@q1travel/design-system 0.30.9 → 0.30.11
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 +14 -4
- package/bin/q1-design.mjs +11 -0
- package/contracts/app-base.css +38 -0
- package/dist-pkg/design-system.d.ts +3 -1
- package/dist-pkg/design-system.js +2386 -2382
- package/dist-pkg/style.css +29 -14
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -69,8 +69,8 @@ root.render(
|
|
|
69
69
|
|
|
70
70
|
| 命令 | 说明 |
|
|
71
71
|
| --- | --- |
|
|
72
|
-
| `npx q1-design ls` |
|
|
73
|
-
| `npx q1-design doc <组件名>` | 打印组件的公共 API |
|
|
72
|
+
| `npx q1-design ls` | 列出包内提供的组件、hook 与应用模板 |
|
|
73
|
+
| `npx q1-design doc <组件名>` | 打印组件的公共 API;`doc app-base` 查看应用基础样式模板 |
|
|
74
74
|
| `npx q1-design lint [路径...]` | 按 `Q1-DS-*` 规则检查样式用法,默认扫描 `src` |
|
|
75
75
|
| `npx q1-design lint --diff <base-ref>` | 只检查相对 `base-ref` 有改动的文件 |
|
|
76
76
|
| `npx q1-design overrides [路径...]` | 统计对组件外观的 `className` 覆写 |
|
|
@@ -79,7 +79,17 @@ root.render(
|
|
|
79
79
|
|
|
80
80
|
## 设计契约与 AI 编码指南
|
|
81
81
|
|
|
82
|
-
包内随附设计契约(`contracts/*.md`)与 product-design 编码指南(`.agents/`),可供 AI 编码助手读取,使生成的界面遵循同一套 token 与组件规范。契约文件通过 `@q1travel/design-system/contracts/*` 路径导出,也可以用 `npx q1-design sync` 同步到项目中。
|
|
82
|
+
包内随附设计契约(`contracts/*.md`、`contracts/app-base.css`)与 product-design 编码指南(`.agents/`),可供 AI 编码助手读取,使生成的界面遵循同一套 token 与组件规范。契约文件通过 `@q1travel/design-system/contracts/*` 路径导出,也可以用 `npx q1-design sync` 同步到项目中。
|
|
83
|
+
|
|
84
|
+
基础层归应用所有。运行 `npx q1-design sync` 后,模板位于
|
|
85
|
+
`.claude/skills/product-design/contracts/app-base.css`(只读缓存,纳入 `verify` 哈希校验)。首次接入时复制为应用自己的文件:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
mkdir -p src/styles
|
|
89
|
+
cp .claude/skills/product-design/contracts/app-base.css src/styles/app-base.css
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
在应用入口先引入 `@q1travel/design-system/tokens.css`(已引入 `style.css` 时无需重复),再引入 `./styles/app-base.css`。应用可修改该副本或在之后加载覆盖样式;升级并重新 `sync` 后自行审阅模板差异再采纳,CLI 不覆盖应用副本。模板只包含盒模型、页面边距与最小高度、画布文字字体与字体平滑、点按高亮、原生表单字体继承;根容器、读屏工具与组件运动/触控行为由各自所属层管理。
|
|
83
93
|
|
|
84
94
|
## 版本
|
|
85
95
|
|
|
@@ -102,7 +112,7 @@ npm run dev
|
|
|
102
112
|
|
|
103
113
|
### Sources
|
|
104
114
|
|
|
105
|
-
- Source contracts(设计契约源,canonical):`contracts/design.md`、`contracts/design.dark.md`、`contracts/token-naming.md`、`contracts/icon-system.md`、`contracts/button-api-compatibility.md`、`contracts/interface-guidelines.md`、`contracts/design-engineering-principles.md`、`contracts/implementation-map.md`、`contracts/overlay-foundation.md`,以及迁移契约 `contracts/context-contrast-migration.md`、`contracts/status-chip-badge-migration.md`、`contracts/pagination-migration.md`、`contracts/table-migration.md`、`contracts/overlay-shadow-migration.md
|
|
115
|
+
- Source contracts(设计契约源,canonical):`contracts/design.md`、`contracts/design.dark.md`、`contracts/token-naming.md`、`contracts/icon-system.md`、`contracts/button-api-compatibility.md`、`contracts/interface-guidelines.md`、`contracts/design-engineering-principles.md`、`contracts/implementation-map.md`、`contracts/overlay-foundation.md`,以及迁移契约 `contracts/context-contrast-migration.md`、`contracts/status-chip-badge-migration.md`、`contracts/pagination-migration.md`、`contracts/table-migration.md`、`contracts/overlay-shadow-migration.md`。应用自有基础样式模板源为 `contracts/app-base.css`(非运行时样式导出)。独立 HTML 文档的有界 class 词汇表源为 `contracts/design.css`。
|
|
106
116
|
- Generated mirrors(生成镜像,勿手改):`public/design.md`、`public/design.dark.md` 由 `scripts/sync-design-contracts.mjs` 从契约源逐字节复制;`public/design.css` 由 `scripts/build-design-css.mjs` 把两份契约 frontmatter 的取值注入 `contracts/design.css` 的类词汇后生成,因而自足、可被独立 HTML 页面直接加载。
|
|
107
117
|
- Runtime tokens:`src/styles/tokens.css`(canonical `--q1-*`,仅 `:root` 与 `:root[data-theme='dark']` 两个扁平 selector)。
|
|
108
118
|
- 发布记录:`contracts/releases/`(仅存于仓库,不进 npm 包)。
|
package/bin/q1-design.mjs
CHANGED
|
@@ -854,10 +854,21 @@ function runList(consumerRootDir) {
|
|
|
854
854
|
console.log(`\n工具与 hook (${hooks.length})`);
|
|
855
855
|
console.log(` ${hooks.join(' ')}`);
|
|
856
856
|
}
|
|
857
|
+
console.log('\n应用模板:app-base(q1-design doc app-base)');
|
|
857
858
|
console.log(`\n查看某个组件的 API:q1-design doc <名称>`);
|
|
858
859
|
}
|
|
859
860
|
|
|
860
861
|
function runDoc(consumerRootDir, requestedName) {
|
|
862
|
+
if (requestedName === 'app-base') {
|
|
863
|
+
const packageRootDir = resolveInstalledPackageRoot(consumerRootDir) ?? resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
864
|
+
const templatePath = join(packageRootDir, 'contracts/app-base.css');
|
|
865
|
+
if (!existsSync(templatePath)) {
|
|
866
|
+
console.error('当前安装的设计系统版本不含应用基础样式模板,请升级后重试');
|
|
867
|
+
process.exit(1);
|
|
868
|
+
}
|
|
869
|
+
console.log(readFileSync(templatePath, 'utf8'));
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
861
872
|
if (!requestedName) {
|
|
862
873
|
console.error('Usage: q1-design doc <组件名>');
|
|
863
874
|
process.exit(1);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* q1-design sync 生成此模板缓存;复制到应用样式目录后归应用所有。
|
|
3
|
+
* 应用可按需修改或在其后覆盖;不要修改只读契约缓存。
|
|
4
|
+
* 先加载 @q1travel/design-system/tokens.css,再加载应用基础样式。
|
|
5
|
+
* 更新包并重新 sync 只更新模板,应用自行审阅并采纳差异。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
*,
|
|
9
|
+
*::before,
|
|
10
|
+
*::after {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
html,
|
|
15
|
+
body {
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
body {
|
|
20
|
+
min-height: 100%;
|
|
21
|
+
background: var(--q1-color-bg-canvas);
|
|
22
|
+
color: var(--q1-color-text-primary);
|
|
23
|
+
font-family: var(--q1-font-sans);
|
|
24
|
+
-webkit-font-smoothing: antialiased;
|
|
25
|
+
-moz-osx-font-smoothing: grayscale;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
html {
|
|
29
|
+
height: 100%;
|
|
30
|
+
-webkit-tap-highlight-color: transparent;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
button,
|
|
34
|
+
input,
|
|
35
|
+
textarea,
|
|
36
|
+
select {
|
|
37
|
+
font: inherit;
|
|
38
|
+
}
|
|
@@ -2337,10 +2337,12 @@ export declare function Separator({ orientation, decorative, className, }: {
|
|
|
2337
2337
|
|
|
2338
2338
|
export declare type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
2339
2339
|
|
|
2340
|
-
export declare function Sheet({ open, onClose, title, side, size, dismissable, mobileFullscreen, children, footer }: {
|
|
2340
|
+
export declare function Sheet({ open, onClose, title, description, side, size, dismissable, mobileFullscreen, children, footer }: {
|
|
2341
2341
|
open: boolean;
|
|
2342
2342
|
onClose: () => void;
|
|
2343
2343
|
title: string;
|
|
2344
|
+
/** 标题下方的导语;通过 aria-describedby 关联,不传则不渲染。 */
|
|
2345
|
+
description?: ReactNode;
|
|
2344
2346
|
side?: SheetSide;
|
|
2345
2347
|
size?: SheetSize;
|
|
2346
2348
|
dismissable?: boolean;
|