@dooboostore/simple-web-component 1.0.39 → 1.0.41

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 (98) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +235 -47
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +194 -111
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyNode.js +58 -43
  7. package/dist/cjs/decorators/applyNode.js.map +2 -2
  8. package/dist/cjs/decorators/applyProperty.js +213 -0
  9. package/dist/cjs/decorators/applyProperty.js.map +7 -0
  10. package/dist/cjs/decorators/applySlot.js +32 -26
  11. package/dist/cjs/decorators/applySlot.js.map +2 -2
  12. package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
  13. package/dist/cjs/decorators/elementDefine.js +17 -30
  14. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  15. package/dist/cjs/decorators/index.js +2 -2
  16. package/dist/cjs/decorators/index.js.map +2 -2
  17. package/dist/cjs/decorators/lifecycles.js +4 -4
  18. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  19. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
  20. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  21. package/dist/cjs/elements/SwcApp.js.map +2 -2
  22. package/dist/cjs/elements/SwcAppMixin.js +11 -4
  23. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  24. package/dist/cjs/types/index.js.map +1 -1
  25. package/dist/esm/SwcAppEngine.js.map +2 -2
  26. package/dist/esm/decorators/applyAttribute.js +196 -113
  27. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  28. package/dist/esm/decorators/applyNode.js +58 -43
  29. package/dist/esm/decorators/applyNode.js.map +2 -2
  30. package/dist/esm/decorators/applyProperty.js +194 -0
  31. package/dist/esm/decorators/applyProperty.js.map +7 -0
  32. package/dist/esm/decorators/applySlot.js +32 -26
  33. package/dist/esm/decorators/applySlot.js.map +2 -2
  34. package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
  35. package/dist/esm/decorators/elementDefine.js +17 -30
  36. package/dist/esm/decorators/elementDefine.js.map +2 -2
  37. package/dist/esm/decorators/index.js +2 -2
  38. package/dist/esm/decorators/index.js.map +1 -1
  39. package/dist/esm/decorators/lifecycles.js +4 -4
  40. package/dist/esm/decorators/lifecycles.js.map +2 -2
  41. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
  42. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  43. package/dist/esm/elements/SwcApp.js.map +2 -2
  44. package/dist/esm/elements/SwcAppMixin.js +11 -4
  45. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  46. package/dist/esm/types/index.js.map +1 -1
  47. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +441 -401
  48. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  49. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  50. package/dist/types/decorators/applyAttribute.d.ts +56 -15
  51. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  52. package/dist/types/decorators/applyNode.d.ts +28 -24
  53. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  54. package/dist/types/decorators/applyProperty.d.ts +61 -0
  55. package/dist/types/decorators/applyProperty.d.ts.map +1 -0
  56. package/dist/types/decorators/applySlot.d.ts +10 -10
  57. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  58. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  59. package/dist/types/decorators/index.d.ts +2 -2
  60. package/dist/types/decorators/index.d.ts.map +1 -1
  61. package/dist/types/decorators/lifecycles.d.ts +4 -4
  62. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  63. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
  64. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  65. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  66. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  67. package/dist/types/types/index.d.ts +1 -6
  68. package/dist/types/types/index.d.ts.map +1 -1
  69. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +441 -401
  70. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  71. package/package.json +3 -3
  72. package/src/SwcAppEngine.ts +1 -0
  73. package/src/decorators/applyAttribute.ts +311 -126
  74. package/src/decorators/applyNode.ts +68 -57
  75. package/src/decorators/applyProperty.ts +302 -0
  76. package/src/decorators/applySlot.ts +25 -18
  77. package/src/decorators/changedAttributeThis.ts +1 -1
  78. package/src/decorators/elementDefine.ts +41 -30
  79. package/src/decorators/index.ts +2 -3
  80. package/src/decorators/lifecycles.ts +6 -6
  81. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +14 -4
  82. package/src/elements/SwcApp.ts +0 -1
  83. package/src/elements/SwcAppMixin.ts +16 -4
  84. package/src/types/index.ts +7 -7
  85. package/dist/cjs/decorators/attribute.js +0 -187
  86. package/dist/cjs/decorators/attribute.js.map +0 -7
  87. package/dist/cjs/decorators/setProperty.js +0 -109
  88. package/dist/cjs/decorators/setProperty.js.map +0 -7
  89. package/dist/esm/decorators/attribute.js +0 -168
  90. package/dist/esm/decorators/attribute.js.map +0 -7
  91. package/dist/esm/decorators/setProperty.js +0 -90
  92. package/dist/esm/decorators/setProperty.js.map +0 -7
  93. package/dist/types/decorators/attribute.d.ts +0 -31
  94. package/dist/types/decorators/attribute.d.ts.map +0 -1
  95. package/dist/types/decorators/setProperty.d.ts +0 -17
  96. package/dist/types/decorators/setProperty.d.ts.map +0 -1
  97. package/src/decorators/attribute.ts +0 -223
  98. package/src/decorators/setProperty.ts +0 -112
@@ -17,143 +17,226 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var applyAttribute_exports = {};
19
19
  __export(applyAttribute_exports, {
20
- ATTRIBUTE_APPLY_METADATA_KEY: () => ATTRIBUTE_APPLY_METADATA_KEY,
20
+ ATTRIBUTE_METADATA_KEY: () => ATTRIBUTE_METADATA_KEY,
21
21
  applyAttribute: () => applyAttribute,
22
- applyAttributeThis: () => applyAttributeThis,
22
+ attribute: () => attribute,
23
+ attributeThis: () => attributeThis,
24
+ convertValue: () => convertValue,
25
+ default: () => applyAttribute_default,
23
26
  findAllAttributeApplyMetadata: () => findAllAttributeApplyMetadata,
24
- removeAttribute: () => removeAttribute,
25
- removeAttributeThis: () => removeAttributeThis,
27
+ findAllAttributeMetadata: () => findAllAttributeMetadata,
28
+ getAttributeValue: () => getAttributeValue,
29
+ resolveAttributeTargets: () => resolveAttributeTargets,
26
30
  setAttribute: () => setAttribute,
27
- setAttributeThis: () => setAttributeThis,
28
- updateAttribute: () => updateAttribute,
29
- updateAttributeThis: () => updateAttributeThis
31
+ setAttributeThis: () => setAttributeThis
30
32
  });
31
33
  module.exports = __toCommonJS(applyAttribute_exports);
32
34
  var import_core = require("@dooboostore/core");
33
35
  var import_elementDefine = require("./elementDefine");
