sibujs 1.2.0 → 1.3.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.
Files changed (89) hide show
  1. package/README.md +29 -25
  2. package/dist/browser.cjs +804 -2
  3. package/dist/browser.d.cts +591 -1
  4. package/dist/browser.d.ts +591 -1
  5. package/dist/browser.js +50 -8
  6. package/dist/build.cjs +654 -144
  7. package/dist/build.js +14 -12
  8. package/dist/cdn.global.js +188 -7
  9. package/dist/chunk-2BYQDGN3.js +742 -0
  10. package/dist/chunk-32DY64NT.js +282 -0
  11. package/dist/chunk-3AIRKM3B.js +1263 -0
  12. package/dist/chunk-3X2YG6YM.js +505 -0
  13. package/dist/chunk-5X6PP2UK.js +28 -0
  14. package/dist/chunk-77L6NL3X.js +1097 -0
  15. package/dist/chunk-BGN5ZMP4.js +26 -0
  16. package/dist/chunk-BTU3TJDS.js +365 -0
  17. package/dist/chunk-CHF5OHIA.js +61 -0
  18. package/dist/chunk-CMBFNA7L.js +27 -0
  19. package/dist/chunk-DAHRH4ON.js +331 -0
  20. package/dist/chunk-EBGIRKQY.js +616 -0
  21. package/dist/chunk-EUZND3CB.js +27 -0
  22. package/dist/chunk-F3FA4F32.js +292 -0
  23. package/dist/chunk-JAKHTMQU.js +1000 -0
  24. package/dist/chunk-JCI5M6U6.js +956 -0
  25. package/dist/chunk-KQPDEVVS.js +398 -0
  26. package/dist/chunk-NEKUBFPT.js +60 -0
  27. package/dist/chunk-NYVAC6P5.js +37 -0
  28. package/dist/chunk-PTQJDMRT.js +146 -0
  29. package/dist/chunk-QWZG56ET.js +2744 -0
  30. package/dist/chunk-TSOKIX5Z.js +654 -0
  31. package/dist/chunk-VRW3FULF.js +725 -0
  32. package/dist/chunk-WZSPOOER.js +84 -0
  33. package/dist/chunk-YT6HQ6AM.js +14 -0
  34. package/dist/chunk-ZD6OAMTH.js +277 -0
  35. package/dist/contracts-DDrwxvJ-.d.cts +245 -0
  36. package/dist/contracts-DDrwxvJ-.d.ts +245 -0
  37. package/dist/data.cjs +35 -2
  38. package/dist/data.d.cts +7 -0
  39. package/dist/data.d.ts +7 -0
  40. package/dist/data.js +9 -8
  41. package/dist/devtools.cjs +122 -0
  42. package/dist/devtools.d.cts +69 -461
  43. package/dist/devtools.d.ts +69 -461
  44. package/dist/devtools.js +127 -6
  45. package/dist/ecosystem.cjs +23 -6
  46. package/dist/ecosystem.d.cts +1 -1
  47. package/dist/ecosystem.d.ts +1 -1
  48. package/dist/ecosystem.js +10 -9
  49. package/dist/extras.cjs +1207 -65
  50. package/dist/extras.d.cts +5 -5
  51. package/dist/extras.d.ts +5 -5
  52. package/dist/extras.js +69 -24
  53. package/dist/index.cjs +663 -144
  54. package/dist/index.d.cts +397 -17
  55. package/dist/index.d.ts +397 -17
  56. package/dist/index.js +39 -17
  57. package/dist/introspect-BumjnBKr.d.cts +477 -0
  58. package/dist/introspect-CZrlcaYy.d.ts +477 -0
  59. package/dist/introspect-Cb0zgpi2.d.cts +477 -0
  60. package/dist/introspect-Y2xNXGSf.d.ts +477 -0
  61. package/dist/motion.js +4 -4
  62. package/dist/patterns.cjs +51 -2
  63. package/dist/patterns.d.cts +18 -8
  64. package/dist/patterns.d.ts +18 -8
  65. package/dist/patterns.js +7 -7
  66. package/dist/performance.js +4 -4
  67. package/dist/plugins.cjs +428 -81
  68. package/dist/plugins.d.cts +27 -4
  69. package/dist/plugins.d.ts +27 -4
  70. package/dist/plugins.js +156 -37
  71. package/dist/ssr-4PBXAOO3.js +40 -0
  72. package/dist/ssr-Do_SiVoL.d.cts +201 -0
  73. package/dist/ssr-Do_SiVoL.d.ts +201 -0
  74. package/dist/ssr.cjs +312 -60
  75. package/dist/ssr.d.cts +10 -1
  76. package/dist/ssr.d.ts +10 -1
  77. package/dist/ssr.js +13 -10
  78. package/dist/tagFactory-DaJ0YWX6.d.cts +47 -0
  79. package/dist/tagFactory-DaJ0YWX6.d.ts +47 -0
  80. package/dist/testing.cjs +233 -2
  81. package/dist/testing.d.cts +42 -1
  82. package/dist/testing.d.ts +42 -1
  83. package/dist/testing.js +129 -2
  84. package/dist/ui.cjs +374 -3
  85. package/dist/ui.d.cts +252 -2
  86. package/dist/ui.d.ts +252 -2
  87. package/dist/ui.js +328 -8
  88. package/dist/widgets.js +7 -7
  89. package/package.json +1 -1
