@ecopages/radiant 0.1.8 → 0.2.0

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 (150) hide show
  1. package/dist/context/context-provider.js +3 -279
  2. package/dist/context/context-provider.js.map +4 -6
  3. package/dist/context/create-context.js +3 -6
  4. package/dist/context/create-context.js.map +2 -2
  5. package/dist/context/decorators/consume-context.d.ts +3 -3
  6. package/dist/context/decorators/consume-context.js +3 -64
  7. package/dist/context/decorators/consume-context.js.map +4 -5
  8. package/dist/context/decorators/context-selector.d.ts +5 -8
  9. package/dist/context/decorators/context-selector.js +3 -71
  10. package/dist/context/decorators/context-selector.js.map +4 -5
  11. package/dist/context/decorators/legacy/consume-context.d.ts +3 -0
  12. package/dist/context/decorators/legacy/consume-context.js +4 -0
  13. package/dist/context/decorators/legacy/consume-context.js.map +10 -0
  14. package/dist/context/decorators/legacy/context-selector.d.ts +4 -0
  15. package/dist/context/decorators/legacy/context-selector.js +4 -0
  16. package/dist/context/decorators/legacy/context-selector.js.map +10 -0
  17. package/dist/context/decorators/legacy/provide-context.d.ts +4 -0
  18. package/dist/context/decorators/legacy/provide-context.js +4 -0
  19. package/dist/context/decorators/legacy/provide-context.js.map +10 -0
  20. package/dist/context/decorators/provide-context.d.ts +6 -7
  21. package/dist/context/decorators/provide-context.js +3 -291
  22. package/dist/context/decorators/provide-context.js.map +4 -7
  23. package/dist/context/decorators/standard/consume-context.d.ts +3 -0
  24. package/dist/context/decorators/standard/consume-context.js +4 -0
  25. package/dist/context/decorators/standard/consume-context.js.map +10 -0
  26. package/dist/context/decorators/standard/context-selector.d.ts +4 -0
  27. package/dist/context/decorators/standard/context-selector.js +4 -0
  28. package/dist/context/decorators/standard/context-selector.js.map +10 -0
  29. package/dist/context/decorators/standard/provide-context.d.ts +4 -0
  30. package/dist/context/decorators/standard/provide-context.js +4 -0
  31. package/dist/context/decorators/standard/provide-context.js.map +10 -0
  32. package/dist/context/events.d.ts +3 -2
  33. package/dist/context/events.js +3 -53
  34. package/dist/context/events.js.map +3 -3
  35. package/dist/core/radiant-element.d.ts +72 -20
  36. package/dist/core/radiant-element.js +3 -82
  37. package/dist/core/radiant-element.js.map +3 -3
  38. package/dist/decorators/bound.d.ts +2 -6
  39. package/dist/decorators/bound.js +2 -23
  40. package/dist/decorators/bound.js.map +3 -3
  41. package/dist/decorators/custom-element.d.ts +3 -1
  42. package/dist/decorators/custom-element.js +3 -14
  43. package/dist/decorators/custom-element.js.map +3 -3
  44. package/dist/decorators/debounce.d.ts +6 -1
  45. package/dist/decorators/debounce.js +2 -20
  46. package/dist/decorators/debounce.js.map +3 -3
  47. package/dist/decorators/event.d.ts +3 -2
  48. package/dist/decorators/event.js +3 -46
  49. package/dist/decorators/event.js.map +4 -5
  50. package/dist/decorators/legacy/bound.d.ts +9 -0
  51. package/dist/decorators/legacy/bound.js +4 -0
  52. package/dist/decorators/legacy/bound.js.map +10 -0
  53. package/dist/decorators/legacy/custom-element.d.ts +6 -0
  54. package/dist/decorators/legacy/custom-element.js +4 -0
  55. package/dist/decorators/legacy/custom-element.js.map +10 -0
  56. package/dist/decorators/legacy/debounce.d.ts +1 -0
  57. package/dist/decorators/legacy/debounce.js +4 -0
  58. package/dist/decorators/legacy/debounce.js.map +10 -0
  59. package/dist/decorators/legacy/event.d.ts +9 -0
  60. package/dist/decorators/legacy/event.js +3 -0
  61. package/dist/decorators/legacy/event.js.map +10 -0
  62. package/dist/decorators/legacy/on-event.d.ts +26 -0
  63. package/dist/decorators/legacy/on-event.js +4 -0
  64. package/dist/decorators/legacy/on-event.js.map +10 -0
  65. package/dist/decorators/legacy/on-updated.d.ts +6 -0
  66. package/dist/decorators/legacy/on-updated.js +4 -0
  67. package/dist/decorators/legacy/on-updated.js.map +10 -0
  68. package/dist/decorators/legacy/query.d.ts +23 -0
  69. package/dist/decorators/legacy/query.js +4 -0
  70. package/dist/decorators/legacy/query.js.map +10 -0
  71. package/dist/decorators/legacy/reactive-field.d.ts +10 -0
  72. package/dist/decorators/legacy/reactive-field.js +4 -0
  73. package/dist/decorators/legacy/reactive-field.js.map +10 -0
  74. package/dist/decorators/legacy/reactive-prop.d.ts +19 -0
  75. package/dist/decorators/legacy/reactive-prop.js +4 -0
  76. package/dist/decorators/legacy/reactive-prop.js.map +10 -0
  77. package/dist/decorators/on-event.d.ts +4 -7
  78. package/dist/decorators/on-event.js +3 -47
  79. package/dist/decorators/on-event.js.map +3 -3
  80. package/dist/decorators/on-updated.d.ts +3 -4
  81. package/dist/decorators/on-updated.js +3 -29
  82. package/dist/decorators/on-updated.js.map +3 -3
  83. package/dist/decorators/query.d.ts +9 -28
  84. package/dist/decorators/query.js +3 -36
  85. package/dist/decorators/query.js.map +3 -3
  86. package/dist/decorators/reactive-field.d.ts +3 -7
  87. package/dist/decorators/reactive-field.js +3 -26
  88. package/dist/decorators/reactive-field.js.map +3 -3
  89. package/dist/decorators/reactive-prop.d.ts +4 -15
  90. package/dist/decorators/reactive-prop.js +3 -214
  91. package/dist/decorators/reactive-prop.js.map +4 -5
  92. package/dist/decorators/standard/bound.d.ts +2 -0
  93. package/dist/decorators/standard/bound.js +4 -0
  94. package/dist/decorators/standard/bound.js.map +10 -0
  95. package/dist/decorators/standard/custom-element.d.ts +1 -0
  96. package/dist/decorators/standard/custom-element.js +4 -0
  97. package/dist/decorators/standard/custom-element.js.map +10 -0
  98. package/dist/decorators/standard/debounce.d.ts +2 -0
  99. package/dist/decorators/standard/debounce.js +4 -0
  100. package/dist/decorators/standard/debounce.js.map +10 -0
  101. package/dist/decorators/standard/event.d.ts +9 -0
  102. package/dist/decorators/standard/event.js +4 -0
  103. package/dist/decorators/standard/event.js.map +10 -0
  104. package/dist/decorators/standard/on-event.d.ts +27 -0
  105. package/dist/decorators/standard/on-event.js +4 -0
  106. package/dist/decorators/standard/on-event.js.map +10 -0
  107. package/dist/decorators/standard/on-updated.d.ts +2 -0
  108. package/dist/decorators/standard/on-updated.js +4 -0
  109. package/dist/decorators/standard/on-updated.js.map +10 -0
  110. package/dist/decorators/standard/query.d.ts +2 -0
  111. package/dist/decorators/standard/query.js +4 -0
  112. package/dist/decorators/standard/query.js.map +10 -0
  113. package/dist/decorators/standard/reactive-field.d.ts +2 -0
  114. package/dist/decorators/standard/reactive-field.js +4 -0
  115. package/dist/decorators/standard/reactive-field.js.map +10 -0
  116. package/dist/decorators/standard/reactive-prop.d.ts +2 -0
  117. package/dist/decorators/standard/reactive-prop.js +4 -0
  118. package/dist/decorators/standard/reactive-prop.js.map +10 -0
  119. package/dist/index.d.ts +14 -4
  120. package/dist/index.js +2 -716
  121. package/dist/index.js.map +3 -21
  122. package/dist/mixins/index.js +2 -23
  123. package/dist/mixins/index.js.map +3 -4
  124. package/dist/mixins/with-kita.js +3 -23
  125. package/dist/mixins/with-kita.js.map +3 -3
  126. package/dist/tools/event-emitter.d.ts +1 -1
  127. package/dist/tools/event-emitter.js +3 -22
  128. package/dist/tools/event-emitter.js.map +3 -3
  129. package/dist/tools/index.js +2 -28
  130. package/dist/tools/index.js.map +3 -5
  131. package/dist/tools/stringify-typed.js +3 -8
  132. package/dist/tools/stringify-typed.js.map +2 -2
  133. package/dist/types.d.ts +79 -0
  134. package/dist/types.js +3 -0
  135. package/dist/types.js.map +10 -0
  136. package/dist/utils/attribute-utils.d.ts +2 -0
  137. package/dist/utils/attribute-utils.js +3 -137
  138. package/dist/utils/attribute-utils.js.map +3 -3
  139. package/dist/utils/index.js +2 -137
  140. package/dist/utils/index.js.map +3 -4
  141. package/package.json +22 -34
  142. package/dist/context/index.d.ts +0 -7
  143. package/dist/context/index.js +0 -338
  144. package/dist/context/index.js.map +0 -16
  145. package/dist/core/index.d.ts +0 -1
  146. package/dist/core/index.js +0 -83
  147. package/dist/core/index.js.map +0 -10
  148. package/dist/decorators.d.ts +0 -7
  149. package/dist/decorators.js +0 -401
  150. package/dist/decorators.js.map +0 -18
