@vuu-ui/vuu-utils 4.0.0-alpha.9 → 4.0.0-beta.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 (133) hide show
  1. package/package.json +10 -9
  2. package/src/array-utils.js +5 -4
  3. package/src/column-utils.js +33 -20
  4. package/src/component-registry.js +3 -2
  5. package/src/data-utils.js +1 -0
  6. package/src/datasource/BaseDataSource.js +5 -3
  7. package/src/date/EpochTimestamp.js +85 -0
  8. package/src/date/date-utils.js +50 -18
  9. package/src/date/dateTimePattern.js +33 -5
  10. package/src/date/formatter.js +54 -16
  11. package/src/date/index.js +5 -2
  12. package/src/date/temporal.js +131 -0
  13. package/src/date/time-zone.js +56 -0
  14. package/src/event-emitter.js +1 -3
  15. package/src/feature-utils.js +14 -8
  16. package/src/filters/filter-utils.js +13 -7
  17. package/src/filters/filterAsQuery.js +107 -45
  18. package/src/filters/index.js +1 -0
  19. package/src/filters/temporal-cell-filter.js +63 -0
  20. package/src/form-utils.js +44 -6
  21. package/src/formatting-utils.js +46 -25
  22. package/src/html-utils.js +35 -1
  23. package/src/index.js +0 -1
  24. package/src/keyset.js +15 -9
  25. package/src/react-utils.js +8 -2
  26. package/src/table-schema-utils.js +6 -5
  27. package/src/useResizeObserver.js +3 -3
  28. package/src/vendor/@preact/signals-core/dist/signals-core.js +1 -1
  29. package/src/vendor/@preact/signals-core/dist/signals-core.js.map +1 -1
  30. package/types/ThemeProvider.d.ts +1 -1
  31. package/types/array-utils.d.ts +3 -2
  32. package/types/column-utils.d.ts +45 -43
  33. package/types/context-definitions/DataProvider.d.ts +1 -1
  34. package/types/context-definitions/DataSourceProvider.d.ts +1 -1
  35. package/types/datasource/BaseDataSource.d.ts +2 -2
  36. package/types/date/EpochTimestamp.d.ts +66 -0
  37. package/types/date/date-utils.d.ts +34 -9
  38. package/types/date/dateTimePattern.d.ts +20 -2
  39. package/types/date/formatter.d.ts +26 -1
  40. package/types/date/index.d.ts +6 -2
  41. package/types/date/temporal.d.ts +68 -0
  42. package/types/date/time-zone.d.ts +52 -0
  43. package/types/feature-utils.d.ts +34 -30
  44. package/types/filters/filter-utils.d.ts +6 -1
  45. package/types/filters/filterAsQuery.d.ts +41 -0
  46. package/types/filters/index.d.ts +1 -0
  47. package/types/filters/temporal-cell-filter.d.ts +27 -0
  48. package/types/form-utils.d.ts +19 -0
  49. package/types/formatting-utils.d.ts +23 -1
  50. package/types/html-utils.d.ts +16 -0
  51. package/types/index.d.ts +0 -1
  52. package/types/keyset.d.ts +11 -1
  53. package/types/react-utils.d.ts +1 -1
  54. package/types/sort-utils.d.ts +2 -2
  55. package/types/table-schema-utils.d.ts +2 -2
  56. package/types/tree-types.d.ts +2 -0
  57. package/types/src/Clock.d.ts +0 -20
  58. package/types/src/PageVisibilityObserver.d.ts +0 -36
  59. package/types/src/ScaledDecimal.d.ts +0 -12
  60. package/types/src/ShellContext.d.ts +0 -11
  61. package/types/src/ThemeProvider.d.ts +0 -32
  62. package/types/src/array-utils.d.ts +0 -16
  63. package/types/src/box-utils.d.ts +0 -24
  64. package/types/src/broadcast-channel.d.ts +0 -16
  65. package/types/src/column-utils.d.ts +0 -243
  66. package/types/src/common-types.d.ts +0 -6
  67. package/types/src/component-registry.d.ts +0 -65
  68. package/types/src/context-definitions/DataContext.d.ts +0 -21
  69. package/types/src/context-definitions/DataProvider.d.ts +0 -7
  70. package/types/src/context-definitions/DataSourceProvider.d.ts +0 -12
  71. package/types/src/context-definitions/WorkspaceContext.d.ts +0 -17
  72. package/types/src/cookie-utils.d.ts +0 -9
  73. package/types/src/css-utils.d.ts +0 -1
  74. package/types/src/data-utils.d.ts +0 -33
  75. package/types/src/datasource/BaseDataSource.d.ts +0 -63
  76. package/types/src/datasource/datasource-action-utils.d.ts +0 -7
  77. package/types/src/datasource/datasource-filter-utils.d.ts +0 -2
  78. package/types/src/datasource/datasource-utils.d.ts +0 -61
  79. package/types/src/date/date-utils.d.ts +0 -39
  80. package/types/src/date/dateTimePattern.d.ts +0 -8
  81. package/types/src/date/formatter.d.ts +0 -9
  82. package/types/src/date/index.d.ts +0 -4
  83. package/types/src/date/types.d.ts +0 -29
  84. package/types/src/debug-utils.d.ts +0 -9
  85. package/types/src/edit-utils.d.ts +0 -2
  86. package/types/src/errors.d.ts +0 -2
  87. package/types/src/event-emitter.d.ts +0 -21
  88. package/types/src/feature-utils.d.ts +0 -110
  89. package/types/src/filters/filter-utils.d.ts +0 -75
  90. package/types/src/filters/filterAsQuery.d.ts +0 -8
  91. package/types/src/filters/index.d.ts +0 -2
  92. package/types/src/form-utils.d.ts +0 -37
  93. package/types/src/formatting-utils.d.ts +0 -14
  94. package/types/src/getUniqueId.d.ts +0 -1
  95. package/types/src/group-utils.d.ts +0 -10
  96. package/types/src/html-utils.d.ts +0 -21
  97. package/types/src/index.d.ts +0 -76
  98. package/types/src/input-utils.d.ts +0 -2
  99. package/types/src/invariant.d.ts +0 -1
  100. package/types/src/itemToString.d.ts +0 -2
  101. package/types/src/json-types.d.ts +0 -52
  102. package/types/src/json-utils.d.ts +0 -6
  103. package/types/src/keyboard-utils.d.ts +0 -15
  104. package/types/src/keyset.d.ts +0 -16
  105. package/types/src/layout-types.d.ts +0 -22
  106. package/types/src/list-utils.d.ts +0 -2
  107. package/types/src/local-storage-utils.d.ts +0 -4
  108. package/types/src/logging-utils.d.ts +0 -45
  109. package/types/src/module-utils.d.ts +0 -8
  110. package/types/src/nanoid/index.d.ts +0 -1
  111. package/types/src/perf-utils.d.ts +0 -5
  112. package/types/src/promise-utils.d.ts +0 -8
  113. package/types/src/protocol-message-utils.d.ts +0 -43
  114. package/types/src/range-utils.d.ts +0 -29
  115. package/types/src/react-utils.d.ts +0 -15
  116. package/types/src/round-decimal.d.ts +0 -4
  117. package/types/src/row-utils.d.ts +0 -28
  118. package/types/src/selection-utils.d.ts +0 -9
  119. package/types/src/shell-layout-types.d.ts +0 -15
  120. package/types/src/sort-utils.d.ts +0 -11
  121. package/types/src/table-schema-utils.d.ts +0 -5
  122. package/types/src/text-utils.d.ts +0 -10
  123. package/types/src/theme-utils.d.ts +0 -14
  124. package/types/src/tree-types.d.ts +0 -9
  125. package/types/src/tree-utils.d.ts +0 -9
  126. package/types/src/ts-utils.d.ts +0 -20
  127. package/types/src/typeahead-utils.d.ts +0 -1
  128. package/types/src/url-utils.d.ts +0 -3
  129. package/types/src/useId.d.ts +0 -1
  130. package/types/src/useLayoutEffectSkipFirst.d.ts +0 -2
  131. package/types/src/useResizeObserver.d.ts +0 -15
  132. package/types/src/useStateRef.d.ts +0 -2
  133. package/types/src/user-types.d.ts +0 -3
