@tempots/dom 21.0.0 → 22.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/index.cjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +439 -437
- package/package.json +1 -1
- package/renderable/conjunction.d.ts +1 -1
- package/renderable/foreach.d.ts +2 -2
- package/renderable/repeat.d.ts +2 -3
- package/std/{position.d.ts → element-position.d.ts} +25 -22
- package/std/value.d.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signal } from '../std/signal';
|
|
2
2
|
import { Renderable, TNode } from '../types/domain';
|
|
3
|
-
import { ElementPosition } from '../std/position';
|
|
3
|
+
import { ElementPosition } from '../std/element-position';
|
|
4
4
|
/**
|
|
5
5
|
* Options for configuring a conjunction.
|
|
6
6
|
* @public
|
package/renderable/foreach.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TNode, Renderable } from '../types/domain';
|
|
2
2
|
import { Signal } from '../std/signal';
|
|
3
|
-
import { ElementPosition } from '../std/position';
|
|
3
|
+
import { ElementPosition } from '../std/element-position';
|
|
4
4
|
import { Value } from '../std/value';
|
|
5
5
|
/**
|
|
6
6
|
* Renders a list of items based on a signal of arrays.
|
|
@@ -12,4 +12,4 @@ import { Value } from '../std/value';
|
|
|
12
12
|
* @returns - The renderable function that renders the list of items.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export declare const ForEach: <T>(value: Value<T[]>, item: (value: Signal<T>, position:
|
|
15
|
+
export declare const ForEach: <T>(value: Value<T[]>, item: (value: Signal<T>, position: ElementPosition) => TNode, separator?: (pos: ElementPosition) => TNode) => Renderable;
|
package/renderable/repeat.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ElementPosition } from '../std/position';
|
|
2
|
-
import { Signal } from '../std/signal';
|
|
1
|
+
import { ElementPosition } from '../std/element-position';
|
|
3
2
|
import { Value } from '../std/value';
|
|
4
3
|
import { TNode, Renderable } from '../types/domain';
|
|
5
4
|
/**
|
|
@@ -11,4 +10,4 @@ import { TNode, Renderable } from '../types/domain';
|
|
|
11
10
|
* @returns A renderable function that renders the repeated elements.
|
|
12
11
|
* @public
|
|
13
12
|
*/
|
|
14
|
-
export declare const Repeat: (times: Value<number>, element: (index:
|
|
13
|
+
export declare const Repeat: (times: Value<number>, element: (index: ElementPosition) => TNode, separator?: (pos: ElementPosition) => TNode) => Renderable;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { Signal } from './signal';
|
|
1
2
|
/**
|
|
2
3
|
* Represents the position of an element in a collection.
|
|
3
4
|
*
|
|
4
5
|
* @public
|
|
5
6
|
*/
|
|
6
7
|
export declare class ElementPosition {
|
|
8
|
+
#private;
|
|
7
9
|
/**
|
|
8
10
|
* The index of the element.
|
|
9
11
|
*/
|
|
@@ -11,7 +13,26 @@ export declare class ElementPosition {
|
|
|
11
13
|
/**
|
|
12
14
|
* The total number of elements in the collection.
|
|
13
15
|
*/
|
|
14
|
-
readonly total: number
|
|
16
|
+
readonly total: Signal<number>;
|
|
17
|
+
/**
|
|
18
|
+
* The counter of the element starting from 1.
|
|
19
|
+
*/
|
|
20
|
+
readonly counter: number;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if the element is the first element in the collection.
|
|
23
|
+
* @returns `true` if the element is the first element, `false` otherwise.
|
|
24
|
+
*/
|
|
25
|
+
readonly isFirst: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the counter of the element is even.
|
|
28
|
+
* @returns `true` if the counter is even, `false` otherwise.
|
|
29
|
+
*/
|
|
30
|
+
readonly isEven: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the counter of the element is odd.
|
|
33
|
+
* @returns `true` if the counter is odd, `false` otherwise.
|
|
34
|
+
*/
|
|
35
|
+
readonly isOdd: boolean;
|
|
15
36
|
/**
|
|
16
37
|
* Creates a new instance of `ElementPosition`.
|
|
17
38
|
* @param index - The index of the element.
|
|
@@ -25,29 +46,11 @@ export declare class ElementPosition {
|
|
|
25
46
|
/**
|
|
26
47
|
* The total number of elements in the collection.
|
|
27
48
|
*/
|
|
28
|
-
total: number);
|
|
29
|
-
/**
|
|
30
|
-
* Gets the counter of the element.
|
|
31
|
-
*/
|
|
32
|
-
get counter(): number;
|
|
33
|
-
/**
|
|
34
|
-
* Checks if the element is the first element in the collection.
|
|
35
|
-
* @returns `true` if the element is the first element, `false` otherwise.
|
|
36
|
-
*/
|
|
37
|
-
get isFirst(): boolean;
|
|
49
|
+
total: Signal<number>);
|
|
38
50
|
/**
|
|
39
51
|
* Checks if the element is the last element in the collection.
|
|
40
52
|
* @returns `true` if the element is the last element, `false` otherwise.
|
|
41
53
|
*/
|
|
42
|
-
get isLast(): boolean
|
|
43
|
-
|
|
44
|
-
* Checks if the counter of the element is even.
|
|
45
|
-
* @returns `true` if the counter is even, `false` otherwise.
|
|
46
|
-
*/
|
|
47
|
-
get isEven(): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Checks if the counter of the element is odd.
|
|
50
|
-
* @returns `true` if the counter is odd, `false` otherwise.
|
|
51
|
-
*/
|
|
52
|
-
get isOdd(): boolean;
|
|
54
|
+
get isLast(): Signal<boolean>;
|
|
55
|
+
readonly dispose: () => void;
|
|
53
56
|
}
|
package/std/value.d.ts
CHANGED
|
@@ -50,6 +50,13 @@ export declare const Value: {
|
|
|
50
50
|
* @returns A function to remove the listener.
|
|
51
51
|
*/
|
|
52
52
|
on: <T>(value: Value<T>, listener: (value: T) => void) => (() => void);
|
|
53
|
+
/**
|
|
54
|
+
* Disposes of a value or a Signal.
|
|
55
|
+
* If the value is a Signal, it disposes of the Signal.
|
|
56
|
+
* If the value is not a Signal, it does nothing.
|
|
57
|
+
* @param value - The value or Signal instance to dispose of.
|
|
58
|
+
*/
|
|
59
|
+
dispose: <T>(value: Value<T>) => void;
|
|
53
60
|
};
|
|
54
61
|
/**
|
|
55
62
|
* Creates a computed signal that depends on other signals or literal values and updates when any of the dependencies change.
|