@metadev/daga 4.0.1 → 4.1.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.
Files changed (30) hide show
  1. package/Changelog.md +25 -0
  2. package/index.cjs.js +478 -194
  3. package/index.esm.js +478 -194
  4. package/package.json +1 -1
  5. package/src/index.d.ts +8 -5
  6. package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +10 -0
  7. package/src/lib/diagram/canvas/diagram-canvas.d.ts +4 -1
  8. package/src/lib/diagram/canvas/diagram-user-selection.d.ts +1 -1
  9. package/src/lib/diagram/collab/collab-action.d.ts +32 -2
  10. package/src/lib/diagram/config/diagram-canvas-config.d.ts +6 -0
  11. package/src/lib/diagram/config/diagram-components-config.d.ts +249 -0
  12. package/src/lib/diagram/config/diagram-config.d.ts +33 -248
  13. package/src/lib/diagram/diagram-action.d.ts +23 -0
  14. package/src/lib/diagram/layout/adjacency-layout.d.ts +2 -0
  15. package/src/lib/diagram/layout/breadth-adjacency-layout.d.ts +2 -0
  16. package/src/lib/diagram/layout/breadth-layout.d.ts +2 -0
  17. package/src/lib/diagram/layout/force-layout.d.ts +2 -0
  18. package/src/lib/diagram/layout/horizontal-layout.d.ts +2 -0
  19. package/src/lib/diagram/layout/priority-layout.d.ts +2 -0
  20. package/src/lib/diagram/layout/tree-layout.d.ts +2 -0
  21. package/src/lib/diagram/layout/vertical-layout.d.ts +2 -0
  22. package/src/lib/diagram/model/diagram-connection.d.ts +2 -1
  23. package/src/lib/diagram/model/diagram-model.d.ts +2 -1
  24. package/src/lib/diagram/model/diagram-node.d.ts +25 -2
  25. package/src/lib/diagram/property/property-util.d.ts +61 -0
  26. package/src/lib/diagram/property/property.d.ts +146 -0
  27. package/src/lib/diagram/property/value.d.ts +163 -0
  28. package/src/lib/interfaces/canvas.d.ts +14 -1
  29. package/src/lib/interfaces/property-editor.d.ts +1 -1
  30. package/src/lib/diagram/model/diagram-property.d.ts +0 -368
