@tempots/dom 37.0.3 → 37.1.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/dom/inertia.d.ts +39 -0
- package/dom/is-input-focused.d.ts +11 -0
- package/dom/pinch-zoom.d.ts +39 -0
- package/dom/raf-loop.d.ts +30 -0
- package/dom/reduced-motion.d.ts +30 -0
- package/dom/tween.d.ts +44 -0
- package/index.cjs +1 -1
- package/index.d.ts +11 -2
- package/index.js +934 -722
- package/package.json +3 -3
- package/renderable/attribute.d.ts +7 -7
- package/renderable/inertia.d.ts +13 -0
- package/renderable/pinch-zoom.d.ts +13 -0
- package/renderable/transition-keyed-foreach.d.ts +37 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempots/dom",
|
|
3
|
-
"version": "37.0
|
|
3
|
+
"version": "37.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./index.cjs",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@tempots/core": "^3.
|
|
19
|
-
"@tempots/render": "^0.0.
|
|
18
|
+
"@tempots/core": "^3.1.0",
|
|
19
|
+
"@tempots/render": "^0.0.5"
|
|
20
20
|
},
|
|
21
21
|
"description": "Fully-typed frontend framework alternative to React and Angular",
|
|
22
22
|
"keywords": [
|
|
@@ -191,7 +191,7 @@ export declare const attr: {
|
|
|
191
191
|
/**
|
|
192
192
|
* Creates a renderable for a data attribute with the specified name and value.
|
|
193
193
|
*
|
|
194
|
-
* This is
|
|
194
|
+
* This is an alias for `dataAttr(name, value)` that accepts `unknown` values.
|
|
195
195
|
*
|
|
196
196
|
* @param name - The name of the data attribute (without the 'data-' prefix).
|
|
197
197
|
* @param value - The value of the attribute (can be a literal or Signal).
|
|
@@ -206,20 +206,20 @@ export declare const attr: {
|
|
|
206
206
|
*/
|
|
207
207
|
export declare const DataAttr: (name: string, value: unknown) => Renderable;
|
|
208
208
|
/**
|
|
209
|
-
*
|
|
210
|
-
* or `Signal<string>` can be passed as a value.
|
|
209
|
+
* Creates a renderable for a `data-` attribute with the specified name and value.
|
|
211
210
|
*
|
|
211
|
+
* @param name - The name of the data attribute (without the 'data-' prefix).
|
|
212
|
+
* @param value - The value of the attribute (can be a literal or Signal).
|
|
213
|
+
* @returns A renderable that sets the data attribute.
|
|
212
214
|
* @example
|
|
213
215
|
* ```ts
|
|
214
216
|
* const button = html.button(
|
|
215
|
-
* dataAttr
|
|
217
|
+
* dataAttr('myinfo', 'something'), // maps to the `data-myinfo` attribute
|
|
216
218
|
* )
|
|
217
219
|
* ```
|
|
218
220
|
* @public
|
|
219
221
|
*/
|
|
220
|
-
export declare const dataAttr:
|
|
221
|
-
[x: string]: (value: Value<string>) => Renderable;
|
|
222
|
-
};
|
|
222
|
+
export declare const dataAttr: (name: string, value: Value<string>) => Renderable;
|
|
223
223
|
/**
|
|
224
224
|
* Creates a renderable for an ARIA attribute with the specified name and value.
|
|
225
225
|
*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Renderable } from '../types/domain';
|
|
2
|
+
import { InertiaConfig } from '../dom/inertia';
|
|
3
|
+
/**
|
|
4
|
+
* A Tempo renderable that attaches inertia-based pointer drag handlers to
|
|
5
|
+
* the parent element. On pointer up, the surface continues scrolling with
|
|
6
|
+
* exponential velocity decay.
|
|
7
|
+
*
|
|
8
|
+
* @param onDelta - Called with `(dx, dy)` deltas each frame during drag and decay.
|
|
9
|
+
* @param config - Optional friction and threshold settings.
|
|
10
|
+
* @returns A renderable.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const Inertia: (onDelta: (dx: number, dy: number) => void, config?: InertiaConfig) => Renderable;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Prop } from '@tempots/core';
|
|
2
|
+
import { Renderable } from '../types/domain';
|
|
3
|
+
import { PinchZoomState, PinchZoomConfig } from '../dom/pinch-zoom';
|
|
4
|
+
/**
|
|
5
|
+
* A Tempo renderable that attaches pinch-to-zoom touch handlers to the
|
|
6
|
+
* parent element. The handlers are automatically removed on disposal.
|
|
7
|
+
*
|
|
8
|
+
* @param state - A `Prop` holding the current zoom/pan state.
|
|
9
|
+
* @param config - Optional scale limits.
|
|
10
|
+
* @returns A renderable.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const PinchZoom: (state: Prop<PinchZoomState>, config?: PinchZoomConfig) => Renderable;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Signal, KeyedPosition } from '@tempots/core';
|
|
2
|
+
import { Renderable, TNode } from '../types/domain';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for enter/exit transitions.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type TransitionConfig = {
|
|
8
|
+
/** CSS class added to items during their exit animation. */
|
|
9
|
+
readonly exitClass?: string;
|
|
10
|
+
/** Duration in milliseconds before an exiting item is removed from the DOM. */
|
|
11
|
+
readonly exitDuration?: number;
|
|
12
|
+
/** CSS class added to items during their enter animation. */
|
|
13
|
+
readonly enterClass?: string;
|
|
14
|
+
/** Duration in milliseconds before the enter class is removed. */
|
|
15
|
+
readonly enterDuration?: number;
|
|
16
|
+
/**
|
|
17
|
+
* When `true`, listens for `animationend` / `transitionend` events to
|
|
18
|
+
* determine when to remove exiting items, instead of using `exitDuration`.
|
|
19
|
+
*/
|
|
20
|
+
readonly useAnimationEvents?: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A drop-in replacement for `KeyedForEach` that supports enter and exit
|
|
24
|
+
* animations by delaying DOM removal. Items that leave the list are kept in
|
|
25
|
+
* the DOM with an `isExiting` signal set to `true`, allowing CSS transitions
|
|
26
|
+
* or class-based animations to play before removal.
|
|
27
|
+
*
|
|
28
|
+
* @typeParam T - The type of items in the list.
|
|
29
|
+
* @param items - A signal of the current item array.
|
|
30
|
+
* @param key - A function that returns a unique key for each item.
|
|
31
|
+
* @param renderFn - Renders each item. Receives the item signal, keyed position,
|
|
32
|
+
* and an `isExiting` signal.
|
|
33
|
+
* @param config - Transition configuration (classes, durations).
|
|
34
|
+
* @returns A renderable.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export declare function TransitionKeyedForEach<T>(items: Signal<T[]>, key: (item: T) => string | number, renderFn: (item: Signal<T>, position: KeyedPosition, isExiting: Signal<boolean>) => TNode, config: TransitionConfig): Renderable;
|