cx 26.1.13 → 26.2.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 (127) hide show
  1. package/build/charts/Marker.d.ts +1 -1
  2. package/build/charts/Marker.d.ts.map +1 -1
  3. package/build/charts/Marker.js +16 -6
  4. package/build/charts/MouseTracker.d.ts +2 -0
  5. package/build/charts/MouseTracker.d.ts.map +1 -1
  6. package/build/charts/helpers/PointReducer.d.ts +2 -2
  7. package/build/charts/helpers/PointReducer.d.ts.map +1 -1
  8. package/build/data/View.d.ts +5 -3
  9. package/build/data/View.d.ts.map +1 -1
  10. package/build/data/View.js +3 -1
  11. package/build/data/ops/findTreeNode.d.ts +20 -1
  12. package/build/data/ops/findTreeNode.d.ts.map +1 -1
  13. package/build/data/ops/findTreeNode.js +19 -0
  14. package/build/data/ops/findTreePath.d.ts +1 -1
  15. package/build/data/ops/findTreePath.d.ts.map +1 -1
  16. package/build/data/ops/findTreePath.js +1 -1
  17. package/build/data/ops/removeTreeNodes.d.ts +14 -1
  18. package/build/data/ops/removeTreeNodes.d.ts.map +1 -1
  19. package/build/data/ops/removeTreeNodes.js +13 -0
  20. package/build/data/ops/updateArray.d.ts +1 -1
  21. package/build/data/ops/updateArray.d.ts.map +1 -1
  22. package/build/data/ops/updateArray.js +1 -1
  23. package/build/data/ops/updateTree.d.ts +20 -1
  24. package/build/data/ops/updateTree.d.ts.map +1 -1
  25. package/build/data/ops/updateTree.js +19 -0
  26. package/build/jsx-runtime.d.ts +1 -0
  27. package/build/jsx-runtime.d.ts.map +1 -1
  28. package/build/jsx-runtime.js +3 -1
  29. package/build/svg/Rectangle.d.ts +6 -4
  30. package/build/svg/Rectangle.d.ts.map +1 -1
  31. package/build/svg/Rectangle.js +9 -7
  32. package/build/ui/Instance.d.ts +1 -1
  33. package/build/ui/Instance.d.ts.map +1 -1
  34. package/build/ui/Instance.js +18 -8
  35. package/build/ui/IsolatedScope.d.ts +2 -1
  36. package/build/ui/IsolatedScope.d.ts.map +1 -1
  37. package/build/ui/Prop.d.ts +1 -1
  38. package/build/ui/Prop.d.ts.map +1 -1
  39. package/build/ui/Widget.d.ts +2 -0
  40. package/build/ui/Widget.d.ts.map +1 -1
  41. package/build/ui/Widget.js +4 -0
  42. package/build/ui/adapter/GroupAdapter.d.ts +4 -4
  43. package/build/ui/adapter/GroupAdapter.d.ts.map +1 -1
  44. package/build/ui/adapter/GroupAdapter.js +4 -4
  45. package/build/ui/adapter/TreeAdapter.d.ts +5 -3
  46. package/build/ui/adapter/TreeAdapter.d.ts.map +1 -1
  47. package/build/ui/adapter/TreeAdapter.js +12 -5
  48. package/build/ui/app/startAppLoop.d.ts +2 -2
  49. package/build/ui/app/startAppLoop.d.ts.map +1 -1
  50. package/build/ui/app/startHotAppLoop.d.ts +4 -4
  51. package/build/ui/app/startHotAppLoop.d.ts.map +1 -1
  52. package/build/ui/app/startHotAppLoop.js +1 -1
  53. package/build/ui/batchUpdates.d.ts.map +1 -1
  54. package/build/ui/batchUpdates.js +3 -4
  55. package/build/widgets/Button.d.ts +0 -7
  56. package/build/widgets/Button.d.ts.map +1 -1
  57. package/build/widgets/HtmlElement.d.ts +2 -2
  58. package/build/widgets/HtmlElement.d.ts.map +1 -1
  59. package/build/widgets/form/Checkbox.d.ts +3 -3
  60. package/build/widgets/form/Checkbox.d.ts.map +1 -1
  61. package/build/widgets/form/Checkbox.js +11 -6
  62. package/build/widgets/form/DateTimeField.d.ts +4 -0
  63. package/build/widgets/form/DateTimeField.d.ts.map +1 -1
  64. package/build/widgets/form/TextField.d.ts +2 -2
  65. package/build/widgets/form/TextField.d.ts.map +1 -1
  66. package/build/widgets/grid/Grid.d.ts +20 -16
  67. package/build/widgets/grid/Grid.d.ts.map +1 -1
  68. package/build/widgets/grid/Grid.js +200 -86
  69. package/build/widgets/nav/Menu.d.ts +2 -0
  70. package/build/widgets/nav/Menu.d.ts.map +1 -1
  71. package/build/widgets/nav/Route.js +1 -1
  72. package/build/widgets/overlay/FlyweightTooltipTracker.d.ts +6 -4
  73. package/build/widgets/overlay/FlyweightTooltipTracker.d.ts.map +1 -1
  74. package/build/widgets/overlay/FlyweightTooltipTracker.js +3 -0
  75. package/build/widgets/overlay/Overlay.d.ts +2 -2
  76. package/build/widgets/overlay/Overlay.d.ts.map +1 -1
  77. package/dist/data.js +52 -1
  78. package/dist/jsx-runtime.js +4 -2
  79. package/dist/manifest.js +910 -904
  80. package/dist/svg.js +3 -0
  81. package/dist/ui.js +1548 -1544
  82. package/dist/widgets.css +1 -1
  83. package/dist/widgets.js +395 -4
  84. package/package.json +2 -2
  85. package/src/charts/Marker.tsx +448 -394
  86. package/src/charts/MouseTracker.tsx +3 -0
  87. package/src/charts/helpers/PointReducer.ts +2 -2
  88. package/src/data/View.ts +76 -19
  89. package/src/data/ops/findTreeNode.ts +20 -1
  90. package/src/data/ops/findTreePath.ts +7 -2
  91. package/src/data/ops/removeTreeNodes.ts +14 -1
  92. package/src/data/ops/updateArray.ts +4 -4
  93. package/src/data/ops/updateTree.ts +32 -6
  94. package/src/index.scss +6 -6
  95. package/src/jsx-runtime.spec.tsx +40 -0
  96. package/src/jsx-runtime.ts +87 -84
  97. package/src/svg/Rectangle.tsx +80 -73
  98. package/src/ui/DataProxy.ts +55 -55
  99. package/src/ui/Instance.ts +142 -45
  100. package/src/ui/IsolatedScope.ts +4 -2
  101. package/src/ui/Prop.ts +141 -141
  102. package/src/ui/Rescope.ts +50 -50
  103. package/src/ui/Widget.tsx +292 -234
  104. package/src/ui/adapter/ArrayAdapter.ts +229 -229
  105. package/src/ui/adapter/GroupAdapter.ts +8 -10
  106. package/src/ui/adapter/TreeAdapter.ts +75 -15
  107. package/src/ui/app/Url.spec.ts +1 -1
  108. package/src/ui/app/startAppLoop.tsx +56 -45
  109. package/src/ui/app/startHotAppLoop.ts +4 -4
  110. package/src/ui/batchUpdates.ts +16 -21
  111. package/src/ui/exprHelpers.ts +96 -96
  112. package/src/widgets/Button.tsx +0 -8
  113. package/src/widgets/HtmlElement.spec.tsx +100 -72
  114. package/src/widgets/HtmlElement.tsx +11 -10
  115. package/src/widgets/Sandbox.ts +104 -104
  116. package/src/widgets/Section.scss +55 -55
  117. package/src/widgets/drag-drop/DropZone.scss +74 -74
  118. package/src/widgets/form/Checkbox.tsx +296 -243
  119. package/src/widgets/form/DateTimeField.tsx +6 -0
  120. package/src/widgets/form/TextField.tsx +2 -2
  121. package/src/widgets/grid/Grid.scss +43 -10
  122. package/src/widgets/grid/Grid.tsx +4401 -3848
  123. package/src/widgets/nav/Menu.tsx +3 -0
  124. package/src/widgets/nav/Route.ts +1 -1
  125. package/src/widgets/overlay/FlyweightTooltipTracker.ts +15 -4
  126. package/src/widgets/overlay/Overlay.tsx +2 -1
  127. package/src/widgets/overlay/index.d.ts +11 -11
