tweak-ui 0.4.3 → 0.8.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 (200) hide show
  1. package/LICENSE +7 -7
  2. package/README.md +32 -32
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/lib/builder.d.ts +102 -162
  6. package/dist/lib/builder.d.ts.map +1 -1
  7. package/dist/lib/color/adapter.d.ts +7 -0
  8. package/dist/lib/color/adapter.d.ts.map +1 -0
  9. package/dist/lib/color/array-format.d.ts +9 -0
  10. package/dist/lib/color/array-format.d.ts.map +1 -0
  11. package/dist/lib/{color-formats → color}/converter.d.ts +18 -18
  12. package/dist/lib/color/converter.d.ts.map +1 -0
  13. package/dist/lib/color/css-string-format.d.ts +8 -0
  14. package/dist/lib/color/css-string-format.d.ts.map +1 -0
  15. package/dist/lib/color/formatter.d.ts +9 -0
  16. package/dist/lib/color/formatter.d.ts.map +1 -0
  17. package/dist/lib/color/hex-string-format.d.ts +9 -0
  18. package/dist/lib/color/hex-string-format.d.ts.map +1 -0
  19. package/dist/lib/{color-formats → color}/index.d.ts +3 -3
  20. package/dist/lib/color/index.d.ts.map +1 -0
  21. package/dist/lib/color/number-format.d.ts +9 -0
  22. package/dist/lib/color/number-format.d.ts.map +1 -0
  23. package/dist/lib/{color-formats → color}/object-format.d.ts +14 -14
  24. package/dist/lib/color/object-format.d.ts.map +1 -0
  25. package/dist/lib/{color-formats → color}/types.d.ts +107 -101
  26. package/dist/lib/color/types.d.ts.map +1 -0
  27. package/dist/lib/components/container/bar.d.ts +28 -0
  28. package/dist/lib/components/container/bar.d.ts.map +1 -0
  29. package/dist/lib/components/container/dialog.d.ts +14 -0
  30. package/dist/lib/components/container/dialog.d.ts.map +1 -0
  31. package/dist/lib/components/container/grid.d.ts +22 -0
  32. package/dist/lib/components/container/grid.d.ts.map +1 -0
  33. package/dist/lib/components/container/group.d.ts +55 -0
  34. package/dist/lib/components/container/group.d.ts.map +1 -0
  35. package/dist/lib/components/container/index.d.ts +10 -0
  36. package/dist/lib/components/container/index.d.ts.map +1 -0
  37. package/dist/lib/components/container/list.d.ts +25 -0
  38. package/dist/lib/components/container/list.d.ts.map +1 -0
  39. package/dist/lib/components/container/section.d.ts +28 -0
  40. package/dist/lib/components/container/section.d.ts.map +1 -0
  41. package/dist/lib/components/container/split.d.ts +40 -0
  42. package/dist/lib/components/container/split.d.ts.map +1 -0
  43. package/dist/lib/components/container/tabs.d.ts +23 -0
  44. package/dist/lib/components/container/tabs.d.ts.map +1 -0
  45. package/dist/lib/components/container/tree.d.ts +25 -0
  46. package/dist/lib/components/container/tree.d.ts.map +1 -0
  47. package/dist/lib/components/controls/angle.d.ts +47 -51
  48. package/dist/lib/components/controls/angle.d.ts.map +1 -1
  49. package/dist/lib/components/controls/bitmask.d.ts +41 -0
  50. package/dist/lib/components/controls/bitmask.d.ts.map +1 -0
  51. package/dist/lib/components/controls/bool.d.ts +52 -0
  52. package/dist/lib/components/controls/bool.d.ts.map +1 -0
  53. package/dist/lib/components/controls/color-picker.d.ts +41 -56
  54. package/dist/lib/components/controls/color-picker.d.ts.map +1 -1
  55. package/dist/lib/components/controls/color.d.ts +37 -51
  56. package/dist/lib/components/controls/color.d.ts.map +1 -1
  57. package/dist/lib/components/controls/index.d.ts +14 -10
  58. package/dist/lib/components/controls/index.d.ts.map +1 -1
  59. package/dist/lib/components/controls/input.d.ts +44 -0
  60. package/dist/lib/components/controls/input.d.ts.map +1 -0
  61. package/dist/lib/components/controls/matrix.d.ts +58 -0
  62. package/dist/lib/components/controls/matrix.d.ts.map +1 -0
  63. package/dist/lib/components/controls/point.d.ts +41 -47
  64. package/dist/lib/components/controls/point.d.ts.map +1 -1
  65. package/dist/lib/components/controls/poll.d.ts +12 -0
  66. package/dist/lib/components/controls/poll.d.ts.map +1 -0
  67. package/dist/lib/components/controls/scalar.d.ts +67 -0
  68. package/dist/lib/components/controls/scalar.d.ts.map +1 -0
  69. package/dist/lib/components/controls/select.d.ts +53 -59
  70. package/dist/lib/components/controls/select.d.ts.map +1 -1
  71. package/dist/lib/components/controls/spherical.d.ts +37 -74
  72. package/dist/lib/components/controls/spherical.d.ts.map +1 -1
  73. package/dist/lib/components/controls/string.d.ts +46 -0
  74. package/dist/lib/components/controls/string.d.ts.map +1 -0
  75. package/dist/lib/components/controls/vector.d.ts +54 -0
  76. package/dist/lib/components/controls/vector.d.ts.map +1 -0
  77. package/dist/lib/components/elements/button.d.ts +36 -0
  78. package/dist/lib/components/elements/button.d.ts.map +1 -0
  79. package/dist/lib/components/elements/divider.d.ts +4 -0
  80. package/dist/lib/components/elements/divider.d.ts.map +1 -0
  81. package/dist/lib/components/elements/graph.d.ts +8 -0
  82. package/dist/lib/components/elements/graph.d.ts.map +1 -0
  83. package/dist/lib/components/elements/image.d.ts +33 -0
  84. package/dist/lib/components/elements/image.d.ts.map +1 -0
  85. package/dist/lib/components/elements/index.d.ts +6 -0
  86. package/dist/lib/components/elements/index.d.ts.map +1 -0
  87. package/dist/lib/components/elements/widget.d.ts +27 -0
  88. package/dist/lib/components/elements/widget.d.ts.map +1 -0
  89. package/dist/lib/components/index.d.ts +3 -5
  90. package/dist/lib/components/index.d.ts.map +1 -1
  91. package/dist/lib/core/control.d.ts +20 -0
  92. package/dist/lib/core/control.d.ts.map +1 -0
  93. package/dist/lib/core/index.d.ts +3 -4
  94. package/dist/lib/core/index.d.ts.map +1 -1
  95. package/dist/lib/core/render.d.ts +7 -9
  96. package/dist/lib/core/render.d.ts.map +1 -1
  97. package/dist/lib/core/types.d.ts +73 -87
  98. package/dist/lib/core/types.d.ts.map +1 -1
  99. package/dist/lib/core/utils.d.ts +78 -93
  100. package/dist/lib/core/utils.d.ts.map +1 -1
  101. package/dist/lib/index.d.ts +21 -27
  102. package/dist/lib/index.d.ts.map +1 -1
  103. package/dist/lib/mount.d.ts +35 -45
  104. package/dist/lib/mount.d.ts.map +1 -1
  105. package/dist/lib/stats/index.d.ts +2 -0
  106. package/dist/lib/stats/index.d.ts.map +1 -0
  107. package/dist/lib/stats/sampler.d.ts +66 -0
  108. package/dist/lib/stats/sampler.d.ts.map +1 -0
  109. package/dist/lib/stats/stats-renderer.d.ts +16 -0
  110. package/dist/lib/stats/stats-renderer.d.ts.map +1 -0
  111. package/dist/style.css +1 -0
  112. package/dist/style.d.ts +4 -0
  113. package/dist/tweak-ui.module.js +2938 -2393
  114. package/dist/tweak-ui.module.js.map +1 -1
  115. package/dist/tweak-ui.umd.js +33 -4420
  116. package/dist/tweak-ui.umd.js.map +1 -1
  117. package/package.json +37 -51
  118. package/dist/index.html +0 -1063
  119. package/dist/lib/color-formats/array-format.d.ts +0 -9
  120. package/dist/lib/color-formats/array-format.d.ts.map +0 -1
  121. package/dist/lib/color-formats/array-format.spec.d.ts +0 -2
  122. package/dist/lib/color-formats/array-format.spec.d.ts.map +0 -1
  123. package/dist/lib/color-formats/converter.d.ts.map +0 -1
  124. package/dist/lib/color-formats/converter.spec.d.ts +0 -2
  125. package/dist/lib/color-formats/converter.spec.d.ts.map +0 -1
  126. package/dist/lib/color-formats/css-string-format.d.ts +0 -8
  127. package/dist/lib/color-formats/css-string-format.d.ts.map +0 -1
  128. package/dist/lib/color-formats/css-string-format.spec.d.ts +0 -2
  129. package/dist/lib/color-formats/css-string-format.spec.d.ts.map +0 -1
  130. package/dist/lib/color-formats/formatter.d.ts +0 -9
  131. package/dist/lib/color-formats/formatter.d.ts.map +0 -1
  132. package/dist/lib/color-formats/formatter.spec.d.ts +0 -2
  133. package/dist/lib/color-formats/formatter.spec.d.ts.map +0 -1
  134. package/dist/lib/color-formats/hex-string-format.d.ts +0 -8
  135. package/dist/lib/color-formats/hex-string-format.d.ts.map +0 -1
  136. package/dist/lib/color-formats/hex-string-format.spec.d.ts +0 -2
  137. package/dist/lib/color-formats/hex-string-format.spec.d.ts.map +0 -1
  138. package/dist/lib/color-formats/index.d.ts.map +0 -1
  139. package/dist/lib/color-formats/number-format.d.ts +0 -9
  140. package/dist/lib/color-formats/number-format.d.ts.map +0 -1
  141. package/dist/lib/color-formats/number-format.spec.d.ts +0 -2
  142. package/dist/lib/color-formats/number-format.spec.d.ts.map +0 -1
  143. package/dist/lib/color-formats/object-format.d.ts.map +0 -1
  144. package/dist/lib/color-formats/object-format.spec.d.ts +0 -2
  145. package/dist/lib/color-formats/object-format.spec.d.ts.map +0 -1
  146. package/dist/lib/color-formats/types.d.ts.map +0 -1
  147. package/dist/lib/components/button.d.ts +0 -29
  148. package/dist/lib/components/button.d.ts.map +0 -1
  149. package/dist/lib/components/content.d.ts +0 -22
  150. package/dist/lib/components/content.d.ts.map +0 -1
  151. package/dist/lib/components/controls/checkbox.d.ts +0 -29
  152. package/dist/lib/components/controls/checkbox.d.ts.map +0 -1
  153. package/dist/lib/components/controls/number.d.ts +0 -48
  154. package/dist/lib/components/controls/number.d.ts.map +0 -1
  155. package/dist/lib/components/controls/position.d.ts +0 -56
  156. package/dist/lib/components/controls/position.d.ts.map +0 -1
  157. package/dist/lib/components/controls/text.d.ts +0 -36
  158. package/dist/lib/components/controls/text.d.ts.map +0 -1
  159. package/dist/lib/components/groups/accordion.d.ts +0 -22
  160. package/dist/lib/components/groups/accordion.d.ts.map +0 -1
  161. package/dist/lib/components/groups/container.d.ts +0 -25
  162. package/dist/lib/components/groups/container.d.ts.map +0 -1
  163. package/dist/lib/components/groups/group.d.ts +0 -49
  164. package/dist/lib/components/groups/group.d.ts.map +0 -1
  165. package/dist/lib/components/groups/index.d.ts +0 -5
  166. package/dist/lib/components/groups/index.d.ts.map +0 -1
  167. package/dist/lib/components/groups/tabs.d.ts +0 -22
  168. package/dist/lib/components/groups/tabs.d.ts.map +0 -1
  169. package/dist/lib/components/image.d.ts +0 -37
  170. package/dist/lib/components/image.d.ts.map +0 -1
  171. package/dist/lib/core/registry.d.ts +0 -18
  172. package/dist/lib/core/registry.d.ts.map +0 -1
  173. package/dist/lib/core/value-accessor.d.ts +0 -18
  174. package/dist/lib/core/value-accessor.d.ts.map +0 -1
  175. package/dist/scss/_style.scss +0 -120
  176. package/dist/scss/_themes.scss +0 -23
  177. package/dist/scss/_utils.scss +0 -24
  178. package/dist/scss/_variables.scss +0 -30
  179. package/dist/scss/controls/_angle.scss +0 -64
  180. package/dist/scss/controls/_button.scss +0 -0
  181. package/dist/scss/controls/_checkbox.scss +0 -19
  182. package/dist/scss/controls/_color-picker.scss +0 -124
  183. package/dist/scss/controls/_color.scss +0 -14
  184. package/dist/scss/controls/_container.scss +0 -13
  185. package/dist/scss/controls/_group.scss +0 -69
  186. package/dist/scss/controls/_image.scss +0 -27
  187. package/dist/scss/controls/_number.scss +0 -38
  188. package/dist/scss/controls/_point.scss +0 -36
  189. package/dist/scss/controls/_position.scss +0 -9
  190. package/dist/scss/controls/_select.scss +0 -0
  191. package/dist/scss/controls/_spherical.scss +0 -87
  192. package/dist/scss/controls/_tabs.scss +0 -38
  193. package/dist/scss/controls/_text.scss +0 -0
  194. package/dist/scss/index.scss +0 -21
  195. package/dist/tweak-ui.css +0 -653
  196. package/dist/tweak-ui.css.map +0 -1
  197. package/dist/tweak-ui.min.css +0 -1
  198. package/dist/tweak-ui.min.css.map +0 -1
  199. package/dist/tweak-ui.umd.min.js +0 -17
  200. package/dist/tweak-ui.umd.min.js.map +0 -1