@@ -1,280 +1,4 @@
1
- // src/utils/attribute-utils.ts
2
- function parseAttributeTypeConstant(constant) {
3
- switch (constant) {
4
- case Array:
5
- return "array";
6
- case Boolean:
7
- return "boolean";
8
- case Number:
9
- return "number";
10
- case Object:
11
- return "object";
12
- case String:
13
- return "string";
14
- }
15
- }
16
- function parseAttributeTypeDefault(defaultValue) {
17
- switch (typeof defaultValue) {
18
- case "boolean":
19
- return "boolean";
20
- case "number":
21
- return "number";
22
- case "string":
23
- return "string";
24
- }
25
- if (Array.isArray(defaultValue))
26
- return "array";
27
- if (Object.prototype.toString.call(defaultValue) === "[object Object]")
28
- return "object";
29
- }
30
- function defaultValueForType(type) {
31
- switch (type) {
32
- case Number:
33
- return 0;
34
- case String:
35
- return "";
36
- case Boolean:
37
- return false;
38
- default:
39
- return null;
40
- }
41
- }
42
- function parseJSON(value) {
43
- try {
44
- return JSON.parse(value);
45
- } catch (error) {
46
- throw new TypeError("Invalid JSON string");
47
- }
48
- }
49
- function writeJSON(value) {
50
- return JSON.stringify(value);
51
- }
52
- function writeString(value) {
53
- return `${value}`;
54
- }
55
- function readAttributeValue(value, type) {
56
- const readerType = parseAttributeTypeConstant(type);
57
- if (!readerType)
58
- throw new TypeError(`[radiant-element] Unknown type "${type}"`);
59
- return readers[readerType](value);
60
- }
61
- function writeAttributeValue(value, type) {
62
- const writerType = parseAttributeTypeConstant(type);
63
- if (!writerType)
64
- throw new TypeError(`[radiant-element] Unknown type "${type}"`);
65
- return (writers[writerType] || writers.default)(value);
66
- }
67
- function isBoolean(value) {
68
- return typeof value === "boolean";
69
- }
70
- function isNumber(value) {
71
- return typeof value === "number";
72
- }
73
- function isString(value) {
74
- return typeof value === "string";
75
- }
76
- function isArray(value) {
77
- return Array.isArray(value);
78
- }
79
- function isObject(value) {
80
- return typeof value === "object" && !Array.isArray(value) && value !== null;
81
- }
82
- function isValueOfType(type, defaultValue) {
83
- switch (type) {
84
- case Boolean:
85
- return isBoolean(defaultValue);
86
- case Number:
87
- return isNumber(defaultValue);
88
- case String:
89
- return isString(defaultValue);
90
- case Array:
91
- return isArray(defaultValue);
92
- case Object:
93
- return isObject(defaultValue);
94
- default:
95
- return false;
96
- }
97
- }
98
- var readers = {
99
- array(value) {
100
- const array = parseJSON(value);
101
- if (!Array.isArray(array)) {
102
- throw new TypeError(`Expected an array but got a value of type "${typeof array}"`);
103
- }
104
- return array;
105
- },
106
- boolean(value) {
107
- return !(value === "0" || String(value).toLowerCase() === "false");
108
- },
109
- number(value) {
110
- const number = Number(value.replace(/_/g, ""));
111
- return number;
112
- },
113
- object(value) {
114
- const object = JSON.parse(value);
115
- if (object === null || typeof object !== "object" || Array.isArray(object)) {
116
- throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseAttributeTypeDefault(object)}"`);
117
- }
118
- return object;
119
- },
120
- string(value) {
121
- return value;
122
- }
123
- };
124
- var writers = {
125
- default: writeString,
126
- array: writeJSON,
127
- object: writeJSON
128
- };
1
+ import{q as G}from"./events.js";import{J as I}from"../utils/attribute-utils.js";class J{host;context;value;subscriptions=[];constructor(j,q){this.host=j,this.context=q.context;let z=q.initialValue;if(q.hydrate){const B=this.host.querySelector("script[data-hydration]");if(B?.textContent){const D=B.textContent,F=I(D,q.hydrate);if(q.hydrate===Object&&this.isObject(F)&&(this.isObject(z)||typeof z==="undefined"))z={...z??{},...F};else z=F}}this.value=z,this.registerEvents(),this.host.dispatchEvent(new G(this.context))}setContext=(j,q)=>{if(typeof this.value==="object"){const z={...this.value};if(this.value={...this.value,...j},q)q(this.value);this.notifySubscribers(this.value,z)}};getContext=()=>{return this.value};subscribe=({select:j,callback:q})=>{this.subscriptions.push({select:j,callback:q})};isObject(j){return typeof j==="object"&&!Array.isArray(j)&&j!==null}notifySubscribers=(j,q)=>{for(let z of this.subscriptions){if(!z.select)return this.sendSubscriptionUpdate(z,j);const B=z.select(j),D=z.select(q);if(B!==D)this.sendSubscriptionUpdate(z,j)}};sendSubscriptionUpdate=({select:j,callback:q},z)=>{if(!j)q(z);else q(j(z))};handleSubscriptionRequest=({select:j,callback:q,subscribe:z})=>{if(z)this.subscribe({select:j,callback:q});if(!this.value)return;if(j)q(j(this.value));else q(this.value)};onSubscriptionRequest=(j)=>{const{context:q,callback:z,subscribe:B,select:D,target:F}=j;if(q!==this.context)return;j.stopPropagation(),F.dispatchEvent(new G(this.context)),this.handleSubscriptionRequest({select:D,callback:z,subscribe:B})};onContextRequest=(j)=>{const{context:q,callback:z}=j;if(q!==this.context)return;j.stopPropagation(),z(this)};registerEvents=()=>{this.host.addEventListener("context-subscription-request",this.onSubscriptionRequest),this.host.addEventListener("context-request",this.onContextRequest)}}export{J as ContextProvider};
2
+ export{J as n};
129
3
 
