@xh/hoist 83.1.0 → 84.0.1

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 (250) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/admin/tabs/cluster/instances/logs/levels/LogLevelDialogModel.ts +106 -10
  3. package/admin/tabs/cluster/metrics/MetricsModel.ts +3 -3
  4. package/appcontainer/AppContainerModel.ts +1 -1
  5. package/appcontainer/README.md +20 -0
  6. package/assets.d.ts +34 -0
  7. package/build/types/cmp/ag-grid/AgGrid.d.ts +8 -19
  8. package/build/types/cmp/ag-grid/AgGridModel.d.ts +18 -5
  9. package/build/types/cmp/card/Card.d.ts +9 -4
  10. package/build/types/cmp/card/CardModel.d.ts +15 -2
  11. package/build/types/cmp/chart/Chart.d.ts +2 -2
  12. package/build/types/cmp/chart/ChartModel.d.ts +11 -1
  13. package/build/types/cmp/dataview/DataView.d.ts +4 -2
  14. package/build/types/cmp/dataview/DataViewModel.d.ts +16 -4
  15. package/build/types/cmp/filter/FilterChooserModel.d.ts +7 -1
  16. package/build/types/cmp/form/Form.d.ts +2 -1
  17. package/build/types/cmp/form/FormModel.d.ts +12 -0
  18. package/build/types/cmp/form/field/BaseFieldModel.d.ts +7 -0
  19. package/build/types/cmp/form/formfieldset/FormFieldSetModel.d.ts +7 -1
  20. package/build/types/cmp/grid/GridModel.d.ts +16 -1
  21. package/build/types/cmp/grid/GridSorter.d.ts +14 -0
  22. package/build/types/cmp/grid/Types.d.ts +18 -0
  23. package/build/types/cmp/grid/columns/Column.d.ts +40 -2
  24. package/build/types/cmp/grid/columns/ColumnGroup.d.ts +10 -0
  25. package/build/types/cmp/grouping/GroupingChooserModel.d.ts +9 -2
  26. package/build/types/cmp/layout/Box.d.ts +19 -7
  27. package/build/types/cmp/layout/Frame.d.ts +17 -5
  28. package/build/types/cmp/loadingindicator/LoadingIndicator.d.ts +6 -4
  29. package/build/types/cmp/pinpad/PinPadModel.d.ts +6 -1
  30. package/build/types/cmp/spinner/Spinner.d.ts +31 -10
  31. package/build/types/cmp/tab/TabContainerModel.d.ts +11 -0
  32. package/build/types/cmp/tab/TabModel.d.ts +7 -0
  33. package/build/types/cmp/tab/Types.d.ts +4 -0
  34. package/build/types/cmp/treemap/TreeMapModel.d.ts +3 -3
  35. package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +9 -0
  36. package/build/types/cmp/zoneGrid/ZoneGridModel.d.ts +22 -3
  37. package/build/types/cmp/zoneGrid/impl/ZoneMapperModel.d.ts +6 -0
  38. package/build/types/core/HoistComponent.d.ts +29 -8
  39. package/build/types/core/HoistProps.d.ts +9 -3
  40. package/build/types/core/load/LoadSpec.d.ts +1 -1
  41. package/build/types/core/persist/provider/ViewManagerProvider.d.ts +7 -0
  42. package/build/types/data/Store.d.ts +35 -1
  43. package/build/types/data/StoreSelectionModel.d.ts +18 -2
  44. package/build/types/data/cube/Cube.d.ts +26 -6
  45. package/build/types/data/cube/Query.d.ts +10 -0
  46. package/build/types/data/cube/View.d.ts +21 -2
  47. package/build/types/data/cube/aggregate/Aggregator.d.ts +13 -0
  48. package/build/types/data/cube/aggregate/AverageAggregator.d.ts +1 -0
  49. package/build/types/data/cube/aggregate/AverageStrictAggregator.d.ts +1 -0
  50. package/build/types/data/cube/aggregate/ChildCountAggregator.d.ts +1 -0
  51. package/build/types/data/cube/aggregate/LeafCountAggregator.d.ts +1 -0
  52. package/build/types/data/cube/aggregate/MaxAggregator.d.ts +1 -0
  53. package/build/types/data/cube/aggregate/MinAggregator.d.ts +1 -0
  54. package/build/types/data/cube/aggregate/NullAggregator.d.ts +1 -0
  55. package/build/types/data/cube/aggregate/SingleAggregator.d.ts +1 -0
  56. package/build/types/data/cube/aggregate/SumAggregator.d.ts +1 -0
  57. package/build/types/data/cube/aggregate/SumStrictAggregator.d.ts +1 -0
  58. package/build/types/data/cube/aggregate/UniqueAggregator.d.ts +1 -0
  59. package/build/types/data/filter/BaseFilterFieldSpec.d.ts +9 -0
  60. package/build/types/data/filter/Types.d.ts +12 -0
  61. package/build/types/desktop/cmp/button/AppMenuButton.d.ts +5 -0
  62. package/build/types/desktop/cmp/button/Button.d.ts +5 -1
  63. package/build/types/desktop/cmp/dash/canvas/DashCanvasModel.d.ts +12 -3
  64. package/build/types/desktop/cmp/dash/container/DashContainerModel.d.ts +9 -0
  65. package/build/types/desktop/cmp/dock/DockViewModel.d.ts +7 -0
  66. package/build/types/desktop/cmp/filechooser/FileChooserModel.d.ts +8 -0
  67. package/build/types/desktop/cmp/grid/editors/BooleanEditor.d.ts +1 -0
  68. package/build/types/desktop/cmp/grid/editors/DateEditor.d.ts +1 -0
  69. package/build/types/desktop/cmp/grid/editors/NumberEditor.d.ts +1 -0
  70. package/build/types/desktop/cmp/grid/editors/SelectEditor.d.ts +1 -0
  71. package/build/types/desktop/cmp/grid/editors/TextAreaEditor.d.ts +1 -0
  72. package/build/types/desktop/cmp/grid/editors/TextEditor.d.ts +1 -0
  73. package/build/types/desktop/cmp/input/Picker.d.ts +1 -1
  74. package/build/types/desktop/cmp/input/SegmentedControl.d.ts +16 -2
  75. package/build/types/desktop/cmp/leftrightchooser/LeftRightChooserModel.d.ts +7 -0
  76. package/build/types/desktop/cmp/modalsupport/ModalSupportModel.d.ts +28 -2
  77. package/build/types/desktop/cmp/panel/Panel.d.ts +5 -2
  78. package/build/types/desktop/cmp/panel/PanelModel.d.ts +12 -2
  79. package/build/types/desktop/cmp/rest/RestGrid.d.ts +10 -0
  80. package/build/types/desktop/cmp/rest/RestGridModel.d.ts +9 -1
  81. package/build/types/desktop/cmp/toolbar/Toolbar.d.ts +4 -1
  82. package/build/types/format/FormatDate.d.ts +4 -4
  83. package/build/types/icon/Icon.d.ts +3 -0
  84. package/build/types/kit/blueprint/Wrappers.d.ts +12 -1
  85. package/build/types/mobile/cmp/navigator/NavigatorModel.d.ts +8 -0
  86. package/build/types/mobile/cmp/navigator/PageModel.d.ts +7 -0
  87. package/build/types/mobile/cmp/panel/DialogPanel.d.ts +0 -2
  88. package/build/types/security/BaseOAuthClient.d.ts +9 -0
  89. package/build/types/security/authzero/AuthZeroClient.d.ts +6 -0
  90. package/build/types/security/msal/MsalClient.d.ts +6 -0
  91. package/build/types/svc/FetchService.d.ts +10 -7
  92. package/build/types/svc/TraceService.d.ts +17 -2
  93. package/build/types/utils/async/Timer.d.ts +6 -0
  94. package/build/types/utils/js/LangUtils.d.ts +1 -1
  95. package/build/types/utils/js/TestUtils.d.ts +1 -1
  96. package/build/types/utils/react/index.d.ts +0 -1
  97. package/build/types/utils/telemetry/Span.d.ts +12 -2
  98. package/cmp/ag-grid/AgGrid.ts +8 -19
  99. package/cmp/ag-grid/AgGridModel.ts +18 -5
  100. package/cmp/card/Card.ts +9 -4
  101. package/cmp/card/CardModel.ts +15 -2
  102. package/cmp/chart/Chart.ts +2 -2
  103. package/cmp/chart/ChartModel.ts +11 -1
  104. package/cmp/dataview/DataView.ts +4 -2
  105. package/cmp/dataview/DataViewModel.ts +16 -4
  106. package/cmp/filter/FilterChooserModel.ts +7 -1
  107. package/cmp/form/Form.ts +2 -1
  108. package/cmp/form/FormModel.ts +12 -0
  109. package/cmp/form/README.md +13 -0
  110. package/cmp/form/field/BaseFieldModel.ts +7 -0
  111. package/cmp/form/formfieldset/FormFieldSetModel.ts +7 -1
  112. package/cmp/grid/Grid.scss +14 -8
  113. package/cmp/grid/GridModel.ts +16 -1
  114. package/cmp/grid/GridSorter.ts +14 -0
  115. package/cmp/grid/README.md +12 -0
  116. package/cmp/grid/Types.ts +18 -0
  117. package/cmp/grid/columns/Column.ts +40 -2
  118. package/cmp/grid/columns/ColumnGroup.ts +10 -0
  119. package/cmp/grouping/GroupingChooserModel.ts +9 -2
  120. package/cmp/layout/Box.ts +19 -7
  121. package/cmp/layout/Frame.ts +17 -5
  122. package/cmp/layout/README.md +16 -21
  123. package/cmp/loadingindicator/LoadingIndicator.scss +1 -1
  124. package/cmp/loadingindicator/LoadingIndicator.ts +11 -9
  125. package/cmp/pinpad/PinPadModel.ts +6 -1
  126. package/cmp/spinner/Spinner.scss +13 -0
  127. package/cmp/spinner/Spinner.ts +58 -20
  128. package/cmp/tab/TabContainerModel.ts +11 -0
  129. package/cmp/tab/TabModel.ts +7 -0
  130. package/cmp/tab/Types.ts +4 -0
  131. package/cmp/treemap/TreeMapModel.ts +3 -3
  132. package/cmp/viewmanager/ViewManagerModel.ts +9 -0
  133. package/cmp/zoneGrid/ZoneGridModel.ts +22 -3
  134. package/cmp/zoneGrid/impl/ZoneMapperModel.ts +6 -0
  135. package/core/ExceptionHandler.ts +1 -1
  136. package/core/HoistComponent.ts +36 -11
  137. package/core/HoistProps.ts +9 -3
  138. package/core/README.md +68 -6
  139. package/core/impl/InstanceManager.ts +1 -0
  140. package/core/load/LoadSpec.ts +1 -1
  141. package/core/persist/provider/ViewManagerProvider.ts +7 -0
  142. package/data/README.md +48 -124
  143. package/data/Store.ts +35 -1
  144. package/data/StoreSelectionModel.ts +18 -2
  145. package/data/cube/Cube.ts +26 -6
  146. package/data/cube/Query.ts +10 -0
  147. package/data/cube/README.md +236 -0
  148. package/data/cube/View.ts +21 -2
  149. package/data/cube/aggregate/Aggregator.ts +13 -0
  150. package/data/cube/aggregate/AverageAggregator.ts +1 -0
  151. package/data/cube/aggregate/AverageStrictAggregator.ts +1 -0
  152. package/data/cube/aggregate/ChildCountAggregator.ts +1 -0
  153. package/data/cube/aggregate/LeafCountAggregator.ts +1 -0
  154. package/data/cube/aggregate/MaxAggregator.ts +1 -0
  155. package/data/cube/aggregate/MinAggregator.ts +1 -0
  156. package/data/cube/aggregate/NullAggregator.ts +1 -0
  157. package/data/cube/aggregate/SingleAggregator.ts +1 -0
  158. package/data/cube/aggregate/SumAggregator.ts +1 -0
  159. package/data/cube/aggregate/SumStrictAggregator.ts +1 -0
  160. package/data/cube/aggregate/UniqueAggregator.ts +1 -0
  161. package/data/filter/BaseFilterFieldSpec.ts +9 -0
  162. package/data/filter/Types.ts +12 -0
  163. package/desktop/README.md +131 -9
  164. package/desktop/appcontainer/AboutDialog.ts +2 -0
  165. package/desktop/appcontainer/Banner.ts +5 -2
  166. package/desktop/appcontainer/ChangelogDialog.ts +1 -0
  167. package/desktop/appcontainer/ExceptionDialog.ts +4 -0
  168. package/desktop/appcontainer/ExceptionDialogDetails.ts +4 -1
  169. package/desktop/appcontainer/FeedbackDialog.ts +4 -1
  170. package/desktop/appcontainer/ImpersonationBar.ts +4 -0
  171. package/desktop/appcontainer/LockoutPanel.ts +4 -1
  172. package/desktop/appcontainer/LoginPanel.ts +7 -3
  173. package/desktop/appcontainer/Message.ts +9 -3
  174. package/desktop/appcontainer/OptionsDialog.ts +3 -1
  175. package/desktop/appcontainer/VersionBar.ts +1 -0
  176. package/desktop/appcontainer/suspend/IdlePanel.ts +4 -4
  177. package/desktop/appcontainer/suspend/SuspendPanel.ts +3 -0
  178. package/desktop/cmp/button/AppMenuButton.ts +5 -0
  179. package/desktop/cmp/button/Button.ts +14 -4
  180. package/desktop/cmp/dash/README.md +14 -0
  181. package/desktop/cmp/dash/canvas/DashCanvasModel.ts +12 -3
  182. package/desktop/cmp/dash/container/DashContainerModel.ts +9 -0
  183. package/desktop/cmp/dock/DockViewModel.ts +7 -0
  184. package/desktop/cmp/filechooser/FileChooserModel.ts +9 -2
  185. package/desktop/cmp/grid/editors/BooleanEditor.ts +1 -0
  186. package/desktop/cmp/grid/editors/DateEditor.ts +1 -0
  187. package/desktop/cmp/grid/editors/NumberEditor.ts +1 -0
  188. package/desktop/cmp/grid/editors/SelectEditor.ts +1 -0
  189. package/desktop/cmp/grid/editors/TextAreaEditor.ts +1 -0
  190. package/desktop/cmp/grid/editors/TextEditor.ts +1 -0
  191. package/desktop/cmp/input/Picker.ts +2 -2
  192. package/desktop/cmp/input/SegmentedControl.ts +20 -2
  193. package/desktop/cmp/leftrightchooser/LeftRightChooserModel.ts +7 -0
  194. package/desktop/cmp/modalsupport/ModalSupportModel.ts +31 -2
  195. package/desktop/cmp/panel/Panel.ts +29 -21
  196. package/desktop/cmp/panel/PanelModel.ts +12 -2
  197. package/desktop/cmp/panel/README.md +20 -0
  198. package/desktop/cmp/rest/RestGrid.ts +10 -0
  199. package/desktop/cmp/rest/RestGridModel.ts +9 -1
  200. package/desktop/cmp/toolbar/Toolbar.ts +9 -2
  201. package/desktop/cmp/viewmanager/ViewManager.ts +1 -1
  202. package/docs/README.md +9 -4
  203. package/docs/coding-conventions.md +29 -21
  204. package/docs/doc-registry.json +31 -15
  205. package/docs/planning/docs-roadmap-log.md +11 -0
  206. package/docs/planning/docs-roadmap.md +1 -0
  207. package/docs/upgrade-notes/v84-upgrade-notes.md +136 -0
  208. package/docs/version-compatibility.md +2 -0
  209. package/format/FormatDate.ts +4 -4
  210. package/icon/Icon.ts +9 -0
  211. package/icon/README.md +62 -22
  212. package/icon/index.ts +24 -0
  213. package/kit/README.md +8 -2
  214. package/kit/blueprint/Wrappers.ts +12 -1
  215. package/mcp/README.md +47 -26
  216. package/mcp/cli/ts.ts +39 -4
  217. package/mcp/data/ts-registry.ts +57 -17
  218. package/mcp/tools/typescript.ts +32 -4
  219. package/mobile/appcontainer/AboutDialog.ts +3 -0
  220. package/mobile/appcontainer/Banner.ts +2 -0
  221. package/mobile/appcontainer/ExceptionDialog.ts +4 -0
  222. package/mobile/appcontainer/ExceptionDialogDetails.ts +1 -0
  223. package/mobile/appcontainer/FeedbackDialog.ts +4 -1
  224. package/mobile/appcontainer/ImpersonationBar.ts +2 -0
  225. package/mobile/appcontainer/LockoutPanel.ts +2 -0
  226. package/mobile/appcontainer/LoginPanel.ts +7 -3
  227. package/mobile/appcontainer/Message.ts +9 -3
  228. package/mobile/appcontainer/OptionsDialog.ts +5 -1
  229. package/mobile/appcontainer/VersionBar.ts +1 -0
  230. package/mobile/appcontainer/suspend/IdlePanel.ts +5 -6
  231. package/mobile/appcontainer/suspend/SuspendPanel.ts +3 -0
  232. package/mobile/cmp/navigator/NavigatorModel.ts +8 -0
  233. package/mobile/cmp/navigator/PageModel.ts +7 -0
  234. package/mobile/cmp/panel/DialogPanel.ts +0 -2
  235. package/package.json +11 -11
  236. package/security/BaseOAuthClient.ts +9 -0
  237. package/security/authzero/AuthZeroClient.ts +6 -0
  238. package/security/msal/MsalClient.ts +6 -0
  239. package/styles/vars.scss +14 -0
  240. package/svc/FetchService.ts +25 -15
  241. package/svc/README.md +39 -9
  242. package/svc/TraceService.ts +69 -11
  243. package/utils/README.md +0 -1
  244. package/utils/async/Timer.ts +6 -0
  245. package/utils/js/LangUtils.ts +1 -1
  246. package/utils/js/TestUtils.ts +1 -1
  247. package/utils/react/index.ts +0 -1
  248. package/utils/telemetry/Span.ts +21 -4
  249. package/build/types/utils/react/ClassName.d.ts +0 -14
  250. package/utils/react/ClassName.ts +0 -24
