@asyra/props-manager 0.2.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -1
- package/dist/components/base.d.ts +12 -2
- package/dist/components/base.d.ts.map +1 -1
- package/dist/components/base.js +78 -4
- package/dist/components/base.js.map +1 -1
- package/dist/components/index.d.ts +4 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/props-change-handler.d.ts +2 -1
- package/dist/components/props-change-handler.d.ts.map +1 -1
- package/dist/components/props-change-handler.js +2 -3
- package/dist/components/props-change-handler.js.map +1 -1
- package/dist/factories/create-property.d.ts +6 -0
- package/dist/factories/create-property.d.ts.map +1 -0
- package/dist/factories/create-property.js +24 -0
- package/dist/factories/create-property.js.map +1 -0
- package/dist/index.d.ts +19 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/manager/component-accessor.d.ts +12 -0
- package/dist/manager/component-accessor.d.ts.map +1 -0
- package/dist/manager/component-accessor.js +23 -0
- package/dist/manager/component-accessor.js.map +1 -0
- package/dist/manager/props-manager.d.ts +209 -0
- package/dist/manager/props-manager.d.ts.map +1 -0
- package/dist/manager/props-manager.js +3840 -0
- package/dist/manager/props-manager.js.map +1 -0
- package/dist/manager/subscribes.d.ts.map +1 -0
- package/dist/manager/subscribes.js +76 -0
- package/dist/manager/subscribes.js.map +1 -0
- package/dist/registries/declarative-property-type.d.ts +39 -0
- package/dist/registries/declarative-property-type.d.ts.map +1 -0
- package/dist/registries/declarative-property-type.js +482 -0
- package/dist/registries/declarative-property-type.js.map +1 -0
- package/dist/registries/property-component.d.ts +50 -0
- package/dist/registries/property-component.d.ts.map +1 -0
- package/dist/registries/property-component.js +151 -0
- package/dist/registries/property-component.js.map +1 -0
- package/dist/registries/property-definition-value.d.ts +5 -0
- package/dist/registries/property-definition-value.d.ts.map +1 -0
- package/dist/registries/property-definition-value.js +19 -0
- package/dist/registries/property-definition-value.js.map +1 -0
- package/dist/registries/property-definition.d.ts +48 -0
- package/dist/registries/property-definition.d.ts.map +1 -0
- package/dist/registries/property-definition.js +107 -0
- package/dist/registries/property-definition.js.map +1 -0
- package/dist/registries/property-registration.d.ts +36 -0
- package/dist/registries/property-registration.d.ts.map +1 -0
- package/dist/registries/property-registration.js +61 -0
- package/dist/registries/property-registration.js.map +1 -0
- package/dist/registries/property-schema.d.ts +19 -0
- package/dist/registries/property-schema.d.ts.map +1 -0
- package/dist/registries/property-schema.js +75 -0
- package/dist/registries/property-schema.js.map +1 -0
- package/dist/registries/property-value-kind.d.ts +3 -0
- package/dist/registries/property-value-kind.d.ts.map +1 -0
- package/dist/registries/property-value-kind.js +18 -0
- package/dist/registries/property-value-kind.js.map +1 -0
- package/dist/registries/registration-options.d.ts +4 -0
- package/dist/registries/registration-options.d.ts.map +1 -0
- package/dist/registries/registration-options.js +2 -0
- package/dist/registries/registration-options.js.map +1 -0
- package/dist/registries/state.d.ts +14 -0
- package/dist/registries/state.d.ts.map +1 -0
- package/dist/registries/state.js +53 -0
- package/dist/registries/state.js.map +1 -0
- package/package.json +24 -4
- package/.turbo/turbo-test$colon$ci.log +0 -130
- package/.turbo/turbo-test$colon$local.log +0 -46
- package/.turbo/turbo-test.log +0 -0
- package/CHANGELOG.md +0 -37
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -368
- package/coverage/coverage-final.json +0 -5904
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -131
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/coverage/src/components/base.ts.html +0 -262
- package/coverage/src/components/dimension.ts.html +0 -253
- package/coverage/src/components/index.html +0 -176
- package/coverage/src/components/index.ts.html +0 -106
- package/coverage/src/components/position.ts.html +0 -250
- package/coverage/src/components/props-change-handler.ts.html +0 -145
- package/coverage/src/index.html +0 -161
- package/coverage/src/index.ts.html +0 -106
- package/coverage/src/props-manager.ts.html +0 -574
- package/coverage/src/subscribes.ts.html +0 -247
- package/coverage/src/utils.ts.html +0 -226
- package/dist/__tests__/props-manager.test.d.ts +0 -2
- package/dist/__tests__/props-manager.test.d.ts.map +0 -1
- package/dist/__tests__/props-manager.test.js +0 -290
- package/dist/__tests__/props-manager.test.js.map +0 -1
- package/dist/components/dimension.d.ts +0 -12
- package/dist/components/dimension.d.ts.map +0 -1
- package/dist/components/dimension.js +0 -43
- package/dist/components/dimension.js.map +0 -1
- package/dist/components/position.d.ts +0 -12
- package/dist/components/position.d.ts.map +0 -1
- package/dist/components/position.js +0 -42
- package/dist/components/position.js.map +0 -1
- package/dist/props-manager.d.ts +0 -28
- package/dist/props-manager.d.ts.map +0 -1
- package/dist/props-manager.js +0 -120
- package/dist/props-manager.js.map +0 -1
- package/dist/subscribes.d.ts.map +0 -1
- package/dist/subscribes.js +0 -35
- package/dist/subscribes.js.map +0 -1
- package/dist/utils.d.ts +0 -3
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -31
- package/dist/utils.js.map +0 -1
- package/src/__tests__/props-manager.test.ts +0 -362
- package/src/components/base.ts +0 -59
- package/src/components/dimension.ts +0 -56
- package/src/components/index.ts +0 -7
- package/src/components/position.ts +0 -55
- package/src/components/props-change-handler.ts +0 -20
- package/src/index.ts +0 -7
- package/src/props-manager.ts +0 -163
- package/src/subscribes.ts +0 -54
- package/src/utils.ts +0 -47
- package/tsconfig.json +0 -17
- /package/dist/{subscribes.d.ts → manager/subscribes.d.ts} +0 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
import { isRecord } from '@asyra/utils';
|
|
2
|
+
import { BasePropertyComponent } from '../components/index.js';
|
|
3
|
+
import propsManager from '../manager/props-manager.js';
|
|
4
|
+
import { clonePropertyComponentConfigRegistration, getPropertyComponent, getPropertyComponentConfigDefinition, markPropertyComponentBatchRebindable, propertyComponentRegistry, registerPropertyComponent, resolvePropertyComponentConfigRoles, restorePropertyComponentAfterFailedDeclarativeCommit } from './property-component.js';
|
|
5
|
+
import { clonePropertyDefinitionRecord, clonePropertyDefinitionValue } from './property-definition-value.js';
|
|
6
|
+
import { PropertyRegistrationError } from './property-registration.js';
|
|
7
|
+
import { getPropertySchema, propertySchemaRegistry, registerPropertySchema, restorePropertySchemaAfterFailedDeclarativeCommit } from './property-schema.js';
|
|
8
|
+
import { matchesPropertyValueKind } from './property-value-kind.js';
|
|
9
|
+
export const PROPERTY_TYPE_DEFINITION_ERROR_CODES = [
|
|
10
|
+
'PROPERTY_TYPE_NOT_DECLARATIVE',
|
|
11
|
+
'PROPERTY_TYPE_DEFINITION_DRIFT',
|
|
12
|
+
'PROPERTY_TYPE_DEFINITION_INVALID',
|
|
13
|
+
'PROPERTY_TYPE_DEFINITION_COMMIT_FAILED'
|
|
14
|
+
];
|
|
15
|
+
export class PropertyTypeDefinitionError extends Error {
|
|
16
|
+
constructor(result, cause) {
|
|
17
|
+
super(result.message);
|
|
18
|
+
this.name = 'PropertyTypeDefinitionError';
|
|
19
|
+
this.code = result.code;
|
|
20
|
+
this.type = result.type;
|
|
21
|
+
this.result = { ...result };
|
|
22
|
+
this.cause = cause;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const failDefinition = (code, type, message, cause) => {
|
|
26
|
+
throw new PropertyTypeDefinitionError({ ok: false, code, type, message }, cause);
|
|
27
|
+
};
|
|
28
|
+
const valuesEqual = (left, right) => {
|
|
29
|
+
if (Object.is(left, right))
|
|
30
|
+
return true;
|
|
31
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
32
|
+
return (Array.isArray(left) &&
|
|
33
|
+
Array.isArray(right) &&
|
|
34
|
+
left.length === right.length &&
|
|
35
|
+
left.every((item, index) => valuesEqual(item, right[index])));
|
|
36
|
+
}
|
|
37
|
+
if (!isRecord(left) || !isRecord(right))
|
|
38
|
+
return false;
|
|
39
|
+
const leftKeys = Object.keys(left);
|
|
40
|
+
const rightKeys = Object.keys(right);
|
|
41
|
+
return (leftKeys.length === rightKeys.length &&
|
|
42
|
+
leftKeys.every((key) => Object.prototype.hasOwnProperty.call(right, key) &&
|
|
43
|
+
valuesEqual(left[key], right[key])));
|
|
44
|
+
};
|
|
45
|
+
const VALUE_KINDS = new Set([
|
|
46
|
+
'number',
|
|
47
|
+
'string',
|
|
48
|
+
'boolean',
|
|
49
|
+
'object',
|
|
50
|
+
'array',
|
|
51
|
+
'custom'
|
|
52
|
+
]);
|
|
53
|
+
const UNIT_KINDS = new Set(['px', 'pct', 'auto', 'custom']);
|
|
54
|
+
const FIXED_RESERVED_KEYS = new Set(['id', 'type']);
|
|
55
|
+
const hasDuplicates = (keys) => new Set(keys).size !== keys.length;
|
|
56
|
+
const validateDefault = (type, field, code) => {
|
|
57
|
+
if (!matchesPropertyValueKind(field.kind, field.defaultValue)) {
|
|
58
|
+
failDefinition(code, type, `Property field "${field.key}" has an invalid default for kind "${field.kind}"`);
|
|
59
|
+
}
|
|
60
|
+
if (field.allowedUnits &&
|
|
61
|
+
!field.allowedUnits.includes(field.defaultValue)) {
|
|
62
|
+
failDefinition(code, type, `Property field "${field.key}" default is outside its allowed units`);
|
|
63
|
+
}
|
|
64
|
+
if (field.validate) {
|
|
65
|
+
let valid = false;
|
|
66
|
+
try {
|
|
67
|
+
valid = field.validate(field.defaultValue);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
failDefinition(code, type, `Property field "${field.key}" validator rejected its default`, error);
|
|
71
|
+
}
|
|
72
|
+
if (!valid) {
|
|
73
|
+
failDefinition(code, type, `Property field "${field.key}" validator rejected its default`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const normalizeDefinition = (expectedType, definition, code = 'PROPERTY_TYPE_DEFINITION_INVALID') => {
|
|
78
|
+
if (!isRecord(definition) || definition.type !== expectedType) {
|
|
79
|
+
failDefinition(code, expectedType, `Property definition identity must remain "${expectedType}"`);
|
|
80
|
+
}
|
|
81
|
+
if (typeof definition.allowDynamicKeys !== 'boolean' ||
|
|
82
|
+
!Array.isArray(definition.dynamicReservedKeys) ||
|
|
83
|
+
!definition.dynamicReservedKeys.every((key) => typeof key === 'string' && key.length > 0) ||
|
|
84
|
+
hasDuplicates(definition.dynamicReservedKeys)) {
|
|
85
|
+
failDefinition(code, expectedType, 'Property definition has invalid dynamic-key policy');
|
|
86
|
+
}
|
|
87
|
+
if (!Array.isArray(definition.fields)) {
|
|
88
|
+
failDefinition(code, expectedType, 'Property definition fields must be an array');
|
|
89
|
+
}
|
|
90
|
+
const seenKeys = new Set();
|
|
91
|
+
const fields = definition.fields.map((field) => {
|
|
92
|
+
if (!isRecord(field)) {
|
|
93
|
+
return failDefinition(code, expectedType, 'Property field must be an object');
|
|
94
|
+
}
|
|
95
|
+
if (typeof field.key !== 'string' ||
|
|
96
|
+
field.key.length === 0 ||
|
|
97
|
+
FIXED_RESERVED_KEYS.has(field.key) ||
|
|
98
|
+
seenKeys.has(field.key)) {
|
|
99
|
+
return failDefinition(code, expectedType, `Property field key "${String(field.key)}" is duplicate or reserved`);
|
|
100
|
+
}
|
|
101
|
+
seenKeys.add(field.key);
|
|
102
|
+
if (!VALUE_KINDS.has(field.kind)) {
|
|
103
|
+
return failDefinition(code, expectedType, `Property field "${field.key}" has an invalid kind`);
|
|
104
|
+
}
|
|
105
|
+
if (!Object.prototype.hasOwnProperty.call(field, 'defaultValue') ||
|
|
106
|
+
field.defaultValue === undefined) {
|
|
107
|
+
return failDefinition(code, expectedType, `Property field "${field.key}" requires a default value`);
|
|
108
|
+
}
|
|
109
|
+
if (typeof field.persist !== 'boolean' ||
|
|
110
|
+
typeof field.project !== 'boolean' ||
|
|
111
|
+
typeof field.unit !== 'boolean' ||
|
|
112
|
+
(field.project && field.unit)) {
|
|
113
|
+
return failDefinition(code, expectedType, `Property field "${field.key}" has contradictory projection flags`);
|
|
114
|
+
}
|
|
115
|
+
if (field.validate !== undefined && typeof field.validate !== 'function') {
|
|
116
|
+
return failDefinition(code, expectedType, `Property field "${field.key}" has an invalid validator`);
|
|
117
|
+
}
|
|
118
|
+
if (field.allowedUnits !== undefined &&
|
|
119
|
+
(!Array.isArray(field.allowedUnits) ||
|
|
120
|
+
field.kind !== 'string' ||
|
|
121
|
+
field.allowedUnits.some((unit) => !UNIT_KINDS.has(unit)) ||
|
|
122
|
+
hasDuplicates(field.allowedUnits))) {
|
|
123
|
+
return failDefinition(code, expectedType, `Property field "${field.key}" has invalid allowed units`);
|
|
124
|
+
}
|
|
125
|
+
const normalizedField = {
|
|
126
|
+
key: field.key,
|
|
127
|
+
kind: field.kind,
|
|
128
|
+
defaultValue: clonePropertyDefinitionValue(field.defaultValue),
|
|
129
|
+
validate: field.validate,
|
|
130
|
+
allowedUnits: field.allowedUnits && field.allowedUnits.length > 0
|
|
131
|
+
? [...field.allowedUnits]
|
|
132
|
+
: undefined,
|
|
133
|
+
persist: field.persist,
|
|
134
|
+
project: field.project,
|
|
135
|
+
unit: field.unit
|
|
136
|
+
};
|
|
137
|
+
validateDefault(expectedType, normalizedField, code);
|
|
138
|
+
return normalizedField;
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
type: expectedType,
|
|
142
|
+
fields,
|
|
143
|
+
allowDynamicKeys: definition.allowDynamicKeys,
|
|
144
|
+
dynamicReservedKeys: [...definition.dynamicReservedKeys]
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
const uniqueKeys = (keys) => [...new Set(keys)];
|
|
148
|
+
const isString = (value) => typeof value === 'string';
|
|
149
|
+
const assertCanonicalRelationshipDefault = (type, config, defaults, persistKeys, code) => {
|
|
150
|
+
const relation = config.children;
|
|
151
|
+
if (!relation) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const value = defaults[relation.key];
|
|
155
|
+
if (!Object.prototype.hasOwnProperty.call(defaults, relation.key) ||
|
|
156
|
+
!persistKeys.includes(relation.key) ||
|
|
157
|
+
!Array.isArray(value) ||
|
|
158
|
+
value.some((childId) => typeof childId !== 'string' || childId.length === 0) ||
|
|
159
|
+
new Set(value).size !== value.length) {
|
|
160
|
+
failDefinition(code, type, `Property relationship default "${relation.key}" must be a persisted ordered array of unique canonical ids`);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const projectRegisteredDefinition = (type, schema, config) => {
|
|
164
|
+
const { defaults, persistKeys, valueKeys, unitKeys } = resolvePropertyComponentConfigRoles(config);
|
|
165
|
+
const schemaKeys = schema.fields.map((field) => field.key);
|
|
166
|
+
const defaultKeys = Object.keys(defaults);
|
|
167
|
+
const knownKeys = new Set(schemaKeys);
|
|
168
|
+
const drift = (message) => failDefinition('PROPERTY_TYPE_DEFINITION_DRIFT', type, message);
|
|
169
|
+
assertCanonicalRelationshipDefault(type, config, defaults, persistKeys, 'PROPERTY_TYPE_DEFINITION_DRIFT');
|
|
170
|
+
if (schema.type !== type ||
|
|
171
|
+
config.type !== type ||
|
|
172
|
+
hasDuplicates(schemaKeys) ||
|
|
173
|
+
hasDuplicates(defaultKeys) ||
|
|
174
|
+
hasDuplicates(persistKeys) ||
|
|
175
|
+
hasDuplicates(valueKeys) ||
|
|
176
|
+
hasDuplicates(unitKeys) ||
|
|
177
|
+
schemaKeys.length !== defaultKeys.length ||
|
|
178
|
+
schemaKeys.some((key) => !Object.prototype.hasOwnProperty.call(defaults, key)) ||
|
|
179
|
+
[...persistKeys, ...valueKeys, ...unitKeys].some((key) => !knownKeys.has(key)) ||
|
|
180
|
+
valueKeys.some((key) => unitKeys.includes(key))) {
|
|
181
|
+
return drift(`Property type "${type}" schema and config runtime are not a complete matching definition`);
|
|
182
|
+
}
|
|
183
|
+
const persistSet = new Set(persistKeys);
|
|
184
|
+
const valueSet = new Set(valueKeys);
|
|
185
|
+
const unitSet = new Set(unitKeys);
|
|
186
|
+
const fields = schema.fields.map((field) => {
|
|
187
|
+
if (!Object.prototype.hasOwnProperty.call(field, 'defaultValue') ||
|
|
188
|
+
!valuesEqual(field.defaultValue, defaults[field.key])) {
|
|
189
|
+
return drift(`Property field "${field.key}" schema and runtime defaults have drifted`);
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
key: field.key,
|
|
193
|
+
kind: field.kind,
|
|
194
|
+
defaultValue: clonePropertyDefinitionValue(field.defaultValue),
|
|
195
|
+
validate: field.validate,
|
|
196
|
+
allowedUnits: field.allowedUnits ? [...field.allowedUnits] : undefined,
|
|
197
|
+
persist: persistSet.has(field.key),
|
|
198
|
+
project: valueSet.has(field.key),
|
|
199
|
+
unit: unitSet.has(field.key)
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
return normalizeDefinition(type, {
|
|
203
|
+
type,
|
|
204
|
+
fields,
|
|
205
|
+
allowDynamicKeys: config.allowDynamicKeys === true,
|
|
206
|
+
dynamicReservedKeys: [...(config.dynamicReservedKeys ?? [])]
|
|
207
|
+
}, 'PROPERTY_TYPE_DEFINITION_DRIFT');
|
|
208
|
+
};
|
|
209
|
+
export const getDeclarativePropertyTypeDefinition = (type) => {
|
|
210
|
+
const schema = getPropertySchema(type);
|
|
211
|
+
const component = getPropertyComponent(type);
|
|
212
|
+
const config = getPropertyComponentConfigDefinition(type);
|
|
213
|
+
if (!schema && !component && !config)
|
|
214
|
+
return;
|
|
215
|
+
if (component && !config) {
|
|
216
|
+
return failDefinition('PROPERTY_TYPE_NOT_DECLARATIVE', type, `Property type "${type}" uses constructor mode and cannot be redefined declaratively`);
|
|
217
|
+
}
|
|
218
|
+
if (!schema || !component || !config) {
|
|
219
|
+
return failDefinition('PROPERTY_TYPE_DEFINITION_DRIFT', type, `Property type "${type}" has an incomplete schema/runtime registration`);
|
|
220
|
+
}
|
|
221
|
+
return projectRegisteredDefinition(type, schema, config);
|
|
222
|
+
};
|
|
223
|
+
const toPropertySchema = (definition) => ({
|
|
224
|
+
type: definition.type,
|
|
225
|
+
fields: definition.fields.map((field) => ({
|
|
226
|
+
key: field.key,
|
|
227
|
+
kind: field.kind,
|
|
228
|
+
defaultValue: clonePropertyDefinitionValue(field.defaultValue),
|
|
229
|
+
validate: field.validate,
|
|
230
|
+
allowedUnits: field.allowedUnits ? [...field.allowedUnits] : undefined
|
|
231
|
+
}))
|
|
232
|
+
});
|
|
233
|
+
const toConfigRegistration = (definition, current) => ({
|
|
234
|
+
type: definition.type,
|
|
235
|
+
defaults: definition.fields.reduce((defaults, field) => {
|
|
236
|
+
defaults[field.key] = clonePropertyDefinitionValue(field.defaultValue);
|
|
237
|
+
return defaults;
|
|
238
|
+
}, {}),
|
|
239
|
+
persistKeys: definition.fields
|
|
240
|
+
.filter((field) => field.persist)
|
|
241
|
+
.map((field) => field.key),
|
|
242
|
+
valueKeys: definition.fields
|
|
243
|
+
.filter((field) => field.project)
|
|
244
|
+
.map((field) => field.key),
|
|
245
|
+
unitKeys: definition.fields
|
|
246
|
+
.filter((field) => field.unit)
|
|
247
|
+
.map((field) => field.key),
|
|
248
|
+
allowDynamicKeys: definition.allowDynamicKeys,
|
|
249
|
+
dynamicReservedKeys: [...definition.dynamicReservedKeys],
|
|
250
|
+
children: current.children ? { ...current.children } : undefined
|
|
251
|
+
});
|
|
252
|
+
export const createPropertyComponentFromConfig = (definition) => {
|
|
253
|
+
const config = clonePropertyComponentConfigRegistration(definition);
|
|
254
|
+
const defaults = isRecord(config.defaults) ? config.defaults : {};
|
|
255
|
+
const allowDynamicKeys = config.allowDynamicKeys === true;
|
|
256
|
+
const children = config.children;
|
|
257
|
+
const fixedKeys = new Set(Object.keys(defaults));
|
|
258
|
+
if (children)
|
|
259
|
+
fixedKeys.add(children.key);
|
|
260
|
+
const reservedDynamicKeys = new Set(uniqueKeys([
|
|
261
|
+
'id',
|
|
262
|
+
'type',
|
|
263
|
+
...fixedKeys,
|
|
264
|
+
...(config.dynamicReservedKeys ?? [])
|
|
265
|
+
]));
|
|
266
|
+
const isAllowedDynamicKey = (key) => !reservedDynamicKeys.has(key);
|
|
267
|
+
const { persistKeys, valueKeys, unitKeys } = resolvePropertyComponentConfigRoles(config);
|
|
268
|
+
assertCanonicalRelationshipDefault(config.type, config, defaults, persistKeys, 'PROPERTY_TYPE_DEFINITION_INVALID');
|
|
269
|
+
const normalizeChildrenValue = (value, accessor) => {
|
|
270
|
+
if (!children || !Array.isArray(value))
|
|
271
|
+
return null;
|
|
272
|
+
const mode = children.mode ?? 'ids';
|
|
273
|
+
if (mode === 'ids')
|
|
274
|
+
return value.every(isString) ? value : null;
|
|
275
|
+
const childIds = [];
|
|
276
|
+
value.forEach((item) => {
|
|
277
|
+
if (isString(item)) {
|
|
278
|
+
childIds.push(item);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (!isRecord(item))
|
|
282
|
+
return;
|
|
283
|
+
const mapped = children.toChildData ? children.toChildData(item) : item;
|
|
284
|
+
if (!isRecord(mapped))
|
|
285
|
+
return;
|
|
286
|
+
const childData = {
|
|
287
|
+
...mapped,
|
|
288
|
+
type: children.childType
|
|
289
|
+
};
|
|
290
|
+
let childId = '';
|
|
291
|
+
if (isString(item.id)) {
|
|
292
|
+
childId = item.id;
|
|
293
|
+
}
|
|
294
|
+
if (isString(childData.id)) {
|
|
295
|
+
childId = childData.id;
|
|
296
|
+
}
|
|
297
|
+
if (!childId && 'id' in childData)
|
|
298
|
+
delete childData.id;
|
|
299
|
+
const existing = childId ? accessor.getPropertyById(childId) : undefined;
|
|
300
|
+
if (existing &&
|
|
301
|
+
typeof existing.get === 'function' &&
|
|
302
|
+
existing.get('type') === children.childType &&
|
|
303
|
+
typeof existing.set === 'function') {
|
|
304
|
+
Object.entries(childData).forEach(([key, childValue]) => {
|
|
305
|
+
if (key === 'id' || key === 'type')
|
|
306
|
+
return;
|
|
307
|
+
existing.set(key, childValue);
|
|
308
|
+
});
|
|
309
|
+
const existingId = existing.get('id');
|
|
310
|
+
if (isString(existingId))
|
|
311
|
+
childIds.push(existingId);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const created = accessor.createComponent(childId ? { id: childId, ...childData } : childData);
|
|
315
|
+
if (!created)
|
|
316
|
+
return;
|
|
317
|
+
accessor.addToMap(created);
|
|
318
|
+
const createdId = created.get('id');
|
|
319
|
+
if (isString(createdId))
|
|
320
|
+
childIds.push(createdId);
|
|
321
|
+
});
|
|
322
|
+
return childIds;
|
|
323
|
+
};
|
|
324
|
+
const toChildrenValue = (value, accessor) => {
|
|
325
|
+
if (!children?.toValue || !Array.isArray(value))
|
|
326
|
+
return value;
|
|
327
|
+
return value
|
|
328
|
+
.filter(isString)
|
|
329
|
+
.map((childId) => {
|
|
330
|
+
const child = accessor.getPropertyById(childId);
|
|
331
|
+
if (!child || typeof child.get !== 'function')
|
|
332
|
+
return null;
|
|
333
|
+
return children.toValue?.(child, childId);
|
|
334
|
+
})
|
|
335
|
+
.filter((item) => item !== null);
|
|
336
|
+
};
|
|
337
|
+
class ConfiguredPropertyComponent extends BasePropertyComponent {
|
|
338
|
+
constructor(data) {
|
|
339
|
+
super();
|
|
340
|
+
this.data = {
|
|
341
|
+
id: '',
|
|
342
|
+
type: config.type,
|
|
343
|
+
...clonePropertyDefinitionRecord(defaults)
|
|
344
|
+
};
|
|
345
|
+
this.load(data);
|
|
346
|
+
}
|
|
347
|
+
load(data) {
|
|
348
|
+
this.data.id = typeof data.id === 'string' ? data.id : this.data.id;
|
|
349
|
+
const rawData = isRecord(data) ? data : {};
|
|
350
|
+
persistKeys.forEach((key) => {
|
|
351
|
+
if (children && key === children.key) {
|
|
352
|
+
const normalized = normalizeChildrenValue(rawData[key], this.propertyComponentAccessor);
|
|
353
|
+
if (normalized) {
|
|
354
|
+
this.data[key] =
|
|
355
|
+
normalized;
|
|
356
|
+
}
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
if (!(key in rawData))
|
|
360
|
+
return;
|
|
361
|
+
this.assignLoadedValue(key, rawData[key]);
|
|
362
|
+
});
|
|
363
|
+
if (!allowDynamicKeys)
|
|
364
|
+
return;
|
|
365
|
+
Object.entries(rawData).forEach(([key, value]) => {
|
|
366
|
+
if (!isAllowedDynamicKey(key) || value === undefined)
|
|
367
|
+
return;
|
|
368
|
+
this.data[key] =
|
|
369
|
+
clonePropertyDefinitionValue(value);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
save() {
|
|
373
|
+
const saved = super.save();
|
|
374
|
+
const data = this.data;
|
|
375
|
+
const dynamicPersistKeys = allowDynamicKeys
|
|
376
|
+
? Object.keys(data).filter(isAllowedDynamicKey)
|
|
377
|
+
: [];
|
|
378
|
+
uniqueKeys([...persistKeys, ...dynamicPersistKeys]).forEach((key) => {
|
|
379
|
+
const current = data[key];
|
|
380
|
+
if (current !== undefined)
|
|
381
|
+
saved[key] = current;
|
|
382
|
+
});
|
|
383
|
+
return saved;
|
|
384
|
+
}
|
|
385
|
+
getValue() {
|
|
386
|
+
const value = {};
|
|
387
|
+
const data = this.data;
|
|
388
|
+
const dynamicValueKeys = allowDynamicKeys
|
|
389
|
+
? Object.keys(data).filter(isAllowedDynamicKey)
|
|
390
|
+
: [];
|
|
391
|
+
uniqueKeys([...valueKeys, ...dynamicValueKeys]).forEach((key) => {
|
|
392
|
+
const current = this.get(key);
|
|
393
|
+
if (current !== undefined) {
|
|
394
|
+
value[key] = toChildrenValue(current, this.propertyComponentAccessor);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
return value;
|
|
398
|
+
}
|
|
399
|
+
getUnit() {
|
|
400
|
+
const units = {};
|
|
401
|
+
unitKeys.forEach((key) => {
|
|
402
|
+
const current = this.get(key);
|
|
403
|
+
if (current !== undefined)
|
|
404
|
+
units[key] = current;
|
|
405
|
+
});
|
|
406
|
+
return units;
|
|
407
|
+
}
|
|
408
|
+
set(key, value, options) {
|
|
409
|
+
if (children && key === children.key) {
|
|
410
|
+
const normalized = normalizeChildrenValue(value, this.propertyComponentAccessor);
|
|
411
|
+
if (!normalized)
|
|
412
|
+
return;
|
|
413
|
+
super.set(key, normalized, options);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (allowDynamicKeys &&
|
|
417
|
+
typeof key === 'string' &&
|
|
418
|
+
isAllowedDynamicKey(key)) {
|
|
419
|
+
if (!(key in this.data)) {
|
|
420
|
+
;
|
|
421
|
+
this.data[key] = value;
|
|
422
|
+
}
|
|
423
|
+
super.set(key, value, options);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (!(key in this.data))
|
|
427
|
+
return;
|
|
428
|
+
super.set(key, value, options);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
markPropertyComponentBatchRebindable(ConfiguredPropertyComponent, children);
|
|
432
|
+
return ConfiguredPropertyComponent;
|
|
433
|
+
};
|
|
434
|
+
const restoreRegistrations = (type, schema, component, config) => {
|
|
435
|
+
restorePropertySchemaAfterFailedDeclarativeCommit(schema);
|
|
436
|
+
restorePropertyComponentAfterFailedDeclarativeCommit(type, component, config);
|
|
437
|
+
};
|
|
438
|
+
const assertPropertyTypeUnused = (type, manager) => {
|
|
439
|
+
const propertyIds = manager.getPropertyIdsByType(type);
|
|
440
|
+
if (propertyIds.length === 0)
|
|
441
|
+
return;
|
|
442
|
+
throw new PropertyRegistrationError({
|
|
443
|
+
ok: false,
|
|
444
|
+
code: 'PROPERTY_TYPE_IN_USE',
|
|
445
|
+
type,
|
|
446
|
+
propertyIds,
|
|
447
|
+
removedSchema: false,
|
|
448
|
+
removedComponent: false
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
export const commitDeclarativePropertyTypeDefinition = (type, definition, manager = propsManager) => {
|
|
452
|
+
const current = getDeclarativePropertyTypeDefinition(type);
|
|
453
|
+
if (!current) {
|
|
454
|
+
return failDefinition('PROPERTY_TYPE_DEFINITION_DRIFT', type, `Property type "${type}" is not registered`);
|
|
455
|
+
}
|
|
456
|
+
assertPropertyTypeUnused(type, manager);
|
|
457
|
+
const currentSchema = getPropertySchema(type);
|
|
458
|
+
const currentComponent = getPropertyComponent(type);
|
|
459
|
+
const currentConfig = getPropertyComponentConfigDefinition(type);
|
|
460
|
+
if (!currentSchema || !currentComponent || !currentConfig) {
|
|
461
|
+
return failDefinition('PROPERTY_TYPE_DEFINITION_DRIFT', type, `Property type "${type}" changed while preparing redefinition`);
|
|
462
|
+
}
|
|
463
|
+
const normalized = normalizeDefinition(type, definition);
|
|
464
|
+
const nextSchema = toPropertySchema(normalized);
|
|
465
|
+
const nextConfig = toConfigRegistration(normalized, currentConfig);
|
|
466
|
+
const nextComponent = createPropertyComponentFromConfig(nextConfig);
|
|
467
|
+
// Definition validators are app-provided synchronous callbacks. Recheck
|
|
468
|
+
// usage after every staging callback and immediately before registry writes.
|
|
469
|
+
assertPropertyTypeUnused(type, manager);
|
|
470
|
+
try {
|
|
471
|
+
propertySchemaRegistry.unregister(type);
|
|
472
|
+
propertyComponentRegistry.unregister(type);
|
|
473
|
+
registerPropertySchema(nextSchema);
|
|
474
|
+
registerPropertyComponent(type, nextComponent, undefined, nextConfig);
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
restoreRegistrations(type, currentSchema, currentComponent, currentConfig);
|
|
478
|
+
return failDefinition('PROPERTY_TYPE_DEFINITION_COMMIT_FAILED', type, `Property type "${type}" commit failed and the previous definition was restored`, error);
|
|
479
|
+
}
|
|
480
|
+
return normalized;
|
|
481
|
+
};
|
|
482
|
+
//# sourceMappingURL=declarative-property-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarative-property-type.js","sourceRoot":"","sources":["../../src/registries/declarative-property-type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,YAA8B,MAAM,6BAA6B,CAAA;AAExE,OAAO,EACL,wCAAwC,EACxC,oBAAoB,EACpB,oCAAoC,EACpC,oCAAoC,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;IACH,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PropertyComponentConstructor } from '../components/index.js';
|
|
2
|
+
import type { PropertyRegistrationOptions } from './registration-options.js';
|
|
3
|
+
export interface PropertyChildRelationDefinition {
|
|
4
|
+
key: string;
|
|
5
|
+
childType: string;
|
|
6
|
+
mode?: 'ids' | 'ids-or-objects';
|
|
7
|
+
collection?: 'array' | 'array-or-record';
|
|
8
|
+
toChildData?: (item: Record<string, unknown>, childId?: string) => Record<string, unknown> | null;
|
|
9
|
+
toValue?: (child: {
|
|
10
|
+
get: (key: string) => unknown;
|
|
11
|
+
}, childId: string) => unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface PropertyComponentConfigRegistration {
|
|
14
|
+
type: string;
|
|
15
|
+
defaults?: Record<string, unknown>;
|
|
16
|
+
persistKeys?: string[];
|
|
17
|
+
valueKeys?: string[];
|
|
18
|
+
unitKeys?: string[];
|
|
19
|
+
allowDynamicKeys?: boolean;
|
|
20
|
+
dynamicReservedKeys?: string[];
|
|
21
|
+
children?: PropertyChildRelationDefinition;
|
|
22
|
+
}
|
|
23
|
+
export declare const resolvePropertyComponentConfigRoles: (config: PropertyComponentConfigRegistration) => {
|
|
24
|
+
defaults: Record<string, unknown>;
|
|
25
|
+
persistKeys: string[];
|
|
26
|
+
valueKeys: string[];
|
|
27
|
+
unitKeys: string[];
|
|
28
|
+
};
|
|
29
|
+
export declare const markPropertyComponentBatchRebindable: (component: PropertyComponentConstructor, relation: PropertyChildRelationDefinition | undefined) => void;
|
|
30
|
+
export declare const getPropertyComponentBatchRebindableRelation: (component: PropertyComponentConstructor) => PropertyChildRelationDefinition | undefined;
|
|
31
|
+
export declare const arePropertyChildRelationsEqual: (left: PropertyChildRelationDefinition | undefined, right: PropertyChildRelationDefinition | undefined) => boolean;
|
|
32
|
+
export declare const isPropertyComponentBatchRebindable: (component: PropertyComponentConstructor, relation: PropertyChildRelationDefinition) => boolean;
|
|
33
|
+
export declare const clonePropertyComponentConfigRegistration: (definition: PropertyComponentConfigRegistration) => PropertyComponentConfigRegistration;
|
|
34
|
+
export declare const propertyComponentRegistry: {
|
|
35
|
+
register: (type: string, component: PropertyComponentConstructor, options?: PropertyRegistrationOptions, configDefinition?: PropertyComponentConfigRegistration, canonicalChildRelation?: PropertyChildRelationDefinition) => void;
|
|
36
|
+
get: (type: string) => PropertyComponentConstructor | undefined;
|
|
37
|
+
has: (type: string) => boolean;
|
|
38
|
+
getConfigDefinition: (type: string) => PropertyComponentConfigRegistration | undefined;
|
|
39
|
+
unregister: (type: string) => boolean;
|
|
40
|
+
clear: () => void;
|
|
41
|
+
};
|
|
42
|
+
export declare const registerPropertyComponent: (type: string, component: PropertyComponentConstructor, options?: PropertyRegistrationOptions, configDefinition?: PropertyComponentConfigRegistration, canonicalChildRelation?: PropertyChildRelationDefinition) => void;
|
|
43
|
+
export declare const getPropertyComponent: (type: string) => PropertyComponentConstructor | undefined;
|
|
44
|
+
export declare const getPropertyComponentConfigDefinition: (type: string) => PropertyComponentConfigRegistration | undefined;
|
|
45
|
+
export declare const getPropertyComponentCanonicalChildRelation: (type: string) => PropertyChildRelationDefinition | undefined;
|
|
46
|
+
export declare const getPropertyComponentRegistrationRevision: (type: string) => number;
|
|
47
|
+
export declare const unregisterPropertyComponent: (type: string) => boolean;
|
|
48
|
+
export declare const restorePropertyComponentAfterFailedDeclarativeCommit: (type: string, component: PropertyComponentConstructor, configDefinition: PropertyComponentConfigRegistration) => void;
|
|
49
|
+
export type { PropertyComponentConstructor };
|
|
50
|
+
//# sourceMappingURL=property-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-component.d.ts","sourceRoot":"","sources":["../../src/registries/property-component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AAE1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,M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