@measured/puck 0.21.0-canary.3aa27d1d → 0.21.0-canary.41d0882b

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-IQP25PUX.css +404 -0
  2. package/dist/Editor-L3JAAT2X.mjs +204 -0
  3. package/dist/Render-3OV4N4MT.css +102 -0
  4. package/dist/Render-FXZX6NFH.mjs +55 -0
  5. package/dist/{walk-tree-16XYcbNo.d.mts → actions-tsxxcX1z.d.mts} +29 -40
  6. package/dist/{walk-tree-16XYcbNo.d.ts → actions-tsxxcX1z.d.ts} +29 -40
  7. package/dist/chunk-23IZFPL7.mjs +528 -0
  8. package/dist/chunk-3SDLQIUZ.mjs +429 -0
  9. package/dist/chunk-45I5SDOI.mjs +134 -0
  10. package/dist/chunk-5ZZVX2Z3.mjs +63 -0
  11. package/dist/chunk-AOEDIUVK.mjs +11 -0
  12. package/dist/chunk-B7REOAA7.mjs +435 -0
  13. package/dist/chunk-BXQQARCR.mjs +708 -0
  14. package/dist/{chunk-GFIVKP2H.mjs → chunk-CQUAWHOK.mjs} +6092 -8451
  15. package/dist/chunk-D2SRL6YA.mjs +1807 -0
  16. package/dist/chunk-LJEGWHDD.mjs +53 -0
  17. package/dist/chunk-M6W7YEVX.mjs +95 -0
  18. package/dist/chunk-PBAAIKXA.mjs +111 -0
  19. package/dist/chunk-U4VSQKO3.mjs +33 -0
  20. package/dist/chunk-V5I7CVLT.mjs +103 -0
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-L7DWVNTZ.mjs +93 -0
  24. package/dist/index-Ca6V6NQD.d.ts +118 -0
  25. package/dist/index-mQvUCH3C.d.mts +118 -0
  26. package/dist/index.css +858 -459
  27. package/dist/index.d.mts +32 -129
  28. package/dist/index.d.ts +32 -129
  29. package/dist/index.js +9406 -6857
  30. package/dist/index.mjs +32 -14
  31. package/dist/internal.d.mts +27 -0
  32. package/dist/internal.d.ts +27 -0
  33. package/dist/internal.js +927 -0
  34. package/dist/internal.mjs +13 -0
  35. package/dist/loaded-2HLHDP2G.mjs +57 -0
  36. package/dist/loaded-LZUXYAGW.mjs +60 -0
  37. package/dist/loaded-RVWBFK7L.css +87 -0
  38. package/dist/loaded-UHVTB6OD.mjs +57 -0
  39. package/dist/no-external.css +990 -587
  40. package/dist/no-external.d.mts +4 -2
  41. package/dist/no-external.d.ts +4 -2
  42. package/dist/no-external.js +9407 -6855
  43. package/dist/no-external.mjs +34 -11
  44. package/dist/rsc.css +35 -26
  45. package/dist/rsc.d.mts +2 -2
  46. package/dist/rsc.d.ts +2 -2
  47. package/dist/rsc.js +300 -215
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
  50. package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
  51. package/package.json +9 -4
  52. package/dist/chunk-SRDLYODX.mjs +0 -1245
