@inglorious/web 6.9.0 → 6.9.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.
Files changed (2) hide show
  1. package/README.md +16 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -89,7 +89,7 @@ It's that simple — and surprisingly fast in practice.
89
89
  - You want UI to be fully controlled by your entity-based store
90
90
  - You want to stay entirely in **JavaScript**, without DSLs or compilers
91
91
  - You want **React-like declarative UI** but without the cost and overhead of React
92
- - You want to build **static sites with SSX** — same entity patterns, pre-rendered HTML, and client hydration
92
+ - You want **pre-rendered sites with SSX**, static or server-rendered on request — same entity patterns, HTML from the server, and client hydration
93
93
 
94
94
  This framework is ideal for both small apps and large business UIs.
95
95
 
@@ -289,7 +289,7 @@ import { createStore } from "@inglorious/store"
289
289
  import { html } from "@inglorious/web"
290
290
 
291
291
  const types = {
292
- counter: {
292
+ Counter: {
293
293
  increment(entity) {
294
294
  entity.value++
295
295
  },
@@ -1282,6 +1282,7 @@ api.notify("geolocationUnwatch")
1282
1282
 
1283
1283
  ```javascript
1284
1284
  import { mount, html } from "@inglorious/web"
1285
+ import { when } from "@inglorious/web/directives/when"
1285
1286
  import { store } from "./store.js"
1286
1287
 
1287
1288
  const renderApp = (api) => {
@@ -1295,12 +1296,13 @@ const renderApp = (api) => {
1295
1296
  <p>Loading: ${geolocation.isLoading ? "yes" : "no"}</p>
1296
1297
  <p>
1297
1298
  Position:
1298
- ${
1299
- position
1300
- ? html`${position.coords.latitude.toFixed(4)},
1301
- ${position.coords.longitude.toFixed(4)}`
1302
- : "unknown"
1303
- }
1299
+ ${when(
1300
+ position,
1301
+ () =>
1302
+ html`${position.coords.latitude.toFixed(4)},
1303
+ ${position.coords.longitude.toFixed(4)}`,
1304
+ () => "unknown",
1305
+ )}
1304
1306
  </p>
1305
1307
  <p>Error: ${geolocation.error ? geolocation.error.message : "none"}</p>
1306
1308
  <button
@@ -1461,11 +1463,13 @@ Events:
1461
1463
 
1462
1464
  ```javascript
1463
1465
  const renderUpdate = (api) =>
1464
- api.getEntity("pwaUpdate").isUpdateReady
1465
- ? html`<button @click=${() => api.notify("#pwaUpdate:pwaUpdateApply")}>
1466
+ when(
1467
+ api.getEntity("pwaUpdate").isUpdateReady,
1468
+ () =>
1469
+ html`<button @click=${() => api.notify("#pwaUpdate:pwaUpdateApply")}>
1466
1470
  Update now
1467
- </button>`
1468
- : ""
1471
+ </button>`,
1472
+ )
1469
1473
  ```
1470
1474
 
1471
1475
  Inglorious UI's `Snackbar` is the usual place for it. `watchPwaUpdate` takes `{ id, checkEveryMs }` as a third argument, to announce to an entity with another id or to check more or less often, and returns a function that stops watching.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/web",
3
- "version": "6.9.0",
3
+ "version": "6.9.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": [