vlite3 1.4.7 → 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/AppShell/AppShellLayoutStorefront.vue.js +18 -18
- package/components/CategoryManager/CategoryManager.vue2.js +2 -2
- package/components/Dropdown/DropdownMenu.vue.js +1 -1
- package/components/Dropdown/DropdownMenu.vue2.js +0 -1
- package/components/Input.vue.js +33 -25
- package/components/RichTextEditor/RichTextEditor.vue.js +4 -4
- package/components/RichTextEditor/RichTextLinkPopover.vue3.js +2 -2
- package/components/RichTextEditor/RichTextToolbar.vue3.js +2 -2
- 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/Screen/ScreenFilter.vue.js +2 -2
- 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/components/Timeline/Timeline.vue.js +17 -17
- package/components/Timeline/TimelineItem.vue.js +13 -13
- 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/style.css +1 -1
- package/utils/colorUtils.d.ts +41 -0
- package/utils/colorUtils.js +36 -0
- package/utils/index.d.ts +1 -0
- /package/components/RichTextEditor/{RichTextLinkPopover.vue2.js → RichTextLinkPopover.vue.js} +0 -0
- /package/components/RichTextEditor/{RichTextToolbar.vue2.js → RichTextToolbar.vue.js} +0 -0
|
@@ -10,10 +10,10 @@ import { normalizeRoutePrefix as B } from "../CategoryMenu/utils.js";
|
|
|
10
10
|
const E = { class: "vlite-app-layout flex flex-col w-full h-full min-h-0 bg-body text-foreground overflow-hidden" }, L = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "shrink-0 w-full"
|
|
13
|
-
}, M = { class: "w-full mx-auto
|
|
13
|
+
}, M = { class: "w-full mx-auto px-3 sm:px-4 md:px-6 lg:px-8" }, O = ["aria-label"], A = {
|
|
14
14
|
key: 0,
|
|
15
15
|
class: "flex items-center justify-center min-w-0 flex-1 px-2"
|
|
16
|
-
}, U = { class: "w-full min-w-0
|
|
16
|
+
}, U = { class: "w-full min-w-0 mx-auto overflow-hidden" }, Y = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "shrink-0 w-full"
|
|
19
19
|
}, D = {
|
|
@@ -35,12 +35,12 @@ const E = { class: "vlite-app-layout flex flex-col w-full h-full min-h-0 bg-body
|
|
|
35
35
|
toggleSidebar: G,
|
|
36
36
|
pageTitle: J,
|
|
37
37
|
breadcrumbData: p,
|
|
38
|
-
breakpointClasses:
|
|
38
|
+
breakpointClasses: m,
|
|
39
39
|
nestedTabsItems: g,
|
|
40
40
|
activeNestedTab: c,
|
|
41
|
-
handleNestedTabClick:
|
|
42
|
-
mainScrollRef:
|
|
43
|
-
layoutMainRef:
|
|
41
|
+
handleNestedTabClick: $,
|
|
42
|
+
mainScrollRef: C,
|
|
43
|
+
layoutMainRef: x
|
|
44
44
|
} = k, S = v(() => [
|
|
45
45
|
"w-full shrink-0 bg-background transition-shadow duration-200",
|
|
46
46
|
{
|
|
@@ -54,7 +54,7 @@ const E = { class: "vlite-app-layout flex flex-col w-full h-full min-h-0 bg-body
|
|
|
54
54
|
s.floating ? "m-3 rounded-lg border border-border shadow-sm overflow-hidden" : "",
|
|
55
55
|
s.class
|
|
56
56
|
].filter(Boolean).join(" ")), h = v(() => B(s.categoryRoutePrefix));
|
|
57
|
-
return (o,
|
|
57
|
+
return (o, u) => (t(), i("div", E, [
|
|
58
58
|
o.$slots.announcement ? (t(), i("div", L, [
|
|
59
59
|
l(o.$slots, "announcement")
|
|
60
60
|
])) : d("", !0),
|
|
@@ -74,9 +74,9 @@ const E = { class: "vlite-app-layout flex flex-col w-full h-full min-h-0 bg-body
|
|
|
74
74
|
}, () => [
|
|
75
75
|
a("button", {
|
|
76
76
|
type: "button",
|
|
77
|
-
class: n(["inline-flex items-center justify-center w-9 h-9 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent", [e(
|
|
77
|
+
class: n(["inline-flex items-center justify-center w-9 h-9 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent", [e(m).mobileTrigger, e(s).mobileTriggerClass]]),
|
|
78
78
|
"aria-label": e(r) ? "Close menu" : "Open menu",
|
|
79
|
-
onClick:
|
|
79
|
+
onClick: u[0] || (u[0] = (b) => r.value = !e(r))
|
|
80
80
|
}, [
|
|
81
81
|
f(R, {
|
|
82
82
|
icon: e(r) ? "lucide:x" : "lucide:menu",
|
|
@@ -97,14 +97,14 @@ const E = { class: "vlite-app-layout flex flex-col w-full h-full min-h-0 bg-body
|
|
|
97
97
|
], 2),
|
|
98
98
|
o.$slots["mobile-bottom"] ? (t(), i("div", {
|
|
99
99
|
key: 0,
|
|
100
|
-
class: n(["pb-3 w-full", e(
|
|
100
|
+
class: n(["pb-3 w-full", e(m).mobileTrigger])
|
|
101
101
|
}, [
|
|
102
102
|
l(o.$slots, "mobile-bottom")
|
|
103
103
|
], 2)) : d("", !0)
|
|
104
104
|
]),
|
|
105
105
|
o.$slots.categories ? (t(), i("div", {
|
|
106
106
|
key: 0,
|
|
107
|
-
class: n(["w-full min-w-0 overflow-hidden border-t border-border bg-background", [e(
|
|
107
|
+
class: n(["w-full min-w-0 overflow-hidden border-t border-border bg-background", [e(m).desktopContent, e(s).menuClass]])
|
|
108
108
|
}, [
|
|
109
109
|
a("div", U, [
|
|
110
110
|
l(o.$slots, "categories", { categoryRoutePrefix: h.value })
|
|
@@ -114,14 +114,14 @@ const E = { class: "vlite-app-layout flex flex-col w-full h-full min-h-0 bg-body
|
|
|
114
114
|
o.$slots.main ? (t(), i("main", {
|
|
115
115
|
key: 1,
|
|
116
116
|
ref_key: "layoutMainRef",
|
|
117
|
-
ref:
|
|
117
|
+
ref: x,
|
|
118
118
|
class: "flex-1 overflow-hidden w-full relative flex flex-col min-h-0"
|
|
119
119
|
}, [
|
|
120
120
|
e(s).renderNestedTabs && e(g).length > 0 ? (t(), i("div", Y, [
|
|
121
121
|
f(V, {
|
|
122
122
|
modelValue: e(c),
|
|
123
|
-
"onUpdate:modelValue":
|
|
124
|
-
onChange: e(
|
|
123
|
+
"onUpdate:modelValue": u[1] || (u[1] = (b) => y(c) ? c.value = b : null),
|
|
124
|
+
onChange: e($),
|
|
125
125
|
items: e(g)
|
|
126
126
|
}, null, 8, ["modelValue", "onChange", "items"])
|
|
127
127
|
])) : d("", !0),
|
|
@@ -138,7 +138,7 @@ const E = { class: "vlite-app-layout flex flex-col w-full h-full min-h-0 bg-body
|
|
|
138
138
|
], 2)) : d("", !0),
|
|
139
139
|
a("div", {
|
|
140
140
|
ref_key: "mainScrollRef",
|
|
141
|
-
ref:
|
|
141
|
+
ref: C,
|
|
142
142
|
style: { "will-change": "transform", contain: "layout style" },
|
|
143
143
|
class: n(["flex-1 overflow-y-auto w-full relative h-full scrollbar-thin scrollbar-stable", e(s).contentClass])
|
|
144
144
|
}, [
|
|
@@ -150,11 +150,11 @@ const E = { class: "vlite-app-layout flex flex-col w-full h-full min-h-0 bg-body
|
|
|
150
150
|
])) : d("", !0),
|
|
151
151
|
f(P, {
|
|
152
152
|
show: e(r),
|
|
153
|
-
"onUpdate:show":
|
|
153
|
+
"onUpdate:show": u[2] || (u[2] = (b) => y(r) ? r.value = b : null),
|
|
154
154
|
position: "left",
|
|
155
155
|
size: "sm",
|
|
156
|
-
triggerClass: e(
|
|
157
|
-
class: n(["z-60", e(
|
|
156
|
+
triggerClass: e(m).mobileTrigger,
|
|
157
|
+
class: n(["z-60", e(m).mobileTrigger]),
|
|
158
158
|
headerClass: "pl-3! pr-4.5! py-3!",
|
|
159
159
|
bodyClass: "p-0!"
|
|
160
160
|
}, _({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./DropdownMenu.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-173c7a02"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|
package/components/Input.vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as Z, computed as d, useSlots as _, ref as v, onMounted as ee, nextTick as B, openBlock as r, createElementBlock as s, normalizeClass as u, createBlock as j, withCtx as te, createTextVNode as R, toDisplayString as w, createCommentVNode as i, createElementVNode as A, renderSlot as M, createVNode as C } from "vue";
|
|
2
2
|
import g from "./Icon.vue.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import le from "./Label.vue.js";
|
|
4
|
+
import ne from "./Textarea.vue.js";
|
|
5
5
|
import { $t as E } from "../utils/i18n.js";
|
|
6
|
-
const
|
|
6
|
+
const oe = ["for"], ae = ["type", "value", "placeholder", "disabled", "readonly", "min", "max", "data-testid"], de = { class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center gap-2 z-20" }, me = /* @__PURE__ */ Z({
|
|
7
7
|
__name: "Input",
|
|
8
8
|
props: {
|
|
9
9
|
modelValue: { default: "" },
|
|
@@ -39,16 +39,16 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
39
39
|
},
|
|
40
40
|
emits: ["update:modelValue", "focus", "blur", "change", "click:icon", "click:icon-right"],
|
|
41
41
|
setup(t, { emit: D }) {
|
|
42
|
-
const e = t, c = D, a = d(() => e.labelI18n ? E(e.labelI18n) : e.label),
|
|
42
|
+
const e = t, c = D, a = d(() => e.labelI18n ? E(e.labelI18n) : e.label), L = d(
|
|
43
43
|
() => e.placeholderI18n ? E(e.placeholderI18n) : e.placeholder
|
|
44
|
-
), x =
|
|
44
|
+
), x = _(), m = v(null), y = v(!1), p = v(!1), H = d(() => e.type === "password" && y.value ? "text" : e.type), k = d(() => e.modelValue !== "" && e.modelValue !== null && e.modelValue !== void 0), $ = d(() => b.value || k.value || p.value), h = d(() => !!e.addonLeft || !!x["addon-left"]), V = d(() => !!e.addonRight || !!x["addon-right"]), U = d(() => [
|
|
45
45
|
"relative w-full",
|
|
46
46
|
e.class,
|
|
47
47
|
e.labelPosition === "left" ? "flex items-center gap-4" : "",
|
|
48
48
|
e.labelPosition === "right" ? "flex flex-row-reverse items-center gap-4" : "space-y-2"
|
|
49
49
|
].join(" ")), W = d(() => ["relative flex w-full items-stretch", e.labelPosition !== "top" ? "flex-1" : ""].join(
|
|
50
50
|
" "
|
|
51
|
-
)),
|
|
51
|
+
)), S = d(() => {
|
|
52
52
|
const l = "block w-full bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground/70 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none relative focus:z-10", n = {
|
|
53
53
|
solid: "bg-muted border-transparent focus-visible:border-black",
|
|
54
54
|
outline: "border border-input focus-visible:border-black",
|
|
@@ -69,15 +69,23 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
69
69
|
"2xl": "rounded-2xl",
|
|
70
70
|
full: "rounded-full"
|
|
71
71
|
}[e.rounded];
|
|
72
|
-
|
|
72
|
+
h.value && (e.rounded === "md" ? o = "rounded-r-md rounded-l-none" : e.rounded === "sm" ? o = "rounded-r-sm rounded-l-none" : e.rounded === "lg" ? o = "rounded-r-lg rounded-l-none" : e.rounded === "full" ? o = "rounded-r-full rounded-l-none" : e.rounded !== "none" && (o = o.replace("rounded-", "rounded-r-").replace("rounded-l-", ""))), V.value && (h.value ? o = "rounded-none" : e.rounded === "md" ? o = "rounded-l-md rounded-r-none" : e.rounded === "sm" ? o = "rounded-l-sm rounded-r-none" : e.rounded === "lg" ? o = "rounded-l-lg rounded-r-none" : e.rounded === "full" ? o = "rounded-l-full rounded-r-none" : e.rounded !== "none" && (o = o.replace("rounded-", "rounded-l-").replace("rounded-r-", ""))), e.variant === "outline-b" && (o = "rounded-none");
|
|
73
73
|
const T = e.variant === "outline-b" || e.variant === "transparent";
|
|
74
|
-
|
|
74
|
+
e.variant;
|
|
75
|
+
const Y = {
|
|
76
|
+
xs: "pl-6",
|
|
77
|
+
sm: "pl-8",
|
|
78
|
+
md: "pl-9",
|
|
79
|
+
lg: "pl-9",
|
|
80
|
+
xl: "pl-9"
|
|
81
|
+
};
|
|
82
|
+
return [
|
|
75
83
|
l,
|
|
76
84
|
n[e.variant],
|
|
77
85
|
e.type === "textarea" ? "" : f[e.size],
|
|
78
86
|
o,
|
|
79
87
|
e.error ? "border-destructive focus-visible:ring-destructive" : "",
|
|
80
|
-
e.icon ?
|
|
88
|
+
e.icon ? Y[e?.size] : T && !h.value ? "pl-0" : "",
|
|
81
89
|
e.showClearButton && k.value || e.type === "password" || e.loading || e.iconRight ? "pr-9" : T && !V.value ? "pr-0" : "",
|
|
82
90
|
// Keyframe name used to detect browser autofill via animationstart event
|
|
83
91
|
e.variant === "floating" ? "autofill-detect" : "",
|
|
@@ -147,26 +155,26 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
147
155
|
}, N = (l) => {
|
|
148
156
|
b.value = !1, c("blur", l);
|
|
149
157
|
}, X = (l) => {
|
|
150
|
-
l.animationName === "onAutoFillStart" ?
|
|
158
|
+
l.animationName === "onAutoFillStart" ? p.value = !0 : l.animationName === "onAutoFillCancel" && (p.value = !1);
|
|
151
159
|
};
|
|
152
|
-
return
|
|
160
|
+
return ee(() => {
|
|
153
161
|
e.autofocus && B(() => {
|
|
154
162
|
setTimeout(() => {
|
|
155
163
|
m.value?.focus(), b.value = !0;
|
|
156
164
|
}, 100);
|
|
157
165
|
}), B(() => {
|
|
158
|
-
m.value && m.value.value && !e.modelValue && (
|
|
166
|
+
m.value && m.value.value && !e.modelValue && (p.value = !0);
|
|
159
167
|
});
|
|
160
168
|
}), (l, n) => (r(), s("div", {
|
|
161
169
|
class: u(U.value)
|
|
162
170
|
}, [
|
|
163
|
-
a.value && t.variant !== "floating" ? (r(), j(
|
|
171
|
+
a.value && t.variant !== "floating" ? (r(), j(le, {
|
|
164
172
|
key: 0,
|
|
165
173
|
size: "xs",
|
|
166
174
|
for: a.value,
|
|
167
175
|
class: u(["mb-1.5", t.labelPosition !== "top" ? "mb-0" : ""].join(" "))
|
|
168
176
|
}, {
|
|
169
|
-
default:
|
|
177
|
+
default: te(() => [
|
|
170
178
|
R(w(a.value), 1)
|
|
171
179
|
]),
|
|
172
180
|
_: 1
|
|
@@ -174,7 +182,7 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
174
182
|
A("div", {
|
|
175
183
|
class: u(W.value)
|
|
176
184
|
}, [
|
|
177
|
-
|
|
185
|
+
h.value ? (r(), s("div", {
|
|
178
186
|
key: 0,
|
|
179
187
|
class: u(q.value)
|
|
180
188
|
}, [
|
|
@@ -194,15 +202,15 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
194
202
|
"absolute transition-all duration-200 ease-in-out pointer-events-none z-20",
|
|
195
203
|
$.value ? "-top-2.5 left-3 text-xs bg-background px-1 text-black shadow-[0_4px_4px_-4px_bg-background] translate-y-0" : t.type === "textarea" ? `top-2 text-sm text-muted-foreground/70 ${t.icon ? "left-9" : "left-3"} translate-y-0` : `top-1/2 -translate-y-1/2 text-sm text-muted-foreground/70 ${t.icon ? "left-9" : "left-3"}`
|
|
196
204
|
])
|
|
197
|
-
}, w(a.value), 11,
|
|
198
|
-
t.type === "textarea" ? (r(), j(
|
|
205
|
+
}, w(a.value), 11, oe)) : i("", !0),
|
|
206
|
+
t.type === "textarea" ? (r(), j(ne, {
|
|
199
207
|
key: 1,
|
|
200
208
|
"model-value": String(t.modelValue),
|
|
201
|
-
placeholder: t.variant === "floating" && a.value && !$.value ? "" :
|
|
209
|
+
placeholder: t.variant === "floating" && a.value && !$.value ? "" : L.value,
|
|
202
210
|
disabled: t.disabled,
|
|
203
211
|
readonly: t.readonly,
|
|
204
212
|
rows: t.rows,
|
|
205
|
-
class: u(
|
|
213
|
+
class: u(S.value),
|
|
206
214
|
"onUpdate:modelValue": n[0] || (n[0] = (f) => c("update:modelValue", f)),
|
|
207
215
|
onBlur: N,
|
|
208
216
|
onFocus: F,
|
|
@@ -213,19 +221,19 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
213
221
|
ref: m,
|
|
214
222
|
type: H.value,
|
|
215
223
|
value: t.modelValue,
|
|
216
|
-
placeholder: t.variant === "floating" && a.value && !$.value ? "" :
|
|
224
|
+
placeholder: t.variant === "floating" && a.value && !$.value ? "" : L.value,
|
|
217
225
|
disabled: t.disabled,
|
|
218
226
|
readonly: t.readonly,
|
|
219
227
|
min: t.min,
|
|
220
228
|
max: t.max,
|
|
221
|
-
class: u(
|
|
229
|
+
class: u(S.value),
|
|
222
230
|
onInput: J,
|
|
223
231
|
onChange: K,
|
|
224
232
|
onBlur: N,
|
|
225
233
|
onFocus: F,
|
|
226
234
|
onAnimationstart: X,
|
|
227
235
|
"data-testid": l.$attrs["data-testid"] || (l.$attrs.name ? `input-${l.$attrs.name}` : a.value ? `input-${a.value.toString().toLowerCase().replace(/[^a-z0-9]+/g, "-")}` : "input")
|
|
228
|
-
}, null, 42,
|
|
236
|
+
}, null, 42, ae)),
|
|
229
237
|
t.icon ? (r(), s("div", {
|
|
230
238
|
key: 3,
|
|
231
239
|
tabindex: "-1",
|
|
@@ -239,7 +247,7 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
239
247
|
class: u(["h-4 w-4", t.iconClass])
|
|
240
248
|
}, null, 8, ["icon", "class"])
|
|
241
249
|
], 2)) : i("", !0),
|
|
242
|
-
A("div",
|
|
250
|
+
A("div", de, [
|
|
243
251
|
t.loading ? (r(), j(g, {
|
|
244
252
|
key: 0,
|
|
245
253
|
icon: "lucide:loader-2",
|
|
@@ -297,5 +305,5 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
297
305
|
}
|
|
298
306
|
});
|
|
299
307
|
export {
|
|
300
|
-
|
|
308
|
+
me as default
|
|
301
309
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as te, ref as v, shallowRef as ne, watch as oe, computed as h, onMounted as le, onUnmounted as ae, openBlock as C, createElementBlock as L, normalizeClass as re, toDisplayString as I, createCommentVNode as U, createElementVNode as w, createVNode as q, unref as a, normalizeStyle as ie } from "vue";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import se from "./RichTextToolbar.
|
|
4
|
-
/* empty css
|
|
5
|
-
import de from "./RichTextLinkPopover.
|
|
6
|
-
/* empty css
|
|
3
|
+
import se from "./RichTextToolbar.vue.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import de from "./RichTextLinkPopover.vue.js";
|
|
6
|
+
/* empty css */
|
|
7
7
|
import { useRichTextImageUpload as ue } from "./composables/useRichTextImageUpload.js";
|
|
8
8
|
import { useRichTextLinks as ce } from "./composables/useRichTextLinks.js";
|
|
9
9
|
const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { class: "rte-wrapper" }, ye = { class: "rte-body-wrap" }, ge = ["id", "contenteditable", "aria-label", "aria-readonly", "aria-disabled", "aria-invalid"], be = ["id"], Se = /* @__PURE__ */ te({
|
|
@@ -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
|
+
};
|