@measured/puck 0.21.0-canary.16a3eee1 → 0.21.0-canary.17395b2c

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-CYTATURR.mjs +204 -0
  2. package/dist/Editor-F2LSS6SE.css +403 -0
  3. package/dist/Render-OFE6QLI2.mjs +55 -0
  4. package/dist/Render-QEMDIDQC.css +101 -0
  5. package/dist/{walk-tree-Ctf3FZQI.d.mts → actions-tsxxcX1z.d.mts} +285 -82
  6. package/dist/{walk-tree-Ctf3FZQI.d.ts → actions-tsxxcX1z.d.ts} +285 -82
  7. package/dist/chunk-72SA22GI.mjs +134 -0
  8. package/dist/chunk-CSSRLPHM.mjs +11 -0
  9. package/dist/chunk-M4QBB3JM.mjs +111 -0
  10. package/dist/chunk-M6W7YEVX.mjs +95 -0
  11. package/dist/chunk-MLTVJA2A.mjs +63 -0
  12. package/dist/chunk-MVJKIFF6.mjs +419 -0
  13. package/dist/chunk-NLUHDYVR.mjs +416 -0
  14. package/dist/chunk-NOJQSXRU.mjs +33 -0
  15. package/dist/chunk-QBGM4ELA.mjs +528 -0
  16. package/dist/chunk-UNQOU2OI.mjs +53 -0
  17. package/dist/chunk-UUOBSXZR.mjs +1807 -0
  18. package/dist/chunk-V5I7CVLT.mjs +103 -0
  19. package/dist/chunk-V7333LON.mjs +708 -0
  20. package/dist/{chunk-JZ2BPCUI.mjs → chunk-V73FDFDB.mjs} +6032 -7351
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-GZ4L3XCF.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 +1032 -387
  27. package/dist/index.d.mts +116 -114
  28. package/dist/index.d.ts +116 -114
  29. package/dist/index.js +8758 -4944
  30. package/dist/index.mjs +34 -12
  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-2MNXXPJP.mjs +57 -0
  36. package/dist/loaded-6QT4HD2O.mjs +57 -0
  37. package/dist/loaded-RVWBFK7L.css +87 -0
  38. package/dist/loaded-ZVPBQVNE.mjs +60 -0
  39. package/dist/no-external.css +1165 -516
  40. package/dist/no-external.d.mts +19 -2
  41. package/dist/no-external.d.ts +19 -2
  42. package/dist/no-external.js +8760 -4943
  43. package/dist/no-external.mjs +36 -9
  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 +421 -32
  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 +31 -4
  52. package/dist/chunk-X7YZ3YE7.mjs +0 -964
