@master/internal-site 0.2.7 → 0.2.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@master/internal-site",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "type": "module",
5
5
  "description": "First-party Astro and Svelte website framework for Master sites.",
6
6
  "engines": {
@@ -32,6 +32,7 @@
32
32
  /** Primary destinations, with community and preferences kept in a quiet footer. */
33
33
  let { class: className }: Props = $props()
34
34
  let opened = $state(false)
35
+ let mounted = $state(false)
35
36
  const id = $props.id()
36
37
  let dialog: HTMLDialogElement
37
38
  let trigger: HTMLButtonElement
@@ -96,6 +97,7 @@
96
97
  }
97
98
 
98
99
  onMount(() => {
100
+ mounted = true
99
101
  const wide = matchMedia('(width >= 64rem)')
100
102
  const motion = matchMedia('(prefers-reduced-motion: reduce)')
101
103
  const resize = () => { if (wide.matches && dialog.open) finishClose() }
@@ -114,7 +116,7 @@
114
116
  <IconMenu class="ui-menu-glyph" size={18} stroke={1.5} data-open={opened} aria-hidden="true" />
115
117
  {/snippet}
116
118
 
117
- <button bind:this={trigger} type="button" class={clsx('btn btn-quiet btn-square ui-menu-toggle', className)} data-variant="quiet" data-shape="icon"
119
+ <button bind:this={trigger} type="button" disabled={!mounted} class={clsx('btn btn-quiet btn-square ui-menu-toggle', className)} data-variant="quiet" data-shape="icon"
118
120
  aria-label={t('Menu')} aria-expanded={opened} aria-haspopup="dialog" aria-controls={id} onclick={open}>
119
121
  {@render lines()}
120
122
  </button>
@@ -2,7 +2,7 @@
2
2
  import '@master/internal-site/styles/interface.css'
3
3
  import '@master/internal-site/styles/system/search-trigger.css'
4
4
 
5
- import type { Snippet } from 'svelte'
5
+ import { onMount, type Snippet } from 'svelte'
6
6
  import type { HTMLButtonAttributes } from 'svelte/elements'
7
7
  import IconSearch from '@tabler/icons-svelte-runes/icons/search'
8
8
  import { openSearch, prefetchSearch, searchLabels } from '../contexts/search'
@@ -13,7 +13,10 @@
13
13
  }
14
14
 
15
15
  /** Opens the page's search dialog. Without children it renders the search field trigger (`ui-search-trigger`) with its shortcut. */
16
- let { class: className, children, onclick, onfocus, onpointerenter, type = 'button', ...props }: Props = $props()
16
+ let { class: className, children, onclick, onfocus, onpointerenter, type = 'button', disabled = false, ...props }: Props = $props()
17
+ // SSR must not offer an action before this island can receive it.
18
+ let mounted = $state(false)
19
+ onMount(() => { mounted = true })
17
20
  const { t, locale } = getSite()
18
21
  const { searchText, searchLabel } = searchLabels(t, locale)
19
22
 
@@ -23,7 +26,7 @@
23
26
  }
24
27
  </script>
25
28
 
26
- <button {...props} {type} class={className} aria-label={props['aria-label'] ?? searchLabel} aria-keyshortcuts="Meta+K Control+K" onclick={handleClick}
29
+ <button {...props} {type} disabled={!mounted || disabled} class={className} aria-label={props['aria-label'] ?? searchLabel} aria-keyshortcuts="Meta+K Control+K" onclick={handleClick}
27
30
  onpointerenter={event => { onpointerenter?.(event); prefetchSearch() }}
28
31
  onfocus={event => { onfocus?.(event); prefetchSearch() }}>
29
32
  {#if children}