@winkintel/bootstrap-svelte 1.0.10 → 1.0.11

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
@@ -26,7 +26,7 @@ The showcase at <https://bootstrap-svelte.vercel.app> is published for AI agents
26
26
 
27
27
  - `/llms.txt` indexes every page with one-line summaries ([llms.txt format](https://llmstxt.org)); `/llms-full.txt` bundles every page into one Markdown file.
28
28
  - Every page is available as Markdown from its own URL with `Accept: text/markdown` (quality values are honored; the response carries `Vary: Accept` and a `Link` alternate header), or by appending `.md` to the path, for example `/components/button.md`.
29
- - `/agents.md` explains when to use the library and how to integrate it; `/sitemap.xml` and `/robots.txt` serve crawlers.
29
+ - `/agents.md` explains when to use the library and how to integrate it; `/sitemap.xml` and `/robots.txt` serve crawlers, and `pnpm indexnow` pushes changed URLs to Bing and the other [IndexNow](https://www.indexnow.org/) engines after a deploy.
30
30
  - Paths that do not exist return a real HTTP 404 with a Markdown or HTML body that links back to the documentation index.
31
31
 
32
32
  ## Why this exists
@@ -180,7 +180,7 @@ Interactive components are implemented as Svelte components rather than requirin
180
180
 
181
181
  ## Status and feedback
182
182
 
183
- This package is published as `1.0.10`, but feedback from Svelte developers is still very welcome. Useful feedback includes:
183
+ This package is published as `1.0.11`, but feedback from Svelte developers is still very welcome. Useful feedback includes:
184
184
 
185
185
  - Component API ergonomics
186
186
  - Svelte 5 idioms and runes compatibility
@@ -22,6 +22,7 @@ Title component for the Modal.Header.
22
22
  - `level` (number): Optional. Heading level (1-6) for the title element
23
23
  -->
24
24
  <script lang="ts">import { uniqueClsx } from '../common/css.js';
25
+ import { onDestroy } from 'svelte';
25
26
  import { getOptionalModalRootState } from './modal.svelte.js';
26
27
  // Generate a unique ID for the modal title element, in case one is not provided...
27
28
  const uid = $props.id();
@@ -29,14 +30,19 @@ let { children, class: classValues, elementRef = $bindable(null), id = `modal-ti
29
30
  let elementType = $derived(`h${level}`);
30
31
  let classes = $derived(uniqueClsx('modal-title', classValues));
31
32
  const rootState = getOptionalModalRootState();
33
+ // Stable identity for this title's registry entry, so an id change updates
34
+ // the entry in place and keeps its position among sibling titles...
35
+ const titleKey = Symbol('modal-title');
32
36
  $effect(() => {
33
- const registeredId = id;
34
- if (!registeredId)
35
- return;
36
- rootState?.registerTitleId(registeredId);
37
- return () => {
38
- rootState?.unregisterTitleId(registeredId);
39
- };
37
+ if (id) {
38
+ rootState?.registerTitleId(titleKey, id);
39
+ }
40
+ else {
41
+ rootState?.unregisterTitleId(titleKey);
42
+ }
43
+ });
44
+ onDestroy(() => {
45
+ rootState?.unregisterTitleId(titleKey);
40
46
  });
41
47
  </script>
42
48
 
@@ -8,6 +8,10 @@ export class ModalRootState {
8
8
  // Private
9
9
  #isShown = $state(false);
10
10
  #useBackdrop = $state(true);
11
+ // Plain (non-reactive) ordered registry of mounted Modal.Title components,
12
+ // keyed by a stable per-instance token so an id change updates the entry in
13
+ // place instead of moving it. The first registered title labels the dialog...
14
+ #titles = [];
11
15
  titleId = $state(undefined);
12
16
  constructor(props) {
13
17
  this.props = props;
@@ -30,13 +34,23 @@ export class ModalRootState {
30
34
  toggleIsShown() {
31
35
  this.#isShown = !this.#isShown;
32
36
  }
33
- registerTitleId(id) {
34
- this.titleId ??= id;
35
- }
36
- unregisterTitleId(id) {
37
- if (this.titleId === id) {
38
- this.titleId = undefined;
37
+ // Both methods are called from Modal.Title. They must never read `titleId`
38
+ // (reactive state) there, or the title's `$effect` would depend on the state
39
+ // it writes and Svelte >= 5.56.5 loops with "Maximum update depth exceeded".
40
+ // The registry is a plain array, and `titleId` is only written...
41
+ registerTitleId(key, id) {
42
+ const entry = this.#titles.find((title) => title.key === key);
43
+ if (entry) {
44
+ entry.id = id;
45
+ }
46
+ else {
47
+ this.#titles.push({ key, id });
39
48
  }
49
+ this.titleId = this.#titles[0]?.id;
50
+ }
51
+ unregisterTitleId(key) {
52
+ this.#titles = this.#titles.filter((title) => title.key !== key);
53
+ this.titleId = this.#titles[0]?.id;
40
54
  }
41
55
  }
42
56
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Wink, Inc.",
3
3
  "name": "@winkintel/bootstrap-svelte",
4
- "version": "1.0.10",
4
+ "version": "1.0.11",
5
5
  "description": "Bootstrap components for Svelte 5 with TypeScript support.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -26,6 +26,7 @@
26
26
  "doctor": "svelte-doctor check",
27
27
  "format": "prettier --write --ignore-path=.prettierignore $(git diff --name-only --diff-filter d --relative . && git ls-files --others --exclude-standard | sed \"s|^$(git rev-parse --show-prefix)||\")",
28
28
  "format-all": "prettier --write --ignore-path=.prettierignore ./src",
29
+ "indexnow": "node scripts/indexnow.mjs",
29
30
  "lint": "prettier --check ./src && eslint ./src",
30
31
  "ncu:check": "ncu --target minor && ncu --target minor --cooldown 0d --filter \"@sveltejs/adapter-static,@sveltejs/kit,@sveltejs/vite-plugin-svelte,svelte,svelte-check,svelte-preprocess\"",
31
32
  "ncu:upgrade": "ncu --target minor -u && ncu --target minor --cooldown 0d -u --filter \"@sveltejs/adapter-static,@sveltejs/kit,@sveltejs/vite-plugin-svelte,svelte,svelte-check,svelte-preprocess\" && pnpm install",
@@ -87,7 +88,7 @@
87
88
  "publint": "~0.3.21",
88
89
  "rimraf": "~6.1.3",
89
90
  "sass": "1.77.6",
90
- "svelte": "~5.56.4",
91
+ "svelte": "~5.57.0",
91
92
  "svelte-check": "~4.7.2",
92
93
  "svelte-doctor": "~0.3.1",
93
94
  "svelte-highlight": "~7.14.1",