@@ -4,10 +4,10 @@
4
4
  *
5
5
  * Copyright © 2026 Extremely Heavy Industries Inc.
6
6
  */
7
- import {HoistService, XH} from '@xh/hoist/core';
7
+ import {HoistService, PlainObject, XH} from '@xh/hoist/core';
8
8
  import {SECONDS} from '@xh/hoist/utils/datetime';
9
9
  import {debounced, parseNameSource} from '@xh/hoist/utils/js';
10
- import {isEmpty, isString} from 'lodash';
10
+ import {every, isEmpty, isString} from 'lodash';
11
11
  import {Span, SpanConfig} from '@xh/hoist/utils/telemetry';
12
12
 
13
13
  /**
@@ -18,7 +18,7 @@ import {Span, SpanConfig} from '@xh/hoist/utils/telemetry';
18
18
  * end-to-end traces from user interaction through server processing and back.
19
19
  *
20
20
  * Controlled by the `xhTraceConfig` soft config. When disabled (the default), all
21
- * span-creation methods are no-ops the wrapped function still executes normally.
21
+ * span-creation methods are no-ops - the wrapped function still executes normally.
22
22
  *
23
23
  * Completed spans are batched and exported to the Hoist server endpoint `xh/submitSpans`,
24
24
  * which relays them to the configured collector.
@@ -111,7 +111,10 @@ export class TraceService extends HoistService {
111
111
  * Create a new span, or return null if tracing is disabled.
112
112
  * Inherits the parent's `source` tag if not specified.
113
113
  *
114
- * Note: sampling is handled server-side when spans are relayed to the collector.
114
+ * Sampling rules from `xhTraceConfig.sampleRules` are evaluated against the span's tags
115
+ * at creation time (head-based). Child spans inherit their parent's sampling decision.
116
+ * Unsampled spans may still be exported if they end in error and `alwaysSampleErrors` is
117
+ * enabled — see {@link exportSpan}.
115
118
  *
116
119
  * @param config - span name string, or a SpanConfig with name and optional tags.
117
120
  */
