sibujs 1.3.0 → 1.5.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 (87) hide show
  1. package/README.md +105 -119
  2. package/dist/browser.cjs +53 -14
  3. package/dist/browser.d.cts +14 -9
  4. package/dist/browser.d.ts +14 -9
  5. package/dist/browser.js +4 -4
  6. package/dist/build.cjs +125 -135
  7. package/dist/build.d.cts +1 -1
  8. package/dist/build.d.ts +1 -1
  9. package/dist/build.js +11 -91
  10. package/dist/cdn.global.js +6 -6
  11. package/dist/chunk-5ZYQ6KDD.js +154 -0
  12. package/dist/chunk-6BMPXPUW.js +26 -0
  13. package/dist/chunk-7GRNSCFT.js +1097 -0
  14. package/dist/chunk-BGTHZHJ5.js +1016 -0
  15. package/dist/chunk-BMPL52BF.js +654 -0
  16. package/dist/chunk-CNZ35WI2.js +178 -0
  17. package/dist/chunk-GJPXRJ45.js +37 -0
  18. package/dist/chunk-JCDUJN2F.js +2779 -0
  19. package/dist/chunk-K4G4ZQNR.js +286 -0
  20. package/dist/chunk-M4NLBH4I.js +725 -0
  21. package/dist/chunk-MB6QFH3I.js +2776 -0
  22. package/dist/chunk-MYRV7VDM.js +742 -0
  23. package/dist/chunk-NZIIMDWI.js +84 -0
  24. package/dist/chunk-P3XWXJZU.js +282 -0
  25. package/dist/chunk-PDZQY43A.js +616 -0
  26. package/dist/chunk-RJ46C3CS.js +1293 -0
  27. package/dist/chunk-SFKNRVCU.js +292 -0
  28. package/dist/chunk-TDGZL5CU.js +365 -0
  29. package/dist/chunk-UHNL42EF.js +2730 -0
  30. package/dist/chunk-VAPYJN4X.js +368 -0
  31. package/dist/chunk-VQDZK23A.js +1023 -0
  32. package/dist/chunk-VQNQZCWJ.js +61 -0
  33. package/dist/chunk-XHK6BDAJ.js +76 -0
  34. package/dist/chunk-XUEEGU5O.js +409 -0
  35. package/dist/chunk-ZWKZCBO6.js +317 -0
  36. package/dist/contracts-ey_Qh8ef.d.cts +239 -0
  37. package/dist/contracts-ey_Qh8ef.d.ts +239 -0
  38. package/dist/contracts-xo5ckdRP.d.cts +240 -0
  39. package/dist/contracts-xo5ckdRP.d.ts +240 -0
  40. package/dist/customElement-BL3Uo8dL.d.cts +318 -0
  41. package/dist/customElement-BL3Uo8dL.d.ts +318 -0
  42. package/dist/data.cjs +52 -11
  43. package/dist/data.js +6 -6
  44. package/dist/devtools.cjs +22 -24
  45. package/dist/devtools.d.cts +1 -1
  46. package/dist/devtools.d.ts +1 -1
  47. package/dist/devtools.js +26 -28
  48. package/dist/ecosystem.cjs +31 -6
  49. package/dist/ecosystem.d.cts +4 -4
  50. package/dist/ecosystem.d.ts +4 -4
  51. package/dist/ecosystem.js +7 -7
  52. package/dist/extras.cjs +305 -131
  53. package/dist/extras.d.cts +3 -3
  54. package/dist/extras.d.ts +3 -3
  55. package/dist/extras.js +21 -29
  56. package/dist/index.cjs +124 -56
  57. package/dist/index.d.cts +60 -72
  58. package/dist/index.d.ts +60 -72
  59. package/dist/index.js +10 -14
  60. package/dist/motion.cjs +13 -2
  61. package/dist/motion.d.cts +1 -1
  62. package/dist/motion.d.ts +1 -1
  63. package/dist/motion.js +3 -3
  64. package/dist/patterns.cjs +91 -46
  65. package/dist/patterns.d.cts +46 -60
  66. package/dist/patterns.d.ts +46 -60
  67. package/dist/patterns.js +6 -14
  68. package/dist/performance.cjs +97 -12
  69. package/dist/performance.d.cts +6 -1
  70. package/dist/performance.d.ts +6 -1
  71. package/dist/performance.js +5 -3
  72. package/dist/plugins.cjs +20 -14
  73. package/dist/plugins.d.cts +3 -3
  74. package/dist/plugins.d.ts +3 -3
  75. package/dist/plugins.js +17 -19
  76. package/dist/ssr.cjs +9 -0
  77. package/dist/ssr.d.cts +1 -1
  78. package/dist/ssr.d.ts +1 -1
  79. package/dist/ssr.js +7 -7
  80. package/dist/testing.js +2 -2
  81. package/dist/ui.cjs +130 -53
  82. package/dist/ui.d.cts +13 -16
  83. package/dist/ui.d.ts +13 -16
  84. package/dist/ui.js +7 -9
  85. package/dist/widgets.cjs +31 -6
  86. package/dist/widgets.js +5 -5
  87. package/package.json +1 -1
