arekui 1.0.0 → 1.0.2
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/LICENSE +21 -21
- package/README.md +198 -198
- package/arekui.css +3279 -3279
- package/arekui.d.ts +328 -328
- package/arekui.js +450 -450
- package/package.json +59 -57
- package/scripts/build-custom.js +318 -318
- package/src/arekui.css +55 -55
- package/src/base/neo-overrides.css +317 -317
- package/src/base/reset.css +67 -67
- package/src/base/tokens.css +304 -304
- package/src/components/accordion.css +34 -34
- package/src/components/alert.css +26 -26
- package/src/components/badge.css +33 -33
- package/src/components/breadcrumb.css +33 -33
- package/src/components/button.css +103 -103
- package/src/components/card.css +24 -24
- package/src/components/carousel.css +14 -14
- package/src/components/chat.css +78 -78
- package/src/components/drawer.css +53 -53
- package/src/components/file-upload.css +51 -51
- package/src/components/footer.css +26 -26
- package/src/components/forms.css +69 -69
- package/src/components/hero.css +22 -22
- package/src/components/join.css +14 -14
- package/src/components/link.css +24 -24
- package/src/components/menu.css +56 -56
- package/src/components/misc.css +57 -57
- package/src/components/modal.css +32 -32
- package/src/components/navbar.css +37 -37
- package/src/components/pagination.css +46 -46
- package/src/components/popover.css +70 -70
- package/src/components/progress.css +19 -19
- package/src/components/prose.css +80 -80
- package/src/components/rating.css +37 -37
- package/src/components/scroll-top.css +36 -36
- package/src/components/skeleton.css +54 -54
- package/src/components/swap.css +45 -45
- package/src/components/table.css +22 -22
- package/src/components/tabs.css +24 -24
- package/src/components/tag.css +101 -101
- package/src/components/textured.css +34 -34
- package/src/components/timeline.css +34 -34
- package/src/components/toast.css +134 -134
- package/src/components/tooltip.css +24 -24
- package/src/utilities/borders.css +152 -152
- package/src/utilities/colors.css +73 -73
- package/src/utilities/hover.css +33 -33
- package/src/utilities/layout.css +100 -100
- package/src/utilities/neo-utilities.css +95 -95
- package/src/utilities/responsive.css +128 -128
- package/src/utilities/sizing.css +91 -91
- package/src/utilities/spacing.css +130 -130
- package/src/utilities/typography.css +94 -94
package/arekui.d.ts
CHANGED
|
@@ -1,328 +1,328 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ARStyle v1.4.0
|
|
3
|
-
* A standalone CSS framework by Andika Rekatias.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```html
|
|
7
|
-
* <link rel="stylesheet" href="arstyle.css">
|
|
8
|
-
* <script src="arstyle.js"></script>
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // Set theme
|
|
14
|
-
* ARStyle.setTheme("dark");
|
|
15
|
-
*
|
|
16
|
-
* // Show toast
|
|
17
|
-
* ARStyle.toast("Saved!", { type: "success", duration: 4000 });
|
|
18
|
-
*
|
|
19
|
-
* // Get rating
|
|
20
|
-
* const rating = ARStyle.getRating(document.querySelector("[data-ar-rating]"));
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/** Available theme names */
|
|
25
|
-
export type ThemeName = "light" | "dark" | "neo";
|
|
26
|
-
|
|
27
|
-
/** Toast notification type */
|
|
28
|
-
export type ToastType = "info" | "success" | "warning" | "error";
|
|
29
|
-
|
|
30
|
-
/** Toast position on screen */
|
|
31
|
-
export type ToastPosition =
|
|
32
|
-
| "top-left"
|
|
33
|
-
| "top-center"
|
|
34
|
-
| "top-right"
|
|
35
|
-
| "bottom-left"
|
|
36
|
-
| "bottom-center"
|
|
37
|
-
| "bottom-right";
|
|
38
|
-
|
|
39
|
-
/** Options for toast notifications */
|
|
40
|
-
export interface ToastOptions {
|
|
41
|
-
/** Toast type for styling */
|
|
42
|
-
type?: ToastType;
|
|
43
|
-
|
|
44
|
-
/** Auto-dismiss duration in milliseconds (0 = no auto-dismiss, default: 4000) */
|
|
45
|
-
duration?: number;
|
|
46
|
-
|
|
47
|
-
/** Toast position on screen (default: "top-right") */
|
|
48
|
-
position?: ToastPosition;
|
|
49
|
-
|
|
50
|
-
/** Show close button (default: true) */
|
|
51
|
-
closable?: boolean;
|
|
52
|
-
|
|
53
|
-
/** HTML icon content (displayed before message) */
|
|
54
|
-
icon?: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Options for creating custom events */
|
|
58
|
-
export interface CustomEventOptions<T = unknown> {
|
|
59
|
-
/** Event detail payload */
|
|
60
|
-
detail: T;
|
|
61
|
-
|
|
62
|
-
/** Whether the event bubbles up the DOM (default: true) */
|
|
63
|
-
bubbles?: boolean;
|
|
64
|
-
|
|
65
|
-
/** Whether the event can be canceled (default: false) */
|
|
66
|
-
cancelable?: boolean;
|
|
67
|
-
|
|
68
|
-
/** Whether the event crosses shadow DOM boundaries (default: false) */
|
|
69
|
-
composed?: boolean;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Detail payload for ar-rating-change event */
|
|
73
|
-
export interface RatingChangeDetail {
|
|
74
|
-
/** The selected rating value (0-5) */
|
|
75
|
-
value: number;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Detail payload for ar-file-change event */
|
|
79
|
-
export interface FileChangeDetail {
|
|
80
|
-
/** The selected files */
|
|
81
|
-
files: FileList;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Custom event dispatched when rating changes
|
|
86
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent | CustomEvent}
|
|
87
|
-
*/
|
|
88
|
-
export interface RatingChangeEvent extends CustomEvent<RatingChangeDetail> {
|
|
89
|
-
type: "ar-rating-change";
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Custom event dispatched when files are selected
|
|
94
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent | CustomEvent}
|
|
95
|
-
*/
|
|
96
|
-
export interface FileChangeEvent extends CustomEvent<FileChangeDetail> {
|
|
97
|
-
type: "ar-file-change";
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* ARStyle public API
|
|
102
|
-
*
|
|
103
|
-
* @description Provides theme management, toast notifications,
|
|
104
|
-
* rating controls, popover management, and initialization.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```html
|
|
108
|
-
* <script>
|
|
109
|
-
* // Theme management
|
|
110
|
-
* ARStyle.setTheme("neo");
|
|
111
|
-
* console.log(ARStyle.getTheme()); // "neo"
|
|
112
|
-
*
|
|
113
|
-
* // Toast notifications
|
|
114
|
-
* ARStyle.toast("Item saved!", { type: "success" });
|
|
115
|
-
*
|
|
116
|
-
* // Rating
|
|
117
|
-
* const container = document.querySelector("[data-ar-rating]");
|
|
118
|
-
* ARStyle.setRating(container, 4);
|
|
119
|
-
* console.log(ARStyle.getRating(container)); // 4
|
|
120
|
-
*
|
|
121
|
-
* // Popover
|
|
122
|
-
* ARStyle.openPopover("my-popover");
|
|
123
|
-
* </script>
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export interface ARStyleStatic {
|
|
127
|
-
/**
|
|
128
|
-
* Set the active theme
|
|
129
|
-
*
|
|
130
|
-
* @param theme - The theme to activate
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* ARStyle.setTheme("dark");
|
|
135
|
-
* ARStyle.setTheme("neo");
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
setTheme(theme: ThemeName): void;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Get the currently active theme
|
|
142
|
-
*
|
|
143
|
-
* @returns The current theme name, or null if no theme is set
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* const current = ARStyle.getTheme();
|
|
148
|
-
* if (current === "dark") {
|
|
149
|
-
* // Dark theme is active
|
|
150
|
-
* }
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
getTheme(): ThemeName | null;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Initialize theme from localStorage or system preference
|
|
157
|
-
*
|
|
158
|
-
* @description Checks localStorage for a saved theme, falls back to
|
|
159
|
-
* prefers-color-scheme media query, defaults to "light"
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```typescript
|
|
163
|
-
* // Usually called automatically, but can be called manually
|
|
164
|
-
* ARStyle.initTheme();
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
initTheme(): void;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Initialize all ARStyle behaviors
|
|
171
|
-
*
|
|
172
|
-
* @description Sets up event listeners for theme toggle, modals, drawers,
|
|
173
|
-
* tabs, dropdowns, accordion, ratings, popovers, file uploads, and scroll-to-top
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* ```typescript
|
|
177
|
-
* // Called automatically on DOMContentLoaded
|
|
178
|
-
* // Call manually if adding elements dynamically
|
|
179
|
-
* ARStyle.init();
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
init(): void;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Show a toast notification
|
|
186
|
-
*
|
|
187
|
-
* @param message - Toast message text
|
|
188
|
-
* @param options - Toast configuration options
|
|
189
|
-
* @returns The toast DOM element (can be used with dismissToast)
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* ```typescript
|
|
193
|
-
* // Basic toast
|
|
194
|
-
* ARStyle.toast("Hello world!");
|
|
195
|
-
*
|
|
196
|
-
* // Success toast with custom duration
|
|
197
|
-
* ARStyle.toast("Saved successfully!", {
|
|
198
|
-
* type: "success",
|
|
199
|
-
* duration: 5000
|
|
200
|
-
* });
|
|
201
|
-
*
|
|
202
|
-
* // Persistent toast (no auto-dismiss)
|
|
203
|
-
* const loading = ARStyle.toast("Loading...", { duration: 0 });
|
|
204
|
-
*
|
|
205
|
-
* // Dismiss programmatically
|
|
206
|
-
* ARStyle.dismissToast(loading);
|
|
207
|
-
* ```
|
|
208
|
-
*/
|
|
209
|
-
toast(message: string, options?: ToastOptions): HTMLElement;
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Dismiss a toast element
|
|
213
|
-
*
|
|
214
|
-
* @param el - The toast element to dismiss
|
|
215
|
-
*
|
|
216
|
-
* @example
|
|
217
|
-
* ```typescript
|
|
218
|
-
* const toast = ARStyle.toast("Processing...");
|
|
219
|
-
* // ... later
|
|
220
|
-
* ARStyle.dismissToast(toast);
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
dismissToast(el: HTMLElement): void;
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Get the current rating value from a rating container
|
|
227
|
-
*
|
|
228
|
-
* @param container - The rating container element (with data-ar-rating attribute)
|
|
229
|
-
* @returns The selected rating value (0-5), or 0 if nothing is selected
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* ```typescript
|
|
233
|
-
* const container = document.querySelector("[data-ar-rating]");
|
|
234
|
-
* const rating = ARStyle.getRating(container);
|
|
235
|
-
* console.log(`Selected rating: ${rating}`);
|
|
236
|
-
* ```
|
|
237
|
-
*/
|
|
238
|
-
getRating(container: HTMLElement): number;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Set rating programmatically
|
|
242
|
-
*
|
|
243
|
-
* @param container - The rating container element (with data-ar-rating attribute)
|
|
244
|
-
* @param value - Rating value (0-5)
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* ```typescript
|
|
248
|
-
* const container = document.querySelector("[data-ar-rating]");
|
|
249
|
-
* ARStyle.setRating(container, 4); // Select 4 stars
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
setRating(container: HTMLElement, value: number): void;
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Open a popover by ID
|
|
256
|
-
*
|
|
257
|
-
* @param id - The popover content element ID
|
|
258
|
-
*
|
|
259
|
-
* @example
|
|
260
|
-
* ```html
|
|
261
|
-
* <div class="ar-popover">
|
|
262
|
-
* <button>Click me</button>
|
|
263
|
-
* <div class="ar-popover-content" id="my-popover">
|
|
264
|
-
* Popover content
|
|
265
|
-
* </div>
|
|
266
|
-
* </div>
|
|
267
|
-
* ```
|
|
268
|
-
*
|
|
269
|
-
* ```typescript
|
|
270
|
-
* ARStyle.openPopover("my-popover");
|
|
271
|
-
* ```
|
|
272
|
-
*/
|
|
273
|
-
openPopover(id: string): void;
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Close a popover by ID
|
|
277
|
-
*
|
|
278
|
-
* @param id - The popover content element ID
|
|
279
|
-
*
|
|
280
|
-
* @example
|
|
281
|
-
* ```typescript
|
|
282
|
-
* ARStyle.closePopover("my-popover");
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
|
-
closePopover(id: string): void;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* ARStyle global namespace
|
|
290
|
-
*
|
|
291
|
-
* @description Provides access to all ARStyle public methods
|
|
292
|
-
* when using the script tag approach (no module system)
|
|
293
|
-
*
|
|
294
|
-
* @see {@link ARStyleStatic} for method signatures and examples
|
|
295
|
-
*/
|
|
296
|
-
declare global {
|
|
297
|
-
interface Window {
|
|
298
|
-
/**
|
|
299
|
-
* ARStyle global API
|
|
300
|
-
*
|
|
301
|
-
* @example
|
|
302
|
-
* ```html
|
|
303
|
-
* <script src="arstyle.js"></script>
|
|
304
|
-
* <script>
|
|
305
|
-
* ARStyle.setTheme("dark");
|
|
306
|
-
* ARStyle.toast("Hello!");
|
|
307
|
-
* </script>
|
|
308
|
-
* ```
|
|
309
|
-
*/
|
|
310
|
-
ARStyle: ARStyleStatic;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* ARStyle module export
|
|
316
|
-
*
|
|
317
|
-
* @example
|
|
318
|
-
* ```typescript
|
|
319
|
-
* // ES Module import
|
|
320
|
-
* import ARStyle from "arstyle";
|
|
321
|
-
*
|
|
322
|
-
* ARStyle.setTheme("neo");
|
|
323
|
-
* ```
|
|
324
|
-
*/
|
|
325
|
-
declare const ARStyle: ARStyleStatic;
|
|
326
|
-
|
|
327
|
-
export default ARStyle;
|
|
328
|
-
export { ARStyle, ARStyleStatic };
|
|
1
|
+
/**
|
|
2
|
+
* ARStyle v1.4.0
|
|
3
|
+
* A standalone CSS framework by Andika Rekatias.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```html
|
|
7
|
+
* <link rel="stylesheet" href="arstyle.css">
|
|
8
|
+
* <script src="arstyle.js"></script>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Set theme
|
|
14
|
+
* ARStyle.setTheme("dark");
|
|
15
|
+
*
|
|
16
|
+
* // Show toast
|
|
17
|
+
* ARStyle.toast("Saved!", { type: "success", duration: 4000 });
|
|
18
|
+
*
|
|
19
|
+
* // Get rating
|
|
20
|
+
* const rating = ARStyle.getRating(document.querySelector("[data-ar-rating]"));
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** Available theme names */
|
|
25
|
+
export type ThemeName = "light" | "dark" | "neo";
|
|
26
|
+
|
|
27
|
+
/** Toast notification type */
|
|
28
|
+
export type ToastType = "info" | "success" | "warning" | "error";
|
|
29
|
+
|
|
30
|
+
/** Toast position on screen */
|
|
31
|
+
export type ToastPosition =
|
|
32
|
+
| "top-left"
|
|
33
|
+
| "top-center"
|
|
34
|
+
| "top-right"
|
|
35
|
+
| "bottom-left"
|
|
36
|
+
| "bottom-center"
|
|
37
|
+
| "bottom-right";
|
|
38
|
+
|
|
39
|
+
/** Options for toast notifications */
|
|
40
|
+
export interface ToastOptions {
|
|
41
|
+
/** Toast type for styling */
|
|
42
|
+
type?: ToastType;
|
|
43
|
+
|
|
44
|
+
/** Auto-dismiss duration in milliseconds (0 = no auto-dismiss, default: 4000) */
|
|
45
|
+
duration?: number;
|
|
46
|
+
|
|
47
|
+
/** Toast position on screen (default: "top-right") */
|
|
48
|
+
position?: ToastPosition;
|
|
49
|
+
|
|
50
|
+
/** Show close button (default: true) */
|
|
51
|
+
closable?: boolean;
|
|
52
|
+
|
|
53
|
+
/** HTML icon content (displayed before message) */
|
|
54
|
+
icon?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Options for creating custom events */
|
|
58
|
+
export interface CustomEventOptions<T = unknown> {
|
|
59
|
+
/** Event detail payload */
|
|
60
|
+
detail: T;
|
|
61
|
+
|
|
62
|
+
/** Whether the event bubbles up the DOM (default: true) */
|
|
63
|
+
bubbles?: boolean;
|
|
64
|
+
|
|
65
|
+
/** Whether the event can be canceled (default: false) */
|
|
66
|
+
cancelable?: boolean;
|
|
67
|
+
|
|
68
|
+
/** Whether the event crosses shadow DOM boundaries (default: false) */
|
|
69
|
+
composed?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Detail payload for ar-rating-change event */
|
|
73
|
+
export interface RatingChangeDetail {
|
|
74
|
+
/** The selected rating value (0-5) */
|
|
75
|
+
value: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Detail payload for ar-file-change event */
|
|
79
|
+
export interface FileChangeDetail {
|
|
80
|
+
/** The selected files */
|
|
81
|
+
files: FileList;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Custom event dispatched when rating changes
|
|
86
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent | CustomEvent}
|
|
87
|
+
*/
|
|
88
|
+
export interface RatingChangeEvent extends CustomEvent<RatingChangeDetail> {
|
|
89
|
+
type: "ar-rating-change";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Custom event dispatched when files are selected
|
|
94
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent | CustomEvent}
|
|
95
|
+
*/
|
|
96
|
+
export interface FileChangeEvent extends CustomEvent<FileChangeDetail> {
|
|
97
|
+
type: "ar-file-change";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* ARStyle public API
|
|
102
|
+
*
|
|
103
|
+
* @description Provides theme management, toast notifications,
|
|
104
|
+
* rating controls, popover management, and initialization.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```html
|
|
108
|
+
* <script>
|
|
109
|
+
* // Theme management
|
|
110
|
+
* ARStyle.setTheme("neo");
|
|
111
|
+
* console.log(ARStyle.getTheme()); // "neo"
|
|
112
|
+
*
|
|
113
|
+
* // Toast notifications
|
|
114
|
+
* ARStyle.toast("Item saved!", { type: "success" });
|
|
115
|
+
*
|
|
116
|
+
* // Rating
|
|
117
|
+
* const container = document.querySelector("[data-ar-rating]");
|
|
118
|
+
* ARStyle.setRating(container, 4);
|
|
119
|
+
* console.log(ARStyle.getRating(container)); // 4
|
|
120
|
+
*
|
|
121
|
+
* // Popover
|
|
122
|
+
* ARStyle.openPopover("my-popover");
|
|
123
|
+
* </script>
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export interface ARStyleStatic {
|
|
127
|
+
/**
|
|
128
|
+
* Set the active theme
|
|
129
|
+
*
|
|
130
|
+
* @param theme - The theme to activate
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* ARStyle.setTheme("dark");
|
|
135
|
+
* ARStyle.setTheme("neo");
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
setTheme(theme: ThemeName): void;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get the currently active theme
|
|
142
|
+
*
|
|
143
|
+
* @returns The current theme name, or null if no theme is set
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* const current = ARStyle.getTheme();
|
|
148
|
+
* if (current === "dark") {
|
|
149
|
+
* // Dark theme is active
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
getTheme(): ThemeName | null;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Initialize theme from localStorage or system preference
|
|
157
|
+
*
|
|
158
|
+
* @description Checks localStorage for a saved theme, falls back to
|
|
159
|
+
* prefers-color-scheme media query, defaults to "light"
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* // Usually called automatically, but can be called manually
|
|
164
|
+
* ARStyle.initTheme();
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
initTheme(): void;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Initialize all ARStyle behaviors
|
|
171
|
+
*
|
|
172
|
+
* @description Sets up event listeners for theme toggle, modals, drawers,
|
|
173
|
+
* tabs, dropdowns, accordion, ratings, popovers, file uploads, and scroll-to-top
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* // Called automatically on DOMContentLoaded
|
|
178
|
+
* // Call manually if adding elements dynamically
|
|
179
|
+
* ARStyle.init();
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
init(): void;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Show a toast notification
|
|
186
|
+
*
|
|
187
|
+
* @param message - Toast message text
|
|
188
|
+
* @param options - Toast configuration options
|
|
189
|
+
* @returns The toast DOM element (can be used with dismissToast)
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* // Basic toast
|
|
194
|
+
* ARStyle.toast("Hello world!");
|
|
195
|
+
*
|
|
196
|
+
* // Success toast with custom duration
|
|
197
|
+
* ARStyle.toast("Saved successfully!", {
|
|
198
|
+
* type: "success",
|
|
199
|
+
* duration: 5000
|
|
200
|
+
* });
|
|
201
|
+
*
|
|
202
|
+
* // Persistent toast (no auto-dismiss)
|
|
203
|
+
* const loading = ARStyle.toast("Loading...", { duration: 0 });
|
|
204
|
+
*
|
|
205
|
+
* // Dismiss programmatically
|
|
206
|
+
* ARStyle.dismissToast(loading);
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
toast(message: string, options?: ToastOptions): HTMLElement;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Dismiss a toast element
|
|
213
|
+
*
|
|
214
|
+
* @param el - The toast element to dismiss
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* const toast = ARStyle.toast("Processing...");
|
|
219
|
+
* // ... later
|
|
220
|
+
* ARStyle.dismissToast(toast);
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
dismissToast(el: HTMLElement): void;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Get the current rating value from a rating container
|
|
227
|
+
*
|
|
228
|
+
* @param container - The rating container element (with data-ar-rating attribute)
|
|
229
|
+
* @returns The selected rating value (0-5), or 0 if nothing is selected
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* const container = document.querySelector("[data-ar-rating]");
|
|
234
|
+
* const rating = ARStyle.getRating(container);
|
|
235
|
+
* console.log(`Selected rating: ${rating}`);
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
getRating(container: HTMLElement): number;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Set rating programmatically
|
|
242
|
+
*
|
|
243
|
+
* @param container - The rating container element (with data-ar-rating attribute)
|
|
244
|
+
* @param value - Rating value (0-5)
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```typescript
|
|
248
|
+
* const container = document.querySelector("[data-ar-rating]");
|
|
249
|
+
* ARStyle.setRating(container, 4); // Select 4 stars
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
setRating(container: HTMLElement, value: number): void;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Open a popover by ID
|
|
256
|
+
*
|
|
257
|
+
* @param id - The popover content element ID
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```html
|
|
261
|
+
* <div class="ar-popover">
|
|
262
|
+
* <button>Click me</button>
|
|
263
|
+
* <div class="ar-popover-content" id="my-popover">
|
|
264
|
+
* Popover content
|
|
265
|
+
* </div>
|
|
266
|
+
* </div>
|
|
267
|
+
* ```
|
|
268
|
+
*
|
|
269
|
+
* ```typescript
|
|
270
|
+
* ARStyle.openPopover("my-popover");
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
openPopover(id: string): void;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Close a popover by ID
|
|
277
|
+
*
|
|
278
|
+
* @param id - The popover content element ID
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* ARStyle.closePopover("my-popover");
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
closePopover(id: string): void;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* ARStyle global namespace
|
|
290
|
+
*
|
|
291
|
+
* @description Provides access to all ARStyle public methods
|
|
292
|
+
* when using the script tag approach (no module system)
|
|
293
|
+
*
|
|
294
|
+
* @see {@link ARStyleStatic} for method signatures and examples
|
|
295
|
+
*/
|
|
296
|
+
declare global {
|
|
297
|
+
interface Window {
|
|
298
|
+
/**
|
|
299
|
+
* ARStyle global API
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```html
|
|
303
|
+
* <script src="arstyle.js"></script>
|
|
304
|
+
* <script>
|
|
305
|
+
* ARStyle.setTheme("dark");
|
|
306
|
+
* ARStyle.toast("Hello!");
|
|
307
|
+
* </script>
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
ARStyle: ARStyleStatic;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* ARStyle module export
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* // ES Module import
|
|
320
|
+
* import ARStyle from "arstyle";
|
|
321
|
+
*
|
|
322
|
+
* ARStyle.setTheme("neo");
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
declare const ARStyle: ARStyleStatic;
|
|
326
|
+
|
|
327
|
+
export default ARStyle;
|
|
328
|
+
export { ARStyle, ARStyleStatic };
|