@measured/puck 0.21.0-canary.a3dabae1 → 0.21.0-canary.a62292fd

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 (52) hide show
  1. package/dist/Editor-F2LSS6SE.css +403 -0
  2. package/dist/Editor-O447AVCX.mjs +204 -0
  3. package/dist/Render-OFE6QLI2.mjs +55 -0
  4. package/dist/Render-QEMDIDQC.css +101 -0
  5. package/dist/{walk-tree-Cvtjzg9C.d.mts → actions-ONhOkrvf.d.mts} +270 -95
  6. package/dist/{walk-tree-Cvtjzg9C.d.ts → actions-ONhOkrvf.d.ts} +270 -95
  7. package/dist/chunk-2Q4PACDA.mjs +111 -0
  8. package/dist/chunk-62AAYNXG.mjs +63 -0
  9. package/dist/{chunk-V2FU5KB6.mjs → chunk-7GESFTRA.mjs} +5544 -8012
  10. package/dist/chunk-BSDEIOEK.mjs +706 -0
  11. package/dist/chunk-CSSRLPHM.mjs +11 -0
  12. package/dist/chunk-DAQLMM2T.mjs +1722 -0
  13. package/dist/chunk-M6W7YEVX.mjs +95 -0
  14. package/dist/chunk-NLUHDYVR.mjs +416 -0
  15. package/dist/chunk-PLXSMBAA.mjs +53 -0
  16. package/dist/chunk-QAWJTCV5.mjs +33 -0
  17. package/dist/chunk-QBGM4ELA.mjs +528 -0
  18. package/dist/chunk-T3WX7XJ6.mjs +132 -0
  19. package/dist/chunk-V5I7CVLT.mjs +103 -0
  20. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  21. package/dist/chunk-Y656T6AQ.mjs +419 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-BEMDJKDS.mjs +93 -0
  24. package/dist/index-BEoNHRI1.d.ts +116 -0
  25. package/dist/index-DfxZ7tZF.d.mts +116 -0
  26. package/dist/index.css +640 -761
  27. package/dist/index.d.mts +95 -123
  28. package/dist/index.d.ts +95 -123
  29. package/dist/index.js +8032 -5511
  30. package/dist/index.mjs +28 -15
  31. package/dist/internal.d.mts +27 -0
  32. package/dist/internal.d.ts +27 -0
  33. package/dist/internal.js +908 -0
  34. package/dist/internal.mjs +13 -0
  35. package/dist/loaded-JU3A7Y4L.mjs +57 -0
  36. package/dist/loaded-N3FYGF2Y.mjs +57 -0
  37. package/dist/loaded-OBY7OMS6.mjs +60 -0
  38. package/dist/loaded-RVWBFK7L.css +87 -0
  39. package/dist/no-external.css +640 -761
  40. package/dist/no-external.d.mts +19 -2
  41. package/dist/no-external.d.ts +19 -2
  42. package/dist/no-external.js +8023 -5502
  43. package/dist/no-external.mjs +28 -15
  44. package/dist/rsc.css +101 -0
  45. package/dist/rsc.d.mts +17 -2
  46. package/dist/rsc.d.ts +17 -2
  47. package/dist/rsc.js +437 -57
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-CdriEzFJ.d.mts +29 -0
  50. package/dist/walk-tree-DHbAZ4wF.d.ts +29 -0
  51. package/package.json +31 -4
  52. package/dist/chunk-C24EBUN6.mjs +0 -971
