@measured/puck 0.21.0-canary.ace4c8b3 → 0.21.0-canary.b353d921

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 (40) 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-C2TVYIYC.mjs +415 -0
  8. package/dist/chunk-DCSQEDMK.mjs +194 -0
  9. package/dist/{chunk-TC25DCTQ.mjs → chunk-DJSH5REF.mjs} +70 -498
  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-AIFI2M23.mjs → chunk-TB3SSIAY.mjs} +1041 -2778
  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 +278 -22
  20. package/dist/index.d.mts +100 -7
  21. package/dist/index.d.ts +100 -7
  22. package/dist/index.js +5811 -2550
  23. package/dist/index.mjs +25 -9
  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 +278 -22
  29. package/dist/no-external.d.mts +17 -2
  30. package/dist/no-external.d.ts +17 -2
  31. package/dist/no-external.js +5811 -2550
  32. package/dist/no-external.mjs +25 -9
  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 -22
  37. package/dist/rsc.mjs +16 -9
  38. package/dist/{walk-tree-CkSoNBF7.d.mts → walk-tree-Ja9bNCM9.d.mts} +208 -7
  39. package/dist/{walk-tree-CkSoNBF7.d.ts → walk-tree-Ja9bNCM9.d.ts} +208 -7
  40. package/package.json +23 -1
@@ -0,0 +1,53 @@
1
+ import {
2
+ PuckRichText
3
+ } from "./chunk-R6CVX2IY.mjs";
4
+ import {
5
+ styles_module_default
6
+ } from "./chunk-WUWXFMEM.mjs";
7
+ import {
8
+ get_class_name_factory_default,
9
+ init_react_import
10
+ } from "./chunk-DCSQEDMK.mjs";
11
+
12
+ // components/RichTextEditor/components/Render.tsx
13
+ init_react_import();
14
+ import { generateHTML, generateJSON } from "@tiptap/html";
15
+ import { useMemo } from "react";
16
+ import { jsx } from "react/jsx-runtime";
17
+ var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
18
+ function RichTextRender({
19
+ content,
20
+ field
21
+ }) {
22
+ const { tiptap = {}, options } = field;
23
+ const { extensions = [] } = tiptap;
24
+ const loadedExtensions = useMemo(
25
+ () => [PuckRichText.configure(options), ...extensions],
26
+ [field, extensions]
27
+ );
28
+ const normalized = useMemo(() => {
29
+ if (typeof content === "object" && (content == null ? void 0 : content.type) === "doc") {
30
+ return content;
31
+ }
32
+ if (typeof content === "string") {
33
+ const isHtml = /<\/?[a-z][\s\S]*>/i.test(content);
34
+ if (isHtml) {
35
+ return generateJSON(content, loadedExtensions);
36
+ }
37
+ return {
38
+ type: "doc",
39
+ content: [
40
+ { type: "paragraph", content: [{ type: "text", text: content }] }
41
+ ]
42
+ };
43
+ }
44
+ return { type: "doc", content: [] };
45
+ }, [content, loadedExtensions]);
46
+ const html = useMemo(() => {
47
+ return generateHTML(normalized, loadedExtensions);
48
+ }, [normalized, loadedExtensions]);
49
+ return /* @__PURE__ */ jsx("div", { className: getClassName(), children: /* @__PURE__ */ jsx("div", { className: "rich-text", dangerouslySetInnerHTML: { __html: html } }) });
50
+ }
51
+ export {
52
+ RichTextRender
53
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ List,
3
+ ListOrdered
4
+ } from "./chunk-7KY6RHEY.mjs";
5
+ import {
6
+ init_react_import
7
+ } from "./chunk-DCSQEDMK.mjs";
8
+
9
+ // components/RichTextMenu/controls/ListSelect/use-options.ts
10
+ init_react_import();
11
+ import { useMemo } from "react";
12
+ var optionNodes = {
13
+ ul: { label: "Bullet list", icon: List },
14
+ ol: { label: "Numbered list", icon: ListOrdered }
15
+ };
16
+ var useListOptions = (fieldOptions) => {
17
+ let blockOptions = [];
18
+ if ((fieldOptions == null ? void 0 : fieldOptions.listItem) !== false) {
19
+ blockOptions = ["ul", "ol"];
20
+ }
21
+ return useMemo(
22
+ () => blockOptions.map((item) => ({
23
+ value: item,
24
+ label: optionNodes[item].label,
25
+ icon: optionNodes[item].icon
26
+ })),
27
+ [blockOptions]
28
+ );
29
+ };
30
+
31
+ export {
32
+ useListOptions
33
+ };