element-vir 26.11.1 → 26.11.3
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.
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { type Overwrite } from '@augment-vir/common';
|
|
2
2
|
import { CallbackObservable, type AsyncValue, type CallbackObservableInit } from 'observavir';
|
|
3
3
|
export type { AsyncValue } from 'observavir';
|
|
4
|
-
/**
|
|
5
|
-
* The current state of an {@link AsyncProp}'s value.
|
|
6
|
-
*
|
|
7
|
-
* @category Internal
|
|
8
|
-
*/
|
|
9
|
-
export declare enum AsyncValueState {
|
|
10
|
-
/** The `.value` Promise has been rejected. */
|
|
11
|
-
Rejected = "rejected",
|
|
12
|
-
/** The `.value` Promise has not settled yet. */
|
|
13
|
-
Waiting = "waiting",
|
|
14
|
-
/** The `.value` Promise has been resolved into an awaited value. */
|
|
15
|
-
Resolved = "resolved"
|
|
16
|
-
}
|
|
17
4
|
/**
|
|
18
5
|
* Class for constructing async props. Do not use this directly as its internal types won't be
|
|
19
6
|
* inferred correctly. Instead use {@link asyncProp} an async prop or {@link AsyncProp} for types.
|
|
@@ -21,15 +8,6 @@ export declare enum AsyncValueState {
|
|
|
21
8
|
* @category Internal
|
|
22
9
|
*/
|
|
23
10
|
export declare class InternalAsyncPropClass<Value, Params> extends CallbackObservable<Value, Params> {
|
|
24
|
-
/**
|
|
25
|
-
* The current `.value` if it has settled (into either a resolved value or an Error), or
|
|
26
|
-
* `undefined` if it has not.
|
|
27
|
-
*/
|
|
28
|
-
get settledValue(): Exclude<typeof this.value, Promise<any>> | undefined;
|
|
29
|
-
/** The current `.value` as a promise or resolved value. If `.value` is an error, it'll throw. */
|
|
30
|
-
get promiseValue(): Promise<Value>;
|
|
31
|
-
/** The state of the current `.value`. */
|
|
32
|
-
get state(): AsyncValueState;
|
|
33
11
|
/**
|
|
34
12
|
* Checks if the current `.value` has resolved (meaning the Promise has settled and it was not
|
|
35
13
|
* rejected). This type guards the current instance's `.value` property.
|
|
@@ -74,7 +52,7 @@ export declare class InternalAsyncPropClass<Value, Params> extends CallbackObser
|
|
|
74
52
|
*/
|
|
75
53
|
export type AsyncProp<Value, Params> = Omit<InternalAsyncPropClass<Value, Params>,
|
|
76
54
|
/** Hide these properties to make the `AsyncProp` interface much simpler. */
|
|
77
|
-
'dispatch' | 'equalityCheck' | 'getListenerCount' | 'updateCallback' | 'removeListener' | 'removeAllListeners' | 'listenToEvent' | 'listen'>;
|
|
55
|
+
'dispatch' | 'equalityCheck' | 'getListenerCount' | 'updateCallback' | 'removeListener' | 'removeAllListeners' | 'listenToEvent' | 'listen' | 'resolvedValue'>;
|
|
78
56
|
/**
|
|
79
57
|
* Create an async prop for a declarative element's state.
|
|
80
58
|
*
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import { CallbackObservable } from 'observavir';
|
|
2
|
-
/**
|
|
3
|
-
* The current state of an {@link AsyncProp}'s value.
|
|
4
|
-
*
|
|
5
|
-
* @category Internal
|
|
6
|
-
*/
|
|
7
|
-
export var AsyncValueState;
|
|
8
|
-
(function (AsyncValueState) {
|
|
9
|
-
/** The `.value` Promise has been rejected. */
|
|
10
|
-
AsyncValueState["Rejected"] = "rejected";
|
|
11
|
-
/** The `.value` Promise has not settled yet. */
|
|
12
|
-
AsyncValueState["Waiting"] = "waiting";
|
|
13
|
-
/** The `.value` Promise has been resolved into an awaited value. */
|
|
14
|
-
AsyncValueState["Resolved"] = "resolved";
|
|
15
|
-
})(AsyncValueState || (AsyncValueState = {}));
|
|
16
2
|
/**
|
|
17
3
|
* Class for constructing async props. Do not use this directly as its internal types won't be
|
|
18
4
|
* inferred correctly. Instead use {@link asyncProp} an async prop or {@link AsyncProp} for types.
|
|
@@ -20,42 +6,6 @@ export var AsyncValueState;
|
|
|
20
6
|
* @category Internal
|
|
21
7
|
*/
|
|
22
8
|
export class InternalAsyncPropClass extends CallbackObservable {
|
|
23
|
-
/**
|
|
24
|
-
* The current `.value` if it has settled (into either a resolved value or an Error), or
|
|
25
|
-
* `undefined` if it has not.
|
|
26
|
-
*/
|
|
27
|
-
get settledValue() {
|
|
28
|
-
if (this.isSettled()) {
|
|
29
|
-
return this.value;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/** The current `.value` as a promise or resolved value. If `.value` is an error, it'll throw. */
|
|
36
|
-
get promiseValue() {
|
|
37
|
-
if (this.isError()) {
|
|
38
|
-
return Promise.reject(this.value);
|
|
39
|
-
}
|
|
40
|
-
else if (this.isWaiting()) {
|
|
41
|
-
return this.value;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return Promise.resolve(this.value);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/** The state of the current `.value`. */
|
|
48
|
-
get state() {
|
|
49
|
-
if (this.isResolved()) {
|
|
50
|
-
return AsyncValueState.Resolved;
|
|
51
|
-
}
|
|
52
|
-
else if (this.isError()) {
|
|
53
|
-
return AsyncValueState.Rejected;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
return AsyncValueState.Waiting;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
9
|
/**
|
|
60
10
|
* Checks if the current `.value` has resolved (meaning the Promise has settled and it was not
|
|
61
11
|
* rejected). This type guards the current instance's `.value` property.
|
|
@@ -17,7 +17,7 @@ export type DirectiveOutput = EmptyObject;
|
|
|
17
17
|
*
|
|
18
18
|
* @category Internal
|
|
19
19
|
*/
|
|
20
|
-
export type HtmlInterpolation = null | undefined | string | number | boolean | bigint | CSSResult | Readonly<CSSResult> | Element | Readonly<Element> | TemplateResult | Readonly<TemplateResult> | MinimalElementDefinition | Readonly<MinimalElementDefinition> | MinimalDefinitionWithInputs | Readonly<MinimalDefinitionWithInputs> | DeclarativeElementDefinition | Readonly<DeclarativeElementDefinition> | DirectiveOutput | Readonly<DirectiveOutput> | AnyFunction | typeof nothing | HtmlInterpolation[] | ReadonlyArray<HtmlInterpolation
|
|
20
|
+
export type HtmlInterpolation = null | undefined | string | number | boolean | bigint | CSSResult | Readonly<CSSResult> | Element | Readonly<Element> | TemplateResult | Readonly<TemplateResult> | MinimalElementDefinition | Readonly<MinimalElementDefinition> | MinimalDefinitionWithInputs | Readonly<MinimalDefinitionWithInputs> | DeclarativeElementDefinition | Readonly<DeclarativeElementDefinition> | DirectiveOutput | Readonly<DirectiveOutput> | AnyFunction | typeof nothing | HtmlInterpolation[] | ReadonlyArray<HtmlInterpolation> | Iterable<HtmlInterpolation> | Readonly<Iterable<HtmlInterpolation>>;
|
|
21
21
|
/**
|
|
22
22
|
* This type ensures that interpolated element definitions are not missing their inputs, when inputs
|
|
23
23
|
* are required.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "element-vir",
|
|
3
|
-
"version": "26.11.
|
|
3
|
+
"version": "26.11.3",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"custom",
|
|
6
6
|
"web",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"test:docs": "virmator docs check"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@augment-vir/assert": "^31.
|
|
43
|
-
"@augment-vir/common": "^31.
|
|
42
|
+
"@augment-vir/assert": "^31.51.1",
|
|
43
|
+
"@augment-vir/common": "^31.51.1",
|
|
44
44
|
"date-vir": "^8.0.0",
|
|
45
45
|
"lit": "^3.3.1",
|
|
46
46
|
"lit-css-vars": "^3.0.11",
|
|
47
47
|
"lit-html": "^3.3.1",
|
|
48
|
-
"object-shape-tester": "^6.9.
|
|
49
|
-
"observavir": "^2.
|
|
48
|
+
"object-shape-tester": "^6.9.3",
|
|
49
|
+
"observavir": "^2.2.0",
|
|
50
50
|
"typed-event-target": "^4.1.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@augment-vir/test": "^31.
|
|
54
|
-
"@augment-vir/web": "^31.
|
|
53
|
+
"@augment-vir/test": "^31.51.1",
|
|
54
|
+
"@augment-vir/web": "^31.51.1",
|
|
55
55
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
56
56
|
"@web/test-runner": "^0.20.2",
|
|
57
57
|
"@web/test-runner-commands": "^0.9.0",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"html-spec-tags": "^2.2.3",
|
|
61
61
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
62
62
|
"markdown-code-example-inserter": "^3.0.3",
|
|
63
|
-
"type-fest": "^5.
|
|
63
|
+
"type-fest": "^5.2.0",
|
|
64
64
|
"typedoc": "^0.28.14",
|
|
65
65
|
"typescript": "5.9.3",
|
|
66
|
-
"vite": "^7.
|
|
66
|
+
"vite": "^7.2.4",
|
|
67
67
|
"vite-tsconfig-paths": "^5.1.4"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|