package/src/ui/Prop.ts CHANGED
@@ -1,141 +1,141 @@
1
- import type { Instance } from "./Instance";
2
- import { Selector } from "../data/Selector";
3
- import { AccessorChain } from "../data/createAccessorModelProxy";
4
-
5
- export type Bind = {
6
- bind: string;
7
- defaultValue?: any;
8
- throttle?: number;
9
- debounce?: number;
10
- };
11
-
12
- export type Tpl = {
13
- tpl: string;
14
- };
15
-
16
- export type Expr = {
17
- expr: string;
18
- set?: (value: any, instance?: Instance) => boolean;
19
- throttle?: number;
20
- debounce?: number;
21
- };
22
-
23
- export type Binding = Bind | Tpl | Expr;
24
-
25
- export type GetSet<T> = {
26
- get: Selector<T>;
27
- set?: (value: T, instance?: Instance) => boolean;
28
- throttle?: number;
29
- debounce?: number;
30
- };
31
-
32
- export interface StructuredSelector {
33
- [prop: string]: Selector<any>;
34
- }
35
-
36
- export type Prop<T> = T | Binding | Selector<T> | AccessorChain<T> | GetSet<T>;
37
-
38
- export type WritableProp<T> = Bind | AccessorChain<T>;
39
-
40
- export interface DataRecord {
41
- [prop: string]: any;
42
- }
43
-
44
- export interface Config {
45
- [prop: string]: any;
46
- }
47
-
48
- export interface StructuredProp {
49
- [prop: string]: Prop<any>;
50
- }
51
-
52
- /**
53
- * Utility type that extracts the resolved value type from a Prop<T>.
54
- * Used to derive the runtime type of structured props.
55
- */
56
- export type ResolveProp<P> =
57
- P extends Selector<infer T>
58
- ? T
59
- : P extends AccessorChain<infer T>
60
- ? T
61
- : P extends GetSet<infer T>
62
- ? T
63
- : P extends Bind
64
- ? any
65
- : P extends Tpl
66
- ? string
67
- : P extends Expr
68
- ? any
69
- : P;
70
-
71
- /**
72
- * Utility type that resolves a structured prop object to its runtime value types.
73
- * Transforms { name: StringProp, count: NumberProp } to { name: string, count: number }
74
- */
75
- export type ResolveStructuredPropType<S> = {
76
- [K in keyof S]: ResolveProp<S[K]>;
77
- };
78
-
79
- /**
80
- * Resolves the runtime value type from either a Prop<T> or a StructuredProp.
81
- * Use this for generic widgets like ContentResolver and Validator where the
82
- * input can be either a single prop or a structured object.
83
- *
84
- * - For Prop<T> (Selector, AccessorChain, GetSet), resolves to T
85
- * - For bindings (Bind, Tpl, Expr), resolves to any/string/any
86
- * - For structured objects, recursively resolves each property via ResolveStructuredProp
87
- * - For literal values, returns them as-is
88
- */
89
- export type ResolvePropType<P> =
90
- P extends Selector<infer T>
91
- ? T
92
- : P extends AccessorChain<infer T>
93
- ? T
94
- : P extends GetSet<infer T>
95
- ? T
96
- : P extends Bind
97
- ? any
98
- : P extends Tpl
99
- ? string
100
- : P extends Expr
101
- ? any
102
- : P extends object
103
- ? ResolveStructuredPropType<P>
104
- : P;
105
-
106
- /**
107
- * Generic structured prop type that provides type safety for params and their resolved values.
108
- * Use with ContentResolver and similar widgets to type the onResolve callback params.
109
- */
110
- export type TypedStructuredProp<T extends Record<string, any>> = {
111
- [K in keyof T]: Prop<T[K]>;
112
- };
113
-
114
- export type StringProp = Prop<string>;
115
- export type StyleProp = Prop<string | React.CSSProperties> | StructuredProp;
116
- export type NumberProp = Prop<number>;
117
- export type BooleanProp = Prop<boolean>;
118
- export type ClassProp = Prop<string> | StructuredProp;
119
- export type RecordsProp = Prop<DataRecord[]>;
120
- export type SortersProp = Prop<Sorter[]>;
121
- export type UnknownProp = Prop<unknown>;
122
- export type ModProp = StringProp | StructuredProp;
123
-
124
- export type RecordAlias = string | { toString(): string };
125
-
126
- export type SortDirection = "ASC" | "DESC";
127
-
128
- export interface Sorter {
129
- field?: string;
130
- value?: (record: DataRecord) => any;
131
- direction: SortDirection;
132
- }
133
-
134
- export interface CollatorOptions {
135
- localeMatcher?: "lookup" | "best fit";
136
- usage?: "sort" | "search";
137
- sensitivity?: "base" | "accent" | "case" | "variant";
138
- ignorePunctuation?: boolean;
139
- numeric?: boolean;
140
- caseFirst?: "upper" | "lower" | "false";
141
- }
1
+ import type { Instance } from "./Instance";
2
+ import { Selector } from "../data/Selector";
3
+ import { AccessorChain } from "../data/createAccessorModelProxy";
4
+
5
+ export type Bind = {
6
+ bind: string;
7
+ defaultValue?: any;
8
+ throttle?: number;
9
+ debounce?: number;
10
+ };
11
+
12
+ export type Tpl = {
13
+ tpl: string;
14
+ };
15
+
16
+ export type Expr = {
17
+ expr: string;
18
+ set?: (value: any, instance?: Instance) => boolean;
19
+ throttle?: number;
20
+ debounce?: number;
21
+ };
22
+
23
+ export type Binding = Bind | Tpl | Expr;
24
+
25
+ export type GetSet<T> = {
26
+ get: Selector<T>;
27
+ set?: (value: T, instance: Instance) => boolean;
28
+ throttle?: number;
29
+ debounce?: number;
30
+ };
31
+
32
+ export interface StructuredSelector {
33
+ [prop: string]: Selector<any>;
34
+ }
35
+
36
+ export type Prop<T> = T | Binding | Selector<T> | AccessorChain<T> | GetSet<T>;
37
+
38
+ export type WritableProp<T> = Bind | AccessorChain<T>;
39
+
40
+ export interface DataRecord {
41
+ [prop: string]: any;
42
+ }
43
+
44
+ export interface Config {
45
+ [prop: string]: any;
46
+ }
47
+
48
+ export interface StructuredProp {
49
+ [prop: string]: Prop<any>;
50
+ }
51
+
52
+ /**
53
+ * Utility type that extracts the resolved value type from a Prop<T>.
54
+ * Used to derive the runtime type of structured props.
55
+ */
56
+ export type ResolveProp<P> =
57
+ P extends Selector<infer T>
58
+ ? T
59
+ : P extends AccessorChain<infer T>
60
+ ? T
61
+ : P extends GetSet<infer T>
62
+ ? T
63
+ : P extends Bind
64
+ ? any
65
+ : P extends Tpl
66
+ ? string
67
+ : P extends Expr
68
+ ? any
69
+ : P;
70
+
71
+ /**
72
+ * Utility type that resolves a structured prop object to its runtime value types.
73
+ * Transforms { name: StringProp, count: NumberProp } to { name: string, count: number }
74
+ */
75
+ export type ResolveStructuredPropType<S> = {
76
+ [K in keyof S]: ResolveProp<S[K]>;
77
+ };
78
+
79
+ /**
80
+ * Resolves the runtime value type from either a Prop<T> or a StructuredProp.
81
+ * Use this for generic widgets like ContentResolver and Validator where the
82
+ * input can be either a single prop or a structured object.
83
+ *
84
+ * - For Prop<T> (Selector, AccessorChain, GetSet), resolves to T
85
+ * - For bindings (Bind, Tpl, Expr), resolves to any/string/any
86
+ * - For structured objects, recursively resolves each property via ResolveStructuredProp
87
+ * - For literal values, returns them as-is
88
+ */
89
+ export type ResolvePropType<P> =
90
+ P extends Selector<infer T>
91
+ ? T
92
+ : P extends AccessorChain<infer T>
93
+ ? T
94
+ : P extends GetSet<infer T>
95
+ ? T
96
+ : P extends Bind
97
+ ? any
98
+ : P extends Tpl
99
+ ? string
100
+ : P extends Expr
101
+ ? any
102
+ : P extends object
103
+ ? ResolveStructuredPropType<P>
104
+ : P;
105
+
106
+ /**
107
+ * Generic structured prop type that provides type safety for params and their resolved values.
108
+ * Use with ContentResolver and similar widgets to type the onResolve callback params.
109
+ */
110
+ export type TypedStructuredProp<T extends Record<string, any>> = {
111
+ [K in keyof T]: Prop<T[K]>;
112
+ };
113
+
114
+ export type StringProp = Prop<string>;
115
+ export type StyleProp = Prop<string | React.CSSProperties> | StructuredProp;
116
+ export type NumberProp = Prop<number>;
117
+ export type BooleanProp = Prop<boolean>;
118
+ export type ClassProp = Prop<string> | StructuredProp;
119
+ export type RecordsProp = Prop<DataRecord[]>;
120
+ export type SortersProp = Prop<Sorter[]>;
121
+ export type UnknownProp = Prop<unknown>;
122
+ export type ModProp = StringProp | StructuredProp;
123
+
124
+ export type RecordAlias = string | { toString(): string };
125
+
126
+ export type SortDirection = "ASC" | "DESC";
127
+
128
+ export interface Sorter {
129
+ field?: string;
130
+ value?: (record: DataRecord) => any;
131
+ direction: SortDirection;
132
+ }
133
+
134
+ export interface CollatorOptions {
135
+ localeMatcher?: "lookup" | "best fit";
136
+ usage?: "sort" | "search";
137
+ sensitivity?: "base" | "accent" | "case" | "variant";
138
+ ignorePunctuation?: boolean;
139
+ numeric?: boolean;
140
+ caseFirst?: "upper" | "lower" | "false";
141
+ }
package/src/ui/Rescope.ts CHANGED
@@ -1,50 +1,50 @@
1
- import { Widget } from "./Widget";
2
- import { PureContainerBase, PureContainerConfig } from "./PureContainer";
3
- import { Binding } from "../data/Binding";
4
- import { ZoomIntoPropertyView } from "../data/ZoomIntoPropertyView";
5
- import { StructuredInstanceDataAccessor } from "./StructuredInstanceDataAccessor";
6
- import { isObject } from "../util/isObject";
7
- import { StructuredProp } from "./Prop";
8
- import { AccessorChain } from "../data/createAccessorModelProxy";
9
-
10
- export interface RescopeConfig extends PureContainerConfig {
11
- bind: string | AccessorChain<any>;
12
- rootName?: string | AccessorChain<any>;
13
- rootAlias?: string | AccessorChain<any>;
14
- data?: StructuredProp;
15
- }
16
-
17
- export class Rescope extends PureContainerBase<RescopeConfig> {
18
- declare bind: string;
19
- declare binding: any;
20
- declare rootAlias?: string;
21
- declare rootName: string;
22
- declare data?: any;
23
-
24
- init() {
25
- this.binding = Binding.get(this.bind);
26
- if (this.rootAlias) this.rootName = this.rootAlias;
27
- super.init();
28
- }
29
-
30
- initInstance(context: any, instance: any) {
31
- instance.store = new ZoomIntoPropertyView({
32
- store: instance.parentStore,
33
- binding: this.binding,
34
- rootName: this.rootName,
35
- nestedData: isObject(this.data)
36
- ? new StructuredInstanceDataAccessor({ instance, data: this.data, useParentStore: true })
37
- : undefined,
38
- });
39
- super.initInstance(context, instance);
40
- }
41
-
42
- applyParentStore(instance: any) {
43
- instance.store.setStore(instance.parentStore);
44
- }
45
- }
46
-
47
- Rescope.prototype.bind = "$page";
48
- Rescope.prototype.rootName = "$root";
49
-
50
- Widget.alias("rescope", Rescope);
1
+ import { Widget } from "./Widget";
2
+ import { PureContainerBase, PureContainerConfig } from "./PureContainer";
3
+ import { Binding } from "../data/Binding";
4
+ import { ZoomIntoPropertyView } from "../data/ZoomIntoPropertyView";
5
+ import { StructuredInstanceDataAccessor } from "./StructuredInstanceDataAccessor";
6
+ import { isObject } from "../util/isObject";
7
+ import { StructuredProp } from "./Prop";
8
+ import { AccessorChain } from "../data/createAccessorModelProxy";
9
+
10
+ export interface RescopeConfig extends PureContainerConfig {
11
+ bind: string | AccessorChain<any>;
12
+ rootName?: string | AccessorChain<any>;
13
+ rootAlias?: string | AccessorChain<any>;
14
+ data?: StructuredProp;
15
+ }
16
+
17
+ export class Rescope extends PureContainerBase<RescopeConfig> {
18
+ declare bind: string;
19
+ declare binding: any;
20
+ declare rootAlias?: string;
21
+ declare rootName: string;
22
+ declare data?: any;
23
+
24
+ init() {
25
+ this.binding = Binding.get(this.bind);
26
+ if (this.rootAlias) this.rootName = this.rootAlias;
27
+ super.init();
28
+ }
29
+
30
+ initInstance(context: any, instance: any) {
31
+ instance.store = new ZoomIntoPropertyView({
32
+ store: instance.parentStore,
33
+ binding: this.binding,
34
+ rootName: this.rootName,
35
+ nestedData: isObject(this.data)
36
+ ? new StructuredInstanceDataAccessor({ instance, data: this.data, useParentStore: true })
37
+ : undefined,
38
+ });
39
+ super.initInstance(context, instance);
40
+ }
41
+
42
+ applyParentStore(instance: any) {
43
+ instance.store.setStore(instance.parentStore);
44
+ }
45
+ }
46
+
47
+ Rescope.prototype.bind = "$page";
48
+ Rescope.prototype.rootName = "$root";
49
+
50
+ Widget.alias("rescope", Rescope);