@fuzdev/fuz_ui 0.177.0 → 0.177.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.
@@ -31,7 +31,7 @@
31
31
  minimal?: boolean;
32
32
  } = $props();
33
33
 
34
- const search = create_declaration_search(library);
34
+ const search = $derived(create_declaration_search(library));
35
35
  </script>
36
36
 
37
37
  <svelte:head>
@@ -267,8 +267,8 @@
267
267
  }
268
268
  };
269
269
 
270
- const keyboard_handlers = contextmenu_create_keyboard_handlers(contextmenu);
271
- const keydown = contextmenu_create_keydown_handler(keyboard_handlers);
270
+ const keyboard_handlers = $derived(contextmenu_create_keyboard_handlers(contextmenu));
271
+ const keydown = $derived(contextmenu_create_keydown_handler(keyboard_handlers));
272
272
  </script>
273
273
 
274
274
  <svelte:window
@@ -376,8 +376,8 @@
376
376
  }
377
377
  };
378
378
 
379
- const keyboard_handlers = contextmenu_create_keyboard_handlers(contextmenu);
380
- const keydown = contextmenu_create_keydown_handler(keyboard_handlers);
379
+ const keyboard_handlers = $derived(contextmenu_create_keyboard_handlers(contextmenu));
380
+ const keydown = $derived(contextmenu_create_keydown_handler(keyboard_handlers));
381
381
 
382
382
  /**
383
383
  * Creates an attachment that registers touch event listeners with { passive: false }
@@ -31,7 +31,7 @@
31
31
 
32
32
  <!-- type signature -->
33
33
  {#if declaration.type_signature}
34
- <Code content={declaration.type_signature} lang="ts" class="mb_lg" />
34
+ <Code lang="ts" content={declaration.type_signature} />
35
35
  {/if}
36
36
 
37
37
  <!-- documentation -->
@@ -63,7 +63,7 @@
63
63
  {/if}
64
64
  {#if param.default_value}
65
65
  <strong>default</strong>
66
- <Code content={param.default_value} lang="ts" />
66
+ <Code lang="ts" content={param.default_value} />
67
67
  {/if}
68
68
  </div>
69
69
  {/if}
@@ -99,7 +99,7 @@
99
99
  {/if}
100
100
  {#if prop.default_value}
101
101
  <strong>default</strong>
102
- <Code content={prop.default_value} lang="ts" />
102
+ <Code lang="ts" content={prop.default_value} />
103
103
  {/if}
104
104
  </div>
105
105
  {/if}
@@ -112,7 +112,7 @@
112
112
  {#if declaration.return_type}
113
113
  <section>
114
114
  <h4>returns</h4>
115
- <Code content={declaration.return_type} lang="ts" />
115
+ <Code lang="ts" content={declaration.return_type} />
116
116
  {#if declaration.return_description}
117
117
  <Mdz content={declaration.return_description} />
118
118
  {/if}
@@ -203,7 +203,7 @@
203
203
  {#each declaration.examples as example, i (example)}
204
204
  <Details>
205
205
  {#snippet summary()}Example {i + 1}{/snippet}
206
- <Code content={example} lang="ts" />
206
+ <Code lang="ts" content={example} />
207
207
  </Details>
208
208
  {/each}
209
209
  </section>
@@ -273,7 +273,7 @@
273
273
  {/if}
274
274
  {#if param.default_value}
275
275
  <strong>default</strong>
276
- <Code content={param.default_value} lang="ts" />
276
+ <Code lang="ts" content={param.default_value} />
277
277
  {/if}
278
278
  </div>
279
279
  {/if}
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type {SvelteHTMLElements} from 'svelte/elements';
3
+ import {ensure_start} from '@fuzdev/fuz_util/string.js';
3
4
 
4
5
  import {library_context} from './library.svelte.js';
5
6
  import {contextmenu_attachment} from './contextmenu_state.svelte.js';
@@ -7,11 +8,14 @@
7
8
 
8
9
  const {
9
10
  name,
11
+ hash,
10
12
  children,
11
13
  class: class_prop = 'chip',
12
14
  ...rest
13
15
  }: SvelteHTMLElements['a'] & {
14
16
  name: string;
17
+ /** URL fragment to append, with or without the `#`. */
18
+ hash?: string;
15
19
  } = $props();
16
20
 
17
21
  const library = library_context.get();
@@ -31,7 +35,7 @@
31
35
  <a