@@ -122,14 +125,17 @@ export class TraceService extends HoistService {
122
125
 
123
126
  // Apply default tags.
124
127
  ret.tags = {
125
- clientApp: XH.clientAppCode,
126
- loadId: XH.loadId,
127
- tabId: XH.tabId,
128
- source: ret.parent?.tags?.source ?? 'app',
128
+ 'xh.clientApp': XH.clientAppCode,
129
+ 'xh.loadId': XH.loadId,
130
+ 'xh.tabId': XH.tabId,
131
+ 'xh.source': ret.parent?.tags?.['xh.source'] ?? 'app',
129
132
  ...(ret.caller ? {'code.namespace': parseNameSource(ret.caller)} : {}),
130
133
  ...ret.tags
131
134
  };
132
135
 
136
+ // Sampling: children inherit parent decision; root spans evaluate rules.
137
+ ret.sampled = ret.parent ? ret.parent.sampled : this.shouldSample(ret.tags);
138
+
133
139
  return new Span(ret);
134
140
  }
135
141
 
@@ -138,8 +144,15 @@ export class TraceService extends HoistService {
138
144
  //------------------
139
145
  /** Submit a completed span for export. */
140
146
  exportSpan(span: Span) {
141
- this._pending.push(span);
142
- this.pushPendingBuffered();
147
+ if (span.sampled || (this.conf.alwaysSampleErrors && span.status === 'error')) {
148
+ this._pending.push(span);
149
+
150
+ // Queue the span, but if this is the submitSpans export itself, don't schedule
151
+ // another flush or we'll loop forever.
152
+ if (!span.tags['url.path']?.endsWith('xh/submitSpans')) {
153
+ this.pushPendingBuffered();
154
+ }
155
+ }
143
156
  }
144
157
 
145
158
  /**
@@ -169,10 +182,55 @@ export class TraceService extends HoistService {
169
182
  //------------------
170
183
  @debounced(5 * SECONDS)
171
184
  private pushPendingBuffered() {
172
- this.pushPendingAsync();
185
+ void this.pushPendingAsync();
186
+ }
187
+
188
+ /** Evaluate sampling rules against a span's tags. */
189
+ private shouldSample(tags: PlainObject): boolean {
190
+ try {
191
+ return Math.random() < this.getSampleRate(tags);
192
+ } catch (e) {
193
+ this.logError('Failed to compute sample rate', e);
194
+ return false;
195
+ }
196
+ }
197
+
198
+ private getSampleRate(tags: PlainObject): number {
199
+ const {conf} = this;
200
+ for (const rule of conf.sampleRules ?? []) {
201
+ if (every(rule.match, (v, k) => this.matchesValue(tags[k], v))) {
202
+ return rule.sampleRate;
203
+ }
204
+ }
205
+ return conf.sampleRate;
206
+ }
207
+
208
+ /** For strings, simple glob matching: `*` = any, `foo*` = prefix, `*foo` = suffix, `*foo*` = contains. */
209
+ private matchesValue(actual: any, pattern: any): boolean {
210
+ if (!isString(actual) || !isString(pattern)) {
211
+ return actual === pattern;
212
+ }
213
+
214
+ if (pattern === '*') return true;
215
+ const startsWithWild = pattern.startsWith('*'),
216
+ endsWithWild = pattern.endsWith('*'),
217
+ core = pattern.replace(/^\*|\*$/g, '');
218
+
219
+ if (startsWithWild && endsWithWild) return actual.includes(core);
220
+ if (startsWithWild) return actual.endsWith(core);
221
+ if (endsWithWild) return actual.startsWith(core);
222
+ return actual === pattern;
173
223
  }
174
224
  }