34
36
  var import_Utils = require("../utils/Utils");
35
- const ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for("simple-web-component:attribute-apply");
36
- function createAttributeDecorator(action) {
37
- return (selector, nameOrOptions, options = {}) => {
38
- return (target, propertyKey, descriptor) => {
39
- const constructor = target.constructor;
40
- let metaList = import_core.ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor);
41
- if (!metaList) {
42
- metaList = /* @__PURE__ */ new Map();
43
- import_core.ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);
37
+ var import_core_web = require("@dooboostore/core-web");
38
+ const ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
39
+ const convertValue = (val, type) => {
40
+ if (val === null || val === void 0) return val;
41
+ if (type === Number) return Number(val);
42
+ if (type === Boolean) return val === "false" || val === "0" ? false : true;
43
+ return val;
44
+ };
45
+ const getAttributeValue = (inst, attrName, options) => {
46
+ const conf = (0, import_elementDefine.getElementConfig)(inst);
47
+ const currentWin = inst._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
48
+ const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];
49
+ const primaryTarget = targets[0];
50
+ if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
51
+ let domVal = primaryTarget.getAttribute(attrName);
52
+ const ae = new import_core.ActionExpression(domVal);
53
+ const expr = ae.getFirstExpression("callReturn");
54
+ if (expr) {
55
+ try {
56
+ const result = import_core.FunctionUtils.executeReturn({
57
+ script: import_core_web.ConvertUtils.decodeHtmlEntity(expr.script, currentWin.document),
58
+ context: inst,
59
+ args: import_Utils.SwcUtils.getHelperAndHostSet(currentWin, inst)
60
+ });
61
+ return convertValue(result, options?.type);
62
+ } catch (err) {
63
+ console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);
64
+ return convertValue(domVal, options?.type);
44
65
  }
45
- let attributeName = typeof nameOrOptions === "string" ? nameOrOptions : void 0;
46
- let finalOptions = options;
47
- if (typeof nameOrOptions === "object" && nameOrOptions !== null) {
48
- finalOptions = nameOrOptions;
66
+ }
67
+ return convertValue(domVal, options?.type);
68
+ }
69
+ return null;
70
+ };
71
+ const resolveAttributeTargets = (inst, selector, options) => {
72
+ const conf = (0, import_elementDefine.getElementConfig)(inst);
73
+ const currentWin = conf.window;
74
+ const r = options.root || "auto";
75
+ const results = [];
76
+ const applyRoot = (target) => {
77
+ if (!target) return;
78
+ if (r === "auto") {
79
+ results.push(target);
80
+ } else {
81
+ if (r === "light" || r === "all") results.push(target);
82
+ if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
83
+ }
84
+ };
85
+ if (selector === "$this" || !selector) {
86
+ applyRoot(inst);
87
+ } else {
88
+ const hostSet = import_Utils.SwcUtils.getHostSet(inst);
89
+ if (selector === "$host") applyRoot(hostSet.$host);
90
+ else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
91
+ else if (selector === "$appHost") applyRoot(hostSet.$appHost);
92
+ else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
93
+ else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
94
+ else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
95
+ else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
96
+ else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
97
+ else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
98
+ else {
99
+ if (r === "shadow") {
100
+ const found = inst.shadowRoot?.querySelectorAll(selector);
101
+ if (found) results.push(...found);
102
+ } else if (r === "light") {
103
+ const found = inst.querySelectorAll(selector);
104
+ if (found) results.push(...found);
105
+ } else if (r === "all") {
106
+ const sMatch = inst.shadowRoot?.querySelectorAll(selector);
107
+ const lMatch = inst.querySelectorAll(selector);
108
+ if (sMatch) results.push(...sMatch);
109
+ if (lMatch) results.push(...lMatch);
110
+ } else {
111
+ const found = (inst.shadowRoot || inst).querySelectorAll(selector);
112
+ if (found) results.push(...found);
49
113
  }
50
- metaList.set(propertyKey, {
51
- propertyKey,
52
- selector,
53
- action,
54
- options: { ...finalOptions, name: attributeName }
114
+ }
115
+ }
116
+ return results;
117
+ };
118
+ function applyAttribute(selector, targetAttributeNameOrOptions, options) {
119
+ return (target, propertyKey, descriptor) => {
120
+ const constructor = target.constructor;
121
+ const designType = Reflect.getMetadata("design:type", target, propertyKey);
122
+ const metaType = descriptor && typeof descriptor.value === "function" ? "method" : "property";
123
+ let finalOptions = {};
124
+ let targetAttributeName;
125
+ if (typeof targetAttributeNameOrOptions === "string") {
126
+ targetAttributeName = targetAttributeNameOrOptions;
127
+ finalOptions = options || {};
128
+ } else if (targetAttributeNameOrOptions) {
129
+ finalOptions = targetAttributeNameOrOptions;
130
+ targetAttributeName = finalOptions.name || String(propertyKey);
131
+ } else {
132
+ targetAttributeName = String(propertyKey);
133
+ }
134
+ let metaList = import_core.ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor);
135
+ if (!metaList) {
136
+ metaList = [];
137
+ import_core.ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);
138
+ }
139
+ metaList.push({
140
+ propertyKey,
141
+ selector,
142
+ targetAttributeName,
143
+ options: finalOptions,
144
+ type: metaType
145
+ });
146
+ const applyValueToTargets = (inst, resolvedValue) => {
147
+ const conf = (0, import_elementDefine.getElementConfig)(inst);
148
+ const currentWin = conf.window;
149
+ const targetEls = resolveAttributeTargets(inst, selector, finalOptions);
150
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(currentWin, inst);
151
+ targetEls.forEach((targetEl) => {
152
+ if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: inst, helper: hostSet })) {
153
+ return;
154
+ }
155
+ if (resolvedValue === null) {
156
+ targetEl.removeAttribute(targetAttributeName);
157
+ } else if (resolvedValue !== void 0) {
158
+ targetEl.setAttribute(targetAttributeName, resolvedValue === true ? "" : String(resolvedValue));
159
+ }
55
160
  });
