@dsh-plugin/dsh-ui-components 0.0.1 → 0.1.0-dev.43616582648
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/LICENSE +21 -21
- package/NOTICE +21 -21
- package/README.md +136 -136
- package/README.zh_CN.md +136 -136
- package/docs/tokens.md +67 -67
- package/lib/basic/form.js +49 -49
- package/lib/basic/styles.js +391 -391
- package/lib/composites/styles.js +427 -427
- package/lib/data/styles.js +257 -257
- package/lib/display/styles.js +310 -310
- package/lib/feedback/styles.js +228 -228
- package/lib/foundation/bridge.js +203 -203
- package/lib/navigation/styles.js +417 -417
- package/package.json +104 -104
- package/scripts/check-size.mjs +69 -69
- package/scripts/dump-npm-latest.mjs +59 -59
- package/scripts/gen-host-tokens.mjs +61 -61
- package/scripts/gen-icons.mjs +188 -178
- package/scripts/verify-no-literal-colors.mjs +63 -63
- package/scripts/verify-tokens.mjs +135 -135
- package/src/basic/button.tsx +76 -76
- package/src/basic/form.tsx +187 -187
- package/src/basic/icon-button.tsx +66 -66
- package/src/basic/index.ts +38 -38
- package/src/basic/input.tsx +140 -140
- package/src/basic/select.tsx +120 -120
- package/src/basic/styles.ts +412 -412
- package/src/basic/toggle.tsx +116 -116
- package/src/composites/data-view.tsx +189 -189
- package/src/composites/index.ts +11 -11
- package/src/composites/indicator.tsx +90 -90
- package/src/composites/menu-select.tsx +230 -230
- package/src/composites/panel.tsx +72 -72
- package/src/composites/settings.tsx +80 -80
- package/src/composites/styles.ts +450 -450
- package/src/data/collection.tsx +71 -71
- package/src/data/index.ts +39 -39
- package/src/data/info.tsx +89 -89
- package/src/data/picker.tsx +113 -113
- package/src/data/styles.ts +278 -278
- package/src/display/container.tsx +67 -67
- package/src/display/feedback.tsx +92 -92
- package/src/display/index.ts +44 -44
- package/src/display/label.tsx +165 -165
- package/src/display/overlay.tsx +103 -103
- package/src/display/styles.ts +332 -332
- package/src/feedback/global.tsx +110 -110
- package/src/feedback/index.ts +19 -19
- package/src/feedback/inline.tsx +50 -50
- package/src/feedback/panel.tsx +93 -93
- package/src/feedback/styles.ts +250 -250
- package/src/foundation/bridge.ts +318 -318
- package/src/foundation/icons.tsx +315 -315
- package/src/foundation/index.ts +33 -33
- package/src/foundation/palette.ts +153 -153
- package/src/foundation/provider.tsx +62 -62
- package/src/foundation/style.ts +63 -63
- package/src/foundation/tokens.ts +62 -62
- package/src/index.ts +18 -18
- package/src/navigation/hierarchy.tsx +82 -82
- package/src/navigation/index.ts +21 -21
- package/src/navigation/indicator.tsx +125 -125
- package/src/navigation/menu.tsx +94 -94
- package/src/navigation/segmented.tsx +136 -136
- package/src/navigation/styles.ts +438 -438
package/package.json
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@dsh-plugin/dsh-ui-components",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "React component library that restyles Arco Design with dsh (DeepSeek Harness) design tokens, and exposes the full IconPark icon set by name.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./lib/index.d.ts",
|
|
11
|
-
"default": "./lib/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./icons/*": {
|
|
14
|
-
"types": "./lib/icons/*.d.ts",
|
|
15
|
-
"default": "./lib/icons/*.js"
|
|
16
|
-
},
|
|
17
|
-
"./icons-index": {
|
|
18
|
-
"types": "./lib/icons-index.d.ts",
|
|
19
|
-
"default": "./lib/icons-index.js"
|
|
20
|
-
},
|
|
21
|
-
"./package.json": "./package.json"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"lib",
|
|
25
|
-
"src",
|
|
26
|
-
"!src/icons",
|
|
27
|
-
"scripts",
|
|
28
|
-
"docs/tokens.md",
|
|
29
|
-
"README.md",
|
|
30
|
-
"README.zh_CN.md",
|
|
31
|
-
"LICENSE",
|
|
32
|
-
"NOTICE"
|
|
33
|
-
],
|
|
34
|
-
"scripts": {
|
|
35
|
-
"gen:icons": "node scripts/gen-icons.mjs",
|
|
36
|
-
"gen:tokens": "node scripts/gen-host-tokens.mjs",
|
|
37
|
-
"build": "tsc -p tsconfig.build.json",
|
|
38
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
39
|
-
"test": "vitest run",
|
|
40
|
-
"preview": "vite --config docs/preview/vite.config.ts",
|
|
41
|
-
"preview:build": "vite build --config docs/preview/vite.config.ts",
|
|
42
|
-
"verify:tokens": "node scripts/verify-tokens.mjs",
|
|
43
|
-
"verify:icons": "node scripts/gen-icons.mjs --check",
|
|
44
|
-
"verify:colors": "node scripts/verify-no-literal-colors.mjs",
|
|
45
|
-
"verify:size": "node scripts/check-size.mjs",
|
|
46
|
-
"verify": "npm run verify:tokens && npm run verify:icons && npm run verify:colors && npm run verify:size",
|
|
47
|
-
"prepublishOnly": "npm run typecheck && npm run build && npm test && npm run verify"
|
|
48
|
-
},
|
|
49
|
-
"publishConfig": {
|
|
50
|
-
"access": "public"
|
|
51
|
-
},
|
|
52
|
-
"engines": {
|
|
53
|
-
"node": ">=24.9.0"
|
|
54
|
-
},
|
|
55
|
-
"repository": {
|
|
56
|
-
"type": "git",
|
|
57
|
-
"url": "git+https://github.com/dsh-plugins/dsh-ui-components.git"
|
|
58
|
-
},
|
|
59
|
-
"homepage": "https://github.com/dsh-plugins/dsh-ui-components",
|
|
60
|
-
"bugs": {
|
|
61
|
-
"url": "https://github.com/dsh-plugins/dsh-ui-components/issues"
|
|
62
|
-
},
|
|
63
|
-
"license": "MIT",
|
|
64
|
-
"keywords": [
|
|
65
|
-
"dsh",
|
|
66
|
-
"deepseek-harness",
|
|
67
|
-
"plugin",
|
|
68
|
-
"ui",
|
|
69
|
-
"components",
|
|
70
|
-
"arco-design",
|
|
71
|
-
"react"
|
|
72
|
-
],
|
|
73
|
-
"dependencies": {
|
|
74
|
-
"@icon-park/react": "^1.4.2"
|
|
75
|
-
},
|
|
76
|
-
"peerDependencies": {
|
|
77
|
-
"@dsh-plugin/dsh-loader": "^2.0.0-0",
|
|
78
|
-
"react": ">=18",
|
|
79
|
-
"react-dom": ">=18"
|
|
80
|
-
},
|
|
81
|
-
"peerDependenciesMeta": {
|
|
82
|
-
"react": {
|
|
83
|
-
"optional": false
|
|
84
|
-
},
|
|
85
|
-
"react-dom": {
|
|
86
|
-
"optional": false
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"devDependencies": {
|
|
90
|
-
"@arco-design/web-react": "^2.66.18",
|
|
91
|
-
"@dsh-plugin/dsh-loader": "^2.0.0-0",
|
|
92
|
-
"@testing-library/dom": "^10.4.0",
|
|
93
|
-
"@testing-library/react": "^16.1.0",
|
|
94
|
-
"@types/node": "^26.6.6",
|
|
95
|
-
"@types/react": "^18.3.31",
|
|
96
|
-
"@types/react-dom": "^18.3.7",
|
|
97
|
-
"jsdom": "^25.0.0",
|
|
98
|
-
"react": "^18.3.1",
|
|
99
|
-
"react-dom": "^18.3.1",
|
|
100
|
-
"typescript": "^7.0.2",
|
|
101
|
-
"vite": "^6.4.6",
|
|
102
|
-
"vitest": "^2.1.0"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-plugin/dsh-ui-components",
|
|
3
|
+
"version": "0.1.0-dev.43616582648",
|
|
4
|
+
"description": "React component library that restyles Arco Design with dsh (DeepSeek Harness) design tokens, and exposes the full IconPark icon set by name.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./icons/*": {
|
|
14
|
+
"types": "./lib/icons/*.d.ts",
|
|
15
|
+
"default": "./lib/icons/*.js"
|
|
16
|
+
},
|
|
17
|
+
"./icons-index": {
|
|
18
|
+
"types": "./lib/icons-index.d.ts",
|
|
19
|
+
"default": "./lib/icons-index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib",
|
|
25
|
+
"src",
|
|
26
|
+
"!src/icons",
|
|
27
|
+
"scripts",
|
|
28
|
+
"docs/tokens.md",
|
|
29
|
+
"README.md",
|
|
30
|
+
"README.zh_CN.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"NOTICE"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"gen:icons": "node scripts/gen-icons.mjs",
|
|
36
|
+
"gen:tokens": "node scripts/gen-host-tokens.mjs",
|
|
37
|
+
"build": "tsc -p tsconfig.build.json",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"preview": "vite --config docs/preview/vite.config.ts",
|
|
41
|
+
"preview:build": "vite build --config docs/preview/vite.config.ts",
|
|
42
|
+
"verify:tokens": "node scripts/verify-tokens.mjs",
|
|
43
|
+
"verify:icons": "node scripts/gen-icons.mjs --check",
|
|
44
|
+
"verify:colors": "node scripts/verify-no-literal-colors.mjs",
|
|
45
|
+
"verify:size": "node scripts/check-size.mjs",
|
|
46
|
+
"verify": "npm run verify:tokens && npm run verify:icons && npm run verify:colors && npm run verify:size",
|
|
47
|
+
"prepublishOnly": "npm run typecheck && npm run build && npm test && npm run verify"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=24.9.0"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/dsh-plugins/dsh-ui-components.git"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/dsh-plugins/dsh-ui-components",
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/dsh-plugins/dsh-ui-components/issues"
|
|
62
|
+
},
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"keywords": [
|
|
65
|
+
"dsh",
|
|
66
|
+
"deepseek-harness",
|
|
67
|
+
"plugin",
|
|
68
|
+
"ui",
|
|
69
|
+
"components",
|
|
70
|
+
"arco-design",
|
|
71
|
+
"react"
|
|
72
|
+
],
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"@icon-park/react": "^1.4.2"
|
|
75
|
+
},
|
|
76
|
+
"peerDependencies": {
|
|
77
|
+
"@dsh-plugin/dsh-loader": "^2.0.0-0",
|
|
78
|
+
"react": ">=18",
|
|
79
|
+
"react-dom": ">=18"
|
|
80
|
+
},
|
|
81
|
+
"peerDependenciesMeta": {
|
|
82
|
+
"react": {
|
|
83
|
+
"optional": false
|
|
84
|
+
},
|
|
85
|
+
"react-dom": {
|
|
86
|
+
"optional": false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"devDependencies": {
|
|
90
|
+
"@arco-design/web-react": "^2.66.18",
|
|
91
|
+
"@dsh-plugin/dsh-loader": "^2.0.0-0",
|
|
92
|
+
"@testing-library/dom": "^10.4.0",
|
|
93
|
+
"@testing-library/react": "^16.1.0",
|
|
94
|
+
"@types/node": "^26.6.6",
|
|
95
|
+
"@types/react": "^18.3.31",
|
|
96
|
+
"@types/react-dom": "^18.3.7",
|
|
97
|
+
"jsdom": "^25.0.0",
|
|
98
|
+
"react": "^18.3.1",
|
|
99
|
+
"react-dom": "^18.3.1",
|
|
100
|
+
"typescript": "^7.0.2",
|
|
101
|
+
"vite": "^6.4.6",
|
|
102
|
+
"vitest": "^2.1.0"
|
|
103
|
+
}
|
|
104
|
+
}
|
package/scripts/check-size.mjs
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* 核对发布产物的体积与文件数。
|
|
4
|
-
*
|
|
5
|
-
* 本包逐文件产出 ESM 与声明,体积主要由图标通道决定:`lib/icons/` 每个文件
|
|
6
|
-
* 是一行转导出,整体应保持在几百 KB 量级。门禁在构建后用 `npm pack` 的
|
|
7
|
-
* 实际结果核对,超出阈值说明产物结构发生了变化。
|
|
8
|
-
*
|
|
9
|
-
* 用法:node scripts/check-size.mjs [--json]
|
|
10
|
-
*/
|
|
11
|
-
import { execFileSync } from 'node:child_process'
|
|
12
|
-
import { dirname, join } from 'node:path'
|
|
13
|
-
import { fileURLToPath } from 'node:url'
|
|
14
|
-
|
|
15
|
-
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
16
|
-
|
|
17
|
-
/** 各部分的体积上限,单位字节。 */
|
|
18
|
-
const LIMITS = {
|
|
19
|
-
/** 整个压缩包上限,覆盖图标、组件与声明。 */
|
|
20
|
-
tarball: 2_200_000,
|
|
21
|
-
/** 打包后的解压体积上限。 */
|
|
22
|
-
unpacked: 7_000_000,
|
|
23
|
-
}
|
|
24
|
-
/** 压缩包内文件数上限。图标通道本身占约 5300 个(`.js` 与 `.d.ts` 各一份)。 */
|
|
25
|
-
const MAX_FILES = 6_000
|
|
26
|
-
|
|
27
|
-
let report
|
|
28
|
-
try {
|
|
29
|
-
const output = execFileSync('npm', ['pack', '--dry-run', '--json'], {
|
|
30
|
-
cwd: root,
|
|
31
|
-
encoding: 'utf8',
|
|
32
|
-
shell: process.platform === 'win32',
|
|
33
|
-
})
|
|
34
|
-
// npm 在不同版本下可能返回数组、单个对象,或以包名为键的对象;BOM 也要先去掉。
|
|
35
|
-
const parsed = JSON.parse(output.replace(/^\uFEFF/, ''))
|
|
36
|
-
const candidate = Array.isArray(parsed) ? parsed[0] : parsed
|
|
37
|
-
report = candidate !== null && typeof candidate === 'object' && !('size' in candidate)
|
|
38
|
-
? Object.values(candidate)[0]
|
|
39
|
-
: candidate
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error('npm pack --dry-run 失败,请先执行 npm run build')
|
|
42
|
-
console.error(error instanceof Error ? error.message : String(error))
|
|
43
|
-
process.exit(2)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (report === undefined || report === null || typeof report !== 'object') {
|
|
47
|
-
console.error('无法从 npm pack --dry-run 的输出中定位本次打包结果')
|
|
48
|
-
process.exit(2)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const size = Number(report.size ?? 0)
|
|
52
|
-
const unpacked = Number(report.unpackedSize ?? 0)
|
|
53
|
-
const files = Number(report.entryCount ?? (Array.isArray(report.files) ? report.files.length : 0))
|
|
54
|
-
|
|
55
|
-
const problems = []
|
|
56
|
-
if (size > LIMITS.tarball) problems.push(`压缩包 ${size} 字节超过上限 ${LIMITS.tarball}`)
|
|
57
|
-
if (unpacked > LIMITS.unpacked) problems.push(`解压体积 ${unpacked} 字节超过上限 ${LIMITS.unpacked}`)
|
|
58
|
-
if (files > MAX_FILES) problems.push(`文件数 ${files} 超过上限 ${MAX_FILES}`)
|
|
59
|
-
|
|
60
|
-
if (process.argv.includes('--json')) {
|
|
61
|
-
console.log(JSON.stringify({ size, unpacked, files }, null, 2))
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (problems.length > 0) {
|
|
65
|
-
console.error(problems.join('\n'))
|
|
66
|
-
process.exit(1)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
console.log(`体积检查通过:压缩包 ${(size / 1024).toFixed(0)} KB,解压 ${(unpacked / 1024).toFixed(0)} KB,${files} 个文件`)
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 核对发布产物的体积与文件数。
|
|
4
|
+
*
|
|
5
|
+
* 本包逐文件产出 ESM 与声明,体积主要由图标通道决定:`lib/icons/` 每个文件
|
|
6
|
+
* 是一行转导出,整体应保持在几百 KB 量级。门禁在构建后用 `npm pack` 的
|
|
7
|
+
* 实际结果核对,超出阈值说明产物结构发生了变化。
|
|
8
|
+
*
|
|
9
|
+
* 用法:node scripts/check-size.mjs [--json]
|
|
10
|
+
*/
|
|
11
|
+
import { execFileSync } from 'node:child_process'
|
|
12
|
+
import { dirname, join } from 'node:path'
|
|
13
|
+
import { fileURLToPath } from 'node:url'
|
|
14
|
+
|
|
15
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
16
|
+
|
|
17
|
+
/** 各部分的体积上限,单位字节。 */
|
|
18
|
+
const LIMITS = {
|
|
19
|
+
/** 整个压缩包上限,覆盖图标、组件与声明。 */
|
|
20
|
+
tarball: 2_200_000,
|
|
21
|
+
/** 打包后的解压体积上限。 */
|
|
22
|
+
unpacked: 7_000_000,
|
|
23
|
+
}
|
|
24
|
+
/** 压缩包内文件数上限。图标通道本身占约 5300 个(`.js` 与 `.d.ts` 各一份)。 */
|
|
25
|
+
const MAX_FILES = 6_000
|
|
26
|
+
|
|
27
|
+
let report
|
|
28
|
+
try {
|
|
29
|
+
const output = execFileSync('npm', ['pack', '--dry-run', '--json'], {
|
|
30
|
+
cwd: root,
|
|
31
|
+
encoding: 'utf8',
|
|
32
|
+
shell: process.platform === 'win32',
|
|
33
|
+
})
|
|
34
|
+
// npm 在不同版本下可能返回数组、单个对象,或以包名为键的对象;BOM 也要先去掉。
|
|
35
|
+
const parsed = JSON.parse(output.replace(/^\uFEFF/, ''))
|
|
36
|
+
const candidate = Array.isArray(parsed) ? parsed[0] : parsed
|
|
37
|
+
report = candidate !== null && typeof candidate === 'object' && !('size' in candidate)
|
|
38
|
+
? Object.values(candidate)[0]
|
|
39
|
+
: candidate
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error('npm pack --dry-run 失败,请先执行 npm run build')
|
|
42
|
+
console.error(error instanceof Error ? error.message : String(error))
|
|
43
|
+
process.exit(2)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (report === undefined || report === null || typeof report !== 'object') {
|
|
47
|
+
console.error('无法从 npm pack --dry-run 的输出中定位本次打包结果')
|
|
48
|
+
process.exit(2)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const size = Number(report.size ?? 0)
|
|
52
|
+
const unpacked = Number(report.unpackedSize ?? 0)
|
|
53
|
+
const files = Number(report.entryCount ?? (Array.isArray(report.files) ? report.files.length : 0))
|
|
54
|
+
|
|
55
|
+
const problems = []
|
|
56
|
+
if (size > LIMITS.tarball) problems.push(`压缩包 ${size} 字节超过上限 ${LIMITS.tarball}`)
|
|
57
|
+
if (unpacked > LIMITS.unpacked) problems.push(`解压体积 ${unpacked} 字节超过上限 ${LIMITS.unpacked}`)
|
|
58
|
+
if (files > MAX_FILES) problems.push(`文件数 ${files} 超过上限 ${MAX_FILES}`)
|
|
59
|
+
|
|
60
|
+
if (process.argv.includes('--json')) {
|
|
61
|
+
console.log(JSON.stringify({ size, unpacked, files }, null, 2))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (problems.length > 0) {
|
|
65
|
+
console.error(problems.join('\n'))
|
|
66
|
+
process.exit(1)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
console.log(`体积检查通过:压缩包 ${(size / 1024).toFixed(0)} KB,解压 ${(unpacked / 1024).toFixed(0)} KB,${files} 个文件`)
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* 把 npm 上本包的 latest 版本信息回写到仓库根的 npm-latest.json。
|
|
4
|
-
*
|
|
5
|
-
* 由发布工作流在正式版发布后调用,内容幂等:同一 latest 版本重复运行没有
|
|
6
|
-
* 差异,因此不会产生空提交。
|
|
7
|
-
*/
|
|
8
|
-
import { readFileSync, writeFileSync } from 'node:fs'
|
|
9
|
-
import { dirname, join } from 'node:path'
|
|
10
|
-
import { fileURLToPath } from 'node:url'
|
|
11
|
-
|
|
12
|
-
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
13
|
-
const registry = process.env.NPM_REGISTRY ?? 'https://registry.npmjs.org'
|
|
14
|
-
const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'))
|
|
15
|
-
const name = manifest.name
|
|
16
|
-
|
|
17
|
-
const tagsResponse = await fetch(`${registry}/-/package/${name}/dist-tags`, {
|
|
18
|
-
headers: { accept: 'application/json' },
|
|
19
|
-
})
|
|
20
|
-
if (!tagsResponse.ok) {
|
|
21
|
-
console.error(`读取 dist-tags 失败:HTTP ${tagsResponse.status}`)
|
|
22
|
-
process.exit(1)
|
|
23
|
-
}
|
|
24
|
-
const tags = await tagsResponse.json()
|
|
25
|
-
const latest = tags.latest
|
|
26
|
-
if (typeof latest !== 'string') {
|
|
27
|
-
console.error('dist-tags 中没有 latest')
|
|
28
|
-
process.exit(1)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const versionResponse = await fetch(`${registry}/${name}/${latest}`, {
|
|
32
|
-
headers: { accept: 'application/json' },
|
|
33
|
-
})
|
|
34
|
-
if (!versionResponse.ok) {
|
|
35
|
-
console.error(`读取 ${name}@${latest} 失败:HTTP ${versionResponse.status}`)
|
|
36
|
-
process.exit(1)
|
|
37
|
-
}
|
|
38
|
-
const version = await versionResponse.json()
|
|
39
|
-
|
|
40
|
-
const record = {
|
|
41
|
-
name,
|
|
42
|
-
latest,
|
|
43
|
-
publishedAt: '',
|
|
44
|
-
dist: {
|
|
45
|
-
tarball: version.dist?.tarball ?? '',
|
|
46
|
-
integrity: version.dist?.integrity ?? '',
|
|
47
|
-
unpackedSize: version.dist?.unpackedSize ?? 0,
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// 发布时间取注册表给出的该版本时间戳,读不到时退回当前时间。
|
|
52
|
-
const document = await fetch(`${registry}/${name}`, { headers: { accept: 'application/json' } })
|
|
53
|
-
.then(response => (response.ok ? response.json() : undefined))
|
|
54
|
-
.catch(() => undefined)
|
|
55
|
-
const publishedAt = document?.time?.[latest]
|
|
56
|
-
record.publishedAt = typeof publishedAt === 'string' ? publishedAt : new Date().toISOString()
|
|
57
|
-
|
|
58
|
-
writeFileSync(join(root, 'npm-latest.json'), `${JSON.stringify(record, null, 2)}\n`, 'utf8')
|
|
59
|
-
console.log(`已写入 npm-latest.json:${name}@${latest}`)
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 把 npm 上本包的 latest 版本信息回写到仓库根的 npm-latest.json。
|
|
4
|
+
*
|
|
5
|
+
* 由发布工作流在正式版发布后调用,内容幂等:同一 latest 版本重复运行没有
|
|
6
|
+
* 差异,因此不会产生空提交。
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
9
|
+
import { dirname, join } from 'node:path'
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
11
|
+
|
|
12
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
13
|
+
const registry = process.env.NPM_REGISTRY ?? 'https://registry.npmjs.org'
|
|
14
|
+
const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'))
|
|
15
|
+
const name = manifest.name
|
|
16
|
+
|
|
17
|
+
const tagsResponse = await fetch(`${registry}/-/package/${name}/dist-tags`, {
|
|
18
|
+
headers: { accept: 'application/json' },
|
|
19
|
+
})
|
|
20
|
+
if (!tagsResponse.ok) {
|
|
21
|
+
console.error(`读取 dist-tags 失败:HTTP ${tagsResponse.status}`)
|
|
22
|
+
process.exit(1)
|
|
23
|
+
}
|
|
24
|
+
const tags = await tagsResponse.json()
|
|
25
|
+
const latest = tags.latest
|
|
26
|
+
if (typeof latest !== 'string') {
|
|
27
|
+
console.error('dist-tags 中没有 latest')
|
|
28
|
+
process.exit(1)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const versionResponse = await fetch(`${registry}/${name}/${latest}`, {
|
|
32
|
+
headers: { accept: 'application/json' },
|
|
33
|
+
})
|
|
34
|
+
if (!versionResponse.ok) {
|
|
35
|
+
console.error(`读取 ${name}@${latest} 失败:HTTP ${versionResponse.status}`)
|
|
36
|
+
process.exit(1)
|
|
37
|
+
}
|
|
38
|
+
const version = await versionResponse.json()
|
|
39
|
+
|
|
40
|
+
const record = {
|
|
41
|
+
name,
|
|
42
|
+
latest,
|
|
43
|
+
publishedAt: '',
|
|
44
|
+
dist: {
|
|
45
|
+
tarball: version.dist?.tarball ?? '',
|
|
46
|
+
integrity: version.dist?.integrity ?? '',
|
|
47
|
+
unpackedSize: version.dist?.unpackedSize ?? 0,
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 发布时间取注册表给出的该版本时间戳,读不到时退回当前时间。
|
|
52
|
+
const document = await fetch(`${registry}/${name}`, { headers: { accept: 'application/json' } })
|
|
53
|
+
.then(response => (response.ok ? response.json() : undefined))
|
|
54
|
+
.catch(() => undefined)
|
|
55
|
+
const publishedAt = document?.time?.[latest]
|
|
56
|
+
record.publishedAt = typeof publishedAt === 'string' ? publishedAt : new Date().toISOString()
|
|
57
|
+
|
|
58
|
+
writeFileSync(join(root, 'npm-latest.json'), `${JSON.stringify(record, null, 2)}\n`, 'utf8')
|
|
59
|
+
console.log(`已写入 npm-latest.json:${name}@${latest}`)
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* 从 DSH 宿主样式表生成演示站使用的令牌副本。
|
|
4
|
-
*
|
|
5
|
-
* 演示站跑在普通浏览器里,没有宿主注入 `--dsw-*`。为了让组件在演示站里与
|
|
6
|
-
* 在宿主里表现一致,本脚本把宿主的三张样式表(调色板、语义别名、阴影与
|
|
7
|
-
* 字体)原样搬到 `docs/preview/host-tokens.css`,并补上宿主 `base.css` 里的
|
|
8
|
-
* 字体族默认值。
|
|
9
|
-
*
|
|
10
|
-
* 用法:node scripts/gen-host-tokens.mjs
|
|
11
|
-
* 宿主样式目录的定位规则与 `verify-tokens.mjs` 一致。
|
|
12
|
-
*/
|
|
13
|
-
import { readFileSync, writeFileSync, existsSync, statSync } from 'node:fs'
|
|
14
|
-
import { dirname, join, resolve } from 'node:path'
|
|
15
|
-
import { fileURLToPath } from 'node:url'
|
|
16
|
-
|
|
17
|
-
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 按候选顺序定位宿主样式目录。
|
|
21
|
-
*
|
|
22
|
-
* @returns 样式目录绝对路径。
|
|
23
|
-
*/
|
|
24
|
-
function locateThemeDir() {
|
|
25
|
-
const candidates = []
|
|
26
|
-
if (process.env.DSH_UI_THEME_DIR) candidates.push(process.env.DSH_UI_THEME_DIR)
|
|
27
|
-
candidates.push(resolve(root, '..', '.dsh', 'temp', 'session-tree-harness', 'packages', 'client', 'ui-theme', 'src', 'styles'))
|
|
28
|
-
for (const candidate of candidates) {
|
|
29
|
-
if (existsSync(candidate) && statSync(candidate).isDirectory()) return candidate
|
|
30
|
-
}
|
|
31
|
-
console.error('未找到 DSH 宿主样式目录。请设置 DSH_UI_THEME_DIR。')
|
|
32
|
-
process.exit(2)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const themeDir = locateThemeDir()
|
|
36
|
-
|
|
37
|
-
/** 需要搬运的样式表,顺序即层叠顺序。 */
|
|
38
|
-
const SOURCES = ['base.css', 'design-platform.css', 'gradient-shadow-text.css', 'focus.css', 'corner-shape.css']
|
|
39
|
-
|
|
40
|
-
const header = `/*
|
|
41
|
-
* 本文件由 scripts/gen-host-tokens.mjs 从 DSH 宿主样式表生成,请勿手改。
|
|
42
|
-
*
|
|
43
|
-
* 内容与宿主 ui-theme 的样式表一一对应:静态调色板、语义别名、字体与阴影
|
|
44
|
-
* 令牌、焦点环与圆角平滑。演示站用它代替宿主注入,使组件外观与在宿主中
|
|
45
|
-
* 一致。宿主升级后重新运行脚本即可更新。
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
`
|
|
49
|
-
|
|
50
|
-
const body = SOURCES.map(file => {
|
|
51
|
-
const path = join(themeDir, file)
|
|
52
|
-
if (!existsSync(path)) {
|
|
53
|
-
console.error(`宿主样式表缺少 ${file}`)
|
|
54
|
-
process.exit(2)
|
|
55
|
-
}
|
|
56
|
-
return `/* ── ${file} ────────────────────────────────────────────────── */\n${readFileSync(path, 'utf8').trim()}\n`
|
|
57
|
-
}).join('\n')
|
|
58
|
-
|
|
59
|
-
const target = join(root, 'docs', 'preview', 'host-tokens.css')
|
|
60
|
-
writeFileSync(target, header + body, 'utf8')
|
|
61
|
-
console.log(`已生成 docs/preview/host-tokens.css(来源 ${themeDir})`)
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 从 DSH 宿主样式表生成演示站使用的令牌副本。
|
|
4
|
+
*
|
|
5
|
+
* 演示站跑在普通浏览器里,没有宿主注入 `--dsw-*`。为了让组件在演示站里与
|
|
6
|
+
* 在宿主里表现一致,本脚本把宿主的三张样式表(调色板、语义别名、阴影与
|
|
7
|
+
* 字体)原样搬到 `docs/preview/host-tokens.css`,并补上宿主 `base.css` 里的
|
|
8
|
+
* 字体族默认值。
|
|
9
|
+
*
|
|
10
|
+
* 用法:node scripts/gen-host-tokens.mjs
|
|
11
|
+
* 宿主样式目录的定位规则与 `verify-tokens.mjs` 一致。
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync, writeFileSync, existsSync, statSync } from 'node:fs'
|
|
14
|
+
import { dirname, join, resolve } from 'node:path'
|
|
15
|
+
import { fileURLToPath } from 'node:url'
|
|
16
|
+
|
|
17
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 按候选顺序定位宿主样式目录。
|
|
21
|
+
*
|
|
22
|
+
* @returns 样式目录绝对路径。
|
|
23
|
+
*/
|
|
24
|
+
function locateThemeDir() {
|
|
25
|
+
const candidates = []
|
|
26
|
+
if (process.env.DSH_UI_THEME_DIR) candidates.push(process.env.DSH_UI_THEME_DIR)
|
|
27
|
+
candidates.push(resolve(root, '..', '.dsh', 'temp', 'session-tree-harness', 'packages', 'client', 'ui-theme', 'src', 'styles'))
|
|
28
|
+
for (const candidate of candidates) {
|
|
29
|
+
if (existsSync(candidate) && statSync(candidate).isDirectory()) return candidate
|
|
30
|
+
}
|
|
31
|
+
console.error('未找到 DSH 宿主样式目录。请设置 DSH_UI_THEME_DIR。')
|
|
32
|
+
process.exit(2)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const themeDir = locateThemeDir()
|
|
36
|
+
|
|
37
|
+
/** 需要搬运的样式表,顺序即层叠顺序。 */
|
|
38
|
+
const SOURCES = ['base.css', 'design-platform.css', 'gradient-shadow-text.css', 'focus.css', 'corner-shape.css']
|
|
39
|
+
|
|
40
|
+
const header = `/*
|
|
41
|
+
* 本文件由 scripts/gen-host-tokens.mjs 从 DSH 宿主样式表生成,请勿手改。
|
|
42
|
+
*
|
|
43
|
+
* 内容与宿主 ui-theme 的样式表一一对应:静态调色板、语义别名、字体与阴影
|
|
44
|
+
* 令牌、焦点环与圆角平滑。演示站用它代替宿主注入,使组件外观与在宿主中
|
|
45
|
+
* 一致。宿主升级后重新运行脚本即可更新。
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
const body = SOURCES.map(file => {
|
|
51
|
+
const path = join(themeDir, file)
|
|
52
|
+
if (!existsSync(path)) {
|
|
53
|
+
console.error(`宿主样式表缺少 ${file}`)
|
|
54
|
+
process.exit(2)
|
|
55
|
+
}
|
|
56
|
+
return `/* ── ${file} ────────────────────────────────────────────────── */\n${readFileSync(path, 'utf8').trim()}\n`
|
|
57
|
+
}).join('\n')
|
|
58
|
+
|
|
59
|
+
const target = join(root, 'docs', 'preview', 'host-tokens.css')
|
|
60
|
+
writeFileSync(target, header + body, 'utf8')
|
|
61
|
+
console.log(`已生成 docs/preview/host-tokens.css(来源 ${themeDir})`)
|