@baybreezy/docd 0.0.5 → 0.0.7

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.
@@ -1,6 +1,5 @@
1
1
  @import "tailwindcss";
2
2
  @import "tw-animate-css";
3
- @source "../../../../";
4
3
 
5
4
  @config "../../../tailwind.config.cjs";
6
5
 
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <NuxtLink :href="github?.repo" target="_blank" rel="noopener noreferrer">
3
- <UiButton class="dark:text-muted-foreground" size="icon-sm" variant="ghost">
3
+ <UiButton size="icon-sm" variant="ghost">
4
4
  <Icon name="simple-icons:github" />
5
5
  </UiButton>
6
6
  </NuxtLink>
@@ -1,41 +1,48 @@
1
1
  <template>
2
- <UiPopover v-if="isDesktop">
3
- <UiTooltip>
4
- <UiTooltipTrigger as-child>
5
- <UiPopoverTrigger as-child>
6
- <UiButton size="icon-sm" variant="ghost">
7
- <Icon name="lucide:palette" />
8
- </UiButton>
9
- </UiPopoverTrigger>
10
- </UiTooltipTrigger>
11
- <UiPopoverContent
12
- translucent
13
- class="w-auto overflow-y-auto p-4"
14
- side="right"
15
- align="end"
16
- :side-offset="8"
17
- >
18
- <DocsThemeCustomizerCore />
19
- </UiPopoverContent>
20
- <UiTooltipContent> Customize theme </UiTooltipContent>
21
- </UiTooltip>
22
- </UiPopover>
23
- <UiDrawer v-else>
24
- <UiDrawerTrigger as-child>
25
- <UiButton size="icon-sm" variant="ghost">
2
+ <ClientOnly>
3
+ <template #fallback>
4
+ <UiButton size="icon-sm" variant="ghost" disabled>
26
5
  <Icon name="lucide:palette" />
27
6
  </UiButton>
28
- </UiDrawerTrigger>
29
- <UiDrawerContent class="w-full px-4 pb-6">
30
- <UiDrawerHeader>
31
- <UiDrawerTitle class="sr-only">Theme Customizer</UiDrawerTitle>
32
- <UiDrawerDescription class="sr-only"
33
- >Pick a style and color for your components.</UiDrawerDescription
7
+ </template>
8
+ <UiPopover v-if="isDesktop">
9
+ <UiTooltip>
10
+ <UiTooltipTrigger as-child>
11
+ <UiPopoverTrigger as-child>
12
+ <UiButton size="icon-sm" variant="ghost">
13
+ <Icon name="lucide:palette" />
14
+ </UiButton>
15
+ </UiPopoverTrigger>
16
+ </UiTooltipTrigger>
17
+ <UiPopoverContent
18
+ translucent
19
+ class="w-auto overflow-y-auto p-4"
20
+ side="right"
21
+ align="end"
22
+ :side-offset="8"
34
23
  >
35
- </UiDrawerHeader>
36
- <DocsThemeCustomizerCore />
37
- </UiDrawerContent>
38
- </UiDrawer>
24
+ <DocsThemeCustomizerCore />
25
+ </UiPopoverContent>
26
+ <UiTooltipContent> Customize theme </UiTooltipContent>
27
+ </UiTooltip>
28
+ </UiPopover>
29
+ <UiDrawer v-else>
30
+ <UiDrawerTrigger as-child>
31
+ <UiButton size="icon-sm" variant="ghost">
32
+ <Icon name="lucide:palette" />
33
+ </UiButton>
34
+ </UiDrawerTrigger>
35
+ <UiDrawerContent class="w-full px-4 pb-6">
36
+ <UiDrawerHeader>
37
+ <UiDrawerTitle class="sr-only">Theme Customizer</UiDrawerTitle>
38
+ <UiDrawerDescription class="sr-only"
39
+ >Pick a style and color for your components.</UiDrawerDescription
40
+ >
41
+ </UiDrawerHeader>
42
+ <DocsThemeCustomizerCore />
43
+ </UiDrawerContent>
44
+ </UiDrawer>
45
+ </ClientOnly>
39
46
  </template>
40
47
 
41
48
  <script lang="ts" setup>
@@ -13,7 +13,7 @@
13
13
  >
14
14
  <ClientOnly>
15
15
  <template #fallback>
16
- <Icon name="svg-spinners:180-ring-with-bg" />
16
+ <Icon name="lucide:sun-medium" />
17
17
  </template>
18
18
  <Icon :name="iconName" />
19
19
  </ClientOnly>
package/modules/config.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtModule } from "@nuxt/kit";
2
- import { defaultsDeep } from "lodash-es";
2
+ import { defu } from "defu";
3
3
 
4
4
  import { getGitBranch, getGitEnv, getLocalGitInfo } from "../utils/git";
5
5
  import { getPackageJsonMetadata, inferSiteURL } from "../utils/meta";
