verstak 0.22.412 → 0.22.500
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.
- package/README.md +3 -2
- package/build/dist/source/core/Block.d.ts +62 -0
- package/build/dist/source/core/{RxNode.js → Block.js} +130 -125
- package/build/dist/source/core/Elements.d.ts +3 -4
- package/build/dist/source/core/Elements.js +5 -5
- package/build/dist/source/core/Layout.d.ts +27 -0
- package/build/dist/source/{html/CellRange.js → core/Layout.js} +101 -17
- package/build/dist/source/core/Restyler.d.ts +2 -2
- package/build/dist/source/core/Restyler.js +3 -3
- package/build/dist/source/core/api.d.ts +3 -2
- package/build/dist/source/core/api.js +3 -2
- package/build/dist/source/html/Cluster.d.ts +11 -0
- package/build/dist/source/html/Cluster.js +14 -0
- package/build/dist/source/html/HtmlElements.d.ts +348 -348
- package/build/dist/source/html/HtmlElements.js +523 -523
- package/build/dist/source/html/HtmlNodeFactory.d.ts +13 -13
- package/build/dist/source/html/HtmlNodeFactory.js +30 -30
- package/build/dist/source/html/RxFocuser.js +2 -2
- package/build/dist/source/html/api.d.ts +0 -1
- package/build/dist/source/html/api.js +0 -1
- package/build/dist/source/html/sensors/ResizeSensor.d.ts +2 -2
- package/build/dist/source/html/sensors/ResizeSensor.js +11 -11
- package/package.json +6 -6
- package/build/dist/source/core/RxNode.d.ts +0 -59
- package/build/dist/source/html/CellRange.d.ts +0 -11
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Item } from 'reactronic';
|
|
2
|
-
import {
|
|
3
|
-
export declare abstract class
|
|
4
|
-
initialize(
|
|
5
|
-
finalize(
|
|
6
|
-
|
|
7
|
-
render(
|
|
2
|
+
import { Block, BlockFactory } from '../core/api';
|
|
3
|
+
export declare abstract class AbstractHtmlBlockFactory<T extends Element> extends BlockFactory<T> {
|
|
4
|
+
initialize(block: Block<T>, element: T | undefined): void;
|
|
5
|
+
finalize(block: Block<T>, isLeader: boolean): boolean;
|
|
6
|
+
layout(block: Block<T>, strict: boolean): void;
|
|
7
|
+
render(block: Block<T>): void | Promise<void>;
|
|
8
8
|
static get blinkingEffect(): string | undefined;
|
|
9
9
|
static set blinkingEffect(value: string | undefined);
|
|
10
|
-
static
|
|
11
|
-
static
|
|
12
|
-
protected abstract createElement(
|
|
10
|
+
static findNearestParentHtmlBlock(block: Block<any>): Block<Element>;
|
|
11
|
+
static findPrevSiblingHtmlBlock(item: Item<Block<any>>): Item<Block<Element>> | undefined;
|
|
12
|
+
protected abstract createElement(block: Block<T>): T;
|
|
13
13
|
}
|
|
14
|
-
export declare class
|
|
15
|
-
protected createElement(
|
|
14
|
+
export declare class HtmlBlockFactory<T extends HTMLElement> extends AbstractHtmlBlockFactory<T> {
|
|
15
|
+
protected createElement(block: Block<T>): T;
|
|
16
16
|
}
|
|
17
|
-
export declare class
|
|
18
|
-
protected createElement(
|
|
17
|
+
export declare class SvgBlockFactory<T extends SVGElement> extends AbstractHtmlBlockFactory<T> {
|
|
18
|
+
protected createElement(block: Block<T>): T;
|
|
19
19
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { Rx } from 'reactronic';
|
|
2
|
-
import {
|
|
3
|
-
export class
|
|
4
|
-
initialize(
|
|
5
|
-
element = this.createElement(
|
|
2
|
+
import { Block, BlockFactory } from '../core/api';
|
|
3
|
+
export class AbstractHtmlBlockFactory extends BlockFactory {
|
|
4
|
+
initialize(block, element) {
|
|
5
|
+
element = this.createElement(block);
|
|
6
6
|
if (Rx.isLogging)
|
|
7
|
-
element.id =
|
|
8
|
-
super.initialize(
|
|
7
|
+
element.id = block.name;
|
|
8
|
+
super.initialize(block, element);
|
|
9
9
|
}
|
|
10
|
-
finalize(
|
|
10
|
+
finalize(block, isLeader) {
|
|
11
11
|
var _a;
|
|
12
|
-
const e =
|
|
12
|
+
const e = block.impl;
|
|
13
13
|
if (e) {
|
|
14
14
|
(_a = e.resizeObserver) === null || _a === void 0 ? void 0 : _a.unobserve(e);
|
|
15
15
|
if (isLeader)
|
|
16
16
|
e.remove();
|
|
17
17
|
}
|
|
18
|
-
super.finalize(
|
|
18
|
+
super.finalize(block, isLeader);
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
const e =
|
|
21
|
+
layout(block, strict) {
|
|
22
|
+
const e = block.impl;
|
|
23
23
|
if (e) {
|
|
24
|
-
const nativeParent =
|
|
24
|
+
const nativeParent = AbstractHtmlBlockFactory.findNearestParentHtmlBlock(block).impl;
|
|
25
25
|
if (nativeParent) {
|
|
26
26
|
if (strict) {
|
|
27
|
-
const after =
|
|
27
|
+
const after = AbstractHtmlBlockFactory.findPrevSiblingHtmlBlock(block.item);
|
|
28
28
|
if (after === undefined) {
|
|
29
29
|
if (nativeParent !== e.parentNode || !e.previousSibling)
|
|
30
30
|
nativeParent.prepend(e);
|
|
31
31
|
}
|
|
32
|
-
else if (after.self.parent.
|
|
33
|
-
const nativeAfter = after.self.
|
|
32
|
+
else if (after.self.parent.impl === nativeParent) {
|
|
33
|
+
const nativeAfter = after.self.impl;
|
|
34
34
|
if (nativeAfter instanceof Element) {
|
|
35
35
|
if (nativeAfter.nextSibling !== e)
|
|
36
36
|
nativeParent.insertBefore(e, nativeAfter.nextSibling);
|
|
@@ -42,10 +42,10 @@ export class ElementNodeFactory extends NodeFactory {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
render(
|
|
46
|
-
const result = super.render(
|
|
45
|
+
render(block) {
|
|
46
|
+
const result = super.render(block);
|
|
47
47
|
if (gBlinkingEffect)
|
|
48
|
-
blink(
|
|
48
|
+
blink(block.impl, Block.currentRenderingPriority, block.stamp);
|
|
49
49
|
return result;
|
|
50
50
|
}
|
|
51
51
|
static get blinkingEffect() {
|
|
@@ -54,34 +54,34 @@ export class ElementNodeFactory extends NodeFactory {
|
|
|
54
54
|
static set blinkingEffect(value) {
|
|
55
55
|
if (value === undefined) {
|
|
56
56
|
const effect = gBlinkingEffect;
|
|
57
|
-
|
|
57
|
+
Block.forAllBlocksDo((e) => {
|
|
58
58
|
if (e instanceof HTMLElement)
|
|
59
59
|
e.classList.remove(`${effect}-0`, `${effect}-1`);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
gBlinkingEffect = value;
|
|
63
63
|
}
|
|
64
|
-
static
|
|
65
|
-
let p =
|
|
66
|
-
while (p.
|
|
64
|
+
static findNearestParentHtmlBlock(block) {
|
|
65
|
+
let p = block.parent;
|
|
66
|
+
while (p.impl instanceof Element === false && p !== block)
|
|
67
67
|
p = p.parent;
|
|
68
68
|
return p;
|
|
69
69
|
}
|
|
70
|
-
static
|
|
70
|
+
static findPrevSiblingHtmlBlock(item) {
|
|
71
71
|
let p = item.prev;
|
|
72
|
-
while (p && !(p.self.
|
|
72
|
+
while (p && !(p.self.impl instanceof Element))
|
|
73
73
|
p = p.prev;
|
|
74
74
|
return p;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
export class
|
|
78
|
-
createElement(
|
|
79
|
-
return document.createElement(
|
|
77
|
+
export class HtmlBlockFactory extends AbstractHtmlBlockFactory {
|
|
78
|
+
createElement(block) {
|
|
79
|
+
return document.createElement(block.factory.name);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
export class
|
|
83
|
-
createElement(
|
|
84
|
-
return document.createElementNS('http://www.w3.org/2000/svg',
|
|
82
|
+
export class SvgBlockFactory extends AbstractHtmlBlockFactory {
|
|
83
|
+
createElement(block) {
|
|
84
|
+
return document.createElementNS('http://www.w3.org/2000/svg', block.factory.name);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
function blink(e, priority, revision) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Reaction } from '../core/Elements';
|
|
2
2
|
export function RxFocuser(name, target, model, switchEditMode = undefined) {
|
|
3
|
-
Reaction(name, { target, model },
|
|
3
|
+
Reaction(name, { triggers: { target, model }, throttling: 0 }, () => {
|
|
4
4
|
if (switchEditMode !== undefined) {
|
|
5
5
|
switchEditMode(model);
|
|
6
6
|
}
|
|
7
7
|
else {
|
|
8
8
|
model.isEditMode ? target.focus() : target.blur();
|
|
9
9
|
}
|
|
10
|
-
}
|
|
10
|
+
});
|
|
11
11
|
}
|
|
@@ -2,7 +2,6 @@ export * from './HtmlNodeFactory';
|
|
|
2
2
|
export * from './HtmlElements';
|
|
3
3
|
export * from './HtmlApiExt';
|
|
4
4
|
export * from './RxFocuser';
|
|
5
|
-
export * from './CellRange';
|
|
6
5
|
export * from './sensors/Sensor';
|
|
7
6
|
export * from './sensors/PointerSensor';
|
|
8
7
|
export * from './sensors/BasePointerSensor';
|
|
@@ -2,7 +2,6 @@ export * from './HtmlNodeFactory';
|
|
|
2
2
|
export * from './HtmlElements';
|
|
3
3
|
export * from './HtmlApiExt';
|
|
4
4
|
export * from './RxFocuser';
|
|
5
|
-
export * from './CellRange';
|
|
6
5
|
export * from './sensors/Sensor';
|
|
7
6
|
export * from './sensors/PointerSensor';
|
|
8
7
|
export * from './sensors/BasePointerSensor';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Block } from '../../core/api';
|
|
2
2
|
import { Sensor } from './Sensor';
|
|
3
3
|
export interface ResizedElement {
|
|
4
4
|
readonly borderBoxSize: ReadonlyArray<ResizeObserverSize>;
|
|
@@ -11,7 +11,7 @@ export declare class ResizeSensor extends Sensor {
|
|
|
11
11
|
resizedElements: Array<ResizedElement>;
|
|
12
12
|
constructor();
|
|
13
13
|
reset(): void;
|
|
14
|
-
observeResizing(
|
|
14
|
+
observeResizing(block: Block<any, any, any>, value: boolean, boxSizing?: ResizeObserverBoxOptions): void;
|
|
15
15
|
protected onResize(entries: Array<ResizeObserverEntry>): void;
|
|
16
16
|
protected resize(entries: Array<ResizeObserverEntry>): void;
|
|
17
17
|
protected doReset(): void;
|
|
@@ -18,24 +18,24 @@ export class ResizeSensor extends Sensor {
|
|
|
18
18
|
reset() {
|
|
19
19
|
this.doReset();
|
|
20
20
|
}
|
|
21
|
-
observeResizing(
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
21
|
+
observeResizing(block, value, boxSizing = 'content-box') {
|
|
22
|
+
const impl = block.impl;
|
|
23
|
+
if (impl instanceof Element) {
|
|
24
24
|
if (value) {
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.observer.observe(
|
|
25
|
+
if (impl.resizeObserver !== undefined && impl.resizeObserver !== this.observer)
|
|
26
|
+
impl.resizeObserver.unobserve(impl);
|
|
27
|
+
impl.resizeObserver = this.observer;
|
|
28
|
+
this.observer.observe(impl, { box: boxSizing });
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
if (
|
|
32
|
-
this.observer.unobserve(
|
|
33
|
-
|
|
31
|
+
if (impl.resizeObserver === this.observer) {
|
|
32
|
+
this.observer.unobserve(impl);
|
|
33
|
+
impl.resizeObserver = undefined;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
else
|
|
38
|
-
throw new Error('cannot observe resizing of non-HTML
|
|
38
|
+
throw new Error('cannot observe resizing of non-HTML block');
|
|
39
39
|
}
|
|
40
40
|
onResize(entries) {
|
|
41
41
|
this.resize(entries);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verstak",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.500",
|
|
4
4
|
"description": "Verstak - Transactional Reactive Front-End Development Framework",
|
|
5
5
|
"publisher": "Nezaboodka Software",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"reactronic": "^0.22.411"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/node": "18.7
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
39
|
-
"@typescript-eslint/parser": "5.
|
|
37
|
+
"@types/node": "18.11.7",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "5.41.0",
|
|
39
|
+
"@typescript-eslint/parser": "5.41.0",
|
|
40
40
|
"ava": "4.3.3",
|
|
41
41
|
"c8": "7.12.0",
|
|
42
|
-
"eslint": "8.
|
|
42
|
+
"eslint": "8.26.0",
|
|
43
43
|
"ts-node": "10.9.1",
|
|
44
44
|
"tsconfig-paths": "4.1.0",
|
|
45
|
-
"typescript": "4.8.
|
|
45
|
+
"typescript": "4.8.4"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "eslint source/**/*.ts test/**/*.ts && tsc",
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Monitor, LoggingOptions, Item, CollectionReader } from 'reactronic';
|
|
2
|
-
export declare type Callback<E = unknown> = (element: E) => void;
|
|
3
|
-
export declare type Render<E = unknown, M = unknown, R = void> = (element: E, node: RxNode<E, M, R>) => R;
|
|
4
|
-
export declare type AsyncRender<E = unknown, M = unknown> = (element: E, node: RxNode<E, M, Promise<void>>) => Promise<void>;
|
|
5
|
-
export declare const enum Priority {
|
|
6
|
-
SyncP0 = 0,
|
|
7
|
-
AsyncP1 = 1,
|
|
8
|
-
AsyncP2 = 2
|
|
9
|
-
}
|
|
10
|
-
export declare abstract class RxNode<E = any, M = unknown, R = void> {
|
|
11
|
-
static currentRenderingPriority: Priority;
|
|
12
|
-
static readonly shortFrameDuration = 16;
|
|
13
|
-
static readonly longFrameDuration = 300;
|
|
14
|
-
static frameDuration: number;
|
|
15
|
-
abstract readonly name: string;
|
|
16
|
-
abstract readonly factory: NodeFactory<E>;
|
|
17
|
-
abstract readonly inline: boolean;
|
|
18
|
-
abstract readonly triggers: unknown;
|
|
19
|
-
abstract readonly renderer: Render<E, M, R>;
|
|
20
|
-
abstract readonly wrapper: Render<E, M, R> | undefined;
|
|
21
|
-
abstract readonly monitor?: Monitor;
|
|
22
|
-
abstract readonly throttling?: number;
|
|
23
|
-
abstract readonly logging?: Partial<LoggingOptions>;
|
|
24
|
-
abstract readonly priority: Priority;
|
|
25
|
-
abstract readonly shuffle: boolean;
|
|
26
|
-
abstract model?: M;
|
|
27
|
-
abstract readonly level: number;
|
|
28
|
-
abstract readonly parent: RxNode;
|
|
29
|
-
abstract readonly children: CollectionReader<RxNode>;
|
|
30
|
-
abstract readonly item: Item<RxNode> | undefined;
|
|
31
|
-
abstract readonly stamp: number;
|
|
32
|
-
abstract readonly element?: E;
|
|
33
|
-
render(): R;
|
|
34
|
-
get isInitialRendering(): boolean;
|
|
35
|
-
abstract wrapBy(renderer: Render<E, M, R> | undefined): this;
|
|
36
|
-
static root(render: () => void): void;
|
|
37
|
-
static get current(): RxNode;
|
|
38
|
-
static shuffleChildrenRendering(shuffle: boolean): void;
|
|
39
|
-
static renderChildrenThenDo(action: (error: unknown) => void): void;
|
|
40
|
-
static forAllNodesDo<E>(action: (e: E) => void): void;
|
|
41
|
-
static claim<E = undefined, M = unknown, R = void>(name: string, triggers: unknown, inline: boolean, renderer: Render<E, M, R>, priority?: Priority, monitor?: Monitor, throttling?: number, logging?: Partial<LoggingOptions>, factory?: NodeFactory<E>): RxNode<E, M, R>;
|
|
42
|
-
static getDefaultLoggingOptions(): LoggingOptions | undefined;
|
|
43
|
-
static setDefaultLoggingOptions(logging?: LoggingOptions): void;
|
|
44
|
-
}
|
|
45
|
-
export declare class NodeFactory<E> {
|
|
46
|
-
static readonly default: NodeFactory<any>;
|
|
47
|
-
readonly name: string;
|
|
48
|
-
readonly strict: boolean;
|
|
49
|
-
constructor(name: string, strict: boolean);
|
|
50
|
-
initialize(node: RxNode<E>, element: E | undefined): void;
|
|
51
|
-
finalize(node: RxNode<E>, isLeader: boolean): boolean;
|
|
52
|
-
arrange(node: RxNode<E>, strict: boolean): void;
|
|
53
|
-
render(node: RxNode<E>): void | Promise<void>;
|
|
54
|
-
}
|
|
55
|
-
export declare class StaticNodeFactory<E> extends NodeFactory<E> {
|
|
56
|
-
readonly element: E;
|
|
57
|
-
constructor(name: string, sequential: boolean, element: E);
|
|
58
|
-
initialize(node: RxNode<E>, element: E | undefined): void;
|
|
59
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface CellRange {
|
|
2
|
-
x1: number;
|
|
3
|
-
y1: number;
|
|
4
|
-
x2: number;
|
|
5
|
-
y2: number;
|
|
6
|
-
}
|
|
7
|
-
export declare class CellRangeUtils {
|
|
8
|
-
static parseCellRange(text: string, result: CellRange): CellRange;
|
|
9
|
-
static emitCellRange(value: CellRange): string;
|
|
10
|
-
private static emitCellPos;
|
|
11
|
-
}
|