Skip to content
Draft
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
7 changes: 4 additions & 3 deletions packages/theme-nonepress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,24 @@
"@mdx-js/react": "^3.0.0",
"@nullbot/docusaurus-plugin-docsmenu": "^3.4.2",
"@nullbot/docusaurus-plugin-getsidebar": "^3.4.2",
"@tailwindcss/postcss": "^4.1.4",
"@tailwindcss/typography": "^0.5.0",
"algoliasearch": "^5.17.1",
"algoliasearch-helper": "^3.22.6",
"autoprefixer": "^10.3.1",
"clsx": "^2.0.0",
"copy-text-to-clipboard": "^3.2.0",
"daisyui": "^4.0.0",
"daisyui": "^5.0.0",
"infima": "0.2.0-alpha.43",
"lodash": "^4.17.21",
"nprogress": "^0.2.0",
"postcss": "^8.4.26",
"postcss-import": "^15.1.0",
"postcss-nested": "^7.0.2",
"prism-react-renderer": "^2.3.0",
"prismjs": "^1.29.0",
"react-router-dom": "^5.3.4",
"rtlcss": "^4.1.0",
"tailwindcss": "^3.0.0",
"tailwindcss": "^4.0.0",
"tslib": "^2.6.0",
"utility-types": "^3.10.0"
},
Expand Down
36 changes: 3 additions & 33 deletions packages/theme-nonepress/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import path from "path";

import { readDefaultCodeTranslationMessages } from "@docusaurus/theme-translations";
import autoprefixer from "autoprefixer";
import postcssImport from "postcss-import";
import tailwindcss from "tailwindcss";
import tailwindNesting from "tailwindcss/nesting";
import tailwindcss from "@tailwindcss/postcss";
import postcssNested from "postcss-nested";

import defaultTailwindConfig from "./tailwind.config";
import { getTranslationFiles, translateThemeConfig } from "./translations";

import type { LoadContext, Plugin, PostCssOptions } from "@docusaurus/types";
import type {
PluginOptions,
ThemeConfig,
} from "@nullbot/docusaurus-theme-nonepress";
import type { Config as tailwindConfigType } from "tailwindcss";

const ThemeStorageKey = "theme";
const ThemeQueryStringKey = "docusaurus-theme";
Expand Down Expand Up @@ -84,14 +80,6 @@ const AnnouncementBarInlineJavaScript = `
document.documentElement.setAttribute('${AnnouncementBarDismissDataAttribute}', isDismissed());
})();`;

function getPurgeCSSPath(siteDir?: string): string[] {
const purge = [`${__dirname}/theme/**/*.{js,jsx,ts,tsx}`];
if (siteDir) {
purge.push(`${siteDir}/**/*.{js,jsx,ts,tsx,mdx}`);
}
return purge;
}

