@ecopages/radiant 0.1.7 → 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.
- package/dist/context/context-provider.js +3 -279
- package/dist/context/context-provider.js.map +4 -6
- package/dist/context/create-context.js +3 -6
- package/dist/context/create-context.js.map +2 -2
- package/dist/context/decorators/consume-context.d.ts +3 -3
- package/dist/context/decorators/consume-context.js +3 -64
- package/dist/context/decorators/consume-context.js.map +4 -5
- package/dist/context/decorators/context-selector.d.ts +5 -8
- package/dist/context/decorators/context-selector.js +3 -71
- package/dist/context/decorators/context-selector.js.map +4 -5
- package/dist/context/decorators/legacy/consume-context.d.ts +3 -0
- package/dist/context/decorators/legacy/consume-context.js +4 -0
- package/dist/context/decorators/legacy/consume-context.js.map +10 -0
- package/dist/context/decorators/legacy/context-selector.d.ts +4 -0
- package/dist/context/decorators/legacy/context-selector.js +4 -0
- package/dist/context/decorators/legacy/context-selector.js.map +10 -0
- package/dist/context/decorators/legacy/provide-context.d.ts +4 -0
- package/dist/context/decorators/legacy/provide-context.js +4 -0
- package/dist/context/decorators/legacy/provide-context.js.map +10 -0
- package/dist/context/decorators/provide-context.d.ts +6 -7
- package/dist/context/decorators/provide-context.js +3 -291
- package/dist/context/decorators/provide-context.js.map +4 -7
- package/dist/context/decorators/standard/consume-context.d.ts +3 -0
- package/dist/context/decorators/standard/consume-context.js +4 -0
- package/dist/context/decorators/standard/consume-context.js.map +10 -0
- package/dist/context/decorators/standard/context-selector.d.ts +4 -0
- package/dist/context/decorators/standard/context-selector.js +4 -0
- package/dist/context/decorators/standard/context-selector.js.map +10 -0
- package/dist/context/decorators/standard/provide-context.d.ts +4 -0
- package/dist/context/decorators/standard/provide-context.js +4 -0
- package/dist/context/decorators/standard/provide-context.js.map +10 -0
- package/dist/context/events.d.ts +3 -2
- package/dist/context/events.js +3 -53
- package/dist/context/events.js.map +3 -3
- package/dist/core/radiant-element.d.ts +72 -20
- package/dist/core/radiant-element.js +3 -82
- package/dist/core/radiant-element.js.map +3 -3
- package/dist/decorators/bound.d.ts +5 -0
- package/dist/decorators/bound.js +3 -0
- package/dist/decorators/bound.js.map +10 -0
- package/dist/decorators/custom-element.d.ts +3 -1
- package/dist/decorators/custom-element.js +3 -14
- package/dist/decorators/custom-element.js.map +3 -3
- package/dist/decorators/debounce.d.ts +6 -1
- package/dist/decorators/debounce.js +2 -20
- package/dist/decorators/debounce.js.map +3 -3
- package/dist/decorators/event.d.ts +3 -2
- package/dist/decorators/event.js +3 -46
- package/dist/decorators/event.js.map +4 -5
- package/dist/decorators/legacy/bound.d.ts +9 -0
- package/dist/decorators/legacy/bound.js +4 -0
- package/dist/decorators/legacy/bound.js.map +10 -0
- package/dist/decorators/legacy/custom-element.d.ts +6 -0
- package/dist/decorators/legacy/custom-element.js +4 -0
- package/dist/decorators/legacy/custom-element.js.map +10 -0
- package/dist/decorators/legacy/debounce.d.ts +1 -0
- package/dist/decorators/legacy/debounce.js +4 -0
- package/dist/decorators/legacy/debounce.js.map +10 -0
- package/dist/decorators/legacy/event.d.ts +9 -0
- package/dist/decorators/legacy/event.js +3 -0
- package/dist/decorators/legacy/event.js.map +10 -0
- package/dist/decorators/legacy/on-event.d.ts +26 -0
- package/dist/decorators/legacy/on-event.js +4 -0
- package/dist/decorators/legacy/on-event.js.map +10 -0
- package/dist/decorators/legacy/on-updated.d.ts +6 -0
- package/dist/decorators/legacy/on-updated.js +4 -0
- package/dist/decorators/legacy/on-updated.js.map +10 -0
- package/dist/decorators/legacy/query.d.ts +23 -0
- package/dist/decorators/legacy/query.js +4 -0
- package/dist/decorators/legacy/query.js.map +10 -0
- package/dist/decorators/legacy/reactive-field.d.ts +10 -0
- package/dist/decorators/legacy/reactive-field.js +4 -0
- package/dist/decorators/legacy/reactive-field.js.map +10 -0
- package/dist/decorators/legacy/reactive-prop.d.ts +19 -0
- package/dist/decorators/legacy/reactive-prop.js +4 -0
- package/dist/decorators/legacy/reactive-prop.js.map +10 -0
- package/dist/decorators/on-event.d.ts +4 -7
- package/dist/decorators/on-event.js +3 -47
- package/dist/decorators/on-event.js.map +3 -3
- package/dist/decorators/on-updated.d.ts +3 -4
- package/dist/decorators/on-updated.js +3 -29
- package/dist/decorators/on-updated.js.map +3 -3
- package/dist/decorators/query.d.ts +9 -28
- package/dist/decorators/query.js +3 -36
- package/dist/decorators/query.js.map +3 -3
- package/dist/decorators/reactive-field.d.ts +3 -7
- package/dist/decorators/reactive-field.js +3 -26
- package/dist/decorators/reactive-field.js.map +3 -3
- package/dist/decorators/reactive-prop.d.ts +4 -15
- package/dist/decorators/reactive-prop.js +3 -214
- package/dist/decorators/reactive-prop.js.map +4 -5
- package/dist/decorators/standard/bound.d.ts +2 -0
- package/dist/decorators/standard/bound.js +4 -0
- package/dist/decorators/standard/bound.js.map +10 -0
- package/dist/decorators/standard/custom-element.d.ts +1 -0
- package/dist/decorators/standard/custom-element.js +4 -0
- package/dist/decorators/standard/custom-element.js.map +10 -0
- package/dist/decorators/standard/debounce.d.ts +2 -0
- package/dist/decorators/standard/debounce.js +4 -0
- package/dist/decorators/standard/debounce.js.map +10 -0
- package/dist/decorators/standard/event.d.ts +9 -0
- package/dist/decorators/standard/event.js +4 -0
- package/dist/decorators/standard/event.js.map +10 -0
- package/dist/decorators/standard/on-event.d.ts +27 -0
- package/dist/decorators/standard/on-event.js +4 -0
- package/dist/decorators/standard/on-event.js.map +10 -0
- package/dist/decorators/standard/on-updated.d.ts +2 -0
- package/dist/decorators/standard/on-updated.js +4 -0
- package/dist/decorators/standard/on-updated.js.map +10 -0
- package/dist/decorators/standard/query.d.ts +2 -0
- package/dist/decorators/standard/query.js +4 -0
- package/dist/decorators/standard/query.js.map +10 -0
- package/dist/decorators/standard/reactive-field.d.ts +2 -0
- package/dist/decorators/standard/reactive-field.js +4 -0
- package/dist/decorators/standard/reactive-field.js.map +10 -0
- package/dist/decorators/standard/reactive-prop.d.ts +2 -0
- package/dist/decorators/standard/reactive-prop.js +4 -0
- package/dist/decorators/standard/reactive-prop.js.map +10 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.js +2 -716
- package/dist/index.js.map +3 -21
- package/dist/mixins/index.js +2 -23
- package/dist/mixins/index.js.map +3 -4
- package/dist/mixins/with-kita.js +3 -23
- package/dist/mixins/with-kita.js.map +3 -3
- package/dist/tools/event-emitter.d.ts +1 -1
- package/dist/tools/event-emitter.js +3 -22
- package/dist/tools/event-emitter.js.map +3 -3
- package/dist/tools/index.js +2 -28
- package/dist/tools/index.js.map +3 -5
- package/dist/tools/stringify-typed.js +3 -8
- package/dist/tools/stringify-typed.js.map +2 -2
- package/dist/types.d.ts +79 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +10 -0
- package/dist/utils/attribute-utils.d.ts +2 -0
- package/dist/utils/attribute-utils.js +3 -137
- package/dist/utils/attribute-utils.js.map +3 -3
- package/dist/utils/index.js +2 -137
- package/dist/utils/index.js.map +3 -4
- package/package.json +26 -34
- package/dist/context/index.d.ts +0 -7
- package/dist/context/index.js +0 -338
- package/dist/context/index.js.map +0 -16
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -83
- package/dist/core/index.js.map +0 -10
- package/dist/decorators.d.ts +0 -7
- package/dist/decorators.js +0 -401
- package/dist/decorators.js.map +0 -18
package/dist/decorators.js
DELETED
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
// src/decorators/custom-element.ts
|
|
2
|
-
function customElement(name) {
|
|
3
|
-
return (target) => {
|
|
4
|
-
if (!globalThis.window)
|
|
5
|
-
return;
|
|
6
|
-
if (!window.customElements.get(name)) {
|
|
7
|
-
window.customElements.define(name, target);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// src/tools/event-emitter.ts
|
|
13
|
-
class EventEmitter {
|
|
14
|
-
host;
|
|
15
|
-
eventConfig;
|
|
16
|
-
constructor(host, eventConfig) {
|
|
17
|
-
this.host = host;
|
|
18
|
-
this.eventConfig = eventConfig;
|
|
19
|
-
}
|
|
20
|
-
emit(detail) {
|
|
21
|
-
const event = new CustomEvent(this.eventConfig.name, {
|
|
22
|
-
detail,
|
|
23
|
-
bubbles: this.eventConfig.bubbles,
|
|
24
|
-
cancelable: this.eventConfig.cancelable,
|
|
25
|
-
composed: this.eventConfig.composed
|
|
26
|
-
});
|
|
27
|
-
this.host.dispatchEvent(event);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// src/decorators/event.ts
|
|
32
|
-
function event(eventConfig) {
|
|
33
|
-
return (target, propertyKey) => {
|
|
34
|
-
if (!propertyKey) {
|
|
35
|
-
throw new Error("The propertyKey is missing for the event decorator.");
|
|
36
|
-
}
|
|
37
|
-
if (!eventConfig || !eventConfig.name) {
|
|
38
|
-
throw new Error("Invalid eventConfig provided.");
|
|
39
|
-
}
|
|
40
|
-
const uniqueKey = Symbol(eventConfig.name);
|
|
41
|
-
Object.defineProperty(target, propertyKey, {
|
|
42
|
-
get() {
|
|
43
|
-
const emittersMap = eventEmitters.get(this) || new Map;
|
|
44
|
-
if (!emittersMap.has(uniqueKey)) {
|
|
45
|
-
emittersMap.set(uniqueKey, new EventEmitter(this, eventConfig));
|
|
46
|
-
eventEmitters.set(this, emittersMap);
|
|
47
|
-
}
|
|
48
|
-
return emittersMap.get(uniqueKey);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
var eventEmitters = new WeakMap;
|
|
54
|
-
|
|
55
|
-
// src/decorators/on-event.ts
|
|
56
|
-
function onEvent(eventConfig) {
|
|
57
|
-
return (proto, _, descriptor) => {
|
|
58
|
-
const originalConnectedCallback = proto.connectedCallback;
|
|
59
|
-
const originalDisconnectedCallback = proto.disconnectedCallback;
|
|
60
|
-
if ("window" in eventConfig) {
|
|
61
|
-
proto.connectedCallback = function() {
|
|
62
|
-
window.addEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);
|
|
63
|
-
originalConnectedCallback.call(this);
|
|
64
|
-
};
|
|
65
|
-
proto.disconnectedCallback = function() {
|
|
66
|
-
window.removeEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);
|
|
67
|
-
originalDisconnectedCallback.call(this);
|
|
68
|
-
};
|
|
69
|
-
return descriptor;
|
|
70
|
-
}
|
|
71
|
-
if ("document" in eventConfig) {
|
|
72
|
-
proto.connectedCallback = function() {
|
|
73
|
-
document.addEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);
|
|
74
|
-
originalConnectedCallback.call(this);
|
|
75
|
-
};
|
|
76
|
-
proto.disconnectedCallback = function() {
|
|
77
|
-
document.removeEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);
|
|
78
|
-
originalDisconnectedCallback.call(this);
|
|
79
|
-
};
|
|
80
|
-
return descriptor;
|
|
81
|
-
}
|
|
82
|
-
const selector = "selector" in eventConfig ? eventConfig.selector : `[data-ref="${eventConfig.ref}"]`;
|
|
83
|
-
const originalMethod = descriptor.value;
|
|
84
|
-
const subscriptionId = `${eventConfig.type}-${selector}`;
|
|
85
|
-
proto.connectedCallback = function() {
|
|
86
|
-
this.subscribeEvent({
|
|
87
|
-
id: subscriptionId,
|
|
88
|
-
selector,
|
|
89
|
-
type: eventConfig.type,
|
|
90
|
-
listener: originalMethod.bind(this),
|
|
91
|
-
options: eventConfig?.options ?? undefined
|
|
92
|
-
});
|
|
93
|
-
originalConnectedCallback.call(this);
|
|
94
|
-
};
|
|
95
|
-
return descriptor;
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// src/decorators/on-updated.ts
|
|
100
|
-
function onUpdated(keyOrKeys) {
|
|
101
|
-
return (proto, methodName) => {
|
|
102
|
-
if (!("updatesRegistry" in proto)) {
|
|
103
|
-
Object.defineProperty(proto, "updatesRegistry", {
|
|
104
|
-
value: new Map,
|
|
105
|
-
configurable: true
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
const updatesRegistry = proto.updatesRegistry;
|
|
109
|
-
if (Array.isArray(keyOrKeys)) {
|
|
110
|
-
for (const key of keyOrKeys) {
|
|
111
|
-
if (!updatesRegistry.has(key)) {
|
|
112
|
-
updatesRegistry.set(key, new Set);
|
|
113
|
-
}
|
|
114
|
-
updatesRegistry.get(key)?.add(methodName);
|
|
115
|
-
}
|
|
116
|
-
} else if (typeof keyOrKeys === "string") {
|
|
117
|
-
if (!updatesRegistry.has(keyOrKeys)) {
|
|
118
|
-
updatesRegistry.set(keyOrKeys, new Set);
|
|
119
|
-
}
|
|
120
|
-
updatesRegistry.get(keyOrKeys)?.add(methodName);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// src/decorators/query.ts
|
|
126
|
-
function query({
|
|
127
|
-
cache: shouldBeCached = true,
|
|
128
|
-
...options
|
|
129
|
-
}) {
|
|
130
|
-
const cache = new WeakMap;
|
|
131
|
-
return (proto, propertyKey) => {
|
|
132
|
-
const doQuery = function() {
|
|
133
|
-
if (shouldBeCached) {
|
|
134
|
-
const cachedResult = cache.get(this);
|
|
135
|
-
if (cachedResult !== undefined) {
|
|
136
|
-
return cachedResult;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
const selector = "selector" in options ? options.selector : `[data-ref="${options.ref}"]`;
|
|
140
|
-
const queryResult = options.all ? this.querySelectorAll(selector) : this.querySelector(selector);
|
|
141
|
-
if (shouldBeCached) {
|
|
142
|
-
cache.set(this, queryResult);
|
|
143
|
-
}
|
|
144
|
-
return queryResult;
|
|
145
|
-
};
|
|
146
|
-
const originalConnectedCallback = proto.connectedCallback;
|
|
147
|
-
proto.connectedCallback = function() {
|
|
148
|
-
Object.defineProperty(this, propertyKey, {
|
|
149
|
-
get: doQuery,
|
|
150
|
-
enumerable: true,
|
|
151
|
-
configurable: true
|
|
152
|
-
});
|
|
153
|
-
originalConnectedCallback.call(this);
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// src/utils/attribute-utils.ts
|
|
159
|
-
function parseAttributeTypeConstant(constant) {
|
|
160
|
-
switch (constant) {
|
|
161
|
-
case Array:
|
|
162
|
-
return "array";
|
|
163
|
-
case Boolean:
|
|
164
|
-
return "boolean";
|
|
165
|
-
case Number:
|
|
166
|
-
return "number";
|
|
167
|
-
case Object:
|
|
168
|
-
return "object";
|
|
169
|
-
case String:
|
|
170
|
-
return "string";
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
function parseAttributeTypeDefault(defaultValue) {
|
|
174
|
-
switch (typeof defaultValue) {
|
|
175
|
-
case "boolean":
|
|
176
|
-
return "boolean";
|
|
177
|
-
case "number":
|
|
178
|
-
return "number";
|
|
179
|
-
case "string":
|
|
180
|
-
return "string";
|
|
181
|
-
}
|
|
182
|
-
if (Array.isArray(defaultValue))
|
|
183
|
-
return "array";
|
|
184
|
-
if (Object.prototype.toString.call(defaultValue) === "[object Object]")
|
|
185
|
-
return "object";
|
|
186
|
-
}
|
|
187
|
-
function defaultValueForType(type) {
|
|
188
|
-
switch (type) {
|
|
189
|
-
case Number:
|
|
190
|
-
return 0;
|
|
191
|
-
case String:
|
|
192
|
-
return "";
|
|
193
|
-
case Boolean:
|
|
194
|
-
return false;
|
|
195
|
-
default:
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function parseJSON(value) {
|
|
200
|
-
try {
|
|
201
|
-
return JSON.parse(value);
|
|
202
|
-
} catch (error) {
|
|
203
|
-
throw new TypeError("Invalid JSON string");
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
function writeJSON(value) {
|
|
207
|
-
return JSON.stringify(value);
|
|
208
|
-
}
|
|
209
|
-
function writeString(value) {
|
|
210
|
-
return `${value}`;
|
|
211
|
-
}
|
|
212
|
-
function readAttributeValue(value, type) {
|
|
213
|
-
const readerType = parseAttributeTypeConstant(type);
|
|
214
|
-
if (!readerType)
|
|
215
|
-
throw new TypeError(`[radiant-element] Unknown type "${type}"`);
|
|
216
|
-
return readers[readerType](value);
|
|
217
|
-
}
|
|
218
|
-
function writeAttributeValue(value, type) {
|
|
219
|
-
const writerType = parseAttributeTypeConstant(type);
|
|
220
|
-
if (!writerType)
|
|
221
|
-
throw new TypeError(`[radiant-element] Unknown type "${type}"`);
|
|
222
|
-
return (writers[writerType] || writers.default)(value);
|
|
223
|
-
}
|
|
224
|
-
function isBoolean(value) {
|
|
225
|
-
return typeof value === "boolean";
|
|
226
|
-
}
|
|
227
|
-
function isNumber(value) {
|
|
228
|
-
return typeof value === "number";
|
|
229
|
-
}
|
|
230
|
-
function isString(value) {
|
|
231
|
-
return typeof value === "string";
|
|
232
|
-
}
|
|
233
|
-
function isArray(value) {
|
|
234
|
-
return Array.isArray(value);
|
|
235
|
-
}
|
|
236
|
-
function isObject(value) {
|
|
237
|
-
return typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
238
|
-
}
|
|
239
|
-
function isValueOfType(type, defaultValue) {
|
|
240
|
-
switch (type) {
|
|
241
|
-
case Boolean:
|
|
242
|
-
return isBoolean(defaultValue);
|
|
243
|
-
case Number:
|
|
244
|
-
return isNumber(defaultValue);
|
|
245
|
-
case String:
|
|
246
|
-
return isString(defaultValue);
|
|
247
|
-
case Array:
|
|
248
|
-
return isArray(defaultValue);
|
|
249
|
-
case Object:
|
|
250
|
-
return isObject(defaultValue);
|
|
251
|
-
default:
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
var readers = {
|
|
256
|
-
array(value) {
|
|
257
|
-
const array = parseJSON(value);
|
|
258
|
-
if (!Array.isArray(array)) {
|
|
259
|
-
throw new TypeError(`Expected an array but got a value of type "${typeof array}"`);
|
|
260
|
-
}
|
|
261
|
-
return array;
|
|
262
|
-
},
|
|
263
|
-
boolean(value) {
|
|
264
|
-
return !(value === "0" || String(value).toLowerCase() === "false");
|
|
265
|
-
},
|
|
266
|
-
number(value) {
|
|
267
|
-
const number = Number(value.replace(/_/g, ""));
|
|
268
|
-
return number;
|
|
269
|
-
},
|
|
270
|
-
object(value) {
|
|
271
|
-
const object = JSON.parse(value);
|
|
272
|
-
if (object === null || typeof object !== "object" || Array.isArray(object)) {
|
|
273
|
-
throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseAttributeTypeDefault(object)}"`);
|
|
274
|
-
}
|
|
275
|
-
return object;
|
|
276
|
-
},
|
|
277
|
-
string(value) {
|
|
278
|
-
return value;
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
var writers = {
|
|
282
|
-
default: writeString,
|
|
283
|
-
array: writeJSON,
|
|
284
|
-
object: writeJSON
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
// src/decorators/reactive-prop.ts
|
|
288
|
-
function reactiveProp({ type, attribute, reflect, defaultValue }) {
|
|
289
|
-
if (defaultValue !== undefined && !isValueOfType(type, defaultValue)) {
|
|
290
|
-
throw new Error(`defaultValue does not match the expected type for ${type.name}`);
|
|
291
|
-
}
|
|
292
|
-
return (target, propertyName) => {
|
|
293
|
-
const originalValues = new WeakMap;
|
|
294
|
-
const attributeKey = attribute ?? propertyName;
|
|
295
|
-
if (propertyName in target) {
|
|
296
|
-
throw new Error(`Property "${propertyName}" already exists on ${target.constructor.name}`);
|
|
297
|
-
}
|
|
298
|
-
const propertyMapping = {
|
|
299
|
-
type,
|
|
300
|
-
propertyName,
|
|
301
|
-
attributeKey,
|
|
302
|
-
converter: {
|
|
303
|
-
fromAttribute: (value) => readAttributeValue(value, type),
|
|
304
|
-
toAttribute: (value) => writeAttributeValue(value, type)
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
addPropertyToMappings(target, propertyMapping);
|
|
308
|
-
Object.defineProperty(target, propertyName, {
|
|
309
|
-
get: function() {
|
|
310
|
-
if (!originalValues.has(this)) {
|
|
311
|
-
const initialValue = getInitialValue(this, type, attributeKey, defaultValue);
|
|
312
|
-
originalValues.set(this, initialValue);
|
|
313
|
-
}
|
|
314
|
-
return originalValues.get(this);
|
|
315
|
-
},
|
|
316
|
-
set: function(newValue) {
|
|
317
|
-
const oldValue = originalValues.get(this);
|
|
318
|
-
if (oldValue === newValue)
|
|
319
|
-
return;
|
|
320
|
-
originalValues.set(this, newValue);
|
|
321
|
-
if (reflect) {
|
|
322
|
-
const attributeValue = propertyMapping.converter.toAttribute(newValue);
|
|
323
|
-
this.setAttribute(attributeKey, attributeValue);
|
|
324
|
-
}
|
|
325
|
-
this.updated(propertyName, oldValue, newValue);
|
|
326
|
-
},
|
|
327
|
-
enumerable: true,
|
|
328
|
-
configurable: true
|
|
329
|
-
});
|
|
330
|
-
const originalConnectedCallback = target.connectedCallback;
|
|
331
|
-
target.connectedCallback = function() {
|
|
332
|
-
originalConnectedCallback.call(this);
|
|
333
|
-
this.updated(propertyName, null, defaultValue);
|
|
334
|
-
};
|
|
335
|
-
addObservedAttribute(target, attributeKey);
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
function addObservedAttribute(target, attribute) {
|
|
339
|
-
const ctor = target.constructor;
|
|
340
|
-
const existingObservedAttributes = ctor.observedAttributes || [];
|
|
341
|
-
if (!existingObservedAttributes.includes(attribute)) {
|
|
342
|
-
const newObservedAttributes = [...existingObservedAttributes, attribute];
|
|
343
|
-
Object.defineProperty(ctor, "observedAttributes", {
|
|
344
|
-
get() {
|
|
345
|
-
return newObservedAttributes;
|
|
346
|
-
},
|
|
347
|
-
configurable: true
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
var getInitialValue = (target, type, attributeKey, defaultValue) => {
|
|
352
|
-
if (type === Boolean) {
|
|
353
|
-
const hasAttribute = target.hasAttribute(attributeKey);
|
|
354
|
-
return hasAttribute || defaultValue;
|
|
355
|
-
}
|
|
356
|
-
const attributeValue = target.getAttribute(attributeKey);
|
|
357
|
-
return attributeValue !== null ? readAttributeValue(attributeValue, type) : defaultValue || defaultValueForType(type);
|
|
358
|
-
};
|
|
359
|
-
var addPropertyToMappings = (target, propertyMapping) => {
|
|
360
|
-
if (!("propertyConfigMap" in target)) {
|
|
361
|
-
Object.defineProperty(target, "propertyConfigMap", {
|
|
362
|
-
value: new Map,
|
|
363
|
-
configurable: true
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
target.propertyConfigMap.set(propertyMapping.propertyName, propertyMapping);
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
// src/decorators/reactive-field.ts
|
|
370
|
-
function reactiveField(proto, propertyKey) {
|
|
371
|
-
const originalValues = new WeakMap;
|
|
372
|
-
const isDefined = new WeakSet;
|
|
373
|
-
Object.defineProperty(proto, propertyKey, {
|
|
374
|
-
get: function() {
|
|
375
|
-
return originalValues.get(this);
|
|
376
|
-
},
|
|
377
|
-
set: function(newValue) {
|
|
378
|
-
if (isDefined.has(this)) {
|
|
379
|
-
const oldValue = originalValues.get(this);
|
|
380
|
-
if (oldValue !== newValue) {
|
|
381
|
-
originalValues.set(this, newValue);
|
|
382
|
-
this.updated(propertyKey, oldValue, newValue);
|
|
383
|
-
}
|
|
384
|
-
} else {
|
|
385
|
-
originalValues.set(this, newValue);
|
|
386
|
-
isDefined.add(this);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
export {
|
|
392
|
-
reactiveProp,
|
|
393
|
-
reactiveField,
|
|
394
|
-
query,
|
|
395
|
-
onUpdated,
|
|
396
|
-
onEvent,
|
|
397
|
-
event,
|
|
398
|
-
customElement
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
//# debugId=4CC8B2D8AD40ADE664756E2164756E21
|
package/dist/decorators.js.map
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/decorators/custom-element.ts", "../src/tools/event-emitter.ts", "../src/decorators/event.ts", "../src/decorators/on-event.ts", "../src/decorators/on-updated.ts", "../src/decorators/query.ts", "../src/utils/attribute-utils.ts", "../src/decorators/reactive-prop.ts", "../src/decorators/reactive-field.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Registers a web component with the given name on the global `window.customElements` registry.\n * @param name selector name.\n */\nexport function customElement(name: string) {\n return (target: CustomElementConstructor) => {\n if (!globalThis.window) return;\n if (!window.customElements.get(name)) {\n window.customElements.define(name, target);\n }\n };\n}\n",
|
|
6
|
-
"import type { RadiantElement } from '..';\n\nexport interface EventEmitterConfig {\n name: string;\n bubbles?: boolean;\n cancelable?: boolean;\n composed?: boolean;\n}\n\n/**\n * A generic event emitter class that allows emitting custom events.\n *\n * @template T - The type of the event detail.\n */\nexport class EventEmitter<T = unknown> {\n private host: RadiantElement;\n private eventConfig: EventEmitterConfig;\n\n /**\n * Constructs a new instance of the EventEmitter class.\n *\n * @param host - The host element on which the events will be dispatched.\n * @param eventConfig - The configuration for the event.\n */\n constructor(host: RadiantElement, eventConfig: EventEmitterConfig) {\n this.host = host;\n this.eventConfig = eventConfig;\n }\n\n /**\n * Emits a custom event with the specified detail.\n *\n * @param detail - The detail object to be passed along with the event.\n */\n emit(detail?: T) {\n const event = new CustomEvent(this.eventConfig.name, {\n detail: detail,\n bubbles: this.eventConfig.bubbles,\n cancelable: this.eventConfig.cancelable,\n composed: this.eventConfig.composed,\n });\n this.host.dispatchEvent(event);\n }\n}\n",
|
|
7
|
-
"import { EventEmitter, type EventEmitterConfig } from '@/tools/event-emitter';\n\nconst eventEmitters = new WeakMap();\n\n/**\n * Decorator that attaches an EventEmitter to the class field property.\n * The EventEmitter can be used to dispatch custom events from the target element.\n * @param eventConfig Configuration for the event emitter.\n * @see {@link EventEmitter} for more details about how the EventEmitter works.\n */\nexport function event(eventConfig: EventEmitterConfig) {\n return (target: any, propertyKey: string) => {\n if (!propertyKey) {\n throw new Error('The propertyKey is missing for the event decorator.');\n }\n\n if (!eventConfig || !eventConfig.name) {\n throw new Error('Invalid eventConfig provided.');\n }\n\n const uniqueKey = Symbol(eventConfig.name);\n\n Object.defineProperty(target, propertyKey, {\n get() {\n const emittersMap: Map<symbol, EventEmitter> = eventEmitters.get(this) || new Map();\n if (!emittersMap.has(uniqueKey)) {\n emittersMap.set(uniqueKey, new EventEmitter(this, eventConfig));\n eventEmitters.set(this, emittersMap);\n }\n\n return emittersMap.get(uniqueKey);\n },\n });\n };\n}\n",
|
|
8
|
-
"import type { RadiantElement, RadiantElementEventListener } from '@/core/radiant-element';\n\ntype OnEventConfig = Pick<RadiantElementEventListener, 'type' | 'options'> &\n (\n | {\n selector: string;\n }\n | {\n ref: string;\n }\n | {\n window: boolean;\n }\n | {\n document: boolean;\n }\n );\n\n/**\n * A decorator to subscribe to an event on the target element.\n * The event listener will be automatically unsubscribed when the element is disconnected.\n *\n * Note: This decorator uses event delegation, which means it relies on event bubbling.\n * Therefore, it will not work with events that do not bubble, such as `focus`, `blur`, `load`, `unload`, `scroll`, etc.\n * For focus and blur events, consider using `focusin` and `focusout` which are similar but do bubble.\n *\n * @param eventConfig The event configuration.\n * @param eventConfig.selectors The CSS selector(s) of the target element(s).\n * @param eventConfig.ref The data-ref attribute of the target element.\n * @param eventConfig.type The type of the event to listen for.\n * @param eventConfig.options Optional. An options object that specifies characteristics about the event listener.\n */\nexport function onEvent(eventConfig: OnEventConfig) {\n return (proto: RadiantElement, _: string, descriptor: PropertyDescriptor) => {\n const originalConnectedCallback = proto.connectedCallback;\n const originalDisconnectedCallback = proto.disconnectedCallback;\n\n if ('window' in eventConfig) {\n proto.connectedCallback = function (this: RadiantElement) {\n window.addEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);\n originalConnectedCallback.call(this);\n };\n\n proto.disconnectedCallback = function (this: RadiantElement) {\n window.removeEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);\n originalDisconnectedCallback.call(this);\n };\n\n return descriptor;\n }\n\n if ('document' in eventConfig) {\n proto.connectedCallback = function (this: RadiantElement) {\n document.addEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);\n originalConnectedCallback.call(this);\n };\n\n proto.disconnectedCallback = function (this: RadiantElement) {\n document.removeEventListener(eventConfig.type, descriptor.value.bind(this), eventConfig.options);\n originalDisconnectedCallback.call(this);\n };\n\n return descriptor;\n }\n\n const selector = 'selector' in eventConfig ? eventConfig.selector : `[data-ref=\"${eventConfig.ref}\"]`;\n\n const originalMethod = descriptor.value;\n const subscriptionId = `${eventConfig.type}-${selector}`;\n\n proto.connectedCallback = function (this: RadiantElement) {\n this.subscribeEvent({\n id: subscriptionId,\n selector: selector,\n type: eventConfig.type,\n listener: originalMethod.bind(this),\n options: eventConfig?.options ?? undefined,\n });\n\n originalConnectedCallback.call(this);\n };\n\n return descriptor;\n };\n}\n",
|
|
9
|
-
"import type { RadiantElement } from '@/core/radiant-element';\n\n/**\n * A decorator to subscribe to an updated callback when a reactive field or property changes.\n * @param eventConfig The event configuration.\n */\nexport function onUpdated(keyOrKeys: string | string[]) {\n return (proto: RadiantElement, methodName: string) => {\n if (!('updatesRegistry' in proto)) {\n Object.defineProperty(proto, 'updatesRegistry', {\n value: new Map<string, Set<string>>(),\n configurable: true,\n });\n }\n\n const updatesRegistry = proto.updatesRegistry;\n\n if (Array.isArray(keyOrKeys)) {\n for (const key of keyOrKeys) {\n if (!updatesRegistry.has(key)) {\n updatesRegistry.set(key, new Set());\n }\n updatesRegistry.get(key)?.add(methodName);\n }\n } else if (typeof keyOrKeys === 'string') {\n if (!updatesRegistry.has(keyOrKeys)) {\n updatesRegistry.set(keyOrKeys, new Set());\n }\n updatesRegistry.get(keyOrKeys)?.add(methodName);\n }\n };\n}\n",
|
|
10
|
-
"import type { RadiantElement } from '@/core';\n\n/**\n * The base configuration object for the query.\n */\ntype BaseQueryConfig = {\n all?: boolean;\n cache?: boolean;\n};\n\n/**\n * The configuration object for the query.\n * It can be configured to query by CSS selector or data-ref attribute.\n */\nexport type QueryConfig = BaseQueryConfig &\n (\n | {\n selector: string;\n }\n | {\n ref: string;\n }\n );\n\n/**\n * A decorator to query by CSS selector or data-ref attribute.\n * By default it queries for the first element that matches the selector, but it can be configured to query for all elements.\n *\n * @param {QueryConfig} options - The configuration object for the query.\n * @param {boolean} [options.all] - A flag to query for all elements that match the selector. Defaults to `false`.\n * @param {boolean} [options.cache] - A flag to cache the query result. Defaults to `true`.\n * @param {string} [options.selector] - A CSS selector to match elements against. This property is mutually exclusive with `options.ref`.\n * @param {string} [options.ref] - A reference to an element. This property is mutually exclusive with `options.selector`.\n *\n * @returns {Function} A decorator function that, when applied to a class property, will replace it with a getter. The getter will return the result of the query when accessed.\n *\n * @example\n * class MyElement extends HTMLElement {\n * @query({ selector: '.my-class' })\n * myElement;\n * }\n *\n * // Now, `myElement` will return the first element in the light DOM of `MyElement` that matches the selector '.my-class'.\n */\nexport function query({\n cache: shouldBeCached = true,\n ...options\n}: QueryConfig): (proto: RadiantElement, propertyKey: string | symbol) => void {\n const cache = new WeakMap<Element, Element | NodeList | null>();\n\n return (proto: RadiantElement, propertyKey: string | symbol) => {\n const doQuery = function (this: Element) {\n if (shouldBeCached) {\n const cachedResult = cache.get(this);\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n }\n\n const selector = 'selector' in options ? options.selector : `[data-ref=\"${options.ref}\"]`;\n const queryResult = options.all ? this.querySelectorAll(selector) : this.querySelector(selector);\n\n if (shouldBeCached) {\n cache.set(this, queryResult);\n }\n\n return queryResult;\n };\n\n const originalConnectedCallback = proto.connectedCallback;\n\n proto.connectedCallback = function (this: RadiantElement) {\n Object.defineProperty(this, propertyKey, {\n get: doQuery,\n enumerable: true,\n configurable: true,\n });\n\n originalConnectedCallback.call(this);\n };\n };\n}\n",
|
|
11
|
-
"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",
|
|
12
|
-
"import type { PropertyConfig, RadiantElement } from '@/core/radiant-element';\nimport {\n type AttributeTypeConstant,\n defaultValueForType,\n isValueOfType,\n readAttributeValue,\n writeAttributeValue,\n} from '@/utils/attribute-utils';\n\ntype ReactivePropertyOptions<T> = {\n type: AttributeTypeConstant;\n reflect?: boolean;\n attribute?: string;\n defaultValue?: T;\n};\n\n/**\n * A decorator to define a reactive property.\n * Every time the property changes, the `updated` method will be called.\n * @param options The options for the reactive property.\n * @param options.type The type of the property value.\n * @param options.reflect Whether to reflect the property to the attribute.\n * @param options.attribute The name of the attribute.\n * @param options.defaultValue The default value of the property.\n */\nexport function reactiveProp<T = unknown>({ type, attribute, reflect, defaultValue }: ReactivePropertyOptions<T>) {\n if (defaultValue !== undefined && !isValueOfType(type, defaultValue)) {\n throw new Error(`defaultValue does not match the expected type for ${type.name}`);\n }\n\n return (target: RadiantElement, propertyName: string) => {\n const originalValues = new WeakMap<WeakKey, unknown>();\n const attributeKey = attribute ?? propertyName;\n\n if (propertyName in target) {\n throw new Error(`Property \"${propertyName}\" already exists on ${target.constructor.name}`);\n }\n\n const propertyMapping: PropertyConfig = {\n type,\n propertyName,\n attributeKey,\n converter: {\n fromAttribute: (value) => readAttributeValue(value, type),\n toAttribute: (value) => writeAttributeValue(value, type),\n },\n };\n\n addPropertyToMappings(target, propertyMapping);\n\n Object.defineProperty(target, propertyName, {\n get: function () {\n if (!originalValues.has(this)) {\n const initialValue = getInitialValue(this, type, attributeKey, defaultValue as T);\n originalValues.set(this, initialValue);\n }\n return originalValues.get(this);\n },\n set: function (newValue: T) {\n const oldValue = originalValues.get(this);\n if (oldValue === newValue) return;\n originalValues.set(this, newValue);\n if (reflect) {\n const attributeValue = propertyMapping.converter.toAttribute(newValue);\n this.setAttribute(attributeKey, attributeValue);\n }\n this.updated(propertyName, oldValue, newValue);\n },\n enumerable: true,\n configurable: true,\n });\n\n const originalConnectedCallback = target.connectedCallback;\n\n target.connectedCallback = function (this: RadiantElement) {\n originalConnectedCallback.call(this);\n this.updated(propertyName, null, defaultValue);\n };\n\n addObservedAttribute(target, attributeKey);\n };\n}\n\nconst getInitialValue = (\n target: RadiantElement,\n type: AttributeTypeConstant,\n attributeKey: string,\n defaultValue: unknown,\n) => {\n if (type === Boolean) {\n const hasAttribute = target.hasAttribute(attributeKey);\n return hasAttribute || defaultValue;\n }\n\n const attributeValue = target.getAttribute(attributeKey);\n return attributeValue !== null\n ? readAttributeValue(attributeValue, type)\n : defaultValue || (defaultValueForType(type) as typeof defaultValue);\n};\n\nconst addPropertyToMappings = (target: RadiantElement, propertyMapping: PropertyConfig) => {\n if (!('propertyConfigMap' in target)) {\n Object.defineProperty(target, 'propertyConfigMap', {\n value: new Map<string, PropertyConfig>(),\n configurable: true,\n });\n }\n\n target.propertyConfigMap.set(propertyMapping.propertyName, propertyMapping);\n};\n\nfunction addObservedAttribute(target: RadiantElement, attribute: string) {\n const ctor = target.constructor as typeof RadiantElement;\n const existingObservedAttributes = (ctor as any).observedAttributes || [];\n if (!existingObservedAttributes.includes(attribute)) {\n const newObservedAttributes = [...existingObservedAttributes, attribute];\n Object.defineProperty(ctor, 'observedAttributes', {\n get() {\n return newObservedAttributes;\n },\n configurable: true,\n });\n }\n}\n",
|
|
13
|
-
"import type { RadiantElement } from '@/core/radiant-element';\n\n/**\n * A decorator to define a reactive field.\n * Every time the property changes, the `updated` method will be called.\n * Due the fact the value is always undefined before the first update,\n * we are adding a `isDefined` WeakSet to track if the property has been defined.\n * @param target The target element.\n * @param propertyKey The property key.\n */\nexport function reactiveField(proto: RadiantElement, propertyKey: string) {\n const originalValues = new WeakMap<WeakKey, unknown>();\n const isDefined = new WeakSet<WeakKey>();\n\n Object.defineProperty(proto, propertyKey, {\n get: function () {\n return originalValues.get(this);\n },\n set: function (newValue: unknown) {\n if (isDefined.has(this)) {\n const oldValue = originalValues.get(this);\n if (oldValue !== newValue) {\n originalValues.set(this, newValue);\n this.updated(propertyKey, oldValue, newValue);\n }\n } else {\n originalValues.set(this, newValue);\n isDefined.add(this);\n }\n },\n });\n}\n"
|
|
14
|
-
],
|
|
15
|
-
"mappings": ";AAIO,SAAS,aAAa,CAAC,MAAc;AAC1C,SAAO,CAAC,WAAqC;AAC3C,SAAK,WAAW;AAAQ;AACxB,SAAK,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,aAAO,eAAe,OAAO,MAAM,MAAM;AAAA,IAC3C;AAAA;AAAA;;;ACKG,MAAM,aAA0B;AAAA,EAC7B;AAAA,EACA;AAAA,EAQR,WAAW,CAAC,MAAsB,aAAiC;AACjE,SAAK,OAAO;AACZ,SAAK,cAAc;AAAA;AAAA,EAQrB,IAAI,CAAC,QAAY;AACf,UAAM,QAAQ,IAAI,YAAY,KAAK,YAAY,MAAM;AAAA,MACnD;AAAA,MACA,SAAS,KAAK,YAAY;AAAA,MAC1B,YAAY,KAAK,YAAY;AAAA,MAC7B,UAAU,KAAK,YAAY;AAAA,IAC7B,CAAC;AACD,SAAK,KAAK,cAAc,KAAK;AAAA;AAEjC;;;ACjCO,SAAS,KAAK,CAAC,aAAiC;AACrD,SAAO,CAAC,QAAa,gBAAwB;AAC3C,SAAK,aAAa;AAChB,YAAM,IAAI,MAAM,qDAAqD;AAAA,IACvE;AAEA,SAAK,gBAAgB,YAAY,MAAM;AACrC,YAAM,IAAI,MAAM,+BAA+B;AAAA,IACjD;AAEA,UAAM,YAAY,OAAO,YAAY,IAAI;AAEzC,WAAO,eAAe,QAAQ,aAAa;AAAA,MACzC,GAAG,GAAG;AACJ,cAAM,cAAyC,cAAc,IAAI,IAAI,KAAK,IAAI;AAC9E,aAAK,YAAY,IAAI,SAAS,GAAG;AAC/B,sBAAY,IAAI,WAAW,IAAI,aAAa,MAAM,WAAW,CAAC;AAC9D,wBAAc,IAAI,MAAM,WAAW;AAAA,QACrC;AAEA,eAAO,YAAY,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