@axi-engine/fields 0.3.5 → 0.3.6
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/dist/index.d.ts +997 -18
- package/dist/index.js +1228 -18
- package/package.json +1 -1
- package/dist/core-field-tree-factory.d.ts +0 -13
- package/dist/core-field-tree-factory.d.ts.map +0 -1
- package/dist/core-field-tree-factory.js +0 -14
- package/dist/core-field-tree-factory.js.map +0 -1
- package/dist/core-field-tree.d.ts +0 -5
- package/dist/core-field-tree.d.ts.map +0 -1
- package/dist/core-field-tree.js +0 -4
- package/dist/core-field-tree.js.map +0 -1
- package/dist/core-fields-factory.d.ts +0 -10
- package/dist/core-fields-factory.d.ts.map +0 -1
- package/dist/core-fields-factory.js +0 -14
- package/dist/core-fields-factory.js.map +0 -1
- package/dist/core-fields.d.ts +0 -47
- package/dist/core-fields.d.ts.map +0 -1
- package/dist/core-fields.js +0 -8
- package/dist/core-fields.js.map +0 -1
- package/dist/data-store-field-resolver.d.ts +0 -26
- package/dist/data-store-field-resolver.d.ts.map +0 -1
- package/dist/data-store-field-resolver.js +0 -21
- package/dist/data-store-field-resolver.js.map +0 -1
- package/dist/data-store.d.ts +0 -38
- package/dist/data-store.d.ts.map +0 -1
- package/dist/data-store.js +0 -141
- package/dist/data-store.js.map +0 -1
- package/dist/field-definitions/core-boolean-field.d.ts +0 -11
- package/dist/field-definitions/core-boolean-field.d.ts.map +0 -1
- package/dist/field-definitions/core-boolean-field.js +0 -13
- package/dist/field-definitions/core-boolean-field.js.map +0 -1
- package/dist/field-definitions/core-field.d.ts +0 -51
- package/dist/field-definitions/core-field.d.ts.map +0 -1
- package/dist/field-definitions/core-field.js +0 -74
- package/dist/field-definitions/core-field.js.map +0 -1
- package/dist/field-definitions/core-numeric-field.d.ts +0 -18
- package/dist/field-definitions/core-numeric-field.d.ts.map +0 -1
- package/dist/field-definitions/core-numeric-field.js +0 -45
- package/dist/field-definitions/core-numeric-field.js.map +0 -1
- package/dist/field-definitions/core-string-field.d.ts +0 -15
- package/dist/field-definitions/core-string-field.d.ts.map +0 -1
- package/dist/field-definitions/core-string-field.js +0 -27
- package/dist/field-definitions/core-string-field.js.map +0 -1
- package/dist/field-definitions/index.d.ts +0 -5
- package/dist/field-definitions/index.d.ts.map +0 -1
- package/dist/field-definitions/index.js +0 -5
- package/dist/field-definitions/index.js.map +0 -1
- package/dist/field-registry.d.ts +0 -5
- package/dist/field-registry.d.ts.map +0 -1
- package/dist/field-registry.js +0 -4
- package/dist/field-registry.js.map +0 -1
- package/dist/field-tree-factory.d.ts +0 -12
- package/dist/field-tree-factory.d.ts.map +0 -1
- package/dist/field-tree-factory.js +0 -2
- package/dist/field-tree-factory.js.map +0 -1
- package/dist/field-tree.d.ts +0 -171
- package/dist/field-tree.d.ts.map +0 -1
- package/dist/field-tree.js +0 -248
- package/dist/field-tree.js.map +0 -1
- package/dist/field.d.ts +0 -34
- package/dist/field.d.ts.map +0 -1
- package/dist/field.js +0 -2
- package/dist/field.js.map +0 -1
- package/dist/fields-factory.d.ts +0 -5
- package/dist/fields-factory.d.ts.map +0 -1
- package/dist/fields-factory.js +0 -2
- package/dist/fields-factory.js.map +0 -1
- package/dist/fields.d.ts +0 -101
- package/dist/fields.d.ts.map +0 -1
- package/dist/fields.js +0 -143
- package/dist/fields.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mixins/mixin-factory.d.ts +0 -29
- package/dist/mixins/mixin-factory.d.ts.map +0 -1
- package/dist/mixins/mixin-factory.js +0 -32
- package/dist/mixins/mixin-factory.js.map +0 -1
- package/dist/mixins/with-boolean-fields.mixin.d.ts +0 -9
- package/dist/mixins/with-boolean-fields.mixin.d.ts.map +0 -1
- package/dist/mixins/with-boolean-fields.mixin.js +0 -4
- package/dist/mixins/with-boolean-fields.mixin.js.map +0 -1
- package/dist/mixins/with-default-generic-fields.mixin.d.ts +0 -31
- package/dist/mixins/with-default-generic-fields.mixin.d.ts.map +0 -1
- package/dist/mixins/with-default-generic-fields.mixin.js +0 -15
- package/dist/mixins/with-default-generic-fields.mixin.js.map +0 -1
- package/dist/mixins/with-numeric-fields.mixin.d.ts +0 -9
- package/dist/mixins/with-numeric-fields.mixin.d.ts.map +0 -1
- package/dist/mixins/with-numeric-fields.mixin.js +0 -4
- package/dist/mixins/with-numeric-fields.mixin.js.map +0 -1
- package/dist/mixins/with-string-fields.mixin.d.ts +0 -9
- package/dist/mixins/with-string-fields.mixin.d.ts.map +0 -1
- package/dist/mixins/with-string-fields.mixin.js +0 -4
- package/dist/mixins/with-string-fields.mixin.js.map +0 -1
- package/dist/policies/clamp-max-policy.d.ts +0 -11
- package/dist/policies/clamp-max-policy.d.ts.map +0 -1
- package/dist/policies/clamp-max-policy.js +0 -18
- package/dist/policies/clamp-max-policy.js.map +0 -1
- package/dist/policies/clamp-min-policy.d.ts +0 -11
- package/dist/policies/clamp-min-policy.d.ts.map +0 -1
- package/dist/policies/clamp-min-policy.js +0 -18
- package/dist/policies/clamp-min-policy.js.map +0 -1
- package/dist/policies/clamp-policy.d.ts +0 -12
- package/dist/policies/clamp-policy.d.ts.map +0 -1
- package/dist/policies/clamp-policy.js +0 -21
- package/dist/policies/clamp-policy.js.map +0 -1
- package/dist/policies/index.d.ts +0 -6
- package/dist/policies/index.d.ts.map +0 -1
- package/dist/policies/index.js +0 -6
- package/dist/policies/index.js.map +0 -1
- package/dist/policies/policies.d.ts +0 -38
- package/dist/policies/policies.d.ts.map +0 -1
- package/dist/policies/policies.js +0 -62
- package/dist/policies/policies.js.map +0 -1
- package/dist/policies/policy.d.ts +0 -6
- package/dist/policies/policy.d.ts.map +0 -1
- package/dist/policies/policy.js +0 -2
- package/dist/policies/policy.js.map +0 -1
- package/dist/serializer/field-serializer.d.ts +0 -52
- package/dist/serializer/field-serializer.d.ts.map +0 -1
- package/dist/serializer/field-serializer.js +0 -66
- package/dist/serializer/field-serializer.js.map +0 -1
- package/dist/serializer/field-tree-serializer.d.ts +0 -50
- package/dist/serializer/field-tree-serializer.d.ts.map +0 -1
- package/dist/serializer/field-tree-serializer.js +0 -68
- package/dist/serializer/field-tree-serializer.js.map +0 -1
- package/dist/serializer/fields-serializer.d.ts +0 -49
- package/dist/serializer/fields-serializer.d.ts.map +0 -1
- package/dist/serializer/fields-serializer.js +0 -57
- package/dist/serializer/fields-serializer.js.map +0 -1
- package/dist/serializer/index.d.ts +0 -8
- package/dist/serializer/index.d.ts.map +0 -1
- package/dist/serializer/index.js +0 -8
- package/dist/serializer/index.js.map +0 -1
- package/dist/serializer/policies/clamp-max-policy-serializer-handler.d.ts +0 -13
- package/dist/serializer/policies/clamp-max-policy-serializer-handler.d.ts.map +0 -1
- package/dist/serializer/policies/clamp-max-policy-serializer-handler.js +0 -10
- package/dist/serializer/policies/clamp-max-policy-serializer-handler.js.map +0 -1
- package/dist/serializer/policies/clamp-min-policy-serializer-handler.d.ts +0 -13
- package/dist/serializer/policies/clamp-min-policy-serializer-handler.d.ts.map +0 -1
- package/dist/serializer/policies/clamp-min-policy-serializer-handler.js +0 -10
- package/dist/serializer/policies/clamp-min-policy-serializer-handler.js.map +0 -1
- package/dist/serializer/policies/clamp-policy-serializer-handler.d.ts +0 -16
- package/dist/serializer/policies/clamp-policy-serializer-handler.d.ts.map +0 -1
- package/dist/serializer/policies/clamp-policy-serializer-handler.js +0 -10
- package/dist/serializer/policies/clamp-policy-serializer-handler.js.map +0 -1
- package/dist/serializer/policy-serializer.d.ts +0 -41
- package/dist/serializer/policy-serializer.d.ts.map +0 -1
- package/dist/serializer/policy-serializer.js +0 -43
- package/dist/serializer/policy-serializer.js.map +0 -1
- package/dist/setup.d.ts +0 -41
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -57
- package/dist/setup.js.map +0 -1
- package/dist/store.d.ts +0 -137
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -2
- package/dist/store.js.map +0 -1
package/dist/field.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":""}
|
package/dist/fields-factory.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields-factory.d.ts","sourceRoot":"","sources":["../src/fields-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,MAAM,WAAW,aAAa,CAAC,OAAO,SAAS,MAAM;IACnD,MAAM,IAAI,OAAO,CAAC;CACnB"}
|
package/dist/fields-factory.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields-factory.js","sourceRoot":"","sources":["../src/fields-factory.ts"],"names":[],"mappings":""}
|
package/dist/fields.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Emitter } from '@axi-engine/utils';
|
|
2
|
-
import { FieldRegistry } from './field-registry';
|
|
3
|
-
import { Field } from './field';
|
|
4
|
-
/**
|
|
5
|
-
* A container for a collection of named `Field` instances.
|
|
6
|
-
*
|
|
7
|
-
* This class acts as a "leaf" node in the `FieldTree` hierarchy, managing a flat
|
|
8
|
-
* key-value store of reactive data points. It uses a `FieldRegistry` to dynamically
|
|
9
|
-
* create `Field` instances of different types.
|
|
10
|
-
*/
|
|
11
|
-
export declare class Fields {
|
|
12
|
-
static readonly typeName = "fields";
|
|
13
|
-
readonly typeName = "fields";
|
|
14
|
-
readonly _fields: Map<string, Field<any>>;
|
|
15
|
-
readonly _fieldRegistry: FieldRegistry;
|
|
16
|
-
/**
|
|
17
|
-
* An event emitter that fires when a new field is added to the collection.
|
|
18
|
-
* @event
|
|
19
|
-
* @param {object} event - The event payload.
|
|
20
|
-
* @param {string} event.name - The name of the added field.
|
|
21
|
-
* @param {Field<any>} event.field - The `Field` instance that was added.
|
|
22
|
-
*/
|
|
23
|
-
onAdd: Emitter<[event: {
|
|
24
|
-
name: string;
|
|
25
|
-
field: Field<any>;
|
|
26
|
-
}]>;
|
|
27
|
-
/**
|
|
28
|
-
* An event emitter that fires after one or more fields have been removed.
|
|
29
|
-
* @event
|
|
30
|
-
* @param {object} event - The event payload.
|
|
31
|
-
* @param {string[]} event.names - An array of names of the fields that were successfully removed.
|
|
32
|
-
*/
|
|
33
|
-
onRemove: Emitter<[event: {
|
|
34
|
-
names: string[];
|
|
35
|
-
}]>;
|
|
36
|
-
/**
|
|
37
|
-
* Gets the read-only map of all `Field` instances in this container.
|
|
38
|
-
* @returns {Map<string, Field<any>>} The collection of fields.
|
|
39
|
-
*/
|
|
40
|
-
get fields(): Map<string, Field<any>>;
|
|
41
|
-
/**
|
|
42
|
-
* Creates an instance of Fields.
|
|
43
|
-
* @param {FieldRegistry} fieldRegistry - The registry used to create new `Field` instances.
|
|
44
|
-
*/
|
|
45
|
-
constructor(fieldRegistry: FieldRegistry);
|
|
46
|
-
/**
|
|
47
|
-
* Checks if a field with the given name exists in the collection.
|
|
48
|
-
* @param {string} name The name of the field to check.
|
|
49
|
-
* @returns {boolean} `true` if the field exists, otherwise `false`.
|
|
50
|
-
*/
|
|
51
|
-
has(name: string): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Adds a pre-existing `Field` instance to the collection and fires the `onAdd` event.
|
|
54
|
-
* @template T - The specific `Field` type being added.
|
|
55
|
-
* @param {Field<any>} field - The `Field` instance to add.
|
|
56
|
-
* @returns {T} The added `Field` instance, cast to type `T`.
|
|
57
|
-
* @throws If a field with the same name already exists.
|
|
58
|
-
*/
|
|
59
|
-
add<T extends Field<any>>(field: Field<any>): T;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a new `Field` instance of a specified type, adds it to the collection, and returns it.
|
|
62
|
-
* This is the primary factory method for creating fields within this container.
|
|
63
|
-
* @template T - The expected `Field` type to be returned.
|
|
64
|
-
* @param {string} typeName - The registered type name of the field to create (e.g., 'numeric', 'boolean').
|
|
65
|
-
* @param {string} name - The unique name for the new field.
|
|
66
|
-
* @param {*} initialValue - The initial value for the new field.
|
|
67
|
-
* @param {*} [options] - Optional configuration passed to the field's constructor.
|
|
68
|
-
* @returns {T} The newly created `Field` instance.
|
|
69
|
-
*/
|
|
70
|
-
create<T extends Field<any>>(typeName: string, name: string, initialValue: any, options?: any): T;
|
|
71
|
-
/**
|
|
72
|
-
* Updates an existing field's value or creates a new one if it doesn't exist.
|
|
73
|
-
* @template T - The expected `Field` type.
|
|
74
|
-
* @param {string} typeName - The type name to use if a new field needs to be created.
|
|
75
|
-
* @param {string} name - The name of the field to update or create.
|
|
76
|
-
* @param {*} value - The new value to set.
|
|
77
|
-
* @param {*} [options] - Optional configuration, used only if a new field is created.
|
|
78
|
-
* @returns {T} The existing or newly created `Field` instance.
|
|
79
|
-
*/
|
|
80
|
-
upset<T extends Field<any>>(typeName: string, name: string, value: any, options?: any): T;
|
|
81
|
-
/**
|
|
82
|
-
* Retrieves a field by its name.
|
|
83
|
-
* @template TField - The expected `Field` type to be returned.
|
|
84
|
-
* @param {string} name - The name of the field to retrieve.
|
|
85
|
-
* @returns {TField} The `Field` instance.
|
|
86
|
-
* @throws If the field does not exist.
|
|
87
|
-
*/
|
|
88
|
-
get<TField extends Field<any>>(name: string): TField;
|
|
89
|
-
/**
|
|
90
|
-
* Removes one or more fields from the collection.
|
|
91
|
-
* This method ensures that the `destroy` method of each removed field is called to clean up its resources.
|
|
92
|
-
* @param {string| string[]} names A single name or an array of names to remove.
|
|
93
|
-
*/
|
|
94
|
-
remove(names: string | string[]): void;
|
|
95
|
-
/**
|
|
96
|
-
* Removes all fields from the collection, ensuring each is properly destroyed.
|
|
97
|
-
*/
|
|
98
|
-
clear(): void;
|
|
99
|
-
destroy(): void;
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=fields.d.ts.map
|
package/dist/fields.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO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GAAG,CAAC,MAAM,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAKpD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAkB/B;;OAEG;IACH,KAAK;IAIL,OAAO;CAKR"}
|
package/dist/fields.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { Emitter, throwIf } from '@axi-engine/utils';
|
|
2
|
-
/**
|
|
3
|
-
* A container for a collection of named `Field` instances.
|
|
4
|
-
*
|
|
5
|
-
* This class acts as a "leaf" node in the `FieldTree` hierarchy, managing a flat
|
|
6
|
-
* key-value store of reactive data points. It uses a `FieldRegistry` to dynamically
|
|
7
|
-
* create `Field` instances of different types.
|
|
8
|
-
*/
|
|
9
|
-
export class Fields {
|
|
10
|
-
static typeName = 'fields';
|
|
11
|
-
typeName = Fields.typeName;
|
|
12
|
-
_fields = new Map();
|
|
13
|
-
_fieldRegistry;
|
|
14
|
-
/**
|
|
15
|
-
* An event emitter that fires when a new field is added to the collection.
|
|
16
|
-
* @event
|
|
17
|
-
* @param {object} event - The event payload.
|
|
18
|
-
* @param {string} event.name - The name of the added field.
|
|
19
|
-
* @param {Field<any>} event.field - The `Field` instance that was added.
|
|
20
|
-
*/
|
|
21
|
-
onAdd = new Emitter();
|
|
22
|
-
/**
|
|
23
|
-
* An event emitter that fires after one or more fields have been removed.
|
|
24
|
-
* @event
|
|
25
|
-
* @param {object} event - The event payload.
|
|
26
|
-
* @param {string[]} event.names - An array of names of the fields that were successfully removed.
|
|
27
|
-
*/
|
|
28
|
-
onRemove = new Emitter();
|
|
29
|
-
/**
|
|
30
|
-
* Gets the read-only map of all `Field` instances in this container.
|
|
31
|
-
* @returns {Map<string, Field<any>>} The collection of fields.
|
|
32
|
-
*/
|
|
33
|
-
get fields() {
|
|
34
|
-
return this._fields;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Creates an instance of Fields.
|
|
38
|
-
* @param {FieldRegistry} fieldRegistry - The registry used to create new `Field` instances.
|
|
39
|
-
*/
|
|
40
|
-
constructor(fieldRegistry) {
|
|
41
|
-
this._fieldRegistry = fieldRegistry;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Checks if a field with the given name exists in the collection.
|
|
45
|
-
* @param {string} name The name of the field to check.
|
|
46
|
-
* @returns {boolean} `true` if the field exists, otherwise `false`.
|
|
47
|
-
*/
|
|
48
|
-
has(name) {
|
|
49
|
-
return this._fields.has(name);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Adds a pre-existing `Field` instance to the collection and fires the `onAdd` event.
|
|
53
|
-
* @template T - The specific `Field` type being added.
|
|
54
|
-
* @param {Field<any>} field - The `Field` instance to add.
|
|
55
|
-
* @returns {T} The added `Field` instance, cast to type `T`.
|
|
56
|
-
* @throws If a field with the same name already exists.
|
|
57
|
-
*/
|
|
58
|
-
add(field) {
|
|
59
|
-
throwIf(this.has(field.name), `Field with name '${field.name}' already exists`);
|
|
60
|
-
this._fields.set(field.name, field);
|
|
61
|
-
this.onAdd.emit({
|
|
62
|
-
name: field.name,
|
|
63
|
-
field: field
|
|
64
|
-
});
|
|
65
|
-
return field;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Creates a new `Field` instance of a specified type, adds it to the collection, and returns it.
|
|
69
|
-
* This is the primary factory method for creating fields within this container.
|
|
70
|
-
* @template T - The expected `Field` type to be returned.
|
|
71
|
-
* @param {string} typeName - The registered type name of the field to create (e.g., 'numeric', 'boolean').
|
|
72
|
-
* @param {string} name - The unique name for the new field.
|
|
73
|
-
* @param {*} initialValue - The initial value for the new field.
|
|
74
|
-
* @param {*} [options] - Optional configuration passed to the field's constructor.
|
|
75
|
-
* @returns {T} The newly created `Field` instance.
|
|
76
|
-
*/
|
|
77
|
-
create(typeName, name, initialValue, options) {
|
|
78
|
-
const Ctor = this._fieldRegistry.get(typeName);
|
|
79
|
-
const field = new Ctor(name, initialValue, options);
|
|
80
|
-
this.add(field);
|
|
81
|
-
return field;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Updates an existing field's value or creates a new one if it doesn't exist.
|
|
85
|
-
* @template T - The expected `Field` type.
|
|
86
|
-
* @param {string} typeName - The type name to use if a new field needs to be created.
|
|
87
|
-
* @param {string} name - The name of the field to update or create.
|
|
88
|
-
* @param {*} value - The new value to set.
|
|
89
|
-
* @param {*} [options] - Optional configuration, used only if a new field is created.
|
|
90
|
-
* @returns {T} The existing or newly created `Field` instance.
|
|
91
|
-
*/
|
|
92
|
-
upset(typeName, name, value, options) {
|
|
93
|
-
if (this.has(name)) {
|
|
94
|
-
const field = this.get(name);
|
|
95
|
-
field.value = value;
|
|
96
|
-
return field;
|
|
97
|
-
}
|
|
98
|
-
return this.create(typeName, name, value, options);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Retrieves a field by its name.
|
|
102
|
-
* @template TField - The expected `Field` type to be returned.
|
|
103
|
-
* @param {string} name - The name of the field to retrieve.
|
|
104
|
-
* @returns {TField} The `Field` instance.
|
|
105
|
-
* @throws If the field does not exist.
|
|
106
|
-
*/
|
|
107
|
-
get(name) {
|
|
108
|
-
throwIf(!this._fields.has(name), `Field with name '${name}' not exists`);
|
|
109
|
-
return this._fields.get(name);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Removes one or more fields from the collection.
|
|
113
|
-
* This method ensures that the `destroy` method of each removed field is called to clean up its resources.
|
|
114
|
-
* @param {string| string[]} names A single name or an array of names to remove.
|
|
115
|
-
*/
|
|
116
|
-
remove(names) {
|
|
117
|
-
const namesToRemove = Array.isArray(names) ? names : [names];
|
|
118
|
-
const reallyRemoved = namesToRemove.filter(name => {
|
|
119
|
-
const field = this._fields.get(name);
|
|
120
|
-
if (!field) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
field.destroy();
|
|
124
|
-
return this._fields.delete(name);
|
|
125
|
-
});
|
|
126
|
-
if (!reallyRemoved.length) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
this.onRemove.emit({ names: reallyRemoved });
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Removes all fields from the collection, ensuring each is properly destroyed.
|
|
133
|
-
*/
|
|
134
|
-
clear() {
|
|
135
|
-
this.remove(Array.from(this._fields.keys()));
|
|
136
|
-
}
|
|
137
|
-
destroy() {
|
|
138
|
-
this.clear();
|
|
139
|
-
this.onAdd.clear();
|
|
140
|
-
this.onRemove.clear();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=fields.js.map
|
package/dist/fields.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAInD;;;;;;GAMG;AACH,MAAM,OAAO,MAAM;IACjB,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC;IAC3B,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAE3B,OAAO,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC7C,cAAc,CAAgB;IAEvC;;;;;;OAMG;IACH,KAAK,GAAG,IAAI,OAAO,EAGd,CAAC;IAEN;;;;;OAKG;IACH,QAAQ,GAAG,IAAI,OAAO,EAEjB,CAAC;IAEN;;;OAGG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,YAAY,aAA4B;QACtC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAuB,KAAiB;QACzC,O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CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAE5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AAEzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAE5B,cAAc,SAAS,CAAA"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAEhC,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAE5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AAEzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAE5B,cAAc,SAAS,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Constructor } from '@axi-engine/utils';
|
|
2
|
-
import { Field } from '../field';
|
|
3
|
-
import { Fields } from '../fields';
|
|
4
|
-
/**
|
|
5
|
-
* extract field type
|
|
6
|
-
*/
|
|
7
|
-
type GetValueType<TField extends Field<any>> = TField extends Field<infer U> ? U : any;
|
|
8
|
-
/**
|
|
9
|
-
* A mapped type that creates the method signatures for a typed mixin.
|
|
10
|
-
* e.g., createBoolean, upsetBoolean, getBoolean
|
|
11
|
-
*/
|
|
12
|
-
type TypedMethods<TCtor extends Constructor<Field<any>>, TBaseName extends string> = {
|
|
13
|
-
[K in `create${TBaseName}`]: (name: string, initialValue: GetValueType<InstanceType<TCtor>>, options?: ConstructorParameters<TCtor>[2]) => InstanceType<TCtor>;
|
|
14
|
-
} & {
|
|
15
|
-
[K in `upset${TBaseName}`]: (name: string, value: GetValueType<InstanceType<TCtor>>, options?: ConstructorParameters<TCtor>[2]) => InstanceType<TCtor>;
|
|
16
|
-
} & {
|
|
17
|
-
[K in `get${TBaseName}`]: (name: string) => InstanceType<TCtor>;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* A higher-order function that generates a mixin for a specific Field type.
|
|
21
|
-
* This factory removes the need to write boilerplate mixin code for every new field type.
|
|
22
|
-
*
|
|
23
|
-
* @param typeName The `typeName` of the Field to create (e.g., 'boolean', 'my-signal-field').
|
|
24
|
-
* @param baseMethodName The base name for the generated methods (e.g., 'Boolean', 'MySignal').
|
|
25
|
-
* @returns A fully functional, typed mixin.
|
|
26
|
-
*/
|
|
27
|
-
export declare function createTypedMethodsMixin<TCtor extends Constructor<Field<any>>, TBaseName extends string>(typeName: string, baseMethodName: TBaseName): <TBase extends Constructor<Fields>>(Base: TBase) => Constructor<InstanceType<TBase> & TypedMethods<TCtor, TBaseName>>;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=mixin-factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mixin-factory.d.ts","sourceRoot":"","sources":["../../src/mixins/mixin-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,KAAK,YAAY,CAAC,MAAM,SAAS,KAAK,CAAC,GAAG,CAA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ate mixin code for every new field type.
|
|
4
|
-
*
|
|
5
|
-
* @param typeName The `typeName` of the Field to create (e.g., 'boolean', 'my-signal-field').
|
|
6
|
-
* @param baseMethodName The base name for the generated methods (e.g., 'Boolean', 'MySignal').
|
|
7
|
-
* @returns A fully functional, typed mixin.
|
|
8
|
-
*/
|
|
9
|
-
export function createTypedMethodsMixin(typeName, baseMethodName) {
|
|
10
|
-
const methodNames = {
|
|
11
|
-
create: `create${baseMethodName}`,
|
|
12
|
-
upset: `upset${baseMethodName}`,
|
|
13
|
-
get: `get${baseMethodName}`,
|
|
14
|
-
};
|
|
15
|
-
return function (Base) {
|
|
16
|
-
return class FieldsWith extends Base {
|
|
17
|
-
// createBoolean, createMySignal, etc.
|
|
18
|
-
[methodNames.create](name, initialValue, options) {
|
|
19
|
-
return this.create(typeName, name, initialValue, options);
|
|
20
|
-
}
|
|
21
|
-
// upsetBoolean, upsetMySignal, etc.
|
|
22
|
-
[methodNames.upset](name, value, options) {
|
|
23
|
-
return this.upset(typeName, name, value, options);
|
|
24
|
-
}
|
|
25
|
-
// getBoolean, getMySignal, etc.
|
|
26
|
-
[methodNames.get](name) {
|
|
27
|
-
return this.get(name);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=mixin-factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mixin-factory.js","sourceRoot":"","sources":["../../src/mixins/mixin-factory.ts"],"names":[],"mappings":"AAwBA;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAIrC,QAAgB,EAChB,cAAyB;IAEzB,MAAM,WAAW,GAAG;QAClB,MAAM,EAAE,SAAS,cAAc,EAAE;QACjC,KAAK,EAAE,QAAQ,cAAc,EAAE;QAC/B,GAAG,EAAE,MAAM,cAAc,EAAE;KAC5B,CAAC;IAEF,OAAO,UAA6C,IAAW;QAG7D,OAAO,MAAM,UAAW,SAAQ,IAAI;YAClC,sCAAsC;YACtC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAY,EAAE,YAAiB,EAAE,OAAyC;gBAC7F,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAwB,CAAC;YACnF,CAAC;YAED,oCAAoC;YACpC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,IAAY,EAAE,KAAU,EAAE,OAAyC;gBACrF,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAwB,CAAC;YAC3E,CAAC;YAED,gCAAgC;YAChC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAY;gBAC5B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;SACK,CAAC;IACX,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CoreBooleanField } from '../field-definitions';
|
|
2
|
-
export declare const WithBooleanFields: <TBase extends import("@axi-engine/utils").Constructor<import("..").Fields>>(Base: TBase) => import("@axi-engine/utils").Constructor<InstanceType<TBase> & {
|
|
3
|
-
createBoolean: (name: string, initialValue: boolean, options?: import("../field-definitions").CoreBooleanFieldOptions | undefined) => CoreBooleanField;
|
|
4
|
-
} & {
|
|
5
|
-
upsetBoolean: (name: string, value: boolean, options?: import("../field-definitions").CoreBooleanFieldOptions | undefined) => CoreBooleanField;
|
|
6
|
-
} & {
|
|
7
|
-
getBoolean: (name: string) => CoreBooleanField;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=with-boolean-fields.mixin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-boolean-fields.mixin.d.ts","sourceRoot":"","sources":["../../src/mixins/with-boolean-fields.mixin.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAEtD,eAAO,MAAM,iBAAiB;;;;;;EAGS,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-boolean-fields.mixin.js","sourceRoot":"","sources":["../../src/mixins/with-boolean-fields.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAGtD,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Constructor } from '@axi-engine/utils';
|
|
2
|
-
import { Fields } from '../fields';
|
|
3
|
-
import { CoreField } from '../field-definitions';
|
|
4
|
-
import { FieldOptions } from '../field';
|
|
5
|
-
export declare function WithDefaultGenericFields<TBase extends Constructor<Fields>>(Base: TBase): {
|
|
6
|
-
new (...args: any[]): {
|
|
7
|
-
createGeneric<T>(name: string, initialValue: T, options?: FieldOptions<T>): CoreField<T>;
|
|
8
|
-
upsetGeneric<T>(name: string, value: T, options?: FieldOptions<T>): CoreField<T>;
|
|
9
|
-
getGeneric<T>(name: string): CoreField<T>;
|
|
10
|
-
readonly typeName: "fields";
|
|
11
|
-
readonly _fields: Map<string, import("../field").Field<any>>;
|
|
12
|
-
readonly _fieldRegistry: import("..").FieldRegistry;
|
|
13
|
-
onAdd: import("@axi-engine/utils").Emitter<[event: {
|
|
14
|
-
name: string;
|
|
15
|
-
field: import("../field").Field<any>;
|
|
16
|
-
}]>;
|
|
17
|
-
onRemove: import("@axi-engine/utils").Emitter<[event: {
|
|
18
|
-
names: string[];
|
|
19
|
-
}]>;
|
|
20
|
-
get fields(): Map<string, import("../field").Field<any>>;
|
|
21
|
-
has(name: string): boolean;
|
|
22
|
-
add<T extends import("../field").Field<any>>(field: import("../field").Field<any>): T;
|
|
23
|
-
create<T extends import("../field").Field<any>>(typeName: string, name: string, initialValue: any, options?: any): T;
|
|
24
|
-
upset<T extends import("../field").Field<any>>(typeName: string, name: string, value: any, options?: any): T;
|
|
25
|
-
get<TField extends import("../field").Field<any>>(name: string): TField;
|
|
26
|
-
remove(names: string | string[]): void;
|
|
27
|
-
clear(): void;
|
|
28
|
-
destroy(): void;
|
|
29
|
-
};
|
|
30
|
-
} & TBase;
|
|
31
|
-
//# sourceMappingURL=with-default-generic-fields.mixin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-default-generic-fields.mixin.d.ts","sourceRoot":"","sources":["../../src/mixins/with-default-generic-fields.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAGtC,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK;;sBAGrE,CAAC,QAAQ,MAAM,gBAAgB,CAAC,YAAY,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;qBAI3E,CAAC,QAAQ,MAAM,SAAS,CAAC,YAAY,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;mBAIrE,CAAC,QAAQ,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;UAI5C"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CoreField } from '../field-definitions';
|
|
2
|
-
export function WithDefaultGenericFields(Base) {
|
|
3
|
-
return class FieldsWithDefaultGeneric extends Base {
|
|
4
|
-
createGeneric(name, initialValue, options) {
|
|
5
|
-
return this.create(CoreField.typeName, name, initialValue, options);
|
|
6
|
-
}
|
|
7
|
-
upsetGeneric(name, value, options) {
|
|
8
|
-
return this.upset(CoreField.typeName, name, value, options);
|
|
9
|
-
}
|
|
10
|
-
getGeneric(name) {
|
|
11
|
-
return this.get(name);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=with-default-generic-fields.mixin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-default-generic-fields.mixin.js","sourceRoot":"","sources":["../../src/mixins/with-default-generic-fields.mixin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAI/C,MAAM,UAAU,wBAAwB,CAAoC,IAAW;IAErF,OAAO,MAAM,wBAAyB,SAAQ,IAAI;QAChD,aAAa,CAAI,IAAY,EAAE,YAAe,EAAE,OAAyB;YACvE,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC;QAED,YAAY,CAAI,IAAY,EAAE,KAAQ,EAAE,OAAyB;YAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC;QAED,UAAU,CAAI,IAAY;YACxB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CoreNumericField } from '../field-definitions';
|
|
2
|
-
export declare const WithNumericFields: <TBase extends import("@axi-engine/utils").Constructor<import("..").Fields>>(Base: TBase) => import("@axi-engine/utils").Constructor<InstanceType<TBase> & {
|
|
3
|
-
createNumeric: (name: string, initialValue: number, options?: import("../field-definitions").CoreNumericFieldOptions | undefined) => CoreNumericField;
|
|
4
|
-
} & {
|
|
5
|
-
upsetNumeric: (name: string, value: number, options?: import("../field-definitions").CoreNumericFieldOptions | undefined) => CoreNumericField;
|
|
6
|
-
} & {
|
|
7
|
-
getNumeric: (name: string) => CoreNumericField;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=with-numeric-fields.mixin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-numeric-fields.mixin.d.ts","sourceRoot":"","sources":["../../src/mixins/with-numeric-fields.mixin.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAGtD,eAAO,MAAM,iBAAiB;;;;;;EAGS,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-numeric-fields.mixin.js","sourceRoot":"","sources":["../../src/mixins/with-numeric-fields.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAGtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAGtD,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CoreStringField } from '../field-definitions';
|
|
2
|
-
export declare const WithStringFields: <TBase extends import("@axi-engine/utils").Constructor<import("..").Fields>>(Base: TBase) => import("@axi-engine/utils").Constructor<InstanceType<TBase> & {
|
|
3
|
-
createString: (name: string, initialValue: string, options?: import("../field-definitions").CoreStringFieldOptions | undefined) => CoreStringField;
|
|
4
|
-
} & {
|
|
5
|
-
upsetString: (name: string, value: string, options?: import("../field-definitions").CoreStringFieldOptions | undefined) => CoreStringField;
|
|
6
|
-
} & {
|
|
7
|
-
getString: (name: string) => CoreStringField;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=with-string-fields.mixin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-string-fields.mixin.d.ts","sourceRoot":"","sources":["../../src/mixins/with-string-fields.mixin.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,eAAO,MAAM,gBAAgB;;;;;;EAGQ,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-string-fields.mixin.js","sourceRoot":"","sources":["../../src/mixins/with-string-fields.mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAGrD,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Policy } from './policy';
|
|
2
|
-
export declare class ClampMaxPolicy implements Policy<number> {
|
|
3
|
-
max: number;
|
|
4
|
-
static readonly id = "clampMax";
|
|
5
|
-
readonly id = "clampMax";
|
|
6
|
-
constructor(max: number);
|
|
7
|
-
apply(val: number): number;
|
|
8
|
-
updateBounds(max: number): void;
|
|
9
|
-
}
|
|
10
|
-
export declare function clampMaxPolicy(max: number): ClampMaxPolicy;
|
|
11
|
-
//# sourceMappingURL=clamp-max-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clamp-max-policy.d.ts","sourceRoot":"","sources":["../../src/policies/clamp-max-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,qBAAa,cAAe,YAAW,MAAM,CAAC,MAAM,CAAC;IAIhC,GAAG,EAAE,MAAM;IAH9B,MAAM,CAAC,QAAQ,CAAC,EAAE,cAAc;IAChC,QAAQ,CAAC,EAAE,cAAqB;gBAEb,GAAG,EAAE,MAAM;IAG9B,KAAK,CAAC,GAAG,EAAE,MAAM;IAIjB,YAAY,CAAC,GAAG,EAAE,MAAM;CAGzB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,kBAEzC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class ClampMaxPolicy {
|
|
2
|
-
max;
|
|
3
|
-
static id = 'clampMax';
|
|
4
|
-
id = ClampMaxPolicy.id;
|
|
5
|
-
constructor(max) {
|
|
6
|
-
this.max = max;
|
|
7
|
-
}
|
|
8
|
-
apply(val) {
|
|
9
|
-
return Math.min(this.max, val);
|
|
10
|
-
}
|
|
11
|
-
updateBounds(max) {
|
|
12
|
-
this.max = max;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export function clampMaxPolicy(max) {
|
|
16
|
-
return new ClampMaxPolicy(max);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=clamp-max-policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clamp-max-policy.js","sourceRoot":"","sources":["../../src/policies/clamp-max-policy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IAIN;IAHnB,MAAM,CAAU,EAAE,GAAG,UAAU,CAAC;IACvB,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC;IAEhC,YAAmB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAC9B,CAAC;IAED,KAAK,CAAC,GAAW;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,YAAY,CAAC,GAAW;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;;AAGH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,IAAI,cAAc,CAAC,GAAG,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Policy } from './policy';
|
|
2
|
-
export declare class ClampMinPolicy implements Policy<number> {
|
|
3
|
-
min: number;
|
|
4
|
-
static readonly id = "clampMin";
|
|
5
|
-
readonly id = "clampMin";
|
|
6
|
-
constructor(min: number);
|
|
7
|
-
apply(val: number): number;
|
|
8
|
-
updateBounds(min: number): void;
|
|
9
|
-
}
|
|
10
|
-
export declare function clampMinPolicy(min: number): ClampMinPolicy;
|
|
11
|
-
//# sourceMappingURL=clamp-min-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clamp-min-policy.d.ts","sourceRoot":"","sources":["../../src/policies/clamp-min-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,qBAAa,cAAe,YAAW,MAAM,CAAC,MAAM,CAAC;IAIhC,GAAG,EAAE,MAAM;IAH9B,MAAM,CAAC,QAAQ,CAAC,EAAE,cAAc;IAChC,QAAQ,CAAC,EAAE,cAAqB;gBAEb,GAAG,EAAE,MAAM;IAG9B,KAAK,CAAC,GAAG,EAAE,MAAM;IAIjB,YAAY,CAAC,GAAG,EAAE,MAAM;CAGzB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,kBAEzC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class ClampMinPolicy {
|
|
2
|
-
min;
|
|
3
|
-
static id = 'clampMin';
|
|
4
|
-
id = ClampMinPolicy.id;
|
|
5
|
-
constructor(min) {
|
|
6
|
-
this.min = min;
|
|
7
|
-
}
|
|
8
|
-
apply(val) {
|
|
9
|
-
return Math.max(this.min, val);
|
|
10
|
-
}
|
|
11
|
-
updateBounds(min) {
|
|
12
|
-
this.min = min;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export function clampMinPolicy(min) {
|
|
16
|
-
return new ClampMinPolicy(min);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=clamp-min-policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clamp-min-policy.js","sourceRoot":"","sources":["../../src/policies/clamp-min-policy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IAIN;IAHnB,MAAM,CAAU,EAAE,GAAG,UAAU,CAAC;IACvB,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC;IAEhC,YAAmB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAC9B,CAAC;IAED,KAAK,CAAC,GAAW;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,YAAY,CAAC,GAAW;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;;AAGH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,IAAI,cAAc,CAAC,GAAG,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Policy } from './policy';
|
|
2
|
-
export declare class ClampPolicy implements Policy<number> {
|
|
3
|
-
min: number;
|
|
4
|
-
max: number;
|
|
5
|
-
static readonly id = "clamp";
|
|
6
|
-
readonly id = "clamp";
|
|
7
|
-
constructor(min: number, max: number);
|
|
8
|
-
apply(val: number): number;
|
|
9
|
-
updateBounds(min: number, max: number): void;
|
|
10
|
-
}
|
|
11
|
-
export declare function clampPolicy(min: number, max: number): ClampPolicy;
|
|
12
|
-
//# sourceMappingURL=clamp-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clamp-policy.d.ts","sourceRoot":"","sources":["../../src/policies/clamp-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,qBAAa,WAAY,YAAW,MAAM,CAAC,MAAM,CAAC;IAI7B,GAAG,EAAE,MAAM;IAAS,GAAG,EAAE,MAAM;IAHlD,MAAM,CAAC,QAAQ,CAAC,EAAE,WAAW;IAC7B,QAAQ,CAAC,EAAE,WAAkB;gBAEV,GAAG,EAAE,MAAM,EAAS,GAAG,EAAE,MAAM;IAGlD,KAAK,CAAC,GAAG,EAAE,MAAM;IAIjB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CAItC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,eAEnD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export class ClampPolicy {
|
|
2
|
-
min;
|
|
3
|
-
max;
|
|
4
|
-
static id = 'clamp';
|
|
5
|
-
id = ClampPolicy.id;
|
|
6
|
-
constructor(min, max) {
|
|
7
|
-
this.min = min;
|
|
8
|
-
this.max = max;
|
|
9
|
-
}
|
|
10
|
-
apply(val) {
|
|
11
|
-
return Math.max(this.min, Math.min(this.max, val));
|
|
12
|
-
}
|
|
13
|
-
updateBounds(min, max) {
|
|
14
|
-
this.min = min;
|
|
15
|
-
this.max = max;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export function clampPolicy(min, max) {
|
|
19
|
-
return new ClampPolicy(min, max);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=clamp-policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clamp-policy.js","sourceRoot":"","sources":["../../src/policies/clamp-policy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,WAAW;IAIH;IAAoB;IAHvC,MAAM,CAAU,EAAE,GAAG,OAAO,CAAC;IACpB,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC;IAE7B,YAAmB,GAAW,EAAS,GAAW;QAA/B,QAAG,GAAH,GAAG,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;IAClD,CAAC;IAED,KAAK,CAAC,GAAW;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,YAAY,CAAC,GAAW,EAAE,GAAW;QACnC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;;AAGH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,GAAW;IAClD,OAAO,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC"}
|
package/dist/policies/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policies/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AAEzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,YAAY,CAAC"}
|