@symbiotejs/symbiote 3.9.0 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/README.md +12 -0
  2. package/core/AppRouter.js +97 -58
  3. package/core/PubSub.js +42 -11
  4. package/core/Symbiote.js +70 -46
  5. package/core/itemizeProcessor-keyed.js +88 -188
  6. package/core/itemizeProcessor.js +1 -12
  7. package/core/itemizeSetup.js +26 -3
  8. package/core/ownElements.js +1 -4
  9. package/core/resolveTemplate.js +12 -0
  10. package/core/tpl-processors.js +1 -2
  11. package/docs/README.md +2 -0
  12. package/docs/html-app-vs-htmx.md +55 -0
  13. package/docs/lifecycle.md +2 -0
  14. package/docs/list-rendering.md +10 -2
  15. package/docs/pubsub.md +3 -0
  16. package/docs/routing.md +15 -4
  17. package/html-app/BaseClass.js +203 -0
  18. package/html-app/README.md +369 -0
  19. package/html-app/action-data.js +168 -0
  20. package/html-app/actions.js +366 -0
  21. package/html-app/collection-actions.js +104 -0
  22. package/html-app/collection-data.js +234 -0
  23. package/html-app/collection-items.js +45 -0
  24. package/html-app/conditions.js +42 -0
  25. package/html-app/context-data.js +185 -0
  26. package/html-app/context-requests.js +374 -0
  27. package/html-app/context-storage.js +376 -0
  28. package/html-app/declarations.js +55 -0
  29. package/html-app/examples/assets/actions.html +56 -0
  30. package/html-app/examples/assets/collections.html +72 -0
  31. package/html-app/examples/assets/components.html +25 -0
  32. package/html-app/examples/assets/conditional.html +29 -0
  33. package/html-app/examples/assets/data.html +31 -0
  34. package/html-app/examples/assets/guide.html +4 -0
  35. package/html-app/examples/assets/imports.html +11 -0
  36. package/html-app/examples/assets/not-found.html +4 -0
  37. package/html-app/examples/assets/routes.json +58 -0
  38. package/html-app/examples/assets/routing.html +27 -0
  39. package/html-app/examples/assets/state.html +32 -0
  40. package/html-app/examples/assets/storage.html +28 -0
  41. package/html-app/examples/assets/tasks.json +25 -0
  42. package/html-app/examples/full-app.html +147 -0
  43. package/html-app/examples/todo-ref.html +37 -0
  44. package/html-app/fetch-source.js +147 -0
  45. package/html-app/fragment-content.js +29 -0
  46. package/html-app/fragment-source.js +169 -0
  47. package/html-app/index.js +34 -0
  48. package/html-app/initial-data.js +88 -0
  49. package/html-app/pub-map.js +93 -0
  50. package/html-app/router-data.js +50 -0
  51. package/html-app/router-navigation.js +70 -0
  52. package/html-app/storage-revisions.js +130 -0
  53. package/html-app/sym-collection.js +142 -0
  54. package/html-app/sym-component.js +20 -0
  55. package/html-app/sym-conditional.js +141 -0
  56. package/html-app/sym-context.js +176 -0
  57. package/html-app/sym-import.js +218 -0
  58. package/html-app/sym-router.js +107 -0
  59. package/package.json +18 -6
  60. package/scripts/check-html-app-package.js +117 -0
  61. package/scripts/check-html-app-size.js +91 -0
  62. package/scripts/update-exports.js +4 -0
  63. package/skills/symbiote/SKILL.md +64 -15
  64. package/skills/symbiote/agents/openai.yaml +1 -1
  65. package/types/core/AppRouter.d.ts +13 -4
  66. package/types/core/AppRouter.d.ts.map +1 -1
  67. package/types/core/PubSub.d.ts +1 -1
  68. package/types/core/PubSub.d.ts.map +1 -1
  69. package/types/core/Symbiote.d.ts +4 -1
  70. package/types/core/Symbiote.d.ts.map +1 -1
  71. package/types/core/itemizeProcessor-keyed.d.ts.map +1 -1
  72. package/types/core/itemizeProcessor.d.ts.map +1 -1
  73. package/types/core/itemizeSetup.d.ts +1 -0
  74. package/types/core/itemizeSetup.d.ts.map +1 -1
  75. package/types/core/ownElements.d.ts +1 -1
  76. package/types/core/ownElements.d.ts.map +1 -1
  77. package/types/core/resolveTemplate.d.ts +2 -0
  78. package/types/core/resolveTemplate.d.ts.map +1 -0
  79. package/types/core/tpl-processors.d.ts.map +1 -1
  80. package/types/html-app/BaseClass.d.ts +24 -0
  81. package/types/html-app/BaseClass.d.ts.map +1 -0
  82. package/types/html-app/action-data.d.ts +15 -0
  83. package/types/html-app/action-data.d.ts.map +1 -0
  84. package/types/html-app/actions.d.ts +104 -0
  85. package/types/html-app/actions.d.ts.map +1 -0
  86. package/types/html-app/collection-actions.d.ts +12 -0
  87. package/types/html-app/collection-actions.d.ts.map +1 -0
  88. package/types/html-app/collection-data.d.ts +13 -0
  89. package/types/html-app/collection-data.d.ts.map +1 -0
  90. package/types/html-app/collection-items.d.ts +7 -0
  91. package/types/html-app/collection-items.d.ts.map +1 -0
  92. package/types/html-app/conditions.d.ts +5 -0
  93. package/types/html-app/conditions.d.ts.map +1 -0
  94. package/types/html-app/context-data.d.ts +31 -0
  95. package/types/html-app/context-data.d.ts.map +1 -0
  96. package/types/html-app/context-requests.d.ts +97 -0
  97. package/types/html-app/context-requests.d.ts.map +1 -0
  98. package/types/html-app/context-storage.d.ts +102 -0
  99. package/types/html-app/context-storage.d.ts.map +1 -0
  100. package/types/html-app/declarations.d.ts +3 -0
  101. package/types/html-app/declarations.d.ts.map +1 -0
  102. package/types/html-app/fetch-source.d.ts +23 -0
  103. package/types/html-app/fetch-source.d.ts.map +1 -0
  104. package/types/html-app/fragment-content.d.ts +6 -0
  105. package/types/html-app/fragment-content.d.ts.map +1 -0
  106. package/types/html-app/fragment-source.d.ts +14 -0
  107. package/types/html-app/fragment-source.d.ts.map +1 -0
  108. package/types/html-app/index.d.ts +9 -0
  109. package/types/html-app/index.d.ts.map +1 -0
  110. package/types/html-app/initial-data.d.ts +8 -0
  111. package/types/html-app/initial-data.d.ts.map +1 -0
  112. package/types/html-app/pub-map.d.ts +19 -0
  113. package/types/html-app/pub-map.d.ts.map +1 -0
  114. package/types/html-app/router-data.d.ts +4 -0
  115. package/types/html-app/router-data.d.ts.map +1 -0
  116. package/types/html-app/router-navigation.d.ts +3 -0
  117. package/types/html-app/router-navigation.d.ts.map +1 -0
  118. package/types/html-app/storage-revisions.d.ts +11 -0
  119. package/types/html-app/storage-revisions.d.ts.map +1 -0
  120. package/types/html-app/sym-collection.d.ts +16 -0
  121. package/types/html-app/sym-collection.d.ts.map +1 -0
  122. package/types/html-app/sym-component.d.ts +5 -0
  123. package/types/html-app/sym-component.d.ts.map +1 -0
  124. package/types/html-app/sym-conditional.d.ts +10 -0
  125. package/types/html-app/sym-conditional.d.ts.map +1 -0
  126. package/types/html-app/sym-context.d.ts +16 -0
  127. package/types/html-app/sym-context.d.ts.map +1 -0
  128. package/types/html-app/sym-import.d.ts +19 -0
  129. package/types/html-app/sym-import.d.ts.map +1 -0
  130. package/types/html-app/sym-router.d.ts +12 -0
  131. package/types/html-app/sym-router.d.ts.map +1 -0
