@yuhuanowo/yunui 0.2.14 → 0.2.16

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/package.json CHANGED
@@ -1,7 +1,20 @@
1
1
  {
2
2
  "name": "@yuhuanowo/yunui",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "A versioned React 19 + Tailwind v4 design system — tokens, primitives, patterns, and AI components, in one package.",
5
+ "keywords": [
6
+ "react",
7
+ "react19",
8
+ "tailwindcss",
9
+ "tailwind-css",
10
+ "design-system",
11
+ "component-library",
12
+ "ui-components",
13
+ "ui-kit",
14
+ "design-tokens",
15
+ "oklch",
16
+ "typescript"
17
+ ],
5
18
  "type": "module",
6
19
  "license": "Apache-2.0",
7
20
  "author": "yuhuanowo",
@@ -40,8 +53,18 @@
40
53
  "types": "./dist/ai.d.ts",
41
54
  "import": "./dist/ai.js"
42
55
  },
56
+ "./content": {
57
+ "types": "./dist/content.d.ts",
58
+ "import": "./dist/content.js"
59
+ },
60
+ "./chat": {
61
+ "types": "./dist/chat.d.ts",
62
+ "import": "./dist/chat.js"
63
+ },
43
64
  "./css": "./styles/yunui.css",
44
- "./styles/yunui.css": "./styles/yunui.css"
65
+ "./styles/yunui.css": "./styles/yunui.css",
66
+ "./content.css": "./styles/content.css",
67
+ "./styles/content.css": "./styles/content.css"
45
68
  },
46
69
  "scripts": {
47
70
  "build": "node scripts/gen-tokens.mjs && tsup",
@@ -55,10 +78,48 @@
55
78
  "icons:sync": "node scripts/sync-icons.mjs --apply"
56
79
  },
57
80
  "peerDependencies": {
81
+ "katex": ">=0.16",
82
+ "mermaid": ">=11",
58
83
  "react": ">=19",
59
84
  "react-dom": ">=19",
85
+ "react-markdown": ">=9",
86
+ "rehype-katex": ">=7",
87
+ "rehype-raw": ">=7",
88
+ "rehype-slug": ">=6",
89
+ "remark-gfm": ">=4",
90
+ "remark-math": ">=6",
91
+ "shiki": ">=1",
60
92
  "tailwindcss": ">=4"
61
93
  },
94
+ "peerDependenciesMeta": {
95
+ "react-markdown": {
96
+ "optional": true
97
+ },
98
+ "remark-gfm": {
99
+ "optional": true
100
+ },
101
+ "remark-math": {
102
+ "optional": true
103
+ },
104
+ "rehype-raw": {
105
+ "optional": true
106
+ },
107
+ "rehype-katex": {
108
+ "optional": true
109
+ },
110
+ "rehype-slug": {
111
+ "optional": true
112
+ },
113
+ "katex": {
114
+ "optional": true
115
+ },
116
+ "shiki": {
117
+ "optional": true
118
+ },
119
+ "mermaid": {
120
+ "optional": true
121
+ }
122
+ },
62
123
  "dependencies": {
63
124
  "@radix-ui/react-accordion": "^1.2.14",
64
125
  "@radix-ui/react-avatar": "1.1.12",
@@ -69,6 +130,7 @@
69
130
  "@radix-ui/react-presence": "1.1.6",
70
131
  "@radix-ui/react-progress": "1.1.9",
71
132
  "@radix-ui/react-radio-group": "^1.4.1",
133
+ "@radix-ui/react-scroll-area": "^1.2.13",
72
134
  "@radix-ui/react-select": "2.3.0",
73
135
  "@radix-ui/react-slider": "1.4.0",
74
136
  "@radix-ui/react-switch": "1.3.0",
@@ -83,22 +145,32 @@
83
145
  "tailwind-merge": "3.6.0"
84
146
  },
85
147
  "devDependencies": {
148
+ "@lobehub/icons-static-avatar": "^1.11.0",
149
+ "@lobehub/icons-static-svg": "^1.91.0",
86
150
  "@testing-library/jest-dom": "^6.9.1",
87
151
  "@testing-library/react": "^16.3.2",
88
152
  "@testing-library/user-event": "^14.6.1",
153
+ "@types/katex": "^0.16.8",
89
154
  "@types/react": "^19",
90
155
  "@types/react-dom": "^19",
91
156
  "@vitejs/plugin-react": "^6.0.2",
92
157
  "concurrently": "^10.0.3",
93
158
  "jsdom": "^29.1.1",
159
+ "katex": "^0.16.47",
160
+ "mermaid": "^11.16.0",
94
161
  "publint": "^0.3.21",
95
162
  "react": "19.2.7",
96
163
  "react-dom": "19.2.7",
164
+ "react-markdown": "^10.1.0",
165
+ "rehype-katex": "^7.0.1",
166
+ "rehype-raw": "^7.0.0",
167
+ "rehype-slug": "^6.0.0",
168
+ "remark-gfm": "^4.0.1",
169
+ "remark-math": "^6.0.0",
170
+ "shiki": "^1.29.2",
97
171
  "tailwindcss": "^4.3.1",
98
172
  "tsup": "^8.5.0",
99
173
  "typescript": "^6.0.3",
100
- "vitest": "^4.1.9",
101
- "@lobehub/icons-static-svg": "^1.91.0",
102
- "@lobehub/icons-static-avatar": "^1.11.0"
174
+ "vitest": "^4.1.9"
103
175
  }