@@ -1,10 +1,8 @@
1
- import type { ComponentModel } from './types';
2
- import { default as m } from 'mithril';
3
- /**
4
- * Renders a registered component using the model
5
- *
6
- * @public
7
- * @param model - The model
8
- */
9
- export declare function renderModel<T extends ComponentModel>(model: T): m.Vnode<import("./types").ComponentAttrs<any>, m.ClassComponent<import("./types").ComponentAttrs<any>>>;
1
+ import { default as m, ChildArrayOrPrimitive, Children, FactoryComponent, Vnode } from 'mithril';
2
+ import { ComponentChildren } from './types';
3
+ export declare function isVnode(child: Children): child is Vnode;
4
+ export declare function mapChildren(nodes: ChildArrayOrPrimitive | undefined, fn: (child: Vnode, index: number, all: Children[]) => Children): m.Children;
5
+ export declare function renderChildren(children: ComponentChildren): Children;
6
+ export type LabeledFn<T> = ((opts: T) => Vnode<T> | null) & ((label: string, opts: Omit<T, 'label'>) => Vnode<T> | null);
7
+ export declare function labeledFn<T>(component: FactoryComponent<T>): LabeledFn<T>;
10
8
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/lib/core/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,SAAS,CAAA;AAEtC;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,2GAS7D"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/lib/core/render.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,EAAE,EAAE,qBAAqB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAuB,MAAM,SAAS,CAAA;AAEhE,wBAAgB,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,IAAI,KAAK,CAEvD;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,qBAAqB,GAAG,SAAS,EACxC,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,QAAQ,cAc/D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,QAAQ,CAiBpE;AAOD,MAAM,MAAM,SAAS,CAAC,CAAC,IACnB,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAC9B,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;AAEhE,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAazE"}
@@ -1,88 +1,74 @@
1
- import type { FactoryComponent, ClassComponent } from 'mithril';
2
- /**
3
- * @public
4
- */
5
- export declare type ComponentType<T = any> = FactoryComponent<T> | ClassComponent<T>;
6
- /**
7
- * Base model for a component with children
8
- *
9
- * @public
10
- */
11
- export interface ComponentGroupModel<T extends ComponentModel = ComponentModel> extends ComponentModel {
12
- /**
13
- * Collection of child components
14
- */
15
- children?: T[];
16
- }
17
- /**
18
- * Base model for a component
19
- *
20
- * @public
21
- */
22
- export interface ComponentModel {
23
- /**
24
- * The type name of the component
25
- */
26
- type: string;
27
- /**
28
- * If true, the component will not be rendered
29
- *
30
- * @remarks
31
- * This is a convenience property that allows to hide a component
32
- * without removing it from the component data model.
33
- */
34
- hidden?: boolean | (() => boolean);
35
- /**
36
- * The label for this component when rendered as a control
37
- *
38
- * @remarks
39
- * This is only evaluated when rendered as a child of a panel component
40
- */
41
- label?: string;
42
- }
43
- /**
44
- * Common component attributes
45
- *
46
- * @public
47
- */
48
- export declare type ComponentAttrs<T extends ComponentModel> = {
49
- data: T;
50
- };
51
- export declare type KeyMatchingType<T, V> = {
52
- [K in keyof T]: T[K] extends V ? K : never;
53
- }[keyof T];
54
- /**
55
- * Utility to convert a value type
56
- *
57
- * @public
58
- */
59
- export declare type ValueCodec<Encoded, Decoded> = {
60
- decode: (value: Encoded) => Decoded;
61
- encode: (value: Decoded) => Encoded;
62
- };
63
- export declare type ValueSource<T, V, I = unknown> = {
64
- /**
65
- * The object which is holding a control value
66
- *
67
- * @remarks
68
- * Requires the `property` option to be set.
69
- */
70
- target?: T;
71
- /**
72
- * The property name in `target` where the control value is stored
73
- *
74
- * @remarks
75
- * Requires the `target` option to be set.
76
- */
77
- property?: keyof T;
78
- /**
79
- * If `target` and `property` are not set, then this is used as the control value
80
- */
81
- value?: V | I;
82
- codec?: ValueCodec<I, V>;
83
- };
84
- /**
85
- * @public
86
- */
87
- export declare type ArrayOrSingleOf<T> = T | T[];
1
+ import { Children, ClassComponent, FactoryComponent } from 'mithril';
2
+ export type EventAttrs = Partial<GlobalEventHandlers>;
3
+ export type StyleAttr = Partial<CSSStyleDeclaration> & {
4
+ [key: string]: any;
5
+ };
6
+ /**
7
+ * A UI component, which can be either a Mithril factory component or a Mithril class component.
8
+ *
9
+ * @public
10
+ */
11
+ export type Component<Attr extends Object> = FactoryComponent<Attr> | ClassComponent<Attr>;
12
+ /**
13
+ * A descriptor for a component, which includes the component itself, its attributes, and optionally its children.
14
+ *
15
+ * @internal
16
+ */
17
+ export type ComponentDescriptor<Attr extends Object> = {
18
+ component: Component<Attr> | string;
19
+ attributes: Attr;
20
+ children?: ComponentChildren;
21
+ };
22
+ /**
23
+ *
24
+ */
25
+ export type ComponentChildren = ComponentSchema | Children | (() => Children);
26
+ /**
27
+ * A schema for a set of components, which is an array of component descriptors.
28
+ *
29
+ * @internal
30
+ */
31
+ export type ComponentSchema = Array<ComponentDescriptor<any>>;
32
+ export declare function binding<T>(target: T, field: keyof T): ValueBinding<T, T[keyof T]>;
33
+ /**
34
+ * A get/set pair that encapsulates access to a value without exposing the source object.
35
+ *
36
+ * @public
37
+ */
38
+ export type ValueBinding<M, T> = {
39
+ get: (model: M, field?: keyof M) => T;
40
+ set?: (value: T, model: M, field?: keyof M) => void;
41
+ };
42
+ export type TweakableAttrs<T, Value = unknown> = {
43
+ /**
44
+ * The target object being tweaked.
45
+ */
46
+ value: T;
47
+ /**
48
+ * The property on `value` to read from and write to
49
+ */
50
+ field?: keyof T;
51
+ /**
52
+ * The custom binding controller
53
+ */
54
+ binding?: ValueBinding<T, Value>;
55
+ /**
56
+ * An optional adapter to convert between the raw value and the control value.
57
+ */
58
+ adapter?: ControlAdapter<any, Value>;
59
+ };
60
+ /**
61
+ * Converts between the raw stored value and the value the control operates on.
62
+ * Use when the control's internal representation differs from the source data format
63
+ * e.g. radians stored, degrees displayed; or a packed integer unpacked into a vector.
64
+ *
65
+ * @public
66
+ */
67
+ export type ControlAdapter<RawValue, ControlValue> = {
68
+ toControl: (value: RawValue) => ControlValue;
69
+ fromControl: (value: ControlValue) => RawValue;
70
+ };
71
+ export type OmitIn<A, Keys extends keyof A> = {
72
+ [P in keyof A as P extends Keys ? never : P]: A[P];
73
+ };
88
74
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE/D;;GAEG;AACH,oBAAY,aAAa,CAAC,CAAC,GAAG,GAAG,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;AAE5E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CAC5E,SAAQ,cAAc;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAA;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,oBAAY,cAAc,CAAC,CAAC,SAAS,cAAc,IAAI;IACrD,IAAI,EAAE,CAAC,CAAA;CACR,CAAA;AAED,oBAAY,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAA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AW,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,QAAQ,CAAA;CAC/C,CAAA;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,CAAC,IAAI;KAC3C,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACnD,CAAA"}
@@ -1,94 +1,79 @@
1
- import type { ArrayOrSingleOf, ComponentAttrs, ComponentModel } from './types';
2
- import type { Children, Vnode } from 'mithril';
3
- /**
4
- * Checks if value is a string
5
- * @internal
6
- */
7
- export declare function isString(v: any): v is string;
8
- /**
9
- * Checks if value is a number
10
- * @internal
11
- */
12
- export declare function isNumber(v: any): v is number;
13
- /**
14
- * Checks if value is a function
15
- * @internal
16
- */
17
- export declare function isFunction(v: any): v is (...args: any[]) => any;
18
- /**
19
- * Checks if value is an array
20
- * @internal
21
- */
22
- export declare function isArray(v: any): v is any[];
23
- /**
24
- * Checks if value is an object
25
- * @internal
26
- */
27
- export declare function isObject(v: any): v is object;
28
- /**
29
- * Calls a function if it is not null
30
- * @internal
31
- */
32
- export declare function call<T extends (...args: any) => any>(cb: T, ...args: Parameters<T>): any;
33
- /**
34
- * Resolves a property to its value
35
- * @param value - the function or value to resolve
36
- */
37
- export declare function resolve<T>(value: (() => T) | T): T;
38
- /**
39
- * Calls the callback of object is not null
40
- * @internal
41
- */
42
- export declare function use<T, R>(obj: T | null, cb: (it: T) => R): R | null;
43
- /**
44
- * Clamps a number value
45
- * @internal
46
- */
47
- export declare function clamp(v: number, min: number, max: number): number;
48
- /**
49
- * Builds a css class from various argument types
50
- * @param exp
51
- */
52
- export declare function cssClass(exp: ArrayOrSingleOf<string | {
53
- [k: string]: boolean | (() => boolean);
54
- }>): string;
55
- /**
56
- * Pads a string
57
- * @internal
58
- */
59
- export declare function padLeft(value: string, length: number, char: string): string;
60
- /**
61
- * @internal
62
- */
63
- export declare function twuiClass(name: string, variation?: string): string;
64
- /**
65
- * Gets current mouse coordinates from mouse or touch event
66
- * @internal
67
- */
68
- export declare function getTouchPoint(e: MouseEvent | TouchEvent): [number, number];
69
- export declare function getTouchInTarget(e: MouseEvent, target?: HTMLElement, offset?: [number, number]): {
70
- width: number;
71
- height: number;
72
- x: number;
73
- y: number;
74
- normalizedX: number;
75
- normalizedY: number;
76
- };
77
- /**
78
- * @internal
79
- */
80
- export declare function viewFn<T extends ComponentModel>(fn: (data: T, node: Vnode<ComponentAttrs<T>>) => Children): (node: Vnode<ComponentAttrs<T>>) => Children;
81
- export declare function dataFn<T extends ComponentModel, R>(node: Vnode<ComponentAttrs<T>>, fn: (data: T, node: Vnode<ComponentAttrs<T>>) => R): () => R;
82
- export declare function dragUtil({ onStart, onMove, onEnd, }: {
83
- onStart?: (e: MouseEvent) => void;
84
- onMove?: (e: MouseEvent) => void;
85
- onEnd?: (e: MouseEvent) => void;
86
- }): {
87
- target: HTMLElement;
88
- activate: (e: MouseEvent) => void;
89
- deactivate: () => void;
90
- onStart: (e: MouseEvent) => void;
91
- onMove: (e: MouseEvent) => void;
92
- onEnd: (e: MouseEvent) => void;
93
- };
1
+ /**
2
+ * Checks if value is a string
3
+ * @internal
4
+ */
5
+ export declare function isString(v: any): v is string;
6
+ /**
7
+ * Checks if value is a number
8
+ * @internal
9
+ */
10
+ export declare function isNumber(v: any): v is number;
11
+ /**
12
+ * Checks if value is a function
13
+ * @internal
14
+ */
15
+ export declare function isFunction(v: any): v is (...args: any[]) => any;
16
+ /**
17
+ * Checks if value is an array
18
+ * @internal
19
+ */
20
+ export declare function isArray(v: any): v is any[];
21
+ /**
22
+ * Checks if value is an object
23
+ * @internal
24
+ */
25
+ export declare function isObject(v: any): v is object;
26
+ /**
27
+ * Calls a function if it is not null
28
+ * @internal
29
+ */
30
+ export declare function call<T extends (...args: any) => any>(cb: T | null | undefined, ...args: Parameters<T>): any;
31
+ /**
32
+ * Clamps a number value
33
+ * @internal
34
+ */
35
+ export declare function clamp(v: number, min: number, max: number): number;
36
+ export type ClassValue = string | null | undefined | false | ClassDictionary | ClassArray | (() => ClassValue);
37
+ export interface ClassDictionary {
38
+ [key: string]: boolean | (() => boolean);
39
+ }
40
+ export interface ClassArray extends Array<ClassValue> {
41
+ }
42
+ export declare function uiStyle(style: Partial<CSSStyleDeclaration> | undefined): Partial<CSSStyleDeclaration>;
43
+ /**
44
+ * Builds a css class from various argument types
45
+ * @param exp
46
+ */
47
+ export declare function uiClass(...args: ClassValue[]): string;
48
+ /**
49
+ * Pads a string
50
+ * @internal
51
+ */
52
+ export declare function padLeft(value: string, length: number, char: string): string;
53
+ /**
54
+ * Gets current mouse coordinates from mouse or touch event
55
+ * @internal
56
+ */
57
+ export declare function getTouchPoint(e: MouseEvent | TouchEvent): [number, number];
58
+ export declare function getTouchInTarget(e: MouseEvent | TouchEvent, target?: HTMLElement | null, offset?: [number, number]): {
59
+ width: number;
60
+ height: number;
61
+ x: number;
62
+ y: number;
63
+ normalizedX: number;
64
+ normalizedY: number;
65
+ };
66
+ export declare function dragUtil({ onStart, onMove, onEnd, }: {
67
+ onStart?: (e: MouseEvent | TouchEvent) => void;
68
+ onMove?: (e: MouseEvent | TouchEvent) => void;
69
+ onEnd?: (e: MouseEvent | TouchEvent) => void;
70
+ }): {
71
+ target: HTMLElement | null;
72
+ activate: (e: MouseEvent) => void;
73
+ deactivate: () => void;
74
+ onStart: ((e: MouseEvent | TouchEvent) => void) | undefined;
75
+ onMove: ((e: MouseEvent | TouchEvent) => void) | undefined;
76
+ onEnd: ((e: MouseEvent | TouchEvent) => void) | undefined;
77
+ };
78
+ export declare function eventWithTimout(el: Element, event: string, timeout: number): Promise<boolean>;
94
79
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/core/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MA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AAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiB7F"}
@@ -1,28 +1,22 @@
1
- /**
2
- * Tweak UI is a lightweight js library for building input controls with data binding
3
- *
4
- * @remarks
5
- * The library provides a set of common ui components built with mithriljs. The main objective
6
- * is to allow a developer to rapidly scaffold input interfaces for manipulating javascript objects
7
- * at runtime.
8
- *
9
- * Similar projects are:
10
- * {@link https://github.com/dataarts/dat.gui | dat.GUI}
11
- * {@link https://github.com/automat/controlkit.js | controlkit}
12
- * {@link https://github.com/colejd/guify | guify}
13
- *
14
- * @packageDocumentation
15
- */
16
- import './components';
17
- export * from './builder';
18
- export * from './color-formats';
19
- export * from './components';
20
- export * from './core';
21
- export * from './mount';
22
- /**
23
- * The version string
24
- *
25
- * @public
26
- */
27
- export declare const VERSION: string;
1
+ /**
2
+ * Tweak UI is a lightweight js library for building input controls with data binding
3
+ *
4
+ * @remarks
5
+ * The library provides a set of common ui components built with mithriljs. The main objective
6
+ * is to allow a developer to rapidly scaffold input interfaces for manipulating javascript objects
7
+ * at runtime.
8
+ *
9
+ * Similar projects are:
10
+ * {@link https://github.com/dataarts/dat.gui | dat.GUI}
11
+ * {@link https://github.com/automat/controlkit.js | controlkit}
12
+ * {@link https://github.com/colejd/guify | guify}
13
+ * {@link https://tweakpane.github.io/docs/ | tweakpane}
14
+ *
15
+ * @packageDocumentation
16
+ */
17
+ export * from './builder';
18
+ export * from './color';
19
+ export * from './components';
20
+ export * from './core';
21
+ export * from './mount';
28
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,cAAc,CAAA;AAErB,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AAIvB;;;;GAIG;AACH,eAAO,MAAM,OAAO,QAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA"}
@@ -1,46 +1,36 @@
1
- import type { ComponentModel } from './core/types';
2
- import { default as m } from 'mithril';
3
- import { BuilderFn } from './builder';
4
- /**
5
- * Mithril's hyperscript function.
6
- *
7
- * @public
8
- * @remarks
9
- * Useful to create custom components
10
- */
11
- export declare const h: m.Static;
12
- /**
13
- * Runs the function through a builder system and returns the created controls
14
- *
15
- * @param fn - The builder function
16
- * @returns
17
- */
18
- export declare function build(fn: BuilderFn): ComponentModel[];
19
- /**
20
- * Mounts a ui to the given element
21
- *
22
- * @public
23
- * @param el - The ui host element
24
- * @param data - The ui definition object
25
- */
26
- export declare function mount<T extends ComponentModel>(el: Element | string, data: T | Array<T> | BuilderFn): void;
27
- /**
28
- * Unmounts the ui from given host element
29
- *
30
- * @public
31
- * @param el - The ui host element
32
- */
33
- export declare function unmount(el: Element | string): void;
34
- /**
35
- * Redraws the ui
36
- *
37
- * @public
38
- * @remarks
39
- * When changing the ui description object qui callbacks (e.g. `onInput` or `onChange`)
40
- * the ui will redraw automatically.
41
- *
42
- * However if the ui description object is changed from outside the qui callback
43
- * then this method must be called in order to update the visual state.
44
- */
45
- export declare function redraw(): void;
1
+ import { default as m, ChildArray, Component } from 'mithril';
2
+ import { BuilderFn } from './builder';
3
+ /**
4
+ * Mithril's hyperscript function.
5
+ *
6
+ * @public
7
+ * @remarks
8
+ * Useful to create custom components
9
+ */
10
+ export declare const h: m.Static;
11
+ /**
12
+ * Mounts a ui to the given element
13
+ */
14
+ export declare function mountUi(target: Element | string, data: ChildArray): void;
15
+ export declare function mountUi(target: Element | string, data: BuilderFn): void;
16
+ export declare function mountUi<A, S>(target: Element | string, data: Component<A, S>): void;
17
+ /**
18
+ * Unmounts the ui from given host element
19
+ *
20
+ * @public
21
+ * @param el - The ui host element
22
+ */
23
+ export declare function unmountUi(target: Element | string): void;
24
+ /**
25
+ * Redraws the ui
26
+ *
27
+ * @public
28
+ * @remarks
29
+ * When changing the ui description object qui callbacks (e.g. `onInput` or `onChange`)
30
+ * the ui will redraw automatically.
31
+ *
32
+ * However if the ui description object is changed from outside the qui callback
33
+ * then this method must be called in order to update the visual state.
34
+ */
35
+ export declare function redrawUi(): void;
46
36
  //# sourceMappingURL=mount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/lib/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAW,SAAS,EAAE,MAAM,WAAW,CAAA;AAK9C;;;;;;GAMG;AACH,eAAO,MAAM,CAAC,UAAI,CAAA;AAElB;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,SAAS,oBAIlC;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,QA4BnG;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,QAG3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,SAErB"}
