@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,93 @@
1
+ import {
2
+ LoadedRichTextMenuInner
3
+ } from "./chunk-NQEE2254.mjs";
4
+ import "./chunk-PXYVL42X.mjs";
5
+ import "./chunk-QLQZDFXM.mjs";
6
+ import "./chunk-4N3WJM5Y.mjs";
7
+ import "./chunk-D6RJOV2Z.mjs";
8
+ import "./chunk-QBGM4ELA.mjs";
9
+ import "./chunk-T3WX7XJ6.mjs";
10
+ import "./chunk-Y2EFNT5P.mjs";
11
+ import "./chunk-NLUHDYVR.mjs";
12
+ import {
13
+ __spreadValues,
14
+ init_react_import
15
+ } from "./chunk-M6W7YEVX.mjs";
16
+
17
+ // components/RichTextMenu/full.tsx
18
+ init_react_import();
19
+ import { useEditorState } from "@tiptap/react";
20
+ import { useMemo } from "react";
21
+
22
+ // components/RichTextEditor/selector.ts
23
+ init_react_import();
24
+ var defaultEditorState = (ctx, readOnly) => {
25
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
26
+ const editor = ctx.editor;
27
+ if (!editor) return {};
28
+ const canChain = () => editor.can().chain();
29
+ return {
30
+ isAlignLeft: editor.isActive({ textAlign: "left" }),
31
+ canAlignLeft: !readOnly && ((_b = (_a = canChain()).setTextAlign) == null ? void 0 : _b.call(_a, "left").run()),
32
+ isAlignCenter: editor.isActive({ textAlign: "center" }),
33
+ canAlignCenter: !readOnly && ((_d = (_c = canChain()).setTextAlign) == null ? void 0 : _d.call(_c, "center").run()),
34
+ isAlignRight: editor.isActive({ textAlign: "right" }),
35
+ canAlignRight: !readOnly && ((_f = (_e = canChain()).setTextAlign) == null ? void 0 : _f.call(_e, "right").run()),
36
+ isAlignJustify: editor.isActive({ textAlign: "justify" }),
37
+ canAlignJustify: !readOnly && ((_h = (_g = canChain()).setTextAlign) == null ? void 0 : _h.call(_g, "justify").run()),
38
+ isBold: editor.isActive("bold"),
39
+ canBold: !readOnly && ((_j = (_i = canChain()).toggleBold) == null ? void 0 : _j.call(_i).run()),
40
+ isItalic: editor.isActive("italic"),
41
+ canItalic: !readOnly && ((_l = (_k = canChain()).toggleItalic) == null ? void 0 : _l.call(_k).run()),
42
+ isUnderline: editor.isActive("underline"),
43
+ canUnderline: !readOnly && ((_n = (_m = canChain()).toggleUnderline) == null ? void 0 : _n.call(_m).run()),
44
+ isStrike: editor.isActive("strike"),
45
+ canStrike: !readOnly && ((_p = (_o = canChain()).toggleStrike) == null ? void 0 : _p.call(_o).run()),
46
+ isInlineCode: editor.isActive("code"),
47
+ canInlineCode: !readOnly && ((_r = (_q = canChain()).toggleCode) == null ? void 0 : _r.call(_q).run()),
48
+ isBulletList: editor.isActive("bulletList"),
49
+ canBulletList: !readOnly && ((_t = (_s = canChain()).toggleBulletList) == null ? void 0 : _t.call(_s).run()),
50
+ isOrderedList: editor.isActive("orderedList"),
51
+ canOrderedList: !readOnly && ((_v = (_u = canChain()).toggleOrderedList) == null ? void 0 : _v.call(_u).run()),
52
+ isCodeBlock: editor.isActive("codeBlock"),
53
+ canCodeBlock: !readOnly && ((_x = (_w = canChain()).toggleCodeBlock) == null ? void 0 : _x.call(_w).run()),
54
+ isBlockquote: editor.isActive("blockquote"),
55
+ canBlockquote: !readOnly && ((_z = (_y = canChain()).toggleBlockquote) == null ? void 0 : _z.call(_y).run()),
56
+ canHorizontalRule: !readOnly && ((_B = (_A = canChain()).setHorizontalRule) == null ? void 0 : _B.call(_A).run())
57
+ };
58
+ };
59
+
60
+ // components/RichTextMenu/full.tsx
61
+ import { jsx } from "react/jsx-runtime";
62
+ var LoadedRichTextMenuFull = ({
63
+ editor,
64
+ field,
65
+ readOnly,
66
+ inline
67
+ }) => {
68
+ const { tiptap = {} } = field;
69
+ const { selector } = tiptap;
70
+ const resolvedSelector = useMemo(() => {
71
+ return (ctx) => __spreadValues(__spreadValues({}, defaultEditorState(ctx, readOnly)), selector ? selector(ctx, readOnly) : {});
72
+ }, [selector, readOnly]);
73
+ const editorState = useEditorState({
74
+ editor,
75
+ selector: resolvedSelector
76
+ });
77
+ if (!editor || !editorState) {
78
+ return null;
79
+ }
80
+ return /* @__PURE__ */ jsx(
81
+ LoadedRichTextMenuInner,
82
+ {
83
+ editor,
84
+ editorState,
85
+ field,
86
+ readOnly,
87
+ inline
88
+ }
89
+ );
90
+ };
91
+ export {
92
+ LoadedRichTextMenuFull
93
+ };
@@ -0,0 +1,117 @@
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-DwdqNb63.js';
2
+ import { Editor } from '@tiptap/react';
3
+
4
+ type HistorySlice<D = any> = {
5
+ index: number;
6
+ hasPast: () => boolean;
7
+ hasFuture: () => boolean;
8
+ histories: History<D>[];
9
+ record: (data: D) => void;
10
+ back: VoidFunction;
11
+ forward: VoidFunction;
12
+ currentHistory: () => History;
13
+ nextHistory: () => History<D> | null;
14
+ prevHistory: () => History<D> | null;
15
+ setHistories: (histories: History[]) => void;
16
+ setHistoryIndex: (index: number) => void;
17
+ initialAppState: D;
18
+ };
19
+
20
+ type NodeMethods = {
21
+ sync: () => void;
22
+ hideOverlay: () => void;
23
+ showOverlay: () => void;
24
+ };
25
+ type PuckNodeInstance = {
26
+ id: string;
27
+ methods: NodeMethods;
28
+ element: HTMLElement | null;
29
+ };
30
+ type NodesSlice = {
31
+ nodes: Record<string, PuckNodeInstance | undefined>;
32
+ registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
33
+ unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
34
+ };
35
+
36
+ type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
37
+ item?: G["UserComponentData"] | null;
38
+ type?: keyof G["UserProps"];
39
+ root?: boolean;
40
+ };
41
+ type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
42
+ type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
43
+ type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
44
+ type Cache = Record<string, {
45
+ lastPermissions: Partial<Permissions>;
46
+ lastData: ComponentData | null;
47
+ lastParentId: string | null;
48
+ }>;
49
+ type PermissionsSlice = {
50
+ cache: Cache;
51
+ globalPermissions: Permissions;
52
+ resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
53
+ getPermissions: GetPermissions<Config>;
54
+ resolvePermissions: ResolvePermissions<Config>;
55
+ refreshPermissions: RefreshPermissions<Config>;
56
+ };
57
+
58
+ type ComponentOrRootData = Omit<ComponentData<any>, "type">;
59
+ type FieldsSlice = {
60
+ fields: Fields | Partial<Fields>;
61
+ loading: boolean;
62
+ lastResolvedData: Partial<ComponentOrRootData>;
63
+ id: string | undefined;
64
+ };
65
+
66
+ type Status = "LOADING" | "MOUNTED" | "READY";
67
+ type ZoomConfig = {
68
+ autoZoom: number;
69
+ rootHeight: number;
70
+ zoom: number;
71
+ };
72
+ type ComponentState = Record<string, {
73
+ loadingCount: number;
74
+ }>;
75
+ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
76
+ state: G["UserAppState"];
77
+ dispatch: (action: PuckAction) => void;
78
+ config: UserConfig;
79
+ componentState: ComponentState;
80
+ setComponentState: (componentState: ComponentState) => void;
81
+ setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
82
+ unsetComponentLoading: (id: string) => void;
83
+ pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
84
+ resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
85
+ node: T;
86
+ didChange: boolean;
87
+ }>;
88
+ resolveAndCommitData: () => void;
89
+ plugins: Plugin[];
90
+ overrides: Partial<Overrides>;
91
+ viewports: Viewports;
92
+ zoomConfig: ZoomConfig;
93
+ setZoomConfig: (zoomConfig: ZoomConfig) => void;
94
+ status: Status;
95
+ setStatus: (status: Status) => void;
96
+ iframe: IframeConfig;
97
+ selectedItem?: G["UserData"]["content"][0] | null;
98
+ getCurrentData: () => G["UserData"]["content"][0] | G["UserData"]["root"];
99
+ setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
100
+ getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
101
+ onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
102
+ metadata: Metadata;
103
+ fields: FieldsSlice;
104
+ history: HistorySlice;
105
+ nodes: NodesSlice;
106
+ permissions: PermissionsSlice;
107
+ fieldTransforms: FieldTransforms;
108
+ currentRichText?: {
109
+ inlineComponentId?: string;
110
+ inline: boolean;
111
+ field: RichtextField;
112
+ editor: Editor;
113
+ id: string;
114
+ } | null;
115
+ };
116
+
117
+ export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
@@ -0,0 +1,117 @@
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-DwdqNb63.mjs';
2
+ import { Editor } from '@tiptap/react';
3
+
4
+ type HistorySlice<D = any> = {
5
+ index: number;
6
+ hasPast: () => boolean;
7
+ hasFuture: () => boolean;
8
+ histories: History<D>[];
9
+ record: (data: D) => void;
10
+ back: VoidFunction;
11
+ forward: VoidFunction;
12
+ currentHistory: () => History;
13
+ nextHistory: () => History<D> | null;
14
+ prevHistory: () => History<D> | null;
15
+ setHistories: (histories: History[]) => void;
16
+ setHistoryIndex: (index: number) => void;
17
+ initialAppState: D;
18
+ };
19
+
20
+ type NodeMethods = {
21
+ sync: () => void;
22
+ hideOverlay: () => void;
23
+ showOverlay: () => void;
24
+ };
25
+ type PuckNodeInstance = {
26
+ id: string;
27
+ methods: NodeMethods;
28
+ element: HTMLElement | null;
29
+ };
30
+ type NodesSlice = {
31
+ nodes: Record<string, PuckNodeInstance | undefined>;
32
+ registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
33
+ unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
34
+ };
35
+
36
+ type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
37
+ item?: G["UserComponentData"] | null;
38
+ type?: keyof G["UserProps"];
39
+ root?: boolean;
40
+ };
41
+ type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
42
+ type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
43
+ type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
44
+ type Cache = Record<string, {
45
+ lastPermissions: Partial<Permissions>;
46
+ lastData: ComponentData | null;
47
+ lastParentId: string | null;
48
+ }>;
49
+ type PermissionsSlice = {
50
+ cache: Cache;
51
+ globalPermissions: Permissions;
52
+ resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
53
+ getPermissions: GetPermissions<Config>;
54
+ resolvePermissions: ResolvePermissions<Config>;
55
+ refreshPermissions: RefreshPermissions<Config>;
56
+ };
57
+
58
+ type ComponentOrRootData = Omit<ComponentData<any>, "type">;
59
+ type FieldsSlice = {
60
+ fields: Fields | Partial<Fields>;
61
+ loading: boolean;
62
+ lastResolvedData: Partial<ComponentOrRootData>;
63
+ id: string | undefined;
64
+ };
65
+
66
+ type Status = "LOADING" | "MOUNTED" | "READY";
67
+ type ZoomConfig = {
68
+ autoZoom: number;
69
+ rootHeight: number;
70
+ zoom: number;
71
+ };
72
+ type ComponentState = Record<string, {
73
+ loadingCount: number;
74
+ }>;
75
+ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
76
+ state: G["UserAppState"];
77
+ dispatch: (action: PuckAction) => void;
78
+ config: UserConfig;
79
+ componentState: ComponentState;
80
+ setComponentState: (componentState: ComponentState) => void;
81
+ setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
82
+ unsetComponentLoading: (id: string) => void;
83
+ pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
84
+ resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
85
+ node: T;
86
+ didChange: boolean;
87
+ }>;
88
+ resolveAndCommitData: () => void;
89
+ plugins: Plugin[];
90
+ overrides: Partial<Overrides>;
91
+ viewports: Viewports;
92
+ zoomConfig: ZoomConfig;
93
+ setZoomConfig: (zoomConfig: ZoomConfig) => void;
94
+ status: Status;
95
+ setStatus: (status: Status) => void;
96
+ iframe: IframeConfig;
97
+ selectedItem?: G["UserData"]["content"][0] | null;
98
+ getCurrentData: () => G["UserData"]["content"][0] | G["UserData"]["root"];
99
+ setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
100
+ getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
101
+ onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
102
+ metadata: Metadata;
103
+ fields: FieldsSlice;
104
+ history: HistorySlice;
105
+ nodes: NodesSlice;
106
+ permissions: PermissionsSlice;
107
+ fieldTransforms: FieldTransforms;
108
+ currentRichText?: {
109
+ inlineComponentId?: string;
110
+ inline: boolean;
111
+ field: RichtextField;
112
+ editor: Editor;
113
+ id: string;
114
+ } | null;
115
+ };
116
+
117
+ export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };