@aura-react-comp/x 0.0.0-stage → 0.1.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 (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -2
  3. package/esm/actions/index.d.ts +28 -0
  4. package/esm/actions/index.js +37 -0
  5. package/esm/actions/index.less +59 -0
  6. package/esm/attachments/index.d.ts +41 -0
  7. package/esm/attachments/index.js +48 -0
  8. package/esm/attachments/index.less +22 -0
  9. package/esm/bubble/index.d.ts +42 -0
  10. package/esm/bubble/index.js +80 -0
  11. package/esm/bubble/index.less +164 -0
  12. package/esm/code-highlighter/index.d.ts +39 -0
  13. package/esm/code-highlighter/index.js +165 -0
  14. package/esm/code-highlighter/index.less +76 -0
  15. package/esm/code-highlighter/prism-theme.d.ts +13 -0
  16. package/esm/code-highlighter/prism-theme.js +75 -0
  17. package/esm/conversations/index.d.ts +35 -0
  18. package/esm/conversations/index.js +89 -0
  19. package/esm/conversations/index.less +138 -0
  20. package/esm/file-card/index.d.ts +40 -0
  21. package/esm/file-card/index.js +126 -0
  22. package/esm/file-card/index.less +161 -0
  23. package/esm/folder/index.d.ts +66 -0
  24. package/esm/folder/index.js +345 -0
  25. package/esm/folder/index.less +158 -0
  26. package/esm/folder/tree-utils.d.ts +30 -0
  27. package/esm/folder/tree-utils.js +147 -0
  28. package/esm/folder/types.d.ts +51 -0
  29. package/esm/folder/types.js +1 -0
  30. package/esm/index.d.ts +40 -0
  31. package/esm/index.js +20 -0
  32. package/esm/markdown-content/index.d.ts +34 -0
  33. package/esm/markdown-content/index.js +117 -0
  34. package/esm/markdown-content/index.less +124 -0
  35. package/esm/mermaid/index.d.ts +47 -0
  36. package/esm/mermaid/index.js +235 -0
  37. package/esm/mermaid/index.less +155 -0
  38. package/esm/notification/index.d.ts +59 -0
  39. package/esm/notification/index.js +148 -0
  40. package/esm/prompts/index.d.ts +27 -0
  41. package/esm/prompts/index.js +50 -0
  42. package/esm/prompts/index.less +95 -0
  43. package/esm/sender/index.d.ts +48 -0
  44. package/esm/sender/index.js +88 -0
  45. package/esm/sender/index.less +75 -0
  46. package/esm/sources/index.d.ts +40 -0
  47. package/esm/sources/index.js +154 -0
  48. package/esm/sources/index.less +219 -0
  49. package/esm/style.css +1565 -0
  50. package/esm/suggestion/index.d.ts +21 -0
  51. package/esm/suggestion/index.js +36 -0
  52. package/esm/suggestion/index.less +44 -0
  53. package/esm/think/index.d.ts +20 -0
  54. package/esm/think/index.js +48 -0
  55. package/esm/think/index.less +92 -0
  56. package/esm/thought-chain/index.d.ts +34 -0
  57. package/esm/thought-chain/index.js +105 -0
  58. package/esm/thought-chain/index.less +174 -0
  59. package/esm/use-x-chat/index.d.ts +85 -0
  60. package/esm/use-x-chat/index.js +178 -0
  61. package/esm/use-x-stream/index.d.ts +43 -0
  62. package/esm/use-x-stream/index.js +112 -0
  63. package/esm/use-x-stream/parse-sse.d.ts +19 -0
  64. package/esm/use-x-stream/parse-sse.js +91 -0
  65. package/esm/utils/color.d.ts +9 -0
  66. package/esm/utils/color.js +45 -0
  67. package/esm/welcome/index.d.ts +22 -0
  68. package/esm/welcome/index.js +36 -0
  69. package/esm/welcome/index.less +57 -0
  70. package/esm/x-provider/index.d.ts +48 -0
  71. package/esm/x-provider/index.js +66 -0
  72. package/package.json +69 -3
@@ -0,0 +1,66 @@
1
+ import React, { useMemo } from 'react';
2
+ import { ConfigProvider, theme as antdTheme } from 'antd';
3
+ import zhCN from 'antd/locale/zh_CN';
4
+ import { antdTokenOverrides } from '@aura-react-comp/shared';
5
+ import { deriveAccentVars } from "../utils/color";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * 组装 XProvider 的 antd 主题配置。
9
+ *
10
+ * 令牌覆盖集来自 @aura-react-comp/shared 的单一数据源(与 BusinessProvider 共用);
11
+ * 这里只负责 algorithm 的组装:暗色 / 默认 + 可选紧凑。
12
+ * 导出以便单测直接断言配置内容。
13
+ */
14
+ export function buildXThemeConfig({
15
+ dark = false,
16
+ compact = false,
17
+ colorPrimary
18
+ }) {
19
+ const algorithms = [dark ? antdTheme.darkAlgorithm : antdTheme.defaultAlgorithm];
20
+ if (compact) algorithms.push(antdTheme.compactAlgorithm);
21
+ return {
22
+ algorithm: algorithms,
23
+ token: antdTokenOverrides(colorPrimary)
24
+ };
25
+ }
26
+
27
+ /**
28
+ * XProvider — AI 组件主题桥接
29
+ *
30
+ * 将 Aura 设计令牌映射到 antd 的主题系统,为 AI 对话组件(Bubble / Sender 等)
31
+ * 提供与 @aura-react-comp/ui、@aura-react-comp/business 一致的紫罗兰视觉语言。
32
+ *
33
+ * antd v6 默认使用 CSS Variables,因此可与 Aura 的 CSS 变量主题体系共存。
34
+ *
35
+ * 主题派生:`colorPrimary` 会实时派生整套 `--aura-x-*` 品牌变量(渐变 / 光晕 /
36
+ * 软底 / 边框),注入到子树作用域——Bubble / Sender / MarkdownContent 等
37
+ * 组件消费这些变量,因此**换主色即时全量生效**;`dark` 同时在子树启用
38
+ * `data-theme="dark"` 暗色令牌。
39
+ */
40
+ export const XProvider = ({
41
+ children,
42
+ dark = false,
43
+ compact = false,
44
+ colorPrimary,
45
+ locale = zhCN
46
+ }) => {
47
+ const themeConfig = useMemo(() => buildXThemeConfig({
48
+ dark,
49
+ compact,
50
+ colorPrimary
51
+ }), [dark, compact, colorPrimary]);
52
+
53
+ // 由主色派生品牌相关变量(accent / 渐变 / 光晕 / 软底 / 边框),
54
+ // 注入到子树作用域——组件消费同名变量,换主色即时全量生效
55
+ const accentVars = useMemo(() => colorPrimary ? deriveAccentVars(colorPrimary) : undefined, [colorPrimary]);
56
+ return /*#__PURE__*/_jsx(ConfigProvider, {
57
+ theme: themeConfig,
58
+ locale: locale,
59
+ children: /*#__PURE__*/_jsx("div", {
60
+ style: accentVars,
61
+ "data-theme": dark ? 'dark' : undefined,
62
+ children: children
63
+ })
64
+ });
65
+ };
66
+ XProvider.displayName = 'XProvider';
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "@aura-react-comp/x",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Aura AI 组件库 — 对话式 AI 界面的原子组件与数据流 Hooks(对标 Ant Design X 的 Aura 实现)",
5
+ "keywords": [
6
+ "aura",
7
+ "react",
8
+ "ai",
9
+ "chat",
10
+ "llm",
11
+ "antd"
12
+ ],
13
+ "homepage": "https://asbeforelandy.github.io/aura/",
14
+ "bugs": {
15
+ "url": "https://github.com/AsBeforeLandy/aura/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/AsBeforeLandy/aura.git",
20
+ "directory": "packages/x"
21
+ },
22
+ "author": "Aura Team",
23
+ "license": "MIT",
24
+ "type": "module",
25
+ "main": "esm/index.js",
26
+ "module": "esm/index.js",
27
+ "types": "esm/index.d.ts",
28
+ "files": [
29
+ "esm"
30
+ ],
31
+ "sideEffects": [
32
+ "**/*.less",
33
+ "**/*.css"
34
+ ],
35
+ "exports": {
36
+ ".": {
37
+ "types": "./esm/index.d.ts",
38
+ "import": "./esm/index.js",
39
+ "default": "./esm/index.js"
40
+ },
41
+ "./style.css": "./esm/style.css",
42
+ "./package.json": "./package.json"
43
+ },
44
+ "peerDependencies": {
45
+ "antd": ">=6.0.0",
46
+ "mermaid": ">=10.0.0",
47
+ "react": ">=18.0.0",
48
+ "react-dom": ">=18.0.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "mermaid": {
52
+ "optional": true
53
+ }
54
+ },
55
+ "dependencies": {
56
+ "prism-react-renderer": "^2.4.1",
57
+ "react-markdown": "^10.1.0",
58
+ "@aura-react-comp/shared": "0.1.0"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public",
62
+ "registry": "https://registry.npmjs.org/"
63
+ },
64
+ "devDependencies": {
65
+ "less": "^4.9.1",
66
+ "mermaid": "^12.0.0"
67
+ },
68
+ "scripts": {
69
+ "build": "father build && node scripts/build-styles.mjs",
70
+ "dev": "father dev"
71
+ }
6
72
  }