@measured/puck 0.21.0-canary.f5820ce9 → 0.21.0-canary.fee2ba98

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-EHVB6NFF.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-DwdqNb63.d.mts} +265 -75
  6. package/dist/{walk-tree-Ctf3FZQI.d.ts → actions-DwdqNb63.d.ts} +265 -75
  7. package/dist/chunk-2334PLLL.mjs +111 -0
  8. package/dist/chunk-4N3WJM5Y.mjs +33 -0
  9. package/dist/{chunk-AO6Y47WD.mjs → chunk-6AGLD64M.mjs} +4819 -6477
  10. package/dist/chunk-CSSRLPHM.mjs +11 -0
  11. package/dist/chunk-D6RJOV2Z.mjs +1727 -0
  12. package/dist/chunk-M6W7YEVX.mjs +95 -0
  13. package/dist/chunk-NLUHDYVR.mjs +416 -0
  14. package/dist/chunk-NQEE2254.mjs +706 -0
  15. package/dist/chunk-PXYVL42X.mjs +53 -0
  16. package/dist/chunk-QBGM4ELA.mjs +528 -0
  17. package/dist/chunk-QLQZDFXM.mjs +63 -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-TVZATY2K.mjs +93 -0
  24. package/dist/index-AfAtzigt.d.ts +117 -0
  25. package/dist/index-jxA1wrW4.d.mts +117 -0
  26. package/dist/index.css +278 -22
  27. package/dist/index.d.mts +99 -113
  28. package/dist/index.d.ts +99 -113
  29. package/dist/index.js +6647 -3315
  30. package/dist/index.mjs +26 -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-ICVILKS6.mjs +60 -0
  36. package/dist/loaded-IHAGHNLA.mjs +57 -0
  37. package/dist/loaded-ONU7LATV.mjs +57 -0
  38. package/dist/loaded-RVWBFK7L.css +87 -0
  39. package/dist/no-external.css +425 -165
  40. package/dist/no-external.d.mts +19 -2
  41. package/dist/no-external.d.ts +19 -2
  42. package/dist/no-external.js +6646 -3311
  43. package/dist/no-external.mjs +28 -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 +417 -30
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-DRy9ca1P.d.ts +29 -0
  50. package/dist/walk-tree-Dppc3XGY.d.mts +29 -0
  51. package/package.json +31 -4
  52. package/dist/chunk-VBJEDLUM.mjs +0 -965
@@ -0,0 +1,132 @@
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
+ ];
18
+
19
+ // lib/resolve-component-data.ts
20
+ init_react_import();
21
+
22
+ // lib/get-changed.ts
23
+ init_react_import();
24
+ import { deepEqual } from "fast-equals";
25
+ var getChanged = (newItem, oldItem) => {
26
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
27
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
28
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
29
+ return __spreadProps(__spreadValues({}, acc), {
30
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
31
+ });
32
+ }, {}) : {};
33
+ };
34
+
35
+ // lib/resolve-component-data.ts
36
+ import { deepEqual as deepEqual2 } from "fast-equals";
37
+ var cache = { lastChange: {} };
38
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
39
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
40
+ const resolvedItem = __spreadValues({}, item);
41
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
42
+ const id = "id" in item.props ? item.props.id : "root";
43
+ if (shouldRunResolver) {
44
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
45
+ if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
46
+ return { node: resolved, didChange: false };
47
+ }
48
+ const changed = getChanged(item, oldItem);
49
+ if (onResolveStart) {
50
+ onResolveStart(item);
51
+ }
52
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
53
+ changed,
54
+ lastData: oldItem,
55
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
56
+ trigger
57
+ });
58
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
59
+ if (Object.keys(readOnly).length) {
60
+ resolvedItem.readOnly = readOnly;
61
+ }
62
+ }
63
+ let itemWithResolvedChildren = yield mapFields(
64
+ resolvedItem,
65
+ {
66
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
67
+ const content = value;
68
+ return yield Promise.all(
69
+ content.map(
70
+ (childItem) => __async(null, null, function* () {
71
+ return (yield resolveComponentData(
72
+ childItem,
73
+ config,
74
+ metadata,
75
+ onResolveStart,
76
+ onResolveEnd,
77
+ trigger
78
+ )).node;
79
+ })
80
+ )
81
+ );
82
+ })
83
+ },
84
+ config
85
+ );
86
+ if (shouldRunResolver && onResolveEnd) {
87
+ onResolveEnd(resolvedItem);
88
+ }
89
+ cache.lastChange[id] = {
90
+ item,
91
+ resolved: itemWithResolvedChildren
92
+ };
93
+ return {
94
+ node: itemWithResolvedChildren,
95
+ didChange: !deepEqual2(item, itemWithResolvedChildren)
96
+ };
97
+ });
98
+
99
+ // store/default-app-state.ts
100
+ init_react_import();
101
+ var defaultAppState = {
102
+ data: { content: [], root: {}, zones: {} },
103
+ ui: {
104
+ leftSideBarVisible: true,
105
+ rightSideBarVisible: true,
106
+ arrayState: {},
107
+ itemSelector: null,
108
+ componentList: {},
109
+ isDragging: false,
110
+ previewMode: "edit",
111
+ viewports: {
112
+ current: {
113
+ width: defaultViewports[0].width,
114
+ height: defaultViewports[0].height || "auto"
115
+ },
116
+ options: [],
117
+ controlsVisible: true
118
+ },
119
+ field: { focus: null }
120
+ },
121
+ indexes: {
122
+ nodes: {},
123
+ zones: {}
124
+ }
125
+ };
126
+
127
+ export {
128
+ defaultViewports,
129
+ getChanged,
130
+ resolveComponentData,
131
+ defaultAppState
132
+ };
@@ -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
+ */