@webiny/react-properties 6.0.0-beta.0 → 6.0.0-rc.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/Properties.d.ts +16 -2
- package/Properties.js +149 -191
- package/Properties.js.map +1 -1
- package/PropertyPriority.d.ts +8 -0
- package/PropertyPriority.js +15 -0
- package/PropertyPriority.js.map +1 -0
- package/README.md +7 -61
- package/createConfigurableComponent.d.ts +1 -1
- package/createConfigurableComponent.js +67 -64
- package/createConfigurableComponent.js.map +1 -1
- package/domain/PropertyStore.d.ts +48 -0
- package/domain/PropertyStore.js +200 -0
- package/domain/PropertyStore.js.map +1 -0
- package/domain/index.d.ts +1 -0
- package/domain/index.js +3 -0
- package/domain/index.js.map +1 -0
- package/index.d.ts +6 -4
- package/index.js +6 -49
- package/index.js.map +1 -1
- package/package.json +9 -12
- package/useDebugConfig.d.ts +7 -0
- package/useDebugConfig.js +19 -0
- package/useDebugConfig.js.map +1 -0
- package/useIdGenerator.js +9 -14
- package/useIdGenerator.js.map +1 -1
- package/utils.d.ts +1 -1
- package/utils.js +33 -32
- package/utils.js.map +1 -1
|
@@ -1,93 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _reactComposition = require("@webiny/react-composition");
|
|
12
|
-
var _index = require("./index");
|
|
13
|
-
var createHOC = function createHOC(newChildren) {
|
|
14
|
-
return function (BaseComponent) {
|
|
15
|
-
return function ConfigHOC(_ref) {
|
|
16
|
-
var children = _ref.children;
|
|
17
|
-
return /*#__PURE__*/_react.default.createElement(BaseComponent, null, newChildren, children);
|
|
18
|
-
};
|
|
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
|
+
const createHOC = newChildren => BaseComponent => {
|
|
7
|
+
return function ConfigHOC({
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(BaseComponent, null, children, newChildren);
|
|
19
11
|
};
|
|
20
12
|
};
|
|
21
|
-
function createConfigurableComponent(name) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var children = _ref2.children;
|
|
27
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
13
|
+
export function createConfigurableComponent(name) {
|
|
14
|
+
const ConfigApplyPrimary = makeDecoratable(`${name}ConfigApply<Primary>`, ({
|
|
15
|
+
children
|
|
16
|
+
}) => {
|
|
17
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
28
18
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
const ConfigApplySecondary = makeDecoratable(`${name}ConfigApply<Secondary>`, ({
|
|
20
|
+
children
|
|
21
|
+
}) => {
|
|
22
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
32
23
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var Config = function Config(_ref4) {
|
|
38
|
-
var _ref4$priority = _ref4.priority,
|
|
39
|
-
priority = _ref4$priority === void 0 ? "primary" : _ref4$priority,
|
|
40
|
-
children = _ref4.children;
|
|
24
|
+
const Config = ({
|
|
25
|
+
priority = "primary",
|
|
26
|
+
children
|
|
27
|
+
}) => {
|
|
41
28
|
if (priority === "primary") {
|
|
42
|
-
return /*#__PURE__*/
|
|
29
|
+
return /*#__PURE__*/React.createElement(Compose, {
|
|
43
30
|
component: ConfigApplyPrimary,
|
|
44
31
|
with: createHOC(children)
|
|
45
32
|
});
|
|
46
33
|
}
|
|
47
|
-
return /*#__PURE__*/
|
|
34
|
+
return /*#__PURE__*/React.createElement(Compose, {
|
|
48
35
|
component: ConfigApplySecondary,
|
|
49
36
|
with: createHOC(children)
|
|
50
37
|
});
|
|
51
38
|
};
|
|
52
|
-
|
|
39
|
+
const defaultContext = {
|
|
53
40
|
properties: []
|
|
54
41
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
42
|
+
const ViewContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Memoized config subtree — ConfigApply components don't depend on WithConfig
|
|
46
|
+
* props, so they must not remount when the parent re-renders. Without this,
|
|
47
|
+
* every parent re-render causes Property components inside HOCs to unmount
|
|
48
|
+
* and remount, corrupting the config object.
|
|
49
|
+
*/
|
|
50
|
+
const ConfigApplyTree = /*#__PURE__*/React.memo(function ConfigApplyTree() {
|
|
51
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ConfigApplyPrimary, null), /*#__PURE__*/React.createElement(PropertyPriorityProvider, {
|
|
52
|
+
priority: 1
|
|
53
|
+
}, /*#__PURE__*/React.createElement(ConfigApplySecondary, null)));
|
|
54
|
+
});
|
|
55
|
+
const WithConfig = ({
|
|
56
|
+
onProperties,
|
|
57
|
+
children
|
|
58
|
+
}) => {
|
|
59
|
+
// `null` = config not yet collected; `[]` = collected but empty.
|
|
60
|
+
// This distinction is critical: children must NOT render until the
|
|
61
|
+
// PropertyStore debounce has flushed and delivered the initial config.
|
|
62
|
+
// Rendering children with partial/empty config causes errors in
|
|
63
|
+
// consumers like LexicalEditor that require a complete config on mount.
|
|
64
|
+
const [properties, setProperties] = useState(null);
|
|
65
|
+
const resolvedProperties = properties ?? [];
|
|
66
|
+
useDebugConfig(name, resolvedProperties);
|
|
67
|
+
const context = {
|
|
68
|
+
properties: resolvedProperties
|
|
65
69
|
};
|
|
66
|
-
|
|
67
|
-
if (typeof onProperties === "function") {
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (properties !== null && typeof onProperties === "function") {
|
|
68
72
|
onProperties(properties);
|
|
69
73
|
}
|
|
70
74
|
}, [properties]);
|
|
71
|
-
|
|
75
|
+
const stateUpdater = useCallback(properties => {
|
|
72
76
|
setProperties(properties);
|
|
73
|
-
};
|
|
74
|
-
return /*#__PURE__*/
|
|
77
|
+
}, []);
|
|
78
|
+
return /*#__PURE__*/React.createElement(ViewContext.Provider, {
|
|
75
79
|
value: context
|
|
76
|
-
}, /*#__PURE__*/
|
|
80
|
+
}, /*#__PURE__*/React.createElement(Properties, {
|
|
77
81
|
onChange: stateUpdater
|
|
78
|
-
}, /*#__PURE__*/
|
|
82
|
+
}, /*#__PURE__*/React.createElement(ConfigApplyTree, null)), properties !== null ? children : null);
|
|
79
83
|
};
|
|
80
84
|
function useConfig() {
|
|
81
|
-
|
|
82
|
-
properties
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, [properties]);
|
|
85
|
+
const {
|
|
86
|
+
properties
|
|
87
|
+
} = useContext(ViewContext);
|
|
88
|
+
return useMemo(() => toObject(properties), [properties]);
|
|
86
89
|
}
|
|
87
90
|
return {
|
|
88
|
-
WithConfig
|
|
89
|
-
Config
|
|
90
|
-
useConfig
|
|
91
|
+
WithConfig,
|
|
92
|
+
Config,
|
|
93
|
+
useConfig
|
|
91
94
|
};
|
|
92
95
|
}
|
|
93
96
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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\nconst createHOC =\n (newChildren: React.ReactNode): Decorator<GenericComponent<{ children?: React.ReactNode }>> =>\n BaseComponent => {\n return function ConfigHOC({ children }) {\n return (\n <BaseComponent>\n {children}\n {newChildren}\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 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,MAAMC,SAAS,GACVC,WAA4B,IAC7BC,a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EAED,SAAS0B,SAASA,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,48 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* Synchronous lookup map — written immediately on addProperty (before debounce),
|
|
15
|
+
* so useAncestor can find properties during render.
|
|
16
|
+
*/
|
|
17
|
+
private lookup;
|
|
18
|
+
private scheduleFlush;
|
|
19
|
+
get allProperties(): Property[];
|
|
20
|
+
subscribe(listener: Listener): () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Returns properties that are children of the given parent ID.
|
|
23
|
+
* Reads from the synchronous lookup map, so it works during render
|
|
24
|
+
* before the debounced queue has flushed.
|
|
25
|
+
*/
|
|
26
|
+
getChildrenOf(parentId: string): Property[];
|
|
27
|
+
/**
|
|
28
|
+
* Find a property by ID from the synchronous lookup map.
|
|
29
|
+
*/
|
|
30
|
+
getById(id: string): Property | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Register a property in the synchronous lookup map during render,
|
|
33
|
+
* so useAncestor can find it before the debounced queue flushes.
|
|
34
|
+
*/
|
|
35
|
+
registerLookup(property: Property): void;
|
|
36
|
+
addProperty(property: Property, options?: AddPropertyOptions): void;
|
|
37
|
+
removeProperty(id: string): void;
|
|
38
|
+
replaceProperty(oldId: string, newProperty: Property): void;
|
|
39
|
+
private processQueue;
|
|
40
|
+
private executeAdd;
|
|
41
|
+
private executeRemove;
|
|
42
|
+
private executeReplace;
|
|
43
|
+
private insertBefore;
|
|
44
|
+
private insertAfter;
|
|
45
|
+
private reposition;
|
|
46
|
+
private removeDescendants;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import debounce from "lodash/debounce.js";
|
|
2
|
+
export class PropertyStore {
|
|
3
|
+
map = new Map();
|
|
4
|
+
order = [];
|
|
5
|
+
queue = [];
|
|
6
|
+
listeners = new Set();
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Synchronous lookup map — written immediately on addProperty (before debounce),
|
|
10
|
+
* so useAncestor can find properties during render.
|
|
11
|
+
*/
|
|
12
|
+
lookup = new Map();
|
|
13
|
+
scheduleFlush = debounce(() => {
|
|
14
|
+
this.processQueue();
|
|
15
|
+
}, 0);
|
|
16
|
+
get allProperties() {
|
|
17
|
+
return this.order.filter(id => this.map.has(id)).map(id => this.map.get(id));
|
|
18
|
+
}
|
|
19
|
+
subscribe(listener) {
|
|
20
|
+
this.listeners.add(listener);
|
|
21
|
+
return () => {
|
|
22
|
+
this.listeners.delete(listener);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns properties that are children of the given parent ID.
|
|
28
|
+
* Reads from the synchronous lookup map, so it works during render
|
|
29
|
+
* before the debounced queue has flushed.
|
|
30
|
+
*/
|
|
31
|
+
getChildrenOf(parentId) {
|
|
32
|
+
return Array.from(this.lookup.values()).filter(p => p.parent === parentId);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Find a property by ID from the synchronous lookup map.
|
|
37
|
+
*/
|
|
38
|
+
getById(id) {
|
|
39
|
+
return this.lookup.get(id);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Register a property in the synchronous lookup map during render,
|
|
44
|
+
* so useAncestor can find it before the debounced queue flushes.
|
|
45
|
+
*/
|
|
46
|
+
registerLookup(property) {
|
|
47
|
+
if (this.lookup.has(property.id)) {
|
|
48
|
+
const existing = this.lookup.get(property.id);
|
|
49
|
+
this.lookup.set(property.id, {
|
|
50
|
+
...existing,
|
|
51
|
+
...property
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
this.lookup.set(property.id, property);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
addProperty(property, options = {}) {
|
|
58
|
+
this.registerLookup(property);
|
|
59
|
+
this.queue.push({
|
|
60
|
+
type: "add",
|
|
61
|
+
property,
|
|
62
|
+
options
|
|
63
|
+
});
|
|
64
|
+
this.scheduleFlush();
|
|
65
|
+
}
|
|
66
|
+
removeProperty(id) {
|
|
67
|
+
this.lookup.delete(id);
|
|
68
|
+
this.queue.push({
|
|
69
|
+
type: "remove",
|
|
70
|
+
id
|
|
71
|
+
});
|
|
72
|
+
this.scheduleFlush();
|
|
73
|
+
}
|
|
74
|
+
replaceProperty(oldId, newProperty) {
|
|
75
|
+
this.lookup.delete(oldId);
|
|
76
|
+
this.lookup.set(newProperty.id, newProperty);
|
|
77
|
+
this.queue.push({
|
|
78
|
+
type: "replace",
|
|
79
|
+
oldId,
|
|
80
|
+
newProperty
|
|
81
|
+
});
|
|
82
|
+
this.scheduleFlush();
|
|
83
|
+
}
|
|
84
|
+
processQueue() {
|
|
85
|
+
if (this.queue.length === 0) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const ops = this.queue.splice(0);
|
|
89
|
+
|
|
90
|
+
// Stable-sort operations so that "add" ops with lower priority numbers
|
|
91
|
+
// are processed first. Non-add operations and adds with default priority (0)
|
|
92
|
+
// keep their original order.
|
|
93
|
+
ops.sort((a, b) => {
|
|
94
|
+
const pa = a.type === "add" ? a.options.priority ?? 0 : 0;
|
|
95
|
+
const pb = b.type === "add" ? b.options.priority ?? 0 : 0;
|
|
96
|
+
return pa - pb;
|
|
97
|
+
});
|
|
98
|
+
for (const op of ops) {
|
|
99
|
+
switch (op.type) {
|
|
100
|
+
case "add":
|
|
101
|
+
this.executeAdd(op.property, op.options);
|
|
102
|
+
break;
|
|
103
|
+
case "remove":
|
|
104
|
+
this.executeRemove(op.id);
|
|
105
|
+
break;
|
|
106
|
+
case "replace":
|
|
107
|
+
this.executeReplace(op.oldId, op.newProperty);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const properties = this.allProperties;
|
|
112
|
+
for (const listener of this.listeners) {
|
|
113
|
+
listener(properties);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
executeAdd(property, options) {
|
|
117
|
+
const exists = this.map.has(property.id);
|
|
118
|
+
if (exists) {
|
|
119
|
+
const existing = this.map.get(property.id);
|
|
120
|
+
this.map.set(property.id, {
|
|
121
|
+
...existing,
|
|
122
|
+
...property
|
|
123
|
+
});
|
|
124
|
+
if (options.after) {
|
|
125
|
+
this.reposition(property.id, options.after, "after");
|
|
126
|
+
} else if (options.before) {
|
|
127
|
+
this.reposition(property.id, options.before, "before");
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.map.set(property.id, property);
|
|
132
|
+
if (options.after) {
|
|
133
|
+
this.insertAfter(property.id, options.after);
|
|
134
|
+
} else if (options.before) {
|
|
135
|
+
this.insertBefore(property.id, options.before);
|
|
136
|
+
} else {
|
|
137
|
+
this.order.push(property.id);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
executeRemove(id) {
|
|
141
|
+
if (!this.map.has(id)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
this.map.delete(id);
|
|
145
|
+
this.order = this.order.filter(oid => oid !== id);
|
|
146
|
+
this.removeDescendants(id);
|
|
147
|
+
}
|
|
148
|
+
executeReplace(oldId, newProperty) {
|
|
149
|
+
const idx = this.order.indexOf(oldId);
|
|
150
|
+
if (idx === -1) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
this.map.delete(oldId);
|
|
154
|
+
this.map.set(newProperty.id, newProperty);
|
|
155
|
+
this.order[idx] = newProperty.id;
|
|
156
|
+
this.removeDescendants(oldId);
|
|
157
|
+
}
|
|
158
|
+
insertBefore(id, before) {
|
|
159
|
+
if (before.endsWith("$first")) {
|
|
160
|
+
this.order.unshift(id);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const targetIdx = this.order.indexOf(before);
|
|
164
|
+
if (targetIdx === -1) {
|
|
165
|
+
this.order.push(id);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.order.splice(targetIdx, 0, id);
|
|
169
|
+
}
|
|
170
|
+
insertAfter(id, after) {
|
|
171
|
+
if (after.endsWith("$last")) {
|
|
172
|
+
this.order.push(id);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const targetIdx = this.order.indexOf(after);
|
|
176
|
+
if (targetIdx === -1) {
|
|
177
|
+
this.order.push(id);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this.order.splice(targetIdx + 1, 0, id);
|
|
181
|
+
}
|
|
182
|
+
reposition(id, targetId, position) {
|
|
183
|
+
this.order = this.order.filter(oid => oid !== id);
|
|
184
|
+
if (position === "before") {
|
|
185
|
+
this.insertBefore(id, targetId);
|
|
186
|
+
} else {
|
|
187
|
+
this.insertAfter(id, targetId);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
removeDescendants(parentId) {
|
|
191
|
+
const children = Array.from(this.map.values()).filter(p => p.parent === parentId);
|
|
192
|
+
for (const child of children) {
|
|
193
|
+
this.map.delete(child.id);
|
|
194
|
+
this.order = this.order.filter(oid => oid !== child.id);
|
|
195
|
+
this.removeDescendants(child.id);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=PropertyStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["debounce","PropertyStore","map","Map","order","queue","listeners","Set","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","exists","after","reposition","before","insertAfter","insertBefore","oid","removeDescendants","idx","indexOf","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\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 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 const exists = this.map.has(property.id);\n\n if (exists) {\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\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.order = this.order.filter(oid => oid !== id);\n this.removeDescendants(id);\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;;EAEvC;AACJ;AACA;AACA;EACYC,MAAM,GAAG,IAAIL,GAAG,CAAmB,CAAC;EAEpCM,aAAa,GAAGT,QAAQ,CAAC,MAAM;IACnC,IAAI,CAACU,YAAY,CAAC,CAAC;EACvB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AAI,CAACA,KAAK,CAACQ,MAAM,CAACgD,GAAG,IAAIA,GAAG,KAAK/C,EAAE,CAAC;IAEjD,IAAIuD,QAAQ,KAAK,QAAQ,EAAE;MACvB,IAAI,CAACT,YAAY,CAAC9C,EAAE,EAAEsD,QAAQ,CAAC;IACnC,CAAC,MAAM;MACH,IAAI,CAACT,WAAW,CAAC7C,EAAE,EAAEsD,QAAQ,CAAC;IAClC;EACJ;EAEQN,iBAAiBA,CAACxC,QAAgB,EAAQ;IAC9C,MAAMgD,QAAQ,GAAG/C,KAAK,CAACC,IAAI,CAAC,IAAI,CAACrB,GAAG,CAACsB,MAAM,CAAC,CAAC,CAAC,CAACZ,MAAM,CAACa,CAAC,IAAIA,CAAC,CAACC,MAAM,KAAKL,QAAQ,CAAC;IACjF,KAAK,MAAMiD,KAAK,IAAID,QAAQ,EAAE;MAC1B,IAAI,CAACnE,GAAG,CAACiB,MAAM,CAACmD,KAAK,CAACzD,EAAE,CAAC;MACzB,IAAI,CAACT,KAAK,GAAG,IAAI,CAACA,KAAK,CAACQ,MAAM,CAACgD,GAAG,IAAIA,GAAG,KAAKU,KAAK,CAACzD,EAAE,CAAC;MACvD,IAAI,CAACgD,iBAAiB,CAACS,KAAK,CAACzD,EAAE,CAAC;IACpC;EACJ;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PropertyStore } from "./PropertyStore.js";
|
package/domain/index.js
ADDED
|
@@ -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,4 +1,6 @@
|
|
|
1
|
-
export * from "./utils";
|
|
2
|
-
export * from "./Properties";
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
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";
|
package/index.js
CHANGED
|
@@ -1,51 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
});
|
|
28
|
-
var _useIdGenerator = require("./useIdGenerator");
|
|
29
|
-
Object.keys(_useIdGenerator).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _useIdGenerator[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function get() {
|
|
35
|
-
return _useIdGenerator[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _createConfigurableComponent = require("./createConfigurableComponent");
|
|
40
|
-
Object.keys(_createConfigurableComponent).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _createConfigurableComponent[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function get() {
|
|
46
|
-
return _createConfigurableComponent[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
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";
|
|
50
7
|
|
|
51
8
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"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\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/react-properties",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-rc.1",
|
|
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.24.1",
|
|
14
14
|
"@types/react": "18.2.79",
|
|
15
|
-
"@webiny/react-composition": "6.0.0-
|
|
16
|
-
"
|
|
15
|
+
"@webiny/react-composition": "6.0.0-rc.1",
|
|
16
|
+
"lodash": "4.17.23",
|
|
17
|
+
"nanoid": "5.1.6",
|
|
17
18
|
"react": "18.2.0"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"@testing-library/react": "15.0.7",
|
|
21
|
-
"@webiny/
|
|
22
|
-
"
|
|
23
|
-
"
|
|
22
|
+
"@webiny/build-tools": "6.0.0-rc.1",
|
|
23
|
+
"prettier": "3.6.2",
|
|
24
|
+
"vitest": "4.0.18"
|
|
24
25
|
},
|
|
25
26
|
"publishConfig": {
|
|
26
27
|
"access": "public",
|
|
27
28
|
"directory": "dist"
|
|
28
29
|
},
|
|
29
|
-
"
|
|
30
|
-
"build": "yarn webiny run build",
|
|
31
|
-
"watch": "yarn webiny run watch"
|
|
32
|
-
},
|
|
33
|
-
"gitHead": "aa8dbfbbd5ad13ec271adba6f2431e02991a300f"
|
|
30
|
+
"gitHead": "36d702721ff9ed39fb21d6f5fe7922a2a8716e63"
|
|
34
31
|
}
|