32
36
  {...rest}
33
37
  class="declaration_link {class_prop}"
34
- href={declaration.url_api}
38
+ href={declaration.url_api + (hash ? ensure_start(hash, '#') : '')}
35
39
  {@attach contextmenu_attachment(contextmenu_entries)}
36
40
  >
37
41
  {#if children}
@@ -1,6 +1,8 @@
1
1
  import type { SvelteHTMLElements } from 'svelte/elements';
2
2
  type $$ComponentProps = SvelteHTMLElements['a'] & {
3
3
  name: string;
4
+ /** URL fragment to append, with or without the `#`. */
5
+ hash?: string;
4
6
  };
5
7
  declare const DeclarationLink: import("svelte").Component<$$ComponentProps, {}, "">;
6
8
  type DeclarationLink = ReturnType<typeof DeclarationLink>;
@@ -1 +1 @@
1
- {"version":3,"file":"DeclarationLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/DeclarationLink.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAMvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AA+CH,QAAA,MAAM,eAAe,sDAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"DeclarationLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/DeclarationLink.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAOvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAiDH,QAAA,MAAM,eAAe,sDAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
@@ -9,10 +9,13 @@
9
9
 
10
10
  const {
11
11
  reference,
12
+ hash,
12
13
  display_text,
13
14
  children: children_prop,
14
15
  }: {
15
16
  reference: string;
17
+ /** URL fragment to append, with or without the `#`. */
18
+ hash?: string;
16
19
  display_text?: string | null;
17
20
  children?: Snippet<[Declaration | undefined, Module | undefined]>;
18
21
  } = $props();
@@ -24,11 +27,11 @@
24
27
  </script>
25
28
 
26
29
  {#if declaration}
27
- <DeclarationLink name={reference}>
30
+ <DeclarationLink name={reference} {hash}>
28
31
  {@render children()}
29
32
  </DeclarationLink>
30
33
  {:else if module}
31
- <ModuleLink module_path={module.path}>
34
+ <ModuleLink module_path={module.path} {hash}>
32
35
  {@render children()}
33
36
  </ModuleLink>
34
37
  {:else}
@@ -3,6 +3,8 @@ import type { Declaration } from './declaration.svelte.js';
3
3
  import type { Module } from './module.svelte.js';
4
4
  type $$ComponentProps = {
5
5
  reference: string;
6
+ /** URL fragment to append, with or without the `#`. */
7
+ hash?: string;
6
8
  display_text?: string | null;
7
9
  children?: Snippet<[Declaration | undefined, Module | undefined]>;
8
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DocsLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/DocsLink.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAKpC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE9C,KAAK,gBAAgB,GAAI;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAClE,CAAC;AAyCH,QAAA,MAAM,QAAQ,sDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"DocsLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/DocsLink.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAKpC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE9C,KAAK,gBAAgB,GAAI;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAClE,CAAC;AA0CH,QAAA,MAAM,QAAQ,sDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import {strip_start} from '@fuzdev/fuz_util/string.js';
2
+ import {ensure_start, strip_start} from '@fuzdev/fuz_util/string.js';
3
3
  import type {SvelteHTMLElements} from 'svelte/elements';
4
4
  import {DEV} from 'esm-env';
5
5
 
@@ -8,6 +8,7 @@
8
8
 
9
9
  const {
10
10
  path,
11
+ hash,
11
12
  href: href_prop,
12
13
  children,
13
14
  ...rest
@@ -19,6 +20,8 @@
19
20
  * @example https://github.com/fuzdev/fuz_ui/issues/123
20
21
  */
21
22
  path?: string;
23
+ /** URL fragment to append, with or without the `#`. */
24
+ hash?: string;
22
25
  } = $props();
23
26
 
24
27
  if (DEV) {
@@ -30,12 +33,12 @@
30
33
  }
31
34
 
32
35
  const href = $derived(
33
- href_prop ??
36
+ (href_prop ??
34
37
  (path
35
38
  ? path.startsWith('https://')
36
39
  ? path
37
40
  : `https://github.com/${strip_start(path, '/')}`
38
- : ''),
41
+ : '')) + (hash ? ensure_start(hash, '#') : ''),
39
42
  );
40
43
 
41
44
  // extract meaningful display text from the path
@@ -7,6 +7,8 @@ type $$ComponentProps = SvelteHTMLElements['a'] & {
7
7
  * @example https://github.com/fuzdev/fuz_ui/issues/123
8
8
  */
9
9
  path?: string;
10
+ /** URL fragment to append, with or without the `#`. */
11
+ hash?: string;
10
12
  };
11
13
  declare const GithubLink: import("svelte").Component<$$ComponentProps, {}, "">;
12
14
  type GithubLink = ReturnType<typeof GithubLink>;
@@ -1 +1 @@
1
- {"version":3,"file":"GithubLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/GithubLink.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAMvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAmEH,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"GithubLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/GithubLink.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAMvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAoEH,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import {strip_end, strip_start} from '@fuzdev/fuz_util/string.js';
2
+ import {ensure_start, strip_end, strip_start} from '@fuzdev/fuz_util/string.js';
3
3
  import type {SvelteHTMLElements} from 'svelte/elements';
4
4
 
5
5
  import Svg from './Svg.svelte';
@@ -7,16 +7,20 @@
7
7
 
8
8
  const {
9
9
  path,
10
+ hash,
10
11
  children,
11
12
  ...rest
12
13
  }: SvelteHTMLElements['a'] & {
13
14
  path: string;
15
+ /** URL fragment to append, with or without the `#`. */
16
+ hash?: string;
14
17
  } = $props();
15
18
 
16
19
  const href = $derived(
17
- path.startsWith('https://')
20
+ (path.startsWith('https://')
18
21
  ? path
19
- : `https://developer.mozilla.org/en-US/docs/${strip_start(path, '/')}`,
22
+ : `https://developer.mozilla.org/en-US/docs/${strip_start(path, '/')}`) +
23
+ (hash ? ensure_start(hash, '#') : ''),
20
24
  );
21
25
 
22
26
  const final_children = $derived(children ?? strip_end(path, '/').split('/').at(-1)!);
@@ -1,6 +1,8 @@
1
1
  import type { SvelteHTMLElements } from 'svelte/elements';
2
2
  type $$ComponentProps = SvelteHTMLElements['a'] & {
3
3
  path: string;
4
+ /** URL fragment to append, with or without the `#`. */
5
+ hash?: string;
4
6
  };
5
7
  declare const MdnLink: import("svelte").Component<$$ComponentProps, {}, "">;
6
8
  type MdnLink = ReturnType<typeof MdnLink>;
@@ -1 +1 @@
1
- {"version":3,"file":"MdnLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/MdnLink.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAKvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAkCH,QAAA,MAAM,OAAO,sDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"MdnLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/MdnLink.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAKvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAoCH,QAAA,MAAM,OAAO,sDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type {SvelteHTMLElements} from 'svelte/elements';
3
+ import {ensure_start} from '@fuzdev/fuz_util/string.js';
3
4
 
4
5
  import {library_context} from './library.svelte.js';
5
6
  import {contextmenu_attachment} from './contextmenu_state.svelte.js';
@@ -7,11 +8,14 @@
7
8
 
8
9
  const {
9
10
  module_path,
11
+ hash,
10
12
  children,
11
13
  class: class_prop = 'chip',
12
14
  ...rest
13
15
  }: SvelteHTMLElements['a'] & {
14
16
  module_path: string; // TODO maybe rename?
17
+ /** URL fragment to append, with or without the `#`. */
18
+ hash?: string;
15
19
  } = $props();
16
20
 
17
21
  const library = library_context.get();
@@ -28,7 +32,7 @@
28
32
  <a
29
33
  {...rest}
30
34
  class="module_link {class_prop}"
31
- href={module.url_api}
35
+ href={module.url_api + (hash ? ensure_start(hash, '#') : '')}
32
36
  {@attach contextmenu_attachment(contextmenu_entries)}
33
37
  >
34
38
  <!-- eslint-enable svelte/no-navigation-without-resolve -->
@@ -1,6 +1,8 @@
1
1
  import type { SvelteHTMLElements } from 'svelte/elements';
2
2
  type $$ComponentProps = SvelteHTMLElements['a'] & {
3
3
  module_path: string;
4
+ /** URL fragment to append, with or without the `#`. */
5
+ hash?: string;
4
6
  };
5
7
  declare const ModuleLink: import("svelte").Component<$$ComponentProps, {}, "">;
6
8
  type ModuleLink = ReturnType<typeof ModuleLink>;
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ModuleLink.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAMvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC;AA6CH,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ModuleLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/ModuleLink.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAOvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AA+CH,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
@@ -24,7 +24,7 @@
24
24
 
25
25
  tome_context.set(tome); // TODO make reactive?
26
26
 
27
- const fragment = docs_slugify(tome.name);
27
+ const fragment = $derived(docs_slugify(tome.name));
28
28
 
29
29
  const at_root = $derived(page.url.pathname === resolve(docs_path as any));
30
30
  </script>
@@ -15,10 +15,15 @@
15
15
  }: SvelteHTMLElements['a'] & {
16
16
  name: string; // TODO type, generate from `tomes`?
17
17
  docs_path?: string;
18
+ /** URL fragment to append, with or without the `#`. */
18
19
  hash?: string;
19
20
  } = $props();
20
21
 
21
- if (DEV) get_tome_by_name(name); // throws if not found
22
+ if (DEV) {
23
+ $effect(() => {
24
+ get_tome_by_name(name); // throws if not found
25
+ });
26
+ }
22
27
 
23
28
  // TODO add contextmenu behavior
24
29
  </script>
@@ -2,6 +2,7 @@ import type { SvelteHTMLElements } from 'svelte/elements';
2
2
  type $$ComponentProps = SvelteHTMLElements['a'] & {
3
3
  name: string;
4
4
  docs_path?: string;
5
+ /** URL fragment to append, with or without the `#`. */
5
6
  hash?: string;
6
7
  };
7
8
  declare const TomeLink: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -1 +1 @@
1
- {"version":3,"file":"TomeLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/TomeLink.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAKvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AA2BH,QAAA,MAAM,QAAQ,sDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"TomeLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/TomeLink.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAKvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AA+BH,QAAA,MAAM,QAAQ,sDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -24,7 +24,7 @@
24
24
  children?: Snippet;
25
25
  } = $props();
26
26
 
27
- const fragment = docs_slugify(text);
27
+ const fragment = $derived(docs_slugify(text));
28
28
 
29
29
  const register_section_header = register_section_header_context.get();
30
30
  if (!register_section_header) {
@@ -35,7 +35,7 @@
35
35
 
36
36
  // Auto-detect tag based on depth if not explicitly provided
37
37
  const depth = section_depth_context.get();
38
- const final_tag = tag ?? (depth === 1 ? 'h2' : depth === 2 ? 'h3' : 'h4');
38
+ const final_tag = $derived(tag ?? (depth === 1 ? 'h2' : depth === 2 ? 'h3' : 'h4'));
39
39
 
40
40
  // Get own section's ID from context
41
41
  const my_section_id = section_id_context.get();
@@ -4,7 +4,14 @@
4
4
  import DeclarationLink from './DeclarationLink.svelte';
5
5
  import {library_context} from './library.svelte.js';
6
6
 
7
- const {type}: {type: string} = $props();
7
+ const {
8
+ type,
9
+ hash,
10
+ }: {
11
+ type: string;
12
+ /** URL fragment to append, with or without the `#`. */
13
+ hash?: string;
14
+ } = $props();
8
15
 
9
16
  const library = library_context.get();
10
17
 
@@ -13,7 +20,7 @@
13
20
  </script>
14
21
 
15
22
  {#if library.lookup_declaration(type)}
16
- <DeclarationLink name={type} />
23
+ <DeclarationLink name={type} {hash} />
17
24
  {:else}
18
- <Code inline content={type} lang="ts" />
25
+ <Code lang="ts" content={type} inline />
19
26
  {/if}
@@ -1,5 +1,7 @@
1
1
  type $$ComponentProps = {
2
2
  type: string;
3
+ /** URL fragment to append, with or without the `#`. */
4
+ hash?: string;
3
5
  };
4
6
  declare const TypeLink: import("svelte").Component<$$ComponentProps, {}, "">;
5
7
  type TypeLink = ReturnType<typeof TypeLink>;
@@ -1 +1 @@
1
- {"version":3,"file":"TypeLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/TypeLink.svelte"],"names":[],"mappings":"AAQC,KAAK,gBAAgB,GAAI;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAuBzC,QAAA,MAAM,QAAQ,sDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"TypeLink.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/TypeLink.svelte"],"names":[],"mappings":"AAQC,KAAK,gBAAgB,GAAI;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AA0BH,QAAA,MAAM,QAAQ,sDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"contextmenu_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/contextmenu_helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAGpE,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,eAAO,MAAM,iCAAiC,MAAM,CAAC;AACrD,eAAO,MAAM,yCAAyC,KAAK,CAAC;AAC5D,eAAO,MAAM,sCAAsC,MAAM,CAAC;AAC1D,eAAO,MAAM,4CAA4C,KAAK,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,WAAW,GAAG,IAAI,EAC1B,UAAU,OAAO,KACf,MAAM,IAAI,WAAW,GAAG,UAIF,CAAC;AAI1B,eAAO,MAAM,oCAAoC,GAChD,aAAa,gBAAgB,KAC3B,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,CAWtB,CAAC;AAEJ,eAAO,MAAM,kCAAkC,GAC9C,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,KACxC,CAAC,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAO7B,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC/C,QAAQ,MAAM,EACd,YAAY,MAAM,EAClB,cAAc,MAAM,KAClB,MAAoE,CAAC;AAExE,eAAO,MAAM,mCAAmC,GAC/C,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,eAAe,MAAM,KACnB,MAAsE,CAAC"}
1
+ {"version":3,"file":"contextmenu_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/contextmenu_helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAGpE,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,eAAO,MAAM,iCAAiC,MAAM,CAAC;AACrD,eAAO,MAAM,yCAAyC,KAAK,CAAC;AAC5D,eAAO,MAAM,sCAAsC,MAAM,CAAC;AAC1D,eAAO,MAAM,4CAA4C,KAAK,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,WAAW,GAAG,IAAI,EAC1B,UAAU,OAAO,KACf,MAAM,IAAI,WAAW,GAAG,UAIF,CAAC;AAI1B,eAAO,MAAM,oCAAoC,GAChD,aAAa,gBAAgB,KAC3B,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,CAWtB,CAAC;AAEJ,eAAO,MAAM,kCAAkC,GAC7C,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,KAAG,CAAC,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAMxE,CAAC;AAEH,eAAO,MAAM,mCAAmC,GAC/C,QAAQ,MAAM,EACd,YAAY,MAAM,EAClB,cAAc,MAAM,KAClB,MAAoE,CAAC;AAExE,eAAO,MAAM,mCAAmC,GAC/C,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,eAAe,MAAM,KACnB,MAAsE,CAAC"}
@@ -26,14 +26,12 @@ export const contextmenu_create_keyboard_handlers = (contextmenu) => new Map([
26
26
  [' ', () => contextmenu.activate_selected()],
27
27
  ['Enter', () => contextmenu.activate_selected()],
28
28
  ]);
29
- export const contextmenu_create_keydown_handler = (keyboard_handlers) => {
30
- return (e) => {
31
- const handler = keyboard_handlers.get(e.key);
32
- if (!handler || is_editable(e.target))
33
- return;
34
- swallow(e);
35
- handler();
36
- };
29
+ export const contextmenu_create_keydown_handler = (keyboard_handlers) => (e) => {
30
+ const handler = keyboard_handlers.get(e.key);
31
+ if (!handler || is_editable(e.target))
32
+ return;
33
+ swallow(e);
34
+ handler();
37
35
  };
38
36
  export const contextmenu_calculate_constrained_x = (menu_x, menu_width, layout_width) => menu_x + Math.min(0, layout_width - (menu_x + menu_width));
39
37
  export const contextmenu_calculate_constrained_y = (menu_y, menu_height, layout_height) => menu_y + Math.min(0, layout_height - (menu_y + menu_height));
package/dist/tome.d.ts CHANGED
@@ -9,6 +9,9 @@ export declare const Tome: z.ZodObject<{
9
9
  related_declarations: z.ZodArray<z.ZodString>;
10
10
  }, z.core.$strip>;
11
11
  export type Tome = z.infer<typeof Tome>;
12
+ /**
13
+ * @param hash - URL fragment to append, with or without the `#`.
14
+ */
12
15
  export declare const to_tome_pathname: (item: Tome | string, docs_path?: string, hash?: string) => string;
13
16
  export declare const tomes_context: {
14
17
  get: (error_message?: string) => Map<string, {
@@ -1 +1 @@
1
- {"version":3,"file":"tome.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tome.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAKtB,eAAO,MAAM,IAAI;;;;;;;iBAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,gBAAgB,GAC5B,MAAM,IAAI,GAAG,MAAM,EACnB,kBAA6B,EAC7B,OAAO,MAAM,KACX,MAIF,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAsC,CAAC;AAEjE,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,IAK/C,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAyB,CAAC"}
1
+ {"version":3,"file":"tome.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tome.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAMtB,eAAO,MAAM,IAAI;;;;;;;iBAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC5B,MAAM,IAAI,GAAG,MAAM,EACnB,kBAA6B,EAC7B,OAAO,MAAM,KACX,MAIF,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAsC,CAAC;AAEjE,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,IAK/C,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAyB,CAAC"}
package/dist/tome.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { resolve } from '$app/paths';
2
2
  import { z } from 'zod';
3
+ import { ensure_start } from '@fuzdev/fuz_util/string.js';
3
4
  import { create_context } from './context_helpers.js';
4
5
  import { DOCS_PATH_DEFAULT, docs_slugify } from './docs_helpers.svelte.js';
5
6
  export const Tome = z.object({
@@ -11,10 +12,13 @@ export const Tome = z.object({
11
12
  related_modules: z.array(z.string()),
12
13
  related_declarations: z.array(z.string()),
13
14
  });
15
+ /**
16
+ * @param hash - URL fragment to append, with or without the `#`.
17
+ */
14
18
  export const to_tome_pathname = (item, docs_path = DOCS_PATH_DEFAULT, hash) => {
15
19
  const name = typeof item === 'string' ? item : item.name;
16
20
  const path = docs_path + '/' + docs_slugify(name);
17
- return resolve((hash ? path + '#' + hash : path));
21
+ return resolve((hash ? path + ensure_start(hash, '#') : path));
18
22
  };
19
23
  export const tomes_context = create_context();
20
24
  export const get_tome_by_name = (name) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_ui",
3
- "version": "0.177.0",
3
+ "version": "0.177.1",
4
4
  "description": "Svelte UI library",
5
5
  "motto": "friendly user zystem",
6
6
  "glyph": "🧶",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@changesets/changelog-git": "^0.2.1",
64
- "@fuzdev/fuz_code": "^0.38.0",
64
+ "@fuzdev/fuz_code": "^0.39.0",
65
65
  "@fuzdev/fuz_css": "^0.42.1",
66
66
  "@fuzdev/fuz_util": "^0.45.1",
67
67
  "@jridgewell/trace-mapping": "^0.3.31",
@@ -39,16 +39,14 @@ export const contextmenu_create_keyboard_handlers = (
39
39
  ['Enter', () => contextmenu.activate_selected()],
40
40
  ]);
41
41
 
42
- export const contextmenu_create_keydown_handler = (
43
- keyboard_handlers: Map<string, () => void>,
44
- ): ((e: KeyboardEvent) => void) => {
45
- return (e: KeyboardEvent): void => {
42
+ export const contextmenu_create_keydown_handler =
43
+ (keyboard_handlers: Map<string, () => void>): ((e: KeyboardEvent) => void) =>
44
+ (e: KeyboardEvent): void => {
46
45
  const handler = keyboard_handlers.get(e.key);
47
46
  if (!handler || is_editable(e.target)) return;
48
47
  swallow(e);
49
48
  handler();
50
49
  };
51
- };
52
50
 
53
51
  export const contextmenu_calculate_constrained_x = (
54
52
  menu_x: number,
package/src/lib/tome.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import {resolve} from '$app/paths';
2
2
  import type {Component} from 'svelte';
3
3
  import {z} from 'zod';
4
+ import {ensure_start} from '@fuzdev/fuz_util/string.js';
4
5
 
5
6
  import {create_context} from './context_helpers.js';
6
7
  import {DOCS_PATH_DEFAULT, docs_slugify} from './docs_helpers.svelte.js';
@@ -16,6 +17,9 @@ export const Tome = z.object({
16
17
  });
17
18
  export type Tome = z.infer<typeof Tome>;
18
19
 
20
+ /**
21
+ * @param hash - URL fragment to append, with or without the `#`.
22
+ */
19
23
  export const to_tome_pathname = (
20
24
  item: Tome | string,
21
25
  docs_path = DOCS_PATH_DEFAULT,
@@ -23,7 +27,7 @@ export const to_tome_pathname = (
23
27
  ): string => {
24
28
  const name = typeof item === 'string' ? item : item.name;
25
29
  const path = docs_path + '/' + docs_slugify(name);
26
- return resolve((hash ? path + '#' + hash : path) as any);
30
+ return resolve((hash ? path + ensure_start(hash, '#') : path) as any);
27
31
  };
28
32
 
29
33
  export const tomes_context = create_context<Map<string, Tome>>();