@pagehub/sdk 0.1.4 → 0.1.6

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 (141) hide show
  1. package/README.md +1 -1
  2. package/dist/chrome/viewport/Viewport/hooks/usePageLoadIndicator.d.ts +2 -2
  3. package/dist/chrome/viewport/design-system/hooks/useDesignSystem.d.ts +2 -2
  4. package/dist/chrome/viewport/design-system/hooks/usePaletteState.d.ts +2 -2
  5. package/dist/chunks/ActionEditorPanel-9v50QUwu.js +89 -0
  6. package/dist/chunks/ActionInput-CTt7sOs6.js +929 -0
  7. package/dist/chunks/ActionsAddPicker-BeTPUUor.js +51 -0
  8. package/dist/chunks/ActionsInput-D0h-zLYj.js +174 -0
  9. package/dist/chunks/AnchoredPopover-CckPTxXu.js +2676 -0
  10. package/dist/chunks/AnimationEditorPanel-CXNmsTqV.js +26 -0
  11. package/dist/chunks/AnimationsInput-Djyz0uXG.js +292 -0
  12. package/dist/chunks/AnimationsInputPopover-B2-oNebx.js +71 -0
  13. package/dist/chunks/AnimationsPanel-DungA9qb.js +25 -0
  14. package/dist/chunks/Audio.render-CsR69fZ9.js +22 -0
  15. package/dist/chunks/AudioMainTab-BljM2NMQ.js +70 -0
  16. package/dist/chunks/BackdropEditorPanel-CA2k-6SR.js +26 -0
  17. package/dist/chunks/BackgroundImageInputPopover-vB_217Ig.js +94 -0
  18. package/dist/chunks/BackgroundImagePanel-BvMhF9eU.js +100 -0
  19. package/dist/chunks/BackgroundMainTab-CI4c5DEF.js +10 -0
  20. package/dist/chunks/BundleRowPanel-BcYfyfGQ.js +33 -0
  21. package/dist/chunks/ButtonMainTab-Civy_DoA.js +43 -0
  22. package/dist/chunks/CSSEditorInput-C1ITwAh3.js +73 -0
  23. package/dist/chunks/ClassNameInput-Ce0fGQES.js +720 -0
  24. package/dist/chunks/CodeEditor-axBXmPH8.js +33370 -0
  25. package/dist/chunks/ColorInput-BSfMNt86.js +187 -0
  26. package/dist/chunks/ColorPanel-DOLrT-gS.js +562 -0
  27. package/dist/chunks/ComponentImportExportPanel-DVcnGhGx.js +161 -0
  28. package/dist/chunks/ComponentImportExportPopover-BY1_oxU8.js +26 -0
  29. package/dist/chunks/ConditionEditorPanel-DLbqYaSF.js +43 -0
  30. package/dist/chunks/ConditionsAddPicker-SsHJlc1E.js +54 -0
  31. package/dist/chunks/ConditionsInput-B_5Nge8o.js +474 -0
  32. package/dist/chunks/ContainerMainTab-kkktm1Ns.js +1107 -0
  33. package/dist/chunks/ContainerOverflowSectionPanel-ibKXf-1N.js +120 -0
  34. package/dist/chunks/ContainerOverflowSectionPopover-CRQ9EPsn.js +24 -0
  35. package/dist/chunks/ContainerPaddingOverlay-Cd3xOv-S.js +340 -0
  36. package/dist/chunks/ContainerScrollEffectSection-Dbztqdnr.js +123 -0
  37. package/dist/chunks/ContainerStateSection-DY_gjBJL.js +478 -0
  38. package/dist/chunks/ConversionFields-Bpfl-SGP.js +135 -0
  39. package/dist/chunks/CraftListEditor-_TIy1ogW.js +73 -0
  40. package/dist/chunks/CreateTokenDialog-DNWtWqJd.js +147 -0
  41. package/dist/chunks/Data.render-DTmaqSyz.js +10 -0
  42. package/dist/chunks/DataAttributesPanel-mYhisO_O.js +125 -0
  43. package/dist/chunks/DataMainTab-Batm515E.js +23 -0
  44. package/dist/chunks/DataSourceSectionSlot-BKoO6Vxn.js +10 -0
  45. package/dist/chunks/EditorEmptyLeafHintView-D3E3UN_0.js +78 -0
  46. package/dist/chunks/EffectRowInputPopover-CYhfjFwJ.js +323 -0
  47. package/dist/chunks/EffectsClassInput-Yujuchwy.js +315 -0
  48. package/dist/chunks/Embed.render-BgKpUV8n.js +17 -0
  49. package/dist/chunks/EmbedMainTab-d_-Bnkug.js +225 -0
  50. package/dist/chunks/FilterEditorPanel-CRa0IpLr.js +26 -0
  51. package/dist/chunks/FlexDirectionInput-C5gYjk5W.js +78 -0
  52. package/dist/chunks/FloatingPanel-DJP5Vhua.js +553 -0
  53. package/dist/chunks/FontFamilyInput-CVNnVylt.js +111 -0
  54. package/dist/chunks/Form.render-6GjcmL2u.js +54 -0
  55. package/dist/chunks/FormElement.render-DWrG-2ID.js +36 -0
  56. package/dist/chunks/FormElementMainTab-DSbF3F6e.js +470 -0
  57. package/dist/chunks/FormMainTab-SHny1HxF.js +240 -0
  58. package/dist/chunks/GradientInputPopover-1K6O9jBq.js +103 -0
  59. package/dist/chunks/GradientPanel-DSRQKkaB.js +194 -0
  60. package/dist/chunks/HTMLCodeInput-CCe4Bj5z.js +69 -0
  61. package/dist/chunks/HandlerEditorPanel-DiOXobsl.js +93 -0
  62. package/dist/chunks/HandlersAddPicker-DWTgjKgo.js +101 -0
  63. package/dist/chunks/HandlersInput-p49STTn8.js +132 -0
  64. package/dist/chunks/IconDialogInput-C-81_L2n.js +105 -0
  65. package/dist/chunks/IconInput-D2Gy7Hvf.js +182 -0
  66. package/dist/chunks/IconMainTab-CNrVjDWP.js +26 -0
  67. package/dist/chunks/IconPickerPanel-BjNOlCh6.js +670 -0
  68. package/dist/chunks/ImageMainTab-C4O7RjX0.js +66 -0
  69. package/dist/chunks/ImageSettingsPanel-dvOmGg3C.js +485 -0
  70. package/dist/chunks/LayoutPresetPanel-CNAVAcvw.js +81 -0
  71. package/dist/chunks/LayoutPresetSlot-BqMTdE33.js +16 -0
  72. package/dist/chunks/LinkMainTab-BfFZx0AU.js +13 -0
  73. package/dist/chunks/ListEditor-mD-CmRNE.js +178 -0
  74. package/dist/chunks/Map.render-DFkmncHz.js +82 -0
  75. package/dist/chunks/MapLeaflet-DOfmZ3Pk.js +6588 -0
  76. package/dist/chunks/MapMainTab-CxI7IS1_.js +165 -0
  77. package/dist/chunks/MapPoint.render-0OAfCZTp.js +16 -0
  78. package/dist/chunks/MapPointMainTab-CmLcaSR5.js +60 -0
  79. package/dist/chunks/MediaInput-DHs3D8TJ.js +672 -0
  80. package/dist/chunks/MediaManagerModal-Dc5PK3dn.js +240 -0
  81. package/dist/chunks/MiniPreviewTile-B4zxTj9Y.js +32 -0
  82. package/dist/chunks/ModifierChipList-CwsWklih.js +33 -0
  83. package/dist/chunks/ModifiersAddPicker-D-vSYw7O.js +74 -0
  84. package/dist/chunks/ModifiersPickerPanel-CTefidBx.js +243 -0
  85. package/dist/chunks/NodeAiContextInputPopover-D5bn5o_T.js +66 -0
  86. package/dist/chunks/NodeAiContextPanel-Bx4rcjiM.js +81 -0
  87. package/dist/chunks/NumberSettingsPanel-DASi_l6V.js +56 -0
  88. package/dist/chunks/PageSettingsModal-D6o450IR.js +2678 -0
  89. package/dist/chunks/PatternInputPopover-qMWBv_nl.js +100 -0
  90. package/dist/chunks/PatternPanel-D2fgWDd-.js +352 -0
  91. package/dist/chunks/PeekTargetButton-ClrJX7zh.js +26 -0
  92. package/dist/chunks/PermissionsSection-DwobrV40.js +82 -0
  93. package/dist/chunks/PresetAddChildList-D6a0xdt8.js +35 -0
  94. package/dist/chunks/PropertiesInput-9O39ngbb.js +125 -0
  95. package/dist/chunks/PropertiesPanel-DO0RlalO.js +76 -0
  96. package/dist/chunks/SaveModifierPanel-B6mjKyrT.js +130 -0
  97. package/dist/chunks/ScrollEffectEditorPanel-CllGUhui.js +26 -0
  98. package/dist/chunks/SearchInput-DRUztbM0.js +76 -0
  99. package/dist/chunks/SearchableMenuPopover-DZKVXiEl.js +1251 -0
  100. package/dist/chunks/SlotRenderer-CaLf_2_C.js +38 -0
  101. package/dist/chunks/StateBindingEditorPanel-DKdcG5py.js +101 -0
  102. package/dist/chunks/StateBindingsAddPicker-DxMNAWAD.js +91 -0
  103. package/dist/chunks/StateBindingsInput-iWiqvAVB.js +103 -0
  104. package/dist/chunks/TailwindInput-660FZtyK.js +24 -0
  105. package/dist/chunks/TextEditor-B2O7DlN8.js +22032 -0
  106. package/dist/chunks/TextMainTab-B5udsXsk.js +260 -0
  107. package/dist/chunks/TextStyleEditorPanel-GRNPGzUL.js +381 -0
  108. package/dist/chunks/TextStylePickerPanel-l108SmGQ.js +140 -0
  109. package/dist/chunks/TextareaSettingsPanel-C1rQuF1O.js +50 -0
  110. package/dist/chunks/TokenPicker-Q0LToF_p.js +291 -0
  111. package/dist/chunks/ToolbarDashedButton-DbUxGmDg.js +23 -0
  112. package/dist/chunks/TransformEditorPanel-BGwyznZ6.js +26 -0
  113. package/dist/chunks/TransitionEditorPanel-BSvk58Ow.js +26 -0
  114. package/dist/chunks/TypographyPresetInput-DqnGSgR2.js +296 -0
  115. package/dist/chunks/ValidationPanel-CmA9SfoF.js +56 -0
  116. package/dist/chunks/Video.render-Dg6xvis4.js +21 -0
  117. package/dist/chunks/VideoMainTab-v5UFhUm-.js +174 -0
  118. package/dist/chunks/YouTube.esm-EbHnLU1Z.js +744 -0
  119. package/dist/chunks/dialogAtoms-CeQ2G05l.js +59 -0
  120. package/dist/chunks/extends-hS2Bh-Yp.js +12 -0
  121. package/dist/chunks/formatStorage-C3o2s3dk.js +22 -0
  122. package/dist/chunks/googleFonts-Dj4AntNi.js +323 -0
  123. package/dist/chunks/helpers-Cll72tMn.js +18 -0
  124. package/dist/chunks/index-B-GJd039.js +2875 -0
  125. package/dist/chunks/index-C66dAl3Q.js +32177 -0
  126. package/dist/chunks/index.esm-mqFx3NOs.js +644 -0
  127. package/dist/chunks/popoverOpenRequestAtom-hBS_siXv.js +22 -0
  128. package/dist/chunks/propertyRegistry-CMhVNOgl.js +38 -0
  129. package/dist/chunks/resolveAnchorsViaCraft-Cixm6ZyJ.js +31 -0
  130. package/dist/chunks/toolboxUtils-DjTMslSn.js +370 -0
  131. package/dist/chunks/uiPrimitives-BtohldWg.js +15 -0
  132. package/dist/chunks/use-event-listener-DO3Sk7g0.js +15 -0
  133. package/dist/chunks/useElementPicker-DoNuXNMQ.js +41 -0
  134. package/dist/chunks/useLayoutPreset-wOMV5YnO.js +528 -0
  135. package/dist/chunks/useMediaManager-CmKDbFfw.js +4629 -0
  136. package/dist/chunks/usePopoverAutoOpen-CxIjt0ez.js +25 -0
  137. package/dist/chunks/usePopoverPosition-83Vti7Aw.js +15 -0
  138. package/dist/render/static/index.js +9 -0
  139. package/package.json +22 -13
  140. package/dist/pagehub-viewer.umd.cjs +0 -574
  141. package/dist/pagehub.umd.cjs +0 -1130
