verstak 0.95.25048 → 0.96.26002

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,5 +1,5 @@
1
1
  import { ReactiveTreeNode, Mode, derivative } from "reactronic";
2
- import { Block, JustText, OnClick } from "verstak";
2
+ import { Block, OnClick } from "verstak";
3
3
  import { rxModel } from "./common/Utils.js";
4
4
  import { Theme } from "./Theme.js";
5
5
  import { Icon } from "./Icon.v.js";
@@ -13,22 +13,24 @@ export function Button(declaration) {
13
13
  label: ReactiveTreeNode.current.key,
14
14
  }));
15
15
  },
16
- script() {
16
+ body() {
17
17
  const m = this.model;
18
18
  const theme = Theme.current.button;
19
19
  this.useStylingPreset(theme.main);
20
20
  if (m.icon) {
21
21
  Icon(m.icon, {
22
- script(el, base) {
22
+ body(el, base) {
23
23
  base();
24
24
  this.useStylingPreset(theme.icon);
25
25
  },
26
26
  });
27
27
  }
28
28
  if (m.label) {
29
- JustText(m.label, false, {
30
- script(el, base) {
29
+ Block({
30
+ body(el, base) {
31
31
  base();
32
+ this.textIsFormatted = false;
33
+ this.text = m.label;
32
34
  this.useStylingPreset(theme.label);
33
35
  },
34
36
  });
@@ -5,7 +5,7 @@ export function Icon(name, declaration) {
5
5
  return (Block(derivative(declaration, {
6
6
  mode: Mode.autonomous,
7
7
  signalArgs: { name },
8
- script() {
8
+ body() {
9
9
  const theme = Theme.current.icon;
10
10
  this.useStylingPreset(name);
11
11
  this.useStylingPreset(theme.main);
@@ -8,7 +8,7 @@ export function Image(declaration) {
8
8
  var _a;
9
9
  (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({ source: undefined }));
10
10
  },
11
- script() {
11
+ body() {
12
12
  const m = this.model;
13
13
  this.style.backgroundImage = `url(${m.source})`;
14
14
  this.style.backgroundSize = "contain";
@@ -1,5 +1,5 @@
1
1
  import { Mode, derivative } from "reactronic";
2
- import { Block, JustText, OnFocus, rowBreak, Fragment, KeyboardModifiers, Horizontal, Vertical } from "verstak";
2
+ import { Block, OnFocus, rowBreak, Fragment, KeyboardModifiers, Horizontal, Vertical } from "verstak";
3
3
  import { rxModel } from "./common/Utils.js";
4
4
  import { Theme } from "./Theme.js";
5
5
  import { Icon } from "./Icon.v.js";
@@ -11,13 +11,13 @@ export function Input(declaration) {
11
11
  (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeInputModel());
12
12
  this.native.dataForSensor.focus = this.model;
13
13
  },
14
- script() {
14
+ body() {
15
15
  const m = this.model;
16
16
  const theme = Theme.current.input;
17
17
  this.useStylingPreset(theme.main);
18
18
  if (m.icon)
19
19
  Icon(m.icon, {
20
- script(el, base) {
20
+ body(el, base) {
21
21
  base();
22
22
  this.useStylingPreset(theme.icon);
23
23
  },
@@ -43,22 +43,22 @@ export function composeInputModel(props) {
43
43
  });
44
44
  }
45
45
  function InputField(model, styling) {
46
- return (JustText(model.text, false, {
46
+ return (Block({
47
47
  key: InputField.name,
48
48
  preparation(el, base) {
49
49
  const e = this.native;
50
50
  this.useStylingPreset(styling.field);
51
51
  this.horizontally = Horizontal.stretch;
52
52
  this.vertically = Vertical.stretch;
53
+ this.textIsEditable = true;
53
54
  e.tabIndex = 0;
54
- e.contentEditable = "true";
55
55
  e.dataForSensor.focus = model;
56
56
  base();
57
57
  },
58
- script() {
58
+ body() {
59
59
  const e = this.native;
60
60
  if (!model.isEditMode)
61
- e.innerText = model.text;
61
+ this.text = model.text;
62
62
  Fragment(() => {
63
63
  const keyboard = e.sensors.keyboard;
64
64
  if (keyboard.down) {
@@ -81,7 +81,7 @@ function InputField(model, styling) {
81
81
  function InputPopup(model, styling) {
82
82
  return (Block({
83
83
  key: InputPopup.name,
84
- script() {
84
+ body() {
85
85
  this.useStylingPreset(styling.popup);
86
86
  Fragment(() => model.position = this.native.sensors.scroll.y);
87
87
  const visible = this.overlayVisible = model.isEditMode;
@@ -90,16 +90,22 @@ function InputPopup(model, styling) {
90
90
  if (options.length > 0) {
91
91
  for (const x of model.options) {
92
92
  rowBreak();
93
- JustText(x, false, {
93
+ Block({
94
94
  key: x,
95
95
  preparation() {
96
+ this.text = x;
96
97
  this.contentWrapping = false;
97
98
  },
98
99
  });
99
100
  }
100
101
  }
101
102
  else
102
- JustText("(nothing)", false, { key: "(nothing)" });
103
+ Block({
104
+ key: "(nothing)",
105
+ body() {
106
+ this.text = "(nothing)";
107
+ },
108
+ });
103
109
  }
104
110
  },
105
111
  }));
@@ -1 +1 @@
1
- export declare function Markdown(content: string): import("reactronic").ReactiveTreeNode<import("verstak").El<HTMLElement, void>>;
1
+ export declare function Markdown(content: string): import("reactronic").ReactiveTreeNode<import("verstak").El<HTMLElement, unknown>>;
@@ -1,12 +1,16 @@
1
- import { JustText } from "verstak";
2
1
  import Md from "markdown-it";
3
2
  import * as prism from "prismjs";
3
+ import { Block } from "verstak";
4
4
  export function Markdown(content) {
5
- return (JustText(md.render(content), true, {
5
+ return (Block({
6
6
  preparation(el, base) {
7
7
  this.contentWrapping = true;
8
8
  base();
9
9
  },
10
+ body() {
11
+ this.textIsFormatted = true;
12
+ this.text = md.render(content);
13
+ },
10
14
  }));
11
15
  }
12
16
  const md = new Md({
@@ -1,5 +1,5 @@
1
1
  import { Mode, derivative } from "reactronic";
2
- import { Block, JustText } from "verstak";
2
+ import { Block } from "verstak";
3
3
  import { rxModel } from "./common/Utils.js";
4
4
  export function Spinner(declaration) {
5
5
  return (Block(derivative(declaration, {
@@ -8,9 +8,14 @@ export function Spinner(declaration) {
8
8
  var _a;
9
9
  (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeSpinnerModel());
10
10
  },
11
- script() {
11
+ body() {
12
12
  const m = this.model;
13
- m.active && JustText("loading...");
13
+ if (m.active)
14
+ Block({
15
+ body() {
16
+ this.text = "loading...";
17
+ },
18
+ });
14
19
  },
15
20
  })));
16
21
  }
@@ -1,5 +1,5 @@
1
1
  import { ReactiveTreeNode, Mode, derivative } from "reactronic";
2
- import { Block, JustText, OnClick } from "verstak";
2
+ import { Block, OnClick } from "verstak";
3
3
  import { rxModel } from "./common/Utils.js";
4
4
  import { Theme } from "./Theme.js";
5
5
  import { Icon } from "./Icon.v.js";
@@ -14,13 +14,13 @@ export function Toggle(declaration) {
14
14
  color: "green"
15
15
  }));
16
16
  },
17
- script() {
17
+ body() {
18
18
  const m = this.model;
19
19
  const theme = Theme.current;
20
20
  const toggleTheme = theme.toggle;
21
21
  this.useStylingPreset(toggleTheme.main);
22
22
  Icon(`fa-solid fa-toggle-${m.checked ? "on" : "off"}`, {
23
- script(el, base) {
23
+ body(el, base) {
24
24
  var _a;
25
25
  base();
26
26
  this.useStylingPreset(toggleTheme.icon);
@@ -28,9 +28,10 @@ export function Toggle(declaration) {
28
28
  },
29
29
  });
30
30
  if (m.label) {
31
- JustText(m.label, false, {
32
- script(el, base) {
31
+ Block({
32
+ body(el, base) {
33
33
  base();
34
+ this.text = m.label;
34
35
  this.useStylingPreset(toggleTheme.label);
35
36
  },
36
37
  });
@@ -16,6 +16,9 @@ export type El<T = any, M = any> = {
16
16
  stretchingStrengthVertically: number | undefined;
17
17
  contentWrapping: boolean;
18
18
  overlayVisible: boolean | undefined;
19
+ text: string | undefined;
20
+ textIsFormatted: boolean;
21
+ textIsEditable: boolean;
19
22
  sealed: Direction | undefined;
20
23
  splitView: Direction | undefined;
21
24
  widthPx: {
@@ -33,12 +36,11 @@ export type El<T = any, M = any> = {
33
36
  export declare enum ElKind {
34
37
  block = 0,
35
38
  table = 1,
36
- text = 2,
37
- group = 3,
38
- partition = 4,
39
- splitter = 5,
40
- cursor = 6,
41
- native = 7
39
+ group = 2,
40
+ partition = 3,
41
+ splitter = 4,
42
+ cursor = 5,
43
+ native = 6
42
44
  }
43
45
  export type ElCoords = {
44
46
  x1: number;
@@ -2,12 +2,11 @@ export var ElKind;
2
2
  (function (ElKind) {
3
3
  ElKind[ElKind["block"] = 0] = "block";
4
4
  ElKind[ElKind["table"] = 1] = "table";
5
- ElKind[ElKind["text"] = 2] = "text";
6
- ElKind[ElKind["group"] = 3] = "group";
7
- ElKind[ElKind["partition"] = 4] = "partition";
8
- ElKind[ElKind["splitter"] = 5] = "splitter";
9
- ElKind[ElKind["cursor"] = 6] = "cursor";
10
- ElKind[ElKind["native"] = 7] = "native";
5
+ ElKind[ElKind["group"] = 2] = "group";
6
+ ElKind[ElKind["partition"] = 3] = "partition";
7
+ ElKind[ElKind["splitter"] = 4] = "splitter";
8
+ ElKind[ElKind["cursor"] = 5] = "cursor";
9
+ ElKind[ElKind["native"] = 6] = "native";
11
10
  })(ElKind || (ElKind = {}));
12
11
  export var Horizontal;
13
12
  (function (Horizontal) {
@@ -23,6 +23,9 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
23
23
  private _stretchingStrengthVertically;
24
24
  private _contentWrapping;
25
25
  private _overlayVisible;
26
+ private _text;
27
+ private _textIsFormatted;
28
+ private _textIsEditable;
26
29
  private _sealed;
27
30
  private _splitView;
28
31
  private _hasStylingPresets;
@@ -72,6 +75,12 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
72
75
  set contentWrapping(value: boolean);
73
76
  get overlayVisible(): boolean | undefined;
74
77
  set overlayVisible(value: boolean | undefined);
78
+ get text(): string | undefined;
79
+ set text(value: string | undefined);
80
+ get textIsFormatted(): boolean;
81
+ set textIsFormatted(value: boolean);
82
+ get textIsEditable(): boolean;
83
+ set textIsEditable(value: boolean);
75
84
  get sealed(): Direction | undefined;
76
85
  set sealed(value: Direction | undefined);
77
86
  get splitView(): Direction | undefined;
@@ -94,6 +103,9 @@ export declare class ElImpl<T extends Element = any, M = any> implements El<T, M
94
103
  private static applyOverlayVisible;
95
104
  static applySealed<T extends Element>(element: El<T, any>, value: Direction | undefined): void;
96
105
  static applySplitView<T extends Element>(element: El<T, any>, value: Direction | undefined): void;
106
+ static applyText<T extends Element>(element: El<T, any>, value: string | undefined): void;
107
+ static applyTextIsFormatted<T extends Element>(element: El<T, any>, value: boolean): void;
108
+ static applyTextIsEditable<T extends Element>(element: El<T, any>, value: boolean): void;
97
109
  private static applyStylingPreset;
98
110
  }
99
111
  export declare class ElLayoutInfo {
@@ -36,6 +36,9 @@ export class ElImpl {
36
36
  this._stretchingStrengthVertically = undefined;
37
37
  this._contentWrapping = true;
38
38
  this._overlayVisible = undefined;
39
+ this._text = "";
40
+ this._textIsFormatted = false;
41
+ this._textIsEditable = false;
39
42
  this._sealed = undefined;
40
43
  this._splitView = undefined;
41
44
  this._hasStylingPresets = false;
@@ -47,7 +50,7 @@ export class ElImpl {
47
50
  get index() { return this.node.slot.index; }
48
51
  get isBlock() { return this.kind === ElKind.block; }
49
52
  get isTable() { return this.kind === ElKind.table; }
50
- get isAuxiliary() { return this.kind > ElKind.text; }
53
+ get isAuxiliary() { return this.kind > ElKind.table; }
51
54
  get kind() { return this._kind; }
52
55
  set kind(value) {
53
56
  if (value !== this._kind || this.node.stamp >= Number.MAX_SAFE_INTEGER - 1) {
@@ -173,6 +176,27 @@ export class ElImpl {
173
176
  this._overlayVisible = value;
174
177
  }
175
178
  }
179
+ get text() { return this._text; }
180
+ set text(value) {
181
+ if (value !== this._text) {
182
+ ElImpl.applyText(this, value);
183
+ this._text = value;
184
+ }
185
+ }
186
+ get textIsFormatted() { return this._textIsFormatted; }
187
+ set textIsFormatted(value) {
188
+ if (value !== this._textIsFormatted) {
189
+ ElImpl.applyTextIsFormatted(this, value);
190
+ this._textIsFormatted = value;
191
+ }
192
+ }
193
+ get textIsEditable() { return this._textIsEditable; }
194
+ set textIsEditable(value) {
195
+ if (value !== this._textIsEditable) {
196
+ ElImpl.applyTextIsEditable(this, value);
197
+ this._textIsEditable = value;
198
+ }
199
+ }
176
200
  get sealed() { return this._sealed; }
177
201
  set sealed(value) {
178
202
  if (value !== this._sealed) {
@@ -526,6 +550,42 @@ export class ElImpl {
526
550
  });
527
551
  }
528
552
  }
553
+ static applyText(element, value) {
554
+ const e = element.native;
555
+ if (e instanceof HTMLElement) {
556
+ if (value) {
557
+ e.style.display = "inline-grid";
558
+ e.style.minWidth = "";
559
+ }
560
+ else {
561
+ e.style.display = "flex";
562
+ e.style.minWidth = "0";
563
+ }
564
+ if (element.textIsFormatted)
565
+ e.innerHTML = value !== null && value !== void 0 ? value : "";
566
+ else
567
+ e.innerText = value !== null && value !== void 0 ? value : "";
568
+ }
569
+ }
570
+ static applyTextIsFormatted(element, value) {
571
+ var _a, _b;
572
+ const e = element.native;
573
+ if (e instanceof HTMLElement) {
574
+ if (value)
575
+ e.innerHTML = (_a = element.text) !== null && _a !== void 0 ? _a : "";
576
+ else
577
+ e.innerText = (_b = element.text) !== null && _b !== void 0 ? _b : "";
578
+ }
579
+ }
580
+ static applyTextIsEditable(element, value) {
581
+ const e = element.native;
582
+ if (e instanceof HTMLElement) {
583
+ if (value)
584
+ e.contentEditable = "true";
585
+ else
586
+ e.contentEditable = "";
587
+ }
588
+ }
529
589
  static applyStylingPreset(element, secondary, styleName, enabled) {
530
590
  const native = element.native;
531
591
  enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
@@ -708,7 +768,7 @@ export const Constants = {
708
768
  wrapper: "wrapper",
709
769
  splitter: "splitter",
710
770
  group: "group",
711
- layouts: ["block", "table", "text", "group", "", "", ""],
771
+ layouts: ["block", "table", "group", "", "", ""],
712
772
  keyAttrName: "key",
713
773
  kindAttrName: "kind",
714
774
  ownReactiveTreeNodeKey: Symbol("own-reactive-tree-node"),
@@ -734,13 +794,6 @@ const DriversByLayout = [
734
794
  s.gridAutoColumns = "minmax(min-content, 1fr)";
735
795
  s.textAlign = "initial";
736
796
  },
737
- el => {
738
- const owner = el.node.owner.element;
739
- const s = el.style;
740
- s.alignSelf = owner.isTable ? "stretch" : "center";
741
- s.display = "inline-grid";
742
- s.flexShrink = "1";
743
- },
744
797
  el => {
745
798
  const s = el.style;
746
799
  s.display = "contents";
@@ -2,37 +2,35 @@ import { ReactiveTreeNode, ReactiveTreeNodeDecl, ReactiveTreeNodeDriver, Script,
2
2
  import { El, ElPlace } from "./El.js";
3
3
  import { CursorCommandDriver } from "./ElDriver.js";
4
4
  import { HtmlDriver } from "./WebDriver.js";
5
- export declare function Window(script?: Script<El<HTMLBodyElement>>, scriptAsync?: ScriptAsync<El<HTMLBodyElement>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLBodyElement>>, preparationAsync?: ScriptAsync<El<HTMLBodyElement>>, finalization?: Script<El<HTMLBodyElement>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLBodyElement>>): ReactiveTreeNode<El<HTMLBodyElement>>;
5
+ export declare function Window(script?: Script<El<HTMLBodyElement>>, scriptAsync?: ScriptAsync<El<HTMLBodyElement>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLBodyElement>>, preparationTask?: ScriptAsync<El<HTMLBodyElement>>, finalization?: Script<El<HTMLBodyElement>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLBodyElement>>): ReactiveTreeNode<El<HTMLBodyElement>>;
6
6
  export declare function Window(declaration?: ReactiveTreeNodeDecl<El<HTMLBodyElement>>): ReactiveTreeNode<El<HTMLBodyElement>>;
7
- export declare function Block<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationAsync?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
7
+ export declare function Block<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationTask?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
8
8
  export declare function Block<M = unknown>(declaration?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
9
- export declare function Table<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationAsync?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
9
+ export declare function Table<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationTask?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
10
10
  export declare function Table<M = unknown>(declaration?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
11
11
  export declare function row<T = void>(builder?: (element: void) => T, shiftCursorDown?: number): void;
12
- export declare function Splitter<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationAsync?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
12
+ export declare function Splitter<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationTask?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
13
13
  export declare function Splitter<M = unknown>(declaration?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
14
14
  export declare function rowBreak(shiftCursorDown?: number): void;
15
15
  export declare function declareSplitter<T>(index: number, splitViewNode: ReactiveTreeNode<El<T>>): ReactiveTreeNode<El<HTMLElement>>;
16
16
  export declare function cursor(place: ElPlace): void;
17
- export declare function JustText(content: string, formatted?: boolean, declaration?: ReactiveTreeNodeDecl<El<HTMLElement, void>>): ReactiveTreeNode<El<HTMLElement, void>>;
18
- export declare function Group<M = unknown>(script?: Script<El<HTMLElement, M>>, scriptAsync?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationAsync?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
17
+ export declare function Group<M = unknown>(body?: Script<El<HTMLElement, M>>, bodyTask?: ScriptAsync<El<HTMLElement, M>>, key?: string, mode?: Mode, preparation?: Script<El<HTMLElement, M>>, preparationTask?: ScriptAsync<El<HTMLElement, M>>, finalization?: Script<El<HTMLElement, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
19
18
  export declare function Group<M = unknown>(declaration?: ReactiveTreeNodeDecl<El<HTMLElement, M>>): ReactiveTreeNode<El<HTMLElement, M>>;
20
- export declare function Fragment<M = unknown>(script: Script<El<void, M>>): ReactiveTreeNode<El<void, M>>;
21
- export declare function PseudoElement<M = unknown>(script?: Script<El<void, M>>, scriptAsync?: ScriptAsync<El<void, M>>, key?: string, mode?: Mode, preparation?: Script<El<void, M>>, preparationAsync?: ScriptAsync<El<void, M>>, finalization?: Script<El<void, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<void, M>>): ReactiveTreeNode<El<void, M>>;
19
+ export declare function Fragment<M = unknown>(body: Script<El<void, M>>): ReactiveTreeNode<El<void, M>>;
20
+ export declare function PseudoElement<M = unknown>(body?: Script<El<void, M>>, bodyTask?: ScriptAsync<El<void, M>>, key?: string, mode?: Mode, preparation?: Script<El<void, M>>, preparationTask?: ScriptAsync<El<void, M>>, finalization?: Script<El<void, M>>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<El<void, M>>): ReactiveTreeNode<El<void, M>>;
22
21
  export declare function PseudoElement<M = unknown>(declaration?: ReactiveTreeNodeDecl<El<void, M>>): ReactiveTreeNode<El<void, M>>;
23
22
  export declare class BlockDriver<T extends HTMLElement> extends HtmlDriver<T> {
24
- runScript(node: ReactiveTreeNode<El<T>>): void | Promise<void>;
23
+ buildBody(node: ReactiveTreeNode<El<T>>): void | Promise<void>;
25
24
  declareChild(ownerNode: ReactiveTreeNode<El<T, any>>, childDriver: ReactiveTreeNodeDriver<any>, childDeclaration?: ReactiveTreeNodeDecl<any> | undefined, childBasis?: ReactiveTreeNodeDecl<any> | undefined): LinkedItem<ReactiveTreeNode> | undefined;
26
25
  }
27
26
  export declare function isSplitViewPartition(childDriver: ReactiveTreeNodeDriver): boolean;
28
27
  export declare class PartitionDriver<T extends HTMLElement> extends HtmlDriver<T> {
29
- runScript(node: ReactiveTreeNode<El<T>>): void | Promise<void>;
28
+ buildBody(node: ReactiveTreeNode<El<T>>): void | Promise<void>;
30
29
  provideHost(node: ReactiveTreeNode<El<T, any>>): ReactiveTreeNode<El<T, any>>;
31
30
  }
32
31
  export declare const Drivers: {
33
32
  block: BlockDriver<HTMLElement>;
34
33
  table: HtmlDriver<HTMLElement, any>;
35
- text: HtmlDriver<HTMLElement, any>;
36
34
  group: HtmlDriver<HTMLElement, any>;
37
35
  partition: PartitionDriver<HTMLElement>;
38
36
  wrapper: HtmlDriver<HTMLElement, any>;
@@ -1,26 +1,26 @@
1
- import { ReactiveTreeNode, Mode, declare, derivative, launch, runNonReactive } from "reactronic";
1
+ import { ReactiveTreeNode, Mode, declare, launch, runNonReactive } from "reactronic";
2
2
  import { ElKind, Direction } from "./El.js";
3
3
  import { clamp } from "./ElUtils.js";
4
4
  import { Constants, CursorCommandDriver, ElDriver, ElLayoutInfo, InitialElLayoutInfo } from "./ElDriver.js";
5
5
  import { getPrioritiesForEmptySpaceDistribution, getPrioritiesForSizeChanging, relayout, relayoutUsingSplitter } from "./SplitViewMath.js";
6
6
  import { Axis, BodyFontSize, Dimension, toPx } from "./Sizes.js";
7
7
  import { HtmlDriver, StaticDriver } from "./WebDriver.js";
8
- export function Window(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
8
+ export function Window(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationTask, finalization, triggers, basis) {
9
9
  const driver = new StaticDriver(global.document.body, "Page", false, el => el.kind = ElKind.block);
10
- return declare(driver, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
10
+ return declare(driver, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationTask, finalization, triggers, basis);
11
11
  }
12
- export function Block(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
13
- return declare(Drivers.block, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
12
+ export function Block(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationTask, finalization, triggers, basis) {
13
+ return declare(Drivers.block, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationTask, finalization, triggers, basis);
14
14
  }
15
- export function Table(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
16
- return declare(Drivers.table, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
15
+ export function Table(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationTask, finalization, triggers, basis) {
16
+ return declare(Drivers.table, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationTask, finalization, triggers, basis);
17
17
  }
18
18
  export function row(builder, shiftCursorDown) {
19
19
  rowBreak(shiftCursorDown);
20
20
  builder === null || builder === void 0 ? void 0 : builder();
21
21
  }
22
- export function Splitter(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
23
- return declare(Drivers.splitter, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
22
+ export function Splitter(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationTask, finalization, triggers, basis) {
23
+ return declare(Drivers.splitter, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationTask, finalization, triggers, basis);
24
24
  }
25
25
  export function rowBreak(shiftCursorDown) {
26
26
  declare(Drivers.partition);
@@ -33,7 +33,7 @@ export function declareSplitter(index, splitViewNode) {
33
33
  preparation() {
34
34
  this.native.className = `splitter ${key}`;
35
35
  },
36
- script() {
36
+ body() {
37
37
  const e = this.native;
38
38
  const model = this.model;
39
39
  const dataForSensor = e.dataForSensor;
@@ -82,35 +82,25 @@ export function declareSplitter(index, splitViewNode) {
82
82
  }
83
83
  export function cursor(place) {
84
84
  declare(Drivers.cursor, {
85
- script() {
85
+ body() {
86
86
  this.place = place;
87
87
  },
88
88
  });
89
89
  }
90
- export function JustText(content, formatted, declaration) {
91
- return declare(Drivers.text, derivative(declaration, {
92
- script() {
93
- if (formatted)
94
- this.native.innerHTML = content;
95
- else
96
- this.native.innerText = content;
97
- },
98
- }));
99
- }
100
- export function Group(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
101
- return declare(Drivers.group, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
90
+ export function Group(bodyOrDeclaration, bodyTask, key, mode, preparation, preparationTask, finalization, triggers, basis) {
91
+ return declare(Drivers.group, bodyOrDeclaration, bodyTask, key, mode, preparation, preparationTask, finalization, triggers, basis);
102
92
  }
103
- export function Fragment(script) {
104
- return PseudoElement({ mode: Mode.autonomous, script });
93
+ export function Fragment(body) {
94
+ return PseudoElement({ mode: Mode.autonomous, body });
105
95
  }
106
- export function PseudoElement(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
107
- return declare(Drivers.pseudo, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
96
+ export function PseudoElement(bodyOrDeclaration, bodyTask, key, mode, preparation, preparationTask, finalization, triggers, basis) {
97
+ return declare(Drivers.pseudo, bodyOrDeclaration, bodyTask, key, mode, preparation, preparationTask, finalization, triggers, basis);
108
98
  }
109
99
  export class BlockDriver extends HtmlDriver {
110
- runScript(node) {
100
+ buildBody(node) {
111
101
  rowBreak();
112
102
  const el = node.element;
113
- const result = super.runScript(node);
103
+ const result = super.buildBody(node);
114
104
  if (el.splitView !== undefined) {
115
105
  if (el.layoutInfo === undefined)
116
106
  el.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
@@ -130,7 +120,7 @@ export class BlockDriver extends HtmlDriver {
130
120
  });
131
121
  const relayoutEl = PseudoElement({
132
122
  mode: Mode.autonomous,
133
- script() {
123
+ body() {
134
124
  const native = el.native;
135
125
  const isHorizontal = el.splitView === Direction.horizontal;
136
126
  if (layoutInfo.isUpdateFinished) {
@@ -197,7 +187,7 @@ export class BlockDriver extends HtmlDriver {
197
187
  if (childDeclaration.signalArgs === undefined)
198
188
  childDeclaration.signalArgs = {};
199
189
  Object.defineProperty(childDeclaration.signalArgs, "index", { value: partCount });
200
- overrideMethod(childDeclaration, "script", el => {
190
+ overrideMethod(childDeclaration, "body", el => {
201
191
  if (isHorizontal)
202
192
  el.style.gridColumn = `${partCount + 1}`;
203
193
  else
@@ -228,13 +218,13 @@ function overrideMethod(declaration, method, func) {
228
218
  : (el, base) => { base(); func.call(el, el); };
229
219
  }
230
220
  export class PartitionDriver extends HtmlDriver {
231
- runScript(node) {
232
- const result = super.runScript(node);
221
+ buildBody(node) {
222
+ const result = super.buildBody(node);
233
223
  const ownerEl = node.owner.element;
234
224
  if (ownerEl.sealed !== undefined) {
235
225
  node.element.style.flexGrow = "1";
236
226
  declare(Drivers.wrapper, {
237
- script() {
227
+ body() {
238
228
  const ownerEl = this.node.owner.owner.element;
239
229
  if (ownerEl.splitView !== undefined) {
240
230
  this.style.display = "grid";
@@ -272,7 +262,6 @@ export class PartitionDriver extends HtmlDriver {
272
262
  export const Drivers = {
273
263
  block: new BlockDriver(Constants.element, false, el => el.kind = ElKind.block),
274
264
  table: new HtmlDriver(Constants.element, false, el => el.kind = ElKind.table),
275
- text: new HtmlDriver(Constants.element, false, el => el.kind = ElKind.text),
276
265
  group: new HtmlDriver(Constants.group, false, el => el.kind = ElKind.group),
277
266
  partition: new PartitionDriver(Constants.partition, true, el => el.kind = ElKind.partition),
278
267
  wrapper: new HtmlDriver(Constants.wrapper, false, el => el.kind = ElKind.native),
@@ -6,7 +6,7 @@ export declare class WebDriver<T extends Element, M = unknown> extends ElDriver<
6
6
  runPreparation(node: ReactiveTreeNode<El<T, M>>): void | Promise<void>;
7
7
  runFinalization(node: ReactiveTreeNode<El<T, M>>, isLeader: boolean): boolean;
8
8
  runMount(node: ReactiveTreeNode<El<T, M>>): void;
9
- runScript(node: ReactiveTreeNode<El<T, M>>): void | Promise<void>;
9
+ buildBody(node: ReactiveTreeNode<El<T, M>>): void | Promise<void>;
10
10
  private assignExtraAttributesAndProperties;
11
11
  private clearExtraAttributesAndProperties;
12
12
  static getOwnNodeOfNativeElement<T extends Element>(element: T): ReactiveTreeNode<El<T>> | undefined;
@@ -57,11 +57,11 @@ export class WebDriver extends ElDriver {
57
57
  }
58
58
  }
59
59
  }
60
- runScript(node) {
60
+ buildBody(node) {
61
61
  const el = node.element;
62
62
  if (el instanceof ElImpl)
63
63
  el.prepareForUpdate();
64
- let result = super.runScript(node);
64
+ let result = super.buildBody(node);
65
65
  result = proceedSyncOrAsync(result, v => {
66
66
  if (el.place === undefined) {
67
67
  const oel = node.owner.element;
@@ -69,7 +69,7 @@ export class WebDriver extends ElDriver {
69
69
  el.place = undefined;
70
70
  }
71
71
  if (gBlinkingEffectMarker)
72
- blink(el.native, ReactiveTreeNode.currentScriptPriority, node.stamp);
72
+ blink(el.native, ReactiveTreeNode.currentBodyPriority, node.stamp);
73
73
  }, e => {
74
74
  });
75
75
  return result;
@@ -15,7 +15,7 @@ export function OnClick(target, action, key) {
15
15
  key,
16
16
  mode: Mode.autonomous,
17
17
  signalArgs: { target },
18
- script() {
18
+ body() {
19
19
  const pointer = target.sensors.pointer;
20
20
  if (target.dataForSensor.click !== undefined && pointer.clicked === target.dataForSensor.click || target.dataForSensor.click === undefined && pointer.clicked) {
21
21
  if (action instanceof Function) {
@@ -35,7 +35,7 @@ export function OnClickAsync(target, action, key) {
35
35
  key,
36
36
  mode: Mode.autonomous,
37
37
  signalArgs: { target },
38
- scriptAsync() {
38
+ bodyTask() {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  const pointer = target.sensors.pointer;
41
41
  if (target.dataForSensor.click !== undefined && pointer.clicked === target.dataForSensor.click || target.dataForSensor.click === undefined && pointer.clicked) {
@@ -57,7 +57,7 @@ export function OnResize(target, action, key) {
57
57
  key,
58
58
  mode: Mode.autonomous,
59
59
  signalArgs: { target },
60
- script() {
60
+ body() {
61
61
  const resize = target.sensors.resize;
62
62
  resize.resizedElements.forEach(x => {
63
63
  action(x);
@@ -74,7 +74,7 @@ export function OnFocus(target, model, switchEditMode = undefined, key) {
74
74
  preparation() {
75
75
  this.node.configureReactivity({ throttling: 0 });
76
76
  },
77
- script() {
77
+ body() {
78
78
  if (switchEditMode === undefined && !(target instanceof HTMLInputElement || target.hasAttribute("tabindex")))
79
79
  console.warn(`"${key !== null && key !== void 0 ? key : "noname"}" element must have "tabindex" attribute set in order to be focusable`);
80
80
  if (switchEditMode !== undefined) {
@@ -4,7 +4,7 @@ import { Fragment } from "../core/Elements.js";
4
4
  export function DraggableArea(draggingId, builder) {
5
5
  return (Div(derivative(builder, {
6
6
  mode: Mode.autonomous,
7
- script() {
7
+ body() {
8
8
  const e = this.native;
9
9
  const model = this.model;
10
10
  const dataForSensor = e.dataForSensor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verstak",
3
- "version": "0.95.25048",
3
+ "version": "0.96.26002",
4
4
  "description": "Verstak - Front-End Library",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  "markdown-it": "^14.1.0",
43
43
  "markdown-it-prism": "^2.3.0",
44
44
  "prismjs": "^1.30.0",
45
- "reactronic": "^0.95.25048"
45
+ "reactronic": "^0.96.26002"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/markdown-it": "14.1.2",