@@ -0,0 +1,111 @@
1
+ import {
2
+ styles_module_default
3
+ } from "./chunk-CSSRLPHM.mjs";
4
+ import {
5
+ LoadedRichTextMenuInner
6
+ } from "./chunk-BSDEIOEK.mjs";
7
+ import {
8
+ useAppStore,
9
+ useAppStoreApi
10
+ } from "./chunk-DAQLMM2T.mjs";
11
+ import {
12
+ get_class_name_factory_default
13
+ } from "./chunk-Y2EFNT5P.mjs";
14
+ import {
15
+ __spreadValues,
16
+ init_react_import
17
+ } from "./chunk-M6W7YEVX.mjs";
18
+
19
+ // components/RichTextEditor/components/EditorInner.tsx
20
+ init_react_import();
21
+ import {
22
+ memo,
23
+ useCallback
24
+ } from "react";
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+ var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
27
+ var EditorInner = memo(
28
+ ({
29
+ children,
30
+ menu,
31
+ readOnly = false,
32
+ field,
33
+ inline = false,
34
+ editor,
35
+ id
36
+ }) => {
37
+ const { initialHeight } = field;
38
+ const isActive = useAppStore(
39
+ (s) => {
40
+ var _a;
41
+ return ((_a = s.currentRichText) == null ? void 0 : _a.id) === id && inline === s.currentRichText.inline;
42
+ }
43
+ );
44
+ const appStoreApi = useAppStoreApi();
45
+ const handleHotkeyCapture = useCallback(
46
+ (event) => {
47
+ var _a, _b;
48
+ if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "i") {
49
+ event.stopPropagation();
50
+ event.preventDefault();
51
+ (_b = editor == null ? void 0 : (_a = editor.commands).toggleItalic) == null ? void 0 : _b.call(_a);
52
+ }
53
+ },
54
+ [editor]
55
+ );
56
+ const handleBlur = useCallback(
57
+ (e) => {
58
+ var _a, _b;
59
+ const targetInMenu = !!((_b = (_a = e.relatedTarget) == null ? void 0 : _a.closest) == null ? void 0 : _b.call(
60
+ _a,
61
+ "[data-puck-rte-menu]"
62
+ ));
63
+ if (e.relatedTarget && !targetInMenu) {
64
+ appStoreApi.setState({
65
+ currentRichText: null
66
+ });
67
+ } else {
68
+ e.stopPropagation();
69
+ }
70
+ },
71
+ [appStoreApi]
72
+ );
73
+ return /* @__PURE__ */ jsxs(
74
+ "div",
75
+ {
76
+ className: getClassName({
77
+ editor: !inline,
78
+ inline,
79
+ isActive,
80
+ disabled: readOnly
81
+ }),
82
+ style: inline ? {} : { height: initialHeight != null ? initialHeight : 192, overflowY: "auto" },
83
+ onKeyDownCapture: handleHotkeyCapture,
84
+ onBlur: handleBlur,
85
+ children: [
86
+ !inline && /* @__PURE__ */ jsx("div", { className: getClassName("menu"), children: menu }),
87
+ children
88
+ ]
89
+ }
90
+ );
91
+ }
92
+ );
93
+ EditorInner.displayName = "EditorInner";
94
+
95
+ // components/RichTextMenu/index.tsx
96
+ init_react_import();
97
+ import { lazy, Suspense } from "react";
98
+ import { jsx as jsx2 } from "react/jsx-runtime";
99
+ var LoadedRichTextMenuFull = lazy(
100
+ () => import("./full-BEMDJKDS.mjs").then((m) => ({
101
+ default: m.LoadedRichTextMenuFull
102
+ }))
103
+ );
104
+ var LoadedRichTextMenu = (props) => {
105
+ return /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2(LoadedRichTextMenuInner, __spreadValues({}, props)), children: /* @__PURE__ */ jsx2(LoadedRichTextMenuFull, __spreadValues({}, props)) });
106
+ };
107
+
108
+ export {
109
+ EditorInner,
110
+ LoadedRichTextMenu
111
+ };
@@ -0,0 +1,63 @@
1
+ import {
2
+ Heading1,
3
+ Heading2,
4
+ Heading3,
5
+ Heading4,
6
+ Heading5,
7
+ Heading6
8
+ } from "./chunk-DAQLMM2T.mjs";
9
+ import {
10
+ init_react_import
11
+ } from "./chunk-M6W7YEVX.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
+ };