dsh-design-studio 0.25.1 → 0.25.2
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/lib/client.js +5 -0
- package/lib/styles.js +24 -6
- package/package.json +1 -1
- package/skills/ui-design/SKILL.md +1 -1
package/lib/client.js
CHANGED
|
@@ -3811,10 +3811,15 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
3811
3811
|
// 「北欧风」「清新风:首页…」「中国风的界面」算说了风格;先去掉「通风」「台风」「新风系统」「风控」「风景」这类不是风格的词
|
|
3812
3812
|
const NOT_STYLE_FENG = /通风|台风|新风(系统|机|量)|风险|风控|风景|风扇|风味|风暴|风光|风速|风向|风筝|风铃|风车|吹风|防风|挡风|避风|屏风|旋风|狂风|微风|寒风|疾风|顺风|逆风|作风|中风|风湿|风水/g
|
|
3813
3813
|
const SAID_STYLE = /风格|配色|色调|主色|色系|[红橙黄绿青蓝紫粉黑白灰棕金银米]色|蓝白|黑白|黑金|红白|绿白|深色|浅色|暗色|亮色|[^\s。,,、::;;((]风|\b(style|styled|aesthetic|vibe|palette|colou?r scheme|look and feel|dark|light)\b/i
|
|
3814
|
+
// 像申报书、开题 / 结题报告那种图就不附风格卡(默认用 diagram.css 的「申报书炫酷样式」);模型调 pick_style 时卡和这条一起给,由模型照原话判断。规则和 lib/styles.js 的 isProposal 一样
|
|
3815
|
+
const PROPOSAL = /申报|课题|开题|结题|基金|申请书|教学成果|育人模式|人才培养方案|研究框架|研究思路|\b(grant|research|thesis) proposals?\b|\bgrant applications?\b/i
|
|
3816
|
+
const DIAGRAM_WORD = /图|路线|框架|架构|\b(diagrams?|roadmaps?|frameworks?|charts?)\b/i
|
|
3817
|
+
const isProposal = (s, kind) => PROPOSAL.test(s) && (kind === 'diagram' || (!kind && DIAGRAM_WORD.test(s)))
|
|
3814
3818
|
function autoStyle(text, kind) {
|
|
3815
3819
|
const s = String(text || '')
|
|
3816
3820
|
if (!s.trim()) return null
|
|
3817
3821
|
if (kind === 'dshplugin' || kind === 'framed') return null // DSH 插件默认用 DSH 自己的样子(外框的 --dsh-* 变量),不替它挑风格卡
|
|
3822
|
+
if (isProposal(s, kind)) return null // 申报书那种图默认用炫酷样式,不挑风格卡
|
|
3818
3823
|
const said = s.replace(NOT_STYLE_FENG, ' ')
|
|
3819
3824
|
if (SAID_STYLE.test(said) || STYLES.some((x) => said.includes(x.zh) || new RegExp(`\\b${x.en}\\s+(style|look|theme|aesthetic|vibe)\\b`, 'i').test(said))) return null
|
|
3820
3825
|
const by = (id) => STYLES.find((x) => x.id === id) || null
|
package/lib/styles.js
CHANGED
|
@@ -134,10 +134,20 @@ export const AUTO_SPREAD = ['minimal', 'editorial', 'playful', 'fresh', 'tech',
|
|
|
134
134
|
// 「北欧风」「清新风:首页…」「中国风的界面」算说了风格;先去掉「通风」「台风」「新风系统」「风控」「风景」这类不是风格的词
|
|
135
135
|
export const NOT_STYLE_FENG = /通风|台风|新风(系统|机|量)|风险|风控|风景|风扇|风味|风暴|风光|风速|风向|风筝|风铃|风车|吹风|防风|挡风|避风|屏风|旋风|狂风|微风|寒风|疾风|顺风|逆风|作风|中风|风湿|风水/g
|
|
136
136
|
export const SAID_STYLE = /风格|配色|色调|主色|色系|[红橙黄绿青蓝紫粉黑白灰棕金银米]色|蓝白|黑白|黑金|红白|绿白|深色|浅色|暗色|亮色|[^\s。,,、::;;((]风|\b(style|styled|aesthetic|vibe|palette|colou?r scheme|look and feel|dark|light)\b/i
|
|
137
|
+
// 申报书、开题 / 结题报告那种图:默认用 diagram.css 的「申报书炫酷样式」fx-*,不按题材挑风格卡(不然「社区阅读推广」会被「阅读」挑成杂志风)。
|
|
138
|
+
// 这里只粗看「像不像」:像就首页不附卡,模型调 pick_style 时卡和「申报书图用炫酷样式」一起给,由模型照原话判断(「个税申报流程图」照用卡),猜错也只是多调一次
|
|
139
|
+
export const PROPOSAL = /申报|课题|开题|结题|基金|申请书|教学成果|育人模式|人才培养方案|研究框架|研究思路|\b(grant|research|thesis) proposals?\b|\bgrant applications?\b/i
|
|
140
|
+
export const DIAGRAM_WORD = /图|路线|框架|架构|\b(diagrams?|roadmaps?|frameworks?|charts?)\b/i
|
|
141
|
+
/** 像不像申报书那种图:类型选了「图表」,或者没选类型、话里说了要画图 */
|
|
142
|
+
export function isProposal(text, kind) {
|
|
143
|
+
const s = String(text || '')
|
|
144
|
+
return PROPOSAL.test(s) && (kind === 'diagram' || (!kind && DIAGRAM_WORD.test(s)))
|
|
145
|
+
}
|
|
137
146
|
export function autoStyle(text, kind) {
|
|
138
147
|
const s = String(text || '')
|
|
139
148
|
if (!s.trim()) return null
|
|
140
149
|
if (kind === 'dshplugin' || kind === 'framed') return null // DSH 插件默认用 DSH 自己的样子(外框的 --dsh-* 变量),不替它挑风格卡
|
|
150
|
+
if (isProposal(s, kind)) return null // 申报书那种图默认用炫酷样式,不挑风格卡
|
|
141
151
|
const said = s.replace(NOT_STYLE_FENG, ' ')
|
|
142
152
|
if (SAID_STYLE.test(said) || STYLES.some((x) => said.includes(x.zh) || new RegExp(`\\b${x.en}\\s+(style|look|theme|aesthetic|vibe)\\b`, 'i').test(said))) return null
|
|
143
153
|
return topicStyle(s, kind)
|
|
@@ -188,17 +198,25 @@ export function pickStyles(subject, kind, count = 1) {
|
|
|
188
198
|
return out
|
|
189
199
|
}
|
|
190
200
|
|
|
201
|
+
// 像申报书那种图时 pick_style 回复的开头:卡照给,由模型照原话判断用不用
|
|
202
|
+
const PROPOSAL_NOTE = {
|
|
203
|
+
zh: '先看用户要的是什么图:申报书、开题报告、结题报告、教学成果奖、人才培养方案里的框架图、模式图、路线图(技术路线图、研究流程图、研究框架图、育人模式图这类)不用下面的风格卡,默认用申报书炫酷样式——照 references/diagram.md「申报书炫酷样式 fx-*」做(部件都在 diagram.css 里,深浅色、导出、字号都调好了);这时别把下面卡的配色和字体写进 tokens.css,开工第一句说用的是「申报书炫酷样式」。用户要素净、黑白印刷、投期刊论文就照用户的;用户定了风格或配色,定了的那部分照用户的。别的(报告里的统计图、讲申请或审核手续怎么办的流程图,或者网页、海报、幻灯片)照下面的风格卡做。',
|
|
204
|
+
en: `First check what the user wants: a framework, model or roadmap diagram for a grant / research proposal, a research project's opening or final report, a teaching-achievement award or a training program (research roadmap, research workflow, research framework and the like) does not use the style card below; use the proposal style by default: follow references/diagram.md, section "申报书炫酷样式 fx-*" (the parts are in diagram.css, with light/dark, export and font sizes already tuned). In that case do not copy the card's colors and fonts into tokens.css, and say in your first sentence that you are using the proposal style. If the user wants it plain, black-and-white for print, or for a journal paper, follow the user; if the user already named a style or colors, keep what they named. Anything else (data charts in a report, flowcharts of an application or review procedure, or a web page, poster or slides) uses the style card below.`,
|
|
205
|
+
}
|
|
206
|
+
|
|
191
207
|
/** pick_style 工具的返回文字 */
|
|
192
208
|
export function pickStyleText(subject, kind, count = 1) {
|
|
193
209
|
const en = !/[一-鿿]/.test(String(subject))
|
|
210
|
+
const head = isProposal(subject, kind) ? (en ? PROPOSAL_NOTE.en : PROPOSAL_NOTE.zh) + '\n\n' : '' // 像申报书那种图:先说清什么时候不用卡,卡照给
|
|
211
|
+
const els = head ? (en ? 'For the kinds that use the card' : '照卡做的那类') : (en ? 'Otherwise' : '否则') // 有开头那段时,收尾只管照卡做的那类,别和开头打架
|
|
194
212
|
const list = pickStyles(subject, kind, count)
|
|
195
213
|
const cards = list.map((x, i) => (list.length > 1 ? `${en ? 'Direction' : '方向'} ${'ABC'[i]}: ` : '') + cardText(x, en)).join('\n\n')
|
|
196
214
|
if (list.length > 1) {
|
|
197
|
-
return en
|
|
198
|
-
? `${cards}\n\nIf the user already chose a specific style or colors, follow them and do not use these cards.
|
|
199
|
-
: `${cards}\n\n
|
|
215
|
+
return head + (en
|
|
216
|
+
? `${cards}\n\nIf the user already chose a specific style or colors, follow them and do not use these cards. ${els}: each direction keeps its own colors and fonts: write the variables inside that page's own <style>. Create the shared tokens.css only after the user has chosen. Do not swap them for a beige or cream look. Say briefly what style each direction is.`
|
|
217
|
+
: `${cards}\n\n用户已经定了具体风格或配色的话,照用户的来,不用这些卡。${els}:每个方向用各自的配色和字体,变量写在各自页面的 <style> 里;用户挑定以后再建公共的 tokens.css。别换成米色、奶油底。用一两句话说清每个方向是什么风格。`)
|
|
200
218
|
}
|
|
201
|
-
return en
|
|
202
|
-
? `${cards}\n\nIf the user already chose a specific style or colors, follow them and do not use this card.
|
|
203
|
-
: `${cards}\n\n
|
|
219
|
+
return head + (en
|
|
220
|
+
? `${cards}\n\nIf the user already chose a specific style or colors, follow them and do not use this card. ${els}: put these colors and fonts into tokens.css first and build the whole set with them. Do not swap them for a beige or cream look. In your first sentence, tell the user which style you are using; it is easy to change if they do not like it.`
|
|
221
|
+
: `${cards}\n\n用户已经定了具体风格或配色的话,照用户的来,不用这张卡。${els}:先把这些配色和字体定进 tokens.css,整套照它做,别换成米色、奶油底。第一句话告诉用户用的是哪个风格,不喜欢可以换。`)
|
|
204
222
|
}
|
package/package.json
CHANGED
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
|
|
165
165
|
## 风格卡
|
|
166
166
|
|
|
167
|
-
用户没定具体风格时(消息里没有〔风格〕,也没说具体的风格或配色;只说「你定」「帮我推荐一个」「出几个风格挑」都算没定),**开工前先调 `pick_style`**:`subject` 写用户的原话,`kind` 写类型;要先出三个方向时 `count` 填 3,每个方向一张,变量写在各自页面里,用户挑定后才建 tokens.css;只做一套就照返回的配色和字体定进 tokens.css
|
|
167
|
+
用户没定具体风格时(消息里没有〔风格〕,也没说具体的风格或配色;只说「你定」「帮我推荐一个」「出几个风格挑」都算没定),**开工前先调 `pick_style`**:`subject` 写用户的原话,`kind` 写类型;要先出三个方向时 `count` 填 3,每个方向一张,变量写在各自页面里,用户挑定后才建 tokens.css;只做一套就照返回的配色和字体定进 tokens.css。开工第一句点名(「风格:运动能量」)。别跳过它自己定,自己定基本都会落回米色。申报书、开题 / 结题报告里的框架图、模式图、路线图例外:不挑风格卡,默认用 `references/diagram.md` 的「申报书炫酷样式」;报告里的统计图照常调 `pick_style`。
|
|
168
168
|
|
|
169
169
|
下面这张表是换卡用的:用户说不喜欢,就按题材另挑一张。**换卡也先按题材往下挑,别先想米色**:米色暖调的四张(温暖手作、奶油风、日系原木、中式雅致)只在用户点名,或题材离不开(手作、烘焙、茶馆、书店)时才用;民宿、餐饮、电商、SaaS、金融、运动、活动这些题材都有更合适的卡。
|
|
170
170
|
|