verstak 0.95.25047 → 0.96.26001

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,39 +1,41 @@
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";
6
6
  export function Button(declaration) {
7
7
  return (Block(derivative(declaration, {
8
8
  mode: Mode.autonomous,
9
- preparation: el => {
9
+ preparation() {
10
10
  var _a;
11
- (_a = el.model) !== null && _a !== void 0 ? _a : (el.model = rxModel({
11
+ (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({
12
12
  icon: "fa-solid fa-square",
13
13
  label: ReactiveTreeNode.current.key,
14
14
  }));
15
15
  },
16
- script: el => {
17
- const m = el.model;
16
+ body() {
17
+ const m = this.model;
18
18
  const theme = Theme.current.button;
19
- el.useStylingPreset(theme.main);
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
- el.useStylingPreset(theme.icon);
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
- el.useStylingPreset(theme.label);
32
+ this.textIsFormatted = false;
33
+ this.text = m.label;
34
+ this.useStylingPreset(theme.label);
33
35
  },
34
36
  });
35
37
  }
36
- OnClick(el.native, m.action);
38
+ OnClick(this.native, m.action);
37
39
  },
38
40
  })));
39
41
  }
@@ -4,11 +4,11 @@ import { Theme } from "./Theme.js";
4
4
  export function Icon(name, declaration) {
5
5
  return (Block(derivative(declaration, {
6
6
  mode: Mode.autonomous,
7
- triggers: { name },
8
- script: el => {
7
+ signalArgs: { name },
8
+ body() {
9
9
  const theme = Theme.current.icon;
10
- el.useStylingPreset(name);
11
- el.useStylingPreset(theme.main);
10
+ this.useStylingPreset(name);
11
+ this.useStylingPreset(theme.main);
12
12
  },
13
13
  })));
14
14
  }
@@ -4,15 +4,15 @@ import { rxModel } from "./common/Utils.js";
4
4
  export function Image(declaration) {
5
5
  return (Block(derivative(declaration, {
6
6
  mode: Mode.autonomous,
7
- preparation: el => {
7
+ preparation() {
8
8
  var _a;
9
- (_a = el.model) !== null && _a !== void 0 ? _a : (el.model = rxModel({ source: undefined }));
9
+ (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({ source: undefined }));
10
10
  },
11
- script: el => {
12
- const m = el.model;
13
- el.style.backgroundImage = `url(${m.source})`;
14
- el.style.backgroundSize = "contain";
15
- el.style.backgroundRepeat = "no-repeat";
11
+ body() {
12
+ const m = this.model;
13
+ this.style.backgroundImage = `url(${m.source})`;
14
+ this.style.backgroundSize = "contain";
15
+ this.style.backgroundRepeat = "no-repeat";
16
16
  },
17
17
  })));
18
18
  }
@@ -1,25 +1,25 @@
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";
6
6
  export function Input(declaration) {
7
7
  return (Block(derivative(declaration, {
8
8
  mode: Mode.autonomous,
9
- preparation: el => {
9
+ preparation() {
10
10
  var _a;
11
- (_a = el.model) !== null && _a !== void 0 ? _a : (el.model = composeInputModel());
12
- el.native.dataForSensor.focus = el.model;
11
+ (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeInputModel());
12
+ this.native.dataForSensor.focus = this.model;
13
13
  },
14
- script: el => {
15
- const m = el.model;
14
+ body() {
15
+ const m = this.model;
16
16
  const theme = Theme.current.input;
17
- el.useStylingPreset(theme.main);
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
- el.useStylingPreset(theme.icon);
22
+ this.useStylingPreset(theme.icon);
23
23
  },
24
24
  });
25
25
  InputField(m, theme);
@@ -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
- preparation: (el, base) => {
49
- const e = el.native;
50
- el.useStylingPreset(styling.field);
51
- el.horizontally = Horizontal.stretch;
52
- el.vertically = Vertical.stretch;
48
+ preparation(el, base) {
49
+ const e = this.native;
50
+ this.useStylingPreset(styling.field);
51
+ this.horizontally = Horizontal.stretch;
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: el => {
59
- const e = el.native;
58
+ body() {
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,25 +81,31 @@ function InputField(model, styling) {
81
81
  function InputPopup(model, styling) {
82
82
  return (Block({
83
83
  key: InputPopup.name,
84
- script: el => {
85
- el.useStylingPreset(styling.popup);
86
- Fragment(() => model.position = el.native.sensors.scroll.y);
87
- const visible = el.overlayVisible = model.isEditMode;
84
+ body() {
85
+ this.useStylingPreset(styling.popup);
86
+ Fragment(() => model.position = this.native.sensors.scroll.y);
87
+ const visible = this.overlayVisible = model.isEditMode;
88
88
  if (visible) {
89
89
  const options = model.options;
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
- preparation: el => {
96
- el.contentWrapping = false;
95
+ preparation() {
96
+ this.text = x;
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, {
6
- preparation: (el, base) => {
7
- el.contentWrapping = true;
5
+ return (Block({
6
+ preparation(el, base) {
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,16 +1,21 @@
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, {
6
6
  mode: Mode.autonomous,
7
- preparation: el => {
7
+ preparation() {
8
8
  var _a;
9
- (_a = el.model) !== null && _a !== void 0 ? _a : (el.model = composeSpinnerModel());
9
+ (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeSpinnerModel());
10
10
  },
11
- script: el => {
12
- const m = el.model;
13
- m.active && JustText("loading...");
11
+ body() {
12
+ const m = this.model;
13
+ if (m.active)
14
+ Block({
15
+ body() {
16
+ this.text = "loading...";
17
+ },
18
+ });
14
19
  },
15
20
  })));
16
21
  }
@@ -1,42 +1,43 @@
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";
6
6
  export function Toggle(declaration) {
7
7
  return (Block(derivative(declaration, {
8
8
  mode: Mode.autonomous,
9
- preparation: el => {
9
+ preparation() {
10
10
  var _a;
11
- (_a = el.model) !== null && _a !== void 0 ? _a : (el.model = rxModel({
11
+ (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = rxModel({
12
12
  label: ReactiveTreeNode.current.key,
13
13
  checked: true,
14
14
  color: "green"
15
15
  }));
16
16
  },
17
- script: el => {
18
- const m = el.model;
17
+ body() {
18
+ const m = this.model;
19
19
  const theme = Theme.current;
20
20
  const toggleTheme = theme.toggle;
21
- el.useStylingPreset(toggleTheme.main);
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
- el.useStylingPreset(toggleTheme.icon);
27
- el.style.color = m.checked ? ((_a = theme.positiveColor) !== null && _a !== void 0 ? _a : "") : "";
26
+ this.useStylingPreset(toggleTheme.icon);
27
+ this.style.color = m.checked ? ((_a = theme.positiveColor) !== null && _a !== void 0 ? _a : "") : "";
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
- el.useStylingPreset(toggleTheme.label);
34
+ this.text = m.label;
35
+ this.useStylingPreset(toggleTheme.label);
35
36
  },
36
37
  });
37
38
  }
38
- OnClick(el.native, () => {
39
- el.model.checked = !el.model.checked;
39
+ OnClick(this.native, () => {
40
+ this.model.checked = !this.model.checked;
40
41
  });
41
42
  },
42
43
  })));
@@ -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";
@@ -14,25 +14,23 @@ export declare function Splitter<M = unknown>(declaration?: ReactiveTreeNodeDecl
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>>, preparationAsync?: 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>>, preparationAsync?: 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,4 +1,4 @@
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";
@@ -30,10 +30,12 @@ export function declareSplitter(index, splitViewNode) {
30
30
  return (Splitter({
31
31
  key,
32
32
  mode: Mode.autonomous,
33
- preparation: el => el.native.className = `splitter ${key}`,
34
- script: b => {
35
- const e = b.native;
36
- const model = b.model;
33
+ preparation() {
34
+ this.native.className = `splitter ${key}`;
35
+ },
36
+ body() {
37
+ const e = this.native;
38
+ const model = this.model;
37
39
  const dataForSensor = e.dataForSensor;
38
40
  dataForSensor.draggable = key;
39
41
  dataForSensor.drag = key;
@@ -80,35 +82,25 @@ export function declareSplitter(index, splitViewNode) {
80
82
  }
81
83
  export function cursor(place) {
82
84
  declare(Drivers.cursor, {
83
- script: el => {
84
- el.place = place;
85
+ body() {
86
+ this.place = place;
85
87
  },
86
88
  });
87
89
  }
88
- export function JustText(content, formatted, declaration) {
89
- return declare(Drivers.text, derivative(declaration, {
90
- script: el => {
91
- if (formatted)
92
- el.native.innerHTML = content;
93
- else
94
- el.native.innerText = content;
95
- },
96
- }));
97
- }
98
- export function Group(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
99
- return declare(Drivers.group, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
90
+ export function Group(bodyOrDeclaration, bodyTask, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
91
+ return declare(Drivers.group, bodyOrDeclaration, bodyTask, key, mode, preparation, preparationAsync, finalization, triggers, basis);
100
92
  }
101
- export function Fragment(script) {
102
- return PseudoElement({ mode: Mode.autonomous, script });
93
+ export function Fragment(body) {
94
+ return PseudoElement({ mode: Mode.autonomous, body });
103
95
  }
104
- export function PseudoElement(scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
105
- return declare(Drivers.pseudo, scriptOrDeclaration, scriptAsync, key, mode, preparation, preparationAsync, finalization, triggers, basis);
96
+ export function PseudoElement(bodyOrDeclaration, bodyTask, key, mode, preparation, preparationAsync, finalization, triggers, basis) {
97
+ return declare(Drivers.pseudo, bodyOrDeclaration, bodyTask, key, mode, preparation, preparationAsync, finalization, triggers, basis);
106
98
  }
107
99
  export class BlockDriver extends HtmlDriver {
108
- runScript(node) {
100
+ buildBody(node) {
109
101
  rowBreak();
110
102
  const el = node.element;
111
- const result = super.runScript(node);
103
+ const result = super.buildBody(node);
112
104
  if (el.splitView !== undefined) {
113
105
  if (el.layoutInfo === undefined)
114
106
  el.layoutInfo = new ElLayoutInfo(InitialElLayoutInfo);
@@ -128,7 +120,7 @@ export class BlockDriver extends HtmlDriver {
128
120
  });
129
121
  const relayoutEl = PseudoElement({
130
122
  mode: Mode.autonomous,
131
- script: () => {
123
+ body() {
132
124
  const native = el.native;
133
125
  const isHorizontal = el.splitView === Direction.horizontal;
134
126
  if (layoutInfo.isUpdateFinished) {
@@ -192,10 +184,10 @@ export class BlockDriver extends HtmlDriver {
192
184
  }
193
185
  const isHorizontal = el.splitView === Direction.horizontal;
194
186
  if (childDeclaration !== undefined) {
195
- if (childDeclaration.triggers === undefined)
196
- childDeclaration.triggers = {};
197
- Object.defineProperty(childDeclaration.triggers, "index", { value: partCount });
198
- overrideMethod(childDeclaration, "script", el => {
187
+ if (childDeclaration.signalArgs === undefined)
188
+ childDeclaration.signalArgs = {};
189
+ Object.defineProperty(childDeclaration.signalArgs, "index", { value: partCount });
190
+ overrideMethod(childDeclaration, "body", el => {
199
191
  if (isHorizontal)
200
192
  el.style.gridColumn = `${partCount + 1}`;
201
193
  else
@@ -226,32 +218,32 @@ function overrideMethod(declaration, method, func) {
226
218
  : (el, base) => { base(); func.call(el, el); };
227
219
  }
228
220
  export class PartitionDriver extends HtmlDriver {
229
- runScript(node) {
230
- const result = super.runScript(node);
221
+ buildBody(node) {
222
+ const result = super.buildBody(node);
231
223
  const ownerEl = node.owner.element;
232
224
  if (ownerEl.sealed !== undefined) {
233
225
  node.element.style.flexGrow = "1";
234
226
  declare(Drivers.wrapper, {
235
- script: el => {
236
- const ownerEl = el.node.owner.owner.element;
227
+ body() {
228
+ const ownerEl = this.node.owner.owner.element;
237
229
  if (ownerEl.splitView !== undefined) {
238
- el.style.display = "grid";
239
- el.style.flexDirection = "";
230
+ this.style.display = "grid";
231
+ this.style.flexDirection = "";
240
232
  }
241
233
  else {
242
234
  if (ownerEl.isTable) {
243
- el.style.display = "contents";
244
- el.style.flexDirection = "";
235
+ this.style.display = "contents";
236
+ this.style.flexDirection = "";
245
237
  }
246
238
  else {
247
- el.style.display = "flex";
248
- el.style.flexDirection = "row";
239
+ this.style.display = "flex";
240
+ this.style.flexDirection = "row";
249
241
  }
250
242
  }
251
- el.style.position = "absolute";
252
- el.style.inset = "0";
253
- el.style.overflow = "auto";
254
- el.style.gap = "inherit";
243
+ this.style.position = "absolute";
244
+ this.style.inset = "0";
245
+ this.style.overflow = "auto";
246
+ this.style.gap = "inherit";
255
247
  },
256
248
  });
257
249
  }
@@ -270,7 +262,6 @@ export class PartitionDriver extends HtmlDriver {
270
262
  export const Drivers = {
271
263
  block: new BlockDriver(Constants.element, false, el => el.kind = ElKind.block),
272
264
  table: new HtmlDriver(Constants.element, false, el => el.kind = ElKind.table),
273
- text: new HtmlDriver(Constants.element, false, el => el.kind = ElKind.text),
274
265
  group: new HtmlDriver(Constants.group, false, el => el.kind = ElKind.group),
275
266
  partition: new PartitionDriver(Constants.partition, true, el => el.kind = ElKind.partition),
276
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;
@@ -14,8 +14,8 @@ export function OnClick(target, action, key) {
14
14
  PseudoElement({
15
15
  key,
16
16
  mode: Mode.autonomous,
17
- triggers: { target },
18
- script: el => {
17
+ signalArgs: { target },
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) {
@@ -34,18 +34,20 @@ export function OnClickAsync(target, action, key) {
34
34
  PseudoElement({
35
35
  key,
36
36
  mode: Mode.autonomous,
37
- triggers: { target },
38
- scriptAsync: (el) => __awaiter(this, void 0, void 0, function* () {
39
- const pointer = target.sensors.pointer;
40
- if (target.dataForSensor.click !== undefined && pointer.clicked === target.dataForSensor.click || target.dataForSensor.click === undefined && pointer.clicked) {
41
- if (action instanceof Function) {
42
- yield runNonReactive(() => action(pointer));
37
+ signalArgs: { target },
38
+ bodyTask() {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const pointer = target.sensors.pointer;
41
+ if (target.dataForSensor.click !== undefined && pointer.clicked === target.dataForSensor.click || target.dataForSensor.click === undefined && pointer.clicked) {
42
+ if (action instanceof Function) {
43
+ yield runNonReactive(() => action(pointer));
44
+ }
45
+ else if (action instanceof ToggleRef) {
46
+ runNonReactive(() => action.toggle());
47
+ }
43
48
  }
44
- else if (action instanceof ToggleRef) {
45
- runNonReactive(() => action.toggle());
46
- }
47
- }
48
- }),
49
+ });
50
+ },
49
51
  });
50
52
  }
51
53
  }
@@ -54,8 +56,8 @@ export function OnResize(target, action, key) {
54
56
  PseudoElement({
55
57
  key,
56
58
  mode: Mode.autonomous,
57
- triggers: { target },
58
- script: el => {
59
+ signalArgs: { target },
60
+ body() {
59
61
  const resize = target.sensors.resize;
60
62
  resize.resizedElements.forEach(x => {
61
63
  action(x);
@@ -68,11 +70,11 @@ export function OnFocus(target, model, switchEditMode = undefined, key) {
68
70
  PseudoElement({
69
71
  key,
70
72
  mode: Mode.autonomous,
71
- triggers: { target, model },
72
- preparation: el => {
73
- el.node.configureReactivity({ throttling: 0 });
73
+ signalArgs: { target, model },
74
+ preparation() {
75
+ this.node.configureReactivity({ throttling: 0 });
74
76
  },
75
- script: el => {
77
+ body() {
76
78
  if (switchEditMode === undefined && !(target instanceof HTMLInputElement || target.hasAttribute("tabindex")))
77
79
  console.warn(`"${key !== null && key !== void 0 ? key : "noname"}" element must have "tabindex" attribute set in order to be focusable`);
78
80
  if (switchEditMode !== undefined) {
@@ -4,9 +4,9 @@ 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: b => {
8
- const e = b.native;
9
- const model = b.model;
7
+ body() {
8
+ const e = this.native;
9
+ const model = this.model;
10
10
  const dataForSensor = e.dataForSensor;
11
11
  dataForSensor.draggable = draggingId;
12
12
  dataForSensor.drag = draggingId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verstak",
3
- "version": "0.95.25047",
3
+ "version": "0.96.26001",
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.25047"
45
+ "reactronic": "^0.96.26001"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/markdown-it": "14.1.2",