@vanilla-bean/components 1.0.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/Component/Component.js +598 -0
- package/Component/Component.scenarios.js +88 -0
- package/Component/Component.test.js +717 -0
- package/Component/README.md +455 -0
- package/Component/index.js +3 -0
- package/Component/observeElementConnection.js +52 -0
- package/Component/observeElementConnection.test.js +121 -0
- package/Elem/Elem.js +304 -0
- package/Elem/Elem.test.js +679 -0
- package/Elem/README.md +373 -0
- package/Elem/index.js +1 -0
- package/FontWithASyntaxHighlighter-Regular.woff2 +0 -0
- package/LICENSE +21 -0
- package/README.md +413 -0
- package/components/BottomSheet/BottomSheet.js +192 -0
- package/components/BottomSheet/BottomSheet.lld.md +25 -0
- package/components/BottomSheet/README.md +66 -0
- package/components/BottomSheet/index.js +1 -0
- package/components/Button/Button.js +53 -0
- package/components/Button/Button.lld.md +21 -0
- package/components/Button/index.js +1 -0
- package/components/Calendar/Calendar.js +720 -0
- package/components/Calendar/Calendar.lld.md +22 -0
- package/components/Calendar/CalendarEvent.js +102 -0
- package/components/Calendar/Toolbar.js +78 -0
- package/components/Calendar/index.js +2 -0
- package/components/Calendar/utils.js +56 -0
- package/components/Code/Code.js +84 -0
- package/components/Code/Code.lld.md +21 -0
- package/components/Code/index.js +1 -0
- package/components/ColorPicker/ColorPicker.js +445 -0
- package/components/ColorPicker/ColorPicker.lld.md +21 -0
- package/components/ColorPicker/index.js +1 -0
- package/components/ColorPicker/svg.js +5 -0
- package/components/Dialog/Dialog.js +278 -0
- package/components/Dialog/Dialog.lld.md +20 -0
- package/components/Dialog/README.md +96 -0
- package/components/Dialog/index.js +1 -0
- package/components/Form/Form.js +257 -0
- package/components/Form/Form.lld.md +21 -0
- package/components/Form/README.md +87 -0
- package/components/Form/index.js +1 -0
- package/components/Icon/Icon.js +54 -0
- package/components/Icon/Icon.lld.md +21 -0
- package/components/Icon/index.js +1 -0
- package/components/Input/Input.js +173 -0
- package/components/Input/Input.lld.md +28 -0
- package/components/Input/README.md +97 -0
- package/components/Input/index.js +2 -0
- package/components/Input/utils.js +122 -0
- package/components/Keyboard/Key.js +38 -0
- package/components/Keyboard/Keyboard.js +173 -0
- package/components/Keyboard/Keyboard.lld.md +21 -0
- package/components/Keyboard/index.js +1 -0
- package/components/Label/Label.js +214 -0
- package/components/Label/Label.lld.md +20 -0
- package/components/Label/index.js +1 -0
- package/components/Link/Link.js +43 -0
- package/components/Link/Link.lld.md +15 -0
- package/components/Link/index.js +1 -0
- package/components/List/List.js +82 -0
- package/components/List/List.lld.md +19 -0
- package/components/List/index.js +1 -0
- package/components/Menu/Menu.js +93 -0
- package/components/Menu/Menu.lld.md +15 -0
- package/components/Menu/index.js +1 -0
- package/components/Notify/Notify.js +96 -0
- package/components/Notify/Notify.lld.md +20 -0
- package/components/Notify/index.js +1 -0
- package/components/Page/Page.js +67 -0
- package/components/Page/Page.lld.md +20 -0
- package/components/Page/index.js +1 -0
- package/components/Popover/Popover.js +175 -0
- package/components/Popover/Popover.lld.md +19 -0
- package/components/Popover/index.js +1 -0
- package/components/RadioButton/RadioButton.js +108 -0
- package/components/RadioButton/RadioButton.lld.md +15 -0
- package/components/RadioButton/index.js +1 -0
- package/components/Router/README.md +160 -0
- package/components/Router/Router.js +150 -0
- package/components/Router/Router.lld.md +31 -0
- package/components/Router/View.js +15 -0
- package/components/Router/index.js +2 -0
- package/components/Router/utils.js +17 -0
- package/components/Select/README.md +88 -0
- package/components/Select/Select.js +74 -0
- package/components/Select/Select.lld.md +20 -0
- package/components/Select/index.js +1 -0
- package/components/Table/README.md +94 -0
- package/components/Table/Table.js +171 -0
- package/components/Table/Table.lld.md +21 -0
- package/components/Table/index.js +1 -0
- package/components/TagList/Tag.js +84 -0
- package/components/TagList/TagList.js +118 -0
- package/components/TagList/TagList.lld.md +30 -0
- package/components/TagList/design.excalidraw.png +0 -0
- package/components/TagList/index.js +2 -0
- package/components/Tooltip/Tooltip.js +139 -0
- package/components/Tooltip/Tooltip.lld.md +22 -0
- package/components/Tooltip/index.js +1 -0
- package/components/TooltipWrapper/TooltipWrapper.js +89 -0
- package/components/TooltipWrapper/TooltipWrapper.lld.md +21 -0
- package/components/TooltipWrapper/index.js +1 -0
- package/components/Whiteboard/Whiteboard.js +198 -0
- package/components/Whiteboard/Whiteboard.lld.md +35 -0
- package/components/Whiteboard/index.js +1 -0
- package/components/index.js +27 -0
- package/eslint.config.cjs +118 -0
- package/index.d.ts +635 -0
- package/index.js +19 -0
- package/package.json +123 -0
- package/plugins/asText.js +38 -0
- package/plugins/loadPlugins.js +5 -0
- package/plugins/markdownLoader.js +121 -0
- package/prettier.config.cjs +7 -0
- package/spellcheck.config.cjs +227 -0
- package/styled/README.md +329 -0
- package/styled/appendStyles.js +26 -0
- package/styled/appendStyles.test.js +45 -0
- package/styled/index.js +4 -0
- package/styled/shimCSS.js +31 -0
- package/styled/shimCSS.test.js +103 -0
- package/styled/styled.js +91 -0
- package/styled/styled.test.js +586 -0
- package/styled/themeStyles.js +36 -0
- package/styled/themeStyles.test.js +135 -0
- package/test-setup.js +123 -0
- package/theme/.test.js +69 -0
- package/theme/README.md +607 -0
- package/theme/button.js +100 -0
- package/theme/code.js +123 -0
- package/theme/colors.js +42 -0
- package/theme/fonts.js +42 -0
- package/theme/index.js +33 -0
- package/theme/input.js +64 -0
- package/theme/page.js +208 -0
- package/theme/scrollbar.js +24 -0
- package/theme/table.js +53 -0
- package/utils/README.md +176 -0
- package/utils/browser.js +92 -0
- package/utils/class.js +30 -0
- package/utils/color.js +81 -0
- package/utils/data.js +164 -0
- package/utils/element.js +55 -0
- package/utils/index.js +7 -0
- package/utils/rand.js +12 -0
- package/utils/string.js +72 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
// Minimal type declarations for IDE option-name recognition.
|
|
2
|
+
// These are a projection of the source — not a TypeScript implementation.
|
|
3
|
+
// VBC is plain JavaScript. These declarations exist so your IDE can suggest
|
|
4
|
+
// option names while you write. They do not constrain what the library can do.
|
|
5
|
+
|
|
6
|
+
// ── Theme ──────────────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
export interface ThemeColor {
|
|
9
|
+
toString(): string;
|
|
10
|
+
setAlpha(alpha: number): ThemeColor;
|
|
11
|
+
toRgbString(): string;
|
|
12
|
+
toHexString(): string;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ThemeColors {
|
|
17
|
+
blue: ThemeColor;
|
|
18
|
+
green: ThemeColor;
|
|
19
|
+
red: ThemeColor;
|
|
20
|
+
orange: ThemeColor;
|
|
21
|
+
yellow: ThemeColor;
|
|
22
|
+
gray: ThemeColor;
|
|
23
|
+
purple: ThemeColor;
|
|
24
|
+
pink: ThemeColor;
|
|
25
|
+
teal: ThemeColor;
|
|
26
|
+
white: ThemeColor;
|
|
27
|
+
black: ThemeColor;
|
|
28
|
+
transparent: ThemeColor;
|
|
29
|
+
superWhite: ThemeColor;
|
|
30
|
+
vantablack: ThemeColor;
|
|
31
|
+
dark(c: ThemeColor): ThemeColor;
|
|
32
|
+
darker(c: ThemeColor): ThemeColor;
|
|
33
|
+
darkest(c: ThemeColor): ThemeColor;
|
|
34
|
+
light(c: ThemeColor): ThemeColor;
|
|
35
|
+
lighter(c: ThemeColor): ThemeColor;
|
|
36
|
+
lightest(c: ThemeColor): ThemeColor;
|
|
37
|
+
blackish(c: ThemeColor): ThemeColor;
|
|
38
|
+
whiteish(c: ThemeColor): ThemeColor;
|
|
39
|
+
mostReadable(base: ThemeColor, candidates: ThemeColor[]): ThemeColor;
|
|
40
|
+
random(): ThemeColor;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface Theme {
|
|
44
|
+
colors: ThemeColors;
|
|
45
|
+
fonts: { kodeMono: string; code: string; fontAwesome: string; fontAwesomeSolid: string; fontAwesomeBrands: string };
|
|
46
|
+
button: string;
|
|
47
|
+
input: string;
|
|
48
|
+
page: string;
|
|
49
|
+
scrollbar: string;
|
|
50
|
+
table: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare const theme: Theme;
|
|
54
|
+
|
|
55
|
+
// ── Oxject ───────────────────────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
export type {
|
|
58
|
+
OxjectInstance,
|
|
59
|
+
DeriveInstance,
|
|
60
|
+
DeriveOptions,
|
|
61
|
+
Subscription,
|
|
62
|
+
SubscriberSubscription,
|
|
63
|
+
} from '@vanilla-bean/oxject';
|
|
64
|
+
export { Oxject, derive } from '@vanilla-bean/oxject';
|
|
65
|
+
|
|
66
|
+
// ── Elem ───────────────────────────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
export interface ElemOptions {
|
|
69
|
+
tag?: string;
|
|
70
|
+
style?: Record<string, string | number>;
|
|
71
|
+
attributes?: Record<string, string | number | boolean>;
|
|
72
|
+
className?: string;
|
|
73
|
+
id?: string;
|
|
74
|
+
textContent?: string | number | DeriveInstance<any>;
|
|
75
|
+
innerText?: string;
|
|
76
|
+
innerHTML?: string;
|
|
77
|
+
content?: string | Elem | HTMLElement | DeriveInstance<any> | Array<Elem | HTMLElement>;
|
|
78
|
+
appendTo?: Elem | HTMLElement;
|
|
79
|
+
prependTo?: Elem | HTMLElement;
|
|
80
|
+
append?: Array<Elem | HTMLElement | string | null | undefined> | Elem | HTMLElement;
|
|
81
|
+
prepend?: Array<Elem | HTMLElement | string> | Elem | HTMLElement;
|
|
82
|
+
before?: HTMLElement;
|
|
83
|
+
disabled?: boolean;
|
|
84
|
+
onclick?: (event: MouseEvent) => void;
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export declare class Elem extends EventTarget {
|
|
89
|
+
constructor(options?: ElemOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
90
|
+
readonly elem: HTMLElement;
|
|
91
|
+
readonly options: ElemOptions;
|
|
92
|
+
readonly tag: string;
|
|
93
|
+
readonly parentElem: HTMLElement | null;
|
|
94
|
+
readonly parent: Elem | undefined;
|
|
95
|
+
readonly children: Array<Elem>;
|
|
96
|
+
setOptions(options: Partial<ElemOptions>): this;
|
|
97
|
+
addClass(...classes: Array<string | string[] | null | undefined>): this;
|
|
98
|
+
removeClass(...classes: Array<string | RegExp>): this;
|
|
99
|
+
toggleClass(name: string, condition: boolean): this;
|
|
100
|
+
hasClass(...classes: Array<string | RegExp>): boolean;
|
|
101
|
+
setStyle(style: Record<string, string | number>): this;
|
|
102
|
+
setAttributes(attributes: Record<string, string | number | boolean>): this;
|
|
103
|
+
append(...children: Array<Elem | HTMLElement | string | null | undefined>): this;
|
|
104
|
+
prepend(...children: Array<Elem | HTMLElement | string>): this;
|
|
105
|
+
appendTo(parent: Elem | HTMLElement): this;
|
|
106
|
+
prependTo(parent: Elem | HTMLElement): this;
|
|
107
|
+
content(value: string | Elem | HTMLElement | Array<Elem | HTMLElement>): this;
|
|
108
|
+
empty(): this;
|
|
109
|
+
_setOption(key: string, value: any): void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ── Component ──────────────────────────────────────────────────────────────────
|
|
113
|
+
|
|
114
|
+
export interface ComponentOptions extends ElemOptions {
|
|
115
|
+
autoRender?: boolean | 'onload' | 'animationFrame';
|
|
116
|
+
registeredEvents?: Set<string>;
|
|
117
|
+
knownAttributes?: Set<string>;
|
|
118
|
+
priorityOptions?: Set<string>;
|
|
119
|
+
styles?: string | ((theme: Theme) => string) | Record<string, string | number>;
|
|
120
|
+
uniqueId?: string;
|
|
121
|
+
// Lifecycle
|
|
122
|
+
onConnected?: (this: Component) => void;
|
|
123
|
+
onDisconnected?: (this: Component) => void;
|
|
124
|
+
onRendered?: (this: Component) => void;
|
|
125
|
+
// Pointer
|
|
126
|
+
onPointerPress?: (event: PointerEvent) => void;
|
|
127
|
+
onHover?: (event: PointerEvent) => void;
|
|
128
|
+
onPointerOver?: (event: PointerEvent) => void;
|
|
129
|
+
onPointerEnter?: (event: PointerEvent) => void;
|
|
130
|
+
onPointerDown?: (event: PointerEvent) => void;
|
|
131
|
+
onPointerMove?: (event: PointerEvent) => void;
|
|
132
|
+
onPointerUp?: (event: PointerEvent) => void;
|
|
133
|
+
onPointerLeave?: (event: PointerEvent) => void;
|
|
134
|
+
onPointerCancel?: (event: PointerEvent) => void;
|
|
135
|
+
onContextmenu?: (event: PointerEvent) => void;
|
|
136
|
+
// Input
|
|
137
|
+
onChange?: (event: { value: string | number | boolean } & Event) => void;
|
|
138
|
+
onKeydown?: (event: { value: string } & KeyboardEvent) => void;
|
|
139
|
+
onKeyup?: (event: { value: string } & KeyboardEvent) => void;
|
|
140
|
+
onInput?: (event: { value: string } & InputEvent) => void;
|
|
141
|
+
onBlur?: (event: { value: string } & FocusEvent) => void;
|
|
142
|
+
onSearch?: (event: { value: string } & Event) => void;
|
|
143
|
+
[key: string]: any;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export declare class Component extends Elem {
|
|
147
|
+
constructor(options?: ComponentOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
148
|
+
readonly options: ComponentOptions & Record<string, any>;
|
|
149
|
+
readonly rendered: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Optional static dispatch map. Handlers are collected across the full constructor chain
|
|
152
|
+
* (deepest subclass first) and executed in order. Call `next(value?)` to continue to the
|
|
153
|
+
* next handler in the chain; when the chain is exhausted, `next` falls through to standard
|
|
154
|
+
* routing. Handlers that do not call `next` fully own the key.
|
|
155
|
+
*
|
|
156
|
+
* Use shorthand methods so `this` is the component instance:
|
|
157
|
+
* `static handlers = { key(value, next) { ...; next(value); } }`
|
|
158
|
+
*/
|
|
159
|
+
static handlers?: Record<string, (this: Component, value: any, next: (value?: any) => void) => void>;
|
|
160
|
+
readonly uniqueId: string;
|
|
161
|
+
readonly parent: Component | undefined;
|
|
162
|
+
readonly children: Array<Component>;
|
|
163
|
+
build(): void;
|
|
164
|
+
render(): void;
|
|
165
|
+
empty(): this;
|
|
166
|
+
destroy(): void;
|
|
167
|
+
styles(value: string | ((theme: Theme) => string) | Record<string, string | number>): void;
|
|
168
|
+
onPointerPress(callback: (event: PointerEvent) => void): void;
|
|
169
|
+
onHover(callback: (event: PointerEvent) => void): void;
|
|
170
|
+
addCleanup(id: string, fn: () => void): void;
|
|
171
|
+
replaceCleanup(id: string, fn: () => void): void;
|
|
172
|
+
replaceDestroyCleanup(id: string, fn: () => void): void;
|
|
173
|
+
processCleanup(): void;
|
|
174
|
+
on(options: { targetEvent: string; callback: (event: Event) => void; id?: string }): boolean;
|
|
175
|
+
emit(type: string, detail?: any): void;
|
|
176
|
+
ancestry(): Array<object>;
|
|
177
|
+
_setOption(key: string, value: any): void;
|
|
178
|
+
_standardSetOption(key: string, value: any): void;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// ── styled / configured ────────────────────────────────────────────────────────
|
|
182
|
+
|
|
183
|
+
export declare function styled<T extends typeof Elem>(
|
|
184
|
+
Base: T,
|
|
185
|
+
styles?: string | ((theme: Theme) => string) | TemplateStringsArray,
|
|
186
|
+
options?: Partial<ComponentOptions>,
|
|
187
|
+
): T;
|
|
188
|
+
|
|
189
|
+
export declare function configured<T extends typeof Elem>(Base: T, options: Partial<ComponentOptions>): T;
|
|
190
|
+
|
|
191
|
+
// ── GENERATED: Built-in components ────────────────────────────────────────────
|
|
192
|
+
// This section is generated by devTools/buildTypes.js — do not edit manually.
|
|
193
|
+
// Run `bun run build:types` to regenerate from JSDoc annotations.
|
|
194
|
+
|
|
195
|
+
export interface BottomSheetOptions extends ComponentOptions {
|
|
196
|
+
/** Called when the sheet is dismissed */
|
|
197
|
+
onClose?: (...args: any[]) => any;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export declare class BottomSheet extends Component {
|
|
201
|
+
constructor(options?: BottomSheetOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
202
|
+
/** Content area for child components. Append children here for scrollable content. */
|
|
203
|
+
readonly body: Component;
|
|
204
|
+
/** Slides the sheet into view and registers navigation listeners to auto-dismiss. */
|
|
205
|
+
show(): void;
|
|
206
|
+
/** Slides the sheet out of view and calls onClose if set. */
|
|
207
|
+
hide(): void;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface ButtonOptions extends ComponentOptions {
|
|
211
|
+
/** FontAwesome icon name (without 'fa-' prefix) */
|
|
212
|
+
icon?: string;
|
|
213
|
+
/** Tooltip text shown on hover */
|
|
214
|
+
tooltip?: string;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export declare class Button extends Component {
|
|
218
|
+
constructor(options?: ButtonOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface CalendarOptions extends ComponentOptions {
|
|
222
|
+
/** Initial calendar view mode */
|
|
223
|
+
view?: 'month' | 'week' | 'day';
|
|
224
|
+
/** Calendar component height */
|
|
225
|
+
height?: string;
|
|
226
|
+
/** Initial year to display, defaults to current year */
|
|
227
|
+
year?: number;
|
|
228
|
+
/** Initial month to display (0-11), defaults to current month */
|
|
229
|
+
month?: number;
|
|
230
|
+
/** Initial day to display, defaults to current day */
|
|
231
|
+
day?: number;
|
|
232
|
+
/** Available view modes for toolbar */
|
|
233
|
+
views?: Array<string>;
|
|
234
|
+
/** Whether to display time in 24-hour format in day view */
|
|
235
|
+
display24h?: boolean;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export declare class Calendar extends Component {
|
|
239
|
+
constructor(options?: CalendarOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
240
|
+
/** Sets the calendar to display a specific date. */
|
|
241
|
+
setDate(year: number, month: number, day: number): void;
|
|
242
|
+
/** Navigates the calendar to today's date and re-renders. */
|
|
243
|
+
today(): void;
|
|
244
|
+
/** Navigates to the previous time period based on current view (day/week/month). */
|
|
245
|
+
previous(): void;
|
|
246
|
+
/** Navigates to the next time period based on current view (day/week/month). */
|
|
247
|
+
next(): void;
|
|
248
|
+
/** Navigates to a specific day and switches to day view. */
|
|
249
|
+
goToDay(): void;
|
|
250
|
+
/** Changes the calendar view mode and updates the display. */
|
|
251
|
+
setView(view: string): Calendar;
|
|
252
|
+
/** Retrieves all events occurring on a specific date. */
|
|
253
|
+
eventsAt(date: string | Date): Array<CalendarEvent>;
|
|
254
|
+
/** Adds a new event to the calendar and re-renders. */
|
|
255
|
+
addEvent(eventItem: Record<string, any>): Calendar;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface CodeOptions extends ComponentOptions {
|
|
259
|
+
/** Programming language for syntax highlighting class */
|
|
260
|
+
language?: string;
|
|
261
|
+
/** Whether to render as multiline block ('auto' detects newlines) */
|
|
262
|
+
multiline?: string | boolean;
|
|
263
|
+
/** Code content to display */
|
|
264
|
+
code?: string;
|
|
265
|
+
/** Whether to show copy-to-clipboard button */
|
|
266
|
+
copyButton?: boolean;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export declare class Code extends Component {
|
|
270
|
+
constructor(options?: CodeOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export interface ColorPickerOptions extends ComponentOptions {
|
|
274
|
+
/** Initial color value (CSS color, 'random' for random color) */
|
|
275
|
+
value?: string;
|
|
276
|
+
/** Array of predefined color values for swatch buttons */
|
|
277
|
+
swatches?: Array<string>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export declare class ColorPicker extends Component {
|
|
281
|
+
constructor(options?: ColorPickerOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
282
|
+
/** Changes the color value and triggers change event. */
|
|
283
|
+
change(): void;
|
|
284
|
+
/** Parses color value into HSL components and TinyColor instance. */
|
|
285
|
+
parseValue(value: string | Record<string, any>): Record<string, any>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface DialogOptions extends ComponentOptions {
|
|
289
|
+
/** Dialog size */
|
|
290
|
+
size?: 'small' | 'standard' | 'large';
|
|
291
|
+
/** Color variant */
|
|
292
|
+
variant?: 'info' | 'success' | 'warning' | 'error';
|
|
293
|
+
/** Auto-open delay in ms, or false to disable */
|
|
294
|
+
openOnRender?: number | boolean;
|
|
295
|
+
/** Whether to open as modal dialog */
|
|
296
|
+
modal?: boolean;
|
|
297
|
+
/** Header text content */
|
|
298
|
+
header?: string;
|
|
299
|
+
/** Body content */
|
|
300
|
+
body?: string | Component;
|
|
301
|
+
/** Custom footer components */
|
|
302
|
+
footer?: Array<Component>;
|
|
303
|
+
/** Button configurations for default footer */
|
|
304
|
+
buttons?: Array<string | Record<string, any>>;
|
|
305
|
+
/** Handler for button press events */
|
|
306
|
+
onButtonPress?: (...args: any[]) => any;
|
|
307
|
+
/** Custom close function */
|
|
308
|
+
closeDialog?: (...args: any[]) => any;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export declare class Dialog extends Component {
|
|
312
|
+
constructor(options?: DialogOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
313
|
+
/** Content container — primary injection point for subclass and consumer content. */
|
|
314
|
+
readonly body: Component;
|
|
315
|
+
/** Opens the dialog, either as modal or non-modal */
|
|
316
|
+
open(): void;
|
|
317
|
+
/** Closes the dialog with optional return value */
|
|
318
|
+
close(): void;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface FormOptions extends ComponentOptions {
|
|
322
|
+
/** Field and group definitions */
|
|
323
|
+
inputs?: Array<Record<string, any>>;
|
|
324
|
+
/** Initial form data */
|
|
325
|
+
data?: Record<string, any>;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export declare class Form extends Component {
|
|
329
|
+
constructor(options?: FormOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
330
|
+
/** Validates all visible form inputs and returns whether errors were found. */
|
|
331
|
+
hasErrors(options?: Record<string, any>): boolean;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface IconOptions extends ComponentOptions {
|
|
335
|
+
/** FontAwesome icon name (without 'fa-' prefix) */
|
|
336
|
+
icon?: string;
|
|
337
|
+
/** FontAwesome animation name (without 'fa-' prefix) */
|
|
338
|
+
animation?: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export declare class Icon extends Component {
|
|
342
|
+
constructor(options?: IconOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface InputOptions extends ComponentOptions {
|
|
346
|
+
/** Input type, auto-detected from value type if not specified */
|
|
347
|
+
type?: string;
|
|
348
|
+
/** Initial input value */
|
|
349
|
+
value?: any;
|
|
350
|
+
/** Placeholder text */
|
|
351
|
+
placeholder?: string;
|
|
352
|
+
/** Autocomplete behavior */
|
|
353
|
+
autocomplete?: string;
|
|
354
|
+
/** Auto-capitalization behavior */
|
|
355
|
+
autocapitalize?: string;
|
|
356
|
+
/** Auto-correction behavior */
|
|
357
|
+
autocorrect?: string;
|
|
358
|
+
/** Height for textarea ('auto' for dynamic sizing) */
|
|
359
|
+
height?: string | number;
|
|
360
|
+
/** Enable syntax highlighting for textarea */
|
|
361
|
+
syntaxHighlighting?: boolean;
|
|
362
|
+
/** Programming language for syntax highlighting */
|
|
363
|
+
language?: string;
|
|
364
|
+
/** Array of validation functions */
|
|
365
|
+
validations?: Array<(...args: any[]) => any>;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export declare class Input extends Component {
|
|
369
|
+
constructor(options?: InputOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
370
|
+
/** Checks if the input value has changed from its initial value */
|
|
371
|
+
readonly isDirty: boolean;
|
|
372
|
+
/** Validates the input value against configured validation rules */
|
|
373
|
+
validate(options: Record<string, any>): Array<any> | undefined;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export interface KeyboardOptions extends ComponentOptions {
|
|
377
|
+
/** Initial keyboard layout name */
|
|
378
|
+
layout?: string;
|
|
379
|
+
/** Whether to provide haptic feedback on key press */
|
|
380
|
+
tactileResponse?: boolean;
|
|
381
|
+
/** Key configuration object mapping key names to definitions */
|
|
382
|
+
keyDefinitions?: Record<string, any>;
|
|
383
|
+
/** Layout configuration object mapping layout names to key arrays */
|
|
384
|
+
layouts?: Record<string, any>;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export declare class Keyboard extends Component {
|
|
388
|
+
constructor(options?: KeyboardOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
389
|
+
/** Switches the keyboard to the specified layout and rebuilds the keys. */
|
|
390
|
+
setLayout(): void;
|
|
391
|
+
/** Registers a callback for key down events. */
|
|
392
|
+
onKeyDown(callback: (...args: any[]) => any): (...args: any[]) => any;
|
|
393
|
+
/** Registers a callback for key up events. */
|
|
394
|
+
onKeyUp(callback: (...args: any[]) => any): (...args: any[]) => any;
|
|
395
|
+
/** Registers a callback for key press events. */
|
|
396
|
+
onKeyPress(callback: (...args: any[]) => any): (...args: any[]) => any;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export interface LabelOptions extends ComponentOptions {
|
|
400
|
+
/** Label display variant */
|
|
401
|
+
variant?: 'overlay' | 'collapsible' | 'inline' | 'inline-after' | 'simple';
|
|
402
|
+
/** Label text content or label component options */
|
|
403
|
+
label?: string | Record<string, any>;
|
|
404
|
+
/** Input component or ID to associate label with */
|
|
405
|
+
for?: Component | string;
|
|
406
|
+
/** Whether collapsible variant starts collapsed */
|
|
407
|
+
collapsed?: boolean;
|
|
408
|
+
/** Tooltip text for the label */
|
|
409
|
+
tooltip?: string;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export declare class Label extends Component {
|
|
413
|
+
constructor(options?: LabelOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export interface LinkOptions extends ComponentOptions {
|
|
417
|
+
/** Link display variant ('link', 'button') */
|
|
418
|
+
variant?: string;
|
|
419
|
+
/** URL to link to */
|
|
420
|
+
href?: string;
|
|
421
|
+
/** Link target attribute */
|
|
422
|
+
target?: string;
|
|
423
|
+
/** Tooltip configuration or text */
|
|
424
|
+
tooltip?: Record<string, any> | string;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export declare class Link extends Component {
|
|
428
|
+
constructor(options?: LinkOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export interface ListOptions extends ComponentOptions {
|
|
432
|
+
/** Array of list items to render */
|
|
433
|
+
items?: Array<any>;
|
|
434
|
+
/** Custom component class for rendering items */
|
|
435
|
+
ListItemComponent?: Component;
|
|
436
|
+
/** Whether to apply no-style class for plain list */
|
|
437
|
+
noStyle?: boolean;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export declare class List extends Component {
|
|
441
|
+
constructor(options?: ListOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export interface MenuOptions extends ComponentOptions {
|
|
445
|
+
/** Array of menu items to render */
|
|
446
|
+
items?: Array<any>;
|
|
447
|
+
/** Handler called when menu item is selected */
|
|
448
|
+
onSelect?: (...args: any[]) => any;
|
|
449
|
+
/** Custom component class for rendering menu items */
|
|
450
|
+
ListItemComponent?: Component;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export declare class Menu extends Component {
|
|
454
|
+
constructor(options?: MenuOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export interface NotifyOptions extends ComponentOptions {
|
|
458
|
+
/** Notification type ('info', 'success', 'warning', 'error') */
|
|
459
|
+
type?: string;
|
|
460
|
+
/** Auto-dismiss timeout in milliseconds */
|
|
461
|
+
timeout?: number;
|
|
462
|
+
/** Custom icon name, defaults to type-appropriate icon */
|
|
463
|
+
icon?: string;
|
|
464
|
+
/** X position for the notification */
|
|
465
|
+
x?: number;
|
|
466
|
+
/** Y position for the notification */
|
|
467
|
+
y?: number;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export declare class Notify extends Component {
|
|
471
|
+
constructor(options?: NotifyOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export declare class Page extends Component {
|
|
475
|
+
constructor(options?: ComponentOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export interface PopoverOptions extends ComponentOptions {
|
|
479
|
+
/** Popover state ('auto', 'manual') */
|
|
480
|
+
state?: string;
|
|
481
|
+
/** Whether to automatically open on render */
|
|
482
|
+
autoOpen?: boolean;
|
|
483
|
+
/** X position for the popover */
|
|
484
|
+
x?: number;
|
|
485
|
+
/** Y position for the popover */
|
|
486
|
+
y?: number;
|
|
487
|
+
/** Maximum width in pixels */
|
|
488
|
+
maxWidth?: number;
|
|
489
|
+
/** Maximum height in pixels */
|
|
490
|
+
maxHeight?: number;
|
|
491
|
+
/** Viewport element for edge detection */
|
|
492
|
+
viewport?: HTMLElement;
|
|
493
|
+
/** Icon to display in the popover */
|
|
494
|
+
icon?: string;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export declare class Popover extends Component {
|
|
498
|
+
constructor(options?: PopoverOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
499
|
+
/** Checks if the popover is currently open. */
|
|
500
|
+
readonly isOpen: boolean;
|
|
501
|
+
/** Shows the popover with optional position update. */
|
|
502
|
+
show(): void;
|
|
503
|
+
/** Hides the popover. */
|
|
504
|
+
hide(): void;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export interface RadioButtonOptions extends ComponentOptions {
|
|
508
|
+
/** Array of radio button options */
|
|
509
|
+
options?: Array<string | Record<string, any>>;
|
|
510
|
+
/** Currently selected value */
|
|
511
|
+
value?: any;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export declare class RadioButton extends Component {
|
|
515
|
+
constructor(options?: RadioButtonOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export interface RouterOptions extends ComponentOptions {
|
|
519
|
+
/** Object mapping route patterns to component classes */
|
|
520
|
+
views?: Record<string, any>;
|
|
521
|
+
/** Default route path, uses first view key if not specified */
|
|
522
|
+
defaultPath?: string;
|
|
523
|
+
/** Component class for 404/not found routes */
|
|
524
|
+
notFound?: Component;
|
|
525
|
+
/** Callback fired when rendering a new view */
|
|
526
|
+
onRenderView?: (...args: any[]) => any;
|
|
527
|
+
/** Routing mode: 'hash' uses URL fragments, 'history' uses pushState */
|
|
528
|
+
mode?: 'hash' | 'history';
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export declare class Router extends Component {
|
|
532
|
+
constructor(options?: RouterOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
533
|
+
/** Gets the current path from the URL. */
|
|
534
|
+
readonly path: string;
|
|
535
|
+
/** Gets the matched route for the current path. */
|
|
536
|
+
readonly route: string;
|
|
537
|
+
/** Extracts route parameters from a path. */
|
|
538
|
+
parseRouteParameters(path?: string): Record<string, any>;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export interface SelectOptions extends ComponentOptions {
|
|
542
|
+
/** Array of select options */
|
|
543
|
+
options?: Array<string | Record<string, any>>;
|
|
544
|
+
/** Currently selected value */
|
|
545
|
+
value?: any;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export declare class Select extends Component {
|
|
549
|
+
constructor(options?: SelectOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
550
|
+
/** Gets the currently selected value with enhanced option handling. */
|
|
551
|
+
readonly value: any;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export interface TableOptions extends ComponentOptions {
|
|
555
|
+
/** Column definitions with keys and optional configurations */
|
|
556
|
+
columns?: Array<string | Record<string, any>>;
|
|
557
|
+
/** Array of data objects to display in table rows */
|
|
558
|
+
data?: Array<Record<string, any>>;
|
|
559
|
+
/** Footer row data */
|
|
560
|
+
footer?: Array<string | Record<string, any>>;
|
|
561
|
+
/** Custom sort function, defaults to built-in sorting */
|
|
562
|
+
onSort?: (...args: any[]) => any;
|
|
563
|
+
/** Currently sorted column key */
|
|
564
|
+
sortProperty?: string;
|
|
565
|
+
/** Sort direction ('asc' or 'desc') */
|
|
566
|
+
sortDirection?: string;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export declare class Table extends Component {
|
|
570
|
+
constructor(options?: TableOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
export interface TagListOptions extends ComponentOptions {
|
|
574
|
+
/** Whether tags can be added/removed */
|
|
575
|
+
readOnly?: boolean;
|
|
576
|
+
/** Initial array of tag text values */
|
|
577
|
+
tags?: Array<string>;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export declare class TagList extends Component {
|
|
581
|
+
constructor(options?: TagListOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export interface TooltipOptions extends ComponentOptions {
|
|
585
|
+
/** Tooltip position relative to parent */
|
|
586
|
+
position?: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
587
|
+
/** Whether tooltip opens automatically */
|
|
588
|
+
autoOpen?: boolean;
|
|
589
|
+
/** Icon to display in tooltip */
|
|
590
|
+
icon?: string;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export declare class Tooltip extends Component {
|
|
594
|
+
constructor(options?: TooltipOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export interface TooltipWrapperOptions extends ComponentOptions {
|
|
598
|
+
/** Tooltip text or configuration object */
|
|
599
|
+
tooltip?: string | Record<string, any>;
|
|
600
|
+
/** Icon to display in the component */
|
|
601
|
+
icon?: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export declare class TooltipWrapper extends Component {
|
|
605
|
+
constructor(options?: TooltipWrapperOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export interface WhiteboardOptions extends ComponentOptions {
|
|
609
|
+
/** Canvas background color */
|
|
610
|
+
background?: string;
|
|
611
|
+
/** Default drawing color */
|
|
612
|
+
color?: string;
|
|
613
|
+
/** Default line width for drawing */
|
|
614
|
+
lineWidth?: number;
|
|
615
|
+
/** Canvas width */
|
|
616
|
+
width?: string;
|
|
617
|
+
/** Canvas height */
|
|
618
|
+
height?: string;
|
|
619
|
+
/** Whether drawing is disabled */
|
|
620
|
+
readOnly?: boolean;
|
|
621
|
+
/** Predefined lines to render on the canvas */
|
|
622
|
+
lines?: Array<Record<string, any>>;
|
|
623
|
+
/** Custom throttle delay for draw events */
|
|
624
|
+
drawThrottle?: number;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export declare class Whiteboard extends Component {
|
|
628
|
+
constructor(options?: WhiteboardOptions, ...children: Array<Elem | HTMLElement | string>);
|
|
629
|
+
/** Draws a line on the canvas with specified properties. */
|
|
630
|
+
drawLine(options: Record<string, any>): void;
|
|
631
|
+
/** Clears the entire canvas. */
|
|
632
|
+
clearCanvas(): void;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// ── END GENERATED ────────────────────────────────────────────────────────────
|
package/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Elem } from './Elem';
|
|
2
|
+
import { Component } from './Component';
|
|
3
|
+
import * as components from './components';
|
|
4
|
+
import { styled } from './styled';
|
|
5
|
+
|
|
6
|
+
Object.entries({ Elem, Component, ...components }).forEach(([name, component]) => {
|
|
7
|
+
if (/^[A-Z]/.test(name)) styled[name] = (...args) => styled(component, ...args);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export * from './Component';
|
|
11
|
+
export * from './components';
|
|
12
|
+
export { Oxject, derive } from '@vanilla-bean/oxject';
|
|
13
|
+
export * from './Elem';
|
|
14
|
+
export * from './styled';
|
|
15
|
+
export * from './utils';
|
|
16
|
+
|
|
17
|
+
export { default as theme } from './theme';
|
|
18
|
+
|
|
19
|
+
export { styled };
|