Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Shared whitespace rules for every uxfront-com repository.
# The canonical copy is .editorconfig in uxfront-com/.github. Change it there, then copy it.
# It matches @uxfront/oxfmt-config: tabs, with no fixed width, so each reader picks their own.
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

# YAML forbids tabs for indentation.
[*.{yml,yaml}]
indent_style = space
indent_size = 2

# Two trailing spaces are a line break in Markdown, so keep them.
[*.md]
trim_trailing_whitespace = false
102 changes: 51 additions & 51 deletions app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,55 @@ import { FRAMEWORKS } from "./data/frameworks";
import { BLOG_URL, CHANGELOG_URL, GITHUB_URL } from "./data/site";

export default defineAppConfig({
// The docs' GitHub, "Edit this page" and "Report an issue" links. Docus reads
// them from the git remote otherwise, which not every checkout has.
github: {
url: GITHUB_URL,
branch: "main",
},
docsTheme: {
// The frameworks the docs' examples come in (see app/data/frameworks.ts).
frameworks: FRAMEWORKS,
// The docs header's site name, set and signed "by UXFront" the way the
// homepage header does.
wordmark: { bold: "Open", regular: "Components" },
byline: true,
// The docs header's links, beside its buttons from 768px up and at the top of
// its menu below that, each highlighted on its page and the pages below it.
headerLinks: [
{ label: "Blog", to: BLOG_URL, activeFor: BLOG_URL },
{ label: "Changelog", to: CHANGELOG_URL, activeFor: CHANGELOG_URL },
// The introduction, rather than /docs, which only redirects to it.
{ label: "Documentation", to: "/docs/getting-started/introduction", activeFor: "/docs" },
],
},
ui: {
colors: {
// The periwinkle of the homepage's glow (see app/app.css for its shades).
primary: "indigo",
neutral: "zinc",
},
prose: {
// Tabs in the docs, like the MCP Server page's clients, scroll sideways on
// small screens rather than cut their labels short, as code groups do. The
// underline under the active tab moves up a pixel, onto the list's border,
// where scrolling doesn't clip it.
tabs: {
slots: {
list: "overflow-x-auto",
trigger: "shrink-0",
indicator: "bottom-0",
},
},
// Link cards, like the ones the Button's Overview has for its layers' pages,
// lead with a large icon. A hovered card's tint takes the muted description
// below 4.5:1 in light mode, so it darkens on hover.
card: {
slots: {
description: "group-hover:text-toned",
icon: "size-12 mb-4",
},
},
},
},
// The docs' GitHub, "Edit this page" and "Report an issue" links. Docus reads
// them from the git remote otherwise, which not every checkout has.
github: {
url: GITHUB_URL,
branch: "main",
},
docsTheme: {
// The frameworks the docs' examples come in (see app/data/frameworks.ts).
frameworks: FRAMEWORKS,
// The docs header's site name, set and signed "by UXFront" the way the
// homepage header does.
wordmark: { bold: "Open", regular: "Components" },
byline: true,
// The docs header's links, beside its buttons from 768px up and at the top of
// its menu below that, each highlighted on its page and the pages below it.
headerLinks: [
{ label: "Blog", to: BLOG_URL, activeFor: BLOG_URL },
{ label: "Changelog", to: CHANGELOG_URL, activeFor: CHANGELOG_URL },
// The introduction, rather than /docs, which only redirects to it.
{ label: "Documentation", to: "/docs/getting-started/introduction", activeFor: "/docs" },
],
},
ui: {
colors: {
// The periwinkle of the homepage's glow (see app/app.css for its shades).
primary: "indigo",
neutral: "zinc",
},
prose: {
// Tabs in the docs, like the MCP Server page's clients, scroll sideways on
// small screens rather than cut their labels short, as code groups do. The
// underline under the active tab moves up a pixel, onto the list's border,
// where scrolling doesn't clip it.
tabs: {
slots: {
list: "overflow-x-auto",
trigger: "shrink-0",
indicator: "bottom-0",
},
},
// Link cards, like the ones the Button's Overview has for its layers' pages,
// lead with a large icon. A hovered card's tint takes the muted description
// below 4.5:1 in light mode, so it darkens on hover.
card: {
slots: {
description: "group-hover:text-toned",
icon: "size-12 mb-4",
},
},
},
},
});
18 changes: 9 additions & 9 deletions app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
/* Identifiers in a table's first column, like prop names and rule IDs, read as
one word: don't break them at their hyphens. */
table td:first-child > code {
white-space: nowrap;
white-space: nowrap;
}

