@puckeditor/core 0.23.0 → 0.24.0-canary.5d053ab9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Editor-44C53YAG.mjs → Editor-6FVPPPTF.mjs} +6 -6
- package/dist/{chunk-YQWFSBOU.mjs → chunk-3APNIQ4V.mjs} +66 -37
- package/dist/{chunk-NJTGWYYH.mjs → chunk-3RRSMHJE.mjs} +1 -1
- package/dist/{chunk-GNR2HNTB.mjs → chunk-4KR5YUJB.mjs} +7 -7
- package/dist/{chunk-WF6I3XOL.mjs → chunk-AXMNKNOE.mjs} +3 -3
- package/dist/{chunk-55V3NZVF.mjs → chunk-BVD2GJCJ.mjs} +442 -364
- package/dist/{chunk-K2LNXU54.mjs → chunk-J2WXVF4Z.mjs} +1 -0
- package/dist/{chunk-67Y7M4OJ.mjs → chunk-QHS6M72F.mjs} +1 -1
- package/dist/{chunk-4P4VZS4P.mjs → chunk-S6EKCNZI.mjs} +1 -1
- package/dist/{full-7ZJV44EE.mjs → full-MC4TVNN7.mjs} +5 -5
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +716 -611
- package/dist/index.mjs +8 -8
- package/dist/{loaded-36WRJPBT.mjs → loaded-73WW27KL.mjs} +2 -2
- package/dist/{loaded-JKA25A3T.mjs → loaded-7OPHUKVX.mjs} +2 -2
- package/dist/{loaded-SMPR6KZF.mjs → loaded-PZCRIGO7.mjs} +2 -2
- package/dist/no-external.js +716 -611
- package/dist/no-external.mjs +8 -8
- package/dist/rsc.d.mts +3 -2
- package/dist/rsc.d.ts +3 -2
- package/dist/rsc.js +112 -53
- package/dist/rsc.mjs +49 -19
- package/package.json +1 -1
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
EditorInner,
|
|
6
6
|
LoadedRichTextMenu
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AXMNKNOE.mjs";
|
|
8
8
|
import "./chunk-H635BA2V.mjs";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-4KR5YUJB.mjs";
|
|
10
|
+
import "./chunk-QHS6M72F.mjs";
|
|
11
|
+
import "./chunk-S6EKCNZI.mjs";
|
|
12
|
+
import "./chunk-3RRSMHJE.mjs";
|
|
13
13
|
import {
|
|
14
14
|
useAppStore,
|
|
15
15
|
useAppStoreApi
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-J2WXVF4Z.mjs";
|
|
17
17
|
import "./chunk-Z2MS6UIF.mjs";
|
|
18
18
|
import "./chunk-ZRAERXB4.mjs";
|
|
19
19
|
import "./chunk-Y2EFNT5P.mjs";
|
|
@@ -267,23 +267,7 @@ function resolveAllData(_0, _1) {
|
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
// lib/
|
|
271
|
-
init_react_import();
|
|
272
|
-
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
273
|
-
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
274
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
275
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
276
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
277
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
278
|
-
}, dzProps), {
|
|
279
|
-
zone: propName,
|
|
280
|
-
content
|
|
281
|
-
}));
|
|
282
|
-
return Slot;
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
// lib/use-slots.tsx
|
|
270
|
+
// lib/props/render/use-render-props.tsx
|
|
287
271
|
init_react_import();
|
|
288
272
|
|
|
289
273
|
// lib/field-transforms/use-field-transforms.tsx
|
|
@@ -327,16 +311,21 @@ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
|
327
311
|
return mergedProps;
|
|
328
312
|
}
|
|
329
313
|
|
|
330
|
-
// lib/
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
314
|
+
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
315
|
+
init_react_import();
|
|
316
|
+
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
317
|
+
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
318
|
+
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
319
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
320
|
+
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
321
|
+
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
322
|
+
}, dzProps), {
|
|
323
|
+
zone: propName,
|
|
324
|
+
content
|
|
325
|
+
}));
|
|
326
|
+
return Slot;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
340
329
|
|
|
341
330
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
342
331
|
init_react_import();
|
|
@@ -381,11 +370,14 @@ var RichTextRender = lazy(
|
|
|
381
370
|
default: m.RichTextRender
|
|
382
371
|
}))
|
|
383
372
|
);
|
|
384
|
-
function useRichtextProps(fields, props) {
|
|
373
|
+
function useRichtextProps(fields, props, fieldTransforms) {
|
|
385
374
|
const findAllRichtextKeys = (fields2, path = []) => {
|
|
386
375
|
if (!fields2) return [];
|
|
387
376
|
const result = [];
|
|
388
377
|
for (const [key, field] of Object.entries(fields2)) {
|
|
378
|
+
if (fieldTransforms == null ? void 0 : fieldTransforms[field.type]) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
389
381
|
const currentPath = [...path, key];
|
|
390
382
|
if (field.type === "richtext") {
|
|
391
383
|
result.push({
|
|
@@ -402,7 +394,10 @@ function useRichtextProps(fields, props) {
|
|
|
402
394
|
}
|
|
403
395
|
return result;
|
|
404
396
|
};
|
|
405
|
-
const richtextKeys = useMemo2(
|
|
397
|
+
const richtextKeys = useMemo2(
|
|
398
|
+
() => findAllRichtextKeys(fields),
|
|
399
|
+
[fields, fieldTransforms]
|
|
400
|
+
);
|
|
406
401
|
const richtextProps = useMemo2(() => {
|
|
407
402
|
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
408
403
|
let result = __spreadValues({}, props);
|
|
@@ -421,6 +416,28 @@ function useRichtextProps(fields, props) {
|
|
|
421
416
|
return richtextProps;
|
|
422
417
|
}
|
|
423
418
|
|
|
419
|
+
// lib/props/render/use-render-props.tsx
|
|
420
|
+
var EMPTY_FIELD_CONFIG = {};
|
|
421
|
+
function useRenderProps(config, component, renderSlot, fieldTransforms) {
|
|
422
|
+
var _a, _b;
|
|
423
|
+
const transformedProps = useFieldTransforms(
|
|
424
|
+
config,
|
|
425
|
+
component,
|
|
426
|
+
__spreadValues(__spreadValues({}, getSlotTransform(renderSlot)), fieldTransforms),
|
|
427
|
+
void 0,
|
|
428
|
+
true
|
|
429
|
+
);
|
|
430
|
+
const isRoot = !("type" in component) || component.type === "root";
|
|
431
|
+
const componentFields = isRoot ? (_a = config.root) == null ? void 0 : _a.fields : ((_b = config.components[component.type]) == null ? void 0 : _b.fields) || EMPTY_FIELD_CONFIG;
|
|
432
|
+
const richtextProps = useRichtextProps(
|
|
433
|
+
componentFields,
|
|
434
|
+
transformedProps,
|
|
435
|
+
fieldTransforms
|
|
436
|
+
);
|
|
437
|
+
return __spreadValues(__spreadValues({}, transformedProps), richtextProps);
|
|
438
|
+
}
|
|
439
|
+
var use_render_props_default = useRenderProps;
|
|
440
|
+
|
|
424
441
|
// components/SlotRender/server.tsx
|
|
425
442
|
init_react_import();
|
|
426
443
|
import { forwardRef } from "react";
|
|
@@ -429,14 +446,26 @@ var SlotRenderPure = (props) => /* @__PURE__ */ jsx3(SlotRender, __spreadValues(
|
|
|
429
446
|
var Item = ({
|
|
430
447
|
config,
|
|
431
448
|
item,
|
|
432
|
-
metadata
|
|
449
|
+
metadata,
|
|
450
|
+
fieldTransforms
|
|
433
451
|
}) => {
|
|
434
452
|
const Component = config.components[item.type];
|
|
435
|
-
const props =
|
|
436
|
-
|
|
453
|
+
const props = use_render_props_default(
|
|
454
|
+
config,
|
|
455
|
+
item,
|
|
456
|
+
(slotProps) => /* @__PURE__ */ jsx3(
|
|
457
|
+
SlotRenderPure,
|
|
458
|
+
__spreadProps(__spreadValues({}, slotProps), {
|
|
459
|
+
config,
|
|
460
|
+
metadata,
|
|
461
|
+
fieldTransforms
|
|
462
|
+
})
|
|
463
|
+
),
|
|
464
|
+
fieldTransforms
|
|
465
|
+
);
|
|
437
466
|
return /* @__PURE__ */ jsx3(
|
|
438
467
|
Component.render,
|
|
439
|
-
__spreadProps(__spreadValues(
|
|
468
|
+
__spreadProps(__spreadValues({}, props), {
|
|
440
469
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
441
470
|
metadata: metadata || {}
|
|
442
471
|
})
|
|
@@ -444,7 +473,7 @@ var Item = ({
|
|
|
444
473
|
);
|
|
445
474
|
};
|
|
446
475
|
var SlotRender = forwardRef(
|
|
447
|
-
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
476
|
+
function SlotRenderInternal({ className, style, content, config, metadata, as, fieldTransforms }, ref) {
|
|
448
477
|
const El = as != null ? as : "div";
|
|
449
478
|
return /* @__PURE__ */ jsx3(El, { className, style, ref, children: content.map((item) => {
|
|
450
479
|
if (!config.components[item.type]) {
|
|
@@ -455,7 +484,8 @@ var SlotRender = forwardRef(
|
|
|
455
484
|
{
|
|
456
485
|
config,
|
|
457
486
|
item,
|
|
458
|
-
metadata
|
|
487
|
+
metadata,
|
|
488
|
+
fieldTransforms
|
|
459
489
|
},
|
|
460
490
|
item.props.id
|
|
461
491
|
);
|
|
@@ -466,9 +496,8 @@ var SlotRender = forwardRef(
|
|
|
466
496
|
export {
|
|
467
497
|
buildMappers,
|
|
468
498
|
getSlotTransform,
|
|
469
|
-
useSlots,
|
|
470
499
|
RichTextRenderFallback,
|
|
471
|
-
|
|
500
|
+
use_render_props_default,
|
|
472
501
|
SlotRenderPure,
|
|
473
502
|
SlotRender,
|
|
474
503
|
migrate,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAlignOptions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QHS6M72F.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useHeadingOptions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S6EKCNZI.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useListOptions
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3RRSMHJE.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Action,
|
|
12
12
|
AlignCenter,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
Underline,
|
|
30
30
|
useControlContext,
|
|
31
31
|
useMessage
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-J2WXVF4Z.mjs";
|
|
33
33
|
import {
|
|
34
34
|
get_class_name_factory_default
|
|
35
35
|
} from "./chunk-Y2EFNT5P.mjs";
|
|
@@ -204,7 +204,7 @@ function AlignSelectFallback() {
|
|
|
204
204
|
// components/RichTextMenu/controls/AlignSelect/index.tsx
|
|
205
205
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
206
206
|
var AlignSelectLoaded = lazy(
|
|
207
|
-
() => import("./loaded-
|
|
207
|
+
() => import("./loaded-PZCRIGO7.mjs").then((m) => ({
|
|
208
208
|
default: m.AlignSelectLoaded
|
|
209
209
|
}))
|
|
210
210
|
);
|
|
@@ -445,7 +445,7 @@ function HeadingSelectFallback() {
|
|
|
445
445
|
// components/RichTextMenu/controls/HeadingSelect/index.tsx
|
|
446
446
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
447
447
|
var HeadingSelectLoaded = lazy2(
|
|
448
|
-
() => import("./loaded-
|
|
448
|
+
() => import("./loaded-7OPHUKVX.mjs").then((m) => ({
|
|
449
449
|
default: m.HeadingSelectLoaded
|
|
450
450
|
}))
|
|
451
451
|
);
|
|
@@ -477,7 +477,7 @@ function ListSelectFallback() {
|
|
|
477
477
|
// components/RichTextMenu/controls/ListSelect/index.tsx
|
|
478
478
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
479
479
|
var ListSelectLoaded = lazy3(
|
|
480
|
-
() => import("./loaded-
|
|
480
|
+
() => import("./loaded-73WW27KL.mjs").then((m) => ({
|
|
481
481
|
default: m.ListSelectLoaded
|
|
482
482
|
}))
|
|
483
483
|
);
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-H635BA2V.mjs";
|
|
4
4
|
import {
|
|
5
5
|
LoadedRichTextMenuInner
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4KR5YUJB.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useAppStore,
|
|
9
9
|
useAppStoreApi
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-J2WXVF4Z.mjs";
|
|
11
11
|
import {
|
|
12
12
|
get_class_name_factory_default
|
|
13
13
|
} from "./chunk-Y2EFNT5P.mjs";
|
|
@@ -100,7 +100,7 @@ init_react_import();
|
|
|
100
100
|
import { lazy, Suspense } from "react";
|
|
101
101
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
102
102
|
var LoadedRichTextMenuFull = lazy(
|
|
103
|
-
() => import("./full-
|
|
103
|
+
() => import("./full-MC4TVNN7.mjs").then((m) => ({
|
|
104
104
|
default: m.LoadedRichTextMenuFull
|
|
105
105
|
}))
|
|
106
106
|
);
|