Skip to content

Commit

Permalink
feat(vanilla):out of box functions, countor \ newtab timer \ events
Browse files Browse the repository at this point in the history
  • Loading branch information
guocaoyi committed Oct 14, 2023
1 parent 39c641c commit 1179700
Show file tree
Hide file tree
Showing 70 changed files with 1,088 additions and 398 deletions.
5 changes: 1 addition & 4 deletions template-lit-ts/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
<link rel="icon" href="/icons/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chrome Extension + Lit + TS + Vite App - Popup</title>
<link rel="stylesheet" href="./src/index.css" />
</head>
<body>
<lit-popup>
<h1>Vite + Lit</h1>
</lit-popup>
<lit-popup></lit-popup>
<script type="module" src="./src/popup/index.ts"></script>
</body>
</html>
23 changes: 0 additions & 23 deletions template-lit-ts/src/index.css

This file was deleted.

2 changes: 1 addition & 1 deletion template-preact-js/devtools.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

<body>
<div id="app"></div>
<script type="module" src="./src/devtools/index.jsx"></script>
<script type="module" src="./src/devtools/index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-preact-js/newtab.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

<body>
<div id="app"></div>
<script type="module" src="./src/newtab/index.jsx"></script>
<script type="module" src="./src/newtab/index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-preact-js/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/options/index.jsx"></script>
<script type="module" src="/src/options/index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-preact-js/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/popup/index.jsx"></script>
<script type="module" src="/src/popup/index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-preact-js/sidepanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/sidepanel/index.jsx"></script>
<script type="module" src="/src/sidepanel/index.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from 'preact'
import { createElement, render } from 'preact'
import { DevTools } from './DevTools'
import './index.css'

render(<DevTools />, document.getElementById('app'))
render(createElement(DevTools, null), document.getElementById('app'))

chrome.devtools.panels.create('PreactCrx', '', '../../devtools.html', function () {
console.log('devtools panel create')
Expand Down
5 changes: 5 additions & 0 deletions template-preact-js/src/newtab/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Options, render } from 'preact'
import { NewTab } from './NewTab'
import './index.css'

render(Options(NewTab, null), document.getElementById('app'))
5 changes: 0 additions & 5 deletions template-preact-js/src/newtab/index.jsx

This file was deleted.

5 changes: 5 additions & 0 deletions template-preact-js/src/options/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement, render } from 'preact'
import { Options } from './Options'
import './index.css'

render(createElement(Options, null), document.getElementById('app'))
5 changes: 0 additions & 5 deletions template-preact-js/src/options/index.jsx

This file was deleted.

5 changes: 5 additions & 0 deletions template-preact-js/src/popup/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement, render } from 'preact'
import { Popup } from './Popup'
import './index.css'

render(createElement(Popup, null), document.getElementById('app'))
5 changes: 0 additions & 5 deletions template-preact-js/src/popup/index.jsx

This file was deleted.

5 changes: 5 additions & 0 deletions template-preact-js/src/sidepanel/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement, render } from 'preact'
import { SidePanel } from './SidePanel'
import './index.css'

render(createElement(SidePanel, null), document.getElementById('app'))
5 changes: 0 additions & 5 deletions template-preact-js/src/sidepanel/index.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion template-preact-ts/devtools.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

<body>
<div id="app"></div>
<script type="module" src="./src/devtools/index.tsx"></script>
<script type="module" src="./src/devtools/index.ts"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-preact-ts/newtab.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

<body>
<div id="app"></div>
<script type="module" src="./src/newtab/index.tsx"></script>
<script type="module" src="./src/newtab/index.ts"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-preact-ts/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/options/index.tsx"></script>
<script type="module" src="/src/options/index.ts"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-preact-ts/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/popup/index.tsx"></script>
<script type="module" src="/src/popup/index.ts"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-preact-ts/sidepanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/sidepanel/index.tsx"></script>
<script type="module" src="/src/sidepanel/index.ts"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from 'preact'
import { createElement, render } from 'preact'
import { DevTools } from './DevTools'
import './index.css'

render(<DevTools />, document.getElementById('app') as HTMLElement)
render(createElement(DevTools, null), document.getElementById('app') as HTMLElement)

chrome.devtools.panels.create('PreactCrx', '', '../../devtools.html', function () {
console.log('devtools panel create')
Expand Down
5 changes: 5 additions & 0 deletions template-preact-ts/src/newtab/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement, render } from 'preact'
import { NewTab } from './NewTab'
import './index.css'

render(createElement(NewTab, null), document.getElementById('app') as HTMLElement)
5 changes: 0 additions & 5 deletions template-preact-ts/src/newtab/index.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions template-preact-ts/src/options/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement, render } from 'preact'
import { Options } from './Options'
import './index.css'

render(createElement(Options, null), document.getElementById('app') as HTMLElement)
5 changes: 0 additions & 5 deletions template-preact-ts/src/options/index.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions template-preact-ts/src/popup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement, render } from 'preact'
import { Popup } from './Popup'
import './index.css'

