From 42ae418bb5727e822867a951409e5ce7720c4d89 Mon Sep 17 00:00:00 2001 From: Talha Mujahid Date: Sun, 21 Apr 2024 07:09:16 +0500 Subject: [PATCH] feat: version updates --- apps/playground/index.html | 13 + apps/playground/package-lock.json | 304 ++++++++++++++++++ apps/playground/package.json | 19 ++ apps/playground/public/vite.svg | 1 + apps/playground/src/Counter.ts | 52 +++ apps/playground/src/main.ts | 6 + apps/playground/src/style.css | 96 ++++++ apps/playground/src/typescript.svg | 1 + apps/playground/src/vite-env.d.ts | 1 + apps/playground/tsconfig.json | 23 ++ examples/basic/package-lock.json | 8 +- packages/create-sonnet/package.json | 2 +- .../templates/basic/package.json | 2 +- .../templates/basic/src/Counter.ts | 4 +- .../create-sonnet/templates/basic/src/main.ts | 2 +- packages/sonnet-core/package.json | 2 +- .../src/abstract/SonnetComponent.ts | 14 +- packages/sonnet-core/src/core/Event.ts | 51 +++ packages/sonnet-core/src/core/SonnetClient.ts | 6 +- packages/sonnet-core/src/core/factory.ts | 20 ++ packages/sonnet-core/src/index.ts | 1 + 21 files changed, 606 insertions(+), 22 deletions(-) create mode 100644 apps/playground/index.html create mode 100644 apps/playground/package-lock.json create mode 100644 apps/playground/package.json create mode 100644 apps/playground/public/vite.svg create mode 100644 apps/playground/src/Counter.ts create mode 100644 apps/playground/src/main.ts create mode 100644 apps/playground/src/style.css create mode 100644 apps/playground/src/typescript.svg create mode 100644 apps/playground/src/vite-env.d.ts create mode 100644 apps/playground/tsconfig.json create mode 100644 packages/sonnet-core/src/core/Event.ts create mode 100644 packages/sonnet-core/src/core/factory.ts diff --git a/apps/playground/index.html b/apps/playground/index.html new file mode 100644 index 0000000..44a9335 --- /dev/null +++ b/apps/playground/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + TS + + +
+ + + diff --git a/apps/playground/package-lock.json b/apps/playground/package-lock.json new file mode 100644 index 0000000..6621508 --- /dev/null +++ b/apps/playground/package-lock.json @@ -0,0 +1,304 @@ +{ + "name": "c-vite", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "c-vite", + "version": "0.0.1", + "dependencies": { + "@sonnetjs/core": "^0.0.14", + "@sonnetjs/html": "^0.0.1" + }, + "devDependencies": { + "typescript": "^5.2.2", + "vite": "^5.2.6" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.20.2", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.13.2", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@sonnetjs/core": { + "version": "0.0.14", + "resolved": "https://registry.npmjs.org/@sonnetjs/core/-/core-0.0.14.tgz", + "integrity": "sha512-+3pbCCUSLzAvNx1Sv/fkOJN7qQXiWRlTAMYesxBg3U6UKuCvq7t3dJqGJEtpOWqRS64fsU553ug6iO2ZqXQ2Hg==", + "dependencies": { + "@sonnetjs/shared": "*" + } + }, + "node_modules/@sonnetjs/dom": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@sonnetjs/dom/-/dom-0.0.1.tgz", + "integrity": "sha512-Vl8PvK/E3Orh1Xa0uPmxXLiBArVE6Q0i+rpTlUPmQCTffBso8YcPLAw4/aFi34qaW81Tp1PJIb8SPEYDWIUOuQ==", + "dependencies": { + "@sonnetjs/shared": "*" + } + }, + "node_modules/@sonnetjs/html": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@sonnetjs/html/-/html-0.0.1.tgz", + "integrity": "sha512-YXdd5YiCzqn2+RywJdiJvPd3nR3kHhtRRvr69/RLvEx9TwTrGOO4VHbQp3t7+UfYZbJwORLu+IBBUK+D6aKAuQ==", + "dependencies": { + "@sonnetjs/dom": "*", + "@sonnetjs/shared": "*" + } + }, + "node_modules/@sonnetjs/shared": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@sonnetjs/shared/-/shared-0.0.1.tgz", + "integrity": "sha512-QxNnYr/ySo/iK7dL1/81LWrOwiXMoLZUcMri+ozOvQ/Q1YOnCSNZ+g0DjhkEoy9c5wnf5w+Wd8CusbqBI17HDA==" + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.11.30", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/esbuild": { + "version": "0.20.2", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.20.2", + "@esbuild/android-arm": "0.20.2", + "@esbuild/android-arm64": "0.20.2", + "@esbuild/android-x64": "0.20.2", + "@esbuild/darwin-arm64": "0.20.2", + "@esbuild/darwin-x64": "0.20.2", + "@esbuild/freebsd-arm64": "0.20.2", + "@esbuild/freebsd-x64": "0.20.2", + "@esbuild/linux-arm": "0.20.2", + "@esbuild/linux-arm64": "0.20.2", + "@esbuild/linux-ia32": "0.20.2", + "@esbuild/linux-loong64": "0.20.2", + "@esbuild/linux-mips64el": "0.20.2", + "@esbuild/linux-ppc64": "0.20.2", + "@esbuild/linux-riscv64": "0.20.2", + "@esbuild/linux-s390x": "0.20.2", + "@esbuild/linux-x64": "0.20.2", + "@esbuild/netbsd-x64": "0.20.2", + "@esbuild/openbsd-x64": "0.20.2", + "@esbuild/sunos-x64": "0.20.2", + "@esbuild/win32-arm64": "0.20.2", + "@esbuild/win32-ia32": "0.20.2", + "@esbuild/win32-x64": "0.20.2" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.7", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/postcss": { + "version": "8.4.38", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.13.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.13.2", + "@rollup/rollup-android-arm64": "4.13.2", + "@rollup/rollup-darwin-arm64": "4.13.2", + "@rollup/rollup-darwin-x64": "4.13.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.13.2", + "@rollup/rollup-linux-arm64-gnu": "4.13.2", + "@rollup/rollup-linux-arm64-musl": "4.13.2", + "@rollup/rollup-linux-powerpc64le-gnu": "4.13.2", + "@rollup/rollup-linux-riscv64-gnu": "4.13.2", + "@rollup/rollup-linux-s390x-gnu": "4.13.2", + "@rollup/rollup-linux-x64-gnu": "4.13.2", + "@rollup/rollup-linux-x64-musl": "4.13.2", + "@rollup/rollup-win32-arm64-msvc": "4.13.2", + "@rollup/rollup-win32-ia32-msvc": "4.13.2", + "@rollup/rollup-win32-x64-msvc": "4.13.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.0", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/typescript": { + "version": "5.4.3", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/vite": { + "version": "5.2.6", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.20.1", + "postcss": "^8.4.36", + "rollup": "^4.13.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + } + } +} diff --git a/apps/playground/package.json b/apps/playground/package.json new file mode 100644 index 0000000..1fd5b2a --- /dev/null +++ b/apps/playground/package.json @@ -0,0 +1,19 @@ +{ + "name": "playground", + "private": true, + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "typescript": "^5.2.2", + "vite": "^5.2.6" + }, + "dependencies": { + "@sonnetjs/core": "*", + "@sonnetjs/html": "*" + } +} \ No newline at end of file diff --git a/apps/playground/public/vite.svg b/apps/playground/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/apps/playground/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/playground/src/Counter.ts b/apps/playground/src/Counter.ts new file mode 100644 index 0000000..4c492f0 --- /dev/null +++ b/apps/playground/src/Counter.ts @@ -0,0 +1,52 @@ +import { SonnetComponent } from '@sonnetjs/core'; +import { a, button, div, h1, img, p } from '@sonnetjs/html'; + +class Counter extends SonnetComponent { + counter = 0; + + public script() { + const counterButton = document.getElementById( + 'counter', + ) as HTMLButtonElement; + counterButton.addEventListener('click', () => { + this.counter += 1; + counterButton.innerText = `count is ${this.counter}`; + }); + } + + public get() { + return div() + .children( + a() + .href('https://vitejs.dev') + .target('blank') + .children( + img() + .src('https://vitejs.dev/logo.svg') + .className('logo') + .alt('Vite Logo') + .get(), + ) + .get(), + h1().innerText('Vite').get(), + div() + .className('card') + .children( + button() + .id('counter') + .type('button') + .innerText(`count is ${this.counter}`) + .className('btn') + .get(), + ) + .get(), + p() + .innerText('Edit src/main.ts and save to test HMR.') + .className('read-the-docs') + .get(), + ) + .get(); + } +} + +export default Counter; diff --git a/apps/playground/src/main.ts b/apps/playground/src/main.ts new file mode 100644 index 0000000..7dfdf29 --- /dev/null +++ b/apps/playground/src/main.ts @@ -0,0 +1,6 @@ +import './style.css'; +import { createApp } from '@sonnetjs/core'; +import Counter from './Counter'; + +const app = createApp(new Counter()); +app.mount('#app'); diff --git a/apps/playground/src/style.css b/apps/playground/src/style.css new file mode 100644 index 0000000..f9c7350 --- /dev/null +++ b/apps/playground/src/style.css @@ -0,0 +1,96 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +#app { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 300ms; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.vanilla:hover { + filter: drop-shadow(0 0 2em #3178c6aa); +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/apps/playground/src/typescript.svg b/apps/playground/src/typescript.svg new file mode 100644 index 0000000..d91c910 --- /dev/null +++ b/apps/playground/src/typescript.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/playground/src/vite-env.d.ts b/apps/playground/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/apps/playground/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/apps/playground/tsconfig.json b/apps/playground/tsconfig.json new file mode 100644 index 0000000..75abdef --- /dev/null +++ b/apps/playground/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/examples/basic/package-lock.json b/examples/basic/package-lock.json index 8b018c5..6621508 100644 --- a/examples/basic/package-lock.json +++ b/examples/basic/package-lock.json @@ -8,7 +8,7 @@ "name": "c-vite", "version": "0.0.1", "dependencies": { - "@sonnetjs/core": "^0.0.13", + "@sonnetjs/core": "^0.0.14", "@sonnetjs/html": "^0.0.1" }, "devDependencies": { @@ -44,9 +44,9 @@ ] }, "node_modules/@sonnetjs/core": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/@sonnetjs/core/-/core-0.0.13.tgz", - "integrity": "sha512-AVHGqgW2TO96NoFCBxI15b5JjNWOaMBHEMU/5syiC90XaZQlZNQZMsupcS0H2Y7Mp0ALZ/l0iGeMJtW3QqOcJQ==", + "version": "0.0.14", + "resolved": "https://registry.npmjs.org/@sonnetjs/core/-/core-0.0.14.tgz", + "integrity": "sha512-+3pbCCUSLzAvNx1Sv/fkOJN7qQXiWRlTAMYesxBg3U6UKuCvq7t3dJqGJEtpOWqRS64fsU553ug6iO2ZqXQ2Hg==", "dependencies": { "@sonnetjs/shared": "*" } diff --git a/packages/create-sonnet/package.json b/packages/create-sonnet/package.json index 8b74b60..b588f28 100644 --- a/packages/create-sonnet/package.json +++ b/packages/create-sonnet/package.json @@ -1,6 +1,6 @@ { "name": "create-sonnet-app", - "version": "0.0.13", + "version": "0.0.14", "description": "", "main": "index.js", "type": "module", diff --git a/packages/create-sonnet/templates/basic/package.json b/packages/create-sonnet/templates/basic/package.json index ce7dd05..1dc70e4 100644 --- a/packages/create-sonnet/templates/basic/package.json +++ b/packages/create-sonnet/templates/basic/package.json @@ -13,7 +13,7 @@ "vite": "^5.2.6" }, "dependencies": { - "@sonnetjs/core": "^0.0.14", + "@sonnetjs/core": "^0.0.15", "@sonnetjs/html": "^0.0.1" } } \ No newline at end of file diff --git a/packages/create-sonnet/templates/basic/src/Counter.ts b/packages/create-sonnet/templates/basic/src/Counter.ts index 4c492f0..e458fc5 100644 --- a/packages/create-sonnet/templates/basic/src/Counter.ts +++ b/packages/create-sonnet/templates/basic/src/Counter.ts @@ -1,4 +1,4 @@ -import { SonnetComponent } from '@sonnetjs/core'; +import { $component, SonnetComponent } from '@sonnetjs/core'; import { a, button, div, h1, img, p } from '@sonnetjs/html'; class Counter extends SonnetComponent { @@ -49,4 +49,4 @@ class Counter extends SonnetComponent { } } -export default Counter; +export default $component(Counter); diff --git a/packages/create-sonnet/templates/basic/src/main.ts b/packages/create-sonnet/templates/basic/src/main.ts index 7dfdf29..3c6a9cb 100644 --- a/packages/create-sonnet/templates/basic/src/main.ts +++ b/packages/create-sonnet/templates/basic/src/main.ts @@ -2,5 +2,5 @@ import './style.css'; import { createApp } from '@sonnetjs/core'; import Counter from './Counter'; -const app = createApp(new Counter()); +const app = createApp(Counter()); app.mount('#app'); diff --git a/packages/sonnet-core/package.json b/packages/sonnet-core/package.json index 3c6a45f..ace9986 100644 --- a/packages/sonnet-core/package.json +++ b/packages/sonnet-core/package.json @@ -1,6 +1,6 @@ { "name": "@sonnetjs/core", - "version": "0.0.14", + "version": "0.0.15", "files": [ "dist" ], diff --git a/packages/sonnet-core/src/abstract/SonnetComponent.ts b/packages/sonnet-core/src/abstract/SonnetComponent.ts index df15f10..5b775ba 100644 --- a/packages/sonnet-core/src/abstract/SonnetComponent.ts +++ b/packages/sonnet-core/src/abstract/SonnetComponent.ts @@ -1,19 +1,9 @@ -export default abstract class SonnetComponent { +export default class SonnetComponent { protected _id: string = ''; protected _index: number = 0; - public components: SonnetComponent[] = []; - constructor() {} - public loadScripts() { - this.script(); - - this.components.forEach((component) => { - component.loadScripts(); - }); - } - public id(id: string) { this._id = id; return this; @@ -24,6 +14,8 @@ export default abstract class SonnetComponent { return this; } + public static script() {} + public script() {} public get(): string | Element { diff --git a/packages/sonnet-core/src/core/Event.ts b/packages/sonnet-core/src/core/Event.ts new file mode 100644 index 0000000..482e35f --- /dev/null +++ b/packages/sonnet-core/src/core/Event.ts @@ -0,0 +1,51 @@ +export class EventEmitter { + private static instance: EventEmitter; + private events: { [eventName: string]: ((...args: unknown[]) => void)[] }; + + private constructor() { + this.events = {}; + } + + static getInstance(): EventEmitter { + if (!EventEmitter.instance) { + EventEmitter.instance = new EventEmitter(); + } + return EventEmitter.instance; + } + + on(eventName: string, listener: (...args: unknown[]) => void) { + if (!this.events[eventName]) { + this.events[eventName] = []; + } + this.events[eventName].push(listener); + } + + once(eventName: string, listener: (...args: unknown[]) => void) { + if (!this.events[eventName]) { + this.events[eventName] = []; + } + if (!this.events[eventName].includes(listener)) { + this.events[eventName].push(listener); + } + } + + off(eventName: string, listener?: (...args: unknown[]) => void) { + const listeners = this.events[eventName]; + if (listeners && !listener) { + delete this.events[eventName]; + } else if (listeners && listener) { + this.events[eventName] = listeners.filter((l) => l !== listener); + } + } + + emit(eventName: string, ...args: unknown[]) { + const listeners = this.events[eventName]; + if (listeners) { + listeners.forEach((listener) => listener(...args)); + } + } + + get length() { + return Object.keys(this.events).length; + } +} diff --git a/packages/sonnet-core/src/core/SonnetClient.ts b/packages/sonnet-core/src/core/SonnetClient.ts index 1338449..5bcb7dc 100644 --- a/packages/sonnet-core/src/core/SonnetClient.ts +++ b/packages/sonnet-core/src/core/SonnetClient.ts @@ -1,6 +1,9 @@ import { isBrowser } from '@sonnetjs/shared'; import SonnetComponent from '../abstract/SonnetComponent'; import { Sonnet } from './Sonnet'; +import { EventEmitter } from './Event'; + +const event = EventEmitter.getInstance(); class SonnetClient extends Sonnet { private _ssr: boolean = false; @@ -26,7 +29,8 @@ class SonnetClient extends Sonnet { } } } - this._component.loadScripts(); + event.emit('script'); + event.off('script'); } } diff --git a/packages/sonnet-core/src/core/factory.ts b/packages/sonnet-core/src/core/factory.ts new file mode 100644 index 0000000..c94cb0f --- /dev/null +++ b/packages/sonnet-core/src/core/factory.ts @@ -0,0 +1,20 @@ +import SonnetComponent from '../abstract/SonnetComponent'; +import { EventEmitter } from './Event'; + +const event = EventEmitter.getInstance(); + +export function $component(component: { + new (args?: T): SonnetComponent; + script(): void; +}) { + return (args?: T) => { + const instance = new component(args); + if (instance.script) { + event.on('script', instance.script.bind(instance)); + } + if (component.script.toString() !== 'script(){}') { + event.once('script', component.script); + } + return instance; + }; +} diff --git a/packages/sonnet-core/src/index.ts b/packages/sonnet-core/src/index.ts index 71a58d6..111482a 100644 --- a/packages/sonnet-core/src/index.ts +++ b/packages/sonnet-core/src/index.ts @@ -1,3 +1,4 @@ export { default as SonnetComponent } from './abstract/SonnetComponent'; export { createApp } from './core/SonnetClient'; +export { $component } from './core/factory'; export { createSSRApp } from './core/SonnetSSR';