@@ -0,0 +1,100 @@
1
+ import { jsxs as A, Fragment as S, jsx as o } from "react/jsx-runtime";
2
+ import { useNode as x } from "@craftjs/core";
3
+ import { useState as I, useMemo as O, Suspense as k, lazy as y } from "react";
4
+ import { C as H, eQ as N, eR as w } from "./index-C66dAl3Q.js";
5
+ import { u as E } from "./usePopoverAutoOpen-CxIjt0ez.js";
6
+ import { u as L } from "./usePopoverPosition-83Vti7Aw.js";
7
+ const T = y(() => import("./PatternPanel-D2fgWDd-.js")), d = 300, z = 460, D = {
8
+ patternColor1: "rgba(59, 130, 246, 0.8)",
9
+ patternColor2: "rgba(16, 185, 129, 0.8)",
10
+ patternColor3: "rgba(245, 101, 101, 0.8)",
11
+ patternColor4: "rgba(168, 85, 247, 0.8)"
12
+ };
13
+ function R(e) {
14
+ if (!e) return null;
15
+ try {
16
+ return w({
17
+ root: {
18
+ pattern: e,
19
+ patternVerticalPosition: 0,
20
+ patternHorizontalPosition: 0,
21
+ patternStroke: 1,
22
+ patternZoom: 0.4,
23
+ patternAngle: 0,
24
+ patternSpacingX: 0,
25
+ patternSpacingY: 0,
26
+ ...D
27
+ }
28
+ }) || null;
29
+ } catch {
30
+ return null;
31
+ }
32
+ }
33
+ function X({ def: e }) {
34
+ const [n, l] = I(!1), { triggerRef: m, initialPos: g, setInitialPos: P, computePosition: b } = L(d), {
35
+ actions: { setProp: f },
36
+ id: C,
37
+ pattern: r
38
+ } = x((t) => {
39
+ var p, u, c;
40
+ return {
41
+ id: t.id,
42
+ pattern: ((c = (u = (p = t.data) == null ? void 0 : p.props) == null ? void 0 : u.root) == null ? void 0 : c.pattern) || null
43
+ };
44
+ }), a = !!r, i = O(() => R(r), [r]), s = () => {
45
+ P(b()), l(!0);
46
+ };
47
+ E({ nodeId: C, defId: e == null ? void 0 : e.id, onOpen: s });
48
+ const v = () => {
49
+ f((t) => {
50
+ t.root && (t.root.pattern = null, delete t.root.patternColor1, delete t.root.patternColor2, delete t.root.patternColor3, delete t.root.patternColor4, delete t.root.patternStroke, delete t.root.patternZoom, delete t.root.patternAngle, delete t.root.patternSpacingX, delete t.root.patternSpacingY, delete t.root.patternVerticalPosition, delete t.root.patternHorizontalPosition);
51
+ });
52
+ }, h = (e == null ? void 0 : e.label) ?? "Pattern";
53
+ return /* @__PURE__ */ A(S, { children: [
54
+ /* @__PURE__ */ o(
55
+ H,
56
+ {
57
+ mode: "popover",
58
+ ref: m,
59
+ label: h,
60
+ open: n,
61
+ onTriggerClick: () => n ? l(!1) : s(),
62
+ onClear: () => {
63
+ n && l(!1), v();
64
+ },
65
+ triggerAriaLabel: a ? "Edit pattern" : "Add pattern",
66
+ clearAriaLabel: "Clear pattern",
67
+ variant: a ? "preview" : "default",
68
+ leading: a ? /* @__PURE__ */ o(
69
+ "span",
70
+ {
71
+ className: "absolute inset-0 bg-cover bg-center",
72
+ style: i ? { backgroundImage: `url(${i})` } : void 0,
73
+ "aria-hidden": !0
74
+ }
75
+ ) : /* @__PURE__ */ o(N, { className: "size-3.5", "aria-hidden": !0 }),
76
+ summary: a ? null : "Add...",
77
+ previewOverlay: a && (r != null && r.title) ? /* @__PURE__ */ o(
78
+ "span",
79
+ {
80
+ className: "bg-base-100/80 text-base-content relative rounded px-1.5 py-0.5 text-[10px] font-semibold shadow-sm",
81
+ "aria-hidden": !0,
82
+ children: r.title
83
+ }
84
+ ) : null
85
+ }
86
+ ),
87
+ n && /* @__PURE__ */ o(k, { fallback: null, children: /* @__PURE__ */ o(
88
+ T,
89
+ {
90
+ initialPosition: g,
91
+ onClose: () => l(!1),
92
+ defaultWidth: d,
93
+ defaultHeight: z
94
+ }
95
+ ) })
96
+ ] });
97
+ }
98
+ export {
99
+ X as default
100
+ };
@@ -0,0 +1,352 @@
1
+ import { jsxs as d, jsx as e, Fragment as K } from "react/jsx-runtime";
2
+ import { f as M, F as R } from "./FloatingPanel-DJP5Vhua.js";
3
+ import { useEditor as _, useNode as L } from "@craftjs/core";
4
+ import { u as O, V as B, E as F, C as Y, P as j, aw as G, eR as H, dp as X, bY as Z, c as D, fu as U, e as W, n as g, W as q } from "./index-C66dAl3Q.js";
5
+ import { C as J } from "./ColorInput-BSfMNt86.js";
6
+ import { createPortal as Q } from "react-dom";
7
+ import { useState as v, useRef as E, useMemo as z, useEffect as I } from "react";
8
+ import { M as ee } from "./MiniPreviewTile-B4zxTj9Y.js";
9
+ const P = {
10
+ patternColor1: "rgba(59, 130, 246, 0.8)",
11
+ patternColor2: "rgba(16, 185, 129, 0.8)",
12
+ patternColor3: "rgba(245, 101, 101, 0.8)",
13
+ patternColor4: "rgba(168, 85, 247, 0.8)"
14
+ }, V = (o) => H({
15
+ root: {
16
+ pattern: o,
17
+ patternVerticalPosition: 0,
18
+ patternHorizontalPosition: 0,
19
+ patternStroke: 1,
20
+ patternZoom: 0.4,
21
+ patternAngle: 0,
22
+ patternSpacingX: 0,
23
+ patternSpacingY: 0,
24
+ ...P
25
+ }
26
+ }), te = ({
27
+ propKey: o,
28
+ label: u = "",
29
+ prefix: p = "",
30
+ index: l = null,
31
+ propItemKey: m = "",
32
+ propType: s = "class"
33
+ }) => {
34
+ const { actions: h, query: f } = _(), N = O(B), b = O(F).dark ?? !1, S = W(N), {
35
+ actions: { setProp: x },
36
+ nodeProps: y,
37
+ id: t
38
+ } = L((c) => {
39
+ var r;
40
+ return {
41
+ nodeProps: ((r = c.data) == null ? void 0 : r.props) || {},
42
+ id: c.id
43
+ };
44
+ }), [n, i] = v(!1), [C, k] = v(null), w = E(null), a = y.root ? y.root[o] || "" : null, A = z(() => a ? V(a) : null, [a]), $ = () => {
45
+ var r;
46
+ const c = (r = w.current) == null ? void 0 : r.getBoundingClientRect();
47
+ c && k({ top: c.bottom + 4, left: c.left }), i(!0);
48
+ }, T = (c) => {
49
+ D({
50
+ propType: s,
51
+ propKey: o,
52
+ value: c,
53
+ setProp: x,
54
+ index: l,
55
+ propItemKey: m,
56
+ query: f,
57
+ actions: h,
58
+ nodeId: t,
59
+ ...s === "class" ? { view: S, classDark: b } : {}
60
+ }), c && x((r) => {
61
+ r.root = r.root || {}, r.root.patternColor1 || (r.root.patternColor1 = P.patternColor1), r.root.patternColor2 || (r.root.patternColor2 = P.patternColor2), r.root.patternColor3 || (r.root.patternColor3 = P.patternColor3), r.root.patternColor4 || (r.root.patternColor4 = P.patternColor4), r.root.patternStroke || (r.root.patternStroke = 1), r.root.patternZoom || (r.root.patternZoom = 1);
62
+ }, 500);
63
+ };
64
+ return /* @__PURE__ */ d("div", { className: "relative", children: [
65
+ /* @__PURE__ */ e(
66
+ Y,
67
+ {
68
+ propType: s,
69
+ propKey: o,
70
+ trailing: a ? /* @__PURE__ */ e(G, { onClick: () => {
71
+ T(null), i(!1);
72
+ }, tooltip: "Clear pattern" }) : null,
73
+ children: /* @__PURE__ */ e(
74
+ "button",
75
+ {
76
+ ref: w,
77
+ type: "button",
78
+ "data-tooltip-id": j,
79
+ "data-tooltip-content": (a == null ? void 0 : a.title) || "Select pattern",
80
+ id: o ? `input-${o}` : void 0,
81
+ onClick: () => n ? i(!1) : $(),
82
+ className: "input-plain flex min-w-0 flex-1 items-center text-left",
83
+ children: /* @__PURE__ */ d("div", { className: "pointer-events-none flex min-h-0 w-full items-center gap-2", children: [
84
+ /* @__PURE__ */ e(
85
+ ee,
86
+ {
87
+ size: "swatch",
88
+ rounded: "md",
89
+ style: A ? { backgroundImage: `url(${A})` } : void 0
90
+ }
91
+ ),
92
+ /* @__PURE__ */ e("div", { className: "min-w-0 flex-1 truncate text-left", children: (a == null ? void 0 : a.title) || /* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Select pattern" }) })
93
+ ] })
94
+ }
95
+ )
96
+ }
97
+ ),
98
+ n && C && Q(
99
+ /* @__PURE__ */ e(
100
+ re,
101
+ {
102
+ selected: a == null ? void 0 : a.slug,
103
+ position: C,
104
+ triggerRef: w,
105
+ onSelect: (c) => {
106
+ T(c), i(!1);
107
+ },
108
+ onClose: () => i(!1)
109
+ }
110
+ ),
111
+ document.querySelector(".pagehub-sdk-root") || document.body
112
+ )
113
+ ] });
114
+ }, re = ({
115
+ selected: o,
116
+ position: u,
117
+ triggerRef: p,
118
+ onSelect: l,
119
+ onClose: m
120
+ }) => {
121
+ const [s, h] = v(null), [f, N] = v(""), [b, S] = v("all"), x = E(null);
122
+ M(x), I(() => {
123
+ const t = U();
124
+ fetch(`${t}/api/patterns`, {
125
+ method: "POST",
126
+ headers: { Accept: "application/json", "Content-Type": "application/json" },
127
+ body: JSON.stringify({})
128
+ }).then((n) => n.json()).then((n) => h(Array.isArray(n) ? n : [])).catch(() => {
129
+ });
130
+ }, []), I(() => {
131
+ const t = (n) => {
132
+ const i = n.target;
133
+ x.current && x.current.contains(i) || p.current && p.current.contains(i) || m();
134
+ };
135
+ return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
136
+ }, [m, p]);
137
+ const y = z(() => {
138
+ if (!s) return [];
139
+ let t = s;
140
+ if (b !== "all" && (t = t.filter((n) => n.mode === b)), f) {
141
+ const n = f.toLowerCase();
142
+ t = t.filter(
143
+ (i) => {
144
+ var C;
145
+ return i.title.toLowerCase().includes(n) || ((C = i.tags) == null ? void 0 : C.some((k) => k.includes(n)));
146
+ }
147
+ );
148
+ }
149
+ return t;
150
+ }, [s, b, f]);
151
+ return /* @__PURE__ */ d(
152
+ "div",
153
+ {
154
+ ref: x,
155
+ className: "pagehub-sdk-root border-base-300 bg-base-200 fixed z-[1200] w-64 rounded-xl border shadow-xl",
156
+ style: { top: u.top, left: u.left },
157
+ children: [
158
+ /* @__PURE__ */ d("div", { className: "border-base-300 flex items-center gap-1.5 border-b px-2 py-1.5", children: [
159
+ /* @__PURE__ */ e(X, { className: "text-neutral-content size-3.5 shrink-0" }),
160
+ /* @__PURE__ */ e(
161
+ "input",
162
+ {
163
+ type: "text",
164
+ placeholder: "Search patterns...",
165
+ value: f,
166
+ onChange: (t) => N(t.target.value),
167
+ className: "placeholder:text-neutral-content w-full bg-transparent text-xs outline-none",
168
+ autoFocus: !0
169
+ }
170
+ ),
171
+ f && /* @__PURE__ */ e(
172
+ "button",
173
+ {
174
+ onClick: () => N(""),
175
+ className: "text-neutral-content hover:text-base-content",
176
+ children: /* @__PURE__ */ e(Z, { className: "size-3" })
177
+ }
178
+ )
179
+ ] }),
180
+ /* @__PURE__ */ d("div", { className: "border-base-300 flex gap-1 border-b px-2 py-1", children: [
181
+ ["all", "stroke", "fill"].map((t) => /* @__PURE__ */ e(
182
+ "button",
183
+ {
184
+ onClick: () => S(t),
185
+ className: `rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${b === t ? "bg-primary text-primary-content" : "text-neutral-content hover:bg-neutral"}`,
186
+ children: t.charAt(0).toUpperCase() + t.slice(1)
187
+ },
188
+ t
189
+ )),
190
+ /* @__PURE__ */ e("span", { className: "text-neutral-content ml-auto self-center text-[10px]", children: y.length })
191
+ ] }),
192
+ /* @__PURE__ */ e("div", { className: "scrollbar-light max-h-48 overflow-y-auto", children: s ? y.length === 0 ? /* @__PURE__ */ e("div", { className: "text-neutral-content px-3 py-6 text-center text-xs", children: "No patterns found" }) : y.map((t) => {
193
+ const n = V(t);
194
+ return /* @__PURE__ */ d(
195
+ "button",
196
+ {
197
+ onClick: () => l(t),
198
+ className: `hover:bg-neutral flex w-full items-center gap-2 px-2 py-1 text-left transition-colors ${o === t.slug ? "bg-primary/10" : ""}`,
199
+ children: [
200
+ /* @__PURE__ */ e(
201
+ "div",
202
+ {
203
+ className: "border-base-300 bg-base-200 h-10 w-16 shrink-0 rounded border",
204
+ style: { backgroundImage: n ? `url(${n})` : void 0 }
205
+ }
206
+ ),
207
+ /* @__PURE__ */ e("span", { className: "truncate text-xs", children: t.title })
208
+ ]
209
+ },
210
+ t.slug
211
+ );
212
+ }) : /* @__PURE__ */ e("div", { className: "text-neutral-content px-3 py-6 text-center text-xs", children: "Loading..." }) })
213
+ ]
214
+ }
215
+ );
216
+ };
217
+ function oe() {
218
+ var u, p;
219
+ const { pattern: o } = L((l) => {
220
+ var m, s, h;
221
+ return {
222
+ pattern: ((h = (s = (m = l.data) == null ? void 0 : m.props) == null ? void 0 : s.root) == null ? void 0 : h.pattern) || null
223
+ };
224
+ });
225
+ return /* @__PURE__ */ d("div", { className: "flex flex-col gap-2", children: [
226
+ /* @__PURE__ */ e(te, { propKey: "pattern", propType: "root" }),
227
+ o && /* @__PURE__ */ d(K, { children: [
228
+ /* @__PURE__ */ e("div", { className: "flex flex-col gap-1", children: [...Array(Math.max(0, +o.colors - 1)).keys()].map((l) => /* @__PURE__ */ e(
229
+ J,
230
+ {
231
+ propKey: `patternColor${l + 1}`,
232
+ label: `Color ${l + 1}`,
233
+ prefix: "",
234
+ propType: "root",
235
+ inline: !0
236
+ },
237
+ l
238
+ )) }),
239
+ /* @__PURE__ */ d("div", { className: "flex flex-col gap-0.5", children: [
240
+ /* @__PURE__ */ e(
241
+ g,
242
+ {
243
+ propKey: "patternZoom",
244
+ propType: "root",
245
+ type: "slider",
246
+ label: "Scale",
247
+ max: o.maxScale,
248
+ min: 1
249
+ }
250
+ ),
251
+ /* @__PURE__ */ e(
252
+ g,
253
+ {
254
+ propKey: "patternStroke",
255
+ propType: "root",
256
+ type: "slider",
257
+ label: "Stroke",
258
+ max: o.maxStroke || 5,
259
+ min: 0.5,
260
+ step: 0.5
261
+ }
262
+ ),
263
+ /* @__PURE__ */ e(
264
+ g,
265
+ {
266
+ propKey: "patternAngle",
267
+ propType: "root",
268
+ type: "slider",
269
+ label: "Angle",
270
+ max: 180,
271
+ min: 0
272
+ }
273
+ ),
274
+ /* @__PURE__ */ e(
275
+ g,
276
+ {
277
+ propKey: "patternSpacingX",
278
+ propType: "root",
279
+ type: "slider",
280
+ label: "X Gap",
281
+ max: ((u = o.maxSpacing) == null ? void 0 : u[0]) || 10,
282
+ min: 0
283
+ }
284
+ ),
285
+ /* @__PURE__ */ e(
286
+ g,
287
+ {
288
+ propKey: "patternSpacingY",
289
+ propType: "root",
290
+ type: "slider",
291
+ label: "Y Gap",
292
+ max: ((p = o.maxSpacing) == null ? void 0 : p[1]) || 10,
293
+ min: 0
294
+ }
295
+ ),
296
+ /* @__PURE__ */ e(
297
+ g,
298
+ {
299
+ propKey: "patternVerticalPosition",
300
+ propType: "root",
301
+ type: "slider",
302
+ label: "Offset Y",
303
+ max: 0,
304
+ min: -120
305
+ }
306
+ ),
307
+ /* @__PURE__ */ e(
308
+ g,
309
+ {
310
+ propKey: "patternHorizontalPosition",
311
+ propType: "root",
312
+ type: "slider",
313
+ label: "Offset X",
314
+ max: 0,
315
+ min: -120
316
+ }
317
+ )
318
+ ] })
319
+ ] }),
320
+ !o && /* @__PURE__ */ e("p", { className: "text-neutral-content py-2 text-center text-xs", children: "Select a pattern above to edit colors and settings." })
321
+ ] });
322
+ }
323
+ function me({
324
+ initialPosition: o,
325
+ onClose: u,
326
+ defaultWidth: p,
327
+ defaultHeight: l
328
+ }) {
329
+ return /* @__PURE__ */ e(
330
+ R,
331
+ {
332
+ isOpen: !0,
333
+ onClose: u,
334
+ title: "Pattern",
335
+ storageKey: "pattern-input",
336
+ autoSize: !1,
337
+ defaultWidth: p,
338
+ defaultHeight: l,
339
+ minWidth: 260,
340
+ maxWidth: 420,
341
+ minHeight: 200,
342
+ initialPosition: o,
343
+ persistSize: !1,
344
+ zIndex: q,
345
+ scrollable: !0,
346
+ children: /* @__PURE__ */ e(oe, {})
347
+ }
348
+ );
349
+ }
350
+ export {
351
+ me as default
352
+ };
@@ -0,0 +1,26 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useEditor as f } from "@craftjs/core";
3
+ import { f4 as m, f5 as g, P as h, dr as u, f6 as p, f7 as w } from "./index-C66dAl3Q.js";
4
+ import { r as S } from "./resolveAnchorsViaCraft-Cixm6ZyJ.js";
5
+ function E({ target: s, size: r = "lg", ownerNodeId: n }) {
6
+ m();
7
+ const { query: i, selectedId: a } = f((y, b) => ({
8
+ selectedId: b.getEvent("selected").first()
9
+ })), e = S(s, n ?? a, i), d = !e, t = e ? g(e) === "shown" : !1, c = r === "sm" ? "size-5 rounded-md" : "px-2 rounded-md border border-base-300 bg-base-200/50", l = t ? u : p;
10
+ return /* @__PURE__ */ o(
11
+ "button",
12
+ {
13
+ type: "button",
14
+ disabled: d,
15
+ onClick: () => e && w(e),
16
+ "data-tooltip-id": h,
17
+ "data-tooltip-content": t ? "Hide target in editor" : "Show target in editor",
18
+ className: `text-neutral-content hover:bg-base-200 hover:text-base-content inline-flex shrink-0 items-center justify-center transition-colors disabled:opacity-40 ${c}`,
19
+ "aria-label": t ? "Hide target in editor" : "Show target in editor",
20
+ children: /* @__PURE__ */ o(l, { className: "size-3.5" })
21
+ }
22
+ );
23
+ }
24
+ export {
25
+ E as P
26
+ };
@@ -0,0 +1,82 @@
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { useNode as h, useEditor as f } from "@craftjs/core";
3
+ import { P as b, di as u } from "./index-C66dAl3Q.js";
4
+ const a = [];
5
+ function x(t) {
6
+ const n = a.findIndex((r) => r.id === t.id);
7
+ n >= 0 ? a[n] = t : a.push(t);
8
+ }
9
+ const k = [
10
+ { key: "canDrag", label: "Can drag", description: "Allow this node to be dragged" },
11
+ { key: "canDelete", label: "Can delete", description: "Allow this node to be deleted" },
12
+ { key: "canMoveIn", label: "Can drop into", description: "Allow children to be dropped in" },
13
+ {
14
+ key: "canMoveOut",
15
+ label: "Can move children out",
16
+ description: "Allow children to be moved out"
17
+ }
18
+ ];
19
+ function v() {
20
+ const { id: t, permissions: n, isCanvas: r } = h((e) => {
21
+ var s;
22
+ return {
23
+ id: e.id,
24
+ permissions: ((s = e.data.custom) == null ? void 0 : s.permissions) || {},
25
+ isCanvas: !!e.data.isCanvas
26
+ };
27
+ }), { actions: p } = f(), m = (e) => {
28
+ const d = n[e] === !1 ? void 0 : !1;
29
+ p.setCustom(t, (i) => {
30
+ i.permissions || (i.permissions = {}), d === void 0 ? (delete i.permissions[e], Object.keys(i.permissions).length === 0 && delete i.permissions) : i.permissions[e] = d;
31
+ });
32
+ };
33
+ if (t === "ROOT") return null;
34
+ const l = k.filter((e) => e.key === "canMoveIn" || e.key === "canMoveOut" ? r : !0), g = l.some((e) => n[e.key] === !1);
35
+ return /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: [
36
+ g && /* @__PURE__ */ o("p", { className: "text-warning mb-1 text-[10px] leading-tight", children: "Some actions are locked on this node." }),
37
+ l.map((e) => {
38
+ const s = n[e.key] === !1;
39
+ return /* @__PURE__ */ c(
40
+ "label",
41
+ {
42
+ className: "hover:bg-base-200/60 flex cursor-pointer items-center justify-between gap-2 rounded px-1.5 py-1 transition-colors",
43
+ "data-tooltip-id": b,
44
+ "data-tooltip-content": e.description,
45
+ children: [
46
+ /* @__PURE__ */ o(
47
+ "span",
48
+ {
49
+ className: `text-xs select-none ${s ? "text-base-content/50 line-through" : "text-base-content"}`,
50
+ children: e.label
51
+ }
52
+ ),
53
+ /* @__PURE__ */ o(
54
+ "input",
55
+ {
56
+ type: "checkbox",
57
+ checked: !s,
58
+ onChange: () => m(e.key),
59
+ className: "toggle toggle-xs toggle-primary"
60
+ }
61
+ )
62
+ ]
63
+ },
64
+ e.key
65
+ );
66
+ })
67
+ ] });
68
+ }
69
+ x({
70
+ id: "permissions",
71
+ title: "Permissions",
72
+ tab: "advanced",
73
+ icon: /* @__PURE__ */ o(u, {}),
74
+ keywords: ["permission", "lock", "drag", "delete", "edit", "move", "protect", "restrict"],
75
+ component: v,
76
+ sortOrder: 200,
77
+ defaultOpen: !1,
78
+ help: "Lock down what can be done with this node — prevent dragging, deleting, or dropping children."
79
+ });
80
+ export {
81
+ v as PermissionsSection
82
+ };
@@ -0,0 +1,35 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { useNode as c } from "@craftjs/core";
3
+ import { d as u, aE as f, fh as b } from "./index-C66dAl3Q.js";
4
+ import { C as I } from "./CraftListEditor-_TIy1ogW.js";
5
+ const L = f("preset_addchild_selected", null);
6
+ function x(A) {
7
+ const { id: l, presetName: m } = c((e) => {
8
+ var s, a;
9
+ return {
10
+ presetName: (a = (s = e.data) == null ? void 0 : s.custom) == null ? void 0 : a.preset
11
+ };
12
+ }), [n, i] = u(L), r = b(m), t = r == null ? void 0 : r.addChild;
13
+ return t ? /* @__PURE__ */ p(
14
+ I,
15
+ {
16
+ parentId: l,
17
+ mapItem: (e, s, a) => {
18
+ var d, o;
19
+ return {
20
+ label: t.childLabel ? t.childLabel(e, a) : ((o = (d = e == null ? void 0 : e.data) == null ? void 0 : d.custom) == null ? void 0 : o.displayName) || `Item ${a + 1}`
21
+ };
22
+ },
23
+ activeIndex: n,
24
+ setActiveIndex: i,
25
+ addLabel: t.label,
26
+ onAdd: ({ addNode: e }) => e(t.template()),
27
+ renderLabel: (e) => e.label,
28
+ renderPopover: () => null,
29
+ editTooltip: "Open in editor"
30
+ }
31
+ ) : null;
32
+ }
33
+ export {
34
+ x as PresetAddChildList
35
+ };