161
+ return resolvedValue;
162
+ };
163
+ if (descriptor && typeof descriptor.value === "function") {
56
164
  const original = descriptor.value;
57
165
  descriptor.value = function(...args) {
58
166
  (0, import_elementDefine.ensureInit)(this);
59
167
  const res = original.apply(this, args);
60
- const handleResult = (resolvedValue) => {
61
- if (resolvedValue !== void 0) {
62
- const win = this.ownerDocument?.defaultView || window;
63
- const host = this;
64
- const hostSet = { ...import_Utils.SwcUtils.getHelperAndHostSet(win, host), $this: this };
65
- const r = finalOptions.root || "auto";
66
- const targetEls = [];
67
- const applyRoot = (t) => {
68
- if (!t || !(t instanceof win.HTMLElement)) return;
69
- targetEls.push(t);
70
- };
71
- if (selector === "$this" || !selector) applyRoot(host);
72
- else if (selector === "$host") applyRoot(hostSet.$host);
73
- else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
74
- else if (selector === "$appHost") applyRoot(hostSet.$appHost);
75
- else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
76
- else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
77
- else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
78
- else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
79
- else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
80
- else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
81
- else {
82
- const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
83
- if (targetRoot) {
84
- const found = targetRoot.querySelectorAll(selector);
85
- if (found) targetEls.push(...Array.from(found));
86
- }
87
- }
88
- targetEls.forEach((targetEl) => {
89
- if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
90
- return;
91
- }
92
- const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
93
- if (action === "set" || action === "update") {
94
- if (attributeName) {
95
- if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
96
- targetEl.removeAttribute(attributeName);
97
- } else {
98
- targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
99
- }
100
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
101
- Object.entries(resolvedRes).forEach(([attr, val]) => {
102
- const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
103
- if (finalVal === null || finalVal === void 0 || finalVal === false) {
104
- targetEl.removeAttribute(attr);
105
- } else {
106
- targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
107
- }
108
- });
109
- }
110
- } else if (action === "remove") {
111
- if (attributeName) {
112
- targetEl.removeAttribute(attributeName);
113
- } else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
114
- Object.entries(resolvedRes).forEach(([attr, val]) => {
115
- const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
116
- if (shouldRemove) targetEl.removeAttribute(attr);
117
- });
118
- } else {
119
- const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
120
- attrs.forEach((a) => targetEl.removeAttribute(String(a)));
121
- }
122
- }
123
- });
124
- }
125
- return resolvedValue;
126
- };
127
168
  if (res instanceof Promise) {
128
- return res.then(handleResult);
169
+ return res.then((v) => {
170
+ applyValueToTargets(this, v);
171
+ return v;
172
+ });
129
173
  } else {
130
- return handleResult(res);
174
+ applyValueToTargets(this, res);
175
+ return res;
131
176
  }
132
177
  };
133
- return descriptor;
134
- };
178
+ return;
179
+ }
180
+ Object.defineProperty(target, propertyKey, {
181
+ configurable: true,
182
+ enumerable: true,
183
+ get() {
184
+ (0, import_elementDefine.ensureInit)(this);
185
+ const mergedOptions = { ...finalOptions, selector, type: finalOptions.type || designType };
186
+ return getAttributeValue(this, targetAttributeName, mergedOptions);
187
+ },
188
+ set(value) {
189
+ (0, import_elementDefine.ensureInit)(this);
190
+ if (value instanceof Promise) {
191
+ value.then((v) => applyValueToTargets(this, v)).catch(() => {
192
+ });
193
+ } else {
194
+ applyValueToTargets(this, value);
195
+ }
196
+ }
197
+ });
135
198
  };
136
199
  }
137
- function applyAttribute(selector, action = "update", options = {}) {
138
- return createAttributeDecorator(action)(selector, options);
200
+ function attribute(selector, targetAttributeNameOrOptions, options) {
201
+ return applyAttribute(selector, targetAttributeNameOrOptions, options);
202
+ }
203
+ function attributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
204
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") {
205
+ return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
206
+ }
207
+ if (typeof targetOrOptions === "string") {
208
+ return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
209
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
210
+ return applyAttribute("$this", void 0, targetOrOptions);
211
+ } else {
212
+ return applyAttribute("$this", void 0, {});
213
+ }
139
214
  }
