@inglorious/web 6.5.2 → 6.6.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 +1 -0
- package/package.json +2 -2
- package/src/mount.js +6 -0
- package/types/mount.d.ts +3 -2
package/README.md
CHANGED
|
@@ -1851,6 +1851,7 @@ Check out these demos to see `@inglorious/web` in action:
|
|
|
1851
1851
|
|
|
1852
1852
|
- [**@inglorious/ssx**](https://www.npmjs.com/package/@inglorious/ssx) - Static site generation with pre-rendering and client hydration
|
|
1853
1853
|
- [**@inglorious/store**](https://www.npmjs.com/package/@inglorious/store) - Entity-based state management (used by @inglorious/web)
|
|
1854
|
+
- [**@inglorious/i18n**](https://www.npmjs.com/package/@inglorious/i18n) - Internationalization: translations, plurals and formatting driven by a store entity
|
|
1854
1855
|
- [**@inglorious/engine**](https://www.npmjs.com/package/@inglorious/engine) - Game engine with the same entity architecture
|
|
1855
1856
|
- [**@inglorious/create-app**](https://www.npmjs.com/package/@inglorious/create-app) - Scaffolding tool for quick project setup
|
|
1856
1857
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/web",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.1",
|
|
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": [
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"lit-html": "^3.3.3"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
|
-
"@inglorious/store": "11.0.
|
|
112
|
+
"@inglorious/store": "11.0.4"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@inglorious/eslint-config": "1.1.2",
|
package/src/mount.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
import { html, render } from "lit-html"
|
|
7
7
|
|
|
8
|
+
import { isNative } from "./mobile/index.js"
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* Mounts a lit-html template to the DOM and subscribes to a store for re-rendering.
|
|
10
12
|
* @param {Store} store - The application state store.
|
|
@@ -24,6 +26,10 @@ export async function mount(store, renderFn, element, options = {}) {
|
|
|
24
26
|
hydrate: allowHydrate = true,
|
|
25
27
|
} = options
|
|
26
28
|
|
|
29
|
+
// Tells CSS the native app from a browser tab, which env() cannot: the
|
|
30
|
+
// safe-area tokens of @inglorious/ui key off it.
|
|
31
|
+
document.documentElement.classList.toggle("iw-native", isNative())
|
|
32
|
+
|
|
27
33
|
const api = { ...store._api }
|
|
28
34
|
api.render = createRender(api)
|
|
29
35
|
|
package/types/mount.d.ts
CHANGED
|
@@ -13,13 +13,14 @@ export type Api<
|
|
|
13
13
|
> = StoreApi<TEntity, TState> & {
|
|
14
14
|
/**
|
|
15
15
|
* Renders an entity or a type component by its ID.
|
|
16
|
-
* @param id The ID of the entity or type to render.
|
|
16
|
+
* @param id The ID of the entity or type to render. None, such as the route
|
|
17
|
+
* of an unmatched path, renders nothing.
|
|
17
18
|
* @param typeName Optional type name to lazy-register.
|
|
18
19
|
* @param type Optional type definition to register when typeName is provided.
|
|
19
20
|
* @returns The rendered template or an empty string if not found.
|
|
20
21
|
*/
|
|
21
22
|
render: {
|
|
22
|
-
(id: string): TemplateResult | string
|
|
23
|
+
(id: string | undefined): TemplateResult | string
|
|
23
24
|
(
|
|
24
25
|
id: string,
|
|
25
26
|
typeName: string,
|