@dooboostore/simple-web-component 1.0.43 → 1.0.45

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 (146) hide show
  1. package/README.md +312 -63
  2. package/dist/cjs/SwcAppEngine.js +3 -1
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  5. package/dist/cjs/decorators/applyAttribute.js +66 -43
  6. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  7. package/dist/cjs/decorators/applyClass.js +110 -43
  8. package/dist/cjs/decorators/applyClass.js.map +3 -3
  9. package/dist/cjs/decorators/applyNode.js +200 -112
  10. package/dist/cjs/decorators/applyNode.js.map +2 -2
  11. package/dist/cjs/decorators/applyProperty.js +49 -45
  12. package/dist/cjs/decorators/applyProperty.js.map +2 -2
  13. package/dist/cjs/decorators/applyStyle.js +92 -37
  14. package/dist/cjs/decorators/applyStyle.js.map +3 -3
  15. package/dist/cjs/decorators/{changedAttributeThis.js → changedAttribute.js} +6 -6
  16. package/dist/cjs/decorators/changedAttribute.js.map +7 -0
  17. package/dist/cjs/decorators/elementDefine.js +81 -31
  18. package/dist/cjs/decorators/elementDefine.js.map +3 -3
  19. package/dist/cjs/decorators/emitCustomEvent.js +80 -52
  20. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  21. package/dist/cjs/decorators/index.js +1 -1
  22. package/dist/cjs/decorators/index.js.map +2 -2
  23. package/dist/cjs/decorators/publishSwcAppMessage.js +5 -5
  24. package/dist/cjs/decorators/publishSwcAppMessage.js.map +3 -3
  25. package/dist/cjs/decorators/query.js +133 -147
  26. package/dist/cjs/decorators/query.js.map +3 -3
  27. package/dist/cjs/decorators/queryAll.js +143 -132
  28. package/dist/cjs/decorators/queryAll.js.map +3 -3
  29. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
  30. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
  31. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
  32. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  33. package/dist/cjs/elements/SwcAppMixin.js +17 -2
  34. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  35. package/dist/cjs/examples/RxJSOperatorsExample.js +285 -0
  36. package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
  37. package/dist/cjs/index.js +1 -0
  38. package/dist/cjs/index.js.map +2 -2
  39. package/dist/cjs/router/ElementRouter.js +4 -0
  40. package/dist/cjs/router/ElementRouter.js.map +2 -2
  41. package/dist/cjs/types/window.d.js.map +1 -1
  42. package/dist/esm/SwcAppEngine.js +3 -1
  43. package/dist/esm/SwcAppEngine.js.map +2 -2
  44. package/dist/esm/decorators/addEventListener.js.map +2 -2
  45. package/dist/esm/decorators/applyAttribute.js +66 -43
  46. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  47. package/dist/esm/decorators/applyClass.js +110 -43
  48. package/dist/esm/decorators/applyClass.js.map +3 -3
  49. package/dist/esm/decorators/applyNode.js +200 -112
  50. package/dist/esm/decorators/applyNode.js.map +2 -2
  51. package/dist/esm/decorators/applyProperty.js +49 -45
  52. package/dist/esm/decorators/applyProperty.js.map +2 -2
  53. package/dist/esm/decorators/applyStyle.js +92 -37
  54. package/dist/esm/decorators/applyStyle.js.map +3 -3
  55. package/dist/esm/decorators/{changedAttributeThis.js → changedAttribute.js} +3 -3
  56. package/dist/esm/decorators/changedAttribute.js.map +7 -0
  57. package/dist/esm/decorators/elementDefine.js +79 -29
  58. package/dist/esm/decorators/elementDefine.js.map +2 -2
  59. package/dist/esm/decorators/emitCustomEvent.js +80 -52
  60. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  61. package/dist/esm/decorators/index.js +1 -1
  62. package/dist/esm/decorators/index.js.map +1 -1
  63. package/dist/esm/decorators/publishSwcAppMessage.js +5 -5
  64. package/dist/esm/decorators/publishSwcAppMessage.js.map +3 -3
  65. package/dist/esm/decorators/query.js +133 -147
  66. package/dist/esm/decorators/query.js.map +3 -3
  67. package/dist/esm/decorators/queryAll.js +143 -132
  68. package/dist/esm/decorators/queryAll.js.map +3 -3
  69. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
  70. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
  71. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
  72. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  73. package/dist/esm/elements/SwcAppMixin.js +18 -3
  74. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  75. package/dist/esm/examples/RxJSOperatorsExample.js +266 -0
  76. package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
  77. package/dist/esm/index.js +1 -0
  78. package/dist/esm/index.js.map +2 -2
  79. package/dist/esm/router/ElementRouter.js +4 -0
  80. package/dist/esm/router/ElementRouter.js.map +2 -2
  81. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +1118 -633
  82. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  83. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  84. package/dist/types/decorators/addEventListener.d.ts +19 -15
  85. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  86. package/dist/types/decorators/applyAttribute.d.ts +45 -26
  87. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  88. package/dist/types/decorators/applyClass.d.ts +19 -38
  89. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  90. package/dist/types/decorators/applyNode.d.ts +175 -32
  91. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  92. package/dist/types/decorators/applyProperty.d.ts +38 -25
  93. package/dist/types/decorators/applyProperty.d.ts.map +1 -1
  94. package/dist/types/decorators/applyStyle.d.ts +10 -9
  95. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  96. package/dist/types/decorators/{changedAttributeThis.d.ts → changedAttribute.d.ts} +2 -2
  97. package/dist/types/decorators/changedAttribute.d.ts.map +1 -0
  98. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  99. package/dist/types/decorators/emitCustomEvent.d.ts +6 -12
  100. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  101. package/dist/types/decorators/index.d.ts +1 -1
  102. package/dist/types/decorators/index.d.ts.map +1 -1
  103. package/dist/types/decorators/publishSwcAppMessage.d.ts +1 -1
  104. package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
  105. package/dist/types/decorators/query.d.ts +16 -29
  106. package/dist/types/decorators/query.d.ts.map +1 -1
  107. package/dist/types/decorators/queryAll.d.ts +16 -23
  108. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  109. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +1 -0
  110. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
  111. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
  112. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  113. package/dist/types/elements/SwcAppMixin.d.ts +4 -4
  114. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  115. package/dist/types/examples/RxJSOperatorsExample.d.ts +94 -0
  116. package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
  117. package/dist/types/index.d.ts +1 -0
  118. package/dist/types/index.d.ts.map +1 -1
  119. package/dist/types/router/ElementRouter.d.ts.map +1 -1
  120. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +1118 -633
  121. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  122. package/package.json +1 -1
  123. package/src/SwcAppEngine.ts +3 -1
  124. package/src/decorators/addEventListener.ts +31 -25
  125. package/src/decorators/applyAttribute.ts +164 -86
  126. package/src/decorators/applyClass.ts +161 -41
  127. package/src/decorators/applyNode.ts +408 -108
  128. package/src/decorators/applyProperty.ts +100 -89
  129. package/src/decorators/applyStyle.ts +131 -37
  130. package/src/decorators/{changedAttributeThis.ts → changedAttribute.ts} +1 -1
  131. package/src/decorators/elementDefine.ts +96 -30
  132. package/src/decorators/emitCustomEvent.ts +92 -60
  133. package/src/decorators/index.ts +1 -1
  134. package/src/decorators/publishSwcAppMessage.ts +1 -1
  135. package/src/decorators/query.ts +155 -162
  136. package/src/decorators/queryAll.ts +157 -139
  137. package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -0
  138. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +3 -1
  139. package/src/elements/SwcAppMixin.ts +43 -24
  140. package/src/examples/RxJSOperatorsExample.ts +279 -0
  141. package/src/index.ts +2 -0
  142. package/src/router/ElementRouter.ts +4 -0
  143. package/src/types/window.d.ts +3 -0
  144. package/dist/cjs/decorators/changedAttributeThis.js.map +0 -7
  145. package/dist/esm/decorators/changedAttributeThis.js.map +0 -7
  146. package/dist/types/decorators/changedAttributeThis.d.ts.map +0 -1
