@dooboostore/simple-web-component 1.0.17 → 1.0.18

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 (63) hide show
  1. package/README.md +75 -107
  2. package/dist/cjs/decorators/appendChild.js +48 -0
  3. package/dist/cjs/decorators/appendChild.js.map +7 -0
  4. package/dist/cjs/decorators/elementDefine.js +85 -7
  5. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  6. package/dist/cjs/decorators/index.js +2 -1
  7. package/dist/cjs/decorators/index.js.map +2 -2
  8. package/dist/cjs/decorators/{innerHtml.js → onConnectedInnerHtml.js} +8 -8
  9. package/dist/cjs/decorators/onConnectedInnerHtml.js.map +7 -0
  10. package/dist/cjs/decorators/query.js +16 -0
  11. package/dist/cjs/decorators/query.js.map +2 -2
  12. package/dist/cjs/decorators/queryAll.js +18 -0
  13. package/dist/cjs/decorators/queryAll.js.map +2 -2
  14. package/dist/cjs/decorators/replaceChildren.js +53 -0
  15. package/dist/cjs/decorators/replaceChildren.js.map +7 -0
  16. package/dist/cjs/index.js +11 -1
  17. package/dist/cjs/index.js.map +2 -2
  18. package/dist/esm/decorators/appendChild.js +29 -0
  19. package/dist/esm/decorators/appendChild.js.map +7 -0
  20. package/dist/esm/decorators/elementDefine.js +85 -7
  21. package/dist/esm/decorators/elementDefine.js.map +2 -2
  22. package/dist/esm/decorators/index.js +2 -1
  23. package/dist/esm/decorators/index.js.map +2 -2
  24. package/dist/esm/decorators/{innerHtml.js → onConnectedInnerHtml.js} +5 -5
  25. package/dist/esm/decorators/onConnectedInnerHtml.js.map +7 -0
  26. package/dist/esm/decorators/query.js +16 -0
  27. package/dist/esm/decorators/query.js.map +2 -2
  28. package/dist/esm/decorators/queryAll.js +18 -0
  29. package/dist/esm/decorators/queryAll.js.map +2 -2
  30. package/dist/esm/decorators/replaceChildren.js +34 -0
  31. package/dist/esm/decorators/replaceChildren.js.map +7 -0
  32. package/dist/esm/index.js +7 -1
  33. package/dist/esm/index.js.map +2 -2
  34. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +181 -11
  35. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
  36. package/dist/types/decorators/appendChild.d.ts +17 -0
  37. package/dist/types/decorators/appendChild.d.ts.map +1 -0
  38. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  39. package/dist/types/decorators/index.d.ts +2 -1
  40. package/dist/types/decorators/index.d.ts.map +1 -1
  41. package/dist/types/decorators/onConnectedInnerHtml.d.ts +15 -0
  42. package/dist/types/decorators/onConnectedInnerHtml.d.ts.map +1 -0
  43. package/dist/types/decorators/query.d.ts.map +1 -1
  44. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  45. package/dist/types/decorators/replaceChildren.d.ts +9 -0
  46. package/dist/types/decorators/replaceChildren.d.ts.map +1 -0
  47. package/dist/types/index.d.ts +4 -1
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +181 -11
  50. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
  51. package/package.json +1 -1
  52. package/src/decorators/appendChild.ts +42 -0
  53. package/src/decorators/elementDefine.ts +90 -7
  54. package/src/decorators/index.ts +2 -1
  55. package/src/decorators/{innerHtml.ts → onConnectedInnerHtml.ts} +7 -6
  56. package/src/decorators/query.ts +12 -0
  57. package/src/decorators/queryAll.ts +16 -0
  58. package/src/decorators/replaceChildren.ts +35 -0
  59. package/src/index.ts +4 -1
  60. package/dist/cjs/decorators/innerHtml.js.map +0 -7
  61. package/dist/esm/decorators/innerHtml.js.map +0 -7
  62. package/dist/types/decorators/innerHtml.d.ts +0 -12
  63. package/dist/types/decorators/innerHtml.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dooboostore/simple-web-component",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -0,0 +1,42 @@
