@janbox/storefront-builder 2.0.1 → 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/README.md +2 -2
- package/dist/{dialog-header-DPLOS7TT.js → countdown-timer.node-CZrTzirS.js} +3939 -2463
- 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/ui/button-group/button-group.d.ts +1 -1
- package/dist/editor/ui/dialog/dialog-body/dialog-body.d.ts +1 -1
- package/dist/editor/ui/form-label/form-label.d.ts +1 -1
- package/dist/editor/ui/input/input.d.ts +1 -2
- package/dist/editor/ui/loading-overlay/loading-overlay.d.ts +1 -1
- package/dist/editor/ui/popover/popover-close.d.ts +1 -1
- package/dist/editor/ui/tabs/tab-content.d.ts +1 -1
- package/dist/editor/ui/tabs/tab-list.d.ts +2 -4
- package/dist/editor/ui/tabs/tab-panel.d.ts +1 -1
- package/dist/editor/ui/tabs/tab.d.ts +2 -5
- package/dist/editor/ui/tabs/tabs.d.ts +1 -1
- package/dist/editor.js +1471 -739
- package/dist/index-B1b2lC5K.js +4 -0
- package/dist/index-CdI5y-ul.js +8326 -0
- package/dist/index.js +176 -334
- package/dist/style.css +1 -1
- package/dist/templates.js +27 -31
- package/dist/theme/index.d.ts +293 -0
- package/dist/tooltip-npH7aBjY.js +75 -0
- package/dist/utils/common.d.ts +0 -2
- package/package.json +1 -11
- package/dist/anchor-target-BlOvysAr.js +0 -2329
- package/dist/color-picker-popover-B3AVFuei.js +0 -201
- package/dist/countdown-timer.node-OmDiT-pz.js +0 -825
- package/dist/date-picker-B4Rju7gG.js +0 -115
- package/dist/dropzone-Dbfed3jK.js +0 -490
- 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 -336
- package/dist/editor/ui.js +0 -110
- package/dist/index-BbiQ0n_-.js +0 -4
- package/dist/index-CwrFnubn.js +0 -4448
- package/dist/tooltip-KbIHELP2.js +0 -65
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { isString as g } from "lodash-es";
|
|
2
|
-
import { useCallback as v, useMemo as P, useSyncExternalStore as W, Fragment as z } from "react";
|
|
3
|
-
import "clsx";
|
|
4
|
-
import "tailwind-merge";
|
|
5
|
-
import { q as M, s as F, r as V, m as j, W as R, c as T, f as U } from "./dialog-header-DPLOS7TT.js";
|
|
6
|
-
import { useEditor as q } from "@craftjs/core";
|
|
7
|
-
import { jsxs as c, jsx as r } from "@emotion/react/jsx-runtime";
|
|
8
|
-
import { parseColor as x, paletteVars as B, groupedColors as O } from "@janbox/storefront-ui/theme";
|
|
9
|
-
import { flatten as $ } from "flat";
|
|
10
|
-
import "@janbox/storefront-ui/hooks";
|
|
11
|
-
import "@janbox/storefront-ui/utils";
|
|
12
|
-
import "@floating-ui/react";
|
|
13
|
-
import "react-use";
|
|
14
|
-
import "overlayscrollbars-react";
|
|
15
|
-
import "@tanstack/react-virtual";
|
|
16
|
-
import "react-dropzone";
|
|
17
|
-
import "react-datepicker/dist/react-datepicker.css";
|
|
18
|
-
import "react-datepicker";
|
|
19
|
-
const k = (e) => e.info ?? {}, y = (e) => e.data?.custom ?? {}, de = (e) => {
|
|
20
|
-
const t = y(e);
|
|
21
|
-
if (g(t.displayName))
|
|
22
|
-
return t.displayName;
|
|
23
|
-
const o = k(e);
|
|
24
|
-
return g(o.displayName) ? o.displayName : o.displayName?.(e.data.props) ?? e.data.displayName;
|
|
25
|
-
}, le = (e) => e.data.displayName, ce = (e) => e.related ?? {}, he = (e) => y(e).selectable ?? k(e).selectable ?? !0, ue = (e, t) => {
|
|
26
|
-
try {
|
|
27
|
-
e.craft && (e.craft = {
|
|
28
|
-
...e.craft,
|
|
29
|
-
related: {
|
|
30
|
-
...e.craft?.related,
|
|
31
|
-
...t
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
} catch (o) {
|
|
35
|
-
console.error(`Error setting related for ${e.craft?.displayName}`, o);
|
|
36
|
-
}
|
|
37
|
-
}, pe = (e, t = "xs") => t === "xs" ? e : { [t]: e }, we = (e, t) => {
|
|
38
|
-
const { resolved: o, ...i } = t;
|
|
39
|
-
return e.craft = {
|
|
40
|
-
displayName: o,
|
|
41
|
-
...i,
|
|
42
|
-
related: i.related ?? {}
|
|
43
|
-
}, e;
|
|
44
|
-
}, me = (e = () => ({})) => {
|
|
45
|
-
const t = q(e), { query: o, actions: i } = t, h = v(
|
|
46
|
-
(s, a, d) => {
|
|
47
|
-
const l = o.node(s).get(), n = a ?? l.data.parent, w = n ? o.node(n).get() : null;
|
|
48
|
-
if (!w)
|
|
49
|
-
throw new Error("Parent node not found");
|
|
50
|
-
const u = {
|
|
51
|
-
data: {
|
|
52
|
-
...l.data,
|
|
53
|
-
nodes: [],
|
|
54
|
-
linkedNodes: {}
|
|
55
|
-
}
|
|
56
|
-
}, f = o.parseFreshNode(u).toNode();
|
|
57
|
-
return i.add(f, w.id, d ?? w.data.nodes.length), l.data.nodes.forEach((S, E) => {
|
|
58
|
-
h(S, f.id, E);
|
|
59
|
-
}), o.node(f.id).get();
|
|
60
|
-
},
|
|
61
|
-
[i, o]
|
|
62
|
-
), p = v(
|
|
63
|
-
(s) => {
|
|
64
|
-
const a = s.parentId ?? o.node(s.nodeId).get().data.parent;
|
|
65
|
-
if (!a)
|
|
66
|
-
throw new Error("Parent node not found");
|
|
67
|
-
let d;
|
|
68
|
-
if ("sourceIndex" in s) {
|
|
69
|
-
const { sourceIndex: l, destinationIndex: n } = s;
|
|
70
|
-
d = n > l ? n + 1 : n;
|
|
71
|
-
} else
|
|
72
|
-
d = s.moveIndex;
|
|
73
|
-
i.move(s.nodeId, a, d);
|
|
74
|
-
},
|
|
75
|
-
[i, o]
|
|
76
|
-
);
|
|
77
|
-
return P(() => ({
|
|
78
|
-
...t,
|
|
79
|
-
actions: {
|
|
80
|
-
...t.actions,
|
|
81
|
-
move: p,
|
|
82
|
-
duplicate: h
|
|
83
|
-
}
|
|
84
|
-
}), [h, t, p]);
|
|
85
|
-
}, A = () => {
|
|
86
|
-
let e;
|
|
87
|
-
const t = /* @__PURE__ */ new Set();
|
|
88
|
-
return { getSnapshot: () => {
|
|
89
|
-
if (!e)
|
|
90
|
-
throw new Error("useEditor must be initialized with initialState before use.");
|
|
91
|
-
return e;
|
|
92
|
-
}, subscribe: (s) => (t.add(s), () => t.delete(s)), initialize: (s) => {
|
|
93
|
-
e = s, t.forEach((a) => a());
|
|
94
|
-
}, setState: (s) => {
|
|
95
|
-
if (!e)
|
|
96
|
-
throw new Error("useEditor must be initialized before setState.");
|
|
97
|
-
e = { ...e, ...s }, t.forEach((a) => a());
|
|
98
|
-
} };
|
|
99
|
-
}, m = A();
|
|
100
|
-
let N = !1;
|
|
101
|
-
const I = (e) => (e && !N && (N = !0, m.initialize(e)), {
|
|
102
|
-
...W(m.subscribe, m.getSnapshot),
|
|
103
|
-
setState: m.setState
|
|
104
|
-
}), b = ({ color: e, size: t = 24 }) => {
|
|
105
|
-
const o = I(), i = x(e, o.theme.palette);
|
|
106
|
-
return /* @__PURE__ */ c(
|
|
107
|
-
"div",
|
|
108
|
-
{
|
|
109
|
-
title: e,
|
|
110
|
-
className: "tw:rounded-full tw:border tw:border-ic-white-3s tw:overflow-hidden",
|
|
111
|
-
style: { backgroundColor: i?.toString(), width: t, height: t },
|
|
112
|
-
children: [
|
|
113
|
-
!i && /* @__PURE__ */ c("svg", { className: "tw:w-full tw:h-full tw:text-ic-white-5s", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
114
|
-
/* @__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" }) }) }),
|
|
115
|
-
/* @__PURE__ */ r("rect", { width: "32", height: "32", fill: "url(#diagonal-stripes)" })
|
|
116
|
-
] }),
|
|
117
|
-
i?.alpha() === 0 && /* @__PURE__ */ c("svg", { className: "tw:w-full tw:h-full", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
118
|
-
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ c("pattern", { id: "checkerboard", patternUnits: "userSpaceOnUse", width: "8", height: "8", children: [
|
|
119
|
-
/* @__PURE__ */ r("rect", { width: "8", height: "8", fill: "white" }),
|
|
120
|
-
/* @__PURE__ */ r("rect", { width: "4", height: "4", fill: "lightgray" }),
|
|
121
|
-
/* @__PURE__ */ r("rect", { x: "4", y: "4", width: "4", height: "4", fill: "lightgray" })
|
|
122
|
-
] }) }),
|
|
123
|
-
/* @__PURE__ */ r("rect", { width: "100%", height: "100%", fill: "url(#checkerboard)" })
|
|
124
|
-
] })
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
}, D = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
129
|
-
<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"/>
|
|
130
|
-
<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"/>
|
|
131
|
-
<path d="M12 12V17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
132
|
-
</svg>
|
|
133
|
-
`, C = $(B), fe = ({
|
|
134
|
-
color: e,
|
|
135
|
-
onChange: t,
|
|
136
|
-
children: o,
|
|
137
|
-
placement: i = "right-start",
|
|
138
|
-
...h
|
|
139
|
-
}) => {
|
|
140
|
-
const p = (n) => {
|
|
141
|
-
t?.(C[n.currentTarget.value]);
|
|
142
|
-
}, s = I(), a = x(e, s.theme.palette)?.hex(), d = (n) => {
|
|
143
|
-
n.target.select();
|
|
144
|
-
}, l = (n) => {
|
|
145
|
-
t?.(n.target.value);
|
|
146
|
-
};
|
|
147
|
-
return /* @__PURE__ */ c(M, { placement: i, ...h, children: [
|
|
148
|
-
/* @__PURE__ */ r(F, { children: o ?? /* @__PURE__ */ r("button", { className: "tw:border tw:border-ic-white-1s tw:rounded-full tw:hover:border-ic-white-3s tw:p-0.5", children: /* @__PURE__ */ r(b, { color: e }) }) }),
|
|
149
|
-
/* @__PURE__ */ r(V, { children: /* @__PURE__ */ c("div", { className: "tw:flex tw:flex-col tw:gap-3", children: [
|
|
150
|
-
/* @__PURE__ */ r("div", { className: "tw:flex tw:items-center tw:gap-2", children: /* @__PURE__ */ r("div", { className: "tw:flex-1", children: /* @__PURE__ */ r(
|
|
151
|
-
j,
|
|
152
|
-
{
|
|
153
|
-
fullWidth: !0,
|
|
154
|
-
suffix: /* @__PURE__ */ r(
|
|
155
|
-
R,
|
|
156
|
-
{
|
|
157
|
-
className: T({
|
|
158
|
-
hidden: e === a
|
|
159
|
-
}),
|
|
160
|
-
size: 16,
|
|
161
|
-
source: D
|
|
162
|
-
}
|
|
163
|
-
),
|
|
164
|
-
onChange: l,
|
|
165
|
-
onFocus: d,
|
|
166
|
-
value: a,
|
|
167
|
-
size: "32"
|
|
168
|
-
}
|
|
169
|
-
) }) }),
|
|
170
|
-
/* @__PURE__ */ r(U, { className: "tw:min-w-72", color: a, onChange: t }),
|
|
171
|
-
/* @__PURE__ */ r(
|
|
172
|
-
"div",
|
|
173
|
-
{
|
|
174
|
-
style: {
|
|
175
|
-
gridTemplateColumns: "max-content 1fr"
|
|
176
|
-
},
|
|
177
|
-
className: "tw:grid tw:items-center tw:gap-x-4 tw:gap-y-2",
|
|
178
|
-
children: O.map((n, w) => /* @__PURE__ */ c(z, { children: [
|
|
179
|
-
/* @__PURE__ */ r("p", { className: "tw:text-xs", children: n.name }),
|
|
180
|
-
/* @__PURE__ */ r("div", { className: "tw:inline-flex tw:items-center tw:gap-2", children: n.colors.map((u) => /* @__PURE__ */ r("div", { className: "tw:inline-flex", children: /* @__PURE__ */ r("button", { title: u, onClick: p, type: "button", value: u, children: /* @__PURE__ */ r(b, { color: C[u] }) }) }, u)) })
|
|
181
|
-
] }, w))
|
|
182
|
-
}
|
|
183
|
-
)
|
|
184
|
-
] }) })
|
|
185
|
-
] });
|
|
186
|
-
};
|
|
187
|
-
export {
|
|
188
|
-
fe as C,
|
|
189
|
-
D as I,
|
|
190
|
-
de as a,
|
|
191
|
-
k as b,
|
|
192
|
-
ce as c,
|
|
193
|
-
we as d,
|
|
194
|
-
le as e,
|
|
195
|
-
I as f,
|
|
196
|
-
y as g,
|
|
197
|
-
he as i,
|
|
198
|
-
ue as r,
|
|
199
|
-
pe as t,
|
|
200
|
-
me as u
|
|
201
|
-
};
|