@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
@@ -0,0 +1,17 @@
1
+ export type AppendChildPosition = 'firstChild' | 'lastChild' | 'nextSibling' | 'previousSibling';
2
+ export interface AppendChildOptions {
3
+ position?: AppendChildPosition;
4
+ }
5
+ export interface AppendChildMetadata {
6
+ propertyKey: string | symbol;
7
+ selector: string;
8
+ options: AppendChildOptions;
9
+ }
10
+ export declare const APPEND_CHILD_METADATA_KEY: unique symbol;
11
+ /**
12
+ * @appendChild decorator to surgically add nodes to a target element.
13
+ * Usage: @appendChild('#list') addItem() { return '<li>New Item</li>'; }
14
+ */
15
+ export declare function appendChild(selector: string, options?: AppendChildOptions): MethodDecorator;
16
+ export declare const findAllAppendChildMetadata: (target: any) => Map<string | symbol, AppendChildMetadata>;
17
+ //# sourceMappingURL=appendChild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appendChild.d.ts","sourceRoot":"","sources":["../../../src/decorators/appendChild.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,WAAW,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAEjG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,eAAO,MAAM,yBAAyB,eAA8C,CAAC;AAErF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,kBAA8C,GAAG,eAAe,CAUtH;AAED,eAAO,MAAM,0BAA0B,GAAI,QAAQ,GAAG,KAAG,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,mBAAmB,CAShG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"elementDefine.d.ts","sourceRoot":"","sources":["../../../src/decorators/elementDefine.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,eAAgD,CAAC;AAyBhF,eAAO,MAAM,aAAa,GACvB,UAAU,aAAa,GAAG,MAAM,KAAG,cAoYnC,CAAC;AAEJ,eAAO,MAAM,gBAAgB,GAAI,QAAQ,GAAG,KAAG,aAAa,GAAG,SAG9D,CAAC"}
1
+ {"version":3,"file":"elementDefine.d.ts","sourceRoot":"","sources":["../../../src/decorators/elementDefine.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,eAAgD,CAAC;AAyBhF,eAAO,MAAM,aAAa,GACvB,UAAU,aAAa,GAAG,MAAM,KAAG,cAqdnC,CAAC;AAEJ,eAAO,MAAM,gBAAgB,GAAI,QAAQ,GAAG,KAAG,aAAa,GAAG,SAG9D,CAAC"}
@@ -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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,15 @@
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
+ /**
10
+ * @onConnectedInnerHtml decorator to define the initial HTML content when connected.
11
+ */
12
+ export declare function onConnectedInnerHtml(options: InnerHtmlOptions): MethodDecorator;
13
+ export declare function onConnectedInnerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
14
+ export declare const getOnConnectedInnerHtmlMetadata: (target: any) => InnerHtmlMetadata[] | undefined;
15
+ //# sourceMappingURL=onConnectedInnerHtml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onConnectedInnerHtml.d.ts","sourceRoot":"","sources":["../../../src/decorators/onConnectedInnerHtml.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;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAAC;AACjF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,kBAAkB,GAAG,IAAI,CAAC;AAqBzH,eAAO,MAAM,+BAA+B,GAAI,QAAQ,GAAG,KAAG,iBAAiB,EAAE,GAAG,SAGnF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/decorators/query.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,eAAuC,CAAC;AAEvE;;GAEG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,iBAAiB,CAqDrF;AAED,eAAO,MAAM,gBAAgB,GAAI,QAAQ,GAAG,KAAG,aAAa,EAAE,GAAG,SAGhE,CAAC"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/decorators/query.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,eAAuC,CAAC;AAEvE;;GAEG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,iBAAiB,CAiErF;AAED,eAAO,MAAM,gBAAgB,GAAI,QAAQ,GAAG,KAAG,aAAa,EAAE,GAAG,SAGhE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"queryAll.d.ts","sourceRoot":"","sources":["../../../src/decorators/queryAll.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CAC5C;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,sBAAsB,eAA2C,CAAC;AAE/E;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,iBAAiB,CAoD3F;AAED,eAAO,MAAM,mBAAmB,GAAI,QAAQ,GAAG,KAAG,gBAAgB,EAAE,GAAG,SAGtE,CAAC"}
1
+ {"version":3,"file":"queryAll.d.ts","sourceRoot":"","sources":["../../../src/decorators/queryAll.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CAC5C;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,sBAAsB,eAA2C,CAAC;AAE/E;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,iBAAiB,CAoE3F;AAED,eAAO,MAAM,mBAAmB,GAAI,QAAQ,GAAG,KAAG,gBAAgB,EAAE,GAAG,SAGtE,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const REPLACE_CHILDREN_METADATA_KEY: unique symbol;
2
+ /**
3
+ * @replaceChildren decorator to surgically replace children of a target element.
4
+ * Usage: @replaceChildren('#container') renderPart() { return '<div>New Content</div>'; }
5
+ */
6
+ export declare function replaceChildren(selector: string): MethodDecorator;
7
+ export declare const getReplaceChildrenMetadata: (target: any) => Map<string | symbol, string> | undefined;
8
+ export declare const findAllReplaceChildrenMetadata: (target: any) => Map<string | symbol, string>;
9
+ //# sourceMappingURL=replaceChildren.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replaceChildren.d.ts","sourceRoot":"","sources":["../../../src/decorators/replaceChildren.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B,eAAkD,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAUjE;AAED,eAAO,MAAM,0BAA0B,GAAI,QAAQ,GAAG,KAAG,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,GAAG,SAGvF,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,QAAQ,GAAG,KAAG,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CASvF,CAAC"}
@@ -2,7 +2,10 @@ import 'reflect-metadata';
2
2
  export * from './decorators/elementDefine';
3
3
  export * from './decorators/setAttribute';
4
4
  export * from './decorators/changedAttribute';
5
- export * from './decorators/innerHtml';
5
+ export * from './decorators/onConnectedInnerHtml';
6
+ export { onConnectedInnerHtml as innerHtml } from './decorators/onConnectedInnerHtml';
7
+ export * from './decorators/replaceChildren';
8
+ export * from './decorators/appendChild';
6
9
  export * from './decorators/emitCustomEvent';
7
10
  export * from './decorators/lifecycles';
8
11
  export * from './decorators/query';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAG1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAG9C,cAAc,SAAS,CAAC;AAGxB,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAG1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,oBAAoB,IAAI,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACtF,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAG9C,cAAc,SAAS,CAAC;AAGxB,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC"}
@@ -1119,6 +1119,7 @@ var dooboostoreSimpleWebComponent = (() => {
1119
1119
  var bundle_entry_exports = {};
1120
1120
  __export(bundle_entry_exports, {
1121
1121
  ADD_EVENT_LISTENER_METADATA_KEY: () => ADD_EVENT_LISTENER_METADATA_KEY,
1122
+ APPEND_CHILD_METADATA_KEY: () => APPEND_CHILD_METADATA_KEY,
1122
1123
  ATTRIBUTE_CHANGED_WILDCARD: () => ATTRIBUTE_CHANGED_WILDCARD,
1123
1124
  ELEMENT_CONFIG_KEY: () => ELEMENT_CONFIG_KEY,
1124
1125
  EMIT_CUSTOM_EVENT_METADATA_KEY: () => EMIT_CUSTOM_EVENT_METADATA_KEY,
@@ -1134,6 +1135,7 @@ var dooboostoreSimpleWebComponent = (() => {
1134
1135
  ON_BEFORE_DISCONNECTED_METADATA_KEY: () => ON_BEFORE_DISCONNECTED_METADATA_KEY,
1135
1136
  QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
1136
1137
  QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
1138
+ REPLACE_CHILDREN_METADATA_KEY: () => REPLACE_CHILDREN_METADATA_KEY,
1137
1139
  SET_ATTRIBUTE_METADATA_KEY: () => SET_ATTRIBUTE_METADATA_KEY,
1138
1140
  SWC_NOT_FOUND: () => SWC_NOT_FOUND,
1139
1141
  SwcApp: () => SwcApp,
@@ -1207,21 +1209,25 @@ var dooboostoreSimpleWebComponent = (() => {
1207
1209
  SwcUtils: () => SwcUtils,
1208
1210
  SwcWhen: () => SwcWhen,
1209
1211
  addEventListener: () => addEventListener,
1212
+ appendChild: () => appendChild,
1210
1213
  changedAttribute: () => changedAttribute,
1211
1214
  elementDefine: () => elementDefine,
1212
1215
  emitCustomEvent: () => emitCustomEvent,
1216
+ findAllAppendChildMetadata: () => findAllAppendChildMetadata,
1213
1217
  findAllAttributeChangedMetadata: () => findAllAttributeChangedMetadata,
1214
1218
  findAllLifecycleMetadata: () => findAllLifecycleMetadata,
1219
+ findAllReplaceChildrenMetadata: () => findAllReplaceChildrenMetadata,
1215
1220
  findAllSetAttributeMetadata: () => findAllSetAttributeMetadata,
1216
1221
  getAddEventListenerMetadata: () => getAddEventListenerMetadata,
1217
1222
  getChangedAttributeMetadata: () => getChangedAttributeMetadata,
1218
1223
  getElementConfig: () => getElementConfig,
1219
1224
  getEmitCustomEventMetadataList: () => getEmitCustomEventMetadataList,
1220
- getInnerHtmlMetadataList: () => getInnerHtmlMetadataList,
1225
+ getOnConnectedInnerHtmlMetadata: () => getOnConnectedInnerHtmlMetadata,
1221
1226
  getQueryAllMetadata: () => getQueryAllMetadata,
1222
1227
  getQueryMetadata: () => getQueryMetadata,
1228
+ getReplaceChildrenMetadata: () => getReplaceChildrenMetadata,
1223
1229
  getSetAttributeMetadata: () => getSetAttributeMetadata,
1224
- innerHtml: () => innerHtml,
1230
+ innerHtml: () => onConnectedInnerHtml,
1225
1231
  onAddEventListener: () => onAddEventListener,
1226
1232
  onAdopted: () => onAdopted,
1227
1233
  onAfterAdopted: () => onAfterAdopted,
@@ -1231,9 +1237,11 @@ var dooboostoreSimpleWebComponent = (() => {
1231
1237
  onBeforeConnected: () => onBeforeConnected,
1232
1238
  onBeforeDisconnected: () => onBeforeDisconnected,
1233
1239
  onConnected: () => onConnected,
1240
+ onConnectedInnerHtml: () => onConnectedInnerHtml,
1234
1241
  onDisconnected: () => onDisconnected,
1235
1242
  query: () => query,
1236
1243
  queryAll: () => queryAll,
1244
+ replaceChildren: () => replaceChildren,
1237
1245
  setAttribute: () => setAttribute
1238
1246
  });
1239
1247
  var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
@@ -1378,9 +1386,9 @@ var dooboostoreSimpleWebComponent = (() => {
1378
1386
  };
1379
1387
  })(FunctionUtils || (FunctionUtils = {}));
1380
1388
 
1381
- // src/decorators/innerHtml.ts
1389
+ // src/decorators/onConnectedInnerHtml.ts
1382
1390
  var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
1383
- function innerHtml(arg1, arg2, arg3) {
1391
+ function onConnectedInnerHtml(arg1, arg2, arg3) {
1384
1392
  const decorator = (options, target, propertyKey) => {
1385
1393
  const constructor = target.constructor;
1386
1394
  let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
@@ -1397,7 +1405,7 @@ var dooboostoreSimpleWebComponent = (() => {
1397
1405
  decorator(arg1 || {}, target, propertyKey);
1398
1406
  };
1399
1407
  }
1400
- var getInnerHtmlMetadataList = (target) => {
1408
+ var getOnConnectedInnerHtmlMetadata = (target) => {
1401
1409
  const constructor = target instanceof Function ? target : target.constructor;
1402
1410
  return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
1403
1411
  };
@@ -1534,6 +1542,58 @@ var dooboostoreSimpleWebComponent = (() => {
1534
1542
  return result;
1535
1543
  };
1536
1544
 
1545
+ // src/decorators/replaceChildren.ts
1546
+ var REPLACE_CHILDREN_METADATA_KEY = Symbol("simple-web-component:replace-children");
1547
+ function replaceChildren(selector) {
1548
+ return (target, propertyKey) => {
1549
+ const constructor = target.constructor;
1550
+ let meta = ReflectUtils.getOwnMetadata(REPLACE_CHILDREN_METADATA_KEY, constructor);
1551
+ if (!meta) {
1552
+ meta = /* @__PURE__ */ new Map();
1553
+ ReflectUtils.defineMetadata(REPLACE_CHILDREN_METADATA_KEY, meta, constructor);
1554
+ }
1555
+ meta.set(propertyKey, selector);
1556
+ };
1557
+ }
1558
+ var getReplaceChildrenMetadata = (target) => {
1559
+ const constructor = target instanceof Function ? target : target.constructor;
1560
+ return ReflectUtils.getMetadata(REPLACE_CHILDREN_METADATA_KEY, constructor);
1561
+ };
1562
+ var findAllReplaceChildrenMetadata = (target) => {
1563
+ const result = /* @__PURE__ */ new Map();
1564
+ const maps = ReflectUtils.findAllMetadata(REPLACE_CHILDREN_METADATA_KEY, target);
1565
+ maps.forEach((map) => {
1566
+ if (map instanceof Map) {
1567
+ map.forEach((v, k) => result.set(k, v));
1568
+ }
1569
+ });
1570
+ return result;
1571
+ };
1572
+
1573
+ // src/decorators/appendChild.ts
1574
+ var APPEND_CHILD_METADATA_KEY = Symbol("simple-web-component:append-child");
1575
+ function appendChild(selector, options = { position: "lastChild" }) {
1576
+ return (target, propertyKey) => {
1577
+ const constructor = target.constructor;
1578
+ let meta = ReflectUtils.getOwnMetadata(APPEND_CHILD_METADATA_KEY, constructor);
1579
+ if (!meta) {
1580
+ meta = /* @__PURE__ */ new Map();
1581
+ ReflectUtils.defineMetadata(APPEND_CHILD_METADATA_KEY, meta, constructor);
1582
+ }
1583
+ meta.set(propertyKey, { propertyKey, selector, options });
1584
+ };
1585
+ }
1586
+ var findAllAppendChildMetadata = (target) => {
1587
+ const result = /* @__PURE__ */ new Map();
1588
+ const maps = ReflectUtils.findAllMetadata(APPEND_CHILD_METADATA_KEY, target);
1589
+ maps.forEach((map) => {
1590
+ if (map instanceof Map) {
1591
+ map.forEach((v, k) => result.set(k, v));
1592
+ }
1593
+ });
1594
+ return result;
1595
+ };
1596
+
1537
1597
  // src/utils/Utils.ts
1538
1598
  var SWC_NOT_FOUND = Symbol("SWC_NOT_FOUND");
1539
1599
  var SwcUtils;
@@ -1800,10 +1860,12 @@ var dooboostoreSimpleWebComponent = (() => {
1800
1860
  const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
1801
1861
  const attrChangeMap = findAllAttributeChangedMetadata(constructor);
1802
1862
  const setAttrMap = findAllSetAttributeMetadata(constructor);
1863
+ const replaceChildrenMap = findAllReplaceChildrenMetadata(constructor);
1864
+ const appendChildMap = findAllAppendChildMetadata(constructor);
1803
1865
  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"];
1804
1866
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
1805
1867
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...config.observedAttributes ?? [], ...attrChangeMap.keys(), ...setAttrMap.keys(), ...emitCustomEventList.map((it) => it.options.attributeName), ...swcLifecycleAttributes, ...swcOnEvents])];
1806
- const innerHtmlList = getInnerHtmlMetadataList(constructor) || [];
1868
+ const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
1807
1869
  const NewClass = class extends constructor {
1808
1870
  _executeSwcScript(attrName, hostSet, extraArgs = {}) {
1809
1871
  const script = this.getAttribute(attrName);
@@ -1870,7 +1932,7 @@ var dooboostoreSimpleWebComponent = (() => {
1870
1932
  this._boundListeners = [];
1871
1933
  const hostSet = SwcUtils.getHostSet(this);
1872
1934
  this._executeSwcScript("swc-on-constructor", hostSet);
1873
- if (innerHtmlList.some((it) => it.options.useShadow === true) && !this.shadowRoot) {
1935
+ if (connectedInnerHtmlList.some((it) => it.options.useShadow === true) && !this.shadowRoot) {
1874
1936
  this.attachShadow({ mode: "open" });
1875
1937
  }
1876
1938
  }
@@ -1890,9 +1952,9 @@ var dooboostoreSimpleWebComponent = (() => {
1890
1952
  }
1891
1953
  if (typeof this.initCore === "function")
1892
1954
  this.initCore();
1893
- if (innerHtmlList.length > 0) {
1955
+ if (connectedInnerHtmlList.length > 0) {
1894
1956
  let sContent = "", lContent = "";
1895
- for (const meta of innerHtmlList) {
1957
+ for (const meta of connectedInnerHtmlList) {
1896
1958
  const res = await this[meta.propertyKey]();
1897
1959
  if (res !== void 0) {
1898
1960
  if (meta.options.useShadow)
@@ -1936,8 +1998,9 @@ var dooboostoreSimpleWebComponent = (() => {
1936
1998
  }
1937
1999
  };
1938
2000
  DOM_EVENT_NAMES.forEach((type) => {
1939
- this.addEventListener(type, createDelegationHandler(this));
1940
- this._boundListeners.push({ target: this, type, handler: createDelegationHandler(this) });
2001
+ const handler = createDelegationHandler(this);
2002
+ this.addEventListener(type, handler);
2003
+ this._boundListeners.push({ target: this, type, handler });
1941
2004
  });
1942
2005
  const hasParentHost = SwcUtils.findAllSwcHosts(this).length > 0;
1943
2006
  if (!hasParentHost) {
@@ -2139,6 +2202,79 @@ var dooboostoreSimpleWebComponent = (() => {
2139
2202
  };
2140
2203
  }
2141
2204
  });
2205
+ replaceChildrenMap.forEach((selector, methodName) => {
2206
+ const original = NewClass.prototype[methodName];
2207
+ if (typeof original === "function") {
2208
+ NewClass.prototype[methodName] = function(...args) {
2209
+ const res = original.apply(this, args);
2210
+ if (res !== void 0) {
2211
+ const conf = getElementConfig(this);
2212
+ const currentWin = conf?.window || window;
2213
+ const currentDoc = currentWin.document;
2214
+ let targetEl = null;
2215
+ if (selector === ":host" || !selector) {
2216
+ targetEl = this;
2217
+ } else {
2218
+ targetEl = (this.shadowRoot || this).querySelector(selector);
2219
+ }
2220
+ if (targetEl) {
2221
+ const nodes = Array.isArray(res) ? res : [res];
2222
+ const normalizedNodes = nodes.map((n) => {
2223
+ if (typeof n === "string") {
2224
+ const t = currentDoc.createElement("template");
2225
+ t.innerHTML = n;
2226
+ return t.content;
2227
+ }
2228
+ return n;
2229
+ });
2230
+ targetEl.replaceChildren(...normalizedNodes);
2231
+ }
2232
+ }
2233
+ return res;
2234
+ };
2235
+ }
2236
+ });
2237
+ appendChildMap.forEach((meta, methodName) => {
2238
+ const { selector, options } = meta;
2239
+ const original = NewClass.prototype[methodName];
2240
+ if (typeof original === "function") {
2241
+ NewClass.prototype[methodName] = function(...args) {
2242
+ const res = original.apply(this, args);
2243
+ if (res !== void 0) {
2244
+ const conf = getElementConfig(this);
2245
+ const currentWin = conf?.window || window;
2246
+ const currentDoc = currentWin.document;
2247
+ let targetEl = null;
2248
+ if (selector === ":host" || !selector) {
2249
+ targetEl = this;
2250
+ } else {
2251
+ targetEl = (this.shadowRoot || this).querySelector(selector);
2252
+ }
2253
+ if (targetEl) {
2254
+ const nodes = Array.isArray(res) ? res : [res];
2255
+ const normalizedNodes = nodes.map((n) => {
2256
+ if (typeof n === "string") {
2257
+ const t = currentDoc.createElement("template");
2258
+ t.innerHTML = n;
2259
+ return t.content;
2260
+ }
2261
+ return n;
2262
+ });
2263
+ const pos = options.position || "lastChild";
2264
+ if (pos === "lastChild")
2265
+ targetEl.append(...normalizedNodes);
2266
+ else if (pos === "firstChild")
2267
+ targetEl.prepend(...normalizedNodes);
2268
+ else if (pos === "nextSibling")
2269
+ targetEl.after(...normalizedNodes);
2270
+ else if (pos === "previousSibling")
2271
+ targetEl.before(...normalizedNodes);
2272
+ }
2273
+ }
2274
+ return res;
2275
+ };
2276
+ }
2277
+ });
2142
2278
  const originalProto = constructor.prototype;
2143
2279
  const newProto = NewClass.prototype;
2144
2280
  Object.getOwnPropertyNames(originalProto).forEach((name) => {
@@ -2210,6 +2346,22 @@ var dooboostoreSimpleWebComponent = (() => {
2210
2346
  }
2211
2347
  return (this.shadowRoot || this).querySelector(selector);
2212
2348
  },
2349
+ set(nv) {
2350
+ if (nv === null || nv === void 0) {
2351
+ const r = options.root || "auto";
2352
+ let targetEl = null;
2353
+ if (r === "shadow")
2354
+ targetEl = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
2355
+ else if (r === "light")
2356
+ targetEl = this.querySelector(selector);
2357
+ else if (r === "all")
2358
+ targetEl = this.shadowRoot?.querySelector(selector) || this.querySelector(selector);
2359
+ else
2360
+ targetEl = (this.shadowRoot || this).querySelector(selector);
2361
+ if (targetEl)
2362
+ targetEl.remove();
2363
+ }
2364
+ },
2213
2365
  enumerable: true,
2214
2366
  configurable: true
2215
2367
  });
@@ -2265,6 +2417,24 @@ var dooboostoreSimpleWebComponent = (() => {
2265
2417
  const root = this.shadowRoot || this;
2266
2418
  return root.querySelectorAll(selector);
2267
2419
  },
2420
+ set(nv) {
2421
+ if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
2422
+ const r = options.root || "auto";
2423
+ let targets = [];
2424
+ if (r === "shadow")
2425
+ targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
2426
+ else if (r === "light")
2427
+ targets = Array.from(this.querySelectorAll(selector));
2428
+ else if (r === "all") {
2429
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
2430
+ const lNodes = Array.from(this.querySelectorAll(selector));
2431
+ targets = [...sNodes, ...lNodes];
2432
+ } else {
2433
+ targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
2434
+ }
2435
+ targets.forEach((t) => t.remove());
2436
+ }
2437
+ },
2268
2438
  enumerable: true,
2269
2439
  configurable: true
2270
2440
  });