sibujs 4.5.0 → 4.7.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 +1 -1
- package/dist/browser.cjs +326 -133
- package/dist/browser.d.cts +46 -14
- package/dist/browser.d.ts +46 -14
- package/dist/browser.js +8 -6
- package/dist/build.cjs +2094 -1033
- package/dist/build.d.cts +133 -44
- package/dist/build.d.ts +133 -44
- package/dist/build.js +1372 -574
- package/dist/cdn.dev.global.js +10 -10
- package/dist/cdn.full.dev.global.js +11 -11
- package/dist/cdn.full.global.js +10 -10
- package/dist/cdn.global.js +10 -10
- package/dist/{chunk-2DCGACUU.js → chunk-2BPG2XDA.js} +251 -66
- package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
- package/dist/{chunk-4PMLNECI.js → chunk-3QWBSL5R.js} +98 -29
- package/dist/{chunk-KKLW7YWL.js → chunk-4AWA2PVD.js} +275 -144
- package/dist/chunk-5HZXGZ6T.js +24 -0
- package/dist/{chunk-PCT43HW3.js → chunk-7LUJQAOJ.js} +1 -1
- package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
- package/dist/chunk-BC2SECJD.js +44 -0
- package/dist/{chunk-TBYTO6BS.js → chunk-BSY63EM6.js} +136 -80
- package/dist/{chunk-FTIR4QW2.js → chunk-DKXRACVN.js} +6 -8
- package/dist/{chunk-ONOHFDLG.js → chunk-FNJXNGYZ.js} +3 -3
- package/dist/{chunk-XZZOBQAY.js → chunk-FQRUXCEE.js} +6 -5
- package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
- package/dist/chunk-J6FW5TV6.js +233 -0
- package/dist/{chunk-UGRX3S57.js → chunk-JWKYU5GV.js} +22 -4
- package/dist/chunk-NYNYSPK7.js +318 -0
- package/dist/{chunk-RBTPLM32.js → chunk-RUSSKG6G.js} +13 -12
- package/dist/{chunk-7LN645I6.js → chunk-SLM3IA34.js} +3 -3
- package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
- package/dist/{chunk-B3WHI2QA.js → chunk-UNWRJRKC.js} +55 -31
- package/dist/{chunk-KEISJXBU.js → chunk-UOL2ECCS.js} +44 -17
- package/dist/{chunk-RJE2BNI4.js → chunk-VZSG24LS.js} +108 -45
- package/dist/{chunk-RIXRAYIU.js → chunk-WEQ3DMVL.js} +10 -4
- package/dist/{chunk-3JZ4L5TJ.js → chunk-WOLJZUFQ.js} +354 -90
- package/dist/{chunk-S373NSMK.js → chunk-XYV3EDB7.js} +283 -123
- package/dist/{chunk-VZKNK2V7.js → chunk-XZR4PXRE.js} +296 -38
- package/dist/{chunk-GW3SCCZG.js → chunk-Z3OHK6QT.js} +153 -110
- package/dist/{chunk-OMJJM3KM.js → chunk-ZVL7TY4K.js} +287 -130
- package/dist/{contracts-DBdg9J_a.d.ts → contracts-CLqzJnOV.d.ts} +36 -17
- package/dist/{contracts-DBdg9J_a.d.cts → contracts-CTOJXu-x.d.cts} +36 -17
- package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
- package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
- package/dist/data.cjs +410 -155
- package/dist/data.d.cts +166 -12
- package/dist/data.d.ts +166 -12
- package/dist/data.js +12 -9
- package/dist/devtools.cjs +98 -61
- package/dist/devtools.js +7 -8
- package/dist/dispose-GEIG2KOF.js +28 -0
- package/dist/ecosystem.cjs +372 -126
- package/dist/ecosystem.d.cts +20 -3
- package/dist/ecosystem.d.ts +20 -3
- package/dist/ecosystem.js +12 -12
- package/dist/extras.cjs +2366 -909
- package/dist/extras.d.cts +11 -9
- package/dist/extras.d.ts +11 -9
- package/dist/extras.js +39 -28
- package/dist/index.cjs +421 -158
- package/dist/index.d.cts +213 -171
- package/dist/index.d.ts +213 -171
- package/dist/index.js +24 -27
- package/dist/motion.cjs +118 -44
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +344 -53
- package/dist/patterns.d.cts +28 -9
- package/dist/patterns.d.ts +28 -9
- package/dist/patterns.js +8 -8
- package/dist/performance.cjs +325 -220
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +8 -9
- package/dist/plugin-DVgSnTfK.d.cts +112 -0
- package/dist/plugin-DVgSnTfK.d.ts +112 -0
- package/dist/plugins.cjs +664 -233
- package/dist/plugins.d.cts +127 -14
- package/dist/plugins.d.ts +127 -14
- package/dist/plugins.js +96 -42
- package/dist/signal-EotCj4hS.d.cts +110 -0
- package/dist/signal-EotCj4hS.d.ts +110 -0
- package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
- package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
- package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
- package/dist/ssr.cjs +229 -84
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +11 -12
- package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
- package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
- package/dist/tagFactory-8qL9LCIx.d.cts +156 -0
- package/dist/tagFactory-BL2fymez.d.ts +156 -0
- package/dist/testing.cjs +2503 -2191
- package/dist/testing.d.cts +56 -5
- package/dist/testing.d.ts +56 -5
- package/dist/testing.js +580 -307
- package/dist/types-CJFViL6Q.d.cts +26 -0
- package/dist/types-CJFViL6Q.d.ts +26 -0
- package/dist/ui.cjs +732 -329
- package/dist/ui.d.cts +41 -7
- package/dist/ui.d.ts +41 -7
- package/dist/ui.js +151 -56
- package/dist/widgets.cjs +267 -291
- package/dist/widgets.js +9 -10
- package/package.json +4 -2
- package/dist/chunk-2WLZ6757.js +0 -149
- package/dist/chunk-CCSJMTRN.js +0 -15
- package/dist/chunk-QKRPLZ2V.js +0 -108
- package/dist/chunk-VUF4ALSW.js +0 -60
- package/dist/chunk-WWV3SJ3L.js +0 -131
- package/dist/dispose-46BOMMQJ.js +0 -19
- package/dist/plugin-D30wlGW5.d.cts +0 -71
- package/dist/plugin-D30wlGW5.d.ts +0 -71
- package/dist/tagFactory-DVoDpHye.d.cts +0 -215
- package/dist/tagFactory-DVoDpHye.d.ts +0 -215
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { C as Component } from './types-CJFViL6Q.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Higher-order component utilities for SibuJS.
|
|
3
5
|
* These functions wrap or compose components to add behavior.
|
|
6
|
+
*
|
|
7
|
+
* Each helper is generic over the wrapped component's root type `R`, so a
|
|
8
|
+
* component returning `div()` keeps its `HTMLDivElement` root and an SVG
|
|
9
|
+
* component works as well. `R` defaults to `HTMLElement`, the type these
|
|
10
|
+
* helpers used before, for callers that pass the type arguments explicitly.
|
|
4
11
|
*/
|
|
5
|
-
|
|
12
|
+
|
|
6
13
|
/**
|
|
7
14
|
* Wraps a component with additional behavior that runs before/after rendering.
|
|
8
15
|
*
|
|
@@ -18,7 +25,7 @@ type Component<P = unknown> = (props: P) => HTMLElement;
|
|
|
18
25
|
* });
|
|
19
26
|
* ```
|
|
20
27
|
*/
|
|
21
|
-
declare function withWrapper<P>(WrappedComponent: Component<P>, wrapper: (component: Component<P>, props: P) =>
|
|
28
|
+
declare function withWrapper<P, R extends Node = HTMLElement, W extends Node = R>(WrappedComponent: Component<P, R>, wrapper: (component: Component<P, R>, props: P) => W): Component<P, W>;
|
|
22
29
|
/**
|
|
23
30
|
* Adds default props to a component. Missing props are filled from defaults.
|
|
24
31
|
*
|
|
@@ -32,7 +39,15 @@ declare function withWrapper<P>(WrappedComponent: Component<P>, wrapper: (compon
|
|
|
32
39
|
* Button("Click"); // type="button", disabled=false automatically
|
|
33
40
|
* ```
|
|
34
41
|
*/
|
|
35
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Props accepted by a {@link withDefaults} component: every key that has a
|
|
44
|
+
* default becomes optional; every other key keeps its original required or
|
|
45
|
+
* optional status.
|
|
46
|
+
*/
|
|
47
|
+
type WithDefaultsProps<P, D> = Omit<P, keyof D> & Partial<Pick<P, Extract<keyof P, keyof D>>>;
|
|
48
|
+
declare function withDefaults<P extends object, const D extends Partial<P> = Partial<P>, R extends Node = HTMLElement>(component: Component<P, R>, defaults: D & {
|
|
49
|
+
[K in Exclude<keyof D, keyof P>]: never;
|
|
50
|
+
}): Component<WithDefaultsProps<P, D>, R>;
|
|
36
51
|
/**
|
|
37
52
|
* Composes multiple HOC wrappers into a single wrapper.
|
|
38
53
|
* Applied from right to left (like function composition).
|
|
@@ -46,7 +61,7 @@ declare function withDefaults<P extends object>(component: Component<P>, default
|
|
|
46
61
|
* const EnhancedPage = enhance(Page);
|
|
47
62
|
* ```
|
|
48
63
|
*/
|
|
49
|
-
declare function compose(...wrappers: Array<(component:
|
|
64
|
+
declare function compose<C extends Component<never, Node> = Component<unknown, HTMLElement>>(...wrappers: Array<(component: C) => C>): (component: C) => C;
|
|
50
65
|
|
|
51
66
|
/**
|
|
52
67
|
* RenderProp implements the render-prop pattern.
|
|
@@ -75,6 +90,7 @@ declare function createSlots(slots: Record<string, () => HTMLElement | HTMLEleme
|
|
|
75
90
|
* Provides utilities to define typed components with prop defaults,
|
|
76
91
|
* nodes slots, and prop mapping — all with full TypeScript inference.
|
|
77
92
|
*/
|
|
93
|
+
|
|
78
94
|
/**
|
|
79
95
|
* Extract the props type from a component defined with defineComponent.
|
|
80
96
|
*
|
|
@@ -86,7 +102,7 @@ declare function createSlots(slots: Record<string, () => HTMLElement | HTMLEleme
|
|
|
86
102
|
* type ButtonProps = ComponentProps<typeof Button>; // { label: string }
|
|
87
103
|
* ```
|
|
88
104
|
*/
|
|
89
|
-
type ComponentProps<T> = T extends (props: infer P) =>
|
|
105
|
+
type ComponentProps<T> = T extends (props: infer P) => Node ? P : never;
|
|
90
106
|
/**
|
|
91
107
|
* Props that include an optional nodes slot.
|
|
92
108
|
*/
|
|
@@ -96,11 +112,14 @@ type WithNodes<Props> = Props & {
|
|
|
96
112
|
/**
|
|
97
113
|
* Define a typed component with props inference, defaults, and a setup function.
|
|
98
114
|
*
|
|
99
|
-
* The `setup` function receives merged props (defaults + provided) and
|
|
100
|
-
*
|
|
115
|
+
* The `setup` function receives merged props (defaults + provided) and
|
|
116
|
+
* returns the component's root. TypeScript infers the full props type from the
|
|
117
|
+
* generic. `R` is the root type; it defaults to `HTMLElement` (every HTML tag
|
|
118
|
+
* factory's result fits) — pass it explicitly for an SVG root
|
|
119
|
+
* (`defineComponent<Props, SVGSVGElement>`).
|
|
101
120
|
*
|
|
102
121
|
* @param config Component configuration with optional defaults and a setup function
|
|
103
|
-
* @returns A component function that accepts props and returns
|
|
122
|
+
* @returns A component function that accepts props and returns the root
|
|
104
123
|
*
|
|
105
124
|
* @example
|
|
106
125
|
* ```ts
|
|
@@ -117,10 +136,10 @@ type WithNodes<Props> = Props & {
|
|
|
117
136
|
* // Usage: Button({ label: 'Click me' }) — TypeScript infers props
|
|
118
137
|
* ```
|
|
119
138
|
*/
|
|
120
|
-
declare function defineComponent<Props extends object>(config: {
|
|
139
|
+
declare function defineComponent<Props extends object, R extends Node = HTMLElement>(config: {
|
|
121
140
|
defaults?: Partial<Props>;
|
|
122
|
-
setup: (props: Props) =>
|
|
123
|
-
}):
|
|
141
|
+
setup: (props: Props) => R;
|
|
142
|
+
}): Component<Props, R>;
|
|
124
143
|
/**
|
|
125
144
|
* Create a component with nodes slot support.
|
|
126
145
|
*
|
|
@@ -129,7 +148,7 @@ declare function defineComponent<Props extends object>(config: {
|
|
|
129
148
|
* wraps arbitrary child content.
|
|
130
149
|
*
|
|
131
150
|
* @param config Component configuration with optional defaults and a setup function
|
|
132
|
-
* @returns A component function that accepts props (including nodes) and returns
|
|
151
|
+
* @returns A component function that accepts props (including nodes) and returns the root
|
|
133
152
|
*
|
|
134
153
|
* @example
|
|
135
154
|
* ```ts
|
|
@@ -148,10 +167,10 @@ declare function defineComponent<Props extends object>(config: {
|
|
|
148
167
|
* // Usage: Card({ title: 'Hello', nodes: p('World') })
|
|
149
168
|
* ```
|
|
150
169
|
*/
|
|
151
|
-
declare function defineSlottedComponent<Props extends object>(config: {
|
|
170
|
+
declare function defineSlottedComponent<Props extends object, R extends Node = HTMLElement>(config: {
|
|
152
171
|
defaults?: Partial<Props>;
|
|
153
|
-
setup: (props: WithNodes<Props>) =>
|
|
154
|
-
}):
|
|
172
|
+
setup: (props: WithNodes<Props>) => R;
|
|
173
|
+
}): Component<WithNodes<Props>, R>;
|
|
155
174
|
/**
|
|
156
175
|
* Higher-order helper to create a component that maps outer props to inner props.
|
|
157
176
|
*
|
|
@@ -177,7 +196,7 @@ declare function defineSlottedComponent<Props extends object>(config: {
|
|
|
177
196
|
* // Usage: SmallIconButton({ icon: 'star', label: 'Favorite' })
|
|
178
197
|
* ```
|
|
179
198
|
*/
|
|
180
|
-
declare function withProps<OuterProps extends object, InnerProps extends object>(component:
|
|
199
|
+
declare function withProps<OuterProps extends object, InnerProps extends object, R extends Node = HTMLElement>(component: Component<InnerProps, R>, mapProps: (outer: OuterProps) => InnerProps): Component<OuterProps, R>;
|
|
181
200
|
|
|
182
201
|
/**
|
|
183
202
|
* Runtime prop validation and strict typing contracts for SibuJS.
|
|
@@ -257,4 +276,4 @@ declare function assertType<T>(value: unknown, validator: Validator<T>, label?:
|
|
|
257
276
|
*/
|
|
258
277
|
declare function createGuard<T>(validator: Validator<T>): (value: unknown) => value is T;
|
|
259
278
|
|
|
260
|
-
export { type ComponentProps as C, type PropDef as P, RenderProp as R, type Validator as V, type PropSchema as a, assertType as b, compose as c, createGuard as d, createSlots as e, defineComponent as f, defineSlottedComponent as g, defineStrictComponent as h, validators as i, withDefaults as j, withProps as k, withWrapper as l, validateProps as v, withBoundary as w };
|
|
279
|
+
export { type ComponentProps as C, type PropDef as P, RenderProp as R, type Validator as V, type WithDefaultsProps as W, type PropSchema as a, assertType as b, compose as c, createGuard as d, createSlots as e, defineComponent as f, defineSlottedComponent as g, defineStrictComponent as h, validators as i, withDefaults as j, withProps as k, withWrapper as l, validateProps as v, withBoundary as w };
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { C as Component } from './types-CJFViL6Q.cjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Higher-order component utilities for SibuJS.
|
|
3
5
|
* These functions wrap or compose components to add behavior.
|
|
6
|
+
*
|
|
7
|
+
* Each helper is generic over the wrapped component's root type `R`, so a
|
|
8
|
+
* component returning `div()` keeps its `HTMLDivElement` root and an SVG
|
|
9
|
+
* component works as well. `R` defaults to `HTMLElement`, the type these
|
|
10
|
+
* helpers used before, for callers that pass the type arguments explicitly.
|
|
4
11
|
*/
|
|
5
|
-
|
|
12
|
+
|
|
6
13
|
/**
|
|
7
14
|
* Wraps a component with additional behavior that runs before/after rendering.
|
|
8
15
|
*
|
|
@@ -18,7 +25,7 @@ type Component<P = unknown> = (props: P) => HTMLElement;
|
|
|
18
25
|
* });
|
|
19
26
|
* ```
|
|
20
27
|
*/
|
|
21
|
-
declare function withWrapper<P>(WrappedComponent: Component<P>, wrapper: (component: Component<P>, props: P) =>
|
|
28
|
+
declare function withWrapper<P, R extends Node = HTMLElement, W extends Node = R>(WrappedComponent: Component<P, R>, wrapper: (component: Component<P, R>, props: P) => W): Component<P, W>;
|
|
22
29
|
/**
|
|
23
30
|
* Adds default props to a component. Missing props are filled from defaults.
|
|
24
31
|
*
|
|
@@ -32,7 +39,15 @@ declare function withWrapper<P>(WrappedComponent: Component<P>, wrapper: (compon
|
|
|
32
39
|
* Button("Click"); // type="button", disabled=false automatically
|
|
33
40
|
* ```
|
|
34
41
|
*/
|
|
35
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Props accepted by a {@link withDefaults} component: every key that has a
|
|
44
|
+
* default becomes optional; every other key keeps its original required or
|
|
45
|
+
* optional status.
|
|
46
|
+
*/
|
|
47
|
+
type WithDefaultsProps<P, D> = Omit<P, keyof D> & Partial<Pick<P, Extract<keyof P, keyof D>>>;
|
|
48
|
+
declare function withDefaults<P extends object, const D extends Partial<P> = Partial<P>, R extends Node = HTMLElement>(component: Component<P, R>, defaults: D & {
|
|
49
|
+
[K in Exclude<keyof D, keyof P>]: never;
|
|
50
|
+
}): Component<WithDefaultsProps<P, D>, R>;
|
|
36
51
|
/**
|
|
37
52
|
* Composes multiple HOC wrappers into a single wrapper.
|
|
38
53
|
* Applied from right to left (like function composition).
|
|
@@ -46,7 +61,7 @@ declare function withDefaults<P extends object>(component: Component<P>, default
|
|
|
46
61
|
* const EnhancedPage = enhance(Page);
|
|
47
62
|
* ```
|
|
48
63
|
*/
|
|
49
|
-
declare function compose(...wrappers: Array<(component:
|
|
64
|
+
declare function compose<C extends Component<never, Node> = Component<unknown, HTMLElement>>(...wrappers: Array<(component: C) => C>): (component: C) => C;
|
|
50
65
|
|
|
51
66
|
/**
|
|
52
67
|
* RenderProp implements the render-prop pattern.
|
|
@@ -75,6 +90,7 @@ declare function createSlots(slots: Record<string, () => HTMLElement | HTMLEleme
|
|
|
75
90
|
* Provides utilities to define typed components with prop defaults,
|
|
76
91
|
* nodes slots, and prop mapping — all with full TypeScript inference.
|
|
77
92
|
*/
|
|
93
|
+
|
|
78
94
|
/**
|
|
79
95
|
* Extract the props type from a component defined with defineComponent.
|
|
80
96
|
*
|
|
@@ -86,7 +102,7 @@ declare function createSlots(slots: Record<string, () => HTMLElement | HTMLEleme
|
|
|
86
102
|
* type ButtonProps = ComponentProps<typeof Button>; // { label: string }
|
|
87
103
|
* ```
|
|
88
104
|
*/
|
|
89
|
-
type ComponentProps<T> = T extends (props: infer P) =>
|
|
105
|
+
type ComponentProps<T> = T extends (props: infer P) => Node ? P : never;
|
|
90
106
|
/**
|
|
91
107
|
* Props that include an optional nodes slot.
|
|
92
108
|
*/
|
|
@@ -96,11 +112,14 @@ type WithNodes<Props> = Props & {
|
|
|
96
112
|
/**
|
|
97
113
|
* Define a typed component with props inference, defaults, and a setup function.
|
|
98
114
|
*
|
|
99
|
-
* The `setup` function receives merged props (defaults + provided) and
|
|
100
|
-
*
|
|
115
|
+
* The `setup` function receives merged props (defaults + provided) and
|
|
116
|
+
* returns the component's root. TypeScript infers the full props type from the
|
|
117
|
+
* generic. `R` is the root type; it defaults to `HTMLElement` (every HTML tag
|
|
118
|
+
* factory's result fits) — pass it explicitly for an SVG root
|
|
119
|
+
* (`defineComponent<Props, SVGSVGElement>`).
|
|
101
120
|
*
|
|
102
121
|
* @param config Component configuration with optional defaults and a setup function
|
|
103
|
-
* @returns A component function that accepts props and returns
|
|
122
|
+
* @returns A component function that accepts props and returns the root
|
|
104
123
|
*
|
|
105
124
|
* @example
|
|
106
125
|
* ```ts
|
|
@@ -117,10 +136,10 @@ type WithNodes<Props> = Props & {
|
|
|
117
136
|
* // Usage: Button({ label: 'Click me' }) — TypeScript infers props
|
|
118
137
|
* ```
|
|
119
138
|
*/
|
|
120
|
-
declare function defineComponent<Props extends object>(config: {
|
|
139
|
+
declare function defineComponent<Props extends object, R extends Node = HTMLElement>(config: {
|
|
121
140
|
defaults?: Partial<Props>;
|
|
122
|
-
setup: (props: Props) =>
|
|
123
|
-
}):
|
|
141
|
+
setup: (props: Props) => R;
|
|
142
|
+
}): Component<Props, R>;
|
|
124
143
|
/**
|
|
125
144
|
* Create a component with nodes slot support.
|
|
126
145
|
*
|
|
@@ -129,7 +148,7 @@ declare function defineComponent<Props extends object>(config: {
|
|
|
129
148
|
* wraps arbitrary child content.
|
|
130
149
|
*
|
|
131
150
|
* @param config Component configuration with optional defaults and a setup function
|
|
132
|
-
* @returns A component function that accepts props (including nodes) and returns
|
|
151
|
+
* @returns A component function that accepts props (including nodes) and returns the root
|
|
133
152
|
*
|
|
134
153
|
* @example
|
|
135
154
|
* ```ts
|
|
@@ -148,10 +167,10 @@ declare function defineComponent<Props extends object>(config: {
|
|
|
148
167
|
* // Usage: Card({ title: 'Hello', nodes: p('World') })
|
|
149
168
|
* ```
|
|
150
169
|
*/
|
|
151
|
-
declare function defineSlottedComponent<Props extends object>(config: {
|
|
170
|
+
declare function defineSlottedComponent<Props extends object, R extends Node = HTMLElement>(config: {
|
|
152
171
|
defaults?: Partial<Props>;
|
|
153
|
-
setup: (props: WithNodes<Props>) =>
|
|
154
|
-
}):
|
|
172
|
+
setup: (props: WithNodes<Props>) => R;
|
|
173
|
+
}): Component<WithNodes<Props>, R>;
|
|
155
174
|
/**
|
|
156
175
|
* Higher-order helper to create a component that maps outer props to inner props.
|
|
157
176
|
*
|
|
@@ -177,7 +196,7 @@ declare function defineSlottedComponent<Props extends object>(config: {
|
|
|
177
196
|
* // Usage: SmallIconButton({ icon: 'star', label: 'Favorite' })
|
|
178
197
|
* ```
|
|
179
198
|
*/
|
|
180
|
-
declare function withProps<OuterProps extends object, InnerProps extends object>(component:
|
|
199
|
+
declare function withProps<OuterProps extends object, InnerProps extends object, R extends Node = HTMLElement>(component: Component<InnerProps, R>, mapProps: (outer: OuterProps) => InnerProps): Component<OuterProps, R>;
|
|
181
200
|
|
|
182
201
|
/**
|
|
183
202
|
* Runtime prop validation and strict typing contracts for SibuJS.
|
|
@@ -257,4 +276,4 @@ declare function assertType<T>(value: unknown, validator: Validator<T>, label?:
|
|
|
257
276
|
*/
|
|
258
277
|
declare function createGuard<T>(validator: Validator<T>): (value: unknown) => value is T;
|
|
259
278
|
|
|
260
|
-
export { type ComponentProps as C, type PropDef as P, RenderProp as R, type Validator as V, type PropSchema as a, assertType as b, compose as c, createGuard as d, createSlots as e, defineComponent as f, defineSlottedComponent as g, defineStrictComponent as h, validators as i, withDefaults as j, withProps as k, withWrapper as l, validateProps as v, withBoundary as w };
|
|
279
|
+
export { type ComponentProps as C, type PropDef as P, RenderProp as R, type Validator as V, type WithDefaultsProps as W, type PropSchema as a, assertType as b, compose as c, createGuard as d, createSlots as e, defineComponent as f, defineSlottedComponent as g, defineStrictComponent as h, validators as i, withDefaults as j, withProps as k, withWrapper as l, validateProps as v, withBoundary as w };
|
|
@@ -28,6 +28,16 @@ interface FormReturn<T extends object> {
|
|
|
28
28
|
handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: Event) => void;
|
|
29
29
|
reset: () => void;
|
|
30
30
|
setError: (field: keyof T, message: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Release the form's derived graph: every field `error` and the `errors`,
|
|
33
|
+
* `isValid`, `isDirty`, `touched` and `values` aggregates. Call it when the
|
|
34
|
+
* form's owner goes away, e.g. `onCleanup(f.dispose, formElement)`.
|
|
35
|
+
*
|
|
36
|
+
* Afterwards the derived accessors are inert — they return their last
|
|
37
|
+
* settled values and never recompute — while field `value()`/`set()` keep
|
|
38
|
+
* working as plain signals. Idempotent.
|
|
39
|
+
*/
|
|
40
|
+
dispose: () => void;
|
|
31
41
|
}
|
|
32
42
|
/**
|
|
33
43
|
* Require a non-empty value. Rejects `null`, `undefined`, `""` and `[]`.
|
|
@@ -239,6 +249,12 @@ declare function FocusTrap(nodes: HTMLElement, options?: {
|
|
|
239
249
|
* Supports two calling styles:
|
|
240
250
|
* - String combo: hotkey("ctrl+shift+z", handler)
|
|
241
251
|
* - Explicit flags: hotkey("z", handler, { ctrl: true, shift: true })
|
|
252
|
+
*
|
|
253
|
+
* Combo modifiers: `ctrl`/`control`, `shift`, `alt`/`option`,
|
|
254
|
+
* `meta`/`cmd`/`command`, and `mod` — Cmd on Apple platforms, Ctrl
|
|
255
|
+
* everywhere else. An unknown modifier throws, because dropping it would
|
|
256
|
+
* make the shortcut fire on the bare key. The `+` key is written as a
|
|
257
|
+
* trailing plus: `hotkey("+", h)`, `hotkey("ctrl++", h)`.
|
|
242
258
|
*/
|
|
243
259
|
declare function hotkey(combo: string, handler: (e: KeyboardEvent) => void, options?: {
|
|
244
260
|
ctrl?: boolean;
|
|
@@ -452,6 +468,11 @@ declare function pagination(options: {
|
|
|
452
468
|
/**
|
|
453
469
|
* eventBus creates a typed publish/subscribe event system.
|
|
454
470
|
* No reactive state needed -- pure event dispatching.
|
|
471
|
+
*
|
|
472
|
+
* `emit()` delivers to the handlers registered when it starts. A throwing
|
|
473
|
+
* handler is reported through the runtime error pipeline and the remaining
|
|
474
|
+
* handlers still run. Handlers added during delivery receive the next event;
|
|
475
|
+
* handlers removed (or cleared) during delivery are skipped for the rest of it.
|
|
455
476
|
*/
|
|
456
477
|
declare function eventBus<T extends object>(): {
|
|
457
478
|
on: <K extends keyof T>(event: K, handler: (data: T[K]) => void) => () => void;
|
|
@@ -28,6 +28,16 @@ interface FormReturn<T extends object> {
|
|
|
28
28
|
handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: Event) => void;
|
|
29
29
|
reset: () => void;
|
|
30
30
|
setError: (field: keyof T, message: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Release the form's derived graph: every field `error` and the `errors`,
|
|
33
|
+
* `isValid`, `isDirty`, `touched` and `values` aggregates. Call it when the
|
|
34
|
+
* form's owner goes away, e.g. `onCleanup(f.dispose, formElement)`.
|
|
35
|
+
*
|
|
36
|
+
* Afterwards the derived accessors are inert — they return their last
|
|
37
|
+
* settled values and never recompute — while field `value()`/`set()` keep
|
|
38
|
+
* working as plain signals. Idempotent.
|
|
39
|
+
*/
|
|
40
|
+
dispose: () => void;
|
|
31
41
|
}
|
|
32
42
|
/**
|
|
33
43
|
* Require a non-empty value. Rejects `null`, `undefined`, `""` and `[]`.
|
|
@@ -239,6 +249,12 @@ declare function FocusTrap(nodes: HTMLElement, options?: {
|
|
|
239
249
|
* Supports two calling styles:
|
|
240
250
|
* - String combo: hotkey("ctrl+shift+z", handler)
|
|
241
251
|
* - Explicit flags: hotkey("z", handler, { ctrl: true, shift: true })
|
|
252
|
+
*
|
|
253
|
+
* Combo modifiers: `ctrl`/`control`, `shift`, `alt`/`option`,
|
|
254
|
+
* `meta`/`cmd`/`command`, and `mod` — Cmd on Apple platforms, Ctrl
|
|
255
|
+
* everywhere else. An unknown modifier throws, because dropping it would
|
|
256
|
+
* make the shortcut fire on the bare key. The `+` key is written as a
|
|
257
|
+
* trailing plus: `hotkey("+", h)`, `hotkey("ctrl++", h)`.
|
|
242
258
|
*/
|
|
243
259
|
declare function hotkey(combo: string, handler: (e: KeyboardEvent) => void, options?: {
|
|
244
260
|
ctrl?: boolean;
|
|
@@ -452,6 +468,11 @@ declare function pagination(options: {
|
|
|
452
468
|
/**
|
|
453
469
|
* eventBus creates a typed publish/subscribe event system.
|
|
454
470
|
* No reactive state needed -- pure event dispatching.
|
|
471
|
+
*
|
|
472
|
+
* `emit()` delivers to the handlers registered when it starts. A throwing
|
|
473
|
+
* handler is reported through the runtime error pipeline and the remaining
|
|
474
|
+
* handlers still run. Handlers added during delivery receive the next event;
|
|
475
|
+
* handlers removed (or cleared) during delivery are skipped for the rest of it.
|
|
455
476
|
*/
|
|
456
477
|
declare function eventBus<T extends object>(): {
|
|
457
478
|
on: <K extends keyof T>(event: K, handler: (data: T[K]) => void) => () => void;
|