@measured/puck 0.21.0-canary.eb8ea5ce → 0.21.0-canary.ece26d91
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/{Editor-DR57V55X.mjs → Editor-O447AVCX.mjs} +17 -7
- package/dist/{Render-6Q5WP25Y.mjs → Render-OFE6QLI2.mjs} +8 -4
- package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-ONhOkrvf.d.mts} +1 -27
- package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-ONhOkrvf.d.ts} +1 -27
- package/dist/chunk-2Q4PACDA.mjs +111 -0
- package/dist/chunk-62AAYNXG.mjs +63 -0
- package/dist/chunk-BSDEIOEK.mjs +706 -0
- package/dist/chunk-CSSRLPHM.mjs +11 -0
- package/dist/{chunk-OPXWLTPM.mjs → chunk-DAQLMM2T.mjs} +1377 -2795
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/{chunk-YZQENDBP.mjs → chunk-NLUHDYVR.mjs} +2 -123
- package/dist/chunk-PLXSMBAA.mjs +53 -0
- package/dist/chunk-QAWJTCV5.mjs +33 -0
- package/dist/chunk-QBGM4ELA.mjs +528 -0
- package/dist/{chunk-MSIUWPEI.mjs → chunk-QBJ2LDJB.mjs} +36 -20
- package/dist/chunk-T3WX7XJ6.mjs +132 -0
- package/dist/{chunk-CF5XA6LF.mjs → chunk-V5I7CVLT.mjs} +1 -1
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/{chunk-A7EMVTSK.mjs → chunk-Y656T6AQ.mjs} +13 -7
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-BEMDJKDS.mjs +93 -0
- package/dist/index-BEoNHRI1.d.ts +116 -0
- package/dist/index-DfxZ7tZF.d.mts +116 -0
- package/dist/index.d.mts +9 -125
- package/dist/index.d.ts +9 -125
- package/dist/index.js +1002 -775
- package/dist/index.mjs +14 -5
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +908 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-JU3A7Y4L.mjs +57 -0
- package/dist/loaded-N3FYGF2Y.mjs +57 -0
- package/dist/loaded-OBY7OMS6.mjs +60 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/no-external.d.mts +3 -1
- package/dist/no-external.d.ts +3 -1
- package/dist/no-external.js +1002 -775
- package/dist/no-external.mjs +14 -5
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.mjs +6 -3
- package/dist/walk-tree-CdriEzFJ.d.mts +29 -0
- package/dist/walk-tree-DHbAZ4wF.d.ts +29 -0
- package/package.json +7 -2
- package/dist/chunk-GQ457KMA.mjs +0 -199
package/dist/no-external.js
CHANGED
|
@@ -3968,60 +3968,114 @@ var init_SelectControl = __esm({
|
|
|
3968
3968
|
}
|
|
3969
3969
|
});
|
|
3970
3970
|
|
|
3971
|
-
// components/RichTextMenu/controls/AlignSelect.
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
}
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3971
|
+
// components/RichTextMenu/controls/AlignSelect/use-options.ts
|
|
3972
|
+
var import_react22, optionNodes, useAlignOptions;
|
|
3973
|
+
var init_use_options = __esm({
|
|
3974
|
+
"components/RichTextMenu/controls/AlignSelect/use-options.ts"() {
|
|
3975
|
+
"use strict";
|
|
3976
|
+
init_react_import();
|
|
3977
|
+
import_react22 = require("react");
|
|
3978
|
+
init_lucide_react();
|
|
3979
|
+
optionNodes = {
|
|
3980
|
+
left: { label: "Left", icon: AlignLeft },
|
|
3981
|
+
center: { label: "Center", icon: AlignCenter },
|
|
3982
|
+
right: { label: "Right", icon: AlignRight },
|
|
3983
|
+
justify: { label: "Justify", icon: AlignJustify }
|
|
3984
|
+
};
|
|
3985
|
+
useAlignOptions = (fieldOptions) => {
|
|
3986
|
+
var _a;
|
|
3987
|
+
let blockOptions = [];
|
|
3988
|
+
if ((fieldOptions == null ? void 0 : fieldOptions.textAlign) !== false) {
|
|
3989
|
+
if (!((_a = fieldOptions == null ? void 0 : fieldOptions.textAlign) == null ? void 0 : _a.alignments)) {
|
|
3990
|
+
blockOptions = ["left", "center", "right", "justify"];
|
|
3991
|
+
} else {
|
|
3992
|
+
if (fieldOptions == null ? void 0 : fieldOptions.textAlign.alignments.includes("left")) {
|
|
3993
|
+
blockOptions.push("left");
|
|
3994
|
+
}
|
|
3995
|
+
if (fieldOptions == null ? void 0 : fieldOptions.textAlign.alignments.includes("center")) {
|
|
3996
|
+
blockOptions.push("center");
|
|
3997
|
+
}
|
|
3998
|
+
if (fieldOptions == null ? void 0 : fieldOptions.textAlign.alignments.includes("right")) {
|
|
3999
|
+
blockOptions.push("right");
|
|
4000
|
+
}
|
|
4001
|
+
if (fieldOptions == null ? void 0 : fieldOptions.textAlign.alignments.includes("justify")) {
|
|
4002
|
+
blockOptions.push("justify");
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
3991
4005
|
}
|
|
4006
|
+
return (0, import_react22.useMemo)(
|
|
4007
|
+
() => blockOptions.map((item) => ({
|
|
4008
|
+
value: item,
|
|
4009
|
+
label: optionNodes[item].label,
|
|
4010
|
+
icon: optionNodes[item].icon
|
|
4011
|
+
})),
|
|
4012
|
+
[blockOptions]
|
|
4013
|
+
);
|
|
4014
|
+
};
|
|
4015
|
+
}
|
|
4016
|
+
});
|
|
4017
|
+
|
|
4018
|
+
// components/RichTextMenu/controls/AlignSelect/fallback.tsx
|
|
4019
|
+
function AlignSelectFallback() {
|
|
4020
|
+
const ctx = useControlContext();
|
|
4021
|
+
const alignOptions = useAlignOptions(ctx.options);
|
|
4022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4023
|
+
SelectControl,
|
|
4024
|
+
{
|
|
4025
|
+
options: alignOptions,
|
|
4026
|
+
onChange: () => {
|
|
4027
|
+
},
|
|
4028
|
+
value: "left",
|
|
4029
|
+
defaultValue: "left",
|
|
4030
|
+
renderDefaultIcon: AlignLeft
|
|
3992
4031
|
}
|
|
4032
|
+
);
|
|
4033
|
+
}
|
|
4034
|
+
var import_jsx_runtime24;
|
|
4035
|
+
var init_fallback = __esm({
|
|
4036
|
+
"components/RichTextMenu/controls/AlignSelect/fallback.tsx"() {
|
|
4037
|
+
"use strict";
|
|
4038
|
+
init_react_import();
|
|
4039
|
+
init_use_control_context();
|
|
4040
|
+
init_lucide_react();
|
|
4041
|
+
init_SelectControl();
|
|
4042
|
+
init_use_options();
|
|
4043
|
+
import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3993
4044
|
}
|
|
4045
|
+
});
|
|
4046
|
+
|
|
4047
|
+
// components/RichTextMenu/controls/AlignSelect/loaded.tsx
|
|
4048
|
+
var loaded_exports = {};
|
|
4049
|
+
__export(loaded_exports, {
|
|
4050
|
+
AlignSelectLoaded: () => AlignSelectLoaded
|
|
4051
|
+
});
|
|
4052
|
+
function AlignSelectLoaded() {
|
|
4053
|
+
var _a;
|
|
4054
|
+
const { options } = useControlContext();
|
|
4055
|
+
const alignOptions = useAlignOptions(options);
|
|
3994
4056
|
const { editor } = useControlContext();
|
|
3995
|
-
const currentValue = (
|
|
4057
|
+
const currentValue = (_a = (0, import_react23.useEditorState)({
|
|
3996
4058
|
editor,
|
|
3997
4059
|
selector: (ctx) => {
|
|
3998
|
-
var _a2,
|
|
4060
|
+
var _a2, _b, _c, _d;
|
|
3999
4061
|
if ((_a2 = ctx.editor) == null ? void 0 : _a2.isActive({ textAlign: "center" })) {
|
|
4000
4062
|
return "center";
|
|
4001
|
-
} else if ((
|
|
4063
|
+
} else if ((_b = ctx.editor) == null ? void 0 : _b.isActive({ textAlign: "right" })) {
|
|
4002
4064
|
return "right";
|
|
4003
4065
|
} else if ((_c = ctx.editor) == null ? void 0 : _c.isActive({ textAlign: "justify" })) {
|
|
4004
4066
|
return "justify";
|
|
4005
4067
|
}
|
|
4006
4068
|
return (options == null ? void 0 : options.textAlign) ? (_d = options.textAlign.defaultAlignment) != null ? _d : "left" : "left";
|
|
4007
4069
|
}
|
|
4008
|
-
})) != null ?
|
|
4070
|
+
})) != null ? _a : "left";
|
|
4009
4071
|
const handleChange = (val) => {
|
|
4010
4072
|
const chain = editor == null ? void 0 : editor.chain();
|
|
4011
4073
|
chain == null ? void 0 : chain.focus().setTextAlign(val).run();
|
|
4012
4074
|
};
|
|
4013
|
-
|
|
4014
|
-
() => blockOptions.map((item) => ({
|
|
4015
|
-
value: item,
|
|
4016
|
-
label: optionNodes[item].label,
|
|
4017
|
-
icon: optionNodes[item].icon
|
|
4018
|
-
})),
|
|
4019
|
-
[blockOptions]
|
|
4020
|
-
);
|
|
4021
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4022
4076
|
SelectControl,
|
|
4023
4077
|
{
|
|
4024
|
-
options:
|
|
4078
|
+
options: alignOptions,
|
|
4025
4079
|
onChange: handleChange,
|
|
4026
4080
|
value: currentValue,
|
|
4027
4081
|
defaultValue: "left",
|
|
@@ -4029,33 +4083,45 @@ function AlignSelect() {
|
|
|
4029
4083
|
}
|
|
4030
4084
|
);
|
|
4031
4085
|
}
|
|
4032
|
-
var
|
|
4033
|
-
var
|
|
4034
|
-
"components/RichTextMenu/controls/AlignSelect.tsx"() {
|
|
4086
|
+
var import_react23, import_jsx_runtime25;
|
|
4087
|
+
var init_loaded = __esm({
|
|
4088
|
+
"components/RichTextMenu/controls/AlignSelect/loaded.tsx"() {
|
|
4035
4089
|
"use strict";
|
|
4036
4090
|
init_react_import();
|
|
4037
|
-
|
|
4091
|
+
import_react23 = require("@tiptap/react");
|
|
4038
4092
|
init_use_control_context();
|
|
4039
|
-
import_react23 = require("react");
|
|
4040
4093
|
init_lucide_react();
|
|
4041
4094
|
init_SelectControl();
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4095
|
+
init_use_options();
|
|
4096
|
+
import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4097
|
+
}
|
|
4098
|
+
});
|
|
4099
|
+
|
|
4100
|
+
// components/RichTextMenu/controls/AlignSelect/index.tsx
|
|
4101
|
+
var import_react24, import_jsx_runtime26, AlignSelectLoaded2, AlignSelect;
|
|
4102
|
+
var init_AlignSelect = __esm({
|
|
4103
|
+
"components/RichTextMenu/controls/AlignSelect/index.tsx"() {
|
|
4104
|
+
"use strict";
|
|
4105
|
+
init_react_import();
|
|
4106
|
+
import_react24 = require("react");
|
|
4107
|
+
init_fallback();
|
|
4108
|
+
import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4109
|
+
AlignSelectLoaded2 = (0, import_react24.lazy)(
|
|
4110
|
+
() => Promise.resolve().then(() => (init_loaded(), loaded_exports)).then((m) => ({
|
|
4111
|
+
default: m.AlignSelectLoaded
|
|
4112
|
+
}))
|
|
4113
|
+
);
|
|
4114
|
+
AlignSelect = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react24.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AlignSelectFallback, {}), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AlignSelectLoaded2, {}) });
|
|
4049
4115
|
}
|
|
4050
4116
|
});
|
|
4051
4117
|
|
|
4052
4118
|
// components/RichTextMenu/controls/Bold.tsx
|
|
4053
4119
|
function Bold2() {
|
|
4054
4120
|
const { editor, editorState } = useControlContext();
|
|
4055
|
-
return /* @__PURE__ */ (0,
|
|
4121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4056
4122
|
Control,
|
|
4057
4123
|
{
|
|
4058
|
-
icon: /* @__PURE__ */ (0,
|
|
4124
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Bold, {}),
|
|
4059
4125
|
onClick: (e) => {
|
|
4060
4126
|
e.stopPropagation();
|
|
4061
4127
|
editor == null ? void 0 : editor.chain().focus().toggleBold().run();
|
|
@@ -4066,7 +4132,7 @@ function Bold2() {
|
|
|
4066
4132
|
}
|
|
4067
4133
|
);
|
|
4068
4134
|
}
|
|
4069
|
-
var
|
|
4135
|
+
var import_jsx_runtime27;
|
|
4070
4136
|
var init_Bold = __esm({
|
|
4071
4137
|
"components/RichTextMenu/controls/Bold.tsx"() {
|
|
4072
4138
|
"use strict";
|
|
@@ -4074,17 +4140,17 @@ var init_Bold = __esm({
|
|
|
4074
4140
|
init_lucide_react();
|
|
4075
4141
|
init_Control();
|
|
4076
4142
|
init_use_control_context();
|
|
4077
|
-
|
|
4143
|
+
import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4078
4144
|
}
|
|
4079
4145
|
});
|
|
4080
4146
|
|
|
4081
4147
|
// components/RichTextMenu/controls/Italic.tsx
|
|
4082
4148
|
function Italic2() {
|
|
4083
4149
|
const { editor, editorState } = useControlContext();
|
|
4084
|
-
return /* @__PURE__ */ (0,
|
|
4150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4085
4151
|
Control,
|
|
4086
4152
|
{
|
|
4087
|
-
icon: /* @__PURE__ */ (0,
|
|
4153
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Italic, {}),
|
|
4088
4154
|
onClick: (e) => {
|
|
4089
4155
|
e.stopPropagation();
|
|
4090
4156
|
editor == null ? void 0 : editor.chain().focus().toggleItalic().run();
|
|
@@ -4095,7 +4161,7 @@ function Italic2() {
|
|
|
4095
4161
|
}
|
|
4096
4162
|
);
|
|
4097
4163
|
}
|
|
4098
|
-
var
|
|
4164
|
+
var import_jsx_runtime28;
|
|
4099
4165
|
var init_Italic = __esm({
|
|
4100
4166
|
"components/RichTextMenu/controls/Italic.tsx"() {
|
|
4101
4167
|
"use strict";
|
|
@@ -4103,17 +4169,17 @@ var init_Italic = __esm({
|
|
|
4103
4169
|
init_lucide_react();
|
|
4104
4170
|
init_Control();
|
|
4105
4171
|
init_use_control_context();
|
|
4106
|
-
|
|
4172
|
+
import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4107
4173
|
}
|
|
4108
4174
|
});
|
|
4109
4175
|
|
|
4110
4176
|
// components/RichTextMenu/controls/Underline.tsx
|
|
4111
4177
|
function Underline2() {
|
|
4112
4178
|
const { editor, editorState } = useControlContext();
|
|
4113
|
-
return /* @__PURE__ */ (0,
|
|
4179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4114
4180
|
Control,
|
|
4115
4181
|
{
|
|
4116
|
-
icon: /* @__PURE__ */ (0,
|
|
4182
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Underline, {}),
|
|
4117
4183
|
onClick: (e) => {
|
|
4118
4184
|
e.stopPropagation();
|
|
4119
4185
|
editor == null ? void 0 : editor.chain().focus().toggleUnderline().run();
|
|
@@ -4124,7 +4190,7 @@ function Underline2() {
|
|
|
4124
4190
|
}
|
|
4125
4191
|
);
|
|
4126
4192
|
}
|
|
4127
|
-
var
|
|
4193
|
+
var import_jsx_runtime29;
|
|
4128
4194
|
var init_Underline = __esm({
|
|
4129
4195
|
"components/RichTextMenu/controls/Underline.tsx"() {
|
|
4130
4196
|
"use strict";
|
|
@@ -4132,17 +4198,17 @@ var init_Underline = __esm({
|
|
|
4132
4198
|
init_lucide_react();
|
|
4133
4199
|
init_Control();
|
|
4134
4200
|
init_use_control_context();
|
|
4135
|
-
|
|
4201
|
+
import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4136
4202
|
}
|
|
4137
4203
|
});
|
|
4138
4204
|
|
|
4139
4205
|
// components/RichTextMenu/controls/Strikethrough.tsx
|
|
4140
4206
|
function Strikethrough2() {
|
|
4141
4207
|
const { editor, editorState } = useControlContext();
|
|
4142
|
-
return /* @__PURE__ */ (0,
|
|
4208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4143
4209
|
Control,
|
|
4144
4210
|
{
|
|
4145
|
-
icon: /* @__PURE__ */ (0,
|
|
4211
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Strikethrough, {}),
|
|
4146
4212
|
onClick: (e) => {
|
|
4147
4213
|
e.stopPropagation();
|
|
4148
4214
|
editor == null ? void 0 : editor.chain().focus().toggleStrike().run();
|
|
@@ -4153,7 +4219,7 @@ function Strikethrough2() {
|
|
|
4153
4219
|
}
|
|
4154
4220
|
);
|
|
4155
4221
|
}
|
|
4156
|
-
var
|
|
4222
|
+
var import_jsx_runtime30;
|
|
4157
4223
|
var init_Strikethrough = __esm({
|
|
4158
4224
|
"components/RichTextMenu/controls/Strikethrough.tsx"() {
|
|
4159
4225
|
"use strict";
|
|
@@ -4161,17 +4227,17 @@ var init_Strikethrough = __esm({
|
|
|
4161
4227
|
init_lucide_react();
|
|
4162
4228
|
init_Control();
|
|
4163
4229
|
init_use_control_context();
|
|
4164
|
-
|
|
4230
|
+
import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4165
4231
|
}
|
|
4166
4232
|
});
|
|
4167
4233
|
|
|
4168
4234
|
// components/RichTextMenu/controls/InlineCode.tsx
|
|
4169
4235
|
function InlineCode() {
|
|
4170
4236
|
const { editor, editorState } = useControlContext();
|
|
4171
|
-
return /* @__PURE__ */ (0,
|
|
4237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4172
4238
|
Control,
|
|
4173
4239
|
{
|
|
4174
|
-
icon: /* @__PURE__ */ (0,
|
|
4240
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Code, {}),
|
|
4175
4241
|
onClick: (e) => {
|
|
4176
4242
|
e.stopPropagation();
|
|
4177
4243
|
editor == null ? void 0 : editor.chain().focus().toggleCode().run();
|
|
@@ -4182,7 +4248,7 @@ function InlineCode() {
|
|
|
4182
4248
|
}
|
|
4183
4249
|
);
|
|
4184
4250
|
}
|
|
4185
|
-
var
|
|
4251
|
+
var import_jsx_runtime31;
|
|
4186
4252
|
var init_InlineCode = __esm({
|
|
4187
4253
|
"components/RichTextMenu/controls/InlineCode.tsx"() {
|
|
4188
4254
|
"use strict";
|
|
@@ -4190,17 +4256,17 @@ var init_InlineCode = __esm({
|
|
|
4190
4256
|
init_lucide_react();
|
|
4191
4257
|
init_Control();
|
|
4192
4258
|
init_use_control_context();
|
|
4193
|
-
|
|
4259
|
+
import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4194
4260
|
}
|
|
4195
4261
|
});
|
|
4196
4262
|
|
|
4197
4263
|
// components/RichTextMenu/controls/BulletList.tsx
|
|
4198
4264
|
function BulletList() {
|
|
4199
4265
|
const { editor, editorState } = useControlContext();
|
|
4200
|
-
return /* @__PURE__ */ (0,
|
|
4266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4201
4267
|
Control,
|
|
4202
4268
|
{
|
|
4203
|
-
icon: /* @__PURE__ */ (0,
|
|
4269
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(List, {}),
|
|
4204
4270
|
onClick: (e) => {
|
|
4205
4271
|
e.stopPropagation();
|
|
4206
4272
|
editor == null ? void 0 : editor.chain().focus().toggleBulletList().run();
|
|
@@ -4211,7 +4277,7 @@ function BulletList() {
|
|
|
4211
4277
|
}
|
|
4212
4278
|
);
|
|
4213
4279
|
}
|
|
4214
|
-
var
|
|
4280
|
+
var import_jsx_runtime32;
|
|
4215
4281
|
var init_BulletList = __esm({
|
|
4216
4282
|
"components/RichTextMenu/controls/BulletList.tsx"() {
|
|
4217
4283
|
"use strict";
|
|
@@ -4219,17 +4285,17 @@ var init_BulletList = __esm({
|
|
|
4219
4285
|
init_lucide_react();
|
|
4220
4286
|
init_Control();
|
|
4221
4287
|
init_use_control_context();
|
|
4222
|
-
|
|
4288
|
+
import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4223
4289
|
}
|
|
4224
4290
|
});
|
|
4225
4291
|
|
|
4226
4292
|
// components/RichTextMenu/controls/OrderedList.tsx
|
|
4227
4293
|
function OrderedList() {
|
|
4228
4294
|
const { editor, editorState } = useControlContext();
|
|
4229
|
-
return /* @__PURE__ */ (0,
|
|
4295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4230
4296
|
Control,
|
|
4231
4297
|
{
|
|
4232
|
-
icon: /* @__PURE__ */ (0,
|
|
4298
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ListOrdered, {}),
|
|
4233
4299
|
onClick: (e) => {
|
|
4234
4300
|
e.stopPropagation();
|
|
4235
4301
|
editor == null ? void 0 : editor.chain().focus().toggleOrderedList().run();
|
|
@@ -4240,7 +4306,7 @@ function OrderedList() {
|
|
|
4240
4306
|
}
|
|
4241
4307
|
);
|
|
4242
4308
|
}
|
|
4243
|
-
var
|
|
4309
|
+
var import_jsx_runtime33;
|
|
4244
4310
|
var init_OrderedList = __esm({
|
|
4245
4311
|
"components/RichTextMenu/controls/OrderedList.tsx"() {
|
|
4246
4312
|
"use strict";
|
|
@@ -4248,17 +4314,17 @@ var init_OrderedList = __esm({
|
|
|
4248
4314
|
init_lucide_react();
|
|
4249
4315
|
init_Control();
|
|
4250
4316
|
init_use_control_context();
|
|
4251
|
-
|
|
4317
|
+
import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4252
4318
|
}
|
|
4253
4319
|
});
|
|
4254
4320
|
|
|
4255
4321
|
// components/RichTextMenu/controls/CodeBlock.tsx
|
|
4256
4322
|
function CodeBlock() {
|
|
4257
4323
|
const { editor, editorState } = useControlContext();
|
|
4258
|
-
return /* @__PURE__ */ (0,
|
|
4324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4259
4325
|
Control,
|
|
4260
4326
|
{
|
|
4261
|
-
icon: /* @__PURE__ */ (0,
|
|
4327
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SquareCode, {}),
|
|
4262
4328
|
onClick: (e) => {
|
|
4263
4329
|
e.stopPropagation();
|
|
4264
4330
|
editor == null ? void 0 : editor.chain().focus().toggleCodeBlock().run();
|
|
@@ -4269,7 +4335,7 @@ function CodeBlock() {
|
|
|
4269
4335
|
}
|
|
4270
4336
|
);
|
|
4271
4337
|
}
|
|
4272
|
-
var
|
|
4338
|
+
var import_jsx_runtime34;
|
|
4273
4339
|
var init_CodeBlock = __esm({
|
|
4274
4340
|
"components/RichTextMenu/controls/CodeBlock.tsx"() {
|
|
4275
4341
|
"use strict";
|
|
@@ -4277,17 +4343,17 @@ var init_CodeBlock = __esm({
|
|
|
4277
4343
|
init_lucide_react();
|
|
4278
4344
|
init_Control();
|
|
4279
4345
|
init_use_control_context();
|
|
4280
|
-
|
|
4346
|
+
import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4281
4347
|
}
|
|
4282
4348
|
});
|
|
4283
4349
|
|
|
4284
4350
|
// components/RichTextMenu/controls/Blockquote.tsx
|
|
4285
4351
|
function Blockquote() {
|
|
4286
4352
|
const { editor, editorState } = useControlContext();
|
|
4287
|
-
return /* @__PURE__ */ (0,
|
|
4353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4288
4354
|
Control,
|
|
4289
4355
|
{
|
|
4290
|
-
icon: /* @__PURE__ */ (0,
|
|
4356
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Quote, {}),
|
|
4291
4357
|
onClick: (e) => {
|
|
4292
4358
|
e.stopPropagation();
|
|
4293
4359
|
editor == null ? void 0 : editor.chain().focus().toggleBlockquote().run();
|
|
@@ -4298,7 +4364,7 @@ function Blockquote() {
|
|
|
4298
4364
|
}
|
|
4299
4365
|
);
|
|
4300
4366
|
}
|
|
4301
|
-
var
|
|
4367
|
+
var import_jsx_runtime35;
|
|
4302
4368
|
var init_Blockquote = __esm({
|
|
4303
4369
|
"components/RichTextMenu/controls/Blockquote.tsx"() {
|
|
4304
4370
|
"use strict";
|
|
@@ -4306,17 +4372,17 @@ var init_Blockquote = __esm({
|
|
|
4306
4372
|
init_lucide_react();
|
|
4307
4373
|
init_Control();
|
|
4308
4374
|
init_use_control_context();
|
|
4309
|
-
|
|
4375
|
+
import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4310
4376
|
}
|
|
4311
4377
|
});
|
|
4312
4378
|
|
|
4313
4379
|
// components/RichTextMenu/controls/HorizontalRule.tsx
|
|
4314
4380
|
function HorizontalRule() {
|
|
4315
4381
|
const { editor, editorState } = useControlContext();
|
|
4316
|
-
return /* @__PURE__ */ (0,
|
|
4382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4317
4383
|
Control,
|
|
4318
4384
|
{
|
|
4319
|
-
icon: /* @__PURE__ */ (0,
|
|
4385
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Minus, {}),
|
|
4320
4386
|
onClick: (e) => {
|
|
4321
4387
|
e.stopPropagation();
|
|
4322
4388
|
editor == null ? void 0 : editor.chain().focus().setHorizontalRule().run();
|
|
@@ -4326,7 +4392,7 @@ function HorizontalRule() {
|
|
|
4326
4392
|
}
|
|
4327
4393
|
);
|
|
4328
4394
|
}
|
|
4329
|
-
var
|
|
4395
|
+
var import_jsx_runtime36;
|
|
4330
4396
|
var init_HorizontalRule = __esm({
|
|
4331
4397
|
"components/RichTextMenu/controls/HorizontalRule.tsx"() {
|
|
4332
4398
|
"use strict";
|
|
@@ -4334,45 +4400,108 @@ var init_HorizontalRule = __esm({
|
|
|
4334
4400
|
init_lucide_react();
|
|
4335
4401
|
init_Control();
|
|
4336
4402
|
init_use_control_context();
|
|
4337
|
-
|
|
4403
|
+
import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4338
4404
|
}
|
|
4339
4405
|
});
|
|
4340
4406
|
|
|
4341
|
-
// components/RichTextMenu/controls/HeadingSelect.
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
}
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
}
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4407
|
+
// components/RichTextMenu/controls/HeadingSelect/use-options.ts
|
|
4408
|
+
var import_react25, optionNodes2, useHeadingOptions;
|
|
4409
|
+
var init_use_options2 = __esm({
|
|
4410
|
+
"components/RichTextMenu/controls/HeadingSelect/use-options.ts"() {
|
|
4411
|
+
"use strict";
|
|
4412
|
+
init_react_import();
|
|
4413
|
+
import_react25 = require("react");
|
|
4414
|
+
init_lucide_react();
|
|
4415
|
+
optionNodes2 = {
|
|
4416
|
+
h1: { label: "Heading 1", icon: Heading1 },
|
|
4417
|
+
h2: { label: "Heading 2", icon: Heading2 },
|
|
4418
|
+
h3: { label: "Heading 3", icon: Heading3 },
|
|
4419
|
+
h4: { label: "Heading 4", icon: Heading4 },
|
|
4420
|
+
h5: { label: "Heading 5", icon: Heading5 },
|
|
4421
|
+
h6: { label: "Heading 6", icon: Heading6 }
|
|
4422
|
+
};
|
|
4423
|
+
useHeadingOptions = (fieldOptions) => {
|
|
4424
|
+
var _a;
|
|
4425
|
+
let blockOptions = [];
|
|
4426
|
+
if ((fieldOptions == null ? void 0 : fieldOptions.heading) !== false) {
|
|
4427
|
+
if (!((_a = fieldOptions == null ? void 0 : fieldOptions.heading) == null ? void 0 : _a.levels)) {
|
|
4428
|
+
blockOptions = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
4429
|
+
} else {
|
|
4430
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(1)) {
|
|
4431
|
+
blockOptions.push("h1");
|
|
4432
|
+
}
|
|
4433
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(2)) {
|
|
4434
|
+
blockOptions.push("h2");
|
|
4435
|
+
}
|
|
4436
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(3)) {
|
|
4437
|
+
blockOptions.push("h3");
|
|
4438
|
+
}
|
|
4439
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(4)) {
|
|
4440
|
+
blockOptions.push("h4");
|
|
4441
|
+
}
|
|
4442
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(5)) {
|
|
4443
|
+
blockOptions.push("h5");
|
|
4444
|
+
}
|
|
4445
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(6)) {
|
|
4446
|
+
blockOptions.push("h6");
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4367
4449
|
}
|
|
4450
|
+
return (0, import_react25.useMemo)(
|
|
4451
|
+
() => blockOptions.map((item) => ({
|
|
4452
|
+
value: item,
|
|
4453
|
+
label: optionNodes2[item].label,
|
|
4454
|
+
icon: optionNodes2[item].icon
|
|
4455
|
+
})),
|
|
4456
|
+
[blockOptions]
|
|
4457
|
+
);
|
|
4458
|
+
};
|
|
4459
|
+
}
|
|
4460
|
+
});
|
|
4461
|
+
|
|
4462
|
+
// components/RichTextMenu/controls/HeadingSelect/fallback.tsx
|
|
4463
|
+
function HeadingSelectFallback() {
|
|
4464
|
+
const ctx = useControlContext();
|
|
4465
|
+
const headingOptions = useHeadingOptions(ctx.options);
|
|
4466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4467
|
+
SelectControl,
|
|
4468
|
+
{
|
|
4469
|
+
options: headingOptions,
|
|
4470
|
+
onChange: () => {
|
|
4471
|
+
},
|
|
4472
|
+
value: "p",
|
|
4473
|
+
defaultValue: "p",
|
|
4474
|
+
renderDefaultIcon: Heading
|
|
4368
4475
|
}
|
|
4476
|
+
);
|
|
4477
|
+
}
|
|
4478
|
+
var import_jsx_runtime37;
|
|
4479
|
+
var init_fallback2 = __esm({
|
|
4480
|
+
"components/RichTextMenu/controls/HeadingSelect/fallback.tsx"() {
|
|
4481
|
+
"use strict";
|
|
4482
|
+
init_react_import();
|
|
4483
|
+
init_lucide_react();
|
|
4484
|
+
init_SelectControl();
|
|
4485
|
+
init_use_control_context();
|
|
4486
|
+
init_use_options2();
|
|
4487
|
+
import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4369
4488
|
}
|
|
4489
|
+
});
|
|
4490
|
+
|
|
4491
|
+
// components/RichTextMenu/controls/HeadingSelect/loaded.tsx
|
|
4492
|
+
var loaded_exports2 = {};
|
|
4493
|
+
__export(loaded_exports2, {
|
|
4494
|
+
HeadingSelectLoaded: () => HeadingSelectLoaded
|
|
4495
|
+
});
|
|
4496
|
+
function HeadingSelectLoaded() {
|
|
4497
|
+
const { options } = useControlContext();
|
|
4498
|
+
const headingOptions = useHeadingOptions(options);
|
|
4370
4499
|
const { editor } = useControlContext();
|
|
4371
|
-
const currentValue = (0,
|
|
4500
|
+
const currentValue = (0, import_react26.useEditorState)({
|
|
4372
4501
|
editor,
|
|
4373
4502
|
selector: (ctx) => {
|
|
4374
|
-
var
|
|
4375
|
-
if ((
|
|
4503
|
+
var _a, _b;
|
|
4504
|
+
if ((_a = ctx.editor) == null ? void 0 : _a.isActive("paragraph")) return "p";
|
|
4376
4505
|
for (let level = 1; level <= 6; level++) {
|
|
4377
4506
|
if ((_b = ctx.editor) == null ? void 0 : _b.isActive("heading", { level })) {
|
|
4378
4507
|
return `h${level}`;
|
|
@@ -4390,18 +4519,10 @@ function HeadingSelect() {
|
|
|
4390
4519
|
chain == null ? void 0 : chain.focus().toggleHeading({ level }).run();
|
|
4391
4520
|
}
|
|
4392
4521
|
};
|
|
4393
|
-
|
|
4394
|
-
() => blockOptions.map((item) => ({
|
|
4395
|
-
value: item,
|
|
4396
|
-
label: optionNodes2[item].label,
|
|
4397
|
-
icon: optionNodes2[item].icon
|
|
4398
|
-
})),
|
|
4399
|
-
[blockOptions]
|
|
4400
|
-
);
|
|
4401
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4402
4523
|
SelectControl,
|
|
4403
4524
|
{
|
|
4404
|
-
options:
|
|
4525
|
+
options: headingOptions,
|
|
4405
4526
|
onChange: handleChange,
|
|
4406
4527
|
value: currentValue != null ? currentValue : "p",
|
|
4407
4528
|
defaultValue: "p",
|
|
@@ -4409,37 +4530,106 @@ function HeadingSelect() {
|
|
|
4409
4530
|
}
|
|
4410
4531
|
);
|
|
4411
4532
|
}
|
|
4412
|
-
var
|
|
4413
|
-
var
|
|
4414
|
-
"components/RichTextMenu/controls/HeadingSelect.tsx"() {
|
|
4533
|
+
var import_react26, import_jsx_runtime38;
|
|
4534
|
+
var init_loaded2 = __esm({
|
|
4535
|
+
"components/RichTextMenu/controls/HeadingSelect/loaded.tsx"() {
|
|
4415
4536
|
"use strict";
|
|
4416
4537
|
init_react_import();
|
|
4417
|
-
|
|
4538
|
+
import_react26 = require("@tiptap/react");
|
|
4418
4539
|
init_use_control_context();
|
|
4419
|
-
import_react25 = require("react");
|
|
4420
4540
|
init_lucide_react();
|
|
4421
4541
|
init_SelectControl();
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4542
|
+
init_use_options2();
|
|
4543
|
+
import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4544
|
+
}
|
|
4545
|
+
});
|
|
4546
|
+
|
|
4547
|
+
// components/RichTextMenu/controls/HeadingSelect/index.tsx
|
|
4548
|
+
var import_react27, import_jsx_runtime39, HeadingSelectLoaded2, HeadingSelect;
|
|
4549
|
+
var init_HeadingSelect = __esm({
|
|
4550
|
+
"components/RichTextMenu/controls/HeadingSelect/index.tsx"() {
|
|
4551
|
+
"use strict";
|
|
4552
|
+
init_react_import();
|
|
4553
|
+
import_react27 = require("react");
|
|
4554
|
+
init_fallback2();
|
|
4555
|
+
import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4556
|
+
HeadingSelectLoaded2 = (0, import_react27.lazy)(
|
|
4557
|
+
() => Promise.resolve().then(() => (init_loaded2(), loaded_exports2)).then((m) => ({
|
|
4558
|
+
default: m.HeadingSelectLoaded
|
|
4559
|
+
}))
|
|
4560
|
+
);
|
|
4561
|
+
HeadingSelect = () => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react27.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(HeadingSelectFallback, {}), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(HeadingSelectLoaded2, {}) });
|
|
4562
|
+
}
|
|
4563
|
+
});
|
|
4564
|
+
|
|
4565
|
+
// components/RichTextMenu/controls/ListSelect/use-options.ts
|
|
4566
|
+
var import_react28, optionNodes3, useListOptions;
|
|
4567
|
+
var init_use_options3 = __esm({
|
|
4568
|
+
"components/RichTextMenu/controls/ListSelect/use-options.ts"() {
|
|
4569
|
+
"use strict";
|
|
4570
|
+
init_react_import();
|
|
4571
|
+
import_react28 = require("react");
|
|
4572
|
+
init_lucide_react();
|
|
4573
|
+
optionNodes3 = {
|
|
4574
|
+
ul: { label: "Bullet list", icon: List },
|
|
4575
|
+
ol: { label: "Numbered list", icon: ListOrdered }
|
|
4576
|
+
};
|
|
4577
|
+
useListOptions = (fieldOptions) => {
|
|
4578
|
+
let blockOptions = [];
|
|
4579
|
+
if ((fieldOptions == null ? void 0 : fieldOptions.listItem) !== false) {
|
|
4580
|
+
blockOptions = ["ul", "ol"];
|
|
4581
|
+
}
|
|
4582
|
+
return (0, import_react28.useMemo)(
|
|
4583
|
+
() => blockOptions.map((item) => ({
|
|
4584
|
+
value: item,
|
|
4585
|
+
label: optionNodes3[item].label,
|
|
4586
|
+
icon: optionNodes3[item].icon
|
|
4587
|
+
})),
|
|
4588
|
+
[blockOptions]
|
|
4589
|
+
);
|
|
4430
4590
|
};
|
|
4431
4591
|
}
|
|
4432
4592
|
});
|
|
4433
4593
|
|
|
4434
|
-
// components/RichTextMenu/controls/ListSelect.tsx
|
|
4435
|
-
function
|
|
4436
|
-
const
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4594
|
+
// components/RichTextMenu/controls/ListSelect/fallback.tsx
|
|
4595
|
+
function ListSelectFallback() {
|
|
4596
|
+
const ctx = useControlContext();
|
|
4597
|
+
const listOptions = useListOptions(ctx.options);
|
|
4598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4599
|
+
SelectControl,
|
|
4600
|
+
{
|
|
4601
|
+
options: listOptions,
|
|
4602
|
+
onChange: () => {
|
|
4603
|
+
},
|
|
4604
|
+
value: "p",
|
|
4605
|
+
defaultValue: "p",
|
|
4606
|
+
renderDefaultIcon: List
|
|
4607
|
+
}
|
|
4608
|
+
);
|
|
4609
|
+
}
|
|
4610
|
+
var import_jsx_runtime40;
|
|
4611
|
+
var init_fallback3 = __esm({
|
|
4612
|
+
"components/RichTextMenu/controls/ListSelect/fallback.tsx"() {
|
|
4613
|
+
"use strict";
|
|
4614
|
+
init_react_import();
|
|
4615
|
+
init_SelectControl();
|
|
4616
|
+
init_use_control_context();
|
|
4617
|
+
init_lucide_react();
|
|
4618
|
+
init_use_options3();
|
|
4619
|
+
import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4440
4620
|
}
|
|
4621
|
+
});
|
|
4622
|
+
|
|
4623
|
+
// components/RichTextMenu/controls/ListSelect/loaded.tsx
|
|
4624
|
+
var loaded_exports3 = {};
|
|
4625
|
+
__export(loaded_exports3, {
|
|
4626
|
+
ListSelectLoaded: () => ListSelectLoaded
|
|
4627
|
+
});
|
|
4628
|
+
function ListSelectLoaded() {
|
|
4629
|
+
const { options } = useControlContext();
|
|
4630
|
+
const listOptions = useListOptions(options);
|
|
4441
4631
|
const { editor } = useControlContext();
|
|
4442
|
-
const currentValue = (0,
|
|
4632
|
+
const currentValue = (0, import_react29.useEditorState)({
|
|
4443
4633
|
editor,
|
|
4444
4634
|
selector: (ctx) => {
|
|
4445
4635
|
var _a, _b;
|
|
@@ -4458,18 +4648,10 @@ function ListSelect() {
|
|
|
4458
4648
|
chain == null ? void 0 : chain.focus().toggleBulletList().run();
|
|
4459
4649
|
}
|
|
4460
4650
|
};
|
|
4461
|
-
|
|
4462
|
-
() => blockOptions.map((item) => ({
|
|
4463
|
-
value: item,
|
|
4464
|
-
label: optionNodes3[item].label,
|
|
4465
|
-
icon: optionNodes3[item].icon
|
|
4466
|
-
})),
|
|
4467
|
-
[blockOptions]
|
|
4468
|
-
);
|
|
4469
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4470
4652
|
SelectControl,
|
|
4471
4653
|
{
|
|
4472
|
-
options:
|
|
4654
|
+
options: listOptions,
|
|
4473
4655
|
onChange: handleChange,
|
|
4474
4656
|
value: currentValue != null ? currentValue : "p",
|
|
4475
4657
|
defaultValue: "p",
|
|
@@ -4477,21 +4659,35 @@ function ListSelect() {
|
|
|
4477
4659
|
}
|
|
4478
4660
|
);
|
|
4479
4661
|
}
|
|
4480
|
-
var
|
|
4481
|
-
var
|
|
4482
|
-
"components/RichTextMenu/controls/ListSelect.tsx"() {
|
|
4662
|
+
var import_react29, import_jsx_runtime41;
|
|
4663
|
+
var init_loaded3 = __esm({
|
|
4664
|
+
"components/RichTextMenu/controls/ListSelect/loaded.tsx"() {
|
|
4483
4665
|
"use strict";
|
|
4484
4666
|
init_react_import();
|
|
4485
|
-
|
|
4667
|
+
import_react29 = require("@tiptap/react");
|
|
4486
4668
|
init_use_control_context();
|
|
4487
|
-
import_react27 = require("react");
|
|
4488
|
-
init_lucide_react();
|
|
4489
4669
|
init_SelectControl();
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4670
|
+
init_lucide_react();
|
|
4671
|
+
init_use_options3();
|
|
4672
|
+
import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4673
|
+
}
|
|
4674
|
+
});
|
|
4675
|
+
|
|
4676
|
+
// components/RichTextMenu/controls/ListSelect/index.tsx
|
|
4677
|
+
var import_react30, import_jsx_runtime42, ListSelectLoaded2, ListSelect;
|
|
4678
|
+
var init_ListSelect = __esm({
|
|
4679
|
+
"components/RichTextMenu/controls/ListSelect/index.tsx"() {
|
|
4680
|
+
"use strict";
|
|
4681
|
+
init_react_import();
|
|
4682
|
+
import_react30 = require("react");
|
|
4683
|
+
init_fallback3();
|
|
4684
|
+
import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4685
|
+
ListSelectLoaded2 = (0, import_react30.lazy)(
|
|
4686
|
+
() => Promise.resolve().then(() => (init_loaded3(), loaded_exports3)).then((m) => ({
|
|
4687
|
+
default: m.ListSelectLoaded
|
|
4688
|
+
}))
|
|
4689
|
+
);
|
|
4690
|
+
ListSelect = () => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react30.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ListSelectFallback, {}), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ListSelectLoaded2, {}) });
|
|
4495
4691
|
}
|
|
4496
4692
|
});
|
|
4497
4693
|
|
|
@@ -4521,28 +4717,29 @@ var init_controls = __esm({
|
|
|
4521
4717
|
});
|
|
4522
4718
|
|
|
4523
4719
|
// components/RichTextMenu/inner.tsx
|
|
4524
|
-
var
|
|
4720
|
+
var import_react31, import_jsx_runtime43, getClassName16, DefaultMenu, RichTextMenu, Group2, LoadedRichTextMenuInner;
|
|
4525
4721
|
var init_inner = __esm({
|
|
4526
4722
|
"components/RichTextMenu/inner.tsx"() {
|
|
4527
4723
|
"use strict";
|
|
4528
4724
|
init_react_import();
|
|
4529
4725
|
init_get_class_name_factory();
|
|
4530
4726
|
init_styles_module3();
|
|
4531
|
-
|
|
4727
|
+
import_react31 = require("react");
|
|
4532
4728
|
init_controls();
|
|
4533
4729
|
init_use_control_context();
|
|
4534
4730
|
init_Control();
|
|
4535
|
-
|
|
4731
|
+
init_AlignSelect();
|
|
4732
|
+
import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4536
4733
|
getClassName16 = get_class_name_factory_default("RichTextMenu", styles_module_default9);
|
|
4537
4734
|
DefaultMenu = ({ children }) => {
|
|
4538
|
-
return /* @__PURE__ */ (0,
|
|
4735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RichTextMenu, { children });
|
|
4539
4736
|
};
|
|
4540
4737
|
RichTextMenu = ({ children }) => {
|
|
4541
4738
|
const { inline } = useControlContext();
|
|
4542
|
-
return /* @__PURE__ */ (0,
|
|
4739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getClassName16({ inline, form: !inline }), "data-puck-rte-menu": true, children });
|
|
4543
4740
|
};
|
|
4544
4741
|
Group2 = ({ children }) => {
|
|
4545
|
-
return /* @__PURE__ */ (0,
|
|
4742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getClassName16("group"), children });
|
|
4546
4743
|
};
|
|
4547
4744
|
RichTextMenu.Group = Group2;
|
|
4548
4745
|
RichTextMenu.Control = Control;
|
|
@@ -4564,45 +4761,45 @@ var init_inner = __esm({
|
|
|
4564
4761
|
RichTextMenu.Strikethrough = Strikethrough2;
|
|
4565
4762
|
RichTextMenu.Underline = Underline2;
|
|
4566
4763
|
LoadedRichTextMenuInner = ({
|
|
4567
|
-
editor,
|
|
4568
|
-
editorState,
|
|
4764
|
+
editor = null,
|
|
4765
|
+
editorState = null,
|
|
4569
4766
|
field,
|
|
4570
4767
|
readOnly,
|
|
4571
4768
|
inline
|
|
4572
4769
|
}) => {
|
|
4573
4770
|
const { renderMenu, renderInlineMenu } = field;
|
|
4574
|
-
const InlineMenu = (0,
|
|
4771
|
+
const InlineMenu = (0, import_react31.useMemo)(
|
|
4575
4772
|
() => renderInlineMenu || DefaultMenu,
|
|
4576
4773
|
[renderInlineMenu]
|
|
4577
4774
|
);
|
|
4578
|
-
const Menu = (0,
|
|
4579
|
-
return /* @__PURE__ */ (0,
|
|
4775
|
+
const Menu = (0, import_react31.useMemo)(() => renderMenu || DefaultMenu, [renderMenu]);
|
|
4776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4580
4777
|
ControlContext.Provider,
|
|
4581
4778
|
{
|
|
4582
4779
|
value: { editor, editorState, inline, options: field.options, readOnly },
|
|
4583
|
-
children: inline ? /* @__PURE__ */ (0,
|
|
4780
|
+
children: inline ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4584
4781
|
InlineMenu,
|
|
4585
4782
|
{
|
|
4586
4783
|
editor,
|
|
4587
4784
|
editorState,
|
|
4588
4785
|
readOnly,
|
|
4589
|
-
children: /* @__PURE__ */ (0,
|
|
4590
|
-
/* @__PURE__ */ (0,
|
|
4591
|
-
/* @__PURE__ */ (0,
|
|
4592
|
-
/* @__PURE__ */ (0,
|
|
4786
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Group2, { children: [
|
|
4787
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Bold2, {}),
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Italic2, {}),
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Underline2, {})
|
|
4593
4790
|
] })
|
|
4594
4791
|
}
|
|
4595
|
-
) : /* @__PURE__ */ (0,
|
|
4596
|
-
/* @__PURE__ */ (0,
|
|
4597
|
-
/* @__PURE__ */ (0,
|
|
4598
|
-
/* @__PURE__ */ (0,
|
|
4792
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Menu, { editor, editorState, readOnly, children: [
|
|
4793
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Group2, { children: [
|
|
4794
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(HeadingSelect, {}),
|
|
4795
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ListSelect, {})
|
|
4599
4796
|
] }),
|
|
4600
|
-
/* @__PURE__ */ (0,
|
|
4601
|
-
/* @__PURE__ */ (0,
|
|
4602
|
-
/* @__PURE__ */ (0,
|
|
4603
|
-
/* @__PURE__ */ (0,
|
|
4797
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Group2, { children: [
|
|
4798
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Bold2, {}),
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Italic2, {}),
|
|
4800
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Underline2, {})
|
|
4604
4801
|
] }),
|
|
4605
|
-
/* @__PURE__ */ (0,
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Group2, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AlignSelect, {}) })
|
|
4606
4803
|
] })
|
|
4607
4804
|
}
|
|
4608
4805
|
);
|
|
@@ -4628,18 +4825,18 @@ var init_styles_module6 = __esm({
|
|
|
4628
4825
|
});
|
|
4629
4826
|
|
|
4630
4827
|
// components/RichTextEditor/components/EditorInner.tsx
|
|
4631
|
-
var
|
|
4828
|
+
var import_react32, import_jsx_runtime44, getClassName17, EditorInner;
|
|
4632
4829
|
var init_EditorInner = __esm({
|
|
4633
4830
|
"components/RichTextEditor/components/EditorInner.tsx"() {
|
|
4634
4831
|
"use strict";
|
|
4635
4832
|
init_react_import();
|
|
4636
|
-
|
|
4833
|
+
import_react32 = require("react");
|
|
4637
4834
|
init_styles_module6();
|
|
4638
4835
|
init_get_class_name_factory();
|
|
4639
4836
|
init_store();
|
|
4640
|
-
|
|
4837
|
+
import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4641
4838
|
getClassName17 = get_class_name_factory_default("RichTextEditor", styles_module_default12);
|
|
4642
|
-
EditorInner = (0,
|
|
4839
|
+
EditorInner = (0, import_react32.memo)(
|
|
4643
4840
|
({
|
|
4644
4841
|
children,
|
|
4645
4842
|
menu,
|
|
@@ -4657,7 +4854,7 @@ var init_EditorInner = __esm({
|
|
|
4657
4854
|
}
|
|
4658
4855
|
);
|
|
4659
4856
|
const appStoreApi = useAppStoreApi();
|
|
4660
|
-
const handleHotkeyCapture = (0,
|
|
4857
|
+
const handleHotkeyCapture = (0, import_react32.useCallback)(
|
|
4661
4858
|
(event) => {
|
|
4662
4859
|
var _a, _b;
|
|
4663
4860
|
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "i") {
|
|
@@ -4668,7 +4865,7 @@ var init_EditorInner = __esm({
|
|
|
4668
4865
|
},
|
|
4669
4866
|
[editor]
|
|
4670
4867
|
);
|
|
4671
|
-
const handleBlur = (0,
|
|
4868
|
+
const handleBlur = (0, import_react32.useCallback)(
|
|
4672
4869
|
(e) => {
|
|
4673
4870
|
var _a, _b;
|
|
4674
4871
|
const targetInMenu = !!((_b = (_a = e.relatedTarget) == null ? void 0 : _a.closest) == null ? void 0 : _b.call(
|
|
@@ -4685,7 +4882,7 @@ var init_EditorInner = __esm({
|
|
|
4685
4882
|
},
|
|
4686
4883
|
[appStoreApi]
|
|
4687
4884
|
);
|
|
4688
|
-
return /* @__PURE__ */ (0,
|
|
4885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
4689
4886
|
"div",
|
|
4690
4887
|
{
|
|
4691
4888
|
className: getClassName17({
|
|
@@ -4694,11 +4891,11 @@ var init_EditorInner = __esm({
|
|
|
4694
4891
|
isActive,
|
|
4695
4892
|
disabled: readOnly
|
|
4696
4893
|
}),
|
|
4697
|
-
style: inline ? {} : { height: initialHeight != null ? initialHeight :
|
|
4894
|
+
style: inline ? {} : { height: initialHeight != null ? initialHeight : 192, overflowY: "auto" },
|
|
4698
4895
|
onKeyDownCapture: handleHotkeyCapture,
|
|
4699
4896
|
onBlur: handleBlur,
|
|
4700
4897
|
children: [
|
|
4701
|
-
!inline && /* @__PURE__ */ (0,
|
|
4898
|
+
!inline && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName17("menu"), children: menu }),
|
|
4702
4899
|
children
|
|
4703
4900
|
]
|
|
4704
4901
|
}
|
|
@@ -4722,9 +4919,9 @@ function useSyncedEditor({
|
|
|
4722
4919
|
leading: true,
|
|
4723
4920
|
maxWait: 200
|
|
4724
4921
|
});
|
|
4725
|
-
const syncingRef = (0,
|
|
4726
|
-
const lastSyncedRef = (0,
|
|
4727
|
-
const editTimer = (0,
|
|
4922
|
+
const syncingRef = (0, import_react35.useRef)(false);
|
|
4923
|
+
const lastSyncedRef = (0, import_react35.useRef)("");
|
|
4924
|
+
const editTimer = (0, import_react35.useRef)(null);
|
|
4728
4925
|
const isPending = !!editTimer.current;
|
|
4729
4926
|
const isFocused = useAppStore((s) => s.state.ui.field.focus === name);
|
|
4730
4927
|
const resetTimer = (clearOn) => {
|
|
@@ -4738,7 +4935,7 @@ function useSyncedEditor({
|
|
|
4738
4935
|
}, 200);
|
|
4739
4936
|
};
|
|
4740
4937
|
const appStoreApi = useAppStoreApi();
|
|
4741
|
-
const editor = (0,
|
|
4938
|
+
const editor = (0, import_react34.useEditor)({
|
|
4742
4939
|
extensions,
|
|
4743
4940
|
content,
|
|
4744
4941
|
editable,
|
|
@@ -4756,7 +4953,7 @@ function useSyncedEditor({
|
|
|
4756
4953
|
lastSyncedRef.current = html;
|
|
4757
4954
|
}
|
|
4758
4955
|
});
|
|
4759
|
-
(0,
|
|
4956
|
+
(0, import_react35.useEffect)(() => {
|
|
4760
4957
|
if (!editor) return;
|
|
4761
4958
|
const handleFocus = () => {
|
|
4762
4959
|
onFocusChange == null ? void 0 : onFocusChange(editor);
|
|
@@ -4766,7 +4963,7 @@ function useSyncedEditor({
|
|
|
4766
4963
|
editor.off("focus", handleFocus);
|
|
4767
4964
|
};
|
|
4768
4965
|
}, [editor, onFocusChange]);
|
|
4769
|
-
(0,
|
|
4966
|
+
(0, import_react35.useEffect)(() => {
|
|
4770
4967
|
if (debouncedState) {
|
|
4771
4968
|
const { ui } = appStoreApi.getState().state;
|
|
4772
4969
|
onChange(debouncedState.html, {
|
|
@@ -4776,10 +4973,10 @@ function useSyncedEditor({
|
|
|
4776
4973
|
});
|
|
4777
4974
|
}
|
|
4778
4975
|
}, [editor, debouncedState, onChange, appStoreApi, name]);
|
|
4779
|
-
(0,
|
|
4976
|
+
(0, import_react35.useEffect)(() => {
|
|
4780
4977
|
editor == null ? void 0 : editor.setEditable(editable);
|
|
4781
4978
|
}, [editor, editable]);
|
|
4782
|
-
(0,
|
|
4979
|
+
(0, import_react35.useEffect)(() => {
|
|
4783
4980
|
var _a;
|
|
4784
4981
|
if (!editor) return;
|
|
4785
4982
|
if (isPending) {
|
|
@@ -4800,13 +4997,13 @@ function useSyncedEditor({
|
|
|
4800
4997
|
}, [content, editor, appStoreApi]);
|
|
4801
4998
|
return editor;
|
|
4802
4999
|
}
|
|
4803
|
-
var
|
|
5000
|
+
var import_react34, import_react35, import_use_debounce;
|
|
4804
5001
|
var init_use_synced_editor = __esm({
|
|
4805
5002
|
"components/RichTextEditor/lib/use-synced-editor.ts"() {
|
|
4806
5003
|
"use strict";
|
|
4807
5004
|
init_react_import();
|
|
4808
|
-
|
|
4809
|
-
|
|
5005
|
+
import_react34 = require("@tiptap/react");
|
|
5006
|
+
import_react35 = require("react");
|
|
4810
5007
|
import_use_debounce = require("use-debounce");
|
|
4811
5008
|
init_store();
|
|
4812
5009
|
}
|
|
@@ -4952,18 +5149,22 @@ var init_selector = __esm({
|
|
|
4952
5149
|
}
|
|
4953
5150
|
});
|
|
4954
5151
|
|
|
4955
|
-
// components/RichTextMenu/
|
|
4956
|
-
var
|
|
4957
|
-
|
|
4958
|
-
|
|
5152
|
+
// components/RichTextMenu/full.tsx
|
|
5153
|
+
var full_exports = {};
|
|
5154
|
+
__export(full_exports, {
|
|
5155
|
+
LoadedRichTextMenuFull: () => LoadedRichTextMenuFull
|
|
5156
|
+
});
|
|
5157
|
+
var import_react36, import_react37, import_jsx_runtime46, LoadedRichTextMenuFull;
|
|
5158
|
+
var init_full = __esm({
|
|
5159
|
+
"components/RichTextMenu/full.tsx"() {
|
|
4959
5160
|
"use strict";
|
|
4960
5161
|
init_react_import();
|
|
4961
|
-
|
|
4962
|
-
|
|
5162
|
+
import_react36 = require("@tiptap/react");
|
|
5163
|
+
import_react37 = require("react");
|
|
4963
5164
|
init_selector();
|
|
4964
5165
|
init_inner();
|
|
4965
|
-
|
|
4966
|
-
|
|
5166
|
+
import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5167
|
+
LoadedRichTextMenuFull = ({
|
|
4967
5168
|
editor,
|
|
4968
5169
|
field,
|
|
4969
5170
|
readOnly,
|
|
@@ -4971,17 +5172,17 @@ var init_RichTextMenu = __esm({
|
|
|
4971
5172
|
}) => {
|
|
4972
5173
|
const { tiptap = {} } = field;
|
|
4973
5174
|
const { selector } = tiptap;
|
|
4974
|
-
const resolvedSelector = (0,
|
|
5175
|
+
const resolvedSelector = (0, import_react37.useMemo)(() => {
|
|
4975
5176
|
return (ctx) => __spreadValues(__spreadValues({}, defaultEditorState(ctx, readOnly)), selector ? selector(ctx, readOnly) : {});
|
|
4976
5177
|
}, [selector, readOnly]);
|
|
4977
|
-
const editorState = (0,
|
|
5178
|
+
const editorState = (0, import_react36.useEditorState)({
|
|
4978
5179
|
editor,
|
|
4979
5180
|
selector: resolvedSelector
|
|
4980
5181
|
});
|
|
4981
5182
|
if (!editor || !editorState) {
|
|
4982
5183
|
return null;
|
|
4983
5184
|
}
|
|
4984
|
-
return /* @__PURE__ */ (0,
|
|
5185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4985
5186
|
LoadedRichTextMenuInner,
|
|
4986
5187
|
{
|
|
4987
5188
|
editor,
|
|
@@ -4995,25 +5196,45 @@ var init_RichTextMenu = __esm({
|
|
|
4995
5196
|
}
|
|
4996
5197
|
});
|
|
4997
5198
|
|
|
5199
|
+
// components/RichTextMenu/index.tsx
|
|
5200
|
+
var import_react38, import_jsx_runtime47, LoadedRichTextMenuFull2, LoadedRichTextMenu;
|
|
5201
|
+
var init_RichTextMenu = __esm({
|
|
5202
|
+
"components/RichTextMenu/index.tsx"() {
|
|
5203
|
+
"use strict";
|
|
5204
|
+
init_react_import();
|
|
5205
|
+
import_react38 = require("react");
|
|
5206
|
+
init_inner();
|
|
5207
|
+
import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5208
|
+
LoadedRichTextMenuFull2 = (0, import_react38.lazy)(
|
|
5209
|
+
() => Promise.resolve().then(() => (init_full(), full_exports)).then((m) => ({
|
|
5210
|
+
default: m.LoadedRichTextMenuFull
|
|
5211
|
+
}))
|
|
5212
|
+
);
|
|
5213
|
+
LoadedRichTextMenu = (props) => {
|
|
5214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react38.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LoadedRichTextMenuInner, __spreadValues({}, props)), children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LoadedRichTextMenuFull2, __spreadValues({}, props)) });
|
|
5215
|
+
};
|
|
5216
|
+
}
|
|
5217
|
+
});
|
|
5218
|
+
|
|
4998
5219
|
// components/RichTextEditor/components/Editor.tsx
|
|
4999
5220
|
var Editor_exports = {};
|
|
5000
5221
|
__export(Editor_exports, {
|
|
5001
5222
|
Editor: () => Editor
|
|
5002
5223
|
});
|
|
5003
|
-
var
|
|
5224
|
+
var import_react39, import_react40, import_jsx_runtime48, Editor;
|
|
5004
5225
|
var init_Editor = __esm({
|
|
5005
5226
|
"components/RichTextEditor/components/Editor.tsx"() {
|
|
5006
5227
|
"use strict";
|
|
5007
5228
|
init_react_import();
|
|
5008
|
-
|
|
5229
|
+
import_react39 = require("react");
|
|
5009
5230
|
init_use_synced_editor();
|
|
5010
5231
|
init_extension();
|
|
5011
|
-
|
|
5232
|
+
import_react40 = require("@tiptap/react");
|
|
5012
5233
|
init_store();
|
|
5013
5234
|
init_RichTextMenu();
|
|
5014
5235
|
init_EditorInner();
|
|
5015
|
-
|
|
5016
|
-
Editor = (0,
|
|
5236
|
+
import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5237
|
+
Editor = (0, import_react39.memo)((props) => {
|
|
5017
5238
|
const {
|
|
5018
5239
|
onChange,
|
|
5019
5240
|
content,
|
|
@@ -5026,7 +5247,7 @@ var init_Editor = __esm({
|
|
|
5026
5247
|
} = props;
|
|
5027
5248
|
const { tiptap = {}, options } = field;
|
|
5028
5249
|
const { extensions = [] } = tiptap;
|
|
5029
|
-
const loadedExtensions = (0,
|
|
5250
|
+
const loadedExtensions = (0, import_react39.useMemo)(
|
|
5030
5251
|
() => [PuckRichText.configure(options), ...extensions],
|
|
5031
5252
|
[field, extensions]
|
|
5032
5253
|
);
|
|
@@ -5068,11 +5289,11 @@ var init_Editor = __esm({
|
|
|
5068
5289
|
return editor;
|
|
5069
5290
|
});
|
|
5070
5291
|
if (!editor) return null;
|
|
5071
|
-
return /* @__PURE__ */ (0,
|
|
5292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5072
5293
|
EditorInner,
|
|
5073
5294
|
__spreadProps(__spreadValues({}, props), {
|
|
5074
5295
|
editor,
|
|
5075
|
-
menu: /* @__PURE__ */ (0,
|
|
5296
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5076
5297
|
LoadedRichTextMenu,
|
|
5077
5298
|
{
|
|
5078
5299
|
field,
|
|
@@ -5080,7 +5301,7 @@ var init_Editor = __esm({
|
|
|
5080
5301
|
readOnly
|
|
5081
5302
|
}
|
|
5082
5303
|
),
|
|
5083
|
-
children: /* @__PURE__ */ (0,
|
|
5304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react40.EditorContent, { editor, className: "rich-text" })
|
|
5084
5305
|
})
|
|
5085
5306
|
);
|
|
5086
5307
|
});
|
|
@@ -5099,11 +5320,11 @@ function RichTextRender({
|
|
|
5099
5320
|
}) {
|
|
5100
5321
|
const { tiptap = {}, options } = field;
|
|
5101
5322
|
const { extensions = [] } = tiptap;
|
|
5102
|
-
const loadedExtensions = (0,
|
|
5323
|
+
const loadedExtensions = (0, import_react54.useMemo)(
|
|
5103
5324
|
() => [PuckRichText.configure(options), ...extensions],
|
|
5104
5325
|
[field, extensions]
|
|
5105
5326
|
);
|
|
5106
|
-
const normalized = (0,
|
|
5327
|
+
const normalized = (0, import_react54.useMemo)(() => {
|
|
5107
5328
|
if (typeof content === "object" && (content == null ? void 0 : content.type) === "doc") {
|
|
5108
5329
|
return content;
|
|
5109
5330
|
}
|
|
@@ -5121,22 +5342,22 @@ function RichTextRender({
|
|
|
5121
5342
|
}
|
|
5122
5343
|
return { type: "doc", content: [] };
|
|
5123
5344
|
}, [content, loadedExtensions]);
|
|
5124
|
-
const html = (0,
|
|
5345
|
+
const html = (0, import_react54.useMemo)(() => {
|
|
5125
5346
|
return (0, import_html.generateHTML)(normalized, loadedExtensions);
|
|
5126
5347
|
}, [normalized, loadedExtensions]);
|
|
5127
|
-
return /* @__PURE__ */ (0,
|
|
5348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: getClassName22(), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "rich-text", dangerouslySetInnerHTML: { __html: html } }) });
|
|
5128
5349
|
}
|
|
5129
|
-
var import_html,
|
|
5350
|
+
var import_html, import_react54, import_jsx_runtime55, getClassName22;
|
|
5130
5351
|
var init_Render = __esm({
|
|
5131
5352
|
"components/RichTextEditor/components/Render.tsx"() {
|
|
5132
5353
|
"use strict";
|
|
5133
5354
|
init_react_import();
|
|
5134
5355
|
import_html = require("@tiptap/html");
|
|
5135
|
-
|
|
5356
|
+
import_react54 = require("react");
|
|
5136
5357
|
init_get_class_name_factory();
|
|
5137
5358
|
init_styles_module6();
|
|
5138
5359
|
init_extension();
|
|
5139
|
-
|
|
5360
|
+
import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5140
5361
|
getClassName22 = get_class_name_factory_default("RichTextEditor", styles_module_default12);
|
|
5141
5362
|
}
|
|
5142
5363
|
});
|
|
@@ -5272,7 +5493,7 @@ init_react_import();
|
|
|
5272
5493
|
var styles_module_default2 = { "InputWrapper": "_InputWrapper_bsxfo_1", "Input-label": "_Input-label_bsxfo_5", "Input-labelIcon": "_Input-labelIcon_bsxfo_14", "Input-disabledIcon": "_Input-disabledIcon_bsxfo_21", "Input-input": "_Input-input_bsxfo_26", "Input": "_Input_bsxfo_1", "Input--readOnly": "_Input--readOnly_bsxfo_82", "Input-radioGroupItems": "_Input-radioGroupItems_bsxfo_93", "Input-radio": "_Input-radio_bsxfo_93", "Input-radioInner": "_Input-radioInner_bsxfo_110", "Input-radioInput": "_Input-radioInput_bsxfo_155" };
|
|
5273
5494
|
|
|
5274
5495
|
// components/AutoField/index.tsx
|
|
5275
|
-
var
|
|
5496
|
+
var import_react43 = require("react");
|
|
5276
5497
|
|
|
5277
5498
|
// components/AutoField/fields/index.tsx
|
|
5278
5499
|
init_react_import();
|
|
@@ -6799,22 +7020,22 @@ var TextareaField = ({
|
|
|
6799
7020
|
|
|
6800
7021
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
6801
7022
|
init_react_import();
|
|
6802
|
-
var
|
|
7023
|
+
var import_react41 = require("react");
|
|
6803
7024
|
init_lucide_react();
|
|
6804
7025
|
|
|
6805
7026
|
// components/RichTextEditor/components/EditorFallback.tsx
|
|
6806
7027
|
init_react_import();
|
|
6807
|
-
var
|
|
7028
|
+
var import_react33 = require("react");
|
|
6808
7029
|
init_inner();
|
|
6809
7030
|
init_EditorInner();
|
|
6810
|
-
var
|
|
6811
|
-
var EditorFallback = (0,
|
|
7031
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7032
|
+
var EditorFallback = (0, import_react33.memo)((props) => {
|
|
6812
7033
|
var _a;
|
|
6813
|
-
return /* @__PURE__ */ (0,
|
|
7034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
6814
7035
|
EditorInner,
|
|
6815
7036
|
__spreadProps(__spreadValues({}, props), {
|
|
6816
7037
|
editor: null,
|
|
6817
|
-
menu: /* @__PURE__ */ (0,
|
|
7038
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
6818
7039
|
LoadedRichTextMenuInner,
|
|
6819
7040
|
{
|
|
6820
7041
|
field: props.field,
|
|
@@ -6823,7 +7044,7 @@ var EditorFallback = (0, import_react30.memo)((props) => {
|
|
|
6823
7044
|
readOnly: (_a = props.readOnly) != null ? _a : false
|
|
6824
7045
|
}
|
|
6825
7046
|
),
|
|
6826
|
-
children: /* @__PURE__ */ (0,
|
|
7047
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
6827
7048
|
"div",
|
|
6828
7049
|
{
|
|
6829
7050
|
className: "rich-text",
|
|
@@ -6837,8 +7058,8 @@ var EditorFallback = (0, import_react30.memo)((props) => {
|
|
|
6837
7058
|
EditorFallback.displayName = "EditorFallback";
|
|
6838
7059
|
|
|
6839
7060
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
6840
|
-
var
|
|
6841
|
-
var Editor2 = (0,
|
|
7061
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7062
|
+
var Editor2 = (0, import_react41.lazy)(
|
|
6842
7063
|
() => Promise.resolve().then(() => (init_Editor(), Editor_exports)).then((m) => ({
|
|
6843
7064
|
default: m.Editor
|
|
6844
7065
|
}))
|
|
@@ -6862,14 +7083,14 @@ var RichtextField = ({
|
|
|
6862
7083
|
id,
|
|
6863
7084
|
name
|
|
6864
7085
|
};
|
|
6865
|
-
return /* @__PURE__ */ (0,
|
|
7086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6866
7087
|
Label2,
|
|
6867
7088
|
{
|
|
6868
7089
|
label: label || name,
|
|
6869
|
-
icon: labelIcon || /* @__PURE__ */ (0,
|
|
7090
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Type, { size: 16 }),
|
|
6870
7091
|
readOnly,
|
|
6871
7092
|
el: "div",
|
|
6872
|
-
children: /* @__PURE__ */ (0,
|
|
7093
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react41.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(EditorFallback, __spreadValues({}, editorProps)), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Editor2, __spreadValues({}, editorProps)) })
|
|
6873
7094
|
}
|
|
6874
7095
|
) });
|
|
6875
7096
|
};
|
|
@@ -6887,7 +7108,7 @@ var styles_module_default13 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectFi
|
|
|
6887
7108
|
|
|
6888
7109
|
// components/AutoField/fields/ObjectField/index.tsx
|
|
6889
7110
|
init_lucide_react();
|
|
6890
|
-
var
|
|
7111
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
6891
7112
|
var getClassName18 = get_class_name_factory_default("ObjectField", styles_module_default13);
|
|
6892
7113
|
var ObjectField = ({
|
|
6893
7114
|
field,
|
|
@@ -6905,25 +7126,25 @@ var ObjectField = ({
|
|
|
6905
7126
|
return null;
|
|
6906
7127
|
}
|
|
6907
7128
|
const data = value || {};
|
|
6908
|
-
return /* @__PURE__ */ (0,
|
|
7129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6909
7130
|
Label2,
|
|
6910
7131
|
{
|
|
6911
7132
|
label: label || name,
|
|
6912
|
-
icon: labelIcon || /* @__PURE__ */ (0,
|
|
7133
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(EllipsisVertical, { size: 16 }),
|
|
6913
7134
|
el: "div",
|
|
6914
7135
|
readOnly,
|
|
6915
|
-
children: /* @__PURE__ */ (0,
|
|
7136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: getClassName18(), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("fieldset", { className: getClassName18("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
|
6916
7137
|
const subField = field.objectFields[subName];
|
|
6917
7138
|
const subPath = `${localName}.${subName}`;
|
|
6918
7139
|
const subReadOnly = readOnly ? readOnly : readOnlyFields[subPath];
|
|
6919
7140
|
const label2 = subField.label || subName;
|
|
6920
|
-
return /* @__PURE__ */ (0,
|
|
7141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6921
7142
|
NestedFieldProvider,
|
|
6922
7143
|
{
|
|
6923
7144
|
name: localName || id,
|
|
6924
7145
|
subName,
|
|
6925
7146
|
readOnlyFields,
|
|
6926
|
-
children: /* @__PURE__ */ (0,
|
|
7147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6927
7148
|
AutoFieldPrivate,
|
|
6928
7149
|
{
|
|
6929
7150
|
name: subPath,
|
|
@@ -6936,6 +7157,9 @@ var ObjectField = ({
|
|
|
6936
7157
|
}),
|
|
6937
7158
|
value: data[subName],
|
|
6938
7159
|
onChange: (val, ui) => {
|
|
7160
|
+
if (data[subName] === val) {
|
|
7161
|
+
return;
|
|
7162
|
+
}
|
|
6939
7163
|
onChange(
|
|
6940
7164
|
__spreadProps(__spreadValues({}, data), {
|
|
6941
7165
|
[subName]: val
|
|
@@ -6958,18 +7182,18 @@ init_store();
|
|
|
6958
7182
|
|
|
6959
7183
|
// lib/use-safe-id.ts
|
|
6960
7184
|
init_react_import();
|
|
6961
|
-
var
|
|
7185
|
+
var import_react42 = __toESM(require("react"));
|
|
6962
7186
|
init_generate_id();
|
|
6963
7187
|
var useSafeId = () => {
|
|
6964
|
-
if (typeof
|
|
6965
|
-
return
|
|
7188
|
+
if (typeof import_react42.default.useId !== "undefined") {
|
|
7189
|
+
return import_react42.default.useId();
|
|
6966
7190
|
}
|
|
6967
|
-
const [id] = (0,
|
|
7191
|
+
const [id] = (0, import_react42.useState)(generateId());
|
|
6968
7192
|
return id;
|
|
6969
7193
|
};
|
|
6970
7194
|
|
|
6971
7195
|
// components/AutoField/index.tsx
|
|
6972
|
-
var
|
|
7196
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
6973
7197
|
var getClassName19 = get_class_name_factory_default("Input", styles_module_default2);
|
|
6974
7198
|
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
|
|
6975
7199
|
var FieldLabel = ({
|
|
@@ -6981,11 +7205,11 @@ var FieldLabel = ({
|
|
|
6981
7205
|
className
|
|
6982
7206
|
}) => {
|
|
6983
7207
|
const El = el;
|
|
6984
|
-
return /* @__PURE__ */ (0,
|
|
6985
|
-
/* @__PURE__ */ (0,
|
|
6986
|
-
icon ? /* @__PURE__ */ (0,
|
|
7208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(El, { className, children: [
|
|
7209
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: getClassName19("label"), children: [
|
|
7210
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: getClassName19("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, {}),
|
|
6987
7211
|
label,
|
|
6988
|
-
readOnly && /* @__PURE__ */ (0,
|
|
7212
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: getClassName19("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Lock, { size: "12" }) })
|
|
6989
7213
|
] }),
|
|
6990
7214
|
children
|
|
6991
7215
|
] });
|
|
@@ -6998,14 +7222,14 @@ var FieldLabelInternal = ({
|
|
|
6998
7222
|
readOnly
|
|
6999
7223
|
}) => {
|
|
7000
7224
|
const overrides = useAppStore((s) => s.overrides);
|
|
7001
|
-
const Wrapper = (0,
|
|
7225
|
+
const Wrapper = (0, import_react43.useMemo)(
|
|
7002
7226
|
() => overrides.fieldLabel || FieldLabel,
|
|
7003
7227
|
[overrides]
|
|
7004
7228
|
);
|
|
7005
7229
|
if (!label) {
|
|
7006
|
-
return /* @__PURE__ */ (0,
|
|
7230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children });
|
|
7007
7231
|
}
|
|
7008
|
-
return /* @__PURE__ */ (0,
|
|
7232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
7009
7233
|
Wrapper,
|
|
7010
7234
|
{
|
|
7011
7235
|
label,
|
|
@@ -7036,14 +7260,14 @@ function AutoFieldInternal(props) {
|
|
|
7036
7260
|
var _a2;
|
|
7037
7261
|
return (_a2 = s.selectedItem) == null ? void 0 : _a2.readOnly;
|
|
7038
7262
|
});
|
|
7039
|
-
const nestedFieldContext = (0,
|
|
7263
|
+
const nestedFieldContext = (0, import_react43.useContext)(NestedFieldContext);
|
|
7040
7264
|
const { id, Label: Label2 = FieldLabelInternal } = props;
|
|
7041
7265
|
const field = props.field;
|
|
7042
7266
|
const label = field.label;
|
|
7043
7267
|
const labelIcon = field.labelIcon;
|
|
7044
7268
|
const defaultId = useSafeId();
|
|
7045
7269
|
const resolvedId = id || defaultId;
|
|
7046
|
-
const render = (0,
|
|
7270
|
+
const render = (0, import_react43.useMemo)(
|
|
7047
7271
|
() => {
|
|
7048
7272
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
7049
7273
|
return __spreadProps(__spreadValues({}, overrides.fieldTypes), {
|
|
@@ -7060,7 +7284,7 @@ function AutoFieldInternal(props) {
|
|
|
7060
7284
|
},
|
|
7061
7285
|
[overrides]
|
|
7062
7286
|
);
|
|
7063
|
-
const mergedProps = (0,
|
|
7287
|
+
const mergedProps = (0, import_react43.useMemo)(
|
|
7064
7288
|
() => __spreadProps(__spreadValues({}, props), {
|
|
7065
7289
|
field,
|
|
7066
7290
|
label,
|
|
@@ -7070,7 +7294,7 @@ function AutoFieldInternal(props) {
|
|
|
7070
7294
|
}),
|
|
7071
7295
|
[props, field, label, labelIcon, Label2, resolvedId]
|
|
7072
7296
|
);
|
|
7073
|
-
const onFocus = (0,
|
|
7297
|
+
const onFocus = (0, import_react43.useCallback)(
|
|
7074
7298
|
(e) => {
|
|
7075
7299
|
if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
|
|
7076
7300
|
e.stopPropagation();
|
|
@@ -7084,7 +7308,7 @@ function AutoFieldInternal(props) {
|
|
|
7084
7308
|
},
|
|
7085
7309
|
[mergedProps.name]
|
|
7086
7310
|
);
|
|
7087
|
-
const onBlur = (0,
|
|
7311
|
+
const onBlur = (0, import_react43.useCallback)((e) => {
|
|
7088
7312
|
if ("name" in e.target) {
|
|
7089
7313
|
dispatch({
|
|
7090
7314
|
type: "setUi",
|
|
@@ -7094,14 +7318,14 @@ function AutoFieldInternal(props) {
|
|
|
7094
7318
|
});
|
|
7095
7319
|
}
|
|
7096
7320
|
}, []);
|
|
7097
|
-
let Children = (0,
|
|
7321
|
+
let Children = (0, import_react43.useMemo)(() => {
|
|
7098
7322
|
if (field.type !== "custom" && field.type !== "slot") {
|
|
7099
7323
|
return defaultFields[field.type];
|
|
7100
7324
|
}
|
|
7101
7325
|
return (_props) => null;
|
|
7102
7326
|
}, [field.type]);
|
|
7103
7327
|
const fieldKey = field.type === "custom" ? field.key : void 0;
|
|
7104
|
-
let FieldComponent = (0,
|
|
7328
|
+
let FieldComponent = (0, import_react43.useMemo)(() => {
|
|
7105
7329
|
if (field.type === "custom") {
|
|
7106
7330
|
if (!field.render) {
|
|
7107
7331
|
return null;
|
|
@@ -7121,14 +7345,14 @@ function AutoFieldInternal(props) {
|
|
|
7121
7345
|
if (!FieldComponent) {
|
|
7122
7346
|
throw new Error(`Field type for ${field.type} did not exist.`);
|
|
7123
7347
|
}
|
|
7124
|
-
return /* @__PURE__ */ (0,
|
|
7348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
7125
7349
|
NestedFieldContext.Provider,
|
|
7126
7350
|
{
|
|
7127
7351
|
value: {
|
|
7128
7352
|
readOnlyFields: nestedFieldContext.readOnlyFields || readOnly || {},
|
|
7129
7353
|
localName: (_a = nestedFieldContext.localName) != null ? _a : mergedProps.name
|
|
7130
7354
|
},
|
|
7131
|
-
children: /* @__PURE__ */ (0,
|
|
7355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
7132
7356
|
"div",
|
|
7133
7357
|
{
|
|
7134
7358
|
className: getClassNameWrapper(),
|
|
@@ -7137,7 +7361,7 @@ function AutoFieldInternal(props) {
|
|
|
7137
7361
|
onClick: (e) => {
|
|
7138
7362
|
e.stopPropagation();
|
|
7139
7363
|
},
|
|
7140
|
-
children: /* @__PURE__ */ (0,
|
|
7364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FieldComponent, __spreadProps(__spreadValues({}, mergedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Children, __spreadValues({}, mergedProps)) }))
|
|
7141
7365
|
}
|
|
7142
7366
|
)
|
|
7143
7367
|
}
|
|
@@ -7146,20 +7370,20 @@ function AutoFieldInternal(props) {
|
|
|
7146
7370
|
function AutoFieldPrivate(props) {
|
|
7147
7371
|
const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
|
|
7148
7372
|
const { value, onChange } = props;
|
|
7149
|
-
const [localValue, setLocalValue] = (0,
|
|
7150
|
-
const onChangeLocal = (0,
|
|
7373
|
+
const [localValue, setLocalValue] = (0, import_react43.useState)(value);
|
|
7374
|
+
const onChangeLocal = (0, import_react43.useCallback)(
|
|
7151
7375
|
(val, ui) => {
|
|
7152
7376
|
setLocalValue(val);
|
|
7153
7377
|
onChange(val, ui);
|
|
7154
7378
|
},
|
|
7155
7379
|
[onChange]
|
|
7156
7380
|
);
|
|
7157
|
-
(0,
|
|
7381
|
+
(0, import_react43.useEffect)(() => {
|
|
7158
7382
|
if (!isFocused) {
|
|
7159
7383
|
setLocalValue(value);
|
|
7160
7384
|
}
|
|
7161
7385
|
}, [value]);
|
|
7162
|
-
(0,
|
|
7386
|
+
(0, import_react43.useEffect)(() => {
|
|
7163
7387
|
if (!isFocused) {
|
|
7164
7388
|
if (value !== localValue) {
|
|
7165
7389
|
setLocalValue(value);
|
|
@@ -7170,11 +7394,11 @@ function AutoFieldPrivate(props) {
|
|
|
7170
7394
|
value: localValue,
|
|
7171
7395
|
onChange: onChangeLocal
|
|
7172
7396
|
};
|
|
7173
|
-
return /* @__PURE__ */ (0,
|
|
7397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
|
7174
7398
|
}
|
|
7175
7399
|
function AutoField(props) {
|
|
7176
|
-
const DefaultLabel = (0,
|
|
7177
|
-
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0,
|
|
7400
|
+
const DefaultLabel = (0, import_react43.useMemo)(() => {
|
|
7401
|
+
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
7178
7402
|
"div",
|
|
7179
7403
|
__spreadProps(__spreadValues({}, labelProps), {
|
|
7180
7404
|
className: getClassName19({ readOnly: props.readOnly })
|
|
@@ -7185,7 +7409,7 @@ function AutoField(props) {
|
|
|
7185
7409
|
if (props.field.type === "slot") {
|
|
7186
7410
|
return null;
|
|
7187
7411
|
}
|
|
7188
|
-
return /* @__PURE__ */ (0,
|
|
7412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
|
|
7189
7413
|
}
|
|
7190
7414
|
|
|
7191
7415
|
// components/Drawer/index.tsx
|
|
@@ -7197,23 +7421,23 @@ var styles_module_default14 = { "Drawer": "_Drawer_pl7z0_1", "Drawer-draggable":
|
|
|
7197
7421
|
|
|
7198
7422
|
// components/Drawer/index.tsx
|
|
7199
7423
|
init_get_class_name_factory();
|
|
7200
|
-
var
|
|
7424
|
+
var import_react64 = require("react");
|
|
7201
7425
|
init_generate_id();
|
|
7202
7426
|
|
|
7203
7427
|
// components/DragDropContext/index.tsx
|
|
7204
7428
|
init_react_import();
|
|
7205
|
-
var
|
|
7429
|
+
var import_react62 = require("@dnd-kit/react");
|
|
7206
7430
|
init_store();
|
|
7207
|
-
var
|
|
7431
|
+
var import_react63 = require("react");
|
|
7208
7432
|
var import_dom = require("@dnd-kit/dom");
|
|
7209
7433
|
|
|
7210
7434
|
// components/DropZone/index.tsx
|
|
7211
7435
|
init_react_import();
|
|
7212
|
-
var
|
|
7436
|
+
var import_react60 = require("react");
|
|
7213
7437
|
|
|
7214
7438
|
// components/DraggableComponent/index.tsx
|
|
7215
7439
|
init_react_import();
|
|
7216
|
-
var
|
|
7440
|
+
var import_react47 = require("react");
|
|
7217
7441
|
|
|
7218
7442
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
|
7219
7443
|
init_react_import();
|
|
@@ -7248,12 +7472,12 @@ function getDeepScrollPosition(element) {
|
|
|
7248
7472
|
|
|
7249
7473
|
// components/DropZone/context.tsx
|
|
7250
7474
|
init_react_import();
|
|
7251
|
-
var
|
|
7475
|
+
var import_react44 = require("react");
|
|
7252
7476
|
init_store();
|
|
7253
7477
|
var import_zustand3 = require("zustand");
|
|
7254
|
-
var
|
|
7255
|
-
var dropZoneContext = (0,
|
|
7256
|
-
var ZoneStoreContext = (0,
|
|
7478
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
7479
|
+
var dropZoneContext = (0, import_react44.createContext)(null);
|
|
7480
|
+
var ZoneStoreContext = (0, import_react44.createContext)(
|
|
7257
7481
|
(0, import_zustand3.createStore)(() => ({
|
|
7258
7482
|
zoneDepthIndex: {},
|
|
7259
7483
|
nextZoneDepthIndex: {},
|
|
@@ -7269,14 +7493,14 @@ var ZoneStoreProvider = ({
|
|
|
7269
7493
|
children,
|
|
7270
7494
|
store
|
|
7271
7495
|
}) => {
|
|
7272
|
-
return /* @__PURE__ */ (0,
|
|
7496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ZoneStoreContext.Provider, { value: store, children });
|
|
7273
7497
|
};
|
|
7274
7498
|
var DropZoneProvider = ({
|
|
7275
7499
|
children,
|
|
7276
7500
|
value
|
|
7277
7501
|
}) => {
|
|
7278
7502
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
7279
|
-
const registerZone = (0,
|
|
7503
|
+
const registerZone = (0, import_react44.useCallback)(
|
|
7280
7504
|
(zoneCompound) => {
|
|
7281
7505
|
dispatch({
|
|
7282
7506
|
type: "registerZone",
|
|
@@ -7285,13 +7509,13 @@ var DropZoneProvider = ({
|
|
|
7285
7509
|
},
|
|
7286
7510
|
[dispatch]
|
|
7287
7511
|
);
|
|
7288
|
-
const memoValue = (0,
|
|
7512
|
+
const memoValue = (0, import_react44.useMemo)(
|
|
7289
7513
|
() => __spreadValues({
|
|
7290
7514
|
registerZone
|
|
7291
7515
|
}, value),
|
|
7292
7516
|
[value]
|
|
7293
7517
|
);
|
|
7294
|
-
return /* @__PURE__ */ (0,
|
|
7518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
|
|
7295
7519
|
};
|
|
7296
7520
|
|
|
7297
7521
|
// components/DraggableComponent/index.tsx
|
|
@@ -7316,11 +7540,11 @@ function accumulateTransform(el) {
|
|
|
7316
7540
|
|
|
7317
7541
|
// lib/use-context-store.ts
|
|
7318
7542
|
init_react_import();
|
|
7319
|
-
var
|
|
7543
|
+
var import_react45 = require("react");
|
|
7320
7544
|
var import_zustand4 = require("zustand");
|
|
7321
7545
|
var import_shallow = require("zustand/react/shallow");
|
|
7322
7546
|
function useContextStore(context, selector) {
|
|
7323
|
-
const store = (0,
|
|
7547
|
+
const store = (0, import_react45.useContext)(context);
|
|
7324
7548
|
if (!store) {
|
|
7325
7549
|
throw new Error("useContextStore must be used inside context");
|
|
7326
7550
|
}
|
|
@@ -7329,11 +7553,11 @@ function useContextStore(context, selector) {
|
|
|
7329
7553
|
|
|
7330
7554
|
// lib/dnd/use-on-drag-finished.ts
|
|
7331
7555
|
init_react_import();
|
|
7332
|
-
var
|
|
7556
|
+
var import_react46 = require("react");
|
|
7333
7557
|
init_store();
|
|
7334
7558
|
var useOnDragFinished = (cb, deps = []) => {
|
|
7335
7559
|
const appStore = useAppStoreApi();
|
|
7336
|
-
return (0,
|
|
7560
|
+
return (0, import_react46.useCallback)(() => {
|
|
7337
7561
|
let dispose = () => {
|
|
7338
7562
|
};
|
|
7339
7563
|
const processDragging = (isDragging2) => {
|
|
@@ -7362,7 +7586,7 @@ var useOnDragFinished = (cb, deps = []) => {
|
|
|
7362
7586
|
|
|
7363
7587
|
// components/DraggableComponent/index.tsx
|
|
7364
7588
|
init_RichTextMenu();
|
|
7365
|
-
var
|
|
7589
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
7366
7590
|
var getClassName20 = get_class_name_factory_default("DraggableComponent", styles_module_default15);
|
|
7367
7591
|
var DEBUG2 = false;
|
|
7368
7592
|
var space = 8;
|
|
@@ -7373,16 +7597,16 @@ var DefaultActionBar = ({
|
|
|
7373
7597
|
label,
|
|
7374
7598
|
children,
|
|
7375
7599
|
parentAction
|
|
7376
|
-
}) => /* @__PURE__ */ (0,
|
|
7377
|
-
/* @__PURE__ */ (0,
|
|
7600
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(ActionBar, { children: [
|
|
7601
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(ActionBar.Group, { children: [
|
|
7378
7602
|
parentAction,
|
|
7379
|
-
label && /* @__PURE__ */ (0,
|
|
7603
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ActionBar.Label, { label })
|
|
7380
7604
|
] }),
|
|
7381
|
-
/* @__PURE__ */ (0,
|
|
7605
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ActionBar.Group, { children })
|
|
7382
7606
|
] });
|
|
7383
7607
|
var DefaultOverlay = ({
|
|
7384
7608
|
children
|
|
7385
|
-
}) => /* @__PURE__ */ (0,
|
|
7609
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, { children });
|
|
7386
7610
|
var DraggableComponent = ({
|
|
7387
7611
|
children,
|
|
7388
7612
|
depth,
|
|
@@ -7407,9 +7631,9 @@ var DraggableComponent = ({
|
|
|
7407
7631
|
const overrides = useAppStore((s) => s.overrides);
|
|
7408
7632
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
7409
7633
|
const iframe = useAppStore((s) => s.iframe);
|
|
7410
|
-
const ctx = (0,
|
|
7411
|
-
const [localZones, setLocalZones] = (0,
|
|
7412
|
-
const registerLocalZone = (0,
|
|
7634
|
+
const ctx = (0, import_react47.useContext)(dropZoneContext);
|
|
7635
|
+
const [localZones, setLocalZones] = (0, import_react47.useState)({});
|
|
7636
|
+
const registerLocalZone = (0, import_react47.useCallback)(
|
|
7413
7637
|
(zoneCompound2, active) => {
|
|
7414
7638
|
var _a;
|
|
7415
7639
|
(_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
|
|
@@ -7419,7 +7643,7 @@ var DraggableComponent = ({
|
|
|
7419
7643
|
},
|
|
7420
7644
|
[setLocalZones]
|
|
7421
7645
|
);
|
|
7422
|
-
const unregisterLocalZone = (0,
|
|
7646
|
+
const unregisterLocalZone = (0, import_react47.useCallback)(
|
|
7423
7647
|
(zoneCompound2) => {
|
|
7424
7648
|
var _a;
|
|
7425
7649
|
(_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
|
|
@@ -7442,9 +7666,9 @@ var DraggableComponent = ({
|
|
|
7442
7666
|
return s.permissions.getPermissions({ item });
|
|
7443
7667
|
})
|
|
7444
7668
|
);
|
|
7445
|
-
const zoneStore = (0,
|
|
7446
|
-
const [dragAxis, setDragAxis] = (0,
|
|
7447
|
-
const dynamicCollisionDetector = (0,
|
|
7669
|
+
const zoneStore = (0, import_react47.useContext)(ZoneStoreContext);
|
|
7670
|
+
const [dragAxis, setDragAxis] = (0, import_react47.useState)(userDragAxis || autoDragAxis);
|
|
7671
|
+
const dynamicCollisionDetector = (0, import_react47.useMemo)(
|
|
7448
7672
|
() => createDynamicCollisionDetector(dragAxis),
|
|
7449
7673
|
[dragAxis]
|
|
7450
7674
|
);
|
|
@@ -7476,7 +7700,7 @@ var DraggableComponent = ({
|
|
|
7476
7700
|
},
|
|
7477
7701
|
feedback: "clone"
|
|
7478
7702
|
});
|
|
7479
|
-
(0,
|
|
7703
|
+
(0, import_react47.useEffect)(() => {
|
|
7480
7704
|
const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
|
|
7481
7705
|
sortable.droppable.disabled = !isEnabled;
|
|
7482
7706
|
sortable.draggable.disabled = !permissions.drag;
|
|
@@ -7493,9 +7717,9 @@ var DraggableComponent = ({
|
|
|
7493
7717
|
}
|
|
7494
7718
|
return cleanup;
|
|
7495
7719
|
}, [permissions.drag, zoneCompound]);
|
|
7496
|
-
const [, setRerender] = (0,
|
|
7497
|
-
const ref = (0,
|
|
7498
|
-
const refSetter = (0,
|
|
7720
|
+
const [, setRerender] = (0, import_react47.useState)(0);
|
|
7721
|
+
const ref = (0, import_react47.useRef)(null);
|
|
7722
|
+
const refSetter = (0, import_react47.useCallback)(
|
|
7499
7723
|
(el) => {
|
|
7500
7724
|
sortableRef(el);
|
|
7501
7725
|
if (ref.current !== el) {
|
|
@@ -7505,14 +7729,14 @@ var DraggableComponent = ({
|
|
|
7505
7729
|
},
|
|
7506
7730
|
[sortableRef]
|
|
7507
7731
|
);
|
|
7508
|
-
const [portalEl, setPortalEl] = (0,
|
|
7509
|
-
(0,
|
|
7732
|
+
const [portalEl, setPortalEl] = (0, import_react47.useState)();
|
|
7733
|
+
(0, import_react47.useEffect)(() => {
|
|
7510
7734
|
var _a, _b, _c;
|
|
7511
7735
|
setPortalEl(
|
|
7512
7736
|
iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
|
|
7513
7737
|
);
|
|
7514
7738
|
}, [iframe.enabled, ref.current]);
|
|
7515
|
-
const getStyle = (0,
|
|
7739
|
+
const getStyle = (0, import_react47.useCallback)(() => {
|
|
7516
7740
|
var _a, _b, _c;
|
|
7517
7741
|
if (!ref.current) return;
|
|
7518
7742
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -7537,11 +7761,11 @@ var DraggableComponent = ({
|
|
|
7537
7761
|
};
|
|
7538
7762
|
return style2;
|
|
7539
7763
|
}, [ref.current]);
|
|
7540
|
-
const [style, setStyle] = (0,
|
|
7541
|
-
const sync = (0,
|
|
7764
|
+
const [style, setStyle] = (0, import_react47.useState)();
|
|
7765
|
+
const sync = (0, import_react47.useCallback)(() => {
|
|
7542
7766
|
setStyle(getStyle());
|
|
7543
7767
|
}, [ref.current, iframe]);
|
|
7544
|
-
(0,
|
|
7768
|
+
(0, import_react47.useEffect)(() => {
|
|
7545
7769
|
if (ref.current) {
|
|
7546
7770
|
const observer = new ResizeObserver(sync);
|
|
7547
7771
|
observer.observe(ref.current);
|
|
@@ -7551,13 +7775,13 @@ var DraggableComponent = ({
|
|
|
7551
7775
|
}
|
|
7552
7776
|
}, [ref.current]);
|
|
7553
7777
|
const registerNode = useAppStore((s) => s.nodes.registerNode);
|
|
7554
|
-
const hideOverlay = (0,
|
|
7778
|
+
const hideOverlay = (0, import_react47.useCallback)(() => {
|
|
7555
7779
|
setIsVisible(false);
|
|
7556
7780
|
}, []);
|
|
7557
|
-
const showOverlay = (0,
|
|
7781
|
+
const showOverlay = (0, import_react47.useCallback)(() => {
|
|
7558
7782
|
setIsVisible(true);
|
|
7559
7783
|
}, []);
|
|
7560
|
-
(0,
|
|
7784
|
+
(0, import_react47.useEffect)(() => {
|
|
7561
7785
|
var _a;
|
|
7562
7786
|
registerNode(id, {
|
|
7563
7787
|
methods: { sync, showOverlay, hideOverlay },
|
|
@@ -7574,15 +7798,15 @@ var DraggableComponent = ({
|
|
|
7574
7798
|
});
|
|
7575
7799
|
};
|
|
7576
7800
|
}, [id, zoneCompound, index, componentType, sync]);
|
|
7577
|
-
const CustomActionBar = (0,
|
|
7801
|
+
const CustomActionBar = (0, import_react47.useMemo)(
|
|
7578
7802
|
() => overrides.actionBar || DefaultActionBar,
|
|
7579
7803
|
[overrides.actionBar]
|
|
7580
7804
|
);
|
|
7581
|
-
const CustomOverlay = (0,
|
|
7805
|
+
const CustomOverlay = (0, import_react47.useMemo)(
|
|
7582
7806
|
() => overrides.componentOverlay || DefaultOverlay,
|
|
7583
7807
|
[overrides.componentOverlay]
|
|
7584
7808
|
);
|
|
7585
|
-
const onClick = (0,
|
|
7809
|
+
const onClick = (0, import_react47.useCallback)(
|
|
7586
7810
|
(e) => {
|
|
7587
7811
|
const el = e.target;
|
|
7588
7812
|
if (!el.closest("[data-puck-overlay-portal]")) {
|
|
@@ -7598,7 +7822,7 @@ var DraggableComponent = ({
|
|
|
7598
7822
|
[index, zoneCompound, id]
|
|
7599
7823
|
);
|
|
7600
7824
|
const appStore = useAppStoreApi();
|
|
7601
|
-
const onSelectParent = (0,
|
|
7825
|
+
const onSelectParent = (0, import_react47.useCallback)(() => {
|
|
7602
7826
|
const { nodes, zones } = appStore.getState().state.indexes;
|
|
7603
7827
|
const node = nodes[id];
|
|
7604
7828
|
const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
|
|
@@ -7619,26 +7843,26 @@ var DraggableComponent = ({
|
|
|
7619
7843
|
}
|
|
7620
7844
|
});
|
|
7621
7845
|
}, [ctx, path]);
|
|
7622
|
-
const onDuplicate = (0,
|
|
7846
|
+
const onDuplicate = (0, import_react47.useCallback)(() => {
|
|
7623
7847
|
dispatch({
|
|
7624
7848
|
type: "duplicate",
|
|
7625
7849
|
sourceIndex: index,
|
|
7626
7850
|
sourceZone: zoneCompound
|
|
7627
7851
|
});
|
|
7628
7852
|
}, [index, zoneCompound]);
|
|
7629
|
-
const onDelete = (0,
|
|
7853
|
+
const onDelete = (0, import_react47.useCallback)(() => {
|
|
7630
7854
|
dispatch({
|
|
7631
7855
|
type: "remove",
|
|
7632
7856
|
index,
|
|
7633
7857
|
zone: zoneCompound
|
|
7634
7858
|
});
|
|
7635
7859
|
}, [index, zoneCompound]);
|
|
7636
|
-
const [hover, setHover] = (0,
|
|
7860
|
+
const [hover, setHover] = (0, import_react47.useState)(false);
|
|
7637
7861
|
const indicativeHover = useContextStore(
|
|
7638
7862
|
ZoneStoreContext,
|
|
7639
7863
|
(s) => s.hoveringComponent === id
|
|
7640
7864
|
);
|
|
7641
|
-
(0,
|
|
7865
|
+
(0, import_react47.useEffect)(() => {
|
|
7642
7866
|
if (!ref.current) {
|
|
7643
7867
|
return;
|
|
7644
7868
|
}
|
|
@@ -7683,10 +7907,10 @@ var DraggableComponent = ({
|
|
|
7683
7907
|
thisIsDragging,
|
|
7684
7908
|
inDroppableZone
|
|
7685
7909
|
]);
|
|
7686
|
-
const [isVisible, setIsVisible] = (0,
|
|
7687
|
-
const [dragFinished, setDragFinished] = (0,
|
|
7688
|
-
const [_, startTransition] = (0,
|
|
7689
|
-
(0,
|
|
7910
|
+
const [isVisible, setIsVisible] = (0, import_react47.useState)(false);
|
|
7911
|
+
const [dragFinished, setDragFinished] = (0, import_react47.useState)(true);
|
|
7912
|
+
const [_, startTransition] = (0, import_react47.useTransition)();
|
|
7913
|
+
(0, import_react47.useEffect)(() => {
|
|
7690
7914
|
startTransition(() => {
|
|
7691
7915
|
if (hover || indicativeHover || isSelected) {
|
|
7692
7916
|
sync();
|
|
@@ -7697,7 +7921,7 @@ var DraggableComponent = ({
|
|
|
7697
7921
|
}
|
|
7698
7922
|
});
|
|
7699
7923
|
}, [hover, indicativeHover, isSelected, iframe]);
|
|
7700
|
-
const [thisWasDragging, setThisWasDragging] = (0,
|
|
7924
|
+
const [thisWasDragging, setThisWasDragging] = (0, import_react47.useState)(false);
|
|
7701
7925
|
const onDragFinished = useOnDragFinished((finished) => {
|
|
7702
7926
|
if (finished) {
|
|
7703
7927
|
startTransition(() => {
|
|
@@ -7708,15 +7932,15 @@ var DraggableComponent = ({
|
|
|
7708
7932
|
setDragFinished(false);
|
|
7709
7933
|
}
|
|
7710
7934
|
});
|
|
7711
|
-
(0,
|
|
7935
|
+
(0, import_react47.useEffect)(() => {
|
|
7712
7936
|
if (thisIsDragging) {
|
|
7713
7937
|
setThisWasDragging(true);
|
|
7714
7938
|
}
|
|
7715
7939
|
}, [thisIsDragging]);
|
|
7716
|
-
(0,
|
|
7940
|
+
(0, import_react47.useEffect)(() => {
|
|
7717
7941
|
if (thisWasDragging) return onDragFinished();
|
|
7718
7942
|
}, [thisWasDragging, onDragFinished]);
|
|
7719
|
-
const syncActionsPosition = (0,
|
|
7943
|
+
const syncActionsPosition = (0, import_react47.useCallback)(
|
|
7720
7944
|
(el) => {
|
|
7721
7945
|
if (el) {
|
|
7722
7946
|
const view = el.ownerDocument.defaultView;
|
|
@@ -7741,7 +7965,7 @@ var DraggableComponent = ({
|
|
|
7741
7965
|
},
|
|
7742
7966
|
[zoom]
|
|
7743
7967
|
);
|
|
7744
|
-
(0,
|
|
7968
|
+
(0, import_react47.useEffect)(() => {
|
|
7745
7969
|
if (userDragAxis) {
|
|
7746
7970
|
setDragAxis(userDragAxis);
|
|
7747
7971
|
return;
|
|
@@ -7755,11 +7979,11 @@ var DraggableComponent = ({
|
|
|
7755
7979
|
}
|
|
7756
7980
|
setDragAxis(autoDragAxis);
|
|
7757
7981
|
}, [ref, userDragAxis, autoDragAxis]);
|
|
7758
|
-
const parentAction = (0,
|
|
7759
|
-
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0,
|
|
7982
|
+
const parentAction = (0, import_react47.useMemo)(
|
|
7983
|
+
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CornerLeftUp, { size: 16 }) }),
|
|
7760
7984
|
[ctx == null ? void 0 : ctx.areaId]
|
|
7761
7985
|
);
|
|
7762
|
-
const nextContextValue = (0,
|
|
7986
|
+
const nextContextValue = (0, import_react47.useMemo)(
|
|
7763
7987
|
() => __spreadProps(__spreadValues({}, ctx), {
|
|
7764
7988
|
areaId: id,
|
|
7765
7989
|
zoneCompound,
|
|
@@ -7785,9 +8009,9 @@ var DraggableComponent = ({
|
|
|
7785
8009
|
}
|
|
7786
8010
|
);
|
|
7787
8011
|
const hasNormalActions = permissions.duplicate || permissions.delete;
|
|
7788
|
-
return /* @__PURE__ */ (0,
|
|
8012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(DropZoneProvider, { value: nextContextValue, children: [
|
|
7789
8013
|
dragFinished && isVisible && (0, import_react_dom2.createPortal)(
|
|
7790
|
-
/* @__PURE__ */ (0,
|
|
8014
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
7791
8015
|
"div",
|
|
7792
8016
|
{
|
|
7793
8017
|
className: getClassName20({
|
|
@@ -7799,15 +8023,15 @@ var DraggableComponent = ({
|
|
|
7799
8023
|
"data-puck-overlay": true,
|
|
7800
8024
|
children: [
|
|
7801
8025
|
debug,
|
|
7802
|
-
isLoading && /* @__PURE__ */ (0,
|
|
7803
|
-
/* @__PURE__ */ (0,
|
|
8026
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Loader, {}) }),
|
|
8027
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7804
8028
|
"div",
|
|
7805
8029
|
{
|
|
7806
8030
|
className: getClassName20("actionsOverlay"),
|
|
7807
8031
|
style: {
|
|
7808
8032
|
top: actionsOverlayTop / zoom
|
|
7809
8033
|
},
|
|
7810
|
-
children: /* @__PURE__ */ (0,
|
|
8034
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7811
8035
|
"div",
|
|
7812
8036
|
{
|
|
7813
8037
|
className: getClassName20("actions"),
|
|
@@ -7819,14 +8043,14 @@ var DraggableComponent = ({
|
|
|
7819
8043
|
paddingRight: actionsSide
|
|
7820
8044
|
},
|
|
7821
8045
|
ref: syncActionsPosition,
|
|
7822
|
-
children: /* @__PURE__ */ (0,
|
|
8046
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
7823
8047
|
CustomActionBar,
|
|
7824
8048
|
{
|
|
7825
8049
|
parentAction,
|
|
7826
8050
|
label: DEBUG2 ? id : label,
|
|
7827
8051
|
children: [
|
|
7828
|
-
richText && /* @__PURE__ */ (0,
|
|
7829
|
-
/* @__PURE__ */ (0,
|
|
8052
|
+
richText && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
8053
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7830
8054
|
LoadedRichTextMenu,
|
|
7831
8055
|
{
|
|
7832
8056
|
editor: richText.editor,
|
|
@@ -7835,10 +8059,10 @@ var DraggableComponent = ({
|
|
|
7835
8059
|
readOnly: false
|
|
7836
8060
|
}
|
|
7837
8061
|
),
|
|
7838
|
-
hasNormalActions && /* @__PURE__ */ (0,
|
|
8062
|
+
hasNormalActions && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ActionBar.Separator, {})
|
|
7839
8063
|
] }),
|
|
7840
|
-
permissions.duplicate && /* @__PURE__ */ (0,
|
|
7841
|
-
permissions.delete && /* @__PURE__ */ (0,
|
|
8064
|
+
permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Copy, { size: 16 }) }),
|
|
8065
|
+
permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Trash, { size: 16 }) })
|
|
7842
8066
|
]
|
|
7843
8067
|
}
|
|
7844
8068
|
)
|
|
@@ -7846,14 +8070,14 @@ var DraggableComponent = ({
|
|
|
7846
8070
|
)
|
|
7847
8071
|
}
|
|
7848
8072
|
),
|
|
7849
|
-
/* @__PURE__ */ (0,
|
|
8073
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: getClassName20("overlayWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
7850
8074
|
CustomOverlay,
|
|
7851
8075
|
{
|
|
7852
8076
|
componentId: id,
|
|
7853
8077
|
componentType,
|
|
7854
8078
|
hover,
|
|
7855
8079
|
isSelected,
|
|
7856
|
-
children: /* @__PURE__ */ (0,
|
|
8080
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: getClassName20("overlay") })
|
|
7857
8081
|
}
|
|
7858
8082
|
) })
|
|
7859
8083
|
]
|
|
@@ -7876,11 +8100,11 @@ var styles_module_default16 = { "DropZone": "_DropZone_1i2sv_1", "DropZone--hasC
|
|
|
7876
8100
|
|
|
7877
8101
|
// components/DropZone/index.tsx
|
|
7878
8102
|
init_store();
|
|
7879
|
-
var
|
|
8103
|
+
var import_react61 = require("@dnd-kit/react");
|
|
7880
8104
|
|
|
7881
8105
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
7882
8106
|
init_react_import();
|
|
7883
|
-
var
|
|
8107
|
+
var import_react48 = require("react");
|
|
7884
8108
|
init_store();
|
|
7885
8109
|
var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
|
|
7886
8110
|
var useMinEmptyHeight = ({
|
|
@@ -7889,8 +8113,8 @@ var useMinEmptyHeight = ({
|
|
|
7889
8113
|
ref
|
|
7890
8114
|
}) => {
|
|
7891
8115
|
const appStore = useAppStoreApi();
|
|
7892
|
-
const [prevHeight, setPrevHeight] = (0,
|
|
7893
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
8116
|
+
const [prevHeight, setPrevHeight] = (0, import_react48.useState)(0);
|
|
8117
|
+
const [isAnimating, setIsAnimating] = (0, import_react48.useState)(false);
|
|
7894
8118
|
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
|
7895
8119
|
var _a, _b;
|
|
7896
8120
|
return {
|
|
@@ -7898,7 +8122,7 @@ var useMinEmptyHeight = ({
|
|
|
7898
8122
|
isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
|
|
7899
8123
|
};
|
|
7900
8124
|
});
|
|
7901
|
-
const numItems = (0,
|
|
8125
|
+
const numItems = (0, import_react48.useRef)(0);
|
|
7902
8126
|
const onDragFinished = useOnDragFinished(
|
|
7903
8127
|
(finished) => {
|
|
7904
8128
|
var _a;
|
|
@@ -7933,7 +8157,7 @@ var useMinEmptyHeight = ({
|
|
|
7933
8157
|
},
|
|
7934
8158
|
[appStore, prevHeight, zoneCompound]
|
|
7935
8159
|
);
|
|
7936
|
-
(0,
|
|
8160
|
+
(0, import_react48.useEffect)(() => {
|
|
7937
8161
|
if (draggedItem && ref.current) {
|
|
7938
8162
|
if (isZone) {
|
|
7939
8163
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -7965,15 +8189,15 @@ function assignRefs(refs, node) {
|
|
|
7965
8189
|
|
|
7966
8190
|
// components/DropZone/lib/use-content-with-preview.ts
|
|
7967
8191
|
init_react_import();
|
|
7968
|
-
var
|
|
8192
|
+
var import_react51 = require("react");
|
|
7969
8193
|
|
|
7970
8194
|
// lib/dnd/use-rendered-callback.ts
|
|
7971
8195
|
init_react_import();
|
|
7972
|
-
var
|
|
7973
|
-
var
|
|
8196
|
+
var import_react49 = require("@dnd-kit/react");
|
|
8197
|
+
var import_react50 = require("react");
|
|
7974
8198
|
function useRenderedCallback(callback, deps) {
|
|
7975
|
-
const manager = (0,
|
|
7976
|
-
return (0,
|
|
8199
|
+
const manager = (0, import_react49.useDragDropManager)();
|
|
8200
|
+
return (0, import_react50.useCallback)(
|
|
7977
8201
|
(...args) => __async(null, null, function* () {
|
|
7978
8202
|
yield manager == null ? void 0 : manager.renderer.rendering;
|
|
7979
8203
|
return callback(...args);
|
|
@@ -7986,14 +8210,14 @@ function useRenderedCallback(callback, deps) {
|
|
|
7986
8210
|
init_insert();
|
|
7987
8211
|
init_store();
|
|
7988
8212
|
var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
7989
|
-
const zoneStore = (0,
|
|
8213
|
+
const zoneStore = (0, import_react51.useContext)(ZoneStoreContext);
|
|
7990
8214
|
const preview = useContextStore(
|
|
7991
8215
|
ZoneStoreContext,
|
|
7992
8216
|
(s) => s.previewIndex[zoneCompound]
|
|
7993
8217
|
);
|
|
7994
8218
|
const isDragging = useAppStore((s) => s.state.ui.isDragging);
|
|
7995
|
-
const [contentIdsWithPreview, setContentIdsWithPreview] = (0,
|
|
7996
|
-
const [localPreview, setLocalPreview] = (0,
|
|
8219
|
+
const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react51.useState)(contentIds);
|
|
8220
|
+
const [localPreview, setLocalPreview] = (0, import_react51.useState)(
|
|
7997
8221
|
preview
|
|
7998
8222
|
);
|
|
7999
8223
|
const updateContent = useRenderedCallback(
|
|
@@ -8028,7 +8252,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
8028
8252
|
},
|
|
8029
8253
|
[]
|
|
8030
8254
|
);
|
|
8031
|
-
(0,
|
|
8255
|
+
(0, import_react51.useEffect)(() => {
|
|
8032
8256
|
var _a;
|
|
8033
8257
|
const s = zoneStore.getState();
|
|
8034
8258
|
const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
|
@@ -8046,17 +8270,17 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
8046
8270
|
|
|
8047
8271
|
// components/DropZone/lib/use-drag-axis.ts
|
|
8048
8272
|
init_react_import();
|
|
8049
|
-
var
|
|
8273
|
+
var import_react52 = require("react");
|
|
8050
8274
|
init_store();
|
|
8051
8275
|
var GRID_DRAG_AXIS = "dynamic";
|
|
8052
8276
|
var FLEX_ROW_DRAG_AXIS = "x";
|
|
8053
8277
|
var DEFAULT_DRAG_AXIS = "y";
|
|
8054
8278
|
var useDragAxis = (ref, collisionAxis) => {
|
|
8055
8279
|
const status = useAppStore((s) => s.status);
|
|
8056
|
-
const [dragAxis, setDragAxis] = (0,
|
|
8280
|
+
const [dragAxis, setDragAxis] = (0, import_react52.useState)(
|
|
8057
8281
|
collisionAxis || DEFAULT_DRAG_AXIS
|
|
8058
8282
|
);
|
|
8059
|
-
const calculateDragAxis = (0,
|
|
8283
|
+
const calculateDragAxis = (0, import_react52.useCallback)(() => {
|
|
8060
8284
|
if (ref.current) {
|
|
8061
8285
|
const computedStyle = window.getComputedStyle(ref.current);
|
|
8062
8286
|
if (computedStyle.display === "grid") {
|
|
@@ -8068,7 +8292,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
8068
8292
|
}
|
|
8069
8293
|
}
|
|
8070
8294
|
}, [ref.current]);
|
|
8071
|
-
(0,
|
|
8295
|
+
(0, import_react52.useEffect)(() => {
|
|
8072
8296
|
const onViewportChange = () => {
|
|
8073
8297
|
calculateDragAxis();
|
|
8074
8298
|
};
|
|
@@ -8077,7 +8301,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
8077
8301
|
window.removeEventListener("viewportchange", onViewportChange);
|
|
8078
8302
|
};
|
|
8079
8303
|
}, []);
|
|
8080
|
-
(0,
|
|
8304
|
+
(0, import_react52.useEffect)(calculateDragAxis, [status, collisionAxis]);
|
|
8081
8305
|
return [dragAxis, calculateDragAxis];
|
|
8082
8306
|
};
|
|
8083
8307
|
|
|
@@ -8093,10 +8317,10 @@ init_react_import();
|
|
|
8093
8317
|
|
|
8094
8318
|
// lib/field-transforms/use-field-transforms.tsx
|
|
8095
8319
|
init_react_import();
|
|
8096
|
-
var
|
|
8320
|
+
var import_react53 = require("react");
|
|
8097
8321
|
init_map_fields();
|
|
8098
8322
|
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
8099
|
-
const mappers = (0,
|
|
8323
|
+
const mappers = (0, import_react53.useMemo)(() => {
|
|
8100
8324
|
return Object.keys(transforms).reduce((acc, _fieldType) => {
|
|
8101
8325
|
const fieldType = _fieldType;
|
|
8102
8326
|
return __spreadProps(__spreadValues({}, acc), {
|
|
@@ -8117,11 +8341,11 @@ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
|
8117
8341
|
});
|
|
8118
8342
|
}, {});
|
|
8119
8343
|
}, [transforms, readOnly, forceReadOnly]);
|
|
8120
|
-
const transformedProps = (0,
|
|
8344
|
+
const transformedProps = (0, import_react53.useMemo)(() => {
|
|
8121
8345
|
const mapped = mapFields(item, mappers, config).props;
|
|
8122
8346
|
return mapped;
|
|
8123
8347
|
}, [config, item, mappers]);
|
|
8124
|
-
const mergedProps = (0,
|
|
8348
|
+
const mergedProps = (0, import_react53.useMemo)(
|
|
8125
8349
|
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
8126
8350
|
[item.props, transformedProps]
|
|
8127
8351
|
);
|
|
@@ -8156,7 +8380,7 @@ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdi
|
|
|
8156
8380
|
}
|
|
8157
8381
|
|
|
8158
8382
|
// components/Render/index.tsx
|
|
8159
|
-
var
|
|
8383
|
+
var import_react57 = __toESM(require("react"));
|
|
8160
8384
|
|
|
8161
8385
|
// components/SlotRender/index.tsx
|
|
8162
8386
|
init_react_import();
|
|
@@ -8165,20 +8389,20 @@ init_store();
|
|
|
8165
8389
|
|
|
8166
8390
|
// components/SlotRender/server.tsx
|
|
8167
8391
|
init_react_import();
|
|
8168
|
-
var
|
|
8392
|
+
var import_react56 = require("react");
|
|
8169
8393
|
|
|
8170
8394
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
8171
8395
|
init_react_import();
|
|
8172
|
-
var
|
|
8396
|
+
var import_react55 = require("react");
|
|
8173
8397
|
|
|
8174
8398
|
// components/RichTextEditor/components/RenderFallback.tsx
|
|
8175
8399
|
init_react_import();
|
|
8176
8400
|
init_get_class_name_factory();
|
|
8177
8401
|
init_styles_module6();
|
|
8178
|
-
var
|
|
8402
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
8179
8403
|
var getClassName21 = get_class_name_factory_default("RichTextEditor", styles_module_default12);
|
|
8180
8404
|
function RichTextRenderFallback({ content }) {
|
|
8181
|
-
return /* @__PURE__ */ (0,
|
|
8405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: getClassName21(), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
8182
8406
|
"div",
|
|
8183
8407
|
{
|
|
8184
8408
|
className: "rich-text",
|
|
@@ -8188,7 +8412,7 @@ function RichTextRenderFallback({ content }) {
|
|
|
8188
8412
|
}
|
|
8189
8413
|
|
|
8190
8414
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
8191
|
-
var
|
|
8415
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
8192
8416
|
function useRichtextProps(fields, props) {
|
|
8193
8417
|
const findAllRichtextKeys = (fields2) => {
|
|
8194
8418
|
if (!fields2) return [];
|
|
@@ -8200,16 +8424,16 @@ function useRichtextProps(fields, props) {
|
|
|
8200
8424
|
}
|
|
8201
8425
|
return result;
|
|
8202
8426
|
};
|
|
8203
|
-
const richtextKeys = (0,
|
|
8204
|
-
const richtextProps = (0,
|
|
8427
|
+
const richtextKeys = (0, import_react55.useMemo)(() => findAllRichtextKeys(fields), [fields]);
|
|
8428
|
+
const richtextProps = (0, import_react55.useMemo)(() => {
|
|
8205
8429
|
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
8206
|
-
const RichTextRender3 = (0,
|
|
8430
|
+
const RichTextRender3 = (0, import_react55.lazy)(
|
|
8207
8431
|
() => Promise.resolve().then(() => (init_Render(), Render_exports)).then((m) => ({
|
|
8208
8432
|
default: m.RichTextRender
|
|
8209
8433
|
}))
|
|
8210
8434
|
);
|
|
8211
8435
|
return richtextKeys.reduce((acc, key) => {
|
|
8212
|
-
acc[key] = /* @__PURE__ */ (0,
|
|
8436
|
+
acc[key] = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react55.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
8213
8437
|
RichTextRender3,
|
|
8214
8438
|
{
|
|
8215
8439
|
content: props[key],
|
|
@@ -8223,17 +8447,17 @@ function useRichtextProps(fields, props) {
|
|
|
8223
8447
|
}
|
|
8224
8448
|
|
|
8225
8449
|
// components/SlotRender/server.tsx
|
|
8226
|
-
var
|
|
8227
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ (0,
|
|
8450
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
8451
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(SlotRender, __spreadValues({}, props));
|
|
8228
8452
|
var Item2 = ({
|
|
8229
8453
|
config,
|
|
8230
8454
|
item,
|
|
8231
8455
|
metadata
|
|
8232
8456
|
}) => {
|
|
8233
8457
|
const Component = config.components[item.type];
|
|
8234
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
8458
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
8235
8459
|
const richtextProps = useRichtextProps(Component.fields, props);
|
|
8236
|
-
return /* @__PURE__ */ (0,
|
|
8460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8237
8461
|
Component.render,
|
|
8238
8462
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
8239
8463
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
@@ -8242,14 +8466,14 @@ var Item2 = ({
|
|
|
8242
8466
|
})
|
|
8243
8467
|
);
|
|
8244
8468
|
};
|
|
8245
|
-
var SlotRender = (0,
|
|
8469
|
+
var SlotRender = (0, import_react56.forwardRef)(
|
|
8246
8470
|
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
8247
8471
|
const El = as != null ? as : "div";
|
|
8248
|
-
return /* @__PURE__ */ (0,
|
|
8472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
8249
8473
|
if (!config.components[item.type]) {
|
|
8250
8474
|
return null;
|
|
8251
8475
|
}
|
|
8252
|
-
return /* @__PURE__ */ (0,
|
|
8476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8253
8477
|
Item2,
|
|
8254
8478
|
{
|
|
8255
8479
|
config,
|
|
@@ -8263,7 +8487,7 @@ var SlotRender = (0, import_react52.forwardRef)(
|
|
|
8263
8487
|
);
|
|
8264
8488
|
|
|
8265
8489
|
// components/SlotRender/index.tsx
|
|
8266
|
-
var
|
|
8490
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
8267
8491
|
var ContextSlotRender = ({
|
|
8268
8492
|
componentId,
|
|
8269
8493
|
zone
|
|
@@ -8278,7 +8502,7 @@ var ContextSlotRender = ({
|
|
|
8278
8502
|
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
8279
8503
|
})
|
|
8280
8504
|
);
|
|
8281
|
-
return /* @__PURE__ */ (0,
|
|
8505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
8282
8506
|
SlotRenderPure,
|
|
8283
8507
|
{
|
|
8284
8508
|
content: slotContent,
|
|
@@ -8290,8 +8514,8 @@ var ContextSlotRender = ({
|
|
|
8290
8514
|
};
|
|
8291
8515
|
|
|
8292
8516
|
// components/Render/index.tsx
|
|
8293
|
-
var
|
|
8294
|
-
var renderContext =
|
|
8517
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
8518
|
+
var renderContext = import_react57.default.createContext({
|
|
8295
8519
|
config: { components: {} },
|
|
8296
8520
|
data: { root: {}, content: [] },
|
|
8297
8521
|
metadata: {}
|
|
@@ -8322,10 +8546,10 @@ function Render({
|
|
|
8322
8546
|
const propsWithSlots = useSlots(
|
|
8323
8547
|
config,
|
|
8324
8548
|
{ type: "root", props: pageProps },
|
|
8325
|
-
(props) => /* @__PURE__ */ (0,
|
|
8549
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
8326
8550
|
);
|
|
8327
8551
|
const richtextProps = useRichtextProps((_a = config.root) == null ? void 0 : _a.fields, pageProps);
|
|
8328
|
-
const nextContextValue = (0,
|
|
8552
|
+
const nextContextValue = (0, import_react57.useMemo)(
|
|
8329
8553
|
() => ({
|
|
8330
8554
|
mode: "render",
|
|
8331
8555
|
depth: 0
|
|
@@ -8333,9 +8557,9 @@ function Render({
|
|
|
8333
8557
|
[]
|
|
8334
8558
|
);
|
|
8335
8559
|
if ((_b = config.root) == null ? void 0 : _b.render) {
|
|
8336
|
-
return /* @__PURE__ */ (0,
|
|
8560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(config.root.render, __spreadProps(__spreadValues(__spreadValues({}, propsWithSlots), richtextProps), { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
8337
8561
|
}
|
|
8338
|
-
return /* @__PURE__ */ (0,
|
|
8562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
8339
8563
|
}
|
|
8340
8564
|
|
|
8341
8565
|
// components/DropZone/index.tsx
|
|
@@ -8346,7 +8570,7 @@ init_react_import();
|
|
|
8346
8570
|
|
|
8347
8571
|
// components/InlineTextField/index.tsx
|
|
8348
8572
|
init_react_import();
|
|
8349
|
-
var
|
|
8573
|
+
var import_react58 = require("react");
|
|
8350
8574
|
|
|
8351
8575
|
// lib/overlay-portal/index.tsx
|
|
8352
8576
|
init_react_import();
|
|
@@ -8451,7 +8675,7 @@ var getSelectorForId = (state, id) => {
|
|
|
8451
8675
|
};
|
|
8452
8676
|
|
|
8453
8677
|
// components/InlineTextField/index.tsx
|
|
8454
|
-
var
|
|
8678
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
8455
8679
|
var getClassName23 = get_class_name_factory_default("InlineTextField", styles_module_default17);
|
|
8456
8680
|
var InlineTextFieldInternal = ({
|
|
8457
8681
|
propPath,
|
|
@@ -8461,10 +8685,10 @@ var InlineTextFieldInternal = ({
|
|
|
8461
8685
|
opts = {}
|
|
8462
8686
|
}) => {
|
|
8463
8687
|
var _a;
|
|
8464
|
-
const ref = (0,
|
|
8688
|
+
const ref = (0, import_react58.useRef)(null);
|
|
8465
8689
|
const appStoreApi = useAppStoreApi();
|
|
8466
8690
|
const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
|
|
8467
|
-
(0,
|
|
8691
|
+
(0, import_react58.useEffect)(() => {
|
|
8468
8692
|
const appStore = appStoreApi.getState();
|
|
8469
8693
|
const data = appStore.state.indexes.nodes[componentId].data;
|
|
8470
8694
|
const componentConfig = appStore.getComponentConfig(data.type);
|
|
@@ -8510,9 +8734,9 @@ var InlineTextFieldInternal = ({
|
|
|
8510
8734
|
};
|
|
8511
8735
|
}
|
|
8512
8736
|
}, [appStoreApi, ref.current, value, disableLineBreaks]);
|
|
8513
|
-
const [isHovering, setIsHovering] = (0,
|
|
8514
|
-
const [isFocused, setIsFocused] = (0,
|
|
8515
|
-
return /* @__PURE__ */ (0,
|
|
8737
|
+
const [isHovering, setIsHovering] = (0, import_react58.useState)(false);
|
|
8738
|
+
const [isFocused, setIsFocused] = (0, import_react58.useState)(false);
|
|
8739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8516
8740
|
"span",
|
|
8517
8741
|
{
|
|
8518
8742
|
className: getClassName23(),
|
|
@@ -8548,14 +8772,14 @@ var InlineTextFieldInternal = ({
|
|
|
8548
8772
|
}
|
|
8549
8773
|
);
|
|
8550
8774
|
};
|
|
8551
|
-
var InlineTextField = (0,
|
|
8775
|
+
var InlineTextField = (0, import_react58.memo)(InlineTextFieldInternal);
|
|
8552
8776
|
|
|
8553
8777
|
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
8554
|
-
var
|
|
8778
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
8555
8779
|
var getInlineTextTransform = () => ({
|
|
8556
8780
|
text: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
8557
8781
|
if (field.contentEditable) {
|
|
8558
|
-
return /* @__PURE__ */ (0,
|
|
8782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
8559
8783
|
InlineTextField,
|
|
8560
8784
|
{
|
|
8561
8785
|
propPath,
|
|
@@ -8570,7 +8794,7 @@ var getInlineTextTransform = () => ({
|
|
|
8570
8794
|
},
|
|
8571
8795
|
textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
8572
8796
|
if (field.contentEditable) {
|
|
8573
|
-
return /* @__PURE__ */ (0,
|
|
8797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
8574
8798
|
InlineTextField,
|
|
8575
8799
|
{
|
|
8576
8800
|
propPath,
|
|
@@ -8584,7 +8808,7 @@ var getInlineTextTransform = () => ({
|
|
|
8584
8808
|
},
|
|
8585
8809
|
custom: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
8586
8810
|
if (field.contentEditable && typeof value === "string") {
|
|
8587
|
-
return /* @__PURE__ */ (0,
|
|
8811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
8588
8812
|
InlineTextField,
|
|
8589
8813
|
{
|
|
8590
8814
|
propPath,
|
|
@@ -8601,19 +8825,19 @@ var getInlineTextTransform = () => ({
|
|
|
8601
8825
|
// lib/field-transforms/default-transforms/rich-text-transform.tsx
|
|
8602
8826
|
init_react_import();
|
|
8603
8827
|
init_store();
|
|
8604
|
-
var
|
|
8605
|
-
var
|
|
8606
|
-
var Editor3 = (0,
|
|
8828
|
+
var import_react59 = require("react");
|
|
8829
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
8830
|
+
var Editor3 = (0, import_react59.lazy)(
|
|
8607
8831
|
() => Promise.resolve().then(() => (init_Editor(), Editor_exports)).then((m) => ({
|
|
8608
8832
|
default: m.Editor
|
|
8609
8833
|
}))
|
|
8610
8834
|
);
|
|
8611
|
-
var RichTextRender2 = (0,
|
|
8835
|
+
var RichTextRender2 = (0, import_react59.lazy)(
|
|
8612
8836
|
() => Promise.resolve().then(() => (init_Render(), Render_exports)).then((m) => ({
|
|
8613
8837
|
default: m.RichTextRender
|
|
8614
8838
|
}))
|
|
8615
8839
|
);
|
|
8616
|
-
var InlineEditorWrapper = (0,
|
|
8840
|
+
var InlineEditorWrapper = (0, import_react59.memo)(
|
|
8617
8841
|
({
|
|
8618
8842
|
value,
|
|
8619
8843
|
componentId,
|
|
@@ -8621,7 +8845,7 @@ var InlineEditorWrapper = (0, import_react55.memo)(
|
|
|
8621
8845
|
field,
|
|
8622
8846
|
id
|
|
8623
8847
|
}) => {
|
|
8624
|
-
const portalRef = (0,
|
|
8848
|
+
const portalRef = (0, import_react59.useRef)(null);
|
|
8625
8849
|
const appStoreApi = useAppStoreApi();
|
|
8626
8850
|
const onClickHandler = (e) => {
|
|
8627
8851
|
e.preventDefault();
|
|
@@ -8632,14 +8856,14 @@ var InlineEditorWrapper = (0, import_react55.memo)(
|
|
|
8632
8856
|
);
|
|
8633
8857
|
appStoreApi.getState().setUi({ itemSelector });
|
|
8634
8858
|
};
|
|
8635
|
-
(0,
|
|
8859
|
+
(0, import_react59.useEffect)(() => {
|
|
8636
8860
|
if (!portalRef.current) return;
|
|
8637
8861
|
const cleanup = registerOverlayPortal(portalRef.current, {
|
|
8638
8862
|
disableDragOnFocus: true
|
|
8639
8863
|
});
|
|
8640
8864
|
return () => cleanup == null ? void 0 : cleanup();
|
|
8641
8865
|
}, [portalRef.current]);
|
|
8642
|
-
const handleChange = (0,
|
|
8866
|
+
const handleChange = (0, import_react59.useCallback)(
|
|
8643
8867
|
(content, ui) => __async(null, null, function* () {
|
|
8644
8868
|
var _a;
|
|
8645
8869
|
const appStore = appStoreApi.getState();
|
|
@@ -8663,7 +8887,7 @@ var InlineEditorWrapper = (0, import_react55.memo)(
|
|
|
8663
8887
|
}),
|
|
8664
8888
|
[appStoreApi, componentId, propPath]
|
|
8665
8889
|
);
|
|
8666
|
-
const handleFocus = (0,
|
|
8890
|
+
const handleFocus = (0, import_react59.useCallback)(
|
|
8667
8891
|
(editor) => {
|
|
8668
8892
|
appStoreApi.setState({
|
|
8669
8893
|
currentRichText: {
|
|
@@ -8678,7 +8902,7 @@ var InlineEditorWrapper = (0, import_react55.memo)(
|
|
|
8678
8902
|
[field, componentId]
|
|
8679
8903
|
);
|
|
8680
8904
|
if (!field.contentEditable)
|
|
8681
|
-
return /* @__PURE__ */ (0,
|
|
8905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react59.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RichTextRenderFallback, { content: value }), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RichTextRender2, { content: value, field }) });
|
|
8682
8906
|
const editorProps = {
|
|
8683
8907
|
content: value,
|
|
8684
8908
|
onChange: handleChange,
|
|
@@ -8688,7 +8912,7 @@ var InlineEditorWrapper = (0, import_react55.memo)(
|
|
|
8688
8912
|
id,
|
|
8689
8913
|
name: propPath
|
|
8690
8914
|
};
|
|
8691
|
-
return /* @__PURE__ */ (0,
|
|
8915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { ref: portalRef, onClick: onClickHandler, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react59.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(EditorFallback, __spreadValues({}, editorProps)), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Editor3, __spreadValues({}, editorProps)) }) });
|
|
8692
8916
|
}
|
|
8693
8917
|
);
|
|
8694
8918
|
InlineEditorWrapper.displayName = "InlineEditorWrapper";
|
|
@@ -8696,10 +8920,10 @@ var getRichTextTransform = () => ({
|
|
|
8696
8920
|
richtext: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
8697
8921
|
const { contentEditable = true, tiptap } = field;
|
|
8698
8922
|
if (contentEditable === false || isReadOnly) {
|
|
8699
|
-
return /* @__PURE__ */ (0,
|
|
8923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RichTextRender2, { content: value, field });
|
|
8700
8924
|
}
|
|
8701
8925
|
const id = `${componentId}_${field.type}_${propPath}`;
|
|
8702
|
-
return /* @__PURE__ */ (0,
|
|
8926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8703
8927
|
InlineEditorWrapper,
|
|
8704
8928
|
{
|
|
8705
8929
|
value,
|
|
@@ -8714,11 +8938,11 @@ var getRichTextTransform = () => ({
|
|
|
8714
8938
|
});
|
|
8715
8939
|
|
|
8716
8940
|
// components/DropZone/index.tsx
|
|
8717
|
-
var
|
|
8941
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
8718
8942
|
var getClassName24 = get_class_name_factory_default("DropZone", styles_module_default16);
|
|
8719
8943
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
8720
8944
|
var RENDER_DEBUG = false;
|
|
8721
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */ (0,
|
|
8945
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DropZoneEdit, __spreadValues({}, props));
|
|
8722
8946
|
var DropZoneChild = ({
|
|
8723
8947
|
zoneCompound,
|
|
8724
8948
|
componentId,
|
|
@@ -8729,9 +8953,9 @@ var DropZoneChild = ({
|
|
|
8729
8953
|
}) => {
|
|
8730
8954
|
var _a, _b;
|
|
8731
8955
|
const metadata = useAppStore((s) => s.metadata);
|
|
8732
|
-
const ctx = (0,
|
|
8956
|
+
const ctx = (0, import_react60.useContext)(dropZoneContext);
|
|
8733
8957
|
const { depth = 1 } = ctx != null ? ctx : {};
|
|
8734
|
-
const zoneStore = (0,
|
|
8958
|
+
const zoneStore = (0, import_react60.useContext)(ZoneStoreContext);
|
|
8735
8959
|
const nodeProps = useAppStore(
|
|
8736
8960
|
(0, import_shallow4.useShallow)((s) => {
|
|
8737
8961
|
var _a2;
|
|
@@ -8751,7 +8975,7 @@ var DropZoneChild = ({
|
|
|
8751
8975
|
})
|
|
8752
8976
|
);
|
|
8753
8977
|
const appStore = useAppStoreApi();
|
|
8754
|
-
const item = (0,
|
|
8978
|
+
const item = (0, import_react60.useMemo)(() => {
|
|
8755
8979
|
if (nodeProps) {
|
|
8756
8980
|
const expanded = expandNode({
|
|
8757
8981
|
type: nodeType,
|
|
@@ -8773,7 +8997,7 @@ var DropZoneChild = ({
|
|
|
8773
8997
|
const componentConfig = useAppStore(
|
|
8774
8998
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
|
8775
8999
|
);
|
|
8776
|
-
const puckProps = (0,
|
|
9000
|
+
const puckProps = (0, import_react60.useMemo)(
|
|
8777
9001
|
() => ({
|
|
8778
9002
|
renderDropZone: DropZoneEditPure,
|
|
8779
9003
|
isEditing: true,
|
|
@@ -8796,20 +9020,20 @@ var DropZoneChild = ({
|
|
|
8796
9020
|
}
|
|
8797
9021
|
);
|
|
8798
9022
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
|
8799
|
-
const renderPreview = (0,
|
|
9023
|
+
const renderPreview = (0, import_react60.useMemo)(
|
|
8800
9024
|
() => function Preview3() {
|
|
8801
9025
|
var _a2;
|
|
8802
9026
|
if (item && "element" in item && item.element) {
|
|
8803
9027
|
return (
|
|
8804
9028
|
// Safe to use this since the HTML is set by the user
|
|
8805
|
-
/* @__PURE__ */ (0,
|
|
9029
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
|
|
8806
9030
|
);
|
|
8807
9031
|
}
|
|
8808
|
-
return /* @__PURE__ */ (0,
|
|
9032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
|
|
8809
9033
|
},
|
|
8810
9034
|
[componentId, label, overrides]
|
|
8811
9035
|
);
|
|
8812
|
-
const defaultsProps = (0,
|
|
9036
|
+
const defaultsProps = (0, import_react60.useMemo)(
|
|
8813
9037
|
() => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
|
|
8814
9038
|
puck: puckProps,
|
|
8815
9039
|
editMode: true
|
|
@@ -8817,7 +9041,7 @@ var DropZoneChild = ({
|
|
|
8817
9041
|
}),
|
|
8818
9042
|
[componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, puckProps]
|
|
8819
9043
|
);
|
|
8820
|
-
const defaultedNode = (0,
|
|
9044
|
+
const defaultedNode = (0, import_react60.useMemo)(
|
|
8821
9045
|
() => {
|
|
8822
9046
|
var _a2;
|
|
8823
9047
|
return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
|
|
@@ -8827,8 +9051,8 @@ var DropZoneChild = ({
|
|
|
8827
9051
|
const config = useAppStore((s) => s.config);
|
|
8828
9052
|
const plugins = useAppStore((s) => s.plugins);
|
|
8829
9053
|
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
8830
|
-
const combinedFieldTransforms = (0,
|
|
8831
|
-
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0,
|
|
9054
|
+
const combinedFieldTransforms = (0, import_react60.useMemo)(
|
|
9055
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce(
|
|
8832
9056
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
8833
9057
|
{}
|
|
8834
9058
|
)), userFieldTransforms),
|
|
@@ -8842,7 +9066,7 @@ var DropZoneChild = ({
|
|
|
8842
9066
|
isLoading
|
|
8843
9067
|
);
|
|
8844
9068
|
if (!item) return;
|
|
8845
|
-
let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0,
|
|
9069
|
+
let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
|
8846
9070
|
"No configuration for ",
|
|
8847
9071
|
item.type
|
|
8848
9072
|
] });
|
|
@@ -8851,7 +9075,7 @@ var DropZoneChild = ({
|
|
|
8851
9075
|
if (isInserting) {
|
|
8852
9076
|
Render2 = renderPreview;
|
|
8853
9077
|
}
|
|
8854
|
-
return /* @__PURE__ */ (0,
|
|
9078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
8855
9079
|
DraggableComponent,
|
|
8856
9080
|
{
|
|
8857
9081
|
id: componentId,
|
|
@@ -8865,19 +9089,19 @@ var DropZoneChild = ({
|
|
|
8865
9089
|
autoDragAxis: dragAxis,
|
|
8866
9090
|
userDragAxis: collisionAxis,
|
|
8867
9091
|
inDroppableZone,
|
|
8868
|
-
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ (0,
|
|
9092
|
+
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
8869
9093
|
Render2,
|
|
8870
9094
|
__spreadProps(__spreadValues({}, transformedProps), {
|
|
8871
9095
|
puck: __spreadProps(__spreadValues({}, transformedProps.puck), {
|
|
8872
9096
|
dragRef
|
|
8873
9097
|
})
|
|
8874
9098
|
})
|
|
8875
|
-
) }) : /* @__PURE__ */ (0,
|
|
9099
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Render2, __spreadValues({}, transformedProps)) })
|
|
8876
9100
|
}
|
|
8877
9101
|
);
|
|
8878
9102
|
};
|
|
8879
|
-
var DropZoneChildMemo = (0,
|
|
8880
|
-
var DropZoneEdit = (0,
|
|
9103
|
+
var DropZoneChildMemo = (0, import_react60.memo)(DropZoneChild);
|
|
9104
|
+
var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
8881
9105
|
function DropZoneEditInternal({
|
|
8882
9106
|
zone,
|
|
8883
9107
|
allow,
|
|
@@ -8888,7 +9112,7 @@ var DropZoneEdit = (0, import_react56.forwardRef)(
|
|
|
8888
9112
|
collisionAxis,
|
|
8889
9113
|
as
|
|
8890
9114
|
}, userRef) {
|
|
8891
|
-
const ctx = (0,
|
|
9115
|
+
const ctx = (0, import_react60.useContext)(dropZoneContext);
|
|
8892
9116
|
const appStoreApi = useAppStoreApi();
|
|
8893
9117
|
const {
|
|
8894
9118
|
// These all need setting via context
|
|
@@ -8926,14 +9150,14 @@ var DropZoneEdit = (0, import_react56.forwardRef)(
|
|
|
8926
9150
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
|
|
8927
9151
|
})
|
|
8928
9152
|
);
|
|
8929
|
-
(0,
|
|
9153
|
+
(0, import_react60.useEffect)(() => {
|
|
8930
9154
|
if (!zoneType || zoneType === "dropzone") {
|
|
8931
9155
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
8932
9156
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
8933
9157
|
}
|
|
8934
9158
|
}
|
|
8935
9159
|
}, [zoneType, appStoreApi]);
|
|
8936
|
-
(0,
|
|
9160
|
+
(0, import_react60.useEffect)(() => {
|
|
8937
9161
|
if (zoneType === "dropzone") {
|
|
8938
9162
|
if (zoneCompound !== rootDroppableId) {
|
|
8939
9163
|
console.warn(
|
|
@@ -8942,11 +9166,11 @@ var DropZoneEdit = (0, import_react56.forwardRef)(
|
|
|
8942
9166
|
}
|
|
8943
9167
|
}
|
|
8944
9168
|
}, [zoneType]);
|
|
8945
|
-
const contentIds = (0,
|
|
9169
|
+
const contentIds = (0, import_react60.useMemo)(() => {
|
|
8946
9170
|
return zoneContentIds || [];
|
|
8947
9171
|
}, [zoneContentIds]);
|
|
8948
|
-
const ref = (0,
|
|
8949
|
-
const acceptsTarget = (0,
|
|
9172
|
+
const ref = (0, import_react60.useRef)(null);
|
|
9173
|
+
const acceptsTarget = (0, import_react60.useCallback)(
|
|
8950
9174
|
(componentType) => {
|
|
8951
9175
|
if (!componentType) {
|
|
8952
9176
|
return true;
|
|
@@ -8984,7 +9208,7 @@ var DropZoneEdit = (0, import_react56.forwardRef)(
|
|
|
8984
9208
|
}
|
|
8985
9209
|
return _isEnabled;
|
|
8986
9210
|
});
|
|
8987
|
-
(0,
|
|
9211
|
+
(0, import_react60.useEffect)(() => {
|
|
8988
9212
|
if (registerLocalZone) {
|
|
8989
9213
|
registerLocalZone(zoneCompound, targetAccepted || isEnabled);
|
|
8990
9214
|
}
|
|
@@ -8999,8 +9223,8 @@ var DropZoneEdit = (0, import_react56.forwardRef)(
|
|
|
8999
9223
|
zoneCompound
|
|
9000
9224
|
);
|
|
9001
9225
|
const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
|
|
9002
|
-
const zoneStore = (0,
|
|
9003
|
-
(0,
|
|
9226
|
+
const zoneStore = (0, import_react60.useContext)(ZoneStoreContext);
|
|
9227
|
+
(0, import_react60.useEffect)(() => {
|
|
9004
9228
|
const { enabledIndex } = zoneStore.getState();
|
|
9005
9229
|
zoneStore.setState({
|
|
9006
9230
|
enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
|
|
@@ -9019,7 +9243,7 @@ var DropZoneEdit = (0, import_react56.forwardRef)(
|
|
|
9019
9243
|
path: path || []
|
|
9020
9244
|
}
|
|
9021
9245
|
};
|
|
9022
|
-
const { ref: dropRef } = (0,
|
|
9246
|
+
const { ref: dropRef } = (0, import_react61.useDroppable)(droppableConfig);
|
|
9023
9247
|
const isAreaSelected = useAppStore(
|
|
9024
9248
|
(s) => (s == null ? void 0 : s.selectedItem) && areaId === (s == null ? void 0 : s.selectedItem.props.id)
|
|
9025
9249
|
);
|
|
@@ -9030,7 +9254,7 @@ var DropZoneEdit = (0, import_react56.forwardRef)(
|
|
|
9030
9254
|
ref
|
|
9031
9255
|
});
|
|
9032
9256
|
const El = as != null ? as : "div";
|
|
9033
|
-
return /* @__PURE__ */ (0,
|
|
9257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9034
9258
|
El,
|
|
9035
9259
|
{
|
|
9036
9260
|
className: `${getClassName24({
|
|
@@ -9051,7 +9275,7 @@ var DropZoneEdit = (0, import_react56.forwardRef)(
|
|
|
9051
9275
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
9052
9276
|
}),
|
|
9053
9277
|
children: contentIdsWithPreview.map((componentId, i) => {
|
|
9054
|
-
return /* @__PURE__ */ (0,
|
|
9278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9055
9279
|
DropZoneChildMemo,
|
|
9056
9280
|
{
|
|
9057
9281
|
zoneCompound,
|
|
@@ -9074,8 +9298,8 @@ var DropZoneRenderItem = ({
|
|
|
9074
9298
|
metadata
|
|
9075
9299
|
}) => {
|
|
9076
9300
|
const Component = config.components[item.type];
|
|
9077
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
9078
|
-
const nextContextValue = (0,
|
|
9301
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
9302
|
+
const nextContextValue = (0, import_react60.useMemo)(
|
|
9079
9303
|
() => ({
|
|
9080
9304
|
areaId: props.id,
|
|
9081
9305
|
depth: 1
|
|
@@ -9083,7 +9307,7 @@ var DropZoneRenderItem = ({
|
|
|
9083
9307
|
[props]
|
|
9084
9308
|
);
|
|
9085
9309
|
const richtextProps = useRichtextProps(Component.fields, props);
|
|
9086
|
-
return /* @__PURE__ */ (0,
|
|
9310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9087
9311
|
Component.render,
|
|
9088
9312
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
9089
9313
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
@@ -9093,15 +9317,15 @@ var DropZoneRenderItem = ({
|
|
|
9093
9317
|
})
|
|
9094
9318
|
) }, props.id);
|
|
9095
9319
|
};
|
|
9096
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0,
|
|
9097
|
-
var DropZoneRender = (0,
|
|
9320
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DropZoneRender, __spreadValues({}, props));
|
|
9321
|
+
var DropZoneRender = (0, import_react60.forwardRef)(
|
|
9098
9322
|
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
9099
|
-
const ctx = (0,
|
|
9323
|
+
const ctx = (0, import_react60.useContext)(dropZoneContext);
|
|
9100
9324
|
const { areaId = "root" } = ctx || {};
|
|
9101
|
-
const { config, data, metadata } = (0,
|
|
9325
|
+
const { config, data, metadata } = (0, import_react60.useContext)(renderContext);
|
|
9102
9326
|
let zoneCompound = `${areaId}:${zone}`;
|
|
9103
9327
|
let content = (data == null ? void 0 : data.content) || [];
|
|
9104
|
-
(0,
|
|
9328
|
+
(0, import_react60.useEffect)(() => {
|
|
9105
9329
|
if (!content) {
|
|
9106
9330
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
9107
9331
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
@@ -9115,10 +9339,10 @@ var DropZoneRender = (0, import_react56.forwardRef)(
|
|
|
9115
9339
|
if (zoneCompound !== rootDroppableId) {
|
|
9116
9340
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
9117
9341
|
}
|
|
9118
|
-
return /* @__PURE__ */ (0,
|
|
9342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
9119
9343
|
const Component = config.components[item.type];
|
|
9120
9344
|
if (Component) {
|
|
9121
|
-
return /* @__PURE__ */ (0,
|
|
9345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9122
9346
|
DropZoneRenderItem,
|
|
9123
9347
|
{
|
|
9124
9348
|
config,
|
|
@@ -9132,14 +9356,14 @@ var DropZoneRender = (0, import_react56.forwardRef)(
|
|
|
9132
9356
|
}) });
|
|
9133
9357
|
}
|
|
9134
9358
|
);
|
|
9135
|
-
var DropZonePure = (props) => /* @__PURE__ */ (0,
|
|
9136
|
-
var DropZone = (0,
|
|
9359
|
+
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DropZone, __spreadValues({}, props));
|
|
9360
|
+
var DropZone = (0, import_react60.forwardRef)(
|
|
9137
9361
|
function DropZone2(props, ref) {
|
|
9138
|
-
const ctx = (0,
|
|
9362
|
+
const ctx = (0, import_react60.useContext)(dropZoneContext);
|
|
9139
9363
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
9140
|
-
return /* @__PURE__ */ (0,
|
|
9364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
9141
9365
|
}
|
|
9142
|
-
return /* @__PURE__ */ (0,
|
|
9366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
9143
9367
|
}
|
|
9144
9368
|
);
|
|
9145
9369
|
|
|
@@ -9483,14 +9707,14 @@ function getDeepDir(el) {
|
|
|
9483
9707
|
|
|
9484
9708
|
// components/DragDropContext/index.tsx
|
|
9485
9709
|
var import_state = require("@dnd-kit/state");
|
|
9486
|
-
var
|
|
9710
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
9487
9711
|
var DEBUG3 = false;
|
|
9488
|
-
var dragListenerContext = (0,
|
|
9712
|
+
var dragListenerContext = (0, import_react63.createContext)({
|
|
9489
9713
|
dragListeners: {}
|
|
9490
9714
|
});
|
|
9491
9715
|
function useDragListener(type, fn, deps = []) {
|
|
9492
|
-
const { setDragListeners } = (0,
|
|
9493
|
-
(0,
|
|
9716
|
+
const { setDragListeners } = (0, import_react63.useContext)(dragListenerContext);
|
|
9717
|
+
(0, import_react63.useEffect)(() => {
|
|
9494
9718
|
if (setDragListeners) {
|
|
9495
9719
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
|
9496
9720
|
[type]: [...old[type] || [], fn]
|
|
@@ -9500,8 +9724,8 @@ function useDragListener(type, fn, deps = []) {
|
|
|
9500
9724
|
}
|
|
9501
9725
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
|
9502
9726
|
var useTempDisableFallback = (timeout3) => {
|
|
9503
|
-
const lastFallbackDisable = (0,
|
|
9504
|
-
return (0,
|
|
9727
|
+
const lastFallbackDisable = (0, import_react63.useRef)(null);
|
|
9728
|
+
return (0, import_react63.useCallback)((manager) => {
|
|
9505
9729
|
collisionStore.setState({ fallbackEnabled: false });
|
|
9506
9730
|
const fallbackId = generateId();
|
|
9507
9731
|
lastFallbackDisable.current = fallbackId;
|
|
@@ -9520,9 +9744,9 @@ var DragDropContextClient = ({
|
|
|
9520
9744
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
9521
9745
|
const appStore = useAppStoreApi();
|
|
9522
9746
|
const id = useSafeId();
|
|
9523
|
-
const debouncedParamsRef = (0,
|
|
9747
|
+
const debouncedParamsRef = (0, import_react63.useRef)(null);
|
|
9524
9748
|
const tempDisableFallback = useTempDisableFallback(100);
|
|
9525
|
-
const [zoneStore] = (0,
|
|
9749
|
+
const [zoneStore] = (0, import_react63.useState)(
|
|
9526
9750
|
() => (0, import_zustand5.createStore)(() => ({
|
|
9527
9751
|
zoneDepthIndex: {},
|
|
9528
9752
|
nextZoneDepthIndex: {},
|
|
@@ -9534,7 +9758,7 @@ var DragDropContextClient = ({
|
|
|
9534
9758
|
hoveringComponent: null
|
|
9535
9759
|
}))
|
|
9536
9760
|
);
|
|
9537
|
-
const getChanged2 = (0,
|
|
9761
|
+
const getChanged2 = (0, import_react63.useCallback)(
|
|
9538
9762
|
(params, id2) => {
|
|
9539
9763
|
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
|
9540
9764
|
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
|
@@ -9555,7 +9779,7 @@ var DragDropContextClient = ({
|
|
|
9555
9779
|
},
|
|
9556
9780
|
[zoneStore]
|
|
9557
9781
|
);
|
|
9558
|
-
const setDeepestAndCollide = (0,
|
|
9782
|
+
const setDeepestAndCollide = (0, import_react63.useCallback)(
|
|
9559
9783
|
(params, manager) => {
|
|
9560
9784
|
const { zoneChanged, areaChanged } = getChanged2(params, id);
|
|
9561
9785
|
if (!zoneChanged && !areaChanged) return;
|
|
@@ -9579,7 +9803,7 @@ var DragDropContextClient = ({
|
|
|
9579
9803
|
setDeepestDb.cancel();
|
|
9580
9804
|
debouncedParamsRef.current = null;
|
|
9581
9805
|
};
|
|
9582
|
-
(0,
|
|
9806
|
+
(0, import_react63.useEffect)(() => {
|
|
9583
9807
|
if (DEBUG3) {
|
|
9584
9808
|
zoneStore.subscribe(
|
|
9585
9809
|
(s) => {
|
|
@@ -9593,7 +9817,7 @@ var DragDropContextClient = ({
|
|
|
9593
9817
|
);
|
|
9594
9818
|
}
|
|
9595
9819
|
}, []);
|
|
9596
|
-
const [plugins] = (0,
|
|
9820
|
+
const [plugins] = (0, import_react63.useState)(() => [
|
|
9597
9821
|
...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
|
|
9598
9822
|
createNestedDroppablePlugin(
|
|
9599
9823
|
{
|
|
@@ -9641,10 +9865,10 @@ var DragDropContextClient = ({
|
|
|
9641
9865
|
)
|
|
9642
9866
|
]);
|
|
9643
9867
|
const sensors = useSensors();
|
|
9644
|
-
const [dragListeners, setDragListeners] = (0,
|
|
9645
|
-
const dragMode = (0,
|
|
9646
|
-
const initialSelector = (0,
|
|
9647
|
-
const nextContextValue = (0,
|
|
9868
|
+
const [dragListeners, setDragListeners] = (0, import_react63.useState)({});
|
|
9869
|
+
const dragMode = (0, import_react63.useRef)(null);
|
|
9870
|
+
const initialSelector = (0, import_react63.useRef)(void 0);
|
|
9871
|
+
const nextContextValue = (0, import_react63.useMemo)(
|
|
9648
9872
|
() => ({
|
|
9649
9873
|
mode: "edit",
|
|
9650
9874
|
areaId: "root",
|
|
@@ -9652,15 +9876,15 @@ var DragDropContextClient = ({
|
|
|
9652
9876
|
}),
|
|
9653
9877
|
[]
|
|
9654
9878
|
);
|
|
9655
|
-
return /* @__PURE__ */ (0,
|
|
9879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9656
9880
|
dragListenerContext.Provider,
|
|
9657
9881
|
{
|
|
9658
9882
|
value: {
|
|
9659
9883
|
dragListeners,
|
|
9660
9884
|
setDragListeners
|
|
9661
9885
|
},
|
|
9662
|
-
children: /* @__PURE__ */ (0,
|
|
9663
|
-
|
|
9886
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9887
|
+
import_react62.DragDropProvider,
|
|
9664
9888
|
{
|
|
9665
9889
|
plugins,
|
|
9666
9890
|
sensors,
|
|
@@ -9875,7 +10099,7 @@ var DragDropContextClient = ({
|
|
|
9875
10099
|
const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-puck-entry]");
|
|
9876
10100
|
entryEl == null ? void 0 : entryEl.setAttribute("data-puck-dragging", "true");
|
|
9877
10101
|
},
|
|
9878
|
-
children: /* @__PURE__ */ (0,
|
|
10102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
|
|
9879
10103
|
}
|
|
9880
10104
|
)
|
|
9881
10105
|
}
|
|
@@ -9889,12 +10113,12 @@ var DragDropContext = ({
|
|
|
9889
10113
|
if (status === "LOADING") {
|
|
9890
10114
|
return children;
|
|
9891
10115
|
}
|
|
9892
|
-
return /* @__PURE__ */ (0,
|
|
10116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DragDropContextClient, { disableAutoScroll, children });
|
|
9893
10117
|
};
|
|
9894
10118
|
|
|
9895
10119
|
// components/Drawer/index.tsx
|
|
9896
|
-
var
|
|
9897
|
-
var
|
|
10120
|
+
var import_react65 = require("@dnd-kit/react");
|
|
10121
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
9898
10122
|
var getClassName25 = get_class_name_factory_default("Drawer", styles_module_default14);
|
|
9899
10123
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default14);
|
|
9900
10124
|
var DrawerItemInner = ({
|
|
@@ -9904,11 +10128,11 @@ var DrawerItemInner = ({
|
|
|
9904
10128
|
dragRef,
|
|
9905
10129
|
isDragDisabled
|
|
9906
10130
|
}) => {
|
|
9907
|
-
const CustomInner = (0,
|
|
9908
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */ (0,
|
|
10131
|
+
const CustomInner = (0, import_react64.useMemo)(
|
|
10132
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
|
9909
10133
|
[children]
|
|
9910
10134
|
);
|
|
9911
|
-
return /* @__PURE__ */ (0,
|
|
10135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
9912
10136
|
"div",
|
|
9913
10137
|
{
|
|
9914
10138
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
|
@@ -9916,9 +10140,9 @@ var DrawerItemInner = ({
|
|
|
9916
10140
|
onMouseDown: (e) => e.preventDefault(),
|
|
9917
10141
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
|
9918
10142
|
"data-puck-drawer-item": true,
|
|
9919
|
-
children: /* @__PURE__ */ (0,
|
|
9920
|
-
/* @__PURE__ */ (0,
|
|
9921
|
-
/* @__PURE__ */ (0,
|
|
10143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
|
10144
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
|
10145
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DragIcon, {}) })
|
|
9922
10146
|
] }) }) })
|
|
9923
10147
|
}
|
|
9924
10148
|
);
|
|
@@ -9930,15 +10154,15 @@ var DrawerItemDraggable = ({
|
|
|
9930
10154
|
id,
|
|
9931
10155
|
isDragDisabled
|
|
9932
10156
|
}) => {
|
|
9933
|
-
const { ref } = (0,
|
|
10157
|
+
const { ref } = (0, import_react65.useDraggable)({
|
|
9934
10158
|
id,
|
|
9935
10159
|
data: { componentType: name },
|
|
9936
10160
|
disabled: isDragDisabled,
|
|
9937
10161
|
type: "drawer"
|
|
9938
10162
|
});
|
|
9939
|
-
return /* @__PURE__ */ (0,
|
|
9940
|
-
/* @__PURE__ */ (0,
|
|
9941
|
-
/* @__PURE__ */ (0,
|
|
10163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: getClassName25("draggable"), children: [
|
|
10164
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: getClassName25("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DrawerItemInner, { name, label, children }) }),
|
|
10165
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: getClassName25("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
9942
10166
|
DrawerItemInner,
|
|
9943
10167
|
{
|
|
9944
10168
|
name,
|
|
@@ -9959,7 +10183,7 @@ var DrawerItem = ({
|
|
|
9959
10183
|
isDragDisabled
|
|
9960
10184
|
}) => {
|
|
9961
10185
|
const resolvedId = id || name;
|
|
9962
|
-
const [dynamicId, setDynamicId] = (0,
|
|
10186
|
+
const [dynamicId, setDynamicId] = (0, import_react64.useState)(generateId(resolvedId));
|
|
9963
10187
|
if (typeof index !== "undefined") {
|
|
9964
10188
|
console.error(
|
|
9965
10189
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
|
@@ -9972,7 +10196,7 @@ var DrawerItem = ({
|
|
|
9972
10196
|
},
|
|
9973
10197
|
[resolvedId]
|
|
9974
10198
|
);
|
|
9975
|
-
return /* @__PURE__ */ (0,
|
|
10199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
9976
10200
|
DrawerItemDraggable,
|
|
9977
10201
|
{
|
|
9978
10202
|
name,
|
|
@@ -9999,13 +10223,13 @@ var Drawer = ({
|
|
|
9999
10223
|
);
|
|
10000
10224
|
}
|
|
10001
10225
|
const id = useSafeId();
|
|
10002
|
-
const { ref } = (0,
|
|
10226
|
+
const { ref } = (0, import_react65.useDroppable)({
|
|
10003
10227
|
id,
|
|
10004
10228
|
type: "void",
|
|
10005
10229
|
collisionPriority: 0
|
|
10006
10230
|
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
|
10007
10231
|
});
|
|
10008
|
-
return /* @__PURE__ */ (0,
|
|
10232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
10009
10233
|
"div",
|
|
10010
10234
|
{
|
|
10011
10235
|
className: getClassName25(),
|
|
@@ -10024,7 +10248,7 @@ init_IconButton2();
|
|
|
10024
10248
|
|
|
10025
10249
|
// components/Puck/index.tsx
|
|
10026
10250
|
init_react_import();
|
|
10027
|
-
var
|
|
10251
|
+
var import_react86 = require("react");
|
|
10028
10252
|
|
|
10029
10253
|
// components/SidebarSection/index.tsx
|
|
10030
10254
|
init_react_import();
|
|
@@ -10039,7 +10263,7 @@ init_lucide_react();
|
|
|
10039
10263
|
|
|
10040
10264
|
// lib/use-breadcrumbs.ts
|
|
10041
10265
|
init_react_import();
|
|
10042
|
-
var
|
|
10266
|
+
var import_react66 = require("react");
|
|
10043
10267
|
init_store();
|
|
10044
10268
|
var useBreadcrumbs = (renderCount) => {
|
|
10045
10269
|
const selectedId = useAppStore((s) => {
|
|
@@ -10052,7 +10276,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
10052
10276
|
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
10053
10277
|
});
|
|
10054
10278
|
const appStore = useAppStoreApi();
|
|
10055
|
-
return (0,
|
|
10279
|
+
return (0, import_react66.useMemo)(() => {
|
|
10056
10280
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
10057
10281
|
var _a, _b, _c;
|
|
10058
10282
|
const [componentId] = zoneCompound.split(":");
|
|
@@ -10085,7 +10309,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
10085
10309
|
// components/SidebarSection/index.tsx
|
|
10086
10310
|
init_store();
|
|
10087
10311
|
init_Loader();
|
|
10088
|
-
var
|
|
10312
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
10089
10313
|
var getClassName26 = get_class_name_factory_default("SidebarSection", styles_module_default18);
|
|
10090
10314
|
var SidebarSection = ({
|
|
10091
10315
|
children,
|
|
@@ -10098,15 +10322,15 @@ var SidebarSection = ({
|
|
|
10098
10322
|
}) => {
|
|
10099
10323
|
const setUi = useAppStore((s) => s.setUi);
|
|
10100
10324
|
const breadcrumbs = useBreadcrumbs(1);
|
|
10101
|
-
return /* @__PURE__ */ (0,
|
|
10325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
10102
10326
|
"div",
|
|
10103
10327
|
{
|
|
10104
10328
|
className: getClassName26({ noBorderTop, noPadding }),
|
|
10105
10329
|
style: { background },
|
|
10106
10330
|
children: [
|
|
10107
|
-
/* @__PURE__ */ (0,
|
|
10108
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
|
10109
|
-
/* @__PURE__ */ (0,
|
|
10331
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassName26("title"), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: getClassName26("breadcrumbs"), children: [
|
|
10332
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: getClassName26("breadcrumb"), children: [
|
|
10333
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
10110
10334
|
"button",
|
|
10111
10335
|
{
|
|
10112
10336
|
type: "button",
|
|
@@ -10115,12 +10339,12 @@ var SidebarSection = ({
|
|
|
10115
10339
|
children: breadcrumb.label
|
|
10116
10340
|
}
|
|
10117
10341
|
),
|
|
10118
|
-
/* @__PURE__ */ (0,
|
|
10342
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChevronRight, { size: 16 })
|
|
10119
10343
|
] }, i)) : null,
|
|
10120
|
-
/* @__PURE__ */ (0,
|
|
10344
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassName26("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Heading7, { rank: "2", size: "xs", children: title }) })
|
|
10121
10345
|
] }) }),
|
|
10122
|
-
/* @__PURE__ */ (0,
|
|
10123
|
-
isLoading && /* @__PURE__ */ (0,
|
|
10346
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassName26("content"), children }),
|
|
10347
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassName26("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Loader, { size: 32 }) })
|
|
10124
10348
|
]
|
|
10125
10349
|
}
|
|
10126
10350
|
);
|
|
@@ -10146,15 +10370,15 @@ var styles_module_default20 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields
|
|
|
10146
10370
|
|
|
10147
10371
|
// components/Puck/components/Fields/index.tsx
|
|
10148
10372
|
init_lib();
|
|
10149
|
-
var
|
|
10373
|
+
var import_react67 = require("react");
|
|
10150
10374
|
init_fields();
|
|
10151
10375
|
var import_shallow5 = require("zustand/react/shallow");
|
|
10152
|
-
var
|
|
10376
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
10153
10377
|
var getClassName27 = get_class_name_factory_default("PuckFields", styles_module_default20);
|
|
10154
10378
|
var DefaultFields = ({
|
|
10155
10379
|
children
|
|
10156
10380
|
}) => {
|
|
10157
|
-
return /* @__PURE__ */ (0,
|
|
10381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_jsx_runtime67.Fragment, { children });
|
|
10158
10382
|
};
|
|
10159
10383
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
10160
10384
|
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
@@ -10219,13 +10443,13 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
10219
10443
|
})
|
|
10220
10444
|
);
|
|
10221
10445
|
const appStore = useAppStoreApi();
|
|
10222
|
-
const onChange = (0,
|
|
10446
|
+
const onChange = (0, import_react67.useCallback)(createOnChange(fieldName, appStore), [
|
|
10223
10447
|
fieldName
|
|
10224
10448
|
]);
|
|
10225
10449
|
const { visible = true } = field != null ? field : {};
|
|
10226
10450
|
if (!field || !id || !visible) return null;
|
|
10227
10451
|
if (field.type === "slot") return null;
|
|
10228
|
-
return /* @__PURE__ */ (0,
|
|
10452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getClassName27("field"), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
10229
10453
|
AutoFieldPrivate,
|
|
10230
10454
|
{
|
|
10231
10455
|
field,
|
|
@@ -10237,7 +10461,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
10237
10461
|
}
|
|
10238
10462
|
) }, id);
|
|
10239
10463
|
};
|
|
10240
|
-
var FieldsChildMemo = (0,
|
|
10464
|
+
var FieldsChildMemo = (0, import_react67.memo)(FieldsChild);
|
|
10241
10465
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
10242
10466
|
const overrides = useAppStore((s) => s.overrides);
|
|
10243
10467
|
const componentResolving = useAppStore((s) => {
|
|
@@ -10262,8 +10486,8 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
10262
10486
|
})
|
|
10263
10487
|
);
|
|
10264
10488
|
const isLoading = fieldsLoading || componentResolving;
|
|
10265
|
-
const Wrapper = (0,
|
|
10266
|
-
return /* @__PURE__ */ (0,
|
|
10489
|
+
const Wrapper = (0, import_react67.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
|
10490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
10267
10491
|
"form",
|
|
10268
10492
|
{
|
|
10269
10493
|
className: getClassName27({ wrapFields }),
|
|
@@ -10271,20 +10495,20 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
10271
10495
|
e.preventDefault();
|
|
10272
10496
|
},
|
|
10273
10497
|
children: [
|
|
10274
|
-
/* @__PURE__ */ (0,
|
|
10275
|
-
isLoading && /* @__PURE__ */ (0,
|
|
10498
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
|
|
10499
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getClassName27("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getClassName27("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Loader, { size: 16 }) }) })
|
|
10276
10500
|
]
|
|
10277
10501
|
}
|
|
10278
10502
|
);
|
|
10279
10503
|
};
|
|
10280
|
-
var Fields = (0,
|
|
10504
|
+
var Fields = (0, import_react67.memo)(FieldsInternal);
|
|
10281
10505
|
|
|
10282
10506
|
// components/Puck/components/Components/index.tsx
|
|
10283
10507
|
init_react_import();
|
|
10284
10508
|
|
|
10285
10509
|
// lib/use-component-list.tsx
|
|
10286
10510
|
init_react_import();
|
|
10287
|
-
var
|
|
10511
|
+
var import_react69 = require("react");
|
|
10288
10512
|
|
|
10289
10513
|
// components/ComponentList/index.tsx
|
|
10290
10514
|
init_react_import();
|
|
@@ -10295,10 +10519,10 @@ var styles_module_default21 = { "ComponentList": "_ComponentList_1rrlt_1", "Comp
|
|
|
10295
10519
|
|
|
10296
10520
|
// components/ComponentList/index.tsx
|
|
10297
10521
|
init_get_class_name_factory();
|
|
10298
|
-
var
|
|
10522
|
+
var import_react68 = require("react");
|
|
10299
10523
|
init_store();
|
|
10300
10524
|
init_lucide_react();
|
|
10301
|
-
var
|
|
10525
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
10302
10526
|
var getClassName28 = get_class_name_factory_default("ComponentList", styles_module_default21);
|
|
10303
10527
|
var ComponentListItem = ({
|
|
10304
10528
|
name,
|
|
@@ -10311,14 +10535,14 @@ var ComponentListItem = ({
|
|
|
10311
10535
|
type: name
|
|
10312
10536
|
}).insert
|
|
10313
10537
|
);
|
|
10314
|
-
(0,
|
|
10538
|
+
(0, import_react68.useEffect)(() => {
|
|
10315
10539
|
if (overrides.componentItem) {
|
|
10316
10540
|
console.warn(
|
|
10317
10541
|
"The `componentItem` override has been deprecated and renamed to `drawerItem`"
|
|
10318
10542
|
);
|
|
10319
10543
|
}
|
|
10320
10544
|
}, [overrides]);
|
|
10321
|
-
return /* @__PURE__ */ (0,
|
|
10545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
10322
10546
|
};
|
|
10323
10547
|
var ComponentList = ({
|
|
10324
10548
|
children,
|
|
@@ -10329,8 +10553,8 @@ var ComponentList = ({
|
|
|
10329
10553
|
const setUi = useAppStore((s) => s.setUi);
|
|
10330
10554
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
10331
10555
|
const { expanded = true } = componentList[id] || {};
|
|
10332
|
-
return /* @__PURE__ */ (0,
|
|
10333
|
-
title && /* @__PURE__ */ (0,
|
|
10556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: getClassName28({ isExpanded: expanded }), children: [
|
|
10557
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
10334
10558
|
"button",
|
|
10335
10559
|
{
|
|
10336
10560
|
type: "button",
|
|
@@ -10344,14 +10568,14 @@ var ComponentList = ({
|
|
|
10344
10568
|
}),
|
|
10345
10569
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
10346
10570
|
children: [
|
|
10347
|
-
/* @__PURE__ */ (0,
|
|
10348
|
-
/* @__PURE__ */ (0,
|
|
10571
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { children: title }),
|
|
10572
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: getClassName28("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChevronDown, { size: 12 }) })
|
|
10349
10573
|
]
|
|
10350
10574
|
}
|
|
10351
10575
|
),
|
|
10352
|
-
/* @__PURE__ */ (0,
|
|
10576
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: getClassName28("content"), children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
|
10353
10577
|
var _a;
|
|
10354
|
-
return /* @__PURE__ */ (0,
|
|
10578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10355
10579
|
ComponentListItem,
|
|
10356
10580
|
{
|
|
10357
10581
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
|
@@ -10366,12 +10590,12 @@ ComponentList.Item = ComponentListItem;
|
|
|
10366
10590
|
|
|
10367
10591
|
// lib/use-component-list.tsx
|
|
10368
10592
|
init_store();
|
|
10369
|
-
var
|
|
10593
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10370
10594
|
var useComponentList = () => {
|
|
10371
|
-
const [componentList, setComponentList] = (0,
|
|
10595
|
+
const [componentList, setComponentList] = (0, import_react69.useState)();
|
|
10372
10596
|
const config = useAppStore((s) => s.config);
|
|
10373
10597
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
|
10374
|
-
(0,
|
|
10598
|
+
(0, import_react69.useEffect)(() => {
|
|
10375
10599
|
var _a, _b, _c;
|
|
10376
10600
|
if (Object.keys(uiComponentList).length > 0) {
|
|
10377
10601
|
const matchedComponents = [];
|
|
@@ -10387,7 +10611,7 @@ var useComponentList = () => {
|
|
|
10387
10611
|
if (category.visible === false) {
|
|
10388
10612
|
return null;
|
|
10389
10613
|
}
|
|
10390
|
-
return /* @__PURE__ */ (0,
|
|
10614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
10391
10615
|
ComponentList,
|
|
10392
10616
|
{
|
|
10393
10617
|
id: categoryKey,
|
|
@@ -10395,7 +10619,7 @@ var useComponentList = () => {
|
|
|
10395
10619
|
children: category.components.map((componentName, i) => {
|
|
10396
10620
|
var _a2;
|
|
10397
10621
|
const componentConf = config.components[componentName] || {};
|
|
10398
|
-
return /* @__PURE__ */ (0,
|
|
10622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
10399
10623
|
ComponentList.Item,
|
|
10400
10624
|
{
|
|
10401
10625
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
|
@@ -10415,7 +10639,7 @@ var useComponentList = () => {
|
|
|
10415
10639
|
);
|
|
10416
10640
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
|
10417
10641
|
_componentList.push(
|
|
10418
|
-
/* @__PURE__ */ (0,
|
|
10642
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
10419
10643
|
ComponentList,
|
|
10420
10644
|
{
|
|
10421
10645
|
id: "other",
|
|
@@ -10423,7 +10647,7 @@ var useComponentList = () => {
|
|
|
10423
10647
|
children: remainingComponents.map((componentName, i) => {
|
|
10424
10648
|
var _a2;
|
|
10425
10649
|
const componentConf = config.components[componentName] || {};
|
|
10426
|
-
return /* @__PURE__ */ (0,
|
|
10650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
10427
10651
|
ComponentList.Item,
|
|
10428
10652
|
{
|
|
10429
10653
|
name: componentName,
|
|
@@ -10446,12 +10670,12 @@ var useComponentList = () => {
|
|
|
10446
10670
|
|
|
10447
10671
|
// components/Puck/components/Components/index.tsx
|
|
10448
10672
|
init_store();
|
|
10449
|
-
var
|
|
10450
|
-
var
|
|
10673
|
+
var import_react70 = require("react");
|
|
10674
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10451
10675
|
var Components = () => {
|
|
10452
10676
|
const overrides = useAppStore((s) => s.overrides);
|
|
10453
10677
|
const componentList = useComponentList();
|
|
10454
|
-
const Wrapper = (0,
|
|
10678
|
+
const Wrapper = (0, import_react70.useMemo)(() => {
|
|
10455
10679
|
if (overrides.components) {
|
|
10456
10680
|
console.warn(
|
|
10457
10681
|
"The `components` override has been deprecated and renamed to `drawer`"
|
|
@@ -10459,21 +10683,21 @@ var Components = () => {
|
|
|
10459
10683
|
}
|
|
10460
10684
|
return overrides.components || overrides.drawer || "div";
|
|
10461
10685
|
}, [overrides]);
|
|
10462
|
-
return /* @__PURE__ */ (0,
|
|
10686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ComponentList, { id: "all" }) });
|
|
10463
10687
|
};
|
|
10464
10688
|
|
|
10465
10689
|
// components/Puck/components/Preview/index.tsx
|
|
10466
10690
|
init_react_import();
|
|
10467
10691
|
init_root_droppable_id();
|
|
10468
|
-
var
|
|
10692
|
+
var import_react72 = require("react");
|
|
10469
10693
|
init_store();
|
|
10470
10694
|
|
|
10471
10695
|
// components/AutoFrame/index.tsx
|
|
10472
10696
|
init_react_import();
|
|
10473
|
-
var
|
|
10697
|
+
var import_react71 = require("react");
|
|
10474
10698
|
var import_object_hash = __toESM(require("object-hash"));
|
|
10475
10699
|
var import_react_dom3 = require("react-dom");
|
|
10476
|
-
var
|
|
10700
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10477
10701
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
10478
10702
|
var collectStyles = (doc) => {
|
|
10479
10703
|
const collected = [];
|
|
@@ -10523,7 +10747,7 @@ var CopyHostStyles = ({
|
|
|
10523
10747
|
onStylesLoaded = () => null
|
|
10524
10748
|
}) => {
|
|
10525
10749
|
const { document: doc, window: win } = useFrame();
|
|
10526
|
-
(0,
|
|
10750
|
+
(0, import_react71.useEffect)(() => {
|
|
10527
10751
|
if (!win || !doc) {
|
|
10528
10752
|
return () => {
|
|
10529
10753
|
};
|
|
@@ -10680,10 +10904,10 @@ var CopyHostStyles = ({
|
|
|
10680
10904
|
observer.disconnect();
|
|
10681
10905
|
};
|
|
10682
10906
|
}, []);
|
|
10683
|
-
return /* @__PURE__ */ (0,
|
|
10907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children });
|
|
10684
10908
|
};
|
|
10685
|
-
var autoFrameContext = (0,
|
|
10686
|
-
var useFrame = () => (0,
|
|
10909
|
+
var autoFrameContext = (0, import_react71.createContext)({});
|
|
10910
|
+
var useFrame = () => (0, import_react71.useContext)(autoFrameContext);
|
|
10687
10911
|
function AutoFrame(_a) {
|
|
10688
10912
|
var _b = _a, {
|
|
10689
10913
|
children,
|
|
@@ -10704,11 +10928,11 @@ function AutoFrame(_a) {
|
|
|
10704
10928
|
"onNotReady",
|
|
10705
10929
|
"frameRef"
|
|
10706
10930
|
]);
|
|
10707
|
-
const [loaded, setLoaded] = (0,
|
|
10708
|
-
const [ctx, setCtx] = (0,
|
|
10709
|
-
const [mountTarget, setMountTarget] = (0,
|
|
10710
|
-
const [stylesLoaded, setStylesLoaded] = (0,
|
|
10711
|
-
(0,
|
|
10931
|
+
const [loaded, setLoaded] = (0, import_react71.useState)(false);
|
|
10932
|
+
const [ctx, setCtx] = (0, import_react71.useState)({});
|
|
10933
|
+
const [mountTarget, setMountTarget] = (0, import_react71.useState)();
|
|
10934
|
+
const [stylesLoaded, setStylesLoaded] = (0, import_react71.useState)(false);
|
|
10935
|
+
(0, import_react71.useEffect)(() => {
|
|
10712
10936
|
var _a2;
|
|
10713
10937
|
if (frameRef.current) {
|
|
10714
10938
|
const doc = frameRef.current.contentDocument;
|
|
@@ -10727,7 +10951,7 @@ function AutoFrame(_a) {
|
|
|
10727
10951
|
}
|
|
10728
10952
|
}
|
|
10729
10953
|
}, [frameRef, loaded, stylesLoaded]);
|
|
10730
|
-
return /* @__PURE__ */ (0,
|
|
10954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10731
10955
|
"iframe",
|
|
10732
10956
|
__spreadProps(__spreadValues({}, props), {
|
|
10733
10957
|
className,
|
|
@@ -10737,7 +10961,7 @@ function AutoFrame(_a) {
|
|
|
10737
10961
|
onLoad: () => {
|
|
10738
10962
|
setLoaded(true);
|
|
10739
10963
|
},
|
|
10740
|
-
children: /* @__PURE__ */ (0,
|
|
10964
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10741
10965
|
CopyHostStyles,
|
|
10742
10966
|
{
|
|
10743
10967
|
debug,
|
|
@@ -10757,11 +10981,11 @@ var styles_module_default22 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
|
|
|
10757
10981
|
|
|
10758
10982
|
// components/Puck/components/Preview/index.tsx
|
|
10759
10983
|
init_lib();
|
|
10760
|
-
var
|
|
10984
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
10761
10985
|
var getClassName29 = get_class_name_factory_default("PuckPreview", styles_module_default22);
|
|
10762
10986
|
var useBubbleIframeEvents = (ref) => {
|
|
10763
10987
|
const status = useAppStore((s) => s.status);
|
|
10764
|
-
(0,
|
|
10988
|
+
(0, import_react72.useEffect)(() => {
|
|
10765
10989
|
if (ref.current && status === "READY") {
|
|
10766
10990
|
const iframe = ref.current;
|
|
10767
10991
|
const handlePointerMove = (event) => {
|
|
@@ -10810,7 +11034,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
10810
11034
|
const renderData = useAppStore(
|
|
10811
11035
|
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
|
10812
11036
|
);
|
|
10813
|
-
const Page = (0,
|
|
11037
|
+
const Page = (0, import_react72.useCallback)(
|
|
10814
11038
|
(pageProps) => {
|
|
10815
11039
|
var _a, _b, _c, _d;
|
|
10816
11040
|
const propsWithSlots = useSlots(
|
|
@@ -10824,15 +11048,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
10824
11048
|
);
|
|
10825
11049
|
return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadValues(__spreadValues({
|
|
10826
11050
|
id: "puck-root"
|
|
10827
|
-
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ (0,
|
|
11051
|
+
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, { children: propsWithSlots.children });
|
|
10828
11052
|
},
|
|
10829
11053
|
[config]
|
|
10830
11054
|
);
|
|
10831
|
-
const Frame = (0,
|
|
11055
|
+
const Frame = (0, import_react72.useMemo)(() => overrides.iframe, [overrides]);
|
|
10832
11056
|
const rootProps = root.props || root;
|
|
10833
|
-
const ref = (0,
|
|
11057
|
+
const ref = (0, import_react72.useRef)(null);
|
|
10834
11058
|
useBubbleIframeEvents(ref);
|
|
10835
|
-
const inner = !renderData ? /* @__PURE__ */ (0,
|
|
11059
|
+
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
10836
11060
|
Page,
|
|
10837
11061
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
10838
11062
|
puck: {
|
|
@@ -10842,15 +11066,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
10842
11066
|
metadata
|
|
10843
11067
|
},
|
|
10844
11068
|
editMode: true,
|
|
10845
|
-
children: /* @__PURE__ */ (0,
|
|
11069
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DropZonePure, { zone: rootDroppableId })
|
|
10846
11070
|
})
|
|
10847
|
-
) : /* @__PURE__ */ (0,
|
|
10848
|
-
(0,
|
|
11071
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Render, { data: renderData, config, metadata });
|
|
11072
|
+
(0, import_react72.useEffect)(() => {
|
|
10849
11073
|
if (!iframe.enabled) {
|
|
10850
11074
|
setStatus("READY");
|
|
10851
11075
|
}
|
|
10852
11076
|
}, [iframe.enabled]);
|
|
10853
|
-
return /* @__PURE__ */ (0,
|
|
11077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
10854
11078
|
"div",
|
|
10855
11079
|
{
|
|
10856
11080
|
className: getClassName29(),
|
|
@@ -10862,7 +11086,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
10862
11086
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
10863
11087
|
}
|
|
10864
11088
|
},
|
|
10865
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
|
11089
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
10866
11090
|
AutoFrame_default,
|
|
10867
11091
|
{
|
|
10868
11092
|
id: "preview-frame",
|
|
@@ -10875,14 +11099,14 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
10875
11099
|
setStatus("MOUNTED");
|
|
10876
11100
|
},
|
|
10877
11101
|
frameRef: ref,
|
|
10878
|
-
children: /* @__PURE__ */ (0,
|
|
11102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
10879
11103
|
if (Frame) {
|
|
10880
|
-
return /* @__PURE__ */ (0,
|
|
11104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Frame, { document: document2, children: inner });
|
|
10881
11105
|
}
|
|
10882
11106
|
return inner;
|
|
10883
11107
|
} })
|
|
10884
11108
|
}
|
|
10885
|
-
) : /* @__PURE__ */ (0,
|
|
11109
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
10886
11110
|
"div",
|
|
10887
11111
|
{
|
|
10888
11112
|
id: "preview-frame",
|
|
@@ -10923,7 +11147,7 @@ var scrollIntoView = (el) => {
|
|
|
10923
11147
|
// components/LayerTree/index.tsx
|
|
10924
11148
|
init_lucide_react();
|
|
10925
11149
|
init_root_droppable_id();
|
|
10926
|
-
var
|
|
11150
|
+
var import_react73 = require("react");
|
|
10927
11151
|
|
|
10928
11152
|
// lib/on-scroll-end.ts
|
|
10929
11153
|
init_react_import();
|
|
@@ -10947,7 +11171,7 @@ var onScrollEnd = (frame, cb) => {
|
|
|
10947
11171
|
// components/LayerTree/index.tsx
|
|
10948
11172
|
init_store();
|
|
10949
11173
|
var import_shallow6 = require("zustand/react/shallow");
|
|
10950
|
-
var
|
|
11174
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
10951
11175
|
var getClassName30 = get_class_name_factory_default("LayerTree", styles_module_default23);
|
|
10952
11176
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default23);
|
|
10953
11177
|
var Layer = ({
|
|
@@ -10959,7 +11183,7 @@ var Layer = ({
|
|
|
10959
11183
|
const config = useAppStore((s) => s.config);
|
|
10960
11184
|
const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
|
|
10961
11185
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
10962
|
-
const setItemSelector = (0,
|
|
11186
|
+
const setItemSelector = (0, import_react73.useCallback)(
|
|
10963
11187
|
(itemSelector2) => {
|
|
10964
11188
|
dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
|
|
10965
11189
|
},
|
|
@@ -10979,7 +11203,7 @@ var Layer = ({
|
|
|
10979
11203
|
)
|
|
10980
11204
|
);
|
|
10981
11205
|
const containsZone = zonesForItem.length > 0;
|
|
10982
|
-
const zoneStore = (0,
|
|
11206
|
+
const zoneStore = (0, import_react73.useContext)(ZoneStoreContext);
|
|
10983
11207
|
const isHovering = useContextStore(
|
|
10984
11208
|
ZoneStoreContext,
|
|
10985
11209
|
(s) => s.hoveringComponent === itemId
|
|
@@ -10994,7 +11218,7 @@ var Layer = ({
|
|
|
10994
11218
|
});
|
|
10995
11219
|
const componentConfig = config.components[nodeData.data.type];
|
|
10996
11220
|
const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
|
|
10997
|
-
return /* @__PURE__ */ (0,
|
|
11221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
10998
11222
|
"li",
|
|
10999
11223
|
{
|
|
11000
11224
|
className: getClassNameLayer({
|
|
@@ -11004,7 +11228,7 @@ var Layer = ({
|
|
|
11004
11228
|
childIsSelected
|
|
11005
11229
|
}),
|
|
11006
11230
|
children: [
|
|
11007
|
-
/* @__PURE__ */ (0,
|
|
11231
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
11008
11232
|
"button",
|
|
11009
11233
|
{
|
|
11010
11234
|
type: "button",
|
|
@@ -11042,22 +11266,22 @@ var Layer = ({
|
|
|
11042
11266
|
zoneStore.setState({ hoveringComponent: null });
|
|
11043
11267
|
},
|
|
11044
11268
|
children: [
|
|
11045
|
-
containsZone && /* @__PURE__ */ (0,
|
|
11269
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11046
11270
|
"div",
|
|
11047
11271
|
{
|
|
11048
11272
|
className: getClassNameLayer("chevron"),
|
|
11049
11273
|
title: isSelected ? "Collapse" : "Expand",
|
|
11050
|
-
children: /* @__PURE__ */ (0,
|
|
11274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ChevronDown, { size: "12" })
|
|
11051
11275
|
}
|
|
11052
11276
|
),
|
|
11053
|
-
/* @__PURE__ */ (0,
|
|
11054
|
-
/* @__PURE__ */ (0,
|
|
11055
|
-
/* @__PURE__ */ (0,
|
|
11277
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
|
11278
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(LayoutGrid, { size: "16" }) }),
|
|
11279
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameLayer("name"), children: label })
|
|
11056
11280
|
] })
|
|
11057
11281
|
]
|
|
11058
11282
|
}
|
|
11059
11283
|
) }),
|
|
11060
|
-
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0,
|
|
11284
|
+
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(LayerTree, { zoneCompound: subzone }) }, subzone))
|
|
11061
11285
|
]
|
|
11062
11286
|
}
|
|
11063
11287
|
);
|
|
@@ -11083,15 +11307,15 @@ var LayerTree = ({
|
|
|
11083
11307
|
}
|
|
11084
11308
|
)
|
|
11085
11309
|
);
|
|
11086
|
-
return /* @__PURE__ */ (0,
|
|
11087
|
-
label && /* @__PURE__ */ (0,
|
|
11088
|
-
/* @__PURE__ */ (0,
|
|
11310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
11311
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: getClassName30("zoneTitle"), children: [
|
|
11312
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassName30("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Layers, { size: "16" }) }),
|
|
11089
11313
|
label
|
|
11090
11314
|
] }),
|
|
11091
|
-
/* @__PURE__ */ (0,
|
|
11092
|
-
contentIds.length === 0 && /* @__PURE__ */ (0,
|
|
11315
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("ul", { className: getClassName30(), children: [
|
|
11316
|
+
contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassName30("helper"), children: "No items" }),
|
|
11093
11317
|
contentIds.map((itemId, i) => {
|
|
11094
|
-
return /* @__PURE__ */ (0,
|
|
11318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11095
11319
|
Layer,
|
|
11096
11320
|
{
|
|
11097
11321
|
index: i,
|
|
@@ -11107,7 +11331,7 @@ var LayerTree = ({
|
|
|
11107
11331
|
|
|
11108
11332
|
// components/Puck/components/Outline/index.tsx
|
|
11109
11333
|
init_store();
|
|
11110
|
-
var
|
|
11334
|
+
var import_react74 = require("react");
|
|
11111
11335
|
|
|
11112
11336
|
// lib/data/find-zones-for-area.ts
|
|
11113
11337
|
init_react_import();
|
|
@@ -11119,14 +11343,14 @@ var findZonesForArea = (state, area) => {
|
|
|
11119
11343
|
|
|
11120
11344
|
// components/Puck/components/Outline/index.tsx
|
|
11121
11345
|
var import_shallow7 = require("zustand/react/shallow");
|
|
11122
|
-
var
|
|
11346
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
11123
11347
|
var Outline = () => {
|
|
11124
11348
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
11125
11349
|
const rootZones = useAppStore(
|
|
11126
11350
|
(0, import_shallow7.useShallow)((s) => findZonesForArea(s.state, "root"))
|
|
11127
11351
|
);
|
|
11128
|
-
const Wrapper = (0,
|
|
11129
|
-
return /* @__PURE__ */ (0,
|
|
11352
|
+
const Wrapper = (0, import_react74.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
|
11353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
11130
11354
|
LayerTree,
|
|
11131
11355
|
{
|
|
11132
11356
|
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
|
@@ -11139,7 +11363,7 @@ var Outline = () => {
|
|
|
11139
11363
|
// components/Puck/components/Canvas/index.tsx
|
|
11140
11364
|
init_react_import();
|
|
11141
11365
|
init_css_box_model_esm();
|
|
11142
|
-
var
|
|
11366
|
+
var import_react77 = require("react");
|
|
11143
11367
|
init_store();
|
|
11144
11368
|
|
|
11145
11369
|
// components/ViewportControls/index.tsx
|
|
@@ -11147,7 +11371,7 @@ init_react_import();
|
|
|
11147
11371
|
init_lucide_react();
|
|
11148
11372
|
init_IconButton2();
|
|
11149
11373
|
init_store();
|
|
11150
|
-
var
|
|
11374
|
+
var import_react75 = require("react");
|
|
11151
11375
|
init_lib();
|
|
11152
11376
|
|
|
11153
11377
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
@@ -11155,11 +11379,11 @@ init_react_import();
|
|
|
11155
11379
|
var styles_module_default24 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
|
|
11156
11380
|
|
|
11157
11381
|
// components/ViewportControls/index.tsx
|
|
11158
|
-
var
|
|
11382
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
11159
11383
|
var icons = {
|
|
11160
|
-
Smartphone: /* @__PURE__ */ (0,
|
|
11161
|
-
Tablet: /* @__PURE__ */ (0,
|
|
11162
|
-
Monitor: /* @__PURE__ */ (0,
|
|
11384
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Smartphone, { size: 16 }),
|
|
11385
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Tablet, { size: 16 }),
|
|
11386
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Monitor, { size: 16 })
|
|
11163
11387
|
};
|
|
11164
11388
|
var getClassName31 = get_class_name_factory_default("ViewportControls", styles_module_default24);
|
|
11165
11389
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default24);
|
|
@@ -11171,11 +11395,11 @@ var ViewportButton = ({
|
|
|
11171
11395
|
onClick
|
|
11172
11396
|
}) => {
|
|
11173
11397
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
11174
|
-
const [isActive, setIsActive] = (0,
|
|
11175
|
-
(0,
|
|
11398
|
+
const [isActive, setIsActive] = (0, import_react75.useState)(false);
|
|
11399
|
+
(0, import_react75.useEffect)(() => {
|
|
11176
11400
|
setIsActive(width === viewports.current.width);
|
|
11177
11401
|
}, [width, viewports.current.width]);
|
|
11178
|
-
return /* @__PURE__ */ (0,
|
|
11402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11179
11403
|
IconButton,
|
|
11180
11404
|
{
|
|
11181
11405
|
type: "button",
|
|
@@ -11185,7 +11409,7 @@ var ViewportButton = ({
|
|
|
11185
11409
|
e.stopPropagation();
|
|
11186
11410
|
onClick({ width, height });
|
|
11187
11411
|
},
|
|
11188
|
-
children: /* @__PURE__ */ (0,
|
|
11412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: getClassNameButton("inner"), children })
|
|
11189
11413
|
}
|
|
11190
11414
|
) });
|
|
11191
11415
|
};
|
|
@@ -11209,7 +11433,7 @@ var ViewportControls = ({
|
|
|
11209
11433
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
|
11210
11434
|
(option) => option.value === autoZoom
|
|
11211
11435
|
);
|
|
11212
|
-
const zoomOptions = (0,
|
|
11436
|
+
const zoomOptions = (0, import_react75.useMemo)(
|
|
11213
11437
|
() => [
|
|
11214
11438
|
...defaultZoomOptions,
|
|
11215
11439
|
...defaultsContainAutoZoom ? [] : [
|
|
@@ -11221,8 +11445,8 @@ var ViewportControls = ({
|
|
|
11221
11445
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
11222
11446
|
[autoZoom]
|
|
11223
11447
|
);
|
|
11224
|
-
return /* @__PURE__ */ (0,
|
|
11225
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
|
11448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: getClassName31(), children: [
|
|
11449
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11226
11450
|
ViewportButton,
|
|
11227
11451
|
{
|
|
11228
11452
|
height: viewport.height,
|
|
@@ -11233,8 +11457,8 @@ var ViewportControls = ({
|
|
|
11233
11457
|
},
|
|
11234
11458
|
i
|
|
11235
11459
|
)),
|
|
11236
|
-
/* @__PURE__ */ (0,
|
|
11237
|
-
/* @__PURE__ */ (0,
|
|
11460
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: getClassName31("divider") }),
|
|
11461
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11238
11462
|
IconButton,
|
|
11239
11463
|
{
|
|
11240
11464
|
type: "button",
|
|
@@ -11249,10 +11473,10 @@ var ViewportControls = ({
|
|
|
11249
11473
|
)].value
|
|
11250
11474
|
);
|
|
11251
11475
|
},
|
|
11252
|
-
children: /* @__PURE__ */ (0,
|
|
11476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ZoomOut, { size: 16 })
|
|
11253
11477
|
}
|
|
11254
11478
|
),
|
|
11255
|
-
/* @__PURE__ */ (0,
|
|
11479
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11256
11480
|
IconButton,
|
|
11257
11481
|
{
|
|
11258
11482
|
type: "button",
|
|
@@ -11267,11 +11491,11 @@ var ViewportControls = ({
|
|
|
11267
11491
|
)].value
|
|
11268
11492
|
);
|
|
11269
11493
|
},
|
|
11270
|
-
children: /* @__PURE__ */ (0,
|
|
11494
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ZoomIn, { size: 16 })
|
|
11271
11495
|
}
|
|
11272
11496
|
),
|
|
11273
|
-
/* @__PURE__ */ (0,
|
|
11274
|
-
/* @__PURE__ */ (0,
|
|
11497
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: getClassName31("divider") }),
|
|
11498
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11275
11499
|
"select",
|
|
11276
11500
|
{
|
|
11277
11501
|
className: getClassName31("zoomSelect"),
|
|
@@ -11282,7 +11506,7 @@ var ViewportControls = ({
|
|
|
11282
11506
|
onChange: (e) => {
|
|
11283
11507
|
onZoom(parseFloat(e.currentTarget.value));
|
|
11284
11508
|
},
|
|
11285
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
|
11509
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11286
11510
|
"option",
|
|
11287
11511
|
{
|
|
11288
11512
|
value: option.value,
|
|
@@ -11306,23 +11530,23 @@ var import_shallow8 = require("zustand/react/shallow");
|
|
|
11306
11530
|
|
|
11307
11531
|
// lib/frame-context.tsx
|
|
11308
11532
|
init_react_import();
|
|
11309
|
-
var
|
|
11310
|
-
var
|
|
11311
|
-
var FrameContext = (0,
|
|
11533
|
+
var import_react76 = require("react");
|
|
11534
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11535
|
+
var FrameContext = (0, import_react76.createContext)(null);
|
|
11312
11536
|
var FrameProvider = ({
|
|
11313
11537
|
children
|
|
11314
11538
|
}) => {
|
|
11315
|
-
const frameRef = (0,
|
|
11316
|
-
const value = (0,
|
|
11539
|
+
const frameRef = (0, import_react76.useRef)(null);
|
|
11540
|
+
const value = (0, import_react76.useMemo)(
|
|
11317
11541
|
() => ({
|
|
11318
11542
|
frameRef
|
|
11319
11543
|
}),
|
|
11320
11544
|
[]
|
|
11321
11545
|
);
|
|
11322
|
-
return /* @__PURE__ */ (0,
|
|
11546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FrameContext.Provider, { value, children });
|
|
11323
11547
|
};
|
|
11324
11548
|
var useCanvasFrame = () => {
|
|
11325
|
-
const context = (0,
|
|
11549
|
+
const context = (0, import_react76.useContext)(FrameContext);
|
|
11326
11550
|
if (context === null) {
|
|
11327
11551
|
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
11328
11552
|
}
|
|
@@ -11330,7 +11554,7 @@ var useCanvasFrame = () => {
|
|
|
11330
11554
|
};
|
|
11331
11555
|
|
|
11332
11556
|
// components/Puck/components/Canvas/index.tsx
|
|
11333
|
-
var
|
|
11557
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11334
11558
|
var getClassName32 = get_class_name_factory_default("PuckCanvas", styles_module_default25);
|
|
11335
11559
|
var ZOOM_ON_CHANGE = true;
|
|
11336
11560
|
var TRANSITION_DURATION = 150;
|
|
@@ -11371,17 +11595,17 @@ var Canvas = () => {
|
|
|
11371
11595
|
viewports: s.state.ui.viewports
|
|
11372
11596
|
}))
|
|
11373
11597
|
);
|
|
11374
|
-
const [showTransition, setShowTransition] = (0,
|
|
11375
|
-
const isResizingRef = (0,
|
|
11376
|
-
const defaultRender = (0,
|
|
11377
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
|
11598
|
+
const [showTransition, setShowTransition] = (0, import_react77.useState)(false);
|
|
11599
|
+
const isResizingRef = (0, import_react77.useRef)(false);
|
|
11600
|
+
const defaultRender = (0, import_react77.useMemo)(() => {
|
|
11601
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_jsx_runtime77.Fragment, { children });
|
|
11378
11602
|
return PuckDefault;
|
|
11379
11603
|
}, []);
|
|
11380
|
-
const CustomPreview = (0,
|
|
11604
|
+
const CustomPreview = (0, import_react77.useMemo)(
|
|
11381
11605
|
() => overrides.preview || defaultRender,
|
|
11382
11606
|
[overrides]
|
|
11383
11607
|
);
|
|
11384
|
-
const getFrameDimensions = (0,
|
|
11608
|
+
const getFrameDimensions = (0, import_react77.useCallback)(() => {
|
|
11385
11609
|
if (frameRef.current) {
|
|
11386
11610
|
const frame = frameRef.current;
|
|
11387
11611
|
const box = getBox(frame);
|
|
@@ -11389,7 +11613,7 @@ var Canvas = () => {
|
|
|
11389
11613
|
}
|
|
11390
11614
|
return { width: 0, height: 0 };
|
|
11391
11615
|
}, [frameRef]);
|
|
11392
|
-
(0,
|
|
11616
|
+
(0, import_react77.useEffect)(() => {
|
|
11393
11617
|
resetAutoZoom();
|
|
11394
11618
|
}, [
|
|
11395
11619
|
frameRef,
|
|
@@ -11399,7 +11623,7 @@ var Canvas = () => {
|
|
|
11399
11623
|
rightSideBarWidth,
|
|
11400
11624
|
viewports
|
|
11401
11625
|
]);
|
|
11402
|
-
(0,
|
|
11626
|
+
(0, import_react77.useEffect)(() => {
|
|
11403
11627
|
const { height: frameHeight } = getFrameDimensions();
|
|
11404
11628
|
if (viewports.current.height === "auto") {
|
|
11405
11629
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
|
@@ -11407,12 +11631,12 @@ var Canvas = () => {
|
|
|
11407
11631
|
}));
|
|
11408
11632
|
}
|
|
11409
11633
|
}, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
|
|
11410
|
-
(0,
|
|
11634
|
+
(0, import_react77.useEffect)(() => {
|
|
11411
11635
|
if (ZOOM_ON_CHANGE) {
|
|
11412
11636
|
resetAutoZoom();
|
|
11413
11637
|
}
|
|
11414
11638
|
}, [viewports.current.width, viewports]);
|
|
11415
|
-
(0,
|
|
11639
|
+
(0, import_react77.useEffect)(() => {
|
|
11416
11640
|
if (!frameRef.current) return;
|
|
11417
11641
|
const resizeObserver = new ResizeObserver(() => {
|
|
11418
11642
|
if (!isResizingRef.current) {
|
|
@@ -11424,13 +11648,13 @@ var Canvas = () => {
|
|
|
11424
11648
|
resizeObserver.disconnect();
|
|
11425
11649
|
};
|
|
11426
11650
|
}, [frameRef.current]);
|
|
11427
|
-
const [showLoader, setShowLoader] = (0,
|
|
11428
|
-
(0,
|
|
11651
|
+
const [showLoader, setShowLoader] = (0, import_react77.useState)(false);
|
|
11652
|
+
(0, import_react77.useEffect)(() => {
|
|
11429
11653
|
setTimeout(() => {
|
|
11430
11654
|
setShowLoader(true);
|
|
11431
11655
|
}, 500);
|
|
11432
11656
|
}, []);
|
|
11433
|
-
return /* @__PURE__ */ (0,
|
|
11657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
11434
11658
|
"div",
|
|
11435
11659
|
{
|
|
11436
11660
|
className: getClassName32({
|
|
@@ -11448,7 +11672,7 @@ var Canvas = () => {
|
|
|
11448
11672
|
}
|
|
11449
11673
|
},
|
|
11450
11674
|
children: [
|
|
11451
|
-
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
|
11675
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: getClassName32("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
11452
11676
|
ViewportControls,
|
|
11453
11677
|
{
|
|
11454
11678
|
autoZoom: zoomConfig.autoZoom,
|
|
@@ -11477,8 +11701,8 @@ var Canvas = () => {
|
|
|
11477
11701
|
}
|
|
11478
11702
|
}
|
|
11479
11703
|
) }),
|
|
11480
|
-
/* @__PURE__ */ (0,
|
|
11481
|
-
/* @__PURE__ */ (0,
|
|
11704
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: getClassName32("inner"), ref: frameRef, children: [
|
|
11705
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
11482
11706
|
"div",
|
|
11483
11707
|
{
|
|
11484
11708
|
className: getClassName32("root"),
|
|
@@ -11495,10 +11719,10 @@ var Canvas = () => {
|
|
|
11495
11719
|
setShowTransition(false);
|
|
11496
11720
|
isResizingRef.current = false;
|
|
11497
11721
|
},
|
|
11498
|
-
children: /* @__PURE__ */ (0,
|
|
11722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Preview2, {}) })
|
|
11499
11723
|
}
|
|
11500
11724
|
),
|
|
11501
|
-
/* @__PURE__ */ (0,
|
|
11725
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: getClassName32("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Loader, { size: 24 }) })
|
|
11502
11726
|
] })
|
|
11503
11727
|
]
|
|
11504
11728
|
}
|
|
@@ -11510,7 +11734,7 @@ init_default_viewports();
|
|
|
11510
11734
|
|
|
11511
11735
|
// lib/use-loaded-overrides.ts
|
|
11512
11736
|
init_react_import();
|
|
11513
|
-
var
|
|
11737
|
+
var import_react78 = require("react");
|
|
11514
11738
|
|
|
11515
11739
|
// lib/load-overrides.ts
|
|
11516
11740
|
init_react_import();
|
|
@@ -11552,26 +11776,26 @@ var useLoadedOverrides = ({
|
|
|
11552
11776
|
overrides,
|
|
11553
11777
|
plugins
|
|
11554
11778
|
}) => {
|
|
11555
|
-
return (0,
|
|
11779
|
+
return (0, import_react78.useMemo)(() => {
|
|
11556
11780
|
return loadOverrides({ overrides, plugins });
|
|
11557
11781
|
}, [plugins, overrides]);
|
|
11558
11782
|
};
|
|
11559
11783
|
|
|
11560
11784
|
// components/DefaultOverride/index.tsx
|
|
11561
11785
|
init_react_import();
|
|
11562
|
-
var
|
|
11563
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0,
|
|
11786
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
11787
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children });
|
|
11564
11788
|
|
|
11565
11789
|
// lib/use-inject-css.ts
|
|
11566
11790
|
init_react_import();
|
|
11567
|
-
var
|
|
11791
|
+
var import_react79 = require("react");
|
|
11568
11792
|
var styles = ``;
|
|
11569
11793
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
|
11570
|
-
const [el, setEl] = (0,
|
|
11571
|
-
(0,
|
|
11794
|
+
const [el, setEl] = (0, import_react79.useState)();
|
|
11795
|
+
(0, import_react79.useEffect)(() => {
|
|
11572
11796
|
setEl(document.createElement("style"));
|
|
11573
11797
|
}, []);
|
|
11574
|
-
(0,
|
|
11798
|
+
(0, import_react79.useEffect)(() => {
|
|
11575
11799
|
var _a;
|
|
11576
11800
|
if (!el || typeof window === "undefined") {
|
|
11577
11801
|
return;
|
|
@@ -11591,12 +11815,12 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
|
11591
11815
|
|
|
11592
11816
|
// lib/use-preview-mode-hotkeys.ts
|
|
11593
11817
|
init_react_import();
|
|
11594
|
-
var
|
|
11818
|
+
var import_react80 = require("react");
|
|
11595
11819
|
init_use_hotkey();
|
|
11596
11820
|
init_store();
|
|
11597
11821
|
var usePreviewModeHotkeys = () => {
|
|
11598
11822
|
const appStore = useAppStoreApi();
|
|
11599
|
-
const toggleInteractive = (0,
|
|
11823
|
+
const toggleInteractive = (0, import_react80.useCallback)(() => {
|
|
11600
11824
|
const dispatch = appStore.getState().dispatch;
|
|
11601
11825
|
dispatch({
|
|
11602
11826
|
type: "setUi",
|
|
@@ -11611,7 +11835,7 @@ var usePreviewModeHotkeys = () => {
|
|
|
11611
11835
|
|
|
11612
11836
|
// lib/use-delete-hotkeys.ts
|
|
11613
11837
|
init_react_import();
|
|
11614
|
-
var
|
|
11838
|
+
var import_react81 = require("react");
|
|
11615
11839
|
init_use_hotkey();
|
|
11616
11840
|
init_store();
|
|
11617
11841
|
var isElementVisible = (element) => {
|
|
@@ -11648,7 +11872,7 @@ var shouldBlockDeleteHotkey = (e) => {
|
|
|
11648
11872
|
};
|
|
11649
11873
|
var useDeleteHotkeys = () => {
|
|
11650
11874
|
const appStore = useAppStoreApi();
|
|
11651
|
-
const deleteSelectedComponent = (0,
|
|
11875
|
+
const deleteSelectedComponent = (0, import_react81.useCallback)(
|
|
11652
11876
|
(e) => {
|
|
11653
11877
|
var _a;
|
|
11654
11878
|
if (shouldBlockDeleteHotkey(e)) {
|
|
@@ -11679,7 +11903,7 @@ init_use_hotkey();
|
|
|
11679
11903
|
|
|
11680
11904
|
// lib/use-puck.ts
|
|
11681
11905
|
init_react_import();
|
|
11682
|
-
var
|
|
11906
|
+
var import_react82 = require("react");
|
|
11683
11907
|
var import_zustand6 = require("zustand");
|
|
11684
11908
|
init_make_state_public();
|
|
11685
11909
|
init_get_item();
|
|
@@ -11714,9 +11938,12 @@ var generateUsePuck = (store) => {
|
|
|
11714
11938
|
return parentNode.data;
|
|
11715
11939
|
}
|
|
11716
11940
|
};
|
|
11941
|
+
storeData.__private = {
|
|
11942
|
+
appState: store.state
|
|
11943
|
+
};
|
|
11717
11944
|
return storeData;
|
|
11718
11945
|
};
|
|
11719
|
-
var UsePuckStoreContext = (0,
|
|
11946
|
+
var UsePuckStoreContext = (0, import_react82.createContext)(
|
|
11720
11947
|
null
|
|
11721
11948
|
);
|
|
11722
11949
|
var convertToPickedStore = (store) => {
|
|
@@ -11730,12 +11957,12 @@ var convertToPickedStore = (store) => {
|
|
|
11730
11957
|
};
|
|
11731
11958
|
};
|
|
11732
11959
|
var useRegisterUsePuckStore = (appStore) => {
|
|
11733
|
-
const [usePuckStore] = (0,
|
|
11960
|
+
const [usePuckStore] = (0, import_react82.useState)(
|
|
11734
11961
|
() => (0, import_zustand6.createStore)(
|
|
11735
11962
|
() => generateUsePuck(convertToPickedStore(appStore.getState()))
|
|
11736
11963
|
)
|
|
11737
11964
|
);
|
|
11738
|
-
(0,
|
|
11965
|
+
(0, import_react82.useEffect)(() => {
|
|
11739
11966
|
return appStore.subscribe(
|
|
11740
11967
|
(store) => convertToPickedStore(store),
|
|
11741
11968
|
(pickedStore) => {
|
|
@@ -11747,7 +11974,7 @@ var useRegisterUsePuckStore = (appStore) => {
|
|
|
11747
11974
|
};
|
|
11748
11975
|
function createUsePuck() {
|
|
11749
11976
|
return function usePuck2(selector) {
|
|
11750
|
-
const usePuckApi = (0,
|
|
11977
|
+
const usePuckApi = (0, import_react82.useContext)(UsePuckStoreContext);
|
|
11751
11978
|
if (!usePuckApi) {
|
|
11752
11979
|
throw new Error("usePuck must be used inside <Puck>.");
|
|
11753
11980
|
}
|
|
@@ -11759,7 +11986,7 @@ function createUsePuck() {
|
|
|
11759
11986
|
};
|
|
11760
11987
|
}
|
|
11761
11988
|
function usePuck() {
|
|
11762
|
-
(0,
|
|
11989
|
+
(0, import_react82.useEffect)(() => {
|
|
11763
11990
|
console.warn(
|
|
11764
11991
|
"You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
|
|
11765
11992
|
);
|
|
@@ -11767,7 +11994,7 @@ function usePuck() {
|
|
|
11767
11994
|
return createUsePuck()((s) => s);
|
|
11768
11995
|
}
|
|
11769
11996
|
function useGetPuck() {
|
|
11770
|
-
const usePuckApi = (0,
|
|
11997
|
+
const usePuckApi = (0, import_react82.useContext)(UsePuckStoreContext);
|
|
11771
11998
|
if (!usePuckApi) {
|
|
11772
11999
|
throw new Error("usePuckGet must be used inside <Puck>.");
|
|
11773
12000
|
}
|
|
@@ -11780,7 +12007,7 @@ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
|
|
11780
12007
|
|
|
11781
12008
|
// components/Puck/components/Header/index.tsx
|
|
11782
12009
|
init_react_import();
|
|
11783
|
-
var
|
|
12010
|
+
var import_react83 = require("react");
|
|
11784
12011
|
init_store();
|
|
11785
12012
|
init_lucide_react();
|
|
11786
12013
|
init_IconButton();
|
|
@@ -11797,7 +12024,7 @@ var styles_module_default26 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpe
|
|
|
11797
12024
|
|
|
11798
12025
|
// components/MenuBar/index.tsx
|
|
11799
12026
|
init_store();
|
|
11800
|
-
var
|
|
12027
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11801
12028
|
var getClassName33 = get_class_name_factory_default("MenuBar", styles_module_default26);
|
|
11802
12029
|
function MenuBar({
|
|
11803
12030
|
menuOpen = false,
|
|
@@ -11808,7 +12035,7 @@ function MenuBar({
|
|
|
11808
12035
|
const forward = useAppStore((s) => s.history.forward);
|
|
11809
12036
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
11810
12037
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
11811
|
-
return /* @__PURE__ */ (0,
|
|
12038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
11812
12039
|
"div",
|
|
11813
12040
|
{
|
|
11814
12041
|
className: getClassName33({ menuOpen }),
|
|
@@ -11822,30 +12049,30 @@ function MenuBar({
|
|
|
11822
12049
|
setMenuOpen(false);
|
|
11823
12050
|
}
|
|
11824
12051
|
},
|
|
11825
|
-
children: /* @__PURE__ */ (0,
|
|
11826
|
-
/* @__PURE__ */ (0,
|
|
11827
|
-
/* @__PURE__ */ (0,
|
|
12052
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: getClassName33("inner"), children: [
|
|
12053
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: getClassName33("history"), children: [
|
|
12054
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
11828
12055
|
IconButton,
|
|
11829
12056
|
{
|
|
11830
12057
|
type: "button",
|
|
11831
12058
|
title: "undo",
|
|
11832
12059
|
disabled: !hasPast,
|
|
11833
12060
|
onClick: back,
|
|
11834
|
-
children: /* @__PURE__ */ (0,
|
|
12061
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Undo2, { size: 21 })
|
|
11835
12062
|
}
|
|
11836
12063
|
),
|
|
11837
|
-
/* @__PURE__ */ (0,
|
|
12064
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
11838
12065
|
IconButton,
|
|
11839
12066
|
{
|
|
11840
12067
|
type: "button",
|
|
11841
12068
|
title: "redo",
|
|
11842
12069
|
disabled: !hasFuture,
|
|
11843
12070
|
onClick: forward,
|
|
11844
|
-
children: /* @__PURE__ */ (0,
|
|
12071
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Redo2, { size: 21 })
|
|
11845
12072
|
}
|
|
11846
12073
|
)
|
|
11847
12074
|
] }),
|
|
11848
|
-
/* @__PURE__ */ (0,
|
|
12075
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, { children: renderHeaderActions && renderHeaderActions() })
|
|
11849
12076
|
] })
|
|
11850
12077
|
}
|
|
11851
12078
|
);
|
|
@@ -11859,7 +12086,7 @@ init_react_import();
|
|
|
11859
12086
|
var styles_module_default27 = { "PuckHeader": "_PuckHeader_15xnq_1", "PuckHeader-inner": "_PuckHeader-inner_15xnq_10", "PuckHeader-toggle": "_PuckHeader-toggle_15xnq_20", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_15xnq_27", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_15xnq_27", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_15xnq_28", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_15xnq_28", "PuckHeader-title": "_PuckHeader-title_15xnq_32", "PuckHeader-path": "_PuckHeader-path_15xnq_36", "PuckHeader-tools": "_PuckHeader-tools_15xnq_43", "PuckHeader-menuButton": "_PuckHeader-menuButton_15xnq_49", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_15xnq_54" };
|
|
11860
12087
|
|
|
11861
12088
|
// components/Puck/components/Header/index.tsx
|
|
11862
|
-
var
|
|
12089
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11863
12090
|
var getClassName34 = get_class_name_factory_default("PuckHeader", styles_module_default27);
|
|
11864
12091
|
var HeaderInner = () => {
|
|
11865
12092
|
const {
|
|
@@ -11872,7 +12099,7 @@ var HeaderInner = () => {
|
|
|
11872
12099
|
} = usePropsContext();
|
|
11873
12100
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
11874
12101
|
const appStore = useAppStoreApi();
|
|
11875
|
-
const defaultHeaderRender = (0,
|
|
12102
|
+
const defaultHeaderRender = (0, import_react83.useMemo)(() => {
|
|
11876
12103
|
if (renderHeader) {
|
|
11877
12104
|
console.warn(
|
|
11878
12105
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
@@ -11881,13 +12108,13 @@ var HeaderInner = () => {
|
|
|
11881
12108
|
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
|
11882
12109
|
const Comp = renderHeader;
|
|
11883
12110
|
const appState = useAppStore((s) => s.state);
|
|
11884
|
-
return /* @__PURE__ */ (0,
|
|
12111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
11885
12112
|
};
|
|
11886
12113
|
return RenderHeader;
|
|
11887
12114
|
}
|
|
11888
12115
|
return DefaultOverride;
|
|
11889
12116
|
}, [renderHeader]);
|
|
11890
|
-
const defaultHeaderActionsRender = (0,
|
|
12117
|
+
const defaultHeaderActionsRender = (0, import_react83.useMemo)(() => {
|
|
11891
12118
|
if (renderHeaderActions) {
|
|
11892
12119
|
console.warn(
|
|
11893
12120
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
@@ -11895,7 +12122,7 @@ var HeaderInner = () => {
|
|
|
11895
12122
|
const RenderHeader = (props) => {
|
|
11896
12123
|
const Comp = renderHeaderActions;
|
|
11897
12124
|
const appState = useAppStore((s) => s.state);
|
|
11898
|
-
return /* @__PURE__ */ (0,
|
|
12125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
11899
12126
|
};
|
|
11900
12127
|
return RenderHeader;
|
|
11901
12128
|
}
|
|
@@ -11907,7 +12134,7 @@ var HeaderInner = () => {
|
|
|
11907
12134
|
const CustomHeaderActions = useAppStore(
|
|
11908
12135
|
(s) => s.overrides.headerActions || defaultHeaderActionsRender
|
|
11909
12136
|
);
|
|
11910
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
12137
|
+
const [menuOpen, setMenuOpen] = (0, import_react83.useState)(false);
|
|
11911
12138
|
const rootTitle = useAppStore((s) => {
|
|
11912
12139
|
var _a, _b;
|
|
11913
12140
|
const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
|
|
@@ -11917,7 +12144,7 @@ var HeaderInner = () => {
|
|
|
11917
12144
|
const rightSideBarVisible = useAppStore(
|
|
11918
12145
|
(s) => s.state.ui.rightSideBarVisible
|
|
11919
12146
|
);
|
|
11920
|
-
const toggleSidebars = (0,
|
|
12147
|
+
const toggleSidebars = (0, import_react83.useCallback)(
|
|
11921
12148
|
(sidebar) => {
|
|
11922
12149
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
11923
12150
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
@@ -11931,27 +12158,27 @@ var HeaderInner = () => {
|
|
|
11931
12158
|
},
|
|
11932
12159
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
11933
12160
|
);
|
|
11934
|
-
return /* @__PURE__ */ (0,
|
|
12161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11935
12162
|
CustomHeader,
|
|
11936
12163
|
{
|
|
11937
|
-
actions: /* @__PURE__ */ (0,
|
|
12164
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_jsx_runtime80.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11938
12165
|
Button,
|
|
11939
12166
|
{
|
|
11940
12167
|
onClick: () => {
|
|
11941
12168
|
const data = appStore.getState().state.data;
|
|
11942
12169
|
onPublish && onPublish(data);
|
|
11943
12170
|
},
|
|
11944
|
-
icon: /* @__PURE__ */ (0,
|
|
12171
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Globe, { size: "14px" }),
|
|
11945
12172
|
children: "Publish"
|
|
11946
12173
|
}
|
|
11947
12174
|
) }) }),
|
|
11948
|
-
children: /* @__PURE__ */ (0,
|
|
12175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11949
12176
|
"header",
|
|
11950
12177
|
{
|
|
11951
12178
|
className: getClassName34({ leftSideBarVisible, rightSideBarVisible }),
|
|
11952
|
-
children: /* @__PURE__ */ (0,
|
|
11953
|
-
/* @__PURE__ */ (0,
|
|
11954
|
-
/* @__PURE__ */ (0,
|
|
12179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: getClassName34("inner"), children: [
|
|
12180
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: getClassName34("toggle"), children: [
|
|
12181
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: getClassName34("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11955
12182
|
IconButton,
|
|
11956
12183
|
{
|
|
11957
12184
|
type: "button",
|
|
@@ -11959,10 +12186,10 @@ var HeaderInner = () => {
|
|
|
11959
12186
|
toggleSidebars("left");
|
|
11960
12187
|
},
|
|
11961
12188
|
title: "Toggle left sidebar",
|
|
11962
|
-
children: /* @__PURE__ */ (0,
|
|
12189
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PanelLeft, { focusable: "false" })
|
|
11963
12190
|
}
|
|
11964
12191
|
) }),
|
|
11965
|
-
/* @__PURE__ */ (0,
|
|
12192
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: getClassName34("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11966
12193
|
IconButton,
|
|
11967
12194
|
{
|
|
11968
12195
|
type: "button",
|
|
@@ -11970,19 +12197,19 @@ var HeaderInner = () => {
|
|
|
11970
12197
|
toggleSidebars("right");
|
|
11971
12198
|
},
|
|
11972
12199
|
title: "Toggle right sidebar",
|
|
11973
|
-
children: /* @__PURE__ */ (0,
|
|
12200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PanelRight, { focusable: "false" })
|
|
11974
12201
|
}
|
|
11975
12202
|
) })
|
|
11976
12203
|
] }),
|
|
11977
|
-
/* @__PURE__ */ (0,
|
|
12204
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: getClassName34("title"), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Heading7, { rank: "2", size: "xs", children: [
|
|
11978
12205
|
headerTitle || rootTitle || "Page",
|
|
11979
|
-
headerPath && /* @__PURE__ */ (0,
|
|
12206
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
11980
12207
|
" ",
|
|
11981
|
-
/* @__PURE__ */ (0,
|
|
12208
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("code", { className: getClassName34("path"), children: headerPath })
|
|
11982
12209
|
] })
|
|
11983
12210
|
] }) }),
|
|
11984
|
-
/* @__PURE__ */ (0,
|
|
11985
|
-
/* @__PURE__ */ (0,
|
|
12211
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: getClassName34("tools"), children: [
|
|
12212
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: getClassName34("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11986
12213
|
IconButton,
|
|
11987
12214
|
{
|
|
11988
12215
|
type: "button",
|
|
@@ -11990,23 +12217,23 @@ var HeaderInner = () => {
|
|
|
11990
12217
|
return setMenuOpen(!menuOpen);
|
|
11991
12218
|
},
|
|
11992
12219
|
title: "Toggle menu bar",
|
|
11993
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
|
12220
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ChevronDown, { focusable: "false" })
|
|
11994
12221
|
}
|
|
11995
12222
|
) }),
|
|
11996
|
-
/* @__PURE__ */ (0,
|
|
12223
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11997
12224
|
MenuBar,
|
|
11998
12225
|
{
|
|
11999
12226
|
dispatch,
|
|
12000
12227
|
onPublish,
|
|
12001
12228
|
menuOpen,
|
|
12002
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
|
12229
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12003
12230
|
Button,
|
|
12004
12231
|
{
|
|
12005
12232
|
onClick: () => {
|
|
12006
12233
|
const data = appStore.getState().state.data;
|
|
12007
12234
|
onPublish && onPublish(data);
|
|
12008
12235
|
},
|
|
12009
|
-
icon: /* @__PURE__ */ (0,
|
|
12236
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Globe, { size: "14px" }),
|
|
12010
12237
|
children: "Publish"
|
|
12011
12238
|
}
|
|
12012
12239
|
) }),
|
|
@@ -12020,14 +12247,14 @@ var HeaderInner = () => {
|
|
|
12020
12247
|
}
|
|
12021
12248
|
);
|
|
12022
12249
|
};
|
|
12023
|
-
var Header = (0,
|
|
12250
|
+
var Header = (0, import_react83.memo)(HeaderInner);
|
|
12024
12251
|
|
|
12025
12252
|
// components/Puck/components/Sidebar/index.tsx
|
|
12026
12253
|
init_react_import();
|
|
12027
12254
|
|
|
12028
12255
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
12029
12256
|
init_react_import();
|
|
12030
|
-
var
|
|
12257
|
+
var import_react84 = require("react");
|
|
12031
12258
|
init_get_class_name_factory();
|
|
12032
12259
|
|
|
12033
12260
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
|
|
@@ -12036,7 +12263,7 @@ var styles_module_default28 = { "ResizeHandle": "_ResizeHandle_144bf_2", "Resize
|
|
|
12036
12263
|
|
|
12037
12264
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
12038
12265
|
init_lib();
|
|
12039
|
-
var
|
|
12266
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
12040
12267
|
var getClassName35 = get_class_name_factory_default("ResizeHandle", styles_module_default28);
|
|
12041
12268
|
var ResizeHandle = ({
|
|
12042
12269
|
position,
|
|
@@ -12046,11 +12273,11 @@ var ResizeHandle = ({
|
|
|
12046
12273
|
}) => {
|
|
12047
12274
|
const { frameRef } = useCanvasFrame();
|
|
12048
12275
|
const resetAutoZoom = useResetAutoZoom(frameRef);
|
|
12049
|
-
const handleRef = (0,
|
|
12050
|
-
const isDragging = (0,
|
|
12051
|
-
const startX = (0,
|
|
12052
|
-
const startWidth = (0,
|
|
12053
|
-
const handleMouseMove = (0,
|
|
12276
|
+
const handleRef = (0, import_react84.useRef)(null);
|
|
12277
|
+
const isDragging = (0, import_react84.useRef)(false);
|
|
12278
|
+
const startX = (0, import_react84.useRef)(0);
|
|
12279
|
+
const startWidth = (0, import_react84.useRef)(0);
|
|
12280
|
+
const handleMouseMove = (0, import_react84.useCallback)(
|
|
12054
12281
|
(e) => {
|
|
12055
12282
|
if (!isDragging.current) return;
|
|
12056
12283
|
const delta = e.clientX - startX.current;
|
|
@@ -12061,7 +12288,7 @@ var ResizeHandle = ({
|
|
|
12061
12288
|
},
|
|
12062
12289
|
[onResize, position]
|
|
12063
12290
|
);
|
|
12064
|
-
const handleMouseUp = (0,
|
|
12291
|
+
const handleMouseUp = (0, import_react84.useCallback)(() => {
|
|
12065
12292
|
var _a;
|
|
12066
12293
|
if (!isDragging.current) return;
|
|
12067
12294
|
isDragging.current = false;
|
|
@@ -12077,7 +12304,7 @@ var ResizeHandle = ({
|
|
|
12077
12304
|
onResizeEnd(finalWidth);
|
|
12078
12305
|
resetAutoZoom();
|
|
12079
12306
|
}, [onResizeEnd]);
|
|
12080
|
-
const handleMouseDown = (0,
|
|
12307
|
+
const handleMouseDown = (0, import_react84.useCallback)(
|
|
12081
12308
|
(e) => {
|
|
12082
12309
|
var _a;
|
|
12083
12310
|
isDragging.current = true;
|
|
@@ -12095,7 +12322,7 @@ var ResizeHandle = ({
|
|
|
12095
12322
|
},
|
|
12096
12323
|
[position, handleMouseMove, handleMouseUp]
|
|
12097
12324
|
);
|
|
12098
|
-
return /* @__PURE__ */ (0,
|
|
12325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12099
12326
|
"div",
|
|
12100
12327
|
{
|
|
12101
12328
|
ref: handleRef,
|
|
@@ -12113,7 +12340,7 @@ init_react_import();
|
|
|
12113
12340
|
var styles_module_default29 = { "Sidebar": "_Sidebar_1xksb_1", "Sidebar--left": "_Sidebar--left_1xksb_8", "Sidebar--right": "_Sidebar--right_1xksb_14", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_1xksb_20" };
|
|
12114
12341
|
|
|
12115
12342
|
// components/Puck/components/Sidebar/index.tsx
|
|
12116
|
-
var
|
|
12343
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
12117
12344
|
var getClassName36 = get_class_name_factory_default("Sidebar", styles_module_default29);
|
|
12118
12345
|
var Sidebar = ({
|
|
12119
12346
|
position,
|
|
@@ -12124,9 +12351,9 @@ var Sidebar = ({
|
|
|
12124
12351
|
children
|
|
12125
12352
|
}) => {
|
|
12126
12353
|
if (!isVisible) return null;
|
|
12127
|
-
return /* @__PURE__ */ (0,
|
|
12128
|
-
/* @__PURE__ */ (0,
|
|
12129
|
-
/* @__PURE__ */ (0,
|
|
12354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
|
|
12355
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { ref: sidebarRef, className: getClassName36({ [position]: true }), children }),
|
|
12356
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `${getClassName36("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
12130
12357
|
ResizeHandle,
|
|
12131
12358
|
{
|
|
12132
12359
|
position,
|
|
@@ -12140,15 +12367,15 @@ var Sidebar = ({
|
|
|
12140
12367
|
|
|
12141
12368
|
// lib/use-sidebar-resize.ts
|
|
12142
12369
|
init_react_import();
|
|
12143
|
-
var
|
|
12370
|
+
var import_react85 = require("react");
|
|
12144
12371
|
init_store();
|
|
12145
12372
|
function useSidebarResize(position, dispatch) {
|
|
12146
|
-
const [width, setWidth] = (0,
|
|
12147
|
-
const sidebarRef = (0,
|
|
12373
|
+
const [width, setWidth] = (0, import_react85.useState)(null);
|
|
12374
|
+
const sidebarRef = (0, import_react85.useRef)(null);
|
|
12148
12375
|
const storeWidth = useAppStore(
|
|
12149
12376
|
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
12150
12377
|
);
|
|
12151
|
-
(0,
|
|
12378
|
+
(0, import_react85.useEffect)(() => {
|
|
12152
12379
|
if (typeof window !== "undefined" && !storeWidth) {
|
|
12153
12380
|
try {
|
|
12154
12381
|
const savedWidths = localStorage.getItem("puck-sidebar-widths");
|
|
@@ -12173,12 +12400,12 @@ function useSidebarResize(position, dispatch) {
|
|
|
12173
12400
|
}
|
|
12174
12401
|
}
|
|
12175
12402
|
}, [dispatch, position, storeWidth]);
|
|
12176
|
-
(0,
|
|
12403
|
+
(0, import_react85.useEffect)(() => {
|
|
12177
12404
|
if (storeWidth !== void 0) {
|
|
12178
12405
|
setWidth(storeWidth);
|
|
12179
12406
|
}
|
|
12180
12407
|
}, [storeWidth]);
|
|
12181
|
-
const handleResizeEnd = (0,
|
|
12408
|
+
const handleResizeEnd = (0, import_react85.useCallback)(
|
|
12182
12409
|
(width2) => {
|
|
12183
12410
|
dispatch({
|
|
12184
12411
|
type: "setUi",
|
|
@@ -12233,7 +12460,7 @@ var toComponent = (item) => {
|
|
|
12233
12460
|
};
|
|
12234
12461
|
|
|
12235
12462
|
// components/Puck/index.tsx
|
|
12236
|
-
var
|
|
12463
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
12237
12464
|
var getClassName37 = get_class_name_factory_default("Puck", styles_module_default19);
|
|
12238
12465
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default19);
|
|
12239
12466
|
var FieldSideBar = () => {
|
|
@@ -12243,13 +12470,13 @@ var FieldSideBar = () => {
|
|
|
12243
12470
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
|
|
12244
12471
|
}
|
|
12245
12472
|
);
|
|
12246
|
-
return /* @__PURE__ */ (0,
|
|
12473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Fields, {}) });
|
|
12247
12474
|
};
|
|
12248
|
-
var propsContext = (0,
|
|
12475
|
+
var propsContext = (0, import_react86.createContext)({});
|
|
12249
12476
|
function PropsProvider(props) {
|
|
12250
|
-
return /* @__PURE__ */ (0,
|
|
12477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
12251
12478
|
}
|
|
12252
|
-
var usePropsContext = () => (0,
|
|
12479
|
+
var usePropsContext = () => (0, import_react86.useContext)(propsContext);
|
|
12253
12480
|
function PuckProvider({ children }) {
|
|
12254
12481
|
const {
|
|
12255
12482
|
config,
|
|
@@ -12266,14 +12493,14 @@ function PuckProvider({ children }) {
|
|
|
12266
12493
|
onAction,
|
|
12267
12494
|
fieldTransforms
|
|
12268
12495
|
} = usePropsContext();
|
|
12269
|
-
const iframe = (0,
|
|
12496
|
+
const iframe = (0, import_react86.useMemo)(
|
|
12270
12497
|
() => __spreadValues({
|
|
12271
12498
|
enabled: true,
|
|
12272
12499
|
waitForStyles: true
|
|
12273
12500
|
}, _iframe),
|
|
12274
12501
|
[_iframe]
|
|
12275
12502
|
);
|
|
12276
|
-
const [generatedAppState] = (0,
|
|
12503
|
+
const [generatedAppState] = (0, import_react86.useState)(() => {
|
|
12277
12504
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
12278
12505
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
12279
12506
|
let clientUiState = {};
|
|
@@ -12337,7 +12564,7 @@ function PuckProvider({ children }) {
|
|
|
12337
12564
|
return walkAppState(newAppState, config);
|
|
12338
12565
|
});
|
|
12339
12566
|
const { appendData = true } = _initialHistory || {};
|
|
12340
|
-
const [blendedHistories] = (0,
|
|
12567
|
+
const [blendedHistories] = (0, import_react86.useState)(
|
|
12341
12568
|
[
|
|
12342
12569
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
12343
12570
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -12351,7 +12578,7 @@ function PuckProvider({ children }) {
|
|
|
12351
12578
|
});
|
|
12352
12579
|
})
|
|
12353
12580
|
);
|
|
12354
|
-
const initialHistoryIndex = (0,
|
|
12581
|
+
const initialHistoryIndex = (0, import_react86.useMemo)(() => {
|
|
12355
12582
|
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
12356
12583
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
12357
12584
|
}
|
|
@@ -12362,7 +12589,7 @@ function PuckProvider({ children }) {
|
|
|
12362
12589
|
overrides,
|
|
12363
12590
|
plugins
|
|
12364
12591
|
});
|
|
12365
|
-
const loadedFieldTransforms = (0,
|
|
12592
|
+
const loadedFieldTransforms = (0, import_react86.useMemo)(() => {
|
|
12366
12593
|
const _plugins = plugins || [];
|
|
12367
12594
|
const pluginFieldTransforms = _plugins.reduce(
|
|
12368
12595
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -12370,7 +12597,7 @@ function PuckProvider({ children }) {
|
|
|
12370
12597
|
);
|
|
12371
12598
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
12372
12599
|
}, [fieldTransforms, plugins]);
|
|
12373
|
-
const generateAppStore = (0,
|
|
12600
|
+
const generateAppStore = (0, import_react86.useCallback)(
|
|
12374
12601
|
(state) => {
|
|
12375
12602
|
return {
|
|
12376
12603
|
state,
|
|
@@ -12396,15 +12623,15 @@ function PuckProvider({ children }) {
|
|
|
12396
12623
|
loadedFieldTransforms
|
|
12397
12624
|
]
|
|
12398
12625
|
);
|
|
12399
|
-
const [appStore] = (0,
|
|
12626
|
+
const [appStore] = (0, import_react86.useState)(
|
|
12400
12627
|
() => createAppStore(generateAppStore(initialAppState))
|
|
12401
12628
|
);
|
|
12402
|
-
(0,
|
|
12629
|
+
(0, import_react86.useEffect)(() => {
|
|
12403
12630
|
if (process.env.NODE_ENV !== "production") {
|
|
12404
12631
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
12405
12632
|
}
|
|
12406
12633
|
}, [appStore]);
|
|
12407
|
-
(0,
|
|
12634
|
+
(0, import_react86.useEffect)(() => {
|
|
12408
12635
|
const state = appStore.getState().state;
|
|
12409
12636
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
12410
12637
|
}, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
|
|
@@ -12413,8 +12640,8 @@ function PuckProvider({ children }) {
|
|
|
12413
12640
|
index: initialHistoryIndex,
|
|
12414
12641
|
initialAppState
|
|
12415
12642
|
});
|
|
12416
|
-
const previousData = (0,
|
|
12417
|
-
(0,
|
|
12643
|
+
const previousData = (0, import_react86.useRef)(null);
|
|
12644
|
+
(0, import_react86.useEffect)(() => {
|
|
12418
12645
|
return appStore.subscribe(
|
|
12419
12646
|
(s) => s.state.data,
|
|
12420
12647
|
(data) => {
|
|
@@ -12428,11 +12655,11 @@ function PuckProvider({ children }) {
|
|
|
12428
12655
|
}, [onChange]);
|
|
12429
12656
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
12430
12657
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
|
12431
|
-
(0,
|
|
12658
|
+
(0, import_react86.useEffect)(() => {
|
|
12432
12659
|
const { resolveAndCommitData } = appStore.getState();
|
|
12433
12660
|
resolveAndCommitData();
|
|
12434
12661
|
}, []);
|
|
12435
|
-
return /* @__PURE__ */ (0,
|
|
12662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
|
12436
12663
|
}
|
|
12437
12664
|
function PuckLayout({ children }) {
|
|
12438
12665
|
const {
|
|
@@ -12440,7 +12667,7 @@ function PuckLayout({ children }) {
|
|
|
12440
12667
|
dnd,
|
|
12441
12668
|
initialHistory: _initialHistory
|
|
12442
12669
|
} = usePropsContext();
|
|
12443
|
-
const iframe = (0,
|
|
12670
|
+
const iframe = (0, import_react86.useMemo)(
|
|
12444
12671
|
() => __spreadValues({
|
|
12445
12672
|
enabled: true,
|
|
12446
12673
|
waitForStyles: true
|
|
@@ -12465,7 +12692,7 @@ function PuckLayout({ children }) {
|
|
|
12465
12692
|
sidebarRef: rightSidebarRef,
|
|
12466
12693
|
handleResizeEnd: handleRightSidebarResizeEnd
|
|
12467
12694
|
} = useSidebarResize("right", dispatch);
|
|
12468
|
-
(0,
|
|
12695
|
+
(0, import_react86.useEffect)(() => {
|
|
12469
12696
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
12470
12697
|
dispatch({
|
|
12471
12698
|
type: "setUi",
|
|
@@ -12489,18 +12716,18 @@ function PuckLayout({ children }) {
|
|
|
12489
12716
|
};
|
|
12490
12717
|
}, []);
|
|
12491
12718
|
const overrides = useAppStore((s) => s.overrides);
|
|
12492
|
-
const CustomPuck = (0,
|
|
12719
|
+
const CustomPuck = (0, import_react86.useMemo)(
|
|
12493
12720
|
() => overrides.puck || DefaultOverride,
|
|
12494
12721
|
[overrides]
|
|
12495
12722
|
);
|
|
12496
|
-
const [mounted, setMounted] = (0,
|
|
12497
|
-
(0,
|
|
12723
|
+
const [mounted, setMounted] = (0, import_react86.useState)(false);
|
|
12724
|
+
(0, import_react86.useEffect)(() => {
|
|
12498
12725
|
setMounted(true);
|
|
12499
12726
|
}, []);
|
|
12500
12727
|
const ready = useAppStore((s) => s.status === "READY");
|
|
12501
12728
|
useMonitorHotkeys();
|
|
12502
12729
|
useDeleteHotkeys();
|
|
12503
|
-
(0,
|
|
12730
|
+
(0, import_react86.useEffect)(() => {
|
|
12504
12731
|
if (ready && iframe.enabled) {
|
|
12505
12732
|
const frameDoc = getFrame();
|
|
12506
12733
|
if (frameDoc) {
|
|
@@ -12516,8 +12743,8 @@ function PuckLayout({ children }) {
|
|
|
12516
12743
|
if (rightWidth) {
|
|
12517
12744
|
layoutOptions["--puck-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
12518
12745
|
}
|
|
12519
|
-
return /* @__PURE__ */ (0,
|
|
12520
|
-
/* @__PURE__ */ (0,
|
|
12746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `Puck ${getClassName37()}`, children: [
|
|
12747
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
12521
12748
|
"div",
|
|
12522
12749
|
{
|
|
12523
12750
|
className: getLayoutClassName({
|
|
@@ -12525,14 +12752,14 @@ function PuckLayout({ children }) {
|
|
|
12525
12752
|
mounted,
|
|
12526
12753
|
rightSideBarVisible
|
|
12527
12754
|
}),
|
|
12528
|
-
children: /* @__PURE__ */ (0,
|
|
12755
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
12529
12756
|
"div",
|
|
12530
12757
|
{
|
|
12531
12758
|
className: getLayoutClassName("inner"),
|
|
12532
12759
|
style: layoutOptions,
|
|
12533
12760
|
children: [
|
|
12534
|
-
/* @__PURE__ */ (0,
|
|
12535
|
-
/* @__PURE__ */ (0,
|
|
12761
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Header, {}),
|
|
12762
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
12536
12763
|
Sidebar,
|
|
12537
12764
|
{
|
|
12538
12765
|
position: "left",
|
|
@@ -12541,13 +12768,13 @@ function PuckLayout({ children }) {
|
|
|
12541
12768
|
onResize: setLeftWidth,
|
|
12542
12769
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
12543
12770
|
children: [
|
|
12544
|
-
/* @__PURE__ */ (0,
|
|
12545
|
-
/* @__PURE__ */ (0,
|
|
12771
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Components, {}) }),
|
|
12772
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Outline, {}) })
|
|
12546
12773
|
]
|
|
12547
12774
|
}
|
|
12548
12775
|
),
|
|
12549
|
-
/* @__PURE__ */ (0,
|
|
12550
|
-
/* @__PURE__ */ (0,
|
|
12776
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Canvas, {}),
|
|
12777
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
12551
12778
|
Sidebar,
|
|
12552
12779
|
{
|
|
12553
12780
|
position: "right",
|
|
@@ -12555,7 +12782,7 @@ function PuckLayout({ children }) {
|
|
|
12555
12782
|
isVisible: rightSideBarVisible,
|
|
12556
12783
|
onResize: setRightWidth,
|
|
12557
12784
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
12558
|
-
children: /* @__PURE__ */ (0,
|
|
12785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(FieldSideBar, {})
|
|
12559
12786
|
}
|
|
12560
12787
|
)
|
|
12561
12788
|
]
|
|
@@ -12563,11 +12790,11 @@ function PuckLayout({ children }) {
|
|
|
12563
12790
|
)
|
|
12564
12791
|
}
|
|
12565
12792
|
) }) }) }),
|
|
12566
|
-
/* @__PURE__ */ (0,
|
|
12793
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { id: "puck-portal-root", className: getClassName37("portal") })
|
|
12567
12794
|
] });
|
|
12568
12795
|
}
|
|
12569
12796
|
function Puck(props) {
|
|
12570
|
-
return /* @__PURE__ */ (0,
|
|
12797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(PuckLayout, __spreadValues({}, props)) })) }));
|
|
12571
12798
|
}
|
|
12572
12799
|
Puck.Components = Components;
|
|
12573
12800
|
Puck.Fields = Fields;
|