@sewadah/selaras-docs 1.3.0 → 1.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.3.2
4
+
5
+ [compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.3.1...selaras-docs-v1.3.2)
6
+
7
+ ### 🚀 Enhancements
8
+
9
+ - **feat(docs):** add templates catalogue and navigation ([3973c61](https://github.com/sewadahapp/selaras/commit/3973c610c3f6bbdc998ba189d15001c37382ddf4))
10
+ - **feat(docs):** redesign the homepage around four theming edits ([a9e508d](https://github.com/sewadahapp/selaras/commit/a9e508d9b0ab99271a2caaa3ec6cf805515ec35c))
11
+ - **feat(agent)!:** move the MCP server into @sewadah/selaras-mcp ([d4f8848](https://github.com/sewadahapp/selaras/commit/d4f88485a0841210b5d3f16a514b18193de4bfe5))
12
+
13
+ ### 🩹 Fixes
14
+
15
+ - **fix(docs):** recover stale tabs after deployment ([c7f7bdc](https://github.com/sewadahapp/selaras/commit/c7f7bdc62df3c161cf300c815289bbce6e42dee4))
16
+ - **fix(select):** preserve search height with overflowing options ([4a71179](https://github.com/sewadahapp/selaras/commit/4a7117995fc1fd46f30ac883720274cee33f4fa0))
17
+ - **fix(release):** stage changelogs only for selected packages ([ec0f11c](https://github.com/sewadahapp/selaras/commit/ec0f11cae742122a5645414a5be58d2ac902f3dd))
18
+
19
+ ### 📖 Documentation
20
+
21
+ - **docs:** describe Selaras as a Nuxt component library ([4869b74](https://github.com/sewadahapp/selaras/commit/4869b74572284fa5e40625bb0e195a8f5b474818))
22
+
23
+ ### 🤖 Other changes
24
+
25
+ - **test(agent):** resolve the packed server's dependencies from its own workspace ([4678a1d](https://github.com/sewadahapp/selaras/commit/4678a1d7106ab808c96051c8e29d7f87a13141b7))
26
+ - **chore:** stop tracking local design-tool context ([560713f](https://github.com/sewadahapp/selaras/commit/560713f4562903f2ebc952c228f3ba2d4659f0f0))
27
+ - **build(deps):** bump vitest to v5 and happy-dom to v21 ([ebae6e2](https://github.com/sewadahapp/selaras/commit/ebae6e2d7db6785f53e092d63d17273d3b52f49c))
28
+ - **build(deps):** bump dev tooling within current majors ([17bdd8b](https://github.com/sewadahapp/selaras/commit/17bdd8bb6322a19edbc11f9188b73c3b00eef4ef))
29
+ - **build(deps):** bump runtime dependencies and raise their minimums ([1a3b889](https://github.com/sewadahapp/selaras/commit/1a3b8891d2be0140dd16c81a0e9ef19361f6c35d))
30
+ - **build(deps):** bump @nuxt/icon to v2 ([5076bed](https://github.com/sewadahapp/selaras/commit/5076bed7048f69e8cdd372173d0aaee3ebd14b86))
31
+
32
+ Published against `@sewadah/selaras` ^1.0.0.
33
+
34
+ ## v1.3.1
35
+
36
+ [compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.3.0...selaras-docs-v1.3.1)
37
+
38
+ ### 🚀 Enhancements
39
+
40
+ - **feat(docs):** prepare Cloudflare Markdown negotiation rules ([7beb431](https://github.com/sewadahapp/selaras/commit/7beb431ac798eb24fc4021d01b93cd477cca34ee))
41
+ - **feat(docs):** declare AI content usage preferences ([2434ffe](https://github.com/sewadahapp/selaras/commit/2434ffe475b63c862ca1575afb90a497b4742699))
42
+ - **feat(docs):** declare explicit AI crawler access rules ([a2a624c](https://github.com/sewadahapp/selaras/commit/a2a624cbfdaa56cc9fa77d63bdcf08578e22e421))
43
+ - **feat(docs):** generate robots.txt with sitemap discovery ([a8e4ed6](https://github.com/sewadahapp/selaras/commit/a8e4ed6fc7c97beccb3dfab7796ce085d9befa8f))
44
+ - **feat(toolbar):** add shared controls and editor blocks ([dc56fd8](https://github.com/sewadahapp/selaras/commit/dc56fd8d92e19cefe37bd7b261c08937bafaa02c))
45
+ - **feat(docs):** redesign homepage with interactive previews ([878a542](https://github.com/sewadahapp/selaras/commit/878a542f10b0c8310eed4be8759bd80f5017e800))
46
+ - **feat(editable):** add inline text editing with draft controls ([078649e](https://github.com/sewadahapp/selaras/commit/078649e219dfcf4553a02e3f3a6ae0a8914d7bf0))
47
+
48
+ ### 🩹 Fixes
49
+
50
+ - **fix(docs):** make editor read-only labels clickable ([8c521f2](https://github.com/sewadahapp/selaras/commit/8c521f2c84610f1df9b4e5953bed990d0b0ec9aa))
51
+ - **fix(forms):** unify clear button styling and behavior ([c669eb3](https://github.com/sewadahapp/selaras/commit/c669eb39f7c6f7246a892804447e95a533c327c8))
52
+ - **fix(forms):** align field and button heights across sizes ([818c325](https://github.com/sewadahapp/selaras/commit/818c325b24525927be85a21a7c46a875484fc6f0))
53
+ - **fix(listbox):** reuse checkbox component for selection indicators ([1abf48b](https://github.com/sewadahapp/selaras/commit/1abf48b75004754de1ea38a796015ae978047c76))
54
+
55
+ ### 📖 Documentation
56
+
57
+ - **docs(agent):** request optional source attribution ([e279f40](https://github.com/sewadahapp/selaras/commit/e279f4050edae50be0b1e85f085eaa8ea82a9781))
58
+
59
+ ### 🤖 Other changes
60
+
61
+ - **ci:** enforce conventional commits and pre-commit checks ([1b5922f](https://github.com/sewadahapp/selaras/commit/1b5922f5b8534920f9c054d1611ebc2eb7dc377d))
62
+
63
+ Published against `@sewadah/selaras` ^0.10.0.
64
+
3
65
  ## v1.3.0
4
66
 
5
67
  [compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.2.4...selaras-docs-v1.3.0)
package/README.md CHANGED
@@ -37,6 +37,20 @@ need an app root, Content config, or stylesheet for the default setup.
37
37
  `nuxt` remains a peer because the documentation site is a Nuxt application;
38
38
  the layer is normally a development dependency, just like Nuxt itself.
39
39
 
40
+ ## Updates after deployment
41
+
42
+ In production, the layer checks Nuxt's latest build manifest before navigation
43
+ and when a tab becomes visible again. A confirmed build change reloads the page
44
+ at the requested URL. Missing content also triggers a fresh build check before
45
+ becoming a 404. Offline or failed checks keep the existing page available;
46
+ checks for an unchanged build do not reload it. This uses Nuxt's app manifest
47
+ and is disabled when `experimental.appManifest` is false.
48
+
49
+ Serve HTML with `Cache-Control: no-cache` so reloads revalidate it, and avoid
50
+ caching `/_nuxt/builds/latest.json` as immutable. On static hosts, configure
51
+ these headers through the hosting provider or CDN. Hashed JavaScript and CSS
52
+ can keep their normal asset caching.
53
+
40
54
  ## Customization
41
55
 
42
56
  Use `app.config.ts` for site identity and the default shell:
@@ -278,10 +278,6 @@
278
278
  display: none;
279
279
  }
280
280
 
281
- .selaras-docs-nav-toggle {
282
- display: none;
283
- }
284
-
285
281
  /* Reserve the sidebar's width for the brand, so the header menu's first
286
282
  label lines up with the page content: sidebar (16rem) + the content's
287
283
  inset from it (4rem), less the header's own padding (1.5rem), the
@@ -295,6 +291,12 @@
295
291
  }
296
292
  }
297
293
 
294
+ @media (min-width: 80rem) {
295
+ .selaras-docs-nav-toggle {
296
+ display: none;
297
+ }
298
+ }
299
+
298
300
  @media (max-width: 63.999rem) {
299
301
  .selaras-docs-main {
300
302
  padding: 1.5rem;
@@ -9,6 +9,7 @@ const siteName = computed(() => docsConfig.value.header?.title ?? docsConfig.val
9
9
  const headerLinks = computed(() => docsConfig.value.header?.links ?? [])
10
10
  const repositoryUrl = computed(() => docsConfig.value.repository?.url)
11
11
  const sidebarEnabled = computed(() => docsConfig.value.sidebar?.enabled !== false)
12
+ const mobileNavigationEnabled = computed(() => sidebarEnabled.value || headerLinks.value.length > 0)
12
13
 
13
14
  watch(() => route.path, () => {
14
15
  navigationOpen.value = false
@@ -32,7 +33,7 @@ watch(() => route.path, () => {
32
33
  v-if="headerLinks.length"
33
34
  :items="headerLinks"
34
35
  variant="link"
35
- :ui="{ root: 'hidden w-auto lg:flex' }"
36
+ :ui="{ root: 'hidden w-auto xl:flex' }"
36
37
  />
37
38
  <div class="selaras-docs-header-actions">
38
39
  <DocsSearchButton v-if="docsConfig.header?.search !== false" />
@@ -51,7 +52,7 @@ watch(() => route.path, () => {
51
52
  color="neutral"
52
53
  />
53
54
  <SButton
54
- v-if="sidebarEnabled"
55
+ v-if="mobileNavigationEnabled"
55
56
  variant="ghost"
56
57
  color="neutral"
57
58
  class="selaras-docs-nav-toggle"
@@ -62,9 +63,16 @@ watch(() => route.path, () => {
62
63
  </SButton>
63
64
  </div>
64
65
  </SHeader>
65
- <SDrawer v-if="sidebarEnabled" v-model:open="navigationOpen" side="left" title="Documentation navigation" :handle="false">
66
+ <SDrawer v-if="mobileNavigationEnabled" v-model:open="navigationOpen" side="left" title="Documentation navigation" :handle="false">
66
67
  <template #body>
67
- <SContentNavigation :navigation="navigation ?? []" :collapsed="docsConfig.sidebar?.collapsed" />
68
+ <SNavigationMenu
69
+ v-if="headerLinks.length"
70
+ :items="headerLinks"
71
+ orientation="vertical"
72
+ aria-label="Main navigation"
73
+ :ui="{ root: 'mb-6 w-full' }"
74
+ />
75
+ <SContentNavigation v-if="sidebarEnabled" :navigation="navigation ?? []" :collapsed="docsConfig.sidebar?.collapsed" />
68
76
  </template>
69
77
  </SDrawer>
70
78
  </template>
@@ -10,9 +10,12 @@ import ProsePre from '@sewadah/selaras/components/ProsePre.vue'
10
10
 
11
11
  const route = useRoute()
12
12
  const appConfig = useAppConfig()
13
+ const nuxtApp = useNuxtApp()
13
14
  const { data: page, error, status, refresh } = await useAsyncData(`selaras-docs:${route.path}`, () => queryCollection('docs').path(route.path).first())
14
15
 
15
- if (!page.value && !error.value) {
16
+ const recoveringBuild = import.meta.client && (!page.value || error.value)
17
+ && await nuxtApp.$docsCheckBuild(route.fullPath, true)
18
+ if (!page.value && !error.value && !recoveringBuild) {
16
19
  throw createError({ statusCode: 404, statusMessage: 'Documentation page not found', fatal: true })
17
20
  }
18
21
  if (import.meta.server && error.value)
@@ -0,0 +1,60 @@
1
+ import { appManifest } from '#build/nuxt.config.mjs'
2
+ import { createDocsBuildUpdate } from '../utils/build-update'
3
+
4
+ export default defineNuxtPlugin((nuxtApp) => {
5
+ const config = useRuntimeConfig()
6
+ const router = useRouter()
7
+ const check = import.meta.dev || !appManifest || !config.app.buildId
8
+ ? async () => false
9
+ : createDocsBuildUpdate({
10
+ buildId: config.app.buildId,
11
+ fetchLatest: () => $fetch(`${(config.app.cdnURL || config.app.baseURL).replace(/\/$/, '')}/${config.app.buildAssetsDir.replace(/^\/|\/$/g, '')}/builds/latest.json`, {
12
+ cache: 'no-store',
13
+ query: { t: Date.now() },
14
+ timeout: 3000,
15
+ retry: 0,
16
+ }),
17
+ reload: (path) => {
18
+ const target = new URL(`${config.app.baseURL.replace(/\/$/, '')}${path}`, window.location.href)
19
+ const sameDocument = target.pathname === window.location.pathname && target.search === window.location.search
20
+ if (sameDocument && target.hash !== window.location.hash)
21
+ window.history.replaceState(window.history.state, '', target.href)
22
+ nuxtApp.runWithContext(() => reloadNuxtApp({
23
+ // Omitting path reloads the document and retains its query/hash.
24
+ // Assigning an existing URL with a fragment only navigates within it.
25
+ path: sameDocument ? undefined : `${target.pathname}${target.search}${target.hash}`,
26
+ persistState: true,
27
+ ttl: 60_000,
28
+ }))
29
+ },
30
+ })
31
+
32
+ if (import.meta.client && !import.meta.dev && appManifest) {
33
+ router.beforeEach(async (to) => {
34
+ if (!nuxtApp.isHydrating && await check(to.fullPath))
35
+ return false
36
+ })
37
+ nuxtApp.hook('app:error', () => {
38
+ void check(router.currentRoute.value.fullPath, true)
39
+ })
40
+ onNuxtReady(() => {
41
+ const onVisible = () => {
42
+ if (document.visibilityState === 'visible')
43
+ void check(router.currentRoute.value.fullPath, true)
44
+ }
45
+ const onPageShow = (event: PageTransitionEvent) => {
46
+ if (event.persisted)
47
+ onVisible()
48
+ }
49
+ document.addEventListener('visibilitychange', onVisible)
50
+ window.addEventListener('pageshow', onPageShow)
51
+ nuxtApp.vueApp.onUnmount(() => {
52
+ document.removeEventListener('visibilitychange', onVisible)
53
+ window.removeEventListener('pageshow', onPageShow)
54
+ })
55
+ void check(router.currentRoute.value.fullPath)
56
+ })
57
+ }
58
+
59
+ return { provide: { docsCheckBuild: check } }
60
+ })
@@ -0,0 +1,36 @@
1
+ interface BuildUpdateOptions {
2
+ buildId: string
3
+ fetchLatest: () => Promise<unknown>
4
+ reload: (path: string) => void
5
+ now?: () => number
6
+ interval?: number
7
+ }
8
+
9
+ /** Reload only after the server confirms this tab belongs to an older build. */
10
+ export function createDocsBuildUpdate({ buildId, fetchLatest, reload, now = Date.now, interval = 60_000 }: BuildUpdateOptions) {
11
+ let lastCheck = -Infinity
12
+ let pending: Promise<boolean> | undefined
13
+ let outdated = false
14
+ let reloading = false
15
+
16
+ return async (path: string, force = false): Promise<boolean> => {
17
+ if (!outdated && !pending && (force || now() - lastCheck >= interval)) {
18
+ lastCheck = now()
19
+ pending = fetchLatest().then(latest => !!latest && typeof latest === 'object'
20
+ && 'id' in latest && typeof latest.id === 'string' && latest.id.length > 0 && latest.id !== buildId).catch(() => false)
21
+ }
22
+ if (pending) {
23
+ const request = pending
24
+ outdated = await request
25
+ if (pending === request)
26
+ pending = undefined
27
+ }
28
+ if (!outdated)
29
+ return false
30
+ if (!reloading) {
31
+ reloading = true
32
+ reload(path)
33
+ }
34
+ return true
35
+ }
36
+ }
package/nuxt.config.mjs CHANGED
@@ -5,6 +5,9 @@ const { resolve } = createResolver(import.meta.url)
5
5
 
6
6
  export default defineNuxtConfig({
7
7
  modules: ['@sewadah/selaras', '@nuxt/content', resolve('./modules/docs.mjs')],
8
+ experimental: {
9
+ emitRouteChunkError: 'automatic-immediate',
10
+ },
8
11
  // Selaras supports Node versions with node:sqlite. Keeping Content on its
9
12
  // native connector lets an installed docs layer avoid a native addon.
10
13
  content: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sewadah/selaras-docs",
3
3
  "type": "module",
4
- "version": "1.3.0",
4
+ "version": "1.3.2",
5
5
  "description": "Nuxt Content documentation layer for Selaras",
6
6
  "repository": {
7
7
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@nuxt/content": "^3.16.0",
35
35
  "@nuxt/kit": "^4.5.2",
36
- "@sewadah/selaras": "^0.9.0",
36
+ "@sewadah/selaras": "^1.0.0",
37
37
  "tailwindcss": "^4.3.0"
38
38
  }
39
39
  }