@@ -18,150 +18,161 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var queryAll_exports = {};
19
19
  __export(queryAll_exports, {
20
20
  QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
21
- allAppHost: () => allAppHost,
22
- allParentHost: () => allParentHost,
23
21
  getQueryAllMetadata: () => getQueryAllMetadata,
24
- queryAll: () => queryAll,
25
- queryAllThis: () => queryAllThis
22
+ queryAll: () => queryAll
26
23
  });
27
24
  module.exports = __toCommonJS(queryAll_exports);
28
25
  var import_core = require("@dooboostore/core");
29
26
  var import_elementDefine = require("./elementDefine");
30
27
  var import_Utils = require("../utils/Utils");
31
28
  const QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
32
- function queryAll(selectorOrTarget, options = {}) {
33
- return (targetObj, propertyKey, descriptor) => {
34
- if (descriptor !== void 0) {
35
- throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
36
- }
37
- const constructor = targetObj.constructor;
38
- let queries = import_core.ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
39
- if (!queries) {
40
- queries = [];
41
- import_core.ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
42
- }
43
- queries.push({ propertyKey, selector: selectorOrTarget, options });
44
- Object.defineProperty(targetObj, propertyKey, {
45
- get() {
46
- (0, import_elementDefine.ensureInit)(this);
47
- const selector = selectorOrTarget;
48
- const r = options.root || "auto";
49
- const applyRoot = (t) => {
50
- if (!t)
51
- return [];
52
- const items = Array.isArray(t) ? t : [t];
53
- const results = [];
54
- items.forEach((it) => {
55
- if (!(it instanceof HTMLElement)) {
56
- results.push(it);
57
- return;
29
+ function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
30
+ if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
31
+ throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
32
+ }
33
+ if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
34
+ return (targetObj, propertyKey, descriptor2) => {
35
+ if (descriptor2 !== void 0) {
36
+ throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
37
+ }
38
+ const constructor = targetObj.constructor;
39
+ let queries = import_core.ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
40
+ if (!queries) {
41
+ queries = [];
42
+ import_core.ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
43
+ }
44
+ queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
45
+ Object.defineProperty(targetObj, propertyKey, {
46
+ get() {
47
+ (0, import_elementDefine.ensureInit)(this);
48
+ const config = (0, import_elementDefine.getElementConfig)(this);
49
+ const win = config?.window || window;
50
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
51
+ let resolvedSelector;
52
+ let resolvedElements = [];
53
+ if (typeof selectorOrTarget === "function") {
54
+ const result = selectorOrTarget(this, hostSet);
55
+ if (result instanceof win.NodeList) {
56
+ resolvedElements = Array.from(result).filter((el) => el instanceof win.HTMLElement);
57
+ } else if (Array.isArray(result)) {
58
+ resolvedElements = result.filter((el) => el instanceof win.HTMLElement);
58
59
  }
59
- if (r === "auto")
60
- results.push(it.shadowRoot || it);
60
+ } else {
61
+ resolvedSelector = selectorOrTarget;
62
+ const r = optionsOrPropertyKey?.root || "auto";
63
+ const applyRoot = (t) => {
64
+ if (!t)
65
+ return [];
66
+ const items = Array.isArray(t) ? t : [t];
67
+ const results = [];
68
+ items.forEach((it) => {
69
+ if (!(it instanceof HTMLElement)) {
70
+ results.push(it);
71
+ return;
72
+ }
73
+ if (r === "auto")
74
+ results.push(it.shadowRoot || it);
75
+ else {
76
+ if (r === "light" || r === "all")
77
+ results.push(it);
78
+ if ((r === "shadow" || r === "all") && it.shadowRoot)
79
+ results.push(it.shadowRoot);
80
+ }
81
+ });
82
+ return results;
83
+ };
84
+ if (resolvedSelector === "$hosts")
85
+ resolvedElements = applyRoot(hostSet.$hosts).filter((el) => el instanceof HTMLElement);
86
+ else if (resolvedSelector === "$appHosts")
87
+ resolvedElements = applyRoot(hostSet.$appHosts).filter((el) => el instanceof HTMLElement);
88
+ else if (resolvedSelector === "$host")
89
+ resolvedElements = applyRoot(hostSet.$host).filter((el) => el instanceof HTMLElement);
90
+ else if (resolvedSelector === "$parentHost")
91
+ resolvedElements = applyRoot(hostSet.$parentHost).filter((el) => el instanceof HTMLElement);
92
+ else if (resolvedSelector === "$appHost")
93
+ resolvedElements = applyRoot(hostSet.$appHost).filter((el) => el instanceof HTMLElement);
94
+ else if (resolvedSelector === "$firstHost")
95
+ resolvedElements = applyRoot(hostSet.$firstHost).filter((el) => el instanceof HTMLElement);
96
+ else if (resolvedSelector === "$lastHost")
97
+ resolvedElements = applyRoot(hostSet.$lastHost).filter((el) => el instanceof HTMLElement);
98
+ else if (resolvedSelector === "$firstAppHost")
99
+ resolvedElements = applyRoot(hostSet.$firstAppHost).filter((el) => el instanceof HTMLElement);
100
+ else if (resolvedSelector === "$lastAppHost")
101
+ resolvedElements = applyRoot(hostSet.$lastAppHost).filter((el) => el instanceof HTMLElement);
102
+ else if (resolvedSelector === "$window")
103
+ return [win];
104
+ else if (resolvedSelector === "$document")
105
+ return [win.document];
106
+ else if (resolvedSelector === "$this")
107
+ resolvedElements = applyRoot(this).filter((el) => el instanceof HTMLElement);
61
108
  else {
62
- if (r === "light" || r === "all")
63
- results.push(it);
64
- if ((r === "shadow" || r === "all") && it.shadowRoot)
65
- results.push(it.shadowRoot);
109
+ if (r === "shadow")
110
+ resolvedElements = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
111
+ else if (r === "light")
112
+ resolvedElements = Array.from(this.querySelectorAll(resolvedSelector));
113
+ else if (r === "all") {
114
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
115
+ const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
116
+ resolvedElements = [...sNodes, ...lNodes];
117
+ } else
118
+ resolvedElements = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
66
119
  }
67
- });
68
- return results;
69
- };
70
- const hostSet = import_Utils.SwcUtils.getHostSet(this);
71
- if (selector === "$hosts")
72
- return applyRoot(hostSet.$hosts);
73
- if (selector === "$appHosts")
74
- return applyRoot(hostSet.$appHosts);
75
- if (selector === "$host")
76
- return applyRoot(hostSet.$host);
77
- if (selector === "$parentHost")
78
- return applyRoot(hostSet.$parentHost);
79
- if (selector === "$appHost")
80
- return applyRoot(hostSet.$appHost);
81
- if (selector === "$firstHost")
82
- return applyRoot(hostSet.$firstHost);
83
- if (selector === "$lastHost")
84
- return applyRoot(hostSet.$lastHost);
85
- if (selector === "$firstAppHost")
86
- return applyRoot(hostSet.$firstAppHost);
87
- if (selector === "$lastAppHost")
88
- return applyRoot(hostSet.$lastAppHost);
89
- const config = (0, import_elementDefine.getElementConfig)(this);
90
- const win = config?.window || window;
91
- if (selector === "$window")
92
- return [win];
93
- if (selector === "$document")
94
- return [win.document];
95
- if (selector === "$this")
96
- return applyRoot(this);
97
- if (r === "shadow")
98
- return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
99
- if (r === "light")
100
- return Array.from(this.querySelectorAll(selector));
101
- if (r === "all") {
102
- const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
103
- const lNodes = Array.from(this.querySelectorAll(selector));
104
- return [...sNodes, ...lNodes];
105
- }
106
- const root = this.shadowRoot || this;
107
- return Array.from(root.querySelectorAll(selector));
108
- },
109
- set(nv) {
110
- (0, import_elementDefine.ensureInit)(this);
111
- if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
112
- const selector = selectorOrTarget;
113
- if (selector.startsWith("$") && selector !== "$this")
114
- return;
115
- const r = options.root || "auto";
116
- let targets = [];
117
- if (r === "shadow")
118
- targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
119
- else if (r === "light")
120
- targets = Array.from(this.querySelectorAll(selector));
121
- else if (r === "all") {
122
- const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
123
- const lNodes = Array.from(this.querySelectorAll(selector));
124
- targets = [...sNodes, ...lNodes];
125
- } else {
126
- targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
127
120
  }
128
- targets.forEach((t) => t.remove());
129
- }
130
- },
131
- enumerable: true,
132
- configurable: true
133
- });
134
- };
135
- }
136
- function queryAllThis(targetOrOptions, propertyKey) {
137
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
138
- return queryAll("$this", {})(targetOrOptions, propertyKey);
139
- }
140
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
141
- return queryAll("$this", targetOrOptions);
142
- } else {
143
- return queryAll("$this", {});
144
- }
145
- }
146
- function allParentHost(targetOrOptions, propertyKey) {
147
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
148
- return queryAll("$host", {})(targetOrOptions, propertyKey);
149
- }
150
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
151
- return queryAll("$host", targetOrOptions);
152
- } else {
153
- return queryAll("$host", {});
154
- }
155
- }
156
- function allAppHost(targetOrOptions, propertyKey) {
157
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
158
- return queryAll("$appHost", {})(targetOrOptions, propertyKey);
159
- }
160
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
161
- return queryAll("$appHost", targetOrOptions);
162
- } else {
163
- return queryAll("$appHost", {});
121
+ if (optionsOrPropertyKey?.filter) {
122
+ resolvedElements = resolvedElements.filter((el) => {
123
+ if (!(el instanceof win.HTMLElement))
124
+ return true;
125
+ return optionsOrPropertyKey.filter(el, { currentThis: this, helper: hostSet });
126
+ });
127
+ }
128
+ return resolvedElements;
129
+ },
130
+ set(nv) {
131
+ (0, import_elementDefine.ensureInit)(this);
132
+ if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
133
+ const config = (0, import_elementDefine.getElementConfig)(this);
134
+ const win = config?.window || window;
135
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
136
+ if (typeof selectorOrTarget === "function") {
137
+ const result = selectorOrTarget(this, hostSet);
138
+ if (result instanceof win.NodeList) {
139
+ Array.from(result).forEach((el) => {
140
+ if (el instanceof win.Element)
141
+ el.remove();
142
+ });
143
+ } else if (Array.isArray(result)) {
144
+ result.forEach((el) => {
145
+ if (el instanceof win.Element)
146
+ el.remove();
147
+ });
148
+ }
149
+ return;
150
+ }
151
+ const resolvedSelector = selectorOrTarget;
152
+ if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
153
+ return;
154
+ const r = optionsOrPropertyKey?.root || "auto";
155
+ let targets = [];
156
+ if (r === "shadow")
157
+ targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
158
+ else if (r === "light")
159
+ targets = Array.from(this.querySelectorAll(resolvedSelector));
160
+ else if (r === "all") {
161
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
162
+ const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
163
+ targets = [...sNodes, ...lNodes];
164
+ } else {
165
+ targets = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
166
+ }
167
+ targets.forEach((t) => t.remove());
168
+ }
169
+ },
170
+ enumerable: true,
171
+ configurable: true
172
+ });
173
+ };
164
174
  }