@@ -0,0 +1,134 @@
1
+ import {
2
+ mapFields
3
+ } from "./chunk-NLUHDYVR.mjs";
4
+ import {
5
+ __async,
6
+ __spreadProps,
7
+ __spreadValues,
8
+ init_react_import
9
+ } from "./chunk-M6W7YEVX.mjs";
10
+
11
+ // components/ViewportControls/default-viewports.ts
12
+ init_react_import();
13
+ var defaultViewports = [
14
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
15
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
16
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
17
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
18
+ ];
19
+
20
+ // lib/resolve-component-data.ts
21
+ init_react_import();
22
+
23
+ // lib/get-changed.ts
24
+ init_react_import();
25
+ import { deepEqual } from "fast-equals";
26
+ var getChanged = (newItem, oldItem) => {
27
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
28
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
29
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
30
+ return __spreadProps(__spreadValues({}, acc), {
31
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
32
+ });
33
+ }, {}) : {};
34
+ };
35
+
36
+ // lib/resolve-component-data.ts
37
+ import { deepEqual as deepEqual2 } from "fast-equals";
38
+ var cache = { lastChange: {} };
39
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
40
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
41
+ const resolvedItem = __spreadValues({}, item);
42
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
43
+ const id = "id" in item.props ? item.props.id : "root";
44
+ if (shouldRunResolver) {
45
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
46
+ if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
47
+ return { node: resolved, didChange: false };
48
+ }
49
+ const changed = getChanged(item, oldItem);
50
+ if (onResolveStart) {
51
+ onResolveStart(item);
52
+ }
53
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
54
+ changed,
55
+ lastData: oldItem,
56
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
57
+ trigger
58
+ });
59
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
60
+ if (Object.keys(readOnly).length) {
61
+ resolvedItem.readOnly = readOnly;
62
+ }
63
+ }
64
+ let itemWithResolvedChildren = yield mapFields(
65
+ resolvedItem,
66
+ {
67
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
68
+ const content = value;
69
+ return yield Promise.all(
70
+ content.map(
71
+ (childItem) => __async(null, null, function* () {
72
+ return (yield resolveComponentData(
73
+ childItem,
74
+ config,
75
+ metadata,
76
+ onResolveStart,
77
+ onResolveEnd,
78
+ trigger
79
+ )).node;
80
+ })
81
+ )
82
+ );
83
+ })
84
+ },
85
+ config
86
+ );
87
+ if (shouldRunResolver && onResolveEnd) {
88
+ onResolveEnd(resolvedItem);
89
+ }
90
+ cache.lastChange[id] = {
91
+ item,
92
+ resolved: itemWithResolvedChildren
93
+ };
94
+ return {
95
+ node: itemWithResolvedChildren,
96
+ didChange: !deepEqual2(item, itemWithResolvedChildren)
97
+ };
98
+ });
99
+
100
+ // store/default-app-state.ts
101
+ init_react_import();
102
+ var defaultAppState = {
103
+ data: { content: [], root: {}, zones: {} },
104
+ ui: {
105
+ leftSideBarVisible: true,
106
+ rightSideBarVisible: true,
107
+ arrayState: {},
108
+ itemSelector: null,
109
+ componentList: {},
110
+ isDragging: false,
111
+ previewMode: "edit",
112
+ viewports: {
113
+ current: {
114
+ width: defaultViewports[0].width,
115
+ height: defaultViewports[0].height || "auto"
116
+ },
117
+ options: [],
118
+ controlsVisible: true
119
+ },
120
+ field: { focus: null },
121
+ plugin: { current: null }
122
+ },
123
+ indexes: {
124
+ nodes: {},
125
+ zones: {}
126
+ }
127
+ };
128
+
129
+ export {
130
+ defaultViewports,
131
+ getChanged,
132
+ resolveComponentData,
133
+ defaultAppState
134
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ init_react_import
3
+ } from "./chunk-M6W7YEVX.mjs";
4
+
5
+ // css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css#css-module
6
+ init_react_import();
7
+ var styles_module_default = { "RichTextEditor": "_RichTextEditor_1elol_1", "RichTextEditor--editor": "_RichTextEditor--editor_1elol_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_1elol_106", "RichTextEditor--isActive": "_RichTextEditor--isActive_1elol_110", "RichTextEditor-menu": "_RichTextEditor-menu_1elol_116" };
8
+
9
+ export {
10
+ styles_module_default
11
+ };
@@ -0,0 +1,111 @@
1
+ import {
2
+ styles_module_default
3
+ } from "./chunk-CSSRLPHM.mjs";
4
+ import {
5
+ LoadedRichTextMenuInner
6
+ } from "./chunk-V7333LON.mjs";
7
+ import {
8
+ useAppStore,
9
+ useAppStoreApi
10
+ } from "./chunk-UUOBSXZR.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-GZ4L3XCF.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,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,63 @@
1
+ import {
2
+ Heading1,
3
+ Heading2,
4
+ Heading3,
5
+ Heading4,
6
+ Heading5,
7
+ Heading6
8
+ } from "./chunk-UUOBSXZR.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
+ };