dsh-design-studio 1.4.1 → 1.5.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.
- package/README.en.md +6 -6
- package/README.md +13 -13
- package/lib/annotations.js +1 -1
- package/lib/client.js +263 -231
- package/lib/core.js +2 -2
- package/lib/frames.js +3 -3
- package/lib/htmlpack.js +1 -1
- package/lib/index.js +3 -3
- package/lib/kinds.js +1 -1
- package/locale/annotations/en.json +2 -2
- package/locale/annotations/zh.json +2 -2
- package/locale/en.json +1 -1
- package/locale/tool/zh.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +1 -1
- package/skills/ui-design/SKILL.md +6 -4
package/lib/core.js
CHANGED
|
@@ -49,9 +49,9 @@ const KIND_ALIAS = {
|
|
|
49
49
|
social: 'poster', image: 'poster', banner: 'poster', card: 'poster', flyer: 'poster', cover: 'poster',
|
|
50
50
|
slide: 'slides', deck: 'slides', ppt: 'slides', presentation: 'slides',
|
|
51
51
|
mail: 'email', newsletter: 'email', edm: 'email',
|
|
52
|
-
mindmap: 'diagram', 'mind-map': 'diagram', roadmap: 'diagram', architecture: 'diagram', arch: 'diagram', flowchart: 'diagram', 思维导图: 'diagram', 导图: 'diagram', 脑图: 'diagram', 路线图: 'diagram', 技术路线图: 'diagram', 架构图: 'diagram', 图表: 'diagram',
|
|
52
|
+
mindmap: 'diagram', 'mind-map': 'diagram', roadmap: 'diagram', architecture: 'diagram', arch: 'diagram', flowchart: 'diagram', 思维导图: 'diagram', 导图: 'diagram', 脑图: 'diagram', 路线图: 'diagram', 技术路线图: 'diagram', 架构图: 'diagram', 图表: 'diagram', '路线图·导图': 'diagram',
|
|
53
53
|
dsh: 'dshplugin', 'dsh-plugin': 'dshplugin', dshplug: 'dshplugin', harness: 'dshplugin', dsh插件: 'dshplugin', 'dsh 插件': 'dshplugin',
|
|
54
|
-
frame: 'framed', 外框: 'framed', 自定外框: 'framed', 套外框: 'framed',
|
|
54
|
+
frame: 'framed', 外框: 'framed', 自定外框: 'framed', 套外框: 'framed', 外壳: 'framed', 自定义外壳: 'framed',
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/** 类型名(含常见别名)→ KINDS 里的一个;认不出返回 '' */
|
package/lib/frames.js
CHANGED
|
@@ -480,9 +480,9 @@ export async function saveFrame({ browser, src, dir = FRAMES_DIR, hubFactory = c
|
|
|
480
480
|
/** 技能里加一段:库里有哪些外框(每次加载技能现读) */
|
|
481
481
|
export function frameSection(dir = FRAMES_DIR) {
|
|
482
482
|
const list = listFrames(dir)
|
|
483
|
-
const head = '\n\n##
|
|
484
|
-
const how = '用户要给某个软件 / 浏览器插件 / 平台做界面、说「套上 XX
|
|
483
|
+
const head = '\n\n## 外框库(用户自己的外框;界面上叫「外壳库」「自定义外壳」,跟用户说话用这个叫法)\n\n'
|
|
484
|
+
const how = '用户要给某个软件 / 浏览器插件 / 平台做界面、说「套上 XX 的外壳 / 外框」「照这张截图做个外壳 / 外框」:读 `references/frames.md`,照截图或说明写外框,调 `save_frame` 存进库,再用它出设计。'
|
|
485
485
|
if (!list.length) return head + how + '\n'
|
|
486
486
|
const line = (x) => `- 「${x.name}」(${x.id},${x.size[0]}×${x.size[1]}):${x.dir};位置:${x.frames.map((f) => `${f.name}(${f.file},槽位 ${Object.keys(f.slots).join('、')})`).join(';')}`
|
|
487
|
-
return `${head}${list.slice(0, 12).map(line).join('\n')}\n\n
|
|
487
|
+
return `${head}${list.slice(0, 12).map(line).join('\n')}\n\n用户点名用某个外框(首页选了「自定义外壳」再选一个,消息里会写「外壳:名字(id)」,旧消息是「外框:名字(id)」):照 \`references/frames.md\` 的「用外框」做,类型标记写 framed。\n\n${how}\n`
|
|
488
488
|
}
|
package/lib/htmlpack.js
CHANGED
|
@@ -640,7 +640,7 @@ function player() {
|
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
const STRINGS = {
|
|
643
|
-
zh: { prev: '上一屏', next: '下一屏', shell: '
|
|
643
|
+
zh: { prev: '上一屏', next: '下一屏', shell: '设备框', shellTip: '套上手机 / 浏览器的设备框', full: '全屏', exitFull: '退出全屏', of: '{i} / {n}', notIn: '这一屏不在演示里:{p}', menu: '换屏', screens: '选屏', reset: '重置数据', resetTip: '演示里点过、填过的都回到开始', resetDone: '数据回到开始了' },
|
|
644
644
|
en: { prev: 'Previous', next: 'Next', shell: 'Device frame', shellTip: 'Show the phone / browser frame', full: 'Full screen', exitFull: 'Exit full screen', of: '{i} / {n}', notIn: 'This screen isn\'t in the demo: {p}', menu: 'Screens', screens: 'Pick a screen', reset: 'Reset data', resetTip: 'Undo everything tapped and typed in this demo', resetDone: 'Data is back to the start' },
|
|
645
645
|
}
|
|
646
646
|
|
package/lib/index.js
CHANGED
|
@@ -171,7 +171,7 @@ export const previewTool = {
|
|
|
171
171
|
kind: {
|
|
172
172
|
type: 'string',
|
|
173
173
|
enum: KINDS,
|
|
174
|
-
description: '设计类型:web 网页(默认)、app 手机 App 界面(390×844)、miniprogram 微信小程序(375×812,外框带右上角胶囊)、tablet 平板、desktop 桌面软件(1280×800 的 Mac 窗口;Windows 软件在页面 meta 写 desktop windows)、poster 海报 / 社媒图(1080×1350)、slides 幻灯片(16:9)、email 邮件、diagram
|
|
174
|
+
description: '设计类型:web 网页(默认)、app 手机 App 界面(390×844)、miniprogram 微信小程序(375×812,外框带右上角胶囊)、tablet 平板、desktop 桌面软件(1280×800 的 Mac 窗口;Windows 软件在页面 meta 写 desktop windows)、poster 海报 / 社媒图(1080×1350)、slides 幻灯片(16:9)、email 邮件、diagram 路线图·导图(界面上的叫法;技术路线图 / 申报书、研究框架图、架构图、思维导图、产品路线图,默认 1600×1000,图多大画幅跟着多大)、dshplugin DSH 插件(1280×800,套 DSH 桌面端外框,只设计插件那块:左侧栏入口 / 设置分区 / 会话标签页 / 右侧栏面板)、framed 自定义外壳(外框库里用户自己的外框,界面上叫外壳;画幅跟外框走,只设计槽位里那块)',
|
|
175
175
|
},
|
|
176
176
|
size: { type: 'string', description: '画幅尺寸,可选,如 1080x1920;不填按类型的默认尺寸' },
|
|
177
177
|
screens: {
|
|
@@ -435,7 +435,7 @@ function annotationNotes(at, rows) {
|
|
|
435
435
|
list = lintAnnotations(at.root)
|
|
436
436
|
const r = at.ann
|
|
437
437
|
if (r && rows) list.push(...annotationFindings(r.list, rows.filter((x) => Array.isArray(x.annots)).map((x) => ({ page: x.key, list: x.annots }))))
|
|
438
|
-
else if (r && r.list.length) list.push('
|
|
438
|
+
else if (r && r.list.length) list.push('这次没有无头浏览器,选择器定位不到的情况没核对;右侧栏「需求说明」面板里能看到')
|
|
439
439
|
} catch (e) { studio.log(e) }
|
|
440
440
|
return list.length ? `\n\n业务标注(annotations.json):\n${list.map((x) => `- ${x}`).join('\n')}` : ''
|
|
441
441
|
}
|
|
@@ -613,7 +613,7 @@ export const frameTool = {
|
|
|
613
613
|
name: 'save_frame',
|
|
614
614
|
description:
|
|
615
615
|
'把写好的「外框」存进用户的外框库(~/.dsh/design-frames/<id>/),以后做设计原样套上、只改槽位。' +
|
|
616
|
-
'用户要给某个软件 / 浏览器插件 /
|
|
616
|
+
'用户要给某个软件 / 浏览器插件 / 平台做界面、说「照这张截图做个外壳 / 外框」「套上 XX 的外壳 / 外框」时:先读 ui-design 技能的 references/frames.md,在一个文件夹里写好 frame.json、每个位置一个 HTML(根元素 data-frame="<id>/<位置>",槽位 data-slot,必须有 main)和样式,再调它。' +
|
|
617
617
|
'它检查 frame.json 和槽位对不对,用无头浏览器打开每个位置(浅色、深色)算外框指纹(体检「外框被改动」靠它),截图回给你核对;同 id 再存一次就覆盖。',
|
|
618
618
|
parameters: specToJsonSchema({
|
|
619
619
|
dir: { type: 'string', required: true, description: '写好外框的文件夹(里面有 frame.json),绝对路径或相对会话目录' },
|
package/lib/kinds.js
CHANGED
|
@@ -8,4 +8,4 @@ export const KIND_SIZE = { web: [1280, 800], app: [390, 844], miniprogram: [375,
|
|
|
8
8
|
export const KINDS = Object.keys(KIND_SIZE)
|
|
9
9
|
|
|
10
10
|
/** 页面 <meta name="dsh-design"> 里认的类型别名(比 core 的 parseKind 少,故意不合并) */
|
|
11
|
-
export const META_ALIAS = { phone: 'app', mobile: 'app', ios: 'app', android: 'app', mini: 'miniprogram', miniapp: 'miniprogram', weapp: 'miniprogram', wechat: 'miniprogram', 小程序: 'miniprogram', pad: 'tablet', ipad: 'tablet', pc: 'desktop', electron: 'desktop', tauri: 'desktop', mac: 'desktop', macos: 'desktop', windows: 'desktop', win: 'desktop', 桌面: 'desktop', 桌面软件: 'desktop', social: 'poster', image: 'poster', slide: 'slides', deck: 'slides', ppt: 'slides', mail: 'email', mindmap: 'diagram', roadmap: 'diagram', architecture: 'diagram', flowchart: 'diagram', 思维导图: 'diagram', 导图: 'diagram', 路线图: 'diagram', 架构图: 'diagram', 图表: 'diagram', dsh: 'dshplugin', 'dsh-plugin': 'dshplugin', dsh插件: 'dshplugin', frame: 'framed', 外框: 'framed', 自定外框: 'framed', 套外框: 'framed' }
|
|
11
|
+
export const META_ALIAS = { phone: 'app', mobile: 'app', ios: 'app', android: 'app', mini: 'miniprogram', miniapp: 'miniprogram', weapp: 'miniprogram', wechat: 'miniprogram', 小程序: 'miniprogram', pad: 'tablet', ipad: 'tablet', pc: 'desktop', electron: 'desktop', tauri: 'desktop', mac: 'desktop', macos: 'desktop', windows: 'desktop', win: 'desktop', 桌面: 'desktop', 桌面软件: 'desktop', social: 'poster', image: 'poster', slide: 'slides', deck: 'slides', ppt: 'slides', mail: 'email', mindmap: 'diagram', roadmap: 'diagram', architecture: 'diagram', flowchart: 'diagram', 思维导图: 'diagram', 导图: 'diagram', 路线图: 'diagram', 架构图: 'diagram', 图表: 'diagram', '路线图·导图': 'diagram', dsh: 'dshplugin', 'dsh-plugin': 'dshplugin', dsh插件: 'dshplugin', frame: 'framed', 外框: 'framed', 自定外框: 'framed', 套外框: 'framed', 外壳: 'framed', 自定义外壳: 'framed' }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
|
-
"title": "
|
|
4
|
-
"description": "When on, the model also writes annotations.json with the business rules, states and edge cases the UI does not show, which takes a little longer. The sidebar gains a Notes
|
|
3
|
+
"title": "Requirement notes (experimental)",
|
|
4
|
+
"description": "When on, the model also writes annotations.json with the business rules, states and edge cases the UI does not show, which takes a little longer. The Check panel in the sidebar gains a Notes tab: numbered markers on the page, cards on the right, each locating the other. The rules are included when you turn a design into code."
|
|
5
5
|
}
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
|
-
"title": "
|
|
4
|
-
"description": "打开后,模型做设计时会同时写一份 annotations.json
|
|
3
|
+
"title": "需求说明(试验)",
|
|
4
|
+
"description": "打开后,模型做设计时会同时写一份 annotations.json,记下界面上看不出来的业务规则、状态和边界,会多花一些时间。右侧栏「检查」面板里多一个「需求说明」页签:页面上出编号,右边列卡片,两边能互相定位;转成代码时带上这些规则。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Design Studio",
|
|
4
|
-
"description": "A design workbench in the right sidebar: web, app, mini program and poster screens generate on a canvas inside device frames; click an element or
|
|
4
|
+
"description": "A design workbench in the right sidebar: web, app, mini program and poster screens generate on a canvas inside device frames; click an element or annotate it to have the model change it, open existing HTML pages to keep working on them, drag sliders to tweak design tokens across every screen, compare and roll back versions, extract a brand's design system from a website, turn a design into React / Vue / HTML code and diff it pixel by pixel, export share-ready images, and scan a QR code for a phone preview.",
|
|
5
5
|
"detail": "README.en.md"
|
|
6
6
|
}
|
|
7
7
|
}
|
package/locale/tool/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
|
-
"title": "
|
|
3
|
+
"title": "预览、检查、截图和转代码工具(其他模式)",
|
|
4
4
|
"description": "让标准、创造等其他模式也能用 preview_page(把页面打开到右侧「设计工作台」)、check_design(按真实尺寸量一遍设计问题)、look_design(按真实尺寸截图给模型看)、extract_design_system(从网站 / 项目提取品牌设计系统)、handoff_design 和 compare_design(把设计做成真代码、和设计稿逐像素比)。设计模式里自带,不受这个开关影响。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "设计工作台",
|
|
4
|
-
"description": "右侧栏的设计工作台:网页、App
|
|
4
|
+
"description": "右侧栏的设计工作台:网页、App、小程序、海报一屏屏生成在画布上,套好设备框;点一下元素或用标注圈出来就让模型改那里,已有的 HTML 页面也能打开接着改;拖滑块微调设计变量全屏一起变,版本能对比回退;能从网站提取品牌设计系统,也能把设计转成 React / Vue / HTML 代码并逐像素对比;一键导出好看的展示图,扫码就能手机预览。",
|
|
5
5
|
"detail": "README.md"
|
|
6
6
|
}
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# 界面设计(配合右侧「设计工作台」)
|
|
2
2
|
|
|
3
|
-
做网页、App 界面、微信小程序、平板界面、桌面软件、海报 /
|
|
3
|
+
做网页、App 界面、微信小程序、平板界面、桌面软件、海报 / 社媒图、幻灯片、邮件、路线图·导图(技术路线图、研究框架图、架构图、思维导图、产品路线图)、组件这类**看得见的设计**时照这份来。目标:一眼看上去像专业设计师做的,不像模板,也没有「AI 味」。
|
|
4
|
+
|
|
5
|
+
> 跟用户说话时用工作台界面上的叫法:路线图·导图(不说「图表」)、检查(不说「体检」)、演示(不说「试用」)、尺寸(不说「画幅」)、文字 / 样式 / 标注(工具栏三个工具)、主题面板(全局样式 / 微调 / 风格 / 品牌)、需求说明、自定义外壳和外壳库(手机、浏览器那一圈叫设备框,导出时分带设备框 / 无设备框)、单页查看、手机预览、在线链接、还原度对比、导出设计包。下文和消息开头的〔…〕标记里还有旧叫法,照常认,只是别对用户说。
|
|
4
6
|
|
|
5
7
|
> 不归这里管:用户只是要把回答做成一页看或用(对比、表格、清单、数据图表、计算器、学习卡片),而你有 `show_page` 工具——直接调 `show_page`,不用这份流程、不写文件、不开预览。思维导图、路线图也一样:只是在对话里随手看一张,`show_page` 有对应模板就用它;用户说要「设计」「做一张好看的」、要导出成图片 / PDF / PPT,或者已经在工作台里做,才按这份做(类型 `diagram`)。
|
|
6
8
|
|
|
@@ -91,7 +93,7 @@
|
|
|
91
93
|
|
|
92
94
|
6. **用户点选后让你改**(消息里有〔选中元素〕/〔选中区域〕):按里面的文件和 CSS 路径找到源码改那一处;如果是颜色、字号、圆角这类风格问题,优先改 `tokens.css` 里的变量,让所有屏保持一致。
|
|
93
95
|
|
|
94
|
-
**用户在工作台里手调过样式**:元素上的 `style="…"`
|
|
96
|
+
**用户在工作台里手调过样式**:元素上的 `style="…"` 多半是用户用「样式」工具拖出来的,值是用户要的,别随手删、也别改回去;整理代码时可以挪进对应的样式规则(值不变)。用户还会在右侧栏直接改字、调滑块、回到旧版本:接着改某一屏、或把设计做进项目之前,先重新读现在的文件,别照你之前写过的内容来。消息以〔调样式〕开头时,按里面的元素、选择器和「原来 → 现在」写进样式表,值是 `var(--x)` 的就用那个变量;同类元素(比如所有主按钮)该一起改就一起改,改完说一句。
|
|
95
97
|
|
|
96
98
|
**换风格**(〔风格〕后面说「把现在的设计换成这个风格」):先改 `tokens.css`(配色、字体、圆角、阴影按消息里的来),页面里写死的颜色换成变量,再按「要点」调细节;布局和文案不动。改完调 `check_design` 量一遍(换了配色最容易出对比度问题)。
|
|
97
99
|
|
|
@@ -112,12 +114,12 @@
|
|
|
112
114
|
|
|
113
115
|
改完说一句改了哪几处。这一轮结束后右侧栏会自己再量一遍,按钮上的数字没了就是都改好了。
|
|
114
116
|
|
|
115
|
-
|
|
117
|
+
**准备分享**(消息以〔准备分享〕开头):用户要把设计导出成设计包(.zip)发给别人,打包前的检查查出了这些问题。逐条改,没列出来的地方别动:
|
|
116
118
|
- 有脚本、`on…` 事件、`javascript:` 链接:删掉(设计稿是静态的,交互效果用 CSS 的 `:hover`、`:target`、`<details>` 代替);
|
|
117
119
|
- 连了外网(外链的字体、图片、样式,`@import`):图片下载进目录用相对路径,或者换成 CSS / SVG 画的;字体改用系统字体栈(分享包不带字体文件,别调 `use_fonts`);
|
|
118
120
|
- 像真的手机号、邮箱、身份证号:换成明显是假的(`138 0000 0000`、`hello@example.com`);
|
|
119
121
|
- 文件太大、太多:压小图片、删掉没用到的文件。
|
|
120
|
-
改完调 `check_design`
|
|
122
|
+
改完调 `check_design` 检查一遍,说一句改了哪几处;用户会再点一次「检查并导出」。
|
|
121
123
|
|
|
122
124
|
8. **调节滑块**(用户说「做几个滑块」「让我自己调」,或消息以〔调节滑块〕开头):全套做完后,挑 3–5 个这套设计最值得试的维度(留白疏密、圆角、主色、标题字号、卡片排法……),写进设计目录的 `tweaks.json`。右侧工作台把它们列成滑块,用户拖的时候所有屏一起变(只改页面上的 CSS 变量和 `<html>` 上的属性,不动文件),满意了写回文件或交给你。
|
|
123
125
|
|