@@ -0,0 +1,240 @@
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
+ * RenderProp implements the render-prop pattern.
53
+ * The render function receives data and returns DOM nodes.
54
+ */
55
+ declare function RenderProp<T>(props: {
56
+ data: () => T;
57
+ render: (data: T) => HTMLElement;
58
+ }): HTMLElement;
59
+ /**
60
+ * withBoundary creates an isolated component boundary for debugging.
61
+ * Wraps component output in a named container with error isolation.
62
+ */
63
+ declare function withBoundary(name: string, component: (props?: unknown) => HTMLElement): (props?: unknown) => HTMLElement;
64
+ /**
65
+ * Slot pattern — provides named slots for component composition.
66
+ */
67
+ declare function createSlots(slots: Record<string, () => HTMLElement | HTMLElement[] | null>): {
68
+ renderSlot: (name: string, fallback?: () => HTMLElement) => HTMLElement | null;
69
+ hasSlot: (name: string) => boolean;
70
+ };
71
+
72
+ /**
73
+ * Functional component props with TypeScript inference for SibuJS.
74
+ *
75
+ * Provides utilities to define typed components with prop defaults,
76
+ * nodes slots, and prop mapping — all with full TypeScript inference.
77
+ */
78
+ /**
79
+ * Extract the props type from a component defined with defineComponent.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const Button = defineComponent<{ label: string }>({
84
+ * setup(props) { ... }
85
+ * });
86
+ * type ButtonProps = ComponentProps<typeof Button>; // { label: string }
87
+ * ```
88
+ */
89
+ type ComponentProps<T> = T extends (props: infer P) => HTMLElement ? P : never;
90
+ /**
91
+ * Props that include an optional nodes slot.
92
+ */
93
+ type WithNodes<Props> = Props & {
94
+ nodes?: Node | Node[];
95
+ };
96
+ /**
97
+ * Define a typed component with props inference, defaults, and a setup function.
98
+ *
99
+ * The `setup` function receives merged props (defaults + provided) and must
100
+ * return an HTMLElement. TypeScript infers the full props type from the generic.
101
+ *
102
+ * @param config Component configuration with optional defaults and a setup function
103
+ * @returns A component function that accepts props and returns an HTMLElement
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * const Button = defineComponent<{ label: string; variant?: 'primary' | 'secondary'; disabled?: boolean }>({
108
+ * defaults: { variant: 'primary', disabled: false },
109
+ * setup(props) {
110
+ * return button({
111
+ * class: `btn btn-${props.variant}`,
112
+ * disabled: props.disabled,
113
+ * nodes: props.label
114
+ * });
115
+ * }
116
+ * });
117
+ *
118
+ * // Usage: Button({ label: 'Click me' }) — TypeScript infers props
119
+ * ```
120
+ */
121
+ declare function defineComponent<Props extends Record<string, unknown>>(config: {
122
+ defaults?: Partial<Props>;
123
+ setup: (props: Props) => HTMLElement;
124
+ }): (props: Props) => HTMLElement;
125
+ /**
126
+ * Create a component with nodes slot support.
127
+ *
128
+ * Nodes are passed as a special `nodes` prop alongside the component's
129
+ * own props. This enables composition patterns where a parent component
130
+ * wraps arbitrary child content.
131
+ *
132
+ * @param config Component configuration with optional defaults and a setup function
133
+ * @returns A component function that accepts props (including nodes) and returns an HTMLElement
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * const Card = defineSlottedComponent<{ title: string }>({
138
+ * setup(props) {
139
+ * const el = div({ class: 'card' });
140
+ * el.appendChild(h2({ nodes: props.title }));
141
+ * if (props.nodes) {
142
+ * const nodes = Array.isArray(props.nodes) ? props.nodes : [props.nodes];
143
+ * nodes.forEach(child => el.appendChild(child));
144
+ * }
145
+ * return el;
146
+ * }
147
+ * });
148
+ *
149
+ * // Usage: Card({ title: 'Hello', nodes: p({ nodes: 'World' }) })
150
+ * ```
151
+ */
152
+ declare function defineSlottedComponent<Props extends Record<string, unknown>>(config: {
153
+ defaults?: Partial<Props>;
154
+ setup: (props: WithNodes<Props>) => HTMLElement;
155
+ }): (props: WithNodes<Props>) => HTMLElement;
156
+ /**
157
+ * Higher-order helper to create a component that maps outer props to inner props.
158
+ *
159
+ * Useful for adapting a generic component to a specific use case by transforming
160
+ * the prop interface without modifying the original component.
161
+ *
162
+ * @param component The inner component to forward mapped props to
163
+ * @param mapProps A function that transforms outer props into inner props
164
+ * @returns A new component that accepts outer props
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * const IconButton = defineComponent<{ icon: string; label: string; size: number }>({
169
+ * setup(props) { ... }
170
+ * });
171
+ *
172
+ * const SmallIconButton = withProps(IconButton, (outer: { icon: string; label: string }) => ({
173
+ * icon: outer.icon,
174
+ * label: outer.label,
175
+ * size: 16
176
+ * }));
177
+ *
178
+ * // Usage: SmallIconButton({ icon: 'star', label: 'Favorite' })
179
+ * ```
180
+ */
181
+ declare function withProps<OuterProps extends Record<string, unknown>, InnerProps extends Record<string, unknown>>(component: (props: InnerProps) => HTMLElement, mapProps: (outer: OuterProps) => InnerProps): (props: OuterProps) => HTMLElement;
182
+
183
+ /**
184
+ * Runtime prop validation and strict typing contracts for SibuJS.
185
+ * Provides runtime type checking for component props in development mode.
186
+ */
187
+ /** Validator function: returns true if valid, or an error message string. */
188
+ type Validator<T = unknown> = (value: T, propName: string) => true | string;
189
+ /** Built-in validators */
190
+ declare const validators: {
191
+ string: Validator;
192
+ number: Validator;
193
+ boolean: Validator;
194
+ function: Validator;
195
+ object: Validator;
196
+ array: Validator;
197
+ required: Validator;
198
+ oneOf: <T>(...values: T[]) => Validator<T>;
199
+ instanceOf: <T>(ctor: new (...args: unknown[]) => T) => Validator<T>;
200
+ arrayOf: (itemValidator: Validator) => Validator<unknown[]>;
201
+ shape: (schema: Record<string, Validator>) => Validator<Record<string, unknown>>;
202
+ optional: (validator: Validator) => Validator;
203
+ range: (min: number, max: number) => Validator<number>;
204
+ pattern: (regex: RegExp) => Validator<string>;
205
+ };
206
+ interface PropDef<T = unknown> {
207
+ type?: Validator<T>;
208
+ required?: boolean;
209
+ default?: T | (() => T);
210
+ validator?: Validator<T>;
211
+ }
212
+ type PropSchema<Props> = {
213
+ [K in keyof Props]: PropDef<Props[K]> | Validator<Props[K]>;
214
+ };
215
+ /**
216
+ * Validate props against a schema. Returns validated props with defaults applied.
217
+ * In production mode (process.env.NODE_ENV === 'production'), validation is skipped
218
+ * and only defaults are applied for performance.
219
+ */
220
+ declare function validateProps<Props extends Record<string, unknown>>(props: Partial<Props>, schema: PropSchema<Props>): Props;
221
+ /**
222
+ * Define a component with runtime prop validation.
223
+ * Validates props in development mode, applies defaults, then calls setup.
224
+ */
225
+ declare function defineStrictComponent<Props extends Record<string, unknown>>(config: {
226
+ name: string;
227
+ props: PropSchema<Props>;
228
+ setup: (props: Props) => HTMLElement;
229
+ }): (props: Partial<Props>) => HTMLElement;
230
+ /**
231
+ * Assert that a value satisfies a contract at runtime.
232
+ * No-op in production builds.
233
+ */
234
+ declare function assertType<T>(value: unknown, validator: Validator<T>, label?: string): asserts value is T;
235
+ /**
236
+ * Create a type guard function from a validator.
237
+ */
238
+ declare function createGuard<T>(validator: Validator<T>): (value: unknown) => value is T;
239
+
240
+ 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 };
@@ -0,0 +1,318 @@
1
+ type ValidatorFn<T = unknown> = (value: T) => string | null;
2
+ interface FieldConfig<T = unknown> {
3
+ initial: T;
4
+ validators?: ValidatorFn<T>[];
5
+ }
6
+ type FormConfig<T extends Record<string, unknown>> = {
7
+ [K in keyof T]: FieldConfig<T[K]>;
8
+ };
9
+ interface FormField<T = unknown> {
10
+ value: () => T;
11
+ set: (v: T) => void;
12
+ error: () => string | null;
13
+ touched: () => boolean;
14
+ touch: () => void;
15
+ reset: () => void;
16
+ }
17
+ interface FormReturn<T extends Record<string, unknown>> {
18
+ fields: {
19
+ [K in keyof T]: FormField<T[K]>;
20
+ };
21
+ errors: () => Partial<Record<keyof T, string | null>>;
22
+ isValid: () => boolean;
23
+ isDirty: () => boolean;
24
+ /** True while an async handleSubmit callback is in flight. Prevents double-submit. */
25
+ submitting: () => boolean;
26
+ touched: () => Partial<Record<keyof T, boolean>>;
27
+ values: () => T;
28
+ handleSubmit: (onSubmit: (values: T) => void | Promise<void>) => (e?: Event) => void;
29
+ reset: () => void;
30
+ setError: (field: keyof T, message: string) => void;
31
+ }
32
+ declare function required(message?: string): ValidatorFn<unknown>;
33
+ declare function minLength(min: number, message?: string): ValidatorFn<string>;
34
+ declare function maxLength(max: number, message?: string): ValidatorFn<string>;
35
+ declare function matchesPattern(regex: RegExp, message?: string): ValidatorFn<string>;
36
+ declare function email(message?: string): ValidatorFn<string>;
37
+ declare function min(minVal: number, message?: string): ValidatorFn<number>;
38
+ declare function max(maxVal: number, message?: string): ValidatorFn<number>;
39
+ declare function custom<T>(fn: (value: T) => boolean, message: string): ValidatorFn<T>;
40
+ /**
41
+ * Props returned by bindField, ready to spread into an input tag factory.
42
+ */
43
+ interface BoundFieldProps {
44
+ value: () => unknown;
45
+ on: {
46
+ input: (e: Event) => void;
47
+ change: (e: Event) => void;
48
+ blur: () => void;
49
+ };
50
+ [attr: string]: unknown;
51
+ }
52
+ /**
53
+ * Bind a FormField to an input element, eliminating the value/input/blur boilerplate.
54
+ *
55
+ * Works with text inputs (`input` event) and selects/checkboxes (`change` event).
56
+ *
57
+ * @param field A FormField from form().fields
58
+ * @param extras Additional props to merge (placeholder, class, disabled, etc.)
59
+ * @returns Props object ready to pass directly to a tag factory
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const f = form({ email: { initial: "", validators: [required(), email()] } });
64
+ *
65
+ * // Before — verbose
66
+ * input({ value: f.fields.email.value(), on: { input: e => f.fields.email.set(e.target.value), blur: () => f.fields.email.touch() } })
67
+ *
68
+ * // After — one-liner
69
+ * input(bindField(f.fields.email, { type: "email", placeholder: "Email" }))
70
+ * ```
71
+ */
72
+ declare function bindField<T>(field: FormField<T>, extras?: Record<string, unknown>): BoundFieldProps;
73
+ declare function form<T extends Record<string, unknown>>(config: FormConfig<T>): FormReturn<T>;
74
+
75
+ interface VirtualListProps<T> {
76
+ items: () => T[];
77
+ itemHeight: number;
78
+ containerHeight: number;
79
+ overscan?: number;
80
+ renderItem: (item: T, index: number) => HTMLElement;
81
+ class?: string;
82
+ }
83
+ /**
84
+ * VirtualList renders only visible items for efficient large-list rendering.
85
+ */
86
+ declare function VirtualList<T>(props: VirtualListProps<T>): HTMLElement;
87
+
88
+ interface IntersectionResult {
89
+ isIntersecting: () => boolean;
90
+ intersectionRatio: () => number;
91
+ observe: (element: HTMLElement) => void;
92
+ unobserve: () => void;
93
+ }
94
+ /**
95
+ * intersection provides reactive intersection observer state.
96
+ */
97
+ declare function intersection(options?: IntersectionObserverInit): IntersectionResult;
98
+ /**
99
+ * Lazy-load utility using IntersectionObserver.
100
+ * Calls the loader function when element becomes visible.
101
+ */
102
+ declare function lazyLoad(element: HTMLElement, loader: () => void, options?: IntersectionObserverInit): () => void;
103
+
104
+ interface MaskOptions {
105
+ /** Pattern: 9 = digit, A = letter, * = any, other chars are literals */
106
+ pattern: string;
107
+ /** Placeholder character for unfilled positions */
108
+ placeholder?: string;
109
+ }
110
+ /**
111
+ * inputMask applies a mask to an input element.
112
+ * Returns reactive value and ref binding.
113
+ */
114
+ declare function inputMask(options: MaskOptions): {
115
+ value: () => string;
116
+ rawValue: () => string;
117
+ bind: (input: HTMLInputElement) => void;
118
+ };
119
+ /** Phone number mask: (999) 999-9999 */
120
+ declare function phoneMask(): MaskOptions;
121
+ /** Date mask: 99/99/9999 */
122
+ declare function dateMask(): MaskOptions;
123
+ /** Credit card mask: 9999 9999 9999 9999 */
124
+ declare function creditCardMask(): MaskOptions;
125
+ /** Time mask: 99:99 */
126
+ declare function timeMask(): MaskOptions;
127
+ /** SSN mask: 999-99-9999 */
128
+ declare function ssnMask(): MaskOptions;
129
+ /** ZIP code mask: 99999 */
130
+ declare function zipMask(): MaskOptions;
131
+
132
+ /**
133
+ * aria applies reactive ARIA attributes to an element.
134
+ */
135
+ declare function aria(element: HTMLElement, attrs: Record<string, string | boolean | (() => string | boolean)>): void;
136
+ /**
137
+ * focus manages focus state for an element.
138
+ */
139
+ declare function focus(): {
140
+ isFocused: () => boolean;
141
+ focus: () => void;
142
+ blur: () => void;
143
+ bind: (element: HTMLElement) => void;
144
+ };
145
+ /**
146
+ * FocusTrap traps focus within a container element.
147
+ * Tab cycling stays inside the container.
148
+ */
149
+ declare function FocusTrap(nodes: HTMLElement, options?: {
150
+ autoFocus?: boolean;
151
+ restoreFocus?: boolean;
152
+ }): HTMLElement;
153
+ /**
154
+ * hotkey registers a keyboard shortcut handler.
155
+ * Returns a cleanup function.
156
+ *
157
+ * Supports two calling styles:
158
+ * - String combo: hotkey("ctrl+shift+z", handler)
159
+ * - Explicit flags: hotkey("z", handler, { ctrl: true, shift: true })
160
+ */
161
+ declare function hotkey(combo: string, handler: (e: KeyboardEvent) => void, options?: {
162
+ ctrl?: boolean;
163
+ shift?: boolean;
164
+ alt?: boolean;
165
+ meta?: boolean;
166
+ preventDefault?: boolean;
167
+ }): () => void;
168
+ /**
169
+ * announce creates a screen reader announcement using ARIA live regions.
170
+ */
171
+ declare function announce(message: string, priority?: "polite" | "assertive"): void;
172
+
173
+ /**
174
+ * scopedStyle creates component-scoped CSS by generating a unique scope ID
175
+ * and prefixing all selectors.
176
+ * Returns the scope attribute name and injects the CSS into the document.
177
+ *
178
+ * CSS is sanitized to remove dangerous patterns (`url()`, `@import`,
179
+ * `expression()`, `-moz-binding`, `behavior`). If you need `url()` for
180
+ * background images, use inline styles via the `style` prop instead.
181
+ */
182
+ declare function scopedStyle(css: string): {
183
+ scope: string;
184
+ attr: string;
185
+ };
186
+ /**
187
+ * withScopedStyle wraps a component function to auto-apply scoped styles.
188
+ * The component and all its children get the scope attribute.
189
+ */
190
+ declare function withScopedStyle<P>(css: string, component: (props: P) => HTMLElement): (props: P) => HTMLElement;
191
+ /**
192
+ * Removes a scoped style by its scope ID.
193
+ */
194
+ declare function removeScopedStyle(scopeId: string): void;
195
+
196
+ /**
197
+ * Bind multiple reactive attributes to an element.
198
+ * Each attribute value can be a static value or a reactive getter.
199
+ * Returns a single teardown function that stops all bindings.
200
+ */
201
+ declare function bindAttrs(el: HTMLElement, attrs: Record<string, string | number | boolean | (() => string | number | boolean)>): () => void;
202
+ /**
203
+ * Reactively toggle a boolean attribute (like disabled, readonly, hidden).
204
+ * When the value is truthy the attribute is present (set to ""),
205
+ * when falsy the attribute is removed entirely.
206
+ * Returns a teardown function to stop reactive tracking.
207
+ */
208
+ declare function bindBoolAttr(el: HTMLElement, attr: string, getter: boolean | (() => boolean)): () => void;
209
+ /**
210
+ * Bind a data-* attribute reactively.
211
+ * Shorthand for `bindAttribute(el, "data-<key>", getter)`.
212
+ * Returns a teardown function to stop reactive tracking.
213
+ */
214
+ declare function bindData(el: HTMLElement, key: string, getter: string | (() => string)): () => void;
215
+
216
+ /**
217
+ * dialog provides reactive dialog state management with escape-to-close support.
218
+ *
219
+ * Call `dispose()` when the owning component unmounts to ensure the global
220
+ * keydown listener is removed even if the dialog is still open.
221
+ */
222
+ declare function dialog(): {
223
+ open: () => void;
224
+ close: () => void;
225
+ isOpen: () => boolean;
226
+ toggle: () => void;
227
+ dispose: () => void;
228
+ };
229
+
230
+ /**
231
+ * Toast notification system with auto-dismiss and max toast limits.
232
+ */
233
+ interface Toast {
234
+ id: string;
235
+ message: string;
236
+ type?: "info" | "success" | "error" | "warning";
237
+ }
238
+ interface ToastInstance {
239
+ toasts: () => Toast[];
240
+ show: (message: string, type?: Toast["type"]) => string;
241
+ /** Show an info toast. */
242
+ info: (message: string) => string;
243
+ /** Show a success toast. */
244
+ success: (message: string) => string;
245
+ /** Show an error toast. */
246
+ error: (message: string) => string;
247
+ /** Show a warning toast. */
248
+ warning: (message: string) => string;
249
+ dismiss: (id: string) => void;
250
+ dismissAll: () => void;
251
+ }
252
+ declare function toast(options?: {
253
+ duration?: number;
254
+ maxToasts?: number;
255
+ }): ToastInstance;
256
+
257
+ /**
258
+ * infiniteScroll combines IntersectionObserver with a data-fetching trigger
259
+ * to implement infinite scroll behavior.
260
+ */
261
+ declare function infiniteScroll(options: {
262
+ onLoadMore: () => Promise<void>;
263
+ hasMore: () => boolean;
264
+ threshold?: number;
265
+ }): {
266
+ sentinelRef: {
267
+ current: HTMLElement | null;
268
+ };
269
+ loading: () => boolean;
270
+ dispose: () => void;
271
+ };
272
+
273
+ /**
274
+ * pagination provides reactive pagination state and controls.
275
+ */
276
+ declare function pagination(options: {
277
+ totalItems: () => number;
278
+ pageSize?: number;
279
+ initialPage?: number;
280
+ }): {
281
+ page: () => number;
282
+ pageSize: () => number;
283
+ totalPages: () => number;
284
+ next: () => void;
285
+ prev: () => void;
286
+ goTo: (page: number) => void;
287
+ startIndex: () => number;
288
+ endIndex: () => number;
289
+ };
290
+
291
+ /**
292
+ * eventBus creates a typed publish/subscribe event system.
293
+ * No reactive state needed -- pure event dispatching.
294
+ */
295
+ declare function eventBus<T extends Record<string, unknown>>(): {
296
+ on: <K extends keyof T>(event: K, handler: (data: T[K]) => void) => () => void;
297
+ emit: <K extends keyof T>(event: K, data: T[K]) => void;
298
+ off: <K extends keyof T>(event: K, handler: (data: T[K]) => void) => void;
299
+ clear: () => void;
300
+ };
301
+
302
+ interface CustomElementOptions {
303
+ shadow?: boolean;
304
+ mode?: "open" | "closed";
305
+ styles?: string;
306
+ observedAttributes?: string[];
307
+ extends?: string;
308
+ }
309
+ /**
310
+ * defineElement creates a Web Component wrapping a SibuJS component function.
311
+ */
312
+ declare function defineElement(name: string, component: (props: Record<string, unknown>, element: HTMLElement) => HTMLElement, options?: CustomElementOptions): void;
313
+ /**
314
+ * Creates an SVG element with proper namespace.
315
+ */
316
+ declare function svgElement(tag: string, props?: Record<string, unknown>, ...nodes: (SVGElement | string)[]): SVGElement;
317
+
318
+ export { lazyLoad as A, type BoundFieldProps as B, type CustomElementOptions as C, matchesPattern as D, max as E, type FieldConfig as F, maxLength as G, min as H, type IntersectionResult as I, minLength as J, pagination as K, phoneMask as L, type MaskOptions as M, removeScopedStyle as N, required as O, scopedStyle as P, ssnMask as Q, svgElement as R, timeMask as S, type Toast as T, toast as U, type ValidatorFn as V, withScopedStyle as W, zipMask as X, FocusTrap as a, type FormConfig as b, type FormField as c, type FormReturn as d, type ToastInstance as e, VirtualList as f, type VirtualListProps as g, announce as h, aria as i, bindAttrs as j, bindBoolAttr as k, bindData as l, bindField as m, creditCardMask as n, custom as o, dateMask as p, defineElement as q, dialog as r, email as s, eventBus as t, focus as u, form as v, hotkey as w, infiniteScroll as x, inputMask as y, intersection as z };