140
- const setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
141
- const updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
142
- const removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
143
- function applyAttributeThis(action = "update", options = {}) {
144
- return createAttributeDecorator(action)("$this", options);
215
+ function setAttribute(selector, targetAttributeNameOrOptions, options) {
216
+ return applyAttribute(selector, targetAttributeNameOrOptions, options);
145
217
  }
146
- const setAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("set")("$this", nameOrOptions, options);
147
- const updateAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("update")("$this", nameOrOptions, options);
148
- const removeAttributeThis = (nameOrOptions, options = {}) => createAttributeDecorator("remove")("$this", nameOrOptions, options);
218
+ function setAttributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
219
+ if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
220
+ return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
221
+ }
222
+ if (typeof targetOrOptions === "string") {
223
+ return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
224
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
225
+ return applyAttribute("$this", void 0, targetOrOptions);
226
+ } else {
227
+ return applyAttribute("$this", void 0, {});
228
+ }
229
+ }
230
+ const findAllAttributeMetadata = (target) => {
231
+ const actualTarget = target instanceof Function ? target : target.constructor;
232
+ return import_core.ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, actualTarget).flat();
233
+ };
149
234
  const findAllAttributeApplyMetadata = (target) => {
150
235
  const result = /* @__PURE__ */ new Map();
151
- const maps = import_core.ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
152
- maps.forEach((map) => {
153
- if (map instanceof Map) {
154
- map.forEach((v, k) => result.set(k, v));
155
- }
236
+ findAllAttributeMetadata(target).forEach((meta) => {
237
+ result.set(meta.propertyKey, meta);
156
238
  });
157
239
  return result;
158
240
  };
241
+ var applyAttribute_default = applyAttribute;
159
242
  //# sourceMappingURL=applyAttribute.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/applyAttribute.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport type AttributeAction = 'set' | 'update' | 'remove';\n\nexport interface AttributeApplyOptions extends SwcQueryOptions {\n name?: string;\n filter?: (target: HTMLElement, value: any, meta: {currentThis: any, helper: HelperHostSet}) => boolean;\n}\n\nexport interface AttributeApplyMetadata {\n propertyKey: string | symbol;\n selector: string;\n action: AttributeAction;\n options: AttributeApplyOptions;\n}\n\nexport const ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for('simple-web-component:attribute-apply');\n\nfunction createAttributeDecorator(action: AttributeAction) {\n return (selector: string, nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}): MethodDecorator => {\n return (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const constructor = target.constructor;\n let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor) as Map<string | symbol, AttributeApplyMetadata>;\n if (!metaList) {\n metaList = new Map<string | symbol, AttributeApplyMetadata>();\n ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);\n }\n\n let attributeName = typeof nameOrOptions === 'string' ? nameOrOptions : undefined;\n let finalOptions = options;\n \n if (typeof nameOrOptions === 'object' && nameOrOptions !== null) {\n finalOptions = nameOrOptions as AttributeApplyOptions;\n }\n\n metaList.set(propertyKey, { \n propertyKey, \n selector, \n action, \n options: { ...finalOptions, name: attributeName } \n });\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n const res = (original as any).apply(this, args);\n\n const handleResult = (resolvedValue: any) => {\n if (resolvedValue !== undefined) {\n const win = (this as any).ownerDocument?.defaultView || window;\n const host = this as unknown as HTMLElement;\n const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };\n const r = finalOptions.root || 'auto';\n const targetEls: HTMLElement[] = [];\n\n const applyRoot = (t: any) => {\n if (!t || !(t instanceof win.HTMLElement)) return;\n targetEls.push(t);\n };\n\n if (selector === '$this' || !selector) applyRoot(host);\n else if (selector === '$host') applyRoot(hostSet.$host);\n else if (selector === '$parentHost') applyRoot(hostSet.$parentHost);\n else if (selector === '$appHost') applyRoot(hostSet.$appHost);\n else if (selector === '$firstHost') applyRoot(hostSet.$firstHost);\n else if (selector === '$lastHost') applyRoot(hostSet.$lastHost);\n else if (selector === '$firstAppHost') applyRoot(hostSet.$firstAppHost);\n else if (selector === '$lastAppHost') applyRoot(hostSet.$lastAppHost);\n else if (selector === '$hosts') hostSet.$hosts.forEach(applyRoot);\n else if (selector === '$appHosts') hostSet.$appHosts.forEach(applyRoot);\n else {\n const targetRoot = r === 'auto' ? (host.shadowRoot || host) : (r === 'shadow' ? host.shadowRoot : host);\n if (targetRoot) {\n const found = targetRoot.querySelectorAll(selector);\n if (found) targetEls.push(...(Array.from(found) as HTMLElement[]));\n }\n }\n\n targetEls.forEach(targetEl => {\n if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, {currentThis: this, helper: hostSet})) {\n return;\n }\n const resolvedRes = typeof resolvedValue === 'function' ? (resolvedValue as any)(targetEl, hostSet) : resolvedValue;\n\n if (action === 'set' || action === 'update') {\n if (attributeName) {\n // Case: @setAttribute(selector, 'name')\n if (resolvedRes === null || resolvedRes === undefined || resolvedRes === false) {\n targetEl.removeAttribute(attributeName);\n } else {\n targetEl.setAttribute(attributeName, resolvedRes === true ? '' : String(resolvedRes));\n }\n } else if (typeof resolvedRes === 'object' && resolvedRes !== null && !Array.isArray(resolvedRes)) {\n // Case: @applyAttribute(selector) with Object return\n Object.entries(resolvedRes as any).forEach(([attr, val]) => {\n const finalVal = typeof val === 'function' ? val(targetEl, hostSet) : val;\n if (finalVal === null || finalVal === undefined || finalVal === false) {\n targetEl.removeAttribute(attr);\n } else {\n targetEl.setAttribute(attr, finalVal === true ? '' : String(finalVal));\n }\n });\n }\n } else if (action === 'remove') {\n if (attributeName) {\n targetEl.removeAttribute(attributeName);\n } else if (typeof resolvedRes === 'object' && resolvedRes !== null && !Array.isArray(resolvedRes)) {\n Object.entries(resolvedRes as any).forEach(([attr, val]) => {\n const shouldRemove = typeof val === 'function' ? val(targetEl, hostSet) : !!val;\n if (shouldRemove) targetEl.removeAttribute(attr);\n });\n } else {\n const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];\n attrs.forEach(a => targetEl.removeAttribute(String(a)));\n }\n }\n });\n }\n return resolvedValue;\n };\n\n if (res instanceof Promise) {\n return res.then(handleResult);\n } else {\n return handleResult(res);\n }\n };\n return descriptor;\n };\n };\n}\n\nexport function applyAttribute(selector: string, action: AttributeAction = 'update', options: AttributeApplyOptions = {}): MethodDecorator {\n return createAttributeDecorator(action)(selector, options);\n}\n\nexport const setAttribute = (selector: string, nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('set')(selector, nameOrOptions, options);\nexport const updateAttribute = (selector: string, nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('update')(selector, nameOrOptions, options);\nexport const removeAttribute = (selector: string, nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('remove')(selector, nameOrOptions, options);\n\n// This versions\nexport function applyAttributeThis(action: AttributeAction = 'update', options: AttributeApplyOptions = {}): MethodDecorator {\n return createAttributeDecorator(action)('$this', options);\n}\nexport const setAttributeThis = (nameOrOptions: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('set')('$this', nameOrOptions, options);\nexport const updateAttributeThis = (nameOrOptions: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('update')('$this', nameOrOptions, options);\nexport const removeAttributeThis = (nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('remove')('$this', nameOrOptions, options);\n\nexport const findAllAttributeApplyMetadata = (target: any): Map<string | symbol, AttributeApplyMetadata> => {\n const result = new Map<string | symbol, AttributeApplyMetadata>();\n const maps = ReflectUtils.findAllMetadata<Map<string | symbol, AttributeApplyMetadata>>(ATTRIBUTE_APPLY_METADATA_KEY, target);\n maps.forEach(map => {\n if (map instanceof Map) {\n map.forEach((v, k) => result.set(k, v));\n }\n });\n return result;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAC7B,2BAA2B;AAC3B,mBAAyB;AAiBlB,MAAM,+BAA+B,OAAO,IAAI,sCAAsC;AAE7F,SAAS,yBAAyB,QAAyB;AACzD,SAAO,CAAC,UAAkB,eAAgD,UAAiC,CAAC,MAAuB;AACjI,WAAO,CAAC,QAAgB,aAA8B,eAAmC;AACvF,YAAM,cAAc,OAAO;AAC3B,UAAI,WAAW,yBAAa,eAAe,8BAA8B,WAAW;AACpF,UAAI,CAAC,UAAU;AACb,mBAAW,oBAAI,IAA6C;AAC5D,iCAAa,eAAe,8BAA8B,UAAU,WAAW;AAAA,MACjF;AAEA,UAAI,gBAAgB,OAAO,kBAAkB,WAA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iC,CAAC,MAAM,yBAAyB,QAAQ,EAAE,SAAS,eAAe,OAAO;AACtL,MAAM,sBAAsB,CAAC,eAAgD,UAAiC,CAAC,MAAM,yBAAyB,QAAQ,EAAE,SAAS,eAAe,OAAO;AAEvL,MAAM,gCAAgC,CAAC,WAA8D;AAC1G,QAAM,SAAS,oBAAI,IAA6C;AAChE,QAAM,OAAO,yBAAa,gBAA8D,8BAA8B,MAAM;AAC5H,OAAK,QAAQ,SAAO;AAClB,QAAI,eAAe,KAAK;AACtB,UAAI,QAAQ,CAAC,GAAG,MAAM,OAAO,IAAI,GAAG,CAAC,CAAC;AAAA,IACxC;AAAA,EACF,CAAC;AACD,SAAO;AACT;",
4
+ "sourcesContent": ["import {ReflectUtils, FunctionUtils, ActionExpression} from '@dooboostore/core';\nimport {ensureInit, getElementConfig} from './elementDefine';\nimport {SwcUtils} from '../utils/Utils';\nimport {SwcQueryOptions, HelperHostSet} from '../types';\nimport {ConvertUtils} from '@dooboostore/core-web';\n\n// ============================================\n// Types & Interfaces\n// ============================================\n\nexport interface AttributeOptions extends SwcQueryOptions {\n name?: string;\n type?: typeof Number | typeof Boolean | typeof String;\n filter?: (target: HTMLElement, value: any, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n}\n\nexport interface AttributeMetadata {\n propertyKey: string | symbol;\n selector: string;\n targetAttributeName: string;\n options: AttributeOptions;\n type: 'property' | 'method';\n}\n\nexport const ATTRIBUTE_METADATA_KEY = Symbol.for('simple-web-component:attribute');\n\n// ============================================\n// Utilities\n// ============================================\n\nconst convertValue = (val: string | null, type: any): any => {\n if (val === null || val === undefined) return val;\n if (type === Number) return Number(val);\n if (type === Boolean) return val === 'false' || val === '0' ? false : true;\n return val;\n};\n\nexport {convertValue};\n\nexport const getAttributeValue = (inst: any, attrName: string, options?: AttributeOptions & { selector?: string }): any => {\n const conf = getElementConfig(inst);\n const currentWin = inst._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as any);\n\n // If selector is not provided, use inst itself\n const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];\n\n const primaryTarget = targets[0];\n\n if (primaryTarget && typeof (primaryTarget as any).hasAttribute === 'function' && (primaryTarget as any).hasAttribute(attrName)) {\n let domVal = (primaryTarget as any).getAttribute(attrName);\n\n // \uD45C\uD604\uC2DD \uCCB4\uD06C\n const ae = new ActionExpression(domVal);\n const expr = ae.getFirstExpression('callReturn');\n if (expr) {\n try {\n const result = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, currentWin.document),\n context: inst,\n args: SwcUtils.getHelperAndHostSet(currentWin, inst)\n });\n return convertValue(result, options?.type);\n } catch (err) {\n console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);\n return convertValue(domVal, options?.type);\n }\n }\n\n return convertValue(domVal, options?.type);\n }\n\n // If no target found, return null\n return null;\n};\n\n/**\n * Resolve target elements based on selector and options\n * Handles special selectors ($this, $host, etc.) and CSS selectors\n * Returns HTMLElement[] for attribute operations\n */\nexport const resolveAttributeTargets = (inst: any, selector: string, options: AttributeOptions): HTMLElement[] => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const r = options.root || 'auto';\n const results: HTMLElement[] = [];\n\n const applyRoot = (target: any) => {\n if (!target) return;\n if (r === 'auto') {\n results.push(target);\n } else {\n if (r === 'light' || r === 'all') results.push(target);\n if ((r === 'shadow' || r === 'all') && target.shadowRoot) results.push(target.shadowRoot);\n }\n };\n\n if (selector === '$this' || !selector) {\n applyRoot(inst);\n } else {\n const hostSet = SwcUtils.getHostSet(inst);\n if (selector === '$host') applyRoot(hostSet.$host);\n else if (selector === '$parentHost') applyRoot(hostSet.$parentHost);\n else if (selector === '$appHost') applyRoot(hostSet.$appHost as any);\n else if (selector === '$firstHost') applyRoot(hostSet.$firstHost);\n else if (selector === '$lastHost') applyRoot(hostSet.$lastHost);\n else if (selector === '$firstAppHost') applyRoot(hostSet.$firstAppHost as any);\n else if (selector === '$lastAppHost') applyRoot(hostSet.$lastAppHost as any);\n else if (selector === '$hosts') hostSet.$hosts.forEach(applyRoot);\n else if (selector === '$appHosts') hostSet.$appHosts.forEach(applyRoot);\n else {\n if (r === 'shadow') {\n const found = inst.shadowRoot?.querySelectorAll(selector);\n if (found) results.push(...found);\n } else if (r === 'light') {\n const found = inst.querySelectorAll(selector);\n if (found) results.push(...found);\n } else if (r === 'all') {\n const sMatch = inst.shadowRoot?.querySelectorAll(selector);\n const lMatch = inst.querySelectorAll(selector);\n if (sMatch) results.push(...sMatch);\n if (lMatch) results.push(...lMatch);\n } else {\n const found = (inst.shadowRoot || inst).querySelectorAll(selector);\n if (found) results.push(...found);\n }\n }\n }\n return results;\n};\n\n/**\n * @applyAttribute decorator - set/get element attributes\n *\n * Usage:\n * - @applyAttribute('selector', 'attrName') - Set attribute with explicit name\n * - @applyAttribute('selector') - Use property name as attribute name\n * - @applyAttribute('selector', { name: 'attrName' }) - Set attribute via options\n * - Return null to remove attribute\n */\nexport function applyAttribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function applyAttribute(selector: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function applyAttribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator & PropertyDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n // ensureInit(target as any);\n\n const constructor = target.constructor;\n const designType = (Reflect as any).getMetadata('design:type', target, propertyKey);\n const metaType: 'property' | 'method' = descriptor && typeof descriptor.value === 'function' ? 'method' : 'property';\n\n // Parse arguments\n let finalOptions: AttributeOptions = {};\n let targetAttributeName: string;\n\n if (typeof targetAttributeNameOrOptions === 'string') {\n // applyAttribute('selector', 'attrName', options?)\n targetAttributeName = targetAttributeNameOrOptions;\n finalOptions = options || {};\n } else if (targetAttributeNameOrOptions) {\n // applyAttribute('selector', options)\n finalOptions = targetAttributeNameOrOptions;\n targetAttributeName = finalOptions.name || String(propertyKey);\n } else {\n // applyAttribute('selector')\n targetAttributeName = String(propertyKey);\n }\n\n // Store metadata\n let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor) as AttributeMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);\n }\n metaList.push({\n propertyKey,\n selector,\n targetAttributeName,\n options: finalOptions,\n type: metaType\n });\n\n // Helper: Apply resolved value to targets\n const applyValueToTargets = (inst: any, resolvedValue: any) => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const targetEls = resolveAttributeTargets(inst, selector, finalOptions);\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);\n\n targetEls.forEach(targetEl => {\n // Apply filter if provided\n if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, {currentThis: inst, helper: hostSet})) {\n return;\n }\n\n if (resolvedValue === null) {\n // Remove attribute if value is null\n targetEl.removeAttribute(targetAttributeName);\n } else if (resolvedValue !== undefined) {\n // Set attribute\n targetEl.setAttribute(targetAttributeName, resolvedValue === true ? '' : String(resolvedValue));\n }\n });\n\n return resolvedValue;\n };\n\n // Method decorator: wrap method to apply its return value to attributes\n if (descriptor && typeof descriptor.value === 'function') {\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n const res = (original as any).apply(this, args);\n\n if (res instanceof Promise) {\n return res.then((v: any) => {\n applyValueToTargets(this, v);\n return v;\n });\n } else {\n applyValueToTargets(this, res);\n return res;\n }\n };\n return;\n }\n\n // Property decorator: define getter/setter to proxy to element attributes\n Object.defineProperty(target, propertyKey, {\n configurable: true,\n enumerable: true,\n get(this: any) {\n ensureInit(this);\n const mergedOptions = {...finalOptions, selector, type: finalOptions.type || designType};\n return getAttributeValue(this, targetAttributeName, mergedOptions);\n },\n set(this: any, value: any) {\n ensureInit(this);\n\n if (value instanceof Promise) {\n value.then((v: any) => applyValueToTargets(this, v)).catch(() => { /* swallow */\n });\n } else {\n applyValueToTargets(this, value);\n }\n }\n });\n };\n}\n\n// ============================================\n// Convenience Aliases\n// ============================================\n\n/**\n * @attribute - Alias for @applyAttribute\n */\nexport function attribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attribute(selector: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator & PropertyDecorator {\n return applyAttribute(selector, targetAttributeNameOrOptions as any, options);\n}\n\n/**\n * @attributeThis - Apply attribute on $this element\n * Can be used as: @attributeThis or @attributeThis('attrName') or @attributeThis({ name: 'attrName' })\n */\nexport function attributeThis(target: Object, propertyKey: string | symbol): void;\nexport function attributeThis(targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attributeThis(options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attributeThis(targetOrOptions?: any, propertyKeyOrOptions?: any, descriptor?: PropertyDescriptor): any {\n // Direct decorator usage: @attributeThis\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null && !Array.isArray(targetOrOptions) &&\n typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol') {\n // Called as @attributeThis (target, propertyKey)\n return applyAttribute('$this', undefined as any, {})(targetOrOptions, propertyKeyOrOptions, descriptor);\n }\n\n // Called with parameters\n if (typeof targetOrOptions === 'string') {\n // @attributeThis('attrName', options?)\n return applyAttribute('$this', targetOrOptions, propertyKeyOrOptions);\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // @attributeThis({ name: 'attrName' })\n return applyAttribute('$this', undefined as any, targetOrOptions);\n } else {\n // @attributeThis() or @attributeThis\n return applyAttribute('$this', undefined as any, {});\n }\n}\n\n/**\n * @setAttribute - Alias for @applyAttribute (method-decorator semantics)\n */\nexport function setAttribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttribute(selector: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator {\n return applyAttribute(selector, targetAttributeNameOrOptions as any, options) as MethodDecorator;\n}\n\n/**\n * @setAttributeThis - Set attribute on $this element\n * Can be used as: @setAttributeThis or @setAttributeThis('attrName') or @setAttributeThis({ name: 'attrName' })\n */\nexport function setAttributeThis(target: Object, propertyKey: string | symbol): void;\nexport function setAttributeThis(targetAttributeName: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttributeThis(options?: AttributeOptions): MethodDecorator;\nexport function setAttributeThis(targetOrOptions?: any, propertyKeyOrOptions?: any, descriptor?: PropertyDescriptor): any {\n // Direct decorator usage: @setAttributeThis\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null && !Array.isArray(targetOrOptions) &&\n (typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol')) {\n // Called as @setAttributeThis (target, propertyKey)\n return applyAttribute('$this', undefined as any, {})(targetOrOptions, propertyKeyOrOptions, descriptor);\n }\n\n // Called with parameters\n if (typeof targetOrOptions === 'string') {\n // @setAttributeThis('attrName', options?)\n return applyAttribute('$this', targetOrOptions, propertyKeyOrOptions) as MethodDecorator;\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // @setAttributeThis({ name: 'attrName' })\n return applyAttribute('$this', undefined as any, targetOrOptions) as MethodDecorator;\n } else {\n // @setAttributeThis() or @setAttributeThis\n return applyAttribute('$this', undefined as any, {}) as MethodDecorator;\n }\n}\n\n// ============================================\n// Metadata Helpers\n// ============================================\n\nexport const findAllAttributeMetadata = (target: any): AttributeMetadata[] => {\n const actualTarget = target instanceof Function ? target : target.constructor;\n return ReflectUtils.findAllMetadata<AttributeMetadata[]>(ATTRIBUTE_METADATA_KEY, actualTarget).flat();\n};\n\n// Backward compatibility alias\nexport const findAllAttributeApplyMetadata = (target: any): Map<string | symbol, AttributeMetadata> => {\n const result = new Map<string | symbol, AttributeMetadata>();\n findAllAttributeMetadata(target).forEach(meta => {\n result.set(meta.propertyKey, meta);\n });\n return result;\n};\n\n\nexport default applyAttribute;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4D;AAC5D,2BAA2C;AAC3C,mBAAuB;AAEvB,sBAA2B;AAoBpB,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAMjF,MAAM,eAAe,CAAC,KAAoB,SAAmB;AAC3D,MAAI,QAAQ,QAAQ,QAAQ,OAAW,QAAO;AAC9C,MAAI,SAAS,OAAQ,QAAO,OAAO,GAAG;AACtC,MAAI,SAAS,QAAS,QAAO,QAAQ,WAAW,QAAQ,MAAM,QAAQ;AACtE,SAAO;AACT;AAIO,MAAM,oBAAoB,CAAC,MAAW,UAAkB,YAA4D;AACzH,QAAM,WAAO,uCAAiB,IAAI;AAClC,QAAM,aAAa,KAAK,iBAAiB,IAAI,MAAO,OAAO,WAAW,cAAc,SAAS;AAG7F,QAAM,UAAU,SAAS,WAAW,wBAAwB,MAAM,QAAQ,UAAU,OAAO,IAAI,CAAC,IAAI;AAEpG,QAAM,gBAAgB,QAAQ,CAAC;AAE/B,MAAI,iBAAiB,OAAQ,cAAsB,iBAAiB,cAAe,cAAsB,aAAa,QAAQ,GAAG;AAC/H,QAAI,SAAU,cAAsB,aAAa,QAAQ;AAGzD,UAAM,KAAK,IAAI,6BAAiB,MAAM;AACtC,UAAM,OAAO,GAAG,mBAAmB,YAAY;AAC/C,QAAI,MAAM;AACR,UAAI;AACF,cAAM,SAAS,0BAAc,cAAc;AAAA,UACzC,QAAQ,6BAAa,iBAAiB,KAAK,QAAQ,WAAW,QAAQ;AAAA,UACtE,SAAS;AAAA,UACT,MAAM,sBAAS,oBAAoB,YAAY,IAAI;AAAA,QACrD,CAAC;AACD,eAAO,aAAa,QAAQ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,UAAU;AAEjE,WAAO,eAAe,SAAS,QAAkB,eAAe;AAAA,EAClE,OAAO;AAEL,WAAO,eAAe,SAAS,QAAkB,CAAC,CAAC;AAAA,EACrD;AACF;AAMO,MAAM,2BAA2B,CAAC,WAAqC;AAC5E,QAAM,eAAe,kBAAkB,WAAW,SAAS,OAAO;AAClE,SAAO,yBAAa,gBAAqC,wBAAwB,YAAY,EAAE,KAAK;AACtG;AAGO,MAAM,gCAAgC,CAAC,WAAyD;AACrG,QAAM,SAAS,oBAAI,IAAwC;AAC3D,2BAAyB,MAAM,EAAE,QAAQ,UAAQ;AAC/C,WAAO,IAAI,KAAK,aAAa,IAAI;AAAA,EACnC,CAAC;AACD,SAAO;AACT;AAGA,IAAO,yBAAQ;",
6
6
  "names": []
7
7
  }
@@ -18,22 +18,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var applyNode_exports = {};
19
19
  __export(applyNode_exports, {
20
20
  APPLY_NODE_METADATA_KEY: () => APPLY_NODE_METADATA_KEY,
21
+ afterBeginLightNodeThis: () => afterBeginLightNodeThis,
22
+ afterBeginNodeThis: () => afterBeginNodeThis,
21
23
  applyNode: () => applyNode,
22
- applyNodeInnerHtml: () => applyNodeInnerHtml,
23
- applyNodeInnerText: () => applyNodeInnerText,
24
- applyNodeReplaceChildren: () => applyNodeReplaceChildren,
25
24
  applyNodeThis: () => applyNodeThis,
26
- applyNodeThisAfterBegin: () => applyNodeThisAfterBegin,
27
- applyNodeThisAfterBeginLightDom: () => applyNodeThisAfterBeginLightDom,
28
- applyNodeThisBeforeEnd: () => applyNodeThisBeforeEnd,
29
- applyNodeThisBeforeEndLightDom: () => applyNodeThisBeforeEndLightDom,
30
- applyNodeThisBeforeEndShadow: () => applyNodeThisBeforeEndShadow,
31
- applyNodeThisInnerHtml: () => applyNodeThisInnerHtml,
32
- applyNodeThisReplaceChildren: () => applyNodeThisReplaceChildren,
33
- applyNodeThisReplaceChildrenLightDom: () => applyNodeThisReplaceChildrenLightDom,
34
- applyThisInnerHtmlNodeLightDom: () => applyThisInnerHtmlNodeLightDom,
35
- applyThisReplaceChildrenNodeLightDom: () => applyThisReplaceChildrenNodeLightDom,
36
- findAllApplyNodeMetadata: () => findAllApplyNodeMetadata
25
+ beforeEndLightNodeThis: () => beforeEndLightNodeThis,
26
+ beforeEndNodeThis: () => beforeEndNodeThis,
27
+ beforeEndShadowNodeThis: () => beforeEndShadowNodeThis,
28
+ findAllApplyNodeMetadata: () => findAllApplyNodeMetadata,
29
+ innerHtmlLightNode: () => innerHtmlLightNode,
30
+ innerHtmlLightNodeThis: () => innerHtmlLightNodeThis,
31
+ innerHtmlNode: () => innerHtmlNode,
32
+ innerHtmlNodeThis: () => innerHtmlNodeThis,
33
+ innerHtmlShadowNode: () => innerHtmlShadowNode,
34
+ innerTextLightNode: () => innerTextLightNode,
35
+ innerTextNode: () => innerTextNode,
36
+ innerTextNodeThis: () => innerTextNodeThis,
37
+ innerTextShadowNode: () => innerTextShadowNode,
38
+ replaceChildrenLightNodeThis: () => replaceChildrenLightNodeThis,
39
+ replaceChildrenNode: () => replaceChildrenNode,
40
+ replaceChildrenNodeThis: () => replaceChildrenNodeThis
37
41
  });
38
42
  module.exports = __toCommonJS(applyNode_exports);
39
43
  var import_core = require("@dooboostore/core");
@@ -114,7 +118,6 @@ function applyNode(selector, options = { position: "replaceChildren" }) {
114
118
  const targetRoot = applyRoot(this);
115
119
  return targetRoot ? targetRoot.querySelector(selector) : null;
116
120
  };
117
- console.log("fffffffffff");
118
121
  const targetEl = getTarget();
119
122
  const res = original.apply(this, args);
120
123
  const runApply = (target, val) => {
@@ -142,89 +145,101 @@ function applyNode(selector, options = { position: "replaceChildren" }) {
142
145
  };
143
146
  };
144
147
  }
145
- const findAllApplyNodeMetadata = (target) => {
146
- const result = /* @__PURE__ */ new Map();
147
- const maps = import_core.ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
148
- maps.forEach((map) => {
149
- if (map instanceof Map) {
150
- map.forEach((v, k) => result.set(k, v));
151
- }
152
- });
153
- return result;
154
- };
155
148
  function applyNodeThis(targetOrOptions, propertyKey, descriptor) {
156
149
  const option = { position: "replaceChildren" };
157
150
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
158
151
  const opt = targetOrOptions || {};
159
152
  return applyNode("$this", { ...option, ...opt });
160
153
  }
161
- function applyNodeThisReplaceChildren(targetOrOptions, propertyKey, descriptor) {
154
+ function replaceChildrenNodeThis(targetOrOptions, propertyKey, descriptor) {
162
155
  const option = { position: "replaceChildren" };
163
156
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
164
157
  const opt = targetOrOptions || {};
165
158
  return applyNode("$this", { ...opt, ...option });
166
159
  }
167
- function applyNodeThisReplaceChildrenLightDom(targetOrOptions, propertyKey, descriptor) {
168
- const options = { position: "replaceChildren", root: "light" };
169
- if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
170
- const opt = targetOrOptions || {};
171
- return applyNode("$this", { ...opt, ...options });
172
- }
173
- function applyNodeThisBeforeEnd(targetOrOptions, propertyKey, descriptor) {
160
+ function beforeEndNodeThis(targetOrOptions, propertyKey, descriptor) {
174
161
  const options = { position: "beforeEnd" };
175
162
  if (propertyKey !== void 0) return applyNode("$this", options)(targetOrOptions, propertyKey, descriptor);
176
163
  const opt = targetOrOptions || {};
177
164
  return applyNode("$this", { ...opt, ...options });
178
165
  }
179
- function applyNodeThisBeforeEndLightDom(targetOrOptions, propertyKey, descriptor) {
166
+ function beforeEndLightNodeThis(targetOrOptions, propertyKey, descriptor) {
180
167
  const option = { position: "beforeEnd", root: "light" };
181
168
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
182
169
  const opt = targetOrOptions || {};
183
170
  return applyNode("$this", { ...opt, ...option });
184
171
  }
185
- function applyNodeThisBeforeEndShadow(targetOrOptions, propertyKey, descriptor) {
172
+ function beforeEndShadowNodeThis(targetOrOptions, propertyKey, descriptor) {
186
173
  const option = { position: "beforeEnd", root: "shadow" };
187
174
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
188
175
  const opt = targetOrOptions || {};
189
176
  return applyNode("$this", { ...opt, ...option });
190
177
  }
191
- function applyNodeThisAfterBegin(targetOrOptions, propertyKey, descriptor) {
178
+ function afterBeginNodeThis(targetOrOptions, propertyKey, descriptor) {
192
179
  const option = { position: "afterBegin" };
193
180
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
194
181
  const opt = targetOrOptions || {};
195
182
  return applyNode("$this", { ...opt, ...option });
196
183
  }
197
- function applyNodeThisAfterBeginLightDom(targetOrOptions, propertyKey, descriptor) {
184
+ function afterBeginLightNodeThis(targetOrOptions, propertyKey, descriptor) {
198
185
  const option = { position: "afterBegin", root: "light" };
199
186
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
200
187
  const opt = targetOrOptions || {};
201
188
  return applyNode("$this", { ...opt, ...option });
202
189
  }
203
- function applyNodeThisInnerHtml(targetOrOptions, propertyKey, descriptor) {
190
+ function innerHtmlNodeThis(targetOrOptions, propertyKey, descriptor) {
204
191
  const option = { position: "innerHtml" };
205
192
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
206
193
  const opt = targetOrOptions || {};
207
194
  return applyNode("$this", { ...opt, ...option });
208
195
  }
209
- function applyThisInnerHtmlNodeLightDom(targetOrOptions, propertyKey, descriptor) {
196
+ function innerTextNodeThis(targetOrOptions, propertyKey, descriptor) {
197
+ const option = { position: "innerText" };
198
+ if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
199
+ const opt = targetOrOptions || {};
200
+ return applyNode("$this", { ...opt, ...option });
201
+ }
202
+ function innerHtmlLightNodeThis(targetOrOptions, propertyKey, descriptor) {
210
203
  const option = { position: "innerHtml", root: "light" };
211
204
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
212
205
  const opt = targetOrOptions || {};
213
206
  return applyNode("$this", { ...opt, ...option });
214
207
  }
215
- function applyThisReplaceChildrenNodeLightDom(targetOrOptions, propertyKey, descriptor) {
208
+ function replaceChildrenLightNodeThis(targetOrOptions, propertyKey, descriptor) {
216
209
  const option = { position: "replaceChildren", root: "light" };
217
210
  if (propertyKey !== void 0) return applyNode("$this", option)(targetOrOptions, propertyKey, descriptor);
218
211
  const opt = targetOrOptions || {};
219
212
  return applyNode("$this", { ...opt, ...option });
220
213
  }
221
- function applyNodeReplaceChildren(selector, options = {}) {
214
+ function replaceChildrenNode(selector, options = {}) {
222
215
  return applyNode(selector, { ...options, position: "replaceChildren" });
223
216
  }
224
- function applyNodeInnerHtml(selector, options = {}) {
217
+ function innerHtmlNode(selector, options = {}) {
225
218
  return applyNode(selector, { ...options, position: "innerHtml" });
226
219
  }
227
- function applyNodeInnerText(selector, options = {}) {
220
+ function innerHtmlLightNode(selector, options = {}) {
221
+ return applyNode(selector, { ...options, position: "innerHtml", root: "light" });
222
+ }
223
+ function innerHtmlShadowNode(selector, options = {}) {
224
+ return applyNode(selector, { ...options, position: "innerHtml", root: "shadow" });
225
+ }
226
+ function innerTextNode(selector, options = {}) {
228
227
  return applyNode(selector, { ...options, position: "innerText" });
229
228
  }
229
+ function innerTextLightNode(selector, options = {}) {
230
+ return applyNode(selector, { ...options, position: "innerText", root: "light" });
231
+ }
232
+ function innerTextShadowNode(selector, options = {}) {
233
+ return applyNode(selector, { ...options, position: "innerText", root: "shadow" });
234
+ }
235
+ const findAllApplyNodeMetadata = (target) => {
236
+ const result = /* @__PURE__ */ new Map();
237
+ const maps = import_core.ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
238
+ maps.forEach((map) => {
239
+ if (map instanceof Map) {
240
+ map.forEach((v, k) => result.set(k, v));
241
+ }
242
+ });
243
+ return result;
244
+ };
230
245
  //# sourceMappingURL=applyNode.js.map