@puckeditor/core 0.24.0-canary.fcfd4b94 → 0.24.0
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/CHANGELOG.md +1244 -0
- package/LICENSE +21 -0
- package/dist/{Editor-T7TKW6NT.css → Editor-CSDMK75G.css} +24 -16
- package/dist/{Editor-7HVJABBS.mjs → Editor-LJSLIQQP.mjs} +9 -9
- package/dist/{Render-DQXAYUBI.mjs → Render-H3USS5FU.mjs} +2 -2
- package/dist/{actions-DzP_zhsF.d.ts → actions-Dgllwd-W.d.mts} +24 -4
- package/dist/{actions-DzP_zhsF.d.mts → actions-Dgllwd-W.d.ts} +24 -4
- package/dist/{chunk-DWQZNG26.mjs → chunk-3GJJSXCL.mjs} +85 -52
- package/dist/{chunk-FHGOTDB5.mjs → chunk-5L3MP6BU.mjs} +8 -8
- package/dist/{chunk-PI2N6YRG.mjs → chunk-DQXMVPVM.mjs} +2536 -1426
- package/dist/{chunk-OOTCJDR3.mjs → chunk-FWBFOZBF.mjs} +189 -139
- package/dist/{chunk-75VT4L37.mjs → chunk-M6VGZJMS.mjs} +1 -1
- package/dist/{chunk-YBKRDXOL.mjs → chunk-OGTX6PQW.mjs} +1 -1
- package/dist/{chunk-Y2EFNT5P.mjs → chunk-OT7NKYY4.mjs} +2 -2
- package/dist/{chunk-FVMO3IOJ.mjs → chunk-UIJZMSVU.mjs} +4 -4
- package/dist/{chunk-ZRAERXB4.mjs → chunk-XMN55NON.mjs} +3 -2
- package/dist/{chunk-L24AF7CT.mjs → chunk-ZO7CHPM6.mjs} +1 -1
- package/dist/{chunk-2CNEFIQP.mjs → chunk-ZOLLDKZQ.mjs} +4 -1
- package/dist/{full-AAZK6KLI.css → full-F3CBWTKQ.css} +24 -16
- package/dist/{full-35XZI7ZG.mjs → full-H4FZ3HN3.mjs} +7 -7
- package/dist/{index-Cv-eVWCd.d.ts → index-D0qqZNSQ.d.mts} +2 -1
- package/dist/{index-poi3aTIz.d.mts → index-dKPCNzR1.d.ts} +2 -1
- package/dist/index.css +371 -127
- package/dist/index.d.mts +64 -8
- package/dist/index.d.ts +64 -8
- package/dist/index.js +5731 -4535
- package/dist/index.mjs +16 -10
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/{loaded-ESP3PLMN.mjs → loaded-P5HN7RJY.mjs} +4 -4
- package/dist/{loaded-RS7ITDTL.mjs → loaded-PFIA543C.mjs} +4 -4
- package/dist/{loaded-CA3Q7UHH.css → loaded-UDM5EYPG.css} +24 -16
- package/dist/{loaded-2NYAMF3O.mjs → loaded-WFQRY2XL.mjs} +4 -4
- package/dist/no-external.css +371 -127
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +5731 -4535
- package/dist/no-external.mjs +16 -10
- package/dist/rsc.d.mts +4 -3
- package/dist/rsc.d.ts +4 -3
- package/dist/rsc.js +139 -70
- package/dist/rsc.mjs +51 -21
- package/dist/{walk-tree-iWDqHBcM.d.mts → walk-tree-BA4pi921.d.mts} +1 -1
- package/dist/{walk-tree-Bu3IHwm_.d.ts → walk-tree-zKkZGcaE.d.ts} +1 -1
- package/package.json +37 -35
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) The Puck Contributors.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css/#css-module-data */
|
|
102
|
-
.
|
|
102
|
+
._ActionBar_gr1cb_1 {
|
|
103
103
|
align-items: center;
|
|
104
104
|
cursor: default;
|
|
105
105
|
display: flex;
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
font-family: var(--puck-font-family);
|
|
115
115
|
min-height: 26px;
|
|
116
116
|
}
|
|
117
|
-
._ActionBar-
|
|
117
|
+
._ActionBar-label_gr1cb_17 {
|
|
118
118
|
color: var(--puck-actionbar-color-text, var(--puck-color-text-inverse));
|
|
119
119
|
font-size: var(--puck-actionbar-font-size, var(--puck-font-size-xxxs));
|
|
120
120
|
opacity: var(--puck-actionbar-opacity-text, var(--puck-opacity-text-inverse));
|
|
@@ -126,13 +126,13 @@
|
|
|
126
126
|
text-overflow: ellipsis;
|
|
127
127
|
white-space: nowrap;
|
|
128
128
|
}
|
|
129
|
-
.
|
|
129
|
+
._ActionBarAction_gr1cb_30 + ._ActionBar-label_gr1cb_17 {
|
|
130
130
|
padding-inline-start: 0;
|
|
131
131
|
}
|
|
132
|
-
._ActionBar-
|
|
132
|
+
._ActionBar-label_gr1cb_17 + ._ActionBarAction_gr1cb_30 {
|
|
133
133
|
margin-inline-start: calc(var(--puck-space-1) * -1);
|
|
134
134
|
}
|
|
135
|
-
._ActionBar-
|
|
135
|
+
._ActionBar-group_gr1cb_38 {
|
|
136
136
|
align-items: center;
|
|
137
137
|
border-inline-start: var(--puck-border-width-hairline) solid var(--puck-actionbar-color-separator, var(--puck-color-border-inverse));
|
|
138
138
|
display: flex;
|
|
@@ -140,13 +140,13 @@
|
|
|
140
140
|
padding-inline-start: var(--puck-space-1);
|
|
141
141
|
padding-inline-end: var(--puck-space-1);
|
|
142
142
|
}
|
|
143
|
-
._ActionBar-
|
|
143
|
+
._ActionBar-group_gr1cb_38:first-of-type {
|
|
144
144
|
border-inline-start: 0;
|
|
145
145
|
}
|
|
146
|
-
._ActionBar-
|
|
146
|
+
._ActionBar-group_gr1cb_38:empty {
|
|
147
147
|
display: none;
|
|
148
148
|
}
|
|
149
|
-
.
|
|
149
|
+
._ActionBarAction_gr1cb_30 {
|
|
150
150
|
background: transparent;
|
|
151
151
|
border: none;
|
|
152
152
|
color: var(--puck-actionbar-color-text, var(--puck-color-text-inverse));
|
|
@@ -162,35 +162,43 @@
|
|
|
162
162
|
opacity: var(--puck-actionbar-opacity-text, var(--puck-opacity-text-inverse));
|
|
163
163
|
transition: color var(--puck-duration-fast) var(--puck-ease-exit), opacity var(--puck-duration-fast) var(--puck-ease-exit);
|
|
164
164
|
}
|
|
165
|
-
._ActionBarAction--
|
|
165
|
+
._ActionBarAction--disabled_gr1cb_74 {
|
|
166
166
|
cursor: auto;
|
|
167
167
|
color: var( --puck-actionbar-color-action-disabled, var(--puck-color-text-inverse) );
|
|
168
168
|
opacity: var(--puck-actionbar-opacity-action-disabled, 0.54);
|
|
169
169
|
}
|
|
170
|
-
.
|
|
170
|
+
._ActionBarAction--grab_gr1cb_83 {
|
|
171
|
+
cursor: grab;
|
|
172
|
+
touch-action: none;
|
|
173
|
+
}
|
|
174
|
+
._ActionBarAction-icon_gr1cb_88 {
|
|
175
|
+
height: var(--puck-actionbar-action-size, var(--puck-icon-size-s));
|
|
176
|
+
width: var(--puck-actionbar-action-size, var(--puck-icon-size-s));
|
|
177
|
+
}
|
|
178
|
+
._ActionBarAction_gr1cb_30 svg {
|
|
171
179
|
max-width: none !important;
|
|
172
180
|
}
|
|
173
|
-
.
|
|
181
|
+
._ActionBarAction_gr1cb_30:focus-visible {
|
|
174
182
|
outline: var(--puck-border-width-focus) solid var(--puck-color-focus-ring);
|
|
175
183
|
outline-offset: calc(var(--puck-border-width-focus) * -1);
|
|
176
184
|
}
|
|
177
185
|
@media (hover: hover) and (pointer: fine) {
|
|
178
|
-
.
|
|
186
|
+
._ActionBarAction_gr1cb_30:hover:not(._ActionBarAction--disabled_gr1cb_74) {
|
|
179
187
|
color: var( --puck-actionbar-color-action-hover, var(--puck-color-interactive-inverse-hover) );
|
|
180
188
|
opacity: 1;
|
|
181
189
|
transition: none;
|
|
182
190
|
}
|
|
183
191
|
}
|
|
184
|
-
.
|
|
185
|
-
._ActionBarAction--
|
|
192
|
+
._ActionBarAction_gr1cb_30:active:not(._ActionBarAction--disabled_gr1cb_74),
|
|
193
|
+
._ActionBarAction--active_gr1cb_114 {
|
|
186
194
|
color: var( --puck-actionbar-color-action-active, var(--puck-color-interactive-inverse-active) );
|
|
187
195
|
opacity: 1;
|
|
188
196
|
transition: none;
|
|
189
197
|
}
|
|
190
|
-
._ActionBar-
|
|
198
|
+
._ActionBar-group_gr1cb_38 * {
|
|
191
199
|
margin: 0;
|
|
192
200
|
}
|
|
193
|
-
._ActionBar-
|
|
201
|
+
._ActionBar-separator_gr1cb_127 {
|
|
194
202
|
background: var( --puck-actionbar-color-separator, var(--puck-color-border-inverse) );
|
|
195
203
|
margin-inline: var(--puck-space-1);
|
|
196
204
|
width: var( --puck-border-width-hairline );
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PuckRichText
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZOLLDKZQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
EditorInner,
|
|
6
6
|
LoadedRichTextMenu
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UIJZMSVU.mjs";
|
|
8
8
|
import "./chunk-H635BA2V.mjs";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-5L3MP6BU.mjs";
|
|
10
|
+
import "./chunk-OGTX6PQW.mjs";
|
|
11
|
+
import "./chunk-ZO7CHPM6.mjs";
|
|
12
|
+
import "./chunk-M6VGZJMS.mjs";
|
|
13
13
|
import {
|
|
14
14
|
useAppStore,
|
|
15
15
|
useAppStoreApi
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FWBFOZBF.mjs";
|
|
17
17
|
import "./chunk-Z2MS6UIF.mjs";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-XMN55NON.mjs";
|
|
19
|
+
import "./chunk-OT7NKYY4.mjs";
|
|
20
20
|
import "./chunk-H65MT2JK.mjs";
|
|
21
21
|
import {
|
|
22
22
|
__spreadProps,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PuckRichText
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZOLLDKZQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
styles_module_default
|
|
6
6
|
} from "./chunk-H635BA2V.mjs";
|
|
7
7
|
import {
|
|
8
8
|
get_class_name_factory_default
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OT7NKYY4.mjs";
|
|
10
10
|
import {
|
|
11
11
|
init_react_import
|
|
12
12
|
} from "./chunk-M6W7YEVX.mjs";
|
|
@@ -53,7 +53,7 @@ type NonForwardableProps = {
|
|
|
53
53
|
/**
|
|
54
54
|
* Keys internally consumed by Puck and never forwarded to `as`.
|
|
55
55
|
*/
|
|
56
|
-
type ConsumedPropKey = keyof DropZoneOwnProps | "as" | "content" | "config" | "metadata";
|
|
56
|
+
type ConsumedPropKey = keyof DropZoneOwnProps | "as" | "content" | "config" | "metadata" | "fieldTransforms";
|
|
57
57
|
/**
|
|
58
58
|
* Additional props forwarded to the element or component provided via `as`,
|
|
59
59
|
* typed against it.
|
|
@@ -236,6 +236,7 @@ interface PuckRichTextOptions {
|
|
|
236
236
|
underline: Partial<UnderlineOptions> | false;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
type FieldGroupVariant = "flush" | "card";
|
|
239
240
|
type FieldOption = {
|
|
240
241
|
label: string;
|
|
241
242
|
value: string | number | boolean | undefined | null | object;
|
|
@@ -272,6 +273,10 @@ interface RadioField extends BaseField {
|
|
|
272
273
|
type: "radio";
|
|
273
274
|
options: FieldOptions;
|
|
274
275
|
}
|
|
276
|
+
interface CheckboxField extends BaseField {
|
|
277
|
+
type: "checkbox";
|
|
278
|
+
options: FieldOptions;
|
|
279
|
+
}
|
|
275
280
|
interface RichtextField<UserSelector extends RichTextSelector = RichTextSelector> extends BaseField {
|
|
276
281
|
type: "richtext";
|
|
277
282
|
contentEditable?: boolean;
|
|
@@ -314,6 +319,9 @@ interface ObjectField<Props extends any = {
|
|
|
314
319
|
[key: string]: any;
|
|
315
320
|
}, UserField extends {} = {}> extends BaseField {
|
|
316
321
|
type: "object";
|
|
322
|
+
collapsible?: boolean;
|
|
323
|
+
defaultExpanded?: boolean;
|
|
324
|
+
variant?: FieldGroupVariant;
|
|
317
325
|
objectFields: {
|
|
318
326
|
[SubPropName in keyof Props]: UserField extends {
|
|
319
327
|
type: PropertyKey;
|
|
@@ -378,7 +386,7 @@ interface SlotField extends BaseField {
|
|
|
378
386
|
allow?: string[];
|
|
379
387
|
disallow?: string[];
|
|
380
388
|
}
|
|
381
|
-
type Field<ValueType = any, UserField extends {} = {}> = TextField | RichtextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
389
|
+
type Field<ValueType = any, UserField extends {} = {}> = TextField | RichtextField | NumberField | TextareaField | SelectField | RadioField | CheckboxField | ArrayField<ValueType extends {
|
|
382
390
|
[key: string]: any;
|
|
383
391
|
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
384
392
|
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps, UserField extends {} = {}> = {
|
|
@@ -462,6 +470,9 @@ UserField extends BaseField = {}> = {
|
|
|
462
470
|
label?: string;
|
|
463
471
|
defaultProps?: FieldProps;
|
|
464
472
|
fields?: Fields<FieldProps, UserField>;
|
|
473
|
+
renderFields?: RenderFunc<{
|
|
474
|
+
fields: Partial<Record<keyof FieldProps, ReactNode>>;
|
|
475
|
+
}>;
|
|
465
476
|
permissions?: Partial<Permissions>;
|
|
466
477
|
inline?: boolean;
|
|
467
478
|
resolveFields?: (data: DataShape, params: {
|
|
@@ -619,10 +630,13 @@ type UiState = {
|
|
|
619
630
|
controlsVisible: boolean;
|
|
620
631
|
options: Viewport[];
|
|
621
632
|
};
|
|
633
|
+
expandedFieldGroups: Record<string, boolean>;
|
|
622
634
|
field: {
|
|
623
635
|
focus?: string | null;
|
|
624
636
|
metadata?: Record<string, any>;
|
|
625
637
|
};
|
|
638
|
+
/** The selected field tab. Shows the first available tab when `null`. */
|
|
639
|
+
fieldTab?: string | number | null;
|
|
626
640
|
plugin: {
|
|
627
641
|
current: string | null;
|
|
628
642
|
};
|
|
@@ -716,6 +730,8 @@ type Overrides<UserConfig extends Config = Config> = OverridesGeneric<{
|
|
|
716
730
|
label?: string;
|
|
717
731
|
children: ReactNode;
|
|
718
732
|
parentAction: ReactNode;
|
|
733
|
+
dragHandle?: ReactNode;
|
|
734
|
+
dragHandleRef?: (element: Element | null) => void;
|
|
719
735
|
}>;
|
|
720
736
|
headerActions: RenderFunc<{
|
|
721
737
|
children: ReactNode;
|
|
@@ -725,10 +741,12 @@ type Overrides<UserConfig extends Config = Config> = OverridesGeneric<{
|
|
|
725
741
|
children: ReactNode;
|
|
726
742
|
isLoading: boolean;
|
|
727
743
|
itemSelector?: ItemSelector | null;
|
|
744
|
+
fields: Partial<Record<string, ReactNode>>;
|
|
728
745
|
}>;
|
|
729
746
|
fieldLabel: RenderFunc<{
|
|
730
747
|
children?: ReactNode;
|
|
731
748
|
icon?: ReactNode;
|
|
749
|
+
endIcon?: ReactNode;
|
|
732
750
|
label: string;
|
|
733
751
|
el?: "label" | "div";
|
|
734
752
|
readOnly?: boolean;
|
|
@@ -795,9 +813,11 @@ type DndBehavior = "auto" | "fluid" | "static";
|
|
|
795
813
|
type DndConfig = {
|
|
796
814
|
disableAutoScroll?: boolean;
|
|
797
815
|
disableOutlineDrag?: boolean;
|
|
816
|
+
enableDragHandle?: boolean;
|
|
798
817
|
/**
|
|
799
818
|
* - `auto` (default): fluid drags within a slot, switching to a static
|
|
800
|
-
* line placeholder when dragging between slots
|
|
819
|
+
* line placeholder when dragging between slots, inserting a new item,
|
|
820
|
+
* or dragging from the action bar drag handle
|
|
801
821
|
* - `fluid`: always animate sibling items during a drag
|
|
802
822
|
* - `static`: always show a line placeholder during a drag, only
|
|
803
823
|
* animating sibling items on drop
|
|
@@ -905,4 +925,4 @@ type PuckAction = {
|
|
|
905
925
|
recordHistory?: boolean;
|
|
906
926
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
|
907
927
|
|
|
908
|
-
export { type
|
|
928
|
+
export { type ObjectField as $, type Adaptor as A, type BaseData as B, type CacheOpts as C, type Data as D, type DragAxis as E, type DropZoneProps as F, type ExternalField as G, type ExternalFieldWithAdaptor as H, type ExtractConfigParams as I, type ExtractField as J, type Field as K, type FieldGroupVariant as L, type FieldMetadata as M, type FieldProps as N, type FieldRenderFunctions as O, type FieldTransformFn as P, type FieldTransformFnParams as Q, type FieldTransforms as R, type Fields as S, type History as T, type IframeConfig as U, type InitialHistory as V, type ItemSelector as W, type ItemWithId as X, type MappedItem as Y, type Metadata as Z, type NumberField as _, type AppState as a, type OnAction as a0, type OverrideKey as a1, type Overrides as a2, type Permissions as a3, type Plugin as a4, type PluginInternal as a5, type PrivateAppState as a6, type PuckAction as a7, type PuckComponent as a8, type PuckContext as a9, type PuckMetadata as aa, type RadioField as ab, type ResolveDataTrigger as ac, type RichText as ad, type RichtextField as ae, type RootConfig as af, type RootData as ag, type RootDataWithProps as ah, type RootDataWithoutProps as ai, type SelectField as aj, type Slot as ak, type SlotComponent as al, type SlotField as am, type TextField as an, type TextareaField as ao, type UiState as ap, type UserGenerics as aq, type Viewport as ar, type Viewports as as, type WithChildren as at, type WithDefaultRootFieldProps as au, type WithId as av, type WithPuckProps as aw, type WithSlotProps as ax, overrideKeys as ay, type ArrayField as b, type ArrayState as c, type AsFieldProps as d, type BaseField as e, type CheckboxField as f, type ComponentConfig as g, type ComponentConfigExtensions as h, type ComponentConfigParams as i, type ComponentData as j, type ComponentDataMap as k, type ComponentDataOptionalId as l, type ComponentMetadata as m, type Config as n, type ConfigParams as o, type Content as p, type CustomField as q, type CustomFieldRender as r, type DefaultComponentProps as s, type DefaultComponents as t, type DefaultRootFieldProps as u, type DefaultRootProps as v, type DefaultRootRenderProps as w, type Direction as x, type DndBehavior as y, type DndConfig as z };
|
|
@@ -53,7 +53,7 @@ type NonForwardableProps = {
|
|
|
53
53
|
/**
|
|
54
54
|
* Keys internally consumed by Puck and never forwarded to `as`.
|
|
55
55
|
*/
|
|
56
|
-
type ConsumedPropKey = keyof DropZoneOwnProps | "as" | "content" | "config" | "metadata";
|
|
56
|
+
type ConsumedPropKey = keyof DropZoneOwnProps | "as" | "content" | "config" | "metadata" | "fieldTransforms";
|
|
57
57
|
/**
|
|
58
58
|
* Additional props forwarded to the element or component provided via `as`,
|
|
59
59
|
* typed against it.
|
|
@@ -236,6 +236,7 @@ interface PuckRichTextOptions {
|
|
|
236
236
|
underline: Partial<UnderlineOptions> | false;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
type FieldGroupVariant = "flush" | "card";
|
|
239
240
|
type FieldOption = {
|
|
240
241
|
label: string;
|
|
241
242
|
value: string | number | boolean | undefined | null | object;
|
|
@@ -272,6 +273,10 @@ interface RadioField extends BaseField {
|
|
|
272
273
|
type: "radio";
|
|
273
274
|
options: FieldOptions;
|
|
274
275
|
}
|
|
276
|
+
interface CheckboxField extends BaseField {
|
|
277
|
+
type: "checkbox";
|
|
278
|
+
options: FieldOptions;
|
|
279
|
+
}
|
|
275
280
|
interface RichtextField<UserSelector extends RichTextSelector = RichTextSelector> extends BaseField {
|
|
276
281
|
type: "richtext";
|
|
277
282
|
contentEditable?: boolean;
|
|
@@ -314,6 +319,9 @@ interface ObjectField<Props extends any = {
|
|
|
314
319
|
[key: string]: any;
|
|
315
320
|
}, UserField extends {} = {}> extends BaseField {
|
|
316
321
|
type: "object";
|
|
322
|
+
collapsible?: boolean;
|
|
323
|
+
defaultExpanded?: boolean;
|
|
324
|
+
variant?: FieldGroupVariant;
|
|
317
325
|
objectFields: {
|
|
318
326
|
[SubPropName in keyof Props]: UserField extends {
|
|
319
327
|
type: PropertyKey;
|
|
@@ -378,7 +386,7 @@ interface SlotField extends BaseField {
|
|
|
378
386
|
allow?: string[];
|
|
379
387
|
disallow?: string[];
|
|
380
388
|
}
|
|
381
|
-
type Field<ValueType = any, UserField extends {} = {}> = TextField | RichtextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
389
|
+
type Field<ValueType = any, UserField extends {} = {}> = TextField | RichtextField | NumberField | TextareaField | SelectField | RadioField | CheckboxField | ArrayField<ValueType extends {
|
|
382
390
|
[key: string]: any;
|
|
383
391
|
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
384
392
|
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps, UserField extends {} = {}> = {
|
|
@@ -462,6 +470,9 @@ UserField extends BaseField = {}> = {
|
|
|
462
470
|
label?: string;
|
|
463
471
|
defaultProps?: FieldProps;
|
|
464
472
|
fields?: Fields<FieldProps, UserField>;
|
|
473
|
+
renderFields?: RenderFunc<{
|
|
474
|
+
fields: Partial<Record<keyof FieldProps, ReactNode>>;
|
|
475
|
+
}>;
|
|
465
476
|
permissions?: Partial<Permissions>;
|
|
466
477
|
inline?: boolean;
|
|
467
478
|
resolveFields?: (data: DataShape, params: {
|
|
@@ -619,10 +630,13 @@ type UiState = {
|
|
|
619
630
|
controlsVisible: boolean;
|
|
620
631
|
options: Viewport[];
|
|
621
632
|
};
|
|
633
|
+
expandedFieldGroups: Record<string, boolean>;
|
|
622
634
|
field: {
|
|
623
635
|
focus?: string | null;
|
|
624
636
|
metadata?: Record<string, any>;
|
|
625
637
|
};
|
|
638
|
+
/** The selected field tab. Shows the first available tab when `null`. */
|
|
639
|
+
fieldTab?: string | number | null;
|
|
626
640
|
plugin: {
|
|
627
641
|
current: string | null;
|
|
628
642
|
};
|
|
@@ -716,6 +730,8 @@ type Overrides<UserConfig extends Config = Config> = OverridesGeneric<{
|
|
|
716
730
|
label?: string;
|
|
717
731
|
children: ReactNode;
|
|
718
732
|
parentAction: ReactNode;
|
|
733
|
+
dragHandle?: ReactNode;
|
|
734
|
+
dragHandleRef?: (element: Element | null) => void;
|
|
719
735
|
}>;
|
|
720
736
|
headerActions: RenderFunc<{
|
|
721
737
|
children: ReactNode;
|
|
@@ -725,10 +741,12 @@ type Overrides<UserConfig extends Config = Config> = OverridesGeneric<{
|
|
|
725
741
|
children: ReactNode;
|
|
726
742
|
isLoading: boolean;
|
|
727
743
|
itemSelector?: ItemSelector | null;
|
|
744
|
+
fields: Partial<Record<string, ReactNode>>;
|
|
728
745
|
}>;
|
|
729
746
|
fieldLabel: RenderFunc<{
|
|
730
747
|
children?: ReactNode;
|
|
731
748
|
icon?: ReactNode;
|
|
749
|
+
endIcon?: ReactNode;
|
|
732
750
|
label: string;
|
|
733
751
|
el?: "label" | "div";
|
|
734
752
|
readOnly?: boolean;
|
|
@@ -795,9 +813,11 @@ type DndBehavior = "auto" | "fluid" | "static";
|
|
|
795
813
|
type DndConfig = {
|
|
796
814
|
disableAutoScroll?: boolean;
|
|
797
815
|
disableOutlineDrag?: boolean;
|
|
816
|
+
enableDragHandle?: boolean;
|
|
798
817
|
/**
|
|
799
818
|
* - `auto` (default): fluid drags within a slot, switching to a static
|
|
800
|
-
* line placeholder when dragging between slots
|
|
819
|
+
* line placeholder when dragging between slots, inserting a new item,
|
|
820
|
+
* or dragging from the action bar drag handle
|
|
801
821
|
* - `fluid`: always animate sibling items during a drag
|
|
802
822
|
* - `static`: always show a line placeholder during a drag, only
|
|
803
823
|
* animating sibling items on drop
|
|
@@ -905,4 +925,4 @@ type PuckAction = {
|
|
|
905
925
|
recordHistory?: boolean;
|
|
906
926
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
|
907
927
|
|
|
908
|
-
export { type
|
|
928
|
+
export { type ObjectField as $, type Adaptor as A, type BaseData as B, type CacheOpts as C, type Data as D, type DragAxis as E, type DropZoneProps as F, type ExternalField as G, type ExternalFieldWithAdaptor as H, type ExtractConfigParams as I, type ExtractField as J, type Field as K, type FieldGroupVariant as L, type FieldMetadata as M, type FieldProps as N, type FieldRenderFunctions as O, type FieldTransformFn as P, type FieldTransformFnParams as Q, type FieldTransforms as R, type Fields as S, type History as T, type IframeConfig as U, type InitialHistory as V, type ItemSelector as W, type ItemWithId as X, type MappedItem as Y, type Metadata as Z, type NumberField as _, type AppState as a, type OnAction as a0, type OverrideKey as a1, type Overrides as a2, type Permissions as a3, type Plugin as a4, type PluginInternal as a5, type PrivateAppState as a6, type PuckAction as a7, type PuckComponent as a8, type PuckContext as a9, type PuckMetadata as aa, type RadioField as ab, type ResolveDataTrigger as ac, type RichText as ad, type RichtextField as ae, type RootConfig as af, type RootData as ag, type RootDataWithProps as ah, type RootDataWithoutProps as ai, type SelectField as aj, type Slot as ak, type SlotComponent as al, type SlotField as am, type TextField as an, type TextareaField as ao, type UiState as ap, type UserGenerics as aq, type Viewport as ar, type Viewports as as, type WithChildren as at, type WithDefaultRootFieldProps as au, type WithId as av, type WithPuckProps as aw, type WithSlotProps as ax, overrideKeys as ay, type ArrayField as b, type ArrayState as c, type AsFieldProps as d, type BaseField as e, type CheckboxField as f, type ComponentConfig as g, type ComponentConfigExtensions as h, type ComponentConfigParams as i, type ComponentData as j, type ComponentDataMap as k, type ComponentDataOptionalId as l, type ComponentMetadata as m, type Config as n, type ConfigParams as o, type Content as p, type CustomField as q, type CustomFieldRender as r, type DefaultComponentProps as s, type DefaultComponents as t, type DefaultRootFieldProps as u, type DefaultRootProps as v, type DefaultRootRenderProps as w, type Direction as x, type DndBehavior as y, type DndConfig as z };
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
defaultAppState,
|
|
6
6
|
resolveComponentData
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XMN55NON.mjs";
|
|
8
8
|
import {
|
|
9
9
|
get_class_name_factory_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OT7NKYY4.mjs";
|
|
11
11
|
import {
|
|
12
12
|
getZoneId,
|
|
13
13
|
mapFields,
|
|
@@ -225,16 +225,12 @@ function resolveAllData(_0, _1) {
|
|
|
225
225
|
"force",
|
|
226
226
|
parent,
|
|
227
227
|
root,
|
|
228
|
-
cacheStore
|
|
228
|
+
cacheStore,
|
|
229
|
+
// Slot children resolve through resolveNode, not a second walk of
|
|
230
|
+
// the resolved tree, so each resolveData runs once.
|
|
231
|
+
(child, resolvedParent) => resolveNode(child, resolvedParent, root)
|
|
229
232
|
)).node;
|
|
230
233
|
const resolvedAsComponent = toComponent(resolved);
|
|
231
|
-
const resolvedDeepPromise = mapFields(
|
|
232
|
-
resolved,
|
|
233
|
-
{
|
|
234
|
-
slot: ({ value }) => processContent(value, resolvedAsComponent, root)
|
|
235
|
-
},
|
|
236
|
-
config
|
|
237
|
-
);
|
|
238
234
|
let resolveZonePromises = [];
|
|
239
235
|
if (zonesByComponent[resolvedAsComponent.props.id]) {
|
|
240
236
|
resolveZonePromises = zonesByComponent[resolvedAsComponent.props.id].map(
|
|
@@ -247,10 +243,9 @@ function resolveAllData(_0, _1) {
|
|
|
247
243
|
})
|
|
248
244
|
);
|
|
249
245
|
}
|
|
250
|
-
const resolvedDeep = yield resolvedDeepPromise;
|
|
251
246
|
yield Promise.all(resolveZonePromises);
|
|
252
|
-
onResolveEnd == null ? void 0 : onResolveEnd(
|
|
253
|
-
return
|
|
247
|
+
onResolveEnd == null ? void 0 : onResolveEnd(resolvedAsComponent);
|
|
248
|
+
return resolved;
|
|
254
249
|
});
|
|
255
250
|
const processContent = (content, parent, root) => __async(null, null, function* () {
|
|
256
251
|
return Promise.all(content.map((item) => resolveNode(item, parent, root)));
|
|
@@ -281,7 +276,8 @@ var CONSUMED_PROP_KEYS = {
|
|
|
281
276
|
as: true,
|
|
282
277
|
content: true,
|
|
283
278
|
config: true,
|
|
284
|
-
metadata: true
|
|
279
|
+
metadata: true,
|
|
280
|
+
fieldTransforms: true
|
|
285
281
|
};
|
|
286
282
|
var NON_FORWARDABLE_PROP_KEYS = {
|
|
287
283
|
children: true,
|
|
@@ -317,23 +313,7 @@ var getDropZoneProps = (allProps) => {
|
|
|
317
313
|
};
|
|
318
314
|
};
|
|
319
315
|
|
|
320
|
-
// lib/
|
|
321
|
-
init_react_import();
|
|
322
|
-
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
323
|
-
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
324
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
325
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
326
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
327
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
328
|
-
}, dzProps), {
|
|
329
|
-
zone: propName,
|
|
330
|
-
content
|
|
331
|
-
}));
|
|
332
|
-
return Slot;
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
// lib/use-slots.tsx
|
|
316
|
+
// lib/props/render/use-render-props.tsx
|
|
337
317
|
init_react_import();
|
|
338
318
|
|
|
339
319
|
// lib/field-transforms/use-field-transforms.tsx
|
|
@@ -377,16 +357,21 @@ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
|
377
357
|
return mergedProps;
|
|
378
358
|
}
|
|
379
359
|
|
|
380
|
-
// lib/
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
360
|
+
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
361
|
+
init_react_import();
|
|
362
|
+
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
363
|
+
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
364
|
+
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
365
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
366
|
+
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
367
|
+
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
368
|
+
}, dzProps), {
|
|
369
|
+
zone: propName,
|
|
370
|
+
content
|
|
371
|
+
}));
|
|
372
|
+
return Slot;
|
|
373
|
+
}
|
|
374
|
+
});
|
|
390
375
|
|
|
391
376
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
392
377
|
init_react_import();
|
|
@@ -427,15 +412,18 @@ var mapDeep = (source, path, render) => {
|
|
|
427
412
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
428
413
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
429
414
|
var RichTextRender = lazy(
|
|
430
|
-
() => import("./Render-
|
|
415
|
+
() => import("./Render-H3USS5FU.mjs").then((m) => ({
|
|
431
416
|
default: m.RichTextRender
|
|
432
417
|
}))
|
|
433
418
|
);
|
|
434
|
-
function useRichtextProps(fields, props) {
|
|
419
|
+
function useRichtextProps(fields, props, fieldTransforms) {
|
|
435
420
|
const findAllRichtextKeys = (fields2, path = []) => {
|
|
436
421
|
if (!fields2) return [];
|
|
437
422
|
const result = [];
|
|
438
423
|
for (const [key, field] of Object.entries(fields2)) {
|
|
424
|
+
if (fieldTransforms == null ? void 0 : fieldTransforms[field.type]) {
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
439
427
|
const currentPath = [...path, key];
|
|
440
428
|
if (field.type === "richtext") {
|
|
441
429
|
result.push({
|
|
@@ -452,7 +440,10 @@ function useRichtextProps(fields, props) {
|
|
|
452
440
|
}
|
|
453
441
|
return result;
|
|
454
442
|
};
|
|
455
|
-
const richtextKeys = useMemo2(
|
|
443
|
+
const richtextKeys = useMemo2(
|
|
444
|
+
() => findAllRichtextKeys(fields),
|
|
445
|
+
[fields, fieldTransforms]
|
|
446
|
+
);
|
|
456
447
|
const richtextProps = useMemo2(() => {
|
|
457
448
|
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
458
449
|
let result = __spreadValues({}, props);
|
|
@@ -471,6 +462,28 @@ function useRichtextProps(fields, props) {
|
|
|
471
462
|
return richtextProps;
|
|
472
463
|
}
|
|
473
464
|
|
|
465
|
+
// lib/props/render/use-render-props.tsx
|
|
466
|
+
var EMPTY_FIELD_CONFIG = {};
|
|
467
|
+
function useRenderProps(config, component, renderSlot, fieldTransforms) {
|
|
468
|
+
var _a, _b;
|
|
469
|
+
const transformedProps = useFieldTransforms(
|
|
470
|
+
config,
|
|
471
|
+
component,
|
|
472
|
+
__spreadValues(__spreadValues({}, getSlotTransform(renderSlot)), fieldTransforms),
|
|
473
|
+
void 0,
|
|
474
|
+
true
|
|
475
|
+
);
|
|
476
|
+
const isRoot = !("type" in component) || component.type === "root";
|
|
477
|
+
const componentFields = isRoot ? (_a = config.root) == null ? void 0 : _a.fields : ((_b = config.components[component.type]) == null ? void 0 : _b.fields) || EMPTY_FIELD_CONFIG;
|
|
478
|
+
const richtextProps = useRichtextProps(
|
|
479
|
+
componentFields,
|
|
480
|
+
transformedProps,
|
|
481
|
+
fieldTransforms
|
|
482
|
+
);
|
|
483
|
+
return __spreadValues(__spreadValues({}, transformedProps), richtextProps);
|
|
484
|
+
}
|
|
485
|
+
var use_render_props_default = useRenderProps;
|
|
486
|
+
|
|
474
487
|
// components/SlotRender/server.tsx
|
|
475
488
|
init_react_import();
|
|
476
489
|
import { forwardRef } from "react";
|
|
@@ -479,14 +492,26 @@ var SlotRenderPure = (props) => /* @__PURE__ */ jsx3(SlotRender, __spreadValues(
|
|
|
479
492
|
var Item = ({
|
|
480
493
|
config,
|
|
481
494
|
item,
|
|
482
|
-
metadata
|
|
495
|
+
metadata,
|
|
496
|
+
fieldTransforms
|
|
483
497
|
}) => {
|
|
484
498
|
const Component = config.components[item.type];
|
|
485
|
-
const props =
|
|
486
|
-
|
|
499
|
+
const props = use_render_props_default(
|
|
500
|
+
config,
|
|
501
|
+
item,
|
|
502
|
+
(slotProps) => /* @__PURE__ */ jsx3(
|
|
503
|
+
SlotRenderPure,
|
|
504
|
+
__spreadProps(__spreadValues({}, slotProps), {
|
|
505
|
+
config,
|
|
506
|
+
metadata,
|
|
507
|
+
fieldTransforms
|
|
508
|
+
})
|
|
509
|
+
),
|
|
510
|
+
fieldTransforms
|
|
511
|
+
);
|
|
487
512
|
return /* @__PURE__ */ jsx3(
|
|
488
513
|
Component.render,
|
|
489
|
-
__spreadProps(__spreadValues(
|
|
514
|
+
__spreadProps(__spreadValues({}, props), {
|
|
490
515
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
491
516
|
metadata: metadata || {}
|
|
492
517
|
})
|
|
@@ -496,7 +521,15 @@ var Item = ({
|
|
|
496
521
|
var SlotRender = forwardRef(
|
|
497
522
|
function SlotRenderInternal(allProps, ref) {
|
|
498
523
|
const {
|
|
499
|
-
props: {
|
|
524
|
+
props: {
|
|
525
|
+
className,
|
|
526
|
+
style,
|
|
527
|
+
content,
|
|
528
|
+
config,
|
|
529
|
+
metadata,
|
|
530
|
+
as,
|
|
531
|
+
fieldTransforms
|
|
532
|
+
},
|
|
500
533
|
forwardableProps
|
|
501
534
|
} = getDropZoneProps(allProps);
|
|
502
535
|
const El = as != null ? as : "div";
|
|
@@ -509,7 +542,8 @@ var SlotRender = forwardRef(
|
|
|
509
542
|
{
|
|
510
543
|
config,
|
|
511
544
|
item,
|
|
512
|
-
metadata
|
|
545
|
+
metadata,
|
|
546
|
+
fieldTransforms
|
|
513
547
|
},
|
|
514
548
|
item.props.id
|
|
515
549
|
);
|
|
@@ -521,9 +555,8 @@ export {
|
|
|
521
555
|
getDropZoneProps,
|
|
522
556
|
buildMappers,
|
|
523
557
|
getSlotTransform,
|
|
524
|
-
useSlots,
|
|
525
558
|
RichTextRenderFallback,
|
|
526
|
-
|
|
559
|
+
use_render_props_default,
|
|
527
560
|
SlotRenderPure,
|
|
528
561
|
SlotRender,
|
|
529
562
|
migrate,
|