dsh-design-studio 0.19.1 → 0.20.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 +2 -1
- package/README.md +2 -1
- package/cordis.patch.yml +2 -2
- package/lib/client.js +45 -17
- package/lib/core.js +3 -2
- package/lib/gallery/policy.js +2 -2
- package/lib/index.js +8 -7
- package/lib/look.js +10 -5
- package/lib/picker.js +107 -5
- package/lib/styles.js +1 -1
- package/package.json +1 -1
- package/skills/ui-design/SKILL.md +6 -5
- package/skills/ui-design/diagram.css +1047 -0
- package/skills/ui-design/references/diagram.md +150 -0
- package/skills/ui-design/tokens.css +1 -1
package/lib/picker.js
CHANGED
|
@@ -1233,6 +1233,12 @@
|
|
|
1233
1233
|
function naturalSize() {
|
|
1234
1234
|
const b = document.body
|
|
1235
1235
|
if (!b) return null
|
|
1236
|
+
if (b.classList.contains('dg-page')) { // 图表(diagram.css):图比窗口大时页面往右、往下长,按整页算
|
|
1237
|
+
const de = document.scrollingElement || document.documentElement
|
|
1238
|
+
const w = Math.ceil(Math.max(de.scrollWidth, b.scrollWidth))
|
|
1239
|
+
const h = Math.ceil(Math.max(de.scrollHeight, b.scrollHeight))
|
|
1240
|
+
return w > innerWidth + 1 || h > innerHeight + 1 ? [w, h] : null
|
|
1241
|
+
}
|
|
1236
1242
|
declMemo = new Map()
|
|
1237
1243
|
cssOpaque = false
|
|
1238
1244
|
const skip = (el) => el.hasAttribute('data-dsh-design') || /^(SCRIPT|STYLE|LINK|NOSCRIPT|TEMPLATE)$/.test(el.tagName)
|
|
@@ -2041,16 +2047,33 @@ background:rgba(20,20,22,.86);color:#e8e8ea;font:12px/18px -apple-system,system-
|
|
|
2041
2047
|
return value.replace(URL_RE, (m, q, u) => (local.has(u) ? `url("${local.get(u)}")` : map.get(u) ? `url("${map.get(u)}")` : 'none'))
|
|
2042
2048
|
}
|
|
2043
2049
|
|
|
2044
|
-
|
|
2050
|
+
const WIDTH_OF_STYLE = [['border-top-style', 'border-top-width'], ['border-right-style', 'border-right-width'], ['border-bottom-style', 'border-bottom-width'], ['border-left-style', 'border-left-width'], ['outline-style', 'outline-width'], ['column-rule-style', 'column-rule-width']]
|
|
2051
|
+
// 会继承的属性:和默认值一样也可能和父元素不一样(粗体节点里的 <small> 写回 400)。克隆出来是跟着父元素走的,这时也得写上
|
|
2052
|
+
const INHERITED = new Set(['color', 'font-family', 'font-size', 'font-style', 'font-weight', 'font-variant', 'font-variant-caps', 'font-variant-numeric', 'font-variant-ligatures', 'font-variant-east-asian',
|
|
2053
|
+
'font-stretch', 'font-feature-settings', 'font-variation-settings', 'font-kerning', 'font-optical-sizing', 'line-height', 'letter-spacing', 'word-spacing', 'text-align', 'text-align-last', 'text-indent',
|
|
2054
|
+
'text-transform', 'text-shadow', 'white-space', 'white-space-collapse', 'text-wrap', 'text-wrap-mode', 'text-wrap-style', 'word-break', 'overflow-wrap', 'line-break', 'hyphens', 'direction', 'writing-mode',
|
|
2055
|
+
'text-orientation', 'visibility', 'list-style-type', 'list-style-position', 'list-style-image', 'quotes', 'tab-size', 'text-rendering', '-webkit-font-smoothing', '-webkit-text-fill-color',
|
|
2056
|
+
'-webkit-text-stroke-color', '-webkit-text-stroke-width', 'text-underline-position', 'text-decoration-skip-ink', 'text-emphasis-style', 'text-emphasis-color', 'text-emphasis-position',
|
|
2057
|
+
'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'color-scheme', 'paint-order', 'fill', 'fill-opacity', 'fill-rule', 'stroke', 'stroke-width', 'stroke-opacity',
|
|
2058
|
+
'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'text-anchor', 'dominant-baseline'])
|
|
2059
|
+
function styleText(cs, def, out, up) {
|
|
2045
2060
|
let s = ''
|
|
2046
2061
|
for (let i = 0; i < cs.length; i++) {
|
|
2047
2062
|
const p = cs[i]
|
|
2048
2063
|
if (SKIP_PROP.test(p)) continue
|
|
2049
2064
|
const v = cs.getPropertyValue(p)
|
|
2050
|
-
if (v === def[p]) continue
|
|
2065
|
+
if (v === def[p] && !(up && INHERITED.has(p) && up.getPropertyValue(p) !== v)) continue
|
|
2051
2066
|
if (out && v.indexOf('url(') >= 0) out.push(p)
|
|
2052
2067
|
s += `${p}:${v};`
|
|
2053
2068
|
}
|
|
2069
|
+
// 宽度 0、样式实线的边(Tailwind 的 *{border:0 solid}、图表连线的单边框):宽度和默认一样被跳过,
|
|
2070
|
+
// 克隆出来只剩 solid,浏览器按初始宽度 medium(3px)画出来。样式不是 none 时宽度一定写上
|
|
2071
|
+
for (const [st, wd] of WIDTH_OF_STYLE) {
|
|
2072
|
+
const sv = cs.getPropertyValue(st)
|
|
2073
|
+
if (!sv || sv === 'none' || sv === 'hidden') continue
|
|
2074
|
+
const wv = cs.getPropertyValue(wd)
|
|
2075
|
+
if (wv === def[wd]) s += `${wd}:${wv};`
|
|
2076
|
+
}
|
|
2054
2077
|
return s
|
|
2055
2078
|
}
|
|
2056
2079
|
|
|
@@ -2153,6 +2176,28 @@ background:rgba(20,20,22,.86);color:#e8e8ea;font:12px/18px -apple-system,system-
|
|
|
2153
2176
|
// ctx:往下传「以哪个滚过的滚动区为定位基准」——a:绝对定位的后代该往回挪多少,f:固定定位的(滚动区有变换时)
|
|
2154
2177
|
const NO_SHIFT = { a: [0, 0], f: [0, 0] }
|
|
2155
2178
|
const idPre = new Map([[document, '']])
|
|
2179
|
+
// 给 <use> 复用的 SVG:defs、symbol 这类定义里的,和 <use href="#…"> 真引用到的元素(普通 <g>、<rect> 也算)及它们里面的
|
|
2180
|
+
const DEFS_SEL = 'symbol, defs, pattern, marker, mask, clipPath, linearGradient, radialGradient, filter'
|
|
2181
|
+
const reusedOf = new Map()
|
|
2182
|
+
const useTargets = (doc) => {
|
|
2183
|
+
let set = reusedOf.get(doc)
|
|
2184
|
+
if (!set) {
|
|
2185
|
+
set = new Set()
|
|
2186
|
+
for (const u of doc.querySelectorAll('use')) {
|
|
2187
|
+
const h = u.getAttribute('href') || u.getAttributeNS('http://www.w3.org/1999/xlink', 'href') || ''
|
|
2188
|
+
const t = h.startsWith('#') && doc.getElementById(h.slice(1))
|
|
2189
|
+
if (t) set.add(t)
|
|
2190
|
+
}
|
|
2191
|
+
reusedOf.set(doc, set)
|
|
2192
|
+
}
|
|
2193
|
+
return set
|
|
2194
|
+
}
|
|
2195
|
+
const reusedSvg = (el) => {
|
|
2196
|
+
if (el.closest(DEFS_SEL)) return true
|
|
2197
|
+
const set = useTargets(el.ownerDocument)
|
|
2198
|
+
for (let e = el; e && e.namespaceURI === SVGNS; e = e.parentElement) if (set.has(e)) return true
|
|
2199
|
+
return false
|
|
2200
|
+
}
|
|
2156
2201
|
function walk(node, ctx = NO_SHIFT) {
|
|
2157
2202
|
if (node.nodeType === 3) return document.createTextNode(node.nodeValue)
|
|
2158
2203
|
if (node.nodeType !== 1) return null
|
|
@@ -2189,7 +2234,11 @@ background:rgba(20,20,22,.86);color:#e8e8ea;font:12px/18px -apple-system,system-
|
|
|
2189
2234
|
|
|
2190
2235
|
const withUrls = []
|
|
2191
2236
|
const def = box.defaults(el)
|
|
2192
|
-
|
|
2237
|
+
// 会继承的属性和父元素比(父层 32px 粗体、子标签用 CSS 改回 16px 常规,导出也得是 16px)。
|
|
2238
|
+
// 给 <use> 复用的(symbol、defs 里的,和被 <use> 直接引用的普通元素)不比,和 0.19.1 一样只和默认值比:
|
|
2239
|
+
// 克隆里它们跟着各处 <use> 继承,按定义处的父元素写死会坏事——currentColor 全变成定义处的一个色、50% 这类相对字号写死成定义处算出来的值
|
|
2240
|
+
const upEl = el.namespaceURI === SVGNS && reusedSvg(el) ? null : el.parentElement
|
|
2241
|
+
let st = styleText(cs, def, withUrls, upEl && upEl.ownerDocument === el.ownerDocument ? getComputedStyle(upEl) : null)
|
|
2193
2242
|
if (el === de) st += (full ? `height:${H}px;max-height:none;` : '') + 'overflow:hidden;' // 整页:根元素写了 height:100%、max-height 也要放得下整页
|
|
2194
2243
|
if (full && el === document.body) st += 'max-height:none;'
|
|
2195
2244
|
// iframe / 视频换成了 div:默认的 300×150、行内排列也得写明(和 iframe 默认一样的样式上面省掉了)
|
|
@@ -2268,7 +2317,7 @@ background:rgba(20,20,22,.86);color:#e8e8ea;font:12px/18px -apple-system,system-
|
|
|
2268
2317
|
const cls = 'ddpx' + (++seq)
|
|
2269
2318
|
c.setAttribute('class', ((c.getAttribute('class') || '') + ' ' + cls).trim())
|
|
2270
2319
|
const urls = []
|
|
2271
|
-
let body = styleText(ps, box.defaults(el, pe), urls)
|
|
2320
|
+
let body = styleText(ps, box.defaults(el, pe), urls, cs)
|
|
2272
2321
|
const pp = ps.position
|
|
2273
2322
|
if (pp === 'absolute' || pp === 'fixed') {
|
|
2274
2323
|
const mine = pp === 'absolute' ? holds(cs) : holds(cs, true)
|
|
@@ -3228,7 +3277,7 @@ background:rgba(20,20,22,.86);color:#e8e8ea;font:12px/18px -apple-system,system-
|
|
|
3228
3277
|
if (hiddenChain(el)) continue
|
|
3229
3278
|
culprits.push({ el, out: Math.round(out) })
|
|
3230
3279
|
}
|
|
3231
|
-
for (const c of culprits) add('hscroll', c.el, { px: c.out, scroll: sw > vw + 1 }, 2)
|
|
3280
|
+
if (kind !== 'diagram') for (const c of culprits) add('hscroll', c.el, { px: c.out, scroll: sw > vw + 1 }, 2)
|
|
3232
3281
|
|
|
3233
3282
|
// 2. 文字被截断 / 超出框:自己的字伸出了所在的块(行内元素看外面那个块)。
|
|
3234
3283
|
// Range 量到的是排版后的位置,被裁掉的部分也量得到
|
|
@@ -3426,6 +3475,8 @@ background:rgba(20,20,22,.86);color:#e8e8ea;font:12px/18px -apple-system,system-
|
|
|
3426
3475
|
if (kind === 'app' || kind === 'miniprogram') phoneCheck(add, atoms, vw, kind)
|
|
3427
3476
|
// 15. 桌面软件:窗口按钮挡住的字和按钮
|
|
3428
3477
|
if (kind === 'desktop') winCheck(add, atoms, vw)
|
|
3478
|
+
// 16. 图表:比画幅大、导图节点写法、一层太多、横条超出时间轴、节点字太多
|
|
3479
|
+
if (kind === 'diagram' || document.querySelector('.dg.mm, .dg.tr, .dg.rm, .dg.ar')) diagramCheck(add, kind, vw)
|
|
3429
3480
|
|
|
3430
3481
|
issues.sort((x, y) => y.sev - x.sev)
|
|
3431
3482
|
const se0 = se()
|
|
@@ -3552,6 +3603,57 @@ background:rgba(20,20,22,.86);color:#e8e8ea;font:12px/18px -apple-system,system-
|
|
|
3552
3603
|
}
|
|
3553
3604
|
}
|
|
3554
3605
|
|
|
3606
|
+
/** 图表(diagram.css)的结构问题:连线是样式按结构画的,结构写错了线就对不上 */
|
|
3607
|
+
function diagramCheck(add, kind, vw) {
|
|
3608
|
+
const de = document.scrollingElement || document.documentElement
|
|
3609
|
+
const pw = Math.ceil(de.scrollWidth), ph = Math.ceil(de.scrollHeight), vh = innerHeight
|
|
3610
|
+
if (kind === 'diagram' && (pw > vw + 2 || ph > vh + 2)) add('dgsize', null, { w: Math.max(pw, vw), h: Math.max(ph, vh), vw, vh }, 2)
|
|
3611
|
+
const shown = (el) => !hiddenChain(el) && el.getClientRects().length > 0
|
|
3612
|
+
// 下面都只看图里面(.dg.mm / .tr / .rm / .ar 根下面):页面别处的 nav.mm、.tr-row 这种同名类不管
|
|
3613
|
+
// 导图:li 的第一个孩子得是 .mm-node,字也不能直接写在 li 里
|
|
3614
|
+
let bad = 0
|
|
3615
|
+
for (const li of document.querySelectorAll('.dg.mm li')) {
|
|
3616
|
+
if (bad >= 3) break
|
|
3617
|
+
const first = li.firstElementChild
|
|
3618
|
+
if ((first && first.classList.contains('mm-node') && !ownText(li)) || !shown(li)) continue
|
|
3619
|
+
add('dgli', li, {}, 2)
|
|
3620
|
+
bad++
|
|
3621
|
+
}
|
|
3622
|
+
// 一层太多:导图一列最多 8 个,技术路线图一行最多 6 个框
|
|
3623
|
+
for (const ul of document.querySelectorAll('.dg.mm ul')) {
|
|
3624
|
+
const n = [...ul.children].filter((x) => x.tagName === 'LI').length
|
|
3625
|
+
if (n > 8 && shown(ul)) add('dgmany', ul, { n, max: 8, what: 'branch' }, 1)
|
|
3626
|
+
}
|
|
3627
|
+
for (const row of document.querySelectorAll('.dg.tr .tr-row')) {
|
|
3628
|
+
if (row.children.length > 6 && shown(row)) add('dgmany', row, { n: row.children.length, max: 6, what: 'box' }, 2)
|
|
3629
|
+
}
|
|
3630
|
+
// 路线图:横条、里程碑落在时间轴外面(网格会多长出几列,表头和竖线就对不上了)
|
|
3631
|
+
for (const el of document.querySelectorAll('.dg.rm .rm-bar, .dg.rm .rm-ms')) {
|
|
3632
|
+
const rm = el.closest('.dg.rm')
|
|
3633
|
+
if (!rm || !shown(el)) continue
|
|
3634
|
+
const num = (e, k, d) => { const v = parseFloat(getComputedStyle(e).getPropertyValue(k)); return Number.isFinite(v) ? v : d }
|
|
3635
|
+
const cols = Math.round(num(rm, '--cols', 4))
|
|
3636
|
+
const ms = el.classList.contains('rm-ms')
|
|
3637
|
+
const from = num(el, ms ? '--at' : '--from', 1)
|
|
3638
|
+
const span = num(el, '--span', 1)
|
|
3639
|
+
if (from < 1 || span < 1 || from !== Math.round(from) || span !== Math.round(span) || from + span - 1 > cols) add('dgbar', el, { from, span, cols }, 2)
|
|
3640
|
+
}
|
|
3641
|
+
// 节点字太多:只算节点自己的字,<small> 里的补充不算。汉字算 1 个,字母、数字算半个
|
|
3642
|
+
const MAX = [['.dg.mm .mm-node', 16], ['.dg.tr .tr-box', 28], ['.dg.rm .rm-bar', 24], ['.dg.ar .ar-mod', 16]]
|
|
3643
|
+
let long = 0
|
|
3644
|
+
for (const [sel, max] of MAX) {
|
|
3645
|
+
for (const el of document.querySelectorAll(sel)) {
|
|
3646
|
+
if (long >= 3) return
|
|
3647
|
+
let s = ''
|
|
3648
|
+
for (const n of el.childNodes) if (n.nodeType === 3 || (n.nodeType === 1 && !/^(SMALL|UL|OL)$/.test(n.tagName))) s += n.textContent
|
|
3649
|
+
s = s.replace(/\s+/g, '')
|
|
3650
|
+
const cjk = (s.match(/[\u3040-\u30ff\u3400-\u9fff\uf900-\ufaff\uac00-\ud7af]/g) || []).length
|
|
3651
|
+
const chars = Math.round(cjk + (s.length - cjk) / 2)
|
|
3652
|
+
if (chars > max && shown(el)) { add('dgtext', el, { chars, max }, 1); long++ }
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3555
3657
|
/**
|
|
3556
3658
|
* 伪元素在屏幕上的框(量不到它自己,按算出来的样式推):
|
|
3557
3659
|
* - 绝对 / 固定定位:算出来的 left / top / 宽高摆进包含块;
|
package/lib/styles.js
CHANGED
|
@@ -129,7 +129,7 @@ export const AUTO_STYLE = [
|
|
|
129
129
|
['editorial', /新闻|杂志|博客|阅读|读书|书店|媒体|播客|\b(news|magazine|blog|reading|books?|media|newsletter)\b/i],
|
|
130
130
|
['swiss', /设计工作室|建筑|展览|美术馆|画廊|作品集|\b(agency|studio|architecture|exhibition|gallery|museum|portfolio)\b/i],
|
|
131
131
|
]
|
|
132
|
-
export const AUTO_BY_KIND = { slides: 'swiss', web: 'minimal', desktop: 'tech', email: 'minimal', poster: 'playful', tablet: 'minimal' }
|
|
132
|
+
export const AUTO_BY_KIND = { slides: 'swiss', web: 'minimal', desktop: 'tech', email: 'minimal', poster: 'playful', tablet: 'minimal', diagram: 'tech' }
|
|
133
133
|
export const AUTO_SPREAD = ['minimal', 'editorial', 'playful', 'fresh', 'tech', 'glass', 'dark', 'sport']
|
|
134
134
|
// 「北欧风」「清新风:首页…」「中国风的界面」算说了风格;先去掉「通风」「台风」「新风系统」「风控」「风景」这类不是风格的词
|
|
135
135
|
export const NOT_STYLE_FENG = /通风|台风|新风(系统|机|量)|风险|风控|风景|风扇|风味|风暴|风光|风速|风向|风筝|风铃|风车|吹风|防风|挡风|避风|屏风|旋风|狂风|微风|寒风|疾风|顺风|逆风|作风|中风|风湿|风水/g
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# 界面设计(配合右侧「设计工作台」)
|
|
2
2
|
|
|
3
|
-
做网页、App 界面、微信小程序、平板界面、桌面软件、海报 /
|
|
3
|
+
做网页、App 界面、微信小程序、平板界面、桌面软件、海报 / 社媒图、幻灯片、邮件、图表(思维导图、技术路线图、产品路线图、架构图)、组件这类**看得见的设计**时照这份来。目标:一眼看上去像专业设计师做的,不像模板,也没有「AI 味」。
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> 不归这里管:用户只是要把回答做成一页看或用(对比、表格、清单、数据图表、计算器、学习卡片),而你有 `show_page` 工具——直接调 `show_page`,不用这份流程、不写文件、不开预览。思维导图、路线图也一样:只是在对话里随手看一张,`show_page` 有对应模板就用它;用户说要「设计」「做一张好看的」、要导出成图片 / PDF / PPT,或者已经在工作台里做,才按这份做(类型 `diagram`)。
|
|
6
6
|
|
|
7
7
|
## 流程
|
|
8
8
|
|
|
9
9
|
0. **新做一套设计:先问清,先出方向**。
|
|
10
10
|
|
|
11
|
-
-
|
|
11
|
+
- **什么时候跳过**:改已有的设计;做图表(思维导图、路线图、架构图:内容就是需求,不出三个方向,内容没给够只问缺的那部分);用户说了「直接做」「不用问」;或者需求已经够具体——**说了做什么,又列了要哪几屏(幻灯片列了页数或每页内容)就算够具体**,给谁用、什么风格没说也不问,按场景你来定。这时不问、也不出三个方向,第一句话说清你按什么理解开工(「按运动能量风格做首页、详情、购物车三屏」),直接从第 1 步做全套。只有连做什么都说不清时才问,而且只问缺的那一两项。
|
|
12
12
|
|
|
13
13
|
- **问**:只问最关键的两三个问题,一次问完:给谁用、想要什么感觉(给三个具体选项,从工作台的风格卡里挑最合场景的三个,见下面「风格卡」一节)、有没有必须有的内容或品牌色。有 `ask_user_question` 工具就用它问(带选项),没有就在回复里问完、停下等回答。用户说「你定」就按场景替他定。
|
|
14
14
|
- **用户有默认的品牌设计系统**(这份技能末尾「设计系统」一节写着):感觉已经定了,照那一节做,不问感觉、不推风格卡。
|
|
@@ -30,15 +30,16 @@
|
|
|
30
30
|
| `poster` | 1080×1350(4:5),可改 1080×1920 / 1080×1080 | 卡片 | `references/poster.md` |
|
|
31
31
|
| `slides` | 1280×720(16:9) | 卡片 | `references/slides.md` |
|
|
32
32
|
| `email` | 600 宽 | 卡片 | `references/email.md` |
|
|
33
|
+
| `diagram` | 1600×1000 起,图多大画幅跟着多大 | 卡片 | `references/diagram.md`(思维导图、技术路线图、产品路线图、架构图;连线自动排,先读) |
|
|
33
34
|
|
|
34
35
|
细则只在做那一类时再读。
|
|
35
36
|
|
|
36
|
-
2. **先写设计变量**:用户没定风格就先调 `pick_style`(见下面「风格卡」)。在设计目录建 `tokens.css`(起手模板 `tokens.css` 就在这个技能目录里,复制过去再按品牌改;有默认的品牌设计系统就复制它的 `tokens.css` 和 `components.css`),颜色、字体、字号阶梯、间距、圆角、阴影都从这里取。每屏都 `<link rel="stylesheet" href="tokens.css"
|
|
37
|
+
2. **先写设计变量**:用户没定风格就先调 `pick_style`(见下面「风格卡」)。在设计目录建 `tokens.css`(起手模板 `tokens.css` 就在这个技能目录里,复制过去再按品牌改;有默认的品牌设计系统就复制它的 `tokens.css` 和 `components.css`),颜色、字体、字号阶梯、间距、圆角、阴影都从这里取。每屏都 `<link rel="stylesheet" href="tokens.css">`。做图表再把技能目录里的 `diagram.css` 原样复制过去,接在后面引用。之后要统一改风格,改这一个文件,所有屏一起变。
|
|
37
38
|
|
|
38
39
|
3. **一屏一个 HTML 文件,放同一个目录**。新做一套设计时先建这套设计自己的文件夹(英文短名,如 `murmur-landing/`;工作区里已有项目就放在 `design/` 下),`tokens.css`、每一屏都放进去。**不要把文件直接写在工作区最外层**——用户的项目里很可能已经有 `index.html`、`style.css`,会被覆盖。按用户会看的顺序一屏一屏写(画布按创建顺序排:登录 → 首页 → 详情 → …)。文件名用英文小写(`login.html`、`home.html`),`<title>` 写「屏名 · 产品名」,用界面的语言(如「首页 · 梅林练」「Home · Pedal」,每屏的产品名写成一样的):画布上只显示屏名,导出整套展示图时产品名做大标题。临时试验的页面用 `_` 开头(`_test.html`),不会上画布。每屏 `<head>` 里写:
|
|
39
40
|
|
|
40
41
|
```html
|
|
41
|
-
<meta name="dsh-design" content="app"> <!-- 类型;小程序写 miniprogram;Windows 软件写 desktop windows;海报可带尺寸:poster 1080x1920 -->
|
|
42
|
+
<meta name="dsh-design" content="app"> <!-- 类型;小程序写 miniprogram;Windows 软件写 desktop windows;海报可带尺寸:poster 1080x1920;图表写 diagram 1600x1000 -->
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
**几屏共用的东西只写一份**:样式放 `tokens.css` 和一个公共的 `app.css`;图标、书封这类 SVG 放进一个 `icons.svg`(每个图标一个 `<symbol id="…">`),页面里用 `<svg><use href="icons.svg#cart"></use></svg>` 引用——换风格时改一处所有屏一起变,不会漏改。状态栏、标签栏这种 HTML 结构每屏照抄一份,保持一模一样。
|