render(createElement(Popup, null), document.getElementById('app') as HTMLElement)
5 changes: 0 additions & 5 deletions template-preact-ts/src/popup/index.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions template-preact-ts/src/sidepanel/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement, render } from 'preact'
import { SidePanel } from './SidePanel'
import './index.css'

render(createElement(SidePanel, null), document.getElementById('app') as HTMLElement)
5 changes: 0 additions & 5 deletions template-preact-ts/src/sidepanel/index.tsx

This file was deleted.

File renamed without changes.
89 changes: 49 additions & 40 deletions template-stencil-ts/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,60 @@
* This is an autogenerated file created by the Stencil compiler.
* It contains typing information for all components that exist in this project.
*/
import { HTMLStencilElement, JSXBase } from '@stencil/core/internal'
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
export namespace Components {
interface OptionsRoot {}
interface PopupRoot {}
interface SideRoot {}
interface OptionsRoot {
}
interface PopupRoot {
}
interface SideRoot {
}
}
declare global {
interface HTMLOptionsRootElement extends Components.OptionsRoot, HTMLStencilElement {}
var HTMLOptionsRootElement: {
prototype: HTMLOptionsRootElement
new (): HTMLOptionsRootElement
}
interface HTMLPopupRootElement extends Components.PopupRoot, HTMLStencilElement {}
var HTMLPopupRootElement: {
prototype: HTMLPopupRootElement
new (): HTMLPopupRootElement
}
interface HTMLSideRootElement extends Components.SideRoot, HTMLStencilElement {}
var HTMLSideRootElement: {
prototype: HTMLSideRootElement
new (): HTMLSideRootElement
}
interface HTMLElementTagNameMap {
'options-root': HTMLOptionsRootElement
'popup-root': HTMLPopupRootElement
'side-root': HTMLSideRootElement
}
interface HTMLOptionsRootElement extends Components.OptionsRoot, HTMLStencilElement {
}
var HTMLOptionsRootElement: {
prototype: HTMLOptionsRootElement;
new (): HTMLOptionsRootElement;
};
interface HTMLPopupRootElement extends Components.PopupRoot, HTMLStencilElement {
}
var HTMLPopupRootElement: {
prototype: HTMLPopupRootElement;
new (): HTMLPopupRootElement;
};
interface HTMLSideRootElement extends Components.SideRoot, HTMLStencilElement {
}
var HTMLSideRootElement: {
prototype: HTMLSideRootElement;
new (): HTMLSideRootElement;
};
interface HTMLElementTagNameMap {
"options-root": HTMLOptionsRootElement;
"popup-root": HTMLPopupRootElement;
"side-root": HTMLSideRootElement;
}
}
declare namespace LocalJSX {
interface OptionsRoot {}
interface PopupRoot {}
interface SideRoot {}
interface IntrinsicElements {
'options-root': OptionsRoot
'popup-root': PopupRoot
'side-root': SideRoot
}
}
export { LocalJSX as JSX }
declare module '@stencil/core' {
export namespace JSX {
interface OptionsRoot {
}
interface PopupRoot {
}
interface SideRoot {
}
interface IntrinsicElements {
'options-root': LocalJSX.OptionsRoot & JSXBase.HTMLAttributes<HTMLOptionsRootElement>
'popup-root': LocalJSX.PopupRoot & JSXBase.HTMLAttributes<HTMLPopupRootElement>
'side-root': LocalJSX.SideRoot & JSXBase.HTMLAttributes<HTMLSideRootElement>
"options-root": OptionsRoot;
"popup-root": PopupRoot;
"side-root": SideRoot;
}
}
export { LocalJSX as JSX };
declare module "@stencil/core" {
export namespace JSX {
interface IntrinsicElements {
"options-root": LocalJSX.OptionsRoot & JSXBase.HTMLAttributes<HTMLOptionsRootElement>;
"popup-root": LocalJSX.PopupRoot & JSXBase.HTMLAttributes<HTMLPopupRootElement>;
"side-root": LocalJSX.SideRoot & JSXBase.HTMLAttributes<HTMLSideRootElement>;
}
}
}
}
13 changes: 13 additions & 0 deletions template-vanilla-js/devtools.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/icon/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chrome Extension + Vanilla + JS + Vite</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/devtools/index.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions template-vanilla-js/newtab.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/icon/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chrome Extension + Vanilla + JS + Vite</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/newtab/index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion template-vanilla-js/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/icons/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chrome Extension + Vanilla + JS + Vite App - Options</title>
<title>Chrome Extension + Vanilla + JS + Vite</title>
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion template-vanilla-js/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/icon/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chrome Extension + Vanilla + JS + Vite App - Popup</title>
<title>Chrome Extension + Vanilla + JS + Vite</title>
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion template-vanilla-js/sidepanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/icons/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chrome Extension + Vanilla + JS + Vite App - Side Panel</title>
<title>Chrome Extension + Vanilla + JS</title>
</head>
<body>
<div id="app"></div>
Expand Down
Loading

0 comments on commit 1179700

Please sign in to comment.