@@ -0,0 +1,53 @@
1
+ import {
2
+ AlignCenter,
3
+ AlignJustify,
4
+ AlignLeft,
5
+ AlignRight
6
+ } from "./chunk-D2SRL6YA.mjs";
7
+ import {
8
+ init_react_import
9
+ } from "./chunk-M6W7YEVX.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
+ };
@@ -0,0 +1,95 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __esm = (fn, res) => function __init() {
37
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
38
+ };
39
+ var __commonJS = (cb, mod) => function __require() {
40
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
41
+ };
42
+ var __copyProps = (to, from, except, desc) => {
43
+ if (from && typeof from === "object" || typeof from === "function") {
44
+ for (let key of __getOwnPropNames(from))
45
+ if (!__hasOwnProp.call(to, key) && key !== except)
46
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
47
+ }
48
+ return to;
49
+ };
50
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
51
+ // If the importer is in node compatibility mode or this is not an ESM
52
+ // file that has been converted to a CommonJS file using a Babel-
53
+ // compatible transform (i.e. "__esModule" has not been set), then set
54
+ // "default" to the CommonJS "module.exports" for node compatibility.
55
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
56
+ mod
57
+ ));
58
+ var __async = (__this, __arguments, generator) => {
59
+ return new Promise((resolve, reject) => {
60
+ var fulfilled = (value) => {
61
+ try {
62
+ step(generator.next(value));
63
+ } catch (e) {
64
+ reject(e);
65
+ }
66
+ };
67
+ var rejected = (value) => {
68
+ try {
69
+ step(generator.throw(value));
70
+ } catch (e) {
71
+ reject(e);
72
+ }
73
+ };
74
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
75
+ step((generator = generator.apply(__this, __arguments)).next());
76
+ });
77
+ };
78
+
79
+ // ../tsup-config/react-import.js
80
+ import React from "react";
81
+ var init_react_import = __esm({
82
+ "../tsup-config/react-import.js"() {
83
+ "use strict";
84
+ }
85
+ });
86
+
87
+ export {
88
+ __spreadValues,
89
+ __spreadProps,
90
+ __objRest,
91
+ __commonJS,
92
+ __toESM,
93
+ __async,
94
+ init_react_import
95
+ };
@@ -0,0 +1,111 @@
1
+ import {
2
+ styles_module_default
3
+ } from "./chunk-AOEDIUVK.mjs";
4
+ import {
5
+ LoadedRichTextMenuInner
6
+ } from "./chunk-BXQQARCR.mjs";
7
+ import {
8
+ useAppStore,
9
+ useAppStoreApi
10
+ } from "./chunk-D2SRL6YA.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-L7DWVNTZ.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,33 @@
1
+ import {
2
+ List,
3
+ ListOrdered
4
+ } from "./chunk-D2SRL6YA.mjs";
5
+ import {
6
+ init_react_import
7
+ } from "./chunk-M6W7YEVX.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
+ };
@@ -0,0 +1,103 @@
1
+ import {
2
+ __spreadValues,
3
+ init_react_import
4
+ } from "./chunk-M6W7YEVX.mjs";
5
+
6
+ // components/RichTextEditor/extension.ts
7
+ init_react_import();
8
+ import { Extension } from "@tiptap/core";
9
+ import { Blockquote } from "@tiptap/extension-blockquote";
10
+ import { Bold } from "@tiptap/extension-bold";
11
+ import { Code } from "@tiptap/extension-code";
12
+ import { CodeBlock } from "@tiptap/extension-code-block";
13
+ import { Document } from "@tiptap/extension-document";
14
+ import { HardBreak } from "@tiptap/extension-hard-break";
15
+ import { Heading } from "@tiptap/extension-heading";
16
+ import { HorizontalRule } from "@tiptap/extension-horizontal-rule";
17
+ import { Italic } from "@tiptap/extension-italic";
18
+ import { Link } from "@tiptap/extension-link";
19
+ import {
20
+ BulletList,
21
+ ListItem,
22
+ ListKeymap,
23
+ OrderedList
24
+ } from "@tiptap/extension-list";
25
+ import { Paragraph } from "@tiptap/extension-paragraph";
26
+ import { Strike } from "@tiptap/extension-strike";
27
+ import { Text } from "@tiptap/extension-text";
28
+ import TextAlign from "@tiptap/extension-text-align";
29
+ import { Underline } from "@tiptap/extension-underline";
30
+ var defaultPuckRichTextOptions = {
31
+ textAlign: {
32
+ types: ["heading", "paragraph"]
33
+ }
34
+ };
35
+ var PuckRichText = Extension.create({
36
+ name: "puckRichText",
37
+ addExtensions() {
38
+ const extensions = [];
39
+ const options = __spreadValues(__spreadValues({}, this.options), defaultPuckRichTextOptions);
40
+ if (options.bold !== false) {
41
+ extensions.push(Bold.configure(options.bold));
42
+ }
43
+ if (options.blockquote !== false) {
44
+ extensions.push(Blockquote.configure(options.blockquote));
45
+ }
46
+ if (options.bulletList !== false) {
47
+ extensions.push(BulletList.configure(options.bulletList));
48
+ }
49
+ if (options.code !== false) {
50
+ extensions.push(Code.configure(options.code));
51
+ }
52
+ if (options.codeBlock !== false) {
53
+ extensions.push(CodeBlock.configure(options.codeBlock));
54
+ }
55
+ if (options.document !== false) {
56
+ extensions.push(Document.configure(options.document));
57
+ }
58
+ if (options.hardBreak !== false) {
59
+ extensions.push(HardBreak.configure(options.hardBreak));
60
+ }
61
+ if (options.heading !== false) {
62
+ extensions.push(Heading.configure(options.heading));
63
+ }
64
+ if (options.horizontalRule !== false) {
65
+ extensions.push(HorizontalRule.configure(options.horizontalRule));
66
+ }
67
+ if (options.italic !== false) {
68
+ extensions.push(Italic.configure(options.italic));
69
+ }
70
+ if (options.listItem !== false) {
71
+ extensions.push(ListItem.configure(options.listItem));
72
+ }
73
+ if (options.listKeymap !== false) {
74
+ extensions.push(ListKeymap.configure(options == null ? void 0 : options.listKeymap));
75
+ }
76
+ if (options.link !== false) {
77
+ extensions.push(Link.configure(options == null ? void 0 : options.link));
78
+ }
79
+ if (options.orderedList !== false) {
80
+ extensions.push(OrderedList.configure(options.orderedList));
81
+ }
82
+ if (options.paragraph !== false) {
83
+ extensions.push(Paragraph.configure(options.paragraph));
84
+ }
85
+ if (options.strike !== false) {
86
+ extensions.push(Strike.configure(options.strike));
87
+ }
88
+ if (options.text !== false) {
89
+ extensions.push(Text.configure(options.text));
90
+ }
91
+ if (options.textAlign !== false) {
92
+ extensions.push(TextAlign.configure(options.textAlign));
93
+ }
94
+ if (options.underline !== false) {
95
+ extensions.push(Underline.configure(options == null ? void 0 : options.underline));
96
+ }
97
+ return extensions;
98
+ }
99
+ });
100
+
101
+ export {
102
+ PuckRichText
103
+ };
@@ -0,0 +1,108 @@
1
+ import {
2
+ __commonJS,
3
+ __spreadValues,
4
+ __toESM,
5
+ init_react_import
6
+ } from "./chunk-M6W7YEVX.mjs";
7
+
8
+ // ../../node_modules/classnames/index.js
9
+ var require_classnames = __commonJS({
10
+ "../../node_modules/classnames/index.js"(exports, module) {
11
+ "use strict";
12
+ init_react_import();
13
+ (function() {
14
+ "use strict";
15
+ var hasOwn = {}.hasOwnProperty;
16
+ function classNames() {
17
+ var classes = "";
18
+ for (var i = 0; i < arguments.length; i++) {
19
+ var arg = arguments[i];
20
+ if (arg) {
21
+ classes = appendClass(classes, parseValue(arg));
22
+ }
23
+ }
24
+ return classes;
25
+ }
26
+ function parseValue(arg) {
27
+ if (typeof arg === "string" || typeof arg === "number") {
28
+ return arg;
29
+ }
30
+ if (typeof arg !== "object") {
31
+ return "";
32
+ }
33
+ if (Array.isArray(arg)) {
34
+ return classNames.apply(null, arg);
35
+ }
36
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
37
+ return arg.toString();
38
+ }
39
+ var classes = "";
40
+ for (var key in arg) {
41
+ if (hasOwn.call(arg, key) && arg[key]) {
42
+ classes = appendClass(classes, key);
43
+ }
44
+ }
45
+ return classes;
46
+ }
47
+ function appendClass(value, newClass) {
48
+ if (!newClass) {
49
+ return value;
50
+ }
51
+ if (value) {
52
+ return value + " " + newClass;
53
+ }
54
+ return value + newClass;
55
+ }
56
+ if (typeof module !== "undefined" && module.exports) {
57
+ classNames.default = classNames;
58
+ module.exports = classNames;
59
+ } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
60
+ define("classnames", [], function() {
61
+ return classNames;
62
+ });
63
+ } else {
64
+ window.classNames = classNames;
65
+ }
66
+ })();
67
+ }
68
+ });
69
+
70
+ // lib/get-class-name-factory.ts
71
+ init_react_import();
72
+ var import_classnames = __toESM(require_classnames());
73
+ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
74
+ if (typeof options === "string") {
75
+ const descendant = options;
76
+ const style = styles[`${rootClass}-${descendant}`];
77
+ if (style) {
78
+ return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
79
+ }
80
+ return "";
81
+ } else if (typeof options === "object") {
82
+ const modifiers = options;
83
+ const prefixedModifiers = {};
84
+ for (let modifier in modifiers) {
85
+ prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
86
+ }
87
+ const c = styles[rootClass];
88
+ return config.baseClass + (0, import_classnames.default)(__spreadValues({
89
+ [c]: !!c
90
+ }, prefixedModifiers));
91
+ } else {
92
+ return config.baseClass + styles[rootClass] || "";
93
+ }
94
+ };
95
+ var get_class_name_factory_default = getClassNameFactory;
96
+
97
+ export {
98
+ get_class_name_factory_default
99
+ };
100
+ /*! Bundled license information:
101
+
102
+ classnames/index.js:
103
+ (*!
104
+ Copyright (c) 2018 Jed Watson.
105
+ Licensed under the MIT License (MIT), see
106
+ http://jedwatson.github.io/classnames
107
+ *)
108
+ */