diff --git a/packages/ui/build-config.ts b/packages/ui/build-config.ts deleted file mode 100644 index 88d7e5f75..000000000 --- a/packages/ui/build-config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import path from 'node:path'; -import fs from 'node:fs/promises'; - -function getOutPath(src: string): string { - const replacedPath = src - .split('/') - .map((v) => (v === 'src' ? 'dist' : v)) - .join('/'); - - const info = path.parse(replacedPath); - - return path.join('./', info.dir, `${info.name}.js`).replace(path.sep, '/'); -} - -/** - * Inject imports for client components - */ -export async function injectImport(src: string): Promise { - const srcOut = getOutPath(src); - const sourceContent = (await fs.readFile(src)).toString(); - let outContent = (await fs.readFile(srcOut)).toString(); - - const regex = - /^declare const {(?(?:.|\n)*?)}: typeof import\((?.+)\)/gm; - let result; - - while ((result = regex.exec(sourceContent)) && result.groups) { - const { from, names } = result.groups; - const importName = from.slice(1, from.length - 1); - const replaceTo = `import {${names}} from ${JSON.stringify(importName)}`; - - outContent = `${replaceTo}\n${outContent}`; - } - - await fs.writeFile(srcOut, outContent); -} diff --git a/packages/ui/src/components/image-zoom.css b/packages/ui/src/components/image-zoom.css index 7f320379f..e621f821e 100644 --- a/packages/ui/src/components/image-zoom.css +++ b/packages/ui/src/components/image-zoom.css @@ -47,10 +47,6 @@ background-color: transparent; } -[data-rmiz-modal-overlay='visible'] { - @apply bg-fd-background; -} - [data-rmiz-modal-content] { width: 100%; height: 100%; diff --git a/packages/ui/src/components/image-zoom.tsx b/packages/ui/src/components/image-zoom.tsx index 4ff1c94c9..0f6366422 100644 --- a/packages/ui/src/components/image-zoom.tsx +++ b/packages/ui/src/components/image-zoom.tsx @@ -28,7 +28,7 @@ export function ImageZoom({ children, rmiz, ...props -}: ImageZoomProps): React.ReactElement { +}: ImageZoomProps) { return ( ( '*': { 'border-color': `theme('colors.fd-border')`, }, + + "[data-rmiz-modal-overlay='visible']": { + 'background-color': `theme('colors.fd-background')`, + }, body: { 'background-color': `theme('colors.fd-background')`, color: `theme('colors.fd-foreground')`, diff --git a/packages/ui/tsup.config.ts b/packages/ui/tsup.config.ts deleted file mode 100644 index 7a89c83b4..000000000 --- a/packages/ui/tsup.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { defineConfig } from 'tsup'; -import { injectImport } from './build-config'; - -const exportedComponents = [ - 'type-table', - 'image-zoom', - 'files', - 'tabs', - 'accordion', - 'steps', - 'inline-toc', - 'callout', - 'api', - 'card', - 'heading', - 'codeblock', - 'banner', - 'dialog/search', - 'dialog/search-default', - 'dialog/search-algolia', - 'dialog/search-orama', - 'layout/root-toggle', - 'layout/language-toggle', -]; - -const injectImports = [ - './src/page.tsx', - './src/mdx.tsx', - './src/layouts/docs.tsx', - './src/layouts/home.tsx', - './src/components/api.tsx', -]; - -export default defineConfig({ - entry: [ - `./src/components/{${exportedComponents.join(',')}}.tsx`, - './src/layouts/{docs,shared,home}.tsx', - './src/{i18n,home-layout,layout,page,provider,mdx,tailwind-plugin,og}.{ts,tsx}', - './src/**/*.client.tsx', - ], - external: ['server-only', './image-zoom.css', 'tailwindcss'], - async onSuccess() { - const replaceImports = injectImports.map((src) => injectImport(src)); - - await Promise.all(replaceImports); - }, - format: 'esm', - dts: true, - target: 'esnext', -});