@layer theme {
/* Nuxt UI draws light-mode links in the 500 shade, below WCAG AA contrast on
/* Nuxt UI draws light-mode links in the 500 shade, below WCAG AA contrast on
white. The rules below replace both of its defaults, so dark mode is restated. */
:root,
.light {
--ui-primary: var(--ui-color-primary-600);
}
:root,
.light {
--ui-primary: var(--ui-color-primary-600);
}

.dark {
--ui-primary: var(--ui-color-primary-400);
}
.dark {
--ui-primary: var(--ui-color-primary-400);
}
}
12 changes: 7 additions & 5 deletions app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ const DocusApp = defineAsyncComponent(() => import("docus/app/app.vue"));

const route = useRoute();
const usesDocus = computed(() =>
["/docs", "/changelog", "/blog"].some((base) => route.path === base || route.path.startsWith(`${base}/`)),
["/docs", "/changelog", "/blog"].some(
(base) => route.path === base || route.path.startsWith(`${base}/`),
),
);

useHead({
titleTemplate: (title) => (title ? `${title} - Open Components` : "Open Components"),
titleTemplate: (title) => (title ? `${title} - Open Components` : "Open Components"),
});
</script>

<template>
<NuxtRouteAnnouncer />
<DocusApp v-if="usesDocus" />
<NuxtPage v-else />
<NuxtRouteAnnouncer />
<DocusApp v-if="usesDocus" />
<NuxtPage v-else />
</template>
5 changes: 3 additions & 2 deletions app/components/UContentSurround.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* It renders Nuxt UI's own with them: keep it in step with how Docus uses it.
*/
import type { ContentNavigationItem } from "@nuxt/content";

import ContentSurround from "#ui/components/content/ContentSurround.vue";
import { findSurround, sortNavigation } from "~/lib/navigation";

Expand All @@ -18,12 +19,12 @@ const route = useRoute();
// The tree Nuxt Content builds the surround from, with each page's description,
// which the links show under their titles, as Docus asks for.
const { data: navigation } = await useAsyncData("docs-surround", () =>
queryCollectionNavigation("docs", ["description"]),
queryCollectionNavigation("docs", ["description"]),
);
// A null where there's no page, which Nuxt UI's leaves a gap for, as Docus's has.
const pages = computed(() => findSurround(sortNavigation(navigation.value ?? []), route.path));
</script>

<template>
<ContentSurround :surround="pages as ContentNavigationItem[]" />
<ContentSurround :surround="pages as ContentNavigationItem[]" />
</template>
22 changes: 11 additions & 11 deletions app/components/app/AppHeaderBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ import { getFirstPagePath } from "docus/app/composables/useSubNavigation";
const navigation = inject<Ref<Array<ContentNavigationItem>>>("navigation");
const { subNavigationMode } = useSubNavigation();
const items = computed<Array<ContentNavigationItem>>(() => {
const nav = navigation?.value || [];
if (!subNavigationMode.value) {
return nav;
}
return nav.map(({ children, ...item }) => ({
...item,
path: children?.length ? getFirstPagePath({ ...item, children }) : item.path,
}));
const nav = navigation?.value || [];
if (!subNavigationMode.value) {
return nav;
}
return nav.map(({ children, ...item }) => ({
...item,
path: children?.length ? getFirstPagePath({ ...item, children }) : item.path,
}));
});
</script>

<template>
<AppHeaderLinks orientation="vertical" class="mb-4 -mx-2.5 md:hidden" />
<AppHeaderFramework />
<DocsNavigation :navigation="items" />
<AppHeaderLinks orientation="vertical" class="mb-4 -mx-2.5 md:hidden" />
<AppHeaderFramework />
<DocsNavigation :navigation="items" />
</template>
41 changes: 23 additions & 18 deletions app/components/blog/BlogByline.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { BlogCollectionItem } from "@nuxt/content";

import { readingTime } from "~/lib/reading-time";

/**
Expand All @@ -8,28 +9,32 @@ import { readingTime } from "~/lib/reading-time";
* day above the title instead, so the byline leaves it out there.
*/
const props = defineProps<{
post: BlogCollectionItem;
// On /blog, which lists every post.
listed?: boolean;
post: BlogCollectionItem;
// On /blog, which lists every post.
listed?: boolean;
}>();

