@netlisian/softconfig 0.1.10 → 0.2.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/dist/puck/index.d.mts +3 -3
- package/dist/puck/index.d.ts +3 -3
- package/dist/puck/index.js +154 -91
- package/dist/puck/index.mjs +118 -55
- package/package.json +3 -3
package/dist/puck/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Field, Fields, Config, DefaultComponentProps, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, OnAction, Data, Overrides as Overrides$1 } from '@
|
|
1
|
+
import * as _puckeditor_core from '@puckeditor/core';
|
|
2
|
+
import { Field, Fields, Config, DefaultComponentProps, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, OnAction, Data, Overrides as Overrides$1 } from '@puckeditor/core';
|
|
3
3
|
import * as zustand from 'zustand';
|
|
4
4
|
import { StoreApi } from 'zustand';
|
|
5
5
|
import * as React$1 from 'react';
|
|
@@ -662,7 +662,7 @@ declare const useRemodel: () => {
|
|
|
662
662
|
id: string;
|
|
663
663
|
version: string;
|
|
664
664
|
softComponent: {
|
|
665
|
-
fields:
|
|
665
|
+
fields: _puckeditor_core.Fields;
|
|
666
666
|
fieldSettings?: SoftFieldSettings;
|
|
667
667
|
defaultProps: DefaultComponentProps;
|
|
668
668
|
rootProps?: Record<string, unknown>;
|
package/dist/puck/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Field, Fields, Config, DefaultComponentProps, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, OnAction, Data, Overrides as Overrides$1 } from '@
|
|
1
|
+
import * as _puckeditor_core from '@puckeditor/core';
|
|
2
|
+
import { Field, Fields, Config, DefaultComponentProps, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, OnAction, Data, Overrides as Overrides$1 } from '@puckeditor/core';
|
|
3
3
|
import * as zustand from 'zustand';
|
|
4
4
|
import { StoreApi } from 'zustand';
|
|
5
5
|
import * as React$1 from 'react';
|
|
@@ -662,7 +662,7 @@ declare const useRemodel: () => {
|
|
|
662
662
|
id: string;
|
|
663
663
|
version: string;
|
|
664
664
|
softComponent: {
|
|
665
|
-
fields:
|
|
665
|
+
fields: _puckeditor_core.Fields;
|
|
666
666
|
fieldSettings?: SoftFieldSettings;
|
|
667
667
|
defaultProps: DefaultComponentProps;
|
|
668
668
|
rootProps?: Record<string, unknown>;
|
package/dist/puck/index.js
CHANGED
|
@@ -581,7 +581,7 @@ var rootActionHandler = (set, get) => (action, appState, previousState) => {
|
|
|
581
581
|
};
|
|
582
582
|
|
|
583
583
|
// src/puck/store/slices/builder.tsx
|
|
584
|
-
var
|
|
584
|
+
var import_core2 = require("@puckeditor/core");
|
|
585
585
|
|
|
586
586
|
// src/puck/lib/soft-component-constants.ts
|
|
587
587
|
var TECHNICAL_KEYS = /* @__PURE__ */ new Set(["_map", "_slot", "id", "_version"]);
|
|
@@ -1569,9 +1569,9 @@ function isSoftComponent(componentType, softComponents) {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
1571
|
// src/puck/lib/demolish-soft-component.ts
|
|
1572
|
-
var
|
|
1572
|
+
var import_core = require("@puckeditor/core");
|
|
1573
1573
|
function demolishSoftComponent(componentName, data, config, softComponents) {
|
|
1574
|
-
const resolvedData = (0,
|
|
1574
|
+
const resolvedData = (0, import_core.walkTree)(data, config, (components) => {
|
|
1575
1575
|
components.forEach((componentData, index) => {
|
|
1576
1576
|
if (componentData.type === componentName) {
|
|
1577
1577
|
const decomposed = decomposeSoftComponent(componentData, softComponents);
|
|
@@ -1666,7 +1666,7 @@ var createBuildersSlice = (set, get) => ({
|
|
|
1666
1666
|
const config = get().softConfig;
|
|
1667
1667
|
const editableIds = /* @__PURE__ */ new Set([selectedItem.props.id]);
|
|
1668
1668
|
const initialContent = [__spreadValues({}, selectedItem)];
|
|
1669
|
-
(0,
|
|
1669
|
+
(0, import_core2.walkTree)(
|
|
1670
1670
|
{
|
|
1671
1671
|
root: {},
|
|
1672
1672
|
content: initialContent
|
|
@@ -1748,7 +1748,7 @@ var createBuildersSlice = (set, get) => ({
|
|
|
1748
1748
|
const dependents = get().dependencyGraph.get(softComponentName) || /* @__PURE__ */ new Set();
|
|
1749
1749
|
const decomposedComponents = get().builder.decompose(selectedItem, true);
|
|
1750
1750
|
const editableIds = /* @__PURE__ */ new Set([decomposedComponents[0].props.id]);
|
|
1751
|
-
const { content: decomposedComponentsWithId } = (0,
|
|
1751
|
+
const { content: decomposedComponentsWithId } = (0, import_core2.walkTree)(
|
|
1752
1752
|
{ root: {}, content: decomposedComponents },
|
|
1753
1753
|
{ components: config.components },
|
|
1754
1754
|
(components) => {
|
|
@@ -1798,7 +1798,10 @@ var createBuildersSlice = (set, get) => ({
|
|
|
1798
1798
|
const readOnly = [
|
|
1799
1799
|
...readOnlyFields.map((f) => String(f)),
|
|
1800
1800
|
...readOnlyArrayBases
|
|
1801
|
-
].reduce(
|
|
1801
|
+
].reduce(
|
|
1802
|
+
(acc, field) => __spreadProps(__spreadValues({}, acc), { [field]: true }),
|
|
1803
|
+
{}
|
|
1804
|
+
);
|
|
1802
1805
|
puckDispatch({
|
|
1803
1806
|
type: "replace",
|
|
1804
1807
|
destinationIndex: itemSelector.index,
|
|
@@ -2189,7 +2192,7 @@ var createBuildersSlice = (set, get) => ({
|
|
|
2189
2192
|
zone: itemSelector.zone
|
|
2190
2193
|
});
|
|
2191
2194
|
if (finalItem) {
|
|
2192
|
-
(0,
|
|
2195
|
+
(0, import_core2.walkTree)(
|
|
2193
2196
|
{ root: {}, content: [finalItem] },
|
|
2194
2197
|
{ components: get().softConfig.components },
|
|
2195
2198
|
(components) => {
|
|
@@ -2834,7 +2837,7 @@ var SoftConfigProvider = ({
|
|
|
2834
2837
|
};
|
|
2835
2838
|
|
|
2836
2839
|
// src/puck/actions/useBuild.tsx
|
|
2837
|
-
var
|
|
2840
|
+
var import_core3 = require("@puckeditor/core");
|
|
2838
2841
|
|
|
2839
2842
|
// src/puck/lib/notify.ts
|
|
2840
2843
|
var customHandler = null;
|
|
@@ -2879,7 +2882,7 @@ var useActionEvent = () => {
|
|
|
2879
2882
|
};
|
|
2880
2883
|
|
|
2881
2884
|
// src/puck/actions/useBuild.tsx
|
|
2882
|
-
var useCustomPuck = (0,
|
|
2885
|
+
var useCustomPuck = (0, import_core3.createUsePuck)();
|
|
2883
2886
|
var useBuild = (name) => {
|
|
2884
2887
|
const build = useSoftConfig((s) => s.builder.build);
|
|
2885
2888
|
const history = useCustomPuck((s) => s.history.histories);
|
|
@@ -2914,8 +2917,8 @@ var useBuild = (name) => {
|
|
|
2914
2917
|
};
|
|
2915
2918
|
|
|
2916
2919
|
// src/puck/actions/useRemodel.tsx
|
|
2917
|
-
var
|
|
2918
|
-
var useCustomPuck2 = (0,
|
|
2920
|
+
var import_core4 = require("@puckeditor/core");
|
|
2921
|
+
var useCustomPuck2 = (0, import_core4.createUsePuck)();
|
|
2919
2922
|
var useRemodel = () => {
|
|
2920
2923
|
const remodel = useSoftConfig((s) => s.builder.remodel);
|
|
2921
2924
|
const history = useCustomPuck2((s) => s.history.histories);
|
|
@@ -2979,9 +2982,9 @@ var useRemodel = () => {
|
|
|
2979
2982
|
};
|
|
2980
2983
|
|
|
2981
2984
|
// src/puck/actions/useComplete.tsx
|
|
2982
|
-
var
|
|
2985
|
+
var import_core5 = require("@puckeditor/core");
|
|
2983
2986
|
var import_react6 = require("react");
|
|
2984
|
-
var useCustomPuck3 = (0,
|
|
2987
|
+
var useCustomPuck3 = (0, import_core5.createUsePuck)();
|
|
2985
2988
|
var useComplete = () => {
|
|
2986
2989
|
const complete = useSoftConfig((s) => s.builder.complete);
|
|
2987
2990
|
const appState = useCustomPuck3((s) => s.appState);
|
|
@@ -2996,7 +2999,11 @@ var useComplete = () => {
|
|
|
2996
2999
|
return null;
|
|
2997
3000
|
}
|
|
2998
3001
|
try {
|
|
2999
|
-
const completedComponent = complete(
|
|
3002
|
+
const completedComponent = complete(
|
|
3003
|
+
appState,
|
|
3004
|
+
setHistories,
|
|
3005
|
+
getItemBySelector
|
|
3006
|
+
);
|
|
3000
3007
|
setNewComponent(completedComponent);
|
|
3001
3008
|
const componentData = appState.data.root;
|
|
3002
3009
|
if (componentData) {
|
|
@@ -3018,14 +3025,21 @@ var useComplete = () => {
|
|
|
3018
3025
|
);
|
|
3019
3026
|
return null;
|
|
3020
3027
|
}
|
|
3021
|
-
}, [
|
|
3028
|
+
}, [
|
|
3029
|
+
complete,
|
|
3030
|
+
appState,
|
|
3031
|
+
setHistories,
|
|
3032
|
+
status,
|
|
3033
|
+
triggerAction,
|
|
3034
|
+
getItemBySelector
|
|
3035
|
+
]);
|
|
3022
3036
|
const canComplete = status === "building" || status === "remodeling";
|
|
3023
3037
|
return { handleComplete, canComplete, newComponent, setNewComponent };
|
|
3024
3038
|
};
|
|
3025
3039
|
|
|
3026
3040
|
// src/puck/actions/useCancel.tsx
|
|
3027
|
-
var
|
|
3028
|
-
var useCustomPuck4 = (0,
|
|
3041
|
+
var import_core6 = require("@puckeditor/core");
|
|
3042
|
+
var useCustomPuck4 = (0, import_core6.createUsePuck)();
|
|
3029
3043
|
var useCancel = () => {
|
|
3030
3044
|
const cancel = useSoftConfig((s) => s.builder.cancel);
|
|
3031
3045
|
const setHistories = useCustomPuck4((s) => s.history.setHistories);
|
|
@@ -3056,9 +3070,9 @@ var useCancel = () => {
|
|
|
3056
3070
|
};
|
|
3057
3071
|
|
|
3058
3072
|
// src/puck/actions/useInspect.tsx
|
|
3059
|
-
var
|
|
3073
|
+
var import_core7 = require("@puckeditor/core");
|
|
3060
3074
|
var import_react7 = require("react");
|
|
3061
|
-
var useCustomPuck5 = (0,
|
|
3075
|
+
var useCustomPuck5 = (0, import_core7.createUsePuck)();
|
|
3062
3076
|
var useInspect = (component) => {
|
|
3063
3077
|
const inspect = useSoftConfig((s) => s.builder.inspect);
|
|
3064
3078
|
const dispatch = useCustomPuck5((s) => s.dispatch);
|
|
@@ -3090,7 +3104,7 @@ var useInspect = (component) => {
|
|
|
3090
3104
|
};
|
|
3091
3105
|
|
|
3092
3106
|
// src/puck/actions/useDecompose.tsx
|
|
3093
|
-
var
|
|
3107
|
+
var import_core8 = require("@puckeditor/core");
|
|
3094
3108
|
|
|
3095
3109
|
// src/puck/lib/get-prop-by-path.ts
|
|
3096
3110
|
function getPropertyByPath(props, path) {
|
|
@@ -3098,7 +3112,7 @@ function getPropertyByPath(props, path) {
|
|
|
3098
3112
|
}
|
|
3099
3113
|
|
|
3100
3114
|
// src/puck/actions/useDecompose.tsx
|
|
3101
|
-
var useCustomPuck6 = (0,
|
|
3115
|
+
var useCustomPuck6 = (0, import_core8.createUsePuck)();
|
|
3102
3116
|
var useDecompose = () => {
|
|
3103
3117
|
const decompose = useSoftConfig((s) => s.builder.decompose);
|
|
3104
3118
|
const appState = useCustomPuck6((s) => s.appState);
|
|
@@ -3134,11 +3148,13 @@ var useDecompose = () => {
|
|
|
3134
3148
|
const targetAreas = contentAreaNames && contentAreaNames.length > 0 ? contentAreaNames : ["content"];
|
|
3135
3149
|
targetAreas.forEach((path) => {
|
|
3136
3150
|
const contentArray = getPropertyByPath(newData, path) || [];
|
|
3137
|
-
const walkedData = (0,
|
|
3151
|
+
const walkedData = (0, import_core8.walkTree)(
|
|
3138
3152
|
{ content: contentArray, root: newData.root || {} },
|
|
3139
3153
|
config,
|
|
3140
3154
|
(components) => {
|
|
3141
|
-
const index = components.findIndex(
|
|
3155
|
+
const index = components.findIndex(
|
|
3156
|
+
(c) => c.props.id === target.props.id
|
|
3157
|
+
);
|
|
3142
3158
|
if (index !== -1) {
|
|
3143
3159
|
components.splice(index, 1, ...decomposedComponents);
|
|
3144
3160
|
}
|
|
@@ -3172,8 +3188,8 @@ var useDecompose = () => {
|
|
|
3172
3188
|
};
|
|
3173
3189
|
|
|
3174
3190
|
// src/puck/actions/useDemolish.tsx
|
|
3175
|
-
var
|
|
3176
|
-
var useCustomPuck7 = (0,
|
|
3191
|
+
var import_core9 = require("@puckeditor/core");
|
|
3192
|
+
var useCustomPuck7 = (0, import_core9.createUsePuck)();
|
|
3177
3193
|
var useDemolish = () => {
|
|
3178
3194
|
const demolish = useSoftConfig((s) => s.builder.demolish);
|
|
3179
3195
|
const dispatch = useCustomPuck7((s) => s.dispatch);
|
|
@@ -3260,14 +3276,14 @@ var useSetDefaultVersion = () => {
|
|
|
3260
3276
|
};
|
|
3261
3277
|
|
|
3262
3278
|
// src/puck/overrides/Header.tsx
|
|
3263
|
-
var
|
|
3279
|
+
var import_core11 = require("@puckeditor/core");
|
|
3264
3280
|
|
|
3265
3281
|
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/Header.module.css#css-module
|
|
3266
3282
|
var Header_module_default = { "Header": "_Header_19oj9_1" };
|
|
3267
3283
|
|
|
3268
3284
|
// src/puck/actions/usePublish.tsx
|
|
3269
|
-
var
|
|
3270
|
-
var useCustomPuck8 = (0,
|
|
3285
|
+
var import_core10 = require("@puckeditor/core");
|
|
3286
|
+
var useCustomPuck8 = (0, import_core10.createUsePuck)();
|
|
3271
3287
|
var usePublish = () => {
|
|
3272
3288
|
const components = useSoftConfig((s) => s.softComponents);
|
|
3273
3289
|
const data = useCustomPuck8((s) => s.appState.data);
|
|
@@ -3312,9 +3328,9 @@ var Header = ({
|
|
|
3312
3328
|
const { handlePublish } = usePublish();
|
|
3313
3329
|
useInspect(newComponent);
|
|
3314
3330
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName2(), children: canCancel ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
3315
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core11.Button, { onClick: handleCancel, children: "Cancel" }),
|
|
3316
3332
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3317
|
-
|
|
3333
|
+
import_core11.Button,
|
|
3318
3334
|
{
|
|
3319
3335
|
variant: "primary",
|
|
3320
3336
|
onClick: () => {
|
|
@@ -3327,7 +3343,7 @@ var Header = ({
|
|
|
3327
3343
|
}
|
|
3328
3344
|
)
|
|
3329
3345
|
] }) : children ? children : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3330
|
-
|
|
3346
|
+
import_core11.Button,
|
|
3331
3347
|
{
|
|
3332
3348
|
variant: "primary",
|
|
3333
3349
|
onClick: () => {
|
|
@@ -3342,7 +3358,7 @@ var Header = ({
|
|
|
3342
3358
|
|
|
3343
3359
|
// src/puck/overrides/ActionBar.tsx
|
|
3344
3360
|
var import_react8 = require("react");
|
|
3345
|
-
var
|
|
3361
|
+
var import_core12 = require("@puckeditor/core");
|
|
3346
3362
|
var import_lucide_react = require("lucide-react");
|
|
3347
3363
|
|
|
3348
3364
|
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/ActionBar.module.css#css-module
|
|
@@ -3351,11 +3367,13 @@ var ActionBar_module_default = { "ActionBar": "_ActionBar_pvuie_5", "ActionBar-l
|
|
|
3351
3367
|
// src/puck/overrides/ActionBar.tsx
|
|
3352
3368
|
var import_shallow = require("zustand/shallow");
|
|
3353
3369
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3354
|
-
var useCustomPuck9 = (0,
|
|
3370
|
+
var useCustomPuck9 = (0, import_core12.createUsePuck)();
|
|
3355
3371
|
var getClassName3 = get_class_name_factory_default("ActionBar", ActionBar_module_default);
|
|
3356
3372
|
var ActionBarOverride = (props) => {
|
|
3357
3373
|
var _a, _b;
|
|
3358
|
-
const { handleBuild } = useBuild(
|
|
3374
|
+
const { handleBuild } = useBuild(
|
|
3375
|
+
props.label ? props.label + " Soft Component" : "New Soft Component"
|
|
3376
|
+
);
|
|
3359
3377
|
const { handleRemodel } = useRemodel();
|
|
3360
3378
|
const { handleDecompose } = useDecompose();
|
|
3361
3379
|
const overrides = useSoftConfig((s) => s.overrides);
|
|
@@ -3376,18 +3394,13 @@ var ActionBarOverride = (props) => {
|
|
|
3376
3394
|
existingKeys: softKeys,
|
|
3377
3395
|
state: status
|
|
3378
3396
|
}));
|
|
3379
|
-
}, [
|
|
3380
|
-
props.label,
|
|
3381
|
-
overrides,
|
|
3382
|
-
selectedItem == null ? void 0 : selectedItem.type,
|
|
3383
|
-
softKeys,
|
|
3384
|
-
status,
|
|
3385
|
-
rootProps
|
|
3386
|
-
]);
|
|
3397
|
+
}, [props.label, overrides, selectedItem == null ? void 0 : selectedItem.type, softKeys, status, rootProps]);
|
|
3387
3398
|
const isSoftComponent2 = softKeys.includes(key);
|
|
3388
3399
|
const selectedId = (_a = selectedItem == null ? void 0 : selectedItem.props) == null ? void 0 : _a.id;
|
|
3389
3400
|
const parentId = (_b = itemSelector == null ? void 0 : itemSelector.zone) == null ? void 0 : _b.split(":")[0];
|
|
3390
|
-
const isEditable = Boolean(
|
|
3401
|
+
const isEditable = Boolean(
|
|
3402
|
+
selectedId && (editableIds.has(selectedId) || parentId && editableIds.has(parentId))
|
|
3403
|
+
);
|
|
3391
3404
|
const label = (0, import_react8.useMemo)(() => {
|
|
3392
3405
|
var _a2;
|
|
3393
3406
|
if (isSoftComponent2) {
|
|
@@ -3395,15 +3408,15 @@ var ActionBarOverride = (props) => {
|
|
|
3395
3408
|
}
|
|
3396
3409
|
return props.label || "";
|
|
3397
3410
|
}, [isSoftComponent2, key, props.label, overrides, softComponents]);
|
|
3398
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName3(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3399
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName3(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core12.ActionBar, { children: [
|
|
3412
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core12.ActionBar.Group, { children: [
|
|
3400
3413
|
props.parentAction,
|
|
3401
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3414
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.ActionBar.Label, { label })
|
|
3402
3415
|
] }),
|
|
3403
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core12.ActionBar.Group, { children: [
|
|
3404
3417
|
status === "ready" ? isSoftComponent2 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
3405
3418
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3406
|
-
|
|
3419
|
+
import_core12.ActionBar.Action,
|
|
3407
3420
|
{
|
|
3408
3421
|
onClick: () => handleRemodel(key),
|
|
3409
3422
|
label: "Remodel Soft Component",
|
|
@@ -3411,7 +3424,7 @@ var ActionBarOverride = (props) => {
|
|
|
3411
3424
|
}
|
|
3412
3425
|
),
|
|
3413
3426
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3414
|
-
|
|
3427
|
+
import_core12.ActionBar.Action,
|
|
3415
3428
|
{
|
|
3416
3429
|
onClick: () => handleDecompose(),
|
|
3417
3430
|
label: "Decompose Soft Component",
|
|
@@ -3419,7 +3432,7 @@ var ActionBarOverride = (props) => {
|
|
|
3419
3432
|
}
|
|
3420
3433
|
)
|
|
3421
3434
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3422
|
-
|
|
3435
|
+
import_core12.ActionBar.Action,
|
|
3423
3436
|
{
|
|
3424
3437
|
onClick: handleBuild,
|
|
3425
3438
|
label: "Build Soft Component",
|
|
@@ -3433,7 +3446,7 @@ var ActionBarOverride = (props) => {
|
|
|
3433
3446
|
|
|
3434
3447
|
// src/puck/overrides/DrawerItem.tsx
|
|
3435
3448
|
var import_react10 = require("react");
|
|
3436
|
-
var
|
|
3449
|
+
var import_core13 = require("@puckeditor/core");
|
|
3437
3450
|
var import_lucide_react2 = require("lucide-react");
|
|
3438
3451
|
|
|
3439
3452
|
// src/puck/lib/confirm.ts
|
|
@@ -3519,7 +3532,7 @@ var Modal = ({
|
|
|
3519
3532
|
// src/puck/overrides/DrawerItem.tsx
|
|
3520
3533
|
var import_shallow2 = require("zustand/shallow");
|
|
3521
3534
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3522
|
-
var useCustomPuck10 = (0,
|
|
3535
|
+
var useCustomPuck10 = (0, import_core13.createUsePuck)();
|
|
3523
3536
|
var getClassName5 = get_class_name_factory_default("DrawerItem", DrawerItem_module_default);
|
|
3524
3537
|
var DrawerItem = (props) => {
|
|
3525
3538
|
const componentMeta = useSoftConfig((s) => s.softComponents[props.name]);
|
|
@@ -3629,7 +3642,7 @@ var DrawerItem = (props) => {
|
|
|
3629
3642
|
] }),
|
|
3630
3643
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName5("actions"), children: [
|
|
3631
3644
|
isHovering && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5("settingsButton"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3632
|
-
|
|
3645
|
+
import_core13.IconButton,
|
|
3633
3646
|
{
|
|
3634
3647
|
title: "Settings",
|
|
3635
3648
|
onClick: (e) => {
|
|
@@ -3657,8 +3670,10 @@ var DrawerItem = (props) => {
|
|
|
3657
3670
|
const isDefault = version === (selectedVersion || defaultVersion);
|
|
3658
3671
|
const isMarkedForDeletion = versionsToDelete.has(version);
|
|
3659
3672
|
let rowClass = getClassName5("versionRow");
|
|
3660
|
-
if (isDefault)
|
|
3661
|
-
|
|
3673
|
+
if (isDefault)
|
|
3674
|
+
rowClass += " " + getClassName5("versionRow--isDefault");
|
|
3675
|
+
if (isMarkedForDeletion)
|
|
3676
|
+
rowClass += " " + getClassName5("versionRow--isMarkedForDeletion");
|
|
3662
3677
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: rowClass, children: [
|
|
3663
3678
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName5("versionInfo"), children: [
|
|
3664
3679
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: getClassName5("versionNumber"), children: [
|
|
@@ -3669,14 +3684,28 @@ var DrawerItem = (props) => {
|
|
|
3669
3684
|
isMarkedForDeletion && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: getClassName5("deleteBadge"), children: "Marked for deletion" })
|
|
3670
3685
|
] }),
|
|
3671
3686
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName5("versionActions"), children: [
|
|
3672
|
-
!isDefault && !isMarkedForDeletion && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3687
|
+
!isDefault && !isMarkedForDeletion && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3688
|
+
import_core13.Button,
|
|
3689
|
+
{
|
|
3690
|
+
variant: "secondary",
|
|
3691
|
+
onClick: () => setSelectedVersion(version),
|
|
3692
|
+
children: "Set as Default"
|
|
3693
|
+
}
|
|
3694
|
+
),
|
|
3695
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3696
|
+
import_core13.Button,
|
|
3697
|
+
{
|
|
3698
|
+
variant: "secondary",
|
|
3699
|
+
onClick: () => toggleVersionForDeletion(version),
|
|
3700
|
+
children: isMarkedForDeletion ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3701
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { size: 14 }),
|
|
3702
|
+
" Undo"
|
|
3703
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3704
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Trash2, { size: 14 }),
|
|
3705
|
+
" Delete"
|
|
3706
|
+
] })
|
|
3707
|
+
}
|
|
3708
|
+
)
|
|
3680
3709
|
] })
|
|
3681
3710
|
] }, version);
|
|
3682
3711
|
}) })
|
|
@@ -3698,10 +3727,20 @@ var DrawerItem = (props) => {
|
|
|
3698
3727
|
type: "button",
|
|
3699
3728
|
role: "radio",
|
|
3700
3729
|
"aria-checked": isSelected,
|
|
3701
|
-
className: `${getClassName5("migrationOption")} ${isSelected ? getClassName5(
|
|
3730
|
+
className: `${getClassName5("migrationOption")} ${isSelected ? getClassName5(
|
|
3731
|
+
"migrationOption--isSelected"
|
|
3732
|
+
) : ""}`,
|
|
3702
3733
|
onClick: () => setMigrationTarget(target.value),
|
|
3703
3734
|
children: [
|
|
3704
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3735
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3736
|
+
"span",
|
|
3737
|
+
{
|
|
3738
|
+
className: getClassName5(
|
|
3739
|
+
"migrationOptionLabel"
|
|
3740
|
+
),
|
|
3741
|
+
children: target.label
|
|
3742
|
+
}
|
|
3743
|
+
),
|
|
3705
3744
|
isSelected && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Check, { size: 14 })
|
|
3706
3745
|
]
|
|
3707
3746
|
},
|
|
@@ -3713,25 +3752,42 @@ var DrawerItem = (props) => {
|
|
|
3713
3752
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: getClassName5("helpText"), children: "Choose where to move existing instances of the deleted versions." })
|
|
3714
3753
|
] })
|
|
3715
3754
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5("section"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { children: [
|
|
3716
|
-
"Manage high-level settings for the
|
|
3755
|
+
"Manage high-level settings for the",
|
|
3756
|
+
" ",
|
|
3717
3757
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: displayName }),
|
|
3718
3758
|
" component."
|
|
3719
3759
|
] }) }) }),
|
|
3720
3760
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName5("modalFooter"), children: [
|
|
3721
3761
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName5("footerLeft"), children: [
|
|
3722
|
-
useVersioning ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3762
|
+
useVersioning ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core13.Button, { size: "medium", onClick: handleApply, children: [
|
|
3723
3763
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Check, { size: 16 }),
|
|
3724
3764
|
" Apply Changes"
|
|
3725
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3726
|
-
useVersioning && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3765
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core13.Button, { size: "medium", onClick: handleCancel, children: "Close" }),
|
|
3766
|
+
useVersioning && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3767
|
+
import_core13.Button,
|
|
3768
|
+
{
|
|
3769
|
+
size: "medium",
|
|
3770
|
+
variant: "secondary",
|
|
3771
|
+
onClick: handleCancel,
|
|
3772
|
+
children: [
|
|
3773
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { size: 16 }),
|
|
3774
|
+
" Cancel"
|
|
3775
|
+
]
|
|
3776
|
+
}
|
|
3777
|
+
)
|
|
3730
3778
|
] }),
|
|
3731
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5("footerRight"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5("footerRight"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3780
|
+
import_core13.Button,
|
|
3781
|
+
{
|
|
3782
|
+
size: "medium",
|
|
3783
|
+
variant: "secondary",
|
|
3784
|
+
onClick: handleDemolishClick,
|
|
3785
|
+
children: [
|
|
3786
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Trash2, { size: 16 }),
|
|
3787
|
+
" Demolish Component"
|
|
3788
|
+
]
|
|
3789
|
+
}
|
|
3790
|
+
) })
|
|
3735
3791
|
] })
|
|
3736
3792
|
] }) })
|
|
3737
3793
|
] });
|
|
@@ -3741,7 +3797,7 @@ var DrawerItem = (props) => {
|
|
|
3741
3797
|
|
|
3742
3798
|
// src/puck/overrides/Drawer.tsx
|
|
3743
3799
|
var import_react11 = require("react");
|
|
3744
|
-
var
|
|
3800
|
+
var import_core14 = require("@puckeditor/core");
|
|
3745
3801
|
var import_lucide_react3 = require("lucide-react");
|
|
3746
3802
|
|
|
3747
3803
|
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/Drawer.module.css#css-module
|
|
@@ -3749,7 +3805,7 @@ var Drawer_module_default = { "Drawer": "_Drawer_12zq5_1", "Drawer-category": "_
|
|
|
3749
3805
|
|
|
3750
3806
|
// src/puck/overrides/Drawer.tsx
|
|
3751
3807
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3752
|
-
var useCustomPuck11 = (0,
|
|
3808
|
+
var useCustomPuck11 = (0, import_core14.createUsePuck)();
|
|
3753
3809
|
var getClassName6 = get_class_name_factory_default("Drawer", Drawer_module_default);
|
|
3754
3810
|
var getCategoryClassName = get_class_name_factory_default("Drawer-category", Drawer_module_default);
|
|
3755
3811
|
var CategorySection = ({
|
|
@@ -3773,8 +3829,8 @@ var CategorySection = ({
|
|
|
3773
3829
|
]
|
|
3774
3830
|
}
|
|
3775
3831
|
),
|
|
3776
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName6("categoryContent"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3777
|
-
|
|
3832
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName6("categoryContent"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core14.Drawer, { children: componentKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3833
|
+
import_core14.Drawer.Item,
|
|
3778
3834
|
{
|
|
3779
3835
|
name: key,
|
|
3780
3836
|
isDragDisabled: !getPermissions({ type: key }).insert,
|
|
@@ -3795,10 +3851,13 @@ var Drawer = (_props) => {
|
|
|
3795
3851
|
})
|
|
3796
3852
|
);
|
|
3797
3853
|
const allKeys = Object.keys(config.components);
|
|
3798
|
-
const labels = Object.entries(config.components).reduce(
|
|
3799
|
-
acc[key
|
|
3800
|
-
|
|
3801
|
-
|
|
3854
|
+
const labels = Object.entries(config.components).reduce(
|
|
3855
|
+
(acc, [key, comp]) => {
|
|
3856
|
+
acc[key] = comp.label || key;
|
|
3857
|
+
return acc;
|
|
3858
|
+
},
|
|
3859
|
+
{}
|
|
3860
|
+
);
|
|
3802
3861
|
const otherKeys = allKeys.filter((k) => !categorised.has(k));
|
|
3803
3862
|
const categoryEntries = Object.entries(categories).filter(
|
|
3804
3863
|
([, cat]) => cat.visible !== false
|
|
@@ -3813,8 +3872,8 @@ var Drawer = (_props) => {
|
|
|
3813
3872
|
});
|
|
3814
3873
|
const toggle = (id) => setExpanded((prev) => __spreadProps(__spreadValues({}, prev), { [id]: !prev[id] }));
|
|
3815
3874
|
if (categoryEntries.length === 0) {
|
|
3816
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3817
|
-
|
|
3875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core14.Drawer, { children: allKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3876
|
+
import_core14.Drawer.Item,
|
|
3818
3877
|
{
|
|
3819
3878
|
name: key,
|
|
3820
3879
|
label: labels[key],
|
|
@@ -3857,9 +3916,9 @@ var Drawer = (_props) => {
|
|
|
3857
3916
|
};
|
|
3858
3917
|
|
|
3859
3918
|
// src/puck/overrides/HeaderActions.tsx
|
|
3860
|
-
var
|
|
3919
|
+
var import_core15 = require("@puckeditor/core");
|
|
3861
3920
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3862
|
-
var useCustomPuck12 = (0,
|
|
3921
|
+
var useCustomPuck12 = (0, import_core15.createUsePuck)();
|
|
3863
3922
|
var HeaderActions = ({ children }) => {
|
|
3864
3923
|
const { handleComplete } = useComplete();
|
|
3865
3924
|
const { handleCancel, canCancel } = useCancel();
|
|
@@ -3868,16 +3927,20 @@ var HeaderActions = ({ children }) => {
|
|
|
3868
3927
|
const selectedItemSelector = appState.ui.itemSelector;
|
|
3869
3928
|
const inspect = useSoftConfig((s) => s.builder.inspect);
|
|
3870
3929
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: canCancel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
3871
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3930
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core15.Button, { onClick: handleCancel, children: "Cancel" }),
|
|
3872
3931
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3873
|
-
|
|
3932
|
+
import_core15.Button,
|
|
3874
3933
|
{
|
|
3875
3934
|
variant: "primary",
|
|
3876
3935
|
onClick: () => {
|
|
3877
3936
|
const completedComponent = handleComplete();
|
|
3878
3937
|
if (completedComponent) {
|
|
3879
3938
|
try {
|
|
3880
|
-
inspect(
|
|
3939
|
+
inspect(
|
|
3940
|
+
completedComponent.id,
|
|
3941
|
+
dispatch,
|
|
3942
|
+
selectedItemSelector
|
|
3943
|
+
);
|
|
3881
3944
|
} catch (error) {
|
|
3882
3945
|
notify.error(
|
|
3883
3946
|
"Failed to inspect after completion: " + (error instanceof Error ? error.message : String(error))
|
package/dist/puck/index.mjs
CHANGED
|
@@ -519,7 +519,7 @@ var rootActionHandler = (set, get) => (action, appState, previousState) => {
|
|
|
519
519
|
// src/puck/store/slices/builder.tsx
|
|
520
520
|
import {
|
|
521
521
|
walkTree as walkTree2
|
|
522
|
-
} from "@
|
|
522
|
+
} from "@puckeditor/core";
|
|
523
523
|
|
|
524
524
|
// src/puck/lib/soft-component-constants.ts
|
|
525
525
|
var TECHNICAL_KEYS = /* @__PURE__ */ new Set(["_map", "_slot", "id", "_version"]);
|
|
@@ -1507,7 +1507,7 @@ function isSoftComponent(componentType, softComponents) {
|
|
|
1507
1507
|
}
|
|
1508
1508
|
|
|
1509
1509
|
// src/puck/lib/demolish-soft-component.ts
|
|
1510
|
-
import { walkTree } from "@
|
|
1510
|
+
import { walkTree } from "@puckeditor/core";
|
|
1511
1511
|
function demolishSoftComponent(componentName, data, config, softComponents) {
|
|
1512
1512
|
const resolvedData = walkTree(data, config, (components) => {
|
|
1513
1513
|
components.forEach((componentData, index) => {
|
|
@@ -1736,7 +1736,10 @@ var createBuildersSlice = (set, get) => ({
|
|
|
1736
1736
|
const readOnly = [
|
|
1737
1737
|
...readOnlyFields.map((f) => String(f)),
|
|
1738
1738
|
...readOnlyArrayBases
|
|
1739
|
-
].reduce(
|
|
1739
|
+
].reduce(
|
|
1740
|
+
(acc, field) => __spreadProps(__spreadValues({}, acc), { [field]: true }),
|
|
1741
|
+
{}
|
|
1742
|
+
);
|
|
1740
1743
|
puckDispatch({
|
|
1741
1744
|
type: "replace",
|
|
1742
1745
|
destinationIndex: itemSelector.index,
|
|
@@ -2772,7 +2775,7 @@ var SoftConfigProvider = ({
|
|
|
2772
2775
|
};
|
|
2773
2776
|
|
|
2774
2777
|
// src/puck/actions/useBuild.tsx
|
|
2775
|
-
import { createUsePuck } from "@
|
|
2778
|
+
import { createUsePuck } from "@puckeditor/core";
|
|
2776
2779
|
|
|
2777
2780
|
// src/puck/lib/notify.ts
|
|
2778
2781
|
var customHandler = null;
|
|
@@ -2852,7 +2855,7 @@ var useBuild = (name) => {
|
|
|
2852
2855
|
};
|
|
2853
2856
|
|
|
2854
2857
|
// src/puck/actions/useRemodel.tsx
|
|
2855
|
-
import { createUsePuck as createUsePuck2 } from "@
|
|
2858
|
+
import { createUsePuck as createUsePuck2 } from "@puckeditor/core";
|
|
2856
2859
|
var useCustomPuck2 = createUsePuck2();
|
|
2857
2860
|
var useRemodel = () => {
|
|
2858
2861
|
const remodel = useSoftConfig((s) => s.builder.remodel);
|
|
@@ -2917,7 +2920,7 @@ var useRemodel = () => {
|
|
|
2917
2920
|
};
|
|
2918
2921
|
|
|
2919
2922
|
// src/puck/actions/useComplete.tsx
|
|
2920
|
-
import { createUsePuck as createUsePuck3 } from "@
|
|
2923
|
+
import { createUsePuck as createUsePuck3 } from "@puckeditor/core";
|
|
2921
2924
|
import { useState as useState2, useCallback as useCallback2 } from "react";
|
|
2922
2925
|
var useCustomPuck3 = createUsePuck3();
|
|
2923
2926
|
var useComplete = () => {
|
|
@@ -2934,7 +2937,11 @@ var useComplete = () => {
|
|
|
2934
2937
|
return null;
|
|
2935
2938
|
}
|
|
2936
2939
|
try {
|
|
2937
|
-
const completedComponent = complete(
|
|
2940
|
+
const completedComponent = complete(
|
|
2941
|
+
appState,
|
|
2942
|
+
setHistories,
|
|
2943
|
+
getItemBySelector
|
|
2944
|
+
);
|
|
2938
2945
|
setNewComponent(completedComponent);
|
|
2939
2946
|
const componentData = appState.data.root;
|
|
2940
2947
|
if (componentData) {
|
|
@@ -2956,13 +2963,20 @@ var useComplete = () => {
|
|
|
2956
2963
|
);
|
|
2957
2964
|
return null;
|
|
2958
2965
|
}
|
|
2959
|
-
}, [
|
|
2966
|
+
}, [
|
|
2967
|
+
complete,
|
|
2968
|
+
appState,
|
|
2969
|
+
setHistories,
|
|
2970
|
+
status,
|
|
2971
|
+
triggerAction,
|
|
2972
|
+
getItemBySelector
|
|
2973
|
+
]);
|
|
2960
2974
|
const canComplete = status === "building" || status === "remodeling";
|
|
2961
2975
|
return { handleComplete, canComplete, newComponent, setNewComponent };
|
|
2962
2976
|
};
|
|
2963
2977
|
|
|
2964
2978
|
// src/puck/actions/useCancel.tsx
|
|
2965
|
-
import { createUsePuck as createUsePuck4 } from "@
|
|
2979
|
+
import { createUsePuck as createUsePuck4 } from "@puckeditor/core";
|
|
2966
2980
|
var useCustomPuck4 = createUsePuck4();
|
|
2967
2981
|
var useCancel = () => {
|
|
2968
2982
|
const cancel = useSoftConfig((s) => s.builder.cancel);
|
|
@@ -2994,7 +3008,7 @@ var useCancel = () => {
|
|
|
2994
3008
|
};
|
|
2995
3009
|
|
|
2996
3010
|
// src/puck/actions/useInspect.tsx
|
|
2997
|
-
import { createUsePuck as createUsePuck5 } from "@
|
|
3011
|
+
import { createUsePuck as createUsePuck5 } from "@puckeditor/core";
|
|
2998
3012
|
import { useEffect as useEffect2 } from "react";
|
|
2999
3013
|
var useCustomPuck5 = createUsePuck5();
|
|
3000
3014
|
var useInspect = (component) => {
|
|
@@ -3028,7 +3042,7 @@ var useInspect = (component) => {
|
|
|
3028
3042
|
};
|
|
3029
3043
|
|
|
3030
3044
|
// src/puck/actions/useDecompose.tsx
|
|
3031
|
-
import { createUsePuck as createUsePuck6, walkTree as walkTree3 } from "@
|
|
3045
|
+
import { createUsePuck as createUsePuck6, walkTree as walkTree3 } from "@puckeditor/core";
|
|
3032
3046
|
|
|
3033
3047
|
// src/puck/lib/get-prop-by-path.ts
|
|
3034
3048
|
function getPropertyByPath(props, path) {
|
|
@@ -3076,7 +3090,9 @@ var useDecompose = () => {
|
|
|
3076
3090
|
{ content: contentArray, root: newData.root || {} },
|
|
3077
3091
|
config,
|
|
3078
3092
|
(components) => {
|
|
3079
|
-
const index = components.findIndex(
|
|
3093
|
+
const index = components.findIndex(
|
|
3094
|
+
(c) => c.props.id === target.props.id
|
|
3095
|
+
);
|
|
3080
3096
|
if (index !== -1) {
|
|
3081
3097
|
components.splice(index, 1, ...decomposedComponents);
|
|
3082
3098
|
}
|
|
@@ -3110,7 +3126,7 @@ var useDecompose = () => {
|
|
|
3110
3126
|
};
|
|
3111
3127
|
|
|
3112
3128
|
// src/puck/actions/useDemolish.tsx
|
|
3113
|
-
import { createUsePuck as createUsePuck7 } from "@
|
|
3129
|
+
import { createUsePuck as createUsePuck7 } from "@puckeditor/core";
|
|
3114
3130
|
var useCustomPuck7 = createUsePuck7();
|
|
3115
3131
|
var useDemolish = () => {
|
|
3116
3132
|
const demolish = useSoftConfig((s) => s.builder.demolish);
|
|
@@ -3198,13 +3214,13 @@ var useSetDefaultVersion = () => {
|
|
|
3198
3214
|
};
|
|
3199
3215
|
|
|
3200
3216
|
// src/puck/overrides/Header.tsx
|
|
3201
|
-
import { Button } from "@
|
|
3217
|
+
import { Button } from "@puckeditor/core";
|
|
3202
3218
|
|
|
3203
3219
|
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/Header.module.css#css-module
|
|
3204
3220
|
var Header_module_default = { "Header": "_Header_19oj9_1" };
|
|
3205
3221
|
|
|
3206
3222
|
// src/puck/actions/usePublish.tsx
|
|
3207
|
-
import { createUsePuck as createUsePuck8 } from "@
|
|
3223
|
+
import { createUsePuck as createUsePuck8 } from "@puckeditor/core";
|
|
3208
3224
|
var useCustomPuck8 = createUsePuck8();
|
|
3209
3225
|
var usePublish = () => {
|
|
3210
3226
|
const components = useSoftConfig((s) => s.softComponents);
|
|
@@ -3280,7 +3296,7 @@ var Header = ({
|
|
|
3280
3296
|
|
|
3281
3297
|
// src/puck/overrides/ActionBar.tsx
|
|
3282
3298
|
import { useMemo as useMemo3 } from "react";
|
|
3283
|
-
import { ActionBar, createUsePuck as createUsePuck10 } from "@
|
|
3299
|
+
import { ActionBar, createUsePuck as createUsePuck10 } from "@puckeditor/core";
|
|
3284
3300
|
import { Combine, ComponentIcon, EditIcon } from "lucide-react";
|
|
3285
3301
|
|
|
3286
3302
|
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/ActionBar.module.css#css-module
|
|
@@ -3293,7 +3309,9 @@ var useCustomPuck9 = createUsePuck10();
|
|
|
3293
3309
|
var getClassName3 = get_class_name_factory_default("ActionBar", ActionBar_module_default);
|
|
3294
3310
|
var ActionBarOverride = (props) => {
|
|
3295
3311
|
var _a, _b;
|
|
3296
|
-
const { handleBuild } = useBuild(
|
|
3312
|
+
const { handleBuild } = useBuild(
|
|
3313
|
+
props.label ? props.label + " Soft Component" : "New Soft Component"
|
|
3314
|
+
);
|
|
3297
3315
|
const { handleRemodel } = useRemodel();
|
|
3298
3316
|
const { handleDecompose } = useDecompose();
|
|
3299
3317
|
const overrides = useSoftConfig((s) => s.overrides);
|
|
@@ -3314,18 +3332,13 @@ var ActionBarOverride = (props) => {
|
|
|
3314
3332
|
existingKeys: softKeys,
|
|
3315
3333
|
state: status
|
|
3316
3334
|
}));
|
|
3317
|
-
}, [
|
|
3318
|
-
props.label,
|
|
3319
|
-
overrides,
|
|
3320
|
-
selectedItem == null ? void 0 : selectedItem.type,
|
|
3321
|
-
softKeys,
|
|
3322
|
-
status,
|
|
3323
|
-
rootProps
|
|
3324
|
-
]);
|
|
3335
|
+
}, [props.label, overrides, selectedItem == null ? void 0 : selectedItem.type, softKeys, status, rootProps]);
|
|
3325
3336
|
const isSoftComponent2 = softKeys.includes(key);
|
|
3326
3337
|
const selectedId = (_a = selectedItem == null ? void 0 : selectedItem.props) == null ? void 0 : _a.id;
|
|
3327
3338
|
const parentId = (_b = itemSelector == null ? void 0 : itemSelector.zone) == null ? void 0 : _b.split(":")[0];
|
|
3328
|
-
const isEditable = Boolean(
|
|
3339
|
+
const isEditable = Boolean(
|
|
3340
|
+
selectedId && (editableIds.has(selectedId) || parentId && editableIds.has(parentId))
|
|
3341
|
+
);
|
|
3329
3342
|
const label = useMemo3(() => {
|
|
3330
3343
|
var _a2;
|
|
3331
3344
|
if (isSoftComponent2) {
|
|
@@ -3371,7 +3384,7 @@ var ActionBarOverride = (props) => {
|
|
|
3371
3384
|
|
|
3372
3385
|
// src/puck/overrides/DrawerItem.tsx
|
|
3373
3386
|
import { useState as useState4 } from "react";
|
|
3374
|
-
import { Button as Button2, IconButton, createUsePuck as createUsePuck11 } from "@
|
|
3387
|
+
import { Button as Button2, IconButton, createUsePuck as createUsePuck11 } from "@puckeditor/core";
|
|
3375
3388
|
import { GripVertical, Check, X, Trash2, Cog } from "lucide-react";
|
|
3376
3389
|
|
|
3377
3390
|
// src/puck/lib/confirm.ts
|
|
@@ -3595,8 +3608,10 @@ var DrawerItem = (props) => {
|
|
|
3595
3608
|
const isDefault = version === (selectedVersion || defaultVersion);
|
|
3596
3609
|
const isMarkedForDeletion = versionsToDelete.has(version);
|
|
3597
3610
|
let rowClass = getClassName5("versionRow");
|
|
3598
|
-
if (isDefault)
|
|
3599
|
-
|
|
3611
|
+
if (isDefault)
|
|
3612
|
+
rowClass += " " + getClassName5("versionRow--isDefault");
|
|
3613
|
+
if (isMarkedForDeletion)
|
|
3614
|
+
rowClass += " " + getClassName5("versionRow--isMarkedForDeletion");
|
|
3600
3615
|
return /* @__PURE__ */ jsxs4("div", { className: rowClass, children: [
|
|
3601
3616
|
/* @__PURE__ */ jsxs4("div", { className: getClassName5("versionInfo"), children: [
|
|
3602
3617
|
/* @__PURE__ */ jsxs4("span", { className: getClassName5("versionNumber"), children: [
|
|
@@ -3607,14 +3622,28 @@ var DrawerItem = (props) => {
|
|
|
3607
3622
|
isMarkedForDeletion && /* @__PURE__ */ jsx8("span", { className: getClassName5("deleteBadge"), children: "Marked for deletion" })
|
|
3608
3623
|
] }),
|
|
3609
3624
|
/* @__PURE__ */ jsxs4("div", { className: getClassName5("versionActions"), children: [
|
|
3610
|
-
!isDefault && !isMarkedForDeletion && /* @__PURE__ */ jsx8(
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3625
|
+
!isDefault && !isMarkedForDeletion && /* @__PURE__ */ jsx8(
|
|
3626
|
+
Button2,
|
|
3627
|
+
{
|
|
3628
|
+
variant: "secondary",
|
|
3629
|
+
onClick: () => setSelectedVersion(version),
|
|
3630
|
+
children: "Set as Default"
|
|
3631
|
+
}
|
|
3632
|
+
),
|
|
3633
|
+
/* @__PURE__ */ jsx8(
|
|
3634
|
+
Button2,
|
|
3635
|
+
{
|
|
3636
|
+
variant: "secondary",
|
|
3637
|
+
onClick: () => toggleVersionForDeletion(version),
|
|
3638
|
+
children: isMarkedForDeletion ? /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
3639
|
+
/* @__PURE__ */ jsx8(X, { size: 14 }),
|
|
3640
|
+
" Undo"
|
|
3641
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
3642
|
+
/* @__PURE__ */ jsx8(Trash2, { size: 14 }),
|
|
3643
|
+
" Delete"
|
|
3644
|
+
] })
|
|
3645
|
+
}
|
|
3646
|
+
)
|
|
3618
3647
|
] })
|
|
3619
3648
|
] }, version);
|
|
3620
3649
|
}) })
|
|
@@ -3636,10 +3665,20 @@ var DrawerItem = (props) => {
|
|
|
3636
3665
|
type: "button",
|
|
3637
3666
|
role: "radio",
|
|
3638
3667
|
"aria-checked": isSelected,
|
|
3639
|
-
className: `${getClassName5("migrationOption")} ${isSelected ? getClassName5(
|
|
3668
|
+
className: `${getClassName5("migrationOption")} ${isSelected ? getClassName5(
|
|
3669
|
+
"migrationOption--isSelected"
|
|
3670
|
+
) : ""}`,
|
|
3640
3671
|
onClick: () => setMigrationTarget(target.value),
|
|
3641
3672
|
children: [
|
|
3642
|
-
/* @__PURE__ */ jsx8(
|
|
3673
|
+
/* @__PURE__ */ jsx8(
|
|
3674
|
+
"span",
|
|
3675
|
+
{
|
|
3676
|
+
className: getClassName5(
|
|
3677
|
+
"migrationOptionLabel"
|
|
3678
|
+
),
|
|
3679
|
+
children: target.label
|
|
3680
|
+
}
|
|
3681
|
+
),
|
|
3643
3682
|
isSelected && /* @__PURE__ */ jsx8(Check, { size: 14 })
|
|
3644
3683
|
]
|
|
3645
3684
|
},
|
|
@@ -3651,7 +3690,8 @@ var DrawerItem = (props) => {
|
|
|
3651
3690
|
/* @__PURE__ */ jsx8("p", { className: getClassName5("helpText"), children: "Choose where to move existing instances of the deleted versions." })
|
|
3652
3691
|
] })
|
|
3653
3692
|
] }) : /* @__PURE__ */ jsx8("div", { className: getClassName5("section"), children: /* @__PURE__ */ jsxs4("p", { children: [
|
|
3654
|
-
"Manage high-level settings for the
|
|
3693
|
+
"Manage high-level settings for the",
|
|
3694
|
+
" ",
|
|
3655
3695
|
/* @__PURE__ */ jsx8("strong", { children: displayName }),
|
|
3656
3696
|
" component."
|
|
3657
3697
|
] }) }) }),
|
|
@@ -3661,15 +3701,31 @@ var DrawerItem = (props) => {
|
|
|
3661
3701
|
/* @__PURE__ */ jsx8(Check, { size: 16 }),
|
|
3662
3702
|
" Apply Changes"
|
|
3663
3703
|
] }) : /* @__PURE__ */ jsx8(Button2, { size: "medium", onClick: handleCancel, children: "Close" }),
|
|
3664
|
-
useVersioning && /* @__PURE__ */ jsxs4(
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3704
|
+
useVersioning && /* @__PURE__ */ jsxs4(
|
|
3705
|
+
Button2,
|
|
3706
|
+
{
|
|
3707
|
+
size: "medium",
|
|
3708
|
+
variant: "secondary",
|
|
3709
|
+
onClick: handleCancel,
|
|
3710
|
+
children: [
|
|
3711
|
+
/* @__PURE__ */ jsx8(X, { size: 16 }),
|
|
3712
|
+
" Cancel"
|
|
3713
|
+
]
|
|
3714
|
+
}
|
|
3715
|
+
)
|
|
3668
3716
|
] }),
|
|
3669
|
-
/* @__PURE__ */ jsx8("div", { className: getClassName5("footerRight"), children: /* @__PURE__ */ jsxs4(
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3717
|
+
/* @__PURE__ */ jsx8("div", { className: getClassName5("footerRight"), children: /* @__PURE__ */ jsxs4(
|
|
3718
|
+
Button2,
|
|
3719
|
+
{
|
|
3720
|
+
size: "medium",
|
|
3721
|
+
variant: "secondary",
|
|
3722
|
+
onClick: handleDemolishClick,
|
|
3723
|
+
children: [
|
|
3724
|
+
/* @__PURE__ */ jsx8(Trash2, { size: 16 }),
|
|
3725
|
+
" Demolish Component"
|
|
3726
|
+
]
|
|
3727
|
+
}
|
|
3728
|
+
) })
|
|
3673
3729
|
] })
|
|
3674
3730
|
] }) })
|
|
3675
3731
|
] });
|
|
@@ -3679,7 +3735,7 @@ var DrawerItem = (props) => {
|
|
|
3679
3735
|
|
|
3680
3736
|
// src/puck/overrides/Drawer.tsx
|
|
3681
3737
|
import { useState as useState5 } from "react";
|
|
3682
|
-
import { createUsePuck as createUsePuck12, Drawer as PuckDrawer } from "@
|
|
3738
|
+
import { createUsePuck as createUsePuck12, Drawer as PuckDrawer } from "@puckeditor/core";
|
|
3683
3739
|
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
3684
3740
|
|
|
3685
3741
|
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/Drawer.module.css#css-module
|
|
@@ -3733,10 +3789,13 @@ var Drawer = (_props) => {
|
|
|
3733
3789
|
})
|
|
3734
3790
|
);
|
|
3735
3791
|
const allKeys = Object.keys(config.components);
|
|
3736
|
-
const labels = Object.entries(config.components).reduce(
|
|
3737
|
-
acc[key
|
|
3738
|
-
|
|
3739
|
-
|
|
3792
|
+
const labels = Object.entries(config.components).reduce(
|
|
3793
|
+
(acc, [key, comp]) => {
|
|
3794
|
+
acc[key] = comp.label || key;
|
|
3795
|
+
return acc;
|
|
3796
|
+
},
|
|
3797
|
+
{}
|
|
3798
|
+
);
|
|
3740
3799
|
const otherKeys = allKeys.filter((k) => !categorised.has(k));
|
|
3741
3800
|
const categoryEntries = Object.entries(categories).filter(
|
|
3742
3801
|
([, cat]) => cat.visible !== false
|
|
@@ -3795,7 +3854,7 @@ var Drawer = (_props) => {
|
|
|
3795
3854
|
};
|
|
3796
3855
|
|
|
3797
3856
|
// src/puck/overrides/HeaderActions.tsx
|
|
3798
|
-
import { Button as Button3, createUsePuck as createUsePuck13 } from "@
|
|
3857
|
+
import { Button as Button3, createUsePuck as createUsePuck13 } from "@puckeditor/core";
|
|
3799
3858
|
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3800
3859
|
var useCustomPuck12 = createUsePuck13();
|
|
3801
3860
|
var HeaderActions = ({ children }) => {
|
|
@@ -3815,7 +3874,11 @@ var HeaderActions = ({ children }) => {
|
|
|
3815
3874
|
const completedComponent = handleComplete();
|
|
3816
3875
|
if (completedComponent) {
|
|
3817
3876
|
try {
|
|
3818
|
-
inspect(
|
|
3877
|
+
inspect(
|
|
3878
|
+
completedComponent.id,
|
|
3879
|
+
dispatch,
|
|
3880
|
+
selectedItemSelector
|
|
3881
|
+
);
|
|
3819
3882
|
} catch (error) {
|
|
3820
3883
|
notify.error(
|
|
3821
3884
|
"Failed to inspect after completion: " + (error instanceof Error ? error.message : String(error))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlisian/softconfig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/node": "^20.11.24",
|
|
44
44
|
"@types/react": "^18.0.0 || ^19.0.0",
|
|
45
45
|
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
|
46
|
-
"eslint": "
|
|
46
|
+
"eslint": "~8.57.1",
|
|
47
47
|
"postcss": "^8.5.6",
|
|
48
48
|
"postcss-modules": "^6.0.1",
|
|
49
49
|
"size-limit": "^11.1.6",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"zustand": "^5.0.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@
|
|
63
|
+
"@puckeditor/core": "0.21.x",
|
|
64
64
|
"react": ">=18.0.0 <20.3.0"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|