export default async function themeNonepress(
context: LoadContext,
options: PluginOptions,
Expand Down Expand Up @@ -165,25 +153,7 @@ export default async function themeNonepress(
},

configurePostCss(postCssOptions: PostCssOptions): PostCssOptions {
const purgeFiles = getPurgeCSSPath(siteDir);
const content = tailwindConfig?.content;
if (Array.isArray(content)) {
content.unshift(...purgeFiles);
} else {
content?.files.unshift(...purgeFiles);
}
const finalTailwindConfig: tailwindConfigType = {
presets: [defaultTailwindConfig, tailwindConfig].filter(
(config): config is tailwindConfigType => !!config,
),
content: content ?? purgeFiles,
};
postCssOptions.plugins.unshift(
postcssImport(),
tailwindNesting(),
tailwindcss(finalTailwindConfig),
autoprefixer(),
);
postCssOptions.plugins.unshift(postcssNested(), tailwindcss());

return postCssOptions;
},
Expand Down
7 changes: 6 additions & 1 deletion packages/theme-nonepress/src/styles.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
@import url("tailwindcss/tailwind");
@import "tailwindcss";
@source '**/theme/**/*.{js,jsx,ts,tsx}';
@plugin "@tailwindcss/typography";
@plugin "daisyui" {
themes: light --default, dark --prefersdark;
}

[data-theme] {
@apply transition-[color,background-color] duration-500;
Expand Down
14 changes: 0 additions & 14 deletions packages/theme-nonepress/src/tailwind.config.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Admonition/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.admonition {
@apply block w-full mb-4 p-4 text-left;
@apply rounded-box bg-base-200 text-base-content;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.announcement {
@apply relative z-40 flex items-center gap-x-6 sm:before:flex-1;
@apply px-6 py-2.5 sm:px-3.5 overflow-hidden;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@reference "../../styles.css";

.back-to-top {
@apply btn btn-circle btn-primary no-animation;
@apply btn btn-circle btn-primary;
@apply fixed z-10 right-5 bottom-5 shadow-md;
@apply transition transform opacity-0 scale-0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function CopyButton({ code, className }: Props): ReactNode {
description: "The copy button label on code blocks",
})}
className={clsx(
"btn btn-square btn-sm no-animation swap swap-rotate code-block-btn",
"btn btn-square btn-sm swap swap-rotate code-block-btn",
className,
isCopied && "swap-active",
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function WordWrapButton({
aria-label={title}
title={title}
className={clsx(
"btn btn-square btn-sm no-animation code-block-btn",
"btn btn-square btn-sm code-block-btn",
className,
isEnabled && "code-block-btn-active",
)}
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/CodeBlock/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.code-block {
&-container {
color: var(--prism-color);
Expand Down
2 changes: 2 additions & 0 deletions packages/theme-nonepress/src/theme/ColorModeToggle/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@reference "../../styles.css";

.appearance-toggle {
@apply inline-flex items-center shrink-0 h-6 w-11 rounded-full;
@apply bg-base-200 cursor-pointer;
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Details/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.details {
@apply w-full p-4 bg-base-200 rounded-box;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function HomeBreadcrumbItem(): ReactNode {
message: "Home page",
description: "The ARIA label for the home page in the breadcrumbs",
})}
className="btn btn-ghost btn-xs no-animation breadcrumbs-btn"
className="btn btn-ghost btn-xs breadcrumbs-btn"
href={homeHref}
>
<IconHome />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function BreadcrumbsItemLink({
href: string | undefined;
isLast: boolean;
}): ReactNode {
const className = "btn btn-ghost btn-xs no-animation breadcrumbs-btn";
const className = "btn btn-ghost btn-xs breadcrumbs-btn";
if (isLast) {
return (
<span
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.breadcrumbs {
@apply mb-2;

Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/DocCard/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.doc-card {
@apply h-full bg-base-200 border border-base-200;
@apply transition-[background-color,border-color] duration-500;
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/DocCardList/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.doc-card-list {
@apply grid grid-cols-2 gap-8;
}
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/DocItem/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.doc {
&-footer {
@apply mt-12;
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/DocPaginator/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.doc-paginator {
@apply flex flex-row gap-4 mt-12;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.doc-version-badge {
@apply font-semibold;
@apply transition-[color,background-color,border-color] duration-500;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.doc-version-banner {
& a {
@apply text-primary;
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/EditThisPage/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.edit-this-page {
@apply flex items-center gap-2 text-primary;

Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Footer/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.footer {
&-wrapper {
@apply w-full bg-base-200 text-base-content transition-[color,background-color] duration-500;
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Heading/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.anchor-sticky-navbar {
@apply scroll-mt-[7.5rem] lg:scroll-mt-[4.5rem];
}
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/LastUpdated/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.last-updated {
@apply italic text-[smaller];
}
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Layout/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.layout {
&-wrapper {
@apply grow;
Expand Down
3 changes: 2 additions & 1 deletion packages/theme-nonepress/src/theme/Menu/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.menu {
&-item {
&:hover,
Expand Down Expand Up @@ -26,7 +27,7 @@
}

&-button {
@apply btn btn-ghost btn-sm no-animation;
@apply btn btn-ghost btn-sm;
}

&-icon {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@reference "../../../styles.css";

.navbar-appearance {
&-mobile {
@apply flex justify-between items-center gap-2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@reference "../../../styles.css";
.navbar-version {
@apply ml-4;

&-label {
@apply btn btn-sm no-animation rounded-full;
@apply btn btn-sm rounded-full;
@apply text-xs leading-5 font-semibold text-base-content/80 normal-case;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-extra {
@apply hidden order-last pl-4;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../../styles.css";
.navbar-brand {
@apply flex items-center;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-locales {
@apply lg:flex lg:items-center;

Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Navbar/Logo/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-brand {
@apply flex items-center;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-mobile {
/* mobile toggle button */
&-toggle {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-mobile-sidebar {
max-width: calc(100vw - 10rem);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-tocpopdown {
max-height: calc(50vh - 4rem);
width: calc(100% - 2rem);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-primary {
&-layout {
@apply px-4 sm:px-6 md:px-8 py-4 w-full;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-search {
@apply flex;
@apply max-lg:ml-auto max-lg:order-last;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-secondary {
&-layout {
@apply px-6 py-3 lg:hidden w-full h-10;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.navbar-social-links {
@apply flex justify-center items-center gap-2;

Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Navbar/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.navbar {
@apply bg-base-100 text-base-content;
@apply border-b border-base-content/10;
Expand Down
3 changes: 2 additions & 1 deletion packages/theme-nonepress/src/theme/NavbarItem/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.navbar {
/* dropdown */
&-dropdown {
Expand Down Expand Up @@ -27,7 +28,7 @@
/* docs menu */
&-docs-menu {
&-content {
@apply block w-[28rem] xl:w-[36rem] 2xl:w-[48rem] pl-0 overflow-hidden whitespace-normal;
@apply p-0 w-[28rem] xl:w-[36rem] 2xl:w-[48rem] pl-0 overflow-hidden whitespace-normal;

&::before {
@apply content-[''] block h-1 left-0 absolute -top-1 w-full bg-transparent;
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Page/Sidebar/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.sidebar {
@apply flex flex-col h-full max-h-screen -mt-16 overflow-y-auto;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.sidebar-item {
&-link-icon {
@apply w-3 h-3 fill-current;
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/Page/TOC/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../../styles.css";
.toc {
@apply block -mt-24;

Expand Down
2 changes: 2 additions & 0 deletions packages/theme-nonepress/src/theme/Page/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@reference "../../styles.css";

.page {
@apply flex flex-row;
@apply max-w-[90rem] mx-auto px-4 sm:px-6 md:px-8 w-full;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.paginator {
@apply block w-full p-4 rounded-lg transition-colors;
@apply border border-base-content/10 hover:border-primary;
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/SearchBar/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
:root {
--docsearch-primary-color: oklch(var(--p)) !important;
}
Expand Down
1 change: 1 addition & 0 deletions packages/theme-nonepress/src/theme/SearchPage/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.doc-search-page {
@apply max-w-[90rem] mx-auto px-4 sm:px-6 md:px-8 w-full pt-8;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@reference "../../styles.css";
.skip-to-content {
@apply fixed -top-full left-4 focus:top-4 z-50;
@apply btn btn-primary rounded-lg shadow-md;
Expand Down
Loading