@measured/puck 0.21.0-canary.77444503 → 0.21.0-canary.7c2f9283

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 (46) hide show
  1. package/dist/{Editor-O447AVCX.mjs → Editor-32UYWE6W.mjs} +10 -10
  2. package/dist/{Editor-F2LSS6SE.css → Editor-IQP25PUX.css} +28 -27
  3. package/dist/{Render-QEMDIDQC.css → Render-3OV4N4MT.css} +28 -27
  4. package/dist/{Render-OFE6QLI2.mjs → Render-FXZX6NFH.mjs} +1 -1
  5. package/dist/{actions-ONhOkrvf.d.mts → actions-BkBoKAc5.d.mts} +26 -10
  6. package/dist/{actions-ONhOkrvf.d.ts → actions-BkBoKAc5.d.ts} +26 -10
  7. package/dist/{chunk-QAWJTCV5.mjs → chunk-3VQHXASI.mjs} +1 -1
  8. package/dist/{chunk-BSDEIOEK.mjs → chunk-6KNQXLQR.mjs} +10 -8
  9. package/dist/{chunk-CSSRLPHM.mjs → chunk-AOEDIUVK.mjs} +1 -1
  10. package/dist/{chunk-4277WLKB.mjs → chunk-FCCNEDWR.mjs} +4373 -3687
  11. package/dist/{chunk-PLXSMBAA.mjs → chunk-GVKHZNTR.mjs} +1 -1
  12. package/dist/{chunk-DAQLMM2T.mjs → chunk-K562SEXI.mjs} +97 -6
  13. package/dist/{chunk-QBGM4ELA.mjs → chunk-KN3XDS7U.mjs} +1 -1
  14. package/dist/{chunk-62AAYNXG.mjs → chunk-MEL7FUSF.mjs} +1 -1
  15. package/dist/{chunk-Y656T6AQ.mjs → chunk-NYGQH27S.mjs} +100 -74
  16. package/dist/{chunk-NLUHDYVR.mjs → chunk-Q3TJ2VYO.mjs} +23 -3
  17. package/dist/{chunk-T3WX7XJ6.mjs → chunk-REWRIUGR.mjs} +33 -9
  18. package/dist/{chunk-2Q4PACDA.mjs → chunk-V2IQTPPK.mjs} +4 -4
  19. package/dist/{full-BEMDJKDS.mjs → full-4OS3O57Y.mjs} +8 -8
  20. package/dist/{index-BEoNHRI1.d.ts → index-bqD1SEOb.d.mts} +3 -1
  21. package/dist/{index-DfxZ7tZF.d.mts → index-lt1zf5WR.d.ts} +3 -1
  22. package/dist/index.css +732 -341
  23. package/dist/index.d.mts +28 -9
  24. package/dist/index.d.ts +28 -9
  25. package/dist/index.js +3340 -2427
  26. package/dist/index.mjs +21 -18
  27. package/dist/internal.d.mts +2 -2
  28. package/dist/internal.d.ts +2 -2
  29. package/dist/internal.js +22 -3
  30. package/dist/internal.mjs +2 -2
  31. package/dist/{loaded-JU3A7Y4L.mjs → loaded-DCQVLO7I.mjs} +5 -5
  32. package/dist/{loaded-N3FYGF2Y.mjs → loaded-JGRO7BH7.mjs} +5 -5
  33. package/dist/{loaded-OBY7OMS6.mjs → loaded-KKVJE5KH.mjs} +5 -5
  34. package/dist/no-external.css +870 -475
  35. package/dist/no-external.d.mts +4 -4
  36. package/dist/no-external.d.ts +4 -4
  37. package/dist/no-external.js +3347 -2431
  38. package/dist/no-external.mjs +20 -12
  39. package/dist/rsc.css +28 -27
  40. package/dist/rsc.d.mts +2 -2
  41. package/dist/rsc.d.ts +2 -2
  42. package/dist/rsc.js +146 -83
  43. package/dist/rsc.mjs +4 -4
  44. package/dist/{walk-tree-CdriEzFJ.d.mts → walk-tree-CRRDqx6_.d.mts} +1 -1
  45. package/dist/{walk-tree-DHbAZ4wF.d.ts → walk-tree-CS7sEpfG.d.ts} +1 -1
  46. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapFields
