@stacksjs/components 0.2.4 → 0.2.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.
- package/dist/components/index.d.ts +1 -1
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/useCopyCode.d.ts +1 -1
- package/dist/composables/useDarkMode.d.ts +1 -1
- package/dist/composables/useSEO.d.ts +2 -2
- package/dist/composables/utilities/index.d.ts +2 -1
- package/dist/composables/utilities/useClickOutside.d.ts +1 -1
- package/dist/composables/utilities/useFocusTrap.d.ts +1 -1
- package/dist/composables/utilities/useKeyboard.d.ts +1 -1
- package/dist/composables/utilities/useLocalStorage.d.ts +2 -2
- package/dist/composables/utilities/useMediaQuery.d.ts +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/ui/accordion/index.d.ts +1 -1
- package/dist/ui/audio/index.d.ts +1 -1
- package/dist/ui/auth/index.d.ts +1 -1
- package/dist/ui/avatar/index.d.ts +1 -1
- package/dist/ui/badge/index.d.ts +1 -1
- package/dist/ui/breadcrumb/index.d.ts +1 -1
- package/dist/ui/button/index.d.ts +3 -3
- package/dist/ui/calendar/index.d.ts +1 -1
- package/dist/ui/card/index.d.ts +1 -1
- package/dist/ui/checkbox/index.d.ts +1 -1
- package/dist/ui/combobox/index.d.ts +1 -1
- package/dist/ui/command-palette/index.d.ts +1 -1
- package/dist/ui/dialog/index.d.ts +1 -1
- package/dist/ui/drawer/index.d.ts +1 -1
- package/dist/ui/dropdown/index.d.ts +1 -1
- package/dist/ui/form/index.d.ts +4 -4
- package/dist/ui/image/index.d.ts +1 -1
- package/dist/ui/input/index.d.ts +7 -7
- package/dist/ui/listbox/index.d.ts +1 -1
- package/dist/ui/navigator/index.d.ts +1 -1
- package/dist/ui/notification/index.d.ts +1 -1
- package/dist/ui/pagination/index.d.ts +1 -1
- package/dist/ui/payment/index.d.ts +1 -1
- package/dist/ui/popover/index.d.ts +1 -1
- package/dist/ui/portal/index.d.ts +1 -1
- package/dist/ui/progress/index.d.ts +1 -1
- package/dist/ui/radio/index.d.ts +1 -1
- package/dist/ui/radio-group/index.d.ts +1 -1
- package/dist/ui/select/index.d.ts +1 -1
- package/dist/ui/sidebar/index.d.ts +2 -2
- package/dist/ui/skeleton/index.d.ts +1 -1
- package/dist/ui/spinner/index.d.ts +1 -1
- package/dist/ui/stepper/index.d.ts +1 -1
- package/dist/ui/storage/index.d.ts +3 -14
- package/dist/ui/switch/index.d.ts +1 -1
- package/dist/ui/table/index.d.ts +1 -1
- package/dist/ui/tabs/index.d.ts +1 -1
- package/dist/ui/teleport/index.d.ts +1 -1
- package/dist/ui/textarea/index.d.ts +1 -1
- package/dist/ui/tooltip/index.d.ts +1 -1
- package/dist/ui/transition/index.d.ts +1 -1
- package/dist/ui/video/index.d.ts +1 -1
- package/dist/ui/virtual-list/index.d.ts +1 -1
- package/dist/ui/virtual-table/index.d.ts +1 -1
- package/dist/utils/accessibility.d.ts +30 -15
- package/dist/utils/animation/easing.d.ts +1 -76
- package/dist/utils/animation/helpers.d.ts +2 -9
- package/dist/utils/animation/index.d.ts +2 -1
- package/dist/utils/animation/keyframes.d.ts +2 -1
- package/dist/utils/error-handling.d.ts +22 -26
- package/dist/utils/highlighter.d.ts +2 -1
- package/dist/utils/i18n.d.ts +3 -30
- package/dist/utils/keep-alive.d.ts +1 -1
- package/dist/utils/lazy-loading.d.ts +2 -2
- package/dist/utils/prop-validation.d.ts +8 -27
- package/dist/utils/theme.d.ts +1 -1
- package/package.json +5 -5
- package/src/composables/utilities/useLocalStorage.ts +4 -4
- package/src/ui/storage/index.ts +1 -1
- package/src/utils/accessibility.ts +1 -1
- package/src/utils/animation/easing.ts +1 -1
- package/src/utils/animation/helpers.ts +1 -1
- package/src/utils/animation/keyframes.ts +1 -1
- package/src/utils/error-handling.ts +1 -1
- package/src/utils/i18n.ts +1 -1
- package/src/utils/lazy-loading.ts +1 -1
- package/src/utils/prop-validation.ts +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function generateId(prefix?:
|
|
1
|
+
export declare function generateId(prefix?: string): string;
|
|
2
2
|
/**
|
|
3
3
|
* Create accessible label and associate with element
|
|
4
4
|
*
|
|
@@ -80,7 +80,7 @@ export declare function getColorSchemePreference(): 'light' | 'dark' | null;
|
|
|
80
80
|
*
|
|
81
81
|
* Creates a skip link that appears on focus
|
|
82
82
|
*/
|
|
83
|
-
export declare function createSkipLink(targetId: string, text?:
|
|
83
|
+
export declare function createSkipLink(targetId: string, text?: string): HTMLAnchorElement;
|
|
84
84
|
/**
|
|
85
85
|
* Validate ARIA relationships
|
|
86
86
|
*
|
|
@@ -106,48 +106,63 @@ export declare const KeyboardKeys: {
|
|
|
106
106
|
};
|
|
107
107
|
/**
|
|
108
108
|
* ARIA attribute helpers
|
|
109
|
+
* @defaultValue
|
|
110
|
+
* ```ts
|
|
111
|
+
* {
|
|
112
|
+
* setExpanded: (element: HTMLElement, expanded: boolean) => unknown,
|
|
113
|
+
* setSelected: (element: HTMLElement, selected: boolean) => unknown,
|
|
114
|
+
* setChecked: (element: HTMLElement, checked: boolean | 'mixed') => unknown,
|
|
115
|
+
* setDisabled: (element: HTMLElement, disabled: boolean) => unknown,
|
|
116
|
+
* setHidden: (element: HTMLElement, hidden: boolean) => unknown,
|
|
117
|
+
* setPressed: (element: HTMLElement, pressed: boolean) => unknown,
|
|
118
|
+
* setInvalid: (element: HTMLElement, invalid: boolean) => unknown,
|
|
119
|
+
* setRequired: (element: HTMLElement, required: boolean) => unknown,
|
|
120
|
+
* setLive: (element: HTMLElement, live: AriaLive) => unknown,
|
|
121
|
+
* setBusy: (element: HTMLElement, busy: boolean) => unknown
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
109
124
|
*/
|
|
110
125
|
export declare const aria: {
|
|
111
126
|
/**
|
|
112
127
|
* Set aria-expanded attribute
|
|
113
128
|
*/
|
|
114
|
-
setExpanded(element: HTMLElement, expanded: boolean)
|
|
129
|
+
setExpanded: (element: HTMLElement, expanded: boolean) => unknown;
|
|
115
130
|
/**
|
|
116
131
|
* Set aria-selected attribute
|
|
117
132
|
*/
|
|
118
|
-
setSelected(element: HTMLElement, selected: boolean)
|
|
133
|
+
setSelected: (element: HTMLElement, selected: boolean) => unknown;
|
|
119
134
|
/**
|
|
120
135
|
* Set aria-checked attribute
|
|
121
136
|
*/
|
|
122
|
-
setChecked(element: HTMLElement, checked: boolean | 'mixed')
|
|
137
|
+
setChecked: (element: HTMLElement, checked: boolean | 'mixed') => unknown;
|
|
123
138
|
/**
|
|
124
139
|
* Set aria-disabled attribute
|
|
125
140
|
*/
|
|
126
|
-
setDisabled(element: HTMLElement, disabled: boolean)
|
|
141
|
+
setDisabled: (element: HTMLElement, disabled: boolean) => unknown;
|
|
127
142
|
/**
|
|
128
143
|
* Set aria-hidden attribute
|
|
129
144
|
*/
|
|
130
|
-
setHidden(element: HTMLElement, hidden: boolean)
|
|
145
|
+
setHidden: (element: HTMLElement, hidden: boolean) => unknown;
|
|
131
146
|
/**
|
|
132
147
|
* Set aria-pressed attribute (for toggle buttons)
|
|
133
148
|
*/
|
|
134
|
-
setPressed(element: HTMLElement, pressed: boolean)
|
|
149
|
+
setPressed: (element: HTMLElement, pressed: boolean) => unknown;
|
|
135
150
|
/**
|
|
136
151
|
* Set aria-invalid attribute
|
|
137
152
|
*/
|
|
138
|
-
setInvalid(element: HTMLElement, invalid: boolean)
|
|
153
|
+
setInvalid: (element: HTMLElement, invalid: boolean) => unknown;
|
|
139
154
|
/**
|
|
140
155
|
* Set aria-required attribute
|
|
141
156
|
*/
|
|
142
|
-
setRequired(element: HTMLElement, required: boolean)
|
|
157
|
+
setRequired: (element: HTMLElement, required: boolean) => unknown;
|
|
143
158
|
/**
|
|
144
159
|
* Set aria-live region
|
|
145
160
|
*/
|
|
146
|
-
setLive(element: HTMLElement, live: AriaLive)
|
|
161
|
+
setLive: (element: HTMLElement, live: AriaLive) => unknown;
|
|
147
162
|
/**
|
|
148
163
|
* Set aria-busy attribute
|
|
149
164
|
*/
|
|
150
|
-
setBusy(element: HTMLElement, busy: boolean)
|
|
165
|
+
setBusy: (element: HTMLElement, busy: boolean) => unknown
|
|
151
166
|
};
|
|
152
167
|
/**
|
|
153
168
|
* Focus trap options
|
|
@@ -157,7 +172,7 @@ export declare interface FocusTrapOptions {
|
|
|
157
172
|
returnFocus?: HTMLElement | null
|
|
158
173
|
escapeDeactivates?: boolean
|
|
159
174
|
clickOutsideDeactivates?: boolean
|
|
160
|
-
allowOutsideClick?: boolean | ((
|
|
175
|
+
allowOutsideClick?: boolean | ((_event: MouseEvent) => boolean)
|
|
161
176
|
onActivate?: () => void
|
|
162
177
|
onDeactivate?: () => void
|
|
163
178
|
}
|
|
@@ -210,7 +225,7 @@ export declare interface RovingTabindexOptions {
|
|
|
210
225
|
/**
|
|
211
226
|
* ARIA live region types
|
|
212
227
|
*/
|
|
213
|
-
export type AriaLive = 'off' | 'polite' | 'assertive'
|
|
228
|
+
export type AriaLive = 'off' | 'polite' | 'assertive';
|
|
214
229
|
/**
|
|
215
230
|
* ARIA role types
|
|
216
231
|
*/
|
|
@@ -282,4 +297,4 @@ export type AriaRole = | 'alert'
|
|
|
282
297
|
| 'tooltip'
|
|
283
298
|
| 'tree'
|
|
284
299
|
| 'treegrid'
|
|
285
|
-
| 'treeitem'
|
|
300
|
+
| 'treeitem';
|
|
@@ -14,81 +14,6 @@ export declare const easeOutQuad: EasingFunction;
|
|
|
14
14
|
* Quadratic ease-in-out - acceleration until halfway, then deceleration
|
|
15
15
|
*/
|
|
16
16
|
export declare const easeInOutQuad: EasingFunction;
|
|
17
|
-
// Cubic
|
|
18
|
-
export declare const easeInCubic: EasingFunction;
|
|
19
|
-
export declare const easeOutCubic: EasingFunction;
|
|
20
|
-
export declare const easeInOutCubic: EasingFunction;
|
|
21
|
-
// Quartic
|
|
22
|
-
export declare const easeInQuart: EasingFunction;
|
|
23
|
-
export declare const easeOutQuart: EasingFunction;
|
|
24
|
-
export declare const easeInOutQuart: EasingFunction;
|
|
25
|
-
// Quintic
|
|
26
|
-
export declare const easeInQuint: EasingFunction;
|
|
27
|
-
export declare const easeOutQuint: EasingFunction;
|
|
28
|
-
export declare const easeInOutQuint: EasingFunction;
|
|
29
|
-
// Sinusoidal
|
|
30
|
-
export declare const easeInSine: EasingFunction;
|
|
31
|
-
export declare const easeOutSine: EasingFunction;
|
|
32
|
-
export declare const easeInOutSine: EasingFunction;
|
|
33
|
-
// Exponential
|
|
34
|
-
export declare const easeInExpo: EasingFunction;
|
|
35
|
-
export declare const easeOutExpo: EasingFunction;
|
|
36
|
-
export declare const easeInOutExpo: EasingFunction;
|
|
37
|
-
// Circular
|
|
38
|
-
export declare const easeInCirc: EasingFunction;
|
|
39
|
-
export declare const easeOutCirc: EasingFunction;
|
|
40
|
-
export declare const easeInOutCirc: EasingFunction;
|
|
41
|
-
// Elastic
|
|
42
|
-
export declare const easeInElastic: EasingFunction;
|
|
43
|
-
export declare const easeOutElastic: EasingFunction;
|
|
44
|
-
export declare const easeInOutElastic: EasingFunction;
|
|
45
|
-
// Back
|
|
46
|
-
export declare const easeInBack: EasingFunction;
|
|
47
|
-
export declare const easeOutBack: EasingFunction;
|
|
48
|
-
export declare const easeInOutBack: EasingFunction;
|
|
49
|
-
// Bounce
|
|
50
|
-
export declare const easeOutBounce: EasingFunction;
|
|
51
|
-
export declare const easeInBounce: EasingFunction;
|
|
52
|
-
export declare const easeInOutBounce: EasingFunction;
|
|
53
|
-
/**
|
|
54
|
-
* Object containing all easing functions
|
|
55
|
-
*
|
|
56
|
-
* Available easings: Linear, Quad, Cubic, Quart, Quint, Sine, Expo, Circ, Elastic, Back, Bounce
|
|
57
|
-
* Each with In, Out, InOut variants (except Linear)
|
|
58
|
-
*/
|
|
59
|
-
export declare const Easing: {
|
|
60
|
-
linear: EasingFunction
|
|
61
|
-
easeInQuad: EasingFunction
|
|
62
|
-
easeOutQuad: EasingFunction
|
|
63
|
-
easeInOutQuad: EasingFunction
|
|
64
|
-
easeInCubic: EasingFunction
|
|
65
|
-
easeOutCubic: EasingFunction
|
|
66
|
-
easeInOutCubic: EasingFunction
|
|
67
|
-
easeInQuart: EasingFunction
|
|
68
|
-
easeOutQuart: EasingFunction
|
|
69
|
-
easeInOutQuart: EasingFunction
|
|
70
|
-
easeInQuint: EasingFunction
|
|
71
|
-
easeOutQuint: EasingFunction
|
|
72
|
-
easeInOutQuint: EasingFunction
|
|
73
|
-
easeInSine: EasingFunction
|
|
74
|
-
easeOutSine: EasingFunction
|
|
75
|
-
easeInOutSine: EasingFunction
|
|
76
|
-
easeInExpo: EasingFunction
|
|
77
|
-
easeOutExpo: EasingFunction
|
|
78
|
-
easeInOutExpo: EasingFunction
|
|
79
|
-
easeInCirc: EasingFunction
|
|
80
|
-
easeOutCirc: EasingFunction
|
|
81
|
-
easeInOutCirc: EasingFunction
|
|
82
|
-
easeInElastic: EasingFunction
|
|
83
|
-
easeOutElastic: EasingFunction
|
|
84
|
-
easeInOutElastic: EasingFunction
|
|
85
|
-
easeInBack: EasingFunction
|
|
86
|
-
easeOutBack: EasingFunction
|
|
87
|
-
easeInOutBack: EasingFunction
|
|
88
|
-
easeInBounce: EasingFunction
|
|
89
|
-
easeOutBounce: EasingFunction
|
|
90
|
-
easeInOutBounce: EasingFunction
|
|
91
|
-
};
|
|
92
17
|
/**
|
|
93
18
|
* Easing functions for smooth animations
|
|
94
19
|
*
|
|
@@ -109,4 +34,4 @@ export declare const Easing: {
|
|
|
109
34
|
/**
|
|
110
35
|
* Easing function type signature
|
|
111
36
|
*/
|
|
112
|
-
export type EasingFunction = (
|
|
37
|
+
export type EasingFunction = (_t: number, _b: number, _c: number, _d: number) => number;
|
|
@@ -51,7 +51,7 @@ export declare function sequenceAnimations(element: HTMLElement, animations: Arr
|
|
|
51
51
|
* @param duration - Duration in milliseconds before removing class
|
|
52
52
|
* @returns Promise that resolves when animation completes
|
|
53
53
|
*/
|
|
54
|
-
export declare function animateWithClass(element: HTMLElement, animationClass: string, duration?:
|
|
54
|
+
export declare function animateWithClass(element: HTMLElement, animationClass: string, duration?: number): Promise<void>;
|
|
55
55
|
/**
|
|
56
56
|
* Create custom CSS @keyframes rule dynamically
|
|
57
57
|
*
|
|
@@ -71,24 +71,17 @@ export declare function createKeyframes(name: string, frames: Record<string, Rec
|
|
|
71
71
|
* Predefined CSS animation class names (compatible with Tailwind/headwind)
|
|
72
72
|
*/
|
|
73
73
|
export declare const AnimationClasses: {
|
|
74
|
-
// Fade
|
|
75
74
|
fadeIn: 'animate-fade-in';
|
|
76
75
|
fadeOut: 'animate-fade-out';
|
|
77
|
-
// Slide
|
|
78
76
|
slideInUp: 'animate-slide-in-up';
|
|
79
77
|
slideInDown: 'animate-slide-in-down';
|
|
80
78
|
slideInLeft: 'animate-slide-in-left';
|
|
81
79
|
slideInRight: 'animate-slide-in-right';
|
|
82
|
-
// Zoom
|
|
83
80
|
zoomIn: 'animate-zoom-in';
|
|
84
81
|
zoomOut: 'animate-zoom-out';
|
|
85
|
-
// Bounce
|
|
86
82
|
bounce: 'animate-bounce';
|
|
87
|
-
// Spin
|
|
88
83
|
spin: 'animate-spin';
|
|
89
|
-
// Ping
|
|
90
84
|
ping: 'animate-ping';
|
|
91
|
-
// Pulse
|
|
92
85
|
pulse: 'animate-pulse'
|
|
93
86
|
};
|
|
94
87
|
/**
|
|
@@ -116,4 +109,4 @@ export declare interface CSSAnimationOptions {
|
|
|
116
109
|
direction?: string
|
|
117
110
|
fill?: string
|
|
118
111
|
playState?: string
|
|
119
|
-
}
|
|
112
|
+
}
|
|
@@ -316,6 +316,7 @@ export declare const KeyframeAnimations: {
|
|
|
316
316
|
*/
|
|
317
317
|
export declare interface Keyframe {
|
|
318
318
|
offset: number
|
|
319
|
+
[property: string]: any
|
|
319
320
|
}
|
|
320
321
|
/**
|
|
321
322
|
* Animation configuration options
|
|
@@ -331,4 +332,4 @@ export declare interface AnimationOptions {
|
|
|
331
332
|
/**
|
|
332
333
|
* Type for predefined animation names
|
|
333
334
|
*/
|
|
334
|
-
export type KeyframeAnimationName = keyof typeof KeyframeAnimations
|
|
335
|
+
export type KeyframeAnimationName = keyof typeof KeyframeAnimations;
|
|
@@ -39,23 +39,6 @@ export declare function handleError(error: Error, options?: {
|
|
|
39
39
|
/** Whether to log the error to console */
|
|
40
40
|
logError?: boolean
|
|
41
41
|
}): void;
|
|
42
|
-
/**
|
|
43
|
-
* Create a wrapped function that catches and handles errors
|
|
44
|
-
*
|
|
45
|
-
* @param fn - Function to wrap
|
|
46
|
-
* @param component - Component name for error context
|
|
47
|
-
* @param eventName - Event name for error context
|
|
48
|
-
* @returns Wrapped function
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```ts
|
|
52
|
-
* const safeHandler = wrapErrorHandler(
|
|
53
|
-
* () => { /* ... * / },
|
|
54
|
-
* 'Button',
|
|
55
|
-
* 'onClick'
|
|
56
|
-
* )
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
42
|
/* ... * / },
|
|
60
43
|
* 'Button',
|
|
61
44
|
* 'onClick'
|
|
@@ -124,40 +107,53 @@ export declare function createDebugger(component: string): {
|
|
|
124
107
|
export declare function errorBoundary<T>(component: string, renderFn: () => T, fallback: T): T;
|
|
125
108
|
/**
|
|
126
109
|
* Error types for common scenarios
|
|
110
|
+
* @defaultValue
|
|
111
|
+
* ```ts
|
|
112
|
+
* {
|
|
113
|
+
* invalidProp: (component: string, prop: string, received: any, expected: any) => unknown,
|
|
114
|
+
* requiredProp: (component: string, prop: string) => unknown,
|
|
115
|
+
* invalidType: (component: string, prop: string, received: any, expected: string) => unknown,
|
|
116
|
+
* componentNotFound: (componentName: string) => unknown,
|
|
117
|
+
* invalidChildren: (component: string, received: any, expected: string) => unknown,
|
|
118
|
+
* stateUpdate: (component: string, stateName: string, error: Error) => unknown,
|
|
119
|
+
* eventHandler: (component: string, eventName: string, error: Error) => unknown,
|
|
120
|
+
* render: (component: string, error: Error) => unknown
|
|
121
|
+
* }
|
|
122
|
+
* ```
|
|
127
123
|
*/
|
|
128
124
|
export declare const ErrorTypes: {
|
|
129
125
|
/**
|
|
130
126
|
* Invalid prop value error
|
|
131
127
|
*/
|
|
132
|
-
invalidProp(component: string, prop: string, received: any, expected: any)
|
|
128
|
+
invalidProp: (component: string, prop: string, received: any, expected: any) => unknown;
|
|
133
129
|
/**
|
|
134
130
|
* Required prop missing error
|
|
135
131
|
*/
|
|
136
|
-
requiredProp(component: string, prop: string)
|
|
132
|
+
requiredProp: (component: string, prop: string) => unknown;
|
|
137
133
|
/**
|
|
138
134
|
* Invalid prop type error
|
|
139
135
|
*/
|
|
140
|
-
invalidType(component: string, prop: string, received: any, expected: string)
|
|
136
|
+
invalidType: (component: string, prop: string, received: any, expected: string) => unknown;
|
|
141
137
|
/**
|
|
142
138
|
* Component not found error
|
|
143
139
|
*/
|
|
144
|
-
componentNotFound(componentName: string)
|
|
140
|
+
componentNotFound: (componentName: string) => unknown;
|
|
145
141
|
/**
|
|
146
142
|
* Invalid children error
|
|
147
143
|
*/
|
|
148
|
-
invalidChildren(component: string, received: any, expected: string)
|
|
144
|
+
invalidChildren: (component: string, received: any, expected: string) => unknown;
|
|
149
145
|
/**
|
|
150
146
|
* State update error
|
|
151
147
|
*/
|
|
152
|
-
stateUpdate(component: string, stateName: string, error: Error)
|
|
148
|
+
stateUpdate: (component: string, stateName: string, error: Error) => unknown;
|
|
153
149
|
/**
|
|
154
150
|
* Event handler error
|
|
155
151
|
*/
|
|
156
|
-
eventHandler(component: string, eventName: string, error: Error)
|
|
152
|
+
eventHandler: (component: string, eventName: string, error: Error) => unknown;
|
|
157
153
|
/**
|
|
158
154
|
* Render error
|
|
159
155
|
*/
|
|
160
|
-
render(component: string, error: Error)
|
|
156
|
+
render: (component: string, error: Error) => unknown
|
|
161
157
|
};
|
|
162
158
|
/**
|
|
163
159
|
* Error context information
|
|
@@ -179,4 +175,4 @@ export declare class ComponentError extends Error {
|
|
|
179
175
|
constructor(component: string, message: string, context?: ErrorContext);
|
|
180
176
|
static formatMessage(component: string, message: string, context: ErrorContext): string;
|
|
181
177
|
toJSON(): { name: string, message: string, component: string, context: ErrorContext | undefined, stack: string | undefined };
|
|
182
|
-
}
|
|
178
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Highlighter as TSHighlighter } from 'ts-syntax-highlighter';
|
|
1
2
|
/**
|
|
2
3
|
* Initialize or get the syntax highlighter instance
|
|
3
4
|
*/
|
|
@@ -24,4 +25,4 @@ export declare interface HighlightResult {
|
|
|
24
25
|
html: string
|
|
25
26
|
language: string
|
|
26
27
|
theme: string
|
|
27
|
-
}
|
|
28
|
+
}
|
package/dist/utils/i18n.d.ts
CHANGED
|
@@ -92,33 +92,6 @@ export declare function isRTL(locale: string): boolean;
|
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
94
|
export declare function loadLocaleMessages(locale: string, loadFn: () => Promise<Messages>): Promise<Messages>;
|
|
95
|
-
/**
|
|
96
|
-
* Predefined pluralization rules for common languages
|
|
97
|
-
*/
|
|
98
|
-
export declare const pluralRules: {
|
|
99
|
-
Finnish
|
|
100
|
-
en: unknown;
|
|
101
|
-
de: unknown;
|
|
102
|
-
nl: unknown;
|
|
103
|
-
sv: unknown;
|
|
104
|
-
Brazilian Portuguese
|
|
105
|
-
fr: unknown;
|
|
106
|
-
pt_BR: unknown;
|
|
107
|
-
Croatian
|
|
108
|
-
ru: (count) => unknown;
|
|
109
|
-
// Polish
|
|
110
|
-
pl: (count) => unknown;
|
|
111
|
-
Slovak
|
|
112
|
-
cs: (count) => unknown;
|
|
113
|
-
// Arabic
|
|
114
|
-
ar: (count) => unknown;
|
|
115
|
-
Vietnamese
|
|
116
|
-
ja: () => unknown;
|
|
117
|
-
ko: () => unknown;
|
|
118
|
-
zh: () => unknown;
|
|
119
|
-
th: () => unknown;
|
|
120
|
-
vi: () => unknown
|
|
121
|
-
};
|
|
122
95
|
/**
|
|
123
96
|
* Common date/time format presets
|
|
124
97
|
*/
|
|
@@ -234,12 +207,12 @@ export declare interface I18n {
|
|
|
234
207
|
* Translation messages structure
|
|
235
208
|
*/
|
|
236
209
|
export type MessageValue = string | { [key: string]: MessageValue }
|
|
237
|
-
export type Messages = Record<string, MessageValue
|
|
210
|
+
export type Messages = Record<string, MessageValue>;
|
|
238
211
|
/**
|
|
239
212
|
* Locale messages
|
|
240
213
|
*/
|
|
241
|
-
export type LocaleMessages = Record<string, Messages
|
|
214
|
+
export type LocaleMessages = Record<string, Messages>;
|
|
242
215
|
/**
|
|
243
216
|
* Pluralization rules
|
|
244
217
|
*/
|
|
245
|
-
export type PluralRule = (
|
|
218
|
+
export type PluralRule = (_count: number, _locale: string) => number;
|
|
@@ -54,7 +54,7 @@ export declare function lazyLoad<T = any>(element: Element | null, importFn: ()
|
|
|
54
54
|
* @param options - Lazy load options
|
|
55
55
|
* @returns Cleanup function
|
|
56
56
|
*/
|
|
57
|
-
export declare function lazyLoadAll<T = any>(elements: Element[] | NodeListOf<Element>, importFn: ((
|
|
57
|
+
export declare function lazyLoadAll<T = any>(elements: Element[] | NodeListOf<Element>, importFn: ((_element: Element) => Promise<T>) | (() => Promise<T>), options?: LazyLoadOptions): () => void;
|
|
58
58
|
/**
|
|
59
59
|
* Preload a module without executing it
|
|
60
60
|
*
|
|
@@ -171,4 +171,4 @@ export declare interface LazyComponent<T = any> {
|
|
|
171
171
|
/**
|
|
172
172
|
* Lazy load state
|
|
173
173
|
*/
|
|
174
|
-
export type LazyLoadState = 'idle' | 'loading' | 'loaded' | 'error'
|
|
174
|
+
export type LazyLoadState = 'idle' | 'loading' | 'loaded' | 'error';
|
|
@@ -43,7 +43,7 @@ export declare function createPropValidator(componentName: string, schema: PropS
|
|
|
43
43
|
* @param name - Name for error messages
|
|
44
44
|
* @throws Error if validation fails
|
|
45
45
|
*/
|
|
46
|
-
export declare function assertProp<T>(value: any, validator: Validator<T>, name?:
|
|
46
|
+
export declare function assertProp<T>(value: any, validator: Validator<T>, name?: string): asserts value is T;
|
|
47
47
|
/**
|
|
48
48
|
* Warn if prop doesn't match validator (non-throwing)
|
|
49
49
|
*
|
|
@@ -51,31 +51,11 @@ export declare function assertProp<T>(value: any, validator: Validator<T>, name?
|
|
|
51
51
|
* @param validator - Validator to use
|
|
52
52
|
* @param name - Name for warning messages
|
|
53
53
|
*/
|
|
54
|
-
export declare function warnProp(value: any, validator: Validator, name?:
|
|
54
|
+
export declare function warnProp(value: any, validator: Validator, name?: string): void;
|
|
55
55
|
/**
|
|
56
56
|
* PropTypes - collection of common validators
|
|
57
57
|
*/
|
|
58
|
-
export declare const
|
|
59
|
-
string: Validator<string>
|
|
60
|
-
number: Validator<number>
|
|
61
|
-
boolean: Validator<boolean>
|
|
62
|
-
func: Validator<(...args: any[]) => any>
|
|
63
|
-
object: Validator<object>
|
|
64
|
-
array: Validator<any[]>
|
|
65
|
-
any: Validator<any>
|
|
66
|
-
email: Validator<string>
|
|
67
|
-
url: Validator<string>
|
|
68
|
-
oneOf: <T>(validValues: T[]) => Validator<T>
|
|
69
|
-
oneOfType: (validators: Validator[]) => Validator
|
|
70
|
-
arrayOf: (validator: Validator) => Validator
|
|
71
|
-
shape: (shape: Record<string, Validator>) => Validator
|
|
72
|
-
instanceOf: <T>(expectedClass: new (...args: any[]) => T) => Validator<T>
|
|
73
|
-
custom: (validatorFn: (value: any, propName: string, componentName: string) => boolean, errorMessage: string | ((value: any, propName: string, componentName: string) => string)) => Validator
|
|
74
|
-
min: (min: number) => Validator<number>
|
|
75
|
-
max: (max: number) => Validator<number>
|
|
76
|
-
range: (min: number, max: number) => Validator<number>
|
|
77
|
-
pattern: (pattern: RegExp) => Validator<string>
|
|
78
|
-
};
|
|
58
|
+
export declare const max: unknown;
|
|
79
59
|
/**
|
|
80
60
|
* Prop validator function type
|
|
81
61
|
*/
|
|
@@ -94,13 +74,14 @@ export declare interface ValidationResult {
|
|
|
94
74
|
/**
|
|
95
75
|
* Prop schema definition
|
|
96
76
|
*/
|
|
97
|
-
export type PropSchema = Record<string, Validator
|
|
77
|
+
export type PropSchema = Record<string, Validator>;
|
|
98
78
|
/**
|
|
99
79
|
* Base validator class
|
|
100
80
|
*/
|
|
101
81
|
declare class Validator<T = any> implements PropValidator<T> {
|
|
102
82
|
public validate: (value: any, propName: string, componentName: string) => boolean;
|
|
103
83
|
public message: (value: any, propName: string, componentName: string) => string;
|
|
104
|
-
public isRequired?:
|
|
105
|
-
constructor(validate: (value: any, propName: string, componentName: string) => boolean, message: (value: any, propName: string, componentName: string) => string, isRequired?:
|
|
106
|
-
|
|
84
|
+
public isRequired?: boolean;
|
|
85
|
+
constructor(validate: (value: any, propName: string, componentName: string) => boolean, message: (value: any, propName: string, componentName: string) => string, isRequired?: boolean);
|
|
86
|
+
get required(): Validator<T>;
|
|
87
|
+
}
|
package/dist/utils/theme.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.6",
|
|
5
5
|
"description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@stacksjs/headwind": "^0.1.3",
|
|
59
|
-
"@stacksjs/stx": "0.2.
|
|
60
|
-
"bun-plugin-stx": "0.2.
|
|
59
|
+
"@stacksjs/stx": "0.2.6",
|
|
60
|
+
"bun-plugin-stx": "0.2.6",
|
|
61
61
|
"ts-syntax-highlighter": "^0.2.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@types/bun": "^1.3.
|
|
64
|
+
"@types/bun": "^1.3.9",
|
|
65
65
|
"bun-plugin-dtsx": "^0.9.9",
|
|
66
|
-
"pickier": "^0.1.
|
|
66
|
+
"pickier": "^0.1.19",
|
|
67
67
|
"typescript": "^5.9.3"
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* Options for useLocalStorage hook
|
|
16
16
|
*/
|
|
17
17
|
export interface UseLocalStorageOptions<T> {
|
|
18
|
-
/** Custom serializer function
|
|
18
|
+
/** Custom serializer function - defaults to JSON.stringify */
|
|
19
19
|
serializer?: (value: T) => string
|
|
20
|
-
/** Custom deserializer function
|
|
20
|
+
/** Custom deserializer function - defaults to JSON.parse */
|
|
21
21
|
deserializer?: (value: string) => T
|
|
22
22
|
/** Error handler function */
|
|
23
23
|
onError?: (error: Error) => void
|
|
@@ -37,7 +37,7 @@ export function useLocalStorage<T>(
|
|
|
37
37
|
options: UseLocalStorageOptions<T> = {},
|
|
38
38
|
): {
|
|
39
39
|
value: T
|
|
40
|
-
setValue: (newValue: T | ((
|
|
40
|
+
setValue: (newValue: T | ((_prev: T) => T)) => void
|
|
41
41
|
removeValue: () => void
|
|
42
42
|
} {
|
|
43
43
|
const {
|
|
@@ -68,7 +68,7 @@ export function useLocalStorage<T>(
|
|
|
68
68
|
function setValue(newValue: T | ((prev: T) => T)) {
|
|
69
69
|
try {
|
|
70
70
|
// Allow value to be a function for same API as useState
|
|
71
|
-
const valueToStore = typeof newValue === 'function' ? (newValue as (
|
|
71
|
+
const valueToStore = typeof newValue === 'function' ? (newValue as (_prev: T) => T)(value) : newValue
|
|
72
72
|
|
|
73
73
|
value = valueToStore
|
|
74
74
|
|
package/src/ui/storage/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface StorageOptions {
|
|
|
7
7
|
compress?: boolean // Compress large objects
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
type StorageWatchCallback = (
|
|
10
|
+
type StorageWatchCallback = (_newValue: any, _oldValue: any, _key: string) => void
|
|
11
11
|
|
|
12
12
|
export class StorageManager {
|
|
13
13
|
private storage: globalThis.Storage
|
|
@@ -112,7 +112,7 @@ export interface FocusTrapOptions {
|
|
|
112
112
|
/** Click outside deactivates trap */
|
|
113
113
|
clickOutsideDeactivates?: boolean
|
|
114
114
|
/** Allow outside click without deactivating */
|
|
115
|
-
allowOutsideClick?: boolean | ((
|
|
115
|
+
allowOutsideClick?: boolean | ((_event: MouseEvent) => boolean)
|
|
116
116
|
/** Callback when activated */
|
|
117
117
|
onActivate?: () => void
|
|
118
118
|
/** Callback when deactivated */
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* Easing function type signature
|
|
21
21
|
*/
|
|
22
|
-
export type EasingFunction = (
|
|
22
|
+
export type EasingFunction = (_t: number, _b: number, _c: number, _d: number) => number
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Linear easing - no acceleration
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
export interface CSSAnimationOptions {
|
|
20
20
|
/** Animation duration (e.g., '300ms', '1s') */
|
|
21
21
|
duration?: string
|
|
22
|
-
/** Timing function
|
|
22
|
+
/** Timing function, e.g. 'ease', 'linear', 'cubic-bezier(...)' */
|
|
23
23
|
timing?: string
|
|
24
24
|
/** Delay before animation (e.g., '100ms') */
|
|
25
25
|
delay?: string
|
|
@@ -32,7 +32,7 @@ export interface Keyframe {
|
|
|
32
32
|
export interface AnimationOptions {
|
|
33
33
|
/** Animation duration in milliseconds */
|
|
34
34
|
duration?: number
|
|
35
|
-
/** Easing function
|
|
35
|
+
/** Easing function, CSS easing string */
|
|
36
36
|
easing?: string
|
|
37
37
|
/** Delay before animation starts in milliseconds */
|
|
38
38
|
delay?: number
|
package/src/utils/i18n.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type LocaleMessages = Record<string, Messages>
|
|
|
36
36
|
/**
|
|
37
37
|
* Pluralization rules
|
|
38
38
|
*/
|
|
39
|
-
export type PluralRule = (
|
|
39
|
+
export type PluralRule = (_count: number, _locale: string) => number
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* I18n configuration
|
|
@@ -311,7 +311,7 @@ export function lazyLoad<T = any>(
|
|
|
311
311
|
*/
|
|
312
312
|
export function lazyLoadAll<T = any>(
|
|
313
313
|
elements: Element[] | NodeListOf<Element>,
|
|
314
|
-
importFn: ((
|
|
314
|
+
importFn: ((_element: Element) => Promise<T>) | (() => Promise<T>),
|
|
315
315
|
options: LazyLoadOptions = {},
|
|
316
316
|
): () => void {
|
|
317
317
|
const cleanupFunctions: Array<() => void> = []
|