130
- // src/context/events.ts
131
- var ContextEventsTypes;
132
- ((ContextEventsTypes2) => {
133
- ContextEventsTypes2["SUBSCRIPTION_REQUEST"] = "context--subscription-request";
134
- ContextEventsTypes2["CONTEXT_REQUEST"] = "context-request";
135
- ContextEventsTypes2["ON_MOUNT"] = "context--on-mount";
136
- })(ContextEventsTypes ||= {});
137
-
138
- class ContextRequestEvent extends Event {
139
- context;
140
- callback;
141
- subscribe;
142
- constructor(context, callback, subscribe) {
143
- super("context-request" /* CONTEXT_REQUEST */, { bubbles: true, composed: true });
144
- this.context = context;
145
- this.callback = callback;
146
- this.subscribe = subscribe;
147
- }
148
- }
149
-
150
- class ContextOnMountEvent extends CustomEvent {
151
- constructor(context) {
152
- super("context--on-mount" /* ON_MOUNT */, {
153
- detail: { context },
154
- bubbles: true,
155
- composed: true
156
- });
157
- }
158
- }
159
-
160
- class ContextSubscriptionRequestEvent extends Event {
161
- context;
162
- callback;
163
- select;
164
- subscribe;
165
- constructor(context, callback, select, subscribe) {
166
- super("context--subscription-request" /* SUBSCRIPTION_REQUEST */, {
167
- bubbles: true,
168
- composed: true
169
- });
170
- this.context = context;
171
- this.callback = callback;
172
- this.select = select;
173
- this.subscribe = subscribe;
174
- }
175
- }
176
-
177
- // src/context/context-provider.ts
178
- class ContextProvider {
179
- host;
180
- context;
181
- value;
182
- subscriptions = [];
183
- constructor(host, options) {
184
- this.host = host;
185
- this.context = options.context;
186
- let contextValue = options.initialValue;
187
- if (options.hydrate) {
188
- const hydrationScriptElement = this.host.querySelector("script[data-hydration]");
189
- if (hydrationScriptElement?.textContent) {
190
- const hydrationValue = hydrationScriptElement.textContent;
191
- const parsedHydrationValue = readAttributeValue(hydrationValue, options.hydrate);
192
- if (options.hydrate === Object && this.isObject(parsedHydrationValue) && (this.isObject(contextValue) || typeof contextValue === "undefined")) {
193
- contextValue = {
194
- ...contextValue ?? {},
195
- ...parsedHydrationValue
196
- };
197
- } else {
198
- contextValue = parsedHydrationValue;
199
- }
200
- }
201
- }
202
- this.value = contextValue;
203
- this.registerEvents();
204
- this.host.dispatchEvent(new ContextOnMountEvent(this.context));
205
- }
206
- setContext = (update, callback) => {
207
- if (typeof this.value === "object") {
208
- const oldContext = { ...this.value };
209
- this.value = { ...this.value, ...update };
210
- if (callback)
211
- callback(this.value);
212
- this.notifySubscribers(this.value, oldContext);
213
- }
214
- };
215
- getContext = () => {
216
- return this.value;
217
- };
218
- subscribe = ({ select, callback }) => {
219
- this.subscriptions.push({ select, callback });
220
- };
221
- isObject(value) {
222
- return typeof value === "object" && !Array.isArray(value) && value !== null;
223
- }
224
- notifySubscribers = (newContext, prevContext) => {
225
- for (const sub of this.subscriptions) {
226
- if (!sub.select)
227
- return this.sendSubscriptionUpdate(sub, newContext);
228
- const newSelected = sub.select(newContext);
229
- const prevSelected = sub.select(prevContext);
230
- if (newSelected !== prevSelected) {
231
- this.sendSubscriptionUpdate(sub, newContext);
232
- }
233
- }
234
- };
235
- sendSubscriptionUpdate = ({ select, callback }, context) => {
236
- if (!select)
237
- callback(context);
238
- else
239
- callback(select(context));
240
- };
241
- handleSubscriptionRequest = ({
242
- select,
243
- callback,
244
- subscribe
245
- }) => {
246
- if (subscribe)
247
- this.subscribe({ select, callback });
248
- if (!this.value)
249
- return;
250
- if (select) {
251
- callback(select(this.value));
252
- } else {
253
- callback(this.value);
254
- }
255
- };
256
- onSubscriptionRequest = (event) => {
257
- const { context, callback, subscribe, select, target } = event;
258
- if (context !== this.context)
259
- return;
260
- event.stopPropagation();
261
- target.dispatchEvent(new ContextOnMountEvent(this.context));
262
- this.handleSubscriptionRequest({ select, callback, subscribe });
263
- };
264
- onContextRequest = (event) => {
265
- const { context, callback } = event;
266
- if (context !== this.context)
267
- return;
268
- event.stopPropagation();
269
- callback(this);
270
- };
271
- registerEvents = () => {
272
- this.host.addEventListener("context--subscription-request" /* SUBSCRIPTION_REQUEST */, this.onSubscriptionRequest);
273
- this.host.addEventListener("context-request" /* CONTEXT_REQUEST */, this.onContextRequest);
274
- };
275
- }
276
- export {
277
- ContextProvider
278
- };
279
-
280
- //# debugId=19BF7CBFBD9F2B6364756E2164756E21
4
+ //# debugId=1E45EE002AF157AF64756E2164756E21
@@ -1,12 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/utils/attribute-utils.ts", "../src/context/events.ts", "../src/context/context-provider.ts"],
3
+ "sources": ["../src/context/context-provider.ts"],
4
4
  "sourcesContent": [
5
- "export type AttributeTypeConstant = typeof Array | typeof Boolean | typeof Number | typeof Object | typeof String;\n\nexport type AttributeTypeDefault = Array<unknown> | boolean | number | Record<string, unknown> | string;\n\n/**\n * Parses the given attribute type constant and returns its corresponding string representation.\n *\n * @param constant - The attribute type constant to parse.\n * @returns The string representation of the attribute type constant.\n */\nexport function parseAttributeTypeConstant(constant?: AttributeTypeConstant) {\n switch (constant) {\n case Array:\n return 'array';\n case Boolean:\n return 'boolean';\n case Number:\n return 'number';\n case Object:\n return 'object';\n case String:\n return 'string';\n }\n}\n\n/**\n * Parses the attribute type default value and returns its type as a string.\n *\n * @param defaultValue - The default value of the attribute type.\n * @returns The type of the default value as a string.\n */\nexport function parseAttributeTypeDefault(defaultValue?: AttributeTypeDefault) {\n switch (typeof defaultValue) {\n case 'boolean':\n return 'boolean';\n case 'number':\n return 'number';\n case 'string':\n return 'string';\n }\n\n if (Array.isArray(defaultValue)) return 'array';\n if (Object.prototype.toString.call(defaultValue) === '[object Object]') return 'object';\n}\n\n/**\n * Returns the default value for a given attribute type.\n *\n * @param type - The attribute type constant.\n * @returns The default value for the specified attribute type.\n */\nexport function defaultValueForType(type: AttributeTypeConstant): unknown {\n switch (type) {\n case Number:\n return 0;\n case String:\n return '';\n case Boolean:\n return false;\n default:\n return null;\n }\n}\n\ntype Reader = (value: string) => number | string | boolean | object | unknown[];\n\n/**\n * Utility function to parse a JSON string safely\n */\nfunction parseJSON<T>(value: string): T {\n try {\n return JSON.parse(value);\n } catch (error) {\n throw new TypeError('Invalid JSON string');\n }\n}\n\n/**\n * Object that maps attribute types to reader functions.\n * @type {Object.<string, Reader>}\n */\nconst readers: { [type: string]: Reader } = {\n array(value: string): unknown[] {\n const array = parseJSON<unknown[]>(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`Expected an array but got a value of type \"${typeof array}\"`);\n }\n return array;\n },\n\n boolean(value: string): boolean {\n return !(value === '0' || String(value).toLowerCase() === 'false');\n },\n\n number(value: string): number {\n const number = Number(value.replace(/_/g, ''));\n return number;\n },\n\n object(value: string): object {\n const object = JSON.parse(value);\n if (object === null || typeof object !== 'object' || Array.isArray(object)) {\n throw new TypeError(\n `expected value of type \"object\" but instead got value \"${value}\" of type \"${parseAttributeTypeDefault(\n object,\n )}\"`,\n );\n }\n return object;\n },\n\n string(value: string): string {\n return value;\n },\n};\n\ntype Writer = (value: unknown) => string;\n\n/**\n * Object that maps attribute types to writer functions.\n * @type {Object.<string, Writer>}\n */\nconst writers: { [type: string]: Writer } = {\n default: writeString,\n array: writeJSON,\n object: writeJSON,\n};\n\nfunction writeJSON(value: unknown) {\n return JSON.stringify(value);\n}\n\nfunction writeString(value: unknown) {\n return `${value}`;\n}\n\n/**\n * Reads the attribute value based on the provided type.\n * @param value - The attribute value to be read.\n * @param type - The type of the attribute.\n * @returns The parsed attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function readAttributeValue(value: string, type: AttributeTypeConstant) {\n const readerType = parseAttributeTypeConstant(type);\n if (!readerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n return readers[readerType](value);\n}\n\nexport type ReadAttributeValueReturnType = ReturnType<typeof readAttributeValue>;\n\n/**\n * Writes the attribute value based on the provided type.\n *\n * @param value - The value to be written.\n * @param type - The type of the attribute.\n * @returns The written attribute value.\n * @throws {TypeError} If the provided type is unknown.\n */\nexport function writeAttributeValue(value: unknown, type: AttributeTypeConstant) {\n const writerType = parseAttributeTypeConstant(type);\n if (!writerType) throw new TypeError(`[radiant-element] Unknown type \"${type}\"`);\n return (writers[writerType] || writers.default)(value);\n}\n\nexport type WriteAttributeValueReturnType = ReturnType<typeof writeAttributeValue>;\n\n/*\n * Type guard functions for each type in AttributeTypeConstant\n */\nfunction isBoolean(value: unknown): value is boolean {\n return typeof value === 'boolean';\n}\n\nfunction isNumber(value: unknown): value is number {\n return typeof value === 'number';\n}\n\nfunction isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n\nfunction isArray(value: unknown): value is Array<unknown> {\n return Array.isArray(value);\n}\n\nfunction isObject(value: unknown): value is object {\n return typeof value === 'object' && !Array.isArray(value) && value !== null;\n}\n\n/*\n * Check function to ensure defaultValue matches the type\n */\nexport function isValueOfType(type: AttributeTypeConstant, defaultValue: unknown): boolean {\n switch (type) {\n case Boolean:\n return isBoolean(defaultValue);\n case Number:\n return isNumber(defaultValue);\n case String:\n return isString(defaultValue);\n case Array:\n return isArray(defaultValue);\n case Object:\n return isObject(defaultValue);\n default:\n return false;\n }\n}\n",
6
- "import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n SUBSCRIPTION_REQUEST = 'context--subscription-request',\n CONTEXT_REQUEST = 'context-request',\n ON_MOUNT = 'context--on-mount',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: ContextCallback<ContextType<T>>,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n }\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\nexport type ContextSubscription<T extends UnknownContext> = {\n select?: (context: ContextType<T>) => unknown;\n callback: (value: unknown) => void;\n};\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n public constructor(context: UnknownContext) {\n super(ContextEventsTypes.ON_MOUNT, {\n detail: { context },\n bubbles: true,\n composed: true,\n });\n }\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: (value: ContextType<T> | { [K in keyof ContextType<T>]: ContextType<T>[K] }) => void,\n public readonly select?: (context: ContextType<T>) => unknown,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n bubbles: true,\n composed: true,\n });\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n /**\n * A 'context-request-subscription' event can be emitted by any element which desires\n * a context value to be injected by an external provider.\n */\n [ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n /**\n * A context-request-provider event can be emitted by a context requester to signal\n * that it desires a context value to be provided by a context provider.\n */\n [ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n /**\n * A 'context-mount' event can be emitted by a context provider to signal\n * that a context value has been mounted and is available for consumption.\n */\n [ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n }\n}\n",
7
- "import type { RadiantElement } from '@/core/radiant-element';\nimport { type AttributeTypeConstant, readAttributeValue } from '@/utils/attribute-utils';\nimport { query } from '..';\nimport {\n ContextEventsTypes,\n ContextOnMountEvent,\n type ContextRequestEvent,\n type ContextSubscription,\n type ContextSubscriptionRequestEvent,\n} from './events';\nimport type { Context, ContextType, UnknownContext } from './types';\n\ntype ContextProviderOptions<T extends UnknownContext> = {\n context: UnknownContext;\n initialValue?: T['__context__'];\n hydrate?: AttributeTypeConstant;\n};\n\n/**\n * Represents a context provider that allows setting and getting the context,\n * as well as subscribing to context updates.\n *\n * @template T - The type of the context.\n */\nexport interface IContextProvider<T extends Context<unknown, unknown>> {\n /**\n * Sets the context with the provided update and invokes the optional callback function.\n *\n * @param update - The partial update to be applied to the context.\n * @param callback - An optional callback function that receives the updated context.\n */\n setContext: (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => void;\n\n /**\n * Gets the current context.\n *\n * @returns The current context.\n */\n getContext: () => ContextType<T>;\n\n /**\n * Subscribes to context updates.\n *\n * @param subscription - The subscription object that defines the callback function to be invoked on context updates.\n */\n subscribe: (subscription: ContextSubscription<T>) => void;\n}\n\n/**\n * It creates a context provider that allows setting and getting the context,\n * It will also be in charge of notifying the subscribers when the context changes.\n *\n * @template T - The type of the context.\n * @implements IContextProvider\n *\n * @example\n * ```ts\n * export class MyElement extends RadiantElement {\n * provider = new ContextProvider<typeof myContext>(this, {\n * context: myContext,\n * initialValue: {\n * value: 'Hello World',\n * },\n * });\n * ```\n */\nexport class ContextProvider<T extends Context<unknown, unknown>> implements IContextProvider<T> {\n private host: RadiantElement;\n private context: UnknownContext;\n private value: ContextType<T> | undefined;\n\n subscriptions: ContextSubscription<T>[] = [];\n\n /**\n * Creates a new instance of the ContextProvider.\n *\n * @param host - The host element that will contain the context provider.\n * @param options - The options to configure the context provider.\n */\n constructor(host: RadiantElement, options: ContextProviderOptions<T>) {\n this.host = host;\n this.context = options.context;\n let contextValue: T['__context__'] | undefined = options.initialValue;\n\n if (options.hydrate) {\n const hydrationScriptElement = this.host.querySelector('script[data-hydration]');\n if (hydrationScriptElement?.textContent) {\n const hydrationValue = hydrationScriptElement.textContent;\n const parsedHydrationValue = readAttributeValue(hydrationValue, options.hydrate) as ContextType<T>;\n\n if (\n options.hydrate === Object &&\n this.isObject(parsedHydrationValue) &&\n (this.isObject(contextValue) || typeof contextValue === 'undefined')\n ) {\n contextValue = {\n ...(contextValue ?? {}),\n ...parsedHydrationValue,\n };\n } else {\n contextValue = parsedHydrationValue;\n }\n }\n }\n\n this.value = contextValue as ContextType<T>;\n\n this.registerEvents();\n this.host.dispatchEvent(new ContextOnMountEvent(this.context));\n }\n\n setContext = (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => {\n if (typeof this.value === 'object') {\n const oldContext = { ...this.value };\n this.value = { ...this.value, ...update };\n if (callback) callback(this.value);\n this.notifySubscribers(this.value, oldContext);\n }\n };\n\n getContext = () => {\n return this.value as ContextType<T>;\n };\n\n subscribe = ({ select, callback }: ContextSubscription<T>) => {\n this.subscriptions.push({ select, callback });\n };\n\n private isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && !Array.isArray(value) && value !== null;\n }\n\n private notifySubscribers = (newContext: ContextType<T>, prevContext: ContextType<T>) => {\n for (const sub of this.subscriptions) {\n if (!sub.select) return this.sendSubscriptionUpdate(sub, newContext);\n const newSelected = sub.select(newContext);\n const prevSelected = sub.select(prevContext);\n if (newSelected !== prevSelected) {\n this.sendSubscriptionUpdate(sub, newContext);\n }\n }\n };\n\n private sendSubscriptionUpdate = ({ select, callback }: ContextSubscription<T>, context: ContextType<T>) => {\n if (!select) callback(context);\n else callback(select(context));\n };\n\n private handleSubscriptionRequest = ({\n select,\n callback,\n subscribe,\n }: {\n select?: ContextSubscription<T>['select'];\n callback: ContextSubscription<T>['callback'];\n subscribe?: boolean;\n }) => {\n if (subscribe) this.subscribe({ select, callback });\n\n if (!this.value) return;\n\n if (select) {\n callback(select(this.value));\n } else {\n callback(this.value as ContextType<T>);\n }\n };\n\n private onSubscriptionRequest = (event: ContextSubscriptionRequestEvent<UnknownContext>) => {\n const { context, callback, subscribe, select, target } = event;\n if (context !== this.context) return;\n\n event.stopPropagation();\n\n (target as HTMLElement).dispatchEvent(new ContextOnMountEvent(this.context));\n\n this.handleSubscriptionRequest({ select, callback, subscribe });\n };\n\n private onContextRequest = (event: ContextRequestEvent<UnknownContext>) => {\n const { context, callback } = event;\n if (context !== this.context) return;\n event.stopPropagation();\n callback(this);\n };\n\n private registerEvents = () => {\n this.host.addEventListener(ContextEventsTypes.SUBSCRIPTION_REQUEST, this.onSubscriptionRequest);\n this.host.addEventListener(ContextEventsTypes.CONTEXT_REQUEST, this.onContextRequest);\n };\n}\n"
5
+ "import type { RadiantElement } from '../core/radiant-element';\nimport { type AttributeTypeConstant, readAttributeValue } from '../utils/attribute-utils';\nimport {\n ContextEventsTypes,\n ContextOnMountEvent,\n type ContextRequestEvent,\n type ContextSubscription,\n type ContextSubscriptionRequestEvent,\n} from './events';\nimport type { Context, ContextType, UnknownContext } from './types';\n\ntype ContextProviderOptions<T extends UnknownContext> = {\n context: UnknownContext;\n initialValue?: T['__context__'];\n hydrate?: AttributeTypeConstant;\n};\n\n/**\n * Represents a context provider that allows setting and getting the context,\n * as well as subscribing to context updates.\n *\n * @template T - The type of the context.\n */\nexport interface IContextProvider<T extends Context<unknown, unknown>> {\n /**\n * Sets the context with the provided update and invokes the optional callback function.\n *\n * @param update - The partial update to be applied to the context.\n * @param callback - An optional callback function that receives the updated context.\n */\n setContext: (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => void;\n\n /**\n * Gets the current context.\n *\n * @returns The current context.\n */\n getContext: () => ContextType<T>;\n\n /**\n * Subscribes to context updates.\n *\n * @param subscription - The subscription object that defines the callback function to be invoked on context updates.\n */\n subscribe: (subscription: ContextSubscription<T>) => void;\n}\n\n/**\n * It creates a context provider that allows setting and getting the context,\n * It will also be in charge of notifying the subscribers when the context changes.\n *\n * @template T - The type of the context.\n * @implements IContextProvider\n *\n * @example\n * ```ts\n * export class MyElement extends RadiantElement {\n * provider = new ContextProvider<typeof myContext>(this, {\n * context: myContext,\n * initialValue: {\n * value: 'Hello World',\n * },\n * });\n * ```\n */\nexport class ContextProvider<T extends Context<unknown, unknown>> implements IContextProvider<T> {\n private host: RadiantElement;\n private context: UnknownContext;\n private value: ContextType<T> | undefined;\n\n subscriptions: ContextSubscription<T>[] = [];\n\n /**\n * Creates a new instance of the ContextProvider.\n *\n * @param host - The host element that will contain the context provider.\n * @param options - The options to configure the context provider.\n */\n constructor(host: RadiantElement, options: ContextProviderOptions<T>) {\n this.host = host;\n this.context = options.context;\n let contextValue: T['__context__'] | undefined = options.initialValue;\n\n if (options.hydrate) {\n const hydrationScriptElement = this.host.querySelector('script[data-hydration]');\n if (hydrationScriptElement?.textContent) {\n const hydrationValue = hydrationScriptElement.textContent;\n const parsedHydrationValue = readAttributeValue(hydrationValue, options.hydrate) as ContextType<T>;\n\n if (\n options.hydrate === Object &&\n this.isObject(parsedHydrationValue) &&\n (this.isObject(contextValue) || typeof contextValue === 'undefined')\n ) {\n contextValue = {\n ...(contextValue ?? {}),\n ...parsedHydrationValue,\n };\n } else {\n contextValue = parsedHydrationValue;\n }\n }\n }\n\n this.value = contextValue as ContextType<T>;\n\n this.registerEvents();\n this.host.dispatchEvent(new ContextOnMountEvent(this.context));\n }\n\n setContext = (update: Partial<ContextType<T>>, callback?: (context: ContextType<T>) => void) => {\n if (typeof this.value === 'object') {\n const oldContext = { ...this.value };\n this.value = { ...this.value, ...update };\n if (callback) callback(this.value);\n this.notifySubscribers(this.value, oldContext);\n }\n };\n\n getContext = () => {\n return this.value as ContextType<T>;\n };\n\n subscribe = ({ select, callback }: ContextSubscription<T>) => {\n this.subscriptions.push({ select, callback });\n };\n\n private isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && !Array.isArray(value) && value !== null;\n }\n\n private notifySubscribers = (newContext: ContextType<T>, prevContext: ContextType<T>) => {\n for (const sub of this.subscriptions) {\n if (!sub.select) return this.sendSubscriptionUpdate(sub, newContext);\n const newSelected = sub.select(newContext);\n const prevSelected = sub.select(prevContext);\n if (newSelected !== prevSelected) {\n this.sendSubscriptionUpdate(sub, newContext);\n }\n }\n };\n\n private sendSubscriptionUpdate = ({ select, callback }: ContextSubscription<T>, context: ContextType<T>) => {\n if (!select) callback(context);\n else callback(select(context));\n };\n\n private handleSubscriptionRequest = ({\n select,\n callback,\n subscribe,\n }: {\n select?: ContextSubscription<T>['select'];\n callback: ContextSubscription<T>['callback'];\n subscribe?: boolean;\n }) => {\n if (subscribe) this.subscribe({ select, callback });\n\n if (!this.value) return;\n\n if (select) {\n callback(select(this.value));\n } else {\n callback(this.value as ContextType<T>);\n }\n };\n\n private onSubscriptionRequest = (event: ContextSubscriptionRequestEvent<UnknownContext>) => {\n const { context, callback, subscribe, select, target } = event;\n if (context !== this.context) return;\n\n event.stopPropagation();\n\n (target as HTMLElement).dispatchEvent(new ContextOnMountEvent(this.context));\n\n this.handleSubscriptionRequest({ select, callback, subscribe });\n };\n\n private onContextRequest = (event: ContextRequestEvent<UnknownContext>) => {\n const { context, callback } = event;\n if (context !== this.context) return;\n event.stopPropagation();\n callback(this);\n };\n\n private registerEvents = () => {\n this.host.addEventListener(ContextEventsTypes.SUBSCRIPTION_REQUEST, this.onSubscriptionRequest);\n this.host.addEventListener(ContextEventsTypes.CONTEXT_REQUEST, this.onContextRequest);\n };\n}\n"
8
6
  ],
