@janbox/storefront-builder 2.0.2 → 2.0.3
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/{dialog-header-Bh3Dkw2q.js → countdown-timer.node-CZrTzirS.js} +3315 -2157
- package/dist/editor/components/index.d.ts +0 -1
- package/dist/editor/hooks/index.d.ts +0 -12
- package/dist/editor/hooks/use-editor.d.ts +6 -2
- package/dist/editor/index.d.ts +4 -0
- package/dist/editor/lib/index.d.ts +6 -4
- package/dist/editor/toolbars/css-font-weight/index.d.ts +9 -0
- package/dist/editor/toolbars/{width/width.d.ts → css-width/index.d.ts} +5 -5
- package/dist/editor/toolbars/html-anchor-target/index.d.ts +7 -0
- package/dist/editor/toolbars/index.d.ts +3 -3
- package/dist/editor/toolbars/text-align/index.d.ts +9 -1
- package/dist/editor.js +1189 -693
- package/dist/index-B1b2lC5K.js +4 -0
- package/dist/index-CdI5y-ul.js +8326 -0
- package/dist/index.js +173 -371
- package/dist/templates.js +26 -28
- package/dist/{tooltip-CXOlTkGg.js → tooltip-npH7aBjY.js} +1 -1
- package/package.json +1 -10
- package/dist/anchor-target-CtXzdkBu.js +0 -2918
- package/dist/color-picker-popover-XeaVfYS8.js +0 -225
- package/dist/countdown-timer.node-Bh5fTSJ8.js +0 -913
- package/dist/date-picker-D9K6HWl-.js +0 -157
- package/dist/dropzone-CF4CWXth.js +0 -546
- package/dist/editor/components/toolbar-container.d.ts +0 -1
- package/dist/editor/toolbars/anchor-target/anchor-target.d.ts +0 -7
- package/dist/editor/toolbars/anchor-target/index.d.ts +0 -1
- package/dist/editor/toolbars/font-weight/dataset.d.ts +0 -5
- package/dist/editor/toolbars/font-weight/font-weight.d.ts +0 -9
- package/dist/editor/toolbars/font-weight/index.d.ts +0 -1
- package/dist/editor/toolbars/text-align/text-align.d.ts +0 -8
- package/dist/editor/toolbars/width/index.d.ts +0 -1
- package/dist/editor/toolbars.js +0 -346
- package/dist/editor/ui.js +0 -120
- package/dist/index-800HnUOi.js +0 -4
- package/dist/index-CXyljfMv.js +0 -4593
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { isString as b } from "lodash-es";
|
|
2
|
-
import { useCallback as v, useMemo as P, useSyncExternalStore as z, Fragment as M } from "react";
|
|
3
|
-
import { t as g, q as F, s as R, r as V, l as j, W as T, e as U, z as q } from "./dialog-header-Bh3Dkw2q.js";
|
|
4
|
-
import { useEditor as B } from "@craftjs/core";
|
|
5
|
-
import { jsxs as c, jsx as r } from "@emotion/react/jsx-runtime";
|
|
6
|
-
import { parseColor as k, paletteVars as D, groupedColors as G } from "@janbox/storefront-ui/theme";
|
|
7
|
-
import { flatten as O } from "flat";
|
|
8
|
-
import "@janbox/storefront-ui/hooks";
|
|
9
|
-
import "@janbox/storefront-ui/utils";
|
|
10
|
-
import "@emotion/react";
|
|
11
|
-
import "@floating-ui/react";
|
|
12
|
-
import "react-use";
|
|
13
|
-
import "overlayscrollbars-react";
|
|
14
|
-
import "@tanstack/react-virtual";
|
|
15
|
-
import "react-dropzone";
|
|
16
|
-
import "react-datepicker/dist/react-datepicker.css";
|
|
17
|
-
import "react-datepicker";
|
|
18
|
-
const N = (e) => e.info ?? {}, I = (e) => e.data?.custom ?? {}, de = (e) => {
|
|
19
|
-
const t = I(e);
|
|
20
|
-
if (b(t.displayName))
|
|
21
|
-
return t.displayName;
|
|
22
|
-
const o = N(e);
|
|
23
|
-
return b(o.displayName) ? o.displayName : o.displayName?.(e.data.props) ?? e.data.displayName;
|
|
24
|
-
}, le = (e) => e.data.displayName, ce = (e) => e.related ?? {}, he = (e) => I(e).selectable ?? N(e).selectable ?? !0, pe = (e, t) => {
|
|
25
|
-
try {
|
|
26
|
-
e.craft && (e.craft = {
|
|
27
|
-
...e.craft,
|
|
28
|
-
related: {
|
|
29
|
-
...e.craft?.related,
|
|
30
|
-
...t
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
} catch (o) {
|
|
34
|
-
console.error(`Error setting related for ${e.craft?.displayName}`, o);
|
|
35
|
-
}
|
|
36
|
-
}, ue = (e, t = "xs") => t === "xs" ? e : { [t]: e }, me = (e, t) => {
|
|
37
|
-
const { resolved: o, ...n } = t;
|
|
38
|
-
return e.craft = {
|
|
39
|
-
displayName: o,
|
|
40
|
-
...n,
|
|
41
|
-
related: n.related ?? {}
|
|
42
|
-
}, e;
|
|
43
|
-
}, fe = (e = () => ({})) => {
|
|
44
|
-
const t = B(e), { query: o, actions: n } = t, h = v(
|
|
45
|
-
(s, a, d) => {
|
|
46
|
-
const l = o.node(s).get(), i = a ?? l.data.parent, m = i ? o.node(i).get() : null;
|
|
47
|
-
if (!m)
|
|
48
|
-
throw new Error("Parent node not found");
|
|
49
|
-
const p = {
|
|
50
|
-
data: {
|
|
51
|
-
...l.data,
|
|
52
|
-
nodes: [],
|
|
53
|
-
linkedNodes: {}
|
|
54
|
-
}
|
|
55
|
-
}, w = o.parseFreshNode(p).toNode();
|
|
56
|
-
return n.add(w, m.id, d ?? m.data.nodes.length), l.data.nodes.forEach((E, W) => {
|
|
57
|
-
h(E, w.id, W);
|
|
58
|
-
}), o.node(w.id).get();
|
|
59
|
-
},
|
|
60
|
-
[n, o]
|
|
61
|
-
), u = v(
|
|
62
|
-
(s) => {
|
|
63
|
-
const a = s.parentId ?? o.node(s.nodeId).get().data.parent;
|
|
64
|
-
if (!a)
|
|
65
|
-
throw new Error("Parent node not found");
|
|
66
|
-
let d;
|
|
67
|
-
if ("sourceIndex" in s) {
|
|
68
|
-
const { sourceIndex: l, destinationIndex: i } = s;
|
|
69
|
-
d = i > l ? i + 1 : i;
|
|
70
|
-
} else
|
|
71
|
-
d = s.moveIndex;
|
|
72
|
-
n.move(s.nodeId, a, d);
|
|
73
|
-
},
|
|
74
|
-
[n, o]
|
|
75
|
-
);
|
|
76
|
-
return P(() => ({
|
|
77
|
-
...t,
|
|
78
|
-
actions: {
|
|
79
|
-
...t.actions,
|
|
80
|
-
move: u,
|
|
81
|
-
duplicate: h
|
|
82
|
-
}
|
|
83
|
-
}), [h, t, u]);
|
|
84
|
-
}, $ = () => {
|
|
85
|
-
let e;
|
|
86
|
-
const t = /* @__PURE__ */ new Set();
|
|
87
|
-
return { getSnapshot: () => {
|
|
88
|
-
if (!e)
|
|
89
|
-
throw new Error("useEditor must be initialized with initialState before use.");
|
|
90
|
-
return e;
|
|
91
|
-
}, subscribe: (s) => (t.add(s), () => t.delete(s)), initialize: (s) => {
|
|
92
|
-
e = s, t.forEach((a) => a());
|
|
93
|
-
}, setState: (s) => {
|
|
94
|
-
if (!e)
|
|
95
|
-
throw new Error("useEditor must be initialized before setState.");
|
|
96
|
-
e = { ...e, ...s }, t.forEach((a) => a());
|
|
97
|
-
} };
|
|
98
|
-
}, f = $();
|
|
99
|
-
let C = !1;
|
|
100
|
-
const S = (e) => (e && !C && (C = !0, f.initialize(e)), {
|
|
101
|
-
...z(f.subscribe, f.getSnapshot),
|
|
102
|
-
setState: f.setState
|
|
103
|
-
}), x = ({ color: e, size: t = 24 }) => {
|
|
104
|
-
const o = S(), n = k(e, o.theme.palette);
|
|
105
|
-
return /* @__PURE__ */ c(
|
|
106
|
-
"div",
|
|
107
|
-
{
|
|
108
|
-
title: e,
|
|
109
|
-
css: { borderRadius: 9999, overflow: "hidden", borderWidth: 1, borderStyle: "solid", borderColor: g.palette.white["3s"] },
|
|
110
|
-
style: { backgroundColor: n?.toString(), width: t, height: t },
|
|
111
|
-
children: [
|
|
112
|
-
!n && /* @__PURE__ */ c("svg", { css: { width: "100%", height: "100%", color: g.palette.white["5s"] }, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
113
|
-
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ r("pattern", { id: "diagonal-stripes", patternUnits: "userSpaceOnUse", width: "8", height: "8", children: /* @__PURE__ */ r("path", { d: "M-2,2 l4,-4 M0,8 l8,-8 M6,10 l4,-4", stroke: "currentColor", strokeWidth: "1.5" }) }) }),
|
|
114
|
-
/* @__PURE__ */ r("rect", { width: "32", height: "32", fill: "url(#diagonal-stripes)" })
|
|
115
|
-
] }),
|
|
116
|
-
n?.alpha() === 0 && /* @__PURE__ */ c("svg", { css: { width: "100%", height: "100%" }, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
117
|
-
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ c("pattern", { id: "checkerboard", patternUnits: "userSpaceOnUse", width: "8", height: "8", children: [
|
|
118
|
-
/* @__PURE__ */ r("rect", { width: "8", height: "8", fill: "white" }),
|
|
119
|
-
/* @__PURE__ */ r("rect", { width: "4", height: "4", fill: "lightgray" }),
|
|
120
|
-
/* @__PURE__ */ r("rect", { x: "4", y: "4", width: "4", height: "4", fill: "lightgray" })
|
|
121
|
-
] }) }),
|
|
122
|
-
/* @__PURE__ */ r("rect", { width: "100%", height: "100%", fill: "url(#checkerboard)" })
|
|
123
|
-
] })
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
}, A = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
128
|
-
<path d="M11.999 8C11.861 8 11.749 8.112 11.75 8.25C11.75 8.388 11.862 8.5 12 8.5C12.138 8.5 12.25 8.388 12.25 8.25C12.25 8.112 12.138 8 11.999 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
129
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 21V21C7.029 21 3 16.971 3 12V12C3 7.029 7.029 3 12 3V3C16.971 3 21 7.029 21 12V12C21 16.971 16.971 21 12 21Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
130
|
-
<path d="M12 12V17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
131
|
-
</svg>
|
|
132
|
-
`, y = O(D), ge = ({
|
|
133
|
-
color: e,
|
|
134
|
-
onChange: t,
|
|
135
|
-
children: o,
|
|
136
|
-
placement: n = "right-start",
|
|
137
|
-
...h
|
|
138
|
-
}) => {
|
|
139
|
-
const u = (i) => {
|
|
140
|
-
t?.(y[i.currentTarget.value]);
|
|
141
|
-
}, s = S(), a = k(e, s.theme.palette)?.hex(), d = (i) => {
|
|
142
|
-
i.target.select();
|
|
143
|
-
}, l = (i) => {
|
|
144
|
-
t?.(i.target.value);
|
|
145
|
-
};
|
|
146
|
-
return /* @__PURE__ */ c(F, { placement: n, ...h, children: [
|
|
147
|
-
/* @__PURE__ */ r(R, { children: o ?? /* @__PURE__ */ r(
|
|
148
|
-
"button",
|
|
149
|
-
{
|
|
150
|
-
css: {
|
|
151
|
-
padding: 2,
|
|
152
|
-
borderRadius: 9999,
|
|
153
|
-
borderWidth: 1,
|
|
154
|
-
borderStyle: "solid",
|
|
155
|
-
borderColor: g.palette.white["1s"],
|
|
156
|
-
":hover": {
|
|
157
|
-
borderColor: g.palette.white["3s"]
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
children: /* @__PURE__ */ r(x, { color: e })
|
|
161
|
-
}
|
|
162
|
-
) }),
|
|
163
|
-
/* @__PURE__ */ r(V, { children: /* @__PURE__ */ c("div", { css: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
164
|
-
/* @__PURE__ */ r("div", { css: { display: "flex", alignItems: "center", gap: 8 }, children: /* @__PURE__ */ r("div", { css: { flex: 1 }, children: /* @__PURE__ */ r(
|
|
165
|
-
j,
|
|
166
|
-
{
|
|
167
|
-
fullWidth: !0,
|
|
168
|
-
suffix: /* @__PURE__ */ r(
|
|
169
|
-
T,
|
|
170
|
-
{
|
|
171
|
-
css: [
|
|
172
|
-
e === a && {
|
|
173
|
-
display: "none"
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
size: 16,
|
|
177
|
-
source: A
|
|
178
|
-
}
|
|
179
|
-
),
|
|
180
|
-
onChange: l,
|
|
181
|
-
onFocus: d,
|
|
182
|
-
value: a,
|
|
183
|
-
size: "32"
|
|
184
|
-
}
|
|
185
|
-
) }) }),
|
|
186
|
-
/* @__PURE__ */ r(U, { css: { minWidth: 288 }, color: a, onChange: t }),
|
|
187
|
-
/* @__PURE__ */ r(
|
|
188
|
-
"div",
|
|
189
|
-
{
|
|
190
|
-
style: {
|
|
191
|
-
gridTemplateColumns: "max-content 1fr"
|
|
192
|
-
},
|
|
193
|
-
css: { display: "grid", alignItems: "center", columnGap: 16, rowGap: 8 },
|
|
194
|
-
children: G.map((i, m) => /* @__PURE__ */ c(M, { children: [
|
|
195
|
-
/* @__PURE__ */ r(
|
|
196
|
-
"p",
|
|
197
|
-
{
|
|
198
|
-
css: {
|
|
199
|
-
...q.xs
|
|
200
|
-
},
|
|
201
|
-
children: i.name
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
/* @__PURE__ */ r("div", { css: { display: "inline-flex", alignItems: "center", gap: 8 }, children: i.colors.map((p) => /* @__PURE__ */ r("div", { css: { display: "inline-flex" }, children: /* @__PURE__ */ r("button", { title: p, onClick: u, type: "button", value: p, children: /* @__PURE__ */ r(x, { color: y[p] }) }) }, p)) })
|
|
205
|
-
] }, m))
|
|
206
|
-
}
|
|
207
|
-
)
|
|
208
|
-
] }) })
|
|
209
|
-
] });
|
|
210
|
-
};
|
|
211
|
-
export {
|
|
212
|
-
ge as C,
|
|
213
|
-
A as I,
|
|
214
|
-
de as a,
|
|
215
|
-
N as b,
|
|
216
|
-
ce as c,
|
|
217
|
-
me as d,
|
|
218
|
-
le as e,
|
|
219
|
-
S as f,
|
|
220
|
-
I as g,
|
|
221
|
-
he as i,
|
|
222
|
-
pe as r,
|
|
223
|
-
ue as t,
|
|
224
|
-
fe as u
|
|
225
|
-
};
|