@@ -0,0 +1,107 @@
1
+ import { AppRouter } from '../core/AppRouter.js';
2
+ import { SymContext } from './sym-context.js';
3
+ import { routingMap } from './router-data.js';
4
+ import { isDataKey } from './initial-data.js';
5
+
6
+ /** @type {SymRouter | undefined} */
7
+ let activeRouter;
8
+
9
+ export class SymRouter extends SymContext {
10
+ init$ = {
11
+ route: null,
12
+ options: null,
13
+ title: null,
14
+ };
15
+ /** @type {AbortController | undefined} */
16
+ #controller;
17
+ /** @type {{ remove(): void } | undefined} */
18
+ #subscription;
19
+
20
+ prepare() {
21
+ if (!this.getAttribute('ctx')?.trim()) {
22
+ throw new TypeError('sym-router requires a ctx name.');
23
+ }
24
+ this.checkOwnership();
25
+ if (this.localCtx.has('routes')) {
26
+ routingMap(this.localCtx.read('routes'));
27
+ } else if (!this.getAttribute('src')?.trim()) {
28
+ throw new TypeError('sym-router requires routes or a JSON src.');
29
+ }
30
+ super.prepare();
31
+ this.localCtx.add('+src', () => {
32
+ // Fragment sources come from the validated map, never URL options.
33
+ let routes = /** @type {ReturnType<typeof routingMap>} */ (AppRouter.appMap);
34
+ return routes[this.$.route]?.src ?? '';
35
+ }, true);
36
+ this.localCtx.add('+params', () => Object.fromEntries(Object.entries(this.$.options ?? {}).filter(([
37
+ key,
38
+ value,
39
+ ]) => isDataKey(key) && (value === null || typeof value === 'string' || typeof value === 'boolean'
40
+ || typeof value === 'number' && Number.isFinite(value)))), true);
41
+ }
42
+
43
+ checkOwnership() {
44
+ if ((activeRouter && activeRouter !== this)
45
+ || (!activeRouter && Object.keys(AppRouter.appMap).length)) {
46
+ throw new TypeError('AppRouter supports one application router; another router already owns it.');
47
+ }
48
+ }
49
+
50
+ connectFoundation() {
51
+ super.connectFoundation();
52
+ if (globalThis.__SYMBIOTE_SSR || !this.isConnected || !this.connectedOnce || this.#controller) {
53
+ return;
54
+ }
55
+ this.checkOwnership();
56
+ this.#controller = new AbortController();
57
+ activeRouter = this;
58
+ this.localCtx.add('__htmlAppNavigate', (route, options) => {
59
+ if (this.isConnected && activeRouter === this && this.#controller) {
60
+ return AppRouter.navigate(route, options);
61
+ }
62
+ }, true);
63
+ let initialized = false;
64
+ this.#subscription = this.sub('routes', () => {
65
+ let routes = routingMap(this.$.routes);
66
+ AppRouter.setRoutingMap(routes, true);
67
+ if (initialized) {
68
+ void AppRouter.notify();
69
+ } else {
70
+ initialized = true;
71
+ AppRouter.initRoutingCtx(this.getAttribute('ctx').trim(), {}, {
72
+ signal: this.#controller.signal,
73
+ });
74
+ }
75
+ }, this.localCtx.has('routes'));
76
+ }
77
+
78
+ /** @param {Record<string, unknown>} data */
79
+ mergeSource(data) {
80
+ if (Object.hasOwn(data, 'routes') || !this.localCtx.has('routes')) {
81
+ routingMap(data.routes);
82
+ }
83
+ super.mergeSource(data);
84
+ }
85
+
86
+ disconnectedCallback() {
87
+ this.#controller?.abort();
88
+ this.#controller = undefined;
89
+ this.#subscription?.remove();
90
+ this.#subscription = undefined;
91
+ this.localCtx.delete('__htmlAppNavigate');
92
+ if (activeRouter === this) {
93
+ AppRouter.removePopstateListener();
94
+ AppRouter.setRoutingMap({}, true);
95
+ activeRouter = undefined;
96
+ }
97
+ super.disconnectedCallback();
98
+ }
99
+
100
+ destroyCallback() {
101
+ this.localCtx.delete('+src');
102
+ this.localCtx.delete('+params');
103
+ super.destroyCallback();
104
+ }
105
+ }
106
+
107
+ export default SymRouter;
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@symbiotejs/symbiote",
4
- "version": "3.9.0",
4
+ "version": "3.10.1",
5
5
  "description": "Symbiote.js - zero-dependency close-to-platform frontend library to build super-powered web components",
6
6
  "author": "team@rnd-pro.com",