1
+ import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';
2
+
3
+ export type AppendChildPosition = 'firstChild' | 'lastChild' | 'nextSibling' | 'previousSibling';
4
+
5
+ export interface AppendChildOptions {
6
+ position?: AppendChildPosition;
7
+ }
8
+
9
+ export interface AppendChildMetadata {
10
+ propertyKey: string | symbol;
11
+ selector: string;
12
+ options: AppendChildOptions;
13
+ }
14
+
15
+ export const APPEND_CHILD_METADATA_KEY = Symbol('simple-web-component:append-child');
16
+
17
+ /**
18
+ * @appendChild decorator to surgically add nodes to a target element.
19
+ * Usage: @appendChild('#list') addItem() { return '<li>New Item</li>'; }
20
+ */
21
+ export function appendChild(selector: string, options: AppendChildOptions = { position: 'lastChild' }): MethodDecorator {
22
+ return (target: Object, propertyKey: string | symbol) => {
23
+ const constructor = target.constructor;
24
+ let meta = ReflectUtils.getOwnMetadata(APPEND_CHILD_METADATA_KEY, constructor) as Map<string | symbol, AppendChildMetadata>;
25
+ if (!meta) {
26
+ meta = new Map<string | symbol, AppendChildMetadata>();
27
+ ReflectUtils.defineMetadata(APPEND_CHILD_METADATA_KEY, meta, constructor);
28
+ }
29
+ meta.set(propertyKey, { propertyKey, selector, options });
30
+ };
31
+ }
32
+
33
+ export const findAllAppendChildMetadata = (target: any): Map<string | symbol, AppendChildMetadata> => {
34
+ const result = new Map<string | symbol, AppendChildMetadata>();
35
+ const maps = ReflectUtils.findAllMetadata<Map<string | symbol, AppendChildMetadata>>(APPEND_CHILD_METADATA_KEY, target);
36
+ maps.forEach(map => {
37
+ if (map instanceof Map) {
38
+ map.forEach((v, k) => result.set(k, v));
39
+ }
40
+ });
41
+ return result;
42
+ };
@@ -1,6 +1,6 @@
1
1
  import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';
2
2
  import { FunctionUtils } from '@dooboostore/core/function/FunctionUtils';
3
- import { getInnerHtmlMetadataList } from './innerHtml';
3
+ import { getOnConnectedInnerHtmlMetadata } from './onConnectedInnerHtml';
4
4
  import { getQueryMetadata } from './query';
5
5
  import { getQueryAllMetadata } from './queryAll';
6
6
  import { getAddEventListenerMetadata } from './addEventListener';
