@umbra.ui/core 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/controls/Dropdown/types.mjs +1 -0
- package/dist/components/controls/SegmentedControl/types.mjs +1 -0
- package/dist/components/dialogs/Alert/types.mjs +1 -0
- package/dist/components/dialogs/Toast/{types.js → types.mjs} +1 -4
- package/dist/components/dialogs/Toast/{useToast.js → useToast.mjs} +9 -13
- package/dist/components/indicators/Tooltip/{tooltip.js → tooltip.mjs} +4 -7
- package/dist/components/indicators/Tooltip/types.mjs +1 -0
- package/dist/components/indicators/Tooltip/{useTooltip.js → useTooltip.mjs} +5 -10
- package/dist/components/inputs/Tags/{tag-bar-styles.js → tag-bar-styles.mjs} +3 -6
- package/dist/components/inputs/Tags/{types.js → types.mjs} +15 -58
- package/dist/components/inputs/search/types.mjs +1 -0
- package/dist/components/navigation/adaptive/types.mjs +1 -0
- package/dist/components/navigation/adaptive/{useAdaptiveLayout.js → useAdaptiveLayout.mjs} +10 -14
- package/dist/components/navigation/adaptive/{useBreakpoints.js → useBreakpoints.mjs} +1 -5
- package/dist/components/navigation/adaptive/{useContainerMonitor.js → useContainerMonitor.mjs} +16 -20
- package/dist/components/navigation/adaptive/{useViewAnimation.js → useViewAnimation.mjs} +10 -17
- package/dist/components/navigation/adaptive/{useViewResize.js → useViewResize.mjs} +6 -10
- package/dist/components/navigation/navstack/{useNavigationStack.js → useNavigationStack.mjs} +10 -13
- package/dist/components/navigation/slideover/{useSlideoverController.js → useSlideoverController.mjs} +19 -23
- package/dist/components/navigation/splitview/{useSplitViewController.js → useSplitViewController.mjs} +22 -26
- package/dist/components/navigation/tabcontroller/types.mjs +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.mjs +10 -0
- package/dist/components/navigation/types.mjs +1 -0
- package/dist/components/pickers/CollectionPicker/types.mjs +1 -0
- package/dist/components/pickers/ColorPicker/{colors.js → colors.mjs} +26 -29
- package/dist/components/pickers/FilePicker/types.mjs +1 -0
- package/dist/{readme.js → readme.mjs} +4 -11
- package/dist/{theme.js → theme.mjs} +45 -61
- package/dist/themes/{crimson-dark.js → crimson-dark.mjs} +2 -5
- package/dist/themes/{cyan-light.js → cyan-light.mjs} +2 -5
- package/dist/themes/{dark.js → dark.mjs} +2 -5
- package/dist/themes/{gold-dark.js → gold-dark.mjs} +2 -5
- package/dist/themes/{grass-dark.js → grass-dark.mjs} +2 -5
- package/dist/themes/{indigo.js → indigo.mjs} +2 -5
- package/dist/themes/{light.js → light.mjs} +2 -5
- package/dist/themes/{orange-dark.js → orange-dark.mjs} +2 -5
- package/dist/themes/{orange-light.js → orange-light.mjs} +2 -5
- package/package.json +5 -6
- package/dist/components/controls/Dropdown/types.js +0 -2
- package/dist/components/controls/SegmentedControl/types.js +0 -2
- package/dist/components/dialogs/Alert/types.js +0 -2
- package/dist/components/indicators/Tooltip/types.js +0 -2
- package/dist/components/inputs/search/types.js +0 -2
- package/dist/components/navigation/adaptive/types.js +0 -2
- package/dist/components/navigation/tabcontroller/types.js +0 -2
- package/dist/components/navigation/tabcontroller/useTabController.js +0 -14
- package/dist/components/navigation/types.js +0 -2
- package/dist/components/pickers/CollectionPicker/types.js +0 -2
- package/dist/components/pickers/FilePicker/types.js +0 -2
- package/dist/index.js +0 -176
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const Flip_1 = require("gsap/Flip");
|
|
7
|
-
gsap_1.gsap.registerPlugin(Flip_1.Flip);
|
|
8
|
-
const useSlideoverController = (panes, componentId) => {
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
import { gsap } from "gsap";
|
|
3
|
+
import { Flip } from "gsap/Flip";
|
|
4
|
+
gsap.registerPlugin(Flip);
|
|
5
|
+
export const useSlideoverController = (panes, componentId) => {
|
|
9
6
|
// State to track visibility of panes
|
|
10
|
-
const visiblePanes =
|
|
7
|
+
const visiblePanes = ref(panes.map(() => false));
|
|
11
8
|
// Track the current active pane index
|
|
12
|
-
const currentPaneIndex =
|
|
9
|
+
const currentPaneIndex = computed(() => {
|
|
13
10
|
// Find the highest index that's visible
|
|
14
11
|
for (let i = visiblePanes.value.length - 1; i >= 0; i--) {
|
|
15
12
|
if (visiblePanes.value[i]) {
|
|
@@ -31,11 +28,11 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
31
28
|
return;
|
|
32
29
|
if (show) {
|
|
33
30
|
darken.style.pointerEvents = "all";
|
|
34
|
-
|
|
31
|
+
gsap.to(darken, { duration: 0.5, opacity: 1, ease: "circ.outOut" });
|
|
35
32
|
}
|
|
36
33
|
else {
|
|
37
34
|
darken.style.pointerEvents = "none";
|
|
38
|
-
|
|
35
|
+
gsap.to(darken, { duration: 0.5, opacity: 0, ease: "circ.outOut" });
|
|
39
36
|
}
|
|
40
37
|
};
|
|
41
38
|
// Show a specific pane and all panes after it
|
|
@@ -54,7 +51,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
54
51
|
.slice(0, -1) // Exclude main pane
|
|
55
52
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
56
53
|
.filter((el) => el !== null);
|
|
57
|
-
const state =
|
|
54
|
+
const state = Flip.getState(paneElements);
|
|
58
55
|
// Show all panes from the selected index onward
|
|
59
56
|
for (let i = 0; i < panes.length - 1; i++) {
|
|
60
57
|
const pane = document.getElementById(getPaneId(i));
|
|
@@ -72,7 +69,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
// Animate
|
|
75
|
-
|
|
72
|
+
Flip.from(state, {
|
|
76
73
|
duration: 0.3,
|
|
77
74
|
ease: "power1.inOut",
|
|
78
75
|
absolute: true,
|
|
@@ -93,7 +90,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
93
90
|
.slice(0, -1)
|
|
94
91
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
95
92
|
.filter((el) => el !== null);
|
|
96
|
-
const state =
|
|
93
|
+
const state = Flip.getState(paneElements);
|
|
97
94
|
// Hide all panes up to and including the specified index
|
|
98
95
|
for (let i = 0; i <= index && i < panes.length - 1; i++) {
|
|
99
96
|
const pane = document.getElementById(getPaneId(i));
|
|
@@ -104,7 +101,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
// Animate
|
|
107
|
-
|
|
104
|
+
Flip.from(state, {
|
|
108
105
|
duration: 0.3,
|
|
109
106
|
ease: "power1.inOut",
|
|
110
107
|
absolute: true,
|
|
@@ -128,7 +125,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
128
125
|
.slice(0, -1)
|
|
129
126
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
130
127
|
.filter((el) => el !== null);
|
|
131
|
-
const state =
|
|
128
|
+
const state = Flip.getState(paneElements);
|
|
132
129
|
// If the previous pane is visible, hide all before this one
|
|
133
130
|
if (visiblePanes.value[index - 1]) {
|
|
134
131
|
for (let i = 0; i < index; i++) {
|
|
@@ -150,7 +147,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
150
147
|
}
|
|
151
148
|
}
|
|
152
149
|
// Animate
|
|
153
|
-
|
|
150
|
+
Flip.from(state, {
|
|
154
151
|
duration: 0.3,
|
|
155
152
|
ease: "power1.inOut",
|
|
156
153
|
absolute: true,
|
|
@@ -169,7 +166,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
169
166
|
.slice(0, -1)
|
|
170
167
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
171
168
|
.filter((el) => el !== null);
|
|
172
|
-
const state =
|
|
169
|
+
const state = Flip.getState(paneElements);
|
|
173
170
|
// Move all secondary panes to overlay
|
|
174
171
|
for (let i = 0; i < panes.length - 1; i++) {
|
|
175
172
|
const pane = document.getElementById(getPaneId(i));
|
|
@@ -179,7 +176,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
179
176
|
overlay.appendChild(pane);
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
|
-
|
|
179
|
+
Flip.from(state, {
|
|
183
180
|
duration: 0.3,
|
|
184
181
|
ease: "power1.inOut",
|
|
185
182
|
absolute: true,
|
|
@@ -198,7 +195,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
198
195
|
.slice(0, -1)
|
|
199
196
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
200
197
|
.filter((el) => el !== null);
|
|
201
|
-
const state =
|
|
198
|
+
const state = Flip.getState(paneElements);
|
|
202
199
|
// Move all panes from overlay to offscreen
|
|
203
200
|
for (let i = 0; i < panes.length - 1; i++) {
|
|
204
201
|
const pane = document.getElementById(getPaneId(i));
|
|
@@ -208,7 +205,7 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
208
205
|
offscreen.appendChild(pane);
|
|
209
206
|
}
|
|
210
207
|
}
|
|
211
|
-
|
|
208
|
+
Flip.from(state, {
|
|
212
209
|
duration: 0.3,
|
|
213
210
|
ease: "power1.inOut",
|
|
214
211
|
absolute: true,
|
|
@@ -268,4 +265,3 @@ const useSlideoverController = (panes, componentId) => {
|
|
|
268
265
|
navigate,
|
|
269
266
|
};
|
|
270
267
|
};
|
|
271
|
-
exports.useSlideoverController = useSlideoverController;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSplitViewController = void 0;
|
|
4
1
|
//useSplitViewController.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const useSplitViewController = (panes, componentId) => {
|
|
2
|
+
import { ref, computed, unref, watch } from "vue";
|
|
3
|
+
import { gsap } from "gsap";
|
|
4
|
+
import { Flip } from "gsap/Flip";
|
|
5
|
+
gsap.registerPlugin(Flip);
|
|
6
|
+
export const useSplitViewController = (panes, componentId) => {
|
|
10
7
|
// Get the actual panes array
|
|
11
|
-
const panesArray =
|
|
8
|
+
const panesArray = computed(() => unref(panes));
|
|
12
9
|
// State to track visibility of panes
|
|
13
|
-
const visiblePanes =
|
|
10
|
+
const visiblePanes = ref(panesArray.value.map(() => true));
|
|
14
11
|
// Vue-native event stream for visibility changes
|
|
15
|
-
const lastVisibilityEvent =
|
|
12
|
+
const lastVisibilityEvent = ref(null);
|
|
16
13
|
// Watch for changes in panes and update visiblePanes accordingly
|
|
17
|
-
|
|
14
|
+
watch(panesArray, (newPanes) => {
|
|
18
15
|
visiblePanes.value = newPanes.map((_, index) => index === newPanes.length - 1 ? true : visiblePanes.value[index] || false);
|
|
19
16
|
});
|
|
20
17
|
// Track the current visible pane indices
|
|
21
|
-
const currentPaneIndex =
|
|
18
|
+
const currentPaneIndex = computed(() => {
|
|
22
19
|
// Find the highest index that's visible (excluding the last pane which is always visible)
|
|
23
20
|
for (let i = visiblePanes.value.length - 2; i >= 0; i--) {
|
|
24
21
|
if (visiblePanes.value[i]) {
|
|
@@ -45,7 +42,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
45
42
|
const paneElements = panesArray.value
|
|
46
43
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
47
44
|
.filter((el) => el !== null);
|
|
48
|
-
const state =
|
|
45
|
+
const state = Flip.getState(paneElements);
|
|
49
46
|
// Show the specified pane
|
|
50
47
|
const pane = document.getElementById(getPaneId(index));
|
|
51
48
|
if (pane && !visiblePanes.value[index]) {
|
|
@@ -69,7 +66,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
69
66
|
lastVisibilityEvent.value = { type: "show", index };
|
|
70
67
|
}
|
|
71
68
|
// Animate
|
|
72
|
-
|
|
69
|
+
Flip.from(state, {
|
|
73
70
|
duration: 0.3,
|
|
74
71
|
ease: "power1.inOut",
|
|
75
72
|
absolute: true,
|
|
@@ -89,7 +86,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
89
86
|
const paneElements = panesArray.value
|
|
90
87
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
91
88
|
.filter((el) => el !== null);
|
|
92
|
-
const state =
|
|
89
|
+
const state = Flip.getState(paneElements);
|
|
93
90
|
// Hide the specified pane
|
|
94
91
|
const pane = document.getElementById(getPaneId(index));
|
|
95
92
|
if (pane && visiblePanes.value[index]) {
|
|
@@ -99,7 +96,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
99
96
|
lastVisibilityEvent.value = { type: "hide", index };
|
|
100
97
|
}
|
|
101
98
|
// Animate
|
|
102
|
-
|
|
99
|
+
Flip.from(state, {
|
|
103
100
|
duration: 0.3,
|
|
104
101
|
ease: "power1.inOut",
|
|
105
102
|
absolute: true,
|
|
@@ -119,7 +116,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
119
116
|
const paneElements = panesArray.value
|
|
120
117
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
121
118
|
.filter((el) => el !== null);
|
|
122
|
-
const state =
|
|
119
|
+
const state = Flip.getState(paneElements);
|
|
123
120
|
// Hide all panes before the clicked pane
|
|
124
121
|
if (visiblePanes.value[index - 1]) {
|
|
125
122
|
for (let i = 0; i < index; i++) {
|
|
@@ -143,7 +140,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
143
140
|
}
|
|
144
141
|
}
|
|
145
142
|
// Animate
|
|
146
|
-
|
|
143
|
+
Flip.from(state, {
|
|
147
144
|
duration: 0.3,
|
|
148
145
|
ease: "power1.inOut",
|
|
149
146
|
absolute: true,
|
|
@@ -160,7 +157,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
160
157
|
const paneElements = panesArray.value
|
|
161
158
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
162
159
|
.filter((el) => el !== null);
|
|
163
|
-
const state =
|
|
160
|
+
const state = Flip.getState(paneElements);
|
|
164
161
|
// Show all panes except the last one (which is always visible)
|
|
165
162
|
for (let i = 0; i < panesArray.value.length - 1; i++) {
|
|
166
163
|
const pane = document.getElementById(getPaneId(i));
|
|
@@ -185,7 +182,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
185
182
|
lastVisibilityEvent.value = { type: "show", index: i };
|
|
186
183
|
}
|
|
187
184
|
}
|
|
188
|
-
|
|
185
|
+
Flip.from(state, {
|
|
189
186
|
duration: 0.3,
|
|
190
187
|
ease: "power1.inOut",
|
|
191
188
|
absolute: true,
|
|
@@ -202,7 +199,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
202
199
|
const paneElements = panesArray.value
|
|
203
200
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
204
201
|
.filter((el) => el !== null);
|
|
205
|
-
const state =
|
|
202
|
+
const state = Flip.getState(paneElements);
|
|
206
203
|
// Hide all panes except the last one
|
|
207
204
|
for (let i = 0; i < panesArray.value.length - 1; i++) {
|
|
208
205
|
const pane = document.getElementById(getPaneId(i));
|
|
@@ -213,7 +210,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
213
210
|
lastVisibilityEvent.value = { type: "hide", index: i };
|
|
214
211
|
}
|
|
215
212
|
}
|
|
216
|
-
|
|
213
|
+
Flip.from(state, {
|
|
217
214
|
duration: 0.3,
|
|
218
215
|
ease: "power1.inOut",
|
|
219
216
|
absolute: true,
|
|
@@ -272,7 +269,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
272
269
|
const paneElements = panesArray.value
|
|
273
270
|
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
274
271
|
.filter((el) => el !== null);
|
|
275
|
-
const state =
|
|
272
|
+
const state = Flip.getState(paneElements);
|
|
276
273
|
// First hide all panes
|
|
277
274
|
for (let i = 0; i < panesArray.value.length - 1; i++) {
|
|
278
275
|
if (i !== index && visiblePanes.value[i]) {
|
|
@@ -307,7 +304,7 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
307
304
|
}
|
|
308
305
|
lastVisibilityEvent.value = { type: "show", index };
|
|
309
306
|
}
|
|
310
|
-
|
|
307
|
+
Flip.from(state, {
|
|
311
308
|
duration: 0.3,
|
|
312
309
|
ease: "power1.inOut",
|
|
313
310
|
absolute: true,
|
|
@@ -326,4 +323,3 @@ const useSplitViewController = (panes, componentId) => {
|
|
|
326
323
|
navigate,
|
|
327
324
|
};
|
|
328
325
|
};
|
|
329
|
-
exports.useSplitViewController = useSplitViewController;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// ============= useTabController.ts =============
|
|
2
|
+
import { inject } from "vue";
|
|
3
|
+
export const TabControllerKey = Symbol("TabController");
|
|
4
|
+
export const useTabController = () => {
|
|
5
|
+
const context = inject(TabControllerKey);
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error("useTabController must be used within a TabController component");
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.colorGroups = exports.colorPickerColors = exports.colors = void 0;
|
|
4
|
-
exports.colors = [
|
|
1
|
+
export const colors = [
|
|
5
2
|
{ name: "Gray", hex: "#E5E7EB", weight: 200 },
|
|
6
3
|
{ name: "Gray", hex: "#D1D5DB", weight: 300 },
|
|
7
4
|
{ name: "Gray", hex: "#9CA3AF", weight: 400 },
|
|
@@ -172,98 +169,98 @@ exports.colors = [
|
|
|
172
169
|
{ name: "Rose", hex: "#881337", weight: 900 },
|
|
173
170
|
];
|
|
174
171
|
// Create a colorPicker object for easy access to colors by name and weight
|
|
175
|
-
|
|
172
|
+
export const colorPickerColors = {};
|
|
176
173
|
// Populate the colorPicker object
|
|
177
|
-
|
|
174
|
+
colors.forEach((color) => {
|
|
178
175
|
if (color.name && color.weight) {
|
|
179
176
|
const key = `${color.name.toLowerCase()}${color.weight}`;
|
|
180
|
-
|
|
177
|
+
colorPickerColors[key] = color;
|
|
181
178
|
}
|
|
182
179
|
});
|
|
183
180
|
// Also export individual color groups for convenience
|
|
184
|
-
|
|
181
|
+
export const colorGroups = [
|
|
185
182
|
{
|
|
186
183
|
name: "Gray",
|
|
187
|
-
colors:
|
|
184
|
+
colors: colors.filter((c) => c.name === "Gray"),
|
|
188
185
|
},
|
|
189
186
|
{
|
|
190
187
|
name: "Zinc",
|
|
191
|
-
colors:
|
|
188
|
+
colors: colors.filter((c) => c.name === "Zinc"),
|
|
192
189
|
},
|
|
193
190
|
{
|
|
194
191
|
name: "Neutral",
|
|
195
|
-
colors:
|
|
192
|
+
colors: colors.filter((c) => c.name === "Neutral"),
|
|
196
193
|
},
|
|
197
194
|
{
|
|
198
195
|
name: "Stone",
|
|
199
|
-
colors:
|
|
196
|
+
colors: colors.filter((c) => c.name === "Stone"),
|
|
200
197
|
},
|
|
201
198
|
{
|
|
202
199
|
name: "Red",
|
|
203
|
-
colors:
|
|
200
|
+
colors: colors.filter((c) => c.name === "Red"),
|
|
204
201
|
},
|
|
205
202
|
{
|
|
206
203
|
name: "Orange",
|
|
207
|
-
colors:
|
|
204
|
+
colors: colors.filter((c) => c.name === "Orange"),
|
|
208
205
|
},
|
|
209
206
|
{
|
|
210
207
|
name: "Amber",
|
|
211
|
-
colors:
|
|
208
|
+
colors: colors.filter((c) => c.name === "Amber"),
|
|
212
209
|
},
|
|
213
210
|
{
|
|
214
211
|
name: "Yellow",
|
|
215
|
-
colors:
|
|
212
|
+
colors: colors.filter((c) => c.name === "Yellow"),
|
|
216
213
|
},
|
|
217
214
|
{
|
|
218
215
|
name: "Lime",
|
|
219
|
-
colors:
|
|
216
|
+
colors: colors.filter((c) => c.name === "Lime"),
|
|
220
217
|
},
|
|
221
218
|
{
|
|
222
219
|
name: "Green",
|
|
223
|
-
colors:
|
|
220
|
+
colors: colors.filter((c) => c.name === "Green"),
|
|
224
221
|
},
|
|
225
222
|
{
|
|
226
223
|
name: "Emerald",
|
|
227
|
-
colors:
|
|
224
|
+
colors: colors.filter((c) => c.name === "Emerald"),
|
|
228
225
|
},
|
|
229
226
|
{
|
|
230
227
|
name: "Teal",
|
|
231
|
-
colors:
|
|
228
|
+
colors: colors.filter((c) => c.name === "Teal"),
|
|
232
229
|
},
|
|
233
230
|
{
|
|
234
231
|
name: "Cyan",
|
|
235
|
-
colors:
|
|
232
|
+
colors: colors.filter((c) => c.name === "Cyan"),
|
|
236
233
|
},
|
|
237
234
|
{
|
|
238
235
|
name: "Sky",
|
|
239
|
-
colors:
|
|
236
|
+
colors: colors.filter((c) => c.name === "Sky"),
|
|
240
237
|
},
|
|
241
238
|
{
|
|
242
239
|
name: "Blue",
|
|
243
|
-
colors:
|
|
240
|
+
colors: colors.filter((c) => c.name === "Blue"),
|
|
244
241
|
},
|
|
245
242
|
{
|
|
246
243
|
name: "Indigo",
|
|
247
|
-
colors:
|
|
244
|
+
colors: colors.filter((c) => c.name === "Indigo"),
|
|
248
245
|
},
|
|
249
246
|
{
|
|
250
247
|
name: "Violet",
|
|
251
|
-
colors:
|
|
248
|
+
colors: colors.filter((c) => c.name === "Violet"),
|
|
252
249
|
},
|
|
253
250
|
{
|
|
254
251
|
name: "Purple",
|
|
255
|
-
colors:
|
|
252
|
+
colors: colors.filter((c) => c.name === "Purple"),
|
|
256
253
|
},
|
|
257
254
|
{
|
|
258
255
|
name: "Fuchsia",
|
|
259
|
-
colors:
|
|
256
|
+
colors: colors.filter((c) => c.name === "Fuchsia"),
|
|
260
257
|
},
|
|
261
258
|
{
|
|
262
259
|
name: "Pink",
|
|
263
|
-
colors:
|
|
260
|
+
colors: colors.filter((c) => c.name === "Pink"),
|
|
264
261
|
},
|
|
265
262
|
{
|
|
266
263
|
name: "Rose",
|
|
267
|
-
colors:
|
|
264
|
+
colors: colors.filter((c) => c.name === "Rose"),
|
|
268
265
|
},
|
|
269
266
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// README accessors - Optional module for accessing component documentation
|
|
3
2
|
// This module is only needed for playground/documentation purposes
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.registerReadmes = exports.getReadmeIndex = exports.getAvailableComponents = exports.getComponentReadme = void 0;
|
|
6
3
|
// This will be populated by Vite's import.meta.glob in Vite environments
|
|
7
4
|
// or remain empty in other bundlers
|
|
8
5
|
// Disabled for CommonJS compatibility
|
|
@@ -28,39 +25,35 @@ for (const [path, content] of Object.entries(__readmeModules)) {
|
|
|
28
25
|
* @param componentName - The component name (kebab-case or PascalCase)
|
|
29
26
|
* @returns The README content as a string, or undefined if not found
|
|
30
27
|
*/
|
|
31
|
-
const getComponentReadme = (componentName) => {
|
|
28
|
+
export const getComponentReadme = (componentName) => {
|
|
32
29
|
const kebab = componentName
|
|
33
30
|
.replace(/([a-z0-9])([A-Z])/g, "$1-$2")
|
|
34
31
|
.replace(/[\s_]+/g, "-")
|
|
35
32
|
.toLowerCase();
|
|
36
33
|
return README_INDEX[kebab] || README_INDEX[componentName.toLowerCase()];
|
|
37
34
|
};
|
|
38
|
-
exports.getComponentReadme = getComponentReadme;
|
|
39
35
|
/**
|
|
40
36
|
* Get all available component names that have README files
|
|
41
37
|
* @returns Array of component names
|
|
42
38
|
*/
|
|
43
|
-
const getAvailableComponents = () => {
|
|
39
|
+
export const getAvailableComponents = () => {
|
|
44
40
|
return Object.keys(README_INDEX);
|
|
45
41
|
};
|
|
46
|
-
exports.getAvailableComponents = getAvailableComponents;
|
|
47
42
|
/**
|
|
48
43
|
* Get the complete README index
|
|
49
44
|
* @returns The README index object
|
|
50
45
|
*/
|
|
51
|
-
const getReadmeIndex = () => {
|
|
46
|
+
export const getReadmeIndex = () => {
|
|
52
47
|
return { ...README_INDEX };
|
|
53
48
|
};
|
|
54
|
-
exports.getReadmeIndex = getReadmeIndex;
|
|
55
49
|
/**
|
|
56
50
|
* Register additional README content (useful for non-Vite environments)
|
|
57
51
|
* @param modules - Object mapping file paths to README content
|
|
58
52
|
*/
|
|
59
|
-
const registerReadmes = (modules) => {
|
|
53
|
+
export const registerReadmes = (modules) => {
|
|
60
54
|
for (const [path, content] of Object.entries(modules)) {
|
|
61
55
|
if (typeof content === "string") {
|
|
62
56
|
__indexReadme(path, content);
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
59
|
};
|
|
66
|
-
exports.registerReadmes = registerReadmes;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTheme = exports.getRegisteredThemes = exports.isThemeRegistered = exports.unregisterCustomTheme = exports.registerCustomTheme = exports.destroyThemeManager = exports.isAutoDetectEnabled = exports.setAutoDetect = exports.toggleTheme = exports.getThemeConfig = exports.getTheme = exports.setCustomTheme = exports.setTheme = exports.themeConfig = exports.autoDetect = exports.customThemeColorMode = exports.customThemeId = exports.currentTheme = exports.themeManager = void 0;
|
|
4
|
-
const vue_1 = require("vue");
|
|
1
|
+
import { ref, computed, readonly } from "vue";
|
|
5
2
|
// Track registered themes to avoid duplicates
|
|
6
3
|
const registeredThemes = new Set();
|
|
7
4
|
class ThemeManager {
|
|
8
5
|
constructor() {
|
|
9
|
-
this.currentTheme =
|
|
10
|
-
this.autoDetect =
|
|
6
|
+
this.currentTheme = ref("light");
|
|
7
|
+
this.autoDetect = ref(true);
|
|
11
8
|
this.mediaQuery = null;
|
|
12
9
|
this.systemThemeListener = null;
|
|
13
|
-
this.customThemeId =
|
|
14
|
-
this.customThemeColorMode =
|
|
10
|
+
this.customThemeId = ref(undefined);
|
|
11
|
+
this.customThemeColorMode = ref(undefined);
|
|
15
12
|
this.initialize();
|
|
16
13
|
}
|
|
17
14
|
initialize() {
|
|
@@ -179,20 +176,20 @@ class ThemeManager {
|
|
|
179
176
|
}
|
|
180
177
|
// Expose reactive references as readonly for components
|
|
181
178
|
get theme() {
|
|
182
|
-
return
|
|
179
|
+
return readonly(this.currentTheme);
|
|
183
180
|
}
|
|
184
181
|
get customThemeIdRef() {
|
|
185
|
-
return
|
|
182
|
+
return readonly(this.customThemeId);
|
|
186
183
|
}
|
|
187
184
|
get customThemeColorModeRef() {
|
|
188
|
-
return
|
|
185
|
+
return readonly(this.customThemeColorMode);
|
|
189
186
|
}
|
|
190
187
|
get autoDetectRef() {
|
|
191
|
-
return
|
|
188
|
+
return readonly(this.autoDetect);
|
|
192
189
|
}
|
|
193
190
|
// Computed property for the full config
|
|
194
191
|
get configRef() {
|
|
195
|
-
return
|
|
192
|
+
return computed(() => ({
|
|
196
193
|
theme: this.currentTheme.value,
|
|
197
194
|
autoDetect: this.autoDetect.value,
|
|
198
195
|
customThemeId: this.customThemeId.value,
|
|
@@ -201,33 +198,25 @@ class ThemeManager {
|
|
|
201
198
|
}
|
|
202
199
|
}
|
|
203
200
|
// Create singleton instance
|
|
204
|
-
|
|
201
|
+
export const themeManager = new ThemeManager();
|
|
205
202
|
// Export reactive references for direct use in components
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
203
|
+
export const currentTheme = themeManager.theme;
|
|
204
|
+
export const customThemeId = themeManager.customThemeIdRef;
|
|
205
|
+
export const customThemeColorMode = themeManager.customThemeColorModeRef;
|
|
206
|
+
export const autoDetect = themeManager.autoDetectRef;
|
|
207
|
+
export const themeConfig = themeManager.configRef;
|
|
211
208
|
// Export convenience functions (keep existing API)
|
|
212
|
-
const setTheme = (theme, save) =>
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
exports.getThemeConfig = getThemeConfig;
|
|
220
|
-
const toggleTheme = () => exports.themeManager.toggleTheme();
|
|
221
|
-
exports.toggleTheme = toggleTheme;
|
|
222
|
-
const setAutoDetect = (enabled) => exports.themeManager.setAutoDetect(enabled);
|
|
223
|
-
exports.setAutoDetect = setAutoDetect;
|
|
224
|
-
const isAutoDetectEnabled = () => exports.themeManager.isAutoDetectEnabled();
|
|
225
|
-
exports.isAutoDetectEnabled = isAutoDetectEnabled;
|
|
209
|
+
export const setTheme = (theme, save) => themeManager.setTheme(theme, save);
|
|
210
|
+
export const setCustomTheme = (customThemeId, customThemeColorMode, save) => themeManager.setCustomTheme(customThemeId, customThemeColorMode, save);
|
|
211
|
+
export const getTheme = () => themeManager.getTheme();
|
|
212
|
+
export const getThemeConfig = () => themeManager.getConfig();
|
|
213
|
+
export const toggleTheme = () => themeManager.toggleTheme();
|
|
214
|
+
export const setAutoDetect = (enabled) => themeManager.setAutoDetect(enabled);
|
|
215
|
+
export const isAutoDetectEnabled = () => themeManager.isAutoDetectEnabled();
|
|
226
216
|
// Cleanup function for SPA navigation
|
|
227
|
-
const destroyThemeManager = () =>
|
|
228
|
-
exports.destroyThemeManager = destroyThemeManager;
|
|
217
|
+
export const destroyThemeManager = () => themeManager.destroy();
|
|
229
218
|
// Custom theme registration utilities
|
|
230
|
-
const registerCustomTheme = (themeId, cssVariables) => {
|
|
219
|
+
export const registerCustomTheme = (themeId, cssVariables) => {
|
|
231
220
|
// Check if already registered
|
|
232
221
|
if (registeredThemes.has(themeId)) {
|
|
233
222
|
console.warn(`Theme "${themeId}" is already registered`);
|
|
@@ -250,46 +239,41 @@ ${cssVars}
|
|
|
250
239
|
document.head.appendChild(style);
|
|
251
240
|
registeredThemes.add(themeId);
|
|
252
241
|
};
|
|
253
|
-
|
|
254
|
-
const unregisterCustomTheme = (themeId) => {
|
|
242
|
+
export const unregisterCustomTheme = (themeId) => {
|
|
255
243
|
const styleElement = document.querySelector(`style[data-umbra-custom-theme="${themeId}"]`);
|
|
256
244
|
if (styleElement) {
|
|
257
245
|
styleElement.remove();
|
|
258
246
|
registeredThemes.delete(themeId);
|
|
259
247
|
}
|
|
260
248
|
};
|
|
261
|
-
|
|
262
|
-
const isThemeRegistered = (themeId) => {
|
|
249
|
+
export const isThemeRegistered = (themeId) => {
|
|
263
250
|
return registeredThemes.has(themeId);
|
|
264
251
|
};
|
|
265
|
-
|
|
266
|
-
const getRegisteredThemes = () => {
|
|
252
|
+
export const getRegisteredThemes = () => {
|
|
267
253
|
return Array.from(registeredThemes);
|
|
268
254
|
};
|
|
269
|
-
exports.getRegisteredThemes = getRegisteredThemes;
|
|
270
255
|
// Composable for use in Vue components
|
|
271
|
-
const useTheme = () => {
|
|
256
|
+
export const useTheme = () => {
|
|
272
257
|
return {
|
|
273
258
|
// Reactive refs
|
|
274
|
-
theme:
|
|
275
|
-
customThemeId
|
|
276
|
-
customThemeColorMode
|
|
277
|
-
autoDetect
|
|
278
|
-
config:
|
|
259
|
+
theme: currentTheme,
|
|
260
|
+
customThemeId,
|
|
261
|
+
customThemeColorMode,
|
|
262
|
+
autoDetect,
|
|
263
|
+
config: themeConfig,
|
|
279
264
|
// Methods
|
|
280
|
-
setTheme
|
|
281
|
-
setCustomTheme
|
|
282
|
-
toggleTheme
|
|
283
|
-
setAutoDetect
|
|
265
|
+
setTheme,
|
|
266
|
+
setCustomTheme,
|
|
267
|
+
toggleTheme,
|
|
268
|
+
setAutoDetect,
|
|
284
269
|
// Custom theme registration (for advanced usage)
|
|
285
|
-
registerCustomTheme
|
|
286
|
-
unregisterCustomTheme
|
|
287
|
-
isThemeRegistered
|
|
288
|
-
getRegisteredThemes
|
|
270
|
+
registerCustomTheme,
|
|
271
|
+
unregisterCustomTheme,
|
|
272
|
+
isThemeRegistered,
|
|
273
|
+
getRegisteredThemes,
|
|
289
274
|
// Non-reactive getters (for backward compatibility)
|
|
290
|
-
getTheme
|
|
291
|
-
getThemeConfig
|
|
292
|
-
isAutoDetectEnabled
|
|
275
|
+
getTheme,
|
|
276
|
+
getThemeConfig,
|
|
277
|
+
isAutoDetectEnabled,
|
|
293
278
|
};
|
|
294
279
|
};
|
|
295
|
-
exports.useTheme = useTheme;
|