9
- "mappings": ";AAUO,SAAS,0BAA0B,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AC9B,GAAI,IAAY,KAAK,QAAS,OAC9B,EAAM,gBAAgB,EACtB,EAAS,IAAI,GAGP,eAAiB,IAAM,CAC7B,KAAK,KAAK,gDAA0D,KAAK,qBAAqB,EAC9F,KAAK,KAAK,mCAAqD,KAAK,gBAAgB,EAExF",
8
+ "debugId": "1E45EE002AF157AF64756E2164756E21",
11
9
  "names": []
12
10
  }
@@ -1,7 +1,4 @@
1
- // src/context/create-context.ts
2
- var createContext = (key) => key;
3
- export {
4
- createContext
5
- };
1
+ var g=(d)=>d;export{g as createContext};
2
+ export{g as e};
6
3
 
7
- //# debugId=4C205EEF470D369264756E2164756E21
4
+ //# debugId=B8BB9E641176DF6864756E2164756E21
@@ -4,7 +4,7 @@
4
4
  "sourcesContent": [
5
5
  "import type { Context } from './types';\n\n/**\n * A function which creates a Context value object\n */\nexport const createContext = <ValueType>(key: unknown) => key as Context<typeof key, ValueType>;\n"
6
6
  ],
7
- "mappings": ";AAKO,IAAM,gBAAgB,CAAY,QAAiB;",
8
- "debugId": "4C205EEF470D369264756E2164756E21",
7
+ "mappings": "AAKO,IAAM,EAAgB,CAAY,IAAiB",
8
+ "debugId": "B8BB9E641176DF6864756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,8 +1,8 @@
1
- import type { UnknownContext } from '../../context/types';
2
- import type { RadiantElement } from '../../core/radiant-element';
1
+ import type { StandardOrLegacyFieldDecoratorArgs } from '../../types';
2
+ import type { UnknownContext } from '../types';
3
3
  /**
4
4
  * A decorator to provide a context to the target element.
5
5
  * @param contextToProvide
6
6
  * @returns
7
7
  */
