@tuwaio/docs-ui 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  - **Logo:** `RemoteLogo` is an async React Server Component that fetches an SVG (by default the TUWA logo) and renders it as React elements, so it takes `className` and `currentColor`.
14
14
  - **Theme switch:** `ThemeSwitcher` is a light/dark switch for any theme state (for example `next-themes`).
15
15
  - **Decoration:** `Orb` (an animated sphere in the brand color of a TUWA project), `StarryBackground` (an animated star field on a canvas) and `NoSSR` (renders its children only on the client).
16
- - **Policy pages:** `policies` lists the TUWA policies (Terms, Privacy, Cookie, Refund, Security, Data Processing Addendum) with their paths and whether they are in force (`publishedPolicies`; footers use `footerPolicies`). `loadPolicy` loads the text of a policy, and `PolicyDocument` renders it with the date of the version, a Download PDF button, anchored sections and a list of sections. The texts and PDFs come from [`TuwaIO/workflows/docs`](https://github.com/TuwaIO/workflows/tree/main/docs).
16
+ - **Policy pages:** `policies` lists the TUWA policies (Terms, Privacy, Cookie, Refund, Security, Data Processing Addendum) with their paths and whether they are in force (`publishedPolicies`; footers use `footerPolicies`). `loadPolicy` loads the text of a policy, and `PolicyDocument` renders it with the date of the version, a Download PDF button, anchored sections and a list of sections. The texts and PDFs come from [`TuwaIO/workflows/docs`](https://github.com/TuwaIO/workflows/tree/main/docs). Code that needs only the list or `loadPolicy` (footers, sitemaps, route handlers) imports them from `@tuwaio/docs-ui/policies`, which has no React, Next.js or Nextra imports.
17
17
  - **Stylesheet:** `dist/index.css` contains the `--tuwa-*` theme variables of [`@tuwaio/nova-core`](https://stories.tuwa.io/?path=/docs/packages-nova-core-overview--docs) (light and `.dark`), the styles of the Nextra parts and the Tailwind CSS v4 utilities used by the components, prefixed with `tuwadocs:`.
18
18
 
19
19
  ---
@@ -95,10 +95,10 @@ export default async function RefundPage() {
95
95
  }
96
96
  ```
97
97
 
98
- Footers list the policies in force:
98
+ Footers list the policies in force (`@tuwaio/docs-ui/policies` has only the policy data, so a footer does not pull in the Nextra parts):
99
99
 
100
100
  ```tsx
101
- import { footerPolicies } from '@tuwaio/docs-ui';
101
+ import { footerPolicies } from '@tuwaio/docs-ui/policies';
102
102
 
103
103
  export function PolicyLinks() {
104
104
  return (
@@ -22,21 +22,21 @@ __export(Footer_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(Footer_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_nova_core = require("@tuwaio/nova-core");
25
+ var import_utils = require("@tuwaio/nova-core/utils");
26
26
  var import_nextra_theme_docs = require("nextra-theme-docs");
27
27
  var import_policies = require("../policies");
28
- var import_utils = require("../utils");
28
+ var import_utils2 = require("../utils");
29
29
  function Footer({ links, logo }) {
30
30
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_nextra_theme_docs.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tuwadocs:flex tuwadocs:w-full tuwadocs:flex-col tuwadocs:items-center tuwadocs:sm:items-start tuwa-footer-border tuwadocs:pt-8", children: [
31
31
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tuwadocs:mb-6 tuwadocs:flex tuwadocs:items-center tuwadocs:gap-4 tuwadocs:w-full tuwadocs:justify-between", children: [
32
32
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tuwadocs:flex tuwadocs:items-center", children: logo }),
33
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tuwadocs:flex tuwadocs:items-center tuwadocs:gap-4 tuwadocs:text-sm", children: (links ?? import_utils.baseFooterLinks).map(({ title, href, image, className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tuwadocs:flex tuwadocs:items-center tuwadocs:gap-4 tuwadocs:text-sm", children: (links ?? import_utils2.baseFooterLinks).map(({ title, href, image, className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
34
34
  "a",
35
35
  {
36
36
  href,
37
37
  target: "_blank",
38
38
  rel: "noopener noreferrer",
39
- className: (0, import_nova_core.cn)("tuwa-footer-link tuwadocs:flex tuwadocs:items-center tuwadocs:gap-1", className),
39
+ className: (0, import_utils.cn)("tuwa-footer-link tuwadocs:flex tuwadocs:items-center tuwadocs:gap-1", className),
40
40
  children: [
41
41
  image,
42
42
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "tuwadocs:hidden tuwadocs:sm:inline", children: title })
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { cn } from "@tuwaio/nova-core";
2
+ import { cn } from "@tuwaio/nova-core/utils";
3
3
  import { Footer as NextraFooter } from "nextra-theme-docs";
4
4
  import { footerPolicies, getPolicyPageUrl, POLICIES_INDEX_URL } from "../policies";
5
5
  import { baseFooterLinks } from "../utils";
@@ -22,17 +22,17 @@ __export(NavBar_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(NavBar_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_nova_core = require("@tuwaio/nova-core");
25
+ var import_utils = require("@tuwaio/nova-core/utils");
26
26
  var import_nextra_theme_docs = require("nextra-theme-docs");
27
- var import_utils = require("../utils");
27
+ var import_utils2 = require("../utils");
28
28
  function Navbar({ links, logo }) {
29
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_nextra_theme_docs.Navbar, { logo, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tuwadocs:flex tuwadocs:items-center tuwadocs:gap-3", children: (links ?? import_utils.baseNavLinks).map(({ title, href, image, className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_nextra_theme_docs.Navbar, { logo, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tuwadocs:flex tuwadocs:items-center tuwadocs:gap-3", children: (links ?? import_utils2.baseNavLinks).map(({ title, href, image, className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
30
30
  "a",
31
31
  {
32
32
  href,
33
33
  target: "_blank",
34
34
  rel: "noopener noreferrer",
35
- className: (0, import_nova_core.cn)(
35
+ className: (0, import_utils.cn)(
36
36
  "tuwadocs:hidden tuwadocs:sm:flex tuwadocs:items-center tuwadocs:gap-1 tuwadocs:px-3 tuwadocs:py-1.5 tuwadocs:text-sm tuwadocs:font-medium tuwadocs:transition-colors tuwadocs:text-[var(--tuwa-text-primary)]",
37
37
  className
38
38
  ),
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { cn } from "@tuwaio/nova-core";
2
+ import { cn } from "@tuwaio/nova-core/utils";
3
3
  import { Navbar as NextraNavbar } from "nextra-theme-docs";
4
4
  import { baseNavLinks } from "../utils";
5
5
  function Navbar({ links, logo }) {
@@ -33,7 +33,7 @@ __export(Orb_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(Orb_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_nova_core = require("@tuwaio/nova-core");
36
+ var import_utils = require("@tuwaio/nova-core/utils");
37
37
  var import_react = __toESM(require("react"), 1);
38
38
  const packageColors = {
39
39
  siwx: "#10b981",
@@ -294,7 +294,7 @@ const Orb = import_react.default.forwardRef(
294
294
  "div",
295
295
  {
296
296
  ref,
297
- className: (0, import_nova_core.cn)(
297
+ className: (0, import_utils.cn)(
298
298
  "tuwadocs:relative tuwadocs:flex tuwadocs:items-center tuwadocs:justify-center tuwa-orb-float",
299
299
  className
300
300
  ),
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { cn } from "@tuwaio/nova-core";
3
+ import { cn } from "@tuwaio/nova-core/utils";
4
4
  import React from "react";
5
5
  const packageColors = {
6
6
  siwx: "#10b981",
@@ -33,7 +33,7 @@ __export(PolicyDocument_exports, {
33
33
  module.exports = __toCommonJS(PolicyDocument_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_outline = require("@heroicons/react/24/outline");
36
- var import_nova_core = require("@tuwaio/nova-core");
36
+ var import_utils = require("@tuwaio/nova-core/utils");
37
37
  var import_html_react_parser = __toESM(require("html-react-parser"), 1);
38
38
  var import_policies = require("../policies");
39
39
  const BLOCKED_ELEMENTS = /* @__PURE__ */ new Set([
@@ -80,7 +80,7 @@ function PolicyDocument({
80
80
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
81
81
  "div",
82
82
  {
83
- className: (0, import_nova_core.cn)(
83
+ className: (0, import_utils.cn)(
84
84
  "tuwadocs:grid tuwadocs:grid-cols-1 tuwadocs:gap-10 tuwadocs:lg:grid-cols-[minmax(0,1fr)_14rem]",
85
85
  className
86
86
  ),
@@ -89,7 +89,7 @@ function PolicyDocument({
89
89
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
90
90
  "header",
91
91
  {
92
- className: (0, import_nova_core.cn)(
92
+ className: (0, import_utils.cn)(
93
93
  "tuwadocs:mb-8 tuwadocs:flex tuwadocs:flex-col tuwadocs:gap-4 tuwadocs:border-b tuwadocs:border-[var(--tuwa-border-primary)] tuwadocs:pb-6",
94
94
  classNames?.header
95
95
  ),
@@ -97,7 +97,7 @@ function PolicyDocument({
97
97
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
98
98
  "h1",
99
99
  {
100
- className: (0, import_nova_core.cn)(
100
+ className: (0, import_utils.cn)(
101
101
  "tuwadocs-policy-title tuwadocs:text-3xl tuwadocs:font-extrabold tuwadocs:tracking-tight tuwadocs:text-[var(--tuwa-text-primary)] tuwadocs:sm:text-4xl",
102
102
  classNames?.title
103
103
  ),
@@ -105,7 +105,7 @@ function PolicyDocument({
105
105
  }
106
106
  ),
107
107
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tuwadocs:flex tuwadocs:flex-wrap tuwadocs:items-center tuwadocs:justify-between tuwadocs:gap-3", children: [
108
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: (0, import_nova_core.cn)("tuwadocs:text-sm tuwadocs:text-[var(--tuwa-text-secondary)]", classNames?.updated), children: [
108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: (0, import_utils.cn)("tuwadocs:text-sm tuwadocs:text-[var(--tuwa-text-secondary)]", classNames?.updated), children: [
109
109
  labels?.updated ?? "Last updated",
110
110
  " ",
111
111
  content.updated
@@ -116,7 +116,7 @@ function PolicyDocument({
116
116
  href: (0, import_policies.getPolicyFileUrl)(slug, "pdf", source),
117
117
  target: "_blank",
118
118
  rel: "noopener noreferrer",
119
- className: (0, import_nova_core.cn)(
119
+ className: (0, import_utils.cn)(
120
120
  "tuwadocs-policy-title tuwadocs:inline-flex tuwadocs:h-10 tuwadocs:no-underline tuwadocs:items-center tuwadocs:gap-2 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:border tuwadocs:border-[var(--tuwa-border-primary)] tuwadocs:bg-[var(--tuwa-bg-primary)] tuwadocs:px-4 tuwadocs:text-sm tuwadocs:font-bold tuwadocs:text-[var(--tuwa-text-primary)] tuwadocs:transition-colors tuwadocs:hover:bg-[var(--tuwa-bg-muted)]",
121
121
  classNames?.download
122
122
  ),
@@ -130,13 +130,13 @@ function PolicyDocument({
130
130
  ]
131
131
  }
132
132
  ),
133
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("article", { className: (0, import_nova_core.cn)("tuwadocs-policy", classNames?.body), children: (0, import_html_react_parser.default)(content.html, { replace: sanitize }) })
133
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("article", { className: (0, import_utils.cn)("tuwadocs-policy", classNames?.body), children: (0, import_html_react_parser.default)(content.html, { replace: sanitize }) })
134
134
  ] }),
135
135
  content.sections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
136
136
  "nav",
137
137
  {
138
138
  "aria-label": tocLabel,
139
- className: (0, import_nova_core.cn)(
139
+ className: (0, import_utils.cn)(
140
140
  "tuwadocs:hidden tuwadocs:lg:sticky tuwadocs:lg:top-24 tuwadocs:lg:block tuwadocs:lg:self-start",
141
141
  classNames?.toc
142
142
  ),
@@ -1,6 +1,6 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { ArrowDownTrayIcon } from "@heroicons/react/24/outline";
3
- import { cn } from "@tuwaio/nova-core";
3
+ import { cn } from "@tuwaio/nova-core/utils";
4
4
  import parse, { Element } from "html-react-parser";
5
5
  import { getPolicyFileUrl, POLICY_SOURCE } from "../policies";
6
6
  const BLOCKED_ELEMENTS = /* @__PURE__ */ new Set([
@@ -24,7 +24,7 @@ __export(ThemeSwitcher_exports, {
24
24
  module.exports = __toCommonJS(ThemeSwitcher_exports);
25
25
  var import_jsx_runtime = require("react/jsx-runtime");
26
26
  var import_solid = require("@heroicons/react/24/solid");
27
- var import_nova_core = require("@tuwaio/nova-core");
27
+ var import_utils = require("@tuwaio/nova-core/utils");
28
28
  var import_react = require("react");
29
29
  function ThemeSwitcher({ theme, onToggle }) {
30
30
  const [mounted, setMounted] = (0, import_react.useState)(false);
@@ -36,7 +36,7 @@ function ThemeSwitcher({ theme, onToggle }) {
36
36
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
37
37
  "div",
38
38
  {
39
- className: (0, import_nova_core.cn)(
39
+ className: (0, import_utils.cn)(
40
40
  "tuwadocs:relative tuwadocs:flex tuwadocs:h-10 tuwadocs:w-20 tuwadocs:md:h-8 tuwadocs:md:w-16 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:border tuwadocs:opacity-0",
41
41
  defaultStyles
42
42
  )
@@ -48,7 +48,7 @@ function ThemeSwitcher({ theme, onToggle }) {
48
48
  "button",
49
49
  {
50
50
  onClick: onToggle,
51
- className: (0, import_nova_core.cn)(
51
+ className: (0, import_utils.cn)(
52
52
  "tuwadocs:group tuwadocs:relative tuwadocs:flex tuwadocs:h-10 tuwadocs:w-20 tuwadocs:md:h-8 tuwadocs:md:w-16 tuwadocs:cursor-pointer tuwadocs:items-center tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:p-1 tuwadocs:transition-all tuwadocs:duration-300 tuwadocs:ease-in-out tuwadocs:backdrop-blur-sm tuwadocs:border",
53
53
  defaultStyles
54
54
  ),
@@ -57,7 +57,7 @@ function ThemeSwitcher({ theme, onToggle }) {
57
57
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
58
58
  "div",
59
59
  {
60
- className: (0, import_nova_core.cn)(
60
+ className: (0, import_utils.cn)(
61
61
  "tuwadocs:absolute tuwadocs:top-[1px] tuwadocs:left-[2px] tuwadocs:z-10 tuwadocs:h-9 tuwadocs:w-9 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:bg-[var(--tuwa-bg-primary)] tuwadocs:shadow-md tuwadocs:md:hidden",
62
62
  isDark ? "tuwa-slide-dark" : "tuwa-slide-light"
63
63
  )
@@ -66,7 +66,7 @@ function ThemeSwitcher({ theme, onToggle }) {
66
66
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
67
  "div",
68
68
  {
69
- className: (0, import_nova_core.cn)(
69
+ className: (0, import_utils.cn)(
70
70
  "tuwadocs:absolute tuwadocs:top-[1px] tuwadocs:left-[2px] tuwadocs:z-10 tuwadocs:h-9 tuwadocs:w-9 tuwadocs:md:h-7 tuwadocs:md:w-7 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:bg-[var(--tuwa-bg-primary)] tuwadocs:shadow-md tuwadocs:hidden tuwadocs:md:block",
71
71
  isDark ? "tuwa-slide-dark" : "tuwa-slide-light"
72
72
  )
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { MoonIcon, SunIcon } from "@heroicons/react/24/solid";
4
- import { cn } from "@tuwaio/nova-core";
4
+ import { cn } from "@tuwaio/nova-core/utils";
5
5
  import { useEffect, useState } from "react";
6
6
  function ThemeSwitcher({ theme, onToggle }) {
7
7
  const [mounted, setMounted] = useState(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuwaio/docs-ui",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "private": false,
5
5
  "author": "Oleksandr Tkach",
6
6
  "license": "Apache-2.0",
@@ -15,6 +15,11 @@
15
15
  "require": "./dist/index.cjs",
16
16
  "types": "./dist/index.d.ts"
17
17
  },
18
+ "./policies": {
19
+ "types": "./dist/policies.d.ts",
20
+ "import": "./dist/policies.js",
21
+ "require": "./dist/policies.cjs"
22
+ },
18
23
  "./dist/index.css": "./dist/index.css",
19
24
  "./dist/*": "./dist/*"
20
25
  },
@@ -25,6 +30,9 @@
25
30
  "dist",
26
31
  "socket.json"
27
32
  ],
33
+ "sideEffects": [
34
+ "*.css"
35
+ ],
28
36
  "keywords": [
29
37
  "react",
30
38
  "tailwindcss",
@@ -49,7 +57,7 @@
49
57
  }
50
58
  ],
51
59
  "dependencies": {
52
- "@tuwaio/nova-core": "^0.9.0",
60
+ "@tuwaio/nova-core": "^0.9.3",
53
61
  "clsx": "^2.1.1",
54
62
  "html-react-parser": "^6.1.8",
55
63
  "tailwind-merge": "^3.7.0"