@aegis-framework/pandora 0.3.0 → 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/README.md +321 -37
- package/dist/pandora.browser.js +27 -8
- package/dist/pandora.browser.js.map +9 -7
- package/dist/pandora.js +27 -8
- package/dist/pandora.js.map +9 -7
- package/dist/types/Component.d.ts +95 -39
- package/dist/types/Component.d.ts.map +1 -1
- package/dist/types/Decorators.d.ts +70 -0
- package/dist/types/Decorators.d.ts.map +1 -0
- package/dist/types/Registry.d.ts +19 -3
- package/dist/types/Registry.d.ts.map +1 -1
- package/dist/types/ShadowComponent.d.ts +13 -4
- package/dist/types/ShadowComponent.d.ts.map +1 -1
- package/dist/types/Util.d.ts +9 -0
- package/dist/types/Util.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +7 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TemplateResult, nothing } from 'lit-html';
|
|
1
2
|
import { Properties, Style, ReadyCallback } from './Types';
|
|
2
3
|
/**
|
|
3
4
|
* A component represents a custom HTML element, and has all of its functionality
|
|
@@ -7,21 +8,20 @@ import { Properties, Style, ReadyCallback } from './Types';
|
|
|
7
8
|
* @template S - The type of the component's state (defaults to Properties)
|
|
8
9
|
*/
|
|
9
10
|
declare class Component<P extends Properties = Properties, S extends Properties = Properties> extends HTMLElement {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
protected _styleElement: HTMLStyleElement | null;
|
|
11
|
+
_children: string;
|
|
12
|
+
_state: S;
|
|
13
|
+
_props: P;
|
|
14
|
+
_ready: ReadyCallback[];
|
|
15
|
+
_connected: boolean;
|
|
16
|
+
_isReady: boolean;
|
|
17
|
+
_style: Style;
|
|
18
18
|
static _tag?: string;
|
|
19
|
-
static _template?: string | ((context: any) => string);
|
|
19
|
+
static _template?: string | ((context: any) => string | TemplateResult | typeof nothing);
|
|
20
20
|
static _observedAttributes: string[];
|
|
21
21
|
static _onMount?: (component: Component, tag: string) => void;
|
|
22
22
|
static _onUnmount?: (component: Component, tag: string) => void;
|
|
23
23
|
static _onError?: (error: Error, component: Component, tag: string, lifecycle: string) => void;
|
|
24
|
-
static _applyMiddleware?: (type: string, component: Component, value: any) => any;
|
|
24
|
+
static _applyMiddleware?: (type: string, component: Component, value: any, renderType?: 'string' | 'lit') => any;
|
|
25
25
|
static _hasMiddleware?: (type: string) => boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Returns the list of attributes to observe for changes.
|
|
@@ -38,7 +38,19 @@ declare class Component<P extends Properties = Properties, S extends Properties
|
|
|
38
38
|
static set observedAttributes(value: string[]);
|
|
39
39
|
static get tag(): string;
|
|
40
40
|
static set tag(value: string);
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Set or get the static template for this component class.
|
|
43
|
+
*
|
|
44
|
+
* Templates can be:
|
|
45
|
+
* - A string: `'<div>Hello</div>'`
|
|
46
|
+
* - A function returning string: `(ctx) => \`<div>\${ctx.props.name}</div>\``
|
|
47
|
+
* - A function returning lit-html: `(ctx) => html\`<div>\${ctx.props.name}</div>\``
|
|
48
|
+
*
|
|
49
|
+
* @param html - The template to set, or null to get the current template result
|
|
50
|
+
* @param context - The context to use when calling template functions (usually the component instance)
|
|
51
|
+
* @returns The rendered template when getting, void when setting
|
|
52
|
+
*/
|
|
53
|
+
static template(html?: string | ((context: any) => string | TemplateResult | typeof nothing) | null, context?: any): string | TemplateResult | typeof nothing | undefined | void;
|
|
42
54
|
constructor();
|
|
43
55
|
get width(): number;
|
|
44
56
|
set width(value: number | string);
|
|
@@ -52,6 +64,24 @@ declare class Component<P extends Properties = Properties, S extends Properties
|
|
|
52
64
|
set state(value: S);
|
|
53
65
|
get dom(): HTMLElement;
|
|
54
66
|
set dom(value: HTMLElement);
|
|
67
|
+
/**
|
|
68
|
+
* Returns the original innerHTML content that was present before the component rendered.
|
|
69
|
+
*
|
|
70
|
+
* This is an alias for `_children`
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* // String template
|
|
74
|
+
* render() {
|
|
75
|
+
* return `<div class="wrapper">${this.slotContent}</div>`;
|
|
76
|
+
* }
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* // lit-html template
|
|
80
|
+
* render() {
|
|
81
|
+
* return html`<div class="wrapper">${this.slotContent}</div>`;
|
|
82
|
+
* }
|
|
83
|
+
*/
|
|
84
|
+
get slotContent(): string;
|
|
55
85
|
/**
|
|
56
86
|
* Returns whether the component is currently connected to the DOM.
|
|
57
87
|
*/
|
|
@@ -69,20 +99,27 @@ declare class Component<P extends Properties = Properties, S extends Properties
|
|
|
69
99
|
*/
|
|
70
100
|
static register(): void;
|
|
71
101
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
102
|
+
* Instance method to set or get the template.
|
|
103
|
+
* Delegates to the static template() method with this instance as context.
|
|
104
|
+
*
|
|
105
|
+
* @param html - The template to set, or null to get the current template result
|
|
106
|
+
* @returns The rendered template when getting, void when setting
|
|
107
|
+
*/
|
|
108
|
+
template(html?: string | ((context: any) => string | TemplateResult | typeof nothing) | null): string | TemplateResult | typeof nothing | undefined | void;
|
|
109
|
+
static _styleSheet: CSSStyleSheet | null;
|
|
110
|
+
/**
|
|
111
|
+
* Sets the component style. For normal components, styles are scoped to the
|
|
112
|
+
* component's tag name as a selector prefix and shared across all instances
|
|
113
|
+
* of the same component class.
|
|
114
|
+
*
|
|
115
|
+
* @param style - CSS object or string to apply
|
|
116
|
+
* @param reset - If true, replaces all styles; if false, merges with existing
|
|
117
|
+
* @returns The current style object
|
|
118
|
+
*/
|
|
82
119
|
setStyle(style: Style | string, reset?: boolean): Style;
|
|
83
120
|
setState(state: Partial<S>): void;
|
|
84
121
|
setProps(props: Partial<P>): void;
|
|
85
|
-
|
|
122
|
+
_setPropAttributes(update?: boolean): void;
|
|
86
123
|
/**
|
|
87
124
|
* Adds an event listener to the component.
|
|
88
125
|
*
|
|
@@ -148,7 +185,7 @@ declare class Component<P extends Properties = Properties, S extends Properties
|
|
|
148
185
|
* @param newObject - The new state/props object
|
|
149
186
|
* @returns A promise that resolves when the pre-update logic completes
|
|
150
187
|
*/
|
|
151
|
-
|
|
188
|
+
willUpdate(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void>;
|
|
152
189
|
/**
|
|
153
190
|
* Called when the component updates due to state or props changes.
|
|
154
191
|
* Override this method to perform actions during an update.
|
|
@@ -161,7 +198,7 @@ declare class Component<P extends Properties = Properties, S extends Properties
|
|
|
161
198
|
* @param newObject - The new state/props object
|
|
162
199
|
* @returns A promise that resolves when the update logic completes
|
|
163
200
|
*/
|
|
164
|
-
|
|
201
|
+
update(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void>;
|
|
165
202
|
/**
|
|
166
203
|
* Called after the component updates due to state or props changes.
|
|
167
204
|
* Override this method to perform actions after an update completes.
|
|
@@ -174,7 +211,7 @@ declare class Component<P extends Properties = Properties, S extends Properties
|
|
|
174
211
|
* @param newObject - The new state/props object
|
|
175
212
|
* @returns A promise that resolves when the post-update logic completes
|
|
176
213
|
*/
|
|
177
|
-
|
|
214
|
+
didUpdate(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void>;
|
|
178
215
|
/**
|
|
179
216
|
* Called when the component's state updates.
|
|
180
217
|
* Override this method to react specifically to state changes.
|
|
@@ -186,7 +223,7 @@ declare class Component<P extends Properties = Properties, S extends Properties
|
|
|
186
223
|
* @param newObject - The new state object
|
|
187
224
|
* @returns A promise that resolves when the state update logic completes
|
|
188
225
|
*/
|
|
189
|
-
|
|
226
|
+
onStateUpdate(property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void>;
|
|
190
227
|
/**
|
|
191
228
|
* Called when the component's props update.
|
|
192
229
|
* Override this method to react specifically to props changes.
|
|
@@ -198,60 +235,79 @@ declare class Component<P extends Properties = Properties, S extends Properties
|
|
|
198
235
|
* @param newObject - The new props object
|
|
199
236
|
* @returns A promise that resolves when the props update logic completes
|
|
200
237
|
*/
|
|
201
|
-
|
|
238
|
+
onPropsUpdate(property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void>;
|
|
202
239
|
/**
|
|
203
240
|
* Called before the component is mounted to the DOM.
|
|
204
241
|
* Override this method to perform setup before rendering.
|
|
205
242
|
*
|
|
206
243
|
* @returns A promise that resolves when the pre-mount logic completes
|
|
207
244
|
*/
|
|
208
|
-
|
|
245
|
+
willMount(): Promise<void>;
|
|
209
246
|
/**
|
|
210
247
|
* Called after the component is mounted to the DOM.
|
|
211
248
|
* Override this method to perform actions after the component is rendered.
|
|
212
249
|
*
|
|
213
250
|
* @returns A promise that resolves when the post-mount logic completes
|
|
214
251
|
*/
|
|
215
|
-
|
|
252
|
+
didMount(): Promise<void>;
|
|
216
253
|
/**
|
|
217
254
|
* Called before the component is removed from the DOM.
|
|
218
255
|
* Override this method to perform cleanup before unmounting.
|
|
219
256
|
*
|
|
220
257
|
* @returns A promise that resolves when the pre-unmount logic completes
|
|
221
258
|
*/
|
|
222
|
-
|
|
259
|
+
willUnmount(): Promise<void>;
|
|
223
260
|
/**
|
|
224
261
|
* Called when the component is being removed from the DOM.
|
|
225
262
|
* Override this method to perform cleanup during unmounting.
|
|
226
263
|
*
|
|
227
264
|
* @returns A promise that resolves when the unmount logic completes
|
|
228
265
|
*/
|
|
229
|
-
|
|
266
|
+
unmount(): Promise<void>;
|
|
230
267
|
/**
|
|
231
268
|
* Called after the component is removed from the DOM.
|
|
232
269
|
* Override this method to perform final cleanup after unmounting.
|
|
233
270
|
*
|
|
234
271
|
* @returns A promise that resolves when the post-unmount logic completes
|
|
235
272
|
*/
|
|
236
|
-
|
|
273
|
+
didUnmount(): Promise<void>;
|
|
237
274
|
/**
|
|
238
275
|
* Forces the component to be rendered again.
|
|
239
276
|
*
|
|
240
|
-
* @returns A promise that resolves
|
|
277
|
+
* @returns A promise that resolves when rendering is complete
|
|
241
278
|
*/
|
|
242
|
-
forceRender():
|
|
279
|
+
forceRender(): Promise<void>;
|
|
243
280
|
/**
|
|
244
|
-
* Returns the
|
|
281
|
+
* Returns the content for the component.
|
|
245
282
|
* Override this method to define the component's template.
|
|
246
283
|
*
|
|
247
|
-
*
|
|
284
|
+
* You can return either:
|
|
285
|
+
* - A string (traditional HTML string)
|
|
286
|
+
* - A lit-html TemplateResult (for efficient DOM diffing)
|
|
287
|
+
* - `nothing` from lit-html (to render nothing)
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* // String-based rendering
|
|
291
|
+
* render() {
|
|
292
|
+
* return `<div>Hello ${this.state.name}</div>`;
|
|
293
|
+
* }
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* // lit-html rendering
|
|
297
|
+
* import { html } from '@aegis-framework/pandora';
|
|
298
|
+
*
|
|
299
|
+
* render() {
|
|
300
|
+
* return html`<div>Hello ${this.state.name}</div>`;
|
|
301
|
+
* }
|
|
302
|
+
*
|
|
303
|
+
* @returns The HTML string or lit-html TemplateResult to render
|
|
248
304
|
*/
|
|
249
|
-
render(): string;
|
|
250
|
-
|
|
305
|
+
render(): string | TemplateResult | typeof nothing;
|
|
306
|
+
_render(): Promise<void>;
|
|
251
307
|
connectedCallback(): Promise<void>;
|
|
252
308
|
ready(callback: ReadyCallback): void;
|
|
253
309
|
disconnectedCallback(): Promise<void>;
|
|
254
|
-
|
|
310
|
+
updateCallback(property: string, oldValue: unknown, newValue: unknown, origin?: 'props' | 'state' | 'attribute', oldObject?: P | S, newObject?: P | S): Promise<void>;
|
|
255
311
|
/**
|
|
256
312
|
* Called when an observed attribute changes.
|
|
257
313
|
* This is a Web Components lifecycle callback.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/Component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/Component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE3D;;;;;;GAMG;AACH,cAAM,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAAE,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,WAAW;IAChG,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,CAAC;IACV,MAAM,EAAE,CAAC,CAAC;IACV,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,KAAK,CAAC;IAGrB,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAGrB,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,KAAK,MAAM,GAAG,cAAc,GAAG,OAAO,OAAO,CAAC,CAAC;IAIzF,MAAM,CAAC,mBAAmB,EAAE,MAAM,EAAE,CAAM;IAG1C,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,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I,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAUlC;;;;OAIG;IACH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,IAAI,MAAM,GAAG,cAAc,GAAG,OAAO,OAAO;IAIrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAiD/B,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IA2DxC,KAAK,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAQ9B,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B9B,cAAc,CACzB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,MAAM,GAAE,OAAO,GAAG,OAAO,GAAG,WAAqB,EACjD,SAAS,GAAE,CAAC,GAAG,CAAe,EAC9B,SAAS,GAAE,CAAC,GAAG,CAAe,GAC7B,OAAO,CAAC,IAAI,CAAC;IAahB;;;;;;;OAOG;IACH,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;CAKnG;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import Component from './Component';
|
|
2
|
+
type ComponentConstructor = typeof Component & {
|
|
3
|
+
tag: string;
|
|
4
|
+
_registered?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Class Decorator: Automatically registers the component with the CustomElementsRegistry.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* @Register('my-component')
|
|
12
|
+
* class MyComponent extends Component {
|
|
13
|
+
* render() {
|
|
14
|
+
* return '<div>Hello World</div>';
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param tagName - The custom element tag name (must contain a hyphen)
|
|
20
|
+
*/
|
|
21
|
+
export declare function Register(tagName: string): <T extends ComponentConstructor>(constructor: T) => T;
|
|
22
|
+
/**
|
|
23
|
+
* Property Decorator: Binds a class property to a Global Registry state key.
|
|
24
|
+
*
|
|
25
|
+
* This decorator:
|
|
26
|
+
* 1. On component connect, sets the property to the current global value
|
|
27
|
+
* 2. Subscribes to global state changes and updates the property automatically
|
|
28
|
+
* 3. When the property is set internally, updates the global state
|
|
29
|
+
* 4. Automatically unsubscribes when the component disconnects
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* class UserProfile extends Component {
|
|
34
|
+
* @Consumer('user.theme')
|
|
35
|
+
* theme!: string;
|
|
36
|
+
*
|
|
37
|
+
* @Consumer('app.language')
|
|
38
|
+
* language!: string;
|
|
39
|
+
*
|
|
40
|
+
* render() {
|
|
41
|
+
* return `<div>Theme: ${this.theme}, Language: ${this.language}</div>`;
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @param stateKey - The global state key in the Registry to bind to
|
|
47
|
+
*/
|
|
48
|
+
export declare function Consumer(stateKey: string): (target: any, propertyKey: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Property Decorator: Declares a property that syncs with a DOM attribute.
|
|
51
|
+
*
|
|
52
|
+
* When the attribute changes, the property updates automatically.
|
|
53
|
+
* When the property is set, the attribute is updated.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* class MyButton extends Component {
|
|
58
|
+
* @Prop()
|
|
59
|
+
* disabled: boolean = false;
|
|
60
|
+
*
|
|
61
|
+
* @Prop('button-type')
|
|
62
|
+
* type: string = 'primary';
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param attributeName - Optional custom attribute name (defaults to property name)
|
|
67
|
+
*/
|
|
68
|
+
export declare function Prop(attributeName?: string): (target: any, propertyKey: string) => void;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=Decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decorators.d.ts","sourceRoot":"","sources":["../../src/Decorators.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAOpC,KAAK,oBAAoB,GAAG,OAAO,SAAS,GAAG;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAMF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,IACrB,CAAC,SAAS,oBAAoB,EAAE,aAAa,CAAC,KAAG,CAAC,CAIpE;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,IACtB,QAAQ,GAAG,EAAE,aAAa,MAAM,UAyElD;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,IACxB,QAAQ,GAAG,EAAE,aAAa,MAAM,UA+ClD"}
|
package/dist/types/Registry.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ type StateSubscriber<T = unknown> = (newValue: T, oldValue: T | undefined) => vo
|
|
|
7
7
|
type LifecycleCallback = (component: Component, tag: string) => void;
|
|
8
8
|
type ErrorCallback = (error: Error, component: Component, tag: string, lifecycle: string) => void;
|
|
9
9
|
type MiddlewareType = 'props' | 'state' | 'render';
|
|
10
|
-
type
|
|
10
|
+
type RenderType = 'string' | 'lit';
|
|
11
|
+
type Middleware = (component: Component, value: any, renderType?: RenderType) => any;
|
|
11
12
|
type ComponentLoader = () => Promise<ComponentClass | {
|
|
12
13
|
default: ComponentClass;
|
|
13
14
|
}>;
|
|
@@ -255,16 +256,31 @@ declare class Registry {
|
|
|
255
256
|
* Register middleware to intercept props, state, or render operations
|
|
256
257
|
*
|
|
257
258
|
* @param type - The type of middleware: 'props', 'state', or 'render'
|
|
258
|
-
* @param middleware - Function that receives (component, value) and returns the modified value
|
|
259
|
+
* @param middleware - Function that receives (component, value, renderType?) and returns the modified value.
|
|
260
|
+
*
|
|
259
261
|
* @returns Unsubscribe function
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* // Type-aware render middleware
|
|
265
|
+
* Registry.use('render', (component, value, renderType) => {
|
|
266
|
+
* if (renderType === 'string') {
|
|
267
|
+
* return value.toUpperCase();
|
|
268
|
+
* }
|
|
269
|
+
* // For lit-html, return as-is or wrap
|
|
270
|
+
* return value;
|
|
271
|
+
* });
|
|
260
272
|
*/
|
|
261
273
|
static use(type: MiddlewareType, middleware: Middleware): () => void;
|
|
262
274
|
/**
|
|
263
275
|
* Apply middleware to a value
|
|
264
276
|
*
|
|
277
|
+
* @param type - The middleware type
|
|
278
|
+
* @param component - The component instance
|
|
279
|
+
* @param value - The value to process
|
|
280
|
+
* @param renderType - For 'render' middleware, indicates if template is 'string' or 'lit'
|
|
265
281
|
* @internal
|
|
266
282
|
*/
|
|
267
|
-
static _applyMiddleware(type: MiddlewareType, component: Component, value: any): any;
|
|
283
|
+
static _applyMiddleware(type: MiddlewareType, component: Component, value: any, renderType?: RenderType): any;
|
|
268
284
|
/**
|
|
269
285
|
* Check if there are any middleware registered for a type
|
|
270
286
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.d.ts","sourceRoot":"","sources":["../../src/Registry.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,KAAK,cAAc,GAAG,OAAO,SAAS,GAAG;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,KAAK,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,E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IAUpC;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI;IAoEvD;;;;OAIG;WACU,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0B3D;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAInC;;;;OAIG;WACU,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhD;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,IAAI;IAOpE;;;;;;;;OAQG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,GAAG;IAc7G;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO;CAGrD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import Component from './Component';
|
|
2
2
|
import { Properties, Style } from './Types';
|
|
3
3
|
/**
|
|
4
|
-
* A component that uses Shadow DOM for encapsulation
|
|
4
|
+
* A component that uses Shadow DOM for encapsulation.
|
|
5
|
+
* Uses Constructable Stylesheets for high-performance styling.
|
|
5
6
|
*
|
|
6
7
|
* @template P - The type of the component's props (defaults to Properties)
|
|
7
8
|
* @template S - The type of the component's state (defaults to Properties)
|
|
8
9
|
*/
|
|
9
10
|
declare class ShadowComponent<P extends Properties = Properties, S extends Properties = Properties> extends Component<P, S> {
|
|
10
|
-
|
|
11
|
+
_shadowDOM: ShadowRoot;
|
|
12
|
+
static _styleSheet: CSSStyleSheet | null;
|
|
11
13
|
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Sets the component style, these are scoped to the component's shadow root
|
|
16
|
+
* and shared across all instances of the same component class.
|
|
17
|
+
*
|
|
18
|
+
* @param style - CSS object or string to apply
|
|
19
|
+
* @param reset - If true, replaces all styles; if false, merges with existing
|
|
20
|
+
* @returns The current style object
|
|
21
|
+
*/
|
|
12
22
|
setStyle(style: Style | string, reset?: boolean): Style;
|
|
13
|
-
|
|
14
|
-
protected _render(): Promise<string>;
|
|
23
|
+
_render(): Promise<void>;
|
|
15
24
|
get dom(): HTMLElement;
|
|
16
25
|
set dom(value: HTMLElement);
|
|
17
26
|
get shadowRoot(): ShadowRoot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShadowComponent.d.ts","sourceRoot":"","sources":["../../src/ShadowComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ShadowComponent.d.ts","sourceRoot":"","sources":["../../src/ShadowComponent.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;GAMG;AACH,cAAM,eAAe,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAAE,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1G,UAAU,EAAE,UAAU,CAAC;IAI9B,MAAM,CAAC,WAAW,EAAE,aAAa,GAAG,IAAI,CAAQ;;IAShD;;;;;;;OAOG;IACM,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,KAAK;IA0CjD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA8C9C,IAAI,GAAG,IAAI,WAAW,CAErB;IAED,IAAI,GAAG,CAAC,KAAK,EAAE,WAAW,EAEzB;IAED,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,UAAU,EAE/B;IAED;;;;;OAKG;IACM,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAIvE;;;;;OAKG;IACM,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;CAGhF;AAED,eAAe,eAAe,CAAC"}
|
package/dist/types/Util.d.ts
CHANGED
|
@@ -6,6 +6,15 @@ import { CSSObject } from './Types';
|
|
|
6
6
|
* @param args - Additional arguments to pass to the function
|
|
7
7
|
*/
|
|
8
8
|
export declare function callAsync<T>(callable: (...args: any[]) => T, context: any, ...args: any[]): Promise<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Checks if a value is a lit-html TemplateResult
|
|
11
|
+
* This allows Components to detect whether render() returned a string or a TemplateResult
|
|
12
|
+
* and handle them appropriately.
|
|
13
|
+
*
|
|
14
|
+
* @param value - The value to check
|
|
15
|
+
* @returns True if the value is a lit-html TemplateResult
|
|
16
|
+
*/
|
|
17
|
+
export declare function isTemplateResult(value: unknown): boolean;
|
|
9
18
|
/**
|
|
10
19
|
* Converts a CSS object to a CSS string
|
|
11
20
|
* @param object - The CSS object to convert
|
package/dist/types/Util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/Util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAOtG;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,GAAE,MAAW,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,CAuCvG"}
|
|
1
|
+
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/Util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAOtG;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,GAAE,MAAW,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,CAuCvG"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { default as Component } from './Component';
|
|
2
2
|
export { default as ShadowComponent } from './ShadowComponent';
|
|
3
3
|
export { default as Registry } from './Registry';
|
|
4
|
+
export { Register, Consumer, Prop } from './Decorators';
|
|
5
|
+
export { html, svg, nothing, noChange, render, type TemplateResult, type SVGTemplateResult, type RenderOptions } from 'lit-html';
|
|
4
6
|
export * as Util from './Util';
|
|
5
7
|
export * as Types from './Types';
|
|
8
|
+
export type { Properties, Style, ReadyCallback, CSSValue, CSSProperties, CSSObject } from './Types';
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EACL,IAAI,EACJ,GAAG,EACH,OAAO,EACP,QAAQ,EACR,MAAM,EACN,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,UAAU,CAAC;AAGlB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aegis-framework/pandora",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Aegis Framework Web Components Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/pandora.js",
|
|
@@ -39,14 +39,17 @@
|
|
|
39
39
|
"library"
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "
|
|
42
|
+
"build": "bun clean && bun lint && bun check && bun build:module && bun build:legacy && bun build:types",
|
|
43
43
|
"build:module": "bun build ./src/index.ts --target browser --format esm --outdir ./dist --sourcemap=linked --minify && mv ./dist/index.js ./dist/pandora.js && mv ./dist/index.js.map ./dist/pandora.js.map && sed -i 's/index.js.map/pandora.js.map/' ./dist/pandora.js",
|
|
44
44
|
"build:legacy": "bun build ./src/browser.ts --target browser --format esm --outdir ./dist --sourcemap=linked --minify && mv ./dist/browser.js ./dist/pandora.browser.js && mv ./dist/browser.js.map ./dist/pandora.browser.js.map && sed -i 's/browser.js.map/pandora.browser.js.map/' ./dist/pandora.browser.js",
|
|
45
45
|
"build:types": "tsc --emitDeclarationOnly --declarationDir ./dist/types",
|
|
46
46
|
"check": "tsc --noEmit",
|
|
47
47
|
"lint": "eslint ./src/**/*.ts",
|
|
48
48
|
"clean": "rm -rf dist",
|
|
49
|
-
"test": "
|
|
49
|
+
"test": "bun test/index.html"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"lit-html": "^3.0.0"
|
|
50
53
|
},
|
|
51
54
|
"devDependencies": {
|
|
52
55
|
"@babel/eslint-parser": "^7.28.5",
|
|
@@ -55,7 +58,6 @@
|
|
|
55
58
|
"@typescript-eslint/parser": "^8.48.1",
|
|
56
59
|
"bun": "^1.3.3",
|
|
57
60
|
"eslint": "^9.39.1",
|
|
58
|
-
"http-server": "^14.1.1",
|
|
59
61
|
"typescript": "^5.9.3",
|
|
60
62
|
"typescript-eslint": "^8.48.1"
|
|
61
63
|
},
|
|
@@ -66,5 +68,5 @@
|
|
|
66
68
|
"package.json"
|
|
67
69
|
],
|
|
68
70
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
69
|
-
"packageManager": "
|
|
71
|
+
"packageManager": "bun@4.12.0"
|
|
70
72
|
}
|