3
- } from "./chunk-NLUHDYVR.mjs";
3
+ } from "./chunk-Q3TJ2VYO.mjs";
4
4
  import {
5
5
  __async,
6
6
  __spreadProps,
@@ -13,9 +13,19 @@ init_react_import();
13
13
  var defaultViewports = [
14
14
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
15
15
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
16
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
16
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
17
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
17
18
  ];
18
19
 
20
+ // lib/data/to-component.ts
21
+ init_react_import();
22
+ var toComponent = (item) => {
23
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
24
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
25
+ type: "root"
26
+ });
27
+ };
28
+
19
29
  // lib/resolve-component-data.ts
20
30
  init_react_import();
21
31
 
@@ -35,14 +45,22 @@ var getChanged = (newItem, oldItem) => {
35
45
  // lib/resolve-component-data.ts
36
46
  import { deepEqual as deepEqual2 } from "fast-equals";
37
47
  var cache = { lastChange: {} };
38
- var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
48
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null) {
39
49
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
40
50
  const resolvedItem = __spreadValues({}, item);
41
51
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
42
52
  const id = "id" in item.props ? item.props.id : "root";
43
53
  if (shouldRunResolver) {
44
- const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
45
- if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
54
+ const {
55
+ item: oldItem = null,
56
+ resolved = {},
57
+ parentId: oldParentId = null
58
+ } = cache.lastChange[id] || {};
59
+ const isRootOrInserted = oldParentId === null;
60
+ const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
61
+ const dataChanged = item && !deepEqual2(item, oldItem);
62
+ const shouldSkip = trigger === "move" && !parentChanged || trigger !== "move" && trigger !== "force" && !dataChanged;
63
+ if (shouldSkip) {
46
64
  return { node: resolved, didChange: false };
47
65
  }
48
66
  const changed = getChanged(item, oldItem);
@@ -53,13 +71,15 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
53
71
  changed,
54
72
  lastData: oldItem,
55
73
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
56
- trigger
74
+ trigger,
75
+ parent
57
76
  });
58
77
  resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
59
78
  if (Object.keys(readOnly).length) {
60
79
  resolvedItem.readOnly = readOnly;
61
80
  }
62
81
  }
82
+ const itemAsComponentData = toComponent(resolvedItem);
63
83
  let itemWithResolvedChildren = yield mapFields(
64
84
  resolvedItem,
65
85
  {
@@ -74,7 +94,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
74
94
  metadata,
75
95
  onResolveStart,
76
96
  onResolveEnd,
77
- trigger
97
+ trigger,
98
+ itemAsComponentData
78
99
  )).node;
79
100
  })
80
101
  )
@@ -88,7 +109,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
88
109
  }
89
110
  cache.lastChange[id] = {
90
111
  item,
91
- resolved: itemWithResolvedChildren
112
+ resolved: itemWithResolvedChildren,
113
+ parentId: parent == null ? void 0 : parent.props.id
92
114
  };
93
115
  return {
94
116
  node: itemWithResolvedChildren,
@@ -116,7 +138,8 @@ var defaultAppState = {
116
138
  options: [],
117
139
  controlsVisible: true
118
140
  },
119
- field: { focus: null }
141
+ field: { focus: null },
142
+ plugin: { current: null }
120
143
  },
