@measured/puck 0.14.0-canary.5bb1708 → 0.14.0-canary.68f97ae
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-487c2755.d.ts → Config-Bgx_Bij_.d.ts} +19 -2
- package/dist/index.css +404 -332
- package/dist/index.d.ts +13 -6
- package/dist/index.js +1569 -727
- package/dist/rsc.d.ts +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
@@ -93,7 +93,8 @@ var init_react_import = __esm({
|
|
93
93
|
|
94
94
|
// ../../node_modules/classnames/index.js
|
95
95
|
var require_classnames = __commonJS({
|
96
|
-
"../../node_modules/classnames/index.js"(
|
96
|
+
"../../node_modules/classnames/index.js"(exports2, module2) {
|
97
|
+
"use strict";
|
97
98
|
init_react_import();
|
98
99
|
(function() {
|
99
100
|
"use strict";
|
@@ -145,7 +146,7 @@ var require_classnames = __commonJS({
|
|
145
146
|
|
146
147
|
// ../../node_modules/scheduler/cjs/scheduler.production.min.js
|
147
148
|
var require_scheduler_production_min = __commonJS({
|
148
|
-
"../../node_modules/scheduler/cjs/scheduler.production.min.js"(
|
149
|
+
"../../node_modules/scheduler/cjs/scheduler.production.min.js"(exports2) {
|
149
150
|
"use strict";
|
150
151
|
init_react_import();
|
151
152
|
function f(a, b) {
|
@@ -188,12 +189,12 @@ var require_scheduler_production_min = __commonJS({
|
|
188
189
|
}
|
189
190
|
if ("object" === typeof performance && "function" === typeof performance.now) {
|
190
191
|
l = performance;
|
191
|
-
|
192
|
+
exports2.unstable_now = function() {
|
192
193
|
return l.now();
|
193
194
|
};
|
194
195
|
} else {
|
195
196
|
p = Date, q = p.now();
|
196
|
-
|
197
|
+
exports2.unstable_now = function() {
|
197
198
|
return p.now() - q;
|
198
199
|
};
|
199
200
|
}
|
@@ -247,7 +248,7 @@ var require_scheduler_production_min = __commonJS({
|
|
247
248
|
v.callback = null;
|
248
249
|
y = v.priorityLevel;
|
249
250
|
var e = d(v.expirationTime <= b);
|
250
|
-
b =
|
251
|
+
b = exports2.unstable_now();
|
251
252
|
"function" === typeof e ? v.callback = e : v === h(r) && k(r);
|
252
253
|
G(b);
|
253
254
|
} else
|
@@ -272,11 +273,11 @@ var require_scheduler_production_min = __commonJS({
|
|
272
273
|
var P = 5;
|
273
274
|
var Q = -1;
|
274
275
|
function M() {
|
275
|
-
return
|
276
|
+
return exports2.unstable_now() - Q < P ? false : true;
|
276
277
|
}
|
277
278
|
function R() {
|
278
279
|
if (null !== O) {
|
279
|
-
var a =
|
280
|
+
var a = exports2.unstable_now();
|
280
281
|
Q = a;
|
281
282
|
var b = true;
|
282
283
|
try {
|
@@ -310,31 +311,31 @@ var require_scheduler_production_min = __commonJS({
|
|
310
311
|
}
|
311
312
|
function K(a, b) {
|
312
313
|
L = D(function() {
|
313
|
-
a(
|
314
|
+
a(exports2.unstable_now());
|
314
315
|
}, b);
|
315
316
|
}
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
317
|
+
exports2.unstable_IdlePriority = 5;
|
318
|
+
exports2.unstable_ImmediatePriority = 1;
|
319
|
+
exports2.unstable_LowPriority = 4;
|
320
|
+
exports2.unstable_NormalPriority = 3;
|
321
|
+
exports2.unstable_Profiling = null;
|
322
|
+
exports2.unstable_UserBlockingPriority = 2;
|
323
|
+
exports2.unstable_cancelCallback = function(a) {
|
323
324
|
a.callback = null;
|
324
325
|
};
|
325
|
-
|
326
|
+
exports2.unstable_continueExecution = function() {
|
326
327
|
A || z || (A = true, I(J));
|
327
328
|
};
|
328
|
-
|
329
|
+
exports2.unstable_forceFrameRate = function(a) {
|
329
330
|
0 > a || 125 < a ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : P = 0 < a ? Math.floor(1e3 / a) : 5;
|
330
331
|
};
|
331
|
-
|
332
|
+
exports2.unstable_getCurrentPriorityLevel = function() {
|
332
333
|
return y;
|
333
334
|
};
|
334
|
-
|
335
|
+
exports2.unstable_getFirstCallbackNode = function() {
|
335
336
|
return h(r);
|
336
337
|
};
|
337
|
-
|
338
|
+
exports2.unstable_next = function(a) {
|
338
339
|
switch (y) {
|
339
340
|
case 1:
|
340
341
|
case 2:
|
@@ -352,11 +353,11 @@ var require_scheduler_production_min = __commonJS({
|
|
352
353
|
y = c;
|
353
354
|
}
|
354
355
|
};
|
355
|
-
|
356
|
+
exports2.unstable_pauseExecution = function() {
|
356
357
|
};
|
357
|
-
|
358
|
+
exports2.unstable_requestPaint = function() {
|
358
359
|
};
|
359
|
-
|
360
|
+
exports2.unstable_runWithPriority = function(a, b) {
|
360
361
|
switch (a) {
|
361
362
|
case 1:
|
362
363
|
case 2:
|
@@ -375,8 +376,8 @@ var require_scheduler_production_min = __commonJS({
|
|
375
376
|
y = c;
|
376
377
|
}
|
377
378
|
};
|
378
|
-
|
379
|
-
var d =
|
379
|
+
exports2.unstable_scheduleCallback = function(a, b, c) {
|
380
|
+
var d = exports2.unstable_now();
|
380
381
|
"object" === typeof c && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
|
381
382
|
switch (a) {
|
382
383
|
case 1:
|
@@ -399,8 +400,8 @@ var require_scheduler_production_min = __commonJS({
|
|
399
400
|
c > d ? (a.sortIndex = c, f(t, a), null === h(r) && a === h(t) && (B ? (E(L), L = -1) : B = true, K(H, c - d))) : (a.sortIndex = e, f(r, a), A || z || (A = true, I(J)));
|
400
401
|
return a;
|
401
402
|
};
|
402
|
-
|
403
|
-
|
403
|
+
exports2.unstable_shouldYield = M;
|
404
|
+
exports2.unstable_wrapCallback = function(a) {
|
404
405
|
var b = y;
|
405
406
|
return function() {
|
406
407
|
var c = y;
|
@@ -417,7 +418,7 @@ var require_scheduler_production_min = __commonJS({
|
|
417
418
|
|
418
419
|
// ../../node_modules/scheduler/cjs/scheduler.development.js
|
419
420
|
var require_scheduler_development = __commonJS({
|
420
|
-
"../../node_modules/scheduler/cjs/scheduler.development.js"(
|
421
|
+
"../../node_modules/scheduler/cjs/scheduler.development.js"(exports2) {
|
421
422
|
"use strict";
|
422
423
|
init_react_import();
|
423
424
|
if (process.env.NODE_ENV !== "production") {
|
@@ -505,13 +506,13 @@ var require_scheduler_development = __commonJS({
|
|
505
506
|
var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function";
|
506
507
|
if (hasPerformanceNow) {
|
507
508
|
var localPerformance = performance;
|
508
|
-
|
509
|
+
exports2.unstable_now = function() {
|
509
510
|
return localPerformance.now();
|
510
511
|
};
|
511
512
|
} else {
|
512
513
|
var localDate = Date;
|
513
514
|
var initialTime = localDate.now();
|
514
|
-
|
515
|
+
exports2.unstable_now = function() {
|
515
516
|
return localDate.now() - initialTime;
|
516
517
|
};
|
517
518
|
}
|
@@ -577,7 +578,7 @@ var require_scheduler_development = __commonJS({
|
|
577
578
|
return workLoop(hasTimeRemaining, initialTime2);
|
578
579
|
} catch (error) {
|
579
580
|
if (currentTask !== null) {
|
580
|
-
var currentTime =
|
581
|
+
var currentTime = exports2.unstable_now();
|
581
582
|
markTaskErrored(currentTask, currentTime);
|
582
583
|
currentTask.isQueued = false;
|
583
584
|
}
|
@@ -606,7 +607,7 @@ var require_scheduler_development = __commonJS({
|
|
606
607
|
currentPriorityLevel = currentTask.priorityLevel;
|
607
608
|
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
608
609
|
var continuationCallback = callback(didUserCallbackTimeout);
|
609
|
-
currentTime =
|
610
|
+
currentTime = exports2.unstable_now();
|
610
611
|
if (typeof continuationCallback === "function") {
|
611
612
|
currentTask.callback = continuationCallback;
|
612
613
|
} else {
|
@@ -682,7 +683,7 @@ var require_scheduler_development = __commonJS({
|
|
682
683
|
};
|
683
684
|
}
|
684
685
|
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
685
|
-
var currentTime =
|
686
|
+
var currentTime = exports2.unstable_now();
|
686
687
|
var startTime2;
|
687
688
|
if (typeof options === "object" && options !== null) {
|
688
689
|
var delay = options.delay;
|
@@ -766,7 +767,7 @@ var require_scheduler_development = __commonJS({
|
|
766
767
|
var frameInterval = frameYieldMs;
|
767
768
|
var startTime = -1;
|
768
769
|
function shouldYieldToHost() {
|
769
|
-
var timeElapsed =
|
770
|
+
var timeElapsed = exports2.unstable_now() - startTime;
|
770
771
|
if (timeElapsed < frameInterval) {
|
771
772
|
return false;
|
772
773
|
}
|
@@ -787,7 +788,7 @@ var require_scheduler_development = __commonJS({
|
|
787
788
|
}
|
788
789
|
var performWorkUntilDeadline = function() {
|
789
790
|
if (scheduledHostCallback !== null) {
|
790
|
-
var currentTime =
|
791
|
+
var currentTime = exports2.unstable_now();
|
791
792
|
startTime = currentTime;
|
792
793
|
var hasTimeRemaining = true;
|
793
794
|
var hasMoreWork = true;
|
@@ -831,7 +832,7 @@ var require_scheduler_development = __commonJS({
|
|
831
832
|
}
|
832
833
|
function requestHostTimeout(callback, ms) {
|
833
834
|
taskTimeoutID = localSetTimeout(function() {
|
834
|
-
callback(
|
835
|
+
callback(exports2.unstable_now());
|
835
836
|
}, ms);
|
836
837
|
}
|
837
838
|
function cancelHostTimeout() {
|
@@ -840,24 +841,24 @@ var require_scheduler_development = __commonJS({
|
|
840
841
|
}
|
841
842
|
var unstable_requestPaint = requestPaint;
|
842
843
|
var unstable_Profiling = null;
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
844
|
+
exports2.unstable_IdlePriority = IdlePriority;
|
845
|
+
exports2.unstable_ImmediatePriority = ImmediatePriority;
|
846
|
+
exports2.unstable_LowPriority = LowPriority;
|
847
|
+
exports2.unstable_NormalPriority = NormalPriority;
|
848
|
+
exports2.unstable_Profiling = unstable_Profiling;
|
849
|
+
exports2.unstable_UserBlockingPriority = UserBlockingPriority;
|
850
|
+
exports2.unstable_cancelCallback = unstable_cancelCallback;
|
851
|
+
exports2.unstable_continueExecution = unstable_continueExecution;
|
852
|
+
exports2.unstable_forceFrameRate = forceFrameRate;
|
853
|
+
exports2.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
854
|
+
exports2.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
855
|
+
exports2.unstable_next = unstable_next;
|
856
|
+
exports2.unstable_pauseExecution = unstable_pauseExecution;
|
857
|
+
exports2.unstable_requestPaint = unstable_requestPaint;
|
858
|
+
exports2.unstable_runWithPriority = unstable_runWithPriority;
|
859
|
+
exports2.unstable_scheduleCallback = unstable_scheduleCallback;
|
860
|
+
exports2.unstable_shouldYield = shouldYieldToHost;
|
861
|
+
exports2.unstable_wrapCallback = unstable_wrapCallback;
|
861
862
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
862
863
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
863
864
|
}
|
@@ -868,7 +869,7 @@ var require_scheduler_development = __commonJS({
|
|
868
869
|
|
869
870
|
// ../../node_modules/scheduler/index.js
|
870
871
|
var require_scheduler = __commonJS({
|
871
|
-
"../../node_modules/scheduler/index.js"(
|
872
|
+
"../../node_modules/scheduler/index.js"(exports2, module2) {
|
872
873
|
"use strict";
|
873
874
|
init_react_import();
|
874
875
|
if (process.env.NODE_ENV === "production") {
|
@@ -881,7 +882,7 @@ var require_scheduler = __commonJS({
|
|
881
882
|
|
882
883
|
// ../../node_modules/react-dom/cjs/react-dom.production.min.js
|
883
884
|
var require_react_dom_production_min = __commonJS({
|
884
|
-
"../../node_modules/react-dom/cjs/react-dom.production.min.js"(
|
885
|
+
"../../node_modules/react-dom/cjs/react-dom.production.min.js"(exports2) {
|
885
886
|
"use strict";
|
886
887
|
init_react_import();
|
887
888
|
var aa = require("react");
|
@@ -7938,14 +7939,14 @@ var require_react_dom_production_min = __commonJS({
|
|
7938
7939
|
}
|
7939
7940
|
}
|
7940
7941
|
var wl;
|
7941
|
-
|
7942
|
-
|
7942
|
+
exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = tl;
|
7943
|
+
exports2.createPortal = function(a, b) {
|
7943
7944
|
var c = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
|
7944
7945
|
if (!ol(b))
|
7945
7946
|
throw Error(p(200));
|
7946
7947
|
return dl(a, b, null, c);
|
7947
7948
|
};
|
7948
|
-
|
7949
|
+
exports2.createRoot = function(a, b) {
|
7949
7950
|
if (!ol(a))
|
7950
7951
|
throw Error(p(299));
|
7951
7952
|
var c = false, d = "", e = ll;
|
@@ -7955,7 +7956,7 @@ var require_react_dom_production_min = __commonJS({
|
|
7955
7956
|
sf(8 === a.nodeType ? a.parentNode : a);
|
7956
7957
|
return new ml(b);
|
7957
7958
|
};
|
7958
|
-
|
7959
|
+
exports2.findDOMNode = function(a) {
|
7959
7960
|
if (null == a)
|
7960
7961
|
return null;
|
7961
7962
|
if (1 === a.nodeType)
|
@@ -7971,15 +7972,15 @@ var require_react_dom_production_min = __commonJS({
|
|
7971
7972
|
a = null === a ? null : a.stateNode;
|
7972
7973
|
return a;
|
7973
7974
|
};
|
7974
|
-
|
7975
|
+
exports2.flushSync = function(a) {
|
7975
7976
|
return Sk(a);
|
7976
7977
|
};
|
7977
|
-
|
7978
|
+
exports2.hydrate = function(a, b, c) {
|
7978
7979
|
if (!pl(b))
|
7979
7980
|
throw Error(p(200));
|
7980
7981
|
return sl(null, a, b, true, c);
|
7981
7982
|
};
|
7982
|
-
|
7983
|
+
exports2.hydrateRoot = function(a, b, c) {
|
7983
7984
|
if (!ol(a))
|
7984
7985
|
throw Error(p(405));
|
7985
7986
|
var d = null != c && c.hydratedSources || null, e = false, f = "", g = ll;
|
@@ -7995,12 +7996,12 @@ var require_react_dom_production_min = __commonJS({
|
|
7995
7996
|
);
|
7996
7997
|
return new nl(b);
|
7997
7998
|
};
|
7998
|
-
|
7999
|
+
exports2.render = function(a, b, c) {
|
7999
8000
|
if (!pl(b))
|
8000
8001
|
throw Error(p(200));
|
8001
8002
|
return sl(null, a, b, false, c);
|
8002
8003
|
};
|
8003
|
-
|
8004
|
+
exports2.unmountComponentAtNode = function(a) {
|
8004
8005
|
if (!pl(a))
|
8005
8006
|
throw Error(p(40));
|
8006
8007
|
return a._reactRootContainer ? (Sk(function() {
|
@@ -8010,21 +8011,21 @@ var require_react_dom_production_min = __commonJS({
|
|
8010
8011
|
});
|
8011
8012
|
}), true) : false;
|
8012
8013
|
};
|
8013
|
-
|
8014
|
-
|
8014
|
+
exports2.unstable_batchedUpdates = Rk;
|
8015
|
+
exports2.unstable_renderSubtreeIntoContainer = function(a, b, c, d) {
|
8015
8016
|
if (!pl(c))
|
8016
8017
|
throw Error(p(200));
|
8017
8018
|
if (null == a || void 0 === a._reactInternals)
|
8018
8019
|
throw Error(p(38));
|
8019
8020
|
return sl(a, b, c, false, d);
|
8020
8021
|
};
|
8021
|
-
|
8022
|
+
exports2.version = "18.2.0-next-9e3b772b8-20220608";
|
8022
8023
|
}
|
8023
8024
|
});
|
8024
8025
|
|
8025
8026
|
// ../../node_modules/react-dom/cjs/react-dom.development.js
|
8026
8027
|
var require_react_dom_development = __commonJS({
|
8027
|
-
"../../node_modules/react-dom/cjs/react-dom.development.js"(
|
8028
|
+
"../../node_modules/react-dom/cjs/react-dom.development.js"(exports2) {
|
8028
8029
|
"use strict";
|
8029
8030
|
init_react_import();
|
8030
8031
|
if (process.env.NODE_ENV !== "production") {
|
@@ -8084,7 +8085,7 @@ var require_react_dom_development = __commonJS({
|
|
8084
8085
|
var HostPortal = 4;
|
8085
8086
|
var HostComponent = 5;
|
8086
8087
|
var HostText = 6;
|
8087
|
-
var
|
8088
|
+
var Fragment16 = 7;
|
8088
8089
|
var Mode = 8;
|
8089
8090
|
var ContextConsumer = 9;
|
8090
8091
|
var ContextProvider = 10;
|
@@ -8264,8 +8265,8 @@ var require_react_dom_development = __commonJS({
|
|
8264
8265
|
if (propertyInfo !== null) {
|
8265
8266
|
return !propertyInfo.acceptsBooleans;
|
8266
8267
|
} else {
|
8267
|
-
var
|
8268
|
-
return
|
8268
|
+
var prefix3 = name.toLowerCase().slice(0, 5);
|
8269
|
+
return prefix3 !== "data-" && prefix3 !== "aria-";
|
8269
8270
|
}
|
8270
8271
|
}
|
8271
8272
|
default:
|
@@ -8937,18 +8938,18 @@ var require_react_dom_development = __commonJS({
|
|
8937
8938
|
}
|
8938
8939
|
}
|
8939
8940
|
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
8940
|
-
var
|
8941
|
+
var prefix2;
|
8941
8942
|
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
8942
8943
|
{
|
8943
|
-
if (
|
8944
|
+
if (prefix2 === void 0) {
|
8944
8945
|
try {
|
8945
8946
|
throw Error();
|
8946
8947
|
} catch (x) {
|
8947
8948
|
var match = x.stack.trim().match(/\n( *(at )?)/);
|
8948
|
-
|
8949
|
+
prefix2 = match && match[1] || "";
|
8949
8950
|
}
|
8950
8951
|
}
|
8951
|
-
return "\n" +
|
8952
|
+
return "\n" + prefix2 + name;
|
8952
8953
|
}
|
8953
8954
|
}
|
8954
8955
|
var reentry = false;
|
@@ -9240,7 +9241,7 @@ var require_react_dom_development = __commonJS({
|
|
9240
9241
|
return "DehydratedFragment";
|
9241
9242
|
case ForwardRef:
|
9242
9243
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
9243
|
-
case
|
9244
|
+
case Fragment16:
|
9244
9245
|
return "Fragment";
|
9245
9246
|
case HostComponent:
|
9246
9247
|
return type;
|
@@ -10033,13 +10034,13 @@ var require_react_dom_development = __commonJS({
|
|
10033
10034
|
strokeOpacity: true,
|
10034
10035
|
strokeWidth: true
|
10035
10036
|
};
|
10036
|
-
function prefixKey(
|
10037
|
-
return
|
10037
|
+
function prefixKey(prefix3, key) {
|
10038
|
+
return prefix3 + key.charAt(0).toUpperCase() + key.substring(1);
|
10038
10039
|
}
|
10039
10040
|
var prefixes = ["Webkit", "ms", "Moz", "O"];
|
10040
10041
|
Object.keys(isUnitlessNumber).forEach(function(prop) {
|
10041
|
-
prefixes.forEach(function(
|
10042
|
-
isUnitlessNumber[prefixKey(
|
10042
|
+
prefixes.forEach(function(prefix3) {
|
10043
|
+
isUnitlessNumber[prefixKey(prefix3, prop)] = isUnitlessNumber[prop];
|
10043
10044
|
});
|
10044
10045
|
});
|
10045
10046
|
function dangerousStyleValue(name, value, isCustomProperty) {
|
@@ -18911,7 +18912,7 @@ var require_react_dom_development = __commonJS({
|
|
18911
18912
|
}
|
18912
18913
|
}
|
18913
18914
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
18914
|
-
if (current2 === null || current2.tag !==
|
18915
|
+
if (current2 === null || current2.tag !== Fragment16) {
|
18915
18916
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
18916
18917
|
created.return = returnFiber;
|
18917
18918
|
return created;
|
@@ -19314,7 +19315,7 @@ var require_react_dom_development = __commonJS({
|
|
19314
19315
|
if (child.key === key) {
|
19315
19316
|
var elementType = element.type;
|
19316
19317
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
19317
|
-
if (child.tag ===
|
19318
|
+
if (child.tag === Fragment16) {
|
19318
19319
|
deleteRemainingChildren(returnFiber, child.sibling);
|
19319
19320
|
var existing = useFiber(child, element.props.children);
|
19320
19321
|
existing.return = returnFiber;
|
@@ -23489,7 +23490,7 @@ var require_react_dom_development = __commonJS({
|
|
23489
23490
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
23490
23491
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
23491
23492
|
}
|
23492
|
-
case
|
23493
|
+
case Fragment16:
|
23493
23494
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
23494
23495
|
case Mode:
|
23495
23496
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -23762,7 +23763,7 @@ var require_react_dom_development = __commonJS({
|
|
23762
23763
|
case SimpleMemoComponent:
|
23763
23764
|
case FunctionComponent:
|
23764
23765
|
case ForwardRef:
|
23765
|
-
case
|
23766
|
+
case Fragment16:
|
23766
23767
|
case Mode:
|
23767
23768
|
case Profiler:
|
23768
23769
|
case ContextConsumer:
|
@@ -28021,7 +28022,7 @@ var require_react_dom_development = __commonJS({
|
|
28021
28022
|
return fiber;
|
28022
28023
|
}
|
28023
28024
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
28024
|
-
var fiber = createFiber(
|
28025
|
+
var fiber = createFiber(Fragment16, elements, key, mode);
|
28025
28026
|
fiber.lanes = lanes;
|
28026
28027
|
return fiber;
|
28027
28028
|
}
|
@@ -29094,18 +29095,18 @@ var require_react_dom_development = __commonJS({
|
|
29094
29095
|
}
|
29095
29096
|
}
|
29096
29097
|
}
|
29097
|
-
|
29098
|
-
|
29099
|
-
|
29100
|
-
|
29101
|
-
|
29102
|
-
|
29103
|
-
|
29104
|
-
|
29105
|
-
|
29106
|
-
|
29107
|
-
|
29108
|
-
|
29098
|
+
exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
|
29099
|
+
exports2.createPortal = createPortal$1;
|
29100
|
+
exports2.createRoot = createRoot$1;
|
29101
|
+
exports2.findDOMNode = findDOMNode;
|
29102
|
+
exports2.flushSync = flushSync$1;
|
29103
|
+
exports2.hydrate = hydrate;
|
29104
|
+
exports2.hydrateRoot = hydrateRoot$1;
|
29105
|
+
exports2.render = render;
|
29106
|
+
exports2.unmountComponentAtNode = unmountComponentAtNode;
|
29107
|
+
exports2.unstable_batchedUpdates = batchedUpdates$1;
|
29108
|
+
exports2.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
|
29109
|
+
exports2.version = ReactVersion;
|
29109
29110
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
29110
29111
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
29111
29112
|
}
|
@@ -29116,7 +29117,7 @@ var require_react_dom_development = __commonJS({
|
|
29116
29117
|
|
29117
29118
|
// ../../node_modules/react-dom/index.js
|
29118
29119
|
var require_react_dom = __commonJS({
|
29119
|
-
"../../node_modules/react-dom/index.js"(
|
29120
|
+
"../../node_modules/react-dom/index.js"(exports2, module2) {
|
29120
29121
|
"use strict";
|
29121
29122
|
init_react_import();
|
29122
29123
|
function checkDCE() {
|
@@ -29171,9 +29172,19 @@ init_react_import();
|
|
29171
29172
|
init_react_import();
|
29172
29173
|
var import_react2 = require("react");
|
29173
29174
|
|
29174
|
-
//
|
29175
|
-
|
29176
|
-
|
29175
|
+
// components/Button/Button.module.css
|
29176
|
+
var Button_default = {
|
29177
|
+
Button: "Button_Button",
|
29178
|
+
"Button--medium": "Button_Button--medium",
|
29179
|
+
"Button--large": "Button_Button--large",
|
29180
|
+
"Button-icon": "Button_Button-icon",
|
29181
|
+
"Button--primary": "Button_Button--primary",
|
29182
|
+
"Button--secondary": "Button_Button--secondary",
|
29183
|
+
"Button--flush": "Button_Button--flush",
|
29184
|
+
"Button--disabled": "Button_Button--disabled",
|
29185
|
+
"Button--fullWidth": "Button_Button--fullWidth",
|
29186
|
+
"Button-spinner": "Button_Button-spinner"
|
29187
|
+
};
|
29177
29188
|
|
29178
29189
|
// lib/get-class-name-factory.ts
|
29179
29190
|
init_react_import();
|
@@ -29210,7 +29221,7 @@ var get_class_name_factory_default = getClassNameFactory;
|
|
29210
29221
|
// components/Button/Button.tsx
|
29211
29222
|
var import_react_spinners = require("react-spinners");
|
29212
29223
|
var import_jsx_runtime = require("react/jsx-runtime");
|
29213
|
-
var getClassName = get_class_name_factory_default("Button",
|
29224
|
+
var getClassName = get_class_name_factory_default("Button", Button_default);
|
29214
29225
|
var Button = ({
|
29215
29226
|
children,
|
29216
29227
|
href,
|
@@ -29264,16 +29275,190 @@ var Button = ({
|
|
29264
29275
|
|
29265
29276
|
// components/Drawer/index.tsx
|
29266
29277
|
init_react_import();
|
29267
|
-
var import_dnd2 = require("@hello-pangea/dnd");
|
29268
29278
|
|
29269
|
-
//
|
29279
|
+
// components/Droppable/index.tsx
|
29270
29280
|
init_react_import();
|
29271
|
-
var
|
29281
|
+
var import_dnd = require("@measured/dnd");
|
29272
29282
|
|
29273
|
-
// components/
|
29283
|
+
// components/Puck/context.tsx
|
29284
|
+
init_react_import();
|
29285
|
+
var import_react3 = require("react");
|
29286
|
+
|
29287
|
+
// lib/get-item.ts
|
29288
|
+
init_react_import();
|
29289
|
+
|
29290
|
+
// lib/root-droppable-id.ts
|
29291
|
+
init_react_import();
|
29292
|
+
var rootDroppableId = "default-zone";
|
29293
|
+
|
29294
|
+
// lib/setup-zone.ts
|
29295
|
+
init_react_import();
|
29296
|
+
var setupZone = (data, zoneKey) => {
|
29297
|
+
if (zoneKey === rootDroppableId) {
|
29298
|
+
return data;
|
29299
|
+
}
|
29300
|
+
const newData = __spreadValues({}, data);
|
29301
|
+
newData.zones = data.zones || {};
|
29302
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
29303
|
+
return newData;
|
29304
|
+
};
|
29305
|
+
|
29306
|
+
// lib/get-item.ts
|
29307
|
+
var getItem = (selector, data, dynamicProps = {}) => {
|
29308
|
+
if (!selector.zone || selector.zone === rootDroppableId) {
|
29309
|
+
const item2 = data.content[selector.index];
|
29310
|
+
return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
|
29311
|
+
}
|
29312
|
+
const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
|
29313
|
+
return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
|
29314
|
+
};
|
29315
|
+
|
29316
|
+
// components/ViewportControls/default-viewports.ts
|
29274
29317
|
init_react_import();
|
29275
|
-
var
|
29318
|
+
var defaultViewports = [
|
29319
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
29320
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
29321
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
29322
|
+
];
|
29323
|
+
|
29324
|
+
// components/Puck/context.tsx
|
29276
29325
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
29326
|
+
var defaultAppState = {
|
29327
|
+
data: { content: [], root: { props: { title: "" } } },
|
29328
|
+
ui: {
|
29329
|
+
leftSideBarVisible: true,
|
29330
|
+
rightSideBarVisible: true,
|
29331
|
+
arrayState: {},
|
29332
|
+
itemSelector: null,
|
29333
|
+
componentList: {},
|
29334
|
+
isDragging: false,
|
29335
|
+
viewports: {
|
29336
|
+
current: {
|
29337
|
+
width: defaultViewports[0].width,
|
29338
|
+
height: defaultViewports[0].height || "auto"
|
29339
|
+
},
|
29340
|
+
options: [],
|
29341
|
+
controlsVisible: true
|
29342
|
+
}
|
29343
|
+
}
|
29344
|
+
};
|
29345
|
+
var defaultContext = {
|
29346
|
+
state: defaultAppState,
|
29347
|
+
dispatch: () => null,
|
29348
|
+
config: { components: {} },
|
29349
|
+
componentState: {},
|
29350
|
+
resolveData: () => {
|
29351
|
+
},
|
29352
|
+
plugins: [],
|
29353
|
+
overrides: {},
|
29354
|
+
history: {},
|
29355
|
+
viewports: defaultViewports,
|
29356
|
+
zoomConfig: {
|
29357
|
+
autoZoom: 1,
|
29358
|
+
rootHeight: 0,
|
29359
|
+
zoom: 1
|
29360
|
+
},
|
29361
|
+
setZoomConfig: () => null,
|
29362
|
+
status: "LOADING",
|
29363
|
+
setStatus: () => null,
|
29364
|
+
iframe: {}
|
29365
|
+
};
|
29366
|
+
var appContext = (0, import_react3.createContext)(defaultContext);
|
29367
|
+
var AppProvider = ({
|
29368
|
+
children,
|
29369
|
+
value
|
29370
|
+
}) => {
|
29371
|
+
const [zoomConfig, setZoomConfig] = (0, import_react3.useState)(defaultContext.zoomConfig);
|
29372
|
+
const [status, setStatus] = (0, import_react3.useState)("LOADING");
|
29373
|
+
(0, import_react3.useEffect)(() => {
|
29374
|
+
setStatus("MOUNTED");
|
29375
|
+
}, []);
|
29376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
29377
|
+
appContext.Provider,
|
29378
|
+
{
|
29379
|
+
value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig, status, setStatus }),
|
29380
|
+
children
|
29381
|
+
}
|
29382
|
+
);
|
29383
|
+
};
|
29384
|
+
function useAppContext() {
|
29385
|
+
const mainContext = (0, import_react3.useContext)(appContext);
|
29386
|
+
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
29387
|
+
return __spreadProps(__spreadValues({}, mainContext), {
|
29388
|
+
// Helpers
|
29389
|
+
selectedItem,
|
29390
|
+
setUi: (ui, recordHistory) => {
|
29391
|
+
return mainContext.dispatch({
|
29392
|
+
type: "setUi",
|
29393
|
+
ui,
|
29394
|
+
recordHistory
|
29395
|
+
});
|
29396
|
+
}
|
29397
|
+
});
|
29398
|
+
}
|
29399
|
+
|
29400
|
+
// components/Droppable/index.tsx
|
29401
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
29402
|
+
var defaultProvided = {
|
29403
|
+
droppableProps: {
|
29404
|
+
"data-rfd-droppable-context-id": "",
|
29405
|
+
"data-rfd-droppable-id": ""
|
29406
|
+
},
|
29407
|
+
placeholder: null,
|
29408
|
+
innerRef: () => null
|
29409
|
+
};
|
29410
|
+
var defaultSnapshot = {
|
29411
|
+
isDraggingOver: false,
|
29412
|
+
draggingOverWith: null,
|
29413
|
+
draggingFromThisWith: null,
|
29414
|
+
isUsingPlaceholder: false
|
29415
|
+
};
|
29416
|
+
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: children(defaultProvided, defaultSnapshot) });
|
29417
|
+
var Droppable = (props) => {
|
29418
|
+
const { status } = useAppContext();
|
29419
|
+
const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
|
29420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(El, __spreadValues({}, props));
|
29421
|
+
};
|
29422
|
+
|
29423
|
+
// components/Drawer/styles.module.css
|
29424
|
+
var styles_default = {
|
29425
|
+
Drawer: "styles_Drawer",
|
29426
|
+
"DrawerItem-default": "styles_DrawerItem-default",
|
29427
|
+
"DrawerItem-draggableWrapper": "styles_DrawerItem-draggableWrapper",
|
29428
|
+
DrawerItem: "styles_DrawerItem",
|
29429
|
+
"DrawerItem-draggable": "styles_DrawerItem-draggable",
|
29430
|
+
"Drawer--isDraggingFrom": "styles_Drawer--isDraggingFrom",
|
29431
|
+
"DrawerItem-name": "styles_DrawerItem-name"
|
29432
|
+
};
|
29433
|
+
|
29434
|
+
// components/Draggable/index.tsx
|
29435
|
+
init_react_import();
|
29436
|
+
var import_dnd2 = require("@measured/dnd");
|
29437
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
29438
|
+
var defaultProvided2 = {
|
29439
|
+
draggableProps: {
|
29440
|
+
"data-rfd-draggable-context-id": "",
|
29441
|
+
"data-rfd-draggable-id": ""
|
29442
|
+
},
|
29443
|
+
dragHandleProps: null,
|
29444
|
+
innerRef: () => null
|
29445
|
+
};
|
29446
|
+
var defaultSnapshot2 = {
|
29447
|
+
isDragging: false,
|
29448
|
+
isDropAnimating: false,
|
29449
|
+
isClone: false,
|
29450
|
+
dropAnimation: null,
|
29451
|
+
draggingOver: null,
|
29452
|
+
combineWith: null,
|
29453
|
+
combineTargetFor: null,
|
29454
|
+
mode: null
|
29455
|
+
};
|
29456
|
+
var defaultRubric = {
|
29457
|
+
draggableId: "",
|
29458
|
+
type: "",
|
29459
|
+
source: { droppableId: "", index: 0 }
|
29460
|
+
};
|
29461
|
+
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
|
29277
29462
|
var Draggable = ({
|
29278
29463
|
className,
|
29279
29464
|
children,
|
@@ -29283,39 +29468,33 @@ var Draggable = ({
|
|
29283
29468
|
disableAnimations = false,
|
29284
29469
|
isDragDisabled = false
|
29285
29470
|
}) => {
|
29286
|
-
|
29287
|
-
|
29288
|
-
|
29289
|
-
|
29290
|
-
|
29291
|
-
|
29292
|
-
|
29293
|
-
|
29294
|
-
|
29295
|
-
|
29296
|
-
|
29297
|
-
|
29298
|
-
|
29299
|
-
|
29300
|
-
|
29301
|
-
|
29302
|
-
|
29303
|
-
|
29304
|
-
|
29305
|
-
|
29306
|
-
),
|
29307
|
-
|
29308
|
-
|
29309
|
-
|
29310
|
-
|
29311
|
-
|
29312
|
-
|
29313
|
-
}
|
29314
|
-
)
|
29315
|
-
] });
|
29316
|
-
}
|
29317
|
-
}
|
29318
|
-
);
|
29471
|
+
const { status } = useAppContext();
|
29472
|
+
const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
|
29473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
|
29474
|
+
var _a;
|
29475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
29476
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
29477
|
+
"div",
|
29478
|
+
__spreadProps(__spreadValues(__spreadValues({
|
29479
|
+
className: className && className(provided, snapshot),
|
29480
|
+
ref: provided.innerRef
|
29481
|
+
}, provided.draggableProps), provided.dragHandleProps), {
|
29482
|
+
style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
|
29483
|
+
transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
|
29484
|
+
}),
|
29485
|
+
children: children(provided, snapshot)
|
29486
|
+
})
|
29487
|
+
),
|
29488
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
29489
|
+
"div",
|
29490
|
+
{
|
29491
|
+
className: className && className(provided, snapshot),
|
29492
|
+
style: { transform: "none !important" },
|
29493
|
+
children: children(provided, snapshot)
|
29494
|
+
}
|
29495
|
+
)
|
29496
|
+
] });
|
29497
|
+
} });
|
29319
29498
|
};
|
29320
29499
|
|
29321
29500
|
// components/DragIcon/index.tsx
|
@@ -29345,28 +29524,29 @@ var replace = (list, index, newItem) => {
|
|
29345
29524
|
return result;
|
29346
29525
|
};
|
29347
29526
|
|
29348
|
-
//
|
29349
|
-
|
29350
|
-
|
29527
|
+
// components/DragIcon/styles.module.css
|
29528
|
+
var styles_default2 = {
|
29529
|
+
DragIcon: "styles_DragIcon"
|
29530
|
+
};
|
29351
29531
|
|
29352
29532
|
// components/DragIcon/index.tsx
|
29353
|
-
var
|
29354
|
-
var getClassName2 = get_class_name_factory_default("DragIcon",
|
29355
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
29533
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
29534
|
+
var getClassName2 = get_class_name_factory_default("DragIcon", styles_default2);
|
29535
|
+
var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
|
29356
29536
|
|
29357
29537
|
// components/Drawer/index.tsx
|
29358
|
-
var
|
29359
|
-
var
|
29360
|
-
var getClassName3 = get_class_name_factory_default("Drawer",
|
29361
|
-
var getClassNameItem = get_class_name_factory_default("DrawerItem",
|
29362
|
-
var drawerContext = (0,
|
29538
|
+
var import_react4 = require("react");
|
29539
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
29540
|
+
var getClassName3 = get_class_name_factory_default("Drawer", styles_default);
|
29541
|
+
var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_default);
|
29542
|
+
var drawerContext = (0, import_react4.createContext)({
|
29363
29543
|
droppableId: ""
|
29364
29544
|
});
|
29365
29545
|
var DrawerDraggable = ({
|
29366
29546
|
children,
|
29367
29547
|
id,
|
29368
29548
|
index
|
29369
|
-
}) => /* @__PURE__ */ (0,
|
29549
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
29370
29550
|
Draggable,
|
29371
29551
|
{
|
29372
29552
|
id,
|
@@ -29385,15 +29565,15 @@ var DrawerItem = ({
|
|
29385
29565
|
label,
|
29386
29566
|
index
|
29387
29567
|
}) => {
|
29388
|
-
const ctx = (0,
|
29568
|
+
const ctx = (0, import_react4.useContext)(drawerContext);
|
29389
29569
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
29390
|
-
const CustomInner = (0,
|
29391
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0,
|
29570
|
+
const CustomInner = (0, import_react4.useMemo)(
|
29571
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
|
29392
29572
|
[children]
|
29393
29573
|
);
|
29394
|
-
return /* @__PURE__ */ (0,
|
29395
|
-
/* @__PURE__ */ (0,
|
29396
|
-
/* @__PURE__ */ (0,
|
29574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: getClassNameItem("draggable"), children: [
|
29575
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
|
29576
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DragIcon, {}) })
|
29397
29577
|
] }) }) }) });
|
29398
29578
|
};
|
29399
29579
|
var Drawer = ({
|
@@ -29401,7 +29581,7 @@ var Drawer = ({
|
|
29401
29581
|
droppableId = "component-list",
|
29402
29582
|
direction = "vertical"
|
29403
29583
|
}) => {
|
29404
|
-
return /* @__PURE__ */ (0,
|
29584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
29405
29585
|
"div",
|
29406
29586
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
29407
29587
|
ref: provided.innerRef,
|
@@ -29410,7 +29590,7 @@ var Drawer = ({
|
|
29410
29590
|
}),
|
29411
29591
|
children: [
|
29412
29592
|
children,
|
29413
|
-
/* @__PURE__ */ (0,
|
29593
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
29414
29594
|
]
|
29415
29595
|
})
|
29416
29596
|
) }) });
|
@@ -29423,19 +29603,32 @@ var import_react9 = require("react");
|
|
29423
29603
|
|
29424
29604
|
// components/DraggableComponent/index.tsx
|
29425
29605
|
init_react_import();
|
29426
|
-
var
|
29427
|
-
var import_dnd3 = require("@
|
29606
|
+
var import_react7 = require("react");
|
29607
|
+
var import_dnd3 = require("@measured/dnd");
|
29428
29608
|
|
29429
|
-
//
|
29430
|
-
|
29431
|
-
|
29609
|
+
// components/DraggableComponent/styles.module.css
|
29610
|
+
var styles_default3 = {
|
29611
|
+
DraggableComponent: "styles_DraggableComponent",
|
29612
|
+
"DraggableComponent--isDragging": "styles_DraggableComponent--isDragging",
|
29613
|
+
"DraggableComponent-contents": "styles_DraggableComponent-contents",
|
29614
|
+
"DraggableComponent-overlay": "styles_DraggableComponent-overlay",
|
29615
|
+
"DraggableComponent-loadingOverlay": "styles_DraggableComponent-loadingOverlay",
|
29616
|
+
"DraggableComponent--isLocked": "styles_DraggableComponent--isLocked",
|
29617
|
+
"DraggableComponent--forceHover": "styles_DraggableComponent--forceHover",
|
29618
|
+
"DraggableComponent--isSelected": "styles_DraggableComponent--isSelected",
|
29619
|
+
"DraggableComponent--indicativeHover": "styles_DraggableComponent--indicativeHover",
|
29620
|
+
"DraggableComponent-actionsOverlay": "styles_DraggableComponent-actionsOverlay",
|
29621
|
+
"DraggableComponent-actions": "styles_DraggableComponent-actions",
|
29622
|
+
"DraggableComponent-actionsLabel": "styles_DraggableComponent-actionsLabel",
|
29623
|
+
"DraggableComponent-action": "styles_DraggableComponent-action"
|
29624
|
+
};
|
29432
29625
|
|
29433
29626
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
29434
29627
|
init_react_import();
|
29435
29628
|
|
29436
29629
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29437
29630
|
init_react_import();
|
29438
|
-
var
|
29631
|
+
var import_react5 = require("react");
|
29439
29632
|
|
29440
29633
|
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
29441
29634
|
init_react_import();
|
@@ -29454,10 +29647,10 @@ var defaultAttributes = {
|
|
29454
29647
|
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
29455
29648
|
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
|
29456
29649
|
var createLucideIcon = (iconName, iconNode) => {
|
29457
|
-
const Component = (0,
|
29650
|
+
const Component = (0, import_react5.forwardRef)(
|
29458
29651
|
(_a, ref) => {
|
29459
29652
|
var _b = _a, { color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children } = _b, rest = __objRest(_b, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children"]);
|
29460
|
-
return (0,
|
29653
|
+
return (0, import_react5.createElement)(
|
29461
29654
|
"svg",
|
29462
29655
|
__spreadValues(__spreadProps(__spreadValues({
|
29463
29656
|
ref
|
@@ -29469,7 +29662,7 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
29469
29662
|
className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
|
29470
29663
|
}), rest),
|
29471
29664
|
[
|
29472
|
-
...iconNode.map(([tag, attrs]) => (0,
|
29665
|
+
...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
|
29473
29666
|
...Array.isArray(children) ? children : [children]
|
29474
29667
|
]
|
29475
29668
|
);
|
@@ -29580,6 +29773,14 @@ var Lock = createLucideIcon("Lock", [
|
|
29580
29773
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
29581
29774
|
]);
|
29582
29775
|
|
29776
|
+
// ../../node_modules/lucide-react/dist/esm/icons/monitor.js
|
29777
|
+
init_react_import();
|
29778
|
+
var Monitor = createLucideIcon("Monitor", [
|
29779
|
+
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
29780
|
+
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
29781
|
+
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
29782
|
+
]);
|
29783
|
+
|
29583
29784
|
// ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
|
29584
29785
|
init_react_import();
|
29585
29786
|
var MoreVertical = createLucideIcon("MoreVertical", [
|
@@ -29630,6 +29831,20 @@ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
|
|
29630
29831
|
["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
|
29631
29832
|
]);
|
29632
29833
|
|
29834
|
+
// ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
|
29835
|
+
init_react_import();
|
29836
|
+
var Smartphone = createLucideIcon("Smartphone", [
|
29837
|
+
["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
|
29838
|
+
["path", { d: "M12 18h.01", key: "mhygvu" }]
|
29839
|
+
]);
|
29840
|
+
|
29841
|
+
// ../../node_modules/lucide-react/dist/esm/icons/tablet.js
|
29842
|
+
init_react_import();
|
29843
|
+
var Tablet = createLucideIcon("Tablet", [
|
29844
|
+
["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
|
29845
|
+
["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
|
29846
|
+
]);
|
29847
|
+
|
29633
29848
|
// ../../node_modules/lucide-react/dist/esm/icons/trash.js
|
29634
29849
|
init_react_import();
|
29635
29850
|
var Trash = createLucideIcon("Trash", [
|
@@ -29653,12 +29868,29 @@ var Unlock = createLucideIcon("Unlock", [
|
|
29653
29868
|
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
|
29654
29869
|
]);
|
29655
29870
|
|
29871
|
+
// ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
|
29872
|
+
init_react_import();
|
29873
|
+
var ZoomIn = createLucideIcon("ZoomIn", [
|
29874
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
29875
|
+
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
29876
|
+
["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
|
29877
|
+
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
29878
|
+
]);
|
29879
|
+
|
29880
|
+
// ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
|
29881
|
+
init_react_import();
|
29882
|
+
var ZoomOut = createLucideIcon("ZoomOut", [
|
29883
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
29884
|
+
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
29885
|
+
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
29886
|
+
]);
|
29887
|
+
|
29656
29888
|
// lib/use-modifier-held.ts
|
29657
29889
|
init_react_import();
|
29658
|
-
var
|
29890
|
+
var import_react6 = require("react");
|
29659
29891
|
var useModifierHeld = (modifier) => {
|
29660
|
-
const [modifierHeld, setModifierHeld] = (0,
|
29661
|
-
(0,
|
29892
|
+
const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
|
29893
|
+
(0, import_react6.useEffect)(() => {
|
29662
29894
|
function downHandler({ key }) {
|
29663
29895
|
if (key === modifier) {
|
29664
29896
|
setModifierHeld(true);
|
@@ -29681,8 +29913,12 @@ var useModifierHeld = (modifier) => {
|
|
29681
29913
|
|
29682
29914
|
// components/DraggableComponent/index.tsx
|
29683
29915
|
var import_react_spinners2 = require("react-spinners");
|
29684
|
-
var
|
29685
|
-
var getClassName4 = get_class_name_factory_default("DraggableComponent",
|
29916
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
29917
|
+
var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_default3);
|
29918
|
+
var space = 8;
|
29919
|
+
var actionsOverlayTop = space * 6.5;
|
29920
|
+
var actionsTop = -(actionsOverlayTop - 8);
|
29921
|
+
var actionsRight = space;
|
29686
29922
|
var DraggableComponent = ({
|
29687
29923
|
children,
|
29688
29924
|
id,
|
@@ -29705,91 +29941,87 @@ var DraggableComponent = ({
|
|
29705
29941
|
indicativeHover = false,
|
29706
29942
|
style
|
29707
29943
|
}) => {
|
29944
|
+
const { zoomConfig } = useAppContext();
|
29708
29945
|
const isModifierHeld = useModifierHeld("Alt");
|
29709
|
-
|
29710
|
-
|
29711
|
-
|
29712
|
-
|
29713
|
-
|
29714
|
-
|
29715
|
-
|
29716
|
-
|
29717
|
-
|
29718
|
-
|
29719
|
-
|
29720
|
-
|
29721
|
-
|
29722
|
-
|
29723
|
-
|
29724
|
-
|
29725
|
-
|
29726
|
-
|
29727
|
-
|
29728
|
-
|
29729
|
-
|
29730
|
-
|
29731
|
-
|
29732
|
-
|
29733
|
-
|
29734
|
-
|
29735
|
-
|
29736
|
-
|
29737
|
-
|
29738
|
-
|
29739
|
-
|
29740
|
-
|
29741
|
-
|
29742
|
-
|
29743
|
-
|
29744
|
-
|
29745
|
-
|
29746
|
-
|
29747
|
-
|
29748
|
-
|
29749
|
-
|
29750
|
-
|
29751
|
-
|
29752
|
-
|
29753
|
-
|
29754
|
-
|
29755
|
-
|
29756
|
-
|
29757
|
-
|
29758
|
-
|
29759
|
-
|
29760
|
-
|
29761
|
-
|
29762
|
-
|
29763
|
-
|
29764
|
-
|
29765
|
-
|
29766
|
-
var setupZone = (data, zoneKey) => {
|
29767
|
-
if (zoneKey === rootDroppableId) {
|
29768
|
-
return data;
|
29769
|
-
}
|
29770
|
-
const newData = __spreadValues({}, data);
|
29771
|
-
newData.zones = data.zones || {};
|
29772
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
29773
|
-
return newData;
|
29946
|
+
const { status } = useAppContext();
|
29947
|
+
const El = status !== "LOADING" ? import_dnd3.Draggable : DefaultDraggable;
|
29948
|
+
(0, import_react7.useEffect)(onMount, []);
|
29949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
29950
|
+
"div",
|
29951
|
+
__spreadProps(__spreadValues(__spreadValues({
|
29952
|
+
ref: provided.innerRef
|
29953
|
+
}, provided.draggableProps), provided.dragHandleProps), {
|
29954
|
+
className: getClassName4({
|
29955
|
+
isSelected,
|
29956
|
+
isModifierHeld,
|
29957
|
+
isDragging: snapshot.isDragging,
|
29958
|
+
isLocked,
|
29959
|
+
forceHover,
|
29960
|
+
indicativeHover
|
29961
|
+
}),
|
29962
|
+
style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
|
29963
|
+
cursor: isModifierHeld ? "initial" : "grab"
|
29964
|
+
}),
|
29965
|
+
onMouseOver,
|
29966
|
+
onMouseOut,
|
29967
|
+
onMouseDown,
|
29968
|
+
onMouseUp,
|
29969
|
+
onClick,
|
29970
|
+
children: [
|
29971
|
+
debug,
|
29972
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
|
29973
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
29974
|
+
"div",
|
29975
|
+
{
|
29976
|
+
className: getClassName4("actionsOverlay"),
|
29977
|
+
style: {
|
29978
|
+
top: actionsOverlayTop / zoomConfig.zoom
|
29979
|
+
},
|
29980
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
29981
|
+
"div",
|
29982
|
+
{
|
29983
|
+
className: getClassName4("actions"),
|
29984
|
+
style: {
|
29985
|
+
transform: `scale(${1 / zoomConfig.zoom}`,
|
29986
|
+
top: actionsTop / zoomConfig.zoom,
|
29987
|
+
right: actionsRight / zoomConfig.zoom
|
29988
|
+
},
|
29989
|
+
children: [
|
29990
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
|
29991
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
|
29992
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
|
29993
|
+
]
|
29994
|
+
}
|
29995
|
+
)
|
29996
|
+
}
|
29997
|
+
),
|
29998
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
|
29999
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
|
30000
|
+
]
|
30001
|
+
})
|
30002
|
+
) }, id);
|
29774
30003
|
};
|
29775
30004
|
|
29776
|
-
//
|
29777
|
-
var
|
29778
|
-
|
29779
|
-
|
29780
|
-
|
29781
|
-
|
29782
|
-
|
29783
|
-
|
30005
|
+
// components/DropZone/styles.module.css
|
30006
|
+
var styles_default4 = {
|
30007
|
+
DropZone: "styles_DropZone",
|
30008
|
+
"DropZone-content": "styles_DropZone-content",
|
30009
|
+
"DropZone--userIsDragging": "styles_DropZone--userIsDragging",
|
30010
|
+
"DropZone--draggingOverArea": "styles_DropZone--draggingOverArea",
|
30011
|
+
"DropZone--draggingNewComponent": "styles_DropZone--draggingNewComponent",
|
30012
|
+
"DropZone--isAreaSelected": "styles_DropZone--isAreaSelected",
|
30013
|
+
"DropZone--hoveringOverArea": "styles_DropZone--hoveringOverArea",
|
30014
|
+
"DropZone--isDisabled": "styles_DropZone--isDisabled",
|
30015
|
+
"DropZone--isRootZone": "styles_DropZone--isRootZone",
|
30016
|
+
"DropZone--hasChildren": "styles_DropZone--hasChildren",
|
30017
|
+
"DropZone--isDestination": "styles_DropZone--isDestination",
|
30018
|
+
"DropZone-item": "styles_DropZone-item",
|
30019
|
+
"DropZone-hitbox": "styles_DropZone-hitbox"
|
29784
30020
|
};
|
29785
30021
|
|
29786
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
29787
|
-
init_react_import();
|
29788
|
-
var styles_module_default4 = { "DropZone": "_DropZone_utidm_1", "DropZone--zoomEnabled": "_DropZone--zoomEnabled_utidm_10", "DropZone-renderWrapper": "_DropZone-renderWrapper_utidm_14", "DropZone-content": "_DropZone-content_utidm_18", "DropZone--userIsDragging": "_DropZone--userIsDragging_utidm_23", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_utidm_27", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_utidm_28", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_utidm_34", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_utidm_35", "DropZone--isDisabled": "_DropZone--isDisabled_utidm_36", "DropZone--isRootZone": "_DropZone--isRootZone_utidm_37", "DropZone--hasChildren": "_DropZone--hasChildren_utidm_43", "DropZone--isDestination": "_DropZone--isDestination_utidm_48", "DropZone-item": "_DropZone-item_utidm_56", "DropZone-hitbox": "_DropZone-hitbox_utidm_60" };
|
29789
|
-
|
29790
30022
|
// components/DropZone/context.tsx
|
29791
30023
|
init_react_import();
|
29792
|
-
var
|
30024
|
+
var import_react8 = require("react");
|
29793
30025
|
var import_use_debounce = require("use-debounce");
|
29794
30026
|
|
29795
30027
|
// lib/get-zone-id.ts
|
@@ -29805,30 +30037,30 @@ var getZoneId = (zoneCompound) => {
|
|
29805
30037
|
};
|
29806
30038
|
|
29807
30039
|
// components/DropZone/context.tsx
|
29808
|
-
var
|
29809
|
-
var dropZoneContext = (0,
|
30040
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
30041
|
+
var dropZoneContext = (0, import_react8.createContext)(null);
|
29810
30042
|
var DropZoneProvider = ({
|
29811
30043
|
children,
|
29812
30044
|
value
|
29813
30045
|
}) => {
|
29814
|
-
const [hoveringArea, setHoveringArea] = (0,
|
29815
|
-
const [hoveringZone, setHoveringZone] = (0,
|
30046
|
+
const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
|
30047
|
+
const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
|
29816
30048
|
rootDroppableId
|
29817
30049
|
);
|
29818
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
30050
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
|
29819
30051
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
29820
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
30052
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
|
29821
30053
|
{}
|
29822
30054
|
);
|
29823
|
-
const [activeZones, setActiveZones] = (0,
|
30055
|
+
const [activeZones, setActiveZones] = (0, import_react8.useState)({});
|
29824
30056
|
const { dispatch = null } = value ? value : {};
|
29825
|
-
const registerZoneArea = (0,
|
30057
|
+
const registerZoneArea = (0, import_react8.useCallback)(
|
29826
30058
|
(area) => {
|
29827
30059
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
29828
30060
|
},
|
29829
30061
|
[setAreasWithZones]
|
29830
30062
|
);
|
29831
|
-
const registerZone = (0,
|
30063
|
+
const registerZone = (0, import_react8.useCallback)(
|
29832
30064
|
(zoneCompound) => {
|
29833
30065
|
if (!dispatch) {
|
29834
30066
|
return;
|
@@ -29841,7 +30073,7 @@ var DropZoneProvider = ({
|
|
29841
30073
|
},
|
29842
30074
|
[setActiveZones, dispatch]
|
29843
30075
|
);
|
29844
|
-
const unregisterZone = (0,
|
30076
|
+
const unregisterZone = (0, import_react8.useCallback)(
|
29845
30077
|
(zoneCompound) => {
|
29846
30078
|
if (!dispatch) {
|
29847
30079
|
return;
|
@@ -29856,8 +30088,8 @@ var DropZoneProvider = ({
|
|
29856
30088
|
},
|
29857
30089
|
[setActiveZones, dispatch]
|
29858
30090
|
);
|
29859
|
-
const [pathData, setPathData] = (0,
|
29860
|
-
const registerPath = (0,
|
30091
|
+
const [pathData, setPathData] = (0, import_react8.useState)();
|
30092
|
+
const registerPath = (0, import_react8.useCallback)(
|
29861
30093
|
(selector) => {
|
29862
30094
|
if (!(value == null ? void 0 : value.data)) {
|
29863
30095
|
return;
|
@@ -29882,7 +30114,8 @@ var DropZoneProvider = ({
|
|
29882
30114
|
},
|
29883
30115
|
[value, setPathData]
|
29884
30116
|
);
|
29885
|
-
|
30117
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
|
30118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
29886
30119
|
dropZoneContext.Provider,
|
29887
30120
|
{
|
29888
30121
|
value: __spreadValues({
|
@@ -29898,58 +30131,18 @@ var DropZoneProvider = ({
|
|
29898
30131
|
unregisterZone,
|
29899
30132
|
activeZones,
|
29900
30133
|
registerPath,
|
29901
|
-
pathData
|
30134
|
+
pathData,
|
30135
|
+
zoneWillDrag,
|
30136
|
+
setZoneWillDrag
|
29902
30137
|
}, value),
|
29903
30138
|
children
|
29904
30139
|
}
|
29905
30140
|
) });
|
29906
30141
|
};
|
29907
30142
|
|
29908
|
-
// components/Puck/context.tsx
|
29909
|
-
init_react_import();
|
29910
|
-
var import_react8 = require("react");
|
29911
|
-
var defaultAppState = {
|
29912
|
-
data: { content: [], root: { props: { title: "" } } },
|
29913
|
-
ui: {
|
29914
|
-
leftSideBarVisible: true,
|
29915
|
-
rightSideBarVisible: true,
|
29916
|
-
arrayState: {},
|
29917
|
-
itemSelector: null,
|
29918
|
-
componentList: {},
|
29919
|
-
isDragging: false
|
29920
|
-
}
|
29921
|
-
};
|
29922
|
-
var appContext = (0, import_react8.createContext)({
|
29923
|
-
state: defaultAppState,
|
29924
|
-
dispatch: () => null,
|
29925
|
-
config: { components: {} },
|
29926
|
-
componentState: {},
|
29927
|
-
resolveData: () => {
|
29928
|
-
},
|
29929
|
-
plugins: [],
|
29930
|
-
overrides: {},
|
29931
|
-
history: {}
|
29932
|
-
});
|
29933
|
-
var AppProvider = appContext.Provider;
|
29934
|
-
function useAppContext() {
|
29935
|
-
const mainContext = (0, import_react8.useContext)(appContext);
|
29936
|
-
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
29937
|
-
return __spreadProps(__spreadValues({}, mainContext), {
|
29938
|
-
// Helpers
|
29939
|
-
selectedItem,
|
29940
|
-
setUi: (ui, recordHistory) => {
|
29941
|
-
return mainContext.dispatch({
|
29942
|
-
type: "setUi",
|
29943
|
-
ui,
|
29944
|
-
recordHistory
|
29945
|
-
});
|
29946
|
-
}
|
29947
|
-
});
|
29948
|
-
}
|
29949
|
-
|
29950
30143
|
// components/DropZone/index.tsx
|
29951
|
-
var
|
29952
|
-
var getClassName5 = get_class_name_factory_default("DropZone",
|
30144
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
30145
|
+
var getClassName5 = get_class_name_factory_default("DropZone", styles_default4);
|
29953
30146
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
29954
30147
|
var _a;
|
29955
30148
|
const appContext2 = useAppContext();
|
@@ -29967,7 +30160,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29967
30160
|
registerZoneArea,
|
29968
30161
|
areasWithZones,
|
29969
30162
|
hoveringComponent,
|
29970
|
-
|
30163
|
+
zoneWillDrag,
|
30164
|
+
setZoneWillDrag = () => null
|
29971
30165
|
} = ctx || {};
|
29972
30166
|
let content = data.content || [];
|
29973
30167
|
let zoneCompound = rootDroppableId;
|
@@ -29997,12 +30191,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
29997
30191
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
29998
30192
|
const [zoneArea] = getZoneId(zoneCompound);
|
29999
30193
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
30000
|
-
const
|
30194
|
+
const userWillDrag = zoneWillDrag === zone;
|
30001
30195
|
const userIsDragging = !!draggedItem;
|
30002
30196
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
30003
30197
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
30004
30198
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
30005
|
-
return /* @__PURE__ */ (0,
|
30199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
|
30006
30200
|
}
|
30007
30201
|
const {
|
30008
30202
|
hoveringArea = "root",
|
@@ -30039,7 +30233,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30039
30233
|
}
|
30040
30234
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
30041
30235
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
30042
|
-
return /* @__PURE__ */ (0,
|
30236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30043
30237
|
"div",
|
30044
30238
|
{
|
30045
30239
|
className: getClassName5({
|
@@ -30051,17 +30245,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30051
30245
|
isDestination: draggedDestinationId === zoneCompound,
|
30052
30246
|
isDisabled: !isEnabled,
|
30053
30247
|
isAreaSelected,
|
30054
|
-
hasChildren: content.length > 0
|
30055
|
-
zoomEnabled: !disableZoom
|
30248
|
+
hasChildren: content.length > 0
|
30056
30249
|
}),
|
30057
|
-
|
30058
|
-
|
30250
|
+
onMouseUp: () => {
|
30251
|
+
setZoneWillDrag("");
|
30252
|
+
},
|
30253
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30254
|
+
Droppable,
|
30059
30255
|
{
|
30060
30256
|
droppableId: zoneCompound,
|
30061
30257
|
direction: "vertical",
|
30062
30258
|
isDropDisabled: !isEnabled,
|
30063
30259
|
children: (provided, snapshot) => {
|
30064
|
-
return /* @__PURE__ */ (0,
|
30260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30065
30261
|
"div",
|
30066
30262
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
30067
30263
|
className: getClassName5("content"),
|
@@ -30086,23 +30282,23 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30086
30282
|
"draggable-"
|
30087
30283
|
)[1] === componentId;
|
30088
30284
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
30089
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
30285
|
+
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
30090
30286
|
"No configuration for ",
|
30091
30287
|
item.type
|
30092
30288
|
] });
|
30093
|
-
return /* @__PURE__ */ (0,
|
30289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
30094
30290
|
"div",
|
30095
30291
|
{
|
30096
30292
|
className: getClassName5("item"),
|
30097
30293
|
style: { zIndex: isDragging ? 1 : void 0 },
|
30098
30294
|
children: [
|
30099
|
-
/* @__PURE__ */ (0,
|
30295
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30100
30296
|
DropZoneProvider,
|
30101
30297
|
{
|
30102
30298
|
value: __spreadProps(__spreadValues({}, ctx), {
|
30103
30299
|
areaId: componentId
|
30104
30300
|
}),
|
30105
|
-
children: /* @__PURE__ */ (0,
|
30301
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30106
30302
|
DraggableComponent,
|
30107
30303
|
{
|
30108
30304
|
label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
|
@@ -30128,11 +30324,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30128
30324
|
},
|
30129
30325
|
onMouseDown: (e) => {
|
30130
30326
|
e.stopPropagation();
|
30131
|
-
|
30132
|
-
},
|
30133
|
-
onMouseUp: (e) => {
|
30134
|
-
e.stopPropagation();
|
30135
|
-
setUserWillDrag(false);
|
30327
|
+
setZoneWillDrag(zone);
|
30136
30328
|
},
|
30137
30329
|
onMouseOver: (e) => {
|
30138
30330
|
e.stopPropagation();
|
@@ -30173,12 +30365,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30173
30365
|
style: {
|
30174
30366
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
30175
30367
|
},
|
30176
|
-
children: /* @__PURE__ */ (0,
|
30368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
30177
30369
|
}
|
30178
30370
|
)
|
30179
30371
|
}
|
30180
30372
|
),
|
30181
|
-
userIsDragging && /* @__PURE__ */ (0,
|
30373
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30182
30374
|
"div",
|
30183
30375
|
{
|
30184
30376
|
className: getClassName5("hitbox"),
|
@@ -30195,7 +30387,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30195
30387
|
);
|
30196
30388
|
}),
|
30197
30389
|
provided == null ? void 0 : provided.placeholder,
|
30198
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
30390
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30199
30391
|
"div",
|
30200
30392
|
{
|
30201
30393
|
"data-puck-placeholder": true,
|
@@ -30227,14 +30419,14 @@ function DropZoneRender({ zone }) {
|
|
30227
30419
|
zoneCompound = `${areaId}:${zone}`;
|
30228
30420
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
30229
30421
|
}
|
30230
|
-
return /* @__PURE__ */ (0,
|
30422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
|
30231
30423
|
const Component = config.components[item.type];
|
30232
30424
|
if (Component) {
|
30233
|
-
return /* @__PURE__ */ (0,
|
30425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30234
30426
|
DropZoneProvider,
|
30235
30427
|
{
|
30236
30428
|
value: { data, config, areaId: item.props.id },
|
30237
|
-
children: /* @__PURE__ */ (0,
|
30429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
30238
30430
|
Component.render,
|
30239
30431
|
__spreadProps(__spreadValues({}, item.props), {
|
30240
30432
|
puck: { renderDropZone: DropZone }
|
@@ -30250,9 +30442,9 @@ function DropZoneRender({ zone }) {
|
|
30250
30442
|
function DropZone(props) {
|
30251
30443
|
const ctx = (0, import_react9.useContext)(dropZoneContext);
|
30252
30444
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
30253
|
-
return /* @__PURE__ */ (0,
|
30445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
|
30254
30446
|
}
|
30255
|
-
return /* @__PURE__ */ (0,
|
30447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
|
30256
30448
|
}
|
30257
30449
|
|
30258
30450
|
// components/IconButton/index.ts
|
@@ -30262,14 +30454,17 @@ init_react_import();
|
|
30262
30454
|
init_react_import();
|
30263
30455
|
var import_react10 = require("react");
|
30264
30456
|
|
30265
|
-
//
|
30266
|
-
|
30267
|
-
|
30457
|
+
// components/IconButton/IconButton.module.css
|
30458
|
+
var IconButton_default = {
|
30459
|
+
IconButton: "IconButton_IconButton",
|
30460
|
+
"IconButton--disabled": "IconButton_IconButton--disabled",
|
30461
|
+
"IconButton-title": "IconButton_IconButton-title"
|
30462
|
+
};
|
30268
30463
|
|
30269
30464
|
// components/IconButton/IconButton.tsx
|
30270
30465
|
var import_react_spinners3 = require("react-spinners");
|
30271
|
-
var
|
30272
|
-
var getClassName6 = get_class_name_factory_default("IconButton",
|
30466
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
30467
|
+
var getClassName6 = get_class_name_factory_default("IconButton", IconButton_default);
|
30273
30468
|
var IconButton = ({
|
30274
30469
|
children,
|
30275
30470
|
href,
|
@@ -30284,7 +30479,7 @@ var IconButton = ({
|
|
30284
30479
|
}) => {
|
30285
30480
|
const [loading, setLoading] = (0, import_react10.useState)(false);
|
30286
30481
|
const ElementType = href ? "a" : "button";
|
30287
|
-
const el = /* @__PURE__ */ (0,
|
30482
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
30288
30483
|
ElementType,
|
30289
30484
|
{
|
30290
30485
|
className: getClassName6({
|
@@ -30309,11 +30504,11 @@ var IconButton = ({
|
|
30309
30504
|
href,
|
30310
30505
|
title,
|
30311
30506
|
children: [
|
30312
|
-
/* @__PURE__ */ (0,
|
30507
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
|
30313
30508
|
children,
|
30314
|
-
loading && /* @__PURE__ */ (0,
|
30509
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
30315
30510
|
"\xA0\xA0",
|
30316
|
-
/* @__PURE__ */ (0,
|
30511
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
|
30317
30512
|
] })
|
30318
30513
|
]
|
30319
30514
|
}
|
@@ -30323,26 +30518,51 @@ var IconButton = ({
|
|
30323
30518
|
|
30324
30519
|
// components/Puck/index.tsx
|
30325
30520
|
init_react_import();
|
30326
|
-
var
|
30327
|
-
var import_dnd7 = require("@hello-pangea/dnd");
|
30521
|
+
var import_react29 = require("react");
|
30328
30522
|
|
30329
30523
|
// lib/use-placeholder-style.ts
|
30330
30524
|
init_react_import();
|
30525
|
+
var import_react12 = require("react");
|
30526
|
+
|
30527
|
+
// lib/use-frame.ts
|
30528
|
+
init_react_import();
|
30331
30529
|
var import_react11 = require("react");
|
30530
|
+
|
30531
|
+
// lib/get-frame.ts
|
30532
|
+
init_react_import();
|
30533
|
+
var getFrame = () => {
|
30534
|
+
let frame = document.querySelector("#preview-frame");
|
30535
|
+
if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
|
30536
|
+
frame = frame.contentDocument.body;
|
30537
|
+
}
|
30538
|
+
return frame;
|
30539
|
+
};
|
30540
|
+
|
30541
|
+
// lib/use-frame.ts
|
30542
|
+
var useFrame = () => {
|
30543
|
+
const [el, setEl] = (0, import_react11.useState)();
|
30544
|
+
(0, import_react11.useEffect)(() => {
|
30545
|
+
setEl(getFrame());
|
30546
|
+
}, []);
|
30547
|
+
return el;
|
30548
|
+
};
|
30549
|
+
|
30550
|
+
// lib/use-placeholder-style.ts
|
30332
30551
|
var usePlaceholderStyle = () => {
|
30333
30552
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
30334
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
30553
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react12.useState)();
|
30554
|
+
const frame = useFrame();
|
30335
30555
|
const onDragStartOrUpdate = (draggedItem) => {
|
30336
30556
|
var _a;
|
30337
30557
|
const draggableId = draggedItem.draggableId;
|
30338
30558
|
const destinationIndex = (draggedItem.destination || draggedItem.source).index;
|
30339
30559
|
const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
|
30340
30560
|
const domQuery = `[${queryAttr}='${draggableId}']`;
|
30341
|
-
const draggedDOM =
|
30561
|
+
const draggedDOM = frame == null ? void 0 : frame.ownerDocument.querySelector(domQuery);
|
30342
30562
|
if (!draggedDOM) {
|
30343
30563
|
return;
|
30344
30564
|
}
|
30345
|
-
const targetListElement =
|
30565
|
+
const targetListElement = frame == null ? void 0 : frame.ownerDocument.querySelector(
|
30346
30566
|
`[data-rfd-droppable-id='${droppableId}']`
|
30347
30567
|
);
|
30348
30568
|
const { clientHeight } = draggedDOM;
|
@@ -30377,23 +30597,42 @@ var usePlaceholderStyle = () => {
|
|
30377
30597
|
// components/SidebarSection/index.tsx
|
30378
30598
|
init_react_import();
|
30379
30599
|
|
30380
|
-
//
|
30381
|
-
|
30382
|
-
|
30600
|
+
// components/SidebarSection/styles.module.css
|
30601
|
+
var styles_default5 = {
|
30602
|
+
SidebarSection: "styles_SidebarSection",
|
30603
|
+
"SidebarSection-title": "styles_SidebarSection-title",
|
30604
|
+
"SidebarSection--noBorderTop": "styles_SidebarSection--noBorderTop",
|
30605
|
+
"SidebarSection-content": "styles_SidebarSection-content",
|
30606
|
+
"SidebarSection--noPadding": "styles_SidebarSection--noPadding",
|
30607
|
+
"SidebarSection-breadcrumbLabel": "styles_SidebarSection-breadcrumbLabel",
|
30608
|
+
"SidebarSection-breadcrumbs": "styles_SidebarSection-breadcrumbs",
|
30609
|
+
"SidebarSection-breadcrumb": "styles_SidebarSection-breadcrumb",
|
30610
|
+
"SidebarSection-heading": "styles_SidebarSection-heading",
|
30611
|
+
"SidebarSection-loadingOverlay": "styles_SidebarSection-loadingOverlay"
|
30612
|
+
};
|
30383
30613
|
|
30384
30614
|
// components/Heading/index.tsx
|
30385
30615
|
init_react_import();
|
30386
30616
|
|
30387
|
-
//
|
30388
|
-
|
30389
|
-
|
30617
|
+
// components/Heading/styles.module.css
|
30618
|
+
var styles_default6 = {
|
30619
|
+
Heading: "styles_Heading",
|
30620
|
+
"Heading--xxxxl": "styles_Heading--xxxxl",
|
30621
|
+
"Heading--xxxl": "styles_Heading--xxxl",
|
30622
|
+
"Heading--xxl": "styles_Heading--xxl",
|
30623
|
+
"Heading--xl": "styles_Heading--xl",
|
30624
|
+
"Heading--l": "styles_Heading--l",
|
30625
|
+
"Heading--m": "styles_Heading--m",
|
30626
|
+
"Heading--s": "styles_Heading--s",
|
30627
|
+
"Heading--xs": "styles_Heading--xs"
|
30628
|
+
};
|
30390
30629
|
|
30391
30630
|
// components/Heading/index.tsx
|
30392
|
-
var
|
30393
|
-
var getClassName7 = get_class_name_factory_default("Heading",
|
30631
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
30632
|
+
var getClassName7 = get_class_name_factory_default("Heading", styles_default6);
|
30394
30633
|
var Heading = ({ children, rank, size = "m" }) => {
|
30395
30634
|
const Tag = rank ? `h${rank}` : "span";
|
30396
|
-
return /* @__PURE__ */ (0,
|
30635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
30397
30636
|
Tag,
|
30398
30637
|
{
|
30399
30638
|
className: getClassName7({
|
@@ -30406,7 +30645,7 @@ var Heading = ({ children, rank, size = "m" }) => {
|
|
30406
30645
|
|
30407
30646
|
// lib/use-breadcrumbs.ts
|
30408
30647
|
init_react_import();
|
30409
|
-
var
|
30648
|
+
var import_react13 = require("react");
|
30410
30649
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
30411
30650
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
30412
30651
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -30456,8 +30695,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
30456
30695
|
state: { data },
|
30457
30696
|
selectedItem
|
30458
30697
|
} = useAppContext();
|
30459
|
-
const dzContext = (0,
|
30460
|
-
return (0,
|
30698
|
+
const dzContext = (0, import_react13.useContext)(dropZoneContext);
|
30699
|
+
return (0, import_react13.useMemo)(() => {
|
30461
30700
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
30462
30701
|
selectedItem,
|
30463
30702
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -30472,8 +30711,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
30472
30711
|
|
30473
30712
|
// components/SidebarSection/index.tsx
|
30474
30713
|
var import_react_spinners4 = require("react-spinners");
|
30475
|
-
var
|
30476
|
-
var getClassName8 = get_class_name_factory_default("SidebarSection",
|
30714
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
30715
|
+
var getClassName8 = get_class_name_factory_default("SidebarSection", styles_default5);
|
30477
30716
|
var SidebarSection = ({
|
30478
30717
|
children,
|
30479
30718
|
title,
|
@@ -30485,15 +30724,15 @@ var SidebarSection = ({
|
|
30485
30724
|
}) => {
|
30486
30725
|
const { setUi } = useAppContext();
|
30487
30726
|
const breadcrumbs = useBreadcrumbs(1);
|
30488
|
-
return /* @__PURE__ */ (0,
|
30727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
30489
30728
|
"div",
|
30490
30729
|
{
|
30491
30730
|
className: getClassName8({ noBorderTop, noPadding }),
|
30492
30731
|
style: { background },
|
30493
30732
|
children: [
|
30494
|
-
/* @__PURE__ */ (0,
|
30495
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
30496
|
-
/* @__PURE__ */ (0,
|
30733
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
|
30734
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
|
30735
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
30497
30736
|
"button",
|
30498
30737
|
{
|
30499
30738
|
className: getClassName8("breadcrumbLabel"),
|
@@ -30501,12 +30740,12 @@ var SidebarSection = ({
|
|
30501
30740
|
children: breadcrumb.label
|
30502
30741
|
}
|
30503
30742
|
),
|
30504
|
-
/* @__PURE__ */ (0,
|
30743
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
|
30505
30744
|
] }, i)) : null,
|
30506
|
-
/* @__PURE__ */ (0,
|
30745
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
30507
30746
|
] }) }),
|
30508
|
-
/* @__PURE__ */ (0,
|
30509
|
-
isLoading && /* @__PURE__ */ (0,
|
30747
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("content"), children }),
|
30748
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
|
30510
30749
|
]
|
30511
30750
|
}
|
30512
30751
|
);
|
@@ -30874,7 +31113,7 @@ var flushZones = (appState) => {
|
|
30874
31113
|
|
30875
31114
|
// lib/use-resolved-data.ts
|
30876
31115
|
init_react_import();
|
30877
|
-
var
|
31116
|
+
var import_react14 = require("react");
|
30878
31117
|
|
30879
31118
|
// lib/resolve-component-data.ts
|
30880
31119
|
init_react_import();
|
@@ -30989,13 +31228,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
30989
31228
|
|
30990
31229
|
// lib/use-resolved-data.ts
|
30991
31230
|
var useResolvedData = (appState, config, dispatch) => {
|
30992
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
31231
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react14.useState)({
|
30993
31232
|
resolverKey: 0,
|
30994
31233
|
newAppState: appState
|
30995
31234
|
});
|
30996
|
-
const [componentState, setComponentState] = (0,
|
31235
|
+
const [componentState, setComponentState] = (0, import_react14.useState)({});
|
30997
31236
|
const deferredSetStates = {};
|
30998
|
-
const setComponentLoading = (0,
|
31237
|
+
const setComponentLoading = (0, import_react14.useCallback)(
|
30999
31238
|
(id, loading, defer = 0) => {
|
31000
31239
|
if (deferredSetStates[id]) {
|
31001
31240
|
clearTimeout(deferredSetStates[id]);
|
@@ -31065,10 +31304,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31065
31304
|
});
|
31066
31305
|
yield Promise.all(promises);
|
31067
31306
|
});
|
31068
|
-
(0,
|
31307
|
+
(0, import_react14.useEffect)(() => {
|
31069
31308
|
runResolvers();
|
31070
31309
|
}, [resolverKey]);
|
31071
|
-
const resolveData = (0,
|
31310
|
+
const resolveData = (0, import_react14.useCallback)((newAppState2 = appState) => {
|
31072
31311
|
setResolverState((curr) => ({
|
31073
31312
|
resolverKey: curr.resolverKey + 1,
|
31074
31313
|
newAppState: newAppState2
|
@@ -31083,13 +31322,17 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31083
31322
|
// components/MenuBar/index.tsx
|
31084
31323
|
init_react_import();
|
31085
31324
|
|
31086
|
-
//
|
31087
|
-
|
31088
|
-
|
31325
|
+
// components/MenuBar/styles.module.css
|
31326
|
+
var styles_default7 = {
|
31327
|
+
MenuBar: "styles_MenuBar",
|
31328
|
+
"MenuBar--menuOpen": "styles_MenuBar--menuOpen",
|
31329
|
+
"MenuBar-inner": "styles_MenuBar-inner",
|
31330
|
+
"MenuBar-history": "styles_MenuBar-history"
|
31331
|
+
};
|
31089
31332
|
|
31090
31333
|
// components/MenuBar/index.tsx
|
31091
|
-
var
|
31092
|
-
var getClassName9 = get_class_name_factory_default("MenuBar",
|
31334
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
31335
|
+
var getClassName9 = get_class_name_factory_default("MenuBar", styles_default7);
|
31093
31336
|
var MenuBar = ({
|
31094
31337
|
appState,
|
31095
31338
|
data = { content: [], root: { props: { title: "" } } },
|
@@ -31103,7 +31346,7 @@ var MenuBar = ({
|
|
31103
31346
|
history: { back, forward, historyStore }
|
31104
31347
|
} = useAppContext();
|
31105
31348
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
31106
|
-
return /* @__PURE__ */ (0,
|
31349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31107
31350
|
"div",
|
31108
31351
|
{
|
31109
31352
|
className: getClassName9({ menuOpen }),
|
@@ -31117,16 +31360,16 @@ var MenuBar = ({
|
|
31117
31360
|
setMenuOpen(false);
|
31118
31361
|
}
|
31119
31362
|
},
|
31120
|
-
children: /* @__PURE__ */ (0,
|
31121
|
-
/* @__PURE__ */ (0,
|
31122
|
-
/* @__PURE__ */ (0,
|
31363
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("inner"), children: [
|
31364
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("history"), children: [
|
31365
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31123
31366
|
ChevronLeft,
|
31124
31367
|
{
|
31125
31368
|
size: 21,
|
31126
31369
|
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
31127
31370
|
}
|
31128
31371
|
) }),
|
31129
|
-
/* @__PURE__ */ (0,
|
31372
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31130
31373
|
ChevronRight,
|
31131
31374
|
{
|
31132
31375
|
size: 21,
|
@@ -31134,17 +31377,17 @@ var MenuBar = ({
|
|
31134
31377
|
}
|
31135
31378
|
) })
|
31136
31379
|
] }),
|
31137
|
-
/* @__PURE__ */ (0,
|
31380
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31138
31381
|
state: appState,
|
31139
31382
|
dispatch
|
31140
31383
|
}) }),
|
31141
|
-
/* @__PURE__ */ (0,
|
31384
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31142
31385
|
Button,
|
31143
31386
|
{
|
31144
31387
|
onClick: () => {
|
31145
31388
|
onPublish && onPublish(data);
|
31146
31389
|
},
|
31147
|
-
icon: /* @__PURE__ */ (0,
|
31390
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
|
31148
31391
|
children: "Publish"
|
31149
31392
|
}
|
31150
31393
|
) })
|
@@ -31153,9 +31396,24 @@ var MenuBar = ({
|
|
31153
31396
|
);
|
31154
31397
|
};
|
31155
31398
|
|
31156
|
-
//
|
31157
|
-
|
31158
|
-
|
31399
|
+
// components/Puck/styles.module.css
|
31400
|
+
var styles_default8 = {
|
31401
|
+
Puck: "styles_Puck",
|
31402
|
+
"Puck--leftSideBarVisible": "styles_Puck--leftSideBarVisible",
|
31403
|
+
"Puck--rightSideBarVisible": "styles_Puck--rightSideBarVisible",
|
31404
|
+
"Puck-header": "styles_Puck-header",
|
31405
|
+
"Puck-headerInner": "styles_Puck-headerInner",
|
31406
|
+
"Puck-headerToggle": "styles_Puck-headerToggle",
|
31407
|
+
"Puck-rightSideBarToggle": "styles_Puck-rightSideBarToggle",
|
31408
|
+
"Puck-leftSideBarToggle": "styles_Puck-leftSideBarToggle",
|
31409
|
+
"Puck-headerTitle": "styles_Puck-headerTitle",
|
31410
|
+
"Puck-headerPath": "styles_Puck-headerPath",
|
31411
|
+
"Puck-headerTools": "styles_Puck-headerTools",
|
31412
|
+
"Puck-menuButton": "styles_Puck-menuButton",
|
31413
|
+
"Puck--menuOpen": "styles_Puck--menuOpen",
|
31414
|
+
"Puck-leftSideBar": "styles_Puck-leftSideBar",
|
31415
|
+
"Puck-rightSideBar": "styles_Puck-rightSideBar"
|
31416
|
+
};
|
31159
31417
|
|
31160
31418
|
// components/Puck/components/Fields/index.tsx
|
31161
31419
|
init_react_import();
|
@@ -31164,12 +31422,22 @@ var import_react_spinners6 = require("react-spinners");
|
|
31164
31422
|
// components/InputOrGroup/index.tsx
|
31165
31423
|
init_react_import();
|
31166
31424
|
|
31167
|
-
//
|
31168
|
-
|
31169
|
-
|
31425
|
+
// components/InputOrGroup/styles.module.css
|
31426
|
+
var styles_default9 = {
|
31427
|
+
Input: "styles_Input",
|
31428
|
+
"Input-label": "styles_Input-label",
|
31429
|
+
"Input-labelIcon": "styles_Input-labelIcon",
|
31430
|
+
"Input-disabledIcon": "styles_Input-disabledIcon",
|
31431
|
+
"Input-input": "styles_Input-input",
|
31432
|
+
"Input--readOnly": "styles_Input--readOnly",
|
31433
|
+
"Input-radioGroupItems": "styles_Input-radioGroupItems",
|
31434
|
+
"Input-radio": "styles_Input-radio",
|
31435
|
+
"Input-radioInner": "styles_Input-radioInner",
|
31436
|
+
"Input-radioInput": "styles_Input-radioInput"
|
31437
|
+
};
|
31170
31438
|
|
31171
31439
|
// components/InputOrGroup/index.tsx
|
31172
|
-
var
|
31440
|
+
var import_react19 = require("react");
|
31173
31441
|
|
31174
31442
|
// components/InputOrGroup/fields/index.tsx
|
31175
31443
|
init_react_import();
|
@@ -31177,17 +31445,41 @@ init_react_import();
|
|
31177
31445
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31178
31446
|
init_react_import();
|
31179
31447
|
|
31180
|
-
//
|
31448
|
+
// components/InputOrGroup/fields/ArrayField/styles.module.css
|
31449
|
+
var styles_default10 = {
|
31450
|
+
ArrayField: "styles_ArrayField",
|
31451
|
+
"ArrayField--isDraggingFrom": "styles_ArrayField--isDraggingFrom",
|
31452
|
+
"ArrayField-addButton": "styles_ArrayField-addButton",
|
31453
|
+
"ArrayField--hasItems": "styles_ArrayField--hasItems",
|
31454
|
+
ArrayFieldItem: "styles_ArrayFieldItem",
|
31455
|
+
"ArrayFieldItem--isDragging": "styles_ArrayFieldItem--isDragging",
|
31456
|
+
"ArrayFieldItem--isExpanded": "styles_ArrayFieldItem--isExpanded",
|
31457
|
+
"ArrayFieldItem-summary": "styles_ArrayFieldItem-summary",
|
31458
|
+
"ArrayFieldItem--readOnly": "styles_ArrayFieldItem--readOnly",
|
31459
|
+
"ArrayFieldItem-body": "styles_ArrayFieldItem-body",
|
31460
|
+
"ArrayFieldItem-fieldset": "styles_ArrayFieldItem-fieldset",
|
31461
|
+
"ArrayFieldItem-rhs": "styles_ArrayFieldItem-rhs",
|
31462
|
+
"ArrayFieldItem-actions": "styles_ArrayFieldItem-actions"
|
31463
|
+
};
|
31464
|
+
|
31465
|
+
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31466
|
+
var import_react15 = require("react");
|
31467
|
+
|
31468
|
+
// components/DragDropContext/index.tsx
|
31181
31469
|
init_react_import();
|
31182
|
-
var
|
31470
|
+
var import_dnd4 = require("@measured/dnd");
|
31471
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
31472
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
|
31473
|
+
var DragDropContext = (props) => {
|
31474
|
+
const { status } = useAppContext();
|
31475
|
+
const El = status !== "LOADING" ? import_dnd4.DragDropContext : DefaultDragDropContext;
|
31476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(El, __spreadValues({}, props));
|
31477
|
+
};
|
31183
31478
|
|
31184
31479
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
31185
|
-
var
|
31186
|
-
var
|
31187
|
-
var
|
31188
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
31189
|
-
var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
|
31190
|
-
var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
|
31480
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
31481
|
+
var getClassName10 = get_class_name_factory_default("ArrayField", styles_default10);
|
31482
|
+
var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_default10);
|
31191
31483
|
var ArrayField = ({
|
31192
31484
|
field,
|
31193
31485
|
onChange,
|
@@ -31209,11 +31501,11 @@ var ArrayField = ({
|
|
31209
31501
|
}),
|
31210
31502
|
openId: ""
|
31211
31503
|
};
|
31212
|
-
const [localState, setLocalState] = (0,
|
31213
|
-
(0,
|
31504
|
+
const [localState, setLocalState] = (0, import_react15.useState)({ arrayState, value });
|
31505
|
+
(0, import_react15.useEffect)(() => {
|
31214
31506
|
setLocalState({ arrayState, value });
|
31215
31507
|
}, [value, state.ui.arrayState[id]]);
|
31216
|
-
const mapArrayStateToUi = (0,
|
31508
|
+
const mapArrayStateToUi = (0, import_react15.useCallback)(
|
31217
31509
|
(partialArrayState) => {
|
31218
31510
|
return {
|
31219
31511
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
@@ -31223,13 +31515,13 @@ var ArrayField = ({
|
|
31223
31515
|
},
|
31224
31516
|
[arrayState]
|
31225
31517
|
);
|
31226
|
-
const getHighestIndex = (0,
|
31518
|
+
const getHighestIndex = (0, import_react15.useCallback)(() => {
|
31227
31519
|
return arrayState.items.reduce(
|
31228
31520
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
31229
31521
|
-1
|
31230
31522
|
);
|
31231
31523
|
}, [arrayState]);
|
31232
|
-
const regenerateArrayState = (0,
|
31524
|
+
const regenerateArrayState = (0, import_react15.useCallback)(
|
31233
31525
|
(value2) => {
|
31234
31526
|
let highestIndex = getHighestIndex();
|
31235
31527
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
@@ -31248,22 +31540,22 @@ var ArrayField = ({
|
|
31248
31540
|
},
|
31249
31541
|
[arrayState]
|
31250
31542
|
);
|
31251
|
-
(0,
|
31543
|
+
(0, import_react15.useEffect)(() => {
|
31252
31544
|
setUi(mapArrayStateToUi(arrayState));
|
31253
31545
|
}, []);
|
31254
|
-
const [hovering, setHovering] = (0,
|
31546
|
+
const [hovering, setHovering] = (0, import_react15.useState)(false);
|
31255
31547
|
if (field.type !== "array" || !field.arrayFields) {
|
31256
31548
|
return null;
|
31257
31549
|
}
|
31258
|
-
return /* @__PURE__ */ (0,
|
31550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31259
31551
|
FieldLabelInternal,
|
31260
31552
|
{
|
31261
31553
|
label: label || name,
|
31262
|
-
icon: /* @__PURE__ */ (0,
|
31554
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
|
31263
31555
|
el: "div",
|
31264
31556
|
readOnly,
|
31265
|
-
children: /* @__PURE__ */ (0,
|
31266
|
-
|
31557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31558
|
+
DragDropContext,
|
31267
31559
|
{
|
31268
31560
|
onDragEnd: (event) => {
|
31269
31561
|
var _a, _b;
|
@@ -31289,8 +31581,8 @@ var ArrayField = ({
|
|
31289
31581
|
});
|
31290
31582
|
}
|
31291
31583
|
},
|
31292
|
-
children: /* @__PURE__ */ (0,
|
31293
|
-
return /* @__PURE__ */ (0,
|
31584
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
31585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
31294
31586
|
"div",
|
31295
31587
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
31296
31588
|
ref: provided.innerRef,
|
@@ -31310,7 +31602,7 @@ var ArrayField = ({
|
|
31310
31602
|
localState.arrayState.items.map((item, i) => {
|
31311
31603
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
31312
31604
|
const data = Array.from(localState.value || [])[i] || {};
|
31313
|
-
return /* @__PURE__ */ (0,
|
31605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31314
31606
|
Draggable,
|
31315
31607
|
{
|
31316
31608
|
id: _arrayId,
|
@@ -31321,8 +31613,8 @@ var ArrayField = ({
|
|
31321
31613
|
readOnly
|
31322
31614
|
}),
|
31323
31615
|
isDragDisabled: readOnly || !hovering,
|
31324
|
-
children: () => /* @__PURE__ */ (0,
|
31325
|
-
/* @__PURE__ */ (0,
|
31616
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
31617
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
31326
31618
|
"div",
|
31327
31619
|
{
|
31328
31620
|
onClick: () => {
|
@@ -31343,8 +31635,8 @@ var ArrayField = ({
|
|
31343
31635
|
className: getClassNameItem2("summary"),
|
31344
31636
|
children: [
|
31345
31637
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
31346
|
-
/* @__PURE__ */ (0,
|
31347
|
-
!readOnly && /* @__PURE__ */ (0,
|
31638
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
|
31639
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31348
31640
|
IconButton,
|
31349
31641
|
{
|
31350
31642
|
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
@@ -31366,20 +31658,20 @@ var ArrayField = ({
|
|
31366
31658
|
);
|
31367
31659
|
},
|
31368
31660
|
title: "Delete",
|
31369
|
-
children: /* @__PURE__ */ (0,
|
31661
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
|
31370
31662
|
}
|
31371
31663
|
) }) }),
|
31372
|
-
/* @__PURE__ */ (0,
|
31664
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
|
31373
31665
|
] })
|
31374
31666
|
]
|
31375
31667
|
}
|
31376
31668
|
),
|
31377
|
-
/* @__PURE__ */ (0,
|
31669
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
|
31378
31670
|
(fieldName) => {
|
31379
31671
|
const subField = field.arrayFields[fieldName];
|
31380
31672
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
31381
31673
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
31382
|
-
return /* @__PURE__ */ (0,
|
31674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31383
31675
|
InputOrGroup,
|
31384
31676
|
{
|
31385
31677
|
name: subFieldName,
|
@@ -31408,7 +31700,7 @@ var ArrayField = ({
|
|
31408
31700
|
);
|
31409
31701
|
}),
|
31410
31702
|
provided.placeholder,
|
31411
|
-
/* @__PURE__ */ (0,
|
31703
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
31412
31704
|
"button",
|
31413
31705
|
{
|
31414
31706
|
className: getClassName10("addButton"),
|
@@ -31422,7 +31714,7 @@ var ArrayField = ({
|
|
31422
31714
|
const newArrayState = regenerateArrayState(newValue);
|
31423
31715
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
31424
31716
|
},
|
31425
|
-
children: /* @__PURE__ */ (0,
|
31717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
|
31426
31718
|
}
|
31427
31719
|
)
|
31428
31720
|
]
|
@@ -31437,8 +31729,8 @@ var ArrayField = ({
|
|
31437
31729
|
|
31438
31730
|
// components/InputOrGroup/fields/DefaultField/index.tsx
|
31439
31731
|
init_react_import();
|
31440
|
-
var
|
31441
|
-
var getClassName11 = get_class_name_factory_default("Input",
|
31732
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
31733
|
+
var getClassName11 = get_class_name_factory_default("Input", styles_default9);
|
31442
31734
|
var DefaultField = ({
|
31443
31735
|
field,
|
31444
31736
|
onChange,
|
@@ -31448,16 +31740,16 @@ var DefaultField = ({
|
|
31448
31740
|
label,
|
31449
31741
|
id
|
31450
31742
|
}) => {
|
31451
|
-
return /* @__PURE__ */ (0,
|
31743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31452
31744
|
FieldLabelInternal,
|
31453
31745
|
{
|
31454
31746
|
label: label || name,
|
31455
|
-
icon: /* @__PURE__ */ (0,
|
31456
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
31457
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
31747
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
31748
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
|
31749
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Hash, { size: 16 })
|
31458
31750
|
] }),
|
31459
31751
|
readOnly,
|
31460
|
-
children: /* @__PURE__ */ (0,
|
31752
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
31461
31753
|
"input",
|
31462
31754
|
{
|
31463
31755
|
className: getClassName11("input"),
|
@@ -31485,42 +31777,72 @@ var DefaultField = ({
|
|
31485
31777
|
|
31486
31778
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
31487
31779
|
init_react_import();
|
31488
|
-
var
|
31780
|
+
var import_react18 = require("react");
|
31489
31781
|
|
31490
31782
|
// components/ExternalInput/index.tsx
|
31491
31783
|
init_react_import();
|
31492
|
-
var
|
31784
|
+
var import_react17 = require("react");
|
31493
31785
|
|
31494
|
-
//
|
31495
|
-
|
31496
|
-
|
31786
|
+
// components/ExternalInput/styles.module.css
|
31787
|
+
var styles_default11 = {
|
31788
|
+
"ExternalInput-actions": "styles_ExternalInput-actions",
|
31789
|
+
"ExternalInput-button": "styles_ExternalInput-button",
|
31790
|
+
"ExternalInput--dataSelected": "styles_ExternalInput--dataSelected",
|
31791
|
+
"ExternalInput-detachButton": "styles_ExternalInput-detachButton",
|
31792
|
+
ExternalInputModal: "styles_ExternalInputModal",
|
31793
|
+
"ExternalInputModal-grid": "styles_ExternalInputModal-grid",
|
31794
|
+
"ExternalInputModal--filtersToggled": "styles_ExternalInputModal--filtersToggled",
|
31795
|
+
"ExternalInputModal-filters": "styles_ExternalInputModal-filters",
|
31796
|
+
"ExternalInputModal-masthead": "styles_ExternalInputModal-masthead",
|
31797
|
+
"ExternalInputModal-tableWrapper": "styles_ExternalInputModal-tableWrapper",
|
31798
|
+
"ExternalInputModal-table": "styles_ExternalInputModal-table",
|
31799
|
+
"ExternalInputModal-thead": "styles_ExternalInputModal-thead",
|
31800
|
+
"ExternalInputModal-th": "styles_ExternalInputModal-th",
|
31801
|
+
"ExternalInputModal-td": "styles_ExternalInputModal-td",
|
31802
|
+
"ExternalInputModal-tr": "styles_ExternalInputModal-tr",
|
31803
|
+
"ExternalInputModal-tbody": "styles_ExternalInputModal-tbody",
|
31804
|
+
"ExternalInputModal--hasData": "styles_ExternalInputModal--hasData",
|
31805
|
+
"ExternalInputModal-loadingBanner": "styles_ExternalInputModal-loadingBanner",
|
31806
|
+
"ExternalInputModal--isLoading": "styles_ExternalInputModal--isLoading",
|
31807
|
+
"ExternalInputModal-searchForm": "styles_ExternalInputModal-searchForm",
|
31808
|
+
"ExternalInputModal-search": "styles_ExternalInputModal-search",
|
31809
|
+
"ExternalInputModal-searchIcon": "styles_ExternalInputModal-searchIcon",
|
31810
|
+
"ExternalInputModal-searchIconText": "styles_ExternalInputModal-searchIconText",
|
31811
|
+
"ExternalInputModal-searchInput": "styles_ExternalInputModal-searchInput",
|
31812
|
+
"ExternalInputModal-searchActions": "styles_ExternalInputModal-searchActions",
|
31813
|
+
"ExternalInputModal-searchActionIcon": "styles_ExternalInputModal-searchActionIcon",
|
31814
|
+
"ExternalInputModal-footer": "styles_ExternalInputModal-footer"
|
31815
|
+
};
|
31497
31816
|
|
31498
31817
|
// components/Modal/index.tsx
|
31499
31818
|
init_react_import();
|
31500
|
-
var
|
31819
|
+
var import_react16 = require("react");
|
31501
31820
|
|
31502
|
-
//
|
31503
|
-
|
31504
|
-
|
31821
|
+
// components/Modal/styles.module.css
|
31822
|
+
var styles_default12 = {
|
31823
|
+
Modal: "styles_Modal",
|
31824
|
+
"Modal--isOpen": "styles_Modal--isOpen",
|
31825
|
+
"Modal-inner": "styles_Modal-inner"
|
31826
|
+
};
|
31505
31827
|
|
31506
31828
|
// components/Modal/index.tsx
|
31507
31829
|
var import_react_dom = __toESM(require_react_dom());
|
31508
|
-
var
|
31509
|
-
var getClassName12 = get_class_name_factory_default("Modal",
|
31830
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
31831
|
+
var getClassName12 = get_class_name_factory_default("Modal", styles_default12);
|
31510
31832
|
var Modal = ({
|
31511
31833
|
children,
|
31512
31834
|
onClose,
|
31513
31835
|
isOpen
|
31514
31836
|
}) => {
|
31515
|
-
const [rootEl, setRootEl] = (0,
|
31516
|
-
(0,
|
31837
|
+
const [rootEl, setRootEl] = (0, import_react16.useState)(null);
|
31838
|
+
(0, import_react16.useEffect)(() => {
|
31517
31839
|
setRootEl(document.getElementById("puck-portal-root"));
|
31518
31840
|
}, []);
|
31519
31841
|
if (!rootEl) {
|
31520
|
-
return /* @__PURE__ */ (0,
|
31842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
|
31521
31843
|
}
|
31522
31844
|
return (0, import_react_dom.createPortal)(
|
31523
|
-
/* @__PURE__ */ (0,
|
31845
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
31524
31846
|
"div",
|
31525
31847
|
{
|
31526
31848
|
className: getClassName12("inner"),
|
@@ -31534,9 +31856,9 @@ var Modal = ({
|
|
31534
31856
|
|
31535
31857
|
// components/ExternalInput/index.tsx
|
31536
31858
|
var import_react_spinners5 = require("react-spinners");
|
31537
|
-
var
|
31538
|
-
var getClassName13 = get_class_name_factory_default("ExternalInput",
|
31539
|
-
var getClassNameModal = get_class_name_factory_default("ExternalInputModal",
|
31859
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
31860
|
+
var getClassName13 = get_class_name_factory_default("ExternalInput", styles_default11);
|
31861
|
+
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_default11);
|
31540
31862
|
var dataCache = {};
|
31541
31863
|
var ExternalInput = ({
|
31542
31864
|
field,
|
@@ -31550,16 +31872,16 @@ var ExternalInput = ({
|
|
31550
31872
|
mapRow = (val) => val,
|
31551
31873
|
filterFields
|
31552
31874
|
} = field || {};
|
31553
|
-
const [data, setData] = (0,
|
31554
|
-
const [isOpen, setOpen] = (0,
|
31555
|
-
const [isLoading, setIsLoading] = (0,
|
31875
|
+
const [data, setData] = (0, import_react17.useState)([]);
|
31876
|
+
const [isOpen, setOpen] = (0, import_react17.useState)(false);
|
31877
|
+
const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
|
31556
31878
|
const hasFilterFields = !!filterFields;
|
31557
|
-
const [filters, setFilters] = (0,
|
31558
|
-
const [filtersToggled, setFiltersToggled] = (0,
|
31559
|
-
const mappedData = (0,
|
31879
|
+
const [filters, setFilters] = (0, import_react17.useState)(field.initialFilters || {});
|
31880
|
+
const [filtersToggled, setFiltersToggled] = (0, import_react17.useState)(hasFilterFields);
|
31881
|
+
const mappedData = (0, import_react17.useMemo)(() => {
|
31560
31882
|
return data.map(mapRow);
|
31561
31883
|
}, [data]);
|
31562
|
-
const keys = (0,
|
31884
|
+
const keys = (0, import_react17.useMemo)(() => {
|
31563
31885
|
const validKeys = /* @__PURE__ */ new Set();
|
31564
31886
|
for (const item of mappedData) {
|
31565
31887
|
for (const key of Object.keys(item)) {
|
@@ -31570,8 +31892,8 @@ var ExternalInput = ({
|
|
31570
31892
|
}
|
31571
31893
|
return Array.from(validKeys);
|
31572
31894
|
}, [mappedData]);
|
31573
|
-
const [searchQuery, setSearchQuery] = (0,
|
31574
|
-
const search = (0,
|
31895
|
+
const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
|
31896
|
+
const search = (0, import_react17.useCallback)(
|
31575
31897
|
(query, filters2) => __async(void 0, null, function* () {
|
31576
31898
|
setIsLoading(true);
|
31577
31899
|
const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
|
@@ -31584,10 +31906,10 @@ var ExternalInput = ({
|
|
31584
31906
|
}),
|
31585
31907
|
[name, field]
|
31586
31908
|
);
|
31587
|
-
(0,
|
31909
|
+
(0, import_react17.useEffect)(() => {
|
31588
31910
|
search(searchQuery, filters);
|
31589
31911
|
}, []);
|
31590
|
-
return /* @__PURE__ */ (0,
|
31912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31591
31913
|
"div",
|
31592
31914
|
{
|
31593
31915
|
className: getClassName13({
|
@@ -31596,30 +31918,30 @@ var ExternalInput = ({
|
|
31596
31918
|
}),
|
31597
31919
|
id,
|
31598
31920
|
children: [
|
31599
|
-
/* @__PURE__ */ (0,
|
31600
|
-
/* @__PURE__ */ (0,
|
31921
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
|
31922
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31601
31923
|
"button",
|
31602
31924
|
{
|
31603
31925
|
onClick: () => setOpen(true),
|
31604
31926
|
className: getClassName13("button"),
|
31605
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
31606
|
-
/* @__PURE__ */ (0,
|
31607
|
-
/* @__PURE__ */ (0,
|
31927
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
31928
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Link, { size: "16" }),
|
31929
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: field.placeholder })
|
31608
31930
|
] })
|
31609
31931
|
}
|
31610
31932
|
),
|
31611
|
-
value && /* @__PURE__ */ (0,
|
31933
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31612
31934
|
"button",
|
31613
31935
|
{
|
31614
31936
|
className: getClassName13("detachButton"),
|
31615
31937
|
onClick: () => {
|
31616
31938
|
onChange(null);
|
31617
31939
|
},
|
31618
|
-
children: /* @__PURE__ */ (0,
|
31940
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
|
31619
31941
|
}
|
31620
31942
|
)
|
31621
31943
|
] }),
|
31622
|
-
/* @__PURE__ */ (0,
|
31944
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
31623
31945
|
"form",
|
31624
31946
|
{
|
31625
31947
|
className: getClassNameModal({
|
@@ -31633,11 +31955,11 @@ var ExternalInput = ({
|
|
31633
31955
|
search(searchQuery, filters);
|
31634
31956
|
},
|
31635
31957
|
children: [
|
31636
|
-
/* @__PURE__ */ (0,
|
31637
|
-
/* @__PURE__ */ (0,
|
31638
|
-
/* @__PURE__ */ (0,
|
31639
|
-
/* @__PURE__ */ (0,
|
31640
|
-
/* @__PURE__ */ (0,
|
31958
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
|
31959
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: getClassNameModal("search"), children: [
|
31960
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
31961
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Search, { size: "18" }) }),
|
31962
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31641
31963
|
"input",
|
31642
31964
|
{
|
31643
31965
|
className: getClassNameModal("searchInput"),
|
@@ -31652,9 +31974,9 @@ var ExternalInput = ({
|
|
31652
31974
|
}
|
31653
31975
|
)
|
31654
31976
|
] }),
|
31655
|
-
/* @__PURE__ */ (0,
|
31656
|
-
/* @__PURE__ */ (0,
|
31657
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
31977
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
|
31978
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
31979
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31658
31980
|
IconButton,
|
31659
31981
|
{
|
31660
31982
|
title: "Toggle filters",
|
@@ -31663,15 +31985,15 @@ var ExternalInput = ({
|
|
31663
31985
|
e.stopPropagation();
|
31664
31986
|
setFiltersToggled(!filtersToggled);
|
31665
31987
|
},
|
31666
|
-
children: /* @__PURE__ */ (0,
|
31988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
|
31667
31989
|
}
|
31668
31990
|
) })
|
31669
31991
|
] })
|
31670
|
-
] }) : /* @__PURE__ */ (0,
|
31671
|
-
/* @__PURE__ */ (0,
|
31672
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
31992
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
|
31993
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("grid"), children: [
|
31994
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
31673
31995
|
const filterField = filterFields[fieldName];
|
31674
|
-
return /* @__PURE__ */ (0,
|
31996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31675
31997
|
InputOrGroup,
|
31676
31998
|
{
|
31677
31999
|
field: filterField,
|
@@ -31688,9 +32010,9 @@ var ExternalInput = ({
|
|
31688
32010
|
fieldName
|
31689
32011
|
);
|
31690
32012
|
}) }),
|
31691
|
-
/* @__PURE__ */ (0,
|
31692
|
-
/* @__PURE__ */ (0,
|
31693
|
-
/* @__PURE__ */ (0,
|
32013
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
32014
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: getClassNameModal("table"), children: [
|
32015
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31694
32016
|
"th",
|
31695
32017
|
{
|
31696
32018
|
className: getClassNameModal("th"),
|
@@ -31699,8 +32021,8 @@ var ExternalInput = ({
|
|
31699
32021
|
},
|
31700
32022
|
key
|
31701
32023
|
)) }) }),
|
31702
|
-
/* @__PURE__ */ (0,
|
31703
|
-
return /* @__PURE__ */ (0,
|
32024
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
32025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
31704
32026
|
"tr",
|
31705
32027
|
{
|
31706
32028
|
style: { whiteSpace: "nowrap" },
|
@@ -31709,16 +32031,16 @@ var ExternalInput = ({
|
|
31709
32031
|
onChange(mapProp(data[i]));
|
31710
32032
|
setOpen(false);
|
31711
32033
|
},
|
31712
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
32034
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
31713
32035
|
},
|
31714
32036
|
i
|
31715
32037
|
);
|
31716
32038
|
}) })
|
31717
32039
|
] }),
|
31718
|
-
/* @__PURE__ */ (0,
|
32040
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
|
31719
32041
|
] })
|
31720
32042
|
] }),
|
31721
|
-
/* @__PURE__ */ (0,
|
32043
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
31722
32044
|
mappedData.length,
|
31723
32045
|
" result",
|
31724
32046
|
mappedData.length === 1 ? "" : "s"
|
@@ -31732,7 +32054,7 @@ var ExternalInput = ({
|
|
31732
32054
|
};
|
31733
32055
|
|
31734
32056
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
31735
|
-
var
|
32057
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
31736
32058
|
var ExternalField = ({
|
31737
32059
|
field,
|
31738
32060
|
onChange,
|
@@ -31744,7 +32066,7 @@ var ExternalField = ({
|
|
31744
32066
|
var _a, _b, _c;
|
31745
32067
|
const validField = field;
|
31746
32068
|
const deprecatedField = field;
|
31747
|
-
(0,
|
32069
|
+
(0, import_react18.useEffect)(() => {
|
31748
32070
|
if (deprecatedField.adaptor) {
|
31749
32071
|
console.error(
|
31750
32072
|
"Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
|
@@ -31754,13 +32076,13 @@ var ExternalField = ({
|
|
31754
32076
|
if (field.type !== "external") {
|
31755
32077
|
return null;
|
31756
32078
|
}
|
31757
|
-
return /* @__PURE__ */ (0,
|
32079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31758
32080
|
FieldLabelInternal,
|
31759
32081
|
{
|
31760
32082
|
label: label || name,
|
31761
|
-
icon: /* @__PURE__ */ (0,
|
32083
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
|
31762
32084
|
el: "div",
|
31763
|
-
children: /* @__PURE__ */ (0,
|
32085
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
31764
32086
|
ExternalInput,
|
31765
32087
|
{
|
31766
32088
|
name,
|
@@ -31786,8 +32108,8 @@ var ExternalField = ({
|
|
31786
32108
|
|
31787
32109
|
// components/InputOrGroup/fields/RadioField/index.tsx
|
31788
32110
|
init_react_import();
|
31789
|
-
var
|
31790
|
-
var getClassName14 = get_class_name_factory_default("Input",
|
32111
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
32112
|
+
var getClassName14 = get_class_name_factory_default("Input", styles_default9);
|
31791
32113
|
var RadioField = ({
|
31792
32114
|
field,
|
31793
32115
|
onChange,
|
@@ -31800,19 +32122,19 @@ var RadioField = ({
|
|
31800
32122
|
if (field.type !== "radio" || !field.options) {
|
31801
32123
|
return null;
|
31802
32124
|
}
|
31803
|
-
return /* @__PURE__ */ (0,
|
32125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31804
32126
|
FieldLabelInternal,
|
31805
32127
|
{
|
31806
|
-
icon: /* @__PURE__ */ (0,
|
32128
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
|
31807
32129
|
label: label || name,
|
31808
32130
|
readOnly,
|
31809
32131
|
el: "div",
|
31810
|
-
children: /* @__PURE__ */ (0,
|
32132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
31811
32133
|
"label",
|
31812
32134
|
{
|
31813
32135
|
className: getClassName14("radio"),
|
31814
32136
|
children: [
|
31815
|
-
/* @__PURE__ */ (0,
|
32137
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
31816
32138
|
"input",
|
31817
32139
|
{
|
31818
32140
|
type: "radio",
|
@@ -31830,7 +32152,7 @@ var RadioField = ({
|
|
31830
32152
|
defaultChecked: value === option.value
|
31831
32153
|
}
|
31832
32154
|
),
|
31833
|
-
/* @__PURE__ */ (0,
|
32155
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
|
31834
32156
|
]
|
31835
32157
|
},
|
31836
32158
|
option.label + option.value
|
@@ -31841,8 +32163,8 @@ var RadioField = ({
|
|
31841
32163
|
|
31842
32164
|
// components/InputOrGroup/fields/SelectField/index.tsx
|
31843
32165
|
init_react_import();
|
31844
|
-
var
|
31845
|
-
var getClassName15 = get_class_name_factory_default("Input",
|
32166
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
32167
|
+
var getClassName15 = get_class_name_factory_default("Input", styles_default9);
|
31846
32168
|
var SelectField = ({
|
31847
32169
|
field,
|
31848
32170
|
onChange,
|
@@ -31855,13 +32177,13 @@ var SelectField = ({
|
|
31855
32177
|
if (field.type !== "select" || !field.options) {
|
31856
32178
|
return null;
|
31857
32179
|
}
|
31858
|
-
return /* @__PURE__ */ (0,
|
32180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31859
32181
|
FieldLabelInternal,
|
31860
32182
|
{
|
31861
32183
|
label: label || name,
|
31862
|
-
icon: /* @__PURE__ */ (0,
|
32184
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
|
31863
32185
|
readOnly,
|
31864
|
-
children: /* @__PURE__ */ (0,
|
32186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31865
32187
|
"select",
|
31866
32188
|
{
|
31867
32189
|
id,
|
@@ -31875,7 +32197,7 @@ var SelectField = ({
|
|
31875
32197
|
onChange(e.currentTarget.value);
|
31876
32198
|
},
|
31877
32199
|
value,
|
31878
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
32200
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
31879
32201
|
"option",
|
31880
32202
|
{
|
31881
32203
|
label: option.label,
|
@@ -31891,8 +32213,8 @@ var SelectField = ({
|
|
31891
32213
|
|
31892
32214
|
// components/InputOrGroup/fields/TextareaField/index.tsx
|
31893
32215
|
init_react_import();
|
31894
|
-
var
|
31895
|
-
var getClassName16 = get_class_name_factory_default("Input",
|
32216
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
32217
|
+
var getClassName16 = get_class_name_factory_default("Input", styles_default9);
|
31896
32218
|
var TextareaField = ({
|
31897
32219
|
onChange,
|
31898
32220
|
readOnly,
|
@@ -31901,13 +32223,13 @@ var TextareaField = ({
|
|
31901
32223
|
label,
|
31902
32224
|
id
|
31903
32225
|
}) => {
|
31904
|
-
return /* @__PURE__ */ (0,
|
32226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31905
32227
|
FieldLabelInternal,
|
31906
32228
|
{
|
31907
32229
|
label: label || name,
|
31908
|
-
icon: /* @__PURE__ */ (0,
|
32230
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
|
31909
32231
|
readOnly,
|
31910
|
-
children: /* @__PURE__ */ (0,
|
32232
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
31911
32233
|
"textarea",
|
31912
32234
|
{
|
31913
32235
|
id,
|
@@ -31931,14 +32253,16 @@ var import_use_debounce2 = require("use-debounce");
|
|
31931
32253
|
// components/InputOrGroup/fields/ObjectField/index.tsx
|
31932
32254
|
init_react_import();
|
31933
32255
|
|
31934
|
-
//
|
31935
|
-
|
31936
|
-
|
32256
|
+
// components/InputOrGroup/fields/ObjectField/styles.module.css
|
32257
|
+
var styles_default13 = {
|
32258
|
+
ObjectField: "styles_ObjectField",
|
32259
|
+
"ObjectField-fieldset": "styles_ObjectField-fieldset"
|
32260
|
+
};
|
31937
32261
|
|
31938
32262
|
// components/InputOrGroup/fields/ObjectField/index.tsx
|
31939
|
-
var
|
31940
|
-
var getClassName17 = get_class_name_factory_default("ObjectField",
|
31941
|
-
var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem",
|
32263
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
32264
|
+
var getClassName17 = get_class_name_factory_default("ObjectField", styles_default13);
|
32265
|
+
var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_default13);
|
31942
32266
|
var ObjectField = ({
|
31943
32267
|
field,
|
31944
32268
|
onChange,
|
@@ -31953,18 +32277,18 @@ var ObjectField = ({
|
|
31953
32277
|
return null;
|
31954
32278
|
}
|
31955
32279
|
const data = value || {};
|
31956
|
-
return /* @__PURE__ */ (0,
|
32280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31957
32281
|
FieldLabelInternal,
|
31958
32282
|
{
|
31959
32283
|
label: label || name,
|
31960
|
-
icon: /* @__PURE__ */ (0,
|
32284
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
|
31961
32285
|
el: "div",
|
31962
32286
|
readOnly,
|
31963
|
-
children: /* @__PURE__ */ (0,
|
32287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
|
31964
32288
|
const subField = field.objectFields[fieldName];
|
31965
32289
|
const subFieldName = `${name}.${fieldName}`;
|
31966
32290
|
const wildcardFieldName = `${name}.${fieldName}`;
|
31967
|
-
return /* @__PURE__ */ (0,
|
32291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
31968
32292
|
InputOrGroup,
|
31969
32293
|
{
|
31970
32294
|
name: subFieldName,
|
@@ -31991,8 +32315,8 @@ var ObjectField = ({
|
|
31991
32315
|
};
|
31992
32316
|
|
31993
32317
|
// components/InputOrGroup/index.tsx
|
31994
|
-
var
|
31995
|
-
var getClassName18 = get_class_name_factory_default("Input",
|
32318
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
32319
|
+
var getClassName18 = get_class_name_factory_default("Input", styles_default9);
|
31996
32320
|
var FieldLabel = ({
|
31997
32321
|
children,
|
31998
32322
|
icon,
|
@@ -32002,11 +32326,11 @@ var FieldLabel = ({
|
|
32002
32326
|
className
|
32003
32327
|
}) => {
|
32004
32328
|
const El = el;
|
32005
|
-
return /* @__PURE__ */ (0,
|
32006
|
-
/* @__PURE__ */ (0,
|
32007
|
-
icon ? /* @__PURE__ */ (0,
|
32329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(El, { className, children: [
|
32330
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("label"), children: [
|
32331
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
|
32008
32332
|
label,
|
32009
|
-
readOnly && /* @__PURE__ */ (0,
|
32333
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Lock, { size: "12" }) })
|
32010
32334
|
] }),
|
32011
32335
|
children
|
32012
32336
|
] });
|
@@ -32019,11 +32343,11 @@ var FieldLabelInternal = ({
|
|
32019
32343
|
readOnly
|
32020
32344
|
}) => {
|
32021
32345
|
const { overrides } = useAppContext();
|
32022
|
-
const Wrapper = (0,
|
32346
|
+
const Wrapper = (0, import_react19.useMemo)(
|
32023
32347
|
() => overrides.fieldLabel || FieldLabel,
|
32024
32348
|
[overrides]
|
32025
32349
|
);
|
32026
|
-
return /* @__PURE__ */ (0,
|
32350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
32027
32351
|
Wrapper,
|
32028
32352
|
{
|
32029
32353
|
label,
|
@@ -32040,7 +32364,7 @@ var InputOrGroup = (_a) => {
|
|
32040
32364
|
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
32041
32365
|
const { overrides } = useAppContext();
|
32042
32366
|
const { name, field, value, readOnly } = props;
|
32043
|
-
const [localValue, setLocalValue] = (0,
|
32367
|
+
const [localValue, setLocalValue] = (0, import_react19.useState)(value);
|
32044
32368
|
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
32045
32369
|
(val, ui) => {
|
32046
32370
|
onChange(val, ui);
|
@@ -32048,11 +32372,11 @@ var InputOrGroup = (_a) => {
|
|
32048
32372
|
50,
|
32049
32373
|
{ leading: true }
|
32050
32374
|
);
|
32051
|
-
const onChangeLocal = (0,
|
32375
|
+
const onChangeLocal = (0, import_react19.useCallback)((val, ui) => {
|
32052
32376
|
setLocalValue(val);
|
32053
32377
|
onChangeDb(val, ui);
|
32054
32378
|
}, []);
|
32055
|
-
(0,
|
32379
|
+
(0, import_react19.useEffect)(() => {
|
32056
32380
|
setLocalValue(value);
|
32057
32381
|
}, [value]);
|
32058
32382
|
const localProps = {
|
@@ -32063,7 +32387,7 @@ var InputOrGroup = (_a) => {
|
|
32063
32387
|
if (!field.render) {
|
32064
32388
|
return null;
|
32065
32389
|
}
|
32066
|
-
return /* @__PURE__ */ (0,
|
32390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
|
32067
32391
|
field,
|
32068
32392
|
name,
|
32069
32393
|
readOnly
|
@@ -32092,17 +32416,19 @@ var InputOrGroup = (_a) => {
|
|
32092
32416
|
const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
|
32093
32417
|
const children = defaultFields[field.type](mergedProps);
|
32094
32418
|
const Render2 = render[field.type];
|
32095
|
-
return /* @__PURE__ */ (0,
|
32419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
32096
32420
|
};
|
32097
32421
|
|
32098
|
-
//
|
32099
|
-
|
32100
|
-
|
32422
|
+
// components/Puck/components/Fields/styles.module.css
|
32423
|
+
var styles_default14 = {
|
32424
|
+
PuckFields: "styles_PuckFields",
|
32425
|
+
"PuckFields-loadingOverlay": "styles_PuckFields-loadingOverlay"
|
32426
|
+
};
|
32101
32427
|
|
32102
32428
|
// components/Puck/components/Fields/index.tsx
|
32103
|
-
var
|
32104
|
-
var
|
32105
|
-
var getClassName19 = get_class_name_factory_default("PuckFields",
|
32429
|
+
var import_react20 = require("react");
|
32430
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
32431
|
+
var getClassName19 = get_class_name_factory_default("PuckFields", styles_default14);
|
32106
32432
|
var defaultPageFields = {
|
32107
32433
|
title: { type: "text" }
|
32108
32434
|
};
|
@@ -32110,9 +32436,9 @@ var DefaultFields = ({
|
|
32110
32436
|
children,
|
32111
32437
|
isLoading
|
32112
32438
|
}) => {
|
32113
|
-
return /* @__PURE__ */ (0,
|
32439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
|
32114
32440
|
children,
|
32115
|
-
isLoading && /* @__PURE__ */ (0,
|
32441
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
|
32116
32442
|
] });
|
32117
32443
|
};
|
32118
32444
|
var Fields = () => {
|
@@ -32132,15 +32458,15 @@ var Fields = () => {
|
|
32132
32458
|
const fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
32133
32459
|
const isLoading = selectedItem ? (_c = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _c.loading : (_d = componentState["puck-root"]) == null ? void 0 : _d.loading;
|
32134
32460
|
const rootProps = data.root.props || data.root;
|
32135
|
-
const Wrapper = (0,
|
32136
|
-
return /* @__PURE__ */ (0,
|
32461
|
+
const Wrapper = (0, import_react20.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
32462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32137
32463
|
"form",
|
32138
32464
|
{
|
32139
32465
|
className: getClassName19(),
|
32140
32466
|
onSubmit: (e) => {
|
32141
32467
|
e.preventDefault();
|
32142
32468
|
},
|
32143
|
-
children: /* @__PURE__ */ (0,
|
32469
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
32144
32470
|
const field = fields[fieldName];
|
32145
32471
|
const onChange = (value, updatedUi) => {
|
32146
32472
|
var _a2, _b2;
|
@@ -32206,7 +32532,7 @@ var Fields = () => {
|
|
32206
32532
|
};
|
32207
32533
|
if (selectedItem && itemSelector) {
|
32208
32534
|
const { readOnly = {} } = selectedItem;
|
32209
|
-
return /* @__PURE__ */ (0,
|
32535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32210
32536
|
InputOrGroup,
|
32211
32537
|
{
|
32212
32538
|
field,
|
@@ -32222,7 +32548,7 @@ var Fields = () => {
|
|
32222
32548
|
);
|
32223
32549
|
} else {
|
32224
32550
|
const { readOnly = {} } = data.root;
|
32225
|
-
return /* @__PURE__ */ (0,
|
32551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
32226
32552
|
InputOrGroup,
|
32227
32553
|
{
|
32228
32554
|
field,
|
@@ -32247,25 +32573,30 @@ init_react_import();
|
|
32247
32573
|
|
32248
32574
|
// lib/use-component-list.tsx
|
32249
32575
|
init_react_import();
|
32250
|
-
var
|
32576
|
+
var import_react21 = require("react");
|
32251
32577
|
|
32252
32578
|
// components/ComponentList/index.tsx
|
32253
32579
|
init_react_import();
|
32254
32580
|
|
32255
|
-
//
|
32256
|
-
|
32257
|
-
|
32581
|
+
// components/ComponentList/styles.module.css
|
32582
|
+
var styles_default15 = {
|
32583
|
+
ComponentList: "styles_ComponentList",
|
32584
|
+
"ComponentList--isExpanded": "styles_ComponentList--isExpanded",
|
32585
|
+
"ComponentList-content": "styles_ComponentList-content",
|
32586
|
+
"ComponentList-title": "styles_ComponentList-title",
|
32587
|
+
"ComponentList-titleIcon": "styles_ComponentList-titleIcon"
|
32588
|
+
};
|
32258
32589
|
|
32259
32590
|
// components/ComponentList/index.tsx
|
32260
|
-
var
|
32261
|
-
var getClassName20 = get_class_name_factory_default("ComponentList",
|
32591
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
32592
|
+
var getClassName20 = get_class_name_factory_default("ComponentList", styles_default15);
|
32262
32593
|
var ComponentListItem = ({
|
32263
32594
|
name,
|
32264
32595
|
label,
|
32265
32596
|
index
|
32266
32597
|
}) => {
|
32267
32598
|
const { overrides } = useAppContext();
|
32268
|
-
return /* @__PURE__ */ (0,
|
32599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
|
32269
32600
|
};
|
32270
32601
|
var ComponentList = ({
|
32271
32602
|
children,
|
@@ -32274,8 +32605,8 @@ var ComponentList = ({
|
|
32274
32605
|
}) => {
|
32275
32606
|
const { config, state, setUi } = useAppContext();
|
32276
32607
|
const { expanded = true } = state.ui.componentList[id] || {};
|
32277
|
-
return /* @__PURE__ */ (0,
|
32278
|
-
title && /* @__PURE__ */ (0,
|
32608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
|
32609
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
32279
32610
|
"button",
|
32280
32611
|
{
|
32281
32612
|
className: getClassName20("title"),
|
@@ -32288,14 +32619,14 @@ var ComponentList = ({
|
|
32288
32619
|
}),
|
32289
32620
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
32290
32621
|
children: [
|
32291
|
-
/* @__PURE__ */ (0,
|
32292
|
-
/* @__PURE__ */ (0,
|
32622
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: title }),
|
32623
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronDown, { size: 12 }) })
|
32293
32624
|
]
|
32294
32625
|
}
|
32295
32626
|
),
|
32296
|
-
/* @__PURE__ */ (0,
|
32627
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
|
32297
32628
|
var _a;
|
32298
|
-
return /* @__PURE__ */ (0,
|
32629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
32299
32630
|
ComponentListItem,
|
32300
32631
|
{
|
32301
32632
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -32310,10 +32641,10 @@ var ComponentList = ({
|
|
32310
32641
|
ComponentList.Item = ComponentListItem;
|
32311
32642
|
|
32312
32643
|
// lib/use-component-list.tsx
|
32313
|
-
var
|
32644
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
32314
32645
|
var useComponentList = (config, ui) => {
|
32315
|
-
const [componentList, setComponentList] = (0,
|
32316
|
-
(0,
|
32646
|
+
const [componentList, setComponentList] = (0, import_react21.useState)();
|
32647
|
+
(0, import_react21.useEffect)(() => {
|
32317
32648
|
var _a, _b, _c;
|
32318
32649
|
if (Object.keys(ui.componentList).length > 0) {
|
32319
32650
|
const matchedComponents = [];
|
@@ -32323,7 +32654,7 @@ var useComponentList = (config, ui) => {
|
|
32323
32654
|
if (category.visible === false || !category.components) {
|
32324
32655
|
return null;
|
32325
32656
|
}
|
32326
|
-
return /* @__PURE__ */ (0,
|
32657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32327
32658
|
ComponentList,
|
32328
32659
|
{
|
32329
32660
|
id: categoryKey,
|
@@ -32331,7 +32662,7 @@ var useComponentList = (config, ui) => {
|
|
32331
32662
|
children: category.components.map((componentName, i) => {
|
32332
32663
|
var _a2;
|
32333
32664
|
matchedComponents.push(componentName);
|
32334
|
-
return /* @__PURE__ */ (0,
|
32665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32335
32666
|
ComponentList.Item,
|
32336
32667
|
{
|
32337
32668
|
label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
|
@@ -32351,14 +32682,14 @@ var useComponentList = (config, ui) => {
|
|
32351
32682
|
);
|
32352
32683
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
32353
32684
|
_componentList.push(
|
32354
|
-
/* @__PURE__ */ (0,
|
32685
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32355
32686
|
ComponentList,
|
32356
32687
|
{
|
32357
32688
|
id: "other",
|
32358
32689
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
32359
32690
|
children: remainingComponents.map((componentName, i) => {
|
32360
32691
|
var _a2;
|
32361
|
-
return /* @__PURE__ */ (0,
|
32692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
32362
32693
|
ComponentList.Item,
|
32363
32694
|
{
|
32364
32695
|
name: componentName,
|
@@ -32380,22 +32711,32 @@ var useComponentList = (config, ui) => {
|
|
32380
32711
|
};
|
32381
32712
|
|
32382
32713
|
// components/Puck/components/Components/index.tsx
|
32383
|
-
var
|
32384
|
-
var
|
32714
|
+
var import_react22 = require("react");
|
32715
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
32385
32716
|
var Components = () => {
|
32386
32717
|
const { config, state, overrides } = useAppContext();
|
32387
32718
|
const componentList = useComponentList(config, state.ui);
|
32388
|
-
const Wrapper = (0,
|
32389
|
-
return /* @__PURE__ */ (0,
|
32719
|
+
const Wrapper = (0, import_react22.useMemo)(() => overrides.components || "div", [overrides]);
|
32720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
|
32390
32721
|
};
|
32391
32722
|
|
32392
32723
|
// components/Puck/components/Preview/index.tsx
|
32393
32724
|
init_react_import();
|
32394
|
-
var
|
32395
|
-
var
|
32725
|
+
var import_react23 = require("react");
|
32726
|
+
var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
|
32727
|
+
|
32728
|
+
// components/Puck/components/Preview/styles.module.css
|
32729
|
+
var styles_default16 = {
|
32730
|
+
PuckPreview: "styles_PuckPreview",
|
32731
|
+
"PuckPreview-frame": "styles_PuckPreview-frame"
|
32732
|
+
};
|
32733
|
+
|
32734
|
+
// components/Puck/components/Preview/index.tsx
|
32735
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
32736
|
+
var getClassName21 = get_class_name_factory_default("PuckPreview", styles_default16);
|
32396
32737
|
var Preview = ({ id = "puck-preview" }) => {
|
32397
|
-
const { config, dispatch, state } = useAppContext();
|
32398
|
-
const Page = (0,
|
32738
|
+
const { config, dispatch, state, setStatus, iframe } = useAppContext();
|
32739
|
+
const Page = (0, import_react23.useCallback)(
|
32399
32740
|
(pageProps) => {
|
32400
32741
|
var _a, _b;
|
32401
32742
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({}, pageProps), { editMode: true })) : pageProps.children;
|
@@ -32403,16 +32744,28 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32403
32744
|
[config.root]
|
32404
32745
|
);
|
32405
32746
|
const rootProps = state.data.root.props || state.data.root;
|
32406
|
-
const
|
32407
|
-
return /* @__PURE__ */ (0,
|
32747
|
+
const ref = (0, import_react23.useRef)(null);
|
32748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32408
32749
|
"div",
|
32409
32750
|
{
|
32751
|
+
className: getClassName21(),
|
32410
32752
|
id,
|
32411
32753
|
onClick: () => {
|
32412
32754
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32413
32755
|
},
|
32414
|
-
|
32415
|
-
|
32756
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32757
|
+
import_auto_frame_component.default,
|
32758
|
+
{
|
32759
|
+
id: "preview-frame",
|
32760
|
+
className: getClassName21("frame"),
|
32761
|
+
"data-rfd-iframe": true,
|
32762
|
+
ref,
|
32763
|
+
onStylesLoaded: () => {
|
32764
|
+
setStatus("READY");
|
32765
|
+
},
|
32766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
|
32767
|
+
}
|
32768
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) })) })
|
32416
32769
|
}
|
32417
32770
|
);
|
32418
32771
|
};
|
@@ -32444,9 +32797,24 @@ var areaContainsZones = (data, area) => {
|
|
32444
32797
|
// components/LayerTree/index.tsx
|
32445
32798
|
init_react_import();
|
32446
32799
|
|
32447
|
-
//
|
32448
|
-
|
32449
|
-
|
32800
|
+
// components/LayerTree/styles.module.css
|
32801
|
+
var styles_default17 = {
|
32802
|
+
LayerTree: "styles_LayerTree",
|
32803
|
+
"LayerTree-zoneTitle": "styles_LayerTree-zoneTitle",
|
32804
|
+
"LayerTree-helper": "styles_LayerTree-helper",
|
32805
|
+
Layer: "styles_Layer",
|
32806
|
+
"Layer-inner": "styles_Layer-inner",
|
32807
|
+
"Layer--containsZone": "styles_Layer--containsZone",
|
32808
|
+
"Layer-clickable": "styles_Layer-clickable",
|
32809
|
+
"Layer--isSelected": "styles_Layer--isSelected",
|
32810
|
+
"Layer-chevron": "styles_Layer-chevron",
|
32811
|
+
"Layer--childIsSelected": "styles_Layer--childIsSelected",
|
32812
|
+
"Layer-zones": "styles_Layer-zones",
|
32813
|
+
"Layer-title": "styles_Layer-title",
|
32814
|
+
"Layer-name": "styles_Layer-name",
|
32815
|
+
"Layer-icon": "styles_Layer-icon",
|
32816
|
+
"Layer-zoneIcon": "styles_Layer-zoneIcon"
|
32817
|
+
};
|
32450
32818
|
|
32451
32819
|
// lib/scroll-into-view.ts
|
32452
32820
|
init_react_import();
|
@@ -32460,7 +32828,7 @@ var scrollIntoView = (el) => {
|
|
32460
32828
|
};
|
32461
32829
|
|
32462
32830
|
// components/LayerTree/index.tsx
|
32463
|
-
var
|
32831
|
+
var import_react24 = require("react");
|
32464
32832
|
|
32465
32833
|
// lib/is-child-of-zone.ts
|
32466
32834
|
init_react_import();
|
@@ -32474,9 +32842,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32474
32842
|
};
|
32475
32843
|
|
32476
32844
|
// components/LayerTree/index.tsx
|
32477
|
-
var
|
32478
|
-
var
|
32479
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
32845
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32846
|
+
var getClassName22 = get_class_name_factory_default("LayerTree", styles_default17);
|
32847
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_default17);
|
32480
32848
|
var LayerTree = ({
|
32481
32849
|
data,
|
32482
32850
|
config,
|
@@ -32487,15 +32855,16 @@ var LayerTree = ({
|
|
32487
32855
|
label
|
32488
32856
|
}) => {
|
32489
32857
|
const zones = data.zones || {};
|
32490
|
-
const ctx = (0,
|
32491
|
-
|
32492
|
-
|
32493
|
-
|
32858
|
+
const ctx = (0, import_react24.useContext)(dropZoneContext);
|
32859
|
+
const frame = useFrame();
|
32860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
32861
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
|
32862
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
|
32494
32863
|
" ",
|
32495
32864
|
label
|
32496
32865
|
] }),
|
32497
|
-
/* @__PURE__ */ (0,
|
32498
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32866
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
|
32867
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
|
32499
32868
|
zoneContent.map((item, i) => {
|
32500
32869
|
var _a;
|
32501
32870
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -32511,7 +32880,7 @@ var LayerTree = ({
|
|
32511
32880
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
32512
32881
|
const isHovering = hoveringComponent === item.props.id;
|
32513
32882
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32514
|
-
return /* @__PURE__ */ (0,
|
32883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32515
32884
|
"li",
|
32516
32885
|
{
|
32517
32886
|
className: getClassNameLayer({
|
@@ -32521,7 +32890,7 @@ var LayerTree = ({
|
|
32521
32890
|
childIsSelected
|
32522
32891
|
}),
|
32523
32892
|
children: [
|
32524
|
-
/* @__PURE__ */ (0,
|
32893
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
32525
32894
|
"button",
|
32526
32895
|
{
|
32527
32896
|
className: getClassNameLayer("clickable"),
|
@@ -32536,7 +32905,7 @@ var LayerTree = ({
|
|
32536
32905
|
});
|
32537
32906
|
const id = zoneContent[i].props.id;
|
32538
32907
|
scrollIntoView(
|
32539
|
-
|
32908
|
+
frame == null ? void 0 : frame.querySelector(
|
32540
32909
|
`[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
|
32541
32910
|
)
|
32542
32911
|
);
|
@@ -32552,22 +32921,22 @@ var LayerTree = ({
|
|
32552
32921
|
setHoveringComponent(null);
|
32553
32922
|
},
|
32554
32923
|
children: [
|
32555
|
-
containsZone && /* @__PURE__ */ (0,
|
32924
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32556
32925
|
"div",
|
32557
32926
|
{
|
32558
32927
|
className: getClassNameLayer("chevron"),
|
32559
32928
|
title: isSelected ? "Collapse" : "Expand",
|
32560
|
-
children: /* @__PURE__ */ (0,
|
32929
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
|
32561
32930
|
}
|
32562
32931
|
),
|
32563
|
-
/* @__PURE__ */ (0,
|
32564
|
-
/* @__PURE__ */ (0,
|
32565
|
-
/* @__PURE__ */ (0,
|
32932
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
32933
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayoutGrid, { size: "16" }) }),
|
32934
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
|
32566
32935
|
] })
|
32567
32936
|
]
|
32568
32937
|
}
|
32569
32938
|
) }),
|
32570
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
32939
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32571
32940
|
LayerTree,
|
32572
32941
|
{
|
32573
32942
|
config,
|
@@ -32589,13 +32958,13 @@ var LayerTree = ({
|
|
32589
32958
|
};
|
32590
32959
|
|
32591
32960
|
// components/Puck/components/Outline/index.tsx
|
32592
|
-
var
|
32593
|
-
var
|
32961
|
+
var import_react25 = require("react");
|
32962
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32594
32963
|
var Outline = () => {
|
32595
32964
|
const { dispatch, state, overrides, config } = useAppContext();
|
32596
32965
|
const { data, ui } = state;
|
32597
32966
|
const { itemSelector } = ui;
|
32598
|
-
const setItemSelector = (0,
|
32967
|
+
const setItemSelector = (0, import_react25.useCallback)(
|
32599
32968
|
(newItemSelector) => {
|
32600
32969
|
dispatch({
|
32601
32970
|
type: "setUi",
|
@@ -32604,9 +32973,9 @@ var Outline = () => {
|
|
32604
32973
|
},
|
32605
32974
|
[]
|
32606
32975
|
);
|
32607
|
-
const Wrapper = (0,
|
32608
|
-
return /* @__PURE__ */ (0,
|
32609
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
32976
|
+
const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
|
32977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
32978
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32610
32979
|
LayerTree,
|
32611
32980
|
{
|
32612
32981
|
config,
|
@@ -32619,7 +32988,7 @@ var Outline = () => {
|
|
32619
32988
|
),
|
32620
32989
|
Object.entries(findZonesForArea(data, "root")).map(
|
32621
32990
|
([zoneKey, zone]) => {
|
32622
|
-
return /* @__PURE__ */ (0,
|
32991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32623
32992
|
LayerTree,
|
32624
32993
|
{
|
32625
32994
|
config,
|
@@ -32704,12 +33073,12 @@ function usePuckHistory({
|
|
32704
33073
|
|
32705
33074
|
// lib/use-history-store.ts
|
32706
33075
|
init_react_import();
|
32707
|
-
var
|
33076
|
+
var import_react26 = require("react");
|
32708
33077
|
var import_use_debounce3 = require("use-debounce");
|
32709
33078
|
var EMPTY_HISTORY_INDEX = -1;
|
32710
33079
|
function useHistoryStore() {
|
32711
|
-
const [histories, setHistories] = (0,
|
32712
|
-
const [index, setIndex] = (0,
|
33080
|
+
const [histories, setHistories] = (0, import_react26.useState)([]);
|
33081
|
+
const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
|
32713
33082
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
32714
33083
|
const hasFuture = index < histories.length - 1;
|
32715
33084
|
const currentHistory = histories[index];
|
@@ -32746,14 +33115,441 @@ function useHistoryStore() {
|
|
32746
33115
|
};
|
32747
33116
|
}
|
32748
33117
|
|
33118
|
+
// components/Puck/components/Canvas/index.tsx
|
33119
|
+
init_react_import();
|
33120
|
+
|
33121
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
33122
|
+
init_react_import();
|
33123
|
+
|
33124
|
+
// ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
33125
|
+
init_react_import();
|
33126
|
+
var isProduction = process.env.NODE_ENV === "production";
|
33127
|
+
var prefix = "Invariant failed";
|
33128
|
+
function invariant(condition, message) {
|
33129
|
+
if (condition) {
|
33130
|
+
return;
|
33131
|
+
}
|
33132
|
+
if (isProduction) {
|
33133
|
+
throw new Error(prefix);
|
33134
|
+
}
|
33135
|
+
var provided = typeof message === "function" ? message() : message;
|
33136
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
33137
|
+
throw new Error(value);
|
33138
|
+
}
|
33139
|
+
|
33140
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
33141
|
+
var getRect = function getRect2(_ref) {
|
33142
|
+
var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
|
33143
|
+
var width = right - left;
|
33144
|
+
var height = bottom - top;
|
33145
|
+
var rect = {
|
33146
|
+
top,
|
33147
|
+
right,
|
33148
|
+
bottom,
|
33149
|
+
left,
|
33150
|
+
width,
|
33151
|
+
height,
|
33152
|
+
x: left,
|
33153
|
+
y: top,
|
33154
|
+
center: {
|
33155
|
+
x: (right + left) / 2,
|
33156
|
+
y: (bottom + top) / 2
|
33157
|
+
}
|
33158
|
+
};
|
33159
|
+
return rect;
|
33160
|
+
};
|
33161
|
+
var expand = function expand2(target, expandBy) {
|
33162
|
+
return {
|
33163
|
+
top: target.top - expandBy.top,
|
33164
|
+
left: target.left - expandBy.left,
|
33165
|
+
bottom: target.bottom + expandBy.bottom,
|
33166
|
+
right: target.right + expandBy.right
|
33167
|
+
};
|
33168
|
+
};
|
33169
|
+
var shrink = function shrink2(target, shrinkBy) {
|
33170
|
+
return {
|
33171
|
+
top: target.top + shrinkBy.top,
|
33172
|
+
left: target.left + shrinkBy.left,
|
33173
|
+
bottom: target.bottom - shrinkBy.bottom,
|
33174
|
+
right: target.right - shrinkBy.right
|
33175
|
+
};
|
33176
|
+
};
|
33177
|
+
var noSpacing = {
|
33178
|
+
top: 0,
|
33179
|
+
right: 0,
|
33180
|
+
bottom: 0,
|
33181
|
+
left: 0
|
33182
|
+
};
|
33183
|
+
var createBox = function createBox2(_ref2) {
|
33184
|
+
var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
|
33185
|
+
var marginBox = getRect(expand(borderBox, margin));
|
33186
|
+
var paddingBox = getRect(shrink(borderBox, border));
|
33187
|
+
var contentBox = getRect(shrink(paddingBox, padding));
|
33188
|
+
return {
|
33189
|
+
marginBox,
|
33190
|
+
borderBox: getRect(borderBox),
|
33191
|
+
paddingBox,
|
33192
|
+
contentBox,
|
33193
|
+
margin,
|
33194
|
+
border,
|
33195
|
+
padding
|
33196
|
+
};
|
33197
|
+
};
|
33198
|
+
var parse = function parse2(raw) {
|
33199
|
+
var value = raw.slice(0, -2);
|
33200
|
+
var suffix = raw.slice(-2);
|
33201
|
+
if (suffix !== "px") {
|
33202
|
+
return 0;
|
33203
|
+
}
|
33204
|
+
var result = Number(value);
|
33205
|
+
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
33206
|
+
return result;
|
33207
|
+
};
|
33208
|
+
var calculateBox = function calculateBox2(borderBox, styles) {
|
33209
|
+
var margin = {
|
33210
|
+
top: parse(styles.marginTop),
|
33211
|
+
right: parse(styles.marginRight),
|
33212
|
+
bottom: parse(styles.marginBottom),
|
33213
|
+
left: parse(styles.marginLeft)
|
33214
|
+
};
|
33215
|
+
var padding = {
|
33216
|
+
top: parse(styles.paddingTop),
|
33217
|
+
right: parse(styles.paddingRight),
|
33218
|
+
bottom: parse(styles.paddingBottom),
|
33219
|
+
left: parse(styles.paddingLeft)
|
33220
|
+
};
|
33221
|
+
var border = {
|
33222
|
+
top: parse(styles.borderTopWidth),
|
33223
|
+
right: parse(styles.borderRightWidth),
|
33224
|
+
bottom: parse(styles.borderBottomWidth),
|
33225
|
+
left: parse(styles.borderLeftWidth)
|
33226
|
+
};
|
33227
|
+
return createBox({
|
33228
|
+
borderBox,
|
33229
|
+
margin,
|
33230
|
+
padding,
|
33231
|
+
border
|
33232
|
+
});
|
33233
|
+
};
|
33234
|
+
var getBox = function getBox2(el) {
|
33235
|
+
var borderBox = el.getBoundingClientRect();
|
33236
|
+
var styles = window.getComputedStyle(el);
|
33237
|
+
return calculateBox(borderBox, styles);
|
33238
|
+
};
|
33239
|
+
|
33240
|
+
// components/Puck/components/Canvas/index.tsx
|
33241
|
+
var import_react28 = require("react");
|
33242
|
+
|
33243
|
+
// components/ViewportControls/index.tsx
|
33244
|
+
init_react_import();
|
33245
|
+
var import_react27 = require("react");
|
33246
|
+
|
33247
|
+
// components/ViewportControls/styles.module.css
|
33248
|
+
var styles_default18 = {
|
33249
|
+
ViewportControls: "styles_ViewportControls",
|
33250
|
+
"ViewportControls-divider": "styles_ViewportControls-divider",
|
33251
|
+
"ViewportControls-zoomSelect": "styles_ViewportControls-zoomSelect",
|
33252
|
+
"ViewportButton--isActive": "styles_ViewportButton--isActive",
|
33253
|
+
"ViewportButton-inner": "styles_ViewportButton-inner"
|
33254
|
+
};
|
33255
|
+
|
33256
|
+
// components/ViewportControls/index.tsx
|
33257
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
33258
|
+
var icons = {
|
33259
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
|
33260
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
|
33261
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
|
33262
|
+
};
|
33263
|
+
var getClassName23 = get_class_name_factory_default("ViewportControls", styles_default18);
|
33264
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_default18);
|
33265
|
+
var ViewportButton = ({
|
33266
|
+
children,
|
33267
|
+
height = "auto",
|
33268
|
+
title,
|
33269
|
+
width,
|
33270
|
+
onClick
|
33271
|
+
}) => {
|
33272
|
+
const { state } = useAppContext();
|
33273
|
+
const [isActive, setIsActive] = (0, import_react27.useState)(false);
|
33274
|
+
(0, import_react27.useEffect)(() => {
|
33275
|
+
setIsActive(width === state.ui.viewports.current.width);
|
33276
|
+
}, [width, state.ui.viewports.current.width]);
|
33277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33278
|
+
IconButton,
|
33279
|
+
{
|
33280
|
+
title,
|
33281
|
+
disabled: isActive,
|
33282
|
+
onClick: (e) => {
|
33283
|
+
e.stopPropagation();
|
33284
|
+
onClick({ width, height });
|
33285
|
+
},
|
33286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
|
33287
|
+
}
|
33288
|
+
) });
|
33289
|
+
};
|
33290
|
+
var defaultZoomOptions = [
|
33291
|
+
{ label: "25%", value: 0.25 },
|
33292
|
+
{ label: "50%", value: 0.5 },
|
33293
|
+
{ label: "75%", value: 0.75 },
|
33294
|
+
{ label: "100%", value: 1 },
|
33295
|
+
{ label: "125%", value: 1.25 },
|
33296
|
+
{ label: "150%", value: 1.5 },
|
33297
|
+
{ label: "200%", value: 2 }
|
33298
|
+
];
|
33299
|
+
var ViewportControls = ({
|
33300
|
+
autoZoom,
|
33301
|
+
zoom,
|
33302
|
+
onViewportChange,
|
33303
|
+
onZoom
|
33304
|
+
}) => {
|
33305
|
+
const { viewports } = useAppContext();
|
33306
|
+
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
33307
|
+
(option) => option.value === autoZoom
|
33308
|
+
);
|
33309
|
+
const zoomOptions = (0, import_react27.useMemo)(
|
33310
|
+
() => [
|
33311
|
+
...defaultZoomOptions,
|
33312
|
+
...defaultsContainAutoZoom ? [] : [
|
33313
|
+
{
|
33314
|
+
value: autoZoom,
|
33315
|
+
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
33316
|
+
}
|
33317
|
+
]
|
33318
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
33319
|
+
[autoZoom]
|
33320
|
+
);
|
33321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
|
33322
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33323
|
+
ViewportButton,
|
33324
|
+
{
|
33325
|
+
height: viewport.height,
|
33326
|
+
width: viewport.width,
|
33327
|
+
title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
|
33328
|
+
onClick: onViewportChange,
|
33329
|
+
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
33330
|
+
},
|
33331
|
+
i
|
33332
|
+
)),
|
33333
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
|
33334
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33335
|
+
IconButton,
|
33336
|
+
{
|
33337
|
+
title: "Zoom viewport out",
|
33338
|
+
disabled: zoom <= zoomOptions[0].value,
|
33339
|
+
onClick: (e) => {
|
33340
|
+
e.stopPropagation();
|
33341
|
+
onZoom(
|
33342
|
+
zoomOptions[Math.max(
|
33343
|
+
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
33344
|
+
0
|
33345
|
+
)].value
|
33346
|
+
);
|
33347
|
+
},
|
33348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
|
33349
|
+
}
|
33350
|
+
),
|
33351
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33352
|
+
IconButton,
|
33353
|
+
{
|
33354
|
+
title: "Zoom viewport in",
|
33355
|
+
disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
|
33356
|
+
onClick: (e) => {
|
33357
|
+
e.stopPropagation();
|
33358
|
+
onZoom(
|
33359
|
+
zoomOptions[Math.min(
|
33360
|
+
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
33361
|
+
zoomOptions.length - 1
|
33362
|
+
)].value
|
33363
|
+
);
|
33364
|
+
},
|
33365
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
|
33366
|
+
}
|
33367
|
+
),
|
33368
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
|
33369
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33370
|
+
"select",
|
33371
|
+
{
|
33372
|
+
className: getClassName23("zoomSelect"),
|
33373
|
+
value: zoom.toString(),
|
33374
|
+
onChange: (e) => {
|
33375
|
+
onZoom(parseFloat(e.currentTarget.value));
|
33376
|
+
},
|
33377
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
33378
|
+
"option",
|
33379
|
+
{
|
33380
|
+
value: option.value,
|
33381
|
+
label: option.label
|
33382
|
+
},
|
33383
|
+
option.label
|
33384
|
+
))
|
33385
|
+
}
|
33386
|
+
)
|
33387
|
+
] });
|
33388
|
+
};
|
33389
|
+
|
33390
|
+
// components/Puck/components/Canvas/styles.module.css
|
33391
|
+
var styles_default19 = {
|
33392
|
+
PuckCanvas: "styles_PuckCanvas",
|
33393
|
+
"PuckCanvas-controls": "styles_PuckCanvas-controls",
|
33394
|
+
"PuckCanvas-inner": "styles_PuckCanvas-inner",
|
33395
|
+
"PuckCanvas-root": "styles_PuckCanvas-root",
|
33396
|
+
"PuckCanvas--ready": "styles_PuckCanvas--ready"
|
33397
|
+
};
|
33398
|
+
|
33399
|
+
// lib/get-zoom-config.ts
|
33400
|
+
init_react_import();
|
33401
|
+
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
33402
|
+
var getZoomConfig = (uiViewport, frame, zoom) => {
|
33403
|
+
const box = getBox(frame);
|
33404
|
+
const { width: frameWidth, height: frameHeight } = box.contentBox;
|
33405
|
+
const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
|
33406
|
+
let rootHeight = 0;
|
33407
|
+
let autoZoom = 1;
|
33408
|
+
if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
|
33409
|
+
const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
|
33410
|
+
const heightZoom = Math.min(frameHeight / viewportHeight, 1);
|
33411
|
+
zoom = widthZoom;
|
33412
|
+
if (widthZoom < heightZoom) {
|
33413
|
+
rootHeight = viewportHeight / zoom;
|
33414
|
+
} else {
|
33415
|
+
rootHeight = viewportHeight;
|
33416
|
+
zoom = heightZoom;
|
33417
|
+
}
|
33418
|
+
autoZoom = zoom;
|
33419
|
+
} else {
|
33420
|
+
if (RESET_ZOOM_SMALLER_THAN_FRAME) {
|
33421
|
+
autoZoom = 1;
|
33422
|
+
zoom = 1;
|
33423
|
+
rootHeight = viewportHeight;
|
33424
|
+
}
|
33425
|
+
}
|
33426
|
+
return { autoZoom, rootHeight, zoom };
|
33427
|
+
};
|
33428
|
+
|
33429
|
+
// components/Puck/components/Canvas/index.tsx
|
33430
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
33431
|
+
var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_default19);
|
33432
|
+
var ZOOM_ON_CHANGE = true;
|
33433
|
+
var Canvas = () => {
|
33434
|
+
const { status, iframe } = useAppContext();
|
33435
|
+
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33436
|
+
const { ui } = state;
|
33437
|
+
const frameRef = (0, import_react28.useRef)(null);
|
33438
|
+
const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
|
33439
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
33440
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
|
33441
|
+
return PuckDefault;
|
33442
|
+
}, []);
|
33443
|
+
const CustomPreview = (0, import_react28.useMemo)(
|
33444
|
+
() => overrides.preview || defaultRender,
|
33445
|
+
[overrides]
|
33446
|
+
);
|
33447
|
+
const getFrameDimensions = (0, import_react28.useCallback)(() => {
|
33448
|
+
if (frameRef.current) {
|
33449
|
+
const frame = frameRef.current;
|
33450
|
+
const box = getBox(frame);
|
33451
|
+
return { width: box.contentBox.width, height: box.contentBox.height };
|
33452
|
+
}
|
33453
|
+
return { width: 0, height: 0 };
|
33454
|
+
}, [frameRef]);
|
33455
|
+
const resetAutoZoom = (0, import_react28.useCallback)(
|
33456
|
+
(ui2 = state.ui) => {
|
33457
|
+
if (frameRef.current) {
|
33458
|
+
setZoomConfig(
|
33459
|
+
getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
|
33460
|
+
);
|
33461
|
+
}
|
33462
|
+
},
|
33463
|
+
[frameRef, zoomConfig, state.ui]
|
33464
|
+
);
|
33465
|
+
(0, import_react28.useEffect)(() => {
|
33466
|
+
setShowTransition(false);
|
33467
|
+
resetAutoZoom();
|
33468
|
+
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33469
|
+
(0, import_react28.useEffect)(() => {
|
33470
|
+
const { height: frameHeight } = getFrameDimensions();
|
33471
|
+
if (ui.viewports.current.height === "auto") {
|
33472
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
33473
|
+
rootHeight: frameHeight / zoomConfig.zoom
|
33474
|
+
}));
|
33475
|
+
}
|
33476
|
+
}, [zoomConfig.zoom]);
|
33477
|
+
(0, import_react28.useEffect)(() => {
|
33478
|
+
const observer = new ResizeObserver(() => {
|
33479
|
+
setShowTransition(false);
|
33480
|
+
resetAutoZoom();
|
33481
|
+
});
|
33482
|
+
if (document.body) {
|
33483
|
+
observer.observe(document.body);
|
33484
|
+
}
|
33485
|
+
return () => {
|
33486
|
+
observer.disconnect();
|
33487
|
+
};
|
33488
|
+
}, []);
|
33489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
33490
|
+
"div",
|
33491
|
+
{
|
33492
|
+
className: getClassName24({
|
33493
|
+
ready: status === "READY" || !iframe.enabled
|
33494
|
+
}),
|
33495
|
+
onClick: () => dispatch({
|
33496
|
+
type: "setUi",
|
33497
|
+
ui: { itemSelector: null },
|
33498
|
+
recordHistory: true
|
33499
|
+
}),
|
33500
|
+
children: [
|
33501
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33502
|
+
ViewportControls,
|
33503
|
+
{
|
33504
|
+
autoZoom: zoomConfig.autoZoom,
|
33505
|
+
zoom: zoomConfig.zoom,
|
33506
|
+
onViewportChange: (viewport) => {
|
33507
|
+
setShowTransition(true);
|
33508
|
+
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
33509
|
+
height: viewport.height || "auto",
|
33510
|
+
zoom: zoomConfig.zoom
|
33511
|
+
});
|
33512
|
+
const newUi = __spreadProps(__spreadValues({}, ui), {
|
33513
|
+
viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
|
33514
|
+
});
|
33515
|
+
setUi(newUi);
|
33516
|
+
if (ZOOM_ON_CHANGE) {
|
33517
|
+
resetAutoZoom(newUi);
|
33518
|
+
}
|
33519
|
+
},
|
33520
|
+
onZoom: (zoom) => {
|
33521
|
+
setShowTransition(true);
|
33522
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
|
33523
|
+
}
|
33524
|
+
}
|
33525
|
+
) }),
|
33526
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33527
|
+
"div",
|
33528
|
+
{
|
33529
|
+
className: getClassName24("root"),
|
33530
|
+
style: {
|
33531
|
+
width: iframe.enabled ? ui.viewports.current.width : void 0,
|
33532
|
+
height: zoomConfig.rootHeight,
|
33533
|
+
transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
|
33534
|
+
transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
|
33535
|
+
overflow: iframe.enabled ? void 0 : "auto"
|
33536
|
+
},
|
33537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
|
33538
|
+
}
|
33539
|
+
) })
|
33540
|
+
]
|
33541
|
+
}
|
33542
|
+
);
|
33543
|
+
};
|
33544
|
+
|
32749
33545
|
// components/Puck/index.tsx
|
32750
|
-
var
|
32751
|
-
var
|
33546
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
33547
|
+
var getClassName25 = get_class_name_factory_default("Puck", styles_default8);
|
32752
33548
|
function Puck({
|
32753
33549
|
children,
|
32754
33550
|
config,
|
32755
33551
|
data: initialData = { content: [], root: { props: { title: "" } } },
|
32756
|
-
ui: initialUi
|
33552
|
+
ui: initialUi,
|
32757
33553
|
onChange,
|
32758
33554
|
onPublish,
|
32759
33555
|
plugins = [],
|
@@ -32761,33 +33557,63 @@ function Puck({
|
|
32761
33557
|
renderHeader,
|
32762
33558
|
renderHeaderActions,
|
32763
33559
|
headerTitle,
|
32764
|
-
headerPath
|
33560
|
+
headerPath,
|
33561
|
+
viewports = defaultViewports,
|
33562
|
+
iframe = {
|
33563
|
+
enabled: true
|
33564
|
+
}
|
32765
33565
|
}) {
|
32766
33566
|
var _a;
|
32767
33567
|
const historyStore = useHistoryStore();
|
32768
|
-
const [reducer] = (0,
|
33568
|
+
const [reducer] = (0, import_react29.useState)(
|
32769
33569
|
() => createReducer({ config, record: historyStore.record })
|
32770
33570
|
);
|
32771
|
-
const [initialAppState] = (0,
|
32772
|
-
|
32773
|
-
|
32774
|
-
|
32775
|
-
|
32776
|
-
|
32777
|
-
|
32778
|
-
|
32779
|
-
|
32780
|
-
|
32781
|
-
|
32782
|
-
|
32783
|
-
|
32784
|
-
|
32785
|
-
|
32786
|
-
{
|
32787
|
-
|
32788
|
-
|
32789
|
-
|
32790
|
-
|
33571
|
+
const [initialAppState] = (0, import_react29.useState)(() => {
|
33572
|
+
var _a2, _b, _c, _d;
|
33573
|
+
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33574
|
+
let clientUiState = {};
|
33575
|
+
if (typeof window !== "undefined") {
|
33576
|
+
const viewportWidth = window.innerWidth;
|
33577
|
+
const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
|
33578
|
+
key,
|
33579
|
+
diff: Math.abs(viewportWidth - value.width)
|
33580
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
33581
|
+
const closestViewport = viewportDifferences[0].key;
|
33582
|
+
if (iframe.enabled) {
|
33583
|
+
clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
|
33584
|
+
leftSideBarVisible: false,
|
33585
|
+
rightSideBarVisible: false
|
33586
|
+
}), {
|
33587
|
+
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
33588
|
+
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
33589
|
+
height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
|
33590
|
+
width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
|
33591
|
+
})
|
33592
|
+
})
|
33593
|
+
});
|
33594
|
+
}
|
33595
|
+
}
|
33596
|
+
return __spreadProps(__spreadValues({}, defaultAppState), {
|
33597
|
+
data: initialData,
|
33598
|
+
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
33599
|
+
// Store categories under componentList on state to allow render functions and plugins to modify
|
33600
|
+
componentList: config.categories ? Object.entries(config.categories).reduce(
|
33601
|
+
(acc, [categoryName, category]) => {
|
33602
|
+
return __spreadProps(__spreadValues({}, acc), {
|
33603
|
+
[categoryName]: {
|
33604
|
+
title: category.title,
|
33605
|
+
components: category.components,
|
33606
|
+
expanded: category.defaultExpanded,
|
33607
|
+
visible: category.visible
|
33608
|
+
}
|
33609
|
+
});
|
33610
|
+
},
|
33611
|
+
{}
|
33612
|
+
) : {}
|
33613
|
+
})
|
33614
|
+
});
|
33615
|
+
});
|
33616
|
+
const [appState, dispatch] = (0, import_react29.useReducer)(
|
32791
33617
|
reducer,
|
32792
33618
|
flushZones(initialAppState)
|
32793
33619
|
);
|
@@ -32798,9 +33624,9 @@ function Puck({
|
|
32798
33624
|
config,
|
32799
33625
|
dispatch
|
32800
33626
|
);
|
32801
|
-
const [menuOpen, setMenuOpen] = (0,
|
33627
|
+
const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
|
32802
33628
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
32803
|
-
const setItemSelector = (0,
|
33629
|
+
const setItemSelector = (0, import_react29.useCallback)(
|
32804
33630
|
(newItemSelector) => {
|
32805
33631
|
if (newItemSelector === itemSelector)
|
32806
33632
|
return;
|
@@ -32813,21 +33639,21 @@ function Puck({
|
|
32813
33639
|
[itemSelector]
|
32814
33640
|
);
|
32815
33641
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32816
|
-
(0,
|
33642
|
+
(0, import_react29.useEffect)(() => {
|
32817
33643
|
if (onChange)
|
32818
33644
|
onChange(data);
|
32819
33645
|
}, [data]);
|
32820
33646
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
32821
|
-
const [draggedItem, setDraggedItem] = (0,
|
33647
|
+
const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
|
32822
33648
|
const rootProps = data.root.props || data.root;
|
32823
|
-
(0,
|
33649
|
+
(0, import_react29.useEffect)(() => {
|
32824
33650
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
32825
33651
|
console.error(
|
32826
33652
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
32827
33653
|
);
|
32828
33654
|
}
|
32829
33655
|
}, []);
|
32830
|
-
const toggleSidebars = (0,
|
33656
|
+
const toggleSidebars = (0, import_react29.useCallback)(
|
32831
33657
|
(sidebar) => {
|
32832
33658
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
32833
33659
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -32841,7 +33667,7 @@ function Puck({
|
|
32841
33667
|
},
|
32842
33668
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
32843
33669
|
);
|
32844
|
-
(0,
|
33670
|
+
(0, import_react29.useEffect)(() => {
|
32845
33671
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
32846
33672
|
dispatch({
|
32847
33673
|
type: "setUi",
|
@@ -32864,11 +33690,11 @@ function Puck({
|
|
32864
33690
|
window.removeEventListener("resize", handleResize);
|
32865
33691
|
};
|
32866
33692
|
}, []);
|
32867
|
-
const defaultRender = (0,
|
32868
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
33693
|
+
const defaultRender = (0, import_react29.useMemo)(() => {
|
33694
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
|
32869
33695
|
return PuckDefault;
|
32870
33696
|
}, []);
|
32871
|
-
const defaultHeaderRender = (0,
|
33697
|
+
const defaultHeaderRender = (0, import_react29.useMemo)(() => {
|
32872
33698
|
if (renderHeader) {
|
32873
33699
|
console.warn(
|
32874
33700
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -32876,47 +33702,42 @@ function Puck({
|
|
32876
33702
|
const RenderHeader = (_a2) => {
|
32877
33703
|
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
32878
33704
|
const Comp = renderHeader;
|
32879
|
-
return /* @__PURE__ */ (0,
|
33705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
32880
33706
|
};
|
32881
33707
|
return RenderHeader;
|
32882
33708
|
}
|
32883
33709
|
return defaultRender;
|
32884
33710
|
}, [renderHeader]);
|
32885
|
-
const defaultHeaderActionsRender = (0,
|
33711
|
+
const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
|
32886
33712
|
if (renderHeaderActions) {
|
32887
33713
|
console.warn(
|
32888
33714
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
32889
33715
|
);
|
32890
33716
|
const RenderHeader = (props) => {
|
32891
33717
|
const Comp = renderHeaderActions;
|
32892
|
-
return /* @__PURE__ */ (0,
|
33718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
32893
33719
|
};
|
32894
33720
|
return RenderHeader;
|
32895
33721
|
}
|
32896
33722
|
return defaultRender;
|
32897
33723
|
}, [renderHeader]);
|
32898
|
-
const loadedOverrides = (0,
|
33724
|
+
const loadedOverrides = (0, import_react29.useMemo)(() => {
|
32899
33725
|
return loadOverrides({ overrides, plugins });
|
32900
33726
|
}, [plugins]);
|
32901
|
-
const CustomPuck = (0,
|
33727
|
+
const CustomPuck = (0, import_react29.useMemo)(
|
32902
33728
|
() => loadedOverrides.puck || defaultRender,
|
32903
33729
|
[loadedOverrides]
|
32904
33730
|
);
|
32905
|
-
const
|
32906
|
-
() => loadedOverrides.preview || defaultRender,
|
32907
|
-
[loadedOverrides]
|
32908
|
-
);
|
32909
|
-
const CustomHeader = (0, import_react26.useMemo)(
|
33731
|
+
const CustomHeader = (0, import_react29.useMemo)(
|
32910
33732
|
() => loadedOverrides.header || defaultHeaderRender,
|
32911
33733
|
[loadedOverrides]
|
32912
33734
|
);
|
32913
|
-
const CustomHeaderActions = (0,
|
33735
|
+
const CustomHeaderActions = (0, import_react29.useMemo)(
|
32914
33736
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
32915
33737
|
[loadedOverrides]
|
32916
33738
|
);
|
32917
|
-
|
32918
|
-
|
32919
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "Puck", children: [
|
33740
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32920
33741
|
AppProvider,
|
32921
33742
|
{
|
32922
33743
|
value: {
|
@@ -32927,10 +33748,12 @@ function Puck({
|
|
32927
33748
|
resolveData,
|
32928
33749
|
plugins,
|
32929
33750
|
overrides: loadedOverrides,
|
32930
|
-
history
|
33751
|
+
history,
|
33752
|
+
viewports,
|
33753
|
+
iframe
|
32931
33754
|
},
|
32932
|
-
children: /* @__PURE__ */ (0,
|
32933
|
-
|
33755
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33756
|
+
DragDropContext,
|
32934
33757
|
{
|
32935
33758
|
onDragUpdate: (update) => {
|
32936
33759
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
@@ -32984,7 +33807,7 @@ function Puck({
|
|
32984
33807
|
});
|
32985
33808
|
}
|
32986
33809
|
},
|
32987
|
-
children: /* @__PURE__ */ (0,
|
33810
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32988
33811
|
DropZoneProvider,
|
32989
33812
|
{
|
32990
33813
|
value: {
|
@@ -32996,77 +33819,75 @@ function Puck({
|
|
32996
33819
|
draggedItem,
|
32997
33820
|
placeholderStyle,
|
32998
33821
|
mode: "edit",
|
32999
|
-
areaId: "root"
|
33000
|
-
disableZoom
|
33822
|
+
areaId: "root"
|
33001
33823
|
},
|
33002
|
-
children: /* @__PURE__ */ (0,
|
33824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
33003
33825
|
"div",
|
33004
33826
|
{
|
33005
|
-
className:
|
33827
|
+
className: getClassName25({
|
33006
33828
|
leftSideBarVisible,
|
33007
33829
|
menuOpen,
|
33008
|
-
rightSideBarVisible
|
33009
|
-
disableZoom
|
33830
|
+
rightSideBarVisible
|
33010
33831
|
}),
|
33011
33832
|
children: [
|
33012
|
-
/* @__PURE__ */ (0,
|
33833
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33013
33834
|
CustomHeader,
|
33014
33835
|
{
|
33015
|
-
actions: /* @__PURE__ */ (0,
|
33016
|
-
/* @__PURE__ */ (0,
|
33017
|
-
/* @__PURE__ */ (0,
|
33836
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33837
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33838
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33018
33839
|
Button,
|
33019
33840
|
{
|
33020
33841
|
onClick: () => {
|
33021
33842
|
onPublish && onPublish(data);
|
33022
33843
|
},
|
33023
|
-
icon: /* @__PURE__ */ (0,
|
33844
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
|
33024
33845
|
children: "Publish"
|
33025
33846
|
}
|
33026
33847
|
)
|
33027
33848
|
] }),
|
33028
|
-
children: /* @__PURE__ */ (0,
|
33029
|
-
/* @__PURE__ */ (0,
|
33030
|
-
/* @__PURE__ */ (0,
|
33849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
33850
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
33851
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33031
33852
|
IconButton,
|
33032
33853
|
{
|
33033
33854
|
onClick: () => {
|
33034
33855
|
toggleSidebars("left");
|
33035
33856
|
},
|
33036
33857
|
title: "Toggle left sidebar",
|
33037
|
-
children: /* @__PURE__ */ (0,
|
33858
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
|
33038
33859
|
}
|
33039
33860
|
) }),
|
33040
|
-
/* @__PURE__ */ (0,
|
33861
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33041
33862
|
IconButton,
|
33042
33863
|
{
|
33043
33864
|
onClick: () => {
|
33044
33865
|
toggleSidebars("right");
|
33045
33866
|
},
|
33046
33867
|
title: "Toggle right sidebar",
|
33047
|
-
children: /* @__PURE__ */ (0,
|
33868
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
|
33048
33869
|
}
|
33049
33870
|
) })
|
33050
33871
|
] }),
|
33051
|
-
/* @__PURE__ */ (0,
|
33872
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33052
33873
|
headerTitle || rootProps.title || "Page",
|
33053
|
-
headerPath && /* @__PURE__ */ (0,
|
33874
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
33054
33875
|
" ",
|
33055
|
-
/* @__PURE__ */ (0,
|
33876
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
33056
33877
|
] })
|
33057
33878
|
] }) }),
|
33058
|
-
/* @__PURE__ */ (0,
|
33059
|
-
/* @__PURE__ */ (0,
|
33879
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
33880
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33060
33881
|
IconButton,
|
33061
33882
|
{
|
33062
33883
|
onClick: () => {
|
33063
33884
|
return setMenuOpen(!menuOpen);
|
33064
33885
|
},
|
33065
33886
|
title: "Toggle menu bar",
|
33066
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
33887
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
|
33067
33888
|
}
|
33068
33889
|
) }),
|
33069
|
-
/* @__PURE__ */ (0,
|
33890
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33070
33891
|
MenuBar,
|
33071
33892
|
{
|
33072
33893
|
appState,
|
@@ -33074,7 +33895,7 @@ function Puck({
|
|
33074
33895
|
dispatch,
|
33075
33896
|
onPublish,
|
33076
33897
|
menuOpen,
|
33077
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
33898
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
|
33078
33899
|
setMenuOpen
|
33079
33900
|
}
|
33080
33901
|
)
|
@@ -33082,38 +33903,19 @@ function Puck({
|
|
33082
33903
|
] }) })
|
33083
33904
|
}
|
33084
33905
|
),
|
33085
|
-
/* @__PURE__ */ (0,
|
33086
|
-
/* @__PURE__ */ (0,
|
33087
|
-
/* @__PURE__ */ (0,
|
33906
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
|
33907
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
|
33908
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
|
33088
33909
|
] }),
|
33089
|
-
/* @__PURE__ */ (0,
|
33090
|
-
|
33091
|
-
{
|
33092
|
-
className: getClassName22("frame"),
|
33093
|
-
onClick: () => setItemSelector(null),
|
33094
|
-
children: [
|
33095
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("root"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Preview, {}) }) }),
|
33096
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33097
|
-
"div",
|
33098
|
-
{
|
33099
|
-
style: {
|
33100
|
-
background: "var(--puck-color-grey-11)",
|
33101
|
-
height: "100%",
|
33102
|
-
flexGrow: 1
|
33103
|
-
}
|
33104
|
-
}
|
33105
|
-
)
|
33106
|
-
]
|
33107
|
-
}
|
33108
|
-
),
|
33109
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
33910
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
|
33911
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33110
33912
|
SidebarSection,
|
33111
33913
|
{
|
33112
33914
|
noPadding: true,
|
33113
33915
|
noBorderTop: true,
|
33114
33916
|
showBreadcrumbs: true,
|
33115
33917
|
title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
|
33116
|
-
children: /* @__PURE__ */ (0,
|
33918
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
|
33117
33919
|
}
|
33118
33920
|
) })
|
33119
33921
|
]
|
@@ -33125,7 +33927,7 @@ function Puck({
|
|
33125
33927
|
)
|
33126
33928
|
}
|
33127
33929
|
),
|
33128
|
-
/* @__PURE__ */ (0,
|
33930
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: "puck-portal-root" })
|
33129
33931
|
] });
|
33130
33932
|
}
|
33131
33933
|
Puck.Components = Components;
|
@@ -33135,13 +33937,13 @@ Puck.Preview = Preview;
|
|
33135
33937
|
|
33136
33938
|
// components/Render/index.tsx
|
33137
33939
|
init_react_import();
|
33138
|
-
var
|
33940
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
33139
33941
|
function Render({ config, data }) {
|
33140
33942
|
var _a;
|
33141
33943
|
const rootProps = data.root.props || data.root;
|
33142
33944
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33143
33945
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33144
|
-
return /* @__PURE__ */ (0,
|
33946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33145
33947
|
config.root.render,
|
33146
33948
|
__spreadProps(__spreadValues({}, rootProps), {
|
33147
33949
|
puck: {
|
@@ -33150,11 +33952,11 @@ function Render({ config, data }) {
|
|
33150
33952
|
title,
|
33151
33953
|
editMode: false,
|
33152
33954
|
id: "puck-root",
|
33153
|
-
children: /* @__PURE__ */ (0,
|
33955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
|
33154
33956
|
})
|
33155
33957
|
) });
|
33156
33958
|
}
|
33157
|
-
return /* @__PURE__ */ (0,
|
33959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
|
33158
33960
|
}
|
33159
33961
|
|
33160
33962
|
// lib/migrate.ts
|
@@ -33449,6 +34251,14 @@ lucide-react/dist/esm/icons/lock.js:
|
|
33449
34251
|
* See the LICENSE file in the root directory of this source tree.
|
33450
34252
|
*)
|
33451
34253
|
|
34254
|
+
lucide-react/dist/esm/icons/monitor.js:
|
34255
|
+
(**
|
34256
|
+
* @license lucide-react v0.298.0 - ISC
|
34257
|
+
*
|
34258
|
+
* This source code is licensed under the ISC license.
|
34259
|
+
* See the LICENSE file in the root directory of this source tree.
|
34260
|
+
*)
|
34261
|
+
|
33452
34262
|
lucide-react/dist/esm/icons/more-vertical.js:
|
33453
34263
|
(**
|
33454
34264
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33497,6 +34307,22 @@ lucide-react/dist/esm/icons/sliders-horizontal.js:
|
|
33497
34307
|
* See the LICENSE file in the root directory of this source tree.
|
33498
34308
|
*)
|
33499
34309
|
|
34310
|
+
lucide-react/dist/esm/icons/smartphone.js:
|
34311
|
+
(**
|
34312
|
+
* @license lucide-react v0.298.0 - ISC
|
34313
|
+
*
|
34314
|
+
* This source code is licensed under the ISC license.
|
34315
|
+
* See the LICENSE file in the root directory of this source tree.
|
34316
|
+
*)
|
34317
|
+
|
34318
|
+
lucide-react/dist/esm/icons/tablet.js:
|
34319
|
+
(**
|
34320
|
+
* @license lucide-react v0.298.0 - ISC
|
34321
|
+
*
|
34322
|
+
* This source code is licensed under the ISC license.
|
34323
|
+
* See the LICENSE file in the root directory of this source tree.
|
34324
|
+
*)
|
34325
|
+
|
33500
34326
|
lucide-react/dist/esm/icons/trash.js:
|
33501
34327
|
(**
|
33502
34328
|
* @license lucide-react v0.298.0 - ISC
|
@@ -33521,6 +34347,22 @@ lucide-react/dist/esm/icons/unlock.js:
|
|
33521
34347
|
* See the LICENSE file in the root directory of this source tree.
|
33522
34348
|
*)
|
33523
34349
|
|
34350
|
+
lucide-react/dist/esm/icons/zoom-in.js:
|
34351
|
+
(**
|
34352
|
+
* @license lucide-react v0.298.0 - ISC
|
34353
|
+
*
|
34354
|
+
* This source code is licensed under the ISC license.
|
34355
|
+
* See the LICENSE file in the root directory of this source tree.
|
34356
|
+
*)
|
34357
|
+
|
34358
|
+
lucide-react/dist/esm/icons/zoom-out.js:
|
34359
|
+
(**
|
34360
|
+
* @license lucide-react v0.298.0 - ISC
|
34361
|
+
*
|
34362
|
+
* This source code is licensed under the ISC license.
|
34363
|
+
* See the LICENSE file in the root directory of this source tree.
|
34364
|
+
*)
|
34365
|
+
|
33524
34366
|
lucide-react/dist/esm/lucide-react.js:
|
33525
34367
|
(**
|
33526
34368
|
* @license lucide-react v0.298.0 - ISC
|