@tuwaio/docs-ui 0.5.7 → 0.7.0

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.
Files changed (46) hide show
  1. package/README.md +93 -3
  2. package/bin/i18n-check.js +19 -0
  3. package/dist/components/DocsLayout.cjs +105 -0
  4. package/dist/components/DocsLayout.d.cts +93 -0
  5. package/dist/components/DocsLayout.d.ts +93 -0
  6. package/dist/components/DocsLayout.js +80 -0
  7. package/dist/components/Footer.cjs +1 -6
  8. package/dist/components/Footer.d.cts +3 -2
  9. package/dist/components/Footer.d.ts +3 -2
  10. package/dist/components/Footer.js +1 -6
  11. package/dist/components/LocalizedPage.cjs +42 -0
  12. package/dist/components/LocalizedPage.d.cts +37 -0
  13. package/dist/components/LocalizedPage.d.ts +37 -0
  14. package/dist/components/LocalizedPage.js +18 -0
  15. package/dist/docsI18n.cjs +33 -0
  16. package/dist/docsI18n.d.cts +16 -0
  17. package/dist/docsI18n.d.ts +16 -0
  18. package/dist/docsI18n.js +8 -0
  19. package/dist/docsLabels.cjs +140 -0
  20. package/dist/docsLabels.d.cts +72 -0
  21. package/dist/docsLabels.d.ts +72 -0
  22. package/dist/docsLabels.js +116 -0
  23. package/dist/docsPage.cjs +70 -0
  24. package/dist/docsPage.d.cts +56 -0
  25. package/dist/docsPage.d.ts +56 -0
  26. package/dist/docsPage.js +46 -0
  27. package/dist/i18n.d.cts +1 -1
  28. package/dist/i18n.d.ts +1 -1
  29. package/dist/index.cjs +4 -0
  30. package/dist/index.css +3 -0
  31. package/dist/index.d.cts +3 -0
  32. package/dist/index.d.ts +3 -0
  33. package/dist/index.js +2 -0
  34. package/dist/nextra.cjs +26 -0
  35. package/dist/nextra.d.cts +11 -0
  36. package/dist/nextra.d.ts +11 -0
  37. package/dist/nextra.js +3 -0
  38. package/dist/pageMap.cjs +66 -0
  39. package/dist/pageMap.d.cts +33 -0
  40. package/dist/pageMap.d.ts +33 -0
  41. package/dist/pageMap.js +42 -0
  42. package/dist/translationCheck.cjs +191 -0
  43. package/dist/translationCheck.d.cts +90 -0
  44. package/dist/translationCheck.d.ts +90 -0
  45. package/dist/translationCheck.js +162 -0
  46. package/package.json +15 -3