175
225
 
176
226
  interface TraceConfig {
177
227
  enabled: boolean;
228
+ sampleRules?: SamplingRule[];
229
+ sampleRate?: number;
230
+ alwaysSampleErrors?: boolean;
231
+ }
232
+
233
+ interface SamplingRule {
234
+ match: Record<string, string>;
235
+ sampleRate: number;
178
236
  }
package/utils/README.md CHANGED
@@ -472,7 +472,6 @@ for the full list of supported props and conversion details.
472
472
 
473
473
  | Function | Description |
474
474
  |----------|-------------|
475
- | `getClassName(baseName, props, ...extras)` | Combine a base CSS class with `props.className` and additional class names |
476
475
  | `createObservableRef()` | Create a ref that works as both a React ref object and callback ref, with a MobX-observable `current` property |
477
476
  | `elementFromContent(content, addProps?)` | Create a React element from a `Content` value (element, HoistComponent, or render function) |
478
477
 
@@ -172,6 +172,12 @@ export class Timer {
172
172
  }
173
173
  }
174
174
 
175
+ /**
176
+ * Configuration for a {@link Timer} - a managed interval that runs a function repeatedly
177
+ * with configurable delay, timeout, and app-config-driven intervals.
178
+ *
179
+ * @see Timer
180
+ */
175
181
  export interface TimerSpec {
176
182
  /**
177
183
  * Function to run.
@@ -282,7 +282,7 @@ export function mergeDeep(target: PlainObject, ...sources: PlainObject[]): Plain
282
282
  }
283
283
 
284
284
  /**
285
- * A string, or an object from which a name can be derived via `displayName` (e.g. React
285
+ * A string, or an object from which a name can be derived - via `displayName` (e.g. React
286
286
  * components) or `constructor.name` (e.g. class instances). Used for logging and tracing.
287
287
  */
288
288
  export type NameSource = string | {displayName: string} | {constructor: {name: string}};
@@ -9,7 +9,7 @@ import {isString} from 'lodash';
9
9
 
10
10
  /**
11
11
  * HTML attribute name used to tag elements with stable test identifiers. Use as a computed
12
- * property key on element specs e.g. `{[TEST_ID]: 'my-grid'}` to emit a `data-testid`
12
+ * property key on element specs - e.g. `{[TEST_ID]: 'my-grid'}` - to emit a `data-testid`
13
13
  * attribute that automated test drivers can locate reliably.
14
14
  */
15
15
  export const TEST_ID = 'data-testid';
@@ -4,7 +4,6 @@
4
4
  *
5
5
  * Copyright © 2026 Extremely Heavy Industries Inc.
6
6
  */
7
- export * from './ClassName';
8
7
  export * from './ReactUtils';
9
8
  export * from './LayoutPropUtils';
10
9
  export * from './ObservableRef';
@@ -29,7 +29,7 @@ export class Span {
29
29
  /** Epoch ms (Date.now()-based). */
30
30
  startTime: number;
31
31
 
32
- /** Epoch ms set when span ends. */
32
+ /** Epoch ms - set when span ends. */
33
33
  endTime: number;
34
34
 
35
35
  /** Duration in ms (endTime - startTime). */
@@ -42,6 +42,9 @@ export class Span {
42
42
  tags: PlainObject;
43
43
  events: SpanEvent[] = [];
44
44
 
45
+ /** Whether this span was selected by client-side sampling rules. */
46
+ sampled: boolean;
47
+
45
48
  constructor(config: SpanConfig) {
46
49
  const parent = config.parent;
47
50
  this.traceId = parent?.traceId ?? genTraceId();
@@ -51,6 +54,7 @@ export class Span {
51
54
  this.kind = config.kind ?? 'internal';
52
55
  this.startTime = config.startTime ?? Date.now();
53
56
  this.tags = {...config.tags};
57
+ this.sampled = config.sampled ?? true;
54
58
  }
55
59
 
56
60
  /** End this span, recording status and computing duration. */
@@ -83,11 +87,19 @@ export class Span {
83
87
  duration: this.duration,
84
88
  status: this.status,
85
89
  tags: this.tags,
86
- events: this.events
90
+ events: this.events,
91
+ sampled: this.sampled
87
92
  };
88
93
  }
89
94
  }
90
95
 
96
+ /**
97
+ * Configuration for a {@link Span} - a lightweight trace span for distributed tracing.
98
+ * Create via {@link TraceService} rather than directly.
99
+ *
100
+ * @see Span
101
+ * @see TraceService
102
+ */
91
103
  export interface SpanConfig {
92
104
  name: string;
93
105
  kind?: SpanKind;
@@ -95,6 +107,7 @@ export interface SpanConfig {
95
107
  parent?: Span;
96
108
  startTime?: number;
97
109
  caller?: NameSource;
110
+ sampled?: boolean;
98
111
  }
99
112
 
100
113
  export interface SpanEvent {
@@ -110,8 +123,12 @@ export type SpanStatus = 'ok' | 'error' | 'unset';
110
123
  * Format a W3C traceparent header value.
111
124
  * @see https://www.w3.org/TR/trace-context/#traceparent-header
112
125
  */
113
- export function formatTraceparent(traceId: string, spanId: string): string {
114
- return `00-${traceId}-${spanId}-01`;
126
+ export function formatTraceparent(
127
+ traceId: string,
128
+ spanId: string,
129
+ sampled: boolean = true
130
+ ): string {
131
+ return `00-${traceId}-${spanId}-${sampled ? '01' : '00'}`;
115
132
  }
116
133
 
117
134
  /** Generate a 32-hex-char (128-bit) trace ID. */
@@ -1,14 +0,0 @@
1
- /**
2
- * Generate a string with one or more CSS classes to apply to a component, typically concatenating a
3
- * standardized base className with any instance-specific getClassName(s) provided via props and any
4
- * optional / conditional class names determined at render-time.
5
- *
6
- * Components should call this to produce a combined class list and apply it to their outermost
7
- * (or otherwise most appropriate) rendered component.
8
- *
9
- * @param baseName - base class name for the component.
10
- * @param props - component props.
11
- * @param extraNames - optional, additional class names to append.
12
- * @returns concatenated, space-delimited class name appropriate for html className attribute.
13
- */
14
- export declare function getClassName(baseName: string, props: any, ...extraNames: string[]): string;
@@ -1,24 +0,0 @@
1
- /*
2
- * This file belongs to Hoist, an application development toolkit
3
- * developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
4
- *
5
- * Copyright © 2026 Extremely Heavy Industries Inc.
6
- */
7
- import classNames from 'classnames';
8
-
9
- /**
10
- * Generate a string with one or more CSS classes to apply to a component, typically concatenating a
11
- * standardized base className with any instance-specific getClassName(s) provided via props and any
12
- * optional / conditional class names determined at render-time.
13
- *
14
- * Components should call this to produce a combined class list and apply it to their outermost
15
- * (or otherwise most appropriate) rendered component.
16
- *
17
- * @param baseName - base class name for the component.
18
- * @param props - component props.
19
- * @param extraNames - optional, additional class names to append.
20
- * @returns concatenated, space-delimited class name appropriate for html className attribute.
21
- */
22
- export function getClassName(baseName: string, props: any, ...extraNames: string[]): string {
23
- return classNames(baseName, props.className, ...extraNames);
24
- }