@sigx/runtime-core 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/app-types.d.ts +35 -15
  2. package/dist/app-types.d.ts.map +1 -1
  3. package/dist/app.d.ts +4 -8
  4. package/dist/app.d.ts.map +1 -1
  5. package/dist/component.d.ts +147 -39
  6. package/dist/component.d.ts.map +1 -1
  7. package/dist/compound.d.ts +34 -0
  8. package/dist/compound.d.ts.map +1 -0
  9. package/dist/di/factory.d.ts +3 -2
  10. package/dist/di/factory.d.ts.map +1 -1
  11. package/dist/di/injectable.d.ts +80 -6
  12. package/dist/di/injectable.d.ts.map +1 -1
  13. package/dist/hydration/index.d.ts +88 -0
  14. package/dist/hydration/index.d.ts.map +1 -0
  15. package/dist/index.d.ts +7 -2
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +556 -682
  18. package/dist/index.js.map +1 -1
  19. package/dist/jsx-runtime.d.ts +3 -2
  20. package/dist/jsx-runtime.d.ts.map +1 -1
  21. package/dist/lazy.d.ts.map +1 -1
  22. package/dist/model.d.ts +68 -0
  23. package/dist/model.d.ts.map +1 -0
  24. package/dist/platform.d.ts +9 -9
  25. package/dist/platform.d.ts.map +1 -1
  26. package/dist/plugins.d.ts +25 -1
  27. package/dist/plugins.d.ts.map +1 -1
  28. package/dist/renderer.d.ts +22 -21
  29. package/dist/renderer.d.ts.map +1 -1
  30. package/dist/utils/is-component.d.ts +30 -0
  31. package/dist/utils/is-component.d.ts.map +1 -0
  32. package/dist/utils/normalize.d.ts +34 -0
  33. package/dist/utils/normalize.d.ts.map +1 -0
  34. package/dist/utils/props-accessor.d.ts +20 -0
  35. package/dist/utils/props-accessor.d.ts.map +1 -0
  36. package/dist/utils/slots.d.ts +46 -0
  37. package/dist/utils/slots.d.ts.map +1 -0
  38. package/package.json +7 -6
  39. package/dist/sheet.d.ts +0 -51
  40. package/dist/sheet.d.ts.map +0 -1
  41. package/dist/stores/store.d.ts +0 -70
  42. package/dist/stores/store.d.ts.map +0 -1
  43. package/dist/styled.d.ts +0 -15
  44. package/dist/styled.d.ts.map +0 -1
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Hydration utilities for SSR
3
+ *
4
+ * These utilities are shared between server-side rendering (stream.ts)
5
+ * and client-side hydration (hydrate.ts). They are placed in runtime-core
6
+ * to allow any SSR implementation to use them.
7
+ *
8
+ * @module
9
+ */
10
+ /**
11
+ * Client directive prefix used for selective hydration
12
+ */
13
+ export declare const CLIENT_DIRECTIVE_PREFIX = "client:";
14
+ /**
15
+ * Valid client directive names
16
+ */
17
+ export declare const CLIENT_DIRECTIVES: readonly ["client:load", "client:idle", "client:visible", "client:media", "client:only"];
18
+ export type ClientDirective = typeof CLIENT_DIRECTIVES[number];
19
+ /**
20
+ * Hydration strategies for client directives
21
+ */
22
+ export type HydrationStrategy = 'load' | 'idle' | 'visible' | 'media' | 'only';
23
+ /**
24
+ * Result of getHydrationDirective
25
+ */
26
+ export interface HydrationDirective {
27
+ strategy: HydrationStrategy;
28
+ media?: string;
29
+ }
30
+ /**
31
+ * Filter out client directives from props.
32
+ * Used to get the actual component props without hydration hints.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const props = { 'client:visible': true, name: 'test', count: 5 };
37
+ * filterClientDirectives(props); // { name: 'test', count: 5 }
38
+ * ```
39
+ */
40
+ export declare function filterClientDirectives(props: Record<string, any>): Record<string, any>;
41
+ /**
42
+ * Get hydration directive from props.
43
+ * Returns the strategy and optional media query for client:media.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * getHydrationDirective({ 'client:visible': true }); // { strategy: 'visible' }
48
+ * getHydrationDirective({ 'client:media': '(min-width: 768px)' }); // { strategy: 'media', media: '(min-width: 768px)' }
49
+ * getHydrationDirective({ name: 'test' }); // null
50
+ * ```
51
+ */
52
+ export declare function getHydrationDirective(props: Record<string, any>): HydrationDirective | null;
53
+ /**
54
+ * Check if props contain any client directive.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * hasClientDirective({ 'client:visible': true }); // true
59
+ * hasClientDirective({ name: 'test' }); // false
60
+ * ```
61
+ */
62
+ export declare function hasClientDirective(props: Record<string, any>): boolean;
63
+ /**
64
+ * Serialize props for client hydration.
65
+ * Filters out non-serializable values (functions, symbols, undefined).
66
+ * Returns undefined if no serializable props remain.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * serializeProps({ name: 'test', onClick: () => {} }); // { name: 'test' }
71
+ * serializeProps({ onClick: () => {} }); // undefined
72
+ * ```
73
+ */
74
+ export declare function serializeProps(props: Record<string, any>): Record<string, any> | undefined;
75
+ /**
76
+ * Create an emit function for component context.
77
+ * This is a common pattern used in both mountComponent and hydrateComponent.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const emit = createEmit(reactiveProps);
82
+ * emit('click', eventData); // Calls props.onClick(eventData)
83
+ * ```
84
+ */
85
+ export declare function createEmit(reactiveProps: {
86
+ value?: Record<string, any>;
87
+ } | Record<string, any>): (event: string, ...args: any[]) => void;
88
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hydration/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,iBAAiB,0FAMpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQtF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,kBAAkB,GAAG,IAAI,CAS3F;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAOtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAmC1F;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAUxI"}
package/dist/index.d.ts CHANGED
@@ -2,16 +2,21 @@ export * from './platform.js';
2
2
  export * from './plugins.js';
3
3
  export * from './app.js';
4
4
  export * from './component.js';
5
+ export * from './compound.js';
5
6
  export * from './jsx-runtime.js';
6
7
  export * from './lazy.js';
8
+ export * from './model.js';
7
9
  export { Utils } from './utils/index.js';
10
+ export { createPropsAccessor } from './utils/props-accessor.js';
11
+ export { createSlots } from './utils/slots.js';
12
+ export type { InternalSlotsObject } from './utils/slots.js';
13
+ export { normalizeSubTree } from './utils/normalize.js';
8
14
  export * from './models/index.js';
9
15
  export * from './messaging/index.js';
10
16
  export * from './di/injectable.js';
11
17
  export * from './di/factory.js';
12
- export * from './stores/store.js';
13
18
  import './jsx-types.d.ts';
14
19
  export { signal } from '@sigx/reactivity';
15
20
  export * from './renderer.js';
16
- export type { CustomElementRegistry, ComponentProps, RegisteredElements } from './register.d.ts';
21
+ export * from './hydration/index.js';
17
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,cAAc,eAAe,CAAC;AAG9B,cAAc,sBAAsB,CAAC"}