8
- export declare function consumeContext(contextToProvide: UnknownContext): (proto: RadiantElement, propertyKey: string) => void;
8
+ export declare function consumeContext(contextToProvide: UnknownContext): (protoOrTarget: StandardOrLegacyFieldDecoratorArgs["protoOrTarget"], nameOrContext: StandardOrLegacyFieldDecoratorArgs["nameOrContext"]) => any;
@@ -1,65 +1,4 @@
1
- // src/context/events.ts
2
- var ContextEventsTypes;
3
- ((ContextEventsTypes2) => {
4
- ContextEventsTypes2["SUBSCRIPTION_REQUEST"] = "context--subscription-request";
5
- ContextEventsTypes2["CONTEXT_REQUEST"] = "context-request";
6
- ContextEventsTypes2["ON_MOUNT"] = "context--on-mount";
7
- })(ContextEventsTypes ||= {});
1
+ import{g as k}from"./legacy/consume-context.js";import{o as q}from"./standard/consume-context.js";import"../events.js";function B(f){return function(j,b){if(typeof b==="object")return q(f)(j,b);return k(f)(j,b)}}export{B as consumeContext};
2
+ export{B as f};
8
3
 
9
- class ContextRequestEvent extends Event {
10
- context;
11
- callback;
12
- subscribe;
13
- constructor(context, callback, subscribe) {
14
- super("context-request" /* CONTEXT_REQUEST */, { bubbles: true, composed: true });
15
- this.context = context;
16
- this.callback = callback;
17
- this.subscribe = subscribe;
18
- }
19
- }
20
-
21
- class ContextOnMountEvent extends CustomEvent {
22
- constructor(context) {
23
- super("context--on-mount" /* ON_MOUNT */, {
24
- detail: { context },
25
- bubbles: true,
26
- composed: true
27
- });
28
- }
29
- }
30
-
31
- class ContextSubscriptionRequestEvent extends Event {
32
- context;
33
- callback;
34
- select;
35
- subscribe;
36
- constructor(context, callback, select, subscribe) {
37
- super("context--subscription-request" /* SUBSCRIPTION_REQUEST */, {
38
- bubbles: true,
39
- composed: true
40
- });
41
- this.context = context;
42
- this.callback = callback;
43
- this.select = select;
44
- this.subscribe = subscribe;
45
- }
46
- }
47
-
48
- // src/context/decorators/consume-context.ts
49
- function consumeContext(contextToProvide) {
50
- return (proto, propertyKey) => {
51
- const originalConnectedCallback = proto.connectedCallback;
52
- proto.connectedCallback = function() {
53
- originalConnectedCallback.call(this);
54
- this.dispatchEvent(new ContextRequestEvent(contextToProvide, (context) => {
55
- this[propertyKey] = context;
56
- this.connectedContextCallback(contextToProvide);
57
- }));
58
- };
59
- };
60
- }
61
- export {
62
- consumeContext
63
- };
64
-
65
- //# debugId=D00E7FCC029AE39264756E2164756E21
4
+ //# debugId=D0E540181126F79564756E2164756E21
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/context/events.ts", "../src/context/decorators/consume-context.ts"],
3
+ "sources": ["../src/context/decorators/consume-context.ts"],
4
4
  "sourcesContent": [
5
- "import type { Context, ContextCallback, ContextType, UnknownContext } from './types';\n\n/**\n * List of events which can be emitted by a context provider or requester.\n */\nexport enum ContextEventsTypes {\n SUBSCRIPTION_REQUEST = 'context--subscription-request',\n CONTEXT_REQUEST = 'context-request',\n ON_MOUNT = 'context--on-mount',\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n */\nexport class ContextRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: ContextCallback<ContextType<T>>,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.CONTEXT_REQUEST, { bubbles: true, composed: true });\n }\n}\n\n/**\n * A type which represents a subscription to a context value.\n */\nexport type ContextSubscription<T extends UnknownContext> = {\n select?: (context: ContextType<T>) => unknown;\n callback: (value: unknown) => void;\n};\n\n/**\n * An event fired by a context provider to signal that a context value has been mounted and is available for consumption.\n */\nexport class ContextOnMountEvent extends CustomEvent<{ context: UnknownContext }> {\n public constructor(context: UnknownContext) {\n super(ContextEventsTypes.ON_MOUNT, {\n detail: { context },\n bubbles: true,\n composed: true,\n });\n }\n}\n\n/**\n * An event fired by a context requester to signal it desires a named context.\n *\n * A provider should inspect the `context` property of the event to determine if it has a value that can\n * satisfy the request, calling the `callback` with the requested value if so.\n *\n * If the requested context event contains a truthy `subscribe` value, then a provider can call the callback\n * multiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\n * function to the callback which requesters can invoke to indicate they no longer wish to receive these updates.\n *\n * It accepts a `selector` property which can be used to request a specific property of the context value.\n */\nexport class ContextSubscriptionRequestEvent<T extends UnknownContext> extends Event {\n public constructor(\n public readonly context: T,\n public readonly callback: (value: ContextType<T> | { [K in keyof ContextType<T>]: ContextType<T>[K] }) => void,\n public readonly select?: (context: ContextType<T>) => unknown,\n public readonly subscribe?: boolean,\n ) {\n super(ContextEventsTypes.SUBSCRIPTION_REQUEST, {\n bubbles: true,\n composed: true,\n });\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n /**\n * A 'context-request-subscription' event can be emitted by any element which desires\n * a context value to be injected by an external provider.\n */\n [ContextEventsTypes.SUBSCRIPTION_REQUEST]: ContextSubscriptionRequestEvent<UnknownContext>;\n /**\n * A context-request-provider event can be emitted by a context requester to signal\n * that it desires a context value to be provided by a context provider.\n */\n [ContextEventsTypes.CONTEXT_REQUEST]: ContextRequestEvent<Context<unknown, unknown>>;\n /**\n * A 'context-mount' event can be emitted by a context provider to signal\n * that a context value has been mounted and is available for consumption.\n */\n [ContextEventsTypes.ON_MOUNT]: ContextOnMountEvent;\n }\n}\n",
6
- "import { ContextRequestEvent } from '@/context/events';\nimport type { UnknownContext } from '@/context/types';\nimport type { RadiantElement } from '@/core/radiant-element';\n\n/**\n * A decorator to provide a context to the target element.\n * @param contextToProvide\n * @returns\n */\nexport function consumeContext(contextToProvide: UnknownContext) {\n return (proto: RadiantElement, propertyKey: string) => {\n const originalConnectedCallback = proto.connectedCallback;\n\n proto.connectedCallback = function (this: RadiantElement) {\n originalConnectedCallback.call(this);\n this.dispatchEvent(\n new ContextRequestEvent(contextToProvide, (context) => {\n (this as any)[propertyKey] = context;\n this.connectedContextCallback(contextToProvide);\n }),\n );\n };\n };\n}\n"
5
+ "import type {\n LegacyFieldDecoratorArgs,\n StandardFieldDecoratorArgs,\n StandardOrLegacyFieldDecoratorArgs,\n} from '../../types';\nimport type { UnknownContext } from '../types';\nimport { consumeContext as legacyConsumeContext } from './legacy/consume-context';\nimport { consumeContext as standardConsumeContext } from './standard/consume-context';\n\n/**\n * A decorator to provide a context to the target element.\n * @param contextToProvide\n * @returns\n */\nexport function consumeContext(contextToProvide: UnknownContext) {\n return function (\n protoOrTarget: StandardOrLegacyFieldDecoratorArgs['protoOrTarget'],\n nameOrContext: StandardOrLegacyFieldDecoratorArgs['nameOrContext'],\n ): any {\n if (typeof nameOrContext === 'object') {\n return standardConsumeContext(contextToProvide)(\n protoOrTarget as StandardFieldDecoratorArgs['protoOrTarget'],\n nameOrContext as StandardFieldDecoratorArgs['nameOrContext'],\n );\n }\n return legacyConsumeContext(contextToProvide)(\n protoOrTarget as LegacyFieldDecoratorArgs['protoOrTarget'],\n nameOrContext as LegacyFieldDecoratorArgs['nameOrContext'],\n );\n };\n}\n"
7
6
  ],
