@extable/core 0.3.1 → 0.3.3

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.
@@ -0,0 +1,18 @@
1
+ export type NumericParseResult = {
2
+ ok: true;
3
+ value: number;
4
+ } | {
5
+ ok: false;
6
+ reason: "empty" | "invalid" | "non-finite" | "not-integer" | "out-of-range";
7
+ };
8
+ export type NumericColumnType = "number" | "int" | "uint";
9
+ export declare function normalizeNumericInput(text: string): string;
10
+ export declare function parseNumericText(rawText: string): NumericParseResult;
11
+ export declare function coerceNumericForColumn(value: number, type: NumericColumnType): NumericParseResult;
12
+ export type IntegerBaseFormat = "binary" | "octal" | "hex";
13
+ export declare function formatIntegerWithPrefix(value: number, base: IntegerBaseFormat): string;
14
+ export declare function formatNumberForEdit(value: number, options?: {
15
+ format?: "decimal" | "scientific";
16
+ precision?: number;
17
+ scale?: number;
18
+ }): string;
@@ -64,6 +64,7 @@ export declare class SelectionManager {
64
64
  private activeCell;
65
65
  private activeHost;
66
66
  private activeHostOriginalText;
67
+ private activeOriginalValue;
67
68
  private composing;
68
69
  private lastCompositionEnd;
69
70
  private readonly handleInputCompositionStart;
@@ -118,6 +119,7 @@ export declare class SelectionManager {
118
119
  private handleSelectionCut;
119
120
  private handleSelectionPaste;
120
121
  private handleSelectionCompositionStart;
122
+ private handleSelectionBeforeInput;
121
123
  copySelection(): Promise<void>;
122
124
  pasteFromClipboard(): Promise<void>;
123
125
  private handleSelectionKeydown;
@@ -134,6 +136,9 @@ export declare class SelectionManager {
134
136
  private coerceCellValue;
135
137
  private applyClipboardGrid;
136
138
  private createEditor;
139
+ private getInitialEditValue;
140
+ private readActiveValueForCommit;
141
+ private tryCommitActiveEditor;
137
142
  private autosize;
138
143
  private positionFloatingContentBox;
139
144
  private handleClick;
package/dist/types.d.ts CHANGED
@@ -16,7 +16,7 @@ export type CellValue = CellPrimitive | Date | {
16
16
  kind: "tags";
17
17
  values: string[];
18
18
  } | ButtonValue | LinkValue;
19
- export type ColumnType = "string" | "number" | "boolean" | "datetime" | "date" | "time" | "enum" | "tags" | "button" | "link";
19
+ export type ColumnType = "string" | "number" | "int" | "uint" | "boolean" | "datetime" | "date" | "time" | "enum" | "tags" | "button" | "link";
20
20
  export type StringFormat = {
21
21
  maxLength?: number;
22
22
  regex?: string;
@@ -27,13 +27,30 @@ export type NumberFormat = {
27
27
  signed?: boolean;
28
28
  thousandSeparator?: boolean;
29
29
  negativeRed?: boolean;
30
+ /**
31
+ * Format token for number display.
32
+ * - "decimal": normal decimal formatting (default)
33
+ * - "scientific": scientific notation
34
+ * - other strings are reserved for future/custom formatters
35
+ */
36
+ format?: string;
37
+ };
38
+ export type IntegerFormat = {
39
+ thousandSeparator?: boolean;
40
+ negativeRed?: boolean;
41
+ /**
42
+ * Format token for integer display.
43
+ * - "decimal": normal decimal formatting (default)
44
+ * - "binary" | "octal" | "hex": prefixed base literals
45
+ * - other strings are reserved for future/custom formatters
46
+ */
30
47
  format?: string;
31
48
  };
32
49
  export type BooleanFormat = "checkbox" | string | [string, string];
33
50
  export type DateFormat = string;
34
51
  export type TimeFormat = string;
35
52
  export type DateTimeFormat = string;
36
- export type ColumnFormat<TType extends ColumnType> = TType extends "string" ? StringFormat : TType extends "number" ? NumberFormat : TType extends "boolean" ? BooleanFormat : TType extends "date" ? DateFormat : TType extends "time" ? TimeFormat : TType extends "datetime" ? DateTimeFormat : never;
53
+ export type ColumnFormat<TType extends ColumnType> = TType extends "string" ? StringFormat : TType extends "number" ? NumberFormat : TType extends "int" | "uint" ? IntegerFormat : TType extends "boolean" ? BooleanFormat : TType extends "date" ? DateFormat : TType extends "time" ? TimeFormat : TType extends "datetime" ? DateTimeFormat : never;
37
54
  export type ResolvedCellStyle = {
38
55
  backgroundColor?: string;
39
56
  textColor?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extable/core",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "format": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@extable/sequence": "0.3.1"
34
+ "@extable/sequence": "0.3.3"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^5.6.3"