@tempots/dom 10.0.111 → 11.0.0
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 +2 -0
- package/dom/handle-anchor-click.d.ts +5 -4
- package/dom/ssr.d.ts +5 -3
- package/index.cjs +1 -1
- package/index.js +535 -484
- package/mountable/appearance.d.ts +5 -6
- package/mountable/async.d.ts +5 -5
- package/mountable/attribute.d.ts +435 -431
- package/mountable/autofocus.d.ts +2 -2
- package/mountable/autoselect.d.ts +2 -2
- package/mountable/bind.d.ts +5 -5
- package/mountable/conjunction.d.ts +5 -5
- package/mountable/consumers.d.ts +5 -5
- package/mountable/ctx.d.ts +2 -2
- package/mountable/element.d.ts +227 -227
- package/mountable/empty.d.ts +2 -2
- package/mountable/ensure.d.ts +2 -2
- package/mountable/foreach.d.ts +2 -2
- package/mountable/fragment.d.ts +2 -2
- package/mountable/handler.d.ts +89 -89
- package/mountable/hidden-when-empty.d.ts +2 -2
- package/mountable/inviewport.d.ts +3 -3
- package/mountable/map-signal.d.ts +2 -2
- package/mountable/not-empty.d.ts +2 -2
- package/mountable/ondispose.d.ts +2 -2
- package/mountable/oneof.d.ts +9 -9
- package/mountable/onmount.d.ts +2 -2
- package/mountable/portal.d.ts +2 -2
- package/mountable/providers.d.ts +6 -6
- package/mountable/render.d.ts +3 -3
- package/mountable/repeat.d.ts +2 -2
- package/mountable/size.d.ts +3 -3
- package/mountable/style.d.ts +499 -499
- package/mountable/task.d.ts +5 -5
- package/mountable/text.d.ts +4 -4
- package/mountable/when.d.ts +3 -3
- package/package.json +23 -7
- package/std/signal.d.ts +24 -7
- package/types/css-styles.d.ts +1 -2
- package/types/domain.d.ts +2 -2
- package/types/html-attributes.d.ts +2 -1
package/mountable/task.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TNode, Renderable } from '../types/domain';
|
|
2
2
|
|
|
3
3
|
export declare const Task: <T>(task: () => Promise<T>, options: {
|
|
4
|
-
pending?:
|
|
5
|
-
then: (value: T) =>
|
|
6
|
-
error?: (error: unknown) =>
|
|
7
|
-
} | ((value: T) =>
|
|
4
|
+
pending?: TNode;
|
|
5
|
+
then: (value: T) => TNode;
|
|
6
|
+
error?: (error: unknown) => TNode;
|
|
7
|
+
} | ((value: T) => TNode)) => Renderable;
|
package/mountable/text.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Renderable } from '../types/domain';
|
|
2
2
|
import { Signal, Value } from '../std/signal';
|
|
3
3
|
|
|
4
|
-
export declare const staticText: (text: string) =>
|
|
5
|
-
export declare const signalText: (signal: Signal<string>) =>
|
|
6
|
-
export declare function Text(value: Value<string>):
|
|
4
|
+
export declare const staticText: (text: string) => Renderable;
|
|
5
|
+
export declare const signalText: (signal: Signal<string>) => Renderable;
|
|
6
|
+
export declare function Text(value: Value<string>): Renderable;
|
package/mountable/when.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TNode, Signal } from '..';
|
|
2
2
|
|
|
3
|
-
export declare const When: (condition: Signal<boolean>, then:
|
|
4
|
-
export declare const Unless: (condition: Signal<boolean>, then:
|
|
3
|
+
export declare const When: (condition: Signal<boolean>, then: TNode, otherwise?: TNode) => import('..').Renderable;
|
|
4
|
+
export declare const Unless: (condition: Signal<boolean>, then: TNode, otherwise?: TNode) => import('..').Renderable;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempots/dom",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -12,12 +12,28 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
15
|
+
"description": "Fully-typed frontend framework alternative to React and Angular",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"tempo",
|
|
18
|
+
"tempots",
|
|
19
|
+
"ui",
|
|
20
|
+
"framework",
|
|
21
|
+
"typescript",
|
|
22
|
+
"dom",
|
|
23
|
+
"angular-alternative",
|
|
24
|
+
"react-alternative"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://github.com/fponticelli/tempots",
|
|
19
27
|
"bugs": {
|
|
20
28
|
"url": "https://github.com/fponticelli/tempots/issues"
|
|
21
29
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "Franco Ponticelli",
|
|
32
|
+
"email": "franco.ponticelli@gmail.com",
|
|
33
|
+
"url": "https://github.com/fponticelli"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/fponticelli/tempots.git"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/std/signal.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
declare const $isSignal
|
|
2
|
-
declare const $isProp
|
|
3
|
-
declare const $isComputed
|
|
1
|
+
declare const $isSignal = "$__signal__";
|
|
2
|
+
declare const $isProp = "$__prop__";
|
|
3
|
+
declare const $isComputed = "$__computed__";
|
|
4
|
+
export type AnySignal<T = any> = Signal<T> | Prop<T> | Computed<T>;
|
|
5
|
+
/**
|
|
6
|
+
* @category Signal Implementation
|
|
7
|
+
*/
|
|
4
8
|
export declare class Signal<T> {
|
|
5
9
|
readonly equals: (a: T, b: T) => boolean;
|
|
6
10
|
static ofPromise<T>(promise: Promise<T>, init: T, recover?: (error: unknown) => T, equals?: (a: T, b: T) => boolean): Signal<T>;
|
|
@@ -28,6 +32,7 @@ export declare class Signal<T> {
|
|
|
28
32
|
readonly flatMap: <U>(fn: (value: T) => Signal<U>, equals?: (a: U, b: U) => boolean) => Computed<U>;
|
|
29
33
|
readonly tap: (fn: (value: T) => void) => Computed<T>;
|
|
30
34
|
readonly at: <K extends keyof T>(key: K) => Signal<T[K]>;
|
|
35
|
+
readonly $: { [K in keyof T]: Signal<T[K]>; };
|
|
31
36
|
readonly filter: (fn: (value: T) => boolean, startValue?: T) => Computed<T>;
|
|
32
37
|
readonly filterMap: <U>(fn: (value: T) => U | undefined | null, startValue: U, equals?: (a: U, b: U) => boolean) => Computed<U>;
|
|
33
38
|
readonly mapAsync: <U>(fn: (value: T) => Promise<U>, alt: U, recover?: (error: unknown) => U, equals?: (a: U, b: U) => boolean) => Prop<U>;
|
|
@@ -37,6 +42,9 @@ export declare class Signal<T> {
|
|
|
37
42
|
readonly count: () => Computed<number>;
|
|
38
43
|
readonly setDerivative: <U>(computed: Computed<U>) => void;
|
|
39
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @category Signal Implementation
|
|
47
|
+
*/
|
|
40
48
|
export declare class Computed<T> extends Signal<T> {
|
|
41
49
|
private readonly _fn;
|
|
42
50
|
static is<T = unknown>(value: unknown): value is Computed<T>;
|
|
@@ -49,19 +57,28 @@ export declare class Computed<T> extends Signal<T> {
|
|
|
49
57
|
readonly get: () => T;
|
|
50
58
|
get value(): T;
|
|
51
59
|
}
|
|
60
|
+
export type ReducerEffect<S, A> = (data: {
|
|
61
|
+
previousState: S;
|
|
62
|
+
state: S;
|
|
63
|
+
action: A;
|
|
64
|
+
dispatch: (action: A) => void;
|
|
65
|
+
}) => void;
|
|
66
|
+
/**
|
|
67
|
+
* @category Signal Implementation
|
|
68
|
+
*/
|
|
52
69
|
export declare class Prop<T> extends Signal<T> {
|
|
53
70
|
static is<T = unknown>(value: unknown): value is Prop<T>;
|
|
54
71
|
protected readonly [$isProp] = true;
|
|
55
72
|
readonly set: (value: T) => void;
|
|
56
73
|
readonly update: (fn: (value: T) => T) => void;
|
|
57
|
-
readonly reducer: <
|
|
74
|
+
readonly reducer: <A>(fn: (acc: T, value: A) => T, ...effects: ReducerEffect<T, A>[]) => (action: A) => void;
|
|
58
75
|
readonly iso: <U>(to: (value: T) => U, from: (value: U) => T, equals?: (a: U, b: U) => boolean) => Prop<U>;
|
|
59
76
|
readonly atProp: <K extends keyof T>(key: K) => Prop<T[K]>;
|
|
60
77
|
get value(): T;
|
|
61
78
|
set value(value: T);
|
|
62
79
|
}
|
|
63
|
-
export declare function computed<T>(fn: () => T, signals: Array<
|
|
64
|
-
export declare function effect(fn: () => void, signals: Array<
|
|
80
|
+
export declare function computed<T>(fn: () => T, signals: Array<AnySignal>, equals?: (a: T, b: T) => boolean): Computed<T>;
|
|
81
|
+
export declare function effect(fn: () => void, signals: Array<AnySignal>): () => void;
|
|
65
82
|
export declare function prop<T>(value: T, equals?: (a: T, b: T) => boolean): Prop<T>;
|
|
66
83
|
export declare function signal<T>(value: T, equals?: (a: T, b: T) => boolean): Signal<T>;
|
|
67
84
|
export declare class MemoryStore {
|
|
@@ -97,7 +114,7 @@ export declare function propOfSessionStorage<T>(options: {
|
|
|
97
114
|
equals?: (a: T, b: T) => boolean;
|
|
98
115
|
onLoad?: (value: T) => T;
|
|
99
116
|
}): Prop<T>;
|
|
100
|
-
export declare function animate<T>(initialValue: T, fn: () => T, signals: Array<
|
|
117
|
+
export declare function animate<T>(initialValue: T, fn: () => T, signals: Array<AnySignal>, options?: {
|
|
101
118
|
interpolate?: (start: T, end: T, delta: number) => T;
|
|
102
119
|
duration?: Value<number>;
|
|
103
120
|
easing?: (t: number) => number;
|
package/types/css-styles.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
type ExcludeFromStyle = 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty' | 'parentRule' | 'length' | 'name' | number;
|
|
1
|
+
export type ExcludeFromStyle = 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty' | 'parentRule' | 'length' | 'name' | number;
|
|
2
2
|
export type CSSStyles = Omit<CSSStyleDeclaration, ExcludeFromStyle>;
|
|
3
|
-
export {};
|
package/types/domain.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DOMContext } from '../dom/dom-context';
|
|
2
2
|
import { Value } from '../std/signal';
|
|
3
3
|
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
4
|
+
export type Renderable = (ctx: DOMContext) => Clear;
|
|
5
|
+
export type TNode = Renderable | Value<string> | undefined | null | Renderable[];
|
|
6
6
|
export type Clear = (removeTree: boolean) => void;
|
|
7
7
|
export type ProviderMark<T> = symbol & {
|
|
8
8
|
readonly __type: T;
|
|
@@ -77,6 +77,7 @@ export type HTMLAttributes = {
|
|
|
77
77
|
rel: string;
|
|
78
78
|
required: string;
|
|
79
79
|
reversed: string;
|
|
80
|
+
role: string;
|
|
80
81
|
rows: number;
|
|
81
82
|
rowspan: number;
|
|
82
83
|
sandbox: string;
|
|
@@ -100,7 +101,7 @@ export type HTMLAttributes = {
|
|
|
100
101
|
target: string;
|
|
101
102
|
title: string;
|
|
102
103
|
translate: string;
|
|
103
|
-
type:
|
|
104
|
+
type: string;
|
|
104
105
|
usemap: string;
|
|
105
106
|
value: string;
|
|
106
107
|
valueAsNumber: number;
|