175
+ return queryAll("$this", selectorOrTarget);
165
176
  }
166
177
  const getQueryAllMetadata = (target) => {
167
178
  const constructor = target instanceof Function ? target : target.constructor;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/queryAll.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface QueryAllMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: SwcQueryOptions;\n}\n\nexport const QUERY_ALL_METADATA_KEY = Symbol.for('simple-web-component:query-all');\n\nexport function queryAll(target: SpecialSelector): PropertyDecorator;\nexport function queryAll(selector: string, options?: SwcQueryOptions): PropertyDecorator;\n/**\n * @queryAll decorator to inject a list of elements into a class property.\n */\nexport function queryAll(selectorOrTarget: string, options: any = {}): PropertyDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryAllMetadata[]>(QUERY_ALL_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget, options });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const selector = selectorOrTarget;\n\n const r = options.root || 'auto';\n const applyRoot = (t: any): any[] => {\n if (!t) return [];\n const items = Array.isArray(t) ? t : [t];\n const results: any[] = [];\n items.forEach(it => {\n if (!(it instanceof HTMLElement)) {\n results.push(it);\n return;\n }\n if (r === 'auto') results.push(it.shadowRoot || it);\n else {\n if (r === 'light' || r === 'all') results.push(it);\n if ((r === 'shadow' || r === 'all') && it.shadowRoot) results.push(it.shadowRoot);\n }\n });\n return results;\n };\n\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === '$hosts') return applyRoot(hostSet.$hosts);\n if (selector === '$appHosts') return applyRoot(hostSet.$appHosts);\n if (selector === '$host') return applyRoot(hostSet.$host);\n if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);\n if (selector === '$appHost') return applyRoot(hostSet.$appHost);\n if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);\n if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);\n if (selector === '$firstAppHost') return applyRoot(hostSet.$firstAppHost);\n if (selector === '$lastAppHost') return applyRoot(hostSet.$lastAppHost);\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n if (selector === '$window') return [win];\n if (selector === '$document') return [win.document];\n if (selector === '$this') return applyRoot(this);\n\n // --- Standard Selectors ---\n if (r === 'shadow') return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n if (r === 'light') return Array.from(this.querySelectorAll(selector));\n if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n const lNodes = Array.from(this.querySelectorAll(selector));\n return [...sNodes, ...lNodes];\n }\n const root = this.shadowRoot || this;\n return Array.from(root.querySelectorAll(selector));\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {\n const selector = selectorOrTarget;\n if (selector.startsWith('$') && selector !== '$this') return;\n\n const r = options.root || 'auto';\n let targets: (Element | Node)[] = [];\n if (r === 'shadow') targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n else if (r === 'light') targets = Array.from(this.querySelectorAll(selector));\n else if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n const lNodes = Array.from(this.querySelectorAll(selector));\n targets = [...sNodes, ...lNodes];\n } else {\n targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));\n }\n targets.forEach(t => (t as Element).remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n}\n\n/**\n * @queryAllThis decorator - simplified version of @queryAll for $this selector\n */\nexport function queryAllThis(target: Object, propertyKey: string | symbol): void;\nexport function queryAllThis(): PropertyDecorator;\nexport function queryAllThis(options: SwcQueryOptions): PropertyDecorator;\nexport function queryAllThis(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll('$this', {})(targetOrOptions, propertyKey);\n }\n\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll('$this', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll('$this', {});\n }\n}\n\n/**\n * @allParentHost - Query all parent SWC components\n */\nexport function allParentHost(target: Object, propertyKey: string | symbol): void;\nexport function allParentHost(): PropertyDecorator;\nexport function allParentHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allParentHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll('$host', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll('$host', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll('$host', {});\n }\n}\n\n/**\n * @allAppHost - Query all $appHost (All <swc-app> instances)\n */\nexport function allAppHost(target: Object, propertyKey: string | symbol): void;\nexport function allAppHost(): PropertyDecorator;\nexport function allAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll('$appHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll('$appHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll('$appHost', {});\n }\n}\n\nexport const getQueryAllMetadata = (target: any): QueryAllMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AASlB,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAO3E,SAAU,SAAS,kBAA0B,UAAe,CAAA,GAAE;AAClE,SAAO,CAAC,WAAmB,aAA8B,eAA4B;AACnF,QAAI,eAAe,QAAW;AAC5B,YAAM,IAAI,MAAM,2DAA2D,OAAO,WAAW,CAAC,GAAG;IACnG;AAEA,UAAM,cAAc,UAAU;AAC9B,QAAI,UAAU,yBAAa,YAAgC,wBAAwB,WAAW;AAC9F,QAAI,CAAC,SAAS;AACZ,gBAAU,CAAA;AACV,+BAAa,eAAe,wBAAwB,SAAS,WAAW;IAC1E;AACA,YAAQ,KAAK,EAAE,aAAa,UAAU,kBAAkB,QAAO,CAAE;AAEjE,WAAO,eAAe,WAAW,aAAa;MAC5C,MAAG;AACD,6CAAW,IAAI;AACf,cAAM,WAAW;AAEjB,c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ACA,YAAY;MACZ,cAAc;KACf;EACH;AACF;AAQM,SAAU,aAAa,iBAAuB,aAA6B;AAC/E,MAAI,gBAAgB,WAAc,OAAO,gBAAgB,YAAY,OAAO,gBAAgB,WAAW;AACrG,WAAO,SAAS,SAAS,CAAA,CAAE,EAAE,iBAAiB,WAAW;EAC3D;AAEA,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;AACnE,WAAO,SAAS,SAAS,eAAkC;EAC7D,OAAO;AACL,WAAO,SAAS,SAAS,CAAA,CAAE;EAC7B;AACF;AAQM,SAAU,cAAc,iBAAuB,aAA6B;AAChF,MAAI,gBAAgB,WAAc,OAAO,gBAAgB,YAAY,OAAO,gBAAgB,WAAW;AACrG,WAAO,SAAS,SAAS,CAAA,CAAE,EAAE,iBAAiB,WAAW;EAC3D;AACA,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;AACnE,WAAO,SAAS,SAAS,eAAkC;EAC7D,OAAO;AACL,WAAO,SAAS,SAAS,CAAA,CAAE;EAC7B;AACF;AAQM,SAAU,WAAW,iBAAuB,aAA6B;AAC7E,MAAI,gBAAgB,WAAc,OAAO,gBAAgB,YAAY,OAAO,gBAAgB,WAAW;AACrG,WAAO,SAAS,YAAY,CAAA,CAAE,EAAE,iBAAiB,WAAW;EAC9D;AACA,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;AACnE,WAAO,SAAS,YAAY,eAAkC;EAChE,OAAO;AACL,WAAO,SAAS,YAAY,CAAA,CAAE;EAChC;AACF;AAEO,MAAM,sBAAsB,CAAC,WAA+C;AACjF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,YAAY,wBAAwB,WAAW;AACrE;",
