@sigx/runtime-dom 0.1.5 → 0.1.7

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.
@@ -1,104 +0,0 @@
1
- /**
2
- * Auto-loader for sigx components.
3
- * Automatically loads and bootstraps components when they appear in the DOM.
4
- *
5
- * When using <ui.card /> or <my.custom.thing />, this module:
6
- * 1. Detects unregistered custom elements
7
- * 2. Looks up the component's source file from the manifest
8
- * 3. Dynamically imports and registers the component
9
- * 4. Upgrades the existing DOM elements
10
- */
11
- export interface ComponentManifestEntry {
12
- /** The tag name, e.g., "ui-card" */
13
- tagName: string;
14
- /** The source file path (for bundler) or chunk URL */
15
- source: string;
16
- /** Optional: Named export if not default */
17
- exportName?: string;
18
- }
19
- export interface ComponentManifest {
20
- [tagName: string]: ComponentManifestEntry;
21
- }
22
- export interface AutoLoaderOptions {
23
- /**
24
- * The manifest mapping tag names to their source files.
25
- * Can be provided statically or loaded from a URL.
26
- */
27
- manifest?: ComponentManifest | string;
28
- /**
29
- * Custom loader function for resolving component modules.
30
- * If not provided, uses dynamic import().
31
- */
32
- loader?: (source: string) => Promise<any>;
33
- /**
34
- * Root element to observe for new custom elements.
35
- * @default document.body
36
- */
37
- root?: Element;
38
- /**
39
- * Whether to show a loading placeholder while components load.
40
- * @default true
41
- */
42
- showPlaceholder?: boolean;
43
- /**
44
- * Custom placeholder element or HTML string.
45
- * @default A subtle loading skeleton
46
- */
47
- placeholder?: string | (() => HTMLElement);
48
- /**
49
- * Callback when a component starts loading.
50
- */
51
- onLoadStart?: (tagName: string) => void;
52
- /**
53
- * Callback when a component finishes loading.
54
- */
55
- onLoadEnd?: (tagName: string, success: boolean) => void;
56
- /**
57
- * Callback when a component fails to load.
58
- */
59
- onError?: (tagName: string, error: Error) => void;
60
- }
61
- /**
62
- * Register a component manifest for auto-loading.
63
- * Can be called multiple times to merge manifests.
64
- */
65
- export declare function registerManifest(newManifest: ComponentManifest): void;
66
- /**
67
- * Register a single component entry for auto-loading.
68
- */
69
- export declare function registerComponentSource(tagName: string, source: string, exportName?: string): void;
70
- /**
71
- * Get the current manifest.
72
- */
73
- export declare function getManifest(): ComponentManifest;
74
- /**
75
- * Clear the manifest.
76
- */
77
- export declare function clearManifest(): void;
78
- /**
79
- * Manually trigger loading of a component.
80
- * Useful for preloading components before they appear in the DOM.
81
- */
82
- export declare function preloadComponent(tagName: string): Promise<void>;
83
- /**
84
- * Preload multiple components in parallel.
85
- */
86
- export declare function preloadComponents(tagNames: string[]): Promise<void>;
87
- /**
88
- * Retry loading a failed component.
89
- */
90
- export declare function retryComponent(tagName: string): Promise<void>;
91
- /**
92
- * Initialize the auto-loader.
93
- * Call this once at app startup.
94
- */
95
- export declare function initAutoLoader(opts?: AutoLoaderOptions): Promise<void>;
96
- /**
97
- * Destroy the auto-loader.
98
- */
99
- export declare function destroyAutoLoader(): void;
100
- /**
101
- * Check if the auto-loader is initialized.
102
- */
103
- export declare function isAutoLoaderInitialized(): boolean;
104
- //# sourceMappingURL=auto-loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-loader.d.ts","sourceRoot":"","sources":["../src/auto-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,WAAW,sBAAsB;IACnC,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAC9B,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAAC;CAC7C;AAED,MAAM,WAAW,iBAAiB;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAEtC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAE1C;;;OAGG;IACH,IAA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BAAuB,IAAI,OAAO,CAEjD"}
@@ -1,15 +0,0 @@
1
- /**
2
- * DOM-specific component options
3
- */
4
- export interface DOMComponentOptions {
5
- /** Whether to use Shadow DOM. Defaults to true. */
6
- shadow?: boolean;
7
- }
8
- export interface SignalXComponent extends HTMLElement {
9
- __isSigx: true;
10
- __provides?: Map<any, any>;
11
- __parentComponent?: SignalXComponent | null;
12
- __isMoving?: boolean;
13
- }
14
- export declare function registerWebComponent(tagName: string, options?: DOMComponentOptions): void;
15
- //# sourceMappingURL=custom-element.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-element.d.ts","sourceRoot":"","sources":["../src/custom-element.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACjD,QAAQ,EAAE,IAAI,CAAC;IACf,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC3B,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AASD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,QAsMlF"}
package/dist/sheet.d.ts DELETED
@@ -1,51 +0,0 @@
1
- export type CSSObject = Partial<CSSStyleDeclaration> & {
2
- [key: string]: string | number | CSSObject | undefined | any;
3
- };
4
- export type StylesMap<T> = {
5
- [K in keyof T]: string;
6
- };
7
- export type DeepPartial<T> = {
8
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
9
- };
10
- export type VarsHelper<T> = T & {
11
- (overrides?: DeepPartial<T>): Record<string, string>;
12
- };
13
- /**
14
- * Define a set of styles using a typed object.
15
- * Returns a map of class names that automatically adopts the stylesheet when used.
16
- *
17
- * @example
18
- * ```typescript
19
- * const styles = defineStyles({
20
- * container: {
21
- * display: "flex",
22
- * backgroundColor: "var(--bg)",
23
- * "&:hover": { opacity: 0.8 }
24
- * }
25
- * });
26
- *
27
- * // In component:
28
- * <div class={styles.container} />
29
- * ```
30
- */
31
- export declare function defineStyles<T extends Record<string, CSSObject>>(styles: T): StylesMap<T>;
32
- /**
33
- * Define a set of CSS variables with defaults.
34
- * Returns a helper that provides both the var() strings and a function to generate style objects.
35
- *
36
- * @example
37
- * ```typescript
38
- * const vars = defineVars('card', {
39
- * bg: 'white',
40
- * padding: '1rem'
41
- * });
42
- *
43
- * // Use in styles:
44
- * // background: vars.bg -> var(--card-bg, white)
45
- *
46
- * // Use in component:
47
- * // style={vars({ bg: 'red' })} -> { '--card-bg': 'red' }
48
- * ```
49
- */
50
- export declare function defineVars<T extends Record<string, any>>(namespace: string, defaults: T): VarsHelper<T>;
51
- //# sourceMappingURL=sheet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../src/sheet.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG;IACnD,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,GAAG,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;KACtB,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG;IAC5B,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxD,CAAC;AAkCF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAwBzF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CA4CvG"}
package/dist/styled.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { JSXElement } from "@sigx/runtime-core";
2
- type StyledComponent<P> = (props: P & {
3
- class?: string;
4
- className?: string;
5
- children?: any;
6
- }) => JSXElement;
7
- type StyledFunction<P> = (strings: TemplateStringsArray, ...values: any[]) => StyledComponent<P>;
8
- type StyledInterface = {
9
- [Tag in keyof JSX.IntrinsicElements]: StyledFunction<JSX.IntrinsicElements[Tag]>;
10
- } & {
11
- <P>(tag: string | ((props: P) => JSXElement)): StyledFunction<P>;
12
- };
13
- export declare const styled: StyledInterface;
14
- export {};
15
- //# sourceMappingURL=styled.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAcrD,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,KAAK,UAAU,CAAC;AAE5G,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC;AAEjG,KAAK,eAAe,GAAG;KAClB,GAAG,IAAI,MAAM,GAAG,CAAC,iBAAiB,GAAG,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;CACnF,GAAG;IACA,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;CACpE,CAAC;AA2DF,eAAO,MAAM,MAAM,iBAAc,CAAC"}
package/dist/styles.d.ts DELETED
@@ -1,61 +0,0 @@
1
- /**
2
- * Style Registry for DOM runtime
3
- * Manages CSS stylesheets with deduplication using adoptedStyleSheets API
4
- */
5
- export type CSSObject = Partial<CSSStyleDeclaration> & {
6
- [key: string]: string | number | CSSObject | undefined | any;
7
- };
8
- export type StylesMap<T> = {
9
- [K in keyof T]: string;
10
- };
11
- export type DeepPartial<T> = {
12
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
13
- };
14
- export type VarsHelper<T> = T & {
15
- (overrides?: DeepPartial<T>): Record<string, string>;
16
- };
17
- /**
18
- * Register and adopt a stylesheet to the document
19
- * @param id Unique identifier for deduplication
20
- * @param cssText The CSS text content
21
- */
22
- export declare function adoptStyles(id: string, cssText: string): void;
23
- /**
24
- * Define a set of styles using a typed object.
25
- * Returns a map of class names that automatically adopts the stylesheet when used.
26
- *
27
- * @example
28
- * ```typescript
29
- * const styles = defineStyles({
30
- * container: {
31
- * display: "flex",
32
- * backgroundColor: "var(--bg)",
33
- * "&:hover": { opacity: 0.8 }
34
- * }
35
- * });
36
- *
37
- * // In component:
38
- * <div class={styles.container} />
39
- * ```
40
- */
41
- export declare function defineStyles<T extends Record<string, CSSObject>>(styles: T): StylesMap<T>;
42
- /**
43
- * Define a set of CSS variables with defaults.
44
- * Returns a helper that provides both the var() strings and a function to generate style objects.
45
- *
46
- * @example
47
- * ```typescript
48
- * const vars = defineVars('card', {
49
- * bg: 'white',
50
- * padding: '1rem'
51
- * });
52
- *
53
- * // Use in styles:
54
- * // background: vars.bg -> var(--card-bg, white)
55
- *
56
- * // Use in component:
57
- * // style={vars({ bg: 'red' })} -> { '--card-bg': 'red' }
58
- * ```
59
- */
60
- export declare function defineVars<T extends Record<string, any>>(namespace: string, defaults: T): VarsHelper<T>;
61
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG;IACnD,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,GAAG,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;KACtB,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG;IAC5B,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxD,CAAC;AAcF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAqB7D;AA+BD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,C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