@@ -1,8 +1,49 @@
1
+ import type { TableSchema } from "@vuu-ui/vuu-data-types";
2
+ import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
1
3
  import type { ColumnDescriptorsByName, Filter, SingleValueFilterClause } from "@vuu-ui/vuu-filter-types";
4
+ import { type TemporalInfo } from "../date/temporal";
5
+ import { type RelativeDate } from "../date/time-zone";
2
6
  export declare const filterAsQuery: (f: Filter, opts?: {
3
7
  columnsByName?: ColumnDescriptorsByName;
4
8
  }) => string;
5
9
  export declare const ONE_DAY_IN_MILLIS: number;
10
+ export interface TemporalFilterAsQueryOptions {
11
+ /**
12
+ * The date against which time of day (TimeString) values are resolved.
13
+ * Default is 'today', resolved at the time the query is created.
14
+ */
15
+ date?: RelativeDate;
16
+ }
17
+ /**
18
+ * Serialize a filter clause on a temporal column. Values are interpreted at
19
+ * the granularity implied by the value and the column 'kind':
20
+ * - day: column kind is 'date', or a 'datetime' value at the exact start of a
21
+ * day (in the column time zone), e.g as selected from a DatePicker. The clause
22
+ * applies to the whole day: '=' becomes a [startOfDay, startOfNextDay) range,
23
+ * '>' becomes '>= startOfNextDay' etc. Day boundaries are DST safe.
24
+ * - period: time of day values (TimeString or whole second 'time' values). A
25
+ * TimeString represents the period implied by its precision, e.g hh:mm:ss is
26
+ * the whole second, hh:mm:ss.fff the whole millisecond (on a nanosecond
27
+ * column), and is treated like the day granularity above.
28
+ * - exact: all other values
29
+ * Values are encoded according to the column encoding (millis or nanos).
30
+ */
31
+ export declare function temporalFilterAsQuery(f: SingleValueFilterClause, temporalInfo: TemporalInfo, options?: TemporalFilterAsQueryOptions): string;
32
+ /**
33
+ * @deprecated use temporalFilterAsQuery
34
+ */
6
35
  export declare function dateFilterAsQuery(f: SingleValueFilterClause<number>, opts?: {
7
36
  columnsByName?: ColumnDescriptorsByName;
8
37
  }): string;
