asheeui 0.6.15 → 0.7.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/dist/AsheeUIProvider.js +22 -24
- package/dist/components/accordion/Accordion.js +79 -173
- package/dist/components/accordion/accordion-config.js +12 -13
- package/dist/components/accordion/accordion-styles.js +21 -24
- package/dist/components/autocomplete/Autocomplete.js +78 -136
- package/dist/components/autocomplete/autocomplete-config.js +7 -12
- package/dist/components/button/Button.d.ts +29 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +47 -108
- package/dist/components/button/button-config.js +16 -17
- package/dist/components/button/button-styles.js +10 -11
- package/dist/components/card/Card.d.ts +36 -16
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +115 -205
- package/dist/components/card/card-config.js +24 -21
- package/dist/components/card/card-styles.js +19 -22
- package/dist/components/carousel/Carousel.js +123 -248
- package/dist/components/carousel/carousel-config.js +24 -25
- package/dist/components/carousel/carousel-styles.js +14 -16
- package/dist/components/chip/Chip.js +84 -191
- package/dist/components/chip/chip-config.js +13 -14
- package/dist/components/chip/chip-styles.js +22 -26
- package/dist/components/date-picker/Calendar.d.ts +3 -3
- package/dist/components/date-picker/Calendar.d.ts.map +1 -1
- package/dist/components/date-picker/Calendar.js +141 -222
- package/dist/components/date-picker/DatePicker.d.ts +5 -5
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +122 -220
- package/dist/components/date-picker/TimeSpinner.js +58 -82
- package/dist/components/date-picker/date-picker-config.d.ts +4 -4
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +10 -11
- package/dist/components/date-picker/date-picker-styles.js +44 -45
- package/dist/components/date-picker/date-picker.helpers.d.ts +4 -4
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.helpers.js +74 -102
- package/dist/components/drawer/Drawer.d.ts +26 -8
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +54 -131
- package/dist/components/drawer/drawer-config.js +14 -15
- package/dist/components/drawer/drawer-styles.js +38 -42
- package/dist/components/field/FieldShell.js +49 -56
- package/dist/components/field/field-config.js +17 -18
- package/dist/components/field/field-styles.js +8 -8
- package/dist/components/image/Image.d.ts +7 -7
- package/dist/components/image/Image.d.ts.map +1 -1
- package/dist/components/image/Image.js +65 -132
- package/dist/components/image/image-config.js +17 -18
- package/dist/components/image/image-styles.js +14 -15
- package/dist/components/input/Input.js +65 -150
- package/dist/components/input/PasswordInput.js +30 -49
- package/dist/components/input/input-config.js +7 -7
- package/dist/components/input/input-styles.js +9 -10
- package/dist/components/keyboard/KeyboardContext.js +10 -11
- package/dist/components/keyboard/KeyboardProvider.js +100 -181
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +159 -166
- package/dist/components/keyboard/keyboard-config.js +59 -57
- package/dist/components/keyboard/keyboard-styles.js +10 -11
- package/dist/components/keyboard/use-keyboard-field.js +29 -21
- package/dist/components/link/Link.js +47 -137
- package/dist/components/link/link-config.js +14 -15
- package/dist/components/link/link-styles.js +25 -29
- package/dist/components/marquee/Marquee.js +55 -144
- package/dist/components/marquee/marquee-config.js +18 -19
- package/dist/components/marquee/marquee-styles.js +13 -15
- package/dist/components/modal/Modal.d.ts +26 -10
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +56 -136
- package/dist/components/modal/modal-config.js +15 -16
- package/dist/components/modal/modal-styles.js +13 -14
- package/dist/components/multi-select/MultiSelect.d.ts +18 -2
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +149 -283
- package/dist/components/multi-select/multi-select-config.d.ts +23 -18
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +18 -21
- package/dist/components/multi-select/multi-select-styles.js +17 -20
- package/dist/components/radio/Radio.js +43 -80
- package/dist/components/radio/RadioGroup.js +57 -155
- package/dist/components/radio/radio-config.js +15 -16
- package/dist/components/radio/radio-context.js +6 -6
- package/dist/components/radio/radio-styles.js +55 -60
- package/dist/components/resizable-screen/ResizableScreen.js +87 -177
- package/dist/components/resizable-screen/resizable-screen-config.js +16 -17
- package/dist/components/select/Select.d.ts +3 -2
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +97 -195
- package/dist/components/select/select-config.js +8 -9
- package/dist/components/select/select-styles.js +5 -5
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +102 -196
- package/dist/components/select-menu/select-menu-config.js +12 -12
- package/dist/components/select-menu/use-select-floating.d.ts +11 -1
- package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
- package/dist/components/select-menu/use-select-floating.js +41 -48
- package/dist/components/sidebar/Sidebar.d.ts +43 -22
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +146 -331
- package/dist/components/sidebar/sidebar-config.d.ts +98 -31
- package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar-config.js +47 -33
- package/dist/components/sidebar/sidebar-styles.js +27 -32
- package/dist/components/spinner/spinner-config.js +12 -13
- package/dist/components/spinner/spinner-styles.js +13 -14
- package/dist/components/spinner/spinner.js +39 -82
- package/dist/components/switch/Switch.js +62 -154
- package/dist/components/switch/switch-config.js +11 -12
- package/dist/components/switch/switch-styles.js +14 -16
- package/dist/components/table/Table.js +64 -186
- package/dist/components/table/table-config.js +17 -18
- package/dist/components/table/table-styles.js +48 -52
- package/dist/components/tabs/Tabs.d.ts +16 -8
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +93 -208
- package/dist/components/tabs/tabs-config.d.ts +42 -20
- package/dist/components/tabs/tabs-config.d.ts.map +1 -1
- package/dist/components/tabs/tabs-config.js +26 -18
- package/dist/components/tabs/tabs-styles.js +15 -17
- package/dist/components/textarea/Textarea.js +52 -138
- package/dist/components/textarea/textarea-config.js +10 -11
- package/dist/components/textarea/textarea-styles.js +9 -10
- package/dist/components/toast/ToastContext.js +22 -26
- package/dist/components/toast/ToastItem.js +82 -144
- package/dist/components/toast/ToastProvider.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.js +128 -190
- package/dist/components/toast/toast-config.js +23 -24
- package/dist/components/toast/toast-styles.js +50 -55
- package/dist/components/toast/use-pausable-timeout.js +17 -13
- package/dist/components/tooltip/Tooltip.d.ts +5 -0
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +68 -158
- package/dist/components/tooltip/tooltip-config.d.ts +25 -0
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-config.js +26 -22
- package/dist/components/tooltip/tooltip-styles.js +15 -17
- package/dist/config/default-config.js +11 -34
- package/dist/config/resolve-color.js +23 -23
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/config/resolve-config.js +14 -12
- package/dist/icons/ArrowLeftIcon.js +16 -19
- package/dist/icons/CalendarIcon.js +43 -24
- package/dist/icons/CheckIcon.js +16 -19
- package/dist/icons/ChevronDownIcon.js +15 -21
- package/dist/icons/ChevronLeftIcon.js +16 -19
- package/dist/icons/ChevronRightIcon.js +16 -19
- package/dist/icons/ChevronUpIcon.js +16 -19
- package/dist/icons/ClearIcon.js +26 -22
- package/dist/icons/ClockIcon.js +20 -22
- package/dist/icons/CloseIcon.js +26 -22
- package/dist/icons/ErrorIcon.js +16 -19
- package/dist/icons/ExternalLinkIcon.js +25 -23
- package/dist/icons/EyeIcon.js +20 -22
- package/dist/icons/EyeOffIcon.js +21 -22
- package/dist/icons/InfoIcon.js +16 -19
- package/dist/icons/SearchIcon.js +25 -22
- package/dist/icons/WarningIcon.js +16 -19
- package/dist/index.js +65 -163
- package/dist/libs/context.js +10 -13
- package/dist/libs/index.js +1 -0
- package/dist/libs/registry.js +10 -12
- package/dist/libs/use-floating-z-index.d.ts +32 -0
- package/dist/libs/use-floating-z-index.d.ts.map +1 -0
- package/dist/libs/use-floating-z-index.js +16 -0
- package/dist/libs/use-isomorphic-layout-effect.js +5 -5
- package/dist/scripts/AsheeThemeScript.js +35 -44
- package/dist/shared/radius.d.ts.map +1 -1
- package/dist/shared/radius.js +12 -13
- package/dist/shared/variant.js +46 -134
- package/dist/theme/color.js +28 -28
- package/dist/theme/controller.d.ts.map +1 -1
- package/dist/theme/controller.js +65 -178
- package/dist/theme/useTheme.js +13 -44
- package/dist/utils/cn.js +7 -7
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/merge-object.js +13 -14
- package/dist/utils/resolve-token.js +11 -14
- package/dist/utils/stacking.d.ts +76 -0
- package/dist/utils/stacking.d.ts.map +1 -0
- package/dist/utils/stacking.js +34 -0
- package/package.json +12 -11
package/dist/shared/variant.js
CHANGED
|
@@ -1,138 +1,50 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
),
|
|
26
|
-
danger: r(
|
|
27
|
-
e,
|
|
28
|
-
"bg-transparent text-danger hover:bg-danger/20 hover:text-danger"
|
|
29
|
-
),
|
|
30
|
-
warning: r(
|
|
31
|
-
e,
|
|
32
|
-
"bg-transparent text-warning hover:bg-warning/20 hover:text-warning"
|
|
33
|
-
),
|
|
34
|
-
success: r(
|
|
35
|
-
e,
|
|
36
|
-
"bg-transparent text-success hover:bg-success/20 hover:text-success"
|
|
37
|
-
)
|
|
38
|
-
}, t = {
|
|
39
|
-
none: r(
|
|
40
|
-
e,
|
|
41
|
-
o.primary,
|
|
42
|
-
"border-2 border-background hover:border-background/60"
|
|
43
|
-
),
|
|
44
|
-
primary: r(
|
|
45
|
-
e,
|
|
46
|
-
o.primary,
|
|
47
|
-
"border-2 border-primary hover:border-primary/60"
|
|
48
|
-
),
|
|
49
|
-
secondary: r(
|
|
50
|
-
e,
|
|
51
|
-
o.secondary,
|
|
52
|
-
"border-2 border-border hover:border-border/60"
|
|
53
|
-
),
|
|
54
|
-
danger: r(
|
|
55
|
-
e,
|
|
56
|
-
o.danger,
|
|
57
|
-
"border-2 border-danger hover:border-danger/60"
|
|
58
|
-
),
|
|
59
|
-
warning: r(
|
|
60
|
-
e,
|
|
61
|
-
o.warning,
|
|
62
|
-
"border-2 border-warning hover:border-warning/60"
|
|
63
|
-
),
|
|
64
|
-
success: r(
|
|
65
|
-
e,
|
|
66
|
-
o.success,
|
|
67
|
-
"border-2 border-success hover:border-success/60"
|
|
68
|
-
)
|
|
69
|
-
}, c = {
|
|
70
|
-
none: r(
|
|
71
|
-
e,
|
|
72
|
-
"bg-secondary/40 text-foreground border-2 border-transparent hover:bg-secondary/60 hover:border-secondary/40"
|
|
73
|
-
),
|
|
74
|
-
primary: r(
|
|
75
|
-
e,
|
|
76
|
-
"bg-primary/10 text-primary border-2 border-primary/20 hover:bg-primary/20 hover:border-primary/40"
|
|
77
|
-
),
|
|
78
|
-
secondary: r(
|
|
79
|
-
e,
|
|
80
|
-
"bg-secondary/15 text-foreground border-2 border-secondary/30 hover:bg-secondary/25 hover:border-secondary/50"
|
|
81
|
-
),
|
|
82
|
-
danger: r(
|
|
83
|
-
e,
|
|
84
|
-
"bg-danger/10 text-danger border-2 border-danger/20 hover:bg-danger/20 hover:border-danger/40"
|
|
85
|
-
),
|
|
86
|
-
warning: r(
|
|
87
|
-
e,
|
|
88
|
-
"bg-warning/10 text-warning border-2 border-warning/20 hover:bg-warning/20 hover:border-warning/40"
|
|
89
|
-
),
|
|
90
|
-
success: r(
|
|
91
|
-
e,
|
|
92
|
-
"bg-success/10 text-success border-2 border-success/20 hover:bg-success/20 hover:border-success/40"
|
|
93
|
-
)
|
|
94
|
-
}, n = "border-b-2 border-t-0 border-x-0 rounded-none bg-transparent shadow-none", i = {
|
|
95
|
-
none: r(
|
|
96
|
-
e,
|
|
97
|
-
n,
|
|
98
|
-
"border-background text-foreground hover:border-background/80"
|
|
99
|
-
),
|
|
100
|
-
primary: r(
|
|
101
|
-
e,
|
|
102
|
-
n,
|
|
103
|
-
"border-primary text-primary hover:border-primary/80"
|
|
104
|
-
),
|
|
105
|
-
secondary: r(
|
|
106
|
-
e,
|
|
107
|
-
n,
|
|
108
|
-
"border-secondary text-secondary hover:border-secondary/80"
|
|
109
|
-
),
|
|
110
|
-
danger: r(
|
|
111
|
-
e,
|
|
112
|
-
n,
|
|
113
|
-
"border-danger text-danger hover:border-danger/80"
|
|
114
|
-
),
|
|
115
|
-
warning: r(
|
|
116
|
-
e,
|
|
117
|
-
n,
|
|
118
|
-
"border-warning text-warning hover:border-warning/80"
|
|
119
|
-
),
|
|
120
|
-
success: r(
|
|
121
|
-
e,
|
|
122
|
-
n,
|
|
123
|
-
"border-success text-success hover:border-success/80"
|
|
124
|
-
)
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
//#region src/shared/variant.ts
|
|
4
|
+
var t = "transition-all duration-200 ease-in-out", n = {
|
|
5
|
+
none: e(t, "bg-background text-foreground hover:bg-background/80"),
|
|
6
|
+
primary: e(t, "bg-primary text-foreground hover:bg-primary/80"),
|
|
7
|
+
secondary: e(t, "bg-secondary text-foreground hover:bg-secondary/80"),
|
|
8
|
+
danger: e(t, "bg-danger text-foreground hover:bg-danger/80"),
|
|
9
|
+
warning: e(t, "bg-warning text-foreground hover:bg-warning/80"),
|
|
10
|
+
success: e(t, "bg-success text-foreground hover:bg-success/80")
|
|
11
|
+
}, r = {
|
|
12
|
+
none: e(t, "bg-transparent text-foreground hover:bg-foreground/20 hover:text-foreground"),
|
|
13
|
+
primary: e(t, "bg-transparent text-primary hover:bg-primary/20 hover:text-primary"),
|
|
14
|
+
secondary: e(t, "bg-transparent text-foreground hover:bg-secondary/20 hover:text-foreground"),
|
|
15
|
+
danger: e(t, "bg-transparent text-danger hover:bg-danger/20 hover:text-danger"),
|
|
16
|
+
warning: e(t, "bg-transparent text-warning hover:bg-warning/20 hover:text-warning"),
|
|
17
|
+
success: e(t, "bg-transparent text-success hover:bg-success/20 hover:text-success")
|
|
18
|
+
}, i = {
|
|
19
|
+
none: e(t, r.primary, "border-2 border-background hover:border-background/60"),
|
|
20
|
+
primary: e(t, r.primary, "border-2 border-primary hover:border-primary/60"),
|
|
21
|
+
secondary: e(t, r.secondary, "border-2 border-border hover:border-border/60"),
|
|
22
|
+
danger: e(t, r.danger, "border-2 border-danger hover:border-danger/60"),
|
|
23
|
+
warning: e(t, r.warning, "border-2 border-warning hover:border-warning/60"),
|
|
24
|
+
success: e(t, r.success, "border-2 border-success hover:border-success/60")
|
|
125
25
|
}, a = {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
26
|
+
none: e(t, "bg-secondary/40 text-foreground border-2 border-transparent hover:bg-secondary/60 hover:border-secondary/40"),
|
|
27
|
+
primary: e(t, "bg-primary/10 text-primary border-2 border-primary/20 hover:bg-primary/20 hover:border-primary/40"),
|
|
28
|
+
secondary: e(t, "bg-secondary/15 text-foreground border-2 border-secondary/30 hover:bg-secondary/25 hover:border-secondary/50"),
|
|
29
|
+
danger: e(t, "bg-danger/10 text-danger border-2 border-danger/20 hover:bg-danger/20 hover:border-danger/40"),
|
|
30
|
+
warning: e(t, "bg-warning/10 text-warning border-2 border-warning/20 hover:bg-warning/20 hover:border-warning/40"),
|
|
31
|
+
success: e(t, "bg-success/10 text-success border-2 border-success/20 hover:bg-success/20 hover:border-success/40")
|
|
32
|
+
}, o = "border-b-2 border-t-0 border-x-0 rounded-none bg-transparent shadow-none", s = {
|
|
33
|
+
solid: n,
|
|
34
|
+
ghost: r,
|
|
35
|
+
bordered: i,
|
|
36
|
+
faded: a,
|
|
37
|
+
underlined: {
|
|
38
|
+
none: e(t, o, "border-background text-foreground hover:border-background/80"),
|
|
39
|
+
primary: e(t, o, "border-primary text-primary hover:border-primary/80"),
|
|
40
|
+
secondary: e(t, o, "border-secondary text-secondary hover:border-secondary/80"),
|
|
41
|
+
danger: e(t, o, "border-danger text-danger hover:border-danger/80"),
|
|
42
|
+
warning: e(t, o, "border-warning text-warning hover:border-warning/80"),
|
|
43
|
+
success: e(t, o, "border-success text-success hover:border-success/80")
|
|
44
|
+
}
|
|
131
45
|
};
|
|
132
|
-
function
|
|
133
|
-
|
|
134
|
-
return ((d = a[s]) == null ? void 0 : d[g]) ?? a.bordered.secondary;
|
|
46
|
+
function c(e, t) {
|
|
47
|
+
return s[e]?.[t] ?? s.bordered.secondary;
|
|
135
48
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { c as resolveVariantClass };
|
package/dist/theme/color.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
r as defaultColorConfig
|
|
2
|
+
//#region src/theme/color.ts
|
|
3
|
+
var e = {
|
|
4
|
+
light: {
|
|
5
|
+
background: "#ffffff",
|
|
6
|
+
foreground: "#000000",
|
|
7
|
+
primary: "#2563eb",
|
|
8
|
+
secondary: "#f3f4f6",
|
|
9
|
+
border: "#d5d5d5",
|
|
10
|
+
danger: "#dc2626",
|
|
11
|
+
warning: "#d97706",
|
|
12
|
+
success: "#16a34a",
|
|
13
|
+
scrollbarThumb: "#3b82f6",
|
|
14
|
+
scrollbarTrack: "transparent"
|
|
15
|
+
},
|
|
16
|
+
dark: {
|
|
17
|
+
background: "#111111",
|
|
18
|
+
foreground: "#ffffff",
|
|
19
|
+
primary: "#005bc4",
|
|
20
|
+
secondary: "#262626",
|
|
21
|
+
border: "#2a2a2a",
|
|
22
|
+
danger: "#ef4444",
|
|
23
|
+
warning: "#f59e0b",
|
|
24
|
+
success: "#22c55e",
|
|
25
|
+
scrollbarThumb: "#1e40af",
|
|
26
|
+
scrollbarTrack: "#1f293700"
|
|
27
|
+
}
|
|
30
28
|
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { e as defaultColorConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/theme/controller.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAa/C;;GAEG;AACH,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,YAAY,EAAE,cAAc,CAAC;IAE7B;;;;OAIG;IACH,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,cAAM,eAAe;IAC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|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
i();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
/**
|
|
71
|
-
* Subscribes a listener to theme changes.
|
|
72
|
-
* The listener will be called whenever the theme selection or resolved theme changes.
|
|
73
|
-
* @param listener - The function to call when the theme changes.
|
|
74
|
-
* @returns An unsubscribe function that removes the listener.
|
|
75
|
-
*/
|
|
76
|
-
s(this, "subscribe", (e) => (this.listeners.add(e), () => this.listeners.delete(e)));
|
|
77
|
-
/**
|
|
78
|
-
* Returns the list of available theme names.
|
|
79
|
-
* @returns The list of available themes configured in the controller.
|
|
80
|
-
*/
|
|
81
|
-
s(this, "getAvailableThemes", () => this.availableThemes);
|
|
82
|
-
/**
|
|
83
|
-
* Cycles to the next theme in sequence (including "system" mode by default).
|
|
84
|
-
* Loops back to the start when reaching the end of the available themes list.
|
|
85
|
-
* The "system" option is not included in the toggle sequence; only specific
|
|
86
|
-
* theme names are cycled through.
|
|
87
|
-
*/
|
|
88
|
-
s(this, "toggleTheme", () => {
|
|
89
|
-
const e = Array.from(new Set(this.availableThemes)).filter(
|
|
90
|
-
(l) => l !== "system"
|
|
91
|
-
), t = e.indexOf(this.selection), i = t === -1 ? 0 : (t + 1) % e.length;
|
|
92
|
-
this.setTheme(e[i]);
|
|
93
|
-
});
|
|
94
|
-
/**
|
|
95
|
-
* Handles system dark mode preference changes.
|
|
96
|
-
* Only re-applies the theme if the current selection is "system",
|
|
97
|
-
* ensuring the resolved theme stays in sync with system changes.
|
|
98
|
-
*/
|
|
99
|
-
s(this, "handleSystemChange", () => {
|
|
100
|
-
this.selection === "system" && (this.applySelection(), this.listeners.forEach((e) => {
|
|
101
|
-
e();
|
|
102
|
-
}));
|
|
103
|
-
});
|
|
104
|
-
typeof window > "u" || (this.mediaQuery = window.matchMedia(c), this.mediaQuery.addEventListener("change", this.handleSystemChange));
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Seeds the controller with the resolved theme config and applies the theme.
|
|
108
|
-
*
|
|
109
|
-
* - Uses `localStorage["ashee-theme"]` when it holds a valid selection.
|
|
110
|
-
* - Falls back to `config.theme.defaultTheme` on first visit.
|
|
111
|
-
* - Clears stale/invalid values from storage.
|
|
112
|
-
* - Never writes to storage (only `setTheme` persists user intent).
|
|
113
|
-
*/
|
|
114
|
-
configure({ defaultTheme: e, themes: t }) {
|
|
115
|
-
if (this.defaultTheme = e, this.availableThemes = t, typeof window > "u") {
|
|
116
|
-
console.log(
|
|
117
|
-
"[Theme] Running in non-browser environment, skipping localStorage operations."
|
|
118
|
-
);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const i = window.localStorage.getItem(o), l = i !== null && this.isValid(i);
|
|
122
|
-
l || i !== null && (console.log(
|
|
123
|
-
"[Theme] Invalid stored theme, removing from localStorage."
|
|
124
|
-
), window.localStorage.removeItem(o)), this.selection = l ? i : e, this.applySelection(), this.listeners.forEach((a) => {
|
|
125
|
-
a();
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Validates a theme selection and returns a valid fallback if necessary.
|
|
130
|
-
* @param selection - The theme selection to sanitize.
|
|
131
|
-
* @returns A valid theme selection, falling back to the default theme
|
|
132
|
-
* if the provided selection is invalid.
|
|
133
|
-
*/
|
|
134
|
-
sanitize(e) {
|
|
135
|
-
return this.isValid(e) ? e : this.defaultTheme;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Checks whether a theme selection is valid.
|
|
139
|
-
* "system" is always valid. Other theme names are valid if they exist
|
|
140
|
-
* in the available themes list. If no available themes are configured,
|
|
141
|
-
* any selection is considered valid.
|
|
142
|
-
* @param selection - The theme selection to validate.
|
|
143
|
-
* @returns True if the selection is valid, false otherwise.
|
|
144
|
-
*/
|
|
145
|
-
isValid(e) {
|
|
146
|
-
return e === "system" ? !0 : this.availableThemes.length > 0 ? this.availableThemes.includes(e) : !0;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Resolves a theme selection to an actual theme name.
|
|
150
|
-
* If the selection is "system", resolves based on the system preference.
|
|
151
|
-
* @param selection - The theme selection to resolve.
|
|
152
|
-
* @returns The resolved theme name.
|
|
153
|
-
*/
|
|
154
|
-
resolve(e) {
|
|
155
|
-
var t;
|
|
156
|
-
return e !== "system" ? e : (t = this.mediaQuery) != null && t.matches ? "dark" : "light";
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Applies the current theme selection by updating the DOM.
|
|
160
|
-
* This method sanitizes the selection, resolves it to a theme name,
|
|
161
|
-
* and applies the appropriate CSS class to the document root.
|
|
162
|
-
* It ensures that only valid theme classes are applied and removes
|
|
163
|
-
* any previously applied theme classes.
|
|
164
|
-
*/
|
|
165
|
-
applySelection() {
|
|
166
|
-
const e = this.sanitize(this.selection);
|
|
167
|
-
let t = this.resolve(e);
|
|
168
|
-
if (this.availableThemes.length > 0 && !this.availableThemes.includes(t) && (t = this.availableThemes.includes(this.defaultTheme) ? this.defaultTheme : this.availableThemes[0]), this.resolved = t, typeof document > "u") return;
|
|
169
|
-
const i = document.documentElement, l = `${h}${t}`;
|
|
170
|
-
for (const a of Array.from(i.classList))
|
|
171
|
-
a.startsWith(h) && i.classList.remove(a);
|
|
172
|
-
i.classList.add(l);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
const f = new m();
|
|
176
|
-
export {
|
|
177
|
-
o as THEME_STORAGE_KEY,
|
|
178
|
-
f as themeController
|
|
179
|
-
};
|
|
2
|
+
//#region src/theme/controller.ts
|
|
3
|
+
var e = "ashee-theme", t = "theme-", n = new class {
|
|
4
|
+
selection = "light";
|
|
5
|
+
resolved = "light";
|
|
6
|
+
defaultTheme = "light";
|
|
7
|
+
availableThemes = [];
|
|
8
|
+
listeners = /* @__PURE__ */ new Set();
|
|
9
|
+
mediaQuery = null;
|
|
10
|
+
constructor() {
|
|
11
|
+
typeof window > "u" || (this.mediaQuery = window.matchMedia("(prefers-color-scheme: dark)"), this.mediaQuery.addEventListener("change", this.handleSystemChange));
|
|
12
|
+
}
|
|
13
|
+
configure({ defaultTheme: t, themes: n }) {
|
|
14
|
+
if (this.defaultTheme = t, this.availableThemes = n, typeof window > "u") {
|
|
15
|
+
console.log("[Theme] Running in non-browser environment, skipping localStorage operations.");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let r = window.localStorage.getItem(e), i = r !== null && this.isValid(r);
|
|
19
|
+
i || r !== null && (console.log("[Theme] Invalid stored theme, removing from localStorage."), window.localStorage.removeItem(e)), this.selection = i ? r : t, this.applySelection(), this.listeners.forEach((e) => {
|
|
20
|
+
e();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
setDefault = (e) => {
|
|
24
|
+
this.configure({
|
|
25
|
+
defaultTheme: e,
|
|
26
|
+
themes: this.availableThemes
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
getSelection = () => this.selection;
|
|
30
|
+
getResolvedTheme = () => this.resolved;
|
|
31
|
+
setTheme = (t) => {
|
|
32
|
+
let n = this.sanitize(t);
|
|
33
|
+
this.selection = n, typeof window < "u" && window.localStorage.setItem(e, n), this.applySelection(), this.listeners.forEach((e) => {
|
|
34
|
+
e();
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
subscribe = (e) => (this.listeners.add(e), () => this.listeners.delete(e));
|
|
38
|
+
getAvailableThemes = () => this.availableThemes;
|
|
39
|
+
toggleTheme = () => {
|
|
40
|
+
let e = Array.from(new Set(this.availableThemes)).filter((e) => e !== "system"), t = e.indexOf(this.selection), n = t === -1 ? 0 : (t + 1) % e.length;
|
|
41
|
+
this.setTheme(e[n]);
|
|
42
|
+
};
|
|
43
|
+
handleSystemChange = () => {
|
|
44
|
+
this.selection === "system" && (this.applySelection(), this.listeners.forEach((e) => {
|
|
45
|
+
e();
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
sanitize(e) {
|
|
49
|
+
return this.isValid(e) ? e : this.defaultTheme;
|
|
50
|
+
}
|
|
51
|
+
isValid(e) {
|
|
52
|
+
return e === "system" ? !0 : this.availableThemes.length > 0 ? this.availableThemes.includes(e) : !0;
|
|
53
|
+
}
|
|
54
|
+
resolve(e) {
|
|
55
|
+
return e === "system" ? this.mediaQuery?.matches ? "dark" : "light" : e;
|
|
56
|
+
}
|
|
57
|
+
applySelection() {
|
|
58
|
+
let e = this.sanitize(this.selection), n = this.resolve(e);
|
|
59
|
+
if (this.availableThemes.length > 0 && !this.availableThemes.includes(n) && (n = this.availableThemes.includes(this.defaultTheme) ? this.defaultTheme : this.availableThemes[0]), this.resolved = n, typeof document > "u") return;
|
|
60
|
+
let r = document.documentElement, i = `${t}${n}`;
|
|
61
|
+
for (let e of Array.from(r.classList)) e.startsWith(t) && r.classList.remove(e);
|
|
62
|
+
r.classList.add(i);
|
|
63
|
+
}
|
|
64
|
+
}();
|
|
65
|
+
//#endregion
|
|
66
|
+
export { e as THEME_STORAGE_KEY, n as themeController };
|
package/dist/theme/useTheme.js
CHANGED
|
@@ -1,47 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
"use client";
|
|
3
3
|
import { themeController as e } from "./controller.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
/**
|
|
16
|
-
* The user's current theme selection.
|
|
17
|
-
* This can be either a specific theme name or "system".
|
|
18
|
-
*/
|
|
19
|
-
theme: o,
|
|
20
|
-
/**
|
|
21
|
-
* The resolved theme name after applying the selection.
|
|
22
|
-
* If the selection is "system", this resolves to either "light" or "dark"
|
|
23
|
-
* based on the system preference.
|
|
24
|
-
*/
|
|
25
|
-
resolvedTheme: l,
|
|
26
|
-
/**
|
|
27
|
-
* Function to set the theme selection.
|
|
28
|
-
* This persists the selection to localStorage and applies the theme.
|
|
29
|
-
* @param selection - The theme to select, either "system" or a theme name.
|
|
30
|
-
*/
|
|
31
|
-
setTheme: e.setTheme,
|
|
32
|
-
/**
|
|
33
|
-
* Function to cycle to the next available theme.
|
|
34
|
-
* This cycles through all available theme names, excluding "system".
|
|
35
|
-
* Loops back to the start when reaching the end of the list.
|
|
36
|
-
*/
|
|
37
|
-
toggleTheme: e.toggleTheme,
|
|
38
|
-
/**
|
|
39
|
-
* The list of available theme names in the application.
|
|
40
|
-
* This does not include "system" as it is not a theme name.
|
|
41
|
-
*/
|
|
42
|
-
availableThemes: e.getAvailableThemes()
|
|
43
|
-
};
|
|
4
|
+
import { useSyncExternalStore as t } from "react";
|
|
5
|
+
//#region src/theme/useTheme.ts
|
|
6
|
+
function n() {
|
|
7
|
+
return {
|
|
8
|
+
theme: t(e.subscribe, e.getSelection, () => "light"),
|
|
9
|
+
resolvedTheme: t(e.subscribe, e.getResolvedTheme, () => "light"),
|
|
10
|
+
setTheme: e.setTheme,
|
|
11
|
+
toggleTheme: e.toggleTheme,
|
|
12
|
+
availableThemes: e.getAvailableThemes()
|
|
13
|
+
};
|
|
44
14
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as useTheme };
|
package/dist/utils/cn.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { clsx as
|
|
3
|
-
import { twMerge as
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { clsx as e } from "clsx";
|
|
3
|
+
import { twMerge as t } from "tailwind-merge";
|
|
4
|
+
//#region src/utils/cn.ts
|
|
5
|
+
function n(...n) {
|
|
6
|
+
return t(e(n));
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as cn };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { cn } from './cn';
|
|
2
2
|
export { mergeObject } from './merge-object';
|
|
3
|
+
export { ASHEE_GLOBAL_LAYER, ASHEE_LAYER, establishesStackingContext, resolveBaseZIndex, resolveFloatingZIndex, } from './stacking';
|
|
3
4
|
export type { DeepPartial } from './types';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,0BAA0B,EAC1B,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
//#region src/utils/merge-object.ts
|
|
3
|
+
function e(e) {
|
|
4
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4
5
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return o;
|
|
6
|
+
function t(n, r) {
|
|
7
|
+
if (!r) return n;
|
|
8
|
+
let i = { ...n }, a = n, o = r;
|
|
9
|
+
for (let n of Object.keys(r)) {
|
|
10
|
+
let r = o[n], s = a[n];
|
|
11
|
+
r !== void 0 && (i[n] = e(s) && e(r) ? t(s, r) : r);
|
|
12
|
+
}
|
|
13
|
+
return i;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { t as mergeObject };
|