@@ -0,0 +1,84 @@
1
+ import {
2
+ drainNotificationQueue,
3
+ notifySubscribers,
4
+ queueSignalNotification,
5
+ recordDependency
6
+ } from "./chunk-ZD6OAMTH.js";
7
+ import {
8
+ isDev
9
+ } from "./chunk-5X6PP2UK.js";
10
+
11
+ // src/reactivity/batch.ts
12
+ var batchDepth = 0;
13
+ var pendingSignals = /* @__PURE__ */ new Set();
14
+ function batch(fn) {
15
+ batchDepth++;
16
+ try {
17
+ return fn();
18
+ } finally {
19
+ batchDepth--;
20
+ if (batchDepth === 0) {
21
+ flushBatch();
22
+ }
23
+ }
24
+ }
25
+ function enqueueBatchedSignal(signal2) {
26
+ if (batchDepth === 0) return false;
27
+ pendingSignals.add(signal2);
28
+ return true;
29
+ }
30
+ function isBatching() {
31
+ return batchDepth > 0;
32
+ }
33
+ function flushBatch() {
34
+ for (const signal2 of pendingSignals) {
35
+ queueSignalNotification(signal2);
36
+ }
37
+ pendingSignals.clear();
38
+ drainNotificationQueue();
39
+ }
40
+
41
+ // src/core/signals/signal.ts
42
+ var _g = globalThis;
43
+ var _isDev = isDev();
44
+ function signal(initial, options) {
45
+ const state = { value: initial };
46
+ const debugName = _isDev ? options?.name : void 0;
47
+ const equalsFn = options?.equals;
48
+ if (debugName) {
49
+ state.__name = debugName;
50
+ }
51
+ function get() {
52
+ recordDependency(state);
53
+ return state.value;
54
+ }
55
+ get.__signal = state;
56
+ if (debugName) get.__name = debugName;
57
+ function set(next) {
58
+ const newValue = typeof next === "function" ? next(state.value) : next;
59
+ if (equalsFn ? equalsFn(state.value, newValue) : Object.is(newValue, state.value)) return;
60
+ if (_isDev) {
61
+ const oldValue = state.value;
62
+ state.value = newValue;
63
+ const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
64
+ if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue, newValue });
65
+ } else {
66
+ state.value = newValue;
67
+ }
68
+ if (!enqueueBatchedSignal(state)) {
69
+ notifySubscribers(state);
70
+ }
71
+ }
72
+ if (_isDev) {
73
+ const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
74
+ if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
75
+ }
76
+ return [get, set];
77
+ }
78
+
79
+ export {
80
+ batch,
81
+ enqueueBatchedSignal,
82
+ isBatching,
83
+ signal
84
+ };
@@ -0,0 +1,14 @@
1
+ // src/core/rendering/createId.ts
2
+ var idCounter = 0;
3
+ function createId(prefix = "sibu") {
4
+ idCounter++;
5
+ return `${prefix}-${idCounter}`;
6
+ }
7
+ function __resetIdCounter() {
8
+ idCounter = 0;
9
+ }
10
+
11
+ export {
12
+ createId,
13
+ __resetIdCounter
14
+ };
@@ -0,0 +1,277 @@
1
+ import {
2
+ devWarn,
3
+ isDev
4
+ } from "./chunk-5X6PP2UK.js";
5
+
6
+ // src/reactivity/track.ts
7
+ var _isDev = isDev();
8
+ var subscriberStack = new Array(32);
9
+ var stackCapacity = 32;
10
+ var stackTop = -1;
11
+ var currentSubscriber = null;
12
+ var signalSubscribers = /* @__PURE__ */ new WeakMap();
13
+ var SUBS = "__s";
14
+ var notifyDepth = 0;
15
+ var pendingQueue = [];
16
+ var pendingSet = /* @__PURE__ */ new Set();
17
+ function safeInvoke(sub) {
18
+ try {
19
+ sub();
20
+ } catch (err) {
21
+ if (_isDev) devWarn(`Subscriber threw during notification: ${err instanceof Error ? err.message : String(err)}`);
22
+ }
23
+ }
24
+ var suspendDepth = 0;
25
+ var trackingSuspended = false;
26
+ function track(effectFn, subscriber) {
27
+ if (!subscriber) subscriber = effectFn;
28
+ cleanup(subscriber);
29
+ ++stackTop;
30
+ if (stackTop >= stackCapacity) {
31
+ stackCapacity *= 2;
32
+ subscriberStack.length = stackCapacity;
33
+ }
34
+ subscriberStack[stackTop] = subscriber;
35
+ currentSubscriber = subscriber;
36
+ try {
37
+ effectFn();
38
+ } finally {
39
+ stackTop--;
40
+ currentSubscriber = stackTop >= 0 ? subscriberStack[stackTop] : null;
41
+ }
42
+ return () => cleanup(subscriber);
43
+ }
44
+ function suspendTracking() {
45
+ if (suspendDepth === 0) {
46
+ ++stackTop;
47
+ if (stackTop >= stackCapacity) {
48
+ stackCapacity *= 2;
49
+ subscriberStack.length = stackCapacity;
50
+ }
51
+ subscriberStack[stackTop] = null;
52
+ currentSubscriber = null;
53
+ trackingSuspended = true;
54
+ }
55
+ suspendDepth++;
56
+ }
57
+ function resumeTracking() {
58
+ suspendDepth--;
59
+ if (suspendDepth === 0) {
60
+ stackTop--;
61
+ currentSubscriber = stackTop >= 0 ? subscriberStack[stackTop] : null;
62
+ trackingSuspended = false;
63
+ }
64
+ }
65
+ function untracked(fn) {
66
+ suspendTracking();
67
+ try {
68
+ return fn();
69
+ } finally {
70
+ resumeTracking();
71
+ }
72
+ }
73
+ function recordDependency(signal) {
74
+ if (!currentSubscriber) return;
75
+ const sub = currentSubscriber;
76
+ if (sub._dep === signal) return;
77
+ const deps = sub._deps;
78
+ if (deps) {
79
+ if (deps.has(signal)) return;
80
+ deps.add(signal);
81
+ } else if (sub._dep !== void 0) {
82
+ const set = /* @__PURE__ */ new Set();
83
+ set.add(sub._dep);
84
+ set.add(signal);
85
+ sub._deps = set;
86
+ sub._dep = void 0;
87
+ } else {
88
+ sub._dep = signal;
89
+ }
90
+ let subs = signal[SUBS];
91
+ if (!subs) {
92
+ subs = /* @__PURE__ */ new Set();
93
+ signalSubscribers.set(signal, subs);
94
+ signal[SUBS] = subs;
95
+ }
96
+ subs.add(currentSubscriber);
97
+ if (subs.size === 1) {
98
+ signal.__f = currentSubscriber;
99
+ } else if (signal.__f !== void 0) {
100
+ signal.__f = void 0;
101
+ }
102
+ }
103
+ function queueSignalNotification(signal) {
104
+ const subs = signal[SUBS];
105
+ if (!subs) return;
106
+ for (const sub of subs) {
107
+ if (sub._c) {
108
+ propagateDirty(sub);
109
+ } else if (!pendingSet.has(sub)) {
110
+ pendingSet.add(sub);
111
+ pendingQueue.push(sub);
112
+ }
113
+ }
114
+ }
115
+ function drainNotificationQueue() {
116
+ if (notifyDepth > 0) return;
117
+ notifyDepth++;
118
+ try {
119
+ let i = 0;
120
+ while (i < pendingQueue.length) {
121
+ safeInvoke(pendingQueue[i]);
122
+ i++;
123
+ }
124
+ } finally {
125
+ pendingQueue.length = 0;
126
+ pendingSet.clear();
127
+ notifyDepth--;
128
+ }
129
+ }
130
+ function propagateDirty(sub) {
131
+ sub();
132
+ let sig = sub._sig;
133
+ while (sig) {
134
+ const first = sig.__f;
135
+ if (first) {
136
+ if (first._c) {
137
+ const nSig = first._sig;
138
+ nSig._d = true;
139
+ sig = nSig;
140
+ continue;
141
+ }
142
+ if (!pendingSet.has(first)) {
143
+ pendingSet.add(first);
144
+ pendingQueue.push(first);
145
+ }
146
+ break;
147
+ }
148
+ const subs = sig[SUBS];
149
+ if (!subs) break;
150
+ let nextSig;
151
+ for (const s of subs) {
152
+ if (s._c) {
153
+ s();
154
+ const nSig = s._sig;
155
+ if (nSig && !nextSig) {
156
+ nextSig = nSig;
157
+ } else if (nSig) {
158
+ propagateDirty(s);
159
+ }
160
+ } else if (!pendingSet.has(s)) {
161
+ pendingSet.add(s);
162
+ pendingQueue.push(s);
163
+ }
164
+ }
165
+ sig = nextSig;
166
+ }
167
+ }
168
+ function notifySubscribers(signal) {
169
+ const first = signal.__f;
170
+ if (first) {
171
+ if (notifyDepth > 0) {
172
+ if (first._c) {
173
+ propagateDirty(first);
174
+ } else if (!pendingSet.has(first)) {
175
+ pendingSet.add(first);
176
+ pendingQueue.push(first);
177
+ }
178
+ return;
179
+ }
180
+ notifyDepth++;
181
+ try {
182
+ if (first._c) {
183
+ propagateDirty(first);
184
+ } else {
185
+ safeInvoke(first);
186
+ }
187
+ let i = 0;
188
+ while (i < pendingQueue.length) {
189
+ safeInvoke(pendingQueue[i]);
190
+ i++;
191
+ }
192
+ } finally {
193
+ pendingQueue.length = 0;
194
+ pendingSet.clear();
195
+ notifyDepth--;
196
+ }
197
+ return;
198
+ }
199
+ const subs = signal[SUBS];
200
+ if (!subs || subs.size === 0) return;
201
+ if (notifyDepth > 0) {
202
+ for (const sub of subs) {
203
+ if (sub._c) {
204
+ propagateDirty(sub);
205
+ } else if (!pendingSet.has(sub)) {
206
+ pendingSet.add(sub);
207
+ pendingQueue.push(sub);
208
+ }
209
+ }
210
+ return;
211
+ }
212
+ notifyDepth++;
213
+ try {
214
+ let directCount = 0;
215
+ for (const sub of subs) {
216
+ pendingQueue[directCount++] = sub;
217
+ }
218
+ for (let i2 = 0; i2 < directCount; i2++) {
219
+ if (pendingQueue[i2]._c) {
220
+ propagateDirty(pendingQueue[i2]);
221
+ }
222
+ }
223
+ for (let i2 = 0; i2 < directCount; i2++) {
224
+ if (!pendingQueue[i2]._c) {
225
+ if (!pendingSet.has(pendingQueue[i2])) {
226
+ safeInvoke(pendingQueue[i2]);
227
+ }
228
+ }
229
+ }
230
+ let i = directCount;
231
+ while (i < pendingQueue.length) {
232
+ safeInvoke(pendingQueue[i]);
233
+ i++;
234
+ }
235
+ } finally {
236
+ pendingQueue.length = 0;
237
+ pendingSet.clear();
238
+ notifyDepth--;
239
+ }
240
+ }
241
+ function cleanup(subscriber) {
242
+ const sub = subscriber;
243
+ const singleDep = sub._dep;
244
+ if (singleDep !== void 0) {
245
+ const subs = singleDep[SUBS];
246
+ if (subs) {
247
+ subs.delete(subscriber);
248
+ if (singleDep.__f === subscriber) {
249
+ singleDep.__f = void 0;
250
+ }
251
+ }
252
+ sub._dep = void 0;
253
+ return;
254
+ }
255
+ const deps = sub._deps;
256
+ if (!deps || deps.size === 0) return;
257
+ for (const signal of deps) {
258
+ const subs = signal[SUBS];
259
+ if (subs) {
260
+ subs.delete(subscriber);
261
+ if (signal.__f === subscriber) {
262
+ signal.__f = void 0;
263
+ }
264
+ }
265
+ }
266
+ deps.clear();
267
+ }
268
+
269
+ export {
270
+ trackingSuspended,
271
+ track,
272
+ untracked,
273
+ recordDependency,
274
+ queueSignalNotification,
275
+ drainNotificationQueue,
276
+ notifySubscribers
277
+ };
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Higher-order component utilities for SibuJS.
3
+ * These functions wrap or compose components to add behavior.
4
+ */
5
+ type Component<P = unknown> = (props: P) => HTMLElement;
6
+ /**
7
+ * Wraps a component with additional behavior that runs before/after rendering.
8
+ *
9
+ * @param WrappedComponent The component to wrap
10
+ * @param wrapper Function that receives the component and its props, returns enhanced element
11
+ * @returns A new component function
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const WithLogging = withWrapper(MyComponent, (Comp, props) => {
16
+ * console.log("Rendering with props:", props);
17
+ * return Comp(props);
18
+ * });
19
+ * ```
20
+ */
21
+ declare function withWrapper<P>(WrappedComponent: Component<P>, wrapper: (component: Component<P>, props: P) => HTMLElement): Component<P>;
22
+ /**
23
+ * Adds default props to a component. Missing props are filled from defaults.
24
+ *
25
+ * @param component The component to wrap
26
+ * @param defaults Default prop values
27
+ * @returns A new component with defaults applied
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const Button = withDefaults(RawButton, { type: "button", disabled: false });
32
+ * Button({ nodes: "Click" }); // type="button", disabled=false automatically
33
+ * ```
34
+ */
35
+ declare function withDefaults<P extends Record<string, unknown>>(component: Component<P>, defaults: Partial<P>): Component<Partial<P>>;
36
+ /**
37
+ * Composes multiple HOC wrappers into a single wrapper.
38
+ * Applied from right to left (like function composition).
39
+ *
40
+ * @param wrappers Array of HOC functions
41
+ * @returns A function that applies all wrappers to a component
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const enhance = compose(withAuth, withLogging, withTheme);
46
+ * const EnhancedPage = enhance(Page);
47
+ * ```
48
+ */
49
+ declare function compose(...wrappers: Array<(component: Component) => Component>): (component: Component) => Component;
50
+
51
+ /**
52
+ * composable wraps a setup function to create reusable stateful logic.
53
+ * Similar to Vue 3 composables — encapsulates reactive state and methods.
54
+ */
55
+ declare function composable<T>(setup: () => T): () => T;
56
+ /**
57
+ * RenderProp implements the render-prop pattern.
58
+ * The render function receives data and returns DOM nodes.
59
+ */
60
+ declare function RenderProp<T>(props: {
61
+ data: () => T;
62
+ render: (data: T) => HTMLElement;
63
+ }): HTMLElement;
64
+ /**
65
+ * withBoundary creates an isolated component boundary for debugging.
66
+ * Wraps component output in a named container with error isolation.
67
+ */
68
+ declare function withBoundary(name: string, component: (props?: unknown) => HTMLElement): (props?: unknown) => HTMLElement;
69
+ /**
70
+ * Slot pattern — provides named slots for component composition.
71
+ */
72
+ declare function createSlots(slots: Record<string, () => HTMLElement | HTMLElement[] | null>): {
73
+ renderSlot: (name: string, fallback?: () => HTMLElement) => HTMLElement | null;
74
+ hasSlot: (name: string) => boolean;
75
+ };
76
+
77
+ /**
78
+ * Functional component props with TypeScript inference for SibuJS.
79
+ *
80
+ * Provides utilities to define typed components with prop defaults,
81
+ * nodes slots, and prop mapping — all with full TypeScript inference.
82
+ */
83
+ /**
84
+ * Extract the props type from a component defined with defineComponent.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const Button = defineComponent<{ label: string }>({
89
+ * setup(props) { ... }
90
+ * });
91
+ * type ButtonProps = ComponentProps<typeof Button>; // { label: string }
92
+ * ```
93
+ */
94
+ type ComponentProps<T> = T extends (props: infer P) => HTMLElement ? P : never;
95
+ /**
96
+ * Props that include an optional nodes slot.
97
+ */
98
+ type WithNodes<Props> = Props & {
99
+ nodes?: Node | Node[];
100
+ };
101
+ /**
102
+ * Define a typed component with props inference, defaults, and a setup function.
103
+ *
104
+ * The `setup` function receives merged props (defaults + provided) and must
105
+ * return an HTMLElement. TypeScript infers the full props type from the generic.
106
+ *
107
+ * @param config Component configuration with optional defaults and a setup function
108
+ * @returns A component function that accepts props and returns an HTMLElement
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const Button = defineComponent<{ label: string; variant?: 'primary' | 'secondary'; disabled?: boolean }>({
113
+ * defaults: { variant: 'primary', disabled: false },
114
+ * setup(props) {
115
+ * return button({
116
+ * class: `btn btn-${props.variant}`,
117
+ * disabled: props.disabled,
118
+ * nodes: props.label
119
+ * });
120
+ * }
121
+ * });
122
+ *
123
+ * // Usage: Button({ label: 'Click me' }) — TypeScript infers props
124
+ * ```
125
+ */
126
+ declare function defineComponent<Props extends Record<string, unknown>>(config: {
127
+ defaults?: Partial<Props>;
128
+ setup: (props: Props) => HTMLElement;
129
+ }): (props: Props) => HTMLElement;
130
+ /**
131
+ * Create a component with nodes slot support.
132
+ *
133
+ * Nodes are passed as a special `nodes` prop alongside the component's
134
+ * own props. This enables composition patterns where a parent component
135
+ * wraps arbitrary child content.
136
+ *
137
+ * @param config Component configuration with optional defaults and a setup function
138
+ * @returns A component function that accepts props (including nodes) and returns an HTMLElement
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * const Card = defineSlottedComponent<{ title: string }>({
143
+ * setup(props) {
144
+ * const el = div({ class: 'card' });
145
+ * el.appendChild(h2({ nodes: props.title }));
146
+ * if (props.nodes) {
147
+ * const nodes = Array.isArray(props.nodes) ? props.nodes : [props.nodes];
148
+ * nodes.forEach(child => el.appendChild(child));
149
+ * }
150
+ * return el;
151
+ * }
152
+ * });
153
+ *
154
+ * // Usage: Card({ title: 'Hello', nodes: p({ nodes: 'World' }) })
155
+ * ```
156
+ */
157
+ declare function defineSlottedComponent<Props extends Record<string, unknown>>(config: {
158
+ defaults?: Partial<Props>;
159
+ setup: (props: WithNodes<Props>) => HTMLElement;
160
+ }): (props: WithNodes<Props>) => HTMLElement;
161
+ /**
162
+ * Higher-order helper to create a component that maps outer props to inner props.
163
+ *
164
+ * Useful for adapting a generic component to a specific use case by transforming
165
+ * the prop interface without modifying the original component.
166
+ *
167
+ * @param component The inner component to forward mapped props to
168
+ * @param mapProps A function that transforms outer props into inner props
169
+ * @returns A new component that accepts outer props
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * const IconButton = defineComponent<{ icon: string; label: string; size: number }>({
174
+ * setup(props) { ... }
175
+ * });
176
+ *
177
+ * const SmallIconButton = withProps(IconButton, (outer: { icon: string; label: string }) => ({
178
+ * icon: outer.icon,
179
+ * label: outer.label,
180
+ * size: 16
181
+ * }));
182
+ *
183
+ * // Usage: SmallIconButton({ icon: 'star', label: 'Favorite' })
184
+ * ```
185
+ */
186
+ declare function withProps<OuterProps extends Record<string, unknown>, InnerProps extends Record<string, unknown>>(component: (props: InnerProps) => HTMLElement, mapProps: (outer: OuterProps) => InnerProps): (props: OuterProps) => HTMLElement;
187
+
188
+ /**
189
+ * Runtime prop validation and strict typing contracts for SibuJS.
190
+ * Provides runtime type checking for component props in development mode.
191
+ */
192
+ /** Validator function: returns true if valid, or an error message string. */
193
+ type Validator<T = unknown> = (value: T, propName: string) => true | string;
194
+ /** Built-in validators */
195
+ declare const validators: {
196
+ string: Validator;
197
+ number: Validator;
198
+ boolean: Validator;
199
+ function: Validator;
200
+ object: Validator;
201
+ array: Validator;
202
+ required: Validator;
203
+ oneOf: <T>(...values: T[]) => Validator<T>;
204
+ instanceOf: <T>(ctor: new (...args: unknown[]) => T) => Validator<T>;
205
+ arrayOf: (itemValidator: Validator) => Validator<unknown[]>;
206
+ shape: (schema: Record<string, Validator>) => Validator<Record<string, unknown>>;
207
+ optional: (validator: Validator) => Validator;
208
+ range: (min: number, max: number) => Validator<number>;
209
+ pattern: (regex: RegExp) => Validator<string>;
210
+ };
211
+ interface PropDef<T = unknown> {
212
+ type?: Validator<T>;
213
+ required?: boolean;
214
+ default?: T | (() => T);
215
+ validator?: Validator<T>;
216
+ }
217
+ type PropSchema<Props> = {
218
+ [K in keyof Props]: PropDef<Props[K]> | Validator<Props[K]>;
219
+ };
220
+ /**
221
+ * Validate props against a schema. Returns validated props with defaults applied.
222
+ * In production mode (process.env.NODE_ENV === 'production'), validation is skipped
223
+ * and only defaults are applied for performance.
224
+ */
225
+ declare function validateProps<Props extends Record<string, unknown>>(props: Partial<Props>, schema: PropSchema<Props>): Props;
226
+ /**
227
+ * Define a component with runtime prop validation.
228
+ * Validates props in development mode, applies defaults, then calls setup.
229
+ */
230
+ declare function defineStrictComponent<Props extends Record<string, unknown>>(config: {
231
+ name: string;
232
+ props: PropSchema<Props>;
233
+ setup: (props: Props) => HTMLElement;
234
+ }): (props: Partial<Props>) => HTMLElement;
235
+ /**
236
+ * Assert that a value satisfies a contract at runtime.
237
+ * No-op in production builds.
238
+ */
239
+ declare function assertType<T>(value: unknown, validator: Validator<T>, label?: string): asserts value is T;
240
+ /**
241
+ * Create a type guard function from a validator.
242
+ */
243
+ declare function createGuard<T>(validator: Validator<T>): (value: unknown) => value is T;
244
+
245
+ export { type ComponentProps as C, type PropDef as P, RenderProp as R, type Validator as V, type PropSchema as a, assertType as b, composable as c, compose as d, createGuard as e, createSlots as f, defineComponent as g, defineSlottedComponent as h, defineStrictComponent as i, validators as j, withDefaults as k, withProps as l, withWrapper as m, validateProps as v, withBoundary as w };