@measured/puck 0.21.0-canary.c78dc826 → 0.21.0-canary.d1e8fa71
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.
- package/dist/{Editor-F2LSS6SE.css → Editor-IQP25PUX.css} +28 -27
- package/dist/{Editor-N46HUQEC.mjs → Editor-L3JAAT2X.mjs} +13 -10
- package/dist/{Render-QEMDIDQC.css → Render-3OV4N4MT.css} +28 -27
- package/dist/{Render-Y567PGZ7.mjs → Render-FXZX6NFH.mjs} +6 -4
- package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-tsxxcX1z.d.mts} +24 -35
- package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-tsxxcX1z.d.ts} +24 -35
- package/dist/chunk-23IZFPL7.mjs +528 -0
- package/dist/{chunk-C2TVYIYC.mjs → chunk-3SDLQIUZ.mjs} +57 -43
- package/dist/chunk-45I5SDOI.mjs +134 -0
- package/dist/{chunk-DNF2EMM4.mjs → chunk-5ZZVX2Z3.mjs} +2 -2
- package/dist/chunk-AOEDIUVK.mjs +11 -0
- package/dist/{chunk-DJSH5REF.mjs → chunk-B7REOAA7.mjs} +24 -126
- package/dist/{chunk-K3V4LVUL.mjs → chunk-BXQQARCR.mjs} +14 -10
- package/dist/{chunk-TB3SSIAY.mjs → chunk-CQUAWHOK.mjs} +5224 -4509
- package/dist/{chunk-7KY6RHEY.mjs → chunk-D2SRL6YA.mjs} +101 -524
- package/dist/{chunk-GQKMOYLG.mjs → chunk-LJEGWHDD.mjs} +2 -2
- package/dist/{chunk-DCSQEDMK.mjs → chunk-M6W7YEVX.mjs} +1 -100
- package/dist/{chunk-FNWOH4R6.mjs → chunk-PBAAIKXA.mjs} +8 -6
- package/dist/{chunk-3QHWXJEI.mjs → chunk-U4VSQKO3.mjs} +2 -2
- package/dist/{chunk-R6CVX2IY.mjs → chunk-V5I7CVLT.mjs} +1 -1
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/{full-NLUNPJWS.mjs → full-L7DWVNTZ.mjs} +10 -7
- package/dist/index-Ca6V6NQD.d.ts +118 -0
- package/dist/index-mQvUCH3C.d.mts +118 -0
- package/dist/index.css +732 -341
- package/dist/index.d.mts +29 -120
- package/dist/index.d.ts +29 -120
- package/dist/index.js +3273 -2392
- package/dist/index.mjs +22 -16
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +927 -0
- package/dist/internal.mjs +13 -0
- package/dist/{loaded-HMSPJUZM.mjs → loaded-2HLHDP2G.mjs} +7 -4
- package/dist/{loaded-EV34KGYJ.mjs → loaded-LZUXYAGW.mjs} +7 -4
- package/dist/{loaded-ZXOU6S6R.mjs → loaded-UHVTB6OD.mjs} +7 -4
- package/dist/no-external.css +870 -475
- package/dist/no-external.d.mts +4 -2
- package/dist/no-external.d.ts +4 -2
- package/dist/no-external.js +3276 -2392
- package/dist/no-external.mjs +22 -11
- package/dist/rsc.css +28 -27
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +56 -29
- package/dist/rsc.mjs +6 -4
- package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
- package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
- package/package.json +9 -4
- package/dist/chunk-WUWXFMEM.mjs +0 -11
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
AlignJustify,
|
|
4
4
|
AlignLeft,
|
|
5
5
|
AlignRight
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-D2SRL6YA.mjs";
|
|
7
7
|
import {
|
|
8
8
|
init_react_import
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
10
10
|
|
|
11
11
|
// components/RichTextMenu/controls/AlignSelect/use-options.ts
|
|
12
12
|
init_react_import();
|
|
@@ -84,95 +84,6 @@ var init_react_import = __esm({
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
// ../../node_modules/classnames/index.js
|
|
88
|
-
var require_classnames = __commonJS({
|
|
89
|
-
"../../node_modules/classnames/index.js"(exports, module) {
|
|
90
|
-
"use strict";
|
|
91
|
-
init_react_import();
|
|
92
|
-
(function() {
|
|
93
|
-
"use strict";
|
|
94
|
-
var hasOwn = {}.hasOwnProperty;
|
|
95
|
-
function classNames() {
|
|
96
|
-
var classes = "";
|
|
97
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
98
|
-
var arg = arguments[i];
|
|
99
|
-
if (arg) {
|
|
100
|
-
classes = appendClass(classes, parseValue(arg));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return classes;
|
|
104
|
-
}
|
|
105
|
-
function parseValue(arg) {
|
|
106
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
107
|
-
return arg;
|
|
108
|
-
}
|
|
109
|
-
if (typeof arg !== "object") {
|
|
110
|
-
return "";
|
|
111
|
-
}
|
|
112
|
-
if (Array.isArray(arg)) {
|
|
113
|
-
return classNames.apply(null, arg);
|
|
114
|
-
}
|
|
115
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
116
|
-
return arg.toString();
|
|
117
|
-
}
|
|
118
|
-
var classes = "";
|
|
119
|
-
for (var key in arg) {
|
|
120
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
121
|
-
classes = appendClass(classes, key);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return classes;
|
|
125
|
-
}
|
|
126
|
-
function appendClass(value, newClass) {
|
|
127
|
-
if (!newClass) {
|
|
128
|
-
return value;
|
|
129
|
-
}
|
|
130
|
-
if (value) {
|
|
131
|
-
return value + " " + newClass;
|
|
132
|
-
}
|
|
133
|
-
return value + newClass;
|
|
134
|
-
}
|
|
135
|
-
if (typeof module !== "undefined" && module.exports) {
|
|
136
|
-
classNames.default = classNames;
|
|
137
|
-
module.exports = classNames;
|
|
138
|
-
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
139
|
-
define("classnames", [], function() {
|
|
140
|
-
return classNames;
|
|
141
|
-
});
|
|
142
|
-
} else {
|
|
143
|
-
window.classNames = classNames;
|
|
144
|
-
}
|
|
145
|
-
})();
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// lib/get-class-name-factory.ts
|
|
150
|
-
init_react_import();
|
|
151
|
-
var import_classnames = __toESM(require_classnames());
|
|
152
|
-
var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
|
|
153
|
-
if (typeof options === "string") {
|
|
154
|
-
const descendant = options;
|
|
155
|
-
const style = styles[`${rootClass}-${descendant}`];
|
|
156
|
-
if (style) {
|
|
157
|
-
return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
|
|
158
|
-
}
|
|
159
|
-
return "";
|
|
160
|
-
} else if (typeof options === "object") {
|
|
161
|
-
const modifiers = options;
|
|
162
|
-
const prefixedModifiers = {};
|
|
163
|
-
for (let modifier in modifiers) {
|
|
164
|
-
prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
|
165
|
-
}
|
|
166
|
-
const c = styles[rootClass];
|
|
167
|
-
return config.baseClass + (0, import_classnames.default)(__spreadValues({
|
|
168
|
-
[c]: !!c
|
|
169
|
-
}, prefixedModifiers));
|
|
170
|
-
} else {
|
|
171
|
-
return config.baseClass + styles[rootClass] || "";
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
var get_class_name_factory_default = getClassNameFactory;
|
|
175
|
-
|
|
176
87
|
export {
|
|
177
88
|
__spreadValues,
|
|
178
89
|
__spreadProps,
|
|
@@ -180,15 +91,5 @@ export {
|
|
|
180
91
|
__commonJS,
|
|
181
92
|
__toESM,
|
|
182
93
|
__async,
|
|
183
|
-
init_react_import
|
|
184
|
-
get_class_name_factory_default
|
|
94
|
+
init_react_import
|
|
185
95
|
};
|
|
186
|
-
/*! Bundled license information:
|
|
187
|
-
|
|
188
|
-
classnames/index.js:
|
|
189
|
-
(*!
|
|
190
|
-
Copyright (c) 2018 Jed Watson.
|
|
191
|
-
Licensed under the MIT License (MIT), see
|
|
192
|
-
http://jedwatson.github.io/classnames
|
|
193
|
-
*)
|
|
194
|
-
*/
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
styles_module_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AOEDIUVK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
LoadedRichTextMenuInner
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BXQQARCR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useAppStore,
|
|
9
9
|
useAppStoreApi
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-D2SRL6YA.mjs";
|
|
11
|
+
import {
|
|
12
|
+
get_class_name_factory_default
|
|
13
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
11
14
|
import {
|
|
12
15
|
__spreadValues,
|
|
13
|
-
get_class_name_factory_default,
|
|
14
16
|
init_react_import
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
16
18
|
|
|
17
19
|
// components/RichTextEditor/components/EditorInner.tsx
|
|
18
20
|
init_react_import();
|
|
@@ -95,7 +97,7 @@ init_react_import();
|
|
|
95
97
|
import { lazy, Suspense } from "react";
|
|
96
98
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
97
99
|
var LoadedRichTextMenuFull = lazy(
|
|
98
|
-
() => import("./full-
|
|
100
|
+
() => import("./full-L7DWVNTZ.mjs").then((m) => ({
|
|
99
101
|
default: m.LoadedRichTextMenuFull
|
|
100
102
|
}))
|
|
101
103
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
List,
|
|
3
3
|
ListOrdered
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-D2SRL6YA.mjs";
|
|
5
5
|
import {
|
|
6
6
|
init_react_import
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
8
8
|
|
|
9
9
|
// components/RichTextMenu/controls/ListSelect/use-options.ts
|
|
10
10
|
init_react_import();
|
|
@@ -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
|
+
*/
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LoadedRichTextMenuInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-BXQQARCR.mjs";
|
|
4
|
+
import "./chunk-LJEGWHDD.mjs";
|
|
5
|
+
import "./chunk-5ZZVX2Z3.mjs";
|
|
6
|
+
import "./chunk-U4VSQKO3.mjs";
|
|
7
|
+
import "./chunk-D2SRL6YA.mjs";
|
|
8
|
+
import "./chunk-23IZFPL7.mjs";
|
|
9
|
+
import "./chunk-45I5SDOI.mjs";
|
|
10
|
+
import "./chunk-Y2EFNT5P.mjs";
|
|
11
|
+
import "./chunk-B7REOAA7.mjs";
|
|
9
12
|
import {
|
|
10
13
|
__spreadValues,
|
|
11
14
|
init_react_import
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
13
16
|
|
|
14
17
|
// components/RichTextMenu/full.tsx
|
|
15
18
|
init_react_import();
|
|
@@ -0,0 +1,118 @@
|
|
|
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-tsxxcX1z.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
|
+
instanceId: string;
|
|
77
|
+
state: G["UserAppState"];
|
|
78
|
+
dispatch: (action: PuckAction) => void;
|
|
79
|
+
config: UserConfig;
|
|
80
|
+
componentState: ComponentState;
|
|
81
|
+
setComponentState: (componentState: ComponentState) => void;
|
|
82
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
83
|
+
unsetComponentLoading: (id: string) => void;
|
|
84
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
85
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
86
|
+
node: T;
|
|
87
|
+
didChange: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
resolveAndCommitData: () => void;
|
|
90
|
+
plugins: Plugin[];
|
|
91
|
+
overrides: Partial<Overrides>;
|
|
92
|
+
viewports: Viewports;
|
|
93
|
+
zoomConfig: ZoomConfig;
|
|
94
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
95
|
+
status: Status;
|
|
96
|
+
setStatus: (status: Status) => void;
|
|
97
|
+
iframe: IframeConfig;
|
|
98
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
|
99
|
+
getCurrentData: () => G["UserData"]["content"][0] | G["UserData"]["root"];
|
|
100
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
101
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
102
|
+
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
|
103
|
+
metadata: Metadata;
|
|
104
|
+
fields: FieldsSlice;
|
|
105
|
+
history: HistorySlice;
|
|
106
|
+
nodes: NodesSlice;
|
|
107
|
+
permissions: PermissionsSlice;
|
|
108
|
+
fieldTransforms: FieldTransforms;
|
|
109
|
+
currentRichText?: {
|
|
110
|
+
inlineComponentId?: string;
|
|
111
|
+
inline: boolean;
|
|
112
|
+
field: RichtextField;
|
|
113
|
+
editor: Editor;
|
|
114
|
+
id: string;
|
|
115
|
+
} | null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
|
|
@@ -0,0 +1,118 @@
|
|
|
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-tsxxcX1z.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
|
+
instanceId: string;
|
|
77
|
+
state: G["UserAppState"];
|
|
78
|
+
dispatch: (action: PuckAction) => void;
|
|
79
|
+
config: UserConfig;
|
|
80
|
+
componentState: ComponentState;
|
|
81
|
+
setComponentState: (componentState: ComponentState) => void;
|
|
82
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
83
|
+
unsetComponentLoading: (id: string) => void;
|
|
84
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
85
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
86
|
+
node: T;
|
|
87
|
+
didChange: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
resolveAndCommitData: () => void;
|
|
90
|
+
plugins: Plugin[];
|
|
91
|
+
overrides: Partial<Overrides>;
|
|
92
|
+
viewports: Viewports;
|
|
93
|
+
zoomConfig: ZoomConfig;
|
|
94
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
95
|
+
status: Status;
|
|
96
|
+
setStatus: (status: Status) => void;
|
|
97
|
+
iframe: IframeConfig;
|
|
98
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
|
99
|
+
getCurrentData: () => G["UserData"]["content"][0] | G["UserData"]["root"];
|
|
100
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
101
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
102
|
+
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
|
103
|
+
metadata: Metadata;
|
|
104
|
+
fields: FieldsSlice;
|
|
105
|
+
history: HistorySlice;
|
|
106
|
+
nodes: NodesSlice;
|
|
107
|
+
permissions: PermissionsSlice;
|
|
108
|
+
fieldTransforms: FieldTransforms;
|
|
109
|
+
currentRichText?: {
|
|
110
|
+
inlineComponentId?: string;
|
|
111
|
+
inline: boolean;
|
|
112
|
+
field: RichtextField;
|
|
113
|
+
editor: Editor;
|
|
114
|
+
id: string;
|
|
115
|
+
} | null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
|