6
- "names": []
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface QueryAllOptions extends SwcQueryOptions {\n /**\n * Filter function to determine whether to include the element.\n * If it returns false, the element is skipped.\n */\n filter?: (target: HTMLElement, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n}\n\nexport interface QueryAllMetadata {\n propertyKey: string | symbol;\n selector: string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null);\n options: QueryAllOptions;\n}\n\nexport const QUERY_ALL_METADATA_KEY = Symbol.for('simple-web-component:query-all');\n\nexport function queryAll(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor | void;\nexport function queryAll(selector: string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null), options?: QueryAllOptions): PropertyDecorator;\nexport function queryAll(options?: QueryAllOptions): PropertyDecorator;\n/**\n * @queryAll decorator to inject a list of elements into a class property.\n * \n * Supports both string selectors and function-based selectors:\n * - String selector: @queryAll('.item')\n * - Function selector: @queryAll((currentThis, helper) => currentThis.shadowRoot?.querySelectorAll('.item'))\n * \n * Supports filtering:\n * - @queryAll('.item', { filter: (target, meta) => target.hasAttribute('active') })\n */\nexport function queryAll(selectorOrTarget?: string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null) | Object, optionsOrPropertyKey?: QueryAllOptions | string | symbol, descriptor?: PropertyDescriptor): any {\n // Bare decorator: @queryAll\n if (descriptor !== undefined && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol')) {\n throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);\n }\n // With selector\n if (typeof selectorOrTarget === 'string' || typeof selectorOrTarget === 'function') {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryAllMetadata[]>(QUERY_ALL_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget as any, options: optionsOrPropertyKey as QueryAllOptions || {} });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const config = getElementConfig(this);\n const win = config?.window || window;\n const hostSet = SwcUtils.getHelperAndHostSet(win, this);\n \n // Resolve selector - can be string or function\n let resolvedSelector: string;\n let resolvedElements: HTMLElement[] = [];\n \n if (typeof selectorOrTarget === 'function') {\n const result = (selectorOrTarget as any)(this, hostSet);\n // If function returns NodeList or Element[], convert to array\n if (result instanceof win.NodeList) {\n resolvedElements = Array.from(result).filter(el => el instanceof win.HTMLElement) as HTMLElement[];\n } else if (Array.isArray(result)) {\n resolvedElements = result.filter(el => el instanceof win.HTMLElement) as HTMLElement[];\n }\n } else {\n resolvedSelector = selectorOrTarget;\n\n const r = (optionsOrPropertyKey as QueryAllOptions)?.root || 'auto';\n const applyRoot = (t: any): any[] => {\n if (!t) return [];\n const items = Array.isArray(t) ? t : [t];\n const results: any[] = [];\n items.forEach(it => {\n if (!(it instanceof HTMLElement)) {\n results.push(it);\n return;\n }\n if (r === 'auto') results.push(it.shadowRoot || it);\n else {\n if (r === 'light' || r === 'all') results.push(it);\n if ((r === 'shadow' || r === 'all') && it.shadowRoot) results.push(it.shadowRoot);\n }\n });\n return results;\n };\n\n // --- Special Selectors: HostSet ---\n if (resolvedSelector === '$hosts') resolvedElements = applyRoot(hostSet.$hosts).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$appHosts') resolvedElements = applyRoot(hostSet.$appHosts).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$host') resolvedElements = applyRoot(hostSet.$host).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$parentHost') resolvedElements = applyRoot(hostSet.$parentHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$appHost') resolvedElements = applyRoot(hostSet.$appHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$firstHost') resolvedElements = applyRoot(hostSet.$firstHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$lastHost') resolvedElements = applyRoot(hostSet.$lastHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$firstAppHost') resolvedElements = applyRoot(hostSet.$firstAppHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$lastAppHost') resolvedElements = applyRoot(hostSet.$lastAppHost).filter(el => el instanceof HTMLElement);\n // --- Special Selectors: Env ---\n else if (resolvedSelector === '$window') return [win];\n else if (resolvedSelector === '$document') return [win.document];\n else if (resolvedSelector === '$this') resolvedElements = applyRoot(this).filter(el => el instanceof HTMLElement);\n // --- Standard Selectors ---\n else {\n if (r === 'shadow') resolvedElements = this.shadowRoot ? (Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) as HTMLElement[]) : [];\n else if (r === 'light') resolvedElements = Array.from(this.querySelectorAll(resolvedSelector)) as HTMLElement[];\n else if (r === 'all') {\n const sNodes = this.shadowRoot ? (Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) as HTMLElement[]) : [];\n const lNodes = Array.from(this.querySelectorAll(resolvedSelector)) as HTMLElement[];\n resolvedElements = [...sNodes, ...lNodes];\n }\n else resolvedElements = (Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector)) as HTMLElement[]);\n }\n }\n\n // Apply filter if provided\n if ((optionsOrPropertyKey as QueryAllOptions)?.filter) {\n resolvedElements = resolvedElements.filter(el => {\n if (!(el instanceof win.HTMLElement)) return true;\n return (optionsOrPropertyKey as QueryAllOptions).filter!(el, { currentThis: this, helper: hostSet });\n });\n }\n\n return resolvedElements;\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {\n const config = getElementConfig(this);\n const win = config?.window || window;\n const hostSet = SwcUtils.getHelperAndHostSet(win, this);\n \n // Resolve selector - can be string or function\n if (typeof selectorOrTarget === 'function') {\n // Get elements from function and remove them\n const result = (selectorOrTarget as any)(this, hostSet);\n if (result instanceof win.NodeList) {\n Array.from(result).forEach(el => {\n if (el instanceof win.Element) (el as Element).remove();\n });\n } else if (Array.isArray(result)) {\n result.forEach(el => {\n if (el instanceof win.Element) (el as Element).remove();\n });\n }\n return;\n }\n \n const resolvedSelector = selectorOrTarget;\n \n if (resolvedSelector.startsWith('$') && resolvedSelector !== '$this') return;\n\n const r = (optionsOrPropertyKey as SwcQueryOptions)?.root || 'auto';\n let targets: (Element | Node)[] = [];\n if (r === 'shadow') targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];\n else if (r === 'light') targets = Array.from(this.querySelectorAll(resolvedSelector));\n else if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];\n const lNodes = Array.from(this.querySelectorAll(resolvedSelector));\n targets = [...sNodes, ...lNodes];\n } else {\n targets = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));\n }\n targets.forEach(t => (t as Element).remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n }\n // Without selector (defaults to $this)\n return queryAll('$this', selectorOrTarget as SwcQueryOptions);\n}\n\nexport const getQueryAllMetadata = (target: any): QueryAllMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AAiBlB,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAe3E,SAAU,SAAS,kBAA2H,sBAA0D,YAA+B;AAE3O,MAAI,eAAe,WAAc,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,WAAW;AACtH,UAAM,IAAI,MAAM,2DAA2D,OAAO,oBAAoB,CAAC,GAAG;EAC5G;AAEA,MAAI,OAAO,q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tE,kBAAM,IAAK,sBAA0C,QAAQ;AAC7D,gBAAI,UAA8B,CAAA;AAClC,gBAAI,MAAM;AAAU,wBAAU,KAAK,aAAa,MAAM,KAAK,KAAK,WAAW,iBAAiB,gBAAgB,CAAC,IAAI,CAAA;qBACxG,MAAM;AAAS,wBAAU,MAAM,KAAK,KAAK,iBAAiB,gBAAgB,CAAC;qBAC3E,MAAM,OAAO;AACpB,oBAAM,SAAS,KAAK,aAAa,MAAM,KAAK,KAAK,WAAW,iBAAiB,gBAAgB,CAAC,IAAI,CAAA;AAClG,oBAAM,SAAS,MAAM,KAAK,KAAK,iBAAiB,gBAAgB,CAAC;AACjE,wBAAU,CAAC,GAAG,QAAQ,GAAG,MAAM;YACjC,OAAO;AACL,wBAAU,MAAM,MAAM,KAAK,cAAc,MAAM,iBAAiB,gBAAgB,CAAC;YACnF;AACA,oBAAQ,QAAQ,OAAM,EAAc,OAAM,CAAE;UAC9C;QACF;QACA,YAAY;QACZ,cAAc;OACf;IACH;EACF;AAEA,SAAO,SAAS,SAAS,gBAAmC;AAC9D;AAEO,MAAM,sBAAsB,CAAC,WAA+C;AACjF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,YAAY,wBAAwB,WAAW;AACrE;",
6
+ "names": ["descriptor"]
7
7
  }
