@tempots/dom 34.3.0 → 35.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/README.md +2 -0
- package/index.cjs +1 -1
- package/index.js +420 -408
- package/package.json +1 -4
- package/renderable/iframe.d.ts +3 -3
- package/renderable/provider.d.ts +4 -4
- package/types/domain.d.ts +6 -4
- package/types/html-attributes.d.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempots/dom",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "35.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,8 +35,5 @@
|
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
37
37
|
"url": "git+https://github.com/fponticelli/tempots.git"
|
|
38
|
-
},
|
|
39
|
-
"peerDependencies": {
|
|
40
|
-
"@tempots/core": "^1.2.0"
|
|
41
38
|
}
|
|
42
39
|
}
|
package/renderable/iframe.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TNode, Value } from '../types/domain';
|
|
1
|
+
import { SplitValue, TNode, Value } from '../types/domain';
|
|
2
2
|
export type ReferrerPolicy = 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
|
3
3
|
export interface IFrameOptions {
|
|
4
4
|
/**
|
|
@@ -12,11 +12,11 @@ export interface IFrameOptions {
|
|
|
12
12
|
/**
|
|
13
13
|
* The width of the iframe.
|
|
14
14
|
*/
|
|
15
|
-
width?:
|
|
15
|
+
width?: SplitValue<string | number>;
|
|
16
16
|
/**
|
|
17
17
|
* The height of the iframe.
|
|
18
18
|
*/
|
|
19
|
-
height?:
|
|
19
|
+
height?: SplitValue<string | number>;
|
|
20
20
|
/**
|
|
21
21
|
* The sandbox attribute for the iframe.
|
|
22
22
|
*/
|
package/renderable/provider.d.ts
CHANGED
|
@@ -96,8 +96,8 @@ export declare const WithProvider: (fn: (opts: ProviderOptions) => TNode | void)
|
|
|
96
96
|
* )
|
|
97
97
|
* ```
|
|
98
98
|
*
|
|
99
|
-
* @
|
|
100
|
-
* @
|
|
99
|
+
* @typeParam T - The type of value provided by the provider
|
|
100
|
+
* @typeParam O - The type of options passed to the provider
|
|
101
101
|
* @param provider - The provider definition containing mark and create function
|
|
102
102
|
* @param options - Options to pass to the provider's create function
|
|
103
103
|
* @param child - Function that returns the child components that can access the provider
|
|
@@ -153,7 +153,7 @@ export declare const Provide: <T, O>(provider: Provider<T, O>, options: O, child
|
|
|
153
153
|
* )
|
|
154
154
|
* ```
|
|
155
155
|
*
|
|
156
|
-
* @
|
|
156
|
+
* @typeParam T - The type of value provided by the provider
|
|
157
157
|
* @param provider - The provider to consume (must be available in parent components)
|
|
158
158
|
* @param child - Function that receives the provider value and returns content to render
|
|
159
159
|
* @returns A renderable that consumes the provider and renders the child content
|
|
@@ -226,7 +226,7 @@ export declare const Use: <T>(provider: Provider<T>, child: (provider: T) => TNo
|
|
|
226
226
|
* )
|
|
227
227
|
* ```
|
|
228
228
|
*
|
|
229
|
-
* @
|
|
229
|
+
* @typeParam T - Tuple type representing the types of all providers
|
|
230
230
|
* @param providers - Variable number of providers to consume
|
|
231
231
|
* @returns Function that takes a child function and returns a renderable
|
|
232
232
|
* @throws {ProviderNotFoundError} When any of the providers is not found in the component tree
|
package/types/domain.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReadSignal } from '../../../tempots-core/dist/signal';
|
|
1
2
|
import { DOMContext } from '../dom/dom-context';
|
|
2
3
|
import { AnySignal, Computed, Prop, Signal, Value, ValueType, BaseValueType, ValueTypes, Values, RemoveSignals, Nil, Clear, ProviderMark, makeProviderMark, Renderable as CoreRenderable } from '@tempots/core';
|
|
3
4
|
export type { Clear, ProviderMark, ValueType, BaseValueType, ValueTypes, Values, RemoveSignals, Nil, AnySignal, };
|
|
@@ -55,7 +56,7 @@ export declare const DOM_RENDERABLE_TYPE: unique symbol;
|
|
|
55
56
|
* }
|
|
56
57
|
* ```
|
|
57
58
|
*
|
|
58
|
-
* @
|
|
59
|
+
* @typeParam CTX - The type of DOMContext (defaults to DOMContext)
|
|
59
60
|
* @public
|
|
60
61
|
*/
|
|
61
62
|
export type Renderable<CTX extends DOMContext = DOMContext> = CoreRenderable<CTX, typeof DOM_RENDERABLE_TYPE>;
|
|
@@ -124,10 +125,10 @@ export declare const domRenderable: <CTX extends DOMContext = DOMContext>(render
|
|
|
124
125
|
* }
|
|
125
126
|
* ```
|
|
126
127
|
*
|
|
127
|
-
* @
|
|
128
|
+
* @typeParam CTX - The type of DOMContext (defaults to DOMContext)
|
|
128
129
|
* @public
|
|
129
130
|
*/
|
|
130
|
-
export type TNode<CTX extends DOMContext = DOMContext> = Renderable<CTX> |
|
|
131
|
+
export type TNode<CTX extends DOMContext = DOMContext> = Renderable<CTX> | string | ReadSignal<string> | undefined | null | Renderable<CTX>[];
|
|
131
132
|
/**
|
|
132
133
|
* Represents a collection of providers.
|
|
133
134
|
* The keys of the record are ProviderMark types, and the values are of unknown type.
|
|
@@ -156,6 +157,7 @@ export type Size = {
|
|
|
156
157
|
* @typeParam T - The type of the value.
|
|
157
158
|
* @public
|
|
158
159
|
*/
|
|
159
|
-
export type NValue<T> = Value<NonNullable<T>> |
|
|
160
|
+
export type NValue<T> = Value<NonNullable<T>> | ReadSignal<T> | ReadSignal<T | null> | ReadSignal<T | undefined> | ReadSignal<T | null | undefined> | null | undefined;
|
|
160
161
|
type TupleToUnion<T extends unknown[]> = T[number];
|
|
161
162
|
export type SplitNValue<T> = (T extends unknown ? TupleToUnion<NValue<T>[]> : never) | NValue<T>;
|
|
163
|
+
export type SplitValue<T> = (T extends unknown ? TupleToUnion<Value<T>[]> : never) | Value<T>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents the HTML attributes that can be used in an HTML element.
|
|
3
3
|
*
|
|
4
|
+
* **Security Warning:** Some properties like `innerHTML` and `outerHTML` can introduce
|
|
5
|
+
* Cross-Site Scripting (XSS) vulnerabilities if used with untrusted user input.
|
|
6
|
+
* Always sanitize user-provided content before using these properties.
|
|
7
|
+
*
|
|
4
8
|
* @public
|
|
5
9
|
*/
|
|
6
10
|
export type HTMLAttributes = {
|
|
@@ -148,7 +152,16 @@ export type HTMLAttributes = {
|
|
|
148
152
|
wrap: string;
|
|
149
153
|
textContent: string;
|
|
150
154
|
innerText: string;
|
|
155
|
+
/**
|
|
156
|
+
* **⚠️ XSS Warning:** Setting innerHTML with untrusted user input can lead to
|
|
157
|
+
* Cross-Site Scripting (XSS) attacks. Always sanitize content before use.
|
|
158
|
+
* Consider using `textContent` or `innerText` for plain text content instead.
|
|
159
|
+
*/
|
|
151
160
|
innerHTML: string;
|
|
161
|
+
/**
|
|
162
|
+
* **⚠️ XSS Warning:** Setting outerHTML with untrusted user input can lead to
|
|
163
|
+
* Cross-Site Scripting (XSS) attacks. Always sanitize content before use.
|
|
164
|
+
*/
|
|
152
165
|
outerHTML: string;
|
|
153
166
|
};
|
|
154
167
|
/**
|