@pagehub/sdk 0.1.5 → 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,240 @@
1
+ import { jsxs as t, Fragment as c, jsx as e } from "react/jsx-runtime";
2
+ import { useNode as v, useEditor as T } from "@craftjs/core";
3
+ import { w as p, aD as f, an as S, aA as k, n as o } from "./index-C66dAl3Q.js";
4
+ import { useState as g } from "react";
5
+ import { C as x } from "./ConversionFields-Bpfl-SGP.js";
6
+ import { r as w, S as s } from "./helpers-Cll72tMn.js";
7
+ import { S as C } from "./SlotRenderer-CaLf_2_C.js";
8
+ const E = [
9
+ { value: "", label: "Form", icon: f },
10
+ { value: "loading", label: "Loading", icon: S },
11
+ { value: "loaded", label: "Submitted", icon: k }
12
+ ], U = () => {
13
+ const { id: m, props: r } = v((n) => {
14
+ var i;
15
+ return { props: (i = n.data) == null ? void 0 : i.props };
16
+ }), { actions: d } = T(), [a, u] = g(r.submissionType), b = r.view || "";
17
+ let l = "";
18
+ switch (a) {
19
+ case "iframe":
20
+ l = "Submit your form to a hidden iframe. Define your URL and method.";
21
+ break;
22
+ case "save":
23
+ l = "Save your data — view submissions when they occur.";
24
+ break;
25
+ case "emailSave":
26
+ l = "Save your data and email you upon submission.";
27
+ break;
28
+ case "custom":
29
+ l = "POST form data as JSON to a custom URL.";
30
+ break;
31
+ case "collection":
32
+ l = "Save each submission as a row in a collection.";
33
+ break;
34
+ }
35
+ return w({
36
+ Content: /* @__PURE__ */ t(c, { children: [
37
+ /* @__PURE__ */ t(p, { collapsible: !1, children: [
38
+ /* @__PURE__ */ e("div", { className: "bg-neutral flex gap-1 rounded-md p-1", children: E.map(({ value: n, label: i, icon: h }) => /* @__PURE__ */ t(
39
+ "button",
40
+ {
41
+ type: "button",
42
+ onClick: () => d.setProp(m, (y) => {
43
+ y.view = n;
44
+ }),
45
+ className: `flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-colors ${b === n ? "bg-base-100 text-base-content shadow-sm" : "text-neutral-content hover:text-base-content"}`,
46
+ children: [
47
+ /* @__PURE__ */ e(h, { className: "size-3.5" }),
48
+ i
49
+ ]
50
+ },
51
+ n
52
+ )) }),
53
+ /* @__PURE__ */ e(C, { id: "settings/ai-button" })
54
+ ] }),
55
+ /* @__PURE__ */ t(p, { title: "Submission", icon: s.Type, help: l, children: [
56
+ /* @__PURE__ */ e(
57
+ o,
58
+ {
59
+ propKey: "formName",
60
+ propType: "component",
61
+ type: "text",
62
+ label: "Form Name",
63
+ placeholder: "My Form",
64
+ labelHide: !0
65
+ }
66
+ ),
67
+ /* @__PURE__ */ t(
68
+ o,
69
+ {
70
+ propKey: "submissionType",
71
+ propType: "component",
72
+ type: "select",
73
+ label: "Type",
74
+ labelHide: !0,
75
+ onChange: (n) => u(n),
76
+ children: [
77
+ /* @__PURE__ */ e("option", { value: "", children: " " }),
78
+ /* @__PURE__ */ e("option", { children: "iframe" }),
79
+ /* @__PURE__ */ e("option", { value: "save", children: "Save" }),
80
+ /* @__PURE__ */ e("option", { value: "emailSave", children: "Email & Save" }),
81
+ /* @__PURE__ */ e("option", { value: "custom", children: "Custom URL" }),
82
+ /* @__PURE__ */ e("option", { value: "collection", children: "Collection Row" })
83
+ ]
84
+ }
85
+ ),
86
+ a === "collection" && /* @__PURE__ */ t(c, { children: [
87
+ /* @__PURE__ */ e(
88
+ o,
89
+ {
90
+ propKey: "collectionSlug",
91
+ propType: "component",
92
+ type: "text",
93
+ label: "Collection slug",
94
+ placeholder: "staff",
95
+ labelHide: !0
96
+ }
97
+ ),
98
+ /* @__PURE__ */ e(
99
+ o,
100
+ {
101
+ propKey: "collectionFieldMap",
102
+ propType: "component",
103
+ type: "textarea",
104
+ label: "Field map (JSON)",
105
+ placeholder: '{"name":"name","email":"email"}',
106
+ labelHide: !0
107
+ }
108
+ ),
109
+ /* @__PURE__ */ e(
110
+ o,
111
+ {
112
+ propKey: "collectionSkipEmail",
113
+ propType: "component",
114
+ type: "toggle",
115
+ label: "Email",
116
+ option: "Skip email notification",
117
+ on: "true"
118
+ }
119
+ )
120
+ ] }),
121
+ a === "emailSave" && /* @__PURE__ */ e(
122
+ o,
123
+ {
124
+ propKey: "mailto",
125
+ propType: "component",
126
+ type: "text",
127
+ label: "Mail to",
128
+ placeholder: "you@domain.com",
129
+ labelHide: !0
130
+ }
131
+ ),
132
+ (a === "iframe" || a === "custom") && /* @__PURE__ */ t(c, { children: [
133
+ /* @__PURE__ */ e(
134
+ o,
135
+ {
136
+ propKey: "action",
137
+ propType: "component",
138
+ type: "text",
139
+ label: "Action",
140
+ placeholder: "https://...",
141
+ labelHide: !0
142
+ }
143
+ ),
144
+ /* @__PURE__ */ t(o, { propKey: "method", propType: "component", type: "select", label: "method", children: [
145
+ /* @__PURE__ */ e("option", { value: "POST", children: "POST" }),
146
+ /* @__PURE__ */ e("option", { value: "GET", children: "GET" })
147
+ ] })
148
+ ] })
149
+ ] }),
150
+ /* @__PURE__ */ t(
151
+ p,
152
+ {
153
+ title: "After Submit",
154
+ icon: s.Type,
155
+ help: "What happens after the form is submitted successfully.",
156
+ children: [
157
+ /* @__PURE__ */ t(
158
+ o,
159
+ {
160
+ propKey: "successAction",
161
+ propType: "component",
162
+ type: "select",
163
+ label: "Action",
164
+ labelHide: !0,
165
+ children: [
166
+ /* @__PURE__ */ e("option", { value: "", children: "Show thank you message" }),
167
+ /* @__PURE__ */ e("option", { value: "redirect", children: "Redirect to URL" })
168
+ ]
169
+ }
170
+ ),
171
+ r.successAction === "redirect" && /* @__PURE__ */ e(
172
+ o,
173
+ {
174
+ propKey: "successUrl",
175
+ propType: "component",
176
+ type: "text",
177
+ label: "Redirect URL",
178
+ placeholder: "https://example.com/thank-you",
179
+ labelHide: !0
180
+ }
181
+ )
182
+ ]
183
+ }
184
+ ),
185
+ (a === "save" || a === "emailSave") && /* @__PURE__ */ t(
186
+ p,
187
+ {
188
+ title: "Webhook",
189
+ icon: s.Type,
190
+ help: "Send form data to an external URL on every submission. Works with Zapier, Make, n8n, or any webhook endpoint.",
191
+ children: [
192
+ /* @__PURE__ */ e(
193
+ o,
194
+ {
195
+ propKey: "webhookEnabled",
196
+ propType: "component",
197
+ type: "toggle",
198
+ label: "Webhook",
199
+ option: "Enable",
200
+ on: "true"
201
+ }
202
+ ),
203
+ r.webhookEnabled && /* @__PURE__ */ e(
204
+ o,
205
+ {
206
+ propKey: "webhookUrl",
207
+ propType: "component",
208
+ type: "text",
209
+ label: "Webhook URL",
210
+ placeholder: "https://hooks.zapier.com/...",
211
+ labelHide: !0
212
+ }
213
+ )
214
+ ]
215
+ }
216
+ ),
217
+ /* @__PURE__ */ e(
218
+ p,
219
+ {
220
+ title: "Conversion tracking",
221
+ icon: s.Type,
222
+ help: "Fire a Google Ads / GA4 / Meta conversion when the form submits. Configure site-level integration IDs in your site's settings first.",
223
+ children: /* @__PURE__ */ e(
224
+ x,
225
+ {
226
+ conversion: r.conversion,
227
+ onChange: (n) => d.setProp(m, (i) => {
228
+ i.conversion = n;
229
+ }),
230
+ fallbackEventName: "Lead"
231
+ }
232
+ )
233
+ }
234
+ )
235
+ ] })
236
+ });
237
+ };
238
+ export {
239
+ U as FormMainTab
240
+ };
@@ -0,0 +1,103 @@
1
+ import { jsxs as T, Fragment as _, jsx as p } from "react/jsx-runtime";
2
+ import { useNode as j } from "@craftjs/core";
3
+ import { useState as k, useMemo as n, Suspense as L, lazy as z } from "react";
4
+ import { C as W, eS as B, s as F } from "./index-C66dAl3Q.js";
5
+ import { u as H } from "./usePopoverAutoOpen-CxIjt0ez.js";
6
+ import { u as M } from "./usePopoverPosition-83Vti7Aw.js";
7
+ const V = z(() => import("./GradientPanel-DSRQKkaB.js")), q = 320, J = {
8
+ "bg-linear-to-t": "to top",
9
+ "bg-linear-to-tr": "to top right",
10
+ "bg-linear-to-r": "to right",
11
+ "bg-linear-to-br": "to bottom right",
12
+ "bg-linear-to-b": "to bottom",
13
+ "bg-linear-to-bl": "to bottom left",
14
+ "bg-linear-to-l": "to left",
15
+ "bg-linear-to-tl": "to top left"
16
+ }, K = {
17
+ "bg-linear-to-tl": "↖",
18
+ "bg-linear-to-t": "↑",
19
+ "bg-linear-to-tr": "↗",
20
+ "bg-linear-to-r": "→",
21
+ "bg-linear-to-br": "↘",
22
+ "bg-linear-to-b": "↓",
23
+ "bg-linear-to-bl": "↙",
24
+ "bg-linear-to-l": "←"
25
+ }, Q = (o) => {
26
+ var e;
27
+ return ((e = o.match(/\bbg-linear-to-(?:t|tr|r|br|b|bl|l|tl)\b/)) == null ? void 0 : e[0]) || "";
28
+ }, d = (o, e) => {
29
+ var r;
30
+ return ((r = o.match(new RegExp(`\\b${e}-\\[([^\\]]+)\\]`))) == null ? void 0 : r[1]) || "";
31
+ }, f = (o, e) => {
32
+ const r = o.match(new RegExp(`\\b${e}-(\\d+)%`));
33
+ return r ? parseInt(r[1]) : null;
34
+ };
35
+ function et({ def: o }) {
36
+ const [e, r] = k(!1), { triggerRef: S, initialPos: I, setInitialPos: y, computePosition: A } = M(q), {
37
+ actions: { setProp: R },
38
+ id: w,
39
+ className: t
40
+ } = j((a) => {
41
+ var l, i;
42
+ return {
43
+ id: a.id,
44
+ className: typeof ((i = (l = a.data) == null ? void 0 : l.props) == null ? void 0 : i.className) == "string" ? a.data.props.className : ""
45
+ };
46
+ }), b = n(() => Q(t), [t]), s = !!b, $ = n(() => d(t, "from"), [t]), v = n(() => d(t, "via"), [t]), h = n(() => d(t, "to"), [t]), m = n(() => f(t, "from"), [t]), u = n(() => f(t, "via"), [t]), g = n(() => f(t, "to"), [t]), G = n(() => {
47
+ if (!s) return null;
48
+ const a = J[b] || "to bottom", l = $ || "transparent", i = h || "transparent", c = v, N = `${l}${m != null ? ` ${m}%` : ""}`, C = `${i}${g != null ? ` ${g}%` : ""}`, x = c ? `${c}${u != null ? ` ${u}%` : ""}` : null, E = x ? `${N}, ${x}, ${C}` : `${N}, ${C}`;
49
+ return `linear-gradient(${a}, ${E})`;
50
+ }, [s, b, $, v, h, m, u, g]), P = () => {
51
+ y(A()), r(!0);
52
+ };
53
+ H({ nodeId: w, defId: o == null ? void 0 : o.id, onOpen: P });
54
+ const O = () => {
55
+ R((a) => {
56
+ const l = typeof a.className == "string" ? a.className : "";
57
+ a.className = l.trim().split(/\s+/).filter((i) => {
58
+ if (!i) return !1;
59
+ const { base: c } = F(i);
60
+ return !(/^bg-linear-to-(?:t|tr|r|br|b|bl|l|tl)$/.test(c) || /^(?:from|via|to)-\[[^\]]+\]$/.test(c) || /^(?:from|via|to)-\d+%$/.test(c));
61
+ }).join(" ");
62
+ });
63
+ }, D = (o == null ? void 0 : o.label) ?? "Gradient";
64
+ return /* @__PURE__ */ T(_, { children: [
65
+ /* @__PURE__ */ p(
66
+ W,
67
+ {
68
+ mode: "popover",
69
+ ref: S,
70
+ label: D,
71
+ open: e,
72
+ onTriggerClick: () => e ? r(!1) : P(),
73
+ onClear: () => {
74
+ e && r(!1), O();
75
+ },
76
+ triggerAriaLabel: s ? "Edit gradient" : "Add gradient",
77
+ clearAriaLabel: "Clear gradient",
78
+ variant: s ? "preview" : "default",
79
+ leading: s ? /* @__PURE__ */ p(
80
+ "span",
81
+ {
82
+ className: "absolute inset-0",
83
+ style: { background: G || void 0 },
84
+ "aria-hidden": !0
85
+ }
86
+ ) : /* @__PURE__ */ p(B, { className: "size-3.5", "aria-hidden": !0 }),
87
+ summary: s ? null : "Add...",
88
+ previewOverlay: s ? /* @__PURE__ */ p(
89
+ "span",
90
+ {
91
+ className: "bg-base-100/80 text-base-content relative rounded px-1.5 py-0.5 text-[10px] font-semibold shadow-sm",
92
+ "aria-hidden": !0,
93
+ children: K[b] || ""
94
+ }
95
+ ) : null
96
+ }
97
+ ),
98
+ e && /* @__PURE__ */ p(L, { fallback: null, children: /* @__PURE__ */ p(V, { initialPosition: I, onClose: () => r(!1) }) })
99
+ ] });
100
+ }
101
+ export {
102
+ et as default
103
+ };
@@ -0,0 +1,194 @@
1
+ import { jsxs as x, jsx as a } from "react/jsx-runtime";
2
+ import { F as S } from "./FloatingPanel-DJP5Vhua.js";
3
+ import { useEditor as V, useNode as D } from "@craftjs/core";
4
+ import { u as G, V as K, E as W, T as F, P as L, c as B, e as j, W as H } from "./index-C66dAl3Q.js";
5
+ import { C as M } from "./ColorInput-BSfMNt86.js";
6
+ import { useMemo as s, useCallback as U } from "react";
7
+ const q = {
8
+ "bg-linear-to-tl": "↖",
9
+ "bg-linear-to-t": "↑",
10
+ "bg-linear-to-tr": "↗",
11
+ "bg-linear-to-r": "→",
12
+ "bg-linear-to-br": "↘",
13
+ "bg-linear-to-b": "↓",
14
+ "bg-linear-to-bl": "↙",
15
+ "bg-linear-to-l": "←"
16
+ }, z = {
17
+ "bg-linear-to-t": "to top",
18
+ "bg-linear-to-tr": "to top right",
19
+ "bg-linear-to-r": "to right",
20
+ "bg-linear-to-br": "to bottom right",
21
+ "bg-linear-to-b": "to bottom",
22
+ "bg-linear-to-bl": "to bottom left",
23
+ "bg-linear-to-l": "to left",
24
+ "bg-linear-to-tl": "to top left"
25
+ }, Y = [
26
+ "bg-linear-to-tl",
27
+ "bg-linear-to-t",
28
+ "bg-linear-to-tr",
29
+ "bg-linear-to-r",
30
+ "bg-linear-to-br",
31
+ "bg-linear-to-b",
32
+ "bg-linear-to-bl",
33
+ "bg-linear-to-l"
34
+ ], Z = (r) => {
35
+ var o;
36
+ return ((o = r.match(/\bbg-linear-to-(?:t|tr|r|br|b|bl|l|tl)\b/)) == null ? void 0 : o[0]) || "";
37
+ }, v = (r, o) => {
38
+ var e;
39
+ return ((e = r.match(new RegExp(`\\b${o}-\\[([^\\]]+)\\]`))) == null ? void 0 : e[1]) || "";
40
+ }, $ = (r, o) => {
41
+ const e = r.match(new RegExp(`\\b${o}-(\\d+)%`));
42
+ return e ? parseInt(e[1]) : null;
43
+ }, J = (r, o, e) => {
44
+ const l = r.replace(new RegExp(`\\s*\\b${o}-\\d+%`, "g"), "");
45
+ return e === null ? l.trim() : `${l.trim()} ${o}-${e}%`;
46
+ }, Q = () => {
47
+ const r = G(K), o = G(W).dark ?? !1, { actions: e, query: l } = V(), {
48
+ actions: { setProp: i },
49
+ props: p,
50
+ id: k
51
+ } = D((t) => {
52
+ var c;
53
+ return { props: (c = t.data) == null ? void 0 : c.props, id: t.id };
54
+ }), n = (p == null ? void 0 : p.className) || "", b = s(() => Z(n), [n]), m = !!b, C = s(() => v(n, "from"), [n]), P = s(() => v(n, "to"), [n]), R = s(() => v(n, "via"), [n]), g = s(() => $(n, "from"), [n]), d = s(() => $(n, "via"), [n]), u = s(() => $(n, "to"), [n]), _ = j(r), y = (t) => {
55
+ B({
56
+ propKey: "backgroundGradient",
57
+ propType: "class",
58
+ value: t,
59
+ setProp: i,
60
+ query: l,
61
+ actions: e,
62
+ nodeId: k,
63
+ view: _,
64
+ classDark: o
65
+ });
66
+ }, h = U(
67
+ (t, c) => {
68
+ i((f) => {
69
+ f.className = J(f.className || "", t, c);
70
+ }, 500);
71
+ },
72
+ [i]
73
+ ), A = s(() => {
74
+ if (!m) return null;
75
+ const t = z[b] || "to bottom", c = C || "transparent", f = P || "transparent", w = R, I = `${c}${g != null ? ` ${g}%` : ""}`, T = `${f}${u != null ? ` ${u}%` : ""}`, E = w ? `${w}${d != null ? ` ${d}%` : ""}` : null, O = E ? `${I}, ${E}, ${T}` : `${I}, ${T}`;
76
+ return `linear-gradient(${t}, ${O})`;
77
+ }, [m, b, C, P, R, g, d, u]);
78
+ return /* @__PURE__ */ x("div", { className: "flex flex-col gap-2", children: [
79
+ /* @__PURE__ */ a(
80
+ F,
81
+ {
82
+ tooltipId: L,
83
+ value: b,
84
+ onChange: (t) => y(b === t ? "" : t),
85
+ options: Y.map((t) => ({
86
+ value: t,
87
+ label: q[t],
88
+ tooltip: t.replace("bg-linear-to-", "to ").toUpperCase()
89
+ }))
90
+ }
91
+ ),
92
+ m && /* @__PURE__ */ a(
93
+ "div",
94
+ {
95
+ className: "border-base-300 h-5 w-full rounded border",
96
+ style: { background: A || void 0 }
97
+ }
98
+ ),
99
+ m && /* @__PURE__ */ x("div", { className: "flex flex-col gap-2", children: [
100
+ /* @__PURE__ */ a(
101
+ N,
102
+ {
103
+ label: "From",
104
+ propKey: "backgroundGradientFrom",
105
+ prefix: "from",
106
+ position: g,
107
+ onPosition: (t) => h("from", t)
108
+ }
109
+ ),
110
+ /* @__PURE__ */ a(
111
+ N,
112
+ {
113
+ label: "Via",
114
+ propKey: "backgroundGradientVia",
115
+ prefix: "via",
116
+ position: d,
117
+ onPosition: (t) => h("via", t)
118
+ }
119
+ ),
120
+ /* @__PURE__ */ a(
121
+ N,
122
+ {
123
+ label: "To",
124
+ propKey: "backgroundGradientTo",
125
+ prefix: "to",
126
+ position: u,
127
+ onPosition: (t) => h("to", t)
128
+ }
129
+ ),
130
+ /* @__PURE__ */ a(
131
+ "button",
132
+ {
133
+ type: "button",
134
+ onClick: () => y(""),
135
+ className: "text-neutral-content hover:text-error self-end text-[10px] transition-colors",
136
+ children: "Remove gradient"
137
+ }
138
+ )
139
+ ] })
140
+ ] });
141
+ }, N = ({
142
+ label: r,
143
+ propKey: o,
144
+ prefix: e,
145
+ position: l,
146
+ onPosition: i
147
+ }) => /* @__PURE__ */ x("div", { className: "flex flex-col gap-0.5", children: [
148
+ /* @__PURE__ */ a(M, { propKey: o, label: r, prefix: e, propType: "class" }),
149
+ /* @__PURE__ */ x("div", { className: "flex items-center gap-1.5 pl-[52px]", children: [
150
+ /* @__PURE__ */ a(
151
+ "input",
152
+ {
153
+ type: "range",
154
+ min: 0,
155
+ max: 100,
156
+ step: 5,
157
+ value: l ?? (e === "from" ? 0 : e === "to" ? 100 : 50),
158
+ onChange: (p) => i(parseInt(p.target.value)),
159
+ className: "slider bg-neutral h-1.5 flex-1 cursor-pointer appearance-none rounded-lg"
160
+ }
161
+ ),
162
+ /* @__PURE__ */ a("span", { className: "text-neutral-content w-7 text-right text-[10px] tabular-nums", children: l != null ? `${l}%` : "—" }),
163
+ l != null && /* @__PURE__ */ a(
164
+ "button",
165
+ {
166
+ type: "button",
167
+ onClick: () => i(null),
168
+ className: "text-neutral-content hover:text-error text-[10px]",
169
+ children: "×"
170
+ }
171
+ )
172
+ ] })
173
+ ] });
174
+ function at({ initialPosition: r, onClose: o }) {
175
+ return /* @__PURE__ */ a(
176
+ S,
177
+ {
178
+ isOpen: !0,
179
+ onClose: o,
180
+ title: "Gradient",
181
+ storageKey: "gradient-input",
182
+ minWidth: 280,
183
+ maxWidth: 480,
184
+ minHeight: 320,
185
+ initialPosition: r,
186
+ zIndex: H,
187
+ scrollable: !0,
188
+ children: /* @__PURE__ */ a(Q, {})
189
+ }
190
+ );
191
+ }
192
+ export {
193
+ at as default
194
+ };
@@ -0,0 +1,69 @@
1
+ import { jsxs as d, jsx as m } from "react/jsx-runtime";
2
+ import { C as p, l as u } from "./CodeEditor-axBXmPH8.js";
3
+ const f = u((r) => {
4
+ const e = [], t = r.state.doc.toString();
5
+ try {
6
+ const s = (t.match(/<script[^>]*>/gi) || []).length, n = (t.match(/<\/script>/gi) || []).length;
7
+ s !== n && e.push({
8
+ from: 0,
9
+ to: t.length,
10
+ severity: "error",
11
+ message: "Unclosed <script> tags detected"
12
+ });
13
+ const o = (t.match(/<style[^>]*>/gi) || []).length, c = (t.match(/<\/style>/gi) || []).length;
14
+ o !== c && e.push({
15
+ from: 0,
16
+ to: t.length,
17
+ severity: "error",
18
+ message: "Unclosed <style> tags detected"
19
+ }), t.split(`
20
+ `).forEach((l, i) => {
21
+ const g = l.trim();
22
+ if (g.includes('="') && !g.includes('"')) {
23
+ const h = t.split(`
24
+ `).slice(0, i).join(`
25
+ `).length + i;
26
+ e.push({
27
+ from: h,
28
+ to: h + l.length,
29
+ severity: "warning",
30
+ message: "Unclosed quote in attribute"
31
+ });
32
+ }
33
+ });
34
+ } catch {
35
+ }
36
+ return e;
37
+ }), C = ({
38
+ value: r,
39
+ onChange: e,
40
+ placeholder: t = "<script>...<\/script>",
41
+ height: s = "200px",
42
+ label: n,
43
+ helpText: o,
44
+ className: c = "",
45
+ formatMountKey: a,
46
+ variableCompletionOptions: l,
47
+ editorContainerClassName: i
48
+ }) => /* @__PURE__ */ d("div", { className: `flex flex-col gap-2 ${c}`, children: [
49
+ n && /* @__PURE__ */ m("label", { className: "toolbar-label block font-medium", children: n }),
50
+ /* @__PURE__ */ m(
51
+ p,
52
+ {
53
+ value: r,
54
+ onChange: e,
55
+ language: "html",
56
+ extensions: [f],
57
+ height: s,
58
+ placeholder: t,
59
+ autoFormatOnMount: !!a,
60
+ autoFormatMountKey: a,
61
+ htmlVariableCompletionOptions: l,
62
+ containerClassName: i
63
+ }
64
+ ),
65
+ o && /* @__PURE__ */ m("p", { className: "text-neutral-content text-xs", children: o })
66
+ ] });
67
+ export {
68
+ C as HTMLCodeInput
69
+ };