8
- "mappings": ";AAKO,IAAK;AAAL,EAAK,wBAAL;AACL,gDAAuB;AACvB,2CAAkB;AAClB,oCAAW;AAAA,GAHD;AAgBL;AAAA,MAAM,4BAAsD,MAAM;AAAA,EAErD;AAAA,EACA;AAAA,EACA;AAAA,EAHX,WAAW,CACA,SACA,UACA,WAChB;AACA,UAAM,yCAAoC,EAAE,SAAS,MAAM,UAAU,KAAK,CAAC;AAJ3D;AACA;AACA;AAAA;AAIpB;AAaO;AAAA,MAAM,4BAA4B,YAAyC;AAAA,EACzE,WAAW,CAAC,SAAyB;AAC1C,UAAM,oCAA6B;AAAA,MACjC,QAAQ,EAAE,QAAQ;AAAA,MAClB,SAAS;AAAA,MACT,UAAU;AAAA,IACZ,CAAC;AAAA;AAEL;AAcO;AAAA,MAAM,wCAAkE,MAAM;AAAA,EAEjE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAJX,WAAW,CACA,SACA,UACA,QACA,WAChB;AACA,UAAM,4DAAyC;AAAA,MAC7C,SAAS;AAAA,MACT,UAAU;AAAA,IACZ,CAAC;AARe;AACA;AACA;AACA;AAAA;AAOpB;;;ACnEO,SAAS,cAAc,CAAC,kBAAkC;AAC/D,SAAO,CAAC,OAAuB,gBAAwB;AACrD,UAAM,4BAA4B,MAAM;AAExC,UAAM,4BAA6B,GAAuB;AACxD,gCAA0B,KAAK,IAAI;AACnC,WAAK,cACH,IAAI,oBAAoB,kBAAkB,CAAC,YAAY;AACrD,QAAC,KAAa,eAAe;AAC7B,aAAK,yBAAyB,gBAAgB;AAAA,OAC/C,CACH;AAAA;AAAA;AAAA;",
9
- "debugId": "D00E7FCC029AE39264756E2164756E21",
7
+ "mappings": "gIAcO,aAAS,ZAAc,CAAC,EAAkC,CAC/D,eAAgB,CACd,EACA,EACK,CACL,UAAW,IAAkB,SAC3B,OAAO,EAAuB,CAAgB,EAC5C,EACA,CACF,EAEF,OAAO,EAAqB,CAAgB,EAC1C,EACA,CACF",
8
+ "debugId": "D0E540181126F79564756E2164756E21",
10
9
  "names": []
