verstak 0.23.121 → 0.23.123

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.
@@ -1,9 +1,9 @@
1
1
  import { MergeListReader, MergeItem, MemberOptions } from "reactronic";
2
2
  export type Callback<T = unknown> = (native: T) => void;
3
- export type Delegate<T = unknown, M = unknown, C = unknown, R = void> = (block: Block<T, M, C, R>, base: () => R) => R;
4
- export type AsyncDelegate<T = unknown, M = unknown> = (block: Block<T, M, Promise<void>>) => Promise<void>;
5
- export type SimpleDelegate<T = unknown> = (block: Block<T, any, any, any>) => void;
6
- export declare enum BlockKind {
3
+ export type Delegate<T> = (element: T, base: () => void) => void;
4
+ export type AsyncDelegate<T = unknown, M = unknown> = (element: El<T, M, Promise<void>>) => Promise<void>;
5
+ export type SimpleDelegate<T = unknown> = (element: El<T, any, any, any>) => void;
6
+ export declare enum ElKind {
7
7
  Section = 0,
8
8
  Table = 1,
9
9
  Note = 2,
@@ -12,15 +12,15 @@ export declare enum BlockKind {
12
12
  Cursor = 5,
13
13
  Native = 6
14
14
  }
15
- export interface Block<T = unknown, M = unknown, C = unknown, R = void> {
16
- readonly node: BlockNode<T, M, C, R>;
17
- readonly native: T;
15
+ export interface El<T = unknown, M = unknown, C = unknown, R = void> {
16
+ readonly node: RxNode<T, M, C, R>;
18
17
  readonly isSection: boolean;
19
18
  readonly isTable: boolean;
19
+ native: T;
20
20
  model: M;
21
21
  controller: C;
22
- kind: BlockKind;
23
- area: BlockArea;
22
+ kind: ElKind;
23
+ area: ElArea;
24
24
  widthGrowth: number;
25
25
  minWidth: string;
26
26
  maxWidth: string;
@@ -28,71 +28,69 @@ export interface Block<T = unknown, M = unknown, C = unknown, R = void> {
28
28
  minHeight: string;
29
29
  maxHeight: string;
30
30
  contentAlignment: Align;
31
- blockAlignment: Align;
31
+ elementAlignment: Align;
32
32
  contentWrapping: boolean;
33
33
  overlayVisible: boolean | undefined;
34
- updatePriority?: Priority;
35
- childrenShuffling: boolean;
36
- strictOrder: boolean;
37
- readonly isInitialUpdate: boolean;
38
34
  useStyle(styleName: string, enabled?: boolean): void;
39
35
  configureReactronic(options: Partial<MemberOptions>): MemberOptions;
40
36
  }
41
- export interface BlockNode<T = unknown, M = unknown, C = unknown, R = void> {
37
+ export interface RxNode<T = unknown, M = unknown, C = unknown, R = void> {
42
38
  readonly key: string;
43
- readonly driver: Driver<T>;
44
- readonly builder: Readonly<BlockBuilder<T, M, C, R>>;
39
+ readonly driver: RxNodeDriver<T>;
40
+ readonly spec: Readonly<RxNodeSpec<El<T, M, C, R>>>;
45
41
  readonly level: number;
46
- readonly owner: Block;
47
- readonly host: Block;
48
- readonly children: MergeListReader<Block>;
49
- readonly ties: MergeItem<Block> | undefined;
42
+ readonly owner: RxNode;
43
+ readonly host: RxNode;
44
+ readonly children: MergeListReader<El>;
45
+ readonly slot: MergeItem<El> | undefined;
50
46
  readonly stamp: number;
51
- readonly outer: Block;
52
- readonly context: BlockCtx | undefined;
47
+ readonly outer: RxNode;
48
+ readonly context: RxNodeCtx | undefined;
49
+ readonly isInitialUpdate: boolean;
50
+ priority?: Priority;
51
+ childrenShuffling: boolean;
52
+ strictOrder: boolean;
53
+ has(mode: Mode): boolean;
53
54
  }
54
- export interface BlockBuilder<T = unknown, M = unknown, C = unknown, R = void> {
55
- base?: BlockBuilder<T, M, C, R>;
55
+ export interface RxNodeSpec<T = unknown> {
56
+ base?: RxNodeSpec<T>;
56
57
  key?: string;
57
58
  mode?: Mode;
58
59
  triggers?: unknown;
59
- claim?: Delegate<T, M, C, R>;
60
- create?: Delegate<T, M, C, R>;
61
- initialize?: Delegate<T, M, C, R>;
62
- update?: Delegate<T, M, C, R>;
63
- finalize?: Delegate<T, M, C, R>;
60
+ specify?: Delegate<T>;
61
+ create?: Delegate<T>;
62
+ initialize?: Delegate<T>;
63
+ update?: Delegate<T>;
64
+ finalize?: Delegate<T>;
64
65
  }
65
- export interface BlockCtx<T extends Object = Object> {
66
+ export interface RxNodeCtx<T extends Object = Object> {
66
67
  value: T;
67
68
  }
68
- export interface Driver<T, C = unknown> {
69
+ export interface RxNodeDriver<T, C = unknown> {
69
70
  readonly name: string;
70
- readonly isRow: boolean;
71
+ readonly isSeparator: boolean;
71
72
  readonly preset?: SimpleDelegate<T>;
72
- claim(block: Block<T, unknown, C>): void;
73
- create(block: Block<T, unknown, C>, b: {
74
- native?: T;
75
- controller?: C;
76
- }): void;
77
- initialize(block: Block<T, unknown, C>): void;
78
- mount(block: Block<T, unknown, C>): void;
79
- update(block: Block<T, unknown, C>): void | Promise<void>;
80
- finalize(block: Block<T, unknown, C>, isLeader: boolean): boolean;
81
- applyKind(block: Block<T, any, C, any>, value: BlockKind): void;
82
- applyCoords(block: Block<T, any, C, any>, value: BlockCoords | undefined): void;
83
- applyWidthGrowth(block: Block<T, any, C, any>, value: number): void;
84
- applyMinWidth(block: Block<T, any, C, any>, value: string): void;
85
- applyMaxWidth(block: Block<T, any, C, any>, value: string): void;
86
- applyHeightGrowth(block: Block<T, any, C, any>, value: number): void;
87
- applyMinHeight(block: Block<T, any, C, any>, value: string): void;
88
- applyMaxHeight(block: Block<T, any, C, any>, value: string): void;
89
- applyContentAlignment(block: Block<T, any, C, any>, value: Align): void;
90
- applyBlockAlignment(block: Block<T, any, C, any>, value: Align): void;
91
- applyContentWrapping(block: Block<T, any, C, any>, value: boolean): void;
92
- applyOverlayVisible(block: Block<T, any, C, any>, value: boolean | undefined): void;
93
- applyStyle(block: Block<T, any, C, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
73
+ specify(element: El<T, unknown, C>): void;
74
+ create(element: El<T, unknown, C>): void;
75
+ initialize(element: El<T, unknown, C>): void;
76
+ mount(element: El<T, unknown, C>): void;
77
+ update(element: El<T, unknown, C>): void | Promise<void>;
78
+ finalize(element: El<T, unknown, C>, isLeader: boolean): boolean;
79
+ applyKind(element: El<T, any, C, any>, value: ElKind): void;
80
+ applyCoords(element: El<T, any, C, any>, value: ElCoords | undefined): void;
81
+ applyWidthGrowth(element: El<T, any, C, any>, value: number): void;
82
+ applyMinWidth(element: El<T, any, C, any>, value: string): void;
83
+ applyMaxWidth(element: El<T, any, C, any>, value: string): void;
84
+ applyHeightGrowth(element: El<T, any, C, any>, value: number): void;
85
+ applyMinHeight(element: El<T, any, C, any>, value: string): void;
86
+ applyMaxHeight(element: El<T, any, C, any>, value: string): void;
87
+ applyContentAlignment(element: El<T, any, C, any>, value: Align): void;
88
+ applyElementAlignment(element: El<T, any, C, any>, value: Align): void;
89
+ applyContentWrapping(element: El<T, any, C, any>, value: boolean): void;
90
+ applyOverlayVisible(element: El<T, any, C, any>, value: boolean | undefined): void;
91
+ applyStyle(element: El<T, any, C, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
94
92
  }
95
- export interface BlockCoords {
93
+ export interface ElCoords {
96
94
  x1: number;
97
95
  y1: number;
98
96
  x2: number;
@@ -128,7 +126,7 @@ export interface ElasticSize {
128
126
  export interface TrackSize extends ElasticSize {
129
127
  track?: string | number;
130
128
  }
131
- export type BlockArea = undefined | string | {
129
+ export type ElArea = undefined | string | {
132
130
  cellsOverWidth?: number;
133
131
  cellsOverHeight?: number;
134
132
  };
@@ -1,13 +1,13 @@
1
- export var BlockKind;
2
- (function (BlockKind) {
3
- BlockKind[BlockKind["Section"] = 0] = "Section";
4
- BlockKind[BlockKind["Table"] = 1] = "Table";
5
- BlockKind[BlockKind["Note"] = 2] = "Note";
6
- BlockKind[BlockKind["Group"] = 3] = "Group";
7
- BlockKind[BlockKind["Row"] = 4] = "Row";
8
- BlockKind[BlockKind["Cursor"] = 5] = "Cursor";
9
- BlockKind[BlockKind["Native"] = 6] = "Native";
10
- })(BlockKind || (BlockKind = {}));
1
+ export var ElKind;
2
+ (function (ElKind) {
3
+ ElKind[ElKind["Section"] = 0] = "Section";
4
+ ElKind[ElKind["Table"] = 1] = "Table";
5
+ ElKind[ElKind["Note"] = 2] = "Note";
6
+ ElKind[ElKind["Group"] = 3] = "Group";
7
+ ElKind[ElKind["Row"] = 4] = "Row";
8
+ ElKind[ElKind["Cursor"] = 5] = "Cursor";
9
+ ElKind[ElKind["Native"] = 6] = "Native";
10
+ })(ElKind || (ElKind = {}));
11
11
  export var Priority;
12
12
  (function (Priority) {
13
13
  Priority[Priority["Realtime"] = 0] = "Realtime";
@@ -1,8 +1,8 @@
1
- import { BlockCoords } from "./Interfaces.js";
2
- export declare function parseBlockCoords(text: string, result: BlockCoords): BlockCoords;
3
- export declare function emitBlockCoords(value: BlockCoords): string;
1
+ import { ElCoords } from "./Interfaces.js";
2
+ export declare function parseElCoords(text: string, result: ElCoords): ElCoords;
3
+ export declare function emitElCoords(value: ElCoords): string;
4
4
  export declare function emitLetters(n: number): string;
5
5
  export declare function emitCellPosition(x: number, y: number): string;
6
- export declare function equalBlockCoords(a: BlockCoords, b: BlockCoords): boolean;
6
+ export declare function equalElCoords(a: ElCoords, b: ElCoords): boolean;
7
7
  export declare function objectHasMember<T>(obj: any, member: string): obj is T;
8
8
  export declare function getCallerInfo(prefix: string): string;
@@ -1,4 +1,4 @@
1
- export function parseBlockCoords(text, result) {
1
+ export function parseElCoords(text, result) {
2
2
  let i = 0;
3
3
  let value = 0;
4
4
  let sign = 1;
@@ -129,7 +129,7 @@ export function parseBlockCoords(text, result) {
129
129
  }
130
130
  return result;
131
131
  }
132
- export function emitBlockCoords(value) {
132
+ export function emitElCoords(value) {
133
133
  const p1 = emitCellPosition(value.x1, value.y1);
134
134
  const p2 = emitCellPosition(value.x2, value.y2);
135
135
  return `${p1}${p2 !== "" ? `:${p2}` : ""}`;
@@ -159,7 +159,7 @@ export function emitCellPosition(x, y) {
159
159
  result = "";
160
160
  return result;
161
161
  }
162
- export function equalBlockCoords(a, b) {
162
+ export function equalElCoords(a, b) {
163
163
  return a.x1 === b.x1 && a.y1 === b.y1 && a.x2 === b.x2 && a.y1 === b.y2;
164
164
  }
165
165
  function isWhitespace(char) {
@@ -183,7 +183,7 @@ export function getCallerInfo(prefix) {
183
183
  const stack = error.stack || "";
184
184
  Error.stackTraceLimit = restore;
185
185
  const lines = stack.split("\n");
186
- let i = lines.findIndex(x => x.indexOf(".claim") >= 0);
186
+ let i = lines.findIndex(x => x.indexOf(".specify") >= 0);
187
187
  i = i >= 0 ? i + 2 : 5;
188
188
  let caller = extractFunctionAndLocation(lines[i]);
189
189
  let location = caller;
@@ -1,53 +1,47 @@
1
1
  import { LoggingOptions } from "reactronic";
2
- import { BlockCoords, BlockKind, Priority, Align, BlockBuilder, Block, Driver, SimpleDelegate } from "./Interfaces.js";
2
+ import { ElCoords, ElKind, Priority, Align, RxNodeSpec, El, RxNodeDriver, SimpleDelegate } from "./Interfaces.js";
3
3
  export declare class Verstak {
4
4
  static readonly shortFrameDuration = 16;
5
5
  static readonly longFrameDuration = 300;
6
6
  static currentUpdatePriority: Priority;
7
7
  static frameDuration: number;
8
- static claim<T = undefined, M = unknown, C = unknown, R = void>(driver: Driver<T>, builder?: BlockBuilder<T, M, C, R>, base?: BlockBuilder<T, M, C, R>): Block<T, M, C, R>;
9
- static get block(): Block;
10
- static triggerUpdate(block: Block<any, any, any, void>, triggers: unknown): void;
8
+ static specify<T = undefined, M = unknown, C = unknown, R = void>(driver: RxNodeDriver<T>, spec?: RxNodeSpec<El<T, M, C, R>>, base?: RxNodeSpec<El<T, M, C, R>>): El<T, M, C, R>;
9
+ static get element(): El;
10
+ static triggerUpdate(element: El<any, any, any, void>, triggers: unknown): void;
11
11
  static updateNestedTreesThenDo(action: (error: unknown) => void): void;
12
12
  static getDefaultLoggingOptions(): LoggingOptions | undefined;
13
13
  static setDefaultLoggingOptions(logging?: LoggingOptions): void;
14
14
  }
15
- export declare class BaseDriver<T, C = unknown> implements Driver<T, C> {
15
+ export declare class BaseDriver<T, C = unknown> implements RxNodeDriver<T, C> {
16
16
  readonly name: string;
17
- readonly isRow: boolean;
17
+ readonly isSeparator: boolean;
18
18
  readonly preset?: SimpleDelegate<T> | undefined;
19
19
  static readonly fragment: BaseDriver<any, unknown>;
20
- constructor(name: string, isRow: boolean, preset?: SimpleDelegate<T> | undefined);
21
- claim(block: Block<T, unknown, C>): void;
22
- create(block: Block<T, unknown, C>, b: {
23
- native?: T;
24
- controller?: C;
25
- }): void;
26
- initialize(block: Block<T, unknown, C>): void;
27
- mount(block: Block<T, unknown, C>): void;
28
- update(block: Block<T, unknown, C>): void | Promise<void>;
29
- finalize(block: Block<T, unknown, C>, isLeader: boolean): boolean;
30
- applyKind(block: Block<T, any, C, any>, value: BlockKind): void;
31
- applyCoords(block: Block<T, any, C, any>, value: BlockCoords | undefined): void;
32
- applyWidthGrowth(block: Block<T, any, C, any>, value: number): void;
33
- applyMinWidth(block: Block<T, any, C, any>, value: string): void;
34
- applyMaxWidth(block: Block<T, any, C, any>, value: string): void;
35
- applyHeightGrowth(block: Block<T, any, C, any>, value: number): void;
36
- applyMinHeight(block: Block<T, any, C, any>, value: string): void;
37
- applyMaxHeight(block: Block<T, any, C, any>, value: string): void;
38
- applyContentAlignment(block: Block<T, any, C, any>, value: Align): void;
39
- applyBlockAlignment(block: Block<T, any, C, any>, value: Align): void;
40
- applyContentWrapping(block: Block<T, any, C, any>, value: boolean): void;
41
- applyOverlayVisible(block: Block<T, any, C, any>, value: boolean | undefined): void;
42
- applyStyle(block: Block<T, any, C, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
20
+ constructor(name: string, isSeparator: boolean, preset?: SimpleDelegate<T> | undefined);
21
+ specify(element: El<T, unknown, C>): void;
22
+ create(element: El<T, unknown, C>): void;
23
+ initialize(element: El<T, unknown, C>): void;
24
+ mount(element: El<T, unknown, C>): void;
25
+ update(element: El<T, unknown, C>): void | Promise<void>;
26
+ finalize(element: El<T, unknown, C>, isLeader: boolean): boolean;
27
+ applyKind(element: El<T, any, C, any>, value: ElKind): void;
28
+ applyCoords(element: El<T, any, C, any>, value: ElCoords | undefined): void;
29
+ applyWidthGrowth(element: El<T, any, C, any>, value: number): void;
30
+ applyMinWidth(element: El<T, any, C, any>, value: string): void;
31
+ applyMaxWidth(element: El<T, any, C, any>, value: string): void;
32
+ applyHeightGrowth(element: El<T, any, C, any>, value: number): void;
33
+ applyMinHeight(element: El<T, any, C, any>, value: string): void;
34
+ applyMaxHeight(element: El<T, any, C, any>, value: string): void;
35
+ applyContentAlignment(element: El<T, any, C, any>, value: Align): void;
36
+ applyElementAlignment(element: El<T, any, C, any>, value: Align): void;
37
+ applyContentWrapping(element: El<T, any, C, any>, value: boolean): void;
38
+ applyOverlayVisible(element: El<T, any, C, any>, value: boolean | undefined): void;
39
+ applyStyle(element: El<T, any, C, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
43
40
  }
44
41
  export declare class StaticDriver<T> extends BaseDriver<T> {
45
- readonly element: T;
46
- constructor(element: T, name: string, isRow: boolean, preset?: SimpleDelegate<T>);
47
- create(block: Block<T, unknown, unknown, void>, b: {
48
- native?: T;
49
- controller?: unknown;
50
- }): void;
42
+ readonly native: T;
43
+ constructor(native: T, name: string, isRow: boolean, preset?: SimpleDelegate<T>);
44
+ create(element: El<T, unknown, unknown, void>): void;
51
45
  }
52
46
  export declare class CursorCommand {
53
47
  absolute?: string;
@@ -56,10 +50,7 @@ export declare class CursorCommand {
56
50
  }
57
51
  export declare class CursorCommandDriver extends BaseDriver<CursorCommand, void> {
58
52
  constructor();
59
- create(block: Block<CursorCommand, unknown, void, void>, b: {
60
- native?: CursorCommand;
61
- controller?: void;
62
- }): void;
53
+ create(element: El<CursorCommand, unknown, void, void>): void;
63
54
  }
64
55
  export declare class SubTreeVariable<T extends Object = Object> {
65
56
  readonly defaultValue: T | undefined;