121
144
  indexes: {
122
145
  nodes: {},
@@ -127,6 +150,7 @@ var defaultAppState = {
127
150
  export {
128
151
  defaultViewports,
129
152
  getChanged,
153
+ toComponent,
130
154
  resolveComponentData,
131
155
  defaultAppState
132
156
  };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  styles_module_default
3
- } from "./chunk-CSSRLPHM.mjs";
3
+ } from "./chunk-AOEDIUVK.mjs";
4
4
  import {
5
5
  LoadedRichTextMenuInner
6
- } from "./chunk-BSDEIOEK.mjs";
6
+ } from "./chunk-6KNQXLQR.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-DAQLMM2T.mjs";
10
+ } from "./chunk-K562SEXI.mjs";
11
11
  import {
12
12
  get_class_name_factory_default
13
13
  } from "./chunk-Y2EFNT5P.mjs";
@@ -97,7 +97,7 @@ init_react_import();
97
97
  import { lazy, Suspense } from "react";
98
98
  import { jsx as jsx2 } from "react/jsx-runtime";
99
99
  var LoadedRichTextMenuFull = lazy(
100
- () => import("./full-BEMDJKDS.mjs").then((m) => ({
100
+ () => import("./full-4OS3O57Y.mjs").then((m) => ({
101
101
  default: m.LoadedRichTextMenuFull
102
102
  }))
103
103
  );
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-BSDEIOEK.mjs";
4
- import "./chunk-PLXSMBAA.mjs";
5
- import "./chunk-62AAYNXG.mjs";
6
- import "./chunk-QAWJTCV5.mjs";
7
- import "./chunk-DAQLMM2T.mjs";
8
- import "./chunk-QBGM4ELA.mjs";
9
- import "./chunk-T3WX7XJ6.mjs";
3
+ } from "./chunk-6KNQXLQR.mjs";
4
+ import "./chunk-GVKHZNTR.mjs";
5
+ import "./chunk-MEL7FUSF.mjs";
6
+ import "./chunk-3VQHXASI.mjs";
7
+ import "./chunk-K562SEXI.mjs";
8
+ import "./chunk-KN3XDS7U.mjs";
9
+ import "./chunk-REWRIUGR.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
- import "./chunk-NLUHDYVR.mjs";
11
+ import "./chunk-Q3TJ2VYO.mjs";
12
12
  import {
13
13
  __spreadValues,
14
14
  init_react_import
@@ -1,4 +1,4 @@
1
- import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-ONhOkrvf.js';
1
+ import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-BkBoKAc5.mjs';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {
@@ -73,6 +73,7 @@ type ComponentState = Record<string, {
73
73
  loadingCount: number;
74
74
  }>;
75
75
  type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
76
+ instanceId: string;
76
77
  state: G["UserAppState"];
77
78
  dispatch: (action: PuckAction) => void;
78
79
  config: UserConfig;
@@ -95,6 +96,7 @@ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserCon
95
96
  setStatus: (status: Status) => void;
96
97
  iframe: IframeConfig;
97
98
  selectedItem?: G["UserData"]["content"][0] | null;
99
+ getCurrentData: () => G["UserData"]["content"][0] | G["UserData"]["root"];
98
100
  setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
99
101
  getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
100
102
  onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
@@ -1,4 +1,4 @@
1
- import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-ONhOkrvf.mjs';
1
+ import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-BkBoKAc5.js';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {
@@ -73,6 +73,7 @@ type ComponentState = Record<string, {
73
73
  loadingCount: number;
74
74
  }>;
75
75
  type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
76
+ instanceId: string;
76
77
  state: G["UserAppState"];
77
78
  dispatch: (action: PuckAction) => void;
78
79
  config: UserConfig;
@@ -95,6 +96,7 @@ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserCon
95
96
  setStatus: (status: Status) => void;
96
97
  iframe: IframeConfig;
97
98
  selectedItem?: G["UserData"]["content"][0] | null;
99
+ getCurrentData: () => G["UserData"]["content"][0] | G["UserData"]["root"];
98
100
  setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
99
101
  getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
100
102
  onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;