@deck-shelves/host 1.1.1 → 1.2.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
@@ -2,6 +2,10 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
+ <p>
6
+ <img src="assets/logo.svg" alt="@deck-shelves/host" width="352">
7
+ </p>
8
+
5
9
  [![CI](https://github.com/santojon/Deck-Shelves-HOST/actions/workflows/ci.yml/badge.svg)](https://github.com/santojon/Deck-Shelves-HOST/actions/workflows/ci.yml)
6
10
  [![Release](https://github.com/santojon/Deck-Shelves-HOST/actions/workflows/release.yml/badge.svg)](https://github.com/santojon/Deck-Shelves-HOST/actions/workflows/release.yml)
7
11
  [![npm version](https://img.shields.io/npm/v/@deck-shelves/host?logo=npm&color=cb3837)](https://www.npmjs.com/package/@deck-shelves/host)
@@ -33,6 +37,12 @@ added without touching the bundle.
33
37
  > Quick Access Menu tab — lives in that host's own project, not here. This
34
38
  > package is just the interface both sides agree on.
35
39
 
40
+ > **Coexistence.** A host with a native QAM tab may also expose its panel
41
+ > registration on `window.__SHELVES_QAM__` (a `HostQam`), independently of the
42
+ > full `HostApi` — so a bundle can populate that host's tab even when *another*
43
+ > host owns the home (and `__SHELVES_HOST__` is left unset). Both globals are
44
+ > declared in the contract.
45
+
36
46
  It is **not** `@deck-shelves/api` — that package is the public *extension* API
37
47
  consumed by third-party plugins (`window.deckShelves`). This one is the
38
48
  host↔bundle contract, a different audience.
package/dist/index.d.cts CHANGED
@@ -128,10 +128,20 @@ interface QamPanel {
128
128
  id: string;
129
129
  /** Label / accessible name. */
130
130
  title: string;
131
- /** Inline SVG markup (or a `data:` URI) used as the icon. */
132
- icon: string;
133
- /** Render into the host-owned container; return an optional cleanup fn. */
134
- render(container: HTMLElement): void | (() => void);
131
+ /** Inline SVG markup (or a `data:` URI) used as the icon. Optional: a host
132
+ * with a first-class tab (a permanent presence with its own icon) falls back
133
+ * to that icon when omitted. */
134
+ icon?: string;
135
+ /** Render into the host-owned container; return an optional cleanup fn.
136
+ * Framework-agnostic — the way any host can accept a panel. Provide exactly
137
+ * one of `render` / `content`. */
138
+ render?(container: HTMLElement): void | (() => void);
139
+ /** …or a React node (or a zero-arg factory returning one) that a React-based
140
+ * host renders in its OWN React tree — no nested root, so the bundle's context
141
+ * providers reach the panel. Typed `unknown` to keep the contract
142
+ * dependency-free (cast at the call site, as with `HostUi`). Provide exactly
143
+ * one of `render` / `content`. */
144
+ content?: unknown;
135
145
  }
136
146
  interface HostQam {
137
147
  /**
@@ -174,6 +184,11 @@ interface HostMainMenu {
174
184
  * supports them — add optional surfaces (a Quick Access Menu tab, a Main Menu
175
185
  * entry). Optional capabilities are feature-detected: `host.qam?.…`,
176
186
  * `host.mainMenu?.…`.
187
+ *
188
+ * In *coexistence* (another loader owns the home) a host leaves `__SHELVES_HOST__`
189
+ * unset so it does not disturb host selection, yet MAY still surface its own QAM
190
+ * tab: the bundle registers into it through the host-selection-neutral
191
+ * `window.__SHELVES_QAM__` (see the `Window` augmentation below).
177
192
  */
178
193
  interface HostApi {
179
194
  readonly version: typeof HOST_API_VERSION;
@@ -194,6 +209,24 @@ type ShelvesHostGlobal = HostApi;
194
209
  declare global {
195
210
  interface Window {
196
211
  __SHELVES_HOST__?: ShelvesHostGlobal;
212
+ /**
213
+ * A host's QAM registration surface, exposed independently of the full
214
+ * `HostApi`. A host with a native QAM tab installs this even when it is NOT
215
+ * the bundle's selected host — i.e. in *coexistence*, where another loader
216
+ * owns the home and `__SHELVES_HOST__` is intentionally left unset so host
217
+ * selection is not disturbed. A bundle may register a panel here to populate
218
+ * that host's tab regardless of which host it selected; the surface takes no
219
+ * part in host selection. When the same host also owns the home this is the
220
+ * very same object as `__SHELVES_HOST__.qam`.
221
+ */
222
+ __SHELVES_QAM__?: HostQam;
223
+ /**
224
+ * Panels a bundle registered before `__SHELVES_QAM__` existed. Registration
225
+ * is order-independent: a bundle that boots first may push its panels here,
226
+ * and the host drains and clears this array the moment it installs
227
+ * `__SHELVES_QAM__`. Equivalent to calling `registerPanel` for each.
228
+ */
229
+ __SHELVES_QAM_PENDING__?: QamPanel[];
197
230
  }
198
231
  }
199
232
 
package/dist/index.d.ts CHANGED
@@ -128,10 +128,20 @@ interface QamPanel {
128
128
  id: string;
129
129
  /** Label / accessible name. */
130
130
  title: string;
131
- /** Inline SVG markup (or a `data:` URI) used as the icon. */
132
- icon: string;
133
- /** Render into the host-owned container; return an optional cleanup fn. */
134
- render(container: HTMLElement): void | (() => void);
131
+ /** Inline SVG markup (or a `data:` URI) used as the icon. Optional: a host
132
+ * with a first-class tab (a permanent presence with its own icon) falls back
133
+ * to that icon when omitted. */
134
+ icon?: string;
135
+ /** Render into the host-owned container; return an optional cleanup fn.
136
+ * Framework-agnostic — the way any host can accept a panel. Provide exactly
137
+ * one of `render` / `content`. */
138
+ render?(container: HTMLElement): void | (() => void);
139
+ /** …or a React node (or a zero-arg factory returning one) that a React-based
140
+ * host renders in its OWN React tree — no nested root, so the bundle's context
141
+ * providers reach the panel. Typed `unknown` to keep the contract
142
+ * dependency-free (cast at the call site, as with `HostUi`). Provide exactly
143
+ * one of `render` / `content`. */
144
+ content?: unknown;
135
145
  }
136
146
  interface HostQam {
137
147
  /**
@@ -174,6 +184,11 @@ interface HostMainMenu {
174
184
  * supports them — add optional surfaces (a Quick Access Menu tab, a Main Menu
175
185
  * entry). Optional capabilities are feature-detected: `host.qam?.…`,
176
186
  * `host.mainMenu?.…`.
187
+ *
188
+ * In *coexistence* (another loader owns the home) a host leaves `__SHELVES_HOST__`
189
+ * unset so it does not disturb host selection, yet MAY still surface its own QAM
190
+ * tab: the bundle registers into it through the host-selection-neutral
191
+ * `window.__SHELVES_QAM__` (see the `Window` augmentation below).
177
192
  */
178
193
  interface HostApi {
179
194
  readonly version: typeof HOST_API_VERSION;
@@ -194,6 +209,24 @@ type ShelvesHostGlobal = HostApi;
194
209
  declare global {
195
210
  interface Window {
196
211
  __SHELVES_HOST__?: ShelvesHostGlobal;
212
+ /**
213
+ * A host's QAM registration surface, exposed independently of the full
214
+ * `HostApi`. A host with a native QAM tab installs this even when it is NOT
215
+ * the bundle's selected host — i.e. in *coexistence*, where another loader
216
+ * owns the home and `__SHELVES_HOST__` is intentionally left unset so host
217
+ * selection is not disturbed. A bundle may register a panel here to populate
218
+ * that host's tab regardless of which host it selected; the surface takes no
219
+ * part in host selection. When the same host also owns the home this is the
220
+ * very same object as `__SHELVES_HOST__.qam`.
221
+ */
222
+ __SHELVES_QAM__?: HostQam;
223
+ /**
224
+ * Panels a bundle registered before `__SHELVES_QAM__` existed. Registration
225
+ * is order-independent: a bundle that boots first may push its panels here,
226
+ * and the host drains and clears this array the moment it installs
227
+ * `__SHELVES_QAM__`. Equivalent to calling `registerPanel` for each.
228
+ */
229
+ __SHELVES_QAM_PENDING__?: QamPanel[];
197
230
  }
198
231
  }
199
232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deck-shelves/host",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Deck Shelves host contract — the HostApi types all host adapters and the bundle build against.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -66,16 +66,21 @@
66
66
  "overrides": {
67
67
  "esbuild": "^0.25.0",
68
68
  "vite": "^6.4.2",
69
- "form-data": "^4.0.6"
69
+ "form-data": "^4.0.6",
70
+ "brace-expansion@1": "^1.1.17",
71
+ "brace-expansion@5": "^5.0.9",
72
+ "js-yaml@4": "^4.3.1",
73
+ "nanoid@3": "^3.3.18",
74
+ "postcss@8": "^8.5.23"
70
75
  }
71
76
  },
72
77
  "devDependencies": {
73
- "@typescript-eslint/parser": "^8.61.1",
74
- "eslint": "^9.39.4",
78
+ "@typescript-eslint/parser": "^8.67.0",
79
+ "eslint": "^9.39.5",
75
80
  "jsdom": "^25.0.1",
76
81
  "tsup": "^8.5.1",
77
82
  "typescript": "^5.9.3",
78
- "vitest": "^3.2.6"
83
+ "vitest": "^3.2.7"
79
84
  },
80
85
  "packageManager": "pnpm@10.33.0"
81
86
  }