7
7
  "license": "MIT",
8
8
  "scripts": {
9
9
  "prepare": "git config core.hooksPath .git-hooks",
10
10
  "types": "rm -rf types && tsc -p dts.cfg.json && node scripts/clean-dts.js && node scripts/update-exports.js",
11
- "prepublishOnly": "npm test",
12
- "pub": "npm test && npm run types && npm publish",
13
- "test:setup": "playwright install chromium && puppeteer browsers install chrome",
11
+ "prepublishOnly": "npm test && npm run size:html-app",
12
+ "pub": "npm publish",
13
+ "test:setup": "playwright install --with-deps chromium firefox webkit && puppeteer browsers install chrome",
14
14
  "test:unit": "node --test test/node/*.test.js",
15
15
  "test:browser": "playwright test",
16
+ "test:html-app": "playwright test --config playwright.html-app.config.js",
17
+ "test:package": "node scripts/check-html-app-package.js",
18
+ "size:html-app": "node scripts/check-html-app-size.js",
16
19
  "test:webmcp:native": "node --test test/browser/webmcp.native.test.js",
17
- "test": "node --test test/node/*.test.js && playwright test && npm run test:webmcp:native"
20
+ "test": "npm run types && npm run test:unit && npm run test:browser && npm run test:webmcp:native && npm run test:package"
18
21
  },
19
22
  "files": [
20
23
  "core/*",
@@ -25,7 +28,8 @@
25
28
  "docs/*",
26
29
  "README.md",
27
30
  "LICENSE",
28
- "skills/"
31
+ "skills/",
32
+ "html-app/"
29
33
  ],
30
34
  "module": "./core/index.js",
31
35
  "types": "./types/core/index.d.ts",
@@ -48,6 +52,10 @@
48
52
  "./node": {
49
53
  "default": "./node/index.js"
50
54
  },
55
+ "./html-app": {
56
+ "types": "./types/html-app/index.d.ts",
57
+ "default": "./html-app/index.js"
58
+ },
51
59
  "./core/AppRouter.js": {
52
60
  "types": "./types/core/AppRouter.d.ts",
53
61
  "default": "./core/AppRouter.js"
@@ -108,6 +116,10 @@
108
116
  "types": "./types/core/parseProp.d.ts",
109
117
  "default": "./core/parseProp.js"
110
118
  },
