@tempots/dom 31.5.0 → 31.6.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.js +399 -412
- package/package.json +1 -1
- package/renderable/attribute.d.ts +9 -0
- package/renderable/utils.d.ts +30 -0
- package/types/html-attributes.d.ts +1 -0
package/package.json
CHANGED
|
@@ -119,6 +119,7 @@ export declare const attr: {
|
|
|
119
119
|
popovertargetaction: (value: SplitNValue<"toggle" | "hide" | "show">) => Renderable;
|
|
120
120
|
poster: (value: SplitNValue<string>) => Renderable;
|
|
121
121
|
preload: (value: SplitNValue<string>) => Renderable;
|
|
122
|
+
property: (value: SplitNValue<string>) => Renderable;
|
|
122
123
|
radiogroup: (value: SplitNValue<string>) => Renderable;
|
|
123
124
|
readonly: (value: SplitNValue<boolean>) => Renderable;
|
|
124
125
|
referrerpolicy: (value: SplitNValue<"no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url">) => Renderable;
|
|
@@ -161,6 +162,8 @@ export declare const attr: {
|
|
|
161
162
|
innerText: (value: SplitNValue<string>) => Renderable;
|
|
162
163
|
innerHTML: (value: SplitNValue<string>) => Renderable;
|
|
163
164
|
outerHTML: (value: SplitNValue<string>) => Renderable;
|
|
165
|
+
} & {
|
|
166
|
+
set: (name: string, value: SplitNValue<string>) => Renderable;
|
|
164
167
|
};
|
|
165
168
|
/**
|
|
166
169
|
* The `data` object allows to create any `data-` attributes. Either a literal value
|
|
@@ -176,6 +179,8 @@ export declare const attr: {
|
|
|
176
179
|
*/
|
|
177
180
|
export declare const dataAttr: {
|
|
178
181
|
[x: string]: (value: Value<string>) => Renderable;
|
|
182
|
+
} & {
|
|
183
|
+
set: (name: string, value: Value<string>) => Renderable;
|
|
179
184
|
};
|
|
180
185
|
/**
|
|
181
186
|
* An object that provides a convenient way to create mountable attributes for ARIA properties.
|
|
@@ -246,6 +251,8 @@ export declare const aria: {
|
|
|
246
251
|
valuemin: (value: SplitNValue<number>) => Renderable;
|
|
247
252
|
valuenow: (value: SplitNValue<number>) => Renderable;
|
|
248
253
|
valuetext: (value: SplitNValue<string>) => Renderable;
|
|
254
|
+
} & {
|
|
255
|
+
set: (name: string, value: Value<string>) => Renderable;
|
|
249
256
|
};
|
|
250
257
|
/**
|
|
251
258
|
* An object that provides a convenient way to create mountable attributes for
|
|
@@ -535,6 +542,8 @@ export declare const svgAttr: {
|
|
|
535
542
|
yChannelSelector: (value: SplitNValue<"R" | "G" | "B" | "A">) => Renderable;
|
|
536
543
|
z: (value: SplitNValue<string | number>) => Renderable;
|
|
537
544
|
zoomAndPan: (value: SplitNValue<"disable" | "magnify">) => Renderable;
|
|
545
|
+
} & {
|
|
546
|
+
set: (name: string, value: Value<string>) => Renderable;
|
|
538
547
|
};
|
|
539
548
|
/**
|
|
540
549
|
* An object that provides attribute functions for MathML tags.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Clear, TNode } from '../types/domain';
|
|
2
|
+
import { DOMContext } from '../dom/dom-context';
|
|
3
|
+
import { Signal } from '../std/signal';
|
|
4
|
+
import { Value } from '../std/value';
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to handle a value that could be either a Signal or a static value.
|
|
7
|
+
* Delegates to the appropriate handler based on whether the value is a Signal.
|
|
8
|
+
*
|
|
9
|
+
* @param value - The value to check (could be Signal<T> or T)
|
|
10
|
+
* @param onSignal - Handler function to call if value is a Signal
|
|
11
|
+
* @param onStatic - Handler function to call if value is static
|
|
12
|
+
* @returns The result from the appropriate handler
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const handleValueOrSignal: <T, R>(value: Value<T>, onSignal: (signal: Signal<T>) => R, onStatic: (literal: T) => R) => R;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a reactive renderable that updates when a signal changes.
|
|
18
|
+
* This helper consolidates the common pattern of:
|
|
19
|
+
* - Creating a new context reference
|
|
20
|
+
* - Setting up a signal listener that re-renders on changes
|
|
21
|
+
* - Properly cleaning up the old render before creating a new one
|
|
22
|
+
* - Disposing the signal listener and context on cleanup
|
|
23
|
+
*
|
|
24
|
+
* @param ctx - The parent DOM context
|
|
25
|
+
* @param signal - The signal to watch for changes
|
|
26
|
+
* @param render - Function that takes the signal value and returns content to render
|
|
27
|
+
* @returns A Clear function that cleans up the reactive renderable
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare const createReactiveRenderable: <T>(ctx: DOMContext, signal: Signal<T>, render: (value: T) => TNode) => Clear;
|
|
@@ -107,6 +107,7 @@ export type HTMLAttributes = {
|
|
|
107
107
|
popovertargetaction: 'hide' | 'show' | 'toggle';
|
|
108
108
|
poster: string;
|
|
109
109
|
preload: string;
|
|
110
|
+
property: string;
|
|
110
111
|
radiogroup: string;
|
|
111
112
|
readonly: boolean;
|
|
112
113
|
referrerpolicy: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|