const minutes = computed(() => readingTime(props.post.body));
</script>

<template>
<p class="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted">
<span>
By
<NuxtLink v-if="post.author.url" :to="post.author.url" class="font-medium text-default hover:underline">
{{ post.author.name }}
</NuxtLink>
<span v-else class="font-medium text-default">{{ post.author.name }}</span>
</span>
<template v-if="!listed">
<span aria-hidden="true">·</span>
<BlogDate :date="post.date" />
</template>
<span aria-hidden="true">·</span>
<span>{{ minutes }} min read</span>
</p>
<p class="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted">
<span>
By
<NuxtLink
v-if="post.author.url"
:to="post.author.url"
class="font-medium text-default hover:underline"
>
{{ post.author.name }}
</NuxtLink>
<span v-else class="font-medium text-default">{{ post.author.name }}</span>
</span>
<template v-if="!listed">
<span aria-hidden="true">·</span>
<BlogDate :date="post.date" />
</template>
<span aria-hidden="true">·</span>
<span>{{ minutes }} min read</span>
</p>
</template>
4 changes: 2 additions & 2 deletions app/components/blog/BlogDate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const props = defineProps<{ date: string }>();
// Posts are dated like 2026-11-18, which Date reads as midnight UTC: formatted in
// UTC, it's the same day in every time zone, on the server and in the browser.
const formatted = new Intl.DateTimeFormat("en-GB", { dateStyle: "long", timeZone: "UTC" }).format(
new Date(props.date),
new Date(props.date),
);
</script>

<template>
<time :datetime="date">{{ formatted }}</time>
<time :datetime="date">{{ formatted }}</time>
</template>
51 changes: 26 additions & 25 deletions app/components/changelog/ChangelogEntry.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import type { ChangelogCollectionItem } from "@nuxt/content";
import type { Component, FunctionalComponent } from "vue";

import { ProseH3, ProseH4 } from "#components";

/**
Expand All @@ -9,44 +10,44 @@ import { ProseH3, ProseH4 } from "#components";
* its notes and the link to read more.
*/
const props = defineProps<{
entry: ChangelogCollectionItem;
// On /changelog, which lists every entry.
listed?: boolean;
entry: ChangelogCollectionItem;
// On /changelog, which lists every entry.
listed?: boolean;
}>();

// The notes' headings start at `##`, right below the entry's own page's <h1>. The
// list titles each entry with an <h2>, so there they move down a level, and lose
// their ids, which every entry's New section would share.
const listedHeading =
(heading: Component): FunctionalComponent =>
(_props, { slots }) =>
h(heading, null, slots);
(heading: Component): FunctionalComponent =>
(_props, { slots }) =>
h(heading, null, slots);
const listedHeadings = { h2: listedHeading(ProseH3), h3: listedHeading(ProseH4) };

// Entries are dated like 2026-09-30, which Date reads as midnight UTC: formatted
// in UTC, it's the same day in every time zone, on the server and in the browser.
const date = new Intl.DateTimeFormat("en-GB", { dateStyle: "long", timeZone: "UTC" }).format(
new Date(props.entry.date),
new Date(props.entry.date),
);
</script>

<template>
<div class="flex items-center gap-3">
<UBadge :label="entry.category" color="primary" variant="subtle" size="lg" />
<time :datetime="entry.date" class="text-sm text-muted">{{ date }}</time>
</div>

<slot name="title" />

<ContentRenderer :value="entry" :components="listed ? listedHeadings : undefined" class="mt-4" />

<NuxtLink
v-if="entry.link"
:to="entry.link.to"
class="mt-6 inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline"
>
<UIcon name="i-lucide-book-open" class="size-4" />
{{ entry.link.label }}
<UIcon name="i-lucide-arrow-right" class="size-3.5" />
</NuxtLink>
<div class="flex items-center gap-3">
<UBadge :label="entry.category" color="primary" variant="subtle" size="lg" />
<time :datetime="entry.date" class="text-sm text-muted">{{ date }}</time>
</div>

<slot name="title" />

<ContentRenderer :value="entry" :components="listed ? listedHeadings : undefined" class="mt-4" />

<NuxtLink
v-if="entry.link"
:to="entry.link.to"
class="mt-6 inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline"
>
<UIcon name="i-lucide-book-open" class="size-4" />
{{ entry.link.label }}
<UIcon name="i-lucide-arrow-right" class="size-3.5" />
</NuxtLink>
</template>
Loading