verstak 0.95.25047 → 0.95.25048

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.
@@ -6,34 +6,34 @@ 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
+ script() {
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
+ script(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
29
  JustText(m.label, false, {
30
- script: (el, base) => {
30
+ script(el, base) {
31
31
  base();
32
- el.useStylingPreset(theme.label);
32
+ this.useStylingPreset(theme.label);
33
33
  },
34
34
  });
35
35
  }
36
- OnClick(el.native, m.action);
36
+ OnClick(this.native, m.action);
37
37
  },
38
38
  })));
39
39
  }
@@ -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
+ script() {
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
+ script() {
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
  }
@@ -6,20 +6,20 @@ 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
+ script() {
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
+ script(el, base) {
21
21
  base();
22
- el.useStylingPreset(theme.icon);
22
+ this.useStylingPreset(theme.icon);
23
23
  },
24
24
  });
25
25
  InputField(m, theme);
@@ -45,18 +45,18 @@ export function composeInputModel(props) {
45
45
  function InputField(model, styling) {
46
46
  return (JustText(model.text, false, {
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
53
  e.tabIndex = 0;
54
54
  e.contentEditable = "true";
55
55
  e.dataForSensor.focus = model;
56
56
  base();
57
57
  },
58
- script: el => {
59
- const e = el.native;
58
+ script() {
59
+ const e = this.native;
60
60
  if (!model.isEditMode)
61
61
  e.innerText = model.text;
62
62
  Fragment(() => {
@@ -81,10 +81,10 @@ 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
+ script() {
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) {
@@ -92,8 +92,8 @@ function InputPopup(model, styling) {
92
92
  rowBreak();
93
93
  JustText(x, false, {
94
94
  key: x,
95
- preparation: el => {
96
- el.contentWrapping = false;
95
+ preparation() {
96
+ this.contentWrapping = false;
97
97
  },
98
98
  });
99
99
  }
@@ -3,8 +3,8 @@ import Md from "markdown-it";
3
3
  import * as prism from "prismjs";
4
4
  export function Markdown(content) {
5
5
  return (JustText(md.render(content), true, {
6
- preparation: (el, base) => {
7
- el.contentWrapping = true;
6
+ preparation(el, base) {
7
+ this.contentWrapping = true;
8
8
  base();
9
9
  },
10
10
  }));
@@ -4,12 +4,12 @@ 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;
11
+ script() {
12
+ const m = this.model;
13
13
  m.active && JustText("loading...");
14
14
  },
15
15
  })));
@@ -6,37 +6,37 @@ 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
+ script() {
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
+ script(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
31
  JustText(m.label, false, {
32
- script: (el, base) => {
32
+ script(el, base) {
33
33
  base();
34
- el.useStylingPreset(toggleTheme.label);
34
+ this.useStylingPreset(toggleTheme.label);
35
35
  },
36
36
  });
37
37
  }
38
- OnClick(el.native, () => {
39
- el.model.checked = !el.model.checked;
38
+ OnClick(this.native, () => {
39
+ this.model.checked = !this.model.checked;
40
40
  });
41
41
  },
42
42
  })));
@@ -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
+ script() {
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,18 +82,18 @@ 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
+ script() {
86
+ this.place = place;
85
87
  },
86
88
  });
87
89
  }
88
90
  export function JustText(content, formatted, declaration) {
89
91
  return declare(Drivers.text, derivative(declaration, {
90
- script: el => {
92
+ script() {
91
93
  if (formatted)
92
- el.native.innerHTML = content;
94
+ this.native.innerHTML = content;
93
95
  else
94
- el.native.innerText = content;
96
+ this.native.innerText = content;
95
97
  },
96
98
  }));
97
99
  }
@@ -128,7 +130,7 @@ export class BlockDriver extends HtmlDriver {
128
130
  });
129
131
  const relayoutEl = PseudoElement({
130
132
  mode: Mode.autonomous,
131
- script: () => {
133
+ script() {
132
134
  const native = el.native;
133
135
  const isHorizontal = el.splitView === Direction.horizontal;
134
136
  if (layoutInfo.isUpdateFinished) {
@@ -192,9 +194,9 @@ export class BlockDriver extends HtmlDriver {
192
194
  }
193
195
  const isHorizontal = el.splitView === Direction.horizontal;
194
196
  if (childDeclaration !== undefined) {
195
- if (childDeclaration.triggers === undefined)
196
- childDeclaration.triggers = {};
197
- Object.defineProperty(childDeclaration.triggers, "index", { value: partCount });
197
+ if (childDeclaration.signalArgs === undefined)
198
+ childDeclaration.signalArgs = {};
199
+ Object.defineProperty(childDeclaration.signalArgs, "index", { value: partCount });
198
200
  overrideMethod(childDeclaration, "script", el => {
199
201
  if (isHorizontal)
200
202
  el.style.gridColumn = `${partCount + 1}`;
@@ -232,26 +234,26 @@ export class PartitionDriver extends HtmlDriver {
232
234
  if (ownerEl.sealed !== undefined) {
233
235
  node.element.style.flexGrow = "1";
234
236
  declare(Drivers.wrapper, {
235
- script: el => {
236
- const ownerEl = el.node.owner.owner.element;
237
+ script() {
238
+ const ownerEl = this.node.owner.owner.element;
237
239
  if (ownerEl.splitView !== undefined) {
238
- el.style.display = "grid";
239
- el.style.flexDirection = "";
240
+ this.style.display = "grid";
241
+ this.style.flexDirection = "";
240
242
  }
241
243
  else {
242
244
  if (ownerEl.isTable) {
243
- el.style.display = "contents";
244
- el.style.flexDirection = "";
245
+ this.style.display = "contents";
246
+ this.style.flexDirection = "";
245
247
  }
246
248
  else {
247
- el.style.display = "flex";
248
- el.style.flexDirection = "row";
249
+ this.style.display = "flex";
250
+ this.style.flexDirection = "row";
249
251
  }
250
252
  }
251
- el.style.position = "absolute";
252
- el.style.inset = "0";
253
- el.style.overflow = "auto";
254
- el.style.gap = "inherit";
253
+ this.style.position = "absolute";
254
+ this.style.inset = "0";
255
+ this.style.overflow = "auto";
256
+ this.style.gap = "inherit";
255
257
  },
256
258
  });
257
259
  }
@@ -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
+ script() {
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
+ scriptAsync() {
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
+ script() {
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
+ script() {
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
+ script() {
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.95.25048",
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.95.25048"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/markdown-it": "14.1.2",