@netlisian/softconfig 0.1.6 → 0.1.7
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.css +6 -6
- package/dist/puck/index.d.mts +125 -28
- package/dist/puck/index.d.ts +125 -28
- package/dist/puck/index.js +512 -534
- package/dist/puck/index.mjs +511 -534
- package/package.json +1 -1
package/dist/puck/index.js
CHANGED
|
@@ -74,6 +74,7 @@ __export(puck_exports, {
|
|
|
74
74
|
Drawer: () => Drawer,
|
|
75
75
|
DrawerItem: () => DrawerItem,
|
|
76
76
|
Header: () => Header,
|
|
77
|
+
HeaderActions: () => HeaderActions,
|
|
77
78
|
Modal: () => Modal,
|
|
78
79
|
SoftConfigProvider: () => SoftConfigProvider,
|
|
79
80
|
applyMapping: () => applyMapping,
|
|
@@ -1121,7 +1122,7 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
|
1121
1122
|
};
|
|
1122
1123
|
var get_class_name_factory_default = getClassNameFactory;
|
|
1123
1124
|
|
|
1124
|
-
// css-module:/
|
|
1125
|
+
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/components/error-boundary/styles.module.css#css-module
|
|
1125
1126
|
var styles_module_default = { "ErrorBoundary": "_ErrorBoundary_1xl05_5", "ErrorBoundary-title": "_ErrorBoundary-title_1xl05_21", "ErrorBoundary-details": "_ErrorBoundary-details_1xl05_31", "ErrorBoundary-button": "_ErrorBoundary-button_1xl05_39" };
|
|
1126
1127
|
|
|
1127
1128
|
// src/puck/components/error-boundary/index.tsx
|
|
@@ -1647,26 +1648,18 @@ var generateId = (type) => type ? `${type}-${(0, import_uuid.v4)()}` : (0, impor
|
|
|
1647
1648
|
var toSlug = (value) => {
|
|
1648
1649
|
return value.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
|
|
1649
1650
|
};
|
|
1650
|
-
var
|
|
1651
|
-
|
|
1652
|
-
const registry = (_b = (_a = context.registryName) != null ? _a : context.registry) != null ? _b : "default";
|
|
1653
|
-
return `${toSlug(registry)}/${toSlug(displayName)}`;
|
|
1654
|
-
};
|
|
1655
|
-
var defaultComponentKeyToName = (key) => {
|
|
1656
|
-
const slashIndex = key.indexOf("/");
|
|
1657
|
-
const componentPart = slashIndex === -1 ? key : key.slice(slashIndex + 1);
|
|
1658
|
-
if (!componentPart) return "";
|
|
1659
|
-
return componentPart.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1651
|
+
var slugTolabel = (name) => {
|
|
1652
|
+
return name.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1660
1653
|
};
|
|
1661
|
-
var
|
|
1662
|
-
const key = overrides.
|
|
1654
|
+
var componentNameFromLabel = (label, overrides, context) => {
|
|
1655
|
+
const key = overrides.componentLabelToName ? overrides.componentLabelToName(label, context) : toSlug(label);
|
|
1663
1656
|
return key.trim();
|
|
1664
1657
|
};
|
|
1665
|
-
var
|
|
1666
|
-
if (overrides == null ? void 0 : overrides.
|
|
1667
|
-
return overrides.
|
|
1658
|
+
var componentLabelFromName = (name, overrides) => {
|
|
1659
|
+
if (overrides == null ? void 0 : overrides.componentNameToLabel) {
|
|
1660
|
+
return overrides.componentNameToLabel(name);
|
|
1668
1661
|
}
|
|
1669
|
-
return
|
|
1662
|
+
return slugTolabel(name);
|
|
1670
1663
|
};
|
|
1671
1664
|
|
|
1672
1665
|
// src/puck/lib/soft-component-to-appstate.ts
|
|
@@ -1862,7 +1855,7 @@ var softComponentToAppState = (softComponent, componentName, version, versions,
|
|
|
1862
1855
|
mergedFieldSettings[field.name] = settings;
|
|
1863
1856
|
});
|
|
1864
1857
|
let rootProps = __spreadValues({
|
|
1865
|
-
_name: displayName ||
|
|
1858
|
+
_name: displayName || componentLabelFromName(componentName, overrides),
|
|
1866
1859
|
_category: category,
|
|
1867
1860
|
_version: version,
|
|
1868
1861
|
_versions: versions,
|
|
@@ -2067,14 +2060,12 @@ var hydrateCustomField = (fieldName, field, fieldSettings, customFields) => {
|
|
|
2067
2060
|
};
|
|
2068
2061
|
var createVersionedComponentConfig = (componentName, displayName, version, allVersions, config, softComponents, defaultProps, showVersioning = true, customFields, overrides) => {
|
|
2069
2062
|
var _a, _b;
|
|
2070
|
-
|
|
2063
|
+
return {
|
|
2071
2064
|
label: displayName,
|
|
2072
2065
|
fields: Object.fromEntries(
|
|
2073
2066
|
(Object.entries(
|
|
2074
2067
|
(_b = (_a = softComponents[componentName].versions) == null ? void 0 : _a[version]) == null ? void 0 : _b.fields
|
|
2075
|
-
) || []).filter(
|
|
2076
|
-
([key, field]) => field.type === "slot"
|
|
2077
|
-
).map(([key, field]) => [key, __spreadValues({}, field)])
|
|
2068
|
+
) || []).filter(([key, field]) => field.type === "slot").map(([key, field]) => [key, __spreadValues({}, field)])
|
|
2078
2069
|
),
|
|
2079
2070
|
defaultProps: __spreadProps(__spreadValues({}, defaultProps), {
|
|
2080
2071
|
version
|
|
@@ -2117,10 +2108,6 @@ var createVersionedComponentConfig = (componentName, displayName, version, allVe
|
|
|
2117
2108
|
);
|
|
2118
2109
|
}
|
|
2119
2110
|
};
|
|
2120
|
-
if (overrides == null ? void 0 : overrides.mapComponentConfig) {
|
|
2121
|
-
return __spreadValues(__spreadValues({}, baseConfig), overrides.mapComponentConfig(componentName, baseConfig));
|
|
2122
|
-
}
|
|
2123
|
-
return baseConfig;
|
|
2124
2111
|
};
|
|
2125
2112
|
|
|
2126
2113
|
// src/puck/lib/builder/sub-component-decomposer.tsx
|
|
@@ -2241,6 +2228,61 @@ function demolishSoftComponent(componentName, data, config, softComponents) {
|
|
|
2241
2228
|
};
|
|
2242
2229
|
}
|
|
2243
2230
|
|
|
2231
|
+
// src/puck/lib/edit-visibility-utils.ts
|
|
2232
|
+
var setEditVisibility = (doc, context) => {
|
|
2233
|
+
if (!doc) return;
|
|
2234
|
+
try {
|
|
2235
|
+
const root = doc.documentElement;
|
|
2236
|
+
if (context.mode === "none") {
|
|
2237
|
+
root.removeAttribute("data-edit-mode");
|
|
2238
|
+
root.classList.remove("edit-visibility-mode");
|
|
2239
|
+
doc.querySelectorAll("[data-puck-component]").forEach((el) => {
|
|
2240
|
+
el.removeAttribute("data-edit-visibility");
|
|
2241
|
+
el.classList.remove("edit-visibility-greyed", "edit-visibility-editable", "edit-visibility-dependency");
|
|
2242
|
+
});
|
|
2243
|
+
} else {
|
|
2244
|
+
root.setAttribute("data-edit-mode", context.mode);
|
|
2245
|
+
root.classList.add("edit-visibility-mode");
|
|
2246
|
+
doc.querySelectorAll("[data-puck-component]").forEach((el) => {
|
|
2247
|
+
var _a;
|
|
2248
|
+
const id = el.getAttribute("data-puck-component");
|
|
2249
|
+
if (!id) return;
|
|
2250
|
+
const isEditable = context.editableIds.has(id);
|
|
2251
|
+
const isDependency = (_a = context.highlightDependencyIds) == null ? void 0 : _a.has(id);
|
|
2252
|
+
if (isEditable) {
|
|
2253
|
+
el.setAttribute("data-edit-visibility", "editable");
|
|
2254
|
+
el.classList.remove("edit-visibility-greyed", "edit-visibility-dependency");
|
|
2255
|
+
el.classList.add("edit-visibility-editable");
|
|
2256
|
+
} else if (isDependency) {
|
|
2257
|
+
el.setAttribute("data-edit-visibility", "dependency");
|
|
2258
|
+
el.classList.remove("edit-visibility-greyed", "edit-visibility-editable");
|
|
2259
|
+
el.classList.add("edit-visibility-dependency");
|
|
2260
|
+
} else {
|
|
2261
|
+
el.setAttribute("data-edit-visibility", "greyed");
|
|
2262
|
+
el.classList.remove("edit-visibility-editable", "edit-visibility-dependency");
|
|
2263
|
+
el.classList.add("edit-visibility-greyed");
|
|
2264
|
+
}
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
} catch (error) {
|
|
2268
|
+
console.warn(`Failed to set edit visibility:`, error);
|
|
2269
|
+
}
|
|
2270
|
+
};
|
|
2271
|
+
var clearEditVisibility = (doc) => {
|
|
2272
|
+
if (!doc) return;
|
|
2273
|
+
try {
|
|
2274
|
+
const root = doc.documentElement;
|
|
2275
|
+
root.removeAttribute("data-edit-mode");
|
|
2276
|
+
root.classList.remove("edit-visibility-mode");
|
|
2277
|
+
doc.querySelectorAll("[data-puck-component]").forEach((el) => {
|
|
2278
|
+
el.removeAttribute("data-edit-visibility");
|
|
2279
|
+
el.classList.remove("edit-visibility-greyed", "edit-visibility-editable", "edit-visibility-dependency");
|
|
2280
|
+
});
|
|
2281
|
+
} catch (error) {
|
|
2282
|
+
console.warn(`Failed to clear edit visibility:`, error);
|
|
2283
|
+
}
|
|
2284
|
+
};
|
|
2285
|
+
|
|
2244
2286
|
// src/puck/store/slices/builder.tsx
|
|
2245
2287
|
var createBuildersSlice = (set, get, initialConfig) => ({
|
|
2246
2288
|
build: (history, selectedItem, itemSelector, puckDispatch, name) => {
|
|
@@ -2291,6 +2333,12 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
2291
2333
|
return components;
|
|
2292
2334
|
}
|
|
2293
2335
|
);
|
|
2336
|
+
requestAnimationFrame(
|
|
2337
|
+
() => setEditVisibility(get().iframeDoc, {
|
|
2338
|
+
mode: "build",
|
|
2339
|
+
editableIds
|
|
2340
|
+
})
|
|
2341
|
+
);
|
|
2294
2342
|
set((s) => __spreadProps(__spreadValues({}, s), {
|
|
2295
2343
|
softConfig: buildConfig,
|
|
2296
2344
|
storedConfig: config,
|
|
@@ -2303,15 +2351,14 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
2303
2351
|
editableComponentIds: editableIds,
|
|
2304
2352
|
state: "building"
|
|
2305
2353
|
}));
|
|
2306
|
-
|
|
2354
|
+
requestAnimationFrame(
|
|
2307
2355
|
() => puckDispatch({
|
|
2308
2356
|
type: "replaceRoot",
|
|
2309
2357
|
root: {
|
|
2310
2358
|
title: "Soft Component Builder",
|
|
2311
2359
|
_name: name || "New Soft Component"
|
|
2312
2360
|
}
|
|
2313
|
-
})
|
|
2314
|
-
100
|
|
2361
|
+
})
|
|
2315
2362
|
);
|
|
2316
2363
|
},
|
|
2317
2364
|
remodel: (history, selectedItem, itemSelector, puckDispatch) => {
|
|
@@ -2399,6 +2446,12 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
2399
2446
|
}).content
|
|
2400
2447
|
})
|
|
2401
2448
|
});
|
|
2449
|
+
requestAnimationFrame(
|
|
2450
|
+
() => setEditVisibility(get().iframeDoc, {
|
|
2451
|
+
mode: "remodel",
|
|
2452
|
+
editableIds
|
|
2453
|
+
})
|
|
2454
|
+
);
|
|
2402
2455
|
set((s) => __spreadProps(__spreadValues({}, s), {
|
|
2403
2456
|
storedConfig: config,
|
|
2404
2457
|
softConfig: buildConfig,
|
|
@@ -2412,7 +2465,7 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
2412
2465
|
editableComponentIds: editableIds,
|
|
2413
2466
|
state: "remodeling"
|
|
2414
2467
|
}));
|
|
2415
|
-
|
|
2468
|
+
requestAnimationFrame(
|
|
2416
2469
|
() => puckDispatch({
|
|
2417
2470
|
type: "replaceRoot",
|
|
2418
2471
|
root: {
|
|
@@ -2420,8 +2473,7 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
2420
2473
|
_name: root.props._name,
|
|
2421
2474
|
_category: root.props._category
|
|
2422
2475
|
}
|
|
2423
|
-
})
|
|
2424
|
-
100
|
|
2476
|
+
})
|
|
2425
2477
|
);
|
|
2426
2478
|
},
|
|
2427
2479
|
complete: (appState, setHistories, getItemBySelector) => {
|
|
@@ -2437,34 +2489,34 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
2437
2489
|
if (!itemSelector) {
|
|
2438
2490
|
throw new Error("No item selector found for completed component.");
|
|
2439
2491
|
}
|
|
2440
|
-
const selectedItem = getItemBySelector(
|
|
2441
|
-
itemSelector
|
|
2442
|
-
);
|
|
2492
|
+
const selectedItem = getItemBySelector(itemSelector);
|
|
2443
2493
|
if (!selectedItem) {
|
|
2444
2494
|
throw new Error("Cannot find item being edited");
|
|
2445
2495
|
}
|
|
2446
2496
|
const rootCategory = (_e = (_d = appState.data.root) == null ? void 0 : _d.props) == null ? void 0 : _e._category;
|
|
2447
2497
|
const rootProps = (_f = appState.data.root) == null ? void 0 : _f.props;
|
|
2448
|
-
const componentName =
|
|
2498
|
+
const componentName = componentNameFromLabel(displayName, get().overrides, __spreadProps(__spreadValues({}, rootProps || {}), {
|
|
2449
2499
|
existingKeys: Object.keys(get().softComponents),
|
|
2450
2500
|
state: get().state
|
|
2451
2501
|
}));
|
|
2452
2502
|
if (!componentName) {
|
|
2453
2503
|
throw new Error("Failed to generate component key from name.");
|
|
2454
2504
|
}
|
|
2455
|
-
const [
|
|
2505
|
+
const [defaultSoftComponentConfig, version] = get().builder.compose(
|
|
2456
2506
|
appState,
|
|
2457
2507
|
componentName,
|
|
2458
2508
|
selectedItem,
|
|
2459
2509
|
displayName,
|
|
2460
2510
|
rootCategory
|
|
2461
2511
|
) || [];
|
|
2462
|
-
if (!
|
|
2512
|
+
if (!defaultSoftComponentConfig) {
|
|
2463
2513
|
throw new Error("Failed to compose new soft component config.");
|
|
2464
2514
|
}
|
|
2465
2515
|
const storedHistories = get().originalHistory;
|
|
2466
2516
|
setHistories([...storedHistories]);
|
|
2467
2517
|
const config = __spreadValues({}, get().softConfig || initialConfig);
|
|
2518
|
+
const mapComponentConfig = get().overrides.mapComponentConfig;
|
|
2519
|
+
const newSoftComponentConfig = mapComponentConfig ? mapComponentConfig(componentName, defaultSoftComponentConfig, rootProps) : defaultSoftComponentConfig;
|
|
2468
2520
|
set((s) => {
|
|
2469
2521
|
var _a2, _b2;
|
|
2470
2522
|
const nextComponents = __spreadProps(__spreadValues({}, Object.entries(config.components).reduce(
|
|
@@ -2506,10 +2558,7 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
2506
2558
|
}),
|
|
2507
2559
|
storedConfig: void 0,
|
|
2508
2560
|
state: "inspecting",
|
|
2509
|
-
originalHistory: []
|
|
2510
|
-
editingComponent: null,
|
|
2511
|
-
editingComponentId: null,
|
|
2512
|
-
editableComponentIds: /* @__PURE__ */ new Set()
|
|
2561
|
+
originalHistory: []
|
|
2513
2562
|
});
|
|
2514
2563
|
});
|
|
2515
2564
|
if (!version) {
|
|
@@ -2536,30 +2585,44 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
2536
2585
|
if ((selector == null ? void 0 : selector.index) === void 0 || !(selector == null ? void 0 : selector.zone)) {
|
|
2537
2586
|
throw new Error("No selector found for last item.");
|
|
2538
2587
|
}
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2588
|
+
const editableComponentId = get().editingComponentId;
|
|
2589
|
+
requestAnimationFrame(() => {
|
|
2590
|
+
const config = get().softConfig;
|
|
2591
|
+
const newComponent = config.components[componentName];
|
|
2592
|
+
const reconstructedTree = (data) => (0, import_puck4.walkTree)(data, config, (components) => {
|
|
2593
|
+
return components.map((comp) => {
|
|
2594
|
+
if (comp.props.id === editableComponentId) {
|
|
2595
|
+
return {
|
|
2596
|
+
type: componentName,
|
|
2597
|
+
props: __spreadProps(__spreadValues({}, newComponent.defaultProps), {
|
|
2598
|
+
id: generateId(componentName)
|
|
2599
|
+
})
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
return comp;
|
|
2603
|
+
});
|
|
2544
2604
|
});
|
|
2545
2605
|
puckDispatch({
|
|
2546
|
-
type: "
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2606
|
+
type: "setData",
|
|
2607
|
+
data: (data) => {
|
|
2608
|
+
return reconstructedTree(data);
|
|
2609
|
+
}
|
|
2550
2610
|
});
|
|
2551
|
-
}
|
|
2611
|
+
});
|
|
2612
|
+
requestAnimationFrame(() => clearEditVisibility(get().iframeDoc));
|
|
2552
2613
|
set((s) => __spreadProps(__spreadValues({}, s), {
|
|
2553
2614
|
state: "ready",
|
|
2554
2615
|
setItemSelector: void 0,
|
|
2555
2616
|
setOriginalItem: void 0,
|
|
2617
|
+
editingComponent: null,
|
|
2556
2618
|
editingComponentId: null,
|
|
2557
2619
|
editableComponentIds: /* @__PURE__ */ new Set()
|
|
2558
2620
|
}));
|
|
2559
2621
|
},
|
|
2560
2622
|
cancel: (setHistories) => {
|
|
2561
2623
|
const storedHistories = get().originalHistory;
|
|
2562
|
-
|
|
2624
|
+
requestAnimationFrame(() => setHistories([...storedHistories]));
|
|
2625
|
+
requestAnimationFrame(() => clearEditVisibility(get().iframeDoc));
|
|
2563
2626
|
set((s) => __spreadProps(__spreadValues({}, s), {
|
|
2564
2627
|
softConfig: get().storedConfig || initialConfig,
|
|
2565
2628
|
storedConfig: void 0,
|
|
@@ -2888,74 +2951,12 @@ function buildInitialSoftComponents(hardConfig, softComponents, overrides, showV
|
|
|
2888
2951
|
}
|
|
2889
2952
|
}
|
|
2890
2953
|
|
|
2891
|
-
// src/puck/lib/edit-visibility-utils.ts
|
|
2892
|
-
var setEditVisibility = (doc, context) => {
|
|
2893
|
-
if (!doc) return;
|
|
2894
|
-
try {
|
|
2895
|
-
const root = doc.documentElement;
|
|
2896
|
-
if (context.mode === "none") {
|
|
2897
|
-
root.removeAttribute("data-edit-mode");
|
|
2898
|
-
root.classList.remove("edit-visibility-mode");
|
|
2899
|
-
doc.querySelectorAll("[data-puck-component]").forEach((el) => {
|
|
2900
|
-
el.removeAttribute("data-edit-visibility");
|
|
2901
|
-
el.classList.remove("edit-visibility-greyed", "edit-visibility-editable", "edit-visibility-dependency");
|
|
2902
|
-
});
|
|
2903
|
-
} else {
|
|
2904
|
-
root.setAttribute("data-edit-mode", context.mode);
|
|
2905
|
-
root.classList.add("edit-visibility-mode");
|
|
2906
|
-
doc.querySelectorAll("[data-puck-component]").forEach((el) => {
|
|
2907
|
-
var _a;
|
|
2908
|
-
const id = el.getAttribute("data-puck-component");
|
|
2909
|
-
if (!id) return;
|
|
2910
|
-
const isEditable = context.editableIds.has(id);
|
|
2911
|
-
const isDependency = (_a = context.highlightDependencyIds) == null ? void 0 : _a.has(id);
|
|
2912
|
-
if (isEditable) {
|
|
2913
|
-
el.setAttribute("data-edit-visibility", "editable");
|
|
2914
|
-
el.classList.remove("edit-visibility-greyed", "edit-visibility-dependency");
|
|
2915
|
-
el.classList.add("edit-visibility-editable");
|
|
2916
|
-
} else if (isDependency) {
|
|
2917
|
-
el.setAttribute("data-edit-visibility", "dependency");
|
|
2918
|
-
el.classList.remove("edit-visibility-greyed", "edit-visibility-editable");
|
|
2919
|
-
el.classList.add("edit-visibility-dependency");
|
|
2920
|
-
} else {
|
|
2921
|
-
el.setAttribute("data-edit-visibility", "greyed");
|
|
2922
|
-
el.classList.remove("edit-visibility-editable", "edit-visibility-dependency");
|
|
2923
|
-
el.classList.add("edit-visibility-greyed");
|
|
2924
|
-
}
|
|
2925
|
-
});
|
|
2926
|
-
}
|
|
2927
|
-
} catch (error) {
|
|
2928
|
-
console.warn(`Failed to set edit visibility:`, error);
|
|
2929
|
-
}
|
|
2930
|
-
};
|
|
2931
|
-
var clearEditVisibility = (doc) => {
|
|
2932
|
-
if (!doc) return;
|
|
2933
|
-
try {
|
|
2934
|
-
const root = doc.documentElement;
|
|
2935
|
-
root.removeAttribute("data-edit-mode");
|
|
2936
|
-
root.classList.remove("edit-visibility-mode");
|
|
2937
|
-
doc.querySelectorAll("[data-puck-component]").forEach((el) => {
|
|
2938
|
-
el.removeAttribute("data-edit-visibility");
|
|
2939
|
-
el.classList.remove("edit-visibility-greyed", "edit-visibility-editable", "edit-visibility-dependency");
|
|
2940
|
-
});
|
|
2941
|
-
} catch (error) {
|
|
2942
|
-
console.warn(`Failed to clear edit visibility:`, error);
|
|
2943
|
-
}
|
|
2944
|
-
};
|
|
2945
|
-
|
|
2946
2954
|
// src/puck/store/index.tsx
|
|
2947
|
-
var createSoftConfigStore = (hardConfig = {
|
|
2948
|
-
components: {}
|
|
2949
|
-
}, softComponents = {}, overrides = {}, onActions, showVersionFields = true, customFields = {}) => {
|
|
2955
|
+
var createSoftConfigStore = (hardConfig = { components: {} }, softComponents = {}, overrides = {}, onActions, showVersionFields = true, customFields = {}) => {
|
|
2950
2956
|
const normalizedSoftComponents = Object.fromEntries(
|
|
2951
|
-
Object.entries(softComponents || {}).filter(([key]) => !hardConfig.components || !hardConfig.components[key]).map(([key, value]) => [
|
|
2952
|
-
key,
|
|
2953
|
-
__spreadProps(__spreadValues({}, value), {
|
|
2954
|
-
name: value.name || key
|
|
2955
|
-
})
|
|
2956
|
-
])
|
|
2957
|
+
Object.entries(softComponents || {}).filter(([key]) => !hardConfig.components || !hardConfig.components[key]).map(([key, value]) => [key, __spreadProps(__spreadValues({}, value), { name: value.name || key })])
|
|
2957
2958
|
);
|
|
2958
|
-
const
|
|
2959
|
+
const iframeDoc = null;
|
|
2959
2960
|
const hydratedSoftComponents = (overrides == null ? void 0 : overrides.hydrateMapTransform) ? hydrateSoftComponentsTransforms(
|
|
2960
2961
|
normalizedSoftComponents,
|
|
2961
2962
|
overrides.hydrateMapTransform
|
|
@@ -2964,323 +2965,369 @@ var createSoftConfigStore = (hardConfig = {
|
|
|
2964
2965
|
hydratedSoftComponents
|
|
2965
2966
|
);
|
|
2966
2967
|
return (0, import_zustand2.create)()(
|
|
2967
|
-
(0, import_middleware.subscribeWithSelector)(
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2968
|
+
(0, import_middleware.subscribeWithSelector)((set, get) => ({
|
|
2969
|
+
// ─── Initial State ──────────────────────────────────────────────────────
|
|
2970
|
+
state: "ready",
|
|
2971
|
+
originalHistory: [],
|
|
2972
|
+
overrides,
|
|
2973
|
+
customFields,
|
|
2974
|
+
onActions,
|
|
2975
|
+
iframeDoc,
|
|
2976
|
+
editingComponent: null,
|
|
2977
|
+
editingComponentId: null,
|
|
2978
|
+
editableComponentIds: /* @__PURE__ */ new Set(),
|
|
2979
|
+
itemSelector: null,
|
|
2980
|
+
originalItem: null,
|
|
2981
|
+
hydratedSoftComponents,
|
|
2982
|
+
softComponents: hydratedSoftComponents,
|
|
2983
|
+
dependencyGraph: initialDependencyGraph,
|
|
2984
|
+
showVersionFields,
|
|
2985
|
+
// ─── Initial softConfig ─────────────────────────────────────────────────
|
|
2986
|
+
softConfig: __spreadProps(__spreadValues({}, hardConfig), {
|
|
2987
|
+
components: __spreadValues(__spreadValues({}, hardConfig.components), buildInitialSoftComponents(
|
|
2988
|
+
hardConfig,
|
|
2989
|
+
hydratedSoftComponents,
|
|
2990
|
+
overrides,
|
|
2991
|
+
showVersionFields,
|
|
2992
|
+
customFields
|
|
2993
|
+
)),
|
|
2994
|
+
categories: __spreadValues({}, hardConfig.categories || {})
|
|
2995
|
+
}),
|
|
2996
|
+
// ─── UI Flags ───────────────────────────────────────────────────────────
|
|
2997
|
+
setShowVersionFields: (show) => set({ showVersionFields: show }),
|
|
2998
|
+
// ─── Iframe ─────────────────────────────────────────────────────────────
|
|
2999
|
+
setIframeDoc: (doc) => set({
|
|
3000
|
+
iframeDoc: doc
|
|
3001
|
+
}),
|
|
3002
|
+
// ─── History ────────────────────────────────────────────────────────────
|
|
3003
|
+
storeHistory: (history) => set({ originalHistory: history }),
|
|
3004
|
+
removeHistory: () => set({ originalHistory: [] }),
|
|
3005
|
+
// ─── Item Selection ─────────────────────────────────────────────────────
|
|
3006
|
+
setItemSelector: (selector) => set({ itemSelector: selector }),
|
|
3007
|
+
setOriginalItem: (item) => set({ originalItem: item }),
|
|
3008
|
+
// ─── Editing State ──────────────────────────────────────────────────────
|
|
3009
|
+
setEditableComponentIds: (ids) => set({ editableComponentIds: ids }),
|
|
3010
|
+
addEditableComponentId: (id) => set((state) => {
|
|
3011
|
+
const newIds = new Set(state.editableComponentIds);
|
|
3012
|
+
newIds.add(id);
|
|
3013
|
+
return { editableComponentIds: newIds };
|
|
3014
|
+
}),
|
|
3015
|
+
clearEditingState: () => set({ editingComponentId: null, editableComponentIds: /* @__PURE__ */ new Set() }),
|
|
3016
|
+
// ─── Action Validation ──────────────────────────────────────────────────
|
|
3017
|
+
undoFn: null,
|
|
3018
|
+
setUndoFn: (fn) => set({ undoFn: fn }),
|
|
3019
|
+
validateAction: (action, previousAction) => {
|
|
3020
|
+
var _a;
|
|
3021
|
+
const { state, editableComponentIds, addEditableComponentId } = get();
|
|
3022
|
+
if (state === "ready") return true;
|
|
3023
|
+
if (action.type === "replace") {
|
|
3024
|
+
if ((previousAction == null ? void 0 : previousAction.type) === "insert" && (previousAction == null ? void 0 : previousAction.id) === action.data.props.id) {
|
|
3025
|
+
return true;
|
|
2983
3026
|
}
|
|
2984
|
-
const
|
|
2985
|
-
if (
|
|
2986
|
-
|
|
2987
|
-
mode: "build",
|
|
2988
|
-
editableIds: editableComponentIds
|
|
2989
|
-
});
|
|
2990
|
-
return;
|
|
3027
|
+
const parentId = (_a = action.destinationZone) == null ? void 0 : _a.split(":")[0];
|
|
3028
|
+
if (action.data.props.id && editableComponentIds.has(action.data.props.id)) {
|
|
3029
|
+
return true;
|
|
2991
3030
|
}
|
|
2992
|
-
if (
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
editableIds: editableComponentIds
|
|
2996
|
-
});
|
|
2997
|
-
return;
|
|
3031
|
+
if (parentId && editableComponentIds.has(parentId)) {
|
|
3032
|
+
addEditableComponentId(action.data.props.id);
|
|
3033
|
+
return true;
|
|
2998
3034
|
}
|
|
2999
|
-
|
|
3000
|
-
}
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
softComponents: hydratedSoftComponents,
|
|
3009
|
-
dependencyGraph: initialDependencyGraph,
|
|
3010
|
-
softConfig: __spreadProps(__spreadValues({}, hardConfig), {
|
|
3011
|
-
components: __spreadValues(__spreadValues({}, hardConfig.components), buildInitialSoftComponents(
|
|
3012
|
-
hardConfig,
|
|
3013
|
-
hydratedSoftComponents,
|
|
3014
|
-
overrides,
|
|
3015
|
-
showVersionFields,
|
|
3016
|
-
customFields
|
|
3017
|
-
)),
|
|
3018
|
-
categories: __spreadValues({}, hardConfig.categories || {})
|
|
3019
|
-
}),
|
|
3020
|
-
setSoftComponent: (name, version, component) => {
|
|
3021
|
-
if (hardConfig.components && hardConfig.components[name]) {
|
|
3022
|
-
console.warn(`Cannot set soft component "${name}" because it conflicts with a base hardConfig component.`);
|
|
3023
|
-
return;
|
|
3035
|
+
return false;
|
|
3036
|
+
}
|
|
3037
|
+
if (action.type === "insert" || action.type === "duplicate") {
|
|
3038
|
+
const zone = action.type === "insert" ? action.destinationZone : action.sourceZone;
|
|
3039
|
+
const parentId = zone == null ? void 0 : zone.split(":")[0];
|
|
3040
|
+
const isEditable = parentId && editableComponentIds.has(parentId);
|
|
3041
|
+
if (!isEditable && action.type === "duplicate") return false;
|
|
3042
|
+
if (action.type === "insert" && action.id && isEditable) {
|
|
3043
|
+
addEditableComponentId(action.id);
|
|
3024
3044
|
}
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3045
|
+
}
|
|
3046
|
+
if (action.type === "remove" || action.type === "move" || action.type === "reorder") {
|
|
3047
|
+
const zone = action.type === "remove" ? action.zone : action.destinationZone;
|
|
3048
|
+
const parentId = zone == null ? void 0 : zone.split(":")[0];
|
|
3049
|
+
if (parentId && !editableComponentIds.has(parentId)) return false;
|
|
3050
|
+
return true;
|
|
3051
|
+
}
|
|
3052
|
+
return true;
|
|
3053
|
+
},
|
|
3054
|
+
// ─── Soft Component CRUD ─────────────────────────────────────────────────
|
|
3055
|
+
setSoftComponent: (name, version, component) => {
|
|
3056
|
+
var _a;
|
|
3057
|
+
if ((_a = hardConfig.components) == null ? void 0 : _a[name]) {
|
|
3058
|
+
console.warn(
|
|
3059
|
+
`Cannot set soft component "${name}" because it conflicts with a hardConfig component.`
|
|
3060
|
+
);
|
|
3061
|
+
return;
|
|
3062
|
+
}
|
|
3063
|
+
const existing = get().softComponents[name];
|
|
3064
|
+
set((state) => {
|
|
3065
|
+
var _a2, _b;
|
|
3066
|
+
return {
|
|
3067
|
+
softComponents: __spreadProps(__spreadValues({}, state.softComponents), {
|
|
3068
|
+
[name]: __spreadProps(__spreadValues({}, existing), {
|
|
3069
|
+
name: component.name || (existing == null ? void 0 : existing.name) || name,
|
|
3070
|
+
category: (_a2 = component.category) != null ? _a2 : existing == null ? void 0 : existing.category,
|
|
3071
|
+
defaultVersion: version,
|
|
3072
|
+
versions: __spreadProps(__spreadValues({}, ((_b = state.softComponents[name]) == null ? void 0 : _b.versions) || {}), {
|
|
3073
|
+
[version]: component
|
|
3037
3074
|
})
|
|
3038
3075
|
})
|
|
3039
|
-
};
|
|
3040
|
-
});
|
|
3041
|
-
},
|
|
3042
|
-
setSoftComponents: (incomingComponents) => {
|
|
3043
|
-
const state = get();
|
|
3044
|
-
const nextSoftComponents = __spreadValues({}, state.softComponents);
|
|
3045
|
-
const nextConfigComponents = __spreadValues({}, state.softConfig.components);
|
|
3046
|
-
Object.entries(incomingComponents).forEach(([name, data]) => {
|
|
3047
|
-
if (hardConfig.components && hardConfig.components[name]) {
|
|
3048
|
-
return;
|
|
3049
|
-
}
|
|
3050
|
-
const existing = nextSoftComponents[name];
|
|
3051
|
-
const finalComponentData = existing ? __spreadProps(__spreadValues(__spreadValues({}, existing), data), {
|
|
3052
|
-
name: data.name || existing.name || name,
|
|
3053
|
-
versions: __spreadValues(__spreadValues({}, existing.versions), data.versions)
|
|
3054
|
-
}) : data;
|
|
3055
|
-
finalComponentData.name = finalComponentData.name || name;
|
|
3056
|
-
nextSoftComponents[name] = finalComponentData;
|
|
3057
|
-
const activeVersion = finalComponentData.defaultVersion;
|
|
3058
|
-
const activeVersionData = finalComponentData.versions[activeVersion];
|
|
3059
|
-
if (activeVersionData) {
|
|
3060
|
-
nextConfigComponents[name] = createVersionedComponentConfig(
|
|
3061
|
-
name,
|
|
3062
|
-
finalComponentData.name || name,
|
|
3063
|
-
activeVersion,
|
|
3064
|
-
Object.keys(finalComponentData.versions),
|
|
3065
|
-
state.softConfig,
|
|
3066
|
-
nextSoftComponents,
|
|
3067
|
-
activeVersionData.defaultProps,
|
|
3068
|
-
state.showVersionFields,
|
|
3069
|
-
state.customFields
|
|
3070
|
-
);
|
|
3071
|
-
}
|
|
3072
|
-
});
|
|
3073
|
-
set({
|
|
3074
|
-
softComponents: nextSoftComponents,
|
|
3075
|
-
softConfig: __spreadProps(__spreadValues({}, state.softConfig), {
|
|
3076
|
-
components: nextConfigComponents
|
|
3077
3076
|
})
|
|
3078
|
-
}
|
|
3079
|
-
}
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
)
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3077
|
+
};
|
|
3078
|
+
});
|
|
3079
|
+
},
|
|
3080
|
+
setSoftComponents: (incomingComponents) => {
|
|
3081
|
+
const state = get();
|
|
3082
|
+
const nextSoftComponents = __spreadValues({}, state.softComponents);
|
|
3083
|
+
const nextConfigComponents = __spreadValues({}, state.softConfig.components);
|
|
3084
|
+
Object.entries(incomingComponents).forEach(([name, data]) => {
|
|
3085
|
+
var _a;
|
|
3086
|
+
if ((_a = hardConfig.components) == null ? void 0 : _a[name]) return;
|
|
3087
|
+
const existing = nextSoftComponents[name];
|
|
3088
|
+
const merged = existing ? __spreadProps(__spreadValues(__spreadValues({}, existing), data), {
|
|
3089
|
+
name: data.name || existing.name || name,
|
|
3090
|
+
versions: __spreadValues(__spreadValues({}, existing.versions), data.versions)
|
|
3091
|
+
}) : data;
|
|
3092
|
+
merged.name = merged.name || name;
|
|
3093
|
+
nextSoftComponents[name] = merged;
|
|
3094
|
+
const activeVersion = merged.defaultVersion;
|
|
3095
|
+
const activeVersionData = merged.versions[activeVersion];
|
|
3096
|
+
if (activeVersionData) {
|
|
3097
|
+
nextConfigComponents[name] = createVersionedComponentConfig(
|
|
3098
|
+
name,
|
|
3099
|
+
merged.name,
|
|
3100
|
+
activeVersion,
|
|
3101
|
+
Object.keys(merged.versions),
|
|
3102
|
+
state.softConfig,
|
|
3103
|
+
nextSoftComponents,
|
|
3104
|
+
activeVersionData.defaultProps,
|
|
3105
|
+
state.showVersionFields,
|
|
3106
|
+
state.customFields
|
|
3107
|
+
);
|
|
3108
|
+
}
|
|
3109
|
+
});
|
|
3110
|
+
set({
|
|
3111
|
+
softComponents: nextSoftComponents,
|
|
3112
|
+
softConfig: __spreadProps(__spreadValues({}, state.softConfig), { components: nextConfigComponents })
|
|
3113
|
+
});
|
|
3114
|
+
},
|
|
3115
|
+
hydrateTransforms: () => {
|
|
3116
|
+
const { overrides: overrides2, softComponents: softComponents2, softConfig } = get();
|
|
3117
|
+
if (!(overrides2 == null ? void 0 : overrides2.hydrateMapTransform)) return;
|
|
3118
|
+
const hydratedComponents = hydrateSoftComponentsTransforms(
|
|
3119
|
+
softComponents2,
|
|
3120
|
+
overrides2.hydrateMapTransform
|
|
3121
|
+
);
|
|
3122
|
+
const nextConfigComponents = __spreadValues({}, softConfig.components);
|
|
3123
|
+
Object.entries(hydratedComponents).forEach(([name, componentData]) => {
|
|
3124
|
+
const activeVersion = componentData.defaultVersion;
|
|
3125
|
+
const activeVersionData = componentData.versions[activeVersion];
|
|
3126
|
+
if (activeVersionData) {
|
|
3127
|
+
nextConfigComponents[name] = createVersionedComponentConfig(
|
|
3128
|
+
name,
|
|
3129
|
+
componentData.name || name,
|
|
3130
|
+
activeVersion,
|
|
3131
|
+
Object.keys(componentData.versions),
|
|
3132
|
+
softConfig,
|
|
3133
|
+
hydratedComponents,
|
|
3134
|
+
activeVersionData.defaultProps,
|
|
3135
|
+
get().showVersionFields,
|
|
3136
|
+
get().customFields
|
|
3122
3137
|
);
|
|
3123
3138
|
}
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3139
|
+
});
|
|
3140
|
+
set({
|
|
3141
|
+
softComponents: hydratedComponents,
|
|
3142
|
+
softConfig: __spreadProps(__spreadValues({}, softConfig), { components: nextConfigComponents })
|
|
3143
|
+
});
|
|
3144
|
+
},
|
|
3145
|
+
setSoftComponentDefaultVersion: (name, version) => {
|
|
3146
|
+
var _a, _b, _c, _d;
|
|
3147
|
+
const state = get();
|
|
3148
|
+
const softComponent = (_b = (_a = state.softComponents[name]) == null ? void 0 : _a.versions) == null ? void 0 : _b[version];
|
|
3149
|
+
if (!softComponent) {
|
|
3150
|
+
throw new Error(
|
|
3151
|
+
`Soft component "${name}" version "${version}" does not exist.`
|
|
3134
3152
|
);
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3153
|
+
}
|
|
3154
|
+
const allVersions = Object.keys(
|
|
3155
|
+
((_c = state.softComponents[name]) == null ? void 0 : _c.versions) || {}
|
|
3156
|
+
);
|
|
3157
|
+
const displayName = ((_d = state.softComponents[name]) == null ? void 0 : _d.name) || name;
|
|
3158
|
+
const newConfig = createVersionedComponentConfig(
|
|
3159
|
+
name,
|
|
3160
|
+
displayName,
|
|
3161
|
+
version,
|
|
3162
|
+
allVersions,
|
|
3163
|
+
state.softConfig,
|
|
3164
|
+
state.softComponents,
|
|
3165
|
+
softComponent.defaultProps,
|
|
3166
|
+
state.showVersionFields,
|
|
3167
|
+
state.customFields
|
|
3168
|
+
);
|
|
3169
|
+
set((s) => ({
|
|
3170
|
+
softConfig: __spreadProps(__spreadValues({}, s.softConfig), {
|
|
3171
|
+
components: __spreadProps(__spreadValues({}, s.softConfig.components), { [name]: newConfig })
|
|
3172
|
+
}),
|
|
3173
|
+
softComponents: __spreadProps(__spreadValues({}, s.softComponents), {
|
|
3174
|
+
[name]: __spreadProps(__spreadValues({}, s.softComponents[name]), { defaultVersion: version })
|
|
3175
|
+
})
|
|
3176
|
+
}));
|
|
3177
|
+
},
|
|
3178
|
+
removeSoftComponentVersion: (key, version) => {
|
|
3179
|
+
set((state) => {
|
|
3180
|
+
const component = state.softComponents[key];
|
|
3181
|
+
if (!component) return {};
|
|
3182
|
+
const newVersions = Object.fromEntries(
|
|
3183
|
+
Object.entries(component.versions || {}).filter(
|
|
3184
|
+
([k]) => k !== version
|
|
3185
|
+
)
|
|
3186
|
+
);
|
|
3187
|
+
let newDefaultVersion = component.defaultVersion;
|
|
3188
|
+
if (component.defaultVersion === version) {
|
|
3189
|
+
const versionKeys = Object.keys(newVersions);
|
|
3190
|
+
newDefaultVersion = versionKeys.length > 0 ? versionKeys[versionKeys.length - 1] : "";
|
|
3191
|
+
}
|
|
3192
|
+
return {
|
|
3141
3193
|
softComponents: __spreadProps(__spreadValues({}, state.softComponents), {
|
|
3142
|
-
[
|
|
3143
|
-
|
|
3194
|
+
[key]: __spreadProps(__spreadValues({}, component), {
|
|
3195
|
+
versions: newVersions,
|
|
3196
|
+
defaultVersion: newDefaultVersion
|
|
3144
3197
|
})
|
|
3145
3198
|
})
|
|
3146
|
-
}
|
|
3147
|
-
}
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
if (component.defaultVersion === version) {
|
|
3159
|
-
const versionKeys = Object.keys(newVersions);
|
|
3160
|
-
newDefaultVersion = versionKeys.length > 0 ? versionKeys[versionKeys.length - 1] : "";
|
|
3161
|
-
}
|
|
3162
|
-
return {
|
|
3163
|
-
softComponents: __spreadProps(__spreadValues({}, state.softComponents), {
|
|
3164
|
-
[key]: __spreadProps(__spreadValues({}, component), {
|
|
3165
|
-
versions: newVersions,
|
|
3166
|
-
defaultVersion: newDefaultVersion
|
|
3167
|
-
})
|
|
3168
|
-
})
|
|
3169
|
-
};
|
|
3170
|
-
});
|
|
3171
|
-
},
|
|
3172
|
-
removeSoftComponent: (key) => {
|
|
3173
|
-
set((state) => ({
|
|
3174
|
-
softComponents: Object.fromEntries(
|
|
3175
|
-
Object.entries(state.softComponents).filter(([k, _]) => k !== key)
|
|
3176
|
-
)
|
|
3177
|
-
}));
|
|
3178
|
-
},
|
|
3179
|
-
setSoftComponentConfig: (key, config, category) => {
|
|
3180
|
-
set((state) => {
|
|
3181
|
-
var _a, _b, _c;
|
|
3182
|
-
return {
|
|
3183
|
-
softConfig: __spreadProps(__spreadValues({}, state.softConfig), {
|
|
3184
|
-
components: __spreadProps(__spreadValues({}, state.softConfig.components), {
|
|
3185
|
-
[key]: __spreadValues({}, config)
|
|
3186
|
-
}),
|
|
3187
|
-
categories: category ? __spreadProps(__spreadValues({}, state.softConfig.categories || {}), {
|
|
3188
|
-
[category]: __spreadProps(__spreadValues({}, ((_a = state.softConfig.categories) == null ? void 0 : _a[category]) || {}), {
|
|
3189
|
-
components: [
|
|
3190
|
-
...((_c = (_b = state.softConfig.categories) == null ? void 0 : _b[category]) == null ? void 0 : _c.components) || [],
|
|
3191
|
-
key
|
|
3192
|
-
]
|
|
3193
|
-
})
|
|
3194
|
-
}) : state.softConfig.categories || {}
|
|
3195
|
-
})
|
|
3196
|
-
};
|
|
3197
|
-
});
|
|
3198
|
-
},
|
|
3199
|
-
removeSoftComponentConfig: (key) => {
|
|
3200
|
-
set((state) => ({
|
|
3199
|
+
};
|
|
3200
|
+
});
|
|
3201
|
+
},
|
|
3202
|
+
removeSoftComponent: (key) => set((state) => ({
|
|
3203
|
+
softComponents: Object.fromEntries(
|
|
3204
|
+
Object.entries(state.softComponents).filter(([k]) => k !== key)
|
|
3205
|
+
)
|
|
3206
|
+
})),
|
|
3207
|
+
setSoftComponentConfig: (key, config, category) => {
|
|
3208
|
+
set((state) => {
|
|
3209
|
+
var _a, _b, _c;
|
|
3210
|
+
return {
|
|
3201
3211
|
softConfig: __spreadProps(__spreadValues({}, state.softConfig), {
|
|
3202
|
-
components:
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
set((state) => {
|
|
3212
|
-
var _a;
|
|
3213
|
-
return {
|
|
3214
|
-
softConfig: __spreadProps(__spreadValues({}, state.softConfig), {
|
|
3215
|
-
categories: __spreadProps(__spreadValues({}, state.softConfig.categories), {
|
|
3216
|
-
[key]: __spreadValues(__spreadValues({}, (_a = state.softConfig.categories) == null ? void 0 : _a[key]), category)
|
|
3212
|
+
components: __spreadProps(__spreadValues({}, state.softConfig.components), {
|
|
3213
|
+
[key]: __spreadValues({}, config)
|
|
3214
|
+
}),
|
|
3215
|
+
categories: category ? __spreadProps(__spreadValues({}, state.softConfig.categories || {}), {
|
|
3216
|
+
[category]: __spreadProps(__spreadValues({}, ((_a = state.softConfig.categories) == null ? void 0 : _a[category]) || {}), {
|
|
3217
|
+
components: [
|
|
3218
|
+
...((_c = (_b = state.softConfig.categories) == null ? void 0 : _b[category]) == null ? void 0 : _c.components) || [],
|
|
3219
|
+
key
|
|
3220
|
+
]
|
|
3217
3221
|
})
|
|
3218
|
-
})
|
|
3219
|
-
};
|
|
3220
|
-
});
|
|
3221
|
-
},
|
|
3222
|
-
removeSoftCategoryConfig: (key) => {
|
|
3223
|
-
set((state) => ({
|
|
3224
|
-
softConfig: __spreadProps(__spreadValues({}, state.softConfig), {
|
|
3225
|
-
categories: Object.fromEntries(
|
|
3226
|
-
Object.entries(state.softConfig.categories || {}).filter(
|
|
3227
|
-
([k, _]) => k !== key
|
|
3228
|
-
)
|
|
3229
|
-
)
|
|
3222
|
+
}) : state.softConfig.categories || {}
|
|
3230
3223
|
})
|
|
3231
|
-
}
|
|
3232
|
-
}
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3224
|
+
};
|
|
3225
|
+
});
|
|
3226
|
+
},
|
|
3227
|
+
removeSoftComponentConfig: (key) => set((state) => ({
|
|
3228
|
+
softConfig: __spreadProps(__spreadValues({}, state.softConfig), {
|
|
3229
|
+
components: Object.fromEntries(
|
|
3230
|
+
Object.entries(state.softConfig.components).filter(
|
|
3231
|
+
([k]) => k !== key
|
|
3232
|
+
)
|
|
3233
|
+
)
|
|
3234
|
+
})
|
|
3235
|
+
})),
|
|
3236
|
+
setSoftCategoryConfig: (key, category) => set((state) => {
|
|
3237
|
+
var _a;
|
|
3238
|
+
return {
|
|
3239
|
+
softConfig: __spreadProps(__spreadValues({}, state.softConfig), {
|
|
3240
|
+
categories: __spreadProps(__spreadValues({}, state.softConfig.categories), {
|
|
3241
|
+
[key]: __spreadValues(__spreadValues({}, (_a = state.softConfig.categories) == null ? void 0 : _a[key]), category)
|
|
3242
|
+
})
|
|
3243
|
+
})
|
|
3244
|
+
};
|
|
3245
|
+
}),
|
|
3246
|
+
removeSoftCategoryConfig: (key) => set((state) => ({
|
|
3247
|
+
softConfig: __spreadProps(__spreadValues({}, state.softConfig), {
|
|
3248
|
+
categories: Object.fromEntries(
|
|
3249
|
+
Object.entries(state.softConfig.categories || {}).filter(
|
|
3250
|
+
([k]) => k !== key
|
|
3251
|
+
)
|
|
3252
|
+
)
|
|
3253
|
+
})
|
|
3254
|
+
})),
|
|
3255
|
+
// ─── Builder Slice ────────────────────────────────────────────────────────
|
|
3256
|
+
builder: createBuildersSlice(set, get, hardConfig),
|
|
3257
|
+
// ─── Dependency Graph ─────────────────────────────────────────────────────
|
|
3258
|
+
rebuildDependents: (componentName) => {
|
|
3259
|
+
const state = get();
|
|
3260
|
+
const dependents = state.dependencyGraph.get(componentName) || /* @__PURE__ */ new Set();
|
|
3261
|
+
if (dependents.size === 0) return;
|
|
3262
|
+
const nextConfig = __spreadValues({}, state.softConfig);
|
|
3263
|
+
const { softComponents: softComponents2 } = state;
|
|
3264
|
+
for (const dependentName of Array.from(dependents)) {
|
|
3265
|
+
const dependent = softComponents2[dependentName];
|
|
3266
|
+
const defaultVersion = dependent.defaultVersion || Object.keys(dependent.versions || {}).pop();
|
|
3267
|
+
if (!defaultVersion) continue;
|
|
3268
|
+
const versionedComponent = dependent.versions[defaultVersion];
|
|
3269
|
+
if (!versionedComponent) continue;
|
|
3270
|
+
nextConfig.components[dependentName] = createVersionedComponentConfig(
|
|
3271
|
+
dependentName,
|
|
3272
|
+
dependent.name || dependentName,
|
|
3273
|
+
defaultVersion,
|
|
3274
|
+
Object.keys(dependent.versions || {}),
|
|
3275
|
+
nextConfig,
|
|
3276
|
+
softComponents2,
|
|
3277
|
+
versionedComponent.defaultProps,
|
|
3278
|
+
state.showVersionFields,
|
|
3279
|
+
state.customFields
|
|
3280
|
+
);
|
|
3276
3281
|
}
|
|
3277
|
-
|
|
3278
|
-
|
|
3282
|
+
set((s) => __spreadProps(__spreadValues({}, s), { softConfig: nextConfig }));
|
|
3283
|
+
}
|
|
3284
|
+
}))
|
|
3279
3285
|
);
|
|
3280
3286
|
};
|
|
3281
3287
|
|
|
3282
3288
|
// src/puck/context/storeProvider.tsx
|
|
3283
3289
|
var import_react5 = require("react");
|
|
3290
|
+
|
|
3291
|
+
// src/puck/lib/notify.ts
|
|
3292
|
+
var customHandler = null;
|
|
3293
|
+
var defaultHandler = (message, type) => {
|
|
3294
|
+
if (type === "error") {
|
|
3295
|
+
console.error(`[Error] ${message}`);
|
|
3296
|
+
} else {
|
|
3297
|
+
console.log(`[Success] ${message}`);
|
|
3298
|
+
}
|
|
3299
|
+
};
|
|
3300
|
+
var setNotificationHandler = (handler) => {
|
|
3301
|
+
customHandler = handler;
|
|
3302
|
+
};
|
|
3303
|
+
var notify = {
|
|
3304
|
+
error: (message) => {
|
|
3305
|
+
const handler = customHandler || defaultHandler;
|
|
3306
|
+
handler(message, "error");
|
|
3307
|
+
},
|
|
3308
|
+
success: (message) => {
|
|
3309
|
+
const handler = customHandler || defaultHandler;
|
|
3310
|
+
handler(message, "success");
|
|
3311
|
+
}
|
|
3312
|
+
};
|
|
3313
|
+
|
|
3314
|
+
// src/puck/lib/action-callback.ts
|
|
3315
|
+
var createActionCallback = (validateAction, undo) => {
|
|
3316
|
+
return (action) => {
|
|
3317
|
+
if (!undo) {
|
|
3318
|
+
return;
|
|
3319
|
+
}
|
|
3320
|
+
const isValid = validateAction(action);
|
|
3321
|
+
if (!isValid) {
|
|
3322
|
+
notify.error(
|
|
3323
|
+
"Editing outside the soft component is not allowed when you are editing component definition."
|
|
3324
|
+
);
|
|
3325
|
+
requestAnimationFrame(() => undo());
|
|
3326
|
+
}
|
|
3327
|
+
};
|
|
3328
|
+
};
|
|
3329
|
+
|
|
3330
|
+
// src/puck/context/storeProvider.tsx
|
|
3284
3331
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3285
3332
|
var SoftConfigProvider = ({
|
|
3286
3333
|
children,
|
|
@@ -3316,57 +3363,8 @@ var SoftConfigProvider = ({
|
|
|
3316
3363
|
const [internalSoftComponents, setSoftComponents] = (0, import_react5.useState)(
|
|
3317
3364
|
() => store.getState().softComponents
|
|
3318
3365
|
);
|
|
3319
|
-
const
|
|
3320
|
-
() =>
|
|
3321
|
-
[store]
|
|
3322
|
-
);
|
|
3323
|
-
const validateAction = (0, import_react5.useMemo)(
|
|
3324
|
-
() => (action) => {
|
|
3325
|
-
var _a;
|
|
3326
|
-
const currentState = store.getState();
|
|
3327
|
-
if (currentState.state === "ready") {
|
|
3328
|
-
return true;
|
|
3329
|
-
}
|
|
3330
|
-
const editableIds = currentState.editableComponentIds;
|
|
3331
|
-
if (action.type === "replace") {
|
|
3332
|
-
const parentId = (_a = action.destinationZone) == null ? void 0 : _a.split(":")[0];
|
|
3333
|
-
if (action.data.props.id && editableIds.has(action.data.props.id)) {
|
|
3334
|
-
return true;
|
|
3335
|
-
} else if (parentId && editableIds.has(parentId)) {
|
|
3336
|
-
currentState.addEditableComponentId(action.data.props.id);
|
|
3337
|
-
return true;
|
|
3338
|
-
}
|
|
3339
|
-
return false;
|
|
3340
|
-
}
|
|
3341
|
-
if (action.type === "insert" || action.type === "duplicate") {
|
|
3342
|
-
const zone = action.type === "insert" ? action.destinationZone : action.sourceZone;
|
|
3343
|
-
const parentId = zone == null ? void 0 : zone.split(":")[0];
|
|
3344
|
-
if (parentId && !editableIds.has(parentId)) {
|
|
3345
|
-
return false;
|
|
3346
|
-
}
|
|
3347
|
-
if (action.type === "insert") {
|
|
3348
|
-
const childId = action.id;
|
|
3349
|
-
if (childId) {
|
|
3350
|
-
currentState.addEditableComponentId(childId);
|
|
3351
|
-
}
|
|
3352
|
-
}
|
|
3353
|
-
return true;
|
|
3354
|
-
}
|
|
3355
|
-
if (action.type === "remove" || action.type === "move" || action.type === "reorder") {
|
|
3356
|
-
let parentId;
|
|
3357
|
-
if (action.type === "remove") {
|
|
3358
|
-
parentId = action.zone.split(":")[0];
|
|
3359
|
-
} else if (action.type === "move" || action.type === "reorder") {
|
|
3360
|
-
parentId = action.destinationZone.split(":")[0];
|
|
3361
|
-
}
|
|
3362
|
-
if (parentId && !editableIds.has(parentId)) {
|
|
3363
|
-
return false;
|
|
3364
|
-
}
|
|
3365
|
-
return true;
|
|
3366
|
-
}
|
|
3367
|
-
return true;
|
|
3368
|
-
},
|
|
3369
|
-
[store]
|
|
3366
|
+
const [actionGuard, setActionGuard] = (0, import_react5.useState)(
|
|
3367
|
+
(action) => null
|
|
3370
3368
|
);
|
|
3371
3369
|
(0, import_react5.useEffect)(() => {
|
|
3372
3370
|
const unsubscribe = store.subscribe(() => {
|
|
@@ -3379,59 +3377,26 @@ var SoftConfigProvider = ({
|
|
|
3379
3377
|
}, [store]);
|
|
3380
3378
|
(0, import_react5.useEffect)(() => {
|
|
3381
3379
|
const unsubscribe = store.subscribe((state, prevState) => {
|
|
3382
|
-
if (prevState &&
|
|
3383
|
-
return;
|
|
3384
|
-
}
|
|
3385
|
-
const doc = store.getState().getIframeDoc();
|
|
3386
|
-
if (!doc) return;
|
|
3387
|
-
if (state.state === "building") {
|
|
3388
|
-
setEditVisibility(doc, { mode: "build", editableIds: state.editableComponentIds });
|
|
3380
|
+
if (prevState && prevState.undoFn === state.undoFn) {
|
|
3389
3381
|
return;
|
|
3390
3382
|
}
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
if (freshDoc) {
|
|
3398
|
-
clearEditVisibility(freshDoc);
|
|
3399
|
-
}
|
|
3400
|
-
});
|
|
3383
|
+
setActionGuard(
|
|
3384
|
+
() => createActionCallback(
|
|
3385
|
+
state.validateAction,
|
|
3386
|
+
state.undoFn
|
|
3387
|
+
)
|
|
3388
|
+
);
|
|
3401
3389
|
});
|
|
3402
3390
|
return () => {
|
|
3403
3391
|
unsubscribe();
|
|
3404
3392
|
};
|
|
3405
|
-
}, [store]);
|
|
3406
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(appStoreContext.Provider, { value: store, children: children(softConfig, internalSoftComponents,
|
|
3393
|
+
}, [store.getState().undoFn]);
|
|
3394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(appStoreContext.Provider, { value: store, children: children(softConfig, internalSoftComponents, actionGuard) });
|
|
3407
3395
|
};
|
|
3408
3396
|
|
|
3409
3397
|
// src/puck/actions/useBuild.tsx
|
|
3410
3398
|
var import_puck5 = require("@measured/puck");
|
|
3411
3399
|
|
|
3412
|
-
// src/puck/lib/notify.ts
|
|
3413
|
-
var customHandler = null;
|
|
3414
|
-
var defaultHandler = (message, type) => {
|
|
3415
|
-
if (type === "error") {
|
|
3416
|
-
console.error(`[Error] ${message}`);
|
|
3417
|
-
} else {
|
|
3418
|
-
console.log(`[Success] ${message}`);
|
|
3419
|
-
}
|
|
3420
|
-
};
|
|
3421
|
-
var setNotificationHandler = (handler) => {
|
|
3422
|
-
customHandler = handler;
|
|
3423
|
-
};
|
|
3424
|
-
var notify = {
|
|
3425
|
-
error: (message) => {
|
|
3426
|
-
const handler = customHandler || defaultHandler;
|
|
3427
|
-
handler(message, "error");
|
|
3428
|
-
},
|
|
3429
|
-
success: (message) => {
|
|
3430
|
-
const handler = customHandler || defaultHandler;
|
|
3431
|
-
handler(message, "success");
|
|
3432
|
-
}
|
|
3433
|
-
};
|
|
3434
|
-
|
|
3435
3400
|
// src/puck/hooks/useActionEvent.ts
|
|
3436
3401
|
var import_react6 = require("react");
|
|
3437
3402
|
var useActionEvent = () => {
|
|
@@ -3809,7 +3774,7 @@ var useSetDefaultVersion = () => {
|
|
|
3809
3774
|
// src/puck/overrides/Header.tsx
|
|
3810
3775
|
var import_puck13 = require("@measured/puck");
|
|
3811
3776
|
|
|
3812
|
-
// css-module:/
|
|
3777
|
+
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/Header.module.css#css-module
|
|
3813
3778
|
var Header_module_default = { "Header": "_Header_19oj9_1" };
|
|
3814
3779
|
|
|
3815
3780
|
// src/puck/actions/usePublish.tsx
|
|
@@ -3858,7 +3823,6 @@ var Header = ({
|
|
|
3858
3823
|
const { handleComplete, newComponent, setNewComponent } = useComplete();
|
|
3859
3824
|
const { handleCancel, canCancel } = useCancel();
|
|
3860
3825
|
const { handlePublish } = usePublish();
|
|
3861
|
-
const puck = usePuck((s) => s.config);
|
|
3862
3826
|
useInspect(newComponent);
|
|
3863
3827
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName2(), children: canCancel ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3864
3828
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_puck13.Button, { onClick: handleCancel, children: "Cancel" }),
|
|
@@ -3894,7 +3858,7 @@ var import_react9 = require("react");
|
|
|
3894
3858
|
var import_puck14 = require("@measured/puck");
|
|
3895
3859
|
var import_lucide_react = require("lucide-react");
|
|
3896
3860
|
|
|
3897
|
-
// css-module:/
|
|
3861
|
+
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/ActionBar.module.css#css-module
|
|
3898
3862
|
var ActionBar_module_default = { "ActionBar": "_ActionBar_pvuie_5", "ActionBar-label": "_ActionBar-label_pvuie_39", "ActionBar-action": "_ActionBar-action_pvuie_63", "ActionBar-group": "_ActionBar-group_pvuie_79" };
|
|
3899
3863
|
|
|
3900
3864
|
// src/puck/overrides/ActionBar.tsx
|
|
@@ -3920,7 +3884,7 @@ var ActionBarOverride = (props) => {
|
|
|
3920
3884
|
if (selectedType && softKeys.includes(selectedType)) {
|
|
3921
3885
|
return selectedType;
|
|
3922
3886
|
}
|
|
3923
|
-
return
|
|
3887
|
+
return componentNameFromLabel(props.label || "", overrides, __spreadProps(__spreadValues({}, rootProps || {}), {
|
|
3924
3888
|
existingKeys: softKeys,
|
|
3925
3889
|
state: status
|
|
3926
3890
|
}));
|
|
@@ -3936,17 +3900,17 @@ var ActionBarOverride = (props) => {
|
|
|
3936
3900
|
const selectedId = (_a = selectedItem == null ? void 0 : selectedItem.props) == null ? void 0 : _a.id;
|
|
3937
3901
|
const parentId = (_b = itemSelector == null ? void 0 : itemSelector.zone) == null ? void 0 : _b.split(":")[0];
|
|
3938
3902
|
const isEditable = Boolean(selectedId && (editableIds.has(selectedId) || parentId && editableIds.has(parentId)));
|
|
3939
|
-
const
|
|
3903
|
+
const label = (0, import_react9.useMemo)(() => {
|
|
3940
3904
|
var _a2;
|
|
3941
3905
|
if (isSoftComponent2) {
|
|
3942
|
-
return ((_a2 = softComponents[key]) == null ? void 0 : _a2.name) ||
|
|
3906
|
+
return ((_a2 = softComponents[key]) == null ? void 0 : _a2.name) || componentLabelFromName(key, overrides);
|
|
3943
3907
|
}
|
|
3944
3908
|
return props.label || "";
|
|
3945
3909
|
}, [isSoftComponent2, key, props.label, overrides, softComponents]);
|
|
3946
3910
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName3(), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_puck14.ActionBar, { children: [
|
|
3947
3911
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_puck14.ActionBar.Group, { children: [
|
|
3948
3912
|
props.parentAction,
|
|
3949
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_puck14.ActionBar.Label, { label
|
|
3913
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_puck14.ActionBar.Label, { label })
|
|
3950
3914
|
] }),
|
|
3951
3915
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_puck14.ActionBar.Group, { children: [
|
|
3952
3916
|
status === "ready" ? isSoftComponent2 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
@@ -4001,14 +3965,14 @@ var confirm = (message) => __async(null, null, function* () {
|
|
|
4001
3965
|
}
|
|
4002
3966
|
});
|
|
4003
3967
|
|
|
4004
|
-
// css-module:/
|
|
3968
|
+
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/DrawerItem.module.css#css-module
|
|
4005
3969
|
var DrawerItem_module_default = { "DrawerItem": "_DrawerItem_182aj_1", "DrawerItem--insertDisabled": "_DrawerItem--insertDisabled_182aj_14", "DrawerItem-content": "_DrawerItem-content_182aj_21", "DrawerItem-name": "_DrawerItem-name_182aj_31", "DrawerItem-version": "_DrawerItem-version_182aj_35", "DrawerItem-actions": "_DrawerItem-actions_182aj_40", "DrawerItem-settingsButton": "_DrawerItem-settingsButton_182aj_46", "DrawerItem-grip": "_DrawerItem-grip_182aj_56", "DrawerItem-modal": "_DrawerItem-modal_182aj_63", "DrawerItem-modalHeader": "_DrawerItem-modalHeader_182aj_71", "DrawerItem-modalTitle": "_DrawerItem-modalTitle_182aj_77", "DrawerItem-modalSubtitle": "_DrawerItem-modalSubtitle_182aj_84", "DrawerItem-modalBody": "_DrawerItem-modalBody_182aj_90", "DrawerItem-section": "_DrawerItem-section_182aj_100", "DrawerItem-sectionTitle": "_DrawerItem-sectionTitle_182aj_106", "DrawerItem-sectionDescription": "_DrawerItem-sectionDescription_182aj_113", "DrawerItem-versionList": "_DrawerItem-versionList_182aj_119", "DrawerItem-versionRow": "_DrawerItem-versionRow_182aj_125", "DrawerItem-versionRow--isDefault": "_DrawerItem-versionRow--isDefault_182aj_136", "DrawerItem-versionRow--isMarkedForDeletion": "_DrawerItem-versionRow--isMarkedForDeletion_182aj_141", "DrawerItem-versionInfo": "_DrawerItem-versionInfo_182aj_146", "DrawerItem-versionNumber": "_DrawerItem-versionNumber_182aj_153", "DrawerItem-defaultBadge": "_DrawerItem-defaultBadge_182aj_159", "DrawerItem-deleteBadge": "_DrawerItem-deleteBadge_182aj_170", "DrawerItem-versionActions": "_DrawerItem-versionActions_182aj_181", "DrawerItem-migrationOptions": "_DrawerItem-migrationOptions_182aj_187", "DrawerItem-migrationList": "_DrawerItem-migrationList_182aj_191", "DrawerItem-migrationOption": "_DrawerItem-migrationOption_182aj_187", "DrawerItem-migrationOption--isSelected": "_DrawerItem-migrationOption--isSelected_182aj_229", "DrawerItem-migrationOptionLabel": "_DrawerItem-migrationOptionLabel_182aj_234", "DrawerItem-modalFooter": "_DrawerItem-modalFooter_182aj_240", "DrawerItem-footerLeft": "_DrawerItem-footerLeft_182aj_250", "DrawerItem-footerRight": "_DrawerItem-footerRight_182aj_255" };
|
|
4006
3970
|
|
|
4007
3971
|
// src/puck/components/modal/index.tsx
|
|
4008
3972
|
var import_react10 = require("react");
|
|
4009
3973
|
var import_react_dom = require("react-dom");
|
|
4010
3974
|
|
|
4011
|
-
// css-module:/
|
|
3975
|
+
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/components/modal/styles.module.css#css-module
|
|
4012
3976
|
var styles_module_default2 = { "Modal": "_Modal_1t9ot_1", "Modal--isOpen": "_Modal--isOpen_1t9ot_29", "Modal-inner": "_Modal-inner_1t9ot_37" };
|
|
4013
3977
|
|
|
4014
3978
|
// src/puck/components/modal/index.tsx
|
|
@@ -4243,6 +4207,7 @@ var DrawerItem = (props) => {
|
|
|
4243
4207
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
4244
4208
|
"button",
|
|
4245
4209
|
{
|
|
4210
|
+
"aria-label": target.label,
|
|
4246
4211
|
type: "button",
|
|
4247
4212
|
role: "radio",
|
|
4248
4213
|
"aria-checked": isSelected,
|
|
@@ -4293,7 +4258,7 @@ var import_react12 = require("react");
|
|
|
4293
4258
|
var import_puck16 = require("@measured/puck");
|
|
4294
4259
|
var import_lucide_react3 = require("lucide-react");
|
|
4295
4260
|
|
|
4296
|
-
// css-module:/
|
|
4261
|
+
// css-module:/home/osamu/Documents/netlisian-soft/packages/soft-config/src/puck/overrides/Drawer.module.css#css-module
|
|
4297
4262
|
var Drawer_module_default = { "Drawer": "_Drawer_12zq5_1", "Drawer-category": "_Drawer-category_12zq5_7", "Drawer-category--isExpanded": "_Drawer-category--isExpanded_12zq5_15", "Drawer-categoryContent": "_Drawer-categoryContent_12zq5_19", "Drawer-categoryTitle": "_Drawer-categoryTitle_12zq5_27", "Drawer-categoryTitleIcon": "_Drawer-categoryTitleIcon_12zq5_63" };
|
|
4298
4263
|
|
|
4299
4264
|
// src/puck/overrides/Drawer.tsx
|
|
@@ -4405,25 +4370,37 @@ var Drawer = (_props) => {
|
|
|
4405
4370
|
] });
|
|
4406
4371
|
};
|
|
4407
4372
|
|
|
4408
|
-
// src/puck/
|
|
4409
|
-
var
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4373
|
+
// src/puck/overrides/HeaderActions.tsx
|
|
4374
|
+
var import_puck17 = require("@measured/puck");
|
|
4375
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
4376
|
+
var usePuck5 = (0, import_puck17.createUsePuck)();
|
|
4377
|
+
var HeaderActions = ({ children }) => {
|
|
4378
|
+
const { handleComplete } = useComplete();
|
|
4379
|
+
const { handleCancel, canCancel } = useCancel();
|
|
4380
|
+
const dispatch = usePuck5((s) => s.dispatch);
|
|
4381
|
+
const inspect = useSoftConfig((s) => s.builder.inspect);
|
|
4382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: canCancel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_puck17.Button, { onClick: handleCancel, children: "Cancel" }),
|
|
4384
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4385
|
+
import_puck17.Button,
|
|
4386
|
+
{
|
|
4387
|
+
variant: "primary",
|
|
4388
|
+
onClick: () => {
|
|
4389
|
+
const completedComponent = handleComplete();
|
|
4390
|
+
if (completedComponent) {
|
|
4391
|
+
try {
|
|
4392
|
+
inspect(completedComponent.id, dispatch);
|
|
4393
|
+
} catch (error) {
|
|
4394
|
+
notify.error(
|
|
4395
|
+
"Failed to inspect after completion: " + (error instanceof Error ? error.message : String(error))
|
|
4396
|
+
);
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
},
|
|
4400
|
+
children: "Complete"
|
|
4424
4401
|
}
|
|
4425
|
-
|
|
4426
|
-
};
|
|
4402
|
+
)
|
|
4403
|
+
] }) : children });
|
|
4427
4404
|
};
|
|
4428
4405
|
|
|
4429
4406
|
// src/puck/lib/dissolve-all-soft-components.ts
|
|
@@ -4635,6 +4612,7 @@ var resolveSoftConfig = (data, softComponents, config) => {
|
|
|
4635
4612
|
Drawer,
|
|
4636
4613
|
DrawerItem,
|
|
4637
4614
|
Header,
|
|
4615
|
+
HeaderActions,
|
|
4638
4616
|
Modal,
|
|
4639
4617
|
SoftConfigProvider,
|
|
4640
4618
|
applyMapping,
|