@@ -1,368 +0,0 @@
1
- import { CollabTimestamp, CollabTimestampSet } from '../collab/primitives';
2
- /**
3
- * A property which is part of a property set and defines what values a value in a value set can take.
4
- * @public
5
- * @see PropertySet
6
- * @see ValueSet
7
- */
8
- export declare class Property {
9
- /**
10
- * The name of this property. Used to distinguish this property from others.
11
- */
12
- name: string;
13
- /**
14
- * The type of this property, which indicates the possible values that this property can have.
15
- */
16
- type: Type;
17
- /**
18
- * The default value of this property.
19
- * @default undefined
20
- */
21
- defaultValue?: unknown;
22
- /**
23
- * Whether this property should always appear in the property editor component.
24
- * @see PropertyEditorComponent
25
- */
26
- basic: boolean;
27
- /**
28
- * Whether the value of this property can be edited.
29
- */
30
- editable: boolean;
31
- /**
32
- * Which attribute of the parent component the value of this property is linked to. By default, it is not linked to any.
33
- * @default undefined
34
- */
35
- rootAttribute?: string[] | string;
36
- /**
37
- * The list of possible values if the value of the property is chosen from a set of possible values.
38
- * Should be set if the type of this property is `'option'` or 'option-list'. Otherwise, it should not be set.
39
- * @default undefined
40
- */
41
- options?: Option<unknown>[];
42
- /**
43
- * The list of properties that are part of this property if this property is composed of other properties.
44
- * Should be set if the type of this property is `'object'`. Otherwise, it should not be set.
45
- * @default undefined
46
- */
47
- properties?: Property[];
48
- constructor(name: string, type: Type, defaultValue: unknown, basic: boolean, editable: boolean, rootAttribute?: string[] | string);
49
- }
50
- /**
51
- * Each of the possible values that a property of type option can have.
52
- * @see Property
53
- * @see Type.Option
54
- */
55
- export interface Option<T> {
56
- key: T;
57
- label: string;
58
- }
59
- /**
60
- * The type that a property can have.
61
- * @public
62
- * @see Property
63
- */
64
- export declare enum Type {
65
- /**
66
- * A type whose value must be a boolean.
67
- */
68
- Boolean = "boolean",
69
- /**
70
- * A type whose value must be a string representing a valid HTML color code.
71
- */
72
- Color = "color",
73
- /**
74
- * A type whose value must be a date.
75
- */
76
- Date = "date",
77
- /**
78
- * A type whose value must be a date with a time.
79
- */
80
- Datetime = "datetime",
81
- /**
82
- * A type whose value must be a number.
83
- */
84
- Number = "number",
85
- /**
86
- * A type whose value must be an object.
87
- */
88
- Object = "object",
89
- /**
90
- * A type whose value must be one of a set of options.
91
- */
92
- Option = "option",
93
- /**
94
- * A type whose value must be a list of values picked from a set of options.
95
- * @see Type.Option
96
- */
97
- OptionList = "option-list",
98
- /**
99
- * A type whose value must be a list of values picked from a set of options without repeated values.
100
- * @see Type.Option
101
- */
102
- OptionSet = "option-set",
103
- /**
104
- * A type whose value must be a string without newline characters.
105
- */
106
- Text = "text",
107
- /**
108
- * A type whose value must be a string with newline characters.
109
- */
110
- TextArea = "text-area",
111
- /**
112
- * A type whose value must be a list of strings.
113
- */
114
- TextList = "text-list",
115
- /**
116
- * A type whose value must be a list of strings without repeated values.
117
- */
118
- TextSet = "text-set",
119
- /**
120
- * A type whose value must be a map with string keys and values.
121
- */
122
- TextMap = "text-map",
123
- /**
124
- * A type whose value must be a time of day.
125
- */
126
- Time = "time",
127
- /**
128
- * A type whose value must be a valid URL.
129
- */
130
- Url = "url"
131
- }
132
- /**
133
- * A set of properties based on which a set of values of those properties can be created.
134
- * @public
135
- * @see Property
136
- * @see ValueSet
137
- */
138
- export declare class PropertySet {
139
- propertyMap: {
140
- [key: string]: Property;
141
- };
142
- propertyList: Property[];
143
- constructor(properties?: Property[]);
144
- getProperty(key: string): Property;
145
- hasProperty(key: string): boolean;
146
- hasProperties(): boolean;
147
- }
148
- /**
149
- * A set of values corresponding to a set of properties.
150
- * @public
151
- * @see PropertySet
152
- */
153
- export declare class ValueSet {
154
- rootElement: {
155
- [key: string]: unknown;
156
- };
157
- propertySet: PropertySet;
158
- displayedProperties: Property[];
159
- hiddenProperties: Property[];
160
- private values;
161
- private valueSets;
162
- /**
163
- * Collaborative timestamps for all keys in this.values that have ever been set,
164
- * even if since they've since been set to the default value.
165
- *
166
- * Object values (in this.valueSets) store their own timestamps separately.
167
- */
168
- private ownTimestamps;
169
- constructor(propertySet: PropertySet, rootElement: unknown);
170
- /**
171
- * Gets the value of the root element attribute under the given keys.
172
- * If given an array of keys, the value is found under repeated lookups to enable obtaining nested values.
173
- * @public
174
- * @param rootAttribute A key or array of keys to look up in the root element.
175
- * @returns The value if it could be found, `undefined` if nothing could be found.
176
- */
177
- getRootElementValue(rootAttribute: string[] | string | null): unknown;
178
- /**
179
- * Sets the value of the root element's attribute under the given keys.
180
- * If given an array of keys, the value is found under repeated lookups to enable setting nested values.
181
- * If the root element has a function `updateInView()`, it is called upon successful setting of the value.
182
- * If the root element's attribute doesn't exist, it does nothing.
183
- * @private
184
- * @param rootAttribute A key or array of keys to look up in the root element.
185
- * @param value The value to set the root element's attribute to.
186
- */
187
- setRootElementValue(rootAttribute: string[] | string | null, value: unknown): void;
188
- /**
189
- * Obtains the value under the given key.
190
- * @private
191
- * @param key A key.
192
- * @returns The value under the given key.
193
- */
194
- getValue(key: string): any;
195
- /**
196
- * Obtains all the values in the set.
197
- * @private
198
- * @returns An object containing all the values in the set.
199
- */
200
- getValues(): {
201
- [key: string]: unknown;
202
- };
203
- /**
204
- * Returns the values for all keys present in the given object, including keys in sub-objects.
205
- * @private
206
- * @param values An object containing all values for keys present in the given object.
207
- */
208
- getValuesForKeys(keys: {
209
- [key: string]: unknown;
210
- }): {
211
- [key: string]: unknown;
212
- };
213
- /**
214
- * Obtains all CollabTimestamps in the set, including those corresponding to nested keys.
215
- * @private
216
- * @returns An object containing all the CollabTimestamps in the set.
217
- */
218
- getTimestamps(): CollabTimestampSet;
219
- /**
220
- * Checks if the value under the key is not empty.
221
- * @private
222
- * @param key A key.
223
- * @returns `true` if the value under the key is empty, `false` otherwise.
224
- */
225
- hasValue(key: string): boolean;
226
- /**
227
- * Checks if the value under the key is not empty or the default value.
228
- * @private
229
- * @param key A key.
230
- * @returns `true` if the value under the key is not empty or the default value, `false` otherwise.
231
- */
232
- hasSetValue(key: string): boolean;
233
- /**
234
- * Checks if any of the values in the set are not empty or the default value.
235
- * @private
236
- * @returns `true` if any of the values in the set are not empty or the default value, `false` otherwise.
237
- */
238
- hasAnySetValue(): boolean;
239
- /**
240
- * Sets the value under the given key.
241
- * @private
242
- * @param key A key.
243
- * @param value A value.
244
- */
245
- setValue(key: string, value: unknown): void;
246
- /**
247
- * Resets all values and then set them to the given values.
248
- * @private
249
- * @param values An object containing all values to set the values to.
250
- */
251
- setValues(values: {
252
- [key: string]: unknown;
253
- }): void;
254
- /**
255
- * Resets all timestamps and then set them to the given timestamps.
256
- * @private
257
- * @param values An object containing all the CollabTimestamps in the set.
258
- */
259
- setTimestamps(timestamps: CollabTimestampSet): void;
260
- /**
261
- * Writes the given values over the value set's existing values without resetting the existing values.
262
- * @private
263
- * @param values An object containing all values to set the values to.
264
- */
265
- overwriteValues(values: {
266
- [key: string]: unknown;
267
- }): void;
268
- /**
269
- * Variant of `overwriteValues` that applies last-writer-wins to each key, updating timestamps if appropriate.
270
- * @private
271
- * @param values An object containing all values to set the values to.
272
- */
273
- overwriteValuesLww(values: {
274
- [key: string]: unknown;
275
- }, timestamp: CollabTimestamp): void;
276
- /**
277
- * Sets all the values of this set to the defaults.
278
- * If this set has a root element and any of its properties have root attributes, the root element's attributes are also set to the property's default value if one is provided.
279
- * @private
280
- */
281
- resetValues(): void;
282
- /**
283
- * Constructs a ValueSet with its corresponding PropertySet representing the values of the object.
284
- * @private
285
- * @param key Key that the ValueSet is under.
286
- * @returns The constructed ValueSet.
287
- */
288
- private constructSubValueSet;
289
- /**
290
- * Gets the ValueSet under the given key when there are nested ValueSets.
291
- * @private
292
- * @param key A key.
293
- * @returns A ValueSet.
294
- */
295
- getSubValueSet(key: string): ValueSet;
296
- /**
297
- * Moves the given property to the list of displayed properties.
298
- * @private
299
- * @param property A property.
300
- */
301
- displayProperty(property: Property): void;
302
- /**
303
- * Moves the given property to the list of hidden properties.
304
- * @private
305
- * @param property A property.
306
- */
307
- hideProperty(property: Property): void;
308
- }
309
- /**
310
- * Checks if the given value is not empty.
311
- * @private
312
- * @param a A value.
313
- * @returns `true` if the given value is not `undefined`, `null`, `''`, `[]` or `{}`; `false` otherwise.
314
- */
315
- export declare const empty: (a: unknown) => boolean;
316
- /**
317
- * Checks whether the given values are equal.
318
- * @public
319
- * @param a A value.
320
- * @param b A value.
321
- * @returns `true` if the given values are equal, `false` otherwise.
322
- */
323
- export declare const equals: (a: unknown, b: unknown) => boolean;
324
- /**
325
- * Calculates the differences between the two given objects and returns two objects containing the differences in each relative to the other.
326
- *
327
- * For each key that holds a different value in the two objects, the resulting objects will contain the differences in the values under that key.
328
- *
329
- * This function is recursive, that is, if the value under the key is an object, the function will be applied to that value recursively.
330
- *
331
- * @public
332
- * @param a An object.
333
- * @param b An object.
334
- * @returns A tuple of two objects with each containing the keys that have a different value in the corresponding argument compared to the other argument.
335
- */
336
- export declare const diff: (a: {
337
- [key: string]: unknown;
338
- }, b: {
339
- [key: string]: unknown;
340
- }) => [{
341
- [key: string]: unknown;
342
- }, {
343
- [key: string]: unknown;
344
- }];
345
- /**
346
- * Calculates the differences between the two given values of a valueset and returns two objects containing the differences in each relative to the other.
347
- *
348
- * @param a An object.
349
- * @param b An object.
350
- * @param valueSet A ValueSet to use as reference for the keys and types of each property.
351
- * @returns A tuple of two objects with each containing the keys that have a different value in the corresponding argument compared to the other argument.
352
- */
353
- export declare const diffProperties: (a: {
354
- [key: string]: unknown;
355
- }, b: {
356
- [key: string]: unknown;
357
- }, valueSet: ValueSet) => [{
358
- [key: string]: unknown;
359
- }, {
360
- [key: string]: unknown;
361
- }];
362
- /**
363
- * Checks if the given value is an object.
364
- * @public
365
- * @param x A value.
366
- * @returns `true` if the given value is an object, `false` otherwise.
367
- */
368
- export declare const isObject: (x: unknown) => boolean;