38
+ export declare const getColumnsByName: (columns: readonly ColumnDescriptor[]) => ColumnDescriptorsByName;
39
+ /**
40
+ * Build the columnsByName used to serialize a filter. Column descriptors
41
+ * provided by client take precedence over (are merged with) the schema columns.
42
+ */
43
+ export declare const getColumnsByNameForFilter: (tableSchema?: Pick<TableSchema, "columns">, columnsByName?: ColumnDescriptorsByName) => ColumnDescriptorsByName | undefined;
44
+ /**
45
+ * Returns true if the filter includes clauses whose meaning depends on the
46
+ * column type (temporal columns) or which serialize themselves. Such filters
47
+ * must be resolved (see resolveFilterQuery) before they can be evaluated locally.
48
+ */
49
+ export declare const filterRequiresResolution: (filter: Filter, columnsByName?: ColumnDescriptorsByName) => boolean;
@@ -1,2 +1,3 @@
1
1
  export * from "./filter-utils";
2
2
  export * from "./filterAsQuery";
3
+ export * from "./temporal-cell-filter";
@@ -0,0 +1,27 @@
1
+ import type { DataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
+ export interface TemporalCellFilter {
3
+ /** The value, formatted as displayed */
4
+ label: string;
5
+ op: "=" | "between-inclusive";
6
+ value: string | [string, string];
7
+ }
8
+ /**
9
+ * Describes a filter that matches a temporal value at the precision with which
10
+ * it is displayed by the given column descriptor, e.g. where the descriptor
11
+ * displays milliseconds, the filter matches the whole millisecond.
12
+ * - date => the whole day, as a start of day value
13
+ * - time => a time of day (TimeString), truncated to the displayed precision
14
+ * - datetime => a range, unless the displayed precision is that of the encoding
15
+ * The filter is suitable for FilterAggregator.add (with the same descriptor) and
16
+ * matches the value a ColumnFilter with this descriptor would commit.
17
+ *
18
+ * @param column the descriptor of the filter (or table cell) displaying the value
19
+ * @param value a value as received from the server
20
+ * @param columnFilter the value is displayed by a ColumnFilter, rather than a
21
+ * table cell. A ColumnFilter displays a 'datetime' value as a date (DatePicker,
22
+ * so the filter is the whole day) and a 'time' value to the second, or to the
23
+ * millisecond with the 'hh:mm:ss.ms' pattern (TimeInput supports no finer
24
+ * precision, whereas a table cell displays nanos by default).
25
+ * @returns undefined if value is empty or column is not temporal
26
+ */
27
+ export declare const getTemporalCellFilter: (column: DataValueDescriptor, value: unknown, columnFilter?: boolean) => TemporalCellFilter | undefined;
@@ -1,7 +1,11 @@
1
1
  import { DataValueTypeSimple } from "@vuu-ui/vuu-data-types";
2
2
  import { VuuColumnDataType, VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
3
3
  import { KeyboardEvent, SyntheticEvent } from "react";
4
+ import { EpochTimestamp } from "./date/EpochTimestamp";
5
+ import { type TemporalInfo } from "./date/temporal";
6
+ import type { DataValueDescriptor } from "@vuu-ui/vuu-data-types";
4
7
  import { ExtendedFilterOptions } from "@vuu-ui/vuu-filter-types";
8
+ import { type ScaledDecimal } from "./ScaledDecimal";
5
9
  export declare class DataValidationError extends Error {
6
10
  actualType: string;
7
11
  expectedType: string;
@@ -35,3 +39,18 @@ export declare function getTypedRange([value1, value2]: [string, string], dataTy
35
39
  */
36
40
  export declare function getTypedValue(value: string, type: VuuColumnDataType | DataValueTypeSimple, throwIfInvalid?: false, options?: ExtendedFilterOptions): VuuRowDataItemType | undefined;
37
41
  export declare function getTypedValue(value: string, type: VuuColumnDataType | DataValueTypeSimple, throwIfInvalid: true, options?: ExtendedFilterOptions): VuuRowDataItemType;
42
+ /**
43
+ * Convert a string value (from user input or a filter control) to the wire
44
+ * representation of a temporal value, using the column's TemporalInfo.
45
+ * - time kind: a TimeString is applied to today's date (in the column time zone)
46
+ * - any kind: canonical input (see parseTemporalInput) or raw epoch digits
47
+ * Values are returned in the column encoding (number for epochMillis, string
48
+ * for epochNanos).
49
+ */
50
+ export declare function getTypedTemporalValue(value: string, temporalInfo: TemporalInfo, throwIfInvalid?: boolean, baseValue?: EpochTimestamp): number | string | undefined;
51
+ /**
52
+ * Like getTypedValue, but takes a column (or form field) descriptor. Temporal
53
+ * values are handled according to getTemporalInfo, other values according to
54
+ * the type name, if there is one, otherwise the serverDataType.
55
+ */
56
+ export declare function getTypedValueForDescriptor(value: string, descriptor: DataValueDescriptor, throwIfInvalid?: boolean): VuuRowDataItemType | ScaledDecimal | bigint | undefined;
@@ -1,8 +1,30 @@
1
- import { ColumnDescriptor, ValueFormatter } from "@vuu-ui/vuu-table-types";
1
+ import { DataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
+ import { ColumnDescriptor, FractionalSecondDigits, ValueFormatter } from "@vuu-ui/vuu-table-types";
2
3
  export type ValueFormatters = {
3
4
  [key: string]: ValueFormatter;
4
5
  };
5
6
  export declare const defaultValueFormatter: (value: unknown) => string;
7
+ /**
8
+ * The number of fractional second digits displayed for a temporal value:
9
+ * type.formatting.fractionalSecondDigits if set, otherwise 3 for an
10
+ * 'hh:mm:ss.ms' time pattern, 9 for a nanosecond column with any other time
11
+ * pattern, else 0.
12
+ */
13
+ export declare const getFractionalSecondDigits: (column: DataValueDescriptor, temporalInfo?: import("./date").TemporalInfo | undefined) => FractionalSecondDigits;
14
+ /**
15
+ * Creates a formatter for a temporal value (see getTemporalInfo). Handles
16
+ * millisecond and nanosecond encodings, the configured (or default) pattern,
17
+ * time zone, locale and fractional second digits.
18
+ * Empty values (null, undefined, '', 0) are rendered as empty string.
19
+ */
20
+ export declare const temporalFormatter: (column: DataValueDescriptor, temporalInfo?: import("./date").TemporalInfo | undefined) => ValueFormatter;
21
+ /**
22
+ * Format a filter value on a temporal column for display (e.g. in a FilterPill
23
+ * tooltip or a list of filter clauses). Time of day (TimeString) values are
24
+ * displayed as is. A 'datetime' value at the start of a day (which the filter
25
+ * applies to the whole day, see temporalFilterAsQuery) is displayed as a date.
26
+ */
27
+ export declare const formatTemporalFilterValue: (value: unknown, column: DataValueDescriptor) => string;
6
28
  export declare const numericFormatter: ({ align, serverDataType, type, }: Partial<ColumnDescriptor>) => typeof defaultValueFormatter;
7
29
  export declare const getValueFormatter: (column: ColumnDescriptor) => ValueFormatter;
8
30
  /**
@@ -13,6 +13,22 @@ export declare const isInputElement: (el: HTMLElement | EventTarget | null) => e
13
13
  export declare const isDateInput: (el: HTMLElement | EventTarget | null) => el is HTMLInputElement;
14
14
  export declare const hasOpenOptionList: (el: HTMLElement | EventTarget | null) => boolean | undefined;
15
15
  export declare function getScrollbarSize(): number;
16
+ /**
17
+ * Used when the max scroll height cannot be measured, e.g. outside a browser.
18
+ */
19
+ export declare const DEFAULT_MAX_SCROLL_HEIGHT = 33000000;
20
+ /**
21
+ * Measure the largest scrollHeight (in CSS pixels) the browser supports for a
22
+ * scrollable element. Engines have an internal layout limit, which shrinks in
23
+ * CSS pixels as browser zoom increases, e.g.
24
+ * Chromium/WebKit: ~33.5M at 100%, ~11.18M at 300%
25
+ * Firefox: ~17.9M at 100%, ~5.97M at 300%
26
+ * Chromium/WebKit clamp heights above the limit, Firefox ignores them entirely,
27
+ * so a single oversized probe cannot be used. Instead we binary search for the
28
+ * largest height that is honoured. Browser zoom changes devicePixelRatio, so
29
+ * results are cached per ratio.
30
+ */
31
+ export declare function getMaxScrollHeight(doc?: Document | undefined): number;
16
32
  export type MouseEventTypes = "dblclick" | "click";
17
33
  export type KeyboardEventTypes = "keydown" | "keypress" | "keyup";
18
34
  export declare const dispatchMouseEvent: (el: HTMLElement, type: MouseEventTypes) => void;
package/types/index.d.ts CHANGED
@@ -21,7 +21,6 @@ export * from "./debug-utils";
21
21
  export { isInlineEditingSession } from "./edit-utils";
22
22
  export { StaleUpdateError } from "./errors";
23
23
  export * from "./event-emitter";
24
- export * from "./errors";
25
24
  export * from "./feature-utils";
26
25
  export * from "./filters";
27
26
  export * from "./form-utils";
package/types/keyset.d.ts CHANGED
@@ -5,12 +5,22 @@ export interface IKeySet {
5
5
  }
6
6
  export declare class KeySet implements IKeySet {
7
7
  private keys;
8
+ private freeKeys;
8
9
  private nextKeyValue;
9
10
  private range;
10
11
  constructor(range: VuuRange);
11
12
  next(free?: number[]): number;
12
13
  private init;
13
- reset(range: VuuRange): boolean;
14
+ /**
15
+ * Keys assigned to rows that remain within range are never changed, keys
16
+ * released by rows leaving the range are recycled for rows entering the
17
+ * range. Keys are never re-sequenced, clients may retain rows (and their
18
+ * keys) that remain within range, so re-assigning keys to those rows would
19
+ * risk duplicate keys on the client.
20
+ * Note: range is copied, callers may mutate the range object they pass.
21
+ * Returns false, keys are never resequenced.
22
+ */
23
+ reset({ from, to }: VuuRange): boolean;
14
24
  keyFor(rowIndex: number): number;
15
25
  toDebugString(): string;
16
26
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement, type ReactNode, type SetStateAction } from "react";
1
+ import { ReactElement, ReactNode, SetStateAction } from "react";
2
2
  export declare const asReactElements: (children: ReactNode) => ReactElement[];
3
3
  export declare const useIsMounted: (id?: string) => import("react").RefObject<boolean>;
4
4
  export declare const isSimpleStateValue: <T>(arg: SetStateAction<T>) => arg is T;
@@ -1,5 +1,5 @@
1
- import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
- import type { VuuSort, VuuSortType } from "@vuu-ui/vuu-protocol-types";
1
+ import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
+ import { VuuSort, VuuSortType } from "@vuu-ui/vuu-protocol-types";
3
3
  export declare const toggleOrApplySort: ({ sortDefs }: VuuSort, { name: column }: ColumnDescriptor, extendSort?: boolean, sortType?: VuuSortType) => VuuSort;
4
4
  export declare const setSortColumn: ({ sortDefs }: VuuSort, column: ColumnDescriptor, sortType?: "A" | "D") => VuuSort;
5
5
  export declare const addSortColumn: ({ sortDefs }: VuuSort, column: ColumnDescriptor, sortType?: "A" | "D") => VuuSort;
@@ -1,5 +1,5 @@
1
+ import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
1
2
  import type { SchemaColumn, TableSchemaTable } from "@vuu-ui/vuu-data-types";
2
3
  import type { VuuTable } from "@vuu-ui/vuu-protocol-types";
3
- import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
4
+ export declare const toSchemaColumn: ({ editable, name, required, serverDataType, }: ColumnDescriptor) => SchemaColumn;
4
5
  export declare const getVuuTable: (schemaTable: TableSchemaTable) => VuuTable;
5
- export declare const toSchemaColumn: ({ editable, name, serverDataType }: ColumnDescriptor) => SchemaColumn;
@@ -5,5 +5,7 @@ export interface TreeSourceNode<T = unknown> {
5
5
  header?: boolean;
6
6
  label: string;
7
7
  childNodes?: TreeSourceNode<T>[];
8
+ /** node is rendered expanded initially */
9
+ expanded?: boolean;
8
10
  tags?: string[];
9
11
  }
@@ -1,20 +0,0 @@
1
- export interface ClockProps {
2
- year?: number;
3
- month?: number;
4
- day?: number;
5
- hours?: number;
6
- minutes?: number;
7
- seconds?: number;
8
- milliseconds?: number;
9
- }
10
- export type ClockTimeUnit = "minutes" | "seconds" | "ms";
11
- export declare class Clock {
12
- #private;
13
- constructor(props?: ClockProps);
14
- goBack(value: number, units?: ClockTimeUnit): this;
15
- advance(value: number, units?: ClockTimeUnit): this;
16
- set showCurrentTime(value: boolean);
17
- toString(): string;
18
- get now(): number;
19
- get date(): Date;
20
- }
@@ -1,36 +0,0 @@
1
- import { EventEmitter } from "./event-emitter";
2
- export type PageVisibilityEvents = {
3
- /**
4
- * emits when page has been hidden for this period of time
5
- */
6
- "inactive-timeout": () => void;
7
- /**
8
- * emits when page is hidden
9
- */
10
- hidden: () => void;
11
- /**
12
- * emits when page is made visible
13
- */
14
- visible: () => void;
15
- /**
16
- * emits when page visibility status changes
17
- */
18
- visibilityChange: (hidden: boolean) => void;
19
- };
20
- export interface PageVisibilityObserverConstructorProps {
21
- /**
22
- * timeout period in seconds. Defaults to zero which will never timeout
23
- */
24
- inactiveTimeout?: number;
25
- onHidden?: () => void;
26
- onInactiveTimeout?: () => void;
27
- onVisible?: () => void;
28
- onVisibilityChange?: () => void;
29
- }
30
- export declare class PageVisibilityObserver extends EventEmitter<PageVisibilityEvents> {
31
- #private;
32
- visibilityChangeHandler: () => void;
33
- constructor({ inactiveTimeout, onHidden, onInactiveTimeout, onVisibilityChange, onVisible, }?: PageVisibilityObserverConstructorProps);
34
- clear(): void;
35
- private set hidden(value);
36
- }
@@ -1,12 +0,0 @@
1
- export declare class ScaledDecimal {
2
- protected readonly value: string;
3
- private readonly decimals;
4
- constructor(value: string, decimals?: number);
5
- get asLong(): string;
6
- toJSON(): string;
7
- toString(): string;
8
- }
9
- export declare const ScaledDecimal2: (value: string) => ScaledDecimal;
10
- export declare const ScaledDecimal4: (value: string) => ScaledDecimal;
11
- export declare const ScaledDecimal6: (value: string) => ScaledDecimal;
12
- export declare const ScaledDecimal8: (value: string) => ScaledDecimal;
@@ -1,11 +0,0 @@
1
- import type { RpcResponseHandler } from "@vuu-ui/vuu-data-types";
2
- import type { DefaultColumnConfiguration, DefaultTableConfiguration } from "@vuu-ui/vuu-table-types";
3
- import { LookupTableProvider } from "./feature-utils";
4
- export interface ShellContextProps {
5
- getDefaultColumnConfig?: DefaultColumnConfiguration;
6
- getDefaultTableConfig?: DefaultTableConfiguration;
7
- getLookupValues?: LookupTableProvider;
8
- handleRpcResponse?: RpcResponseHandler;
9
- }
10
- export declare const ShellContext: import("react").Context<ShellContextProps>;
11
- export declare const useShellContext: () => ShellContextProps;
@@ -1,32 +0,0 @@
1
- import { type ReactNode } from "react";
2
- export declare const DEFAULT_DENSITY: Density;
3
- export declare const DEFAULT_THEME = "salt-theme";
4
- export declare const DEFAULT_THEME_MODE: ThemeMode;
5
- export type Density = "high" | "medium" | "low" | "touch";
6
- export type ThemeMode = "light" | "dark";
7
- export type TargetElement = "root" | "scope" | "child";
8
- export interface ThemeContextProps {
9
- density: Density;
10
- theme: string;
11
- themeMode: ThemeMode;
12
- }
13
- export declare const ThemeContext: import("react").Context<ThemeContextProps>;
14
- export type ThemeClasses = [string, string, ThemeMode];
15
- export type ThemeAttributes = {
16
- themeClass: string;
17
- densityClass: string;
18
- dataMode: ThemeMode;
19
- };
20
- export declare const useThemeAttributes: (themeAttributes?: ThemeAttributes) => [string, string, ThemeMode];
21
- interface ThemeProviderProps {
22
- applyThemeClasses?: boolean;
23
- children: ReactNode;
24
- density?: Density;
25
- theme?: string;
26
- themeMode?: ThemeMode;
27
- }
28
- export declare function ThemeProvider({ applyThemeClasses, children, theme: themeProp, themeMode: themeModeProp, density: densityProp, }: ThemeProviderProps): import("react").JSX.Element;
29
- export declare namespace ThemeProvider {
30
- var displayName: string;
31
- }
32
- export {};
@@ -1,16 +0,0 @@
1
- export type PartitionTest<T> = (value: T, index: number) => boolean;
2
- export declare function partition<T>(array: T[], test: PartitionTest<T>, pass?: T[], fail?: T[]): [T[], T[]];
3
- export declare function itemsChanged<T = unknown>(currentItems: T[], newItems: T[], identityProperty?: string): boolean;
4
- export declare function itemsOrOrderChanged<T = unknown>(currentItems: T[], newItems: T[], identityProperty?: string): boolean;
5
- export declare const moveItemDeprecated: <T = unknown>(items: T[], item: T, moveTo: number) => T[];
6
- export declare const moveItem: <T = unknown>(items: T[], fromIndex: number, toIndex: number) => T[];
7
- export declare const getAddedItems: <T>(values: undefined | T[], newValues: T[]) => T[];
8
- export declare const getMissingItems: <T, I>(sourceItems: T[], items: I[], identity: (s: T) => I) => I[];
9
- /**
10
- * Given an ordered list of item names, return items in same order
11
- */
12
- export declare const reorderItems: <T extends {
13
- name: string;
14
- } = {
15
- name: string;
16
- }>(originalItems: readonly T[], orderedNames: string[]) => T[];
@@ -1,24 +0,0 @@
1
- export interface rect {
2
- bottom: number;
3
- left: number;
4
- right: number;
5
- top: number;
6
- }
7
- export type rectTuple = [number, number, number, number];
8
- export type dimension = "width" | "height";
9
- export declare function boxContainsPoint(rect: rect, x: number, y: number): boolean | undefined;
10
- export type GridLayoutSplitDirection = "north" | "south" | "east" | "west";
11
- export type GridLayoutDropPosition = GridLayoutSplitDirection | "header" | "centre";
12
- export declare function getCenteredBox({ right, left, top, bottom }: rect, pctSize: number): {
13
- left: number;
14
- top: number;
15
- right: number;
16
- bottom: number;
17
- };
18
- export declare function pointPositionWithinRect(x: number, y: number, rect: rect, borderZone?: number): {
19
- pctX: number;
20
- pctY: number;
21
- closeToTheEdge: number;
22
- };
23
- export declare const isGridLayoutSplitDirection: (position: GridLayoutDropPosition) => position is GridLayoutSplitDirection;
24
- export declare function getPositionWithinBox(x: number, y: number, rect: rect, pctX: number, pctY: number): GridLayoutDropPosition;
@@ -1,16 +0,0 @@
1
- interface VuuBroadcastChannelEventMap<T> {
2
- message: MessageEvent<T>;
3
- messageerror: MessageEvent<T>;
4
- }
5
- export interface VuuBroadcastChannel<T> extends EventTarget {
6
- readonly name: string;
7
- onmessage: ((this: BroadcastChannel, evt: MessageEvent<T>) => void) | null;
8
- onmessageerror: ((this: BroadcastChannel, evt: MessageEvent<T>) => void) | null;
9
- close(): void;
10
- postMessage<M extends T = T>(message: M): void;
11
- addEventListener<K extends keyof VuuBroadcastChannelEventMap<T>>(type: K, listener: (this: BroadcastChannel, evt: VuuBroadcastChannelEventMap<T>[K]) => void, options?: boolean | AddEventListenerOptions): void;
12
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
13
- removeEventListener<K extends keyof VuuBroadcastChannelEventMap<T>>(type: K, listener: (this: BroadcastChannel, evt: VuuBroadcastChannelEventMap<T>[K]) => void, options?: boolean | EventListenerOptions): void;
14
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
15
- }
16
- export {};