@measured/puck 0.21.0-canary.c0db75c1 → 0.21.0-canary.c78dc826

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/Editor-F2LSS6SE.css +403 -0
  2. package/dist/Editor-N46HUQEC.mjs +201 -0
  3. package/dist/Render-QEMDIDQC.css +101 -0
  4. package/dist/Render-Y567PGZ7.mjs +53 -0
  5. package/dist/chunk-3QHWXJEI.mjs +33 -0
  6. package/dist/chunk-7KY6RHEY.mjs +2230 -0
  7. package/dist/{chunk-PJYARUPI.mjs → chunk-C2TVYIYC.mjs} +76 -138
  8. package/dist/chunk-DCSQEDMK.mjs +194 -0
  9. package/dist/{chunk-S3RM5GHZ.mjs → chunk-DJSH5REF.mjs} +127 -93
  10. package/dist/chunk-DNF2EMM4.mjs +63 -0
  11. package/dist/chunk-FNWOH4R6.mjs +109 -0
  12. package/dist/chunk-GQKMOYLG.mjs +53 -0
  13. package/dist/chunk-K3V4LVUL.mjs +704 -0
  14. package/dist/chunk-R6CVX2IY.mjs +103 -0
  15. package/dist/{chunk-E4BOPJJV.mjs → chunk-TB3SSIAY.mjs} +3519 -5334
  16. package/dist/chunk-WUWXFMEM.mjs +11 -0
  17. package/dist/full-2GJTAAZE.css +301 -0
  18. package/dist/full-NLUNPJWS.mjs +90 -0
  19. package/dist/index.css +636 -759
  20. package/dist/index.d.mts +204 -21
  21. package/dist/index.d.ts +204 -21
  22. package/dist/index.js +7837 -5145
  23. package/dist/index.mjs +23 -16
  24. package/dist/loaded-EV34KGYJ.mjs +57 -0
  25. package/dist/loaded-HMSPJUZM.mjs +54 -0
  26. package/dist/loaded-RVWBFK7L.css +87 -0
  27. package/dist/loaded-ZXOU6S6R.mjs +54 -0
  28. package/dist/no-external.css +636 -759
  29. package/dist/no-external.d.mts +17 -4
  30. package/dist/no-external.d.ts +17 -4
  31. package/dist/no-external.js +7837 -5145
  32. package/dist/no-external.mjs +23 -16
  33. package/dist/rsc.css +101 -0
  34. package/dist/rsc.d.mts +17 -2
  35. package/dist/rsc.d.ts +17 -2
  36. package/dist/rsc.js +409 -25
  37. package/dist/rsc.mjs +13 -8
  38. package/dist/{actions-CaYAKtsG.d.mts → walk-tree-Ja9bNCM9.d.mts} +235 -23
  39. package/dist/{actions-CaYAKtsG.d.ts → walk-tree-Ja9bNCM9.d.ts} +235 -23
  40. package/package.json +24 -7
  41. package/dist/chunk-J32NOAUF.mjs +0 -524
  42. package/dist/index-C6QwyW4B.d.ts +0 -109
  43. package/dist/index-IMRjDHZk.d.mts +0 -109
  44. package/dist/internal.d.mts +0 -12
  45. package/dist/internal.d.ts +0 -12
  46. package/dist/internal.js +0 -906
  47. package/dist/internal.mjs +0 -12
  48. package/dist/walk-tree-B-Q2gpMX.d.mts +0 -29
  49. package/dist/walk-tree-ksvZ7C4q.d.ts +0 -29
