@inglorious/web 6.16.0 → 6.17.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/README.md CHANGED
@@ -272,7 +272,7 @@ If you want a framework that **does not fight JavaScript**, this is the one.
272
272
  ## Installation
273
273
 
274
274
  ```bash
275
- npm install @inglorious/web
275
+ pnpm add @inglorious/web
276
276
  ```
277
277
 
278
278
  ---
@@ -429,7 +429,7 @@ test("counter button has click handler", () => {
429
429
  **No special setup required:**
430
430
 
431
431
  ```bash
432
- npm install --save-dev vitest # or jest, or node:test
432
+ pnpm add -D vitest # or jest, or node:test
433
433
  ```
434
434
 
435
435
  That's it. No `@testing-library/react`, no `renderHook`, no `act()` wrappers.
@@ -697,7 +697,7 @@ This Vite plugin transforms standard JSX/TSX into optimized `lit-html` templates
697
697
 
698
698
  To use it:
699
699
 
700
- 1. Install the plugin: `npm install -D @inglorious/vite-plugin-jsx`
700
+ 1. Install the plugin: `pnpm add -D @inglorious/vite-plugin-jsx`
701
701
  2. Add it to your `vite.config.js`
702
702
  3. Write your render functions using JSX
703
703
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/web",
3
- "version": "6.16.0",
3
+ "version": "6.17.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": [
@@ -121,12 +121,12 @@
121
121
  },
122
122
  "sideEffects": false,
123
123
  "dependencies": {
124
- "@inglorious/utils": "^5.1.0",
124
+ "@inglorious/utils": "^5.2.0",
125
125
  "@lit-labs/ssr-client": "^1.1.8",
126
126
  "lit-html": "^3.3.3"
127
127
  },
128
128
  "peerDependencies": {
129
- "@inglorious/store": "^12.2.0"
129
+ "@inglorious/store": "^12.3.0"
130
130
  },
131
131
  "devDependencies": {
132
132
  "@inglorious/eslint-config": "1.2.0",
@@ -28,7 +28,7 @@ const DENIED = "denied"
28
28
  * @param {string} [config.consentKey] - The localStorage key of the choice.
29
29
  *
30
30
  * @example
31
- * const types = { Analytics: [createAnalytics({ adapter }), renderers] }
31
+ * const types = { Analytics: [createAnalytics({ adapter }), template] }
32
32
  * const entities = { analytics: { type: "Analytics" } }
33
33
  * // later, anywhere
34
34
  * api.notify("#analytics:analyticsTrack", { name: "sign_up" })
package/src/push/index.js CHANGED
@@ -45,7 +45,7 @@ const tappedAdapters = new WeakSet()
45
45
  * const types = {
46
46
  * PushPrompt: {
47
47
  * ...prompt,
48
- * ...renderers,
48
+ * ...template,
49
49
  * sessionStart: prompt.pushStart,
50
50
  * sessionEnd: prompt.pushStop,
51
51
  * },
package/types/mount.d.ts CHANGED
@@ -1,16 +1,19 @@
1
1
  import type { nothing, TemplateResult } from "lit-html"
2
2
  import type {
3
+ AnyEvents,
3
4
  AnyTypeDefinition,
5
+ Api,
4
6
  BaseEntity,
5
7
  EntitiesState,
6
8
  Store,
7
- Api as StoreApi,
8
9
  } from "@inglorious/store"
9
10
 
10
11
  declare module "@inglorious/store" {
11
12
  interface Api<
12
13
  TEntity extends BaseEntity = BaseEntity,
13
14
  TState extends EntitiesState<TEntity> = EntitiesState<TEntity>,
15
+ // Unused here, but every declaration of `Api` must take the same parameters.
16
+ TEvents = AnyEvents,
14
17
  > {
15
18
  /**
16
19
  * Renders an entity or a type component by its ID.
@@ -31,10 +34,12 @@ declare module "@inglorious/store" {
31
34
  }
32
35
  }
33
36
 
34
- export type Api<
35
- TEntity extends BaseEntity = BaseEntity,
36
- TState extends EntitiesState<TEntity> = EntitiesState<TEntity>,
37
- > = StoreApi<TEntity, TState>
37
+ /**
38
+ * The store's api, with `render` added above. It is the store's own interface,
39
+ * re-exported rather than aliased: an interface is resolved lazily, so an app
40
+ * can tell its api the events of types whose handlers take that same api.
41
+ */
42
+ export type { Api }
38
43
 
39
44
  /**
40
45
  * Root error-boundary options for `mount`.
@@ -77,9 +82,10 @@ export interface MountOptions<
77
82
  export function mount<
78
83
  TEntity extends BaseEntity = BaseEntity,
79
84
  TState extends EntitiesState<TEntity> = EntitiesState<TEntity>,
85
+ TEvents = AnyEvents,
80
86
  >(
81
- store: Store<TEntity, TState>,
82
- renderFn: (api: Api<TEntity, TState>) => TemplateResult | null,
87
+ store: Store<TEntity, TState, TEvents>,
88
+ renderFn: (api: Api<TEntity, TState, TEvents>) => TemplateResult | null,
83
89
  element: HTMLElement | DocumentFragment,
84
90
  options?: MountOptions<TEntity, TState>,
85
91
  ): () => void