104
176
  }
@@ -0,0 +1,129 @@
1
+ /* =====================================================
2
+ * YunUI — content stack styles (@yuhuanowo/yunui/content)
3
+ * Import once in the host app alongside `katex/dist/katex.min.css`:
4
+ * import "@yuhuanowo/yunui/content.css";
5
+ * import "katex/dist/katex.min.css";
6
+ * Structural styles for Shiki code blocks, line numbers, KaTeX and Mermaid.
7
+ * Token-independent so it renders the same in any host.
8
+ * ===================================================== */
9
+
10
+ /* Highlighted lines in code blocks — tinted with the host's YunUI accent (falls
11
+ * back to indigo where no token is defined). The full-bleed left bar sits in the
12
+ * container's left padding; `code` is sized to its widest line (below) so this
13
+ * background spans the whole line even when the block scrolls horizontally. */
14
+ .highlighted-line {
15
+ background-color: color-mix(in oklab, var(--accent, #6366f1) 12%, transparent);
16
+ border-left: 3px solid var(--accent, #6366f1);
17
+ margin-left: -16px;
18
+ padding-left: 13px;
19
+ display: block;
20
+ }
21
+
22
+ /* Line numbers */
23
+ .code-with-line-numbers code {
24
+ counter-reset: line;
25
+ }
26
+
27
+ .code-with-line-numbers code > span[data-line]::before {
28
+ counter-increment: line;
29
+ content: counter(line);
30
+ display: inline-block;
31
+ width: 2rem;
32
+ margin-right: 1rem;
33
+ text-align: right;
34
+ color: color-mix(in oklab, currentColor 45%, transparent);
35
+ font-size: 0.75rem;
36
+ }
37
+
38
+ /* Shiki wrapper — strip Shiki's own <pre> chrome so it inherits our container */
39
+ .shiki-wrapper pre {
40
+ margin: 0 !important;
41
+ padding: 0 !important;
42
+ background: transparent !important;
43
+ }
44
+
45
+ .shiki-wrapper code {
46
+ display: block;
47
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
48
+ font-size: 0.875rem;
49
+ line-height: 1.7;
50
+ /* Shiki separates its block-level `.line` spans with literal "\n" text nodes.
51
+ * Under `white-space: pre` those newlines render as an EXTRA empty line after
52
+ * every line (double-spacing). Collapse them here; each `.line` re-enables
53
+ * `pre` below so its own indentation is preserved. */
54
+ white-space: normal;
55
+ /* Size to the widest line (not the scroll container) so block-level `.line`
56
+ * highlights span the ENTIRE line under horizontal scroll instead of getting
57
+ * clipped at the visible edge; `min-width: 100%` keeps short code full-bleed. */
58
+ width: max-content;
59
+ min-width: 100%;
60
+ /* Neutralize any host/prose `code` chrome (border, radius, chip background)
61
+ * that would otherwise draw a nested box inside the code block. */
62
+ background: transparent !important;
63
+ border: 0 !important;
64
+ border-radius: 0 !important;
65
+ padding: 0 !important;
66
+ }
67
+
68
+ .shiki-wrapper .line {
69
+ display: block;
70
+ white-space: pre;
71
+ min-height: 1.5rem;
72
+ }
73
+
74
+ /* Diff decorations */
75
+ .shiki-wrapper .line.diff.add {
76
+ background-color: rgba(46, 160, 67, 0.15);
77
+ }
78
+
79
+ .shiki-wrapper .line.diff.remove {
80
+ background-color: rgba(248, 81, 73, 0.15);
81
+ }
82
+
83
+ .shiki-wrapper .line.diff.add::before {
84
+ content: "+";
85
+ color: rgb(46, 160, 67);
86
+ margin-right: 0.5rem;
87
+ }
88
+
89
+ .shiki-wrapper .line.diff.remove::before {
90
+ content: "-";
91
+ color: rgb(248, 81, 73);
92
+ margin-right: 0.5rem;
93
+ }
94
+
95
+ /* KaTeX */
96
+ .katex-display {
97
+ margin: 1rem 0 !important;
98
+ overflow-x: auto;
99
+ overflow-y: hidden;
100
+ }
101
+
102
+ .katex {
103
+ font-size: 1.1em;
104
+ }
105
+
106
+ /* Mermaid */
107
+ .mermaid-container {
108
+ display: flex;
109
+ justify-content: center;
110
+ padding: 1rem;
111
+ }
112
+
113
+ .mermaid-container svg {
114
+ max-width: 100%;
115
+ height: auto;
116
+ }
117
+
118
+ /* Footnotes (GFM) — not covered by inline element styles */
119
+ .footnotes {
120
+ margin-top: 2rem;
121
+ padding-top: 1rem;
122
+ border-top: 1px solid color-mix(in oklab, currentColor 15%, transparent);
123
+ font-size: 0.875rem;
124
+ }
125
+
126
+ .footnote-ref {
127
+ font-size: 0.75em;
128
+ vertical-align: super;
129
+ }