vlite3 1.4.8 → 1.4.9
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/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/ScaleGenerator/ScaleGenerator.vue.d.ts +44 -0
- package/components/ScaleGenerator/ScaleGenerator.vue.js +110 -0
- package/components/ScaleGenerator/ScaleGenerator.vue2.js +4 -0
- package/components/ScaleGenerator/index.d.ts +2 -0
- package/components/ScaleGenerator/types.d.ts +63 -0
- package/components/ThemeProvider/ThemeProvider.vue.d.ts +27 -0
- package/components/ThemeProvider/ThemeProvider.vue.js +37 -0
- package/components/ThemeProvider/ThemeProvider.vue2.js +4 -0
- package/components/ThemeProvider/index.d.ts +3 -0
- package/components/ThemeProvider/themeVars.d.ts +16 -0
- package/components/ThemeProvider/themeVars.js +372 -0
- package/components/ThemeProvider/types.d.ts +46 -0
- package/composables/useThemeStyles.d.ts +8 -0
- package/composables/useThemeStyles.js +9 -0
- package/index.d.ts +3 -0
- package/index.js +387 -373
- package/package.json +1 -1
- package/utils/colorUtils.d.ts +41 -0
- package/utils/colorUtils.js +36 -0
- package/utils/index.d.ts +1 -0
|
@@ -4,7 +4,7 @@ import k from "../Icon.vue.js";
|
|
|
4
4
|
import { $t as E } from "../../utils/i18n.js";
|
|
5
5
|
import { useCommandPaletteItems as Y } from "./useCommandPaletteItems.js";
|
|
6
6
|
import { useCommandPaletteNav as Z } from "./useCommandPaletteNav.js";
|
|
7
|
-
import ee from "./CommandPaletteItem.
|
|
7
|
+
import ee from "./CommandPaletteItem.vue2.js";
|
|
8
8
|
const te = { class: "command-palette-content flex flex-col w-full h-full max-h-[70vh]" }, oe = { class: "flex items-center gap-3 px-4 py-3 border-b border-border/80 shrink-0" }, se = ["placeholder"], ne = ["aria-label"], re = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "flex flex-col items-center justify-center py-14 px-6 text-center select-none",
|
|
@@ -3,7 +3,7 @@ import L from "./Icon.vue.js";
|
|
|
3
3
|
import v from "./Modal.vue.js";
|
|
4
4
|
import N from "./CommandPalette/CommandPaletteContent.vue.js";
|
|
5
5
|
import { $t as U } from "../utils/i18n.js";
|
|
6
|
-
/* empty css
|
|
6
|
+
/* empty css */
|
|
7
7
|
const V = { class: "block truncate -text-fs-1.5" }, S = { class: "ml-auto inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-mono font-medium border border-border/80 bg-background text-muted-foreground ml-1" }, A = /* @__PURE__ */ x({
|
|
8
8
|
__name: "NavbarCommandPalette",
|
|
9
9
|
props: {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ScaleGeneratorProps, ScaleHorizontalAlign } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {
|
|
6
|
+
scale: number;
|
|
7
|
+
containerWidth: number;
|
|
8
|
+
targetWidth: number;
|
|
9
|
+
}): any;
|
|
10
|
+
};
|
|
11
|
+
refs: {
|
|
12
|
+
frameRef: HTMLDivElement;
|
|
13
|
+
contentRef: HTMLDivElement;
|
|
14
|
+
};
|
|
15
|
+
rootEl: HTMLDivElement;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
+
declare const __VLS_component: import('vue').DefineComponent<ScaleGeneratorProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
19
|
+
"update:scale": (value: number) => any;
|
|
20
|
+
"update:containerWidth": (value: number) => any;
|
|
21
|
+
}, string, import('vue').PublicProps, Readonly<ScaleGeneratorProps> & Readonly<{
|
|
22
|
+
"onUpdate:scale"?: (value: number) => any;
|
|
23
|
+
"onUpdate:containerWidth"?: (value: number) => any;
|
|
24
|
+
}>, {
|
|
25
|
+
maxWidth: number;
|
|
26
|
+
contentClass: string;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
targetWidth: number;
|
|
29
|
+
minScale: number;
|
|
30
|
+
maxScale: number;
|
|
31
|
+
scale: number | null;
|
|
32
|
+
isEditMode: boolean;
|
|
33
|
+
horizontalAlign: ScaleHorizontalAlign;
|
|
34
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
35
|
+
frameRef: HTMLDivElement;
|
|
36
|
+
contentRef: HTMLDivElement;
|
|
37
|
+
}, HTMLDivElement>;
|
|
38
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { defineComponent as w, ref as n, computed as l, onMounted as O, onBeforeUnmount as M, watch as B, openBlock as E, createElementBlock as k, normalizeStyle as S, createElementVNode as C, normalizeClass as L, renderSlot as _, nextTick as $ } from "vue";
|
|
2
|
+
const A = /* @__PURE__ */ w({
|
|
3
|
+
__name: "ScaleGenerator",
|
|
4
|
+
props: {
|
|
5
|
+
enabled: { type: Boolean, default: void 0 },
|
|
6
|
+
targetWidth: { default: void 0 },
|
|
7
|
+
maxWidth: { default: void 0 },
|
|
8
|
+
minScale: { default: 0.25 },
|
|
9
|
+
maxScale: { default: 1 },
|
|
10
|
+
scale: { default: null },
|
|
11
|
+
isEditMode: { type: Boolean, default: !1 },
|
|
12
|
+
horizontalAlign: { default: "center" },
|
|
13
|
+
contentClass: { default: "" }
|
|
14
|
+
},
|
|
15
|
+
emits: ["update:scale", "update:containerWidth"],
|
|
16
|
+
setup(v, { emit: b }) {
|
|
17
|
+
const e = v, c = b, o = n(null), r = n(null), a = n(1), m = n(0), h = n(0);
|
|
18
|
+
let u = null, d = null;
|
|
19
|
+
const f = l(() => e.enabled ?? !!e.isEditMode), i = l(
|
|
20
|
+
() => Math.max(1, e.targetWidth ?? e.maxWidth ?? 1440)
|
|
21
|
+
), g = (t) => Math.min(e.maxScale, Math.max(e.minScale, t)), p = () => {
|
|
22
|
+
h.value = r.value?.scrollHeight ?? 0;
|
|
23
|
+
}, y = () => {
|
|
24
|
+
const t = o.value?.clientWidth ?? i.value;
|
|
25
|
+
if (m.value = t, c("update:containerWidth", t), !f.value) {
|
|
26
|
+
a.value = 1, p(), c("update:scale", 1);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const W = typeof e.scale == "number" ? g(e.scale) : g(t / i.value);
|
|
30
|
+
a.value = Number(W.toFixed(4)), p(), c("update:scale", a.value);
|
|
31
|
+
}, s = async () => {
|
|
32
|
+
await $(), y();
|
|
33
|
+
};
|
|
34
|
+
O(() => {
|
|
35
|
+
s(), !(typeof ResizeObserver > "u") && (u = new ResizeObserver(() => {
|
|
36
|
+
s();
|
|
37
|
+
}), d = new ResizeObserver(() => {
|
|
38
|
+
s();
|
|
39
|
+
}), o.value && u.observe(o.value), r.value && d.observe(r.value));
|
|
40
|
+
}), M(() => {
|
|
41
|
+
u?.disconnect(), d?.disconnect();
|
|
42
|
+
}), B(
|
|
43
|
+
() => [
|
|
44
|
+
e.enabled,
|
|
45
|
+
e.isEditMode,
|
|
46
|
+
e.targetWidth,
|
|
47
|
+
e.maxWidth,
|
|
48
|
+
e.minScale,
|
|
49
|
+
e.maxScale,
|
|
50
|
+
e.scale,
|
|
51
|
+
e.horizontalAlign
|
|
52
|
+
],
|
|
53
|
+
() => {
|
|
54
|
+
s();
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
const x = l(() => {
|
|
58
|
+
const t = e.horizontalAlign ?? "center";
|
|
59
|
+
return t === "left" ? {
|
|
60
|
+
marginLeft: "0",
|
|
61
|
+
marginRight: "auto",
|
|
62
|
+
transformOrigin: "top left"
|
|
63
|
+
} : t === "right" ? {
|
|
64
|
+
marginLeft: "auto",
|
|
65
|
+
marginRight: "0",
|
|
66
|
+
transformOrigin: "top right"
|
|
67
|
+
} : {
|
|
68
|
+
marginLeft: "auto",
|
|
69
|
+
marginRight: "auto",
|
|
70
|
+
transformOrigin: "top center"
|
|
71
|
+
};
|
|
72
|
+
}), R = l(() => {
|
|
73
|
+
if (!f.value) return;
|
|
74
|
+
const t = h.value * a.value;
|
|
75
|
+
return {
|
|
76
|
+
height: t > 0 ? `${t}px` : void 0
|
|
77
|
+
};
|
|
78
|
+
}), z = l(() => f.value ? {
|
|
79
|
+
width: `${i.value}px`,
|
|
80
|
+
transform: a.value !== 1 ? `scale(${a.value})` : "none",
|
|
81
|
+
...x.value
|
|
82
|
+
} : {
|
|
83
|
+
maxWidth: e.maxWidth ? `${e.maxWidth}px` : void 0,
|
|
84
|
+
width: "100%",
|
|
85
|
+
...x.value
|
|
86
|
+
});
|
|
87
|
+
return (t, W) => (E(), k("div", {
|
|
88
|
+
ref_key: "frameRef",
|
|
89
|
+
ref: o,
|
|
90
|
+
class: "vlite-scale-generator-frame relative w-full overflow-hidden",
|
|
91
|
+
style: S(R.value)
|
|
92
|
+
}, [
|
|
93
|
+
C("div", {
|
|
94
|
+
ref_key: "contentRef",
|
|
95
|
+
ref: r,
|
|
96
|
+
class: L(["vlite-scale-generator-content transition-transform duration-150 ease-out", v.contentClass]),
|
|
97
|
+
style: S(z.value)
|
|
98
|
+
}, [
|
|
99
|
+
_(t.$slots, "default", {
|
|
100
|
+
scale: a.value,
|
|
101
|
+
containerWidth: m.value,
|
|
102
|
+
targetWidth: i.value
|
|
103
|
+
})
|
|
104
|
+
], 6)
|
|
105
|
+
], 4));
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export {
|
|
109
|
+
A as default
|
|
110
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public type surface for {@link ScaleGenerator}.
|
|
3
|
+
*
|
|
4
|
+
* `ScaleGenerator` is a generic CSS-transform based scaler for embed-style
|
|
5
|
+
* previews. It is not tied to any particular domain — it scales whatever
|
|
6
|
+
* content lives inside its default slot to a configurable target width.
|
|
7
|
+
*
|
|
8
|
+
* It is used by the ERP editor's "store preview" pane to fit a full
|
|
9
|
+
* storefront (typically 1440px wide) into the available preview viewport,
|
|
10
|
+
* and by the live storefront to opt-in to a fixed display width.
|
|
11
|
+
*
|
|
12
|
+
* The component exposes its current scale, container width, and target
|
|
13
|
+
* width through its scoped slot so descendants can render their own
|
|
14
|
+
* rulers / overlays if they need to.
|
|
15
|
+
*/
|
|
16
|
+
export type ScaleHorizontalAlign = 'left' | 'center' | 'right';
|
|
17
|
+
export interface ScaleGeneratorProps {
|
|
18
|
+
/**
|
|
19
|
+
* Master switch. When `false` the content renders at its natural width
|
|
20
|
+
* (clamped to `maxWidth` if provided) without any transform. Defaults
|
|
21
|
+
* to `true` whenever `isEditMode` is also `true`.
|
|
22
|
+
*/
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The width (in `px`) the content was designed for. The component will
|
|
26
|
+
* scale content down to fit the available viewport. Defaults to
|
|
27
|
+
* `maxWidth ?? 1440`.
|
|
28
|
+
*/
|
|
29
|
+
targetWidth?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Hard cap on the content width when not scaling. Ignored when scaling
|
|
32
|
+
* is active (the content always renders at exactly `targetWidth` and is
|
|
33
|
+
* then scaled down).
|
|
34
|
+
*/
|
|
35
|
+
maxWidth?: number;
|
|
36
|
+
/** Lower bound for the computed scale. Defaults to `0.25`. */
|
|
37
|
+
minScale?: number;
|
|
38
|
+
/** Upper bound for the computed scale. Defaults to `1`. */
|
|
39
|
+
maxScale?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Manual override for the scale. When provided, the component does not
|
|
42
|
+
* derive a scale from the frame width — it uses this value (clamped to
|
|
43
|
+
* `[minScale, maxScale]`) verbatim. Useful for "zoom" controls.
|
|
44
|
+
*/
|
|
45
|
+
scale?: number | null;
|
|
46
|
+
/**
|
|
47
|
+
* When `true`, scaling is enabled by default. Mostly used by editor
|
|
48
|
+
* previews where you want the preview to always scale-to-fit.
|
|
49
|
+
*/
|
|
50
|
+
isEditMode?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Where to align the (possibly scaled) content horizontally inside
|
|
53
|
+
* the frame. Defaults to `'center'`.
|
|
54
|
+
*/
|
|
55
|
+
horizontalAlign?: ScaleHorizontalAlign;
|
|
56
|
+
/** Extra class for the inner content wrapper. */
|
|
57
|
+
contentClass?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ScaleGeneratorSlotScope {
|
|
60
|
+
scale: number;
|
|
61
|
+
containerWidth: number;
|
|
62
|
+
targetWidth: number;
|
|
63
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ThemeProviderProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
rootEl: HTMLDivElement;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<ThemeProviderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ThemeProviderProps> & Readonly<{}>, {
|
|
12
|
+
rootClass: string;
|
|
13
|
+
maxWidth: import('./types').ThemeMaxWidth;
|
|
14
|
+
borderRadius: number;
|
|
15
|
+
bgColor: string;
|
|
16
|
+
primaryColor: string;
|
|
17
|
+
footerBgColor: string;
|
|
18
|
+
baseFontSize: number;
|
|
19
|
+
headingScale: number;
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
21
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineComponent as s, computed as o, provide as n, openBlock as a, createElementBlock as m, normalizeStyle as u, normalizeClass as c, createBlock as f, resolveDynamicComponent as v, withCtx as p, createTextVNode as C, toDisplayString as b, renderSlot as S } from "vue";
|
|
2
|
+
import { buildThemeVariables as g, buildCardOverrideStyles as h } from "./themeVars.js";
|
|
3
|
+
import { THEME_STYLES_KEY as y } from "../../composables/useThemeStyles.js";
|
|
4
|
+
import { isDarkColor as k } from "../../utils/colorUtils.js";
|
|
5
|
+
const D = /* @__PURE__ */ s({
|
|
6
|
+
__name: "ThemeProvider",
|
|
7
|
+
props: {
|
|
8
|
+
bgColor: { default: void 0 },
|
|
9
|
+
primaryColor: { default: void 0 },
|
|
10
|
+
footerBgColor: { default: void 0 },
|
|
11
|
+
baseFontSize: { default: void 0 },
|
|
12
|
+
headingScale: { default: void 0 },
|
|
13
|
+
borderRadius: { default: void 0 },
|
|
14
|
+
maxWidth: { default: void 0 },
|
|
15
|
+
rootClass: { default: "vlite-theme-provider" }
|
|
16
|
+
},
|
|
17
|
+
setup(t) {
|
|
18
|
+
const e = t, r = o(() => e.bgColor ? k(e.bgColor) : !1), l = o(() => g(e)), d = o(
|
|
19
|
+
() => e.bgColor ? h(e.bgColor, r.value) : ""
|
|
20
|
+
);
|
|
21
|
+
return n(y, l), (i, T) => (a(), m("div", {
|
|
22
|
+
class: c([t.rootClass, "transition-colors duration-300", { dark: r.value }]),
|
|
23
|
+
style: u(l.value)
|
|
24
|
+
}, [
|
|
25
|
+
(a(), f(v("style"), null, {
|
|
26
|
+
default: p(() => [
|
|
27
|
+
C(b(d.value), 1)
|
|
28
|
+
]),
|
|
29
|
+
_: 1
|
|
30
|
+
})),
|
|
31
|
+
S(i.$slots, "default")
|
|
32
|
+
], 6));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
D as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ThemeProviderProps, ThemeStyles } from './types';
|
|
2
|
+
export declare const DEFAULT_BASE_FONT_SIZE = 16;
|
|
3
|
+
export declare const DEFAULT_HEADING_SCALE = 1.25;
|
|
4
|
+
export declare const DEFAULT_BORDER_RADIUS = 8;
|
|
5
|
+
export declare const DEFAULT_MAX_WIDTH = 1440;
|
|
6
|
+
/**
|
|
7
|
+
* Nested card overrides. Lives outside `buildThemeVariables` because the SFC
|
|
8
|
+
* has to inject it as a real `<style>` block (it targets descendant
|
|
9
|
+
* `.bg-card .bg-card` selectors which cannot be expressed as inline variables).
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildCardOverrideStyles(bg: string, isDark: boolean): string;
|
|
12
|
+
/**
|
|
13
|
+
* Compute the full theme-styles record from a {@link ThemeProviderProps}.
|
|
14
|
+
* Pure: no DOM, no Vue. Re-usable from tests and from server-side code.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildThemeVariables(props: ThemeProviderProps): ThemeStyles;
|