@tempots/dom 19.3.1 → 20.0.1
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/dom/dom-context.d.ts +0 -1
- package/dom/ssr.d.ts +0 -1
- package/index.cjs +1 -1
- package/index.d.ts +0 -1
- package/index.js +272 -293
- package/package.json +1 -1
- package/renderable/async.d.ts +0 -1
- package/renderable/attribute.d.ts +0 -1
- package/renderable/bind.d.ts +0 -1
- package/renderable/conjunction.d.ts +0 -1
- package/renderable/consumers.d.ts +0 -1
- package/renderable/domnode.d.ts +0 -1
- package/renderable/element.d.ts +0 -1
- package/renderable/empty.d.ts +0 -1
- package/renderable/ensure.d.ts +0 -1
- package/renderable/foreach.d.ts +0 -1
- package/renderable/fragment.d.ts +0 -1
- package/renderable/handler.d.ts +0 -1
- package/renderable/map-signal.d.ts +0 -1
- package/renderable/not-empty.d.ts +0 -1
- package/renderable/onctx.d.ts +0 -1
- package/renderable/oneof.d.ts +0 -1
- package/renderable/onmount.d.ts +0 -1
- package/renderable/onunmount.d.ts +0 -1
- package/renderable/portal.d.ts +0 -1
- package/renderable/providers.d.ts +0 -1
- package/renderable/render.d.ts +0 -1
- package/renderable/repeat.d.ts +0 -1
- package/renderable/style.d.ts +0 -1
- package/renderable/task.d.ts +0 -1
- package/renderable/text.d.ts +0 -1
- package/renderable/when.d.ts +0 -1
- package/std/signal-utils.d.ts +0 -1
- package/std/signal.d.ts +25 -4
- package/types/domain.d.ts +7 -1
- package/dom/animatable.d.ts +0 -79
- package/dom/handle-anchor-click.d.ts +0 -25
package/package.json
CHANGED
package/renderable/async.d.ts
CHANGED
package/renderable/bind.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Prop } from '../std/signal';
|
|
2
2
|
import { Renderable } from '../types/domain';
|
|
3
3
|
import { on } from './handler';
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Binds a `Date` property to an input element. The binding is two-way.
|
|
7
6
|
* Changes to the input element will update the property but will only be
|
package/renderable/domnode.d.ts
CHANGED
package/renderable/element.d.ts
CHANGED
package/renderable/empty.d.ts
CHANGED
package/renderable/ensure.d.ts
CHANGED
package/renderable/foreach.d.ts
CHANGED
package/renderable/fragment.d.ts
CHANGED
package/renderable/handler.d.ts
CHANGED
package/renderable/onctx.d.ts
CHANGED
package/renderable/oneof.d.ts
CHANGED
package/renderable/onmount.d.ts
CHANGED
package/renderable/portal.d.ts
CHANGED
package/renderable/render.d.ts
CHANGED
package/renderable/repeat.d.ts
CHANGED
package/renderable/style.d.ts
CHANGED
package/renderable/task.d.ts
CHANGED
package/renderable/text.d.ts
CHANGED
package/renderable/when.d.ts
CHANGED
package/std/signal-utils.d.ts
CHANGED
package/std/signal.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Value } from '../types/domain';
|
|
2
|
-
|
|
1
|
+
import { GetValueTypes, Value } from '../types/domain';
|
|
3
2
|
/**
|
|
4
3
|
* Represents any type of signal.
|
|
5
4
|
* It can be a Signal, Prop, or Computed.
|
|
@@ -190,10 +189,14 @@ export declare class Signal<T> {
|
|
|
190
189
|
*/
|
|
191
190
|
readonly at: <K extends keyof T>(key: K) => Signal<T[K]>;
|
|
192
191
|
/**
|
|
193
|
-
*
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
private _$;
|
|
195
|
+
/**
|
|
196
|
+
* Represents a collection of signals mapping to each key/field in the wrapped value.
|
|
194
197
|
* @typeParam T - The type of the signals.
|
|
195
198
|
*/
|
|
196
|
-
|
|
199
|
+
get $(): AtGetter<T>;
|
|
197
200
|
readonly filter: (fn: (value: T) => boolean, startValue?: T) => Computed<T>;
|
|
198
201
|
/**
|
|
199
202
|
* Returns a new Computed object that applies the provided mapping function to the value of this Signal,
|
|
@@ -419,6 +422,16 @@ export declare class Prop<T> extends Signal<T> {
|
|
|
419
422
|
* @public
|
|
420
423
|
*/
|
|
421
424
|
export declare const makeComputed: <T>(fn: () => T, dependencies: Array<AnySignal>, equals?: (a: T, b: T) => boolean) => Computed<T>;
|
|
425
|
+
/**
|
|
426
|
+
* Creates a computed signal that depends on other signals or literal values and updates when any of the dependencies change.
|
|
427
|
+
*
|
|
428
|
+
* @typeParam T - The type of the argument values.
|
|
429
|
+
* @param fn - The function that computes the value.
|
|
430
|
+
* @param equals - The equality function used to compare the previous and current computed values.
|
|
431
|
+
* @returns - The computed signal.
|
|
432
|
+
* @public
|
|
433
|
+
*/
|
|
434
|
+
export declare const makeComputedOf: <T extends Value<unknown>[]>(...args: T) => <O>(fn: (...args: GetValueTypes<T>) => O, equals?: (a: O, b: O) => boolean) => Computed<O>;
|
|
422
435
|
/**
|
|
423
436
|
* Executes the provided function `fn` whenever any of the signals in the `signals` array change.
|
|
424
437
|
* Returns a disposable object that can be used to stop the effect.
|
|
@@ -429,6 +442,14 @@ export declare const makeComputed: <T>(fn: () => T, dependencies: Array<AnySigna
|
|
|
429
442
|
* @public
|
|
430
443
|
*/
|
|
431
444
|
export declare const makeEffect: (fn: () => void, signals: Array<AnySignal>) => () => void;
|
|
445
|
+
/**
|
|
446
|
+
* Creates an effect that depends on other signals or literal values and updates when any of the dependencies change.
|
|
447
|
+
*
|
|
448
|
+
* @param args - The array of signals or literal values that the effect depends on.
|
|
449
|
+
* @returns A disposable object that can be used to stop the effect.
|
|
450
|
+
* @public
|
|
451
|
+
*/
|
|
452
|
+
export declare const makeEffectOf: <T extends Value<unknown>[]>(...args: T) => (fn: (...args: GetValueTypes<T>) => void) => void;
|
|
432
453
|
/**
|
|
433
454
|
* Creates a new Prop object with the specified value and equality function.
|
|
434
455
|
*
|
package/types/domain.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DOMContext } from '../dom/dom-context';
|
|
2
2
|
import { Signal } from '../std/signal';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* Represents a function that can be rendered in the DOM.
|
|
6
5
|
* @param ctx - The DOM context for rendering.
|
|
@@ -67,6 +66,13 @@ export type NValue<T> = Value<T> | Value<T | null> | Value<T | undefined> | Valu
|
|
|
67
66
|
* @public
|
|
68
67
|
*/
|
|
69
68
|
export type GetValueType<T> = T extends Signal<infer V> ? V : T;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the value types of a given array of Value types.
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export type GetValueTypes<T extends Value<unknown>[]> = {
|
|
74
|
+
[K in keyof T]: GetValueType<T[K]>;
|
|
75
|
+
};
|
|
70
76
|
/**
|
|
71
77
|
* Removes signals from a given object type and returns a new object type
|
|
72
78
|
* with only the non-signal properties.
|
package/dom/animatable.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
export type AnimatableProps = {
|
|
2
|
-
width?: number;
|
|
3
|
-
maxWidth?: number;
|
|
4
|
-
minWidth?: number;
|
|
5
|
-
height?: number;
|
|
6
|
-
maxHeight?: number;
|
|
7
|
-
minHeight?: number;
|
|
8
|
-
lineHeight?: number;
|
|
9
|
-
opacity?: number;
|
|
10
|
-
top?: number;
|
|
11
|
-
left?: number;
|
|
12
|
-
right?: number;
|
|
13
|
-
bottom?: number;
|
|
14
|
-
padding?: number;
|
|
15
|
-
paddingTop?: number;
|
|
16
|
-
paddingBottom?: number;
|
|
17
|
-
paddingLeft?: number;
|
|
18
|
-
paddingRight?: number;
|
|
19
|
-
margin?: number;
|
|
20
|
-
marginTop?: number;
|
|
21
|
-
marginBottom?: number;
|
|
22
|
-
marginLeft?: number;
|
|
23
|
-
marginRight?: number;
|
|
24
|
-
fontSize?: number;
|
|
25
|
-
letterSpacing?: number;
|
|
26
|
-
color?: string;
|
|
27
|
-
backgroundColor?: string;
|
|
28
|
-
borderColor?: string;
|
|
29
|
-
borderWidth?: number;
|
|
30
|
-
borderRadius?: number;
|
|
31
|
-
boxShadow?: string;
|
|
32
|
-
textShadow?: string;
|
|
33
|
-
outlineWidth?: number;
|
|
34
|
-
outlineColor?: string;
|
|
35
|
-
translateX?: number;
|
|
36
|
-
translateY?: number;
|
|
37
|
-
translateZ?: number;
|
|
38
|
-
rotateX?: number;
|
|
39
|
-
rotateY?: number;
|
|
40
|
-
rotateZ?: number;
|
|
41
|
-
scaleX?: number;
|
|
42
|
-
scaleY?: number;
|
|
43
|
-
scaleZ?: number;
|
|
44
|
-
skewX?: number;
|
|
45
|
-
skewY?: number;
|
|
46
|
-
grayScale?: number;
|
|
47
|
-
sepia?: number;
|
|
48
|
-
saturate?: number;
|
|
49
|
-
hueRotate?: number;
|
|
50
|
-
invert?: number;
|
|
51
|
-
brightness?: number;
|
|
52
|
-
contrast?: number;
|
|
53
|
-
blur?: number;
|
|
54
|
-
};
|
|
55
|
-
export type ColorChannels = [
|
|
56
|
-
number,
|
|
57
|
-
number,
|
|
58
|
-
number,
|
|
59
|
-
number,
|
|
60
|
-
'rgba' | 'hex' | 'hsla'
|
|
61
|
-
];
|
|
62
|
-
export declare const parseColorChannels: (color: string) => ColorChannels;
|
|
63
|
-
export interface BoxShadow {
|
|
64
|
-
inset: boolean;
|
|
65
|
-
x: number;
|
|
66
|
-
y: number;
|
|
67
|
-
blur: number;
|
|
68
|
-
spread: number;
|
|
69
|
-
color: string;
|
|
70
|
-
}
|
|
71
|
-
export declare const colorChannelsToString: (channels: ColorChannels) => string;
|
|
72
|
-
export declare const interpolateColor: (startColor: string, endColor: string) => ((t: number) => string);
|
|
73
|
-
export declare const interpolateShadow: (startShadow: string, endShadow: string) => ((t: number) => string);
|
|
74
|
-
export declare const getComputedAnimatableProp: (styles: CSSStyleDeclaration, key: keyof AnimatableProps) => AnimatableProps[typeof key];
|
|
75
|
-
export declare const getComputedAnimatable: (el: HTMLElement, styles: AnimatableProps) => AnimatableProps;
|
|
76
|
-
export declare const applyAnimatableProp: (el: HTMLElement, key: keyof AnimatableProps, value: AnimatableProps[typeof key]) => void;
|
|
77
|
-
export declare const applyInterpolatedAnimatableProp: (el: HTMLElement, key: keyof AnimatableProps, from: AnimatableProps[typeof key], to: AnimatableProps[typeof key], progress: number) => void;
|
|
78
|
-
export declare const applyInterpolatedAnimatable: (el: HTMLElement, from: AnimatableProps, to: AnimatableProps, progress: number) => void;
|
|
79
|
-
export declare const applyAnimatable: (el: HTMLElement, styles: AnimatableProps) => void;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for handling anchor click events.
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export type HandleAnchorClickOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* A boolean indicating whether to check the anchor's href for a file extension.
|
|
8
|
-
*/
|
|
9
|
-
checkExtension?: boolean | string[];
|
|
10
|
-
/**
|
|
11
|
-
* A boolean indicating whether to check if the anchor's href points to an external URL.
|
|
12
|
-
*/
|
|
13
|
-
checkExternalUrl?: boolean;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Handles anchor click events, optionally checking for external URLs and file extensions.
|
|
17
|
-
*
|
|
18
|
-
* @param callback - A function that is called when the anchor click should be handled. The function should return a boolean indicating whether the default anchor click behavior should be prevented.
|
|
19
|
-
* @param options - An optional object with the following properties:
|
|
20
|
-
* - `checkExtension`: A boolean indicating whether to check the anchor's href for a file extension. Defaults to `true`.
|
|
21
|
-
* - `checkExternalUrl`: A boolean indicating whether to check if the anchor's href points to an external URL. Defaults to `true`.
|
|
22
|
-
* @returns A function that handles the anchor click event, calling the provided callback and preventing the default behavior if the callback returns `true`.
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export declare const handleAnchorClick: (callback: () => boolean, { checkExtension, checkExternalUrl, }?: HandleAnchorClickOptions) => (e: MouseEvent) => void;
|