@netlisian/softconfig 0.1.0 → 0.1.1
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 +5 -5
- package/dist/puck/index.d.mts +24 -5
- package/dist/puck/index.d.ts +24 -5
- package/dist/puck/index.js +210 -90
- package/dist/puck/index.mjs +201 -81
- package/package.json +1 -1
package/dist/puck/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* css-module:/media/
|
|
1
|
+
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/components/error-boundary/styles.module.css/#css-module-data */
|
|
2
2
|
._ErrorBoundary_1xl05_5 {
|
|
3
3
|
padding: 20px;
|
|
4
4
|
border: 1px solid #ff5858;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
background-color: #b71c1c;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/* css-module:/media/
|
|
29
|
+
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/Header.module.css/#css-module-data */
|
|
30
30
|
._Header_19oj9_1 {
|
|
31
31
|
display: flex;
|
|
32
32
|
justify-content: space-between;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
flex-wrap: wrap;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/* css-module:/media/
|
|
38
|
+
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/ActionBar.module.css/#css-module-data */
|
|
39
39
|
._ActionBar_pvuie_5 {
|
|
40
40
|
align-items: center;
|
|
41
41
|
cursor: default;
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
margin: 0;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
/* css-module:/media/
|
|
122
|
+
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/ComponentItem.module.css/#css-module-data */
|
|
123
123
|
._ComponentItem_1kbi2_1 {
|
|
124
124
|
background: var(--puck-color-white);
|
|
125
125
|
cursor: grab;
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
gap: 12px;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
/* css-module:/media/
|
|
317
|
+
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/components/modal/styles.module.css/#css-module-data */
|
|
318
318
|
._Modal_pvj02_1 {
|
|
319
319
|
background: color-mix(in srgb, var(--puck-color-black) 75%, transparent);
|
|
320
320
|
display: none;
|
package/dist/puck/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
|
-
import { History, AppState, PuckApi, ComponentData, ComponentConfig, DefaultComponentProps, Field, Config, Fields, PuckAction, Data } from '@measured/puck';
|
|
3
|
+
import { History, AppState, PuckApi, ComponentData, ComponentConfig, DefaultComponentProps, Field, Config, Fields, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, Data } from '@measured/puck';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import react__default, { ReactNode, ReactElement } from 'react';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -21,7 +21,7 @@ type BuildersSlice = {
|
|
|
21
21
|
build: (history: History<AppState>[], selectedItem: PuckApi["selectedItem"], itemSelector: {
|
|
22
22
|
index: number;
|
|
23
23
|
zone?: string;
|
|
24
|
-
} | null, puckDispatch: PuckApi["dispatch"]) => void | null;
|
|
24
|
+
} | null, puckDispatch: PuckApi["dispatch"], name?: string) => void | null;
|
|
25
25
|
/**
|
|
26
26
|
* Remodel the selected soft component by decomposing it and resetting as root.
|
|
27
27
|
*
|
|
@@ -77,7 +77,7 @@ type BuildersSlice = {
|
|
|
77
77
|
/** Compose multiple components into a soft component.
|
|
78
78
|
* 1. SoftComponent: Get soft fields + default values from the appState.root + sub-component maps + fixedProps
|
|
79
79
|
*/
|
|
80
|
-
compose: (appState: AppState, componentName: string, editedItem: ComponentData) => [ComponentConfig, string] | undefined;
|
|
80
|
+
compose: (appState: AppState, componentName: string, editedItem: ComponentData, displayName: string, category?: string) => [ComponentConfig, string] | undefined;
|
|
81
81
|
/** Break down a composed component into its parts.
|
|
82
82
|
* 1. Get softComponentProps
|
|
83
83
|
* 2. Create a virtual component with all the props from soft-component.
|
|
@@ -88,6 +88,7 @@ type BuildersSlice = {
|
|
|
88
88
|
|
|
89
89
|
type BuilderRootConfig = {
|
|
90
90
|
_name: string;
|
|
91
|
+
_category?: string;
|
|
91
92
|
_version?: string;
|
|
92
93
|
_versions?: string[];
|
|
93
94
|
_fields?: {
|
|
@@ -125,6 +126,8 @@ type SoftSubComponent = {
|
|
|
125
126
|
}[];
|
|
126
127
|
}[];
|
|
127
128
|
type SoftComponent = {
|
|
129
|
+
name: string;
|
|
130
|
+
category?: string;
|
|
128
131
|
fields: Fields;
|
|
129
132
|
fieldSettings?: Record<string, any>;
|
|
130
133
|
defaultProps: DefaultComponentProps;
|
|
@@ -135,6 +138,8 @@ type SoftComponent = {
|
|
|
135
138
|
};
|
|
136
139
|
type VersionedSoftComponent = {
|
|
137
140
|
defaultVersion: string;
|
|
141
|
+
name: string;
|
|
142
|
+
category?: string;
|
|
138
143
|
versions: {
|
|
139
144
|
[version: string]: {
|
|
140
145
|
fields: Fields;
|
|
@@ -170,8 +175,8 @@ type ActionEventPayload = {
|
|
|
170
175
|
type: "complete";
|
|
171
176
|
payload: {
|
|
172
177
|
id: string;
|
|
173
|
-
componentData:
|
|
174
|
-
softComponent:
|
|
178
|
+
componentData: Record<string, any>;
|
|
179
|
+
softComponent: VersionedSoftComponent["versions"][string];
|
|
175
180
|
};
|
|
176
181
|
} | {
|
|
177
182
|
type: "cancel";
|
|
@@ -212,6 +217,10 @@ type RenderFunc<Props extends {
|
|
|
212
217
|
children: ReactNode;
|
|
213
218
|
}> = (props: Props) => ReactElement;
|
|
214
219
|
type Overrides = {
|
|
220
|
+
componentNameToKey?: (displayName: string, context: {
|
|
221
|
+
existingKeys: string[];
|
|
222
|
+
state: "building" | "remodeling" | "ready" | "inspecting";
|
|
223
|
+
}) => string;
|
|
215
224
|
map?: RenderFunc<{
|
|
216
225
|
rootProps: BuilderRootConfig;
|
|
217
226
|
toOptions: {
|
|
@@ -236,6 +245,16 @@ type Overrides = {
|
|
|
236
245
|
softComponent: VersionedSoftComponent["versions"][string];
|
|
237
246
|
}) => ((inputs: any[], props: DefaultComponentProps) => any) | undefined;
|
|
238
247
|
onActions?: OnActionsCallback;
|
|
248
|
+
name?: Field<string>;
|
|
249
|
+
categories?: Field<string | undefined>;
|
|
250
|
+
onRootsDataChange?: (data: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>, params: {
|
|
251
|
+
changed: Partial<Record<keyof BuilderRootConfig, boolean> & {
|
|
252
|
+
id: string;
|
|
253
|
+
}>;
|
|
254
|
+
lastData: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>> | null;
|
|
255
|
+
metadata: Metadata;
|
|
256
|
+
trigger: ResolveDataTrigger;
|
|
257
|
+
}) => void;
|
|
239
258
|
};
|
|
240
259
|
|
|
241
260
|
type Status = "building" | "remodeling" | "ready" | "inspecting";
|
package/dist/puck/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
|
-
import { History, AppState, PuckApi, ComponentData, ComponentConfig, DefaultComponentProps, Field, Config, Fields, PuckAction, Data } from '@measured/puck';
|
|
3
|
+
import { History, AppState, PuckApi, ComponentData, ComponentConfig, DefaultComponentProps, Field, Config, Fields, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, Data } from '@measured/puck';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import react__default, { ReactNode, ReactElement } from 'react';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -21,7 +21,7 @@ type BuildersSlice = {
|
|
|
21
21
|
build: (history: History<AppState>[], selectedItem: PuckApi["selectedItem"], itemSelector: {
|
|
22
22
|
index: number;
|
|
23
23
|
zone?: string;
|
|
24
|
-
} | null, puckDispatch: PuckApi["dispatch"]) => void | null;
|
|
24
|
+
} | null, puckDispatch: PuckApi["dispatch"], name?: string) => void | null;
|
|
25
25
|
/**
|
|
26
26
|
* Remodel the selected soft component by decomposing it and resetting as root.
|
|
27
27
|
*
|
|
@@ -77,7 +77,7 @@ type BuildersSlice = {
|
|
|
77
77
|
/** Compose multiple components into a soft component.
|
|
78
78
|
* 1. SoftComponent: Get soft fields + default values from the appState.root + sub-component maps + fixedProps
|
|
79
79
|
*/
|
|
80
|
-
compose: (appState: AppState, componentName: string, editedItem: ComponentData) => [ComponentConfig, string] | undefined;
|
|
80
|
+
compose: (appState: AppState, componentName: string, editedItem: ComponentData, displayName: string, category?: string) => [ComponentConfig, string] | undefined;
|
|
81
81
|
/** Break down a composed component into its parts.
|
|
82
82
|
* 1. Get softComponentProps
|
|
83
83
|
* 2. Create a virtual component with all the props from soft-component.
|
|
@@ -88,6 +88,7 @@ type BuildersSlice = {
|
|
|
88
88
|
|
|
89
89
|
type BuilderRootConfig = {
|
|
90
90
|
_name: string;
|
|
91
|
+
_category?: string;
|
|
91
92
|
_version?: string;
|
|
92
93
|
_versions?: string[];
|
|
93
94
|
_fields?: {
|
|
@@ -125,6 +126,8 @@ type SoftSubComponent = {
|
|
|
125
126
|
}[];
|
|
126
127
|
}[];
|
|
127
128
|
type SoftComponent = {
|
|
129
|
+
name: string;
|
|
130
|
+
category?: string;
|
|
128
131
|
fields: Fields;
|
|
129
132
|
fieldSettings?: Record<string, any>;
|
|
130
133
|
defaultProps: DefaultComponentProps;
|
|
@@ -135,6 +138,8 @@ type SoftComponent = {
|
|
|
135
138
|
};
|
|
136
139
|
type VersionedSoftComponent = {
|
|
137
140
|
defaultVersion: string;
|
|
141
|
+
name: string;
|
|
142
|
+
category?: string;
|
|
138
143
|
versions: {
|
|
139
144
|
[version: string]: {
|
|
140
145
|
fields: Fields;
|
|
@@ -170,8 +175,8 @@ type ActionEventPayload = {
|
|
|
170
175
|
type: "complete";
|
|
171
176
|
payload: {
|
|
172
177
|
id: string;
|
|
173
|
-
componentData:
|
|
174
|
-
softComponent:
|
|
178
|
+
componentData: Record<string, any>;
|
|
179
|
+
softComponent: VersionedSoftComponent["versions"][string];
|
|
175
180
|
};
|
|
176
181
|
} | {
|
|
177
182
|
type: "cancel";
|
|
@@ -212,6 +217,10 @@ type RenderFunc<Props extends {
|
|
|
212
217
|
children: ReactNode;
|
|
213
218
|
}> = (props: Props) => ReactElement;
|
|
214
219
|
type Overrides = {
|
|
220
|
+
componentNameToKey?: (displayName: string, context: {
|
|
221
|
+
existingKeys: string[];
|
|
222
|
+
state: "building" | "remodeling" | "ready" | "inspecting";
|
|
223
|
+
}) => string;
|
|
215
224
|
map?: RenderFunc<{
|
|
216
225
|
rootProps: BuilderRootConfig;
|
|
217
226
|
toOptions: {
|
|
@@ -236,6 +245,16 @@ type Overrides = {
|
|
|
236
245
|
softComponent: VersionedSoftComponent["versions"][string];
|
|
237
246
|
}) => ((inputs: any[], props: DefaultComponentProps) => any) | undefined;
|
|
238
247
|
onActions?: OnActionsCallback;
|
|
248
|
+
name?: Field<string>;
|
|
249
|
+
categories?: Field<string | undefined>;
|
|
250
|
+
onRootsDataChange?: (data: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>, params: {
|
|
251
|
+
changed: Partial<Record<keyof BuilderRootConfig, boolean> & {
|
|
252
|
+
id: string;
|
|
253
|
+
}>;
|
|
254
|
+
lastData: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>> | null;
|
|
255
|
+
metadata: Metadata;
|
|
256
|
+
trigger: ResolveDataTrigger;
|
|
257
|
+
}) => void;
|
|
239
258
|
};
|
|
240
259
|
|
|
241
260
|
type Status = "building" | "remodeling" | "ready" | "inspecting";
|