@lupinum/ginko-docs 0.3.0-rc.2 → 0.3.0-rc.4

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Matthias Amon
3
+ Copyright (c) 2024-present Lupinum OG and contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -15,7 +15,7 @@ Ginko Docs is a Nuxt layer for focused documentation sites. It combines Ginko Co
15
15
  Install the layer and its Ginko Content peer:
16
16
 
17
17
  ```bash
18
- pnpm add -D @lupinum/ginko-docs@0.3.0-rc.2 @lupinum/ginko-content@0.4.0-rc.1
18
+ pnpm add -D @lupinum/ginko-docs@0.3.0-rc.4 @lupinum/ginko-content@0.4.0-rc.1
19
19
  ```
20
20
 
21
21
  Keep the public identity in one shared value:
package/app/app.config.ts CHANGED
@@ -18,6 +18,7 @@ export default {
18
18
  logo: { light: "/logo.svg", dark: "/logo-dark.svg" },
19
19
  docsSidebarSwitcher: "tabs",
20
20
  lupinumAttribution: true,
21
+ legalLinks: [],
21
22
  },
22
23
  nav: { links: "auto", socialIcons: false },
23
24
  banner: {
@@ -61,17 +61,29 @@ const resources = computed(() => [
61
61
  © <NuxtTime :datetime="currentYearDate" year="numeric" /> {{ site.name }}.
62
62
  {{ t("site.footer") }}
63
63
  </p>
64
- <p v-if="site.lupinumAttribution">
65
- {{ t("site.openSourceBy") }}
66
- <a
67
- href="https://lupinum.com"
68
- target="_blank"
69
- rel="noopener noreferrer"
70
- class="font-medium text-foreground underline decoration-border underline-offset-4 transition-colors hover:decoration-foreground"
64
+ <div class="flex flex-wrap items-center justify-center gap-x-4 gap-y-2 sm:justify-end">
65
+ <NuxtLink
66
+ v-for="link in site.legalLinks"
67
+ :key="link.href"
68
+ :to="link.href"
69
+ :target="link.external ? '_blank' : undefined"
70
+ :rel="link.external ? 'noopener noreferrer' : undefined"
71
+ class="underline decoration-border underline-offset-4 transition-colors hover:text-foreground hover:decoration-foreground"
71
72
  >
72
- Lupinum<span class="sr-only"> ({{ t("nav.externalLink") }})</span> </a
73
- >.
74
- </p>
73
+ {{ link.label }}
74
+ </NuxtLink>
75
+ <p v-if="site.lupinumAttribution">
76
+ {{ t("site.openSourceBy") }}
77
+ <a
78
+ href="https://lupinum.com"
79
+ target="_blank"
80
+ rel="noopener noreferrer"
81
+ class="font-medium text-foreground underline decoration-border underline-offset-4 transition-colors hover:decoration-foreground"
82
+ >
83
+ Lupinum<span class="sr-only"> ({{ t("nav.externalLink") }})</span> </a
84
+ >.
85
+ </p>
86
+ </div>
75
87
  </div>
76
88
  </div>
77
89
  </footer>
@@ -1,6 +1,9 @@
1
1
  import { useScriptPlausibleAnalytics } from "#imports";
2
2
  import { useGinkoDocsConfig } from "./useGinkoDocsConfig";
3
3
 
4
+ const PLAUSIBLE_INITIALIZER =
5
+ "window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()";
6
+
4
7
  export type AnalyticsProps = Record<string, string>;
5
8
 
6
9
  export interface GinkoAnalytics {
@@ -21,11 +24,19 @@ export function useGinkoAnalytics(): GinkoAnalytics {
21
24
  return { enabled: false, track: () => {} };
22
25
  }
23
26
 
27
+ const src = `https://plausible.io/js/pa-${scriptId}.js`;
28
+ useHead({
29
+ script: [
30
+ { key: "plausibleAnalytics", src, async: true },
31
+ { key: "plausibleAnalyticsInit", innerHTML: PLAUSIBLE_INITIALIZER },
32
+ ],
33
+ });
34
+
24
35
  const script = useScriptPlausibleAnalytics({
25
36
  scriptId,
26
- // The site ID comes from app.config at runtime. Keep the vendor script
27
- // external so Nuxt Scripts does not bundle its legacy fallback URL during
28
- // the build-time transform.
37
+ // Plausible verifies its exact snippet in server-rendered HTML. The head
38
+ // entry above provides it; Nuxt Scripts reuses the same keyed script for
39
+ // its typed proxy and lifecycle instead of adding a second tracker.
29
40
  scriptOptions: { bundle: false },
30
41
  });
31
42
 
@@ -22,6 +22,14 @@ export const useSiteNavigation = () => {
22
22
  logo: config.site.logo,
23
23
  url: config.site.url,
24
24
  lupinumAttribution: config.site.lupinumAttribution,
25
+ legalLinks: config.site.legalLinks.map((link) => {
26
+ const href = getLocalizedSiteText(link.to, locale.value);
27
+ return {
28
+ label: getLocalizedSiteText(link.label, locale.value),
29
+ href,
30
+ external: /^https?:\/\//.test(href),
31
+ };
32
+ }),
25
33
  }));
26
34
 
27
35
  const blogPath = computed(() => path("blog"));
@@ -0,0 +1,23 @@
1
+ import { defineNuxtModule } from "@nuxt/kit";
2
+
3
+ function componentDirectoryPath(entry: string | { path: string }) {
4
+ return (typeof entry === "string" ? entry : entry.path).replaceAll("\\", "/");
5
+ }
6
+
7
+ export function isNuxtScriptsComponentDirectory(entry: string | { path: string }) {
8
+ const path = componentDirectoryPath(entry);
9
+ return (
10
+ (path.includes("/node_modules/@nuxt/scripts/") || path.includes("/@nuxt+scripts@")) &&
11
+ path.endsWith("/node_modules/@nuxt/scripts/dist/runtime/components")
12
+ );
13
+ }
14
+
15
+ export default defineNuxtModule({
16
+ meta: { name: "ginko-docs-analytics-boundary" },
17
+ setup(_options, nuxt) {
18
+ nuxt.hook("components:dirs", (dirs) => {
19
+ const usedDirectories = dirs.filter((entry) => !isNuxtScriptsComponentDirectory(entry));
20
+ dirs.splice(0, dirs.length, ...usedDirectories);
21
+ });
22
+ },
23
+ });
@@ -1,6 +1,6 @@
1
- import { defineNuxtModule } from "@nuxt/kit";
1
+ import { defineNuxtModule, installModule } from "@nuxt/kit";
2
2
  import type {} from "@lupinum/ginko-content";
3
- import { localeCodes, localizedPath } from "../i18n/locales";
3
+ import { defaultLocale, localeCodes, locales, localizedPath } from "../i18n/locales";
4
4
  import { routeSlugs } from "../shared/route-slugs";
5
5
 
6
6
  interface PageRoute {
@@ -24,7 +24,28 @@ export function removeBlogPages(pages: PageRoute[], blogEnabled: boolean) {
24
24
 
25
25
  export default defineNuxtModule({
26
26
  meta: { name: "ginko-docs-feature-routing" },
27
- setup(_options, nuxt) {
27
+ async setup(_options, nuxt) {
28
+ const fallback = locales.find((locale) => locale.code === defaultLocale);
29
+ if (!fallback) throw new Error(`Missing locale definition for ${defaultLocale}.`);
30
+ const configuredLocales = nuxt.options.i18n?.locales;
31
+ if (!Array.isArray(configuredLocales) || configuredLocales.length === 0) {
32
+ nuxt.options.i18n = {
33
+ ...nuxt.options.i18n,
34
+ locales: [{ code: fallback.code, language: fallback.language, name: fallback.name }],
35
+ };
36
+ } else if (configuredLocales.length > 1) {
37
+ const fallbackIndex = configuredLocales.findIndex(
38
+ (locale) =>
39
+ typeof locale === "object" &&
40
+ locale !== null &&
41
+ locale.code === fallback.code &&
42
+ locale.language === fallback.language &&
43
+ locale.name === fallback.name,
44
+ );
45
+ if (fallbackIndex >= 0) configuredLocales.splice(fallbackIndex, 1);
46
+ }
47
+ await installModule("@nuxtjs/i18n");
48
+
28
49
  let blogEnabled = false;
29
50
 
30
51
  nuxt.hook("content:context", (context) => {
package/nuxt.config.ts CHANGED
@@ -1,17 +1,29 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
  import { dirname, join } from "node:path";
3
+ import { readFileSync } from "node:fs";
3
4
  import tailwindcss from "@tailwindcss/vite";
4
5
  import { transformerNotationDiff, transformerNotationHighlight } from "@shikijs/transformers";
5
6
  import darkPlus from "shiki/dist/themes/dark-plus.mjs";
6
7
  import lightPlus from "shiki/dist/themes/light-plus.mjs";
7
8
  import { contentComponentPolicy, contentComponentTags } from "./tags";
8
9
  import { i18nPages } from "./i18n/routes";
9
- import { localeCodes, localizedPath } from "./i18n/locales";
10
+ import { defaultLocale, localeCodes, locales, localizedPath } from "./i18n/locales";
10
11
  import { routeSlugs } from "./shared/route-slugs";
11
12
  import { layerIconCollections, layerIconNames } from "./icon-bundle";
12
13
 
13
14
  const root = dirname(fileURLToPath(import.meta.url));
14
15
  const app = join(root, "app");
16
+ const publicSansDirectory = join(root, "public/fonts/public-sans");
17
+ const publicSansFamilies = [400, 500, 600, 700].map((weight) => ({
18
+ name: "Public Sans",
19
+ global: true,
20
+ display: "swap" as const,
21
+ weight,
22
+ style: "normal",
23
+ src: `data:font/woff;base64,${readFileSync(
24
+ join(publicSansDirectory, `public-sans-${weight}-normal-latin.woff`),
25
+ ).toString("base64")}`,
26
+ }));
15
27
 
16
28
  export default defineNuxtConfig({
17
29
  build: {
@@ -25,10 +37,10 @@ export default defineNuxtConfig({
25
37
  join(root, "modules/feature-routing"),
26
38
  "@nuxt/icon",
27
39
  "@nuxt/fonts",
28
- "@nuxtjs/i18n",
29
40
  "@lupinum/ginko-content",
30
41
  "@nuxt/image",
31
42
  "@nuxt/scripts",
43
+ join(root, "modules/analytics-boundary"),
32
44
  "nuxt-og-image",
33
45
  "@nuxtjs/sitemap",
34
46
  "@nuxtjs/robots",
@@ -43,7 +55,7 @@ export default defineNuxtConfig({
43
55
  },
44
56
  mcp: {
45
57
  name: "Ginko Docs",
46
- version: "0.3.0-rc.2",
58
+ version: "0.3.0-rc.4",
47
59
  },
48
60
  components: {
49
61
  dirs: [
@@ -101,17 +113,24 @@ export default defineNuxtConfig({
101
113
  },
102
114
  },
103
115
  fonts: {
104
- defaults: {
105
- weights: [400, 500, 600, 700],
106
- styles: ["normal"],
107
- subsets: ["latin", "latin-ext"],
116
+ families: publicSansFamilies,
117
+ providers: {
118
+ adobe: false,
119
+ bunny: false,
120
+ fontshare: false,
121
+ fontsource: false,
122
+ google: false,
123
+ googleicons: false,
124
+ npm: false,
108
125
  },
109
- families: [{ name: "Public Sans", provider: "google", global: true }],
110
126
  },
111
127
  i18n: {
112
128
  customRoutes: "config",
113
129
  defaultLocale: "en",
114
130
  detectBrowserLanguage: false,
131
+ locales: locales
132
+ .filter((locale) => locale.code === defaultLocale)
133
+ .map(({ code, language, name }) => ({ code, language, name })),
115
134
  pages: i18nPages,
116
135
  strategy: "prefix_except_default",
117
136
  vueI18n: join(root, "i18n/i18n.config.ts"),
@@ -189,17 +208,6 @@ export default defineNuxtConfig({
189
208
  },
190
209
  },
191
210
  vite: {
192
- optimizeDeps: {
193
- include: [
194
- "@vueuse/core",
195
- "class-variance-authority",
196
- "clsx",
197
- "motion-v",
198
- "reka-ui",
199
- "tailwind-merge",
200
- "zod",
201
- ],
202
- },
203
211
  resolve: {
204
212
  dedupe: ["@lupinum/ginko-content", "vue", "vue-router"],
205
213
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lupinum/ginko-docs",
3
- "version": "0.3.0-rc.2",
3
+ "version": "0.3.0-rc.4",
4
4
  "description": "A Nuxt documentation layer powered by Ginko Content.",
5
5
  "keywords": [
6
6
  "content",
@@ -23,6 +23,7 @@
23
23
  "app",
24
24
  "i18n",
25
25
  "modules",
26
+ "public",
26
27
  "runtime",
27
28
  "server",
28
29
  "shared",
@@ -0,0 +1,93 @@
1
+ Copyright 2015 The Public Sans Project Authors (https://github.com/uswds/public-sans) PublicSans-Italic[wght].ttf: Copyright 2015 The Public Sans Project Authors (https://github.com/uswds/public-sans)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,12 @@
1
+ # Public Sans
2
+
3
+ These Latin-subset WOFF files are copied from `@fontsource/public-sans@5.3.0`:
4
+
5
+ - `public-sans-latin-400-normal.woff`
6
+ - `public-sans-latin-500-normal.woff`
7
+ - `public-sans-latin-600-normal.woff`
8
+ - `public-sans-latin-700-normal.woff`
9
+
10
+ They are renamed to the convention expected by the Nuxt Fonts local provider.
11
+ The upstream package is available at <https://fontsource.org/fonts/public-sans>.
12
+ Public Sans is licensed under the SIL Open Font License 1.1; see `LICENSE`.
@@ -71,6 +71,8 @@ export interface GinkoDocsAppConfig {
71
71
  logo: { light: string; dark: string };
72
72
  docsSidebarSwitcher: "dropdown" | "list" | "tabs";
73
73
  lupinumAttribution: boolean;
74
+ /** Legal and company links rendered in the footer. */
75
+ legalLinks: GinkoDocsLink[];
74
76
  };
75
77
  nav: {
76
78
  /** "auto" derives Docs (+ Blog when blog routes exist); an array overrides entirely. */