@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToastPresets = void 0;
|
|
4
1
|
// Preset configurations for common scenarios
|
|
5
|
-
|
|
2
|
+
export const ToastPresets = {
|
|
6
3
|
quick: { duration: 2000 },
|
|
7
4
|
persistent: { duration: 0, dismissible: true },
|
|
8
5
|
important: {
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useToast = exports.ToastPlugin = void 0;
|
|
4
1
|
// useToast.ts
|
|
5
|
-
|
|
2
|
+
import { ref, computed, nextTick, inject } from "vue";
|
|
6
3
|
const TOAST_INJECTION_KEY = Symbol("toast");
|
|
7
4
|
class ToastManager {
|
|
8
5
|
constructor() {
|
|
9
|
-
this.toasts =
|
|
6
|
+
this.toasts = ref([]);
|
|
10
7
|
this.toastIdCounter = 0;
|
|
11
|
-
this.currentToastStyle =
|
|
8
|
+
this.currentToastStyle = ref("bar");
|
|
12
9
|
// Expose reactive toasts
|
|
13
|
-
this.toastList =
|
|
10
|
+
this.toastList = computed(() => this.toasts.value);
|
|
14
11
|
// Expose reactive toast style
|
|
15
|
-
this.toastStyle =
|
|
12
|
+
this.toastStyle = computed(() => this.currentToastStyle.value);
|
|
16
13
|
// Convenience methods
|
|
17
14
|
this.showSuccess = (title, description, options) => this.addToast({ title, description, toastType: "success", ...options });
|
|
18
15
|
this.showError = (title, description, options) => this.addToast({ title, description, toastType: "error", ...options });
|
|
@@ -38,7 +35,7 @@ class ToastManager {
|
|
|
38
35
|
};
|
|
39
36
|
this.toasts.value.push(toast);
|
|
40
37
|
// Trigger show animation on next tick
|
|
41
|
-
await
|
|
38
|
+
await nextTick();
|
|
42
39
|
const toastInstance = this.toasts.value.find((t) => t.id === id);
|
|
43
40
|
if (toastInstance) {
|
|
44
41
|
toastInstance.show = true;
|
|
@@ -61,7 +58,7 @@ class ToastManager {
|
|
|
61
58
|
// Singleton instance
|
|
62
59
|
let toastManager = null;
|
|
63
60
|
// Plugin for Vue app installation
|
|
64
|
-
|
|
61
|
+
export const ToastPlugin = {
|
|
65
62
|
install(app) {
|
|
66
63
|
if (!toastManager) {
|
|
67
64
|
toastManager = new ToastManager();
|
|
@@ -70,9 +67,9 @@ exports.ToastPlugin = {
|
|
|
70
67
|
},
|
|
71
68
|
};
|
|
72
69
|
// Composable for components
|
|
73
|
-
const useToast = () => {
|
|
70
|
+
export const useToast = () => {
|
|
74
71
|
// Try to inject first (if using plugin)
|
|
75
|
-
const injected =
|
|
72
|
+
const injected = inject(TOAST_INJECTION_KEY, null);
|
|
76
73
|
// Fall back to singleton if not using plugin
|
|
77
74
|
if (!toastManager && !injected) {
|
|
78
75
|
toastManager = new ToastManager();
|
|
@@ -91,4 +88,3 @@ const useToast = () => {
|
|
|
91
88
|
showInfo: manager.showInfo.bind(manager),
|
|
92
89
|
};
|
|
93
90
|
};
|
|
94
|
-
exports.useToast = useToast;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.vTooltip = void 0;
|
|
4
|
-
const useTooltip_1 = require("./useTooltip");
|
|
5
|
-
exports.vTooltip = {
|
|
1
|
+
import { useTooltip } from "./useTooltip";
|
|
2
|
+
export const vTooltip = {
|
|
6
3
|
mounted(el, binding) {
|
|
7
4
|
const config = typeof binding.value === "string"
|
|
8
5
|
? { content: binding.value }
|
|
9
6
|
: binding.value;
|
|
10
7
|
if (config && config.content) {
|
|
11
|
-
const { bindTooltip } =
|
|
8
|
+
const { bindTooltip } = useTooltip(config);
|
|
12
9
|
el._tooltipCleanup = bindTooltip(el);
|
|
13
10
|
}
|
|
14
11
|
},
|
|
@@ -23,7 +20,7 @@ exports.vTooltip = {
|
|
|
23
20
|
? { content: binding.value }
|
|
24
21
|
: binding.value;
|
|
25
22
|
if (config && config.content) {
|
|
26
|
-
const { bindTooltip } =
|
|
23
|
+
const { bindTooltip } = useTooltip(config);
|
|
27
24
|
el._tooltipCleanup = bindTooltip(el);
|
|
28
25
|
}
|
|
29
26
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.useTooltip = exports.useTooltipProvider = void 0;
|
|
4
|
-
const vue_1 = require("vue");
|
|
5
|
-
const tooltipState = (0, vue_1.reactive)({
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
const tooltipState = reactive({
|
|
6
3
|
isVisible: false,
|
|
7
4
|
content: "",
|
|
8
5
|
targetElement: null,
|
|
9
6
|
placement: "top",
|
|
10
7
|
offset: 2,
|
|
11
8
|
});
|
|
12
|
-
const useTooltipProvider = () => {
|
|
9
|
+
export const useTooltipProvider = () => {
|
|
13
10
|
const showTooltip = async (element, config) => {
|
|
14
11
|
tooltipState.content = config.content;
|
|
15
12
|
tooltipState.placement = config.placement || "top";
|
|
@@ -28,9 +25,8 @@ const useTooltipProvider = () => {
|
|
|
28
25
|
hideTooltip,
|
|
29
26
|
};
|
|
30
27
|
};
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const { showTooltip, hideTooltip } = (0, exports.useTooltipProvider)();
|
|
28
|
+
export const useTooltip = (config) => {
|
|
29
|
+
const { showTooltip, hideTooltip } = useTooltipProvider();
|
|
34
30
|
const bindTooltip = (element) => {
|
|
35
31
|
// Handle Vue component instances
|
|
36
32
|
let actualElement = element;
|
|
@@ -59,4 +55,3 @@ const useTooltip = (config) => {
|
|
|
59
55
|
hideTooltip,
|
|
60
56
|
};
|
|
61
57
|
};
|
|
62
|
-
exports.useTooltip = useTooltip;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCustomColor = exports.getTagBarStyle = void 0;
|
|
4
|
-
require("./theme.css");
|
|
1
|
+
import "./theme.css";
|
|
5
2
|
// Base style templates for tag bar types
|
|
6
3
|
const baseStyles = {
|
|
7
4
|
default: {
|
|
@@ -231,7 +228,6 @@ const isCustomColor = (barStyle) => {
|
|
|
231
228
|
const predefinedStyles = ["primary", "secondary", "tertiary", "quaternary"];
|
|
232
229
|
return !predefinedStyles.includes(barStyle);
|
|
233
230
|
};
|
|
234
|
-
exports.isCustomColor = isCustomColor;
|
|
235
231
|
// Generate style for custom colors
|
|
236
232
|
const generateCustomColorStyle = (barType, customColor) => {
|
|
237
233
|
const baseStyle = baseStyles[barType] || baseStyles.default;
|
|
@@ -313,4 +309,5 @@ const getTagBarStyle = (type = "default", style = "primary") => {
|
|
|
313
309
|
};
|
|
314
310
|
}
|
|
315
311
|
};
|
|
316
|
-
|
|
312
|
+
// Export for use in your component
|
|
313
|
+
export { getTagBarStyle, isCustomColor };
|
|
@@ -1,48 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.TagTheme = exports.TAG_STYLE_PRESETS = exports.COLOR_PRESETS = exports.createStyledTag = exports.generateTagStyle = exports.getColorMode = void 0;
|
|
40
|
-
const tinycolor2_1 = __importDefault(require("tinycolor2"));
|
|
41
|
-
const colors = __importStar(require("@umbra.ui/colors"));
|
|
42
|
-
const theme_1 = require("../../../theme");
|
|
1
|
+
import tinycolor from "tinycolor2";
|
|
2
|
+
import * as colors from "@umbra.ui/colors";
|
|
3
|
+
import { getThemeConfig } from "../../../theme";
|
|
43
4
|
// Color mode detection function that uses theme or falls back to system
|
|
44
|
-
const getColorMode = () => {
|
|
45
|
-
const config =
|
|
5
|
+
export const getColorMode = () => {
|
|
6
|
+
const config = getThemeConfig();
|
|
46
7
|
// If a theme is provided, use its color mode
|
|
47
8
|
if (config?.customThemeColorMode) {
|
|
48
9
|
return config.customThemeColorMode;
|
|
@@ -52,7 +13,6 @@ const getColorMode = () => {
|
|
|
52
13
|
? "dark"
|
|
53
14
|
: "light";
|
|
54
15
|
};
|
|
55
|
-
exports.getColorMode = getColorMode;
|
|
56
16
|
// Size presets
|
|
57
17
|
const SIZE_PRESETS = {
|
|
58
18
|
sm: { padding: "0.125rem 0.375rem", fontSize: "0.75rem" },
|
|
@@ -61,7 +21,7 @@ const SIZE_PRESETS = {
|
|
|
61
21
|
};
|
|
62
22
|
// Helper to get Radix colors based on color mode
|
|
63
23
|
const getRadixColor = (colorName, step, alpha = false) => {
|
|
64
|
-
const isDark =
|
|
24
|
+
const isDark = getColorMode() === "dark";
|
|
65
25
|
const colorKey = isDark ? `${colorName}Dark` : colorName;
|
|
66
26
|
const alphaKey = alpha ? "A" : "";
|
|
67
27
|
const colorScale = colors[`${colorKey}${alphaKey}`];
|
|
@@ -144,8 +104,8 @@ const generateDefaultStyleFromColor = (colorScheme) => {
|
|
|
144
104
|
}
|
|
145
105
|
else {
|
|
146
106
|
// Use custom hex color
|
|
147
|
-
const baseColor = (
|
|
148
|
-
const isDark =
|
|
107
|
+
const baseColor = tinycolor(colorScheme);
|
|
108
|
+
const isDark = getColorMode() === "dark";
|
|
149
109
|
return {
|
|
150
110
|
container: {
|
|
151
111
|
backgroundColor: isDark
|
|
@@ -168,7 +128,7 @@ const generateDefaultStyleFromColor = (colorScheme) => {
|
|
|
168
128
|
}
|
|
169
129
|
};
|
|
170
130
|
// Main style generation function - much simpler!
|
|
171
|
-
const generateTagStyle = (config = {}) => {
|
|
131
|
+
export const generateTagStyle = (config = {}) => {
|
|
172
132
|
let baseStyle = { ...DEFAULT_STYLE };
|
|
173
133
|
// If a color scheme is provided, generate default colors from it
|
|
174
134
|
if (config.colorScheme) {
|
|
@@ -202,16 +162,14 @@ const generateTagStyle = (config = {}) => {
|
|
|
202
162
|
};
|
|
203
163
|
return style;
|
|
204
164
|
};
|
|
205
|
-
exports.generateTagStyle = generateTagStyle;
|
|
206
165
|
// Helper to create tag with style
|
|
207
|
-
const createStyledTag = (id, title, styleConfig) => ({
|
|
166
|
+
export const createStyledTag = (id, title, styleConfig) => ({
|
|
208
167
|
id,
|
|
209
168
|
title,
|
|
210
169
|
style: styleConfig,
|
|
211
170
|
});
|
|
212
|
-
exports.createStyledTag = createStyledTag;
|
|
213
171
|
// Preset color schemes using Radix colors
|
|
214
|
-
|
|
172
|
+
export const COLOR_PRESETS = {
|
|
215
173
|
primary: "blue",
|
|
216
174
|
success: "green",
|
|
217
175
|
warning: "amber",
|
|
@@ -220,7 +178,7 @@ exports.COLOR_PRESETS = {
|
|
|
220
178
|
neutral: "gray",
|
|
221
179
|
};
|
|
222
180
|
// Example preset styles that developers can use or override
|
|
223
|
-
|
|
181
|
+
export const TAG_STYLE_PRESETS = {
|
|
224
182
|
default: {
|
|
225
183
|
borderRadius: "999px",
|
|
226
184
|
padding: "0.235rem 0.588rem",
|
|
@@ -244,16 +202,15 @@ exports.TAG_STYLE_PRESETS = {
|
|
|
244
202
|
},
|
|
245
203
|
};
|
|
246
204
|
// Utility class for managing tag themes (simplified)
|
|
247
|
-
class TagTheme {
|
|
205
|
+
export class TagTheme {
|
|
248
206
|
constructor(defaultStyle = {}) {
|
|
249
207
|
this.defaultStyle = defaultStyle;
|
|
250
208
|
}
|
|
251
209
|
generateStyle(overrides) {
|
|
252
|
-
return
|
|
210
|
+
return generateTagStyle({ ...this.defaultStyle, ...overrides });
|
|
253
211
|
}
|
|
254
212
|
// Create a tag with the theme's default style
|
|
255
213
|
createTag(id, title, overrides) {
|
|
256
|
-
return
|
|
214
|
+
return createStyledTag(id, title, { ...this.defaultStyle, ...overrides });
|
|
257
215
|
}
|
|
258
216
|
}
|
|
259
|
-
exports.TagTheme = TagTheme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAdaptiveLayoutState = void 0;
|
|
4
|
-
const vue_1 = require("vue");
|
|
1
|
+
import { ref, computed, reactive, shallowRef, } from "vue";
|
|
5
2
|
const layoutStates = new Map();
|
|
6
|
-
const useAdaptiveLayoutState = (key = Symbol()) => {
|
|
3
|
+
export const useAdaptiveLayoutState = (key = Symbol()) => {
|
|
7
4
|
if (!layoutStates.has(key)) {
|
|
8
|
-
const views =
|
|
9
|
-
const initialized =
|
|
10
|
-
const monitor =
|
|
11
|
-
const offScreenViewsLeading =
|
|
12
|
-
const offScreenViewsTrailing =
|
|
13
|
-
const onScreenViews =
|
|
14
|
-
const overlayViews =
|
|
15
|
-
const methods =
|
|
5
|
+
const views = ref([]);
|
|
6
|
+
const initialized = ref(false);
|
|
7
|
+
const monitor = shallowRef(null);
|
|
8
|
+
const offScreenViewsLeading = computed(() => views.value.filter((view) => view.location === "leading"));
|
|
9
|
+
const offScreenViewsTrailing = computed(() => views.value.filter((view) => view.location === "trailing"));
|
|
10
|
+
const onScreenViews = computed(() => views.value.filter((view) => view.location === "onscreen"));
|
|
11
|
+
const overlayViews = computed(() => views.value.filter((view) => view.location === "overlay"));
|
|
12
|
+
const methods = reactive({
|
|
16
13
|
add: () => console.warn("Layout not initialized"),
|
|
17
14
|
remove: () => console.warn("Layout not initialized"),
|
|
18
15
|
replace: () => console.warn("Layout not initialized"),
|
|
@@ -41,4 +38,3 @@ const useAdaptiveLayoutState = (key = Symbol()) => {
|
|
|
41
38
|
}
|
|
42
39
|
return layoutStates.get(key);
|
|
43
40
|
};
|
|
44
|
-
exports.useAdaptiveLayoutState = useAdaptiveLayoutState;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useBreakpoints = void 0;
|
|
4
|
-
const useBreakpoints = (views) => {
|
|
1
|
+
export const useBreakpoints = (views) => {
|
|
5
2
|
const setupForBreakpoint = (oldBreakpoint, currentBreakpoint) => {
|
|
6
3
|
switch (currentBreakpoint) {
|
|
7
4
|
case "mobile":
|
|
@@ -38,4 +35,3 @@ const useBreakpoints = (views) => {
|
|
|
38
35
|
setupForBreakpoint,
|
|
39
36
|
};
|
|
40
37
|
};
|
|
41
|
-
exports.useBreakpoints = useBreakpoints;
|
package/dist/components/navigation/adaptive/{useContainerMonitor.js → useContainerMonitor.mjs}
RENAMED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.breakpoints = exports.useResponsiveContainer = exports.useContainerMonitor = exports.DEFAULT_BREAKPOINTS = void 0;
|
|
4
|
-
const vue_1 = require("vue");
|
|
1
|
+
import { ref, computed, onMounted, onUnmounted } from "vue";
|
|
5
2
|
// Default breakpoint configuration
|
|
6
|
-
|
|
3
|
+
export const DEFAULT_BREAKPOINTS = {
|
|
7
4
|
mobile: { min: 0, max: 639 },
|
|
8
5
|
tablet: { min: 640, max: 1023 },
|
|
9
6
|
desktop: { min: 1024, max: Infinity },
|
|
10
7
|
};
|
|
11
|
-
exports.breakpoints = exports.DEFAULT_BREAKPOINTS;
|
|
12
8
|
// Utility function to find the current breakpoint
|
|
13
9
|
const findCurrentBreakpoint = (width, breakpoints) => {
|
|
14
10
|
for (const [name, range] of Object.entries(breakpoints)) {
|
|
@@ -19,15 +15,15 @@ const findCurrentBreakpoint = (width, breakpoints) => {
|
|
|
19
15
|
return null;
|
|
20
16
|
};
|
|
21
17
|
// Main composable
|
|
22
|
-
const useContainerMonitor = (elementRef, options = {}) => {
|
|
23
|
-
const { breakpoints =
|
|
18
|
+
export const useContainerMonitor = (elementRef, options = {}) => {
|
|
19
|
+
const { breakpoints = DEFAULT_BREAKPOINTS, debounceMs = 16, // ~60fps
|
|
24
20
|
} = options;
|
|
25
21
|
// Reactive state
|
|
26
|
-
const dimensions =
|
|
27
|
-
const currentBreakpoint =
|
|
28
|
-
const previousBreakpoint =
|
|
22
|
+
const dimensions = ref({ width: 0, height: 0 });
|
|
23
|
+
const currentBreakpoint = ref(null);
|
|
24
|
+
const previousBreakpoint = ref(null);
|
|
29
25
|
// Computed properties for easy breakpoint checking
|
|
30
|
-
const breakpointQueries =
|
|
26
|
+
const breakpointQueries = computed(() => {
|
|
31
27
|
const queries = {};
|
|
32
28
|
Object.keys(breakpoints).forEach((name) => {
|
|
33
29
|
queries[`is${name.charAt(0).toUpperCase() + name.slice(1)}`] =
|
|
@@ -109,10 +105,10 @@ const useContainerMonitor = (elementRef, options = {}) => {
|
|
|
109
105
|
}
|
|
110
106
|
};
|
|
111
107
|
// Lifecycle hooks
|
|
112
|
-
|
|
108
|
+
onMounted(() => {
|
|
113
109
|
startObserver();
|
|
114
110
|
});
|
|
115
|
-
|
|
111
|
+
onUnmounted(() => {
|
|
116
112
|
stopObserver();
|
|
117
113
|
});
|
|
118
114
|
// Watch for element ref changes
|
|
@@ -138,12 +134,12 @@ const useContainerMonitor = (elementRef, options = {}) => {
|
|
|
138
134
|
breakpoints,
|
|
139
135
|
};
|
|
140
136
|
};
|
|
141
|
-
exports.useContainerMonitor = useContainerMonitor;
|
|
142
137
|
// Convenience composable for common use cases
|
|
143
|
-
const useResponsiveContainer = (elementRef, customBreakpoints) => {
|
|
138
|
+
export const useResponsiveContainer = (elementRef, customBreakpoints) => {
|
|
144
139
|
const breakpoints = customBreakpoints
|
|
145
|
-
? { ...
|
|
146
|
-
:
|
|
147
|
-
return
|
|
140
|
+
? { ...DEFAULT_BREAKPOINTS, ...customBreakpoints }
|
|
141
|
+
: DEFAULT_BREAKPOINTS;
|
|
142
|
+
return useContainerMonitor(elementRef, { breakpoints });
|
|
148
143
|
};
|
|
149
|
-
|
|
144
|
+
// Export default breakpoints for convenience
|
|
145
|
+
export { DEFAULT_BREAKPOINTS as breakpoints };
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.useViewAnimation = void 0;
|
|
7
|
-
const vue_1 = require("vue");
|
|
8
|
-
const Flip_1 = require("gsap/Flip");
|
|
9
|
-
const gsap_1 = __importDefault(require("gsap"));
|
|
10
|
-
gsap_1.default.registerPlugin(Flip_1.Flip);
|
|
11
|
-
const animationInProgress = (0, vue_1.ref)(false);
|
|
1
|
+
import { nextTick, ref } from "vue";
|
|
2
|
+
import { Flip } from "gsap/Flip";
|
|
3
|
+
import gsap from "gsap";
|
|
4
|
+
gsap.registerPlugin(Flip);
|
|
5
|
+
const animationInProgress = ref(false);
|
|
12
6
|
/*
|
|
13
7
|
# FLIP Order of Operations
|
|
14
8
|
Step 1: Get State
|
|
@@ -16,7 +10,7 @@ Step 3: Manipulate DOM
|
|
|
16
10
|
Step 4: Animate
|
|
17
11
|
Step 5: Update Data (vue reactive state)
|
|
18
12
|
*/
|
|
19
|
-
const useViewAnimation = (views, instanceKey, containerDimensions, padding, gap) => {
|
|
13
|
+
export const useViewAnimation = (views, instanceKey, containerDimensions, padding, gap) => {
|
|
20
14
|
/*
|
|
21
15
|
* Basic animation function
|
|
22
16
|
*/
|
|
@@ -27,11 +21,11 @@ const useViewAnimation = (views, instanceKey, containerDimensions, padding, gap)
|
|
|
27
21
|
}
|
|
28
22
|
animationInProgress.value = true;
|
|
29
23
|
// Step 1: Get State
|
|
30
|
-
const state =
|
|
24
|
+
const state = Flip.getState(targets);
|
|
31
25
|
// Step 2: Manipulate DOM
|
|
32
26
|
manipulateDOMFn();
|
|
33
27
|
// Step 3: Animate
|
|
34
|
-
return
|
|
28
|
+
return Flip.from(state, {
|
|
35
29
|
duration: 0.3,
|
|
36
30
|
ease: "power1.inOut",
|
|
37
31
|
absolute: true,
|
|
@@ -367,7 +361,7 @@ const useViewAnimation = (views, instanceKey, containerDimensions, padding, gap)
|
|
|
367
361
|
view.location = "overlay";
|
|
368
362
|
}
|
|
369
363
|
}
|
|
370
|
-
await
|
|
364
|
+
await nextTick();
|
|
371
365
|
const overlay = document.getElementById(getOverlayId());
|
|
372
366
|
if (!overlay)
|
|
373
367
|
return;
|
|
@@ -568,7 +562,7 @@ const useViewAnimation = (views, instanceKey, containerDimensions, padding, gap)
|
|
|
568
562
|
/*
|
|
569
563
|
State
|
|
570
564
|
*/
|
|
571
|
-
const isOverlayOpen =
|
|
565
|
+
const isOverlayOpen = ref(false);
|
|
572
566
|
return {
|
|
573
567
|
splitViewShow,
|
|
574
568
|
splitViewHide,
|
|
@@ -595,4 +589,3 @@ const useViewAnimation = (views, instanceKey, containerDimensions, padding, gap)
|
|
|
595
589
|
getSingleViewAfter,
|
|
596
590
|
};
|
|
597
591
|
};
|
|
598
|
-
exports.useViewAnimation = useViewAnimation;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useViewResize = void 0;
|
|
4
1
|
// useViewResize.ts
|
|
5
|
-
|
|
6
|
-
const useViewResize = (onScreenViews, config, props, getViewId, // Changed from (index: number) => string
|
|
2
|
+
import { ref, watch, onUnmounted } from "vue";
|
|
3
|
+
export const useViewResize = (onScreenViews, config, props, getViewId, // Changed from (index: number) => string
|
|
7
4
|
getOnscreenId) => {
|
|
8
|
-
const resizing =
|
|
9
|
-
const resizeTooltip =
|
|
5
|
+
const resizing = ref(null);
|
|
6
|
+
const resizeTooltip = ref({
|
|
10
7
|
visible: false,
|
|
11
8
|
x: 0,
|
|
12
9
|
y: 0,
|
|
@@ -122,7 +119,7 @@ getOnscreenId) => {
|
|
|
122
119
|
resizeTooltip.value.visible = false;
|
|
123
120
|
};
|
|
124
121
|
// Set up event listeners when resizing starts/ends
|
|
125
|
-
|
|
122
|
+
watch(resizing, (newVal) => {
|
|
126
123
|
if (newVal) {
|
|
127
124
|
document.addEventListener("mousemove", handleMouseResize);
|
|
128
125
|
document.addEventListener("mouseup", endResize);
|
|
@@ -137,7 +134,7 @@ getOnscreenId) => {
|
|
|
137
134
|
document.removeEventListener("mousemove", handleMouseResize);
|
|
138
135
|
document.removeEventListener("mouseup", endResize);
|
|
139
136
|
};
|
|
140
|
-
|
|
137
|
+
onUnmounted(() => {
|
|
141
138
|
cleanup();
|
|
142
139
|
});
|
|
143
140
|
return {
|
|
@@ -147,4 +144,3 @@ getOnscreenId) => {
|
|
|
147
144
|
updateViewWidth,
|
|
148
145
|
};
|
|
149
146
|
};
|
|
150
|
-
exports.useViewResize = useViewResize;
|
package/dist/components/navigation/navstack/{useNavigationStack.js → useNavigationStack.mjs}
RENAMED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const panes = (0, vue_1.ref)(initialPanes);
|
|
10
|
-
const currentIndex = (0, vue_1.ref)(0);
|
|
11
|
-
const visiblePanes = (0, vue_1.computed)(() => panes.value.map((_, index) => index === currentIndex.value));
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
import { gsap } from "gsap";
|
|
3
|
+
import { Flip } from "gsap/Flip";
|
|
4
|
+
gsap.registerPlugin(Flip);
|
|
5
|
+
export function useNavigationStack(initialPanes, taskKey) {
|
|
6
|
+
const panes = ref(initialPanes);
|
|
7
|
+
const currentIndex = ref(0);
|
|
8
|
+
const visiblePanes = computed(() => panes.value.map((_, index) => index === currentIndex.value));
|
|
12
9
|
const navigate = (index, animated = true) => {
|
|
13
10
|
// Ensure index is within bounds
|
|
14
11
|
if (index < 0 || index >= panes.value.length) {
|
|
@@ -43,7 +40,7 @@ function useNavigationStack(initialPanes, taskKey) {
|
|
|
43
40
|
if (!animated) {
|
|
44
41
|
states = [];
|
|
45
42
|
}
|
|
46
|
-
const state =
|
|
43
|
+
const state = Flip.getState(states);
|
|
47
44
|
// Reorganize panes
|
|
48
45
|
for (let i = 0; i < panes.value.length; i++) {
|
|
49
46
|
const pane = document.getElementById(`${taskKey}-pane-${i}`);
|
|
@@ -63,7 +60,7 @@ function useNavigationStack(initialPanes, taskKey) {
|
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
currentIndex.value = index;
|
|
66
|
-
|
|
63
|
+
Flip.from(state, {
|
|
67
64
|
duration: 0.3,
|
|
68
65
|
ease: "power1.inOut",
|
|
69
66
|
absolute: true,
|