verstak 0.22.515 → 0.23.100

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,8 +1,8 @@
1
- export declare type Render<E = unknown, O = void> = (element: E, options: O) => void | Promise<void>;
2
- export declare type SuperRender<E = unknown, O = void> = ((render: (options: O) => void, element: E) => void);
3
- export declare type AsyncSuperRender<O = unknown, E = void> = ((render: (options: O) => Promise<void>, element: E) => Promise<void>);
4
- export declare type Customize<E = unknown, O = void> = (element: E, options: O) => void;
5
- export declare type AsyncCustomize<E = unknown, O = void> = (element: E, options: O) => Promise<void>;
1
+ export type Render<E = unknown, O = void> = (element: E, options: O) => void | Promise<void>;
2
+ export type SuperRender<E = unknown, O = void> = ((render: (options: O) => void, element: E) => void);
3
+ export type AsyncSuperRender<O = unknown, E = void> = ((render: (options: O) => Promise<void>, element: E) => Promise<void>);
4
+ export type Customize<E = unknown, O = void> = (element: E, options: O) => void;
5
+ export type AsyncCustomize<E = unknown, O = void> = (element: E, options: O) => Promise<void>;
6
6
  export interface RxNodeType<E = unknown, O = void> {
7
7
  readonly name: string;
8
8
  readonly sequential: boolean;
@@ -1,4 +1,9 @@
1
1
  export class RxNode {
2
+ get parent() { return this.host; }
3
+ get revision() { var _a, _b; return (_b = (_a = this.instance) === null || _a === void 0 ? void 0 : _a.revision) !== null && _b !== void 0 ? _b : ~0; }
4
+ get native() { var _a; return (_a = this.instance) === null || _a === void 0 ? void 0 : _a.native; }
5
+ set native(e) { this.instance.native = e; }
6
+ get resizeObserver() { var _a; return (_a = this.instance) === null || _a === void 0 ? void 0 : _a.resizeObserver; }
2
7
  constructor(id, args, render, superRender, priority, childrenShuffling, type, inline, creator, host, instance) {
3
8
  this.id = id;
4
9
  this.args = args;
@@ -14,9 +19,4 @@ export class RxNode {
14
19
  this.old = undefined;
15
20
  this.prevSibling = undefined;
16
21
  }
17
- get parent() { return this.host; }
18
- get revision() { var _a, _b; return (_b = (_a = this.instance) === null || _a === void 0 ? void 0 : _a.revision) !== null && _b !== void 0 ? _b : ~0; }
19
- get native() { var _a; return (_a = this.instance) === null || _a === void 0 ? void 0 : _a.native; }
20
- set native(e) { this.instance.native = e; }
21
- get resizeObserver() { var _a; return (_a = this.instance) === null || _a === void 0 ? void 0 : _a.resizeObserver; }
22
22
  }
@@ -6,4 +6,6 @@ export interface CellRange {
6
6
  }
7
7
  export declare function parseCellRange(text: string, result: CellRange): CellRange;
8
8
  export declare function emitCellRange(value: CellRange): string;
9
+ export declare function emitLetters(n: number): string;
10
+ export declare function emitCellPosition(x: number, y: number): string;
9
11
  export declare function equalCellRanges(a: CellRange, b: CellRange): boolean;
@@ -134,22 +134,7 @@ export function emitCellRange(value) {
134
134
  const p2 = emitCellPosition(value.x2, value.y2);
135
135
  return `${p1}${p2 !== "" ? `:${p2}` : ""}`;
136
136
  }
137
- export function equalCellRanges(a, b) {
138
- return a.x1 === b.x1 && a.y1 === b.y1 && a.x2 === b.x2 && a.y1 === b.y2;
139
- }
140
- function isWhitespace(char) {
141
- return char === 32 || (char >= 9 && char <= 13) || char === 133 || char === 160;
142
- }
143
- function isDigit(input, index) {
144
- return 48 <= input && input <= 57;
145
- }
146
- function isCapitalLetter(ch) {
147
- return 65 <= ch && ch <= 90;
148
- }
149
- function isLowercaseLetter(ch) {
150
- return 97 <= ch && ch <= 122;
151
- }
152
- function emitLetters(n) {
137
+ export function emitLetters(n) {
153
138
  if (n < 0)
154
139
  throw new Error(`emitLetters: argument (${n}) should not be negative or zero`);
155
140
  let result = "";
@@ -160,7 +145,7 @@ function emitLetters(n) {
160
145
  }
161
146
  return result;
162
147
  }
163
- function emitCellPosition(x, y) {
148
+ export function emitCellPosition(x, y) {
164
149
  let result = "";
165
150
  if (x > 0 && y > 0)
166
151
  result = `${emitLetters(x - 1)}${y}`;
@@ -174,3 +159,18 @@ function emitCellPosition(x, y) {
174
159
  result = "";
175
160
  return result;
176
161
  }
162
+ export function equalCellRanges(a, b) {
163
+ return a.x1 === b.x1 && a.y1 === b.y1 && a.x2 === b.x2 && a.y1 === b.y2;
164
+ }
165
+ function isWhitespace(char) {
166
+ return char === 32 || (char >= 9 && char <= 13) || char === 133 || char === 160;
167
+ }
168
+ function isDigit(input, index) {
169
+ return 48 <= input && input <= 57;
170
+ }
171
+ function isCapitalLetter(ch) {
172
+ return 65 <= ch && ch <= 90;
173
+ }
174
+ function isLowercaseLetter(ch) {
175
+ return 97 <= ch && ch <= 122;
176
+ }
@@ -18,7 +18,7 @@ export interface ElasticSize {
18
18
  export interface TrackSize extends ElasticSize {
19
19
  track?: string | number;
20
20
  }
21
- export declare type Cells = undefined | string | number | {
21
+ export type Cells = undefined | string | number | {
22
22
  right?: number;
23
23
  horizontalOverlap?: boolean;
24
24
  down?: number;
@@ -1 +1,2 @@
1
1
  export declare function objectHasMember<T>(obj: any, member: string): obj is T;
2
+ export declare function getCallerInfo(prefix: string): string;
@@ -1,3 +1,35 @@
1
1
  export function objectHasMember(obj, member) {
2
2
  return obj === Object(obj) && !Array.isArray(obj) && member in obj;
3
3
  }
4
+ export function getCallerInfo(prefix) {
5
+ const restore = Error.stackTraceLimit = 20;
6
+ const error = new Error();
7
+ const stack = error.stack || "";
8
+ Error.stackTraceLimit = restore;
9
+ const lines = stack.split("\n");
10
+ let i = lines.findIndex(x => x.indexOf(".claim") >= 0);
11
+ i = i >= 0 ? i + 2 : 5;
12
+ let caller = extractFunctionAndLocation(lines[i]);
13
+ let location = caller;
14
+ if (caller.func.endsWith(".render")) {
15
+ i = i - 1;
16
+ caller = extractFunctionAndLocation(lines[i]);
17
+ location = extractFunctionAndLocation(lines[i + 1]);
18
+ }
19
+ else {
20
+ while (!caller.func) {
21
+ i = i - 1;
22
+ caller = extractFunctionAndLocation(lines[i]);
23
+ }
24
+ location = extractFunctionAndLocation(lines[i + 1]);
25
+ }
26
+ const result = `${prefix}·${caller.func}@${location.file}`;
27
+ return result;
28
+ }
29
+ function extractFunctionAndLocation(s) {
30
+ const match = s.match(/(?:\s*at\s+)?(?:(\S+)\s\()?(?:.*?)([^\/\(\):]+)(?:(:|\d)*\)?)$/);
31
+ return {
32
+ func: (match === null || match === void 0 ? void 0 : match[1]) || "",
33
+ file: (match === null || match === void 0 ? void 0 : match[2]) || "",
34
+ };
35
+ }
@@ -1,28 +1,29 @@
1
1
  import { LoggingOptions, Item, CollectionReader, MemberOptions } from "reactronic";
2
2
  import { CellRange } from "./CellRange";
3
3
  import { Cursor, Align, Cells } from "./Cursor";
4
- export declare type Callback<T = unknown> = (native: T) => void;
5
- export declare type Render<T = unknown, M = unknown, R = void> = (block: VBlock<T, M, R>, base: () => R) => R;
6
- export declare type AsyncRender<T = unknown, M = unknown> = (block: VBlock<T, M, Promise<void>>) => Promise<void>;
4
+ export type Callback<T = unknown> = (native: T) => void;
5
+ export type Operation<T = unknown, M = unknown, R = void> = (block: VBlock<T, M, R>) => R;
6
+ export type VirtualOperation<T = unknown, M = unknown, R = void> = (block: VBlock<T, M, R>, base: () => R) => R;
7
+ export type AsyncOperation<T = unknown, M = unknown> = (block: VBlock<T, M, Promise<void>>) => Promise<void>;
8
+ export type BlockBody<T = unknown, M = unknown, R = void> = Operation<T, M, R> | BlockVmt<T, M, R>;
7
9
  export declare const enum Priority {
8
- SyncP0 = 0,
9
- AsyncP1 = 1,
10
- AsyncP2 = 2
10
+ Realtime = 0,
11
+ Normal = 1,
12
+ Background = 2
11
13
  }
12
- export declare type Type<T> = new (...args: any[]) => T;
13
- export declare type BlockBody<T = unknown, M = unknown, R = void> = Render<T, M, R> | BlockVmt<T, M, R>;
14
14
  export interface BlockVmt<T = unknown, M = unknown, R = void> {
15
+ base?: BlockVmt<T, M, R>;
15
16
  key?: string;
16
- reacting?: boolean;
17
+ autonomous?: boolean;
17
18
  triggers?: unknown;
18
- initialize?: Render<T, M, R>;
19
- override?: Render<T, M, R>;
20
- render?: Render<T, M, R>;
21
- finalize?: Render<T, M, R>;
19
+ initialize?: Operation<T, M, R>;
20
+ render?: Operation<T, M, R>;
21
+ finalize?: Operation<T, M, R>;
22
+ redefinedInitialize?: VirtualOperation<T, M, R>;
23
+ redefinedRender?: VirtualOperation<T, M, R>;
24
+ redefinedFinalize?: VirtualOperation<T, M, R>;
22
25
  }
23
- export declare function asBaseFor<T, M, R>(outer: BlockBody<T, M, R> | undefined, base: BlockBody<T, M, R>): BlockVmt<T, M, R>;
24
- export declare function setContext<T extends Object>(type: Type<T>, context: T): void;
25
- export declare function use<T extends Object>(type: Type<T>): T;
26
+ export declare function vmt<T, M, R>(body: BlockBody<T, M, R> | undefined): BlockVmt<T, M, R> | undefined;
26
27
  export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
27
28
  static readonly shortFrameDuration = 16;
28
29
  static readonly longFrameDuration = 300;
@@ -42,9 +43,10 @@ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
42
43
  abstract contentAlignment: Align;
43
44
  abstract frameAlignment: Align;
44
45
  abstract contentWrapping: boolean;
45
- abstract floating: boolean;
46
+ abstract overlayVisible: boolean | undefined;
46
47
  abstract childrenShuffling: boolean;
47
48
  abstract renderingPriority?: Priority;
49
+ abstract style(styleName: string, enabled?: boolean): void;
48
50
  abstract readonly level: number;
49
51
  abstract readonly host: VBlock;
50
52
  abstract readonly children: CollectionReader<VBlock>;
@@ -58,13 +60,14 @@ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
58
60
  static renderNestedTreesThenDo(action: (error: unknown) => void): void;
59
61
  static runForAllBlocks<T>(action: (e: T) => void): void;
60
62
  static claim<T = undefined, M = unknown, R = void>(driver: AbstractDriver<T> | undefined, body: BlockBody<T, M, R>): VBlock<T, M, R>;
63
+ private static generateKey;
61
64
  static getDefaultLoggingOptions(): LoggingOptions | undefined;
62
65
  static setDefaultLoggingOptions(logging?: LoggingOptions): void;
63
66
  }
64
67
  export declare enum LayoutKind {
65
68
  Block = 0,
66
69
  Grid = 1,
67
- Row = 2,
70
+ Line = 2,
68
71
  Group = 3,
69
72
  Text = 4
70
73
  }
@@ -77,11 +80,12 @@ export declare class AbstractDriver<T> {
77
80
  get isAuxiliary(): boolean;
78
81
  get isBlock(): boolean;
79
82
  get isGrid(): boolean;
80
- get isRow(): boolean;
83
+ get isLine(): boolean;
81
84
  constructor(name: string, layout: LayoutKind, createCursor?: () => Cursor);
82
85
  initialize(block: VBlock<T>, native: T): void;
86
+ deploy(block: VBlock<T>): void;
87
+ render(block: VBlock<T>): void | Promise<void>;
83
88
  finalize(block: VBlock<T>, isLeader: boolean): boolean;
84
- deploy(block: VBlock<T>, sequential: boolean): void;
85
89
  applyCellRange(block: VBlock<T, any, any>, cellRange: CellRange | undefined): void;
86
90
  applyWidthGrowth(block: VBlock<T, any, any>, widthGrowth: number): void;
87
91
  applyMinWidth(block: VBlock<T, any, any>, minWidth: string): void;
@@ -92,11 +96,18 @@ export declare class AbstractDriver<T> {
92
96
  applyContentAlignment(block: VBlock<T, any, any>, contentAlignment: Align): void;
93
97
  applyFrameAlignment(block: VBlock<T, any, any>, frameAlignment: Align): void;
94
98
  applyContentWrapping(block: VBlock<T, any, any>, contentWrapping: boolean): void;
95
- applyFloating(block: VBlock<T, any, any>, floating: boolean): void;
96
- render(block: VBlock<T>): void | Promise<void>;
99
+ applyOverlayVisible(block: VBlock<T, any, any>, overlayVisible: boolean | undefined): void;
100
+ applyStyling(block: VBlock<T, any, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
97
101
  }
98
102
  export declare class StaticDriver<T> extends AbstractDriver<T> {
99
103
  readonly element: T;
100
104
  constructor(element: T, name: string, layout: LayoutKind, createCursor?: () => Cursor);
101
105
  initialize(block: VBlock<T>, element: T): void;
102
106
  }
107
+ export declare class ContextVariable<T extends Object = Object> {
108
+ readonly defaultValue: T | undefined;
109
+ constructor(defaultValue?: T);
110
+ set value(value: T);
111
+ get value(): T;
112
+ get valueOrUndefined(): T | undefined;
113
+ }