11
10
  }
@@ -1,16 +1,13 @@
1
- import type { Context, UnknownContext } from '../../context/types';
2
- import type { RadiantElement } from '../../core/radiant-element';
3
- type SubscribeToContextOptions<T extends UnknownContext> = {
1
+ import type { StandardOrLegacyMethodDecoratorArgs } from '../../types';
2
+ import type { Context, UnknownContext } from '../types';
3
+ export type SubscribeToContextOptions<T extends UnknownContext> = {
4
4
  context: T;
5
5
  select?: (context: T['__context__']) => unknown;
6
6
  subscribe?: boolean;
7
7
  };
8
8
  /**
9
9
  * A decorator to subscribe to a context selector.
10
- * @param context The context to subscribe to.
11
- * @param selector The selector to subscribe to. If not provided, the whole context will be subscribed to.
12
- * @param subscribe @default true Whether to subscribe or unsubscribe. Optional.
10
+ * @param option {@link SubscribeToContextOptions}
13
11
  * @returns
14
12
  */
15
- export declare function contextSelector<T extends Context<unknown, unknown>>({ context, select, subscribe, }: SubscribeToContextOptions<T>): (proto: RadiantElement, _: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
16
- export {};
13
+ export declare function contextSelector<T extends Context<unknown, unknown>>(options: SubscribeToContextOptions<T>): (protoOrTarget: StandardOrLegacyMethodDecoratorArgs["protoOrTarget"], nameOrContext: StandardOrLegacyMethodDecoratorArgs["nameOrContext"], descriptor?: StandardOrLegacyMethodDecoratorArgs["descriptor"]) => any;
@@ -1,72 +1,4 @@
1
- // src/context/events.ts
2
- var ContextEventsTypes;
3
- ((ContextEventsTypes2) => {
4
- ContextEventsTypes2["SUBSCRIPTION_REQUEST"] = "context--subscription-request";
5
- ContextEventsTypes2["CONTEXT_REQUEST"] = "context-request";
6
- ContextEventsTypes2["ON_MOUNT"] = "context--on-mount";
7
- })(ContextEventsTypes ||= {});
1
+ import{i as v}from"./standard/context-selector.js";import{j as q}from"./legacy/context-selector.js";import"../events.js";function D(h){return function(j,f,w){if(typeof f==="object")return v(h)(j,f);return q(h)(j,f,w)}}export{D as contextSelector};
2
+ export{D as h};
8
3
 
9
- class ContextRequestEvent extends Event {
10
- context;
11
- callback;
12
- subscribe;
13
- constructor(context, callback, subscribe) {
14
- super("context-request" /* CONTEXT_REQUEST */, { bubbles: true, composed: true });
15
- this.context = context;
16
- this.callback = callback;
17
- this.subscribe = subscribe;
18
- }
19
- }
20
-
21
- class ContextOnMountEvent extends CustomEvent {
22
- constructor(context) {
23
- super("context--on-mount" /* ON_MOUNT */, {
24
- detail: { context },
25
- bubbles: true,
26
- composed: true
27
- });
28
- }
29
- }
30
-
31
- class ContextSubscriptionRequestEvent extends Event {
32
- context;
33
- callback;
34
- select;
35
- subscribe;
36
- constructor(context, callback, select, subscribe) {
37
- super("context--subscription-request" /* SUBSCRIPTION_REQUEST */, {
38
- bubbles: true,
39
- composed: true
40
- });
41
- this.context = context;
42
- this.callback = callback;
43
- this.select = select;
44
- this.subscribe = subscribe;
45
- }
46
- }
47
-
48
- // src/context/decorators/context-selector.ts
49
- function contextSelector({
50
- context,
51
- select,
52
- subscribe = true
53
- }) {
54
- return (proto, _, descriptor) => {
55
- const originalMethod = descriptor.value;
56
- const originalConnectedCallback = proto.connectedCallback;
57
- proto.connectedCallback = function() {
58
- originalConnectedCallback.call(this);
59
- this.dispatchEvent(new ContextSubscriptionRequestEvent(context, originalMethod.bind(this), select, subscribe));
60
- };
61
- descriptor.value = function(...args) {
62
- const result = originalMethod.apply(this, args);
63
- return result;
64
- };
65
- return descriptor;
66
- };
67
- }
68
- export {
69
- contextSelector
70
- };
71
-
72
- //# debugId=BAE397795EE3704564756E2164756E21
4
+ //# debugId=0C0E19D0A850DDF264756E2164756E21