@puckeditor/core 0.23.0 → 0.24.0-canary.6265ac2a
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/{actions-DA1J5F56.d.mts → actions-CLNN-g7L.d.mts} +3 -3
- package/dist/{actions-DA1J5F56.d.ts → actions-CLNN-g7L.d.ts} +3 -3
- package/dist/{chunk-55V3NZVF.mjs → chunk-IEMHXY7E.mjs} +55 -19
- package/dist/{index-DIZKfHDN.d.ts → index-B_5ZR3yN.d.ts} +1 -1
- package/dist/{index-n9eR_SWx.d.mts → index-CtS7NnHM.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +55 -19
- package/dist/index.mjs +1 -1
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/no-external.d.mts +3 -3
- package/dist/no-external.d.ts +3 -3
- package/dist/no-external.js +55 -19
- package/dist/no-external.mjs +1 -1
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/{walk-tree-DHP1pWEM.d.mts → walk-tree-CLq7jUXe.d.mts} +1 -1
- package/dist/{walk-tree-DbY5zG2K.d.ts → walk-tree-DQYPBSSN.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -713,12 +713,12 @@ type Overrides<UserConfig extends Config = Config> = OverridesGeneric<{
|
|
|
713
713
|
}>;
|
|
714
714
|
type FieldRenderFunctions<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends {
|
|
715
715
|
type: string;
|
|
716
|
-
} = Field | G["UserField"]> =
|
|
716
|
+
} = Field | G["UserField"]> = {
|
|
717
717
|
[Type in UserField["type"]]: React.FunctionComponent<FieldProps<ExtractField<UserField, Type>, any> & {
|
|
718
718
|
children: ReactNode;
|
|
719
719
|
name: string;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
720
|
+
}> | null;
|
|
721
|
+
};
|
|
722
722
|
|
|
723
723
|
type Direction = "left" | "right" | "up" | "down" | null;
|
|
724
724
|
type DragAxis = "dynamic" | "y" | "x";
|
|
@@ -713,12 +713,12 @@ type Overrides<UserConfig extends Config = Config> = OverridesGeneric<{
|
|
|
713
713
|
}>;
|
|
714
714
|
type FieldRenderFunctions<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends {
|
|
715
715
|
type: string;
|
|
716
|
-
} = Field | G["UserField"]> =
|
|
716
|
+
} = Field | G["UserField"]> = {
|
|
717
717
|
[Type in UserField["type"]]: React.FunctionComponent<FieldProps<ExtractField<UserField, Type>, any> & {
|
|
718
718
|
children: ReactNode;
|
|
719
719
|
name: string;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
720
|
+
}> | null;
|
|
721
|
+
};
|
|
722
722
|
|
|
723
723
|
type Direction = "left" | "right" | "up" | "down" | null;
|
|
724
724
|
type DragAxis = "dynamic" | "y" | "x";
|
|
@@ -918,6 +918,24 @@ var getDeep = (node, path) => {
|
|
|
918
918
|
}, node);
|
|
919
919
|
};
|
|
920
920
|
|
|
921
|
+
// lib/fields/is-field-visible.ts
|
|
922
|
+
init_react_import();
|
|
923
|
+
|
|
924
|
+
// lib/overrides/field-types.ts
|
|
925
|
+
init_react_import();
|
|
926
|
+
var isFieldTypeHidden = (overrides, fieldType) => {
|
|
927
|
+
return fieldType ? (overrides == null ? void 0 : overrides[fieldType]) === null : false;
|
|
928
|
+
};
|
|
929
|
+
|
|
930
|
+
// lib/fields/is-field-visible.ts
|
|
931
|
+
var isFieldVisible = (fieldTypeOverrides, field) => {
|
|
932
|
+
var _a;
|
|
933
|
+
if (!field) return false;
|
|
934
|
+
if (field.type === "slot") return false;
|
|
935
|
+
if (isFieldTypeHidden(fieldTypeOverrides, field.type)) return false;
|
|
936
|
+
return (_a = field.visible) != null ? _a : true;
|
|
937
|
+
};
|
|
938
|
+
|
|
921
939
|
// components/AutoField/subfield.tsx
|
|
922
940
|
init_react_import();
|
|
923
941
|
import { memo } from "react";
|
|
@@ -1009,6 +1027,7 @@ var ArrayFieldItemInternal = ({
|
|
|
1009
1027
|
name,
|
|
1010
1028
|
localName
|
|
1011
1029
|
}) => {
|
|
1030
|
+
const fieldTypeOverrides = useAppStore((s) => s.overrides.fieldTypes);
|
|
1012
1031
|
const isExpanded = useAppStore((s) => {
|
|
1013
1032
|
var _a;
|
|
1014
1033
|
return ((_a = s.state.ui.arrayState[arrayId]) == null ? void 0 : _a.openId) === id;
|
|
@@ -1021,9 +1040,9 @@ var ArrayFieldItemInternal = ({
|
|
|
1021
1040
|
return false;
|
|
1022
1041
|
}
|
|
1023
1042
|
return Object.values(field.arrayFields).some(
|
|
1024
|
-
(subField) =>
|
|
1043
|
+
(subField) => isFieldVisible(fieldTypeOverrides, subField)
|
|
1025
1044
|
);
|
|
1026
|
-
}, [field.arrayFields]);
|
|
1045
|
+
}, [field.arrayFields, fieldTypeOverrides]);
|
|
1027
1046
|
return /* @__PURE__ */ jsx8(Sortable, { id, index: dragIndex, disabled: readOnly, children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ jsxs3(
|
|
1028
1047
|
"div",
|
|
1029
1048
|
{
|
|
@@ -2282,11 +2301,7 @@ function AutoFieldInternal(props) {
|
|
|
2282
2301
|
return render[field.type];
|
|
2283
2302
|
}
|
|
2284
2303
|
}, [field.type, fieldKey, render]);
|
|
2285
|
-
|
|
2286
|
-
if (!visible) {
|
|
2287
|
-
return null;
|
|
2288
|
-
}
|
|
2289
|
-
if (field.type === "slot") {
|
|
2304
|
+
if (!isFieldVisible(overrides.fieldTypes, field)) {
|
|
2290
2305
|
return null;
|
|
2291
2306
|
}
|
|
2292
2307
|
if (!FieldComponent) {
|
|
@@ -8139,6 +8154,7 @@ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null
|
|
|
8139
8154
|
});
|
|
8140
8155
|
});
|
|
8141
8156
|
var FieldsChildInner = ({ fieldName }) => {
|
|
8157
|
+
const fieldTypeOverrides = useAppStore((s) => s.overrides.fieldTypes);
|
|
8142
8158
|
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
8143
8159
|
const isReadOnly = useAppStore(
|
|
8144
8160
|
(s) => ((s.selectedItem ? s.selectedItem.readOnly : s.state.data.root.readOnly) || {})[fieldName]
|
|
@@ -8157,7 +8173,6 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
8157
8173
|
const onChange = useCallback20(createOnChange(fieldName, appStore), [
|
|
8158
8174
|
fieldName
|
|
8159
8175
|
]);
|
|
8160
|
-
const { visible = true } = field != null ? field : {};
|
|
8161
8176
|
const fieldStore = useContext16(fieldContextStore.ctx);
|
|
8162
8177
|
useEffect21(() => {
|
|
8163
8178
|
return appStore.subscribe(
|
|
@@ -8171,8 +8186,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
8171
8186
|
}
|
|
8172
8187
|
);
|
|
8173
8188
|
}, [appStore, fieldStore]);
|
|
8174
|
-
if (!
|
|
8175
|
-
if (field.type === "slot") return null;
|
|
8189
|
+
if (!id || !isFieldVisible(fieldTypeOverrides, field)) return null;
|
|
8176
8190
|
return /* @__PURE__ */ jsx52("div", { className: getClassName33("field"), children: /* @__PURE__ */ jsx52(
|
|
8177
8191
|
AutoFieldPrivate,
|
|
8178
8192
|
{
|
|
@@ -11915,11 +11929,25 @@ import { useMemo as useMemo23 } from "react";
|
|
|
11915
11929
|
|
|
11916
11930
|
// lib/load-overrides.ts
|
|
11917
11931
|
init_react_import();
|
|
11932
|
+
var curryPluginOverrides = (override, previousPluginOverride) => {
|
|
11933
|
+
const Comp = (props) => {
|
|
11934
|
+
const children = previousPluginOverride ? previousPluginOverride(props) : props.children;
|
|
11935
|
+
if (override) {
|
|
11936
|
+
return override(__spreadProps(__spreadValues({}, props), {
|
|
11937
|
+
children
|
|
11938
|
+
}));
|
|
11939
|
+
}
|
|
11940
|
+
return children;
|
|
11941
|
+
};
|
|
11942
|
+
return Comp;
|
|
11943
|
+
};
|
|
11918
11944
|
var loadOverrides = ({
|
|
11919
11945
|
overrides,
|
|
11920
11946
|
plugins
|
|
11921
11947
|
}) => {
|
|
11922
11948
|
const collected = __spreadValues({}, overrides);
|
|
11949
|
+
if (overrides == null ? void 0 : overrides.fieldTypes) collected.fieldTypes = __spreadValues({}, overrides.fieldTypes);
|
|
11950
|
+
const prevFieldTypesOverride = __spreadValues({}, overrides == null ? void 0 : overrides.fieldTypes);
|
|
11923
11951
|
plugins == null ? void 0 : plugins.forEach((plugin) => {
|
|
11924
11952
|
if (!plugin.overrides) return;
|
|
11925
11953
|
Object.keys(plugin.overrides).forEach((_overridesType) => {
|
|
@@ -11927,21 +11955,29 @@ var loadOverrides = ({
|
|
|
11927
11955
|
const overridesType = _overridesType;
|
|
11928
11956
|
if (!((_a = plugin.overrides) == null ? void 0 : _a[overridesType])) return;
|
|
11929
11957
|
if (overridesType === "fieldTypes") {
|
|
11930
|
-
const
|
|
11931
|
-
Object.keys(
|
|
11958
|
+
const currPluginFieldTypes = plugin.overrides.fieldTypes;
|
|
11959
|
+
Object.keys(currPluginFieldTypes).forEach((fieldType) => {
|
|
11932
11960
|
collected.fieldTypes = collected.fieldTypes || {};
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
}
|
|
11961
|
+
if (isFieldTypeHidden(currPluginFieldTypes, fieldType)) {
|
|
11962
|
+
collected.fieldTypes[fieldType] = null;
|
|
11963
|
+
return;
|
|
11964
|
+
}
|
|
11965
|
+
const prevNonNullPluginFieldType = prevFieldTypesOverride[fieldType];
|
|
11966
|
+
const currPluginFieldType = currPluginFieldTypes[fieldType];
|
|
11967
|
+
const Comp2 = curryPluginOverrides(
|
|
11968
|
+
currPluginFieldType,
|
|
11969
|
+
prevNonNullPluginFieldType
|
|
11970
|
+
);
|
|
11937
11971
|
collected.fieldTypes[fieldType] = Comp2;
|
|
11972
|
+
prevFieldTypesOverride[fieldType] = Comp2;
|
|
11938
11973
|
});
|
|
11939
11974
|
return;
|
|
11940
11975
|
}
|
|
11941
11976
|
const childNode = collected[overridesType];
|
|
11942
|
-
const Comp = (
|
|
11943
|
-
|
|
11944
|
-
|
|
11977
|
+
const Comp = curryPluginOverrides(
|
|
11978
|
+
plugin.overrides[overridesType],
|
|
11979
|
+
childNode
|
|
11980
|
+
);
|
|
11945
11981
|
collected[overridesType] = Comp;
|
|
11946
11982
|
});
|
|
11947
11983
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as History, a1 as Permissions, i as ComponentData, m as Config, ao as UserGenerics, Q as Fields, a5 as PuckAction, af as RootDataWithProps, aa as ResolveDataTrigger, a2 as Plugin, a0 as Overrides, aq as Viewports, S as IframeConfig, an as UiState, f as ComponentConfig, a as AppState, X as Metadata, y as DndConfig, P as FieldTransforms, ac as RichtextField } from './actions-
|
|
1
|
+
import { R as History, a1 as Permissions, i as ComponentData, m as Config, ao as UserGenerics, Q as Fields, a5 as PuckAction, af as RootDataWithProps, aa as ResolveDataTrigger, a2 as Plugin, a0 as Overrides, aq as Viewports, S as IframeConfig, an as UiState, f as ComponentConfig, a as AppState, X as Metadata, y as DndConfig, P as FieldTransforms, ac as RichtextField } from './actions-CLNN-g7L.js';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
|
|
4
4
|
type HistorySlice<D = any> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as History, a1 as Permissions, i as ComponentData, m as Config, ao as UserGenerics, Q as Fields, a5 as PuckAction, af as RootDataWithProps, aa as ResolveDataTrigger, a2 as Plugin, a0 as Overrides, aq as Viewports, S as IframeConfig, an as UiState, f as ComponentConfig, a as AppState, X as Metadata, y as DndConfig, P as FieldTransforms, ac as RichtextField } from './actions-
|
|
1
|
+
import { R as History, a1 as Permissions, i as ComponentData, m as Config, ao as UserGenerics, Q as Fields, a5 as PuckAction, af as RootDataWithProps, aa as ResolveDataTrigger, a2 as Plugin, a0 as Overrides, aq as Viewports, S as IframeConfig, an as UiState, f as ComponentConfig, a as AppState, X as Metadata, y as DndConfig, P as FieldTransforms, ac as RichtextField } from './actions-CLNN-g7L.mjs';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
|
|
4
4
|
type HistorySlice<D = any> = {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { J as Field, L as FieldProps, E as DropZoneProps, m as Config, ao as UserGenerics, D as Data, an as UiState, _ as OnAction, a1 as Permissions, a2 as Plugin, a0 as Overrides, P as FieldTransforms, a5 as PuckAction, aq as Viewports, S as IframeConfig, y as DndConfig, T as InitialHistory, X as Metadata, aa as ResolveDataTrigger, U as ItemSelector, i as ComponentData, a3 as PluginInternal } from './actions-
|
|
2
|
-
export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DndBehavior, z as DragAxis, F as ExternalField, G as ExternalFieldWithAdaptor, H as ExtractConfigParams, I as ExtractField, K as FieldMetadata, M as FieldRenderFunctions, N as FieldTransformFn, O as FieldTransformFnParams, Q as Fields, R as History, V as ItemWithId, W as MappedItem, Y as NumberField, Z as ObjectField, $ as OverrideKey, a6 as PuckComponent, a7 as PuckContext, a8 as PuckMetadata, a9 as RadioField, ab as RichText, ac as RichtextField, ad as RootConfig, ae as RootData, af as RootDataWithProps, ag as RootDataWithoutProps, ah as SelectField, ai as Slot, aj as SlotComponent, ak as SlotField, al as TextField, am as TextareaField, ap as Viewport, ar as WithChildren, as as WithDefaultRootFieldProps, at as WithId, au as WithPuckProps, av as WithSlotProps, aw as overrideKeys } from './actions-
|
|
3
|
-
import { D as Dictionary, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-
|
|
4
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
1
|
+
import { J as Field, L as FieldProps, E as DropZoneProps, m as Config, ao as UserGenerics, D as Data, an as UiState, _ as OnAction, a1 as Permissions, a2 as Plugin, a0 as Overrides, P as FieldTransforms, a5 as PuckAction, aq as Viewports, S as IframeConfig, y as DndConfig, T as InitialHistory, X as Metadata, aa as ResolveDataTrigger, U as ItemSelector, i as ComponentData, a3 as PluginInternal } from './actions-CLNN-g7L.mjs';
|
|
2
|
+
export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DndBehavior, z as DragAxis, F as ExternalField, G as ExternalFieldWithAdaptor, H as ExtractConfigParams, I as ExtractField, K as FieldMetadata, M as FieldRenderFunctions, N as FieldTransformFn, O as FieldTransformFnParams, Q as Fields, R as History, V as ItemWithId, W as MappedItem, Y as NumberField, Z as ObjectField, $ as OverrideKey, a6 as PuckComponent, a7 as PuckContext, a8 as PuckMetadata, a9 as RadioField, ab as RichText, ac as RichtextField, ad as RootConfig, ae as RootData, af as RootDataWithProps, ag as RootDataWithoutProps, ah as SelectField, ai as Slot, aj as SlotComponent, ak as SlotField, al as TextField, am as TextareaField, ap as Viewport, ar as WithChildren, as as WithDefaultRootFieldProps, at as WithId, au as WithPuckProps, av as WithSlotProps, aw as overrideKeys } from './actions-CLNN-g7L.mjs';
|
|
3
|
+
import { D as Dictionary, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-CtS7NnHM.mjs';
|
|
4
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CLq7jUXe.mjs';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { J as Field, L as FieldProps, E as DropZoneProps, m as Config, ao as UserGenerics, D as Data, an as UiState, _ as OnAction, a1 as Permissions, a2 as Plugin, a0 as Overrides, P as FieldTransforms, a5 as PuckAction, aq as Viewports, S as IframeConfig, y as DndConfig, T as InitialHistory, X as Metadata, aa as ResolveDataTrigger, U as ItemSelector, i as ComponentData, a3 as PluginInternal } from './actions-
|
|
2
|
-
export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DndBehavior, z as DragAxis, F as ExternalField, G as ExternalFieldWithAdaptor, H as ExtractConfigParams, I as ExtractField, K as FieldMetadata, M as FieldRenderFunctions, N as FieldTransformFn, O as FieldTransformFnParams, Q as Fields, R as History, V as ItemWithId, W as MappedItem, Y as NumberField, Z as ObjectField, $ as OverrideKey, a6 as PuckComponent, a7 as PuckContext, a8 as PuckMetadata, a9 as RadioField, ab as RichText, ac as RichtextField, ad as RootConfig, ae as RootData, af as RootDataWithProps, ag as RootDataWithoutProps, ah as SelectField, ai as Slot, aj as SlotComponent, ak as SlotField, al as TextField, am as TextareaField, ap as Viewport, ar as WithChildren, as as WithDefaultRootFieldProps, at as WithId, au as WithPuckProps, av as WithSlotProps, aw as overrideKeys } from './actions-
|
|
3
|
-
import { D as Dictionary, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-
|
|
4
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
1
|
+
import { J as Field, L as FieldProps, E as DropZoneProps, m as Config, ao as UserGenerics, D as Data, an as UiState, _ as OnAction, a1 as Permissions, a2 as Plugin, a0 as Overrides, P as FieldTransforms, a5 as PuckAction, aq as Viewports, S as IframeConfig, y as DndConfig, T as InitialHistory, X as Metadata, aa as ResolveDataTrigger, U as ItemSelector, i as ComponentData, a3 as PluginInternal } from './actions-CLNN-g7L.js';
|
|
2
|
+
export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DndBehavior, z as DragAxis, F as ExternalField, G as ExternalFieldWithAdaptor, H as ExtractConfigParams, I as ExtractField, K as FieldMetadata, M as FieldRenderFunctions, N as FieldTransformFn, O as FieldTransformFnParams, Q as Fields, R as History, V as ItemWithId, W as MappedItem, Y as NumberField, Z as ObjectField, $ as OverrideKey, a6 as PuckComponent, a7 as PuckContext, a8 as PuckMetadata, a9 as RadioField, ab as RichText, ac as RichtextField, ad as RootConfig, ae as RootData, af as RootDataWithProps, ag as RootDataWithoutProps, ah as SelectField, ai as Slot, aj as SlotComponent, ak as SlotField, al as TextField, am as TextareaField, ap as Viewport, ar as WithChildren, as as WithDefaultRootFieldProps, at as WithId, au as WithPuckProps, av as WithSlotProps, aw as overrideKeys } from './actions-CLNN-g7L.js';
|
|
3
|
+
import { D as Dictionary, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-B_5ZR3yN.js';
|
|
4
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DQYPBSSN.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
package/dist/index.js
CHANGED
|
@@ -6622,6 +6622,24 @@ var getDeep = (node, path) => {
|
|
|
6622
6622
|
}, node);
|
|
6623
6623
|
};
|
|
6624
6624
|
|
|
6625
|
+
// lib/fields/is-field-visible.ts
|
|
6626
|
+
init_react_import();
|
|
6627
|
+
|
|
6628
|
+
// lib/overrides/field-types.ts
|
|
6629
|
+
init_react_import();
|
|
6630
|
+
var isFieldTypeHidden = (overrides, fieldType) => {
|
|
6631
|
+
return fieldType ? (overrides == null ? void 0 : overrides[fieldType]) === null : false;
|
|
6632
|
+
};
|
|
6633
|
+
|
|
6634
|
+
// lib/fields/is-field-visible.ts
|
|
6635
|
+
var isFieldVisible = (fieldTypeOverrides, field) => {
|
|
6636
|
+
var _a;
|
|
6637
|
+
if (!field) return false;
|
|
6638
|
+
if (field.type === "slot") return false;
|
|
6639
|
+
if (isFieldTypeHidden(fieldTypeOverrides, field.type)) return false;
|
|
6640
|
+
return (_a = field.visible) != null ? _a : true;
|
|
6641
|
+
};
|
|
6642
|
+
|
|
6625
6643
|
// components/AutoField/subfield.tsx
|
|
6626
6644
|
init_react_import();
|
|
6627
6645
|
var import_react17 = require("react");
|
|
@@ -6755,6 +6773,7 @@ var ArrayFieldItemInternal = ({
|
|
|
6755
6773
|
name,
|
|
6756
6774
|
localName
|
|
6757
6775
|
}) => {
|
|
6776
|
+
const fieldTypeOverrides = useAppStore((s) => s.overrides.fieldTypes);
|
|
6758
6777
|
const isExpanded = useAppStore((s) => {
|
|
6759
6778
|
var _a;
|
|
6760
6779
|
return ((_a = s.state.ui.arrayState[arrayId]) == null ? void 0 : _a.openId) === id;
|
|
@@ -6767,9 +6786,9 @@ var ArrayFieldItemInternal = ({
|
|
|
6767
6786
|
return false;
|
|
6768
6787
|
}
|
|
6769
6788
|
return Object.values(field.arrayFields).some(
|
|
6770
|
-
(subField) =>
|
|
6789
|
+
(subField) => isFieldVisible(fieldTypeOverrides, subField)
|
|
6771
6790
|
);
|
|
6772
|
-
}, [field.arrayFields]);
|
|
6791
|
+
}, [field.arrayFields, fieldTypeOverrides]);
|
|
6773
6792
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Sortable, { id, index: dragIndex, disabled: readOnly, children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
6774
6793
|
"div",
|
|
6775
6794
|
{
|
|
@@ -8206,11 +8225,7 @@ function AutoFieldInternal(props) {
|
|
|
8206
8225
|
return render[field.type];
|
|
8207
8226
|
}
|
|
8208
8227
|
}, [field.type, fieldKey, render]);
|
|
8209
|
-
|
|
8210
|
-
if (!visible) {
|
|
8211
|
-
return null;
|
|
8212
|
-
}
|
|
8213
|
-
if (field.type === "slot") {
|
|
8228
|
+
if (!isFieldVisible(overrides.fieldTypes, field)) {
|
|
8214
8229
|
return null;
|
|
8215
8230
|
}
|
|
8216
8231
|
if (!FieldComponent) {
|
|
@@ -12464,6 +12479,7 @@ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null
|
|
|
12464
12479
|
});
|
|
12465
12480
|
});
|
|
12466
12481
|
var FieldsChildInner = ({ fieldName }) => {
|
|
12482
|
+
const fieldTypeOverrides = useAppStore((s) => s.overrides.fieldTypes);
|
|
12467
12483
|
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
12468
12484
|
const isReadOnly = useAppStore(
|
|
12469
12485
|
(s) => ((s.selectedItem ? s.selectedItem.readOnly : s.state.data.root.readOnly) || {})[fieldName]
|
|
@@ -12482,7 +12498,6 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
12482
12498
|
const onChange = (0, import_react77.useCallback)(createOnChange(fieldName, appStore), [
|
|
12483
12499
|
fieldName
|
|
12484
12500
|
]);
|
|
12485
|
-
const { visible = true } = field != null ? field : {};
|
|
12486
12501
|
const fieldStore = (0, import_react77.useContext)(fieldContextStore.ctx);
|
|
12487
12502
|
(0, import_react77.useEffect)(() => {
|
|
12488
12503
|
return appStore.subscribe(
|
|
@@ -12496,8 +12511,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
12496
12511
|
}
|
|
12497
12512
|
);
|
|
12498
12513
|
}, [appStore, fieldStore]);
|
|
12499
|
-
if (!
|
|
12500
|
-
if (field.type === "slot") return null;
|
|
12514
|
+
if (!id || !isFieldVisible(fieldTypeOverrides, field)) return null;
|
|
12501
12515
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: getClassName28("field"), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
12502
12516
|
AutoFieldPrivate,
|
|
12503
12517
|
{
|
|
@@ -17794,11 +17808,25 @@ var import_react95 = require("react");
|
|
|
17794
17808
|
|
|
17795
17809
|
// lib/load-overrides.ts
|
|
17796
17810
|
init_react_import();
|
|
17811
|
+
var curryPluginOverrides = (override, previousPluginOverride) => {
|
|
17812
|
+
const Comp = (props) => {
|
|
17813
|
+
const children = previousPluginOverride ? previousPluginOverride(props) : props.children;
|
|
17814
|
+
if (override) {
|
|
17815
|
+
return override(__spreadProps(__spreadValues({}, props), {
|
|
17816
|
+
children
|
|
17817
|
+
}));
|
|
17818
|
+
}
|
|
17819
|
+
return children;
|
|
17820
|
+
};
|
|
17821
|
+
return Comp;
|
|
17822
|
+
};
|
|
17797
17823
|
var loadOverrides = ({
|
|
17798
17824
|
overrides,
|
|
17799
17825
|
plugins
|
|
17800
17826
|
}) => {
|
|
17801
17827
|
const collected = __spreadValues({}, overrides);
|
|
17828
|
+
if (overrides == null ? void 0 : overrides.fieldTypes) collected.fieldTypes = __spreadValues({}, overrides.fieldTypes);
|
|
17829
|
+
const prevFieldTypesOverride = __spreadValues({}, overrides == null ? void 0 : overrides.fieldTypes);
|
|
17802
17830
|
plugins == null ? void 0 : plugins.forEach((plugin) => {
|
|
17803
17831
|
if (!plugin.overrides) return;
|
|
17804
17832
|
Object.keys(plugin.overrides).forEach((_overridesType) => {
|
|
@@ -17806,21 +17834,29 @@ var loadOverrides = ({
|
|
|
17806
17834
|
const overridesType = _overridesType;
|
|
17807
17835
|
if (!((_a = plugin.overrides) == null ? void 0 : _a[overridesType])) return;
|
|
17808
17836
|
if (overridesType === "fieldTypes") {
|
|
17809
|
-
const
|
|
17810
|
-
Object.keys(
|
|
17837
|
+
const currPluginFieldTypes = plugin.overrides.fieldTypes;
|
|
17838
|
+
Object.keys(currPluginFieldTypes).forEach((fieldType) => {
|
|
17811
17839
|
collected.fieldTypes = collected.fieldTypes || {};
|
|
17812
|
-
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
}
|
|
17840
|
+
if (isFieldTypeHidden(currPluginFieldTypes, fieldType)) {
|
|
17841
|
+
collected.fieldTypes[fieldType] = null;
|
|
17842
|
+
return;
|
|
17843
|
+
}
|
|
17844
|
+
const prevNonNullPluginFieldType = prevFieldTypesOverride[fieldType];
|
|
17845
|
+
const currPluginFieldType = currPluginFieldTypes[fieldType];
|
|
17846
|
+
const Comp2 = curryPluginOverrides(
|
|
17847
|
+
currPluginFieldType,
|
|
17848
|
+
prevNonNullPluginFieldType
|
|
17849
|
+
);
|
|
17816
17850
|
collected.fieldTypes[fieldType] = Comp2;
|
|
17851
|
+
prevFieldTypesOverride[fieldType] = Comp2;
|
|
17817
17852
|
});
|
|
17818
17853
|
return;
|
|
17819
17854
|
}
|
|
17820
17855
|
const childNode = collected[overridesType];
|
|
17821
|
-
const Comp = (
|
|
17822
|
-
|
|
17823
|
-
|
|
17856
|
+
const Comp = curryPluginOverrides(
|
|
17857
|
+
plugin.overrides[overridesType],
|
|
17858
|
+
childNode
|
|
17859
|
+
);
|
|
17824
17860
|
collected[overridesType] = Comp;
|
|
17825
17861
|
});
|
|
17826
17862
|
});
|
package/dist/index.mjs
CHANGED
package/dist/internal.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Reducer } from 'react';
|
|
2
|
-
import { D as Data, a as AppState, _ as OnAction, a4 as PrivateAppState, a5 as PuckAction } from './actions-
|
|
3
|
-
import { A as AppStore } from './index-
|
|
2
|
+
import { D as Data, a as AppState, _ as OnAction, a4 as PrivateAppState, a5 as PuckAction } from './actions-CLNN-g7L.mjs';
|
|
3
|
+
import { A as AppStore } from './index-CtS7NnHM.mjs';
|
|
4
4
|
import '@tiptap/react';
|
|
5
5
|
import '@tiptap/extension-blockquote';
|
|
6
6
|
import '@tiptap/extension-bold';
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Reducer } from 'react';
|
|
2
|
-
import { D as Data, a as AppState, _ as OnAction, a4 as PrivateAppState, a5 as PuckAction } from './actions-
|
|
3
|
-
import { A as AppStore } from './index-
|
|
2
|
+
import { D as Data, a as AppState, _ as OnAction, a4 as PrivateAppState, a5 as PuckAction } from './actions-CLNN-g7L.js';
|
|
3
|
+
import { A as AppStore } from './index-B_5ZR3yN.js';
|
|
4
4
|
import '@tiptap/react';
|
|
5
5
|
import '@tiptap/extension-blockquote';
|
|
6
6
|
import '@tiptap/extension-bold';
|
package/dist/no-external.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, i as ComponentData, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, m as Config, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, D as Data, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DndBehavior, y as DndConfig, z as DragAxis, F as ExternalField, G as ExternalFieldWithAdaptor, H as ExtractConfigParams, I as ExtractField, J as Field, K as FieldMetadata, L as FieldProps, M as FieldRenderFunctions, N as FieldTransformFn, O as FieldTransformFnParams, P as FieldTransforms, Q as Fields, R as History, S as IframeConfig, T as InitialHistory, V as ItemWithId, W as MappedItem, X as Metadata, Y as NumberField, Z as ObjectField, _ as OnAction, $ as OverrideKey, a0 as Overrides, a1 as Permissions, a2 as Plugin, a5 as PuckAction, a6 as PuckComponent, a7 as PuckContext, a8 as PuckMetadata, a9 as RadioField, aa as ResolveDataTrigger, ab as RichText, ac as RichtextField, ad as RootConfig, ae as RootData, af as RootDataWithProps, ag as RootDataWithoutProps, ah as SelectField, ai as Slot, aj as SlotComponent, ak as SlotField, al as TextField, am as TextareaField, an as UiState, ao as UserGenerics, ap as Viewport, aq as Viewports, ar as WithChildren, as as WithDefaultRootFieldProps, at as WithId, au as WithPuckProps, av as WithSlotProps, aw as overrideKeys } from './actions-
|
|
2
|
-
export { D as Dictionary } from './index-
|
|
1
|
+
export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, i as ComponentData, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, m as Config, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, D as Data, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DndBehavior, y as DndConfig, z as DragAxis, F as ExternalField, G as ExternalFieldWithAdaptor, H as ExtractConfigParams, I as ExtractField, J as Field, K as FieldMetadata, L as FieldProps, M as FieldRenderFunctions, N as FieldTransformFn, O as FieldTransformFnParams, P as FieldTransforms, Q as Fields, R as History, S as IframeConfig, T as InitialHistory, V as ItemWithId, W as MappedItem, X as Metadata, Y as NumberField, Z as ObjectField, _ as OnAction, $ as OverrideKey, a0 as Overrides, a1 as Permissions, a2 as Plugin, a5 as PuckAction, a6 as PuckComponent, a7 as PuckContext, a8 as PuckMetadata, a9 as RadioField, aa as ResolveDataTrigger, ab as RichText, ac as RichtextField, ad as RootConfig, ae as RootData, af as RootDataWithProps, ag as RootDataWithoutProps, ah as SelectField, ai as Slot, aj as SlotComponent, ak as SlotField, al as TextField, am as TextareaField, an as UiState, ao as UserGenerics, ap as Viewport, aq as Viewports, ar as WithChildren, as as WithDefaultRootFieldProps, at as WithId, au as WithPuckProps, av as WithSlotProps, aw as overrideKeys } from './actions-CLNN-g7L.mjs';
|
|
2
|
+
export { D as Dictionary } from './index-CtS7NnHM.mjs';
|
|
3
3
|
export { Action, ActionBar, AutoField, BlocksPluginProps, Button, Drawer, DropZone, FieldLabel, Group, IconButton, Label, OutlinePluginProps, Puck, PuckApi, Render, RichTextMenu, Separator, UsePuckData, blocksPlugin, createUsePuck, fieldsPlugin, legacySideBarPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck } from './index.mjs';
|
|
4
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
4
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CLq7jUXe.mjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@tiptap/react';
|
|
7
7
|
import '@tiptap/extension-blockquote';
|
package/dist/no-external.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, i as ComponentData, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, m as Config, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, D as Data, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DndBehavior, y as DndConfig, z as DragAxis, F as ExternalField, G as ExternalFieldWithAdaptor, H as ExtractConfigParams, I as ExtractField, J as Field, K as FieldMetadata, L as FieldProps, M as FieldRenderFunctions, N as FieldTransformFn, O as FieldTransformFnParams, P as FieldTransforms, Q as Fields, R as History, S as IframeConfig, T as InitialHistory, V as ItemWithId, W as MappedItem, X as Metadata, Y as NumberField, Z as ObjectField, _ as OnAction, $ as OverrideKey, a0 as Overrides, a1 as Permissions, a2 as Plugin, a5 as PuckAction, a6 as PuckComponent, a7 as PuckContext, a8 as PuckMetadata, a9 as RadioField, aa as ResolveDataTrigger, ab as RichText, ac as RichtextField, ad as RootConfig, ae as RootData, af as RootDataWithProps, ag as RootDataWithoutProps, ah as SelectField, ai as Slot, aj as SlotComponent, ak as SlotField, al as TextField, am as TextareaField, an as UiState, ao as UserGenerics, ap as Viewport, aq as Viewports, ar as WithChildren, as as WithDefaultRootFieldProps, at as WithId, au as WithPuckProps, av as WithSlotProps, aw as overrideKeys } from './actions-
|
|
2
|
-
export { D as Dictionary } from './index-
|
|
1
|
+
export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, i as ComponentData, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, m as Config, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, D as Data, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DndBehavior, y as DndConfig, z as DragAxis, F as ExternalField, G as ExternalFieldWithAdaptor, H as ExtractConfigParams, I as ExtractField, J as Field, K as FieldMetadata, L as FieldProps, M as FieldRenderFunctions, N as FieldTransformFn, O as FieldTransformFnParams, P as FieldTransforms, Q as Fields, R as History, S as IframeConfig, T as InitialHistory, V as ItemWithId, W as MappedItem, X as Metadata, Y as NumberField, Z as ObjectField, _ as OnAction, $ as OverrideKey, a0 as Overrides, a1 as Permissions, a2 as Plugin, a5 as PuckAction, a6 as PuckComponent, a7 as PuckContext, a8 as PuckMetadata, a9 as RadioField, aa as ResolveDataTrigger, ab as RichText, ac as RichtextField, ad as RootConfig, ae as RootData, af as RootDataWithProps, ag as RootDataWithoutProps, ah as SelectField, ai as Slot, aj as SlotComponent, ak as SlotField, al as TextField, am as TextareaField, an as UiState, ao as UserGenerics, ap as Viewport, aq as Viewports, ar as WithChildren, as as WithDefaultRootFieldProps, at as WithId, au as WithPuckProps, av as WithSlotProps, aw as overrideKeys } from './actions-CLNN-g7L.js';
|
|
2
|
+
export { D as Dictionary } from './index-B_5ZR3yN.js';
|
|
3
3
|
export { Action, ActionBar, AutoField, BlocksPluginProps, Button, Drawer, DropZone, FieldLabel, Group, IconButton, Label, OutlinePluginProps, Puck, PuckApi, Render, RichTextMenu, Separator, UsePuckData, blocksPlugin, createUsePuck, fieldsPlugin, legacySideBarPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck } from './index.js';
|
|
4
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
4
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DQYPBSSN.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@tiptap/react';
|
|
7
7
|
import '@tiptap/extension-blockquote';
|
package/dist/no-external.js
CHANGED
|
@@ -6622,6 +6622,24 @@ var getDeep = (node, path) => {
|
|
|
6622
6622
|
}, node);
|
|
6623
6623
|
};
|
|
6624
6624
|
|
|
6625
|
+
// lib/fields/is-field-visible.ts
|
|
6626
|
+
init_react_import();
|
|
6627
|
+
|
|
6628
|
+
// lib/overrides/field-types.ts
|
|
6629
|
+
init_react_import();
|
|
6630
|
+
var isFieldTypeHidden = (overrides, fieldType) => {
|
|
6631
|
+
return fieldType ? (overrides == null ? void 0 : overrides[fieldType]) === null : false;
|
|
6632
|
+
};
|
|
6633
|
+
|
|
6634
|
+
// lib/fields/is-field-visible.ts
|
|
6635
|
+
var isFieldVisible = (fieldTypeOverrides, field) => {
|
|
6636
|
+
var _a;
|
|
6637
|
+
if (!field) return false;
|
|
6638
|
+
if (field.type === "slot") return false;
|
|
6639
|
+
if (isFieldTypeHidden(fieldTypeOverrides, field.type)) return false;
|
|
6640
|
+
return (_a = field.visible) != null ? _a : true;
|
|
6641
|
+
};
|
|
6642
|
+
|
|
6625
6643
|
// components/AutoField/subfield.tsx
|
|
6626
6644
|
init_react_import();
|
|
6627
6645
|
var import_react17 = require("react");
|
|
@@ -6755,6 +6773,7 @@ var ArrayFieldItemInternal = ({
|
|
|
6755
6773
|
name,
|
|
6756
6774
|
localName
|
|
6757
6775
|
}) => {
|
|
6776
|
+
const fieldTypeOverrides = useAppStore((s) => s.overrides.fieldTypes);
|
|
6758
6777
|
const isExpanded = useAppStore((s) => {
|
|
6759
6778
|
var _a;
|
|
6760
6779
|
return ((_a = s.state.ui.arrayState[arrayId]) == null ? void 0 : _a.openId) === id;
|
|
@@ -6767,9 +6786,9 @@ var ArrayFieldItemInternal = ({
|
|
|
6767
6786
|
return false;
|
|
6768
6787
|
}
|
|
6769
6788
|
return Object.values(field.arrayFields).some(
|
|
6770
|
-
(subField) =>
|
|
6789
|
+
(subField) => isFieldVisible(fieldTypeOverrides, subField)
|
|
6771
6790
|
);
|
|
6772
|
-
}, [field.arrayFields]);
|
|
6791
|
+
}, [field.arrayFields, fieldTypeOverrides]);
|
|
6773
6792
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Sortable, { id, index: dragIndex, disabled: readOnly, children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
6774
6793
|
"div",
|
|
6775
6794
|
{
|
|
@@ -8206,11 +8225,7 @@ function AutoFieldInternal(props) {
|
|
|
8206
8225
|
return render[field.type];
|
|
8207
8226
|
}
|
|
8208
8227
|
}, [field.type, fieldKey, render]);
|
|
8209
|
-
|
|
8210
|
-
if (!visible) {
|
|
8211
|
-
return null;
|
|
8212
|
-
}
|
|
8213
|
-
if (field.type === "slot") {
|
|
8228
|
+
if (!isFieldVisible(overrides.fieldTypes, field)) {
|
|
8214
8229
|
return null;
|
|
8215
8230
|
}
|
|
8216
8231
|
if (!FieldComponent) {
|
|
@@ -12464,6 +12479,7 @@ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null
|
|
|
12464
12479
|
});
|
|
12465
12480
|
});
|
|
12466
12481
|
var FieldsChildInner = ({ fieldName }) => {
|
|
12482
|
+
const fieldTypeOverrides = useAppStore((s) => s.overrides.fieldTypes);
|
|
12467
12483
|
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
12468
12484
|
const isReadOnly = useAppStore(
|
|
12469
12485
|
(s) => ((s.selectedItem ? s.selectedItem.readOnly : s.state.data.root.readOnly) || {})[fieldName]
|
|
@@ -12482,7 +12498,6 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
12482
12498
|
const onChange = (0, import_react77.useCallback)(createOnChange(fieldName, appStore), [
|
|
12483
12499
|
fieldName
|
|
12484
12500
|
]);
|
|
12485
|
-
const { visible = true } = field != null ? field : {};
|
|
12486
12501
|
const fieldStore = (0, import_react77.useContext)(fieldContextStore.ctx);
|
|
12487
12502
|
(0, import_react77.useEffect)(() => {
|
|
12488
12503
|
return appStore.subscribe(
|
|
@@ -12496,8 +12511,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
12496
12511
|
}
|
|
12497
12512
|
);
|
|
12498
12513
|
}, [appStore, fieldStore]);
|
|
12499
|
-
if (!
|
|
12500
|
-
if (field.type === "slot") return null;
|
|
12514
|
+
if (!id || !isFieldVisible(fieldTypeOverrides, field)) return null;
|
|
12501
12515
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: getClassName28("field"), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
12502
12516
|
AutoFieldPrivate,
|
|
12503
12517
|
{
|
|
@@ -17794,11 +17808,25 @@ var import_react95 = require("react");
|
|
|
17794
17808
|
|
|
17795
17809
|
// lib/load-overrides.ts
|
|
17796
17810
|
init_react_import();
|
|
17811
|
+
var curryPluginOverrides = (override, previousPluginOverride) => {
|
|
17812
|
+
const Comp = (props) => {
|
|
17813
|
+
const children = previousPluginOverride ? previousPluginOverride(props) : props.children;
|
|
17814
|
+
if (override) {
|
|
17815
|
+
return override(__spreadProps(__spreadValues({}, props), {
|
|
17816
|
+
children
|
|
17817
|
+
}));
|
|
17818
|
+
}
|
|
17819
|
+
return children;
|
|
17820
|
+
};
|
|
17821
|
+
return Comp;
|
|
17822
|
+
};
|
|
17797
17823
|
var loadOverrides = ({
|
|
17798
17824
|
overrides,
|
|
17799
17825
|
plugins
|
|
17800
17826
|
}) => {
|
|
17801
17827
|
const collected = __spreadValues({}, overrides);
|
|
17828
|
+
if (overrides == null ? void 0 : overrides.fieldTypes) collected.fieldTypes = __spreadValues({}, overrides.fieldTypes);
|
|
17829
|
+
const prevFieldTypesOverride = __spreadValues({}, overrides == null ? void 0 : overrides.fieldTypes);
|
|
17802
17830
|
plugins == null ? void 0 : plugins.forEach((plugin) => {
|
|
17803
17831
|
if (!plugin.overrides) return;
|
|
17804
17832
|
Object.keys(plugin.overrides).forEach((_overridesType) => {
|
|
@@ -17806,21 +17834,29 @@ var loadOverrides = ({
|
|
|
17806
17834
|
const overridesType = _overridesType;
|
|
17807
17835
|
if (!((_a = plugin.overrides) == null ? void 0 : _a[overridesType])) return;
|
|
17808
17836
|
if (overridesType === "fieldTypes") {
|
|
17809
|
-
const
|
|
17810
|
-
Object.keys(
|
|
17837
|
+
const currPluginFieldTypes = plugin.overrides.fieldTypes;
|
|
17838
|
+
Object.keys(currPluginFieldTypes).forEach((fieldType) => {
|
|
17811
17839
|
collected.fieldTypes = collected.fieldTypes || {};
|
|
17812
|
-
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
}
|
|
17840
|
+
if (isFieldTypeHidden(currPluginFieldTypes, fieldType)) {
|
|
17841
|
+
collected.fieldTypes[fieldType] = null;
|
|
17842
|
+
return;
|
|
17843
|
+
}
|
|
17844
|
+
const prevNonNullPluginFieldType = prevFieldTypesOverride[fieldType];
|
|
17845
|
+
const currPluginFieldType = currPluginFieldTypes[fieldType];
|
|
17846
|
+
const Comp2 = curryPluginOverrides(
|
|
17847
|
+
currPluginFieldType,
|
|
17848
|
+
prevNonNullPluginFieldType
|
|
17849
|
+
);
|
|
17816
17850
|
collected.fieldTypes[fieldType] = Comp2;
|
|
17851
|
+
prevFieldTypesOverride[fieldType] = Comp2;
|
|
17817
17852
|
});
|
|
17818
17853
|
return;
|
|
17819
17854
|
}
|
|
17820
17855
|
const childNode = collected[overridesType];
|
|
17821
|
-
const Comp = (
|
|
17822
|
-
|
|
17823
|
-
|
|
17856
|
+
const Comp = curryPluginOverrides(
|
|
17857
|
+
plugin.overrides[overridesType],
|
|
17858
|
+
childNode
|
|
17859
|
+
);
|
|
17824
17860
|
collected[overridesType] = Comp;
|
|
17825
17861
|
});
|
|
17826
17862
|
});
|
package/dist/no-external.mjs
CHANGED
package/dist/rsc.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { m as Config, ao as UserGenerics, X as Metadata } from './actions-
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
2
|
+
import { m as Config, ao as UserGenerics, X as Metadata } from './actions-CLNN-g7L.mjs';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CLq7jUXe.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@tiptap/react';
|
|
6
6
|
import '@tiptap/extension-blockquote';
|
package/dist/rsc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { m as Config, ao as UserGenerics, X as Metadata } from './actions-
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
2
|
+
import { m as Config, ao as UserGenerics, X as Metadata } from './actions-CLNN-g7L.js';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DQYPBSSN.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@tiptap/react';
|
|
6
6
|
import '@tiptap/extension-blockquote';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as Config, D as Data, at as WithId, ao as UserGenerics, o as Content, i as ComponentData, s as DefaultComponents, r as DefaultComponentProps, t as DefaultRootFieldProps, X as Metadata, ae as RootData } from './actions-
|
|
1
|
+
import { m as Config, D as Data, at as WithId, ao as UserGenerics, o as Content, i as ComponentData, s as DefaultComponents, r as DefaultComponentProps, t as DefaultRootFieldProps, X as Metadata, ae as RootData } from './actions-CLNN-g7L.mjs';
|
|
2
2
|
|
|
3
3
|
type MigrationOptions<UserConfig extends Config> = {
|
|
4
4
|
migrateDynamicZonesForComponent?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as Config, D as Data, at as WithId, ao as UserGenerics, o as Content, i as ComponentData, s as DefaultComponents, r as DefaultComponentProps, t as DefaultRootFieldProps, X as Metadata, ae as RootData } from './actions-
|
|
1
|
+
import { m as Config, D as Data, at as WithId, ao as UserGenerics, o as Content, i as ComponentData, s as DefaultComponents, r as DefaultComponentProps, t as DefaultRootFieldProps, X as Metadata, ae as RootData } from './actions-CLNN-g7L.js';
|
|
2
2
|
|
|
3
3
|
type MigrationOptions<UserConfig extends Config> = {
|
|
4
4
|
migrateDynamicZonesForComponent?: {
|