@inglorious/web 6.6.2 → 6.7.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/package.json +6 -3
- package/types/directives/choose.d.ts +1 -1
- package/types/directives/class-map.d.ts +1 -1
- package/types/directives/ref.d.ts +1 -1
- package/types/directives/repeat.d.ts +1 -1
- package/types/directives/style-map.d.ts +1 -1
- package/types/directives/unsafe-html.d.ts +1 -1
- package/types/directives/when.d.ts +1 -1
- package/types/form.d.ts +2 -2
- package/types/mount.d.ts +29 -19
- package/types/router.d.ts +2 -2
- package/types/sensors/compass.d.ts +3 -3
- package/types/sensors/element-size.d.ts +3 -3
- package/types/sensors/geolocation.d.ts +3 -3
- package/types/sensors/media-query.d.ts +3 -3
- package/types/sensors/network-status.d.ts +3 -3
- package/types/sensors/page-visibility.d.ts +3 -3
- package/types/static.d.ts +1 -1
- package/types/test.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/web",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "A new web framework that leverages the power of the Inglorious Store combined with the performance and simplicity of lit-html.",
|
|
5
5
|
"author": "Matteo Antony Mistretta <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"contributors": [
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"import": "./src/static.js"
|
|
92
92
|
},
|
|
93
93
|
"./test": {
|
|
94
|
+
"types": "./types/test.d.ts",
|
|
94
95
|
"import": "./src/test.js"
|
|
95
96
|
}
|
|
96
97
|
},
|
|
@@ -109,11 +110,12 @@
|
|
|
109
110
|
"lit-html": "^3.3.3"
|
|
110
111
|
},
|
|
111
112
|
"peerDependencies": {
|
|
112
|
-
"@inglorious/store": "11.0
|
|
113
|
+
"@inglorious/store": "11.1.0"
|
|
113
114
|
},
|
|
114
115
|
"devDependencies": {
|
|
115
116
|
"@inglorious/eslint-config": "1.1.4",
|
|
116
117
|
"prettier": "^3.9.6",
|
|
118
|
+
"typescript": "~7.0.2",
|
|
117
119
|
"vitest": "^5.0.0"
|
|
118
120
|
},
|
|
119
121
|
"engines": {
|
|
@@ -123,6 +125,7 @@
|
|
|
123
125
|
"format": "prettier --write .",
|
|
124
126
|
"lint": "eslint .",
|
|
125
127
|
"test:watch": "vitest",
|
|
126
|
-
"test": "vitest run"
|
|
128
|
+
"test": "vitest run && tsc -p type-tests",
|
|
129
|
+
"test:types": "tsc -p type-tests"
|
|
127
130
|
}
|
|
128
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { choose } from "lit-html/directives/choose"
|
|
1
|
+
export { choose } from "lit-html/directives/choose.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { classMap } from "lit-html/directives/class-map"
|
|
1
|
+
export { classMap } from "lit-html/directives/class-map.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createRef, ref } from "lit-html/directives/ref"
|
|
1
|
+
export { createRef, ref } from "lit-html/directives/ref.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { repeat } from "lit-html/directives/repeat"
|
|
1
|
+
export { repeat } from "lit-html/directives/repeat.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { styleMap } from "lit-html/directives/style-map"
|
|
1
|
+
export { styleMap } from "lit-html/directives/style-map.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { unsafeHTML } from "lit-html/directives/unsafe-html"
|
|
1
|
+
export { unsafeHTML } from "lit-html/directives/unsafe-html.js"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { when } from "lit-html/directives/when"
|
|
1
|
+
export { when } from "lit-html/directives/when.js"
|
package/types/form.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type FormTouched<T> = T extends (infer U)[]
|
|
|
31
31
|
*/
|
|
32
32
|
export interface FormEntity<T extends FormValues = FormValues> {
|
|
33
33
|
/** A unique identifier for the form entity. */
|
|
34
|
-
id
|
|
34
|
+
id?: string
|
|
35
35
|
/** The initial values of the form, used for resetting. */
|
|
36
36
|
initialValues: T
|
|
37
37
|
/** The current values of the form fields. */
|
|
@@ -191,7 +191,7 @@ export interface FormValidationErrorPayload {
|
|
|
191
191
|
/**
|
|
192
192
|
* The form type implementation for the entity-based state manager.
|
|
193
193
|
*/
|
|
194
|
-
export
|
|
194
|
+
export type FormType = {
|
|
195
195
|
/**
|
|
196
196
|
* Initializes the form entity with default state.
|
|
197
197
|
* @param entity The form entity.
|
package/types/mount.d.ts
CHANGED
|
@@ -1,33 +1,43 @@
|
|
|
1
1
|
import type { TemplateResult } from "lit-html"
|
|
2
2
|
import type {
|
|
3
|
+
AnyTypeDefinition,
|
|
3
4
|
BaseEntity,
|
|
4
5
|
EntitiesState,
|
|
5
|
-
EntityType,
|
|
6
6
|
Store,
|
|
7
7
|
Api as StoreApi,
|
|
8
8
|
} from "@inglorious/store"
|
|
9
9
|
|
|
10
|
+
// `mount` gives the store's api a `render`, so loading these types gives the
|
|
11
|
+
// store's `Api` one too. There is a single `Api`: the one handlers receive,
|
|
12
|
+
// and the one components take.
|
|
13
|
+
declare module "@inglorious/store" {
|
|
14
|
+
interface Api<
|
|
15
|
+
TEntity extends BaseEntity = BaseEntity,
|
|
16
|
+
TState extends EntitiesState<TEntity> = EntitiesState<TEntity>,
|
|
17
|
+
> {
|
|
18
|
+
/**
|
|
19
|
+
* Renders an entity or a type component by its ID.
|
|
20
|
+
* @param id The ID of the entity or type to render. None, such as the route
|
|
21
|
+
* of an unmatched path, renders nothing.
|
|
22
|
+
* @param typeName Optional type name to lazy-register.
|
|
23
|
+
* @param type Optional type definition to register when typeName is provided.
|
|
24
|
+
* @returns The rendered template or an empty string if not found.
|
|
25
|
+
*/
|
|
26
|
+
render: {
|
|
27
|
+
(id: string | undefined): TemplateResult | string
|
|
28
|
+
(
|
|
29
|
+
id: string,
|
|
30
|
+
typeName: string,
|
|
31
|
+
type: AnyTypeDefinition,
|
|
32
|
+
): TemplateResult | string
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
10
37
|
export type Api<
|
|
11
38
|
TEntity extends BaseEntity = BaseEntity,
|
|
12
39
|
TState extends EntitiesState<TEntity> = EntitiesState<TEntity>,
|
|
13
|
-
> = StoreApi<TEntity, TState>
|
|
14
|
-
/**
|
|
15
|
-
* Renders an entity or a type component by its ID.
|
|
16
|
-
* @param id The ID of the entity or type to render. None, such as the route
|
|
17
|
-
* of an unmatched path, renders nothing.
|
|
18
|
-
* @param typeName Optional type name to lazy-register.
|
|
19
|
-
* @param type Optional type definition to register when typeName is provided.
|
|
20
|
-
* @returns The rendered template or an empty string if not found.
|
|
21
|
-
*/
|
|
22
|
-
render: {
|
|
23
|
-
(id: string | undefined): TemplateResult | string
|
|
24
|
-
(
|
|
25
|
-
id: string,
|
|
26
|
-
typeName: string,
|
|
27
|
-
type: EntityType<TEntity>,
|
|
28
|
-
): TemplateResult | string
|
|
29
|
-
}
|
|
30
|
-
}
|
|
40
|
+
> = StoreApi<TEntity, TState>
|
|
31
41
|
|
|
32
42
|
/**
|
|
33
43
|
* Root error-boundary options for `mount`.
|
package/types/router.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type QueryParams = Record<string, string>
|
|
|
27
27
|
*/
|
|
28
28
|
export interface RouterEntity {
|
|
29
29
|
/** A unique identifier for the router entity. */
|
|
30
|
-
id
|
|
30
|
+
id?: string
|
|
31
31
|
/** The current active path, without query string or hash. */
|
|
32
32
|
path?: string
|
|
33
33
|
/** The entity type of the current active route. */
|
|
@@ -79,7 +79,7 @@ export type { Api as StoreApi } from "@inglorious/store"
|
|
|
79
79
|
/**
|
|
80
80
|
* Client-side router for entity-based systems. Handles URL changes, link interception, and browser history management.
|
|
81
81
|
*/
|
|
82
|
-
export
|
|
82
|
+
export type RouterType = {
|
|
83
83
|
/**
|
|
84
84
|
* Initializes the router, sets up a popstate listener to handle browser navigation,
|
|
85
85
|
* and intercepts clicks on local links.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Api } from "../mount"
|
|
2
2
|
|
|
3
3
|
export interface CompassEntity {
|
|
4
|
-
id
|
|
5
|
-
type
|
|
4
|
+
id?: string
|
|
5
|
+
type: string
|
|
6
6
|
error: CompassError | null
|
|
7
7
|
heading: number | null
|
|
8
8
|
isActive: boolean
|
|
@@ -21,7 +21,7 @@ export interface CompassError {
|
|
|
21
21
|
message: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export
|
|
24
|
+
export type CompassType = {
|
|
25
25
|
create(entity: CompassEntity, payload: unknown, api: Api): void
|
|
26
26
|
destroy(entity: CompassEntity, payload: unknown, api: Api): void
|
|
27
27
|
compassUnwatch(entity: CompassEntity, payload: unknown, api: Api): void
|
|
@@ -2,11 +2,11 @@ import { Api } from "../mount"
|
|
|
2
2
|
|
|
3
3
|
export interface ElementSizeEntity {
|
|
4
4
|
height: number | null
|
|
5
|
-
id
|
|
5
|
+
id?: string
|
|
6
6
|
isSupported: boolean
|
|
7
7
|
isWatching: boolean
|
|
8
8
|
selector?: string | null
|
|
9
|
-
type
|
|
9
|
+
type: string
|
|
10
10
|
width: number | null
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ export interface ElementSizeSize {
|
|
|
15
15
|
width: number
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export
|
|
18
|
+
export type ElementSizeType = {
|
|
19
19
|
create(entity: ElementSizeEntity, payload: unknown, api: Api): void
|
|
20
20
|
destroy(entity: ElementSizeEntity): void
|
|
21
21
|
elementSizeChange(entity: ElementSizeEntity, size: ElementSizeSize): void
|
|
@@ -12,12 +12,12 @@ export interface GeolocationCoordinates {
|
|
|
12
12
|
|
|
13
13
|
export interface GeolocationEntity {
|
|
14
14
|
error: GeolocationError | null
|
|
15
|
-
id
|
|
15
|
+
id?: string
|
|
16
16
|
isLoading: boolean
|
|
17
17
|
isSupported: boolean
|
|
18
18
|
isWatching: boolean
|
|
19
19
|
position: GeolocationPosition | null
|
|
20
|
-
type
|
|
20
|
+
type: string
|
|
21
21
|
watchId: number | null
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -37,7 +37,7 @@ export interface GeolocationPosition {
|
|
|
37
37
|
timestamp: number
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export
|
|
40
|
+
export type GeolocationType = {
|
|
41
41
|
unwatch(entity: GeolocationEntity): void
|
|
42
42
|
create(entity: GeolocationEntity): void
|
|
43
43
|
destroy(entity: GeolocationEntity): void
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Api } from "../mount"
|
|
2
2
|
|
|
3
3
|
export interface MediaQueryEntity {
|
|
4
|
-
id
|
|
5
|
-
type
|
|
4
|
+
id?: string
|
|
5
|
+
type: string
|
|
6
6
|
media: string
|
|
7
7
|
matches: boolean
|
|
8
8
|
isSupported: boolean
|
|
@@ -13,7 +13,7 @@ export interface MediaQueryMatchEvent {
|
|
|
13
13
|
matches: boolean
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export type MediaQueryType = {
|
|
17
17
|
create(entity: MediaQueryEntity, payload: unknown, api: Api): void
|
|
18
18
|
destroy(entity: MediaQueryEntity): void
|
|
19
19
|
mediaQueryChange(entity: MediaQueryEntity, event: MediaQueryMatchEvent): void
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Api } from "../mount"
|
|
2
2
|
|
|
3
3
|
export interface NetworkStatusEntity {
|
|
4
|
-
id
|
|
5
|
-
type
|
|
4
|
+
id?: string
|
|
5
|
+
type: string
|
|
6
6
|
isOnline: boolean
|
|
7
7
|
isSupported: boolean
|
|
8
8
|
isWatching: boolean
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export type NetworkStatusType = {
|
|
12
12
|
create(entity: NetworkStatusEntity, payload: unknown, api: Api): void
|
|
13
13
|
destroy(entity: NetworkStatusEntity, payload: unknown, api: Api): void
|
|
14
14
|
networkStatusChange(entity: NetworkStatusEntity, value: boolean): void
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Api } from "../mount"
|
|
2
2
|
|
|
3
3
|
export interface PageVisibilityEntity {
|
|
4
|
-
id
|
|
5
|
-
type
|
|
4
|
+
id?: string
|
|
5
|
+
type: string
|
|
6
6
|
isSupported: boolean
|
|
7
7
|
isVisible: boolean
|
|
8
8
|
isWatching: boolean
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export type PageVisibilityType = {
|
|
12
12
|
create(entity: PageVisibilityEntity, payload: unknown, api: Api): void
|
|
13
13
|
destroy(entity: PageVisibilityEntity, payload: unknown, api: Api): void
|
|
14
14
|
pageVisibilityChange(entity: PageVisibilityEntity, value: boolean): void
|
package/types/static.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { html as staticHtml, unsafeStatic } from "lit-html/static"
|
|
1
|
+
export { html as staticHtml, unsafeStatic } from "lit-html/static.js"
|
package/types/test.d.ts
ADDED