@@ -19,6 +19,7 @@ var subscribeSwcAppMessageWhileConnected_exports = {};
19
19
  __export(subscribeSwcAppMessageWhileConnected_exports, {
20
20
  SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY: () => SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY,
21
21
  getSubscribeSwcAppMessageWhileConnectedMetadata: () => getSubscribeSwcAppMessageWhileConnectedMetadata,
22
+ receiveMessage: () => receiveMessage,
22
23
  subscribeSwcAppMessageWhileConnected: () => subscribeSwcAppMessageWhileConnected
23
24
  });
24
25
  module.exports = __toCommonJS(subscribeSwcAppMessageWhileConnected_exports);
@@ -55,6 +56,7 @@ function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions, opti
55
56
  }
56
57
  return createSubscribeSwcAppMessageWhileConnected(options, messageType);
57
58
  }
59
+ const receiveMessage = subscribeSwcAppMessageWhileConnected;
58
60
  const getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
59
61
  const constructor = target instanceof Function ? target : target.constructor;
60
62
  return import_core.ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/subscribeSwcAppMessageWhileConnected.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SwcAppMessage, SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport const SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-message-while-connected');\n\nexport interface SwcAppMessageSubscriberMetadata {\n propertyKey: string | symbol;\n messageType?: string;\n filter?: (message: SwcAppMessage, currentThis: any) => boolean;\n}\n\nexport interface SwcAppMessageOptions {\n filter?: (message: SwcAppMessage, currentThis: any) => boolean;\n}\n\nfunction createSubscribeSwcAppMessageWhileConnected(options?: SwcAppMessageOptions, messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppMessageSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType, filter });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppMessageWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785\uB9CC\nexport function subscribeSwcAppMessageWhileConnected(messageType: string): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uC635\uC158\uB9CC\nexport function subscribeSwcAppMessageWhileConnected(options: SwcAppMessageOptions): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785 + \uC635\uC158\nexport function subscribeSwcAppMessageWhileConnected(messageType: string, options: SwcAppMessageOptions): MethodDecorator;\n\nexport function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppMessageWhileConnected\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n optionsOrPropertyKey && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n const propertyKey = optionsOrPropertyKey;\n return createSubscribeSwcAppMessageWhileConnected({})(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C)\n let messageType: string | undefined;\n let options: SwcAppMessageOptions = {};\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @subscribeSwcAppMessageWhileConnected('messageType') \uB610\uB294 @subscribeSwcAppMessageWhileConnected('messageType', options)\n messageType = targetOrMessageTypeOrOptions;\n if (optionsOrPropertyKey && typeof optionsOrPropertyKey === 'object') {\n options = optionsOrPropertyKey;\n }\n } else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object') {\n // \uC635\uC158\uB9CC \uC804\uB2EC: @subscribeSwcAppMessageWhileConnected({ filter: ... })\n options = targetOrMessageTypeOrOptions;\n }\n\n return createSubscribeSwcAppMessageWhileConnected(options, messageType);\n}\n\n// Helper function to retrieve message subscribers metadata\nexport const getSubscribeSwcAppMessageWhileConnectedMetadata = (target: any): SwcAppMessageSubscriberMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAGtB,MAAM,yDAAyD,OAAO,IAAI,gEAAgE;AAYjJ,SAAS,2CAA2C,SAAgC,aAAuC;AACzH,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,SAAS,SAAS;AAExB,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,eAAe,wDAAwD,WAAW;AAC1G,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,+BAAa,eAAe,wDAAwD,MAAM,WAAW;AAAA,IACvG;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,OAAO,CAAC;AAE9C,WAAO;AAAA,EACT;AACF;AAWO,SAAS,qCAAqC,8BAAoC,sBAA4B,YAAsC;AAEzJ,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,UAAM,cAAc;AACpB,WAAO,2CAA2C,CAAC,CAAC,EAAE,QAAQ,aAAa,UAAU;AAAA,EACvF;AAGA,MAAI;AACJ,MAAI,UAAgC,CAAC;AAErC,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,wBAAwB,OAAO,yBAAyB,UAAU;AACpE,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,gCAAgC,OAAO,iCAAiC,UAAU;AAE3F,cAAU;AAAA,EACZ;AAEA,SAAO,2CAA2C,SAAS,WAAW;AACxE;AAGO,MAAM,kDAAkD,CAAC,WAA+D;AAC7H,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,eAAe,wDAAwD,WAAW;AACxG;",
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SwcAppMessage, SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport const SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-message-while-connected');\n\nexport interface SwcAppMessageSubscriberMetadata {\n propertyKey: string | symbol;\n messageType?: string;\n filter?: (message: SwcAppMessage, currentThis: any) => boolean;\n}\n\nexport interface SwcAppMessageOptions {\n filter?: (message: SwcAppMessage, currentThis: any) => boolean;\n}\n\nfunction createSubscribeSwcAppMessageWhileConnected(options?: SwcAppMessageOptions, messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppMessageSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType, filter });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppMessageWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785\uB9CC\nexport function subscribeSwcAppMessageWhileConnected(messageType: string): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uC635\uC158\uB9CC\nexport function subscribeSwcAppMessageWhileConnected(options: SwcAppMessageOptions): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785 + \uC635\uC158\nexport function subscribeSwcAppMessageWhileConnected(messageType: string, options: SwcAppMessageOptions): MethodDecorator;\n\nexport function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppMessageWhileConnected\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n optionsOrPropertyKey && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n const propertyKey = optionsOrPropertyKey;\n return createSubscribeSwcAppMessageWhileConnected({})(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C)\n let messageType: string | undefined;\n let options: SwcAppMessageOptions = {};\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @subscribeSwcAppMessageWhileConnected('messageType') \uB610\uB294 @subscribeSwcAppMessageWhileConnected('messageType', options)\n messageType = targetOrMessageTypeOrOptions;\n if (optionsOrPropertyKey && typeof optionsOrPropertyKey === 'object') {\n options = optionsOrPropertyKey;\n }\n } else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object') {\n // \uC635\uC158\uB9CC \uC804\uB2EC: @subscribeSwcAppMessageWhileConnected({ filter: ... })\n options = targetOrMessageTypeOrOptions;\n }\n\n return createSubscribeSwcAppMessageWhileConnected(options, messageType);\n}\n\nexport const receiveMessage = subscribeSwcAppMessageWhileConnected;\n// Helper function to retrieve message subscribers metadata\nexport const getSubscribeSwcAppMessageWhileConnectedMetadata = (target: any): SwcAppMessageSubscriberMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAGtB,MAAM,yDAAyD,OAAO,IAAI,gEAAgE;AAYjJ,SAAS,2CAA2C,SAAgC,aAAuC;AACzH,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,SAAS,SAAS;AAExB,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,eAAe,wDAAwD,WAAW;AAC1G,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,+BAAa,eAAe,wDAAwD,MAAM,WAAW;AAAA,IACvG;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,OAAO,CAAC;AAE9C,WAAO;AAAA,EACT;AACF;AAWO,SAAS,qCAAqC,8BAAoC,sBAA4B,YAAsC;AAEzJ,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,UAAM,cAAc;AACpB,WAAO,2CAA2C,CAAC,CAAC,EAAE,QAAQ,aAAa,UAAU;AAAA,EACvF;AAGA,MAAI;AACJ,MAAI,UAAgC,CAAC;AAErC,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,wBAAwB,OAAO,yBAAyB,UAAU;AACpE,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,gCAAgC,OAAO,iCAAiC,UAAU;AAE3F,cAAU;AAAA,EACZ;AAEA,SAAO,2CAA2C,SAAS,WAAW;AACxE;AAEO,MAAM,iBAAiB;AAEvB,MAAM,kDAAkD,CAAC,WAA+D;AAC7H,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,eAAe,wDAAwD,WAAW;AACxG;",
6
6
  "names": []
7
7
  }
