@entifix/docs-engine 0.0.0-stage → 0.23.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.
- package/LICENSE +21 -0
- package/README.md +96 -2
- package/dist/directives.d.ts +25 -0
- package/dist/directives.d.ts.map +1 -0
- package/dist/directives.js +107 -0
- package/dist/directives.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/links.d.ts +19 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +17 -0
- package/dist/links.js.map +1 -0
- package/dist/markdown.d.ts +24 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +47 -0
- package/dist/markdown.js.map +1 -0
- package/dist/references.d.ts +20 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +16 -0
- package/dist/references.js.map +1 -0
- package/dist/site.d.ts +46 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +90 -0
- package/dist/site.js.map +1 -0
- package/dist/sources.d.ts +65 -0
- package/dist/sources.d.ts.map +1 -0
- package/dist/sources.js +115 -0
- package/dist/sources.js.map +1 -0
- package/dist/spec-support.d.ts +6 -0
- package/dist/spec-support.d.ts.map +1 -0
- package/dist/spec-support.js +17 -0
- package/dist/spec-support.js.map +1 -0
- package/dist/ui/head.d.ts +16 -0
- package/dist/ui/head.d.ts.map +1 -0
- package/dist/ui/head.js +29 -0
- package/dist/ui/head.js.map +1 -0
- package/dist/ui/index.d.ts +13 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/layout.d.ts +15 -0
- package/dist/ui/layout.d.ts.map +1 -0
- package/dist/ui/layout.js +30 -0
- package/dist/ui/layout.js.map +1 -0
- package/dist/ui/page.d.ts +21 -0
- package/dist/ui/page.d.ts.map +1 -0
- package/dist/ui/page.js +70 -0
- package/dist/ui/page.js.map +1 -0
- package/dist/ui/pagefind.d.ts +37 -0
- package/dist/ui/pagefind.d.ts.map +1 -0
- package/dist/ui/pagefind.js +48 -0
- package/dist/ui/pagefind.js.map +1 -0
- package/dist/ui/root.d.ts +22 -0
- package/dist/ui/root.d.ts.map +1 -0
- package/dist/ui/root.js +85 -0
- package/dist/ui/root.js.map +1 -0
- package/dist/ui/scheme.d.ts +12 -0
- package/dist/ui/scheme.d.ts.map +1 -0
- package/dist/ui/scheme.js +17 -0
- package/dist/ui/scheme.js.map +1 -0
- package/dist/ui/search-dialog.d.ts +15 -0
- package/dist/ui/search-dialog.d.ts.map +1 -0
- package/dist/ui/search-dialog.js +60 -0
- package/dist/ui/search-dialog.js.map +1 -0
- package/dist/ui/skip-link.d.ts +7 -0
- package/dist/ui/skip-link.d.ts.map +1 -0
- package/dist/ui/skip-link.js +17 -0
- package/dist/ui/skip-link.js.map +1 -0
- package/dist/ui/translations.d.ts +12 -0
- package/dist/ui/translations.d.ts.map +1 -0
- package/dist/ui/translations.js +48 -0
- package/dist/ui/translations.js.map +1 -0
- package/package.json +95 -3
- package/src/ui/docs.css +154 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SortedResult } from 'fumadocs-core/search';
|
|
2
|
+
/** What Pagefind's `search()` answers, as far as the engine reads it. */
|
|
3
|
+
interface PagefindSubResult {
|
|
4
|
+
readonly title: string;
|
|
5
|
+
readonly url: string;
|
|
6
|
+
readonly excerpt: string;
|
|
7
|
+
}
|
|
8
|
+
interface PagefindData {
|
|
9
|
+
readonly url: string;
|
|
10
|
+
readonly meta: {
|
|
11
|
+
readonly title?: string;
|
|
12
|
+
};
|
|
13
|
+
readonly excerpt: string;
|
|
14
|
+
readonly sub_results?: readonly PagefindSubResult[];
|
|
15
|
+
}
|
|
16
|
+
export interface Pagefind {
|
|
17
|
+
search: (query: string) => Promise<{
|
|
18
|
+
results: readonly {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
data: () => Promise<PagefindData>;
|
|
21
|
+
}[];
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Pagefind's results as fumadocs' sorted results: a page, then the sections of
|
|
26
|
+
* it that matched. A section whose URL is the page's own is the page's body and
|
|
27
|
+
* is shown as its text rather than as a second heading.
|
|
28
|
+
*/
|
|
29
|
+
export declare const toSortedResults: (pagefind: Pagefind, query: string) => Promise<SortedResult[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Loads the index `pagefind --site` wrote beside the export, once. It is a
|
|
32
|
+
* file of the exported site, not a module of the bundle, so the import is
|
|
33
|
+
* opaque to the bundler.
|
|
34
|
+
*/
|
|
35
|
+
export declare const loadPagefind: (indexUrl: string) => (() => Promise<Pagefind>);
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=pagefind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagefind.d.ts","sourceRoot":"","sources":["../../src/ui/pagefind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,yEAAyE;AACzE,UAAU,iBAAiB;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AACD,UAAU,YAAY;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACrD;AACD,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;QACjC,OAAO,EAAE,SAAS;YAChB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YACpB,IAAI,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;SACnC,EAAE,CAAC;KACL,CAAC,CAAC;CACJ;AAgBD;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,QAAQ,EAClB,OAAO,MAAM,KACZ,OAAO,CAAC,YAAY,EAAE,CA6BxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,CAQvE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Pagefind's excerpt is HTML with `<mark>`; fumadocs highlights by itself. */ const plain = (html)=>html.replace(/<[^>]*>/g, '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'");
|
|
2
|
+
/** At most this many pages; each brings its best sections along. */ const PAGES = 8;
|
|
3
|
+
const SECTIONS = 3;
|
|
4
|
+
/**
|
|
5
|
+
* Pagefind's results as fumadocs' sorted results: a page, then the sections of
|
|
6
|
+
* it that matched. A section whose URL is the page's own is the page's body and
|
|
7
|
+
* is shown as its text rather than as a second heading.
|
|
8
|
+
*/ export const toSortedResults = async (pagefind, query)=>{
|
|
9
|
+
if (query.trim() === '') return [];
|
|
10
|
+
const { results } = await pagefind.search(query);
|
|
11
|
+
const pages = await Promise.all(results.slice(0, PAGES).map((result)=>result.data()));
|
|
12
|
+
return pages.flatMap((page)=>{
|
|
13
|
+
var _page_meta_title, _page_sub_results;
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
id: page.url,
|
|
17
|
+
url: page.url,
|
|
18
|
+
type: 'page',
|
|
19
|
+
content: (_page_meta_title = page.meta.title) != null ? _page_meta_title : page.url
|
|
20
|
+
},
|
|
21
|
+
...((_page_sub_results = page.sub_results) != null ? _page_sub_results : []).filter((sub)=>sub.url !== page.url).slice(0, SECTIONS).map((sub)=>({
|
|
22
|
+
id: sub.url,
|
|
23
|
+
url: sub.url,
|
|
24
|
+
type: 'heading',
|
|
25
|
+
content: sub.title
|
|
26
|
+
})),
|
|
27
|
+
{
|
|
28
|
+
id: `${page.url}#excerpt`,
|
|
29
|
+
url: page.url,
|
|
30
|
+
type: 'text',
|
|
31
|
+
content: plain(page.excerpt)
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Loads the index `pagefind --site` wrote beside the export, once. It is a
|
|
38
|
+
* file of the exported site, not a module of the bundle, so the import is
|
|
39
|
+
* opaque to the bundler.
|
|
40
|
+
*/ export const loadPagefind = (indexUrl)=>{
|
|
41
|
+
let loading;
|
|
42
|
+
return ()=>{
|
|
43
|
+
loading != null ? loading : loading = import(/* webpackIgnore: true */ /* @vite-ignore */ `${indexUrl}pagefind.js`);
|
|
44
|
+
return loading;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=pagefind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/pagefind.ts"],"sourcesContent":["import type { SortedResult } from 'fumadocs-core/search';\n\n/** What Pagefind's `search()` answers, as far as the engine reads it. */\ninterface PagefindSubResult {\n readonly title: string;\n readonly url: string;\n readonly excerpt: string;\n}\ninterface PagefindData {\n readonly url: string;\n readonly meta: { readonly title?: string };\n readonly excerpt: string;\n readonly sub_results?: readonly PagefindSubResult[];\n}\nexport interface Pagefind {\n search: (query: string) => Promise<{\n results: readonly {\n readonly id: string;\n data: () => Promise<PagefindData>;\n }[];\n }>;\n}\n\n/** Pagefind's excerpt is HTML with `<mark>`; fumadocs highlights by itself. */\nconst plain = (html: string) =>\n html\n .replace(/<[^>]*>/g, '')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\");\n\n/** At most this many pages; each brings its best sections along. */\nconst PAGES = 8;\nconst SECTIONS = 3;\n\n/**\n * Pagefind's results as fumadocs' sorted results: a page, then the sections of\n * it that matched. A section whose URL is the page's own is the page's body and\n * is shown as its text rather than as a second heading.\n */\nexport const toSortedResults = async (\n pagefind: Pagefind,\n query: string,\n): Promise<SortedResult[]> => {\n if (query.trim() === '') return [];\n const { results } = await pagefind.search(query);\n const pages = await Promise.all(\n results.slice(0, PAGES).map(result => result.data()),\n );\n return pages.flatMap((page): SortedResult[] => [\n {\n id: page.url,\n url: page.url,\n type: 'page',\n content: page.meta.title ?? page.url,\n },\n ...(page.sub_results ?? [])\n .filter(sub => sub.url !== page.url)\n .slice(0, SECTIONS)\n .map((sub): SortedResult => ({\n id: sub.url,\n url: sub.url,\n type: 'heading',\n content: sub.title,\n })),\n {\n id: `${page.url}#excerpt`,\n url: page.url,\n type: 'text',\n content: plain(page.excerpt),\n },\n ]);\n};\n\n/**\n * Loads the index `pagefind --site` wrote beside the export, once. It is a\n * file of the exported site, not a module of the bundle, so the import is\n * opaque to the bundler.\n */\nexport const loadPagefind = (indexUrl: string): (() => Promise<Pagefind>) => {\n let loading: Promise<Pagefind> | undefined;\n return () => {\n loading ??= import(\n /* webpackIgnore: true */ /* @vite-ignore */ `${indexUrl}pagefind.js`\n ) as Promise<Pagefind>;\n return loading;\n };\n};\n"],"names":["plain","html","replace","PAGES","SECTIONS","toSortedResults","pagefind","query","trim","results","search","pages","Promise","all","slice","map","result","data","flatMap","page","id","url","type","content","meta","title","sub_results","filter","sub","excerpt","loadPagefind","indexUrl","loading"],"mappings":"AAuBA,6EAA6E,GAC7E,MAAMA,QAAQ,CAACC,OACbA,KACGC,OAAO,CAAC,YAAY,IACpBA,OAAO,CAAC,UAAU,KAClBA,OAAO,CAAC,SAAS,KACjBA,OAAO,CAAC,SAAS,KACjBA,OAAO,CAAC,WAAW,KACnBA,OAAO,CAAC,UAAU;AAEvB,kEAAkE,GAClE,MAAMC,QAAQ;AACd,MAAMC,WAAW;AAEjB;;;;CAIC,GACD,OAAO,MAAMC,kBAAkB,OAC7BC,UACAC;IAEA,IAAIA,MAAMC,IAAI,OAAO,IAAI,OAAO,EAAE;IAClC,MAAM,EAAEC,OAAO,EAAE,GAAG,MAAMH,SAASI,MAAM,CAACH;IAC1C,MAAMI,QAAQ,MAAMC,QAAQC,GAAG,CAC7BJ,QAAQK,KAAK,CAAC,GAAGX,OAAOY,GAAG,CAACC,CAAAA,SAAUA,OAAOC,IAAI;IAEnD,OAAON,MAAMO,OAAO,CAAC,CAACC;YAKTA,kBAEPA;eAPyC;YAC7C;gBACEC,IAAID,KAAKE,GAAG;gBACZA,KAAKF,KAAKE,GAAG;gBACbC,MAAM;gBACNC,OAAO,GAAEJ,mBAAAA,KAAKK,IAAI,CAACC,KAAK,YAAfN,mBAAmBA,KAAKE,GAAG;YACtC;eACG,EAACF,oBAAAA,KAAKO,WAAW,YAAhBP,oBAAoB,EAAE,EACvBQ,MAAM,CAACC,CAAAA,MAAOA,IAAIP,GAAG,KAAKF,KAAKE,GAAG,EAClCP,KAAK,CAAC,GAAGV,UACTW,GAAG,CAAC,CAACa,MAAuB,CAAA;oBAC3BR,IAAIQ,IAAIP,GAAG;oBACXA,KAAKO,IAAIP,GAAG;oBACZC,MAAM;oBACNC,SAASK,IAAIH,KAAK;gBACpB,CAAA;YACF;gBACEL,IAAI,GAAGD,KAAKE,GAAG,CAAC,QAAQ,CAAC;gBACzBA,KAAKF,KAAKE,GAAG;gBACbC,MAAM;gBACNC,SAASvB,MAAMmB,KAAKU,OAAO;YAC7B;SACD;;AACH,EAAE;AAEF;;;;CAIC,GACD,OAAO,MAAMC,eAAe,CAACC;IAC3B,IAAIC;IACJ,OAAO;QACLA,kBAAAA,UAAAA,UAAY,MAAM,CAChB,uBAAuB,GAAG,gBAAgB,GAAG,GAAGD,SAAS,WAAW,CAAC;QAEvE,OAAOC;IACT;AACF,EAAE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ThemeOption } from '@entifix/react-controls';
|
|
2
|
+
import { type PropsWithChildren } from 'react';
|
|
3
|
+
export interface DocsRootProps extends PropsWithChildren {
|
|
4
|
+
/** The page's language, as the host's i18n negotiated it. */
|
|
5
|
+
readonly locale: string;
|
|
6
|
+
readonly themes: ThemeOption[];
|
|
7
|
+
readonly defaultTheme?: string;
|
|
8
|
+
/** The palettes fumadocs should treat as dark. */
|
|
9
|
+
readonly darkPalettes: readonly string[];
|
|
10
|
+
/** Where Pagefind's index is served, with the app's `basePath`: `/pagefind/`. */
|
|
11
|
+
readonly searchIndexUrl: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Everything a docs page needs above it: entifix's theme provider, which owns
|
|
15
|
+
* `data-theme`, and fumadocs' root under it with its own theming off, its
|
|
16
|
+
* strings from the controls catalog and its search on Pagefind.
|
|
17
|
+
*
|
|
18
|
+
* Mount it inside the host's translator (`I18nProvider` from
|
|
19
|
+
* `@entifix/react-controls/i18next`, or any other), so the strings resolve.
|
|
20
|
+
*/
|
|
21
|
+
export declare function DocsRoot({ locale, themes, defaultTheme, darkPalettes, searchIndexUrl, children, }: DocsRootProps): import("react").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/ui/root.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,yBAAyB,CAAC;AAG1E,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,iFAAiF;IACjF,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAmDD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,QAAQ,GACT,EAAE,aAAa,+BAYf"}
|
package/dist/ui/root.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { ThemeProvider } from '@entifix/react-controls';
|
|
5
|
+
import { RootProvider } from 'fumadocs-ui/provider/next';
|
|
6
|
+
import { lazy, useEffect } from 'react';
|
|
7
|
+
import { SCHEME_ATTRIBUTE, schemeOf } from './scheme.js';
|
|
8
|
+
import { useDocsTranslations } from './translations.js';
|
|
9
|
+
const PagefindSearchDialog = /*#__PURE__*/ lazy(()=>import('./search-dialog.js'));
|
|
10
|
+
/**
|
|
11
|
+
* Keeps `data-scheme` in step with the palette on the document. It watches the
|
|
12
|
+
* attribute rather than the theme context: the provider writes `data-theme` in
|
|
13
|
+
* its own effect, which runs after this child's, so the context's value would
|
|
14
|
+
* be one commit ahead of the page — and before the stored choice is read, it
|
|
15
|
+
* would paint the default's scheme over the one the first-paint script set.
|
|
16
|
+
*/ function SchemeSync({ darkPalettes }) {
|
|
17
|
+
useEffect(()=>{
|
|
18
|
+
const root = document.documentElement;
|
|
19
|
+
const apply = ()=>{
|
|
20
|
+
const scheme = schemeOf(root.dataset.theme, darkPalettes);
|
|
21
|
+
if (root.getAttribute(SCHEME_ATTRIBUTE) !== scheme) {
|
|
22
|
+
root.setAttribute(SCHEME_ATTRIBUTE, scheme);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
apply();
|
|
26
|
+
const observer = new MutationObserver(apply);
|
|
27
|
+
observer.observe(root, {
|
|
28
|
+
attributeFilter: [
|
|
29
|
+
'data-theme'
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
return ()=>observer.disconnect();
|
|
33
|
+
}, [
|
|
34
|
+
darkPalettes
|
|
35
|
+
]);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function Fumadocs({ locale, searchIndexUrl, children }) {
|
|
39
|
+
const translations = useDocsTranslations();
|
|
40
|
+
return /*#__PURE__*/ _jsx(RootProvider, {
|
|
41
|
+
// One owner of dark mode: entifix's `data-theme`. next-themes would be a
|
|
42
|
+
// second, and it also hides fumadocs' switcher (ADR 0031 §4).
|
|
43
|
+
theme: {
|
|
44
|
+
enabled: false
|
|
45
|
+
},
|
|
46
|
+
search: {
|
|
47
|
+
SearchDialog: PagefindSearchDialog,
|
|
48
|
+
options: {
|
|
49
|
+
indexUrl: searchIndexUrl
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
i18n: {
|
|
53
|
+
locale,
|
|
54
|
+
translations
|
|
55
|
+
},
|
|
56
|
+
children: children
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Everything a docs page needs above it: entifix's theme provider, which owns
|
|
61
|
+
* `data-theme`, and fumadocs' root under it with its own theming off, its
|
|
62
|
+
* strings from the controls catalog and its search on Pagefind.
|
|
63
|
+
*
|
|
64
|
+
* Mount it inside the host's translator (`I18nProvider` from
|
|
65
|
+
* `@entifix/react-controls/i18next`, or any other), so the strings resolve.
|
|
66
|
+
*/ export function DocsRoot({ locale, themes, defaultTheme, darkPalettes, searchIndexUrl, children }) {
|
|
67
|
+
return /*#__PURE__*/ _jsxs(ThemeProvider, _extends({
|
|
68
|
+
themes: themes
|
|
69
|
+
}, defaultTheme === undefined ? {} : {
|
|
70
|
+
defaultTheme
|
|
71
|
+
}, {
|
|
72
|
+
children: [
|
|
73
|
+
/*#__PURE__*/ _jsx(SchemeSync, {
|
|
74
|
+
darkPalettes: darkPalettes
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ _jsx(Fumadocs, {
|
|
77
|
+
locale: locale,
|
|
78
|
+
searchIndexUrl: searchIndexUrl,
|
|
79
|
+
children: children
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/root.tsx"],"sourcesContent":["'use client';\n\nimport { type ThemeOption, ThemeProvider } from '@entifix/react-controls';\nimport type { DefaultSearchDialogProps } from 'fumadocs-ui/components/dialog/search-default';\nimport { RootProvider } from 'fumadocs-ui/provider/next';\nimport {\n type ComponentType,\n lazy,\n type PropsWithChildren,\n useEffect,\n} from 'react';\n\nimport { SCHEME_ATTRIBUTE, schemeOf } from './scheme.js';\nimport { useDocsTranslations } from './translations.js';\n\nconst PagefindSearchDialog = lazy(() => import('./search-dialog.js'));\n\nexport interface DocsRootProps extends PropsWithChildren {\n /** The page's language, as the host's i18n negotiated it. */\n readonly locale: string;\n readonly themes: ThemeOption[];\n readonly defaultTheme?: string;\n /** The palettes fumadocs should treat as dark. */\n readonly darkPalettes: readonly string[];\n /** Where Pagefind's index is served, with the app's `basePath`: `/pagefind/`. */\n readonly searchIndexUrl: string;\n}\n\n/**\n * Keeps `data-scheme` in step with the palette on the document. It watches the\n * attribute rather than the theme context: the provider writes `data-theme` in\n * its own effect, which runs after this child's, so the context's value would\n * be one commit ahead of the page — and before the stored choice is read, it\n * would paint the default's scheme over the one the first-paint script set.\n */\nfunction SchemeSync({ darkPalettes }: { darkPalettes: readonly string[] }) {\n useEffect(() => {\n const root = document.documentElement;\n const apply = () => {\n const scheme = schemeOf(root.dataset.theme, darkPalettes);\n if (root.getAttribute(SCHEME_ATTRIBUTE) !== scheme) {\n root.setAttribute(SCHEME_ATTRIBUTE, scheme);\n }\n };\n apply();\n const observer = new MutationObserver(apply);\n observer.observe(root, { attributeFilter: ['data-theme'] });\n return () => observer.disconnect();\n }, [darkPalettes]);\n return null;\n}\n\nfunction Fumadocs({\n locale,\n searchIndexUrl,\n children,\n}: PropsWithChildren<{ locale: string; searchIndexUrl: string }>) {\n const translations = useDocsTranslations();\n return (\n <RootProvider\n // One owner of dark mode: entifix's `data-theme`. next-themes would be a\n // second, and it also hides fumadocs' switcher (ADR 0031 §4).\n theme={{ enabled: false }}\n search={{\n SearchDialog:\n PagefindSearchDialog as unknown as ComponentType<DefaultSearchDialogProps>,\n options: {\n indexUrl: searchIndexUrl,\n } as Partial<DefaultSearchDialogProps>,\n }}\n i18n={{ locale, translations }}\n >\n {children}\n </RootProvider>\n );\n}\n\n/**\n * Everything a docs page needs above it: entifix's theme provider, which owns\n * `data-theme`, and fumadocs' root under it with its own theming off, its\n * strings from the controls catalog and its search on Pagefind.\n *\n * Mount it inside the host's translator (`I18nProvider` from\n * `@entifix/react-controls/i18next`, or any other), so the strings resolve.\n */\nexport function DocsRoot({\n locale,\n themes,\n defaultTheme,\n darkPalettes,\n searchIndexUrl,\n children,\n}: DocsRootProps) {\n return (\n <ThemeProvider\n themes={themes}\n {...(defaultTheme === undefined ? {} : { defaultTheme })}\n >\n <SchemeSync darkPalettes={darkPalettes} />\n <Fumadocs locale={locale} searchIndexUrl={searchIndexUrl}>\n {children}\n </Fumadocs>\n </ThemeProvider>\n );\n}\n"],"names":["ThemeProvider","RootProvider","lazy","useEffect","SCHEME_ATTRIBUTE","schemeOf","useDocsTranslations","PagefindSearchDialog","SchemeSync","darkPalettes","root","document","documentElement","apply","scheme","dataset","theme","getAttribute","setAttribute","observer","MutationObserver","observe","attributeFilter","disconnect","Fumadocs","locale","searchIndexUrl","children","translations","enabled","search","SearchDialog","options","indexUrl","i18n","DocsRoot","themes","defaultTheme","undefined"],"mappings":"AAAA;;;AAEA,SAA2BA,aAAa,QAAQ,0BAA0B;AAE1E,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAEEC,IAAI,EAEJC,SAAS,QACJ,QAAQ;AAEf,SAASC,gBAAgB,EAAEC,QAAQ,QAAQ,cAAc;AACzD,SAASC,mBAAmB,QAAQ,oBAAoB;AAExD,MAAMC,qCAAuBL,KAAK,IAAM,MAAM,CAAC;AAa/C;;;;;;CAMC,GACD,SAASM,WAAW,EAAEC,YAAY,EAAuC;IACvEN,UAAU;QACR,MAAMO,OAAOC,SAASC,eAAe;QACrC,MAAMC,QAAQ;YACZ,MAAMC,SAAST,SAASK,KAAKK,OAAO,CAACC,KAAK,EAAEP;YAC5C,IAAIC,KAAKO,YAAY,CAACb,sBAAsBU,QAAQ;gBAClDJ,KAAKQ,YAAY,CAACd,kBAAkBU;YACtC;QACF;QACAD;QACA,MAAMM,WAAW,IAAIC,iBAAiBP;QACtCM,SAASE,OAAO,CAACX,MAAM;YAAEY,iBAAiB;gBAAC;aAAa;QAAC;QACzD,OAAO,IAAMH,SAASI,UAAU;IAClC,GAAG;QAACd;KAAa;IACjB,OAAO;AACT;AAEA,SAASe,SAAS,EAChBC,MAAM,EACNC,cAAc,EACdC,QAAQ,EACsD;IAC9D,MAAMC,eAAetB;IACrB,qBACE,KAACL;QACC,yEAAyE;QACzE,8DAA8D;QAC9De,OAAO;YAAEa,SAAS;QAAM;QACxBC,QAAQ;YACNC,cACExB;YACFyB,SAAS;gBACPC,UAAUP;YACZ;QACF;QACAQ,MAAM;YAAET;YAAQG;QAAa;kBAE5BD;;AAGP;AAEA;;;;;;;CAOC,GACD,OAAO,SAASQ,SAAS,EACvBV,MAAM,EACNW,MAAM,EACNC,YAAY,EACZ5B,YAAY,EACZiB,cAAc,EACdC,QAAQ,EACM;IACd,qBACE,MAAC3B;QACCoC,QAAQA;OACHC,iBAAiBC,YAAY,CAAC,IAAI;QAAED;IAAa;;0BAEtD,KAAC7B;gBAAWC,cAAcA;;0BAC1B,KAACe;gBAASC,QAAQA;gBAAQC,gBAAgBA;0BACvCC;;;;AAIT"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fumadocs knows two schemes, light and dark; entifix knows palettes. A palette
|
|
3
|
+
* the host declares dark sets `data-scheme="dark"` on <html>, and every `dark:`
|
|
4
|
+
* utility and the code blocks' dark theme follow that attribute — so the one
|
|
5
|
+
* owner of the palette stays `data-theme`, and fumadocs only reads it
|
|
6
|
+
* (ADR 0031 §4).
|
|
7
|
+
*/
|
|
8
|
+
export declare const SCHEME_ATTRIBUTE = "data-scheme";
|
|
9
|
+
export declare const schemeOf: (theme: string | undefined, darkPalettes: readonly string[]) => "dark" | "light";
|
|
10
|
+
/** The same rule as a script, for the first paint, before React loads. */
|
|
11
|
+
export declare const schemeScript: (darkPalettes: readonly string[]) => string;
|
|
12
|
+
//# sourceMappingURL=scheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheme.d.ts","sourceRoot":"","sources":["../../src/ui/scheme.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAE9C,eAAO,MAAM,QAAQ,GACnB,OAAO,MAAM,GAAG,SAAS,EACzB,cAAc,SAAS,MAAM,EAAE,KAC9B,MAAM,GAAG,OAC4D,CAAC;AAEzE,0EAA0E;AAC1E,eAAO,MAAM,YAAY,GAAI,cAAc,SAAS,MAAM,EAAE,KAAG,MAOzD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fumadocs knows two schemes, light and dark; entifix knows palettes. A palette
|
|
3
|
+
* the host declares dark sets `data-scheme="dark"` on <html>, and every `dark:`
|
|
4
|
+
* utility and the code blocks' dark theme follow that attribute — so the one
|
|
5
|
+
* owner of the palette stays `data-theme`, and fumadocs only reads it
|
|
6
|
+
* (ADR 0031 §4).
|
|
7
|
+
*/ export const SCHEME_ATTRIBUTE = 'data-scheme';
|
|
8
|
+
export const schemeOf = (theme, darkPalettes)=>theme !== undefined && darkPalettes.includes(theme) ? 'dark' : 'light';
|
|
9
|
+
/** The same rule as a script, for the first paint, before React loads. */ export const schemeScript = (darkPalettes)=>`(function () {
|
|
10
|
+
try {
|
|
11
|
+
var root = document.documentElement;
|
|
12
|
+
var dark = ${JSON.stringify(darkPalettes)};
|
|
13
|
+
root.setAttribute('${SCHEME_ATTRIBUTE}', dark.indexOf(root.dataset.theme) === -1 ? 'light' : 'dark');
|
|
14
|
+
} catch (error) {}
|
|
15
|
+
})();`;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=scheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/scheme.ts"],"sourcesContent":["/**\n * fumadocs knows two schemes, light and dark; entifix knows palettes. A palette\n * the host declares dark sets `data-scheme=\"dark\"` on <html>, and every `dark:`\n * utility and the code blocks' dark theme follow that attribute — so the one\n * owner of the palette stays `data-theme`, and fumadocs only reads it\n * (ADR 0031 §4).\n */\nexport const SCHEME_ATTRIBUTE = 'data-scheme';\n\nexport const schemeOf = (\n theme: string | undefined,\n darkPalettes: readonly string[],\n): 'dark' | 'light' =>\n theme !== undefined && darkPalettes.includes(theme) ? 'dark' : 'light';\n\n/** The same rule as a script, for the first paint, before React loads. */\nexport const schemeScript = (darkPalettes: readonly string[]): string =>\n `(function () {\n try {\n var root = document.documentElement;\n var dark = ${JSON.stringify(darkPalettes)};\n root.setAttribute('${SCHEME_ATTRIBUTE}', dark.indexOf(root.dataset.theme) === -1 ? 'light' : 'dark');\n } catch (error) {}\n})();`;\n"],"names":["SCHEME_ATTRIBUTE","schemeOf","theme","darkPalettes","undefined","includes","schemeScript","JSON","stringify"],"mappings":"AAAA;;;;;;CAMC,GACD,OAAO,MAAMA,mBAAmB,cAAc;AAE9C,OAAO,MAAMC,WAAW,CACtBC,OACAC,eAEAD,UAAUE,aAAaD,aAAaE,QAAQ,CAACH,SAAS,SAAS,QAAQ;AAEzE,wEAAwE,GACxE,OAAO,MAAMI,eAAe,CAACH,eAC3B,CAAC;;;eAGY,EAAEI,KAAKC,SAAS,CAACL,cAAc;uBACvB,EAAEH,iBAAiB;;KAErC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type SharedProps } from 'fumadocs-ui/components/dialog/search';
|
|
2
|
+
export interface PagefindSearchDialogProps extends SharedProps {
|
|
3
|
+
/** Where `pagefind --site` wrote its index, with the app's `basePath`: `/docs/pagefind/`. */
|
|
4
|
+
readonly indexUrl: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The search dialog over the exported site's Pagefind index (entifix #276).
|
|
8
|
+
*
|
|
9
|
+
* fumadocs' own dialog is replaced for one reason it cannot be configured out
|
|
10
|
+
* of: its Close button is named "Close Search" and reads "ESC", which fails
|
|
11
|
+
* WCAG 2.5.3 (a control's name contains its visible text). Here the name
|
|
12
|
+
* begins with the very word the button shows (ADR 0031 §4.1).
|
|
13
|
+
*/
|
|
14
|
+
export default function PagefindSearchDialog({ indexUrl, ...props }: PagefindSearchDialogProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=search-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-dialog.d.ts","sourceRoot":"","sources":["../../src/ui/search-dialog.tsx"],"names":[],"mappings":"AAIA,OAAO,EASL,KAAK,WAAW,EACjB,MAAM,sCAAsC,CAAC;AAK9C,MAAM,WAAW,yBAA0B,SAAQ,WAAW;IAC5D,6FAA6F;IAC7F,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,+BAyB3B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
3
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useT } from '@entifix/react-controls';
|
|
6
|
+
import { useDocsSearch } from 'fumadocs-core/search/client';
|
|
7
|
+
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay } from 'fumadocs-ui/components/dialog/search';
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
|
+
import { loadPagefind, toSortedResults } from './pagefind.js';
|
|
10
|
+
/**
|
|
11
|
+
* The search dialog over the exported site's Pagefind index (entifix #276).
|
|
12
|
+
*
|
|
13
|
+
* fumadocs' own dialog is replaced for one reason it cannot be configured out
|
|
14
|
+
* of: its Close button is named "Close Search" and reads "ESC", which fails
|
|
15
|
+
* WCAG 2.5.3 (a control's name contains its visible text). Here the name
|
|
16
|
+
* begins with the very word the button shows (ADR 0031 §4.1).
|
|
17
|
+
*/ export default function PagefindSearchDialog(_0) {
|
|
18
|
+
let { indexUrl } = _0, props = _object_without_properties_loose(_0, [
|
|
19
|
+
"indexUrl"
|
|
20
|
+
]);
|
|
21
|
+
const t = useT('controls');
|
|
22
|
+
const client = useMemo(()=>{
|
|
23
|
+
const pagefind = loadPagefind(indexUrl);
|
|
24
|
+
return {
|
|
25
|
+
search: async (query)=>toSortedResults(await pagefind(), query),
|
|
26
|
+
deps: [
|
|
27
|
+
indexUrl
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
}, [
|
|
31
|
+
indexUrl
|
|
32
|
+
]);
|
|
33
|
+
const search = useDocsSearch({
|
|
34
|
+
client
|
|
35
|
+
});
|
|
36
|
+
return /*#__PURE__*/ _jsxs(SearchDialog, _extends({}, search, props, {
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ _jsx(SearchDialogOverlay, {}),
|
|
39
|
+
/*#__PURE__*/ _jsxs(SearchDialogContent, {
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ _jsxs(SearchDialogHeader, {
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ _jsx(SearchDialogIcon, {
|
|
44
|
+
"aria-hidden": "true"
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ _jsx(SearchDialogInput, {}),
|
|
47
|
+
/*#__PURE__*/ _jsx(SearchDialogClose, {
|
|
48
|
+
"aria-label": t('docs.search.close'),
|
|
49
|
+
children: t('docs.search.closeKey')
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ _jsx(SearchDialogList, {})
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=search-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/search-dialog.tsx"],"sourcesContent":["'use client';\n\nimport { useT } from '@entifix/react-controls';\nimport { useDocsSearch } from 'fumadocs-core/search/client';\nimport {\n SearchDialog,\n SearchDialogClose,\n SearchDialogContent,\n SearchDialogHeader,\n SearchDialogIcon,\n SearchDialogInput,\n SearchDialogList,\n SearchDialogOverlay,\n type SharedProps,\n} from 'fumadocs-ui/components/dialog/search';\nimport { useMemo } from 'react';\n\nimport { loadPagefind, toSortedResults } from './pagefind.js';\n\nexport interface PagefindSearchDialogProps extends SharedProps {\n /** Where `pagefind --site` wrote its index, with the app's `basePath`: `/docs/pagefind/`. */\n readonly indexUrl: string;\n}\n\n/**\n * The search dialog over the exported site's Pagefind index (entifix #276).\n *\n * fumadocs' own dialog is replaced for one reason it cannot be configured out\n * of: its Close button is named \"Close Search\" and reads \"ESC\", which fails\n * WCAG 2.5.3 (a control's name contains its visible text). Here the name\n * begins with the very word the button shows (ADR 0031 §4.1).\n */\nexport default function PagefindSearchDialog({\n indexUrl,\n ...props\n}: PagefindSearchDialogProps) {\n const t = useT('controls');\n const client = useMemo(() => {\n const pagefind = loadPagefind(indexUrl);\n return {\n search: async (query: string) => toSortedResults(await pagefind(), query),\n deps: [indexUrl],\n };\n }, [indexUrl]);\n const search = useDocsSearch({ client });\n return (\n <SearchDialog {...search} {...props}>\n <SearchDialogOverlay />\n <SearchDialogContent>\n <SearchDialogHeader>\n <SearchDialogIcon aria-hidden=\"true\" />\n <SearchDialogInput />\n <SearchDialogClose aria-label={t('docs.search.close')}>\n {t('docs.search.closeKey')}\n </SearchDialogClose>\n </SearchDialogHeader>\n <SearchDialogList />\n </SearchDialogContent>\n </SearchDialog>\n );\n}\n"],"names":["useT","useDocsSearch","SearchDialog","SearchDialogClose","SearchDialogContent","SearchDialogHeader","SearchDialogIcon","SearchDialogInput","SearchDialogList","SearchDialogOverlay","useMemo","loadPagefind","toSortedResults","PagefindSearchDialog","indexUrl","props","t","client","pagefind","search","query","deps","aria-hidden","aria-label"],"mappings":"AAAA;;;;AAEA,SAASA,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,aAAa,QAAQ,8BAA8B;AAC5D,SACEC,YAAY,EACZC,iBAAiB,EACjBC,mBAAmB,EACnBC,kBAAkB,EAClBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,mBAAmB,QAEd,uCAAuC;AAC9C,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,YAAY,EAAEC,eAAe,QAAQ,gBAAgB;AAO9D;;;;;;;CAOC,GACD,eAAe,SAASC,qBAAqB,EAGjB;QAHiB,EAC3CC,QAAQ,EAEkB,OADvBC;;;IAEH,MAAMC,IAAIhB,KAAK;IACf,MAAMiB,SAASP,QAAQ;QACrB,MAAMQ,WAAWP,aAAaG;QAC9B,OAAO;YACLK,QAAQ,OAAOC,QAAkBR,gBAAgB,MAAMM,YAAYE;YACnEC,MAAM;gBAACP;aAAS;QAClB;IACF,GAAG;QAACA;KAAS;IACb,MAAMK,SAASlB,cAAc;QAAEgB;IAAO;IACtC,qBACE,MAACf,2BAAiBiB,QAAYJ;;0BAC5B,KAACN;0BACD,MAACL;;kCACC,MAACC;;0CACC,KAACC;gCAAiBgB,eAAY;;0CAC9B,KAACf;0CACD,KAACJ;gCAAkBoB,cAAYP,EAAE;0CAC9BA,EAAE;;;;kCAGP,KAACR;;;;;AAIT"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first stop on every page, as entifix's keyboard walk requires (ADR 0024):
|
|
3
|
+
* it jumps past the sidebar to fumadocs' `main`, `#nd-page`. Hidden until it
|
|
4
|
+
* has focus.
|
|
5
|
+
*/
|
|
6
|
+
export declare function SkipLink(): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=skip-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip-link.d.ts","sourceRoot":"","sources":["../../src/ui/skip-link.tsx"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,QAAQ,gCAUvB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useT } from '@entifix/react-controls';
|
|
4
|
+
/**
|
|
5
|
+
* The first stop on every page, as entifix's keyboard walk requires (ADR 0024):
|
|
6
|
+
* it jumps past the sidebar to fumadocs' `main`, `#nd-page`. Hidden until it
|
|
7
|
+
* has focus.
|
|
8
|
+
*/ export function SkipLink() {
|
|
9
|
+
const t = useT('controls');
|
|
10
|
+
return /*#__PURE__*/ _jsx("a", {
|
|
11
|
+
href: "#nd-page",
|
|
12
|
+
className: "focus:start-2 focus:top-2 focus:bg-fd-background focus:px-3 focus:py-2 focus:text-fd-foreground sr-only focus:not-sr-only focus:fixed focus:z-50 focus:rounded-md",
|
|
13
|
+
children: t('docs.skip')
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=skip-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/skip-link.tsx"],"sourcesContent":["'use client';\n\nimport { useT } from '@entifix/react-controls';\n\n/**\n * The first stop on every page, as entifix's keyboard walk requires (ADR 0024):\n * it jumps past the sidebar to fumadocs' `main`, `#nd-page`. Hidden until it\n * has focus.\n */\nexport function SkipLink() {\n const t = useT('controls');\n return (\n <a\n href=\"#nd-page\"\n className=\"focus:start-2 focus:top-2 focus:bg-fd-background focus:px-3 focus:py-2 focus:text-fd-foreground sr-only focus:not-sr-only focus:fixed focus:z-50 focus:rounded-md\"\n >\n {t('docs.skip')}\n </a>\n );\n}\n"],"names":["useT","SkipLink","t","a","href","className"],"mappings":"AAAA;;AAEA,SAASA,IAAI,QAAQ,0BAA0B;AAE/C;;;;CAIC,GACD,OAAO,SAASC;IACd,MAAMC,IAAIF,KAAK;IACf,qBACE,KAACG;QACCC,MAAK;QACLC,WAAU;kBAETH,EAAE;;AAGT"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fumadocs' own interface strings — keyed by their English text and a note —
|
|
3
|
+
* answered from the controls catalog's `docs` block, so none of them is a
|
|
4
|
+
* literal the host's `react/jsx-no-literals` gate cannot see (ADR 0031 §4.6).
|
|
5
|
+
*
|
|
6
|
+
* The keys fumadocs has that this site never renders (AI chat, page actions,
|
|
7
|
+
* GitHub links, the language switcher, the type table) are left out on
|
|
8
|
+
* purpose: a string that is never shown needs no translation, and the
|
|
9
|
+
* engine's e2e fails a page that shows an English one in Spanish.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useDocsTranslations: () => Record<string, string>;
|
|
12
|
+
//# sourceMappingURL=translations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/ui/translations.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,QAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAqC3D,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useT } from '@entifix/react-controls';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* fumadocs' own interface strings — keyed by their English text and a note —
|
|
6
|
+
* answered from the controls catalog's `docs` block, so none of them is a
|
|
7
|
+
* literal the host's `react/jsx-no-literals` gate cannot see (ADR 0031 §4.6).
|
|
8
|
+
*
|
|
9
|
+
* The keys fumadocs has that this site never renders (AI chat, page actions,
|
|
10
|
+
* GitHub links, the language switcher, the type table) are left out on
|
|
11
|
+
* purpose: a string that is never shown needs no translation, and the
|
|
12
|
+
* engine's e2e fails a page that shows an English one in Spanish.
|
|
13
|
+
*/ export const useDocsTranslations = ()=>{
|
|
14
|
+
const t = useT('controls');
|
|
15
|
+
return useMemo(()=>({
|
|
16
|
+
'Search(search dialog)': t('docs.search.placeholder'),
|
|
17
|
+
'Search(search trigger)': t('docs.search.open'),
|
|
18
|
+
'Open Search(search trigger)(aria-label)': t('docs.search.open'),
|
|
19
|
+
'Close Search(search dialog)(aria-label)': t('docs.search.close'),
|
|
20
|
+
'No results found(search dialog)': t('docs.search.empty'),
|
|
21
|
+
'Search failed(search dialog)': t('docs.search.failed'),
|
|
22
|
+
'Search failed, showing results for {query}(search dialog)': t('docs.search.failedFor'),
|
|
23
|
+
'Open Sidebar(sidebar)(aria-label)': t('docs.sidebar.open'),
|
|
24
|
+
'Close Sidebar(sidebar)(aria-label)': t('docs.sidebar.close'),
|
|
25
|
+
'Close Sidebar(aria-label)': t('docs.sidebar.close'),
|
|
26
|
+
'Collapse Sidebar(sidebar)(aria-label)': t('docs.sidebar.collapse'),
|
|
27
|
+
'Show Sidebar(sidebar)': t('docs.sidebar.show'),
|
|
28
|
+
'Hide Sidebar(sidebar)': t('docs.sidebar.hide'),
|
|
29
|
+
'Toggle Menu(mobile menu)(aria-label)': t('docs.menu'),
|
|
30
|
+
'On this page(table of contents)': t('docs.toc.title'),
|
|
31
|
+
'Table of Contents(inline table of contents)': t('docs.toc.title'),
|
|
32
|
+
'No Headings(table of contents)': t('docs.toc.empty'),
|
|
33
|
+
'Previous Page(pagination)': t('docs.page.previous'),
|
|
34
|
+
'Next Page(pagination)': t('docs.page.next'),
|
|
35
|
+
'Page Not Found(404 page)': t('docs.page.notFound'),
|
|
36
|
+
'The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.(404 page)': t('docs.page.notFoundBody'),
|
|
37
|
+
'Back to Home(404 page)': t('docs.page.home'),
|
|
38
|
+
'Copy Text(code block)(aria-label)': t('docs.code.copy'),
|
|
39
|
+
'Copied Text(code block)(aria-label)': t('docs.code.copied'),
|
|
40
|
+
'Copy Anchor Link(heading anchor)(aria-label)': t('docs.anchor.copy'),
|
|
41
|
+
'Copied Anchor Link(heading anchor)(aria-label)': t('docs.anchor.copied'),
|
|
42
|
+
'Toggle Theme(theme switcher)(aria-label)': t('docs.theme')
|
|
43
|
+
}), [
|
|
44
|
+
t
|
|
45
|
+
]);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=translations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/translations.ts"],"sourcesContent":["'use client';\n\nimport { useT } from '@entifix/react-controls';\nimport { useMemo } from 'react';\n\n/**\n * fumadocs' own interface strings — keyed by their English text and a note —\n * answered from the controls catalog's `docs` block, so none of them is a\n * literal the host's `react/jsx-no-literals` gate cannot see (ADR 0031 §4.6).\n *\n * The keys fumadocs has that this site never renders (AI chat, page actions,\n * GitHub links, the language switcher, the type table) are left out on\n * purpose: a string that is never shown needs no translation, and the\n * engine's e2e fails a page that shows an English one in Spanish.\n */\nexport const useDocsTranslations = (): Record<string, string> => {\n const t = useT('controls');\n return useMemo(\n () => ({\n 'Search(search dialog)': t('docs.search.placeholder'),\n 'Search(search trigger)': t('docs.search.open'),\n 'Open Search(search trigger)(aria-label)': t('docs.search.open'),\n 'Close Search(search dialog)(aria-label)': t('docs.search.close'),\n 'No results found(search dialog)': t('docs.search.empty'),\n 'Search failed(search dialog)': t('docs.search.failed'),\n 'Search failed, showing results for {query}(search dialog)': t(\n 'docs.search.failedFor',\n ),\n 'Open Sidebar(sidebar)(aria-label)': t('docs.sidebar.open'),\n 'Close Sidebar(sidebar)(aria-label)': t('docs.sidebar.close'),\n 'Close Sidebar(aria-label)': t('docs.sidebar.close'),\n 'Collapse Sidebar(sidebar)(aria-label)': t('docs.sidebar.collapse'),\n 'Show Sidebar(sidebar)': t('docs.sidebar.show'),\n 'Hide Sidebar(sidebar)': t('docs.sidebar.hide'),\n 'Toggle Menu(mobile menu)(aria-label)': t('docs.menu'),\n 'On this page(table of contents)': t('docs.toc.title'),\n 'Table of Contents(inline table of contents)': t('docs.toc.title'),\n 'No Headings(table of contents)': t('docs.toc.empty'),\n 'Previous Page(pagination)': t('docs.page.previous'),\n 'Next Page(pagination)': t('docs.page.next'),\n 'Page Not Found(404 page)': t('docs.page.notFound'),\n 'The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.(404 page)':\n t('docs.page.notFoundBody'),\n 'Back to Home(404 page)': t('docs.page.home'),\n 'Copy Text(code block)(aria-label)': t('docs.code.copy'),\n 'Copied Text(code block)(aria-label)': t('docs.code.copied'),\n 'Copy Anchor Link(heading anchor)(aria-label)': t('docs.anchor.copy'),\n 'Copied Anchor Link(heading anchor)(aria-label)': t('docs.anchor.copied'),\n 'Toggle Theme(theme switcher)(aria-label)': t('docs.theme'),\n }),\n [t],\n );\n};\n"],"names":["useT","useMemo","useDocsTranslations","t"],"mappings":"AAAA;AAEA,SAASA,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,OAAO,QAAQ,QAAQ;AAEhC;;;;;;;;;CASC,GACD,OAAO,MAAMC,sBAAsB;IACjC,MAAMC,IAAIH,KAAK;IACf,OAAOC,QACL,IAAO,CAAA;YACL,yBAAyBE,EAAE;YAC3B,0BAA0BA,EAAE;YAC5B,2CAA2CA,EAAE;YAC7C,2CAA2CA,EAAE;YAC7C,mCAAmCA,EAAE;YACrC,gCAAgCA,EAAE;YAClC,6DAA6DA,EAC3D;YAEF,qCAAqCA,EAAE;YACvC,sCAAsCA,EAAE;YACxC,6BAA6BA,EAAE;YAC/B,yCAAyCA,EAAE;YAC3C,yBAAyBA,EAAE;YAC3B,yBAAyBA,EAAE;YAC3B,wCAAwCA,EAAE;YAC1C,mCAAmCA,EAAE;YACrC,+CAA+CA,EAAE;YACjD,kCAAkCA,EAAE;YACpC,6BAA6BA,EAAE;YAC/B,yBAAyBA,EAAE;YAC3B,4BAA4BA,EAAE;YAC9B,wHACEA,EAAE;YACJ,0BAA0BA,EAAE;YAC5B,qCAAqCA,EAAE;YACvC,uCAAuCA,EAAE;YACzC,gDAAgDA,EAAE;YAClD,kDAAkDA,EAAE;YACpD,4CAA4CA,EAAE;QAChD,CAAA,GACA;QAACA;KAAE;AAEP,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,98 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entifix/docs-engine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.23.7",
|
|
4
|
+
"description": "A documentation site from sources: decision records, Markdown guides that cite ids, and a reference a host derives from its own metadata, turned into one page tree and exported as static files.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/r10c-technologies/entifix.git",
|
|
9
|
+
"directory": "packages/next/docs-engine"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
"./package.json": "./package.json",
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./ui": {
|
|
26
|
+
"types": "./dist/ui/index.d.ts",
|
|
27
|
+
"import": "./dist/ui/index.js",
|
|
28
|
+
"default": "./dist/ui/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./ui/docs.css": "./src/ui/docs.css"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"src/ui/docs.css",
|
|
35
|
+
"!**/*.tsbuildinfo",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"nx": {
|
|
39
|
+
"tags": [
|
|
40
|
+
"tier:4"
|
|
41
|
+
],
|
|
42
|
+
"sourceRoot": "packages/next/docs-engine/src",
|
|
43
|
+
"targets": {
|
|
44
|
+
"build": {
|
|
45
|
+
"executor": "@nx/js:swc",
|
|
46
|
+
"outputs": [
|
|
47
|
+
"{options.outputPath}"
|
|
48
|
+
],
|
|
49
|
+
"options": {
|
|
50
|
+
"outputPath": "packages/next/docs-engine/dist",
|
|
51
|
+
"main": "packages/next/docs-engine/src/index.ts",
|
|
52
|
+
"tsConfig": "packages/next/docs-engine/tsconfig.lib.json",
|
|
53
|
+
"skipTypeCheck": true,
|
|
54
|
+
"stripLeadingPaths": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"fumadocs-core": "16.17.10",
|
|
61
|
+
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
62
|
+
"remark-directive": "^4.0.0",
|
|
63
|
+
"remark-parse": "^11.0.0",
|
|
64
|
+
"remark-rehype": "^11.1.2",
|
|
65
|
+
"unified": "^11.0.5",
|
|
66
|
+
"unist-util-visit": "^5.0.0",
|
|
67
|
+
"vfile": "^6.0.3",
|
|
68
|
+
"@entifix/docs": "0.23.7",
|
|
69
|
+
"@entifix/react-controls": "0.23.7",
|
|
70
|
+
"@entifix/style": "0.23.7"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
74
|
+
"@testing-library/react": "16.3.3",
|
|
75
|
+
"@testing-library/user-event": "^14.6.9",
|
|
76
|
+
"@types/hast": "^3.0.4",
|
|
77
|
+
"@types/mdast": "^4.0.4",
|
|
78
|
+
"fumadocs-ui": "16.17.10",
|
|
79
|
+
"i18next": "27.1.1",
|
|
80
|
+
"mdast-util-directive": "^3.1.0",
|
|
81
|
+
"next": "16.4.6",
|
|
82
|
+
"react": "19.3.1",
|
|
83
|
+
"react-dom": "19.3.1",
|
|
84
|
+
"react-i18next": "18.0.1",
|
|
85
|
+
"@entifix/i18n": "0.23.7"
|
|
86
|
+
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"fumadocs-ui": "16.17.10",
|
|
89
|
+
"next": ">=16 <17",
|
|
90
|
+
"react": ">=19 <20",
|
|
91
|
+
"react-dom": ">=19 <20"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"fumadocs-ui": {
|
|
95
|
+
"optional": true
|
|
96
|
+
}
|
|
97
|
+
}
|
|
6
98
|
}
|