@symbiotejs/symbiote 2.0.4 → 2.1.0-alpha.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 (40) hide show
  1. package/core/PubSub.js +15 -0
  2. package/core/Symbiote.js +28 -1
  3. package/core/dictionary.js +0 -1
  4. package/core/index.js +1 -0
  5. package/core/slotProcessor.js +1 -1
  6. package/core/tpl-processors.js +15 -0
  7. package/package.json +14 -5
  8. package/types/core/AppRouter.d.ts +44 -0
  9. package/types/core/AppRouter.d.ts.map +1 -0
  10. package/types/core/PubSub.d.ts +29 -0
  11. package/types/core/PubSub.d.ts.map +1 -0
  12. package/types/core/Symbiote.d.ts +71 -0
  13. package/types/core/Symbiote.d.ts.map +1 -0
  14. package/types/core/css.d.ts +7 -0
  15. package/types/core/css.d.ts.map +1 -0
  16. package/types/core/dictionary.d.ts +23 -0
  17. package/types/core/dictionary.d.ts.map +1 -0
  18. package/types/core/html.d.ts +7 -0
  19. package/types/core/html.d.ts.map +1 -0
  20. package/types/core/index.d.ts +13 -0
  21. package/types/core/index.d.ts.map +1 -0
  22. package/types/core/itemizeProcessor.d.ts +2 -0
  23. package/types/core/itemizeProcessor.d.ts.map +1 -0
  24. package/types/core/slotProcessor.d.ts +3 -0
  25. package/types/core/slotProcessor.d.ts.map +1 -0
  26. package/types/core/tpl-processors.d.ts +3 -0
  27. package/types/core/tpl-processors.d.ts.map +1 -0
  28. package/types/utils/UID.d.ts +4 -0
  29. package/types/utils/UID.d.ts.map +1 -0
  30. package/types/utils/dom-helpers.d.ts +21 -0
  31. package/types/utils/dom-helpers.d.ts.map +1 -0
  32. package/types/utils/kebabToCamel.d.ts +2 -0
  33. package/types/utils/kebabToCamel.d.ts.map +1 -0
  34. package/types/utils/parseCssPropertyValue.d.ts +2 -0
  35. package/types/utils/parseCssPropertyValue.d.ts.map +1 -0
  36. package/types/utils/prepareStyleSheet.d.ts +2 -0
  37. package/types/utils/prepareStyleSheet.d.ts.map +1 -0
  38. package/types/utils/setNestedProp.d.ts +2 -0
  39. package/types/utils/setNestedProp.d.ts.map +1 -0
  40. package/types/symbiote.d.ts +0 -249
package/core/PubSub.js CHANGED
@@ -16,7 +16,10 @@ function cloneObj(obj) {
16
16
  /** @template {Record<string, unknown>} T */
17
17
  export class PubSub {
18
18
 
19
+ /** @type {String | Symbol} */
20
+ #uid;
19
21
  #proxy;
22
+ /** @type {Boolean} */
20
23
  #storeIsProxy;
21
24
 
22
25
  /** @param {T} schema */
@@ -183,6 +186,17 @@ export class PubSub {
183
186
  };
184
187
  }
185
188
 
189
+ /**
190
+ * @param {String | Symbol} uid
191
+ */
192
+ set uid(uid) {
193
+ !this.#uid && (this.#uid = uid);
194
+ }
195
+
196
+ get uid() {
197
+ return this.#uid;
198
+ }
199
+
186
200
  /**
187
201
  * @template {Record<string, unknown>} S
188
202
  * @param {S} schema
@@ -196,6 +210,7 @@ export class PubSub {
196
210
  console.warn('PubSub: context UID "' + uid + '" is already in use');
197
211
  } else {
198
212
  data = new PubSub(schema);
213
+ data.uid = uid;
199
214
  PubSub.globalStore.set(uid, data);
200
215
  }
201
216
  return data;
package/core/Symbiote.js CHANGED
@@ -162,6 +162,8 @@ export class Symbiote extends HTMLElement {
162
162
  this.ctxOwner = false;
163
163
  /** @type {Boolean} */
164
164
  this.isVirtual = false;
165
+ /** @type {Boolean} */
166
+ this.allowTemplateInits = true;
165
167
  }
166
168
 
167
169
  /** @returns {String} */
@@ -341,6 +343,24 @@ export class Symbiote extends HTMLElement {
341
343
  return this.ctxOwner || (this.hasAttribute(DICT.CTX_OWNER_ATTR) && this.getAttribute(DICT.CTX_OWNER_ATTR) !== 'false');
342
344
  }
343
345
 
346
+ initAttributeObserver() {
347
+ if (!this.attributeMutationObserver) {
348
+ this.attributeMutationObserver = new MutationObserver((mutations) => {
349
+ for (let mr of mutations) {
350
+ if (mr.type === 'attributes') {
351
+ let propName = DICT.ATTR_BIND_PX + mr.attributeName;
352
+ if (this.has(propName)) {
353
+ this.$[propName] = this.getAttribute(mr.attributeName);
354
+ }
355
+ }
356
+ }
357
+ });
358
+ this.attributeMutationObserver.observe(this, {
359
+ attributes: true,
360
+ });
361
+ }
362
+ }
363
+
344
364
  #initDataCtx() {
