@genesislcap/foundation-utils 14.134.0 → 14.136.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/dist/custom-elements.json +212 -78
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/state/index.d.ts +3 -0
- package/dist/dts/state/index.d.ts.map +1 -0
- package/dist/dts/state/reactive.d.ts +37 -0
- package/dist/dts/state/reactive.d.ts.map +1 -0
- package/dist/dts/state/visitor.d.ts +60 -0
- package/dist/dts/state/visitor.d.ts.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/state/index.js +2 -0
- package/dist/esm/state/reactive.js +65 -0
- package/dist/esm/state/visitor.js +53 -0
- package/dist/foundation-utils.api.json +462 -0
- package/dist/foundation-utils.d.ts +98 -0
- package/docs/api/foundation-utils.md +3 -0
- package/docs/api/foundation-utils.objectvisitor.md +49 -0
- package/docs/api/foundation-utils.objectvisitor.visitarray.md +26 -0
- package/docs/api/foundation-utils.objectvisitor.visitobject.md +26 -0
- package/docs/api/foundation-utils.objectvisitor.visitproperty.md +28 -0
- package/docs/api/foundation-utils.reactive.md +59 -0
- package/docs/api/foundation-utils.visitobject.md +42 -0
- package/docs/api-report.md +16 -0
- package/package.json +5 -5
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [ObjectVisitor](./foundation-utils.objectvisitor.md) > [visitObject](./foundation-utils.objectvisitor.visitobject.md)
|
|
4
|
+
|
|
5
|
+
## ObjectVisitor.visitObject() method
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
**Signature:**
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
visitObject(object: any, data: TVisitorData): void;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Type | Description |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| object | any | |
|
|
21
|
+
| data | TVisitorData | |
|
|
22
|
+
|
|
23
|
+
**Returns:**
|
|
24
|
+
|
|
25
|
+
void
|
|
26
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [ObjectVisitor](./foundation-utils.objectvisitor.md) > [visitProperty](./foundation-utils.objectvisitor.visitproperty.md)
|
|
4
|
+
|
|
5
|
+
## ObjectVisitor.visitProperty() method
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
**Signature:**
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
visitProperty(object: any, key: PropertyKey, value: any, data: TVisitorData): void;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Type | Description |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| object | any | |
|
|
21
|
+
| key | PropertyKey | |
|
|
22
|
+
| value | any | |
|
|
23
|
+
| data | TVisitorData | |
|
|
24
|
+
|
|
25
|
+
**Returns:**
|
|
26
|
+
|
|
27
|
+
void
|
|
28
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [reactive](./foundation-utils.reactive.md)
|
|
4
|
+
|
|
5
|
+
## reactive() function
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Converts a plain object to a reactive, observable object.
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export declare function reactive<T>(object: T, deep?: boolean): T;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
| Parameter | Type | Description |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| object | T | The object to make reactive. |
|
|
23
|
+
| deep | boolean | _(Optional)_ Indicates whether to deeply convert the object. |
|
|
24
|
+
|
|
25
|
+
**Returns:**
|
|
26
|
+
|
|
27
|
+
T
|
|
28
|
+
|
|
29
|
+
The converted object.
|
|
30
|
+
|
|
31
|
+
## Example 1
|
|
32
|
+
|
|
33
|
+
An array or reactive items.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
this.todos = todosResponse.map((t) => reactive(t));
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Example 2
|
|
40
|
+
|
|
41
|
+
Add item.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
add(description: string) {
|
|
45
|
+
this.splice(this.todos.length, 0, reactive({ description, done: false }));
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Example 3
|
|
50
|
+
|
|
51
|
+
Remove item.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
remove(todo: Todo) {
|
|
55
|
+
const index = this.todos.indexOf(todo);
|
|
56
|
+
index !== -1 && this.splice(index, 1);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [visitObject](./foundation-utils.visitobject.md)
|
|
4
|
+
|
|
5
|
+
## visitObject() function
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Visit object utility.
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export declare function visitObject<TVisitorData>(object: any, deep: boolean, visitor: ObjectVisitor<TVisitorData>, data: TVisitorData, traversed: WeakSet<any> | Set<any>): void;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
| Parameter | Type | Description |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| object | any | The object. |
|
|
23
|
+
| deep | boolean | A flag to indicate if a recursive visit of sub objects should occur. |
|
|
24
|
+
| visitor | [ObjectVisitor](./foundation-utils.objectvisitor.md)<!-- --><TVisitorData> | The defined [ObjectVisitor](./foundation-utils.objectvisitor.md) logic. |
|
|
25
|
+
| data | TVisitorData | Visitor data. |
|
|
26
|
+
| traversed | WeakSet<any> \| Set<any> | The traversed object set. |
|
|
27
|
+
|
|
28
|
+
**Returns:**
|
|
29
|
+
|
|
30
|
+
void
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
|
|
34
|
+
Reactive example.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
export function reactive<T>(object: T, deep = false): T {
|
|
38
|
+
visitObject(object, deep, makeObserverVisitor, void 0, observed);
|
|
39
|
+
return object;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
package/docs/api-report.md
CHANGED
|
@@ -698,6 +698,16 @@ export class NumberParser {
|
|
|
698
698
|
parse(localeNumber: string): number;
|
|
699
699
|
}
|
|
700
700
|
|
|
701
|
+
// @beta (undocumented)
|
|
702
|
+
export interface ObjectVisitor<TVisitorData> {
|
|
703
|
+
// (undocumented)
|
|
704
|
+
visitArray(array: any[], data: TVisitorData): void;
|
|
705
|
+
// (undocumented)
|
|
706
|
+
visitObject(object: any, data: TVisitorData): void;
|
|
707
|
+
// (undocumented)
|
|
708
|
+
visitProperty(object: any, key: PropertyKey, value: any, data: TVisitorData): void;
|
|
709
|
+
}
|
|
710
|
+
|
|
701
711
|
// @public
|
|
702
712
|
export interface Observer<EventType> {
|
|
703
713
|
// (undocumented)
|
|
@@ -1060,6 +1070,9 @@ export const POPUP_DEFAULT_WIDTH = 483;
|
|
|
1060
1070
|
// @public
|
|
1061
1071
|
export type Publish<EventType> = (event: EventType) => void;
|
|
1062
1072
|
|
|
1073
|
+
// @beta
|
|
1074
|
+
export function reactive<T>(object: T, deep?: boolean): T;
|
|
1075
|
+
|
|
1063
1076
|
// @public
|
|
1064
1077
|
export function renderOnChange(target: FASTElement & {
|
|
1065
1078
|
render(): void;
|
|
@@ -1143,6 +1156,9 @@ export const UUID: InterfaceSymbol<UUID>;
|
|
|
1143
1156
|
export interface UUIDConfig {
|
|
1144
1157
|
}
|
|
1145
1158
|
|
|
1159
|
+
// @beta
|
|
1160
|
+
export function visitObject<TVisitorData>(object: any, deep: boolean, visitor: ObjectVisitor<TVisitorData>, data: TVisitorData, traversed: WeakSet<any> | Set<any>): void;
|
|
1161
|
+
|
|
1146
1162
|
// Warning: (ae-forgotten-export) The symbol "WhenTemplate" needs to be exported by the entry point index.d.ts
|
|
1147
1163
|
//
|
|
1148
1164
|
// @public
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-utils",
|
|
3
3
|
"description": "Genesis Foundation Utils",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.136.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"test": "genx test"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@genesislcap/foundation-testing": "14.
|
|
23
|
-
"@genesislcap/genx": "14.
|
|
22
|
+
"@genesislcap/foundation-testing": "14.136.0",
|
|
23
|
+
"@genesislcap/genx": "14.136.0",
|
|
24
24
|
"rimraf": "^3.0.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@genesislcap/foundation-logger": "14.
|
|
27
|
+
"@genesislcap/foundation-logger": "14.136.0",
|
|
28
28
|
"@microsoft/fast-components": "^2.30.6",
|
|
29
29
|
"@microsoft/fast-element": "^1.12.0",
|
|
30
30
|
"@microsoft/fast-foundation": "^2.49.4",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"customElements": "dist/custom-elements.json",
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "0056e1c9602a30db4d30802cdfe48e7489d0abcd"
|
|
46
46
|
}
|