@@ -0,0 +1,37 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { Heading, $NextraMetadata } from 'nextra';
4
+ import { TuwaLocale } from '../locale.cjs';
5
+
6
+ /** One language of a page: the rendered MDX and what the Nextra page wrapper needs. */
7
+ interface LocalizedPageVariant {
8
+ /** The rendered MDX content. */
9
+ content: ReactNode;
10
+ /** The table of contents of the MDX file (its `toc` export). */
11
+ toc: Heading[];
12
+ /** The metadata of the MDX file (its `metadata` export): the title, the file of the edit link, the last change. */
13
+ metadata: $NextraMetadata;
14
+ /** The source of the MDX file (its `sourceCode` export), for the copy-page button. */
15
+ sourceCode?: string;
16
+ }
17
+ /** Props of {@link LocalizedPage}. */
18
+ interface LocalizedPageProps {
19
+ /** The page in English (the server renders it) and in the languages it is translated into. */
20
+ variants: Partial<Record<TuwaLocale, LocalizedPageVariant>> & {
21
+ en: LocalizedPageVariant;
22
+ };
23
+ }
24
+ /**
25
+ * A page of a TUWA documentation site in the language of the reader, inside the Nextra page wrapper (sidebar, table of
26
+ * contents, breadcrumbs, pagination). All variants come prerendered from the server, so switching the language makes no
27
+ * request and the URL stays the same; the server HTML and the search index hold English. A page without a translation
28
+ * in the active language (package READMEs and the generated API reference) shows English with a short note in that
29
+ * language. Must be rendered inside {@link DocsLayout}; `createDocsPage` (`@tuwaio/docs-ui/nextra/page`) renders it.
30
+ *
31
+ * @param props - See {@link LocalizedPageProps}.
32
+ * @returns The page.
33
+ */
34
+ declare function LocalizedPage({ variants }: LocalizedPageProps): react.JSX.Element;
35
+
36
+ export { LocalizedPage };
37
+ export type { LocalizedPageProps, LocalizedPageVariant };
@@ -0,0 +1,37 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { Heading, $NextraMetadata } from 'nextra';
4
+ import { TuwaLocale } from '../locale.js';
5
+
6
+ /** One language of a page: the rendered MDX and what the Nextra page wrapper needs. */
7
+ interface LocalizedPageVariant {
8
+ /** The rendered MDX content. */
9
+ content: ReactNode;
10
+ /** The table of contents of the MDX file (its `toc` export). */
11
+ toc: Heading[];
12
+ /** The metadata of the MDX file (its `metadata` export): the title, the file of the edit link, the last change. */
13
+ metadata: $NextraMetadata;
14
+ /** The source of the MDX file (its `sourceCode` export), for the copy-page button. */
15
+ sourceCode?: string;
16
+ }
17
+ /** Props of {@link LocalizedPage}. */
18
+ interface LocalizedPageProps {
19
+ /** The page in English (the server renders it) and in the languages it is translated into. */
20
+ variants: Partial<Record<TuwaLocale, LocalizedPageVariant>> & {
21
+ en: LocalizedPageVariant;
22
+ };
23
+ }
24
+ /**
25
+ * A page of a TUWA documentation site in the language of the reader, inside the Nextra page wrapper (sidebar, table of
26
+ * contents, breadcrumbs, pagination). All variants come prerendered from the server, so switching the language makes no
27
+ * request and the URL stays the same; the server HTML and the search index hold English. A page without a translation
28
+ * in the active language (package READMEs and the generated API reference) shows English with a short note in that
29
+ * language. Must be rendered inside {@link DocsLayout}; `createDocsPage` (`@tuwaio/docs-ui/nextra/page`) renders it.
30
+ *
31
+ * @param props - See {@link LocalizedPageProps}.
32
+ * @returns The page.
33
+ */
34
+ declare function LocalizedPage({ variants }: LocalizedPageProps): react.JSX.Element;
35
+
36
+ export { LocalizedPage };
37
+ export type { LocalizedPageProps, LocalizedPageVariant };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Callout } from "nextra/components";
4
+ import { useMDXComponents } from "nextra-theme-docs";
5
+ import { useDocsI18n } from "../docsI18n";
6
+ function LocalizedPage({ variants }) {
7
+ const { locale, t } = useDocsI18n();
8
+ const Wrapper = useMDXComponents().wrapper;
9
+ const translated = variants[locale];
10
+ const page = translated ?? variants.en;
11
+ return /* @__PURE__ */ jsxs(Wrapper, { toc: page.toc, metadata: page.metadata, sourceCode: page.sourceCode, children: [
12
+ !translated && /* @__PURE__ */ jsx("div", { className: "tuwadocs:clear-both", children: /* @__PURE__ */ jsx(Callout, { type: "info", children: t.englishOnly }) }),
13
+ page.content
14
+ ] });
15
+ }
16
+ export {
17
+ LocalizedPage
18
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var docsI18n_exports = {};
21
+ __export(docsI18n_exports, {
22
+ DocsI18nProvider: () => DocsI18nProvider,
23
+ useDocsI18n: () => useDocsI18n
24
+ });
25
+ module.exports = __toCommonJS(docsI18n_exports);
26
+ var import_docsLabels = require("./docsLabels");
27
+ var import_i18n = require("./i18n");
28
+ const { I18nProvider: DocsI18nProvider, useI18n: useDocsI18n } = (0, import_i18n.createI18n)(import_docsLabels.docsLabels);
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ DocsI18nProvider,
32
+ useDocsI18n
33
+ });
@@ -0,0 +1,16 @@
1
+ import { DocsLabels } from './docsLabels.cjs';
2
+ import * as react from 'react';
3
+ import { I18nProviderProps, I18nContextValue } from './i18n.cjs';
4
+ import './locale.cjs';
5
+ import './policies.cjs';
6
+
7
+ /**
8
+ * The i18n kit of the TUWA documentation sites, on {@link docsLabels}: `DocsI18nProvider` provides the language of the
9
+ * reader and the interface texts, `useDocsI18n` reads them (outside the provider: English and a no-op setter).
10
+ * `DocsLayout` renders the provider, so a site's client components inside the layout call `useDocsI18n` directly.
11
+ * The language is detected after mount and kept under `tuwa-locale` in Local Storage (list it in `PreferenceExpiry`).
12
+ */
13
+ declare const DocsI18nProvider: react.ComponentType<I18nProviderProps>;
14
+ declare const useDocsI18n: () => I18nContextValue<DocsLabels>;
15
+
16
+ export { DocsI18nProvider, useDocsI18n };
@@ -0,0 +1,16 @@
1
+ import { DocsLabels } from './docsLabels.js';
2
+ import * as react from 'react';
3
+ import { I18nProviderProps, I18nContextValue } from './i18n.js';
4
+ import './locale.js';
5
+ import './policies.js';
6
+
7
+ /**
8
+ * The i18n kit of the TUWA documentation sites, on {@link docsLabels}: `DocsI18nProvider` provides the language of the
9
+ * reader and the interface texts, `useDocsI18n` reads them (outside the provider: English and a no-op setter).
10
+ * `DocsLayout` renders the provider, so a site's client components inside the layout call `useDocsI18n` directly.
11
+ * The language is detected after mount and kept under `tuwa-locale` in Local Storage (list it in `PreferenceExpiry`).
12
+ */
13
+ declare const DocsI18nProvider: react.ComponentType<I18nProviderProps>;
14
+ declare const useDocsI18n: () => I18nContextValue<DocsLabels>;
15
+
16
+ export { DocsI18nProvider, useDocsI18n };
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { docsLabels } from "./docsLabels";
3
+ import { createI18n } from "./i18n";
4
+ const { I18nProvider: DocsI18nProvider, useI18n: useDocsI18n } = createI18n(docsLabels);
5
+ export {
6
+ DocsI18nProvider,
7
+ useDocsI18n
8
+ };
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var docsLabels_exports = {};
20
+ __export(docsLabels_exports, {
21
+ docsLabels: () => docsLabels
22
+ });
23
+ module.exports = __toCommonJS(docsLabels_exports);
24
+ const en = {
25
+ selectLanguage: "Select language",
26
+ nextra: {
27
+ onThisPage: "On This Page",
28
+ scrollToTop: "Scroll to top",
29
+ editThisPage: "Edit this page",
30
+ feedback: "Question? Give us feedback",
31
+ lastUpdated: "Last updated on",
32
+ searchPlaceholder: "Search documentation\u2026",
33
+ searchEmpty: "No results found.",
34
+ searchError: "Failed to load search index.",
35
+ searchLoading: "Loading\u2026",
36
+ themeLight: "Light",
37
+ themeDark: "Dark",
38
+ themeSystem: "System"
39
+ },
40
+ footer: {
41
+ description: "The modular, headless-first Web3 infrastructure. Build self-custodial applications on open-source, portable building blocks.",
42
+ license: "Licensed under Apache 2.0. Open source and free to use.",
43
+ policiesAriaLabel: "Policies",
44
+ allPolicies: "All policies",
45
+ copyright: "All rights reserved.",
46
+ policyTitles: {
47
+ terms: "Terms of Service",
48
+ privacy: "Privacy Policy",
49
+ cookie: "Cookie Policy",
50
+ refund: "Refund Policy",
51
+ security: "Security Policy",
52
+ dpa: "Data Processing Addendum"
53
+ }
54
+ },
55
+ englishOnly: "This page is in English only: package READMEs and the API reference are generated from the source code and are not translated.",
56
+ sidebar: {}
57
+ };
58
+ const uk = {
59
+ selectLanguage: "\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u043C\u043E\u0432\u0443",
60
+ nextra: {
61
+ onThisPage: "\u041D\u0430 \u0446\u0456\u0439 \u0441\u0442\u043E\u0440\u0456\u043D\u0446\u0456",
62
+ scrollToTop: "\u041F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u0438 \u0432\u0433\u043E\u0440\u0443",
63
+ editThisPage: "\u0420\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438 \u0446\u044E \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443",
64
+ feedback: "\u0404 \u0437\u0430\u043F\u0438\u0442\u0430\u043D\u043D\u044F? \u0417\u0430\u043B\u0438\u0448\u0442\u0435 \u0432\u0456\u0434\u0433\u0443\u043A",
65
+ lastUpdated: "\u0412\u043E\u0441\u0442\u0430\u043D\u043D\u0454 \u043E\u043D\u043E\u0432\u043B\u0435\u043D\u043E",
66
+ searchPlaceholder: "\u041F\u043E\u0448\u0443\u043A \u0443 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0456\u0457\u2026",
67
+ searchEmpty: "\u041D\u0456\u0447\u043E\u0433\u043E \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E.",
68
+ searchError: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438 \u043F\u043E\u0448\u0443\u043A\u043E\u0432\u0438\u0439 \u0456\u043D\u0434\u0435\u043A\u0441.",
69
+ searchLoading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F\u2026",
70
+ themeLight: "\u0421\u0432\u0456\u0442\u043B\u0430",
71
+ themeDark: "\u0422\u0435\u043C\u043D\u0430",
72
+ themeSystem: "\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u0430"
73
+ },
74
+ footer: {
75
+ description: "\u041C\u043E\u0434\u0443\u043B\u044C\u043D\u0430, headless-first Web3-\u0456\u043D\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u0430. \u0411\u0443\u0434\u0443\u0439\u0442\u0435 self-custodial \u0437\u0430\u0441\u0442\u043E\u0441\u0443\u043D\u043A\u0438 \u043D\u0430 \u0431\u0430\u0437\u0456 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u0445 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0456\u0432.",
76
+ license: "\u041B\u0456\u0446\u0435\u043D\u0437\u043E\u0432\u0430\u043D\u043E \u043F\u0456\u0434 Apache 2.0. \u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u0439 \u043A\u043E\u0434 \u0442\u0430 \u0431\u0435\u0437\u043A\u043E\u0448\u0442\u043E\u0432\u043D\u0435 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u043D\u043D\u044F.",
77
+ policiesAriaLabel: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0438",
78
+ allPolicies: "\u0423\u0441\u0456 \u043F\u043E\u043B\u0456\u0442\u0438\u043A\u0438",
79
+ copyright: "\u0423\u0441\u0456 \u043F\u0440\u0430\u0432\u0430 \u0437\u0430\u0445\u0438\u0449\u0435\u043D\u043E.",
80
+ policyTitles: {
81
+ terms: "\u0423\u043C\u043E\u0432\u0438 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u043D\u043D\u044F",
82
+ privacy: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0430 \u043A\u043E\u043D\u0444\u0456\u0434\u0435\u043D\u0446\u0456\u0439\u043D\u043E\u0441\u0442\u0456",
83
+ cookie: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0430 \u0444\u0430\u0439\u043B\u0456\u0432 cookie",
84
+ refund: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0430 \u043F\u043E\u0432\u0435\u0440\u043D\u0435\u043D\u043D\u044F \u043A\u043E\u0448\u0442\u0456\u0432",
85
+ security: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0430 \u0431\u0435\u0437\u043F\u0435\u043A\u0438",
86
+ dpa: "\u0414\u043E\u043F\u043E\u0432\u043D\u0435\u043D\u043D\u044F \u0449\u043E\u0434\u043E \u043E\u0431\u0440\u043E\u0431\u043A\u0438 \u0434\u0430\u043D\u0438\u0445"
87
+ }
88
+ },
89
+ englishOnly: "\u0426\u044F \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u043B\u0438\u0448\u0435 \u0430\u043D\u0433\u043B\u0456\u0439\u0441\u044C\u043A\u043E\u044E: README \u043F\u0430\u043A\u0435\u0442\u0456\u0432 \u0456 \u0434\u043E\u0432\u0456\u0434\u043D\u0438\u043A API \u0433\u0435\u043D\u0435\u0440\u0443\u044E\u0442\u044C\u0441\u044F \u0437 \u0432\u0438\u0445\u0456\u0434\u043D\u043E\u0433\u043E \u043A\u043E\u0434\u0443 \u0439 \u043D\u0435 \u043F\u0435\u0440\u0435\u043A\u043B\u0430\u0434\u0430\u044E\u0442\u044C\u0441\u044F.",
90
+ sidebar: {
91
+ Introduction: "\u0412\u0441\u0442\u0443\u043F",
92
+ Packages: "\u041F\u0430\u043A\u0435\u0442\u0438",
93
+ Guides: "\u041F\u043E\u0441\u0456\u0431\u043D\u0438\u043A\u0438",
94
+ Overview: "\u041E\u0433\u043B\u044F\u0434"
95
+ }
96
+ };
97
+ const zhCN = {
98
+ selectLanguage: "\u9009\u62E9\u8BED\u8A00",
99
+ nextra: {
100
+ onThisPage: "\u672C\u9875\u76EE\u5F55",
101
+ scrollToTop: "\u8FD4\u56DE\u9876\u90E8",
102
+ editThisPage: "\u7F16\u8F91\u6B64\u9875",
103
+ feedback: "\u6709\u7591\u95EE\uFF1F\u5411\u6211\u4EEC\u53CD\u9988",
104
+ lastUpdated: "\u6700\u540E\u66F4\u65B0\u4E8E",
105
+ searchPlaceholder: "\u641C\u7D22\u6587\u6863\u2026",
106
+ searchEmpty: "\u672A\u627E\u5230\u5339\u914D\u7ED3\u679C\u3002",
107
+ searchError: "\u52A0\u8F7D\u641C\u7D22\u7D22\u5F15\u5931\u8D25\u3002",
108
+ searchLoading: "\u6B63\u5728\u52A0\u8F7D\u2026",
109
+ themeLight: "\u6D45\u8272",
110
+ themeDark: "\u6DF1\u8272",
111
+ themeSystem: "\u8DDF\u968F\u7CFB\u7EDF"
112
+ },
113
+ footer: {
114
+ description: "\u6A21\u5757\u5316\u3001\u65E0\u5934\u4F18\u5148\u7684 Web3 \u57FA\u7840\u8BBE\u65BD\u3002\u501F\u52A9\u5F00\u6E90\u4E14\u9AD8\u5EA6\u53EF\u79FB\u690D\u7684\u5E95\u5C42\u6784\u5EFA\u5757\uFF0C\u6253\u9020\u771F\u6B63\u7684\u81EA\u6258\u7BA1\u5E94\u7528\u3002",
115
+ license: "\u57FA\u4E8E Apache 2.0 \u534F\u8BAE\u5F00\u6E90\u3002\u5B8C\u5168\u514D\u8D39\u4F7F\u7528\u3002",
116
+ policiesAriaLabel: "\u6CD5\u5F8B\u4E0E\u5B89\u5168\u653F\u7B56",
117
+ allPolicies: "\u5168\u90E8\u653F\u7B56",
118
+ copyright: "\u4FDD\u7559\u6240\u6709\u6743\u5229\u3002",
119
+ policyTitles: {
120
+ terms: "\u670D\u52A1\u6761\u6B3E",
121
+ privacy: "\u9690\u79C1\u653F\u7B56",
122
+ cookie: "Cookie \u653F\u7B56",
123
+ refund: "\u9000\u6B3E\u653F\u7B56",
124
+ security: "\u5B89\u5168\u653F\u7B56",
125
+ dpa: "\u6570\u636E\u5904\u7406\u9644\u5F55 (DPA)"
126
+ }
127
+ },
128
+ englishOnly: "\u672C\u9875\u4EC5\u63D0\u4F9B\u82F1\u6587\u7248\uFF1A\u8F6F\u4EF6\u5305 README \u4E0E API \u53C2\u8003\u7531\u6E90\u4EE3\u7801\u751F\u6210\uFF0C\u4E0D\u63D0\u4F9B\u7FFB\u8BD1\u3002",
129
+ sidebar: {
130
+ Introduction: "\u7B80\u4ECB",
131
+ Packages: "\u8F6F\u4EF6\u5305",
132
+ Guides: "\u6307\u5357",
133
+ Overview: "\u6982\u89C8"
134
+ }
135
+ };
136
+ const docsLabels = { en, uk, "zh-CN": zhCN };
137
+ // Annotate the CommonJS export names for ESM import in node:
138
+ 0 && (module.exports = {
139
+ docsLabels
140
+ });
@@ -0,0 +1,72 @@
1
+ import { TuwaLocale } from './locale.cjs';
2
+ import { PolicySlug } from './policies.cjs';
3
+
4
+ /**
5
+ * Texts of the interface of a TUWA documentation site (the Nextra chrome, the footer, the language switch and the
6
+ * note on pages that stay in English), shared by the project sites and the docs hub so every site words them the same
7
+ * way. Page content is not part of it: each site keeps its own translated pages.
8
+ */
9
+ interface DocsLabels {
10
+ /** Accessible name of the language switch in the navbar. */
11
+ selectLanguage: string;
12
+ /** The parts of the Nextra layout, passed to its props by `DocsLayout`. */
13
+ nextra: {
14
+ /** Title of the table of contents. */
15
+ onThisPage: string;
16
+ /** The button below the table of contents. */
17
+ scrollToTop: string;
18
+ /** The link to the source of the page on GitHub. */
19
+ editThisPage: string;
20
+ /** The link to a new GitHub issue about the page. */
21
+ feedback: string;
22
+ /** Text before the date of the last change of the page. */
23
+ lastUpdated: string;
24
+ /** Placeholder of the search field. */
25
+ searchPlaceholder: string;
26
+ /** Shown when the search finds nothing. */
27
+ searchEmpty: string;
28
+ /** Shown when the search index cannot be loaded. */
29
+ searchError: string;
30
+ /** Shown while the search index loads. */
31
+ searchLoading: string;
32
+ /** The light option of the theme switch. */
33
+ themeLight: string;
34
+ /** The dark option of the theme switch. */
35
+ themeDark: string;
36
+ /** The system option of the theme switch. */
37
+ themeSystem: string;
38
+ };
39
+ /** The texts of the docs-ui `Footer` (its `labels` prop). */
40
+ footer: {
41
+ /** Description of TUWA. */
42
+ description: string;
43
+ /** License notice. */
44
+ license: string;
45
+ /** Accessible name of the policies nav. */
46
+ policiesAriaLabel: string;
47
+ /** The link to all policies. */
48
+ allPolicies: string;
49
+ /** Copyright text after the year. */
50
+ copyright: string;
51
+ /** Titles of the policies. */
52
+ policyTitles: Record<PolicySlug, string>;
53
+ };
54
+ /**
55
+ * The note above a page that has no translation in the active language: on the project sites these are the package
56
+ * READMEs and the generated API reference, which stay in English.
57
+ */
58
+ englishOnly: string;
59
+ /**
60
+ * Sidebar titles that every documentation site uses, by their English title (`Introduction`, `Packages`, `Guides`,
61
+ * `Overview`). Empty for English.
62
+ */
63
+ sidebar: Record<string, string>;
64
+ }
65
+ /**
66
+ * The {@link DocsLabels} of every {@link TuwaLocale}. `DocsLayout` and `LocalizedPage` (`@tuwaio/docs-ui/nextra`) read
67
+ * them; the docs hub builds its own dictionaries on them.
68
+ */
69
+ declare const docsLabels: Readonly<Record<TuwaLocale, DocsLabels>>;
70
+
71
+ export { docsLabels };
72
+ export type { DocsLabels };
@@ -0,0 +1,72 @@
1
+ import { TuwaLocale } from './locale.js';
2
+ import { PolicySlug } from './policies.js';
3
+
4
+ /**
5
+ * Texts of the interface of a TUWA documentation site (the Nextra chrome, the footer, the language switch and the
6
+ * note on pages that stay in English), shared by the project sites and the docs hub so every site words them the same
7
+ * way. Page content is not part of it: each site keeps its own translated pages.
8
+ */
9
+ interface DocsLabels {
10
+ /** Accessible name of the language switch in the navbar. */
11
+ selectLanguage: string;
12
+ /** The parts of the Nextra layout, passed to its props by `DocsLayout`. */
13
+ nextra: {
14
+ /** Title of the table of contents. */
15
+ onThisPage: string;
16
+ /** The button below the table of contents. */
17
+ scrollToTop: string;
18
+ /** The link to the source of the page on GitHub. */
19
+ editThisPage: string;
20
+ /** The link to a new GitHub issue about the page. */
21
+ feedback: string;
22
+ /** Text before the date of the last change of the page. */
23
+ lastUpdated: string;
24
+ /** Placeholder of the search field. */
25
+ searchPlaceholder: string;
26
+ /** Shown when the search finds nothing. */
27
+ searchEmpty: string;
28
+ /** Shown when the search index cannot be loaded. */
29
+ searchError: string;
30
+ /** Shown while the search index loads. */
31
+ searchLoading: string;
32
+ /** The light option of the theme switch. */
33
+ themeLight: string;
34
+ /** The dark option of the theme switch. */
35
+ themeDark: string;
36
+ /** The system option of the theme switch. */
37
+ themeSystem: string;
38
+ };
39
+ /** The texts of the docs-ui `Footer` (its `labels` prop). */
40
+ footer: {
41
+ /** Description of TUWA. */
42
+ description: string;
43
+ /** License notice. */
44
+ license: string;
45
+ /** Accessible name of the policies nav. */
46
+ policiesAriaLabel: string;
47
+ /** The link to all policies. */
48
+ allPolicies: string;
49
+ /** Copyright text after the year. */
50
+ copyright: string;
51
+ /** Titles of the policies. */
52
+ policyTitles: Record<PolicySlug, string>;
53
+ };
54
+ /**
55
+ * The note above a page that has no translation in the active language: on the project sites these are the package
56
+ * READMEs and the generated API reference, which stay in English.
57
+ */
58
+ englishOnly: string;
59
+ /**
60
+ * Sidebar titles that every documentation site uses, by their English title (`Introduction`, `Packages`, `Guides`,
61
+ * `Overview`). Empty for English.
62
+ */
63
+ sidebar: Record<string, string>;
64
+ }
65
+ /**
66
+ * The {@link DocsLabels} of every {@link TuwaLocale}. `DocsLayout` and `LocalizedPage` (`@tuwaio/docs-ui/nextra`) read
67
+ * them; the docs hub builds its own dictionaries on them.
68
+ */
69
+ declare const docsLabels: Readonly<Record<TuwaLocale, DocsLabels>>;
70
+
71
+ export { docsLabels };
72
+ export type { DocsLabels };
@@ -0,0 +1,116 @@
1
+ const en = {
2
+ selectLanguage: "Select language",
3
+ nextra: {
4
+ onThisPage: "On This Page",
5
+ scrollToTop: "Scroll to top",
6
+ editThisPage: "Edit this page",
7
+ feedback: "Question? Give us feedback",
8
+ lastUpdated: "Last updated on",
9
+ searchPlaceholder: "Search documentation\u2026",
10
+ searchEmpty: "No results found.",
11
+ searchError: "Failed to load search index.",
12
+ searchLoading: "Loading\u2026",
13
+ themeLight: "Light",
14
+ themeDark: "Dark",
15
+ themeSystem: "System"
16
+ },
17
+ footer: {
18
+ description: "The modular, headless-first Web3 infrastructure. Build self-custodial applications on open-source, portable building blocks.",
19
+ license: "Licensed under Apache 2.0. Open source and free to use.",
20
+ policiesAriaLabel: "Policies",
21
+ allPolicies: "All policies",
22
+ copyright: "All rights reserved.",
23
+ policyTitles: {
24
+ terms: "Terms of Service",
25
+ privacy: "Privacy Policy",
26
+ cookie: "Cookie Policy",
27
+ refund: "Refund Policy",
28
+ security: "Security Policy",
29
+ dpa: "Data Processing Addendum"
30
+ }
31
+ },
32
+ englishOnly: "This page is in English only: package READMEs and the API reference are generated from the source code and are not translated.",
33
+ sidebar: {}
34
+ };
35
+ const uk = {
36
+ selectLanguage: "\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u043C\u043E\u0432\u0443",
37
+ nextra: {
38
+ onThisPage: "\u041D\u0430 \u0446\u0456\u0439 \u0441\u0442\u043E\u0440\u0456\u043D\u0446\u0456",
39
+ scrollToTop: "\u041F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u0438 \u0432\u0433\u043E\u0440\u0443",
40
+ editThisPage: "\u0420\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438 \u0446\u044E \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443",
41
+ feedback: "\u0404 \u0437\u0430\u043F\u0438\u0442\u0430\u043D\u043D\u044F? \u0417\u0430\u043B\u0438\u0448\u0442\u0435 \u0432\u0456\u0434\u0433\u0443\u043A",
42
+ lastUpdated: "\u0412\u043E\u0441\u0442\u0430\u043D\u043D\u0454 \u043E\u043D\u043E\u0432\u043B\u0435\u043D\u043E",
43
+ searchPlaceholder: "\u041F\u043E\u0448\u0443\u043A \u0443 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0456\u0457\u2026",
44
+ searchEmpty: "\u041D\u0456\u0447\u043E\u0433\u043E \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E.",
45
+ searchError: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438 \u043F\u043E\u0448\u0443\u043A\u043E\u0432\u0438\u0439 \u0456\u043D\u0434\u0435\u043A\u0441.",
46
+ searchLoading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F\u2026",
47
+ themeLight: "\u0421\u0432\u0456\u0442\u043B\u0430",
48
+ themeDark: "\u0422\u0435\u043C\u043D\u0430",
49
+ themeSystem: "\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u0430"
50
+ },
51
+ footer: {
52
+ description: "\u041C\u043E\u0434\u0443\u043B\u044C\u043D\u0430, headless-first Web3-\u0456\u043D\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u0430. \u0411\u0443\u0434\u0443\u0439\u0442\u0435 self-custodial \u0437\u0430\u0441\u0442\u043E\u0441\u0443\u043D\u043A\u0438 \u043D\u0430 \u0431\u0430\u0437\u0456 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u0445 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0456\u0432.",
53
+ license: "\u041B\u0456\u0446\u0435\u043D\u0437\u043E\u0432\u0430\u043D\u043E \u043F\u0456\u0434 Apache 2.0. \u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438\u0439 \u043A\u043E\u0434 \u0442\u0430 \u0431\u0435\u0437\u043A\u043E\u0448\u0442\u043E\u0432\u043D\u0435 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u043D\u043D\u044F.",
54
+ policiesAriaLabel: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0438",
55
+ allPolicies: "\u0423\u0441\u0456 \u043F\u043E\u043B\u0456\u0442\u0438\u043A\u0438",
56
+ copyright: "\u0423\u0441\u0456 \u043F\u0440\u0430\u0432\u0430 \u0437\u0430\u0445\u0438\u0449\u0435\u043D\u043E.",
57
+ policyTitles: {
58
+ terms: "\u0423\u043C\u043E\u0432\u0438 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u043D\u043D\u044F",
59
+ privacy: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0430 \u043A\u043E\u043D\u0444\u0456\u0434\u0435\u043D\u0446\u0456\u0439\u043D\u043E\u0441\u0442\u0456",
60
+ cookie: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0430 \u0444\u0430\u0439\u043B\u0456\u0432 cookie",
61
+ refund: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0430 \u043F\u043E\u0432\u0435\u0440\u043D\u0435\u043D\u043D\u044F \u043A\u043E\u0448\u0442\u0456\u0432",
62
+ security: "\u041F\u043E\u043B\u0456\u0442\u0438\u043A\u0430 \u0431\u0435\u0437\u043F\u0435\u043A\u0438",
63
+ dpa: "\u0414\u043E\u043F\u043E\u0432\u043D\u0435\u043D\u043D\u044F \u0449\u043E\u0434\u043E \u043E\u0431\u0440\u043E\u0431\u043A\u0438 \u0434\u0430\u043D\u0438\u0445"
64
+ }
65
+ },
66
+ englishOnly: "\u0426\u044F \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u043B\u0438\u0448\u0435 \u0430\u043D\u0433\u043B\u0456\u0439\u0441\u044C\u043A\u043E\u044E: README \u043F\u0430\u043A\u0435\u0442\u0456\u0432 \u0456 \u0434\u043E\u0432\u0456\u0434\u043D\u0438\u043A API \u0433\u0435\u043D\u0435\u0440\u0443\u044E\u0442\u044C\u0441\u044F \u0437 \u0432\u0438\u0445\u0456\u0434\u043D\u043E\u0433\u043E \u043A\u043E\u0434\u0443 \u0439 \u043D\u0435 \u043F\u0435\u0440\u0435\u043A\u043B\u0430\u0434\u0430\u044E\u0442\u044C\u0441\u044F.",
67
+ sidebar: {
68
+ Introduction: "\u0412\u0441\u0442\u0443\u043F",
69
+ Packages: "\u041F\u0430\u043A\u0435\u0442\u0438",
70
+ Guides: "\u041F\u043E\u0441\u0456\u0431\u043D\u0438\u043A\u0438",
71
+ Overview: "\u041E\u0433\u043B\u044F\u0434"
72
+ }
73
+ };
74
+ const zhCN = {
75
+ selectLanguage: "\u9009\u62E9\u8BED\u8A00",
76
+ nextra: {
77
+ onThisPage: "\u672C\u9875\u76EE\u5F55",
78
+ scrollToTop: "\u8FD4\u56DE\u9876\u90E8",
79
+ editThisPage: "\u7F16\u8F91\u6B64\u9875",
80
+ feedback: "\u6709\u7591\u95EE\uFF1F\u5411\u6211\u4EEC\u53CD\u9988",
81
+ lastUpdated: "\u6700\u540E\u66F4\u65B0\u4E8E",
82
+ searchPlaceholder: "\u641C\u7D22\u6587\u6863\u2026",
83
+ searchEmpty: "\u672A\u627E\u5230\u5339\u914D\u7ED3\u679C\u3002",
84
+ searchError: "\u52A0\u8F7D\u641C\u7D22\u7D22\u5F15\u5931\u8D25\u3002",
85
+ searchLoading: "\u6B63\u5728\u52A0\u8F7D\u2026",
86
+ themeLight: "\u6D45\u8272",
87
+ themeDark: "\u6DF1\u8272",
88
+ themeSystem: "\u8DDF\u968F\u7CFB\u7EDF"
89
+ },
90
+ footer: {
91
+ description: "\u6A21\u5757\u5316\u3001\u65E0\u5934\u4F18\u5148\u7684 Web3 \u57FA\u7840\u8BBE\u65BD\u3002\u501F\u52A9\u5F00\u6E90\u4E14\u9AD8\u5EA6\u53EF\u79FB\u690D\u7684\u5E95\u5C42\u6784\u5EFA\u5757\uFF0C\u6253\u9020\u771F\u6B63\u7684\u81EA\u6258\u7BA1\u5E94\u7528\u3002",
92
+ license: "\u57FA\u4E8E Apache 2.0 \u534F\u8BAE\u5F00\u6E90\u3002\u5B8C\u5168\u514D\u8D39\u4F7F\u7528\u3002",
93
+ policiesAriaLabel: "\u6CD5\u5F8B\u4E0E\u5B89\u5168\u653F\u7B56",
94
+ allPolicies: "\u5168\u90E8\u653F\u7B56",
95
+ copyright: "\u4FDD\u7559\u6240\u6709\u6743\u5229\u3002",
96
+ policyTitles: {
97
+ terms: "\u670D\u52A1\u6761\u6B3E",
98
+ privacy: "\u9690\u79C1\u653F\u7B56",
99
+ cookie: "Cookie \u653F\u7B56",
100
+ refund: "\u9000\u6B3E\u653F\u7B56",
101
+ security: "\u5B89\u5168\u653F\u7B56",
102
+ dpa: "\u6570\u636E\u5904\u7406\u9644\u5F55 (DPA)"
103
+ }
104
+ },
105
+ englishOnly: "\u672C\u9875\u4EC5\u63D0\u4F9B\u82F1\u6587\u7248\uFF1A\u8F6F\u4EF6\u5305 README \u4E0E API \u53C2\u8003\u7531\u6E90\u4EE3\u7801\u751F\u6210\uFF0C\u4E0D\u63D0\u4F9B\u7FFB\u8BD1\u3002",
106
+ sidebar: {
107
+ Introduction: "\u7B80\u4ECB",
108
+ Packages: "\u8F6F\u4EF6\u5305",
109
+ Guides: "\u6307\u5357",
110
+ Overview: "\u6982\u89C8"
111
+ }
112
+ };
113
+ const docsLabels = { en, uk, "zh-CN": zhCN };
114
+ export {
115
+ docsLabels
116
+ };
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var docsPage_exports = {};
20
+ __export(docsPage_exports, {
21
+ createDocsPage: () => createDocsPage
22
+ });
23
+ module.exports = __toCommonJS(docsPage_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_navigation = require("next/navigation");
26
+ var import_pages = require("nextra/pages");
27
+ var import_LocalizedPage = require("./components/LocalizedPage");
28
+ function isAssetOrInternal(mdxPath) {
29
+ if (!mdxPath || mdxPath.length === 0) return false;
30
+ if (mdxPath[0] === "_next") return true;
31
+ return Boolean(mdxPath[mdxPath.length - 1]?.includes("."));
32
+ }
33
+ const routeOf = (mdxPath) => `/${(mdxPath ?? []).join("/")}`;
34
+ function variantOf(module2, props, params) {
35
+ const { default: MDXContent, toc, metadata, sourceCode } = module2;
36
+ return { content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MDXContent, { ...props, params }), toc, metadata, sourceCode };
37
+ }
38
+ function createDocsPage({ localizedPages = {} } = {}) {
39
+ const generateStaticParams = (0, import_pages.generateStaticParamsFor)("mdxPath");
40
+ async function generateMetadata(props) {
41
+ const { mdxPath } = await props.params;
42
+ if (isAssetOrInternal(mdxPath)) return {};
43
+ try {
44
+ const { metadata } = await (0, import_pages.importPage)(mdxPath);
45
+ return metadata;
46
+ } catch {
47
+ return {};
48
+ }
49
+ }
50
+ async function Page(props) {
51
+ const params = await props.params;
52
+ if (isAssetOrInternal(params.mdxPath)) (0, import_navigation.notFound)();
53
+ let english;
54
+ try {
55
+ english = await (0, import_pages.importPage)(params.mdxPath);
56
+ } catch {
57
+ (0, import_navigation.notFound)();
58
+ }
59
+ const loaders = Object.entries(localizedPages[routeOf(params.mdxPath)] ?? {});
60
+ const translations = await Promise.all(
61
+ loaders.map(async ([locale, load]) => [locale, variantOf(await load(), props, params)])
62
+ );
63
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LocalizedPage.LocalizedPage, { variants: { ...Object.fromEntries(translations), en: variantOf(english, props, params) } });
64
+ }
65
+ return { generateStaticParams, generateMetadata, Page };
66
+ }
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ createDocsPage
70
+ });