345
365
  /** @type {{ [key: string]: string }} */
346
366
  let attrDesc = this.#super.__attrDesc;
@@ -354,6 +374,9 @@ export class Symbiote extends HTMLElement {
354
374
  for (let prop in this.init$) {
355
375
  if (prop.startsWith(DICT.SHARED_CTX_PX)) {
356
376
  this.sharedCtx.add(prop.replace(DICT.SHARED_CTX_PX, ''), this.init$[prop], this.#ctxOwner);
377
+ } else if (prop.startsWith(DICT.ATTR_BIND_PX)) {
378
+ this.localCtx.add(prop, (this.getAttribute(prop.replace(DICT.ATTR_BIND_PX, '')) || this.init$[prop]));
379
+ this.initAttributeObserver();
357
380
  } else if (prop.includes(DICT.NAMED_CTX_SPLTR)) {
358
381
  let propArr = prop.split(DICT.NAMED_CTX_SPLTR);
359
382
  let ctxName = propArr[0].trim();
@@ -443,10 +466,14 @@ export class Symbiote extends HTMLElement {
443
466
  }
444
467
  this.#disconnectTimeout = window.setTimeout(() => {
445
468
  this.destroyCallback();
469
+ if (this.attributeMutationObserver) {
470
+ this.attributeMutationObserver.disconnect();
471
+ }
446
472
  for (let sub of this.allSubs) {
447
473
  sub.remove();
448
474
  this.allSubs.delete(sub);
449
475
  }
476
+ this.#localCtx && PubSub.deleteCtx(this.#localCtx.uid);
450
477
  for (let proc of this.tplProcessors) {
451
478
  this.tplProcessors.delete(proc);
452
479
  }
@@ -490,7 +517,7 @@ export class Symbiote extends HTMLElement {
490
517
 
491
518
  /** @param {Object<string, string>} desc */
492
519
  static bindAttributes(desc) {
493
- this.observedAttributes = Object.keys(desc);
520
+ this.observedAttributes = [...(this.observedAttributes || []), Object.keys(desc)];
494
521
  /** @private */
495
522
  this.__attrDesc = desc;
496
523
  }
@@ -1,4 +1,3 @@
1
- /** @enum {String} */
2
1
  export const DICT = Object.freeze({
3
2
  // Template data binding attribute:
4
3
  BIND_ATTR: 'bind',
package/core/index.js CHANGED
@@ -6,6 +6,7 @@ export { html } from './html.js';
6
6
  export { css } from './css.js';
7
7
  export { PubSub } from './PubSub.js';
8
8
  export { AppRouter } from './AppRouter.js';
9
+ export { DICT } from './dictionary.js';
9
10
 
10
11
  // Utils:
11
12
  export { UID } from '../utils/UID.js';
@@ -2,7 +2,7 @@ import { DICT } from './dictionary.js';
2
2
 
3
3
  /**
4
4
  * @template {import('./Symbiote.js').Symbiote} T
5
- * @param {DocumentFragment} fr
5
+ * @param {DocumentFragment | T} fr
6
6
  * @param {T} fnCtx
7
7
  */
8
8
  export function slotProcessor(fr, fnCtx) {
@@ -52,6 +52,13 @@ function domBindProcessor(fr, fnCtx) {
52
52
  castType = 'single';
53
53
  valKey = valKey.replace('!', '');
54
54
  }
55
+ if (!fnCtx.has(valKey) && fnCtx.allowTemplateInits) {
56
+ if (valKey.startsWith(DICT.ATTR_BIND_PX)) {
57
+ fnCtx.add(valKey, fnCtx.getAttribute(valKey.replace(DICT.ATTR_BIND_PX, '')));
58
+ } else {
59
+ fnCtx.add(valKey, null);
60
+ }
61
+ }
55
62
  fnCtx.sub(valKey, (val) => {
56
63
  if (castType === 'double') {
57
64
  val = !!val;
@@ -123,6 +130,14 @@ const txtNodesProcessor = function (fr, fnCtx) {
123
130
  tokenNodes.forEach((tNode) => {
124
131
  let prop = tNode.textContent.replace(DICT.TEXT_NODE_OPEN_TOKEN, '').replace(DICT.TEXT_NODE_CLOSE_TOKEN, '');
125
132
  tNode.textContent = '';
133
+ if (!fnCtx.has(prop) && fnCtx.allowTemplateInits) {
134
+ if (prop.startsWith(DICT.ATTR_BIND_PX)) {
135
+ fnCtx.add(prop, fnCtx.getAttribute(prop.replace(DICT.ATTR_BIND_PX, '')));
136
+ fnCtx.initAttributeObserver();
137
+ } else {
138
+ fnCtx.add(prop, null);
139
+ }
140
+ }
126
141
  fnCtx.sub(prop, (val) => {
127
142
  tNode.textContent = val;
128
143
  });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@symbiotejs/symbiote",
4
- "version": "2.0.4",
4
+ "version": "2.1.0-alpha.1",
5
5
  "scripts": {
6
- "types": "tsc -p dts.cfg.json"
6
+ "types": "rm -rf types && tsc -p dts.cfg.json"
7
7
  },
8
8
  "files": [
9
9
  "core/*",
@@ -13,8 +13,17 @@
13
13
  "LICENSE"
14
14
  ],
15
15
  "module": "./core/index.js",
16
- "exports": "./core/index.js",
17
- "types": "./types/symbiote.d.ts",
16
+ "types": "./types/core/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./types/core/index.d.ts",
20
+ "default": "./core/index.js"
21
+ },
22
+ "./core/slotProcessor.js": {
23
+ "types": "./types/core/slotProcessor.d.ts",
24
+ "default": "./core/slotProcessor.js"
25
+ }
26
+ },
18
27
  "publishConfig": {
19
28
  "access": "public"
20
29
  },
@@ -35,4 +44,4 @@
35
44
  "devDependencies": {
36
45
  "typescript": "^5.0.0"
37
46
  }
38
- }
47
+ }
@@ -0,0 +1,44 @@
1
+ export class AppRouter {
2
+ static "__#3@#onPopstate": () => void;
3
+ static "__#3@#separator": string;
4
+ static "__#3@#routingEventName": string;
5
+ static appMap: {
6
+ [x: string]: {
7
+ title?: string;
8
+ default?: boolean;
9
+ error?: boolean;
10
+ };
11
+ };
12
+ static "__#3@#print"(msg: any): void;
13
+ static setDefaultTitle(title: string): void;
14
+ static setRoutingMap(map: {
15
+ [x: string]: {};
16
+ }): void;
17
+ static set routingEventName(arg: string);
18
+ static get routingEventName(): string;
19
+ static readAddressBar(): {
20
+ route: any;
21
+ options: {};
22
+ };
23
+ static notify(): void;
24
+ static reflect(route: string, options?: {
25
+ [x: string]: any;
26
+ }): void;
27
+ static applyRoute(route: string, options?: {
28
+ [x: string]: any;
29
+ }): void;
30
+ static setSeparator(char: string): void;
31
+ static get separator(): string;
32
+ static initRoutingCtx(ctxName: string, routingMap: {
33
+ [x: string]: {
34
+ title?: string;
35
+ default?: boolean;
36
+ error?: boolean;
37
+ };
38
+ }): PubSub<any>;
39
+ static "__#3@#initPopstateListener"(): void;
40
+ static removePopstateListener(): void;
41
+ }
42
+ export default AppRouter;
43
+ import PubSub from './PubSub.js';
44
+ //# sourceMappingURL=AppRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppRouter.d.ts","sourceRoot":"","sources":["../../core/AppRouter.js"],"names":[],"mappings":"AAEA;IAOE,2BADW,MAAM,IAAI,CACF;IAEnB,iCAAkB;IAElB,wCAAyB;IAEzB;;;;;;MAAoC;IAEpC,qCAEC;IAGD,4CAEC;IAGD;YADmB,MAAM,GAAE,EAAE;aAU5B;IAGD,yCAGC;IAGD,sCAEC;IAED;;;MAiBC;IAED,sBA0BC;IAMD;YAFkB,MAAM,GAAE,GAAG;aAmB5B;IAMD;YAFkB,MAAM,GAAE,GAAG;aAK5B;IAGD,wCAGC;IAGD,+BAEC;IAOD;;;;;;oBAoBC;IAED,4CASC;IAED,sCAGC;CACF;;mBArLkB,aAAa"}
@@ -0,0 +1,29 @@
1
+ export class PubSub<T extends Record<string, unknown>> {
2
+ static "__#1@#warn"(actionName: string, prop: any): void;
3
+ static registerCtx<S extends Record<string, unknown>>(schema: S, uid?: string | Symbol): PubSub<S>;
4
+ static deleteCtx(uid: string | Symbol): void;
5
+ static getCtx(uid: string | Symbol, notify?: boolean): PubSub<any>;
6
+ constructor(schema: T);
7
+ store: any;
8
+ callbackMap: Record<keyof T, Set<(val: unknown) => void>>;
9
+ read(prop: keyof T): any;
10
+ private __computedSet;
11
+ has(prop: string): any;
12
+ add(prop: string, val: unknown, rewrite?: boolean): void;
13
+ pub(prop: keyof T, val: unknown): void;
14
+ get proxy(): T;
15
+ multiPub(updObj: T): void;
16
+ notify(prop: keyof T): void;
17
+ sub(prop: keyof T, callback: (val: unknown) => void, init?: boolean): {
18
+ remove: () => void;
19
+ callback: (val: unknown) => void;
20
+ };
21
+ set uid(arg: string | Symbol);
22
+ get uid(): string | Symbol;
23
+ #private;
24
+ }
25
+ export namespace PubSub {
26
+ const globalStore: Map<string | Symbol, PubSub<any>>;
27
+ }
28
+ export default PubSub;
29
+ //# sourceMappingURL=PubSub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PubSub.d.ts","sourceRoot":"","sources":["../../core/PubSub.js"],"names":[],"mappings":"AAgBA;IAyBE,yDAEC;IAkKD,uEAHW,SAAS,MAAM,aAczB;IAGD,sBADY,SAAS,MAAM,QAG1B;IAOD,mBAJW,SAAS,MAAM,iCAMzB;IA7MD,oBADY,CAAC,EAWZ;IARG,WAA6B;IAO/B,uCADoC,OAAO,KAAK,IAAI,GACd;IAYxC,WADY,MAAM,CAAC,OAyBlB;IAXK,sBAA8B;IAcpC,uBAEC;IAOD,uBAHW,OAAO,2BASjB;IAMD,UAHW,MAAM,CAAC,OACP,OAAO,QAkBjB;IAGD,eAcC;IAGD,iBADY,CAAC,QAKZ;IAgBD,aADY,MAAM,CAAC,QASlB;IAOD,UAJW,MAAM,CAAC,kBACD,OAAO,KAAK,IAAI;;wBAAhB,OAAO,KAAK,IAAI;MAwBhC;IAKD,8BAEC;IAED,2BAEC;;CAkCF;;uBAEU,IAAI,SAAS,MAAM,cAAS"}
@@ -0,0 +1,71 @@
1
+ export { html } from "./html.js";
2
+ export { css } from "./css.js";
3
+ export class Symbiote<S> extends HTMLElement {
4
+ static __tpl: HTMLTemplateElement;
5
+ static template: string;
6
+ static "__#2@#parseProp"<T_3 extends Symbiote<any>>(prop: string, fnCtx: T_3): {
7
+ ctx: PubSub<any>;
8
+ name: string;
9
+ };
10
+ static reg(tagName?: string, isAlias?: boolean): void;
11
+ static get is(): string;
12
+ static bindAttributes(desc: {
13
+ [x: string]: string;
14
+ }): void;
15
+ static addRootStyles(styles: string | CSSStyleSheet): void;
16
+ static addShadowStyles(styles: string | CSSStyleSheet): void;
17
+ static set rootStyles(arg: string | CSSStyleSheet);
18
+ static set shadowStyles(arg: string | CSSStyleSheet);
19
+ constructor();
20
+ get Symbiote(): typeof Symbiote;
21
+ initCallback(): void;
22
+ renderCallback(): void;
23
+ render(template?: string | DocumentFragment, shadow?: boolean): void;
24
+ addTemplateProcessor<T extends Symbiote<any>>(processorFn: (fr: DocumentFragment | T, fnCtx: T) => void): void;
25
+ init$: S;
26
+ cssInit$: {
27
+ [x: string]: any;
28
+ };
29
+ tplProcessors: Set<(fr: DocumentFragment | Symbiote<any>, fnCtx: unknown) => void>;
30
+ ref: {
31
+ [x: string]: any;
32
+ };
33
+ allSubs: Set<any>;
34
+ pauseRender: boolean;
35
+ renderShadow: boolean;
36
+ readyToDestroy: boolean;
37
+ processInnerHtml: boolean;
38
+ ssrMode: boolean;
39
+ allowCustomTemplate: boolean;
40
+ ctxOwner: boolean;
41
+ isVirtual: boolean;
42
+ get autoCtxName(): string;
43
+ get cssCtxName(): string;
44
+ get ctxName(): string;
45
+ get localCtx(): PubSub<any>;
46
+ get sharedCtx(): PubSub<any>;
47
+ sub<T_1 extends keyof S>(prop: T_1, handler: (value: S[T_1]) => void, init?: boolean): void;
48
+ notify(prop: string): void;
49
+ has(prop: string): any;
50
+ add<T_2 extends keyof S>(prop: string, val: S[T_2], rewrite?: boolean): void;
51
+ add$(obj: Partial<S>, rewrite?: boolean): void;
52
+ get $(): S;
53
+ set$(kvObj: Partial<S>, forcePrimitives?: boolean): void;
54
+ initChildren: ChildNode[];
55
+ connectedOnce: boolean;
56
+ connectedCallback(): void;
57
+ destroyCallback(): void;
58
+ disconnectedCallback(): void;
59
+ attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
60
+ getCssData(propName: string, silentCheck?: boolean): any;
61
+ updateCssData: () => void;
62
+ bindCssData(propName: string, initValue?: any): void;
63
+ dropCssDataCache(): void;
64
+ defineAccessor(propName: string, handler?: Function, isAsync?: boolean): void;
65
+ #private;
66
+ }
67
+ export default Symbiote;
68
+ import { UID } from '../utils/UID.js';
69
+ import PubSub from './PubSub.js';
70
+ export { UID, PubSub };
71
+ //# sourceMappingURL=Symbiote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Symbiote.d.ts","sourceRoot":"","sources":["../../core/Symbiote.js"],"names":[],"mappings":";;AAgBA;IAsBE,cADW,mBAAmB,CACjB;IAkBb,wBAAgB;IA0JhB;;;MAkCC;IAwND,sDAsBC;IAED,wBAKC;IAGD;YADmB,MAAM,GAAE,MAAM;aAKhC;IA6GD,6BADY,SAAS,aAAa,QAOjC;IAGD,+BADY,SAAS,aAAa,QAOjC;IAGD,mDAGC;IAGD,qDAGC;IA/eD,cA2BC;IA5HD,gCAEC;IAED,qBAAiB;IACjB,uBAAmB;IAiBnB,kBAHW,SAAS,gBAAgB,0BAoEnC;IAMD,mGAFmD,IAAI,QAItD;IAKC,OADW,CAAC,CACoB;IAEhC;YADkB,MAAM;MACW;IAEnC,wBADoB,gBAAgB,gBAAW,SAAS,OAAO,KAAK,IAAI,EAC1C;IAE9B;YADkB,MAAM,GAAE,GAAG;MACC;IAC9B,kBAAwB;IAExB,qBAAwB;IAExB,sBAAyB;IAEzB,wBAA0B;IAE1B,0BAA6B;IAE7B,iBAAoB;IAEpB,6BAAgC;IAEhC,kBAAqB;IAErB,mBAAsB;IAIxB,0BAMC;IAGD,yBAEC;IAGD,sBASC;IAGD,4BAKC;IAGD,6BAEC;IAiDD,gEAH4B,IAAI,wBAmB/B;IAGD,2BAGC;IAGD,uBAGC;IAQD,6EAGC;IAMD,UAHW,QAAQ,CAAC,CAAC,2BAOpB;IAGD,WAgBC;IAMD,YAHW,QAAQ,CAAC,CAAC,mCAcpB;IAiEG,0BAAwC;IAoB1C,uBAAyB;IAG3B,0BAEC;IAED,wBAAoB;IAEpB,6BAuBC;IA4CD,oEAeC;IAMD,yDAiBC;IAYD,0BAME;IAMF,0CAFW,GAAG,QAab;IAED,yBAGC;IAOD,8EAmBC;;CA+BF;;oBAvnBmB,iBAAiB;mBAFlB,aAAa"}
@@ -0,0 +1,7 @@
1
+ export function css(parts: TemplateStringsArray, ...props: any[]): CSSStyleSheet;
2
+ export namespace css {
3
+ const processors: ((cssTxt: string) => string)[];
4
+ function clearProcessors(): void;
5
+ function useProcessor(...args: ((cssTxt: string) => string)[]): typeof css;
6
+ }
7
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../core/css.js"],"names":[],"mappings":"AAKA,2BAJW,oBAAoB,oBAClB,aAAa,CAezB;;;IAKD,iCAEC;IAMD,2EAGC"}
@@ -0,0 +1,23 @@
1
+ export const DICT: Readonly<{
2
+ BIND_ATTR: "bind";
3
+ ATTR_BIND_PX: "@";
4
+ SHARED_CTX_PX: "*";
5
+ PARENT_CTX_PX: "^";
6
+ NAMED_CTX_SPLTR: "/";
7
+ COMPUTED_PX: "+";
8
+ CSS_DATA_PX: "--";
9
+ CTX_NAME_ATTR: "ctx";
10
+ CTX_OWNER_ATTR: "ctx-owner";
11
+ CSS_CTX_PROP: "--ctx";
12
+ EL_REF_ATTR: "ref";
13
+ AUTO_TAG_PX: "sym";
14
+ LIST_ATTR: "itemize";
15
+ LIST_ITEM_TAG_ATTR: "item-tag";
16
+ SET_LATER_KEY: "__toSetLater__";
17
+ USE_TPL_ATTR: "use-template";
18
+ DEFAULT_SLOT_KEY: "__default__";
19
+ TEXT_NODE_SKIP_ATTR: "skip-text-nodes";
20
+ TEXT_NODE_OPEN_TOKEN: "{{";
21
+ TEXT_NODE_CLOSE_TOKEN: "}}";
22
+ }>;
23
+ //# sourceMappingURL=dictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../core/dictionary.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAyCG"}
@@ -0,0 +1,7 @@
1
+ export function html<T>(parts: TemplateStringsArray, ...props: (string | Record<keyof import("./Symbiote.js").Symbiote<any>, string> | T | {
2
+ [x: string]: string;
3
+ })[]): string;
4
+ export const RESERVED_ATTRIBUTES: string[];
5
+ export default html;
6
+ export type BindDescriptor = Record<keyof import("./Symbiote.js").Symbiote<any>, string>;
7
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../core/html.js"],"names":[],"mappings":"AAoBA,+BAJW,oBAAoB;;cAwB9B;AArCD,kCADW,QAAQ,CAQjB;;6BAEY,OAAO,2CAAsC,SAAS"}
@@ -0,0 +1,13 @@
1
+ export { Symbiote };
2
+ export { html } from "./html.js";
3
+ export { css } from "./css.js";
4
+ export { PubSub } from "./PubSub.js";
5
+ export { AppRouter } from "./AppRouter.js";
6
+ export { DICT } from "./dictionary.js";
7
+ export { UID } from "../utils/UID.js";
8
+ export { setNestedProp } from "../utils/setNestedProp.js";
9
+ export { kebabToCamel } from "../utils/kebabToCamel.js";
10
+ export default Symbiote;
11
+ import Symbiote from './Symbiote.js';
12
+ export { applyStyles, applyAttributes, create } from "../utils/dom-helpers.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../core/index.js"],"names":[],"mappings":";;;;;;;;;;qBAAqB,eAAe"}
@@ -0,0 +1,2 @@
1
+ export function itemizeProcessor<T extends import("./Symbiote.js").Symbiote<any>>(fr: DocumentFragment, fnCtx: T): void;
2
+ //# sourceMappingURL=itemizeProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemizeProcessor.d.ts","sourceRoot":"","sources":["../../core/itemizeProcessor.js"],"names":[],"mappings":"AAOA,sFAHW,gBAAgB,kBA4F1B"}
@@ -0,0 +1,3 @@
1
+ export function slotProcessor<T extends import("./Symbiote.js").Symbiote<any>>(fr: DocumentFragment | T, fnCtx: T): void;
2
+ export default slotProcessor;
3
+ //# sourceMappingURL=slotProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slotProcessor.d.ts","sourceRoot":"","sources":["../../core/slotProcessor.js"],"names":[],"mappings":"AAOA,yHAsCC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: (<T extends import("./Symbiote.js").Symbiote<any>>(fr: DocumentFragment, fnCtx: T) => void)[];
2
+ export default _default;
3
+ //# sourceMappingURL=tpl-processors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tpl-processors.d.ts","sourceRoot":"","sources":["../../core/tpl-processors.js"],"names":[],"mappings":"+EAqGW,gBAAgB"}
@@ -0,0 +1,4 @@
1
+ export class UID {
2
+ static generate(pattern?: string): string;
3
+ }
4
+ //# sourceMappingURL=UID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UID.d.ts","sourceRoot":"","sources":["../../utils/UID.js"],"names":[],"mappings":"AAWA;IAKE,0CAMC;CACF"}
@@ -0,0 +1,21 @@
1
+ export function applyStyles<T extends HTMLElement | SVGElement>(el: T, styleMap: StyleMap): void;
2
+ export function applyAttributes<T extends HTMLElement | SVGElement>(el: T, attrMap: AttrMap): void;
3
+ export function create(desc?: ElementDescriptor): any;
4
+ export type StyleMap = {
5
+ [x: string]: string | number | boolean;
6
+ };
7
+ export type AttrMap = {
8
+ [x: string]: string | number | boolean;
9
+ };
10
+ export type PropMap = {
11
+ [x: string]: any;
12
+ };
13
+ export type ElementDescriptor = {
14
+ tag?: string;
15
+ attributes?: AttrMap;
16
+ styles?: StyleMap;
17
+ properties?: PropMap;
18
+ processors?: Function[];
19
+ children?: ElementDescriptor[];
20
+ };
21
+ //# sourceMappingURL=dom-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-helpers.d.ts","sourceRoot":"","sources":["../../utils/dom-helpers.js"],"names":[],"mappings":"AAWA,iFAFW,QAAQ,QAWlB;AAOD,oFAFW,OAAO,QAejB;AAiBD,8BAHW,iBAAiB,GACf,GAAG,CA2Bf;;QAlFoB,MAAM,GAAE,MAAM,GAAG,MAAM,GAAG,OAAO;;;QAEjC,MAAM,GAAE,MAAM,GAAG,MAAM,GAAG,OAAO;;;QAEjC,MAAM,GAAE,GAAG;;gCAuCnB;IACZ,GAAO,CAAC,SAAS;IACjB,UAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,UAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,QAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC"}
@@ -0,0 +1,2 @@
1
+ export function kebabToCamel(string: string): string;
2
+ //# sourceMappingURL=kebabToCamel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kebabToCamel.d.ts","sourceRoot":"","sources":["../../utils/kebabToCamel.js"],"names":[],"mappings":"AACA,qDAYC"}
@@ -0,0 +1,2 @@
1
+ export function parseCssPropertyValue(input: string): string | number;
2
+ //# sourceMappingURL=parseCssPropertyValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseCssPropertyValue.d.ts","sourceRoot":"","sources":["../../utils/parseCssPropertyValue.js"],"names":[],"mappings":"AAoDA,sDAFa,eAAe,CAkC3B"}
@@ -0,0 +1,2 @@
1
+ export function prepareStyleSheet(styles: string | CSSStyleSheet): CSSStyleSheet;
2
+ //# sourceMappingURL=prepareStyleSheet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareStyleSheet.d.ts","sourceRoot":"","sources":["../../utils/prepareStyleSheet.js"],"names":[],"mappings":"AACA,0CADa,SAAS,aAAa,iBAUlC"}
@@ -0,0 +1,2 @@
1
+ export function setNestedProp(parent: any, path: string, value: any): boolean;
2
+ //# sourceMappingURL=setNestedProp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setNestedProp.d.ts","sourceRoot":"","sources":["../../utils/setNestedProp.js"],"names":[],"mappings":"AAKA,sCAJW,GAAG,uBAEH,GAAG,WAoBb"}
@@ -1,249 +0,0 @@
1
- declare module "core/dictionary" {
2
- export type DICT = string;
3
- export const DICT: Readonly<{
4
- BIND_ATTR: "bind";
5
- ATTR_BIND_PX: "@";
6
- SHARED_CTX_PX: "*";
7
- PARENT_CTX_PX: "^";
8
- NAMED_CTX_SPLTR: "/";
9
- COMPUTED_PX: "+";
10
- CSS_DATA_PX: "--";
11
- CTX_NAME_ATTR: "ctx";
12
- CTX_OWNER_ATTR: "ctx-owner";
13
- CSS_CTX_PROP: "--ctx";
14
- EL_REF_ATTR: "ref";
15
- AUTO_TAG_PX: "sym";
16
- LIST_ATTR: "itemize";
17
- LIST_ITEM_TAG_ATTR: "item-tag";
18
- SET_LATER_KEY: "__toSetLater__";
19
- USE_TPL_ATTR: "use-template";
20
- DEFAULT_SLOT_KEY: "__default__";
21
- TEXT_NODE_SKIP_ATTR: "skip-text-nodes";
22
- TEXT_NODE_OPEN_TOKEN: "{{";
23
- TEXT_NODE_CLOSE_TOKEN: "}}";
24
- }>;
25
- }
26
- declare module "core/PubSub" {
27
- export class PubSub<T extends Record<string, unknown>> {
28
- static "__#1@#warn"(actionName: string, prop: any): void;
29
- static registerCtx<S extends Record<string, unknown>>(schema: S, uid?: string | Symbol): PubSub<S>;
30
- static deleteCtx(uid: string | Symbol): void;
31
- static getCtx(uid: string | Symbol, notify?: boolean): PubSub<any>;
32
- constructor(schema: T);
33
- store: any;
34
- callbackMap: Record<keyof T, Set<(val: unknown) => void>>;
35
- read(prop: keyof T): any;
36
- private __computedSet;
37
- has(prop: string): any;
38
- add(prop: string, val: unknown, rewrite?: boolean): void;
39
- pub(prop: keyof T, val: unknown): void;
40
- get proxy(): T;
41
- multiPub(updObj: T): void;
42
- notify(prop: keyof T): void;
43
- sub(prop: keyof T, callback: (val: unknown) => void, init?: boolean): {
44
- remove: () => void;
45
- callback: (val: unknown) => void;
46
- };
47
- #private;
48
- }
49
- export namespace PubSub {
50
- const globalStore: Map<string | Symbol, PubSub<any>>;
51
- }
52
- export default PubSub;
53
- }
54
- declare module "utils/UID" {
55
- export class UID {
56
- static generate(pattern?: string): string;
57
- }
58
- }
59
- declare module "utils/setNestedProp" {
60
- export function setNestedProp(parent: any, path: string, value: any): boolean;
61
- }
62
- declare module "utils/prepareStyleSheet" {
63
- export function prepareStyleSheet(styles: string | CSSStyleSheet): CSSStyleSheet;
64
- }
65
- declare module "core/itemizeProcessor" {
66
- export function itemizeProcessor<T extends import("core/Symbiote").Symbiote<any>>(fr: DocumentFragment, fnCtx: T): void;
67
- }
68
- declare module "core/tpl-processors" {
69
- const _default: (<T extends import("core/Symbiote").Symbiote<any>>(fr: DocumentFragment, fnCtx: T) => void)[];
70
- export default _default;
71
- }
72
- declare module "utils/parseCssPropertyValue" {
73
- export function parseCssPropertyValue(input: string): string | number;
74
- }
75
- declare module "core/html" {
76
- export function html<T>(parts: TemplateStringsArray, ...props: (string | Record<keyof import("core/Symbiote").Symbiote<any>, string> | T | {
77
- [x: string]: string;
78
- })[]): string;
79
- export const RESERVED_ATTRIBUTES: string[];
80
- export default html;
81
- export type BindDescriptor = Record<keyof import("core/Symbiote").Symbiote<any>, string>;
82
- }
83
- declare module "core/css" {
84
- export function css(parts: TemplateStringsArray, ...props: any[]): CSSStyleSheet;
85
- export namespace css {
86
- const processors: ((cssTxt: string) => string)[];
87
- function clearProcessors(): void;
88
- function useProcessor(...args: ((cssTxt: string) => string)[]): typeof css;
89
- }
90
- }
91
- declare module "core/Symbiote" {
92
- export { html } from "./html.js";
93
- export { css } from "./css.js";
94
- export class Symbiote<S> extends HTMLElement {
95
- static __tpl: HTMLTemplateElement;
96
- static template: string;
97
- static "__#2@#parseProp"<T_3 extends Symbiote<any>>(prop: string, fnCtx: T_3): {
98
- ctx: PubSub<any>;
99
- name: string;
100
- };
101
- static reg(tagName?: string, isAlias?: boolean): void;
102
- static get is(): string;
103
- static bindAttributes(desc: {
104
- [x: string]: string;
105
- }): void;
106
- static addRootStyles(styles: string | CSSStyleSheet): void;
107
- static addShadowStyles(styles: string | CSSStyleSheet): void;
108
- static set rootStyles(arg: string | CSSStyleSheet);
109
- static set shadowStyles(arg: string | CSSStyleSheet);
110
- constructor();
111
- get Symbiote(): typeof Symbiote;
112
- initCallback(): void;
113
- renderCallback(): void;
114
- render(template?: string | DocumentFragment, shadow?: boolean): void;
115
- addTemplateProcessor<T extends Symbiote<any>>(processorFn: (fr: DocumentFragment | T, fnCtx: T) => void): void;
116
- init$: S;
117
- cssInit$: {
118
- [x: string]: any;
119
- };
120
- tplProcessors: Set<(fr: DocumentFragment | Symbiote<any>, fnCtx: unknown) => void>;
121
- ref: {
122
- [x: string]: any;
123
- };
124
- allSubs: Set<any>;
125
- pauseRender: boolean;
126
- renderShadow: boolean;
127
- readyToDestroy: boolean;
128
- processInnerHtml: boolean;
129
- ssrMode: boolean;
130
- allowCustomTemplate: boolean;
131
- ctxOwner: boolean;
132
- isVirtual: boolean;
133
- get autoCtxName(): string;
134
- get cssCtxName(): string;
135
- get ctxName(): string;
136
- get localCtx(): PubSub<any>;
137
- get sharedCtx(): PubSub<any>;
138
- sub<T_1 extends keyof S>(prop: T_1, handler: (value: S[T_1]) => void, init?: boolean): void;
139
- notify(prop: string): void;
140
- has(prop: string): any;
141
- add<T_2 extends keyof S>(prop: string, val: S[T_2], rewrite?: boolean): void;
142
- add$(obj: Partial<S>, rewrite?: boolean): void;
143
- get $(): S;
144
- set$(kvObj: Partial<S>, forcePrimitives?: boolean): void;
145
- initChildren: ChildNode[];
146
- connectedOnce: boolean;
147
- connectedCallback(): void;
148
- destroyCallback(): void;
149
- disconnectedCallback(): void;
150
- attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
151
- getCssData(propName: string, silentCheck?: boolean): any;
152
- updateCssData: () => void;
153
- bindCssData(propName: string, initValue?: any): void;
154
- dropCssDataCache(): void;
155
- defineAccessor(propName: string, handler?: Function, isAsync?: boolean): void;
156
- #private;
157
- }
158
- export default Symbiote;
159
- import { UID } from "utils/UID";
160
- import PubSub from "core/PubSub";
161
- export { UID, PubSub };
162
- }
163
- declare module "core/AppRouter" {
164
- export class AppRouter {
165
- static "__#3@#onPopstate": () => void;
166
- static "__#3@#separator": string;
167
- static "__#3@#routingEventName": string;
168
- static appMap: {
169
- [x: string]: {
170
- title?: string;
171
- default?: boolean;
172
- error?: boolean;
173
- };
174
- };
175
- static "__#3@#print"(msg: any): void;
176
- static setDefaultTitle(title: string): void;
177
- static setRoutingMap(map: {
178
- [x: string]: {};
179
- }): void;
180
- static set routingEventName(arg: string);
181
- static get routingEventName(): string;
182
- static readAddressBar(): {
183
- route: any;
184
- options: {};
185
- };
186
- static notify(): void;
187
- static reflect(route: string, options?: {
188
- [x: string]: any;
189
- }): void;
190
- static applyRoute(route: string, options?: {
191
- [x: string]: any;
192
- }): void;
193
- static setSeparator(char: string): void;
194
- static get separator(): string;
195
- static initRoutingCtx(ctxName: string, routingMap: {
196
- [x: string]: {
197
- title?: string;
198
- default?: boolean;
199
- error?: boolean;
200
- };
201
- }): PubSub<any>;
202
- static "__#3@#initPopstateListener"(): void;
203
- static removePopstateListener(): void;
204
- }
205
- export default AppRouter;
206
- import PubSub from "core/PubSub";
207
- }
208
- declare module "utils/dom-helpers" {
209
- export function applyStyles<T extends HTMLElement | SVGElement>(el: T, styleMap: StyleMap): void;
210
- export function applyAttributes<T extends HTMLElement | SVGElement>(el: T, attrMap: AttrMap): void;
211
- export function create(desc?: ElementDescriptor): any;
212
- export type StyleMap = {
213
- [x: string]: string | number | boolean;
214
- };
215
- export type AttrMap = {
216
- [x: string]: string | number | boolean;
217
- };
218
- export type PropMap = {
219
- [x: string]: any;
220
- };
221
- export type ElementDescriptor = {
222
- tag?: string;
223
- attributes?: AttrMap;
224
- styles?: StyleMap;
225
- properties?: PropMap;
226
- processors?: Function[];
227
- children?: ElementDescriptor[];
228
- };
229
- }
230
- declare module "utils/kebabToCamel" {
231
- export function kebabToCamel(string: string): string;
232
- }
233
- declare module "core/index" {
234
- export { Symbiote };
235
- export { html } from "./html.js";
236
- export { css } from "./css.js";
237
- export { PubSub } from "./PubSub.js";
238
- export { AppRouter } from "./AppRouter.js";
239
- export { UID } from "../utils/UID.js";
240
- export { setNestedProp } from "../utils/setNestedProp.js";
241
- export { kebabToCamel } from "../utils/kebabToCamel.js";
242
- export default Symbiote;
243
- import Symbiote from "core/Symbiote";
244
- export { applyStyles, applyAttributes, create } from "../utils/dom-helpers.js";
245
- }
246
- declare module "core/slotProcessor" {
247
- export function slotProcessor<T extends import("core/Symbiote").Symbiote<any>>(fr: DocumentFragment, fnCtx: T): void;
248
- export default slotProcessor;
249
- }