@@ -20,17 +20,20 @@ export default defineNuxtModule({
20
20
  gitInfo?.name ||
21
21
  "";
22
22
 
23
- nuxt.options.vite.optimizeDeps = defaultsDeep({}, nuxt.options.vite.optimizeDeps, {
23
+ nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
24
24
  include: [
25
25
  "mermaid",
26
26
  "lodash-es",
27
27
  "tailwind-variants",
28
28
  "@baybreezy/file-extension-icon",
29
29
  "@iconify/utils",
30
+ "vaul-vue",
31
+ "@vue/devtools-core",
32
+ "@vue/devtools-kit",
30
33
  ],
31
34
  });
32
35
 
33
- nuxt.options.llms = defaultsDeep({}, nuxt.options.llms, {
36
+ nuxt.options.llms = defu(nuxt.options.llms ?? {}, {
34
37
  domain: url,
35
38
  title: siteName,
36
39
  description: meta.description || "",
@@ -40,24 +43,24 @@ export default defineNuxtModule({
40
43
  },
41
44
  });
42
45
 
43
- nuxt.options.app.head = defaultsDeep({}, nuxt.options.app.head, {
46
+ nuxt.options.app.head = defu(nuxt.options.app.head ?? {}, {
44
47
  title: siteName,
45
48
  titleTemplate: `%s - ${siteName}`,
46
- } as typeof nuxt.options.app.head);
49
+ }) as typeof nuxt.options.app.head;
47
50
 
48
- nuxt.options.site = defaultsDeep({}, nuxt.options.site, {
51
+ nuxt.options.site = defu(nuxt.options.site ?? {}, {
49
52
  url: url || "",
50
53
  name: siteName,
51
54
  debug: false,
52
55
  }) as typeof nuxt.options.site;
53
56
 
54
57
  if (siteName) {
55
- nuxt.options.colorMode = defaultsDeep({}, nuxt.options.colorMode, {
58
+ nuxt.options.colorMode = defu(nuxt.options.colorMode ?? {}, {
56
59
  storageKey: `${siteName.toLocaleLowerCase().replace(/\s+/g, "-")}-color-mode`,
57
60
  }) as typeof nuxt.options.colorMode;
58
61
  }
59
62
 
60
- nuxt.options.appConfig.docd = defaultsDeep({}, nuxt.options.appConfig.docd, {
63
+ nuxt.options.appConfig.docd = defu(nuxt.options.appConfig.docd ?? {}, {
61
64
  github: {
62
65
  repo: gitInfo?.url ?? url ?? "",
63
66
  branch: getGitBranch(),
@@ -70,7 +73,7 @@ export default defineNuxtModule({
70
73
  },
71
74
  });
72
75
 
73
- nuxt.options.appConfig.seo = defaultsDeep({}, nuxt.options.appConfig.seo, {
76
+ nuxt.options.appConfig.seo = defu(nuxt.options.appConfig.seo ?? {}, {
74
77
  titleTemplate: `%s - ${siteName}`,
75
78
  title: siteName,
76
79
  description: meta.description || "",
@@ -80,9 +83,9 @@ export default defineNuxtModule({
80
83
  nuxt.options.appConfig.docd as { ui?: { colorMode?: string } } | undefined
81
84
  )?.ui?.colorMode;
82
85
  if (forcedColorMode === "light" || forcedColorMode === "dark") {
83
- nuxt.options.colorMode = defaultsDeep(
86
+ nuxt.options.colorMode = defu(
84
87
  { preference: forcedColorMode, fallback: forcedColorMode },
85
- nuxt.options.colorMode || {}
88
+ nuxt.options.colorMode ?? {}
86
89
  ) as typeof nuxt.options.colorMode;
87
90
  }
88
91
  },
package/modules/css.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import { readFile } from "node:fs/promises";
2
+
1
3
  import { addVitePlugin, createResolver, defineNuxtModule } from "@nuxt/kit";
2
- import { joinURL } from "ufo";
3
4
 
4
5
  export default defineNuxtModule({
5
6
  meta: {
@@ -8,24 +9,30 @@ export default defineNuxtModule({
8
9
  setup(_options, nuxt) {
9
10
  const resolver = createResolver(import.meta.url);
10
11
 
11
- // Absolute path to the layer's tailwind entry — this is the file that owns
12
- // `@import "tailwindcss"` and therefore controls Tailwind's scanner.
13
- const tailwindCssPath = resolver.resolve("../app/assets/css/tailwind.css");
12
+ // Absolute path to the layer's tailwind entry — resolved from this module's
13
+ // location so it stays correct whether docd is local or installed from npm.
14
+ const tailwindCssPath = resolver.resolve("../app/assets/css/tailwind.css").replace(/\\/g, "/");
14
15
 
15
- // The consuming app's content directory. We convert to forward-slashes so
16
- // the injected @source glob works on Windows too.
17
- const contentDir = joinURL(nuxt.options.rootDir, "content").replace(/\\/g, "/");
16
+ // Absolute paths that Tailwind needs to scan.
17
+ const rootDir = nuxt.options.rootDir.replace(/\\/g, "/");
18
+ const layerAppDir = resolver.resolve("../app").replace(/\\/g, "/");
18
19
 
19
- // Inject `@source <contentDir>/**/*` into tailwind.css
20
+ // Use the `load` hook rather than `transform` so our modified source is
21
+ // visible to @tailwindcss/vite's transform hook (which has enforce:"pre"
22
+ // and is registered earlier). Vite always runs `load` before `transform`.
20
23
  addVitePlugin({
21
24
  name: "docd:inject-tailwind-sources",
22
25
  enforce: "pre",
23
- transform(code: string, id: string) {
24
- if (id.split("?")[0] !== tailwindCssPath) return null;
25
- return {
26
- code: `${code}\n@source ${JSON.stringify(`${contentDir}/**/*`)};`,
27
- map: null,
28
- };
26
+ async load(id) {
27
+ const cleanId = id?.split("?")?.[0]?.replace(/\\/g, "/");
28
+ if (cleanId !== tailwindCssPath) return null;
29
+
30
+ const code = await readFile(tailwindCssPath, "utf8");
31
+ return [
32
+ code,
33
+ `@source ${JSON.stringify(`${rootDir}/**/*`)};`,
34
+ `@source ${JSON.stringify(`${layerAppDir}/**/*`)};`,
35
+ ].join("\n");
29
36
  },
30
37
  });
31
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baybreezy/docd",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "A Nuxt layer for building documentation sites with UI Thing.",
5
5
  "repository": {
6
6
  "type": "git",