@janbox/storefront-builder 2.0.2 → 2.0.4

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.
Files changed (61) hide show
  1. package/dist/{dialog-header-Bh3Dkw2q.js → countdown-timer.node-CZA-i5xq.js} +3303 -2187
  2. package/dist/editor/components/index.d.ts +0 -1
  3. package/dist/editor/hooks/index.d.ts +0 -12
  4. package/dist/editor/hooks/use-editor.d.ts +6 -2
  5. package/dist/editor/index.d.ts +4 -0
  6. package/dist/editor/lib/index.d.ts +6 -4
  7. package/dist/editor/toolbars/css-font-weight/index.d.ts +9 -0
  8. package/dist/editor/toolbars/{width/width.d.ts → css-width/index.d.ts} +5 -5
  9. package/dist/editor/toolbars/html-anchor-target/index.d.ts +7 -0
  10. package/dist/editor/toolbars/index.d.ts +3 -3
  11. package/dist/editor/toolbars/text-align/index.d.ts +9 -1
  12. package/dist/editor/ui/floating/wb-floating/types.d.ts +2 -2
  13. package/dist/editor/ui/floating/wb-floating/wb-floating.d.ts +2 -0
  14. package/dist/editor.js +1209 -673
  15. package/dist/hooks/use-composer.d.ts +464 -0
  16. package/dist/index-B58cYfCo.js +4 -0
  17. package/dist/index-ekIAycpt.js +8326 -0
  18. package/dist/index.js +173 -371
  19. package/dist/lib/accordion/accordion.node/helpers.d.ts +3 -0
  20. package/dist/lib/accordion-group/accordion-group.node/helpers.d.ts +3 -0
  21. package/dist/lib/box/box.node/helpers.d.ts +3 -0
  22. package/dist/lib/button/button.node/helpers.d.ts +3 -0
  23. package/dist/lib/cell/cell.node/helpers.d.ts +3 -0
  24. package/dist/lib/container/container.node/helpers.d.ts +3 -0
  25. package/dist/lib/countdown-timer/countdown-timer.node/helpers.d.ts +3 -0
  26. package/dist/lib/flex-item/flex-item.node/helpers.d.ts +3 -0
  27. package/dist/lib/flexbox/flexbox.node/helpers.d.ts +3 -0
  28. package/dist/lib/grid/grid.node/helpers.d.ts +3 -0
  29. package/dist/lib/heading/heading.node/helpers.d.ts +3 -0
  30. package/dist/lib/icon/icon.node/helpers.d.ts +3 -0
  31. package/dist/lib/image/image.node/helpers.d.ts +3 -0
  32. package/dist/lib/link/link.node/helpers.d.ts +3 -0
  33. package/dist/lib/list-item/list-item.node/helpers.d.ts +3 -0
  34. package/dist/lib/marquee/marquee.node/helpers.d.ts +3 -0
  35. package/dist/lib/paragraph/paragraph.node/helpers.d.ts +3 -0
  36. package/dist/lib/swiper/swiper.node/helpers.d.ts +3 -0
  37. package/dist/lib/tab/tab.node/helpers.d.ts +3 -0
  38. package/dist/lib/tab-panel/tab-panel.node/helpers.d.ts +3 -0
  39. package/dist/lib/tabs/tabs.node/helpers.d.ts +3 -0
  40. package/dist/lib/unordered-list/unordered-list.node/helpers.d.ts +3 -0
  41. package/dist/lib/video/video.node/helpers.d.ts +3 -0
  42. package/dist/templates.js +26 -28
  43. package/dist/{tooltip-CXOlTkGg.js → tooltip-BFrdgixm.js} +1 -1
  44. package/package.json +2 -10
  45. package/dist/anchor-target-CtXzdkBu.js +0 -2918
  46. package/dist/color-picker-popover-XeaVfYS8.js +0 -225
  47. package/dist/countdown-timer.node-Bh5fTSJ8.js +0 -913
  48. package/dist/date-picker-D9K6HWl-.js +0 -157
  49. package/dist/dropzone-CF4CWXth.js +0 -546
  50. package/dist/editor/components/toolbar-container.d.ts +0 -1
  51. package/dist/editor/toolbars/anchor-target/anchor-target.d.ts +0 -7
  52. package/dist/editor/toolbars/anchor-target/index.d.ts +0 -1
  53. package/dist/editor/toolbars/font-weight/dataset.d.ts +0 -5
  54. package/dist/editor/toolbars/font-weight/font-weight.d.ts +0 -9
  55. package/dist/editor/toolbars/font-weight/index.d.ts +0 -1
  56. package/dist/editor/toolbars/text-align/text-align.d.ts +0 -8
  57. package/dist/editor/toolbars/width/index.d.ts +0 -1
  58. package/dist/editor/toolbars.js +0 -346
  59. package/dist/editor/ui.js +0 -120
  60. package/dist/index-800HnUOi.js +0 -4
  61. 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
- };