@@ -18,6 +18,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var subscribeSwcAppRouteChangeWhileConnected_exports = {};
19
19
  __export(subscribeSwcAppRouteChangeWhileConnected_exports, {
20
20
  SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY: () => SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY,
21
+ changedRoute: () => changedRoute,
21
22
  getSubscribeSwcAppRouteChangeWhileConnectedMetadata: () => getSubscribeSwcAppRouteChangeWhileConnectedMetadata,
22
23
  subscribeSwcAppRouteChangeWhileConnected: () => subscribeSwcAppRouteChangeWhileConnected
23
24
  });
@@ -58,6 +59,7 @@ function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKeyOr
58
59
  }
59
60
  return createSubscribeSwcAppRouteChangeWhileConnected(options);
60
61
  }
62
+ const changedRoute = subscribeSwcAppRouteChangeWhileConnected;
61
63
  const getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target) => {
62
64
  const constructor = target instanceof Function ? target : target.constructor;
63
65
  const results = import_core.ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts"],
4
- "sourcesContent": ["import {ReflectUtils} from '@dooboostore/core';\nimport {Router} from '@dooboostore/core-web';\nimport {HelperHostSet} from '../types';\n\nexport const SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-route-change-while-connected');\n\nexport type RoutePathType = string | string[] | ((currentThis: any) => string | string[]);\n\nexport interface SwcAppRouteChangeSubscriberMetadata {\n propertyKey: string | symbol;\n options?: SwcAppRouteChangeOptions;\n}\n\nexport interface SwcAppRouteChangeOptions {\n path?: RoutePathType;\n filter?: (router: Router, meta: {currentThis: any, helper: HelperHostSet}) => boolean;\n order?: number;\n}\n\nfunction createSubscribeSwcAppRouteChangeWhileConnected(options?: SwcAppRouteChangeOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const pathPattern = options?.path;\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppRouteChangeSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n\n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType, config: Omit<SwcAppRouteChangeOptions, 'path'>): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(options: SwcAppRouteChangeOptions): MethodDecorator;\n\n// \uC2E4\uC81C \uAD6C\uD604 (\uC774\uC911 \uBAA8\uB4DC)\nexport function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions?: any, propertyKeyOrConfig?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppRouteChangeWhileConnected\n // propertyKey\uAC00 string | symbol\uC774\uACE0 descriptor\uAC00 \uC788\uC73C\uBA74 \uC9C1\uC811 \uC0AC\uC6A9\n if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === 'string' || typeof propertyKeyOrConfig === 'symbol')) {\n return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @subscribeSwcAppRouteChangeWhileConnected() / @subscribeSwcAppRouteChangeWhileConnected('/path')\n let options: SwcAppRouteChangeOptions = {};\n\n if (Array.isArray(targetOrOptions)) {\n // \uBC30\uC5F4: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'])\n // \uB610\uB294: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'], { order: 1 })\n options.path = targetOrOptions;\n if (propertyKeyOrConfig && typeof propertyKeyOrConfig === 'object') {\n options = { ...options, ...propertyKeyOrConfig };\n }\n } else if (typeof targetOrOptions === 'string' || typeof targetOrOptions === 'function') {\n // \uBB38\uC790\uC5F4 \uB610\uB294 \uD568\uC218: @subscribeSwcAppRouteChangeWhileConnected('/path')\n // \uB610\uB294: @subscribeSwcAppRouteChangeWhileConnected('/path', { order: 1 })\n options.path = targetOrOptions;\n if (propertyKeyOrConfig && typeof propertyKeyOrConfig === 'object') {\n options = { ...options, ...propertyKeyOrConfig };\n }\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // \uAC1D\uCCB4: @subscribeSwcAppRouteChangeWhileConnected({ path: '/path', filter: ..., order: 1 })\n options = targetOrOptions;\n }\n\n return createSubscribeSwcAppRouteChangeWhileConnected(options);\n}\n\n// Helper function to retrieve route change subscribers metadata\nexport const getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target: any): SwcAppRouteChangeSubscriberMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n if (!results) return [];\n \n // Sort by order (default 0 if not specified)\n return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;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,QAAS,QAAO,CAAC;AAGtB,SAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,EAAE;AACtF;",
4
+ "sourcesContent": ["import {ReflectUtils} from '@dooboostore/core';\nimport {Router} from '@dooboostore/core-web';\nimport {HelperHostSet} from '../types';\n\nexport const SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-route-change-while-connected');\n\nexport type RoutePathType = string | string[] | ((currentThis: any) => string | string[]);\n\nexport interface SwcAppRouteChangeSubscriberMetadata {\n propertyKey: string | symbol;\n options?: SwcAppRouteChangeOptions;\n}\n\nexport interface SwcAppRouteChangeOptions {\n path?: RoutePathType;\n filter?: (router: Router, meta: { currentThis: any; helper: HelperHostSet }) => boolean;\n order?: number;\n valueKey?: symbol | string;\n}\n\nfunction createSubscribeSwcAppRouteChangeWhileConnected(options?: SwcAppRouteChangeOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const pathPattern = options?.path;\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor) as SwcAppRouteChangeSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n\n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function subscribeSwcAppRouteChangeWhileConnected(): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(pathPattern: RoutePathType, config: Omit<SwcAppRouteChangeOptions, 'path'>): MethodDecorator;\nexport function subscribeSwcAppRouteChangeWhileConnected(options: SwcAppRouteChangeOptions): MethodDecorator;\n\n// \uC2E4\uC81C \uAD6C\uD604 (\uC774\uC911 \uBAA8\uB4DC)\nexport function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions?: any, propertyKeyOrConfig?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppRouteChangeWhileConnected\n // propertyKey\uAC00 string | symbol\uC774\uACE0 descriptor\uAC00 \uC788\uC73C\uBA74 \uC9C1\uC811 \uC0AC\uC6A9\n if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === 'string' || typeof propertyKeyOrConfig === 'symbol')) {\n return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @subscribeSwcAppRouteChangeWhileConnected() / @subscribeSwcAppRouteChangeWhileConnected('/path')\n let options: SwcAppRouteChangeOptions = {};\n\n if (Array.isArray(targetOrOptions)) {\n // \uBC30\uC5F4: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'])\n // \uB610\uB294: @subscribeSwcAppRouteChangeWhileConnected(['/path1', '/path2'], { order: 1 })\n options.path = targetOrOptions;\n if (propertyKeyOrConfig && typeof propertyKeyOrConfig === 'object') {\n options = { ...options, ...propertyKeyOrConfig };\n }\n } else if (typeof targetOrOptions === 'string' || typeof targetOrOptions === 'function') {\n // \uBB38\uC790\uC5F4 \uB610\uB294 \uD568\uC218: @subscribeSwcAppRouteChangeWhileConnected('/path')\n // \uB610\uB294: @subscribeSwcAppRouteChangeWhileConnected('/path', { order: 1 })\n options.path = targetOrOptions;\n if (propertyKeyOrConfig && typeof propertyKeyOrConfig === 'object') {\n options = { ...options, ...propertyKeyOrConfig };\n }\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // \uAC1D\uCCB4: @subscribeSwcAppRouteChangeWhileConnected({ path: '/path', filter: ..., order: 1 })\n options = targetOrOptions;\n }\n\n return createSubscribeSwcAppRouteChangeWhileConnected(options);\n}\nexport const changedRoute = subscribeSwcAppRouteChangeWhileConnected;\n\n// Helper function to retrieve route change subscribers metadata\nexport const getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target: any): SwcAppRouteChangeSubscriberMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);\n if (!results) return [];\n \n // Sort by order (default 0 if not specified)\n return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAIpB,MAAM,8DAA8D,OAAO,IAAI,qEAAqE;AAgB3J,SAAS,+CAA+C,SAAqD;AAC3G,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,SAAS;AAC7B,UAAM,SAAS,SAAS;AAExB,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,eAAe,6DAA6D,WAAW;AAC/G,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,+BAAa,eAAe,6DAA6D,MAAM,WAAW;AAAA,IAC5G;AACA,SAAK,KAAK,EAAE,aAAa,QAAQ,CAAC;AAElC,WAAO;AAAA,EACT;AACF;AAWO,SAAS,yCAAyC,iBAAuB,qBAA2B,YAAsC;AAG/I,MAAI,wBAAwB,OAAO,wBAAwB,YAAY,OAAO,wBAAwB,WAAW;AAC/G,WAAO,+CAA+C,CAAC,CAAC,EAAE,iBAAiB,qBAAqB,UAAU;AAAA,EAC5G;AAGA,MAAI,UAAoC,CAAC;AAEzC,MAAI,MAAM,QAAQ,eAAe,GAAG;AAGlC,YAAQ,OAAO;AACf,QAAI,uBAAuB,OAAO,wBAAwB,UAAU;AAClE,gBAAU,EAAE,GAAG,SAAS,GAAG,oBAAoB;AAAA,IACjD;AAAA,EACF,WAAW,OAAO,oBAAoB,YAAY,OAAO,oBAAoB,YAAY;AAGvF,YAAQ,OAAO;AACf,QAAI,uBAAuB,OAAO,wBAAwB,UAAU;AAClE,gBAAU,EAAE,GAAG,SAAS,GAAG,oBAAoB;AAAA,IACjD;AAAA,EACF,WAAW,mBAAmB,OAAO,oBAAoB,UAAU;AAEjE,cAAU;AAAA,EACZ;AAEA,SAAO,+CAA+C,OAAO;AAC/D;AACO,MAAM,eAAe;AAGrB,MAAM,sDAAsD,CAAC,WAAuD;AACzH,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,QAAM,UAAU,yBAAa,eAAe,6DAA6D,WAAW;AACpH,MAAI,CAAC,QAAS,QAAO,CAAC;AAGtB,SAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,EAAE;AACtF;",
6
6
  "names": []
7
7
  }
@@ -91,6 +91,13 @@ function SwcAppMixin(Base) {
91
91
  const methodName = metadata.propertyKey;
92
92
  let pathPattern = metadata.options?.path;
93
93
  const filter = metadata.options?.filter;
94
+ const extractValue = (v) => {
95
+ const keyToUse = metadata.options?.valueKey ?? import_decorators.SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY;
96
+ if (v && typeof v === "object" && keyToUse in v) {
97
+ return v[keyToUse];
98
+ }
99
+ return v;
100
+ };
94
101
  if (typeof pathPattern === "function") {
95
102
  pathPattern = pathPattern(instance);
96
103
  }
@@ -115,7 +122,7 @@ function SwcAppMixin(Base) {
115
122
  const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(this.config.window, this);
116
123
  const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
117
124
  if (pathMatched && filterPassed && instance[methodName]) {
118
- const result = await instance[methodName]({ ...re, pathData });
125
+ const result = extractValue(await instance[methodName]({ ...re, pathData }));
119
126
  if (result !== void 0 && result !== null) {
120
127
  break;
121
128
  }
@@ -230,7 +237,15 @@ function SwcAppMixin(Base) {
230
237
  context: this,
231
238
  args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
232
239
  });
233
- this.connect(userConfig);
240
+ if (userConfig instanceof Promise) {
241
+ userConfig.then((resolvedConfig) => {
242
+ this.connect(resolvedConfig);
243
+ }).catch((e) => {
244
+ console.error("[SWC-MIXIN] Script execution failed:", e);
245
+ });
246
+ } else {
247
+ this.connect(userConfig);
248
+ }
234
249
  } catch (e) {
235
250
  console.error("[SWC-MIXIN] Script execution failed:", e);
236
251
  }