@@ -8,6 +8,8 @@ import { ON_BEFORE_CONNECTED_METADATA_KEY, ON_AFTER_CONNECTED_METADATA_KEY, ON_B
8
8
  import { getEmitCustomEventMetadataList } from './emitCustomEvent';
9
9
  import { changedAttribute, findAllAttributeChangedMetadata } from './changedAttribute';
10
10
  import { setAttribute, findAllSetAttributeMetadata } from './setAttribute';
11
+ import { findAllReplaceChildrenMetadata } from './replaceChildren';
12
+ import { findAllAppendChildMetadata } from './appendChild';
11
13
  import { SwcUtils } from '../utils/Utils';
12
14
  import { HTML_TAG_ENTRIES, DOM_EVENT_NAMES } from '../config/config';
13
15
  import { SituationType, SituationTypeContainer, SituationTypeContainers } from '@dooboostore/simple-boot/decorators/inject/Inject';
@@ -73,12 +75,14 @@ export const elementDefine =
73
75
  const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
74
76
  const attrChangeMap = findAllAttributeChangedMetadata(constructor);
75
77
  const setAttrMap = findAllSetAttributeMetadata(constructor);
78
+ const replaceChildrenMap = findAllReplaceChildrenMetadata(constructor);
79
+ const appendChildMap = findAllAppendChildMetadata(constructor);
76
80
 
77
81
  const swcLifecycleAttributes = ['swc-on-constructor', 'swc-on-connected', 'swc-on-disconnected', 'swc-on-before-connected', 'swc-on-after-connected', 'swc-on-before-disconnected', 'swc-on-after-disconnected', 'swc-on-before-adopted', 'swc-on-after-adopted', 'swc-on-attribute-changed'];
78
82
  const swcOnEvents = DOM_EVENT_NAMES.map(e => `swc-on-${e}`);
79
83
 
80
84
  const mergedObservedAttributes = [...new Set([...(config.observedAttributes ?? []), ...attrChangeMap.keys(), ...setAttrMap.keys(), ...emitCustomEventList.map(it => it.options.attributeName!), ...swcLifecycleAttributes, ...swcOnEvents])];
81
- const innerHtmlList = getInnerHtmlMetadataList(constructor) || [];
85
+ const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
82
86
 
83
87
  const NewClass = class extends (constructor as any) {
84
88
  private _swcId = Math.random().toString(36).substring(2, 11);
@@ -156,7 +160,7 @@ export const elementDefine =
156
160
  const hostSet = SwcUtils.getHostSet(this as any);
157
161
  this._executeSwcScript('swc-on-constructor', hostSet);
158
162
 
159
- if (innerHtmlList.some(it => it.options.useShadow === true) && !this.shadowRoot) {
163
+ if (connectedInnerHtmlList.some(it => it.options.useShadow === true) && !this.shadowRoot) {
160
164
  this.attachShadow({ mode: 'open' });
161
165
  }
162
166
  }
@@ -180,10 +184,10 @@ export const elementDefine =
180
184
 
181
185
  if (typeof (this as any).initCore === 'function') (this as any).initCore();
182
186
 
183
- if (innerHtmlList.length > 0) {
187
+ if (connectedInnerHtmlList.length > 0) {
184
188
  let sContent = '',
185
189
  lContent = '';
186
- for (const meta of innerHtmlList) {
190
+ for (const meta of connectedInnerHtmlList) {
187
191
  const res = await (this as any)[meta.propertyKey]();
188
192
  if (res !== undefined) {
189
193
  if (meta.options.useShadow) sContent += res;
@@ -227,8 +231,9 @@ export const elementDefine =
227
231
 
228
232
  // 1. Local Delegation (To itself)
229
233
  DOM_EVENT_NAMES.forEach(type => {
230
- this.addEventListener(type, createDelegationHandler(this));
231
- this._boundListeners.push({ target: this as any, type, handler: createDelegationHandler(this) });
234
+ const handler = createDelegationHandler(this);
235
+ this.addEventListener(type, handler);
236
+ this._boundListeners.push({ target: this as any, type, handler });
232
237
  });
233
238
 
234
239
  // 2. Structural/Global Delegation (If no parent host exists)
@@ -425,6 +430,84 @@ export const elementDefine =
425
430
  }
426
431
  });
427
432
 
433
+ // --- @replaceChildren wrapping logic ---
434
+ replaceChildrenMap.forEach((selector, methodName) => {
435
+ const original = NewClass.prototype[methodName as any];
436
+ if (typeof original === 'function') {
437
+ NewClass.prototype[methodName as any] = function (...args: any[]) {
438
+ const res = original.apply(this, args);
439
+ if (res !== undefined) {
440
+ const conf = getElementConfig(this);
441
+ const currentWin = conf?.window || window;
442
+ const currentDoc = currentWin.document;
443
+
444
+ let targetEl: Element | null = null;
445
+ if (selector === ':host' || !selector) {
446
+ targetEl = this;
447
+ } else {
448
+ targetEl = (this.shadowRoot || this).querySelector(selector);
449
+ }
450
+
451
+ if (targetEl) {
452
+ const nodes: (Node | string)[] = Array.isArray(res) ? res : [res];
453
+ const normalizedNodes = nodes.map(n => {
454
+ if (typeof n === 'string') {
455
+ const t = currentDoc.createElement('template');
456
+ t.innerHTML = n;
457
+ return t.content;
458
+ }
459
+ return n as Node;
460
+ });
461
+ (targetEl as any).replaceChildren(...normalizedNodes);
462
+ }
463
+ }
464
+ return res;
465
+ };
466
+ }
467
+ });
468
+
469
+ // --- @appendChild wrapping logic ---
470
+ appendChildMap.forEach((meta, methodName) => {
471
+ const { selector, options } = meta;
472
+ const original = NewClass.prototype[methodName as any];
473
+ if (typeof original === 'function') {
474
+ NewClass.prototype[methodName as any] = function (...args: any[]) {
475
+ const res = original.apply(this, args);
476
+ if (res !== undefined) {
477
+ const conf = getElementConfig(this);
478
+ const currentWin = conf?.window || window;
479
+ const currentDoc = currentWin.document;
480
+
481
+ let targetEl: Element | null = null;
482
+ if (selector === ':host' || !selector) {
483
+ targetEl = this;
484
+ } else {
485
+ targetEl = (this.shadowRoot || this).querySelector(selector);
486
+ }
487
+
488
+ if (targetEl) {
489
+ const nodes: (Node | string)[] = Array.isArray(res) ? res : [res];
490
+ const normalizedNodes = nodes.map(n => {
491
+ if (typeof n === 'string') {
492
+ const t = currentDoc.createElement('template');
493
+ t.innerHTML = n;
494
+ return t.content;
495
+ }
496
+ return n as Node;
497
+ });
498
+
499
+ const pos = options.position || 'lastChild';
500
+ if (pos === 'lastChild') (targetEl as any).append(...normalizedNodes);
501
+ else if (pos === 'firstChild') (targetEl as any).prepend(...normalizedNodes);
502
+ else if (pos === 'nextSibling') (targetEl as any).after(...normalizedNodes);
503
+ else if (pos === 'previousSibling') (targetEl as any).before(...normalizedNodes);
504
+ }
505
+ }
506
+ return res;
507
+ };
508
+ }
509
+ });
510
+
428
511
  const originalProto = constructor.prototype;
429
512
  const newProto = NewClass.prototype;
430
513
  Object.getOwnPropertyNames(originalProto).forEach(name => {
@@ -3,7 +3,8 @@ export * from './elementDefine';
3
3
  export * from './changedAttribute';
4
4
  export * from './setAttribute';
5
5
  export * from './emitCustomEvent';
6
- export * from './innerHtml';
6
+ export * from './replaceChildren';
7
+ export * from './appendChild';
7
8
  export * from './lifecycles';
8
9
  export * from './query';
9
10
  export * from './queryAll';
@@ -11,9 +11,12 @@ export interface InnerHtmlMetadata {
11
11
 
12
12
  export const INNER_HTML_METADATA_KEY = Symbol('simple-web-component:inner-html');
13
13
 
14
- export function innerHtml(options: InnerHtmlOptions): MethodDecorator;
15
- export function innerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
16
- export function innerHtml(arg1?: InnerHtmlOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {
14
+ /**
15
+ * @onConnectedInnerHtml decorator to define the initial HTML content when connected.
16
+ */
17
+ export function onConnectedInnerHtml(options: InnerHtmlOptions): MethodDecorator;
18
+ export function onConnectedInnerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
19
+ export function onConnectedInnerHtml(arg1?: InnerHtmlOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {
17
20
  const decorator = (options: InnerHtmlOptions, target: Object, propertyKey: string | symbol) => {
18
21
  const constructor = target.constructor;
19
22
  let list = ReflectUtils.getMetadata<InnerHtmlMetadata[]>(INNER_HTML_METADATA_KEY, constructor);
@@ -25,17 +28,15 @@ export function innerHtml(arg1?: InnerHtmlOptions | Object, arg2?: string | symb
25
28
  };
26
29
 
27
30
  if (arg2) {
28
- // Used as @innerHtml
29
31
  return decorator({}, arg1!, arg2);
30
32
  }
31
33
 
32
- // Used as @innerHtml(options)
33
34
  return (target: Object, propertyKey: string | symbol) => {
34
35
  decorator((arg1 as InnerHtmlOptions) || {}, target, propertyKey);
35
36
  };
36
37
  }
37
38
 
38
- export const getInnerHtmlMetadataList = (target: any): InnerHtmlMetadata[] | undefined => {
39
+ export const getOnConnectedInnerHtmlMetadata = (target: any): InnerHtmlMetadata[] | undefined => {
39
40
  const constructor = target instanceof Function ? target : target.constructor;
40
41
  return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
41
42
  };
@@ -66,6 +66,18 @@ export function query(selector: string, options: QueryOptions = {}): PropertyDec
66
66
  // auto
67
67
  return (this.shadowRoot || this).querySelector(selector);
68
68
  },
69
+ set(this: HTMLElement, nv: any) {
70
+ if (nv === null || nv === undefined) {
71
+ const r = options.root || 'auto';
72
+ let targetEl: Element | null = null;
73
+ if (r === 'shadow') targetEl = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
74
+ else if (r === 'light') targetEl = this.querySelector(selector);
75
+ else if (r === 'all') targetEl = this.shadowRoot?.querySelector(selector) || this.querySelector(selector);
76
+ else targetEl = (this.shadowRoot || this).querySelector(selector);
77
+
78
+ if (targetEl) targetEl.remove();
79
+ }
80
+ },
69
81
  enumerable: true,
70
82
  configurable: true
71
83
  });
@@ -65,6 +65,22 @@ export function queryAll(selector: string, options: QueryAllOptions = {}): Prope
65
65
  const root = this.shadowRoot || this;
66
66
  return root.querySelectorAll(selector);
67
67
  },
68
+ set(this: HTMLElement, nv: any) {
69
+ if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {
70
+ const r = options.root || 'auto';
71
+ let targets: (Element | Node)[] = [];
72
+ if (r === 'shadow') targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
73
+ else if (r === 'light') targets = Array.from(this.querySelectorAll(selector));
74
+ else if (r === 'all') {
75
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
76
+ const lNodes = Array.from(this.querySelectorAll(selector));
77
+ targets = [...sNodes, ...lNodes];
78
+ } else {
79
+ targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
80
+ }
81
+ targets.forEach(t => (t as Element).remove());
82
+ }
83
+ },
68
84
  enumerable: true,
69
85
  configurable: true
70
86
  });
@@ -0,0 +1,35 @@
1
+ import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';
2
+
3
+ export const REPLACE_CHILDREN_METADATA_KEY = Symbol('simple-web-component:replace-children');
4
+
5
+ /**
6
+ * @replaceChildren decorator to surgically replace children of a target element.
7
+ * Usage: @replaceChildren('#container') renderPart() { return '<div>New Content</div>'; }
8
+ */
9
+ export function replaceChildren(selector: string): MethodDecorator {
10
+ return (target: Object, propertyKey: string | symbol) => {
11
+ const constructor = target.constructor;
12
+ let meta = ReflectUtils.getOwnMetadata(REPLACE_CHILDREN_METADATA_KEY, constructor) as Map<string | symbol, string>;
13
+ if (!meta) {
14
+ meta = new Map<string | symbol, string>();
15
+ ReflectUtils.defineMetadata(REPLACE_CHILDREN_METADATA_KEY, meta, constructor);
16
+ }
17
+ meta.set(propertyKey, selector);
18
+ };
19
+ }
20
+
21
+ export const getReplaceChildrenMetadata = (target: any): Map<string | symbol, string> | undefined => {
22
+ const constructor = target instanceof Function ? target : target.constructor;
23
+ return ReflectUtils.getMetadata(REPLACE_CHILDREN_METADATA_KEY, constructor);
24
+ };
25
+
26
+ export const findAllReplaceChildrenMetadata = (target: any): Map<string | symbol, string> => {
27
+ const result = new Map<string | symbol, string>();
28
+ const maps = ReflectUtils.findAllMetadata<Map<string | symbol, string>>(REPLACE_CHILDREN_METADATA_KEY, target);
29
+ maps.forEach(map => {
30
+ if (map instanceof Map) {
31
+ map.forEach((v, k) => result.set(k, v));
32
+ }
33
+ });
34
+ return result;
35
+ };
package/src/index.ts CHANGED
@@ -4,7 +4,10 @@ import 'reflect-metadata';
4
4
  export * from './decorators/elementDefine';
5
5
  export * from './decorators/setAttribute';
6
6
  export * from './decorators/changedAttribute';
7
- export * from './decorators/innerHtml';
7
+ export * from './decorators/onConnectedInnerHtml';
8
+ export { onConnectedInnerHtml as innerHtml } from './decorators/onConnectedInnerHtml';
9
+ export * from './decorators/replaceChildren';
10
+ export * from './decorators/appendChild';
8
11
  export * from './decorators/emitCustomEvent';
9
12
  export * from './decorators/lifecycles';
10
13
  export * from './decorators/query';
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/decorators/innerHtml.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\n\nexport interface InnerHtmlOptions {\n useShadow?: boolean;\n}\n\nexport interface InnerHtmlMetadata {\n propertyKey: string | symbol;\n options: InnerHtmlOptions;\n}\n\nexport const INNER_HTML_METADATA_KEY = Symbol('simple-web-component:inner-html');\n\nexport function innerHtml(options: InnerHtmlOptions): MethodDecorator;\nexport function innerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function innerHtml(arg1?: InnerHtmlOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n const decorator = (options: InnerHtmlOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<InnerHtmlMetadata[]>(INNER_HTML_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n };\n\n if (arg2) {\n // Used as @innerHtml\n return decorator({}, arg1!, arg2);\n }\n\n // Used as @innerHtml(options)\n return (target: Object, propertyKey: string | symbol) => {\n decorator((arg1 as InnerHtmlOptions) || {}, target, propertyKey);\n };\n}\n\nexport const getInnerHtmlMetadataList = (target: any): InnerHtmlMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAWtB,MAAM,0BAA0B,OAAO,iCAAiC;AAIxE,SAAS,UAAU,MAAkC,MAAwB,MAAmD;AACrI,QAAM,YAAY,CAAC,SAA2B,QAAgB,gBAAiC;AAC7F,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,iCAAa,YAAiC,yBAAyB,WAAW;AAC7F,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,uCAAa,eAAe,yBAAyB,MAAM,WAAW;AAAA,IACxE;AACA,SAAK,KAAK,EAAE,aAAa,QAAQ,CAAC;AAAA,EACpC;AAEA,MAAI,MAAM;AAER,WAAO,UAAU,CAAC,GAAG,MAAO,IAAI;AAAA,EAClC;AAGA,SAAO,CAAC,QAAgB,gBAAiC;AACvD,cAAW,QAA6B,CAAC,GAAG,QAAQ,WAAW;AAAA,EACjE;AACF;AAEO,MAAM,2BAA2B,CAAC,WAAiD;AACxF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,iCAAa,YAAY,yBAAyB,WAAW;AACtE;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/decorators/innerHtml.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\n\nexport interface InnerHtmlOptions {\n useShadow?: boolean;\n}\n\nexport interface InnerHtmlMetadata {\n propertyKey: string | symbol;\n options: InnerHtmlOptions;\n}\n\nexport const INNER_HTML_METADATA_KEY = Symbol('simple-web-component:inner-html');\n\nexport function innerHtml(options: InnerHtmlOptions): MethodDecorator;\nexport function innerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function innerHtml(arg1?: InnerHtmlOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n const decorator = (options: InnerHtmlOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<InnerHtmlMetadata[]>(INNER_HTML_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n };\n\n if (arg2) {\n // Used as @innerHtml\n return decorator({}, arg1!, arg2);\n }\n\n // Used as @innerHtml(options)\n return (target: Object, propertyKey: string | symbol) => {\n decorator((arg1 as InnerHtmlOptions) || {}, target, propertyKey);\n };\n}\n\nexport const getInnerHtmlMetadataList = (target: any): InnerHtmlMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);\n};\n"],
5
- "mappings": "AAAA,SAAS,oBAAoB;AAWtB,MAAM,0BAA0B,OAAO,iCAAiC;AAIxE,SAAS,UAAU,MAAkC,MAAwB,MAAmD;AACrI,QAAM,YAAY,CAAC,SAA2B,QAAgB,gBAAiC;AAC7F,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,YAAiC,yBAAyB,WAAW;AAC7F,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,mBAAa,eAAe,yBAAyB,MAAM,WAAW;AAAA,IACxE;AACA,SAAK,KAAK,EAAE,aAAa,QAAQ,CAAC;AAAA,EACpC;AAEA,MAAI,MAAM;AAER,WAAO,UAAU,CAAC,GAAG,MAAO,IAAI;AAAA,EAClC;AAGA,SAAO,CAAC,QAAgB,gBAAiC;AACvD,cAAW,QAA6B,CAAC,GAAG,QAAQ,WAAW;AAAA,EACjE;AACF;AAEO,MAAM,2BAA2B,CAAC,WAAiD;AACxF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,yBAAyB,WAAW;AACtE;",
6
- "names": []
7
- }
@@ -1,12 +0,0 @@
1
- export interface InnerHtmlOptions {
2
- useShadow?: boolean;
3
- }
4
- export interface InnerHtmlMetadata {
5
- propertyKey: string | symbol;
6
- options: InnerHtmlOptions;
7
- }
8
- export declare const INNER_HTML_METADATA_KEY: unique symbol;
9
- export declare function innerHtml(options: InnerHtmlOptions): MethodDecorator;
10
- export declare function innerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
11
- export declare const getInnerHtmlMetadataList: (target: any) => InnerHtmlMetadata[] | undefined;
12
- //# sourceMappingURL=innerHtml.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"innerHtml.d.ts","sourceRoot":"","sources":["../../../src/decorators/innerHtml.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,eAAO,MAAM,uBAAuB,eAA4C,CAAC;AAEjF,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAAC;AACtE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,kBAAkB,GAAG,IAAI,CAAC;AAuB9G,eAAO,MAAM,wBAAwB,GAAI,QAAQ,GAAG,KAAG,iBAAiB,EAAE,GAAG,SAG5E,CAAC"}