@webiny/react-properties 0.0.0-unstable.7f63ea0744 β†’ 0.0.0-unstable.81ae05e56b

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/README.md CHANGED
@@ -1,65 +1,11 @@
1
- # React Properties
1
+ # @webiny/react-properties
2
2
 
3
- [![](https://img.shields.io/npm/dw/@webiny/react-properties.svg)](https://www.npmjs.com/package/@webiny/react-properties)
4
- [![](https://img.shields.io/npm/v/@webiny/react-properties.svg)](https://www.npmjs.com/package/@webiny/react-properties)
5
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
7
6
 
8
- A tiny React properties framework, to build dynamic data objects using React components, which can be customized after initial creation. The usage is very similar to how you write XML data structures, but in this case you're using actual React.
7
+ πŸ“˜ **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
9
8
 
10
- ## Basic Example
9
+ ---
11
10
 
12
- ```jsx
13
- import React, { useCallback } from "react";
14
- import { Properties, Property, toObject } from "@webiny/react-properties";
15
-
16
- const View = () => {
17
- const onChange = useCallback(properties => {
18
- console.log(toObject(properties));
19
- }, []);
20
-
21
- return (
22
- <Properties onChange={onChange}>
23
- <Property name={"group"}>
24
- <Property name={"name"} value={"layout"} />
25
- <Property name={"label"} value={"Layout"} />
26
- <Property name={"toolbar"}>
27
- <Property name={"name"} value={"basic"} />
28
- </Property>
29
- </Property>
30
- <Property name={"group"}>
31
- <Property name={"name"} value={"heroes"} />
32
- <Property name={"label"} value={"Heroes"} />
33
- <Property name={"toolbar"}>
34
- <Property name={"name"} value={"heroes"} />
35
- </Property>
36
- </Property>
37
- </Properties>
38
- );
39
- };
40
- ```
41
-
42
- Output:
43
-
44
- ```json
45
- {
46
- "group": [
47
- {
48
- "name": "layout",
49
- "label": "Layout",
50
- "toolbar": {
51
- "name": "basic"
52
- }
53
- },
54
- {
55
- "name": "heroes",
56
- "label": "Heroes",
57
- "toolbar": {
58
- "name": "heroes"
59
- }
60
- }
61
- ]
62
- }
63
- ```
64
-
65
- For more examples, check out the test files.
11
+ _This README file is automatically generated during the publish process._
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import type { Property } from "./index.js";
3
+ export interface WithConfigProps {
4
+ children: React.ReactNode;
5
+ onProperties?(properties: Property[]): void;
6
+ }
7
+ export interface ConfigProps {
8
+ children: React.ReactNode;
9
+ priority?: "primary" | "secondary";
10
+ }
11
+ export declare function createConfigurableComponent<TConfig>(name: string): {
12
+ WithConfig: ({ onProperties, children }: WithConfigProps) => React.JSX.Element;
13
+ Config: ({ priority, children }: ConfigProps) => React.JSX.Element;
14
+ useConfig: <TExtra extends object>() => TConfig & TExtra;
15
+ };
@@ -0,0 +1,112 @@
1
+ import React, { useCallback, useContext, useEffect, useMemo, useState } from "react";
2
+ import { Compose, makeDecoratable } from "@webiny/react-composition";
3
+ import { Properties, toObject } from "./index.js";
4
+ import { useDebugConfig } from "./useDebugConfig.js";
5
+ import { PropertyPriorityProvider } from "./PropertyPriority.js";
6
+
7
+ /**
8
+ * Each `<Config>` call composes a new HOC around the previous one via `Compose`.
9
+ * The last composed HOC is the outermost wrapper. By placing `{newChildren}`
10
+ * (this HOC's addition) before `{children}` (all previously composed configs),
11
+ * the final render order matches declaration order:
12
+ *
13
+ * <Config>A</Config> β†’ renders first (outermost HOC, its newChildren rendered first)
14
+ * <Config>B</Config> β†’ renders second
15
+ * <Config>C</Config> β†’ renders third (innermost, rendered last via children chain)
16
+ *
17
+ * This is important because Property components register in mount order,
18
+ * so declaration order = mount order = predictable config resolution.
19
+ */
20
+ const createHOC = newChildren => BaseComponent => {
21
+ return function ConfigHOC({
22
+ children
23
+ }) {
24
+ return /*#__PURE__*/React.createElement(BaseComponent, null, newChildren, children);
25
+ };
26
+ };
27
+ export function createConfigurableComponent(name) {
28
+ const ConfigApplyPrimary = makeDecoratable(`${name}ConfigApply<Primary>`, ({
29
+ children
30
+ }) => {
31
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
32
+ });
33
+ const ConfigApplySecondary = makeDecoratable(`${name}ConfigApply<Secondary>`, ({
34
+ children
35
+ }) => {
36
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
37
+ });
38
+ const Config = ({
39
+ priority = "primary",
40
+ children
41
+ }) => {
42
+ if (priority === "primary") {
43
+ return /*#__PURE__*/React.createElement(Compose, {
44
+ component: ConfigApplyPrimary,
45
+ with: createHOC(children)
46
+ });
47
+ }
48
+ return /*#__PURE__*/React.createElement(Compose, {
49
+ component: ConfigApplySecondary,
50
+ with: createHOC(children)
51
+ });
52
+ };
53
+ const defaultContext = {
54
+ properties: []
55
+ };
56
+ const ViewContext = /*#__PURE__*/React.createContext(defaultContext);
57
+
58
+ /**
59
+ * Memoized config subtree β€” ConfigApply components don't depend on WithConfig
60
+ * props, so they must not remount when the parent re-renders. Without this,
61
+ * every parent re-render causes Property components inside HOCs to unmount
62
+ * and remount, corrupting the config object.
63
+ */
64
+ const ConfigApplyTree = /*#__PURE__*/React.memo(function ConfigApplyTree() {
65
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ConfigApplyPrimary, null), /*#__PURE__*/React.createElement(PropertyPriorityProvider, {
66
+ priority: 1
67
+ }, /*#__PURE__*/React.createElement(ConfigApplySecondary, null)));
68
+ });
69
+ const WithConfig = ({
70
+ onProperties,
71
+ children
72
+ }) => {
73
+ // `null` = config not yet collected; `[]` = collected but empty.
74
+ // This distinction is critical: children must NOT render until the
75
+ // PropertyStore debounce has flushed and delivered the initial config.
76
+ // Rendering children with partial/empty config causes errors in
77
+ // consumers like LexicalEditor that require a complete config on mount.
78
+ const [properties, setProperties] = useState(null);
79
+ const resolvedProperties = properties ?? [];
80
+ useDebugConfig(name, resolvedProperties);
81
+ const context = {
82
+ properties: resolvedProperties
83
+ };
84
+ useEffect(() => {
85
+ if (properties !== null && typeof onProperties === "function") {
86
+ onProperties(properties);
87
+ }
88
+ }, [properties]);
89
+ const stateUpdater = useCallback(properties => {
90
+ setProperties(properties);
91
+ }, []);
92
+ return /*#__PURE__*/React.createElement(ViewContext.Provider, {
93
+ value: context
94
+ }, /*#__PURE__*/React.createElement(Properties, {
95
+ name: name,
96
+ onChange: stateUpdater
97
+ }, /*#__PURE__*/React.createElement(ConfigApplyTree, null)), properties !== null ? children : null);
98
+ };
99
+ function useConfig() {
100
+ const {
101
+ properties
102
+ } = useContext(ViewContext);
103
+ return useMemo(() => toObject(properties), [properties]);
104
+ }
105
+ return {
106
+ WithConfig,
107
+ Config,
108
+ useConfig
109
+ };
110
+ }
111
+
112
+ //# sourceMappingURL=createConfigurableComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useContext","useEffect","useMemo","useState","Compose","makeDecoratable","Properties","toObject","useDebugConfig","PropertyPriorityProvider","createHOC","newChildren","BaseComponent","ConfigHOC","children","createElement","createConfigurableComponent","name","ConfigApplyPrimary","Fragment","ConfigApplySecondary","Config","priority","component","with","defaultContext","properties","ViewContext","createContext","ConfigApplyTree","memo","WithConfig","onProperties","setProperties","resolvedProperties","context","stateUpdater","Provider","value","onChange","useConfig"],"sources":["createConfigurableComponent.tsx"],"sourcesContent":["import React, { useCallback, useContext, useEffect, useMemo, useState } from \"react\";\nimport type { Decorator } from \"@webiny/react-composition\";\nimport { Compose, makeDecoratable } from \"@webiny/react-composition\";\nimport type { GenericComponent } from \"@webiny/react-composition/types.js\";\nimport type { Property } from \"~/index.js\";\nimport { Properties, toObject } from \"~/index.js\";\nimport { useDebugConfig } from \"./useDebugConfig.js\";\nimport { PropertyPriorityProvider } from \"./PropertyPriority.js\";\n\n/**\n * Each `<Config>` call composes a new HOC around the previous one via `Compose`.\n * The last composed HOC is the outermost wrapper. By placing `{newChildren}`\n * (this HOC's addition) before `{children}` (all previously composed configs),\n * the final render order matches declaration order:\n *\n * <Config>A</Config> β†’ renders first (outermost HOC, its newChildren rendered first)\n * <Config>B</Config> β†’ renders second\n * <Config>C</Config> β†’ renders third (innermost, rendered last via children chain)\n *\n * This is important because Property components register in mount order,\n * so declaration order = mount order = predictable config resolution.\n */\nconst createHOC =\n (newChildren: React.ReactNode): Decorator<GenericComponent<{ children?: React.ReactNode }>> =>\n BaseComponent => {\n return function ConfigHOC({ children }) {\n return (\n <BaseComponent>\n {newChildren}\n {children}\n </BaseComponent>\n );\n };\n };\n\nexport interface WithConfigProps {\n children: React.ReactNode;\n onProperties?(properties: Property[]): void;\n}\n\ninterface ConfigApplyProps {\n children?: React.ReactNode;\n}\n\nexport interface ConfigProps {\n children: React.ReactNode;\n priority?: \"primary\" | \"secondary\";\n}\n\nexport function createConfigurableComponent<TConfig>(name: string) {\n const ConfigApplyPrimary = makeDecoratable(\n `${name}ConfigApply<Primary>`,\n ({ children }: ConfigApplyProps) => {\n return <>{children}</>;\n }\n );\n\n const ConfigApplySecondary = makeDecoratable(\n `${name}ConfigApply<Secondary>`,\n ({ children }: ConfigApplyProps) => {\n return <>{children}</>;\n }\n );\n\n const Config = ({ priority = \"primary\", children }: ConfigProps) => {\n if (priority === \"primary\") {\n return <Compose component={ConfigApplyPrimary} with={createHOC(children)} />;\n }\n return <Compose component={ConfigApplySecondary} with={createHOC(children)} />;\n };\n\n interface ViewContext {\n properties: Property[];\n }\n\n const defaultContext = { properties: [] };\n\n const ViewContext = React.createContext<ViewContext>(defaultContext);\n\n /**\n * Memoized config subtree β€” ConfigApply components don't depend on WithConfig\n * props, so they must not remount when the parent re-renders. Without this,\n * every parent re-render causes Property components inside HOCs to unmount\n * and remount, corrupting the config object.\n */\n const ConfigApplyTree = React.memo(function ConfigApplyTree() {\n return (\n <>\n <ConfigApplyPrimary />\n <PropertyPriorityProvider priority={1}>\n <ConfigApplySecondary />\n </PropertyPriorityProvider>\n </>\n );\n });\n\n const WithConfig = ({ onProperties, children }: WithConfigProps) => {\n // `null` = config not yet collected; `[]` = collected but empty.\n // This distinction is critical: children must NOT render until the\n // PropertyStore debounce has flushed and delivered the initial config.\n // Rendering children with partial/empty config causes errors in\n // consumers like LexicalEditor that require a complete config on mount.\n const [properties, setProperties] = useState<Property[] | null>(null);\n const resolvedProperties = properties ?? [];\n useDebugConfig(name, resolvedProperties);\n const context = { properties: resolvedProperties };\n\n useEffect(() => {\n if (properties !== null && typeof onProperties === \"function\") {\n onProperties(properties);\n }\n }, [properties]);\n\n const stateUpdater = useCallback((properties: Property[]) => {\n setProperties(properties);\n }, []);\n\n return (\n <ViewContext.Provider value={context}>\n {/* ConfigApplyTree always renders so Property components inside\n composed HOCs can mount and register with the PropertyStore.\n It lives outside the children gate below. */}\n <Properties name={name} onChange={stateUpdater}>\n <ConfigApplyTree />\n </Properties>\n {/* Gate: only render children once the PropertyStore has flushed\n its first batch (properties !== null). This guarantees that\n useConfig() returns a complete config object on first render. */}\n {properties !== null ? children : null}\n </ViewContext.Provider>\n );\n };\n\n function useConfig<TExtra extends object>(): TConfig & TExtra {\n const { properties } = useContext(ViewContext);\n return useMemo(() => toObject<TConfig & TExtra>(properties), [properties]);\n }\n\n return {\n WithConfig,\n Config,\n useConfig\n };\n}\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpF,SAASC,OAAO,EAAEC,eAAe,QAAQ,2BAA2B;AAGpE,SAASC,UAAU,EAAEC,QAAQ;AAC7B,SAASC,cAAc;AACvB,SAASC,wBAAwB;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,GACVC,WAA4B,IAC7BC,aAAa,IAAI;EACb,OAAO,SAASC,SAASA,CAAC;I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A,CAAA,EAA4C;IAC1D,MAAM;MAAEd;IAAW,CAAC,GAAG1B,UAAU,CAAC2B,WAAW,CAAC;IAC9C,OAAOzB,OAAO,CAAC,MAAMK,QAAQ,CAAmBmB,UAAU,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;EAC9E;EAEA,OAAO;IACHK,UAAU;IACVV,MAAM;IACNmB;EACJ,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ import type { Property } from "../Properties.js";
2
+ interface AddPropertyOptions {
3
+ after?: string;
4
+ before?: string;
5
+ priority?: number;
6
+ }
7
+ type Listener = (properties: Property[]) => void;
8
+ export declare class PropertyStore {
9
+ private map;
10
+ private order;
11
+ private queue;
12
+ private listeners;
13
+ private priorities;
14
+ /** Properties that were explicitly positioned via before/after. */
15
+ private positioned;
16
+ /**
17
+ * Synchronous lookup map β€” written immediately on addProperty (before debounce),
18
+ * so useAncestor can find properties during render.
19
+ */
20
+ private lookup;
21
+ private scheduleFlush;
22
+ get allProperties(): Property[];
23
+ subscribe(listener: Listener): () => void;
24
+ /**
25
+ * Returns properties that are children of the given parent ID.
26
+ * Reads from the synchronous lookup map, so it works during render
27
+ * before the debounced queue has flushed.
28
+ */
29
+ getChildrenOf(parentId: string): Property[];
30
+ /**
31
+ * Find a property by ID from the synchronous lookup map.
32
+ */
33
+ getById(id: string): Property | undefined;
34
+ /**
35
+ * Register a property in the synchronous lookup map during render,
36
+ * so useAncestor can find it before the debounced queue flushes.
37
+ */
38
+ registerLookup(property: Property): void;
39
+ addProperty(property: Property, options?: AddPropertyOptions): void;
40
+ removeProperty(id: string): void;
41
+ replaceProperty(oldId: string, newProperty: Property): void;
42
+ private processQueue;
43
+ private executeAdd;
44
+ private executeRemove;
45
+ private executeReplace;
46
+ private insertBefore;
47
+ private insertAfter;
48
+ private reposition;
49
+ private removeDescendants;
50
+ }
51
+ export {};
@@ -0,0 +1,229 @@
1
+ import debounce from "lodash/debounce.js";
2
+ export class PropertyStore {
3
+ map = new Map();
4
+ order = [];
5
+ queue = [];
6
+ listeners = new Set();
7
+ priorities = new Map();
8
+ /** Properties that were explicitly positioned via before/after. */
9
+ positioned = new Set();
10
+
11
+ /**
12
+ * Synchronous lookup map β€” written immediately on addProperty (before debounce),
13
+ * so useAncestor can find properties during render.
14
+ */
15
+ lookup = new Map();
16
+ scheduleFlush = debounce(() => {
17
+ this.processQueue();
18
+ }, 0);
19
+ get allProperties() {
20
+ return this.order.filter(id => this.map.has(id)).map(id => this.map.get(id));
21
+ }
22
+ subscribe(listener) {
23
+ this.listeners.add(listener);
24
+ return () => {
25
+ this.listeners.delete(listener);
26
+ };
27
+ }
28
+
29
+ /**
30
+ * Returns properties that are children of the given parent ID.
31
+ * Reads from the synchronous lookup map, so it works during render
32
+ * before the debounced queue has flushed.
33
+ */
34
+ getChildrenOf(parentId) {
35
+ return Array.from(this.lookup.values()).filter(p => p.parent === parentId);
36
+ }
37
+
38
+ /**
39
+ * Find a property by ID from the synchronous lookup map.
40
+ */
41
+ getById(id) {
42
+ return this.lookup.get(id);
43
+ }
44
+
45
+ /**
46
+ * Register a property in the synchronous lookup map during render,
47
+ * so useAncestor can find it before the debounced queue flushes.
48
+ */
49
+ registerLookup(property) {
50
+ if (this.lookup.has(property.id)) {
51
+ const existing = this.lookup.get(property.id);
52
+ this.lookup.set(property.id, {
53
+ ...existing,
54
+ ...property
55
+ });
56
+ } else {
57
+ this.lookup.set(property.id, property);
58
+ }
59
+ }
60
+ addProperty(property, options = {}) {
61
+ this.registerLookup(property);
62
+ this.queue.push({
63
+ type: "add",
64
+ property,
65
+ options
66
+ });
67
+ this.scheduleFlush();
68
+ }
69
+ removeProperty(id) {
70
+ this.lookup.delete(id);
71
+ this.queue.push({
72
+ type: "remove",
73
+ id
74
+ });
75
+ this.scheduleFlush();
76
+ }
77
+ replaceProperty(oldId, newProperty) {
78
+ this.lookup.delete(oldId);
79
+ this.lookup.set(newProperty.id, newProperty);
80
+ this.queue.push({
81
+ type: "replace",
82
+ oldId,
83
+ newProperty
84
+ });
85
+ this.scheduleFlush();
86
+ }
87
+ processQueue() {
88
+ if (this.queue.length === 0) {
89
+ return;
90
+ }
91
+ const ops = this.queue.splice(0);
92
+
93
+ // Stable-sort operations so that "add" ops with lower priority numbers
94
+ // are processed first. Non-add operations and adds with default priority (0)
95
+ // keep their original order.
96
+ ops.sort((a, b) => {
97
+ const pa = a.type === "add" ? a.options.priority ?? 0 : 0;
98
+ const pb = b.type === "add" ? b.options.priority ?? 0 : 0;
99
+ return pa - pb;
100
+ });
101
+ for (const op of ops) {
102
+ switch (op.type) {
103
+ case "add":
104
+ this.executeAdd(op.property, op.options);
105
+ break;
106
+ case "remove":
107
+ this.executeRemove(op.id);
108
+ break;
109
+ case "replace":
110
+ this.executeReplace(op.oldId, op.newProperty);
111
+ break;
112
+ }
113
+ }
114
+
115
+ // Stable-sort the order array by priority, but only for properties
116
+ // that were NOT explicitly positioned via before/after. Explicitly
117
+ // positioned properties keep their placement.
118
+ this.order.sort((a, b) => {
119
+ if (this.positioned.has(a) || this.positioned.has(b)) {
120
+ return 0;
121
+ }
122
+ return (this.priorities.get(a) ?? 0) - (this.priorities.get(b) ?? 0);
123
+ });
124
+ const properties = this.allProperties;
125
+ for (const listener of this.listeners) {
126
+ listener(properties);
127
+ }
128
+ }
129
+ executeAdd(property, options) {
130
+ if (options.after || options.before) {
131
+ this.positioned.add(property.id);
132
+ }
133
+ const exists = this.map.has(property.id);
134
+ if (exists) {
135
+ // Merge into existing property. Keep the original priority so
136
+ // that a secondary config overriding a primary property doesn't
137
+ // cause the re-sort to move it after all primary properties.
138
+ const existing = this.map.get(property.id);
139
+ this.map.set(property.id, {
140
+ ...existing,
141
+ ...property
142
+ });
143
+ if (options.after) {
144
+ this.reposition(property.id, options.after, "after");
145
+ } else if (options.before) {
146
+ this.reposition(property.id, options.before, "before");
147
+ }
148
+ return;
149
+ }
150
+ this.map.set(property.id, property);
151
+ // Set priority only for new properties β€” not merges (handled above).
152
+ this.priorities.set(property.id, options.priority ?? 0);
153
+ if (options.after) {
154
+ this.insertAfter(property.id, options.after);
155
+ } else if (options.before) {
156
+ this.insertBefore(property.id, options.before);
157
+ } else {
158
+ this.order.push(property.id);
159
+ }
160
+ }
161
+ executeRemove(id) {
162
+ if (!this.map.has(id)) {
163
+ return;
164
+ }
165
+ this.map.delete(id);
166
+ this.priorities.delete(id);
167
+ this.positioned.delete(id);
168
+ this.order = this.order.filter(oid => oid !== id);
169
+ // Note: we intentionally do NOT call removeDescendants here.
170
+ // React's component lifecycle ensures that when a parent Property
171
+ // unmounts, all child Properties unmount too β€” each triggering its
172
+ // own removeProperty call. Calling removeDescendants would wipe
173
+ // children that belong to OTHER still-mounted configs sharing the
174
+ // same parent ID (e.g., id="pageSettings" used by both primary
175
+ // and secondary configs).
176
+ }
177
+ executeReplace(oldId, newProperty) {
178
+ const idx = this.order.indexOf(oldId);
179
+ if (idx === -1) {
180
+ return;
181
+ }
182
+ this.map.delete(oldId);
183
+ this.map.set(newProperty.id, newProperty);
184
+ this.order[idx] = newProperty.id;
185
+ this.removeDescendants(oldId);
186
+ }
187
+ insertBefore(id, before) {
188
+ if (before.endsWith("$first")) {
189
+ this.order.unshift(id);
190
+ return;
191
+ }
192
+ const targetIdx = this.order.indexOf(before);
193
+ if (targetIdx === -1) {
194
+ this.order.push(id);
195
+ return;
196
+ }
197
+ this.order.splice(targetIdx, 0, id);
198
+ }
199
+ insertAfter(id, after) {
200
+ if (after.endsWith("$last")) {
201
+ this.order.push(id);
202
+ return;
203
+ }
204
+ const targetIdx = this.order.indexOf(after);
205
+ if (targetIdx === -1) {
206
+ this.order.push(id);
207
+ return;
208
+ }
209
+ this.order.splice(targetIdx + 1, 0, id);
210
+ }
211
+ reposition(id, targetId, position) {
212
+ this.order = this.order.filter(oid => oid !== id);
213
+ if (position === "before") {
214
+ this.insertBefore(id, targetId);
215
+ } else {
216
+ this.insertAfter(id, targetId);
217
+ }
218
+ }
219
+ removeDescendants(parentId) {
220
+ const children = Array.from(this.map.values()).filter(p => p.parent === parentId);
221
+ for (const child of children) {
222
+ this.map.delete(child.id);
223
+ this.order = this.order.filter(oid => oid !== child.id);
224
+ this.removeDescendants(child.id);
225
+ }
226
+ }
227
+ }
228
+
229
+ //# sourceMappingURL=PropertyStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["debounce","PropertyStore","map","Map","order","queue","listeners","Set","priorities","positioned","lookup","scheduleFlush","processQueue","allProperties","filter","id","has","get","subscribe","listener","add","delete","getChildrenOf","parentId","Array","from","values","p","parent","getById","registerLookup","property","existing","set","addProperty","options","push","type","removeProperty","replaceProperty","oldId","newProperty","length","ops","splice","sort","a","b","pa","priority","pb","op","executeAdd","executeRemove","executeReplace","properties","after","before","exists","reposition","insertAfter","insertBefore","oid","idx","indexOf","removeDescendants","endsWith","unshift","targetIdx","targetId","position","children","child"],"sources":["PropertyStore.ts"],"sourcesContent":["import debounce from \"lodash/debounce.js\";\nimport type { Property } from \"../Properties.js\";\n\ninterface AddPropertyOptions {\n after?: string;\n before?: string;\n priority?: number;\n}\n\ntype Operation =\n | { type: \"add\"; property: Property; options: AddPropertyOptions }\n | { type: \"remove\"; id: string }\n | { type: \"replace\"; oldId: string; newProperty: Property };\n\ntype Listener = (properties: Property[]) => void;\n\nexport class PropertyStore {\n private map = new Map<string, Property>();\n private order: string[] = [];\n private queue: Operation[] = [];\n private listeners = new Set<Listener>();\n private priorities = new Map<string, number>();\n /** Properties that were explicitly positioned via before/after. */\n private positioned = new Set<string>();\n\n /**\n * Synchronous lookup map β€” written immediately on addProperty (before debounce),\n * so useAncestor can find properties during render.\n */\n private lookup = new Map<string, Property>();\n\n private scheduleFlush = debounce(() => {\n this.processQueue();\n }, 0);\n\n get allProperties(): Property[] {\n return this.order.filter(id => this.map.has(id)).map(id => this.map.get(id)!);\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n /**\n * Returns properties that are children of the given parent ID.\n * Reads from the synchronous lookup map, so it works during render\n * before the debounced queue has flushed.\n */\n getChildrenOf(parentId: string): Property[] {\n return Array.from(this.lookup.values()).filter(p => p.parent === parentId);\n }\n\n /**\n * Find a property by ID from the synchronous lookup map.\n */\n getById(id: string): Property | undefined {\n return this.lookup.get(id);\n }\n\n /**\n * Register a property in the synchronous lookup map during render,\n * so useAncestor can find it before the debounced queue flushes.\n */\n registerLookup(property: Property): void {\n if (this.lookup.has(property.id)) {\n const existing = this.lookup.get(property.id)!;\n this.lookup.set(property.id, { ...existing, ...property });\n } else {\n this.lookup.set(property.id, property);\n }\n }\n\n addProperty(property: Property, options: AddPropertyOptions = {}): void {\n this.registerLookup(property);\n this.queue.push({ type: \"add\", property, options });\n this.scheduleFlush();\n }\n\n removeProperty(id: string): void {\n this.lookup.delete(id);\n this.queue.push({ type: \"remove\", id });\n this.scheduleFlush();\n }\n\n replaceProperty(oldId: string, newProperty: Property): void {\n this.lookup.delete(oldId);\n this.lookup.set(newProperty.id, newProperty);\n this.queue.push({ type: \"replace\", oldId, newProperty });\n this.scheduleFlush();\n }\n\n private processQueue(): void {\n if (this.queue.length === 0) {\n return;\n }\n\n const ops = this.queue.splice(0);\n\n // Stable-sort operations so that \"add\" ops with lower priority numbers\n // are processed first. Non-add operations and adds with default priority (0)\n // keep their original order.\n ops.sort((a, b) => {\n const pa = a.type === \"add\" ? (a.options.priority ?? 0) : 0;\n const pb = b.type === \"add\" ? (b.options.priority ?? 0) : 0;\n return pa - pb;\n });\n\n for (const op of ops) {\n switch (op.type) {\n case \"add\":\n this.executeAdd(op.property, op.options);\n break;\n case \"remove\":\n this.executeRemove(op.id);\n break;\n case \"replace\":\n this.executeReplace(op.oldId, op.newProperty);\n break;\n }\n }\n\n // Stable-sort the order array by priority, but only for properties\n // that were NOT explicitly positioned via before/after. Explicitly\n // positioned properties keep their placement.\n this.order.sort((a, b) => {\n if (this.positioned.has(a) || this.positioned.has(b)) {\n return 0;\n }\n return (this.priorities.get(a) ?? 0) - (this.priorities.get(b) ?? 0);\n });\n\n const properties = this.allProperties;\n for (const listener of this.listeners) {\n listener(properties);\n }\n }\n\n private executeAdd(property: Property, options: AddPropertyOptions): void {\n if (options.after || options.before) {\n this.positioned.add(property.id);\n }\n\n const exists = this.map.has(property.id);\n\n if (exists) {\n // Merge into existing property. Keep the original priority so\n // that a secondary config overriding a primary property doesn't\n // cause the re-sort to move it after all primary properties.\n const existing = this.map.get(property.id)!;\n this.map.set(property.id, { ...existing, ...property });\n\n if (options.after) {\n this.reposition(property.id, options.after, \"after\");\n } else if (options.before) {\n this.reposition(property.id, options.before, \"before\");\n }\n return;\n }\n\n this.map.set(property.id, property);\n // Set priority only for new properties β€” not merges (handled above).\n this.priorities.set(property.id, options.priority ?? 0);\n\n if (options.after) {\n this.insertAfter(property.id, options.after);\n } else if (options.before) {\n this.insertBefore(property.id, options.before);\n } else {\n this.order.push(property.id);\n }\n }\n\n private executeRemove(id: string): void {\n if (!this.map.has(id)) {\n return;\n }\n this.map.delete(id);\n this.priorities.delete(id);\n this.positioned.delete(id);\n this.order = this.order.filter(oid => oid !== id);\n // Note: we intentionally do NOT call removeDescendants here.\n // React's component lifecycle ensures that when a parent Property\n // unmounts, all child Properties unmount too β€” each triggering its\n // own removeProperty call. Calling removeDescendants would wipe\n // children that belong to OTHER still-mounted configs sharing the\n // same parent ID (e.g., id=\"pageSettings\" used by both primary\n // and secondary configs).\n }\n\n private executeReplace(oldId: string, newProperty: Property): void {\n const idx = this.order.indexOf(oldId);\n if (idx === -1) {\n return;\n }\n\n this.map.delete(oldId);\n this.map.set(newProperty.id, newProperty);\n this.order[idx] = newProperty.id;\n this.removeDescendants(oldId);\n }\n\n private insertBefore(id: string, before: string): void {\n if (before.endsWith(\"$first\")) {\n this.order.unshift(id);\n return;\n }\n const targetIdx = this.order.indexOf(before);\n if (targetIdx === -1) {\n this.order.push(id);\n return;\n }\n this.order.splice(targetIdx, 0, id);\n }\n\n private insertAfter(id: string, after: string): void {\n if (after.endsWith(\"$last\")) {\n this.order.push(id);\n return;\n }\n const targetIdx = this.order.indexOf(after);\n if (targetIdx === -1) {\n this.order.push(id);\n return;\n }\n this.order.splice(targetIdx + 1, 0, id);\n }\n\n private reposition(id: string, targetId: string, position: \"before\" | \"after\"): void {\n this.order = this.order.filter(oid => oid !== id);\n\n if (position === \"before\") {\n this.insertBefore(id, targetId);\n } else {\n this.insertAfter(id, targetId);\n }\n }\n\n private removeDescendants(parentId: string): void {\n const children = Array.from(this.map.values()).filter(p => p.parent === parentId);\n for (const child of children) {\n this.map.delete(child.id);\n this.order = this.order.filter(oid => oid !== child.id);\n this.removeDescendants(child.id);\n }\n }\n}\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oBAAoB;AAgBzC,OAAO,MAAMC,aAAa,CAAC;EACfC,GAAG,GAAG,IAAIC,GAAG,CAAmB,CAAC;EACjCC,KAAK,GAAa,EAAE;EACpBC,KAAK,GAAgB,EAAE;EACvBC,SAAS,GAAG,IAAIC,GAAG,CAAW,CAAC;EAC/BC,UAAU,GAAG,IAAIL,GAAG,CAAiB,CAAC;EAC9C;EACQM,UAAU,GAAG,IAAIF,GAAG,CAAS,CAAC;;EAEtC;AACJ;AACA;AACA;EACYG,MAAM,GAAG,IAAIP,GAAG,CAAmB,CAAC;EAEpCQ,aAAa,GAAGX,QAAQ,CAAC,MAAM;IACnC,IAAI,CAACY,YAAY,CAAC,CAAC;EACvB,CAAC,EAAE,CAAC,CAAC;EAEL,IAAIC,aAAaA,CAAA,EAAe;IAC5B,OAAO,IAAI,CAACT,KAAK,CAACU,MAAM,CAACC,EAAE,IAAI,IAAI,CAACb,GAAG,CAACc,GAAG,CAACD,EAAE,CAAC,CAAC,CAACb,GAAG,CAACa,EAAE,IAAI,IAAI,CAACb,GAAG,CAACe,GAAG,CAACF,EAAE,CAAE,CAAC;EACjF;EAEAG,SAASA,CAACC,QAAkB,EAAc;IACtC,IAAI,CAACb,SAAS,CAACc,GAAG,CAACD,QAAQ,CAAC;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List":[]}
@@ -0,0 +1 @@
1
+ export { PropertyStore } from "./PropertyStore.js";
@@ -0,0 +1,3 @@
1
+ export { PropertyStore } from "./PropertyStore.js";
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PropertyStore"],"sources":["index.ts"],"sourcesContent":["export { PropertyStore } from \"./PropertyStore.js\";\n"],"mappings":"AAAA,SAASA,aAAa","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,2 +1,7 @@
1
- export * from "./utils";
2
- export * from "./Properties";
1
+ export * from "./utils.js";
2
+ export * from "./Properties.js";
3
+ export * from "./useDebugConfig.js";
4
+ export * from "./useIdGenerator.js";
5
+ export * from "./createConfigurableComponent.js";
6
+ export * from "./domain/index.js";
7
+ export { DevToolsSection } from "./DevToolsSection.js";
package/index.js CHANGED
@@ -1,27 +1,9 @@
1
- "use strict";
1
+ export * from "./utils.js";
2
+ export * from "./Properties.js";
3
+ export * from "./useDebugConfig.js";
4
+ export * from "./useIdGenerator.js";
5
+ export * from "./createConfigurableComponent.js";
6
+ export * from "./domain/index.js";
7
+ export { DevToolsSection } from "./DevToolsSection.js";
2
8
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _utils = require("./utils");
7
- Object.keys(_utils).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _utils[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _utils[key];
14
- }
15
- });
16
- });
17
- var _Properties = require("./Properties");
18
- Object.keys(_Properties).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _Properties[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _Properties[key];
25
- }
26
- });
27
- });
9
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./utils\";\nexport * from \"./Properties\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":["DevToolsSection"],"sources":["index.ts"],"sourcesContent":["export * from \"./utils.js\";\nexport * from \"./Properties.js\";\nexport * from \"./useDebugConfig.js\";\nexport * from \"./useIdGenerator.js\";\nexport * from \"./createConfigurableComponent.js\";\nexport * from \"./domain/index.js\";\nexport { DevToolsSection } from \"./DevToolsSection.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@webiny/react-properties",
3
- "version": "0.0.0-unstable.7f63ea0744",
3
+ "version": "0.0.0-unstable.81ae05e56b",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "repository": {
6
7
  "type": "git",
@@ -10,25 +11,21 @@
10
11
  "author": "Webiny Ltd",
11
12
  "license": "MIT",
12
13
  "dependencies": {
13
- "@babel/runtime": "7.20.13",
14
- "@types/react": "17.0.39",
15
- "nanoid": "3.3.4",
16
- "react": "17.0.2"
14
+ "@types/react": "18.3.28",
15
+ "@webiny/react-composition": "0.0.0-unstable.81ae05e56b",
16
+ "lodash": "4.17.23",
17
+ "nanoid": "5.1.7",
18
+ "react": "18.3.1"
17
19
  },
18
20
  "devDependencies": {
19
- "@testing-library/react": "^12.1.5",
20
- "@webiny/cli": "^0.0.0-unstable.7f63ea0744",
21
- "@webiny/project-utils": "^0.0.0-unstable.7f63ea0744",
22
- "@webiny/react-composition": "^0.0.0-unstable.7f63ea0744",
23
- "prettier": "^2.8.3"
21
+ "@testing-library/react": "16.3.2",
22
+ "@webiny/build-tools": "0.0.0-unstable.81ae05e56b",
23
+ "prettier": "3.6.2",
24
+ "vitest": "4.1.0"
24
25
  },
25
26
  "publishConfig": {
26
27
  "access": "public",
27
28
  "directory": "dist"
28
29
  },
29
- "scripts": {
30
- "build": "yarn webiny run build",
31
- "watch": "yarn webiny run watch"
32
- },
33
- "gitHead": "7f63ea0744c9e31977e5dabb95538d22b4db585c"
30
+ "gitHead": "81ae05e56bcc774d1e077ca615a0005e736aa5a6"
34
31
  }