@xaendar/core 0.3.38 → 0.4.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/package.json +3 -3
- package/xaendar-core.es.d.ts +112 -7
- package/xaendar-core.es.js +60 -36
- package/xaendar-core.es.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaendar/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A library containing core utils such as webcomponent base classes and theming support",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@xaendar/signals": "0.
|
|
20
|
-
"@xaendar/types": "0.
|
|
19
|
+
"@xaendar/signals": "0.4.0",
|
|
20
|
+
"@xaendar/types": "0.4.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/xaendar-core.es.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { AccessorDecorator } from '@xaendar/types';
|
|
2
2
|
import { Beautify } from '@xaendar/types';
|
|
3
3
|
import { ClassDecorator as ClassDecorator_2 } from '@xaendar/types';
|
|
4
|
+
import { Constructor } from '@xaendar/types';
|
|
4
5
|
import { RequireOne } from '@xaendar/types';
|
|
6
|
+
import { SignalOptions } from '@xaendar/signals';
|
|
7
|
+
import { SignalOptions as SignalOptions_2 } from '@xaendar/signals';
|
|
5
8
|
import { VoidFunction as VoidFunction_2 } from '@xaendar/types';
|
|
6
9
|
|
|
7
10
|
/**
|
|
@@ -50,13 +53,69 @@ export declare class BaseWebComponent extends HTMLElement {
|
|
|
50
53
|
private disconnectedCallback;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
declare
|
|
56
|
+
export declare type BaseWebComponentConstructor = Constructor<BaseWebComponent, {
|
|
57
|
+
observedAttributes: string[];
|
|
58
|
+
}>;
|
|
59
|
+
|
|
60
|
+
declare function Event_2<Class extends BaseWebComponent, Data = void>(options?: EventOptions): AccessorDecorator<Class, Output<Data>>;
|
|
54
61
|
export { Event_2 as Event }
|
|
55
62
|
|
|
56
63
|
/**
|
|
57
64
|
* Rapresent the options to configure an @Event Decorator in a Web Component.
|
|
58
65
|
*/
|
|
59
|
-
export declare type
|
|
66
|
+
export declare type EventOptions = Beautify<RequireOne<Omit<CustomEventInit, 'detail'>>>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* An `InputSignal` is a specialized `Signal.State` designed for use as a property signal in web components.
|
|
70
|
+
* It extends the base `State` signal with additional functionality to handle incoming values, such as those from HTML attributes or external sources,
|
|
71
|
+
* and allows for optional transformation of these values before they are stored in the signal.
|
|
72
|
+
*/
|
|
73
|
+
export declare class InputSignal<ActualValue = unknown, IncomingValue = ActualValue> extends Signal.State<ActualValue> {
|
|
74
|
+
/**
|
|
75
|
+
* Optional transform function to convert incoming values to the actual type stored in the signal.
|
|
76
|
+
*/
|
|
77
|
+
private _transform?;
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new `InputSignal` instance.
|
|
80
|
+
*
|
|
81
|
+
* @param initialValue - The initial value of the signal.
|
|
82
|
+
* @param options - Optional configuration:
|
|
83
|
+
* - `equals` — custom equality function; defaults to `Object.is`.
|
|
84
|
+
* - `watched` — called when the signal gains its first sink.
|
|
85
|
+
* - `unwatched` — called when the signal loses its last sink.
|
|
86
|
+
* - `transform` — function to transform incoming values before setting the signal's value.
|
|
87
|
+
*/
|
|
88
|
+
constructor(value?: ActualValue, options?: SignalOptions<ActualValue> & {
|
|
89
|
+
transform?: (value: IncomingValue) => ActualValue;
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* Set a new value to the signal, applying the transform function if provided.
|
|
93
|
+
* @param newValue - The new value to set.
|
|
94
|
+
* @throws If `frozen` is `true` — writes are forbidden while a protected
|
|
95
|
+
* callback is executing.
|
|
96
|
+
*/
|
|
97
|
+
set(newValue: IncomingValue, symbol: symbol): void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Options used to configure an `InputSignal`.
|
|
102
|
+
*
|
|
103
|
+
* Extends {@link SignalOptions} with an optional `transform` function that
|
|
104
|
+
* converts the incoming value (e.g. an attribute string) into the actual
|
|
105
|
+
* internal value stored by the signal.
|
|
106
|
+
*
|
|
107
|
+
* @template ActualValue - The internal type stored by the signal. Defaults to `unknown`.
|
|
108
|
+
* @template IncomingValue - The raw type received from outside (e.g. from an attribute). Defaults to `ActualValue`.
|
|
109
|
+
*/
|
|
110
|
+
export declare type InputSignalOptions<ActualValue = unknown, IncomingValue = ActualValue> = SignalOptions_2<ActualValue> & {
|
|
111
|
+
/**
|
|
112
|
+
* Optional function to transform the incoming value before it is stored.
|
|
113
|
+
*
|
|
114
|
+
* @param value - The raw incoming value.
|
|
115
|
+
* @returns The transformed value of type `ActualValue`.
|
|
116
|
+
*/
|
|
117
|
+
transform?: (value: IncomingValue) => ActualValue;
|
|
118
|
+
};
|
|
60
119
|
|
|
61
120
|
/**
|
|
62
121
|
* Rapresent the output type returned by an @Event Decorator in a Web Component.
|
|
@@ -67,13 +126,59 @@ export declare type EventParams = Beautify<RequireOne<Omit<CustomEventInit, 'det
|
|
|
67
126
|
* This object's properties override the default event parameters defined in the decorator.
|
|
68
127
|
*/
|
|
69
128
|
export declare type Output<Value = void> = {
|
|
70
|
-
emit: VoidFunction_2<Value extends void ? ([
|
|
129
|
+
emit: VoidFunction_2<Value extends void ? ([EventOptions] | []) : ([Value, EventOptions] | [Value])>;
|
|
71
130
|
};
|
|
72
131
|
|
|
73
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Decoratore per proprietà opzionale.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* @Property()
|
|
137
|
+
* accessor label: InputSignal<string>;
|
|
138
|
+
*
|
|
139
|
+
* @Property({ value: 0 })
|
|
140
|
+
* accessor count: InputSignal<number>;
|
|
141
|
+
*
|
|
142
|
+
* @Property({ value: { required: true, foo: 'bar' }, alias: 'cfg' })
|
|
143
|
+
* accessor config: InputSignal<Config>;
|
|
144
|
+
*/
|
|
145
|
+
export declare function Property<Class extends BaseWebComponent, Value extends InputSignal<ActualValue, IncomingValue>, ActualValue = Value extends InputSignal<infer U, any> ? U : unknown, IncomingValue = Value extends InputSignal<any, infer V> ? V : ActualValue>(value?: ActualValue, options?: PropertyDecoratorOptions<ActualValue, IncomingValue>): AccessorDecorator<Class, InputSignal<ActualValue, IncomingValue>>;
|
|
146
|
+
|
|
147
|
+
export declare namespace Property {
|
|
148
|
+
var required: <Class extends BaseWebComponent, ActualValue = unknown, IncomingValue = ActualValue>(options?: Omit<PropertyDecoratorOptionsWithRequired<ActualValue, IncomingValue>, "required">) => AccessorDecorator<Class, InputSignal<ActualValue, IncomingValue>>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Parameters accepted by the `@property` decorator.
|
|
153
|
+
*
|
|
154
|
+
* Extends {@link InputSignalOptions} with an optional `alias` (the attribute name
|
|
155
|
+
* to observe) and a mandatory `value` (the default value of the property).
|
|
156
|
+
*
|
|
157
|
+
* @template IncomingValue - The raw type received from outside (e.g. from an attribute). Defaults to `ActualValue`.
|
|
158
|
+
* @template ActualValue - The internal type stored by the signal. Defaults to `unknown`.
|
|
159
|
+
*/
|
|
160
|
+
declare type PropertyDecoratorOptions<ActualValue = unknown, IncomingValue = ActualValue> = InputSignalOptions<ActualValue, IncomingValue> & {
|
|
161
|
+
/**
|
|
162
|
+
* The attribute name to observe. Defaults to the property name when omitted.
|
|
163
|
+
*/
|
|
74
164
|
alias?: string;
|
|
75
|
-
|
|
76
|
-
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Variant of {@link PropertyDecoratorOptions} that marks the property as required.
|
|
169
|
+
*
|
|
170
|
+
* When `required` is `true`, the component will expect the attribute/input to be
|
|
171
|
+
* explicitly provided by the consumer.
|
|
172
|
+
*
|
|
173
|
+
* @template IncomingValue - The raw type received from outside. Defaults to `ActualValue`.
|
|
174
|
+
* @template ActualValue - The internal type stored by the signal. Defaults to `unknown`.
|
|
175
|
+
*/
|
|
176
|
+
declare type PropertyDecoratorOptionsWithRequired<ActualValue = unknown, IncomingValue = ActualValue> = PropertyDecoratorOptions<ActualValue, IncomingValue> & {
|
|
177
|
+
/**
|
|
178
|
+
* Indicates that the property is required. When `true`, the component will expect the attribute/input to be explicitly provided by the consumer.
|
|
179
|
+
*/
|
|
180
|
+
required: true;
|
|
181
|
+
};
|
|
77
182
|
|
|
78
183
|
/**
|
|
79
184
|
* Decorator to define a web component
|
|
@@ -81,7 +186,7 @@ export declare function Property<Class extends BaseWebComponent, Signal extends
|
|
|
81
186
|
*/
|
|
82
187
|
export declare function WebComponent<T extends BaseWebComponent>(options: WebComponentDecoratorParams): ClassDecorator_2<T>;
|
|
83
188
|
|
|
84
|
-
declare type WebComponentDecoratorParams = {
|
|
189
|
+
export declare type WebComponentDecoratorParams = {
|
|
85
190
|
selector: string | string[];
|
|
86
191
|
styleUrl?: string;
|
|
87
192
|
templateUrl: string;
|
package/xaendar-core.es.js
CHANGED
|
@@ -28,64 +28,88 @@ function t(t) {
|
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region ../packages/core/src/costants.ts
|
|
31
|
-
var n = "observedAttributes";
|
|
31
|
+
var n = "observedAttributes", r = Symbol("InputSignalSet");
|
|
32
|
+
function i(e) {
|
|
33
|
+
if (e !== r) throw Error("Invalid symbol for InputSignal set method");
|
|
34
|
+
}
|
|
32
35
|
//#endregion
|
|
33
|
-
//#region ../packages/core/src/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
//#region ../packages/core/src/signals/input/input.model.ts
|
|
37
|
+
var a = class extends Signal.State {
|
|
38
|
+
_transform;
|
|
39
|
+
constructor(e, t) {
|
|
40
|
+
let n = t?.transform;
|
|
41
|
+
delete t?.transform, super(e, t), this._transform = n;
|
|
42
|
+
}
|
|
43
|
+
set(e, t) {
|
|
44
|
+
i(t);
|
|
45
|
+
let n = this._transform ? this._transform(e) : e;
|
|
46
|
+
super.set(n);
|
|
47
|
+
}
|
|
48
|
+
}, o = Symbol("PropertyDecoratorOptionsWithRequiredBrand");
|
|
49
|
+
function s(e, t) {
|
|
50
|
+
return function(r, i) {
|
|
51
|
+
let s = i.name;
|
|
52
|
+
if (typeof s == "symbol") throw Error("Symbol properties are not supported");
|
|
53
|
+
let c = i.metadata;
|
|
54
|
+
c[n] ??= [], c[n].push(s);
|
|
55
|
+
let l, u;
|
|
56
|
+
!e || typeof e != "object" || !(o in e) ? (l = e, u = t) : u = e;
|
|
57
|
+
let d = new a(l, {
|
|
58
|
+
equals: u?.equals,
|
|
59
|
+
watched: u?.watched,
|
|
60
|
+
unwatched: u?.unwatched,
|
|
61
|
+
transform: u?.transform
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
get() {
|
|
65
|
+
return d;
|
|
66
|
+
},
|
|
67
|
+
init(e) {
|
|
68
|
+
return d;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
40
71
|
};
|
|
41
72
|
}
|
|
73
|
+
function c(e, t) {
|
|
74
|
+
return s(e, t);
|
|
75
|
+
}
|
|
76
|
+
c.required = function(e) {
|
|
77
|
+
return s({
|
|
78
|
+
...e,
|
|
79
|
+
[o]: "PropertyDecoratorOptionsWithRequired",
|
|
80
|
+
required: !0
|
|
81
|
+
});
|
|
82
|
+
};
|
|
42
83
|
//#endregion
|
|
43
84
|
//#region ../packages/core/src/decorators/web-component/web-component.decorator.ts
|
|
44
|
-
function
|
|
85
|
+
function l(e) {
|
|
45
86
|
return function(t, n) {
|
|
46
|
-
|
|
87
|
+
u(t, n), d(t, e.selector);
|
|
47
88
|
};
|
|
48
89
|
}
|
|
49
|
-
function
|
|
90
|
+
function u(e, t) {
|
|
50
91
|
Object.defineProperty(e, "observedAttributes", {
|
|
51
92
|
get: () => t.metadata[n],
|
|
52
93
|
configurable: !1,
|
|
53
94
|
enumerable: !1
|
|
54
95
|
});
|
|
55
96
|
}
|
|
56
|
-
function
|
|
97
|
+
function d(e, t) {
|
|
57
98
|
Array.isArray(t) ? t.forEach((t) => customElements.define(t, e)) : customElements.define(t, e);
|
|
58
99
|
}
|
|
59
100
|
//#endregion
|
|
60
|
-
//#region ../packages/core/src/
|
|
61
|
-
var
|
|
62
|
-
function c(e) {
|
|
63
|
-
if (e !== s) throw Error("Invalid symbol for InputSignal set method");
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region ../packages/core/src/signals/input/input.model.ts
|
|
67
|
-
var l = class extends Signal.State {
|
|
68
|
-
_transform;
|
|
69
|
-
constructor(e, t) {
|
|
70
|
-
let n = t?.transform;
|
|
71
|
-
delete t?.transform, super(e, t), this._transform = n;
|
|
72
|
-
}
|
|
73
|
-
set(e, t) {
|
|
74
|
-
c(t);
|
|
75
|
-
let n = this._transform ? this._transform(e) : e;
|
|
76
|
-
super.set(n);
|
|
77
|
-
}
|
|
78
|
-
}, u = class extends HTMLElement {
|
|
101
|
+
//#region ../packages/core/src/directives/base-web-component.ts
|
|
102
|
+
var f = class extends HTMLElement {
|
|
79
103
|
_root;
|
|
80
104
|
constructor() {
|
|
81
105
|
super(), this._root = this.attachShadow({ mode: "open" });
|
|
82
106
|
}
|
|
83
107
|
_render() {}
|
|
84
108
|
attributeChangedCallback(e, t, n) {
|
|
85
|
-
let
|
|
86
|
-
if (!(e in
|
|
87
|
-
if (!(
|
|
88
|
-
|
|
109
|
+
let i = this;
|
|
110
|
+
if (!(e in i)) throw Error(`Attribute ${e} is not associated to any property`);
|
|
111
|
+
if (!(i[e] instanceof a)) throw Error(`Property ${e} is not an InputSignal`);
|
|
112
|
+
i[e].set(n, r);
|
|
89
113
|
}
|
|
90
114
|
connectedCallback() {
|
|
91
115
|
this._render();
|
|
@@ -93,6 +117,6 @@ var l = class extends Signal.State {
|
|
|
93
117
|
disconnectedCallback() {}
|
|
94
118
|
};
|
|
95
119
|
//#endregion
|
|
96
|
-
export {
|
|
120
|
+
export { f as BaseWebComponent, t as Event, a as InputSignal, c as Property, l as WebComponent };
|
|
97
121
|
|
|
98
122
|
//# sourceMappingURL=xaendar-core.es.js.map
|
package/xaendar-core.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xaendar-core.es.js","names":[],"sources":["../../../packages/core/src/decorators/event.decorator.ts","../../../packages/core/src/costants.ts","../../../packages/core/src/decorators/property.decorator.ts","../../../packages/core/src/decorators/web-component/web-component.decorator.ts","../../../packages/core/src/signals/input/input-set.symbol.ts","../../../packages/core/src/signals/input/input.model.ts","../../../packages/core/src/directives/base-web-component.ts"],"sourcesContent":["import { AccessorDecorator, ClassAccessorDecoratorValue } from '@xaendar/types';\r\nimport { BaseWebComponent } from '../directives/base-web-component';\r\nimport { EventParams } from '../types/event/event-params.type';\r\nimport { Output } from '../types/event/output.type';\r\n\r\nfunction isEventParams(value: EventParams | unknown): value is EventParams {\r\n return !!value && typeof value === 'object' && ('bubbles' in value || 'cancelable' in value || 'composed' in value);\r\n}\r\n\r\nexport function Event<\r\n Class extends BaseWebComponent,\r\n Field,\r\n Data = void,\r\n>(params?: EventParams): AccessorDecorator<Class, Field, Output<Data>> {\r\n return (_value: ClassAccessorDecoratorValue<Field>, context: ClassAccessorDecoratorContext<Class, Output<Data>>): ReturnType<AccessorDecorator<Class, Field, Output<Data>>> => {\r\n const name = context.name;\r\n let dispatchEvent: EventTarget['dispatchEvent'];\r\n\r\n context.addInitializer(function (this: Class) {\r\n dispatchEvent = this.dispatchEvent.bind(this);\r\n });\r\n\r\n if (typeof name === 'symbol') {\r\n throw new Error('Symbol properties are not supported as event names');\r\n }\r\n\r\n const output: Output<Data> = {\r\n emit: (_valueOrOverrideParams?: Data | EventParams, _overrideParams?: EventParams) => { }\r\n };\r\n\r\n return {\r\n get(): Output<Data> {\r\n output.emit = function (this: Class, valueOrOverrideParams?: Data | EventParams, overrideParams?: EventParams) {\r\n let eventParams: CustomEventInit<Data> = {};\r\n\r\n eventParams = isEventParams(valueOrOverrideParams)\r\n ? { ...params, ...valueOrOverrideParams }\r\n : { ...params, ...overrideParams, detail: valueOrOverrideParams }\r\n\r\n const event = new CustomEvent(name, eventParams);\r\n dispatchEvent(event);\r\n };\r\n return output;\r\n }\r\n }\r\n }\r\n}\r\n","export const INTERNAL_OBSERVED_ATTRIBUTES = `observedAttributes`;","import { INTERNAL_OBSERVED_ATTRIBUTES } from '../costants';\r\nimport { BaseWebComponent } from '../directives/base-web-component';\r\n\r\nexport function Property<\r\n Class extends BaseWebComponent,\r\n Signal extends Signal.State\r\n>(params?: { alias?: string, required?: boolean }) {\r\n return function (_target: undefined, context: ClassFieldDecoratorContext<Class, Signal>): void {\r\n const propertyKey = context.name;\r\n\r\n /*\r\n We need to check if the property key is a symbol because observedAttributes only accepts string attribute names\r\n\r\n https://html.spec.whatwg.org/multipage/custom-elements.html\r\n Let observedAttributes be an empty sequence<DOMString>.\r\n */\r\n if (typeof propertyKey === 'symbol') {\r\n throw new Error('Symbol properties are not supported');\r\n }\r\n\r\n const metadata = context.metadata as { [INTERNAL_OBSERVED_ATTRIBUTES]?: string[] };\r\n metadata[INTERNAL_OBSERVED_ATTRIBUTES] ??= [];\r\n metadata[INTERNAL_OBSERVED_ATTRIBUTES].push(propertyKey);\r\n };\r\n}","import { ClassDecorator, Constructor } from '@xaendar/types';\r\nimport { INTERNAL_OBSERVED_ATTRIBUTES } from '../../costants';\r\nimport { BaseWebComponent } from '../../directives/base-web-component';\r\nimport { WebComponentDecoratorParams } from '../../types/web-component-decorator-params.type';\r\n\r\n/**\r\n * Decorator to define a web component\r\n * @param selector Name or names of the custom element\r\n */\r\nexport function WebComponent<T extends BaseWebComponent>(options: WebComponentDecoratorParams): ClassDecorator<T> {\r\n return function (klass: Constructor<T>, context: ClassDecoratorContext<Constructor<T>>): void {\r\n defineObservedAttributes(klass, context);\r\n setSelectors(klass, options.selector);\r\n };\r\n}\r\n\r\n/**\r\n * Function to define the observedAttributes static property on the class.\r\n * We define static get observedAttributes programmatically\r\n * to abstract the manual definition from the user.\r\n *\r\n * We could not define the property in the base class due to the fact\r\n * that is static and each derived class would override the value of the others\r\n * @param klass The class to set the observedAttributes on\r\n * @param attributes The attributes to observe\r\n */\r\nfunction defineObservedAttributes<T extends BaseWebComponent>(klass: Constructor<T>, context: ClassDecoratorContext<Constructor<T>>): void {\r\n Object.defineProperty(klass, 'observedAttributes', {\r\n get: () => context.metadata![INTERNAL_OBSERVED_ATTRIBUTES],\r\n configurable: false,\r\n enumerable: false\r\n });\r\n}\r\n\r\n/**\r\n * Function to add the custom element definition to the browser using the passed selectors.\r\n * @param klass The class to define as a web component\r\n * @param selectors The selector or selectors to reference the web component in HTML\r\n */\r\nfunction setSelectors<T extends BaseWebComponent>(klass: Constructor<T>, selectors: string | string[]): void {\r\n Array.isArray(selectors)\r\n ? selectors.forEach(selector => customElements.define(selector, klass))\r\n : customElements.define(selectors, klass);\r\n}","/**\r\n * This symbol is used to call the set method of the InputSignal\r\n * Normally the set method is permitted internally and should not be called\r\n * by the User\r\n */\r\nexport const INPUT_SIGNAL_SET_SYMBOL = Symbol(`InputSignalSet`);\r\n\r\n/**\r\n * Asserts that the provided symbol matches the internal {@link INPUT_SIGNAL_SET_SYMBOL} symbol,\r\n * ensuring the caller has access to internal APIs.\r\n *\r\n * Throws if the symbol does not match, preventing external code from\r\n * invoking methods intended for internal use only.\r\n *\r\n * @param symbol - The symbol to validate against {@link INPUT_SIGNAL_SET_SYMBOL}.\r\n * @throws {Error} If `symbol` does not match {@link INPUT_SIGNAL_SET_SYMBOL}.\r\n * @internal\r\n */\r\nexport function assertPrivateContext(symbol: symbol): void {\r\n if (symbol !== INPUT_SIGNAL_SET_SYMBOL) {\r\n throw new Error('Invalid symbol for InputSignal set method');\r\n }\r\n}","import { SignalOptions } from '@xaendar/signals';\r\nimport { assertPrivateContext } from './input-set.symbol';\r\n\r\n/**\r\n * An `InputSignal` is a specialized `Signal.State` designed for use as a property signal in web components. \r\n * It extends the base `State` signal with additional functionality to handle incoming values, such as those from HTML attributes or external sources, \r\n * and allows for optional transformation of these values before they are stored in the signal.\r\n */\r\nexport class InputSignal<ActualValue = any, IncomingValue = ActualValue> extends Signal.State<ActualValue> {\r\n /**\r\n * Optional transform function to convert incoming values to the actual type stored in the signal.\r\n */\r\n private _transform?: (value: IncomingValue) => ActualValue;\r\n\r\n /**\r\n * Creates a new `InputSignal` instance.\r\n *\r\n * @param initialValue - The initial value of the signal.\r\n * @param options - Optional configuration:\r\n * - `equals` — custom equality function; defaults to `Object.is`.\r\n * - `watched` — called when the signal gains its first sink.\r\n * - `unwatched` — called when the signal loses its last sink.\r\n * - `transform` — function to transform incoming values before setting the signal's value.\r\n */\r\n constructor(value: ActualValue, options?: SignalOptions<ActualValue> & { transform?: (value: IncomingValue) => ActualValue }) {\r\n const transform = options?.transform;\r\n /* \r\n Ensure transform field is not passed to super constructor\r\n since it's not part of SignalOptions and would cause an error\r\n */\r\n delete options?.transform;\r\n\r\n super(value, options);\r\n this._transform = transform;\r\n }\r\n\r\n /**\r\n * Set a new value to the signal, applying the transform function if provided.\r\n * @param newValue - The new value to set.\r\n * @throws If `frozen` is `true` — writes are forbidden while a protected\r\n * callback is executing.\r\n */\r\n // @ts-expect-error\r\n public override set(newValue: IncomingValue, symbol: symbol): void {\r\n assertPrivateContext(symbol);\r\n const transformedValue = this._transform ? this._transform(newValue) : newValue;\r\n super.set(transformedValue as ActualValue);\r\n }\r\n}\r\n","import { INPUT_SIGNAL_SET_SYMBOL } from \"../signals/input/input-set.symbol\";\r\nimport { InputSignal } from \"../signals/input/input.model\";\r\n\r\n/**\r\n * Base class for all Web Components in the framework\r\n * \r\n * This class internally has an `observedAttributes` property\r\n * add programmaticaly by the @WebComponent decorator. \r\n * It won't appear by intellisense but it's there.\r\n */\r\nexport class BaseWebComponent extends HTMLElement {\r\n /**\r\n * The root of the Web Component, where the content is rendered\r\n */\r\n private readonly _root: ShadowRoot;\r\n\r\n constructor() {\r\n super();\r\n this._root = this.attachShadow({ mode: 'open' });\r\n }\r\n\r\n /**\r\n * Method called by the @Property decorator to\r\n * update the rendering of the component\r\n * @internal \r\n */\r\n private _render(): void { }\r\n\r\n /**\r\n * Method automatically called by the JavascriptEngine when an attribute\r\n * on the host element is changed\r\n * \r\n * This method runs before the connectedCallback method if any observed attribute\r\n * is specified on the CustomElement tag in the HTML\r\n * \r\n * @param name Name of the attribute changed\r\n * @param _oldValue Old value of the attribute\r\n * @param newValue New value of the attribute\r\n */\r\n private attributeChangedCallback(name: string, _oldValue: unknown, newValue: unknown): void {\r\n /*\r\n Since the 'Property Decorator add the property key to the ObservedAttributes\r\n We are sure that the property with the given name exists on the instance of the subclass\r\n */\r\n const context = this as BaseWebComponent & Record<string, unknown>;\r\n if (!(name in context)) {\r\n throw new Error(`Attribute ${name} is not associated to any property`);\r\n }\r\n\r\n\r\n /*\r\n @Property decorator types ensure that the property associated to the attribute is an InputSignal\r\n but i prefer to check it at runtime anyway to avoid any possible error in the future \r\n if the decorator is used wrong or if the types are not respected for some reason \r\n */\r\n if (!(context[name] instanceof InputSignal)) {\r\n throw new Error(`Property ${name} is not an InputSignal`);\r\n }\r\n\r\n context[name].set(newValue, INPUT_SIGNAL_SET_SYMBOL);\r\n }\r\n\r\n /**\r\n * Method automatically called by the JavascriptEngine when a CustomElement\r\n * is added to the DOM\r\n * \r\n * This method is called EVERY time the element is added\r\n */\r\n private connectedCallback(): void {\r\n this._render();\r\n }\r\n\r\n /**\r\n * Method automatically called by the JavascriptEngine when a CustomElement\r\n * is removed from the DOM\r\n * \r\n * This method is called EVERY time the element is removed\r\n * \r\n * We use this method to reset the _initialized flag\r\n * so that if the element is re-added to the DOM\r\n * the properties initialization won't call the render method\r\n */\r\n private disconnectedCall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Ac;EACd,YAAY;CACd,CAAC;AACH;AAOA,SAAS,EAAyC,GAAuB,GAAoC;CAC3G,MAAM,QAAQ,CAAS,IACnB,EAAU,SAAQ,MAAY,eAAe,OAAO,GAAU,CAAK,CAAC,IACpE,eAAe,OAAO,GAAW,CAAK;AAC5C;;;ACtCA,IAAa,IAA0B,OAAO,gBAAgB;AAa9D,SAAgB,EAAqB,GAAsB;CACzD,IAAI,MAAW,GACb,MAAU,MAAM,2CAA2C;AAE/D;;;ACdA,IAAa,IAAb,cAAiF,OAAO,MAAmB;CAIzG;CAYA,YAAY,GAAoB,GAA8F;EAC5H,IAAM,IAAY,GAAS;EAQ3B,AAHA,OAAO,GAAS,WAEhB,MAAM,GAAO,CAAO,GACpB,KAAK,aAAa;CACpB;CASA,IAAoB,GAAyB,GAAsB;EACjE,EAAqB,CAAM;EAC3B,IAAM,IAAmB,KAAK,aAAa,KAAK,WAAW,CAAQ,IAAI;EACvE,MAAM,IAAI,CAA+B;CAC3C;AACF,GCtCa,IAAb,cAAsC,YAAY;CAIhD;CAEA,cAAc;EAEZ,AADA,MAAM,GACN,KAAK,QAAQ,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;CACjD;CAOA,UAAwB,CAAE;CAa1B,yBAAiC,GAAc,GAAoB,GAAyB;EAK1F,IAAM,IAAU;EAChB,IAAI,EAAE,KAAQ,IACZ,MAAU,MAAM,aAAa,EAAK,mCAAmC;EASvE,IAAI,EAAE,EAAQ,cAAiB,IAC7B,MAAU,MAAM,YAAY,EAAK,uBAAuB;EAG1D,EAAQ,GAAM,IAAI,GAAU,CAAuB;CACrD;CAQA,oBAAkC;EAChC,KAAK,QAAQ;CACf;CAYA,uBAAqC,CACrC;AACF"}
|
|
1
|
+
{"version":3,"file":"xaendar-core.es.js","names":[],"sources":["../../../packages/core/src/decorators/event.decorator.ts","../../../packages/core/src/costants.ts","../../../packages/core/src/signals/input/input-set.symbol.ts","../../../packages/core/src/signals/input/input.model.ts","../../../packages/core/src/decorators/property.decorator.ts","../../../packages/core/src/decorators/web-component/web-component.decorator.ts","../../../packages/core/src/directives/base-web-component.ts"],"sourcesContent":["import { AccessorDecorator, ClassAccessorDecoratorValue } from '@xaendar/types';\r\nimport { BaseWebComponent } from '../directives/base-web-component';\r\nimport { EventOptions } from '../types/event/event-options.type';\r\nimport { Output } from '../types/event/output.type';\r\n\r\nfunction isEventOptions(value: EventOptions | unknown): value is EventOptions {\r\n return !!value && typeof value === 'object' && ('bubbles' in value || 'cancelable' in value || 'composed' in value);\r\n}\r\n\r\nexport function Event<\r\n Class extends BaseWebComponent,\r\n Data = void,\r\n>(options?: EventOptions): AccessorDecorator<Class, Output<Data>> {\r\n return (_value: ClassAccessorDecoratorValue<Output<Data>>, context: ClassAccessorDecoratorContext<Class, Output<Data>>): ReturnType<AccessorDecorator<Class, Output<Data>>> => {\r\n const name = context.name;\r\n let dispatchEvent: EventTarget['dispatchEvent'];\r\n\r\n context.addInitializer(function (this: Class) {\r\n dispatchEvent = this.dispatchEvent.bind(this);\r\n });\r\n\r\n if (typeof name === 'symbol') {\r\n throw new Error('Symbol properties are not supported as event names');\r\n }\r\n\r\n const output: Output<Data> = {\r\n emit: (_valueOrOverrideOptions?: Data | EventOptions, _overrideOptions?: EventOptions) => { }\r\n };\r\n\r\n return {\r\n get(): Output<Data> {\r\n output.emit = function (this: Class, valueOrOverrideOptions?: Data | EventOptions, overrideOptions?: EventOptions) {\r\n let eventOptions: CustomEventInit<Data> = {};\r\n\r\n eventOptions = isEventOptions(valueOrOverrideOptions)\r\n ? { ...options, ...valueOrOverrideOptions }\r\n : { ...options, ...overrideOptions, detail: valueOrOverrideOptions }\r\n\r\n const event = new CustomEvent(name, eventOptions);\r\n dispatchEvent(event);\r\n };\r\n return output;\r\n }\r\n }\r\n }\r\n}\r\n","export const INTERNAL_OBSERVED_ATTRIBUTES = `observedAttributes`;","/**\r\n * This symbol is used to call the set method of the InputSignal\r\n * Normally the set method is permitted internally and should not be called\r\n * by the User\r\n */\r\nexport const INPUT_SIGNAL_SET_SYMBOL = Symbol(`InputSignalSet`);\r\n\r\n/**\r\n * Asserts that the provided symbol matches the internal {@link INPUT_SIGNAL_SET_SYMBOL} symbol,\r\n * ensuring the caller has access to internal APIs.\r\n *\r\n * Throws if the symbol does not match, preventing external code from\r\n * invoking methods intended for internal use only.\r\n *\r\n * @param symbol - The symbol to validate against {@link INPUT_SIGNAL_SET_SYMBOL}.\r\n * @throws {Error} If `symbol` does not match {@link INPUT_SIGNAL_SET_SYMBOL}.\r\n * @internal\r\n */\r\nexport function assertPrivateContext(symbol: symbol): void {\r\n if (symbol !== INPUT_SIGNAL_SET_SYMBOL) {\r\n throw new Error('Invalid symbol for InputSignal set method');\r\n }\r\n}","import { SignalOptions } from '@xaendar/signals';\r\nimport { assertPrivateContext } from './input-set.symbol';\r\n\r\n/**\r\n * An `InputSignal` is a specialized `Signal.State` designed for use as a property signal in web components. \r\n * It extends the base `State` signal with additional functionality to handle incoming values, such as those from HTML attributes or external sources, \r\n * and allows for optional transformation of these values before they are stored in the signal.\r\n */\r\nexport class InputSignal<ActualValue = unknown, IncomingValue = ActualValue> extends Signal.State<ActualValue>{\r\n /**\r\n * Optional transform function to convert incoming values to the actual type stored in the signal.\r\n */\r\n private _transform?: (value: IncomingValue) => ActualValue;\r\n\r\n /**\r\n * Creates a new `InputSignal` instance.\r\n *\r\n * @param initialValue - The initial value of the signal.\r\n * @param options - Optional configuration:\r\n * - `equals` — custom equality function; defaults to `Object.is`.\r\n * - `watched` — called when the signal gains its first sink.\r\n * - `unwatched` — called when the signal loses its last sink.\r\n * - `transform` — function to transform incoming values before setting the signal's value.\r\n */\r\n constructor(value?: ActualValue, options?: SignalOptions<ActualValue> & { transform?: (value: IncomingValue) => ActualValue }) {\r\n const transform = options?.transform;\r\n /* \r\n Ensure transform field is not passed to super constructor\r\n since it's not part of SignalOptions and would cause an error\r\n */\r\n delete options?.transform;\r\n\r\n super(value as ActualValue, options);\r\n this._transform = transform;\r\n }\r\n\r\n /**\r\n * Set a new value to the signal, applying the transform function if provided.\r\n * @param newValue - The new value to set.\r\n * @throws If `frozen` is `true` — writes are forbidden while a protected\r\n * callback is executing.\r\n */\r\n // @ts-expect-error\r\n public override set(newValue: IncomingValue, symbol: symbol): void {\r\n assertPrivateContext(symbol);\r\n const transformedValue = this._transform ? this._transform(newValue) : newValue;\r\n super.set(transformedValue as ActualValue);\r\n }\r\n}\r\n","import { AccessorDecorator, ClassAccessorDecoratorValue } from '@xaendar/types';\r\nimport { INTERNAL_OBSERVED_ATTRIBUTES } from '../costants';\r\nimport { BaseWebComponent } from '../directives/base-web-component';\r\nimport { InputSignal } from '../signals/input/input.model';\r\nimport { PropertyDecoratorOptions, PropertyDecoratorOptionsWithRequired, } from '../types/property-decorator-options.type';\r\n\r\nconst propertyDecoratorOptionsWithRequiredBrand = Symbol('PropertyDecoratorOptionsWithRequiredBrand');\r\ntype PropertyDecoratoprOptionsWithRequiredBrandType<ActualValue = unknown, IncomingValue = ActualValue> = PropertyDecoratorOptionsWithRequired<ActualValue, IncomingValue> & { \r\n [propertyDecoratorOptionsWithRequiredBrand]: 'PropertyDecoratorOptionsWithRequired' \r\n};\r\n\r\nfunction createPropertyDecorator<\r\n Class extends BaseWebComponent,\r\n Value extends InputSignal<ActualValue, IncomingValue>,\r\n ActualValue = unknown,\r\n IncomingValue = ActualValue\r\n>(value?: ActualValue | PropertyDecoratoprOptionsWithRequiredBrandType<ActualValue, IncomingValue>, options?: PropertyDecoratorOptions<ActualValue, IncomingValue>): AccessorDecorator<Class, Value> {\r\n return function (\r\n _target: ClassAccessorDecoratorValue<Value>,\r\n context: ClassAccessorDecoratorContext<Class, Value>\r\n ): ReturnType<AccessorDecorator<Class, Value>> {\r\n const propertyKey = context.name;\r\n\r\n if (typeof propertyKey === 'symbol') {\r\n throw new Error('Symbol properties are not supported');\r\n }\r\n\r\n const metadata = context.metadata as { [INTERNAL_OBSERVED_ATTRIBUTES]?: string[] };\r\n metadata[INTERNAL_OBSERVED_ATTRIBUTES] ??= [];\r\n metadata[INTERNAL_OBSERVED_ATTRIBUTES].push(propertyKey);\r\n\r\n let actualValue: ActualValue | undefined;\r\n let actualOptions: PropertyDecoratorOptions<ActualValue, IncomingValue> | undefined | PropertyDecoratoprOptionsWithRequiredBrandType<ActualValue, IncomingValue> | undefined;\r\n if (!value || typeof value !== 'object' || !(propertyDecoratorOptionsWithRequiredBrand in value)) {\r\n actualValue = value;\r\n actualOptions = options;\r\n } else {\r\n actualOptions = value;\r\n }\r\n\r\n const signal = new InputSignal<ActualValue, IncomingValue>(actualValue, {\r\n equals: actualOptions?.equals,\r\n watched: actualOptions?.watched,\r\n unwatched: actualOptions?.unwatched,\r\n transform: actualOptions?.transform\r\n });\r\n\r\n return {\r\n get() {\r\n return signal as Value;\r\n },\r\n init(_?: InputSignal<ActualValue, IncomingValue>) {\r\n return signal as Value;\r\n },\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Decoratore per proprietà opzionale.\r\n *\r\n * @example\r\n * @Property()\r\n * accessor label: InputSignal<string>;\r\n *\r\n * @Property({ value: 0 })\r\n * accessor count: InputSignal<number>;\r\n *\r\n * @Property({ value: { required: true, foo: 'bar' }, alias: 'cfg' })\r\n * accessor config: InputSignal<Config>;\r\n */\r\nexport function Property<\r\n Class extends BaseWebComponent,\r\n Value extends InputSignal<ActualValue, IncomingValue>,\r\n ActualValue = Value extends InputSignal<infer U, any> ? U : unknown,\r\n IncomingValue = Value extends InputSignal<any, infer V> ? V : ActualValue\r\n>(\r\n value?: ActualValue,\r\n options?: PropertyDecoratorOptions<ActualValue, IncomingValue>\r\n): AccessorDecorator<Class, InputSignal<ActualValue, IncomingValue>> {\r\n return createPropertyDecorator<Class, InputSignal<ActualValue, IncomingValue>, ActualValue, IncomingValue>(value, options);\r\n}\r\n\r\n/**\r\n * Decoratore per proprietà obbligatoria.\r\n * Il consumer deve fornire il valore; non accetta un valore di default.\r\n *\r\n * @example\r\n * @Property.required()\r\n * accessor userId: InputSignal<string>;\r\n *\r\n * @Property.required({ alias: 'user-id' })\r\n * accessor userId: InputSignal<string>;\r\n */\r\nProperty.required = function required<\r\n Class extends BaseWebComponent,\r\n ActualValue = unknown,\r\n IncomingValue = ActualValue\r\n>(\r\n options?: Omit<PropertyDecoratorOptionsWithRequired<ActualValue, IncomingValue>, 'required'>\r\n): AccessorDecorator<Class, InputSignal<ActualValue, IncomingValue>> {\r\n return createPropertyDecorator<Class, InputSignal<ActualValue, IncomingValue>, ActualValue, IncomingValue>({\r\n ...options,\r\n [propertyDecoratorOptionsWithRequiredBrand]: 'PropertyDecoratorOptionsWithRequired',\r\n required: true,\r\n });\r\n};","import { ClassDecorator, Constructor } from '@xaendar/types';\r\nimport { INTERNAL_OBSERVED_ATTRIBUTES } from '../../costants';\r\nimport { BaseWebComponent } from '../../directives/base-web-component';\r\nimport { WebComponentDecoratorParams } from '../../types/web-component/web-component-decorator-params.type';\r\n\r\n/**\r\n * Decorator to define a web component\r\n * @param selector Name or names of the custom element\r\n */\r\nexport function WebComponent<T extends BaseWebComponent>(options: WebComponentDecoratorParams): ClassDecorator<T> {\r\n return function (klass: Constructor<T>, context: ClassDecoratorContext<Constructor<T>>): void {\r\n defineObservedAttributes(klass, context);\r\n setSelectors(klass, options.selector);\r\n };\r\n}\r\n\r\n/**\r\n * Function to define the observedAttributes static property on the class.\r\n * We define static get observedAttributes programmatically\r\n * to abstract the manual definition from the user.\r\n *\r\n * We could not define the property in the base class due to the fact\r\n * that is static and each derived class would override the value of the others\r\n * @param klass The class to set the observedAttributes on\r\n * @param attributes The attributes to observe\r\n */\r\nfunction defineObservedAttributes<T extends BaseWebComponent>(klass: Constructor<T>, context: ClassDecoratorContext<Constructor<T>>): void {\r\n Object.defineProperty(klass, 'observedAttributes', {\r\n get: () => context.metadata![INTERNAL_OBSERVED_ATTRIBUTES],\r\n configurable: false,\r\n enumerable: false\r\n });\r\n}\r\n\r\n/**\r\n * Function to add the custom element definition to the browser using the passed selectors.\r\n * @param klass The class to define as a web component\r\n * @param selectors The selector or selectors to reference the web component in HTML\r\n */\r\nfunction setSelectors<T extends BaseWebComponent>(klass: Constructor<T>, selectors: string | string[]): void {\r\n Array.isArray(selectors)\r\n ? selectors.forEach(selector => customElements.define(selector, klass))\r\n : customElements.define(selectors, klass);\r\n}","import { INPUT_SIGNAL_SET_SYMBOL } from \"../signals/input/input-set.symbol\";\r\nimport { InputSignal } from \"../signals/input/input.model\";\r\n\r\n/**\r\n * Base class for all Web Components in the framework\r\n * \r\n * This class internally has an `observedAttributes` property\r\n * add programmaticaly by the @WebComponent decorator. \r\n * It won't appear by intellisense but it's there.\r\n */\r\nexport class BaseWebComponent extends HTMLElement {\r\n /**\r\n * The root of the Web Component, where the content is rendered\r\n */\r\n private readonly _root: ShadowRoot;\r\n\r\n constructor() {\r\n super();\r\n this._root = this.attachShadow({ mode: 'open' });\r\n }\r\n\r\n /**\r\n * Method called by the @Property decorator to\r\n * update the rendering of the component\r\n * @internal \r\n */\r\n private _render(): void { }\r\n\r\n /**\r\n * Method automatically called by the JavascriptEngine when an attribute\r\n * on the host element is changed\r\n * \r\n * This method runs before the connectedCallback method if any observed attribute\r\n * is specified on the CustomElement tag in the HTML\r\n * \r\n * @param name Name of the attribute changed\r\n * @param _oldValue Old value of the attribute\r\n * @param newValue New value of the attribute\r\n */\r\n private attributeChangedCallback(name: string, _oldValue: unknown, newValue: unknown): void {\r\n /*\r\n Since the 'Property Decorator add the property key to the ObservedAttributes\r\n We are sure that the property with the given name exists on the instance of the subclass\r\n */\r\n const context = this as BaseWebComponent & Record<string, unknown>;\r\n if (!(name in context)) {\r\n throw new Error(`Attribute ${name} is not associated to any property`);\r\n }\r\n\r\n\r\n /*\r\n @Property decorator types ensure that the property associated to the attribute is an InputSignal\r\n but i prefer to check it at runtime anyway to avoid any possible error in the future \r\n if the decorator is used wrong or if the types are not respected for some reason \r\n */\r\n if (!(context[name] instanceof InputSignal)) {\r\n throw new Error(`Property ${name} is not an InputSignal`);\r\n }\r\n\r\n context[name].set(newValue, INPUT_SIGNAL_SET_SYMBOL);\r\n }\r\n\r\n /**\r\n * Method automatically called by the JavascriptEngine when a CustomElement\r\n * is added to the DOM\r\n * \r\n * This method is called EVERY time the element is added\r\n */\r\n private connectedCallback(): void {\r\n this._render();\r\n }\r\n\r\n /**\r\n * Method automatically called by the JavascriptEngine when a CustomElement\r\n * is removed from the DOM\r\n * \r\n * This method is called EVERY time the element is removed\r\n * \r\n * We use this method to reset the _initialized flag\r\n * so that if the element is re-added to the DOM\r\n * the properties initialization won't call the render method\r\n */\r\n private disconnectedCallback(): void {\r\n }\r\n}"],"mappings":";AAKA,SAAS,EAAe,GAAsD;CAC5E,OAAO,CAAC,CAAC,KAAS,OAAO,KAAU,aAAa,aAAa,KAAS,gBAAgB,KAAS,cAAc;AAC/G;AAEA,SAAgB,EAGd,GAAgE;CAChE,QAAQ,GAAmD,MAAoH;EAC7K,IAAM,IAAO,EAAQ,MACjB;EAMJ,IAJA,EAAQ,eAAe,WAAuB;GAC5C,IAAgB,KAAK,cAAc,KAAK,IAAI;EAC9C,CAAC,GAEG,OAAO,KAAS,UAClB,MAAU,MAAM,oDAAoD;EAGtE,IAAM,IAAuB,EAC3B,OAAO,GAA+C,MAAoC,CAAE,EAC9F;EAEA,OAAO,EACL,MAAoB;GAWlB,OAVA,EAAO,OAAO,SAAuB,GAA8C,GAAgC;IACjH,IAAI,IAAsC,CAAC;IAE3C,IAAe,EAAe,CAAsB,IAChD;KAAE,GAAG;KAAS,GAAG;IAAuB,IACxC;KAAE,GAAG;KAAS,GAAG;KAAiB,QAAQ;IAAuB;IAErE,IAAM,IAAQ,IAAI,YAAY,GAAM,CAAY;IAChD,EAAc,CAAK;GACrB,GACO;EACT,EACF;CACF;AACF;;;AC7CA,IAAa,IAA+B,sBCK/B,IAA0B,OAAO,gBAAgB;AAa9D,SAAgB,EAAqB,GAAsB;CACzD,IAAI,MAAW,GACb,MAAU,MAAM,2CAA2C;AAE/D;;;ACdA,IAAa,IA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