1
+ {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/lib/mount.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAW,SAAS,EAAE,MAAM,WAAW,CAAA;AAG9C;;;;;;GAMG;AACH,eAAO,MAAM,CAAC,UAAI,CAAA;AAElB;;GAEG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;AACzE,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;AACxE,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAA;AAkBpF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,QAGjD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,SAEvB"}
@@ -0,0 +1,2 @@
1
+ export * from './stats-renderer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/stats/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,66 @@
1
+ export type StatTransform = 'linear' | 'log' | 'exp';
2
+ export type SamplerConfig = {
3
+ /**
4
+ * Display name of the stat
5
+ */
6
+ name?: string;
7
+ /**
8
+ * Display color of the stat
9
+ */
10
+ color?: string;
11
+ /**
12
+ * Formatting for the current value
13
+ */
14
+ fractionDigits?: number;
15
+ /**
16
+ * Function that returns the current value of the stat
17
+ */
18
+ sample: () => number;
19
+ /**
20
+ * Smoothing factor for EMA calculation.
21
+ *
22
+ * @remarks
23
+ * 0 is no smoothing, 0.9 is heavy smoothing. Don't set to 1 or it will never update! Default is 0 (no smoothing).
24
+ */
25
+ smoothing?: number;
26
+ /**
27
+ * Expected minimum value for display. Used for normalization and auto-ranging. Default is 0.
28
+ */
29
+ min?: number;
30
+ /**
31
+ * Expected maximum value for display. Used for normalization and auto-ranging. Default is 1.
32
+ */
33
+ max?: number;
34
+ transform?: StatTransform;
35
+ noGraph?: boolean;
36
+ };
37
+ export interface Sampler {
38
+ color?: string;
39
+ noGraph?: boolean;
40
+ fractionDigits?: number;
41
+ smoothing: number;
42
+ transform: (v: number) => number;
43
+ min: number;
44
+ max: number;
45
+ sample: () => number;
46
+ value: number | null;
47
+ normalized: number;
48
+ buffer: Float32Array;
49
+ head: number;
50
+ count: number;
51
+ index: number;
52
+ sum: number;
53
+ avg: number;
54
+ minDeque: Float32Array;
55
+ maxDeque: Float32Array;
56
+ minIdx: Uint32Array;
57
+ maxIdx: Uint32Array;
58
+ minHead: number;
59
+ minTail: number;
60
+ maxHead: number;
61
+ maxTail: number;
62
+ minSeen: number;
63
+ maxSeen: number;
64
+ }
65
+ export declare function sampler(config: SamplerConfig, size: number): Sampler;
66
+ //# sourceMappingURL=sampler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampler.d.ts","sourceRoot":"","sources":["../../../src/lib/stats/sampler.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAA;AAEpD,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;OAEG;IACH,MAAM,EAAE,MAAM,MAAM,CAAA;IAEpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,SAAS,CAAC,EAAE,aAAa,CAAA;IAEzB,OAAO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