@@ -0,0 +1,63 @@
1
+ import {
2
+ Heading1,
3
+ Heading2,
4
+ Heading3,
5
+ Heading4,
6
+ Heading5,
7
+ Heading6
8
+ } from "./chunk-7KY6RHEY.mjs";
9
+ import {
10
+ init_react_import
11
+ } from "./chunk-DCSQEDMK.mjs";
12
+
13
+ // components/RichTextMenu/controls/HeadingSelect/use-options.ts
14
+ init_react_import();
15
+ import { useMemo } from "react";
16
+ var optionNodes = {
17
+ h1: { label: "Heading 1", icon: Heading1 },
18
+ h2: { label: "Heading 2", icon: Heading2 },
19
+ h3: { label: "Heading 3", icon: Heading3 },
20
+ h4: { label: "Heading 4", icon: Heading4 },
21
+ h5: { label: "Heading 5", icon: Heading5 },
22
+ h6: { label: "Heading 6", icon: Heading6 }
23
+ };
24
+ var useHeadingOptions = (fieldOptions) => {
25
+ var _a;
26
+ let blockOptions = [];
27
+ if ((fieldOptions == null ? void 0 : fieldOptions.heading) !== false) {
28
+ if (!((_a = fieldOptions == null ? void 0 : fieldOptions.heading) == null ? void 0 : _a.levels)) {
29
+ blockOptions = ["h1", "h2", "h3", "h4", "h5", "h6"];
30
+ } else {
31
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(1)) {
32
+ blockOptions.push("h1");
33
+ }
34
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(2)) {
35
+ blockOptions.push("h2");
36
+ }
37
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(3)) {
38
+ blockOptions.push("h3");
39
+ }
40
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(4)) {
41
+ blockOptions.push("h4");
42
+ }
43
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(5)) {
44
+ blockOptions.push("h5");
45
+ }
46
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(6)) {
47
+ blockOptions.push("h6");
48
+ }
49
+ }
50
+ }
51
+ return useMemo(
52
+ () => blockOptions.map((item) => ({
53
+ value: item,
54
+ label: optionNodes[item].label,
55
+ icon: optionNodes[item].icon
56
+ })),
57
+ [blockOptions]
58
+ );
59
+ };
60
+
61
+ export {
62
+ useHeadingOptions
63
+ };
@@ -0,0 +1,109 @@
1
+ import {
2
+ styles_module_default
3
+ } from "./chunk-WUWXFMEM.mjs";
4
+ import {
5
+ LoadedRichTextMenuInner
6
+ } from "./chunk-K3V4LVUL.mjs";
7
+ import {
8
+ useAppStore,
9
+ useAppStoreApi
10
+ } from "./chunk-7KY6RHEY.mjs";
11
+ import {
12
+ __spreadValues,
13
+ get_class_name_factory_default,
14
+ init_react_import
15
+ } from "./chunk-DCSQEDMK.mjs";
16
+
17
+ // components/RichTextEditor/components/EditorInner.tsx
18
+ init_react_import();
19
+ import {
20
+ memo,
21
+ useCallback
22
+ } from "react";
23
+ import { jsx, jsxs } from "react/jsx-runtime";
24
+ var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
25
+ var EditorInner = memo(
26
+ ({
27
+ children,
28
+ menu,
29
+ readOnly = false,
30
+ field,
31
+ inline = false,
32
+ editor,
33
+ id
34
+ }) => {
35
+ const { initialHeight } = field;
36
+ const isActive = useAppStore(
37
+ (s) => {
38
+ var _a;
39
+ return ((_a = s.currentRichText) == null ? void 0 : _a.id) === id && inline === s.currentRichText.inline;
40
+ }
41
+ );
42
+ const appStoreApi = useAppStoreApi();
43
+ const handleHotkeyCapture = useCallback(
44
+ (event) => {
45
+ var _a, _b;
46
+ if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "i") {
47
+ event.stopPropagation();
48
+ event.preventDefault();
49
+ (_b = editor == null ? void 0 : (_a = editor.commands).toggleItalic) == null ? void 0 : _b.call(_a);
50
+ }
51
+ },
52
+ [editor]
53
+ );
54
+ const handleBlur = useCallback(
55
+ (e) => {
56
+ var _a, _b;
57
+ const targetInMenu = !!((_b = (_a = e.relatedTarget) == null ? void 0 : _a.closest) == null ? void 0 : _b.call(
58
+ _a,
59
+ "[data-puck-rte-menu]"
60
+ ));
61
+ if (e.relatedTarget && !targetInMenu) {
62
+ appStoreApi.setState({
63
+ currentRichText: null
64
+ });
65
+ } else {
66
+ e.stopPropagation();
67
+ }
68
+ },
69
+ [appStoreApi]
70
+ );
71
+ return /* @__PURE__ */ jsxs(
72
+ "div",
73
+ {
74
+ className: getClassName({
75
+ editor: !inline,
76
+ inline,
77
+ isActive,
78
+ disabled: readOnly
79
+ }),
80
+ style: inline ? {} : { height: initialHeight != null ? initialHeight : 192, overflowY: "auto" },
81
+ onKeyDownCapture: handleHotkeyCapture,
82
+ onBlur: handleBlur,
83
+ children: [
84
+ !inline && /* @__PURE__ */ jsx("div", { className: getClassName("menu"), children: menu }),
85
+ children
86
+ ]
87
+ }
88
+ );
89
+ }
90
+ );
91
+ EditorInner.displayName = "EditorInner";
92
+
93
+ // components/RichTextMenu/index.tsx
94
+ init_react_import();
95
+ import { lazy, Suspense } from "react";
96
+ import { jsx as jsx2 } from "react/jsx-runtime";
97
+ var LoadedRichTextMenuFull = lazy(
98
+ () => import("./full-NLUNPJWS.mjs").then((m) => ({
99
+ default: m.LoadedRichTextMenuFull
100
+ }))
101
+ );
102
+ var LoadedRichTextMenu = (props) => {
103
+ return /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2(LoadedRichTextMenuInner, __spreadValues({}, props)), children: /* @__PURE__ */ jsx2(LoadedRichTextMenuFull, __spreadValues({}, props)) });
104
+ };
105
+
106
+ export {
107
+ EditorInner,
108
+ LoadedRichTextMenu
109
+ };
@@ -0,0 +1,53 @@
1
+ import {
2
+ AlignCenter,
3
+ AlignJustify,
4
+ AlignLeft,
5
+ AlignRight
6
+ } from "./chunk-7KY6RHEY.mjs";
7
+ import {
8
+ init_react_import
9
+ } from "./chunk-DCSQEDMK.mjs";
10
+
11
+ // components/RichTextMenu/controls/AlignSelect/use-options.ts
12
+ init_react_import();
13
+ import { useMemo } from "react";
14
+ var optionNodes = {
15
+ left: { label: "Left", icon: AlignLeft },
16
+ center: { label: "Center", icon: AlignCenter },
17
+ right: { label: "Right", icon: AlignRight },
18
+ justify: { label: "Justify", icon: AlignJustify }
19
+ };
20
+ var useAlignOptions = (fieldOptions) => {
21
+ var _a;
22
+ let blockOptions = [];
23
+ if ((fieldOptions == null ? void 0 : fieldOptions.textAlign) !== false) {
24
+ if (!((_a = fieldOptions == null ? void 0 : fieldOptions.textAlign) == null ? void 0 : _a.alignments)) {
25
+ blockOptions = ["left", "center", "right", "justify"];
26
+ } else {
27
+ if (fieldOptions == null ? void 0 : fieldOptions.textAlign.alignments.includes("left")) {
28
+ blockOptions.push("left");
29
+ }
30
+ if (fieldOptions == null ? void 0 : fieldOptions.textAlign.alignments.includes("center")) {
31
+ blockOptions.push("center");
32
+ }
33
+ if (fieldOptions == null ? void 0 : fieldOptions.textAlign.alignments.includes("right")) {
34
+ blockOptions.push("right");
35
+ }
36
+ if (fieldOptions == null ? void 0 : fieldOptions.textAlign.alignments.includes("justify")) {
37
+ blockOptions.push("justify");
38
+ }
39
+ }
40
+ }
41
+ return useMemo(
42
+ () => blockOptions.map((item) => ({
43
+ value: item,
44
+ label: optionNodes[item].label,
45
+ icon: optionNodes[item].icon
46
+ })),
47
+ [blockOptions]
48
+ );
49
+ };
50
+
51
+ export {
52
+ useAlignOptions
53
+ };