assign-gingerly 0.0.44 → 0.0.46
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 +25 -1
- package/assignFeatures.js +1 -1
- package/assignFeatures.ts +3 -153
- package/assignGingerly.js +10 -0
- package/assignGingerly.ts +8 -0
- package/assignTentatively.js +16 -2
- package/assignTentatively.ts +14 -2
- package/package.json +1 -1
- package/types/assign-gingerly/types.d.ts +148 -0
package/README.md
CHANGED
|
@@ -751,7 +751,31 @@ console.log(obj);
|
|
|
751
751
|
// }
|
|
752
752
|
```
|
|
753
753
|
|
|
754
|
-
The `+=` command syntax is `<path> +=` where the path uses the `?.` nested notation for nested properties, or a plain key for direct properties. The right-hand side value is added to the existing value using `+=`. If the path doesn't exist, it's created and set directly to the value.
|
|
754
|
+
The `+=` command syntax is `<path> +=` where the path uses the `?.` nested notation for nested properties, or a plain key for direct properties. The right-hand side value is added to the existing value using `+=`. If the path doesn't exist, it's created and set directly to the value.
|
|
755
|
+
|
|
756
|
+
**Behavior by type:**
|
|
757
|
+
|
|
758
|
+
| LHS type | RHS type | Result |
|
|
759
|
+
|----------|----------|--------|
|
|
760
|
+
| number | number | addition (`2 += 3` → `5`) |
|
|
761
|
+
| string | any | string concatenation (`"hello" += 3` → `"hello3"`) |
|
|
762
|
+
| array | array | array concatenation (`[1,2] += [3,4]` → `[1,2,3,4]`) |
|
|
763
|
+
| array | non-array | push single item (`[1,2] += 3` → `[1,2,3]`) |
|
|
764
|
+
| undefined/missing | any | direct assignment |
|
|
765
|
+
|
|
766
|
+
```TypeScript
|
|
767
|
+
const obj = {
|
|
768
|
+
tags: ['a', 'b'],
|
|
769
|
+
name: 'hello'
|
|
770
|
+
};
|
|
771
|
+
assignGingerly(obj, {
|
|
772
|
+
'?.tags +=': ['c', 'd'], // array concat: ['a', 'b', 'c', 'd']
|
|
773
|
+
'?.name +=': ' world' // string concat: 'hello world'
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
// Push a single item
|
|
777
|
+
assignGingerly(obj, { '?.tags +=': 'e' }); // ['a', 'b', 'c', 'd', 'e']
|
|
778
|
+
```
|
|
755
779
|
|
|
756
780
|
## Example 5 - Toggling boolean values and negating
|
|
757
781
|
|
package/assignFeatures.js
CHANGED
|
@@ -420,7 +420,7 @@ export function assignFeatures(ctr, features, featuresRegistry) {
|
|
|
420
420
|
if (SpawnClass && !isAsyncSpawn(SpawnClass) &&
|
|
421
421
|
Object.hasOwn(SpawnClass, 'onAssigned') &&
|
|
422
422
|
typeof SpawnClass.onAssigned === 'function') {
|
|
423
|
-
const result = SpawnClass.onAssigned(ctr, featureConfig);
|
|
423
|
+
const result = SpawnClass.onAssigned(ctr, featureConfig, key);
|
|
424
424
|
if (result && typeof result.then === 'function') {
|
|
425
425
|
onAssignedPromises.push(result);
|
|
426
426
|
}
|
package/assignFeatures.ts
CHANGED
|
@@ -10,159 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { parseWithAttrs } from './parseWithAttrs.js';
|
|
13
|
+
import { FeatureSpawnContext, SupportedFeatureConfig, FeaturesClassConfig, FeatureConfig, SupportedFeaturesMap, FeatureConfigsMap } from './types/assign-gingerly/types.js';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
* Context passed to feature spawn constructors
|
|
16
|
-
*/
|
|
17
|
-
export interface FeatureSpawnContext {
|
|
18
|
-
/** The feature key (e.g., 'photoTaker') */
|
|
19
|
-
key: string;
|
|
20
|
-
/** The SupportedFeatureConfig from static supportedFeatures */
|
|
21
|
-
optIn: SupportedFeatureConfig;
|
|
22
|
-
/** The FeatureConfig from assignFeatures */
|
|
23
|
-
injection: FeatureConfig;
|
|
24
|
-
/** The features registry reference */
|
|
25
|
-
featuresRegistry: FeaturesRegistry;
|
|
26
|
-
/** Shared context from the host element (via getSharedContext callback) */
|
|
27
|
-
shared?: any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface SupportedFeatureConfig {
|
|
31
|
-
/**
|
|
32
|
-
* Optional fallback class (or async spawner) to use if no implementation is injected.
|
|
33
|
-
*/
|
|
34
|
-
fallbackSpawn?:
|
|
35
|
-
| { new(hostElement: any, ctx: FeatureSpawnContext, initVals?: any): any }
|
|
36
|
-
| (() => Promise<{ new(hostElement: any, ctx: FeatureSpawnContext, initVals?: any): any }>);
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Optional runtime shape validation for the spawned instance.
|
|
40
|
-
* Return true if the instance is valid, false to throw.
|
|
41
|
-
*/
|
|
42
|
-
validateShape?: (spawnedInstance: any) => boolean;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Optional callback to provide shared context (e.g., ElementInternals, private state)
|
|
46
|
-
* to the feature at construction time.
|
|
47
|
-
*
|
|
48
|
-
* Defined in the class body, this callback has access to #private fields
|
|
49
|
-
* because static methods/properties of a class can access private fields
|
|
50
|
-
* of instances of that class.
|
|
51
|
-
*
|
|
52
|
-
* The returned object is passed to the feature constructor as `ctx.shared`.
|
|
53
|
-
*
|
|
54
|
-
* @param instance - The host element instance
|
|
55
|
-
* @returns An object containing shared data for the feature
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* static supportedFeatures = {
|
|
59
|
-
* ariaManager: {
|
|
60
|
-
* fallbackSpawn: AriaManagerImpl,
|
|
61
|
-
* getSharedContext(instance) {
|
|
62
|
-
* return { internals: instance.#internals };
|
|
63
|
-
* }
|
|
64
|
-
* }
|
|
65
|
-
* }
|
|
66
|
-
*/
|
|
67
|
-
getSharedContext?: (instance: any) => any;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Lifecycle callbacks that this feature requires.
|
|
71
|
-
* Serves as the default — the consumer can add more via FeatureConfig.callbackForwarding
|
|
72
|
-
* but cannot remove these.
|
|
73
|
-
*
|
|
74
|
-
* Supported: 'connectedCallback', 'disconnectedCallback',
|
|
75
|
-
* 'attributeChangedCallback', 'adoptedCallback'
|
|
76
|
-
*/
|
|
77
|
-
callbackForwarding?: string[];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Class-level configuration for the features system.
|
|
82
|
-
* Declared as `static featuresConfig` on the class.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* class ClubMember extends HTMLElement {
|
|
86
|
-
* static supportedFeatures = { photoTaker: { fallbackSpawn: PhotoTakerImpl } }
|
|
87
|
-
* static featuresConfig = { lifecycleKeys: true }
|
|
88
|
-
* }
|
|
89
|
-
*/
|
|
90
|
-
export interface FeaturesClassConfig {
|
|
91
|
-
/**
|
|
92
|
-
* Lifecycle method configuration.
|
|
93
|
-
*
|
|
94
|
-
* If set to `true`, installs a method named 'whenFeatureReady' on the prototype.
|
|
95
|
-
* If set to an object, allows customizing the method name.
|
|
96
|
-
*
|
|
97
|
-
* The installed method accepts a feature key and returns a Promise that resolves
|
|
98
|
-
* with the feature instance once it's ready (useful for async spawners).
|
|
99
|
-
* For synchronous spawners, the Promise resolves immediately.
|
|
100
|
-
*
|
|
101
|
-
* Suggested default name: 'whenFeatureReady'
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* static featuresConfig = { lifecycleKeys: true }
|
|
105
|
-
* // await el.whenFeatureReady('photoTaker')
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* static featuresConfig = { lifecycleKeys: { whenFeatureReady: 'awaitFeature' } }
|
|
109
|
-
* // await el.awaitFeature('photoTaker')
|
|
110
|
-
*/
|
|
111
|
-
lifecycleKeys?: true | {
|
|
112
|
-
/** Method name for awaiting feature readiness. Defaults to 'whenFeatureReady'. */
|
|
113
|
-
whenFeatureReady?: string;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface FeatureConfig {
|
|
118
|
-
/**
|
|
119
|
-
* The class to instantiate for this feature, or an async function that
|
|
120
|
-
* resolves to such a class (for lazy-loading).
|
|
121
|
-
*
|
|
122
|
-
* Synchronous: Constructor receives the host element as its first argument,
|
|
123
|
-
* a FeatureSpawnContext as second, and optional initVals as third.
|
|
124
|
-
*
|
|
125
|
-
* Asynchronous: A function (arrow or async) that returns a Promise resolving
|
|
126
|
-
* to a constructor. The getter returns a placeholder object immediately and
|
|
127
|
-
* instantiates the real class once the Promise resolves.
|
|
128
|
-
*/
|
|
129
|
-
spawn?:
|
|
130
|
-
| { new(hostElement: any, ctx: FeatureSpawnContext, initVals?: any): any }
|
|
131
|
-
| (() => Promise<{ new(hostElement: any, ctx: FeatureSpawnContext, initVals?: any): any }>);
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Attribute patterns for parsing element attributes into initVals.
|
|
135
|
-
* Attributes are the "base layer" — programmatic values override them.
|
|
136
|
-
* Always unprefixed for features (no enh- prefix).
|
|
137
|
-
*/
|
|
138
|
-
withAttrs?: any; // AttrPatterns<any> — imported type from types
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Reserved field for custom configuration data.
|
|
142
|
-
* Not interpreted by the library — available to the feature class
|
|
143
|
-
* via ctx.injection.customData in the constructor.
|
|
144
|
-
*/
|
|
145
|
-
customData?: any;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Custom element lifecycle callbacks to forward to this feature.
|
|
149
|
-
* The feature class must implement the listed methods.
|
|
150
|
-
*
|
|
151
|
-
* On first `connectedCallback` forwarding, the getter is triggered (spawning
|
|
152
|
-
* the feature if needed). For async features, forwarding is skipped until
|
|
153
|
-
* the real instance is available.
|
|
154
|
-
*
|
|
155
|
-
* Supported values: 'connectedCallback', 'disconnectedCallback',
|
|
156
|
-
* 'attributeChangedCallback', 'adoptedCallback'
|
|
157
|
-
*
|
|
158
|
-
* Note: `attributeChangedCallback` only receives events for attributes
|
|
159
|
-
* listed in the element's `static observedAttributes`.
|
|
160
|
-
*/
|
|
161
|
-
callbackForwarding?: string[];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export type SupportedFeaturesMap = Record<string, SupportedFeatureConfig>;
|
|
165
|
-
export type FeatureConfigsMap = Record<string, FeatureConfig>;
|
|
15
|
+
export type { FeatureSpawnContext, SupportedFeatureConfig, FeaturesClassConfig, FeatureConfig, SupportedFeaturesMap, FeatureConfigsMap };
|
|
166
16
|
|
|
167
17
|
/**
|
|
168
18
|
* WeakMap storing per-instance feature caches.
|
|
@@ -667,7 +517,7 @@ export function assignFeatures(
|
|
|
667
517
|
if (SpawnClass && !isAsyncSpawn(SpawnClass) &&
|
|
668
518
|
Object.hasOwn(SpawnClass as any, 'onAssigned') &&
|
|
669
519
|
typeof (SpawnClass as any).onAssigned === 'function') {
|
|
670
|
-
const result = (SpawnClass as any).onAssigned(ctr, featureConfig);
|
|
520
|
+
const result = (SpawnClass as any).onAssigned(ctr, featureConfig, key);
|
|
671
521
|
if (result && typeof result.then === 'function') {
|
|
672
522
|
onAssignedPromises.push(result);
|
|
673
523
|
}
|
package/assignGingerly.js
CHANGED
|
@@ -616,6 +616,11 @@ export function assignGingerly(target, source, options) {
|
|
|
616
616
|
if (!(lastKey in parent)) {
|
|
617
617
|
parent[lastKey] = value;
|
|
618
618
|
}
|
|
619
|
+
else if (Array.isArray(parent[lastKey])) {
|
|
620
|
+
parent[lastKey] = Array.isArray(value)
|
|
621
|
+
? [...parent[lastKey], ...value]
|
|
622
|
+
: [...parent[lastKey], value];
|
|
623
|
+
}
|
|
619
624
|
else {
|
|
620
625
|
parent[lastKey] += value;
|
|
621
626
|
}
|
|
@@ -625,6 +630,11 @@ export function assignGingerly(target, source, options) {
|
|
|
625
630
|
if (!(path in target)) {
|
|
626
631
|
target[path] = value;
|
|
627
632
|
}
|
|
633
|
+
else if (Array.isArray(target[path])) {
|
|
634
|
+
target[path] = Array.isArray(value)
|
|
635
|
+
? [...target[path], ...value]
|
|
636
|
+
: [...target[path], value];
|
|
637
|
+
}
|
|
628
638
|
else {
|
|
629
639
|
target[path] += value;
|
|
630
640
|
}
|
package/assignGingerly.ts
CHANGED
|
@@ -801,6 +801,10 @@ export function assignGingerly(
|
|
|
801
801
|
const parent = ensureNestedPath(target, pathParts);
|
|
802
802
|
if (!(lastKey in parent)) {
|
|
803
803
|
parent[lastKey] = value;
|
|
804
|
+
} else if (Array.isArray(parent[lastKey])) {
|
|
805
|
+
parent[lastKey] = Array.isArray(value)
|
|
806
|
+
? [...parent[lastKey], ...value]
|
|
807
|
+
: [...parent[lastKey], value];
|
|
804
808
|
} else {
|
|
805
809
|
parent[lastKey] += value;
|
|
806
810
|
}
|
|
@@ -808,6 +812,10 @@ export function assignGingerly(
|
|
|
808
812
|
// Plain key - direct operation on target
|
|
809
813
|
if (!(path in target)) {
|
|
810
814
|
target[path] = value;
|
|
815
|
+
} else if (Array.isArray(target[path])) {
|
|
816
|
+
target[path] = Array.isArray(value)
|
|
817
|
+
? [...target[path], ...value]
|
|
818
|
+
: [...target[path], value];
|
|
811
819
|
} else {
|
|
812
820
|
target[path] += value;
|
|
813
821
|
}
|
package/assignTentatively.js
CHANGED
|
@@ -124,7 +124,14 @@ export function assignTentatively(target, source, options) {
|
|
|
124
124
|
if (!(fullPath in reversal)) {
|
|
125
125
|
reversal[fullPath] = parent[lastKey];
|
|
126
126
|
}
|
|
127
|
-
parent[lastKey]
|
|
127
|
+
if (Array.isArray(parent[lastKey])) {
|
|
128
|
+
parent[lastKey] = Array.isArray(value)
|
|
129
|
+
? [...parent[lastKey], ...value]
|
|
130
|
+
: [...parent[lastKey], value];
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
parent[lastKey] += value;
|
|
134
|
+
}
|
|
128
135
|
}
|
|
129
136
|
else {
|
|
130
137
|
// Property doesn't exist, create it with the value
|
|
@@ -137,7 +144,14 @@ export function assignTentatively(target, source, options) {
|
|
|
137
144
|
if (!(path in reversal)) {
|
|
138
145
|
reversal[path] = target[path];
|
|
139
146
|
}
|
|
140
|
-
target[path]
|
|
147
|
+
if (Array.isArray(target[path])) {
|
|
148
|
+
target[path] = Array.isArray(value)
|
|
149
|
+
? [...target[path], ...value]
|
|
150
|
+
: [...target[path], value];
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
target[path] += value;
|
|
154
|
+
}
|
|
141
155
|
}
|
|
142
156
|
else {
|
|
143
157
|
target[path] = value;
|
package/assignTentatively.ts
CHANGED
|
@@ -152,7 +152,13 @@ export function assignTentatively(
|
|
|
152
152
|
if (!(fullPath in reversal)) {
|
|
153
153
|
reversal[fullPath] = parent[lastKey];
|
|
154
154
|
}
|
|
155
|
-
parent[lastKey]
|
|
155
|
+
if (Array.isArray(parent[lastKey])) {
|
|
156
|
+
parent[lastKey] = Array.isArray(value)
|
|
157
|
+
? [...parent[lastKey], ...value]
|
|
158
|
+
: [...parent[lastKey], value];
|
|
159
|
+
} else {
|
|
160
|
+
parent[lastKey] += value;
|
|
161
|
+
}
|
|
156
162
|
} else {
|
|
157
163
|
// Property doesn't exist, create it with the value
|
|
158
164
|
parent[lastKey] = value;
|
|
@@ -163,7 +169,13 @@ export function assignTentatively(
|
|
|
163
169
|
if (!(path in reversal)) {
|
|
164
170
|
reversal[path] = target[path];
|
|
165
171
|
}
|
|
166
|
-
target[path]
|
|
172
|
+
if (Array.isArray(target[path])) {
|
|
173
|
+
target[path] = Array.isArray(value)
|
|
174
|
+
? [...target[path], ...value]
|
|
175
|
+
: [...target[path], value];
|
|
176
|
+
} else {
|
|
177
|
+
target[path] += value;
|
|
178
|
+
}
|
|
167
179
|
} else {
|
|
168
180
|
target[path] = value;
|
|
169
181
|
}
|
package/package.json
CHANGED
|
@@ -326,3 +326,151 @@ export interface ElementEnhancement{
|
|
|
326
326
|
dispose(registryItem: EnhancementConfig | string | symbol): void;
|
|
327
327
|
whenResolved(registryItem: EnhancementConfig | string | symbol, mountCtx?: any): Promise<any>;
|
|
328
328
|
}
|
|
329
|
+
|
|
330
|
+
// =============================================================================
|
|
331
|
+
// Custom Element Features types
|
|
332
|
+
// =============================================================================
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Context passed to feature spawn constructors
|
|
336
|
+
*/
|
|
337
|
+
export interface FeatureSpawnContext {
|
|
338
|
+
/** The feature key (e.g., 'photoTaker') */
|
|
339
|
+
key: string;
|
|
340
|
+
/** The SupportedFeatureConfig from static supportedFeatures */
|
|
341
|
+
optIn: SupportedFeatureConfig;
|
|
342
|
+
/** The FeatureConfig from assignFeatures */
|
|
343
|
+
injection: FeatureConfig;
|
|
344
|
+
/** The features registry reference */
|
|
345
|
+
featuresRegistry: FeaturesRegistry;
|
|
346
|
+
/** Shared context from the host element (via getSharedContext callback) */
|
|
347
|
+
shared?: any;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Configuration for a supported feature slot declared via static supportedFeatures
|
|
352
|
+
*/
|
|
353
|
+
export interface SupportedFeatureConfig {
|
|
354
|
+
/**
|
|
355
|
+
* Optional fallback class (or async spawner) to use if no implementation is injected.
|
|
356
|
+
*/
|
|
357
|
+
fallbackSpawn?:
|
|
358
|
+
| { new(hostElement: any, ctx: FeatureSpawnContext, initVals?: any): any }
|
|
359
|
+
| (() => Promise<{ new(hostElement: any, ctx: FeatureSpawnContext, initVals?: any): any }>);
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Optional runtime shape validation for the spawned instance.
|
|
363
|
+
* Return true if the instance is valid, false to throw.
|
|
364
|
+
*/
|
|
365
|
+
validateShape?: (spawnedInstance: any) => boolean;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Optional callback to provide shared context (e.g., ElementInternals, private state)
|
|
369
|
+
* to the feature at construction time.
|
|
370
|
+
*/
|
|
371
|
+
getSharedContext?: (instance: any) => any;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Lifecycle callbacks that this feature requires.
|
|
375
|
+
* Serves as the default — the consumer can add more via FeatureConfig.callbackForwarding.
|
|
376
|
+
*/
|
|
377
|
+
callbackForwarding?: string[];
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Class-level configuration for the features system.
|
|
382
|
+
* Declared as `static featuresConfig` on the class.
|
|
383
|
+
*/
|
|
384
|
+
export interface FeaturesClassConfig {
|
|
385
|
+
/**
|
|
386
|
+
* Lifecycle method configuration.
|
|
387
|
+
* true = install 'whenFeatureReady' method.
|
|
388
|
+
* Object = custom method name.
|
|
389
|
+
*/
|
|
390
|
+
lifecycleKeys?: true | {
|
|
391
|
+
whenFeatureReady?: string;
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Configuration for a feature passed to assignFeatures.
|
|
397
|
+
*/
|
|
398
|
+
export interface FeatureConfig {
|
|
399
|
+
/**
|
|
400
|
+
* The class to instantiate, or an async function returning one.
|
|
401
|
+
*/
|
|
402
|
+
spawn?:
|
|
403
|
+
| { new(hostElement: any, ctx: FeatureSpawnContext, initVals?: any): any }
|
|
404
|
+
| (() => Promise<{ new(hostElement: any, ctx: FeatureSpawnContext, initVals?: any): any }>);
|
|
405
|
+
|
|
406
|
+
/** Attribute patterns for parsing element attributes into initVals. */
|
|
407
|
+
withAttrs?: AttrPatterns<any>;
|
|
408
|
+
|
|
409
|
+
/** Pass-through custom configuration data (accessible via ctx.injection.customData). */
|
|
410
|
+
customData?: any;
|
|
411
|
+
|
|
412
|
+
/** Lifecycle callbacks to forward to this feature. */
|
|
413
|
+
callbackForwarding?: string[];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export type SupportedFeaturesMap = Record<string, SupportedFeatureConfig>;
|
|
417
|
+
export type FeatureConfigsMap = Record<string, FeatureConfig>;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Registry for feature configs, keyed by constructor.
|
|
421
|
+
*/
|
|
422
|
+
export declare class FeaturesRegistry {
|
|
423
|
+
has(ctr: Function): boolean;
|
|
424
|
+
get(ctr: Function): Map<string, FeatureConfig> | undefined;
|
|
425
|
+
set(ctr: Function, key: string, config: FeatureConfig): void;
|
|
426
|
+
hasKey(ctr: Function, key: string): boolean;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* A suggestion from one feature to another.
|
|
431
|
+
*/
|
|
432
|
+
export interface FeatureInfoSuggestion {
|
|
433
|
+
from: Function;
|
|
434
|
+
withAttrs?: any;
|
|
435
|
+
customData?: any;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Core assignFeatures function.
|
|
440
|
+
*/
|
|
441
|
+
export declare function assignFeatures(
|
|
442
|
+
ctr: Function,
|
|
443
|
+
features: FeatureConfigsMap,
|
|
444
|
+
featuresRegistry: FeaturesRegistry
|
|
445
|
+
): Promise<void> | undefined;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Captures own-properties that shadow feature getters.
|
|
449
|
+
*/
|
|
450
|
+
export declare function captureFeatureInitVals(instance: any): void;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Suggest configuration to another feature during registration.
|
|
454
|
+
*/
|
|
455
|
+
export declare function suggestFeatureInfo(
|
|
456
|
+
fromFeatureCtr: Function,
|
|
457
|
+
toFeatureSymbol: symbol,
|
|
458
|
+
featureInfo: { withAttrs?: any; customData?: any },
|
|
459
|
+
targetClass: Function
|
|
460
|
+
): void;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Retrieve suggestions made to a feature by other features.
|
|
464
|
+
*/
|
|
465
|
+
export declare function getFeatureInfoSuggestions(
|
|
466
|
+
toFeatureSymbol: symbol,
|
|
467
|
+
targetClass: Function
|
|
468
|
+
): FeatureInfoSuggestion[];
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Base class for nested feature containers.
|
|
472
|
+
*/
|
|
473
|
+
export declare class PropertyBag {
|
|
474
|
+
customElementRegistry: any;
|
|
475
|
+
constructor(hostElement: any, ctx?: FeatureSpawnContext, initVals?: any);
|
|
476
|
+
}
|