119
+ "./core/resolveTemplate.js": {
120
+ "types": "./types/core/resolveTemplate.d.ts",
121
+ "default": "./core/resolveTemplate.js"
122
+ },
111
123
  "./core/slotProcessor.js": {
112
124
  "types": "./types/core/slotProcessor.d.ts",
113
125
  "default": "./core/slotProcessor.js"
@@ -0,0 +1,117 @@
1
+ import assert from 'node:assert/strict';
2
+ import { execFile } from 'node:child_process';
3
+ import { mkdtemp, mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises';
4
+ import { createServer } from 'node:http';
5
+ import { tmpdir } from 'node:os';
6
+ import { extname, join, resolve, sep } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { promisify } from 'node:util';
9
+ import puppeteer from 'puppeteer';
10
+
11
+ let root = fileURLToPath(new URL('../', import.meta.url));
12
+ let temporary = await mkdtemp(join(tmpdir(), 'symbiote-package-'));
13
+ let run = promisify(execFile);
14
+ let browser;
15
+ let server;
16
+ try {
17
+ let packed = await run('npm', [
18
+ 'pack', '--ignore-scripts', '--json', '--pack-destination', temporary, '--cache', join(temporary, 'cache'),
19
+ ], {
20
+ cwd: root,
21
+ });
22
+ let metadata = JSON.parse(packed.stdout);
23
+ let pack = Array.isArray(metadata) ? metadata[0] : metadata.files ? metadata : Object.values(metadata)[0];
24
+ let paths = new Set(pack.files.map((file) => file.path));
25
+ for (let module of await readdir(join(root, 'html-app'))) {
26
+ if (module.endsWith('.js')) {
27
+ assert.ok(paths.has('html-app/' + module), 'Missing runtime module: ' + module);
28
+ assert.ok(paths.has('types/html-app/' + module.replace(/\.js$/, '.d.ts')), 'Missing declaration: ' + module);
29
+ }
30
+ }
31
+ let consumer = join(temporary, 'consumer');
32
+ await mkdir(consumer);
33
+ await writeFile(join(consumer, 'package.json'), '{"private":true,"type":"module"}');
34
+ await run('npm', [
35
+ 'install', '--offline', '--ignore-scripts', '--omit=optional', '--legacy-peer-deps',
36
+ '--no-audit', '--no-fund', '--cache', join(temporary, 'cache'), join(temporary, pack.filename),
37
+ ], {
38
+ cwd: consumer,
39
+ });
40
+ let installed = join(consumer, 'node_modules/@symbiotejs/symbiote');
41
+ let manifest = JSON.parse(await readFile(join(installed, 'package.json'), 'utf8'));
42
+ await readFile(resolve(installed, manifest.exports['./html-app'].default));
43
+ await readFile(resolve(installed, manifest.exports['./html-app'].types));
44
+ let routes = JSON.parse(await readFile(join(installed, 'html-app/examples/assets/routes.json'), 'utf8'));
45
+ for (let route of Object.values(routes.routes)) {
46
+ await readFile(resolve(installed, 'html-app/examples', route.src));
47
+ }
48
+ await writeFile(join(consumer, 'smoke.ts'),
49
+ "import { SymContext, SymCollection, SymRouter } from '@symbiotejs/symbiote/html-app';\n"
50
+ + 'let context: SymContext = new SymContext();\n'
51
+ + 'let collection: SymCollection = new SymCollection();\n'
52
+ + 'let router: SymRouter = new SymRouter();\n'
53
+ + 'void [context, collection, router];\n');
54
+ await run(process.execPath, [
55
+ join(root, 'node_modules/typescript/bin/tsc'), '--noEmit', '--module', 'nodenext', '--target', 'es2022',
56
+ '--lib', 'es2022,dom', 'smoke.ts',
57
+ ], {
58
+ cwd: consumer,
59
+ });
60
+ let mime = {
61
+ '.js': 'text/javascript',
62
+ '.html': 'text/html',
63
+ '.json': 'application/json',
64
+ };
65
+ server = createServer(async (request, response) => {
66
+ let pathname = new URL(request.url, 'http://localhost').pathname;
67
+ if (pathname === '/') {
68
+ response.writeHead(200, {
69
+ 'Content-Type': 'text/html',
70
+ }).end('<!doctype html><html><body></body></html>');
71
+ return;
72
+ }
73
+ let path = resolve(installed, '.' + decodeURIComponent(pathname));
74
+ if (!path.startsWith(installed + sep)) {
75
+ response.writeHead(403).end();
76
+ return;
77
+ }
78
+ try {
79
+ let content = await readFile(path);
80
+ response.writeHead(200, {
81
+ 'Content-Type': mime[extname(path)] ?? 'text/plain',
82
+ }).end(content);
83
+ } catch {
84
+ response.writeHead(404).end();
85
+ }
86
+ });
87
+ await new Promise((ready) => server.listen(0, '127.0.0.1', ready));
88
+ let origin = 'http://127.0.0.1:' + server.address().port;
89
+ browser = await puppeteer.launch();
90
+ let page = await browser.newPage();
91
+ let errors = [];
92
+ page.on('pageerror', (error) => errors.push(error.message));
93
+ await page.goto(origin);
94
+ assert.equal(await page.evaluate(async () => {
95
+ await import('/core/index.js');
96
+ return !customElements.get('sym-context');
97
+ }), true);
98
+ await page.goto(origin + '/html-app/examples/todo-ref.html');
99
+ await page.locator('form input').fill('Installed task');
100
+ await page.locator('form button').click();
101
+ await page.waitForFunction(() => document.querySelector('li input:not([type="checkbox"])')?.value === 'Installed task');
102
+ await page.locator('li input[type="checkbox"]').click();
103
+ assert.equal(await page.$eval('li input[type="checkbox"]', (input) => input.checked), true);
104
+ await page.locator('li button').click();
105
+ await page.waitForFunction(() => !document.querySelector('li'));
106
+ assert.deepEqual(errors, []);
107
+ console.log('HTML-app packed exports, declarations, example assets and installed Todo passed.');
108
+ } finally {
109
+ await browser?.close();
110
+ if (server) {
111
+ await new Promise((done) => server.close(done));
112
+ }
113
+ await rm(temporary, {
114
+ recursive: true,
115
+ force: true,
116
+ });
117
+ }
@@ -0,0 +1,91 @@
1
+ import assert from 'node:assert/strict';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { resolve } from 'node:path';
4
+ import { gzipSync } from 'node:zlib';
5
+ import { build } from 'esbuild';
6
+
7
+ let root = fileURLToPath(new URL('../', import.meta.url));
8
+ let options = {
9
+ absWorkingDir: root,
10
+ bundle: true,
11
+ minify: true,
12
+ format: 'esm',
13
+ platform: 'browser',
14
+ write: false,
15
+ metafile: true,
16
+ };
17
+ let core = await build({
18
+ ...options,
19
+ entryPoints: [
20
+ 'core/index.js',
21
+ ],
22
+ });
23
+ assert.ok(Object.keys(core.metafile.inputs).every((path) => !path.startsWith('html-app/')),
24
+ 'The core entry must not import HTML-app.');
25
+ let sharedCore = new Set(Object.keys(core.metafile.inputs).map((path) => resolve(root, path)));
26
+ /** @type {import('esbuild').Plugin} */
27
+ let sharedImports = {
28
+ name: 'shared-host-core',
29
+ setup(plugin) {
30
+ plugin.onResolve({
31
+ filter: /^\.\.?\//,
32
+ }, (args) => {
33
+ let path = resolve(args.resolveDir, args.path);
34
+ if (sharedCore.has(path) || path === resolve(root, 'core/webmcp.js')) {
35
+ return {
36
+ path: args.path,
37
+ external: true,
38
+ };
39
+ }
40
+ });
41
+ },
42
+ };
43
+ let incremental = await build({
44
+ ...options,
45
+ entryPoints: [
46
+ 'html-app/index.js',
47
+ ],
48
+ plugins: [
49
+ sharedImports,
50
+ ],
51
+ });
52
+ let foundation = await build({
53
+ ...options,
54
+ entryPoints: [
55
+ 'html-app/index.js',
56
+ ],
57
+ external: [
58
+ '../core/*',
59
+ ],
60
+ });
61
+ let router = await build({
62
+ ...options,
63
+ entryPoints: [
64
+ 'core/AppRouter.js',
65
+ ],
66
+ external: [
67
+ './PubSub.js',
68
+ './warn.js',
69
+ ],
70
+ });
71
+ /** @param {{ outputFiles: import('esbuild').OutputFile[] }} result */
72
+ let measure = (result) => ({
73
+ minified: result.outputFiles[0].contents.length,
74
+ gzip: gzipSync(result.outputFiles[0].contents).length,
75
+ });
76
+ let bytes = measure(incremental);
77
+ console.log(JSON.stringify({
78
+ incremental: bytes,
79
+ foundationOnly: measure(foundation),
80
+ sourceBytes: Object.values(incremental.metafile.inputs).reduce((total, input) => total + input.bytes, 0),
81
+ nativeRouter: measure(router),
82
+ coreIndependent: true,
83
+ modules: Object.entries(incremental.metafile.inputs).map(([
84
+ path,
85
+ input,
86
+ ]) => ({
87
+ path,
88
+ bytes: input.bytes,
89
+ imports: input.imports.map((dependency) => dependency.path),
90
+ })),
91
+ }, null, 2));
@@ -40,6 +40,10 @@ async function run() {
40
40
  './node': {
41
41
  default: './node/index.js',
42
42
  },
43
+ './html-app': {
44
+ types: './types/html-app/index.d.ts',
45
+ default: './html-app/index.js',
46
+ },
43
47
  };
44
48
 
45
49
  for (let dir of DIRS) {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: symbiote
3
- description: Build, debug, and review Symbiote.js Web Components using Runtime Agnostic Templates, reactive state and context bindings, Itemize lists, SSR, and optional WebMCP integration. Use when a project uses @symbiotejs/symbiote or the user requests Symbiote.js.
3
+ description: Build, debug, and review Symbiote.js components and HTML-only applications with the optional HTML-app foundation, RAT templates, reactive contexts, Itemize, SSR, and WebMCP. Use when a project uses @symbiotejs/symbiote or the user requests Symbiote.js or its HTML-app foundation.
4
4
  license: MIT
5
5
  ---
6
6
 
@@ -8,6 +8,36 @@ license: MIT
8
8
 
9
9
  Use Symbiote's native Custom Elements and named bindings to implement the requested UI. Match the project's installed version, imports, component structure, and rendering mode. Consult its source and docs when they differ from this guide; do not migrate unrelated components or introduce a build system just to use Symbiote.
10
10
 
11
+ ## HTML-only applications and components
12
+
13
+ When the installed version provides `@symbiotejs/symbiote/html-app`, read the [HTML-app guide](https://github.com/symbiotejs/symbiote.js/blob/main/html-app/README.md) for its contracts. For supported interactions, reuse its elements, declarative actions and templates instead of generating equivalent event handlers or state helpers. Keep an existing project's component model; use ordinary Symbiote classes for behavior that needs application JavaScript.
14
+
15
+ Load the optional entry through an external module script, or import it into an existing module. The core entry alone does not register the foundation. Applications can use HTML and inert JSON without application-defined JavaScript or a build step.
16
+
17
+ - Declare local or named state with `sym-context` and one direct JSON data script. Native `bind="$: APP/record"` merges incoming state; `pub-to` publishes an edited object back, and `pub-map` publishes selected outputs. These remain explicit directions of data flow.
18
+ - Create reusable custom elements with `sym-component reg="..."`, using an inline template or native `use-template`. Each instance has its own state and defaults. Reuse declarations and templates to keep generated markup compact.
19
+ - Use `sym-collection data="APP/items"` with native Itemize for record arrays, `sym-conditional` for conditional content and `sym-router` for declarative navigation. Follow the guide's supported actions and stable record-ID contract rather than inventing expressions or action syntax.
20
+ - Compose portable HTML chunks with `sym-import src="..."`. Bind incoming data and publish outputs explicitly. Keep shared context providers outside sections that are replaced; let nested components own their local state. Treat imports as trusted application templates, not arbitrary external content.
21
+ - JSON loading, local edits and saving are separate: `sym-context src` loads defaults; `[persist]APP` and `[restore]APP` use explicitly configured browser storage; `[sync]APP` writes to a configured HTTP endpoint. Local edits do not write to the source URL. Read the guide before choosing reload or overwrite behavior.
22
+
23
+ A reusable component can include its behavior entirely in HTML:
24
+
25
+ ```html
26
+ <sym-component reg="expand-note">
27
+ <template>
28
+ <script type="application/json">{"expanded":false}</script>
29
+ <button type="button" bind="onclick: [toggle]expanded">Details</button>
30
+ <sym-conditional when="^expanded"><p>Reusable content.</p></sym-conditional>
31
+ </template>
32
+ </sym-component>
33
+
34
+ <expand-note></expand-note>
35
+ ```
36
+
37
+ Markdown prose and interactive chunks can share a document when the host loads HTML-app and its Markdown renderer preserves trusted custom elements, binding attributes and inert JSON. HTML-app does not parse Markdown itself. Preserve the host's content-trust and sanitization rules. Reusing built-in actions can reduce output tokens spent on handler and state-management boilerplate; savings depend on the workflow, so do not invent benchmark figures.
38
+
39
+ Start from the [compact Todo](https://github.com/symbiotejs/symbiote.js/blob/main/html-app/examples/todo-ref.html) or [feature guide](https://github.com/symbiotejs/symbiote.js/blob/main/html-app/examples/full-app.html). Use the [htmx comparison](https://github.com/symbiotejs/symbiote.js/blob/main/docs/html-app-vs-htmx.md) when choosing between reactive records and server-returned HTML; it does not imply an automatic integration.
40
+
11
41
  ## Component and template model
12
42
 
13
43
  Import `Symbiote`, `html`, and optionally `css` or `PubSub` from `@symbiotejs/symbiote`. A component extends `Symbiote`, assigns a static template, and registers a hyphenated tag with `Component.reg('my-component')`.
@@ -18,31 +48,37 @@ Runtime Agnostic Templates (RAT) are plain HTML strings. They describe markup an
18
48
  import Symbiote, { html } from '@symbiotejs/symbiote';
19
49
 
20
50
  class ClickCounter extends Symbiote {
21
- init$ = { count: 0 };
51
+ init$ = {
52
+ count: 0,
53
+ };
22
54
 
23
- increment() {
55
+ // count = 0; - optional fallback property setting
56
+ increment() { // - also fallback property setting
24
57
  this.$.count++;
25
58
  }
26
59
  }
27
60
 
28
61
  ClickCounter.template = html`
29
- <output ${{textContent: 'count'}}></output>
62
+ <output>{{count}}</output>
30
63
  <button ${{onclick: 'increment'}}>Increment</button>
31
64
  `;
32
65
  ClickCounter.reg('click-counter');
33
66
  ```
34
67
 
68
+ When a template references a key missing from state, fallback registers the matching class field or method in `$`, binding functions to the component instance. This lets `count = 0` replace `init$.count` and exposes `increment()` as a handler without an `init$` entry. Existing state values take precedence; publish later changes through `$`.
69
+
35
70
  Binding maps have DOM property names on the left and state keys on the right. `html` turns `${{onclick: 'increment'}}` into `bind="onclick:increment;"`. A plain HTML template can use that `bind` attribute directly. String and number interpolations concatenate into HTML without escaping; use state bindings for dynamic text.
36
71
 
37
72
  | Need | Binding |
38
73
  | --- | --- |
39
74
  | Reactive text | `${{textContent: 'label'}}` |
40
- | Client-only text token | `{{label}}` |
75
+ | Client-only reactive text token | `{{label}}` |
41
76
  | Event handler | `${{onclick: 'onSave'}}` |
42
77
  | DOM property | `${{value: 'query'}}` |
43
- | Boolean HTML attribute | `${{'@disabled': 'busy'}}` |
78
+ | Boolean HTML attribute | `${{'@disabled': 'isBusy'}}` |
79
+ | Text HTML attribute | `${{'@data-text': 'attrVal'}}` |
44
80
  | Nested DOM property | `${{'style.color': 'color'}}` |
45
- | One child state property | `${{'$.label': 'label'}}` |
81
+ | Child state property | `${{'$.label': 'label'}}` |
46
82
  | Merge an object into child state | `${{$: 'profile'}}` |
47
83
 
48
84
  Input bindings update the DOM from state. Add an input/change handler to publish user edits back into state; there is no implicit two-way binding. Use `textContent` bindings for SSR/ISO hydration: `{{prop}}` text tokens do not leave hydration markers.
@@ -65,16 +101,23 @@ Assigning `$` on an already constructed, disconnected component registers local
65
101
  import Symbiote, { html } from '@symbiotejs/symbiote';
66
102
 
67
103
  class ProfileCard extends Symbiote {
68
- init$ = { name: '', role: 'Reader' };
104
+ init$ = {
105
+ name: '',
106
+ role: 'Reader',
107
+ };
69
108
  }
70
109
  ProfileCard.template = html`
71
- <strong ${{textContent: 'name'}}></strong>
72
- <span ${{textContent: 'role'}}></span>
110
+ <strong>{{name}}</strong>
111
+ <span>{{role}}</span>
73
112
  `;
74
113
  ProfileCard.reg('profile-card');
75
114
 
76
115
  class ProfilePanel extends Symbiote {
77
- init$ = { profile: { name: 'Alex' } };
116
+ init$ = {
117
+ profile: {
118
+ name: 'Alex',
119
+ },
120
+ };
78
121
  }
79
122
  ProfilePanel.template = html`
80
123
  <profile-card ${{$: 'profile'}}></profile-card>
@@ -118,7 +161,7 @@ Use `Component.rootStyles = css` for regular Light DOM styles and `Component.sha
118
161
 
119
162
  For SSR, use the `@symbiotejs/symbiote/node` entrypoint and the optional `linkedom` dependency. Initialize `SSR` before dynamically importing component modules, because those modules extend `HTMLElement`. Clean up an explicitly initialized SSR environment after use. `ssrMode` attaches bindings to existing markup; `isoMode` selects hydration when content exists and normal rendering otherwise. Read the SSR reference for concurrency, streaming, and styles.
120
163
 
121
- For agent-accessible UI, import `@symbiotejs/symbiote/webmcp` before rendering participating components. `mcpToolMode` enables automatic event-handler tools; global activation exposes handlers across the application. Explicit `ToolDescriptor` state values register independently, so leave automatic mode disabled when exposing only selected actions. `ToolDescriptor` adds descriptions, input schemas, `execute`, and optional `when`/`deps`. Visibility dependencies must be explicit.
164
+ For HTML-app, use `webmcp-mode="true"` on its external module loader to enable automatic tools for foundation components without activating them globally. For ordinary Symbiote components, import `@symbiotejs/symbiote/webmcp` before rendering participating components. `mcpToolMode` enables automatic event-handler tools; global activation exposes handlers across the application. Explicit `ToolDescriptor` state values register independently, so leave automatic mode disabled when exposing only selected actions. `ToolDescriptor` adds descriptions, input schemas, `execute`, and optional `when`/`deps`. Visibility dependencies must be explicit.
122
165
 
123
166
  Use `getActiveWebMCPTools()` to discover current registrations and `executeWebMCPTool(name, input)` to invoke the chosen tool within the user's authorized task. Rediscover after UI changes. Handle returned errors and verify the resulting UI or data state. Discovery and visibility are not authorization; the application or transport must enforce access controls and validate input.
124
167
 
@@ -134,15 +177,21 @@ Use `getActiveWebMCPTools()` to discover current registrations and `executeWebMC
134
177
 
135
178
  Check behavior at the boundary being changed: initial render, user events, subsequent state publications, and lifecycle transitions. For object bindings, verify omitted values survive, new keys become reactive, and children keep their state proxy. Exercise hydration or WebMCP only when the task uses them.
136
179
 
137
- In the Symbiote source repository, `npm run test:unit` runs Node tests and `npm run test:browser -- test/browser/symbiote.browser.js` runs the component browser tests. `npm run test:webmcp:native` covers native WebMCP. Use the host project's own scripts in consuming applications. Test dependency setup is separate from publishing.
180
+ Use the host project's existing validation commands. For HTML-app, exercise the actual declared actions and their data targets, including form submission, record updates and any configured saving. Check imported chunks in their consuming context and verify that the Markdown host preserves active markup when that mode is used.
138
181
 
139
- Read only the documentation needed for the task. Prefer matching local files under the project's Symbiote source or `node_modules/@symbiotejs/symbiote/docs/`; otherwise these maintained references are available:
182
+ Read only the documentation needed for the task. Prefer matching files in the project's installed package or Symbiote checkout, including `html-app/README.md` and `docs/`; otherwise these maintained references are available:
140
183
 
184
+ - [Get started](https://github.com/symbiotejs/symbiote.js/blob/main/docs/get-started.md) and [ecosystem](https://github.com/symbiotejs/symbiote.js/blob/main/docs/ecosystem.md): installation, first components, IDE setup, and build tools.
141
185
  - [Templates](https://github.com/symbiotejs/symbiote.js/blob/main/docs/templates.md) and [properties](https://github.com/symbiotejs/symbiote.js/blob/main/docs/properties.md): binding syntax, bulk state, and computed values.
142
186
  - [Context](https://github.com/symbiotejs/symbiote.js/blob/main/docs/context.md) and [PubSub](https://github.com/symbiotejs/symbiote.js/blob/main/docs/pubsub.md): shared or named state ownership.
143
187
  - [Lists](https://github.com/symbiotejs/symbiote.js/blob/main/docs/list-rendering.md): Itemize and identity-preserving updates.
188
+ - [Lifecycle](https://github.com/symbiotejs/symbiote.js/blob/main/docs/lifecycle.md), [flags](https://github.com/symbiotejs/symbiote.js/blob/main/docs/flags.md), and [attributes](https://github.com/symbiotejs/symbiote.js/blob/main/docs/attributes.md): callbacks, destruction, component configuration, and attribute observation.
189
+ - [Styling](https://github.com/symbiotejs/symbiote.js/blob/main/docs/styling.md) and [CSS data](https://github.com/symbiotejs/symbiote.js/blob/main/docs/css-data.md): Light DOM and Shadow DOM styles, CSS processing, and CSS custom properties as state.
190
+ - [Routing](https://github.com/symbiotejs/symbiote.js/blob/main/docs/routing.md) and [animations](https://github.com/symbiotejs/symbiote.js/blob/main/docs/animations.md): SPA paths, guards, lazy loading, and exit transitions.
144
191
  - [SSR](https://github.com/symbiotejs/symbiote.js/blob/main/docs/ssr.md) and [WebMCP](https://github.com/symbiotejs/symbiote.js/blob/main/docs/webmcp.md): optional integrations and their limits.
192
+ - [SSR and your server setup](https://github.com/symbiotejs/symbiote.js/blob/main/docs/ssr-server.md): static builds, streaming, and Express or Fastify integration.
193
+ - [Dev mode](https://github.com/symbiotejs/symbiote.js/blob/main/docs/dev-mode.md) and [TypeScript](https://github.com/symbiotejs/symbiote.js/blob/main/docs/typescript.md): diagnostic warnings, JSDoc types, and template checks.
145
194
  - [Security](https://github.com/symbiotejs/symbiote.js/blob/main/docs/security.md): template trust, CSP, and agent-facing boundaries.
146
195
  - [Common mistakes](https://github.com/symbiotejs/symbiote.js/blob/main/docs/common-mistakes.md): diagnosing binding and lifecycle failures.
147
196
  - [Examples](https://github.com/symbiotejs/symbiote.js/blob/main/docs/examples.md): complete code examples for components, contexts, lists, hydration, styling, and routing; read the relevant example when implementing a feature.
148
- - [Documentation index](https://github.com/symbiotejs/symbiote.js/blob/main/docs/README.md): routing, flags, attributes, styling, TypeScript, and further examples.
197
+ - [Documentation index](https://github.com/symbiotejs/symbiote.js/blob/main/docs/README.md): full documentation overview and additional resources.
@@ -1,3 +1,3 @@
1
1
  interface:
2
2
  display_name: "Symbiote.js"
3
- short_description: "Build and debug Symbiote.js Web Components"
3
+ short_description: "Build Symbiote components and HTML-only applications"
@@ -11,11 +11,18 @@ export class AppRouter {
11
11
  };
12
12
  static setDefaultTitle(title: string | (() => string)): void;
13
13
  static setRoutingMap(map: {
14
- [x: string]: {};
15
- }): void;
14
+ [x: string]: {
15
+ title?: string | (() => string);
16
+ default?: boolean;
17
+ error?: boolean;
18
+ pattern?: string;
19
+ load?: () => Promise<any>;
20
+ __loaded?: boolean;
21
+ };
22
+ }, replace?: boolean): void;
16
23
  static set routingEventName(name: string);
17
24
  static get routingEventName(): string;
18
- static readAddressBar(): {
25
+ static readAddressBar(address?: Pick<Location, "search" | "pathname">): {
19
26
  route: any;
20
27
  options: {};
21
28
  };
@@ -25,7 +32,7 @@ export class AppRouter {
25
32
  }): void;
26
33
  static navigate(route: string, options?: {
27
34
  [x: string]: any;
28
- }): void;
35
+ }): Promise<void>;
29
36
  static beforeRoute(fn: (to: {
30
37
  route: string;
31
38
  options: {
@@ -48,6 +55,8 @@ export class AppRouter {
48
55
  load?: () => Promise<any>;
49
56
  __loaded?: boolean;
50
57
  };
58
+ }, options?: {
59
+ signal?: AbortSignal;
51
60
  }): PubSub<any>;
52
61
  static removePopstateListener(): void;
53
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AppRouter.d.ts","sourceRoot":"","sources":["../../core/AppRouter.js"],"names":[],"mappings":"AAGA;IA4BE,iCADW,MAAM,IAAI,CACF;IAEnB,uCAAkB;IAElB,8CAAyB;IAEzB;;oBA9Ba,SAAS,CAAC,YAAY,CAAC;;;;mBAIxB,MAAM,OAAO,CAAC,GAAC,CAAC;;;MA0BQ;IAEpC,6BADW;;;;;aAZA;;;;;QAAa,IAAI,KACf,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,GAWhD,CACH;IAEpB,mCADW;;;;;QAAa,IAAI,CACA;IAE5B,kCADW,OAAO,CACU;IAE5B,uCADW,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,CAClC;IAE9B,8CAEC;IAED,2CAEC;IAGD,8BADY,SAAS,CAAC,YAAY,CAAC,QAGlC;IAGD,yCADY,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,UAG9C;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G,SAAS,UAG9C;IAMD;;oBA/Da,SAAS,CAAC,YAAY,CAAC;;;;mBAIxB,MAAM,OAAO,CAAC,GAAC,CAAC;;;iBAyDjB,OAAO,QA6BjB;IAOD;;oBAjGa,SAAS,CAAC,YAAY,CAAC;;;;mBAIxB,MAAM,OAAO,CAAC,GAAC,CAAC;;;;;;;QAqH3B;IAGD,0CAGC;IAGD,sCAEC;IAGD,gCADY,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC;;;MAWhD;IAGD,wCADY,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;;;MAiBnC;IAGD,uCADY,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC;;;MAyBhD;IAMD;;;;;QAFa,OAAO,CAAC,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAS5C;IAGD,iBADc,OAAO,CAAC,IAAI,CAAC,CAyE1B;IAMD;;aA4CC;IAOD;;QAFa,OAAO,CAAC,IAAI,CAAC,CAKzB;IAQD;;;;;aAxUW;;;;;QAAa,IAAI,KACf,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,GAqU1D,MAAM,IAAI,CAUtB;IAGD,wCAGC;IAGD,+BAEC;IAQD;;oBAtXa,SAAS,CAAC,YAAY,CAAC;;;;mBAIxB,MAAM,OAAO,CAAC,GAAC,CAAC;;;iBA+WjB;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,eAuClC;IAED,kDAQC;IAED,sCAIC;CACF;;mBAlbkB,aAAa"}
@@ -14,7 +14,7 @@ export class PubSub<T extends Record<string, unknown>> {
14
14
  multiPub(updObj: T): void;
15
15
  delete(prop: keyof T): void;
16
16
  notify(prop: keyof T, val: any): void;
17
- sub(prop: keyof T, callback: (val: unknown) => void, init?: boolean): {
17
+ sub(prop: keyof T, callback: (val: unknown) => void, init?: boolean, wait?: boolean): {
18
18
  remove: () => void;
19
19
  callback: (val: unknown) => void;
20
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PubSub.d.ts","sourceRoot":"","sources":["../../core/PubSub.js"],"names":[],"mappings":"AAiBA,oBADwC,CAAC,SAA1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE;IA2DrC,oDAFW,GAAC,kBAIX;IAiTD,mBALuC,CAAC,SAA1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,UAC3B,CAAC,QACD,SAAS,MAAM,GACb,MAAM,CAAC,CAAC,CAAC,CAuBrB;IAGD,sBADY,SAAS,MAAM,QAK1B;IAOD,mBAJW,SAAS,MAAM,iCAMzB;IAxWD,oBADY,CAAC,EAWZ;IARG,WAA6B;IAO/B,aADW,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAChB;IAqIxC,WADY,MAAM,CAAC,OAqClB;IAzBK,sBAAuB;IA4B7B,uBAEC;IAOD,uBAHW,OAAO,2BAUjB;IAMD,UAHW,MAAM,CAAC,OACP,OAAO,QAkBjB;IAGD,aADc,CAAC,CAed;IAGD,iBADY,CAAC,QAKZ;IAGD,aADY,MAAM,CAAC,QASlB;IAGD,aADY,MAAM,CAAC,kBAoBlB;IAOD,UAJW,MAAM,CAAC,YACP,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI;;wBAAhB,OAAO,KAAK,IAAI;MAwBhC;IAKD,aAFW,SAAS,MAAM,EAIzB;IAED,WANW,SAAS,MAAM,CAQzB;;CA8CF;;qBAEU,GAAG,CAAC,SAAS,MAAM,cAAS;qBAG5B,GAAG,CAAC,SAAS,MAAM,EAAE,KAAK,UAAU,CAAC"}
1
+ {"version":3,"file":"PubSub.d.ts","sourceRoot":"","sources":["../../core/PubSub.js"],"names":[],"mappings":"AAiBA,oBADwC,CAAC,SAA1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE;IA2DrC,oDAFW,GAAC,kBAIX;IAgVD,mBALuC,CAAC,SAA1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,UAC3B,CAAC,QACD,SAAS,MAAM,GACb,MAAM,CAAC,CAAC,CAAC,CAuBrB;IAGD,sBADY,SAAS,MAAM,QAK1B;IAOD,mBAJW,SAAS,MAAM,iCAMzB;IAvYD,oBADY,CAAC,EAWZ;IARG,WAA6B;IAO/B,aADW,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAChB;IAiJxC,WADY,MAAM,CAAC,OAqClB;IAzBK,sBAAuB;IA4B7B,uBAEC;IAOD,uBAHW,OAAO,2BAejB;IAMD,UAHW,MAAM,CAAC,OACP,OAAO,QAuBjB;IAGD,aADc,CAAC,CAed;IAGD,iBADY,CAAC,QAKZ;IAGD,aADY,MAAM,CAAC,QAgBlB;IAGD,aADY,MAAM,CAAC,kBAqBlB;IAQD,UALW,MAAM,CAAC,YACP,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI;;wBAAhB,OAAO,KAAK,IAAI;MAyBhC;IAKD,aAFW,SAAS,MAAM,EAIzB;IAED,WANW,SAAS,MAAM,CAQzB;;CA8CF;;qBAEU,GAAG,CAAC,SAAS,MAAM,cAAS;qBAG5B,GAAG,CAAC,SAAS,MAAM,EAAE,KAAK,UAAU,CAAC"}
@@ -51,7 +51,9 @@ export class Symbiote<S> extends HTMLElement {
51
51
  get ctxName(): string;
52
52
  get localCtx(): PubSub<any>;
53
53
  get sharedCtx(): PubSub<any>;
54
- sub<T extends keyof S>(prop: T, handler: (value: S[T]) => void, init?: boolean): void;
54
+ sub<T extends keyof S>(prop: T, handler: (value: S[T]) => void, init?: boolean): {
55
+ remove: () => void;
56
+ };
55
57
  notify(prop: string): void;
56
58
  has(prop: string): any;
57
59
  add<T extends keyof S>(prop: string, val: S[T], rewrite?: boolean): void;
@@ -67,6 +69,7 @@ export class Symbiote<S> extends HTMLElement {
67
69
  destroyCallback(): void;
68
70
  destructionDelay: number;
69
71
  disconnectedCallback(): void;
72
+ destroy(): void;
70
73
  attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
71
74
  getCssData(propName: string, silentCheck?: boolean): any;
72
75
  updateCssData: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"Symbiote.d.ts","sourceRoot":"","sources":["../../core/Symbiote.js"],"names":[],"mappings":";;AAqBA,sBADc,CAAC;IAGb,qBADW,oBAAoB,CACX;IAuBpB,cADW,mBAAmB,CACjB;IAGb,4BAA2B;IAG3B,6BADW,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CACxB;IAK5B,iCAEC;IAED,8BAEC;IAkBD,wBAAgB;IAkLhB,iBALwB,CAAC,SAAZ,aAAU,uBAEZ,CAAC,GACC,OAAO,gBAAgB,EAAE,UAAU,GAAG,IAAI,CAItD;IA6TD,qCAA+B;IAyC/B,iDAFa,OAAO,QAAQ,CAkB3B;IAED,wBAKC;IAGD;;aAYC;IAmHD,6BADY,SAAS,aAAa,QAOjC;IAGD,+BADY,SAAS,aAAa,QAOjC;IAGD,8BADY,SAAS,aAAa,EAIjC;IAGD,gCADY,SAAS,aAAa,EAIjC;IAhnBD,cAiCC;IAzJD,sBADW,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAC/B;IAUrB,gCAEC;IAED,qBAAiB;IACjB,uBAAmB;IAiBnB,kBAHW,SAAS,gBAAgB,0BAyFnC;IAzDG,aAAiD;IA8DnD,OADW,CAAC,CACoB;IAEhC;;MAAmC;IAEnC,oBADW,GAAG,CAAC,CAAC,EAAE,EAAE,gBAAgB,gBAAW,EAAE,KAAK,eAAU,KAAK,IAAI,CAAC,CACvC;IAEnC;;MAA8B;IAC9B,kBAAwB;IAExB,qBAAwB;IAExB,sBAAyB;IAEzB,wBAA0B;IAE1B,0BAA6B;IAI7B,iBAAoB;IAEpB,6BAAgC;IAEhC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