dsh-design-studio 0.14.0 → 0.16.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 +1 -0
- package/README.md +1 -0
- package/lib/client.js +314 -49
- package/lib/core.js +39 -17
- package/lib/gallery/market.js +23 -1
- package/lib/gallery/pack.js +23 -2
- package/lib/gallery/policy.js +14 -6
- package/lib/gallery/routes.js +3 -3
- package/lib/handoff.js +14 -2
- package/lib/index.js +78 -4
- package/lib/photos-index.json +1 -0
- package/lib/photos.js +265 -0
- package/lib/picker.js +21 -2
- package/lib/tool.js +3 -2
- package/lib/tweaks.js +3 -3
- package/package.json +1 -1
- package/skills/ui-design/SKILL.md +1 -1
package/lib/core.js
CHANGED
|
@@ -31,7 +31,8 @@ const SHELL_TOOL = /^(bash|shell|sh|zsh|powershell|pwsh|exec|run_command|termina
|
|
|
31
31
|
// 放到后台跑的命令(DSH:bash 带 run_in_background,或前台超时转后台)回一个 job id,输出要用 job_output 去读
|
|
32
32
|
const JOB_READ_TOOL = /^(job_output|bash_output|read_job|job_read)$/i
|
|
33
33
|
const BG_JOB = /\bbackground job\s+`?([\w.:-]{3,})/i
|
|
34
|
-
const MAX_SCREENS = 24
|
|
34
|
+
const MAX_SCREENS = 60 // 右侧最多显示几屏,再多的收起来并提示(画布同时只挂 24 屏,见 client.js 的 LIVE_MAX)
|
|
35
|
+
const MAX_ROUTES = 300 // 开发服务器的路由先都记着(只为算出收起了几屏);再多就是写飞了
|
|
35
36
|
|
|
36
37
|
// 设计类型:决定右侧用什么画幅显示(网页框、手机、小程序、平板、桌面软件窗口、海报、幻灯片、邮件)
|
|
37
38
|
export const KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email']
|
|
@@ -64,8 +65,20 @@ export function parseSize(input) {
|
|
|
64
65
|
return `${w}x${h}`
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
/**
|
|
68
|
-
export function listScreens(root) {
|
|
68
|
+
/** 右侧显示的几屏:超过上限时留最新生成的,最早的先收起来。keep:正打开的那屏,不在里面也留着(挤掉最早的一屏) */
|
|
69
|
+
export function listScreens(root, keep = '') {
|
|
70
|
+
const kept = screensByBirth(root).slice(-MAX_SCREENS)
|
|
71
|
+
if (keep && !kept.includes(keep)) { if (kept.length >= MAX_SCREENS) kept.shift(); kept.push(keep) }
|
|
72
|
+
return inManifestOrder(root, kept)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** 目录里所有的屏。按文件名找、改全套的时候用这个,别漏掉收起来的 */
|
|
76
|
+
export function allScreens(root) {
|
|
77
|
+
return inManifestOrder(root, screensByBirth(root))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** 顶层的 HTML 文件,按创建时间(= 模型生成的顺序)排 */
|
|
81
|
+
function screensByBirth(root) {
|
|
69
82
|
let dirents
|
|
70
83
|
try { dirents = fs.readdirSync(root, { withFileTypes: true }) } catch { return [] }
|
|
71
84
|
const out = []
|
|
@@ -80,14 +93,16 @@ export function listScreens(root) {
|
|
|
80
93
|
out.push({ name: d.name, born })
|
|
81
94
|
}
|
|
82
95
|
out.sort((a, b) => a.born - b.born || a.name.localeCompare(b.name))
|
|
83
|
-
|
|
96
|
+
return out.map((x) => x.name)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** 有设计清单(design.json,从设计库来的模板 / 分享过的设计):按清单里的顺序排,清单外的(模型后加的)按创建时间排在后面 */
|
|
100
|
+
function inManifestOrder(root, names) {
|
|
84
101
|
const order = manifestOrder(root)
|
|
85
|
-
if (order.length)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
return out.slice(0, MAX_SCREENS).map((x) => x.name)
|
|
102
|
+
if (!order.length) return names
|
|
103
|
+
const rank = new Map(order.map((f, i) => [f.toLowerCase(), i]))
|
|
104
|
+
const listed = names.filter((x) => rank.has(x.toLowerCase())).sort((a, b) => rank.get(a.toLowerCase()) - rank.get(b.toLowerCase()))
|
|
105
|
+
return [...listed, ...names.filter((x) => !rank.has(x.toLowerCase()))]
|
|
91
106
|
}
|
|
92
107
|
|
|
93
108
|
/** design.json 里 screens 的文件名(读不了、写错了都当没有) */
|
|
@@ -113,7 +128,7 @@ function normRoutes(list) {
|
|
|
113
128
|
if (m) s = m[3] || '/'
|
|
114
129
|
if (!s.startsWith('/')) s = '/' + s
|
|
115
130
|
if (!out.includes(s)) out.push(s)
|
|
116
|
-
if (out.length >=
|
|
131
|
+
if (out.length >= MAX_ROUTES) break
|
|
117
132
|
}
|
|
118
133
|
return out.length ? out : null
|
|
119
134
|
}
|
|
@@ -161,7 +176,7 @@ export function parseTarget(input, cwd = os.homedir()) {
|
|
|
161
176
|
if (st.isDirectory()) {
|
|
162
177
|
// 有 index.html 开它;没有就开最先做的那屏(设计目录一屏一个文件,画布上会把同目录的几屏都排出来)
|
|
163
178
|
const index = path.join(p, 'index.html')
|
|
164
|
-
const first = fs.existsSync(index) ? 'index.html' :
|
|
179
|
+
const first = fs.existsSync(index) ? 'index.html' : allScreens(p)[0]
|
|
165
180
|
if (!first) {
|
|
166
181
|
try { fs.readdirSync(p) } catch (e) { throw new Error(`读不了这个文件夹(${e.code === 'EACCES' || e.code === 'EPERM' ? '没有权限' : e.code || e.message}):${p}`) }
|
|
167
182
|
throw new Error(`这个文件夹里没有 HTML 文件:${p}`)
|
|
@@ -638,19 +653,24 @@ export function createTracker({ open, drafts = null, skipPorts = () => new Set()
|
|
|
638
653
|
|
|
639
654
|
function refreshScreens(st) {
|
|
640
655
|
const t = st.target
|
|
656
|
+
st.hidden = 0
|
|
641
657
|
if (!t) { st.screens = []; return }
|
|
642
658
|
if (t.kind === 'file') {
|
|
643
|
-
const
|
|
659
|
+
const all = allScreens(t.root)
|
|
644
660
|
const me = path.basename(t.file)
|
|
645
|
-
|
|
661
|
+
const found = listScreens(t.root, me)
|
|
646
662
|
// 已经排好的几屏位置不动:编辑器改文件常是写临时文件再换名,创建时间会变,按它重排画布会乱跳
|
|
647
663
|
const list = st.screens.filter((k) => found.includes(k))
|
|
648
664
|
for (const k of found) if (!list.includes(k)) placeScreen(list, k)
|
|
649
|
-
st.screens = list
|
|
665
|
+
st.screens = list
|
|
666
|
+
st.hidden = Math.max(0, all.length + (all.includes(me) ? 0 : 1) - list.length)
|
|
650
667
|
} else {
|
|
651
668
|
const list = st.routes ? [...st.routes] : []
|
|
652
669
|
if (!list.includes(t.path)) list.unshift(t.path)
|
|
653
|
-
|
|
670
|
+
const kept = list.slice(0, MAX_SCREENS)
|
|
671
|
+
if (!kept.includes(t.path)) kept[MAX_SCREENS - 1] = t.path // 正看的这个路由始终在
|
|
672
|
+
st.screens = kept
|
|
673
|
+
st.hidden = list.length - kept.length
|
|
654
674
|
}
|
|
655
675
|
}
|
|
656
676
|
|
|
@@ -705,7 +725,7 @@ export function createTracker({ open, drafts = null, skipPorts = () => new Set()
|
|
|
705
725
|
const t = st.target
|
|
706
726
|
const key = String(focus)
|
|
707
727
|
if (t.kind === 'file') {
|
|
708
|
-
if (!
|
|
728
|
+
if (!allScreens(t.root).includes(key) && key !== path.basename(t.file)) throw new Error(`没有这一屏:${key}`)
|
|
709
729
|
await setTarget(id, { kind: 'file', file: path.join(t.root, key), root: t.root }, { source: st.source, popup: false })
|
|
710
730
|
} else {
|
|
711
731
|
if (!key.startsWith('/')) throw new Error(`路由要以 / 开头:${key}`)
|
|
@@ -1165,6 +1185,8 @@ export function createTracker({ open, drafts = null, skipPorts = () => new Set()
|
|
|
1165
1185
|
origin,
|
|
1166
1186
|
vrev: st.vrev,
|
|
1167
1187
|
focus: file ? path.basename(target.file) : target.path,
|
|
1188
|
+
hidden: st.hidden || 0, // 超过上限收起来的屏数
|
|
1189
|
+
maxScreens: MAX_SCREENS,
|
|
1168
1190
|
screens: st.screens.map((key) => ({
|
|
1169
1191
|
key,
|
|
1170
1192
|
url: file ? `${origin}/${encodeURIComponent(key)}` : origin + key,
|
package/lib/gallery/market.js
CHANGED
|
@@ -281,6 +281,28 @@ export function createMarket({
|
|
|
281
281
|
return buf
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
+
/**
|
|
285
|
+
* 下一个 npm 包,返回 check(文件列表) 的结果(照片库用)。几个源抢着下;check 抛错算这个源失败,接着等别的源。
|
|
286
|
+
* 包内容对不对由调用方按自己钉死的哈希判断,这里不验签名。
|
|
287
|
+
*/
|
|
288
|
+
async function fetchPackage(name, want, { cap = MAX.packs, limits, timing: t, check = (x) => x } = {}) {
|
|
289
|
+
if (!online()) throw new MarketError('off')
|
|
290
|
+
let value
|
|
291
|
+
try {
|
|
292
|
+
({ value } = await race(registries, async (reg, signal) => {
|
|
293
|
+
const info = await lookup(reg, name, want, signal)
|
|
294
|
+
const buf = await download(info, cap, signal)
|
|
295
|
+
return check(untar(buf, limits))
|
|
296
|
+
}, t || timing))
|
|
297
|
+
} catch (e) {
|
|
298
|
+
// 下着下着开了「不联网」:不管几个源各报什么错,都算开关挡的
|
|
299
|
+
if (!online()) throw new MarketError('off')
|
|
300
|
+
throw e
|
|
301
|
+
}
|
|
302
|
+
if (!online()) throw new MarketError('off')
|
|
303
|
+
return value
|
|
304
|
+
}
|
|
305
|
+
|
|
284
306
|
/** 解析、验签名、查格式和 serial;过了返回 index(不写盘) */
|
|
285
307
|
function accept(bytes, sig, { floor = state().serial } = {}) {
|
|
286
308
|
if (!keys.length) throw new MarketError('nokeys')
|
|
@@ -619,5 +641,5 @@ export function createMarket({
|
|
|
619
641
|
return r === base || r.startsWith(base + path.sep) || r.startsWith(path.resolve(stageDir) + path.sep)
|
|
620
642
|
}
|
|
621
643
|
|
|
622
|
-
return { view, refresh, maybeRefresh, abort, entry, thumbFile, stage, shotFile, strictHtml, isStaging, state, url: (e) => e.submission || `${REPO_URL}/tree/main/${e.type === 'system' ? 'systems' : e.type === 'style' ? 'styles' : 'templates'}/${e.id}` }
|
|
644
|
+
return { fetchPackage, view, refresh, maybeRefresh, abort, entry, thumbFile, stage, shotFile, strictHtml, isStaging, state, url: (e) => e.submission || `${REPO_URL}/tree/main/${e.type === 'system' ? 'systems' : e.type === 'style' ? 'styles' : 'templates'}/${e.id}` }
|
|
623
645
|
}
|
package/lib/gallery/pack.js
CHANGED
|
@@ -10,8 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
import fs from 'node:fs'
|
|
12
12
|
import path from 'node:path'
|
|
13
|
-
import { checkPack, normalizeHtml, titleOf, metaKind, message, LIMITS, FORMAT, pctBytes, imageInfo } from './policy.js'
|
|
13
|
+
import { cleanPath, checkPack, normalizeHtml, titleOf, metaKind, message, LIMITS, capsOf, FORMAT, pctBytes, imageInfo } from './policy.js'
|
|
14
14
|
import { writeZip } from './zip.js'
|
|
15
|
+
import { isPhotoAsset } from '../photos.js'
|
|
16
|
+
import { decodeEntities } from './html.js'
|
|
17
|
+
|
|
18
|
+
/** 页面文本 → 去掉注释、解开各种转义、全小写,用来判断提没提到某个文件 */
|
|
19
|
+
function refsFold(s) {
|
|
20
|
+
const t = decodeEntities(s.replace(/<!--[\s\S]*?-->/g, ' ').replace(/\/\*[\s\S]*?\*\//g, ' ')).text
|
|
21
|
+
return t
|
|
22
|
+
.replace(/\\([0-9a-f]{1,6})\s?/gi, (m, h) => { const c = parseInt(h, 16); return c > 0 && c <= 0x10ffff ? String.fromCodePoint(c) : m })
|
|
23
|
+
.replace(/%[0-9a-f]{2}/gi, (m) => { try { return decodeURIComponent(m) } catch { return m } })
|
|
24
|
+
.toLowerCase()
|
|
25
|
+
}
|
|
15
26
|
|
|
16
27
|
const PACK_EXT = /\.(html|css|svg|png|jpe?g|webp|gif|avif|json|md)$/i
|
|
17
28
|
const SKIP_DIRS = new Set(['refs', 'exports', 'handoff', 'drafts', 'node_modules', 'dist', 'build'])
|
|
@@ -237,7 +248,7 @@ export function packDesign(root, { screens, version = '', license = '', author =
|
|
|
237
248
|
const { files: picked, skipped, tooBig } = collectDesign(root)
|
|
238
249
|
const notes = []
|
|
239
250
|
const errors = []
|
|
240
|
-
if (tooBig) errors.push({ code: 'count', n: '2000+', max:
|
|
251
|
+
if (tooBig) errors.push({ code: 'count', n: '2000+', max: capsOf(mode).files, sev: 'error' })
|
|
241
252
|
const screenSet = new Set(screens.map((s) => s.toLowerCase()))
|
|
242
253
|
let existing = null
|
|
243
254
|
const files = []
|
|
@@ -276,8 +287,18 @@ export function packDesign(root, { screens, version = '', license = '', author =
|
|
|
276
287
|
files.push({ path: f.path, data })
|
|
277
288
|
}
|
|
278
289
|
}
|
|
290
|
+
// 自带照片库的图:找图时多拿的、页面没用上的不打包。宁可多带:页面里(解码后)提到这个文件名就留,注释里的不算
|
|
291
|
+
const refText = files.filter((f) => /\.(html|css|svg)$/i.test(f.path)).map((f) => refsFold(Buffer.from(f.data).toString('utf8'))).join('\n')
|
|
292
|
+
const dropped = new Set()
|
|
293
|
+
for (let i = files.length - 1; i >= 0; i--) {
|
|
294
|
+
const f = files[i]
|
|
295
|
+
if (!isPhotoAsset(f.path)) continue
|
|
296
|
+
if (refText.includes(path.posix.basename(f.path).toLowerCase())) notes.push({ code: 'aiPhoto', x: f.path })
|
|
297
|
+
else { skipped.push(f.path); dropped.add(f.path.toLowerCase()); files.splice(i, 1) }
|
|
298
|
+
}
|
|
279
299
|
const order = screens.filter((s) => htmls.has(s))
|
|
280
300
|
const manifest = buildManifest({ existing, screens: order, htmls, version, license, author, title, description, shareHash })
|
|
301
|
+
if (dropped.size && Array.isArray(manifest.assets)) manifest.assets = manifest.assets.filter((x) => !(x && typeof x.path === 'string' && dropped.has(String(cleanPath(x.path) || x.path).toLowerCase())))
|
|
281
302
|
files.unshift({ path: 'design.json', data: Buffer.from(JSON.stringify(manifest, null, 2) + '\n', 'utf8') })
|
|
282
303
|
const r = checkPack(files, { mode })
|
|
283
304
|
// 只该留在作者电脑上的东西(分享记号):哪个文件里有都拦
|
package/lib/gallery/policy.js
CHANGED
|
@@ -16,8 +16,11 @@ import { scanCss, cssTokens, URL_FUNCS } from './css.js'
|
|
|
16
16
|
|
|
17
17
|
export const FORMAT = 1
|
|
18
18
|
export const LIMITS = {
|
|
19
|
-
files: 60, //
|
|
20
|
-
screens: 24, //
|
|
19
|
+
files: 60, // 市场里一套最多几个文件(分享、审核)
|
|
20
|
+
screens: 24, // 市场里一套最多几屏(分享、审核)
|
|
21
|
+
localFiles: 200, // 自己打 zip、导入 zip 的上限(屏数和工作台一样)
|
|
22
|
+
localScreens: 60,
|
|
23
|
+
localTotal: 5 * 1024 * 1024,
|
|
21
24
|
depth: 3, // 目录最多几层
|
|
22
25
|
html: 200 * 1024,
|
|
23
26
|
css: 200 * 1024,
|
|
@@ -29,6 +32,10 @@ export const LIMITS = {
|
|
|
29
32
|
total: 2 * 1024 * 1024,
|
|
30
33
|
name: 64, // 文件名长度
|
|
31
34
|
}
|
|
35
|
+
/** 这个模式下的数量上限:进市场的(share / ci)严,只在自己手上的(zip / install)宽 */
|
|
36
|
+
export const capsOf = (mode) => (mode === 'share' || mode === 'ci'
|
|
37
|
+
? { files: LIMITS.files, screens: LIMITS.screens, total: LIMITS.total }
|
|
38
|
+
: { files: LIMITS.localFiles, screens: LIMITS.localScreens, total: LIMITS.localTotal })
|
|
32
39
|
export const TYPES = ['template', 'system', 'style']
|
|
33
40
|
export const LICENSES = ['CC0-1.0', 'CC-BY-4.0']
|
|
34
41
|
export const KINDS = ['web', 'app', 'miniprogram', 'tablet', 'desktop', 'poster', 'slides', 'email']
|
|
@@ -1247,7 +1254,7 @@ export function checkManifest(m, { mode = 'install', vocab = null } = {}) {
|
|
|
1247
1254
|
if (m.size !== undefined && !/^\d{3,4}x\d{3,4}$/.test(String(m.size))) bad('size', '写成 1080x1920 这样')
|
|
1248
1255
|
if (m.os !== undefined && !['mac', 'windows'].includes(m.os)) bad('os', '只能是 mac / windows')
|
|
1249
1256
|
if (!Array.isArray(m.screens) || !m.screens.length) bad('screens', '至少一屏')
|
|
1250
|
-
else if (m.screens.length >
|
|
1257
|
+
else if (m.screens.length > capsOf(mode).screens) bad('screens', `最多 ${capsOf(mode).screens} 屏`)
|
|
1251
1258
|
else {
|
|
1252
1259
|
const seen = new Set()
|
|
1253
1260
|
m.screens.forEach((s, i) => {
|
|
@@ -1269,7 +1276,7 @@ export function checkManifest(m, { mode = 'install', vocab = null } = {}) {
|
|
|
1269
1276
|
if (m.lang !== undefined && !['zh', 'en', 'both'].includes(m.lang)) bad('lang', '只能是 zh / en / both')
|
|
1270
1277
|
if (m.dark !== undefined && typeof m.dark !== 'boolean') bad('dark', '要是 true / false')
|
|
1271
1278
|
if (m.assets !== undefined) {
|
|
1272
|
-
if (!Array.isArray(m.assets) || m.assets.length >
|
|
1279
|
+
if (!Array.isArray(m.assets) || m.assets.length > capsOf(mode).files) bad('assets', '要是列表')
|
|
1273
1280
|
else m.assets.forEach((a, i) => {
|
|
1274
1281
|
if (!isObj(a) || typeof a.path !== 'string' || !cleanPath(a.path)) return bad(`assets[${i}]`, '要有 path(包里的图片)')
|
|
1275
1282
|
if (!['self', 'cc0', 'pd'].includes(a.source)) bad(`assets[${i}].source`, 'self(自己做的)/ cc0 / pd(公有领域)')
|
|
@@ -1372,8 +1379,9 @@ export function checkPack(files, { mode = 'install', vocab = null } = {}) {
|
|
|
1372
1379
|
bytes += size
|
|
1373
1380
|
list.push({ path: p, ext, kind, data: f.data, size })
|
|
1374
1381
|
}
|
|
1375
|
-
|
|
1376
|
-
if (
|
|
1382
|
+
const caps = capsOf(mode)
|
|
1383
|
+
if (list.length > caps.files) err({ code: 'count', n: list.length, max: caps.files })
|
|
1384
|
+
if (bytes > caps.total) err({ code: 'total', n: kb(bytes), max: kb(caps.total) })
|
|
1377
1385
|
|
|
1378
1386
|
const texts = new Map()
|
|
1379
1387
|
for (const f of list) {
|
package/lib/gallery/routes.js
CHANGED
|
@@ -16,7 +16,7 @@ import fs from 'node:fs'
|
|
|
16
16
|
import os from 'node:os'
|
|
17
17
|
import path from 'node:path'
|
|
18
18
|
import { execFile } from 'node:child_process'
|
|
19
|
-
import { listScreens } from '../core.js'
|
|
19
|
+
import { listScreens, allScreens } from '../core.js'
|
|
20
20
|
import { parseMeta, metaOfFile, KIND_SIZE, prepare } from '../look.js'
|
|
21
21
|
import { packDesign, zipOf, splitTitle } from './pack.js'
|
|
22
22
|
import { PERSONAL_CODES } from './policy.js'
|
|
@@ -215,7 +215,7 @@ export function createLibraryRoutes({ admit, readBody, json, tracker, library, i
|
|
|
215
215
|
const snap = body.session ? tracker.snapshot(String(body.session)) : null
|
|
216
216
|
const open = snap && snap.target && snap.target.kind === 'file' && path.resolve(snap.target.root) === dir
|
|
217
217
|
if (!open && !byDir(dir)) return json(res, 404, { error: 'not a design here' })
|
|
218
|
-
const screens =
|
|
218
|
+
const screens = allScreens(dir) // 打包按整套算:屏数超了要明确报,不能悄悄少几屏
|
|
219
219
|
if (!screens.length) return json(res, 400, { error: 'noScreens' })
|
|
220
220
|
const local = localManifest(dir)
|
|
221
221
|
// 分享向导先要一份预填:名字、介绍、授权、分享过没有
|
|
@@ -265,7 +265,7 @@ export function createLibraryRoutes({ admit, readBody, json, tracker, library, i
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
flags.sort((a, b) => Number(PERSONAL_CODES.has(b.code)) - Number(PERSONAL_CODES.has(a.code))) // 个人信息的提醒排最前面
|
|
268
|
-
const out = { ok: p.ok, errors: p.errors.slice(0, 60), more: Math.max(0, p.errors.length - 60), flags: flags.slice(0, 30), flagsMore: Math.max(0, flags.length - 30), notes: p.notes.slice(0, 60), skipped: p.skipped, bytes: p.bytes, title: p.manifest.title, screens: p.manifest.screens.length }
|
|
268
|
+
const out = { ok: p.ok, errors: p.errors.slice(0, 60), more: Math.max(0, p.errors.length - 60), flags: flags.slice(0, 30), flagsMore: Math.max(0, flags.length - 30), notes: p.notes.filter((x) => x.code !== 'aiPhoto').slice(0, 60), aiPhotos: p.notes.filter((x) => x.code === 'aiPhoto').length, skipped: p.skipped, bytes: p.bytes, title: p.manifest.title, screens: p.manifest.screens.length }
|
|
269
269
|
if (!p.ok) return json(res, 200, out)
|
|
270
270
|
try {
|
|
271
271
|
fs.mkdirSync(downloads, { recursive: true })
|
package/lib/handoff.js
CHANGED
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
* 回一张「设计稿 | 做出来的 | 差异」拼图、差了多少,和差得最多的几块分别是哪个元素。
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { PHOTO_PREFIX, isPhotoAsset } from './photos.js'
|
|
12
13
|
import fs from 'node:fs'
|
|
13
14
|
import os from 'node:os'
|
|
14
15
|
import path from 'node:path'
|
|
15
16
|
import { pathToFileURL } from 'node:url'
|
|
16
17
|
import { prepare } from './look.js'
|
|
17
|
-
import {
|
|
18
|
+
import { allScreens } from './core.js'
|
|
18
19
|
import { readTweaks, shownValue } from './tweaks.js'
|
|
19
20
|
import { tokensOf } from './system.js'
|
|
20
21
|
|
|
@@ -179,6 +180,15 @@ export function within(p, root) {
|
|
|
179
180
|
return a === b || a.startsWith(b.endsWith(path.sep) ? b : b + path.sep)
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
/** 把允许的目录当场解析成真实路径钉住,返回判断函数(之后目录被换成软链,边界也不跟着变) */
|
|
184
|
+
export function pinRoots(roots) {
|
|
185
|
+
const pins = roots.filter(Boolean).map((r) => fold(realish(r)))
|
|
186
|
+
return (p) => {
|
|
187
|
+
const a = fold(realish(p))
|
|
188
|
+
return pins.some((b) => a === b || a.startsWith(b.endsWith(path.sep) ? b : b + path.sep))
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
182
192
|
/**
|
|
183
193
|
* 代码放进 dest 时算哪个项目:dest 自己就是项目就用它;不是、但已经在某个项目里面(比如选了它的 src/pages)→ 用往上最近的那个
|
|
184
194
|
* (往上找到家目录为止,家目录本身不算:有人在家目录放 package.json;还不存在的目录不往上找:那是要新建的项目)
|
|
@@ -516,6 +526,8 @@ export function handoffMd({ root, rows, kind, size, framework, dest, project, sy
|
|
|
516
526
|
walk(root, '', 0)
|
|
517
527
|
lines.push('## 图片和字体', '')
|
|
518
528
|
lines.push(assets.length ? `- ${assets.slice(0, 30).map((a) => `\`${a}\``).join('、')}${assets.length > 30 ? ' …' : ''}:照原样复制进项目的静态资源目录(${mini ? (uni ? `\`${at}static/\`` : taro ? `\`${at}assets/\`` : `\`${at}images/\` 之类`) : 'public/ 或 src/assets/'})` : '- 没有单独的图片、字体文件(图形都写在 HTML / SVG 里)。')
|
|
529
|
+
const aiPhotos = assets.filter((x) => isPhotoAsset(x))
|
|
530
|
+
if (aiPhotos.length) lines.push(`- 文件名带 \`${PHOTO_PREFIX}\` 的 ${aiPhotos.length} 张是 AI 生成的示意图:先照常接上,做完提醒用户上线前换成真实照片。`)
|
|
519
531
|
if (mini) lines.push(`- 小程序主包不能超过 2MB:大图放服务器用网址;字体文件要用 \`${api}.loadFontFace\` 从网址加载,加载不了就用系统字体。`)
|
|
520
532
|
lines.push('')
|
|
521
533
|
|
|
@@ -827,5 +839,5 @@ export async function compareScreens(browser, { design, impl, size, at = 'top',
|
|
|
827
839
|
|
|
828
840
|
/** 设计目录里的几屏(交接、对比时按文件名找) */
|
|
829
841
|
export function screensOf(root) {
|
|
830
|
-
return
|
|
842
|
+
return allScreens(root)
|
|
831
843
|
}
|
package/lib/index.js
CHANGED
|
@@ -53,6 +53,7 @@ import { createInspiration } from './inspire.js'
|
|
|
53
53
|
import { createLibraryRoutes } from './gallery/routes.js'
|
|
54
54
|
import { createMarket } from './gallery/market.js'
|
|
55
55
|
import { createMarketRoutes } from './gallery/market-routes.js'
|
|
56
|
+
import { createPhotos, loadPhotoIndex, searchPhotos, onlyByTheme, isPhotoAsset, orientOf, MAX_PHOTOS } from './photos.js'
|
|
56
57
|
import { createTracker, parseTarget, findRule, KINDS } from './core.js'
|
|
57
58
|
import { createDrafts } from './draft.js'
|
|
58
59
|
import { createHistory } from './history.js'
|
|
@@ -63,7 +64,7 @@ import { createBrowser } from './browser.js'
|
|
|
63
64
|
import { designOf, fitSize, metaOfFile, sizeOf, pickScreens, measureAll, shootAll, cropIssues, formatMeasure, issueSnapshot, formatShots, whereOf, MAX_SCREENS, MAX_SIZES, MAX_SHOTS, MAX_CROPS } from './look.js'
|
|
64
65
|
import { SYSTEMS_DIR, extractSystem, listSystems, setDefault, skillSection } from './system.js'
|
|
65
66
|
import { readTweaks, applyTweaks, lintTweaks } from './tweaks.js'
|
|
66
|
-
import { FRAMEWORKS, detectProject, projectFor, defaultFramework, buildHandoff, compareScreens, implUrl, defaultDest, pickedDest, within } from './handoff.js'
|
|
67
|
+
import { FRAMEWORKS, detectProject, projectFor, defaultFramework, buildHandoff, compareScreens, implUrl, defaultDest, pickedDest, within, pinRoots } from './handoff.js'
|
|
67
68
|
|
|
68
69
|
export const name = 'dsh-design-studio'
|
|
69
70
|
export const inject = ['webServer']
|
|
@@ -89,7 +90,7 @@ const SKILL_RANK = 600 // 和 DSH 自带的技能同一档;用户 / 项目里
|
|
|
89
90
|
* 几行之间靠这个互通(同一个包里的模块 Node 只加载一次):工作台起来后放 tracker、无头浏览器(browser);
|
|
90
91
|
* 「自动打开预览」那行开着时 autoOpen > 0
|
|
91
92
|
*/
|
|
92
|
-
export const studio = { tracker: null, autoOpen: 0, offline: 0, check: null, browser: null, market: null, log: () => {} }
|
|
93
|
+
export const studio = { tracker: null, autoOpen: 0, offline: 0, check: null, browser: null, market: null, photos: null, sessionCwd: null, log: () => {} }
|
|
93
94
|
|
|
94
95
|
/** 设计技能:模型做界面设计时加载(DSH 的 skill 工具),也能让用户手动调 */
|
|
95
96
|
export const designSkill = {
|
|
@@ -169,8 +170,9 @@ export const previewTool = {
|
|
|
169
170
|
const st = await tracker.setTarget(id, target, opts)
|
|
170
171
|
const what = target.kind === 'file' ? target.file : `localhost:${target.port}${target.path}`
|
|
171
172
|
const many = target.kind === 'file' ? '同目录再写别的 HTML 文件,会作为新的一屏并排出现。' : ''
|
|
173
|
+
const over = st.hidden ? `右侧最多显示 ${st.screens.length} 屏,还有 ${st.hidden} 屏没显示。` : ''
|
|
172
174
|
return {
|
|
173
|
-
text: `已在右侧「设计工作台」打开 ${what}。${target.kind === 'file' ? '这个目录里的文件一改就自动刷新。' + many : '开发服务器的热更新照常生效。'}`,
|
|
175
|
+
text: `已在右侧「设计工作台」打开 ${what}。${target.kind === 'file' ? '这个目录里的文件一改就自动刷新。' + many : '开发服务器的热更新照常生效。'}${over}`,
|
|
174
176
|
url: st.url,
|
|
175
177
|
}
|
|
176
178
|
},
|
|
@@ -502,6 +504,69 @@ export const handoffTool = {
|
|
|
502
504
|
},
|
|
503
505
|
}
|
|
504
506
|
|
|
507
|
+
const ORIENT = { landscape: '横图', portrait: '竖图', square: '方图' }
|
|
508
|
+
|
|
509
|
+
/** find_photos 工具:从自带照片库按描述找图,复制进设计目录(图用本地文件,分享、导出、离线预览都带得走) */
|
|
510
|
+
export const photoTool = {
|
|
511
|
+
name: 'find_photos',
|
|
512
|
+
description:
|
|
513
|
+
'从设计台自带的照片库里按描述找照片,复制进设计目录的 assets/,返回能直接写进 HTML 的相对路径和替代文字。' +
|
|
514
|
+
'民宿酒店、餐饮、奶茶咖啡、健身、美妆、服饰、教育、旅行风景这类靠照片说话的设计,需要头图、封面、商品图时用,别画插画冒充照片。' +
|
|
515
|
+
'库里是 AI 生成的示意图;用户给了自己的照片就用用户的。',
|
|
516
|
+
parameters: specToJsonSchema({
|
|
517
|
+
query: { type: 'string', required: true, description: '要什么样的照片,中文英文都行,带上题材和画面,如「民宿 卧室」「奶茶 手拿」「gym interior」' },
|
|
518
|
+
dir: { type: 'string', description: '这套设计的文件夹(绝对路径或相对会话目录),图放进它的 assets/。不填用正在预览的设计目录' },
|
|
519
|
+
count: { type: 'number', description: `要几张,1–${MAX_PHOTOS},默认 3` },
|
|
520
|
+
ratio: { type: 'string', enum: Object.keys(ORIENT), description: 'landscape 横图、portrait 竖图、square 方图;不够时会补别的比例(用 object-fit: cover 裁)' },
|
|
521
|
+
}),
|
|
522
|
+
output: {
|
|
523
|
+
schema: { type: 'object', additionalProperties: false, properties: { text: { type: 'string' } }, required: ['text'] },
|
|
524
|
+
render: (_args, value) => [{ type: 'text', text: value.text }],
|
|
525
|
+
},
|
|
526
|
+
async execute(args, exec) {
|
|
527
|
+
const id = toolSession(exec, '找照片')
|
|
528
|
+
const a = args || {}
|
|
529
|
+
const photos = studio.photos
|
|
530
|
+
if (!photos) return { text: '这个版本的设计台没带照片库。这次用 CSS / SVG 画,并告诉用户这里需要一张什么样的照片。' }
|
|
531
|
+
const query = typeof a.query === 'string' ? a.query.trim() : ''
|
|
532
|
+
if (!query) return { text: 'query 不能空:写要什么样的照片,如「民宿 卧室」。' }
|
|
533
|
+
const cwd = studio.sessionCwd ? await studio.sessionCwd(id) : studio.tracker.cwdOf(id)
|
|
534
|
+
const t = studio.tracker.stateOf(id).target
|
|
535
|
+
const root = t && t.kind === 'file' ? t.root : ''
|
|
536
|
+
const dir = typeof a.dir === 'string' && a.dir.trim() ? resolvePath(a.dir, cwd) : root
|
|
537
|
+
if (!dir) return { text: '不知道放哪:先建好这套设计的文件夹,把路径写进 dir。' }
|
|
538
|
+
const allowed = pinRoots([cwd, root])
|
|
539
|
+
if (!allowed(dir)) return { text: `${dir} 不在会话目录(${cwd})里,图不能放那儿。放进这套设计自己的文件夹。` }
|
|
540
|
+
const ratio = Object.hasOwn(ORIENT, a.ratio) ? a.ratio : ''
|
|
541
|
+
const search = (used) => searchPhotos(photos.index, { query, ratio, count: a.count, used, seed: dir })
|
|
542
|
+
// 先搜一遍:库里没有就不用下载
|
|
543
|
+
if (!search(new Set()).length) {
|
|
544
|
+
const names = Object.values(photos.index.themes).map((x) => x.label).join('、')
|
|
545
|
+
return { text: `库里没有符合「${query}」的照片。现有题材:${names}。换个说法再找;实在没有就用 CSS / SVG 画,并告诉用户这里需要一张什么样的照片。` }
|
|
546
|
+
}
|
|
547
|
+
try {
|
|
548
|
+
const placed = await photos.provide({ dir, allowed, pick: search })
|
|
549
|
+
const want = Math.min(MAX_PHOTOS, Math.max(1, Math.floor(Number(a.count)) || 3))
|
|
550
|
+
const broad = onlyByTheme(photos.index, { query })
|
|
551
|
+
const few = !broad && placed.length < want ? `具体画面只找到这 ${placed.length} 张;要更多就只写题材再搜一次。\n` : ''
|
|
552
|
+
const list = placed.map(({ p, rel }, i) => `${i + 1}. ${rel}(${ORIENT[orientOf(p.w, p.h)]} ${p.w}×${p.h})alt:${p.alt} / ${p.altEn}`)
|
|
553
|
+
return {
|
|
554
|
+
text:
|
|
555
|
+
`${broad ? `按题材找到 ${placed.length} 张(没有和「${query}」里具体画面对得上的标签,看描述合不合适再用;不合适就用 CSS / SVG 画,并告诉用户这里需要什么样的照片)` : `找到 ${placed.length} 张`},已放进 ${path.join(dir, 'assets')}:\n${list.join('\n')}\n${few}` +
|
|
556
|
+
'这是按关键词找的,先看上面的描述和需求对不对得上,对不上的别用(没用上的图不会进分享包)。\n' +
|
|
557
|
+
'用法:<img src="assets/文件名" alt="…"> 配 object-fit: cover;alt 按界面语言选一个;HTML 不在这个文件夹时改相对路径。\n' +
|
|
558
|
+
'这些是 AI 生成的示意图,不是用户真实的店铺或产品:别写「实拍」,也别把图上的场景当事实写进文案;做完告诉用户上线前换成真实照片。',
|
|
559
|
+
}
|
|
560
|
+
} catch (e) {
|
|
561
|
+
studio.log(e)
|
|
562
|
+
if (e && e.code === 'off') return { text: '「设计库不联网」开着,照片库下载不了。这次用 CSS / SVG 画,并告诉用户:关掉这个开关就能用自带照片。' }
|
|
563
|
+
if (e && e.code === 'link') return { text: `${path.join(dir, 'assets')} 指向了这个文件夹外面,图不能放那儿。` }
|
|
564
|
+
if (e && /^(EACCES|EPERM|EROFS|ENOTDIR|EEXIST|ENOSPC)$/.test(e.code || '')) return { text: `${path.join(dir, 'assets')} 写不进去(${e.code})。换一个文件夹,或者这次用 CSS / SVG 画。` }
|
|
565
|
+
return { text: '照片库这会儿下载不了(网络问题)。这次先用 CSS / SVG 画,并告诉用户这里需要一张什么样的照片,稍后可以再试。' }
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
}
|
|
569
|
+
|
|
505
570
|
/** compare_design 工具:设计稿的一屏和做出来的页面按同样尺寸截图,逐像素比 */
|
|
506
571
|
export const compareTool = {
|
|
507
572
|
name: 'compare_design',
|
|
@@ -711,9 +776,15 @@ export function apply(ctx) {
|
|
|
711
776
|
studio.tracker = tracker
|
|
712
777
|
studio.log = log
|
|
713
778
|
studio.market = market
|
|
779
|
+
const photoIndex = loadPhotoIndex()
|
|
780
|
+
const photos = photoIndex ? createPhotos({ market, index: photoIndex, log }) : null
|
|
781
|
+
studio.photos = photos
|
|
782
|
+
studio.sessionCwd = sessionCwd
|
|
714
783
|
return () => {
|
|
715
784
|
if (studio.tracker === tracker) { studio.tracker = null; studio.log = () => {} }
|
|
716
785
|
if (studio.market === market) { market.abort(); studio.market = null }
|
|
786
|
+
if (studio.photos === photos) studio.photos = null
|
|
787
|
+
if (studio.sessionCwd === sessionCwd) studio.sessionCwd = null
|
|
717
788
|
}
|
|
718
789
|
}, 'dsh-design-studio: tracker')
|
|
719
790
|
// check_design / look_design 用的无头浏览器:用到时才开,闲置自己关,这一行停用时关掉
|
|
@@ -1045,7 +1116,10 @@ export function apply(ctx) {
|
|
|
1045
1116
|
const strict = library.strictHtml(page) || (v > 0 && library.strictVersions(t.root))
|
|
1046
1117
|
const nonce = strict ? crypto.randomBytes(16).toString('base64') : ''
|
|
1047
1118
|
const lead = strict ? strictMeta(nonce) + ERR_CATCHER.replace('<script>', `<script nonce="${nonce}">`) : ERR_CATCHER
|
|
1048
|
-
|
|
1119
|
+
let html = bundle(strict ? defang(page.toString('utf8')) : page.toString('utf8'), { key, read, base: href, lead, tail: inlinePicker(fs.readFileSync(PICKER_FILE, 'utf8'), parent, href, nonce) })
|
|
1120
|
+
// 打包后图片变成 data: 地址,文件名没了:把用到的 AI 示意图记在页面里,导出时照样提醒
|
|
1121
|
+
const aiNames = [...deps].filter((x) => isPhotoAsset(x)).map((x) => path.basename(x))
|
|
1122
|
+
if (aiNames.length) html = html.replace(lead, () => `${lead}<meta name="ddp-ai-photos" content="${aiNames.join(',').replace(/[^a-z0-9.,-]/gi, '')}">`)
|
|
1049
1123
|
// 用到的文件太多就不列(null = 右侧栏不按文件筛,目录里一有改动就重新打包)
|
|
1050
1124
|
json(res, 200, { html, deps: deps.size > 200 ? null : [...deps], strict })
|
|
1051
1125
|
} catch (e) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"format":1,"package":"dsh-design-photos","version":"1.0.0","generic":["特写","俯拍","内景","环境","细节","产品","店内","门店","一排","现代","航拍","质地","工具","外观","器械","器具","瓶子","罐子","手","手部","手拿","早晨","清晨","傍晚","黄昏","日出","interior","detail","product","store","shop","room","row","modern","texture","tools","equipment","exterior","aerial","view","table","hand","hands","bottle","bottles","jar","city","street"],"themes":{"hotel":{"label":"民宿酒店","words":["民宿","酒店","客栈","旅馆","住宿","宾馆","度假村","hotel","homestay","guesthouse","inn","resort","bnb","lodging","airbnb"]},"food":{"label":"餐饮","words":["餐饮","餐厅","饭店","美食","外卖","小吃","restaurant","food","dining","bistro","meal"]},"drink":{"label":"奶茶咖啡","words":["奶茶","咖啡","茶饮","饮品","咖啡馆","咖啡店","milk tea","coffee","cafe","bubble tea","beverage","tea shop","drink"]},"fitness":{"label":"健身","words":["健身","运动","撸铁","训练","减脂","gym","fitness","workout","training","sport"]},"beauty":{"label":"美妆","words":["美妆","护肤","化妆","美容","spa","beauty","skincare","cosmetics","makeup"]},"fashion":{"label":"服饰","words":["服饰","服装","穿搭","女装","男装","时尚","潮牌","fashion","clothing","apparel","streetwear"]},"education":{"label":"教育","words":["教育","学校","培训","课程","学习","学生","考研","留学","education","school","course","learning","student","university","study","tutoring"]},"scenery":{"label":"旅行风景","words":["风景","旅行","旅游","景点","山水","户外","徒步","露营","攻略","travel","scenery","tourism","nature","outdoor","hiking","camping","trip"]}},"photos":[{"id":"hotel-01","theme":"hotel","w":1200,"h":800,"size":138410,"sha256":"254e3ccd9006699d70babb67de7d02d5ad8a5e8fbea87a693771ebdc09ba81f3","alt":"山村民宿的卧室,亚麻床品,窗外晨雾","altEn":"Guesthouse bedroom in a mountain village with linen bedding and morning mist outside","tags":["卧室","客房","床","山景","乡村","木梁","bedroom","room","bed","village","rustic"]},{"id":"hotel-02","theme":"hotel","w":1200,"h":800,"size":151540,"sha256":"875107fd24349f61872e1db0208a2a15372ac70b11ff883b8d9c21f3eb3073dc","alt":"黄昏的民宿庭院,石板路和灯笼","altEn":"Guesthouse courtyard at dusk with stone paths and warm lanterns","tags":["庭院","院子","灯笼","黄昏","外观","古建","courtyard","lantern","dusk","exterior"]},{"id":"hotel-03","theme":"hotel","w":1200,"h":800,"size":90673,"sha256":"cd1bec0acb2ae0f1153621ae8ee3a26868e6a4242f82ba97711600f55e194657","alt":"现代酒店客房,落地窗外是城市","altEn":"Modern hotel room with a floor-to-ceiling window over the city","tags":["客房","卧室","城市","落地窗","现代","商务","room","bedroom","city","modern","business"]},{"id":"hotel-04","theme":"hotel","w":1200,"h":800,"size":175642,"sha256":"be2a98ed8f7e18cf39a1ccff7206a86b2db96325f6ba800e1f36a7d6bda32a7f","alt":"木露台上的茶桌,远处是梯田","altEn":"Wooden terrace with a tea table overlooking terraced hills","tags":["露台","阳台","茶","梯田","山景","terrace","balcony","tea","view","hills"]},{"id":"hotel-05","theme":"hotel","w":800,"h":1200,"size":149771,"sha256":"c907907c200b3a9fb3b44932b155b1b1ce8bf40288e3b0aee171f448030cf05c","alt":"窗边的石头浴缸和叠好的毛巾","altEn":"Stone bathtub by a window with folded towels","tags":["浴缸","卫浴","浴室","毛巾","bathtub","bathroom","bath","towel"]},{"id":"hotel-06","theme":"hotel","w":800,"h":1200,"size":130691,"sha256":"a1f098558d2958fc6781a98de5c389e37421d1c097f363462dbf14ee5e9e378c","alt":"挂着纸灯笼的木楼梯","altEn":"Narrow wooden staircase lit by paper lanterns","tags":["楼梯","灯笼","走廊","stairs","staircase","lantern","hallway"]},{"id":"hotel-07","theme":"hotel","w":1200,"h":1200,"size":153618,"sha256":"678682eb63697ac25bb7e3a44a30e668d8969eb862352bed9afce59c01db0f79","alt":"白色床铺上的早餐托盘","altEn":"Breakfast tray on a neatly made white bed","tags":["早餐","床","托盘","咖啡","breakfast","bed","tray"]},{"id":"hotel-08","theme":"hotel","w":1200,"h":1200,"size":170165,"sha256":"39ace7f0e89341ba37ef412320d092b07bf2d452effd48603044ec96bf3c9a43","alt":"床头柜上的台灯、书和陶杯","altEn":"Bedside table with a lamp, a book and a ceramic cup","tags":["床头","台灯","细节","陶杯","bedside","lamp","detail"]},{"id":"food-01","theme":"food","w":1200,"h":800,"size":179909,"sha256":"f6d1f46c3ef49baa75941b9d4c7fe36c94948e1699c60bb2ce609dc5d0dfbe9a","alt":"俯拍一桌家常中餐","altEn":"Overhead view of a family-style Chinese dinner table","tags":["中餐","家常菜","私房菜","一桌菜","俯拍","聚餐","chinese","family","table","dinner"]},{"id":"food-02","theme":"food","w":1200,"h":800,"size":100584,"sha256":"6a621918cf96f86efc213756c975d7e39563f37ce5074906000bde60194a7497","alt":"灯光温暖的餐厅内景,餐桌已摆好","altEn":"Warmly lit restaurant interior with set tables","tags":["餐厅","内景","环境","餐桌","店内","interior","restaurant","table"]},{"id":"food-03","theme":"food","w":1200,"h":800,"size":102091,"sha256":"1384312b05a6a3f4a264954bdc6f351aad93d5e9e7991a39b033f0bde9005173","alt":"后厨里厨师的手在摆盘意面","altEn":"Chef plating pasta in a professional kitchen","tags":["厨师","摆盘","后厨","意面","西餐","chef","plating","kitchen","pasta","western"]},{"id":"food-04","theme":"food","w":1200,"h":800,"size":177275,"sha256":"922b252f6227d20713b0ece2af6701476e879064f58b0c7cf954346891aa31a3","alt":"沸腾的火锅和周围的新鲜食材","altEn":"Bubbling hot pot surrounded by fresh ingredients","tags":["火锅","火锅店","涮","食材","红汤","hotpot","hot pot","ingredients"]},{"id":"food-05","theme":"food","w":800,"h":1200,"size":103614,"sha256":"65e3f17e151413bb6be67658578eeb6ca05d315f76479558fc2deb505a932762","alt":"热气腾腾的牛肉面特写","altEn":"Close-up of a steaming bowl of beef noodles","tags":["牛肉面","面条","汤面","面馆","特写","noodles","noodle","beef","soup"]},{"id":"food-06","theme":"food","w":800,"h":1200,"size":115618,"sha256":"2a58fa11c6a6bf6149df5b41c72e62a023ef98049e629a8e82bb4f6944ed6403","alt":"木板上的汉堡和薯条","altEn":"Burger and fries on a wooden board","tags":["汉堡","薯条","快餐","burger","fries","fast food"]},{"id":"food-07","theme":"food","w":1200,"h":1200,"size":199114,"sha256":"d02b785684da1a847daa8667b0b30c05950e11ad30d0b496463b20daaad11ef7","alt":"黑色石板上的寿司拼盘","altEn":"Sushi platter on dark slate","tags":["寿司","日料","拼盘","sushi","japanese","platter"]},{"id":"food-08","theme":"food","w":1200,"h":1200,"size":165741,"sha256":"01ccc4d288fa8e108b9b43e45ce25a9ad7e7b1756732c99dc62b6e83dac1fd5b","alt":"陶瓷盘里的莓果蛋糕","altEn":"A slice of berry cake on a ceramic plate","tags":["蛋糕","甜品","莓果","烘焙","cake","dessert","bakery","berry"]},{"id":"drink-01","theme":"drink","w":1200,"h":800,"size":83245,"sha256":"6b2f994c2fa581142407a1b59f6a22422ba5405e6c5f61ded29149485d5c6f2d","alt":"咖啡师在吧台倒拉花","altEn":"Barista pouring latte art at a cafe counter","tags":["拉花","拿铁","咖啡师","吧台","barista","latte art","counter"]},{"id":"drink-02","theme":"drink","w":1200,"h":800,"size":116279,"sha256":"8b7318ca0ebc446a8234565523ed003d72ad24cd5193ba943c83657bc39c992b","alt":"明亮的奶茶店内景","altEn":"Bright pastel milk tea shop interior","tags":["门店","店内","内景","环境","奶茶店","interior","shop","store"]},{"id":"drink-03","theme":"drink","w":1200,"h":800,"size":87990,"sha256":"98b0e59030215cb8029b4d64eb85e86c046f355d79a615536d2307067f9a8298","alt":"吧台上一排冰果茶","altEn":"A row of iced fruit teas on a counter","tags":["果茶","水果茶","冰饮","一排","fruit tea","iced","row"]},{"id":"drink-04","theme":"drink","w":1200,"h":800,"size":107263,"sha256":"5c78d9b6706418f35553c2ef3311ffb98ec87bc4999e4bb6d259571536416af7","alt":"木桌上的手冲壶和咖啡豆","altEn":"Pour-over kettle and coffee beans on a wooden table","tags":["手冲","咖啡豆","器具","pour over","beans","kettle"]},{"id":"drink-05","theme":"drink","w":800,"h":1200,"size":79773,"sha256":"2f9bdc9ff80e7cc24da045dd27d5c933184ad9c1ac544d97c27c7ac7ff89e02a","alt":"手拿黑糖珍珠奶茶","altEn":"Hand holding brown sugar boba milk tea","tags":["珍珠","黑糖","手拿","奶茶","boba","brown sugar","hand"]},{"id":"drink-06","theme":"drink","w":800,"h":1200,"size":98633,"sha256":"62fc1f3ff153abd6fc8ccb148106575611ec347b9d3cce14dfa4547a2c5aad2b","alt":"阳光窗台上的冰美式","altEn":"Iced americano on a sunny window ledge","tags":["美式","冰咖啡","窗台","americano","iced"]},{"id":"drink-07","theme":"drink","w":1200,"h":1200,"size":201635,"sha256":"dc4e7c353cc0801b48fd742116139364844dd84fe04f753c7d1c8a12fd60b94f","alt":"俯拍抹茶拿铁","altEn":"Matcha latte from above with leaf art","tags":["抹茶","拿铁","俯拍","matcha","latte"]},{"id":"drink-08","theme":"drink","w":1200,"h":1200,"size":164754,"sha256":"4e30afa6d0583578241c22a7d2ad00d8e434187b3ed5a4bd35c1127e03a65686","alt":"挂着水珠的冰柠檬茶特写","altEn":"Iced lemon tea close up with condensation","tags":["柠檬茶","柠檬","冰饮","特写","lemon","iced tea"]},{"id":"fitness-01","theme":"fitness","w":1200,"h":800,"size":154138,"sha256":"f0aad68474bfa60297bb24a1cc64cf7c569826cf6aea49374f0006029fda924b","alt":"晨光里的现代健身房","altEn":"Empty modern gym with racks in morning light","tags":["健身房","器械","内景","环境","gym","interior","equipment"]},{"id":"fitness-02","theme":"fitness","w":1200,"h":800,"size":99682,"sha256":"2eee4f39fe1fc3032cacbfeeba2aa4c77ddb237d4e36ec849d4830114f87b6ba","alt":"坐在长凳上系鞋带的运动员","altEn":"Athlete tying shoes on a bench","tags":["系鞋带","运动员","准备","athlete","shoes","bench"]},{"id":"fitness-03","theme":"fitness","w":1200,"h":800,"size":97032,"sha256":"64b228ad2dd03e044acbf899441ee344afb004efcef379f0c6d018aba4cb761d","alt":"安静的瑜伽教室和卷好的垫子","altEn":"Quiet yoga studio with rolled mats","tags":["瑜伽","瑜伽垫","教室","普拉提","yoga","mat","studio","pilates"]},{"id":"fitness-04","theme":"fitness","w":1200,"h":800,"size":117122,"sha256":"25a01fda03949e17d14e8d38eb15d84cd0e8990711e9e42a0cbba8819648ca46","alt":"日出时山脊上的越野跑者","altEn":"Trail runner on a ridge at sunrise","tags":["跑步","越野","户外","日出","runner","running","trail","sunrise"]},{"id":"fitness-05","theme":"fitness","w":800,"h":1200,"size":66573,"sha256":"4699daa0a7d29889ce167bb0c366da4d99d671ae367b83fb7a457b8b1d42e39e","alt":"一排哑铃,浅景深","altEn":"A rack of dumbbells","tags":["哑铃","力量","器械","dumbbell","weights","strength"]},{"id":"fitness-06","theme":"fitness","w":800,"h":1200,"size":101974,"sha256":"47b55918170ca812f862798185ffeae49e7152fe7a47f459d7a0b239e4dc051a","alt":"背对镜头做引体向上","altEn":"Person doing pull-ups, seen from behind","tags":["引体向上","力量","训练","背部","pull up","training","back"]},{"id":"fitness-07","theme":"fitness","w":1200,"h":1200,"size":168091,"sha256":"94423411396abd5dd8ee12983eedf9213b30cfc7216c9cbc58db4781b9f1beb9","alt":"橡胶地板上的壶铃和毛巾","altEn":"Kettlebell and a folded towel on a gym floor","tags":["壶铃","毛巾","kettlebell","towel"]},{"id":"fitness-08","theme":"fitness","w":1200,"h":1200,"size":223754,"sha256":"40dd77d270cc485312442af4e4ef413787d13af663ace08ce763187fcfab1ae3","alt":"鸡肉米饭蔬菜的健身餐盒","altEn":"Meal prep box with chicken, rice and greens","tags":["健身餐","减脂餐","餐盒","饮食","meal prep","diet","nutrition"]},{"id":"beauty-01","theme":"beauty","w":1200,"h":800,"size":79141,"sha256":"2dbce4d80476c8dab61239d9b0f729a62a3ba1e79233bebdbaa80d04aa3a2e09","alt":"石板上的无标签护肤瓶","altEn":"Unlabeled skincare bottles on a stone slab","tags":["护肤品","瓶子","产品","skincare","bottles","product"]},{"id":"beauty-02","theme":"beauty","w":1200,"h":800,"size":173538,"sha256":"b5aad48a96e4e2c5cb3116542d0da3b992b6ae3ecf48176a6d2cc94feb7c51bc","alt":"明亮的美发沙龙内景","altEn":"Bright hair salon interior with mirrors and chairs","tags":["沙龙","美发","理发店","内景","环境","salon","hair","interior"]},{"id":"beauty-03","theme":"beauty","w":1200,"h":800,"size":122012,"sha256":"a20af994a9de2e79b695ceaaff1d97618ed75551b288f16f3db54a86bee55966","alt":"浅色布面上的化妆刷和口红","altEn":"Makeup brushes and a lipstick on pale fabric","tags":["化妆刷","口红","彩妆","makeup","brushes","lipstick"]},{"id":"beauty-04","theme":"beauty","w":1200,"h":800,"size":142878,"sha256":"97729a6131f254d69bd5102bb04767304a14bf478cc1c924341b9ca2f5e510ae","alt":"石板上的一抹面霜,质地特写","altEn":"A smear of face cream on a stone slab, macro","tags":["面霜","质地","特写","护肤","cream","texture","swatch"]},{"id":"beauty-05","theme":"beauty","w":800,"h":1200,"size":48775,"sha256":"616b0022012ad2290b444f2b0790e980231c1d6546c84a9342c6f732f170b0ce","alt":"琥珀色精华滴管瓶","altEn":"Amber serum dropper bottle with a falling drop","tags":["精华","滴管","产品","serum","dropper","bottle"]},{"id":"beauty-06","theme":"beauty","w":800,"h":1200,"size":133940,"sha256":"0de9e8acbbeea878a29ecd4fe7d99ade20606843cb98a9a844b7ed9bae0c674f","alt":"理发台上的梳子、剪刀和喷壶","altEn":"Comb, scissors and a spray bottle on a salon counter","tags":["美发","梳子","剪刀","工具","hair","comb","scissors","tools"]},{"id":"beauty-07","theme":"beauty","w":1200,"h":1200,"size":148218,"sha256":"2590ae92b4a5c683bb21fc1cac69c074e7c4abe91b9334b18476bb5b7f1ccd60","alt":"俯拍打开的面霜罐","altEn":"Open cream jar from above","tags":["面霜","罐子","质地","cream","jar","texture"]},{"id":"beauty-08","theme":"beauty","w":1200,"h":1200,"size":169318,"sha256":"2fb0adc2d4fc6dd121e0b5497def5039430695546cebabe4599a3a7e17e20868","alt":"亚麻布上几瓶裸色系指甲油","altEn":"Unlabeled nail polish bottles in neutral shades on linen","tags":["美甲","指甲油","瓶子","nail","polish","manicure"]},{"id":"fashion-01","theme":"fashion","w":1200,"h":800,"size":133856,"sha256":"263ff2d11876c035db2b6296b7f759f49159dc8fe88786c7efa1eee7c16345f4","alt":"安静的买手店内景和衣架","altEn":"Calm boutique interior with garment rails","tags":["门店","买手店","衣架","内景","环境","boutique","store","interior","rack"]},{"id":"fashion-02","theme":"fashion","w":1200,"h":800,"size":144129,"sha256":"f0ae6d3f91802b0bd6d680cba86e62bce29b99d68655e008671ca7c8659805c7","alt":"木桌上叠好的针织衫","altEn":"Stack of folded knitwear on a wooden table","tags":["针织","毛衣","叠放","knitwear","sweater","folded"]},{"id":"fashion-03","theme":"fashion","w":1200,"h":800,"size":104779,"sha256":"cb259f548056ded0c70cf8d7944b2b3e09303cf109f09142fa8acac1f5c04756","alt":"穿长大衣走在街头,只拍颈部以下","altEn":"Person in a long coat on a city street, cropped from the neck down","tags":["大衣","街拍","穿搭","秋冬","coat","street","outfit"]},{"id":"fashion-04","theme":"fashion","w":1200,"h":800,"size":147191,"sha256":"20bb7f62d2edcb3ad8d98d8470c8121bd68e998207be07cc699a3e3c372cd253","alt":"水泥台阶上的白色运动鞋","altEn":"White sneakers on a concrete step","tags":["鞋","运动鞋","小白鞋","球鞋","鞋子","鞋店","sneakers","shoes"]},{"id":"fashion-05","theme":"fashion","w":800,"h":1200,"size":53324,"sha256":"f227a5ed7b7472343b6fc2bbe1eb405086e1c7c5623ae49b271c119f89374574","alt":"纯色背景前的一身穿搭,只拍颈部以下","altEn":"Full outfit against a plain backdrop, cropped from the neck down","tags":["穿搭","全身","棚拍","模特","outfit","lookbook","model"]},{"id":"fashion-06","theme":"fashion","w":800,"h":1200,"size":94625,"sha256":"021615dfb09d9ee2fcccc7075d917382b526f72c0f4a4afbc8d388f2fdd57ced","alt":"木椅上的皮质手提包","altEn":"Leather handbag on a wooden chair","tags":["包","包包","手提包","皮具","handbag","bag","leather"]},{"id":"fashion-07","theme":"fashion","w":1200,"h":1200,"size":307215,"sha256":"c664bee71b338d211bcda5785aed281bfc91ef22954ab45387b30624ae5a86f6","alt":"牛仔布和缝线微距","altEn":"Denim fabric and stitching, macro","tags":["牛仔","面料","细节","denim","fabric","detail"]},{"id":"fashion-08","theme":"fashion","w":1200,"h":1200,"size":186512,"sha256":"92efbae6cc39e04c746ec1c1a6c9cf02aab3786d92dec3492a35ecd93fa39ce8","alt":"手腕上的极简手表","altEn":"Minimal watch on a wrist","tags":["手表","配饰","手腕","watch","accessory","wrist"]},{"id":"education-01","theme":"education","w":1200,"h":800,"size":109110,"sha256":"4347848477c27cbe5b9687d9480098de33e1193deb9d312af829e7618d8726a4","alt":"明亮的空教室和干净的黑板","altEn":"Bright empty classroom with a clean board","tags":["教室","课桌","黑板","classroom","desks","board"]},{"id":"education-02","theme":"education","w":1200,"h":800,"size":130299,"sha256":"67e1a6081bb41148de95cf363155953c98cceba86d4126c29dc35264ddedfd19","alt":"图书馆书架间看书的学生,背对镜头","altEn":"Students reading among tall library shelves, seen from behind","tags":["图书馆","书架","阅读","library","shelves","reading"]},{"id":"education-03","theme":"education","w":1200,"h":800,"size":99192,"sha256":"9d0805006ed8e5c20c75ef895ce60726124cdf1c856cf708ddb19c68a340c216","alt":"书桌上的笔记本、电脑和咖啡","altEn":"Study desk with an open notebook, a laptop and coffee","tags":["书桌","笔记本","自习","网课","线上课","desk","notebook","laptop","online"]},{"id":"education-04","theme":"education","w":1200,"h":800,"size":129687,"sha256":"05d33e1266ff46f7cf65d24bfb67106f6f90200cffb738ca54c8a2f4cd5ee66a","alt":"孩子的手在用彩铅画画","altEn":"Child drawing with colored pencils","tags":["少儿","画画","彩铅","美术","child","kids","drawing","art"]},{"id":"education-05","theme":"education","w":800,"h":1200,"size":133474,"sha256":"608c8db6555a748c12113c410b49e649ce5121a0c2a2c8933786971ebe6011c8","alt":"窗边叠放的书","altEn":"Stack of books beside a window","tags":["书","书本","阅读","books","reading"]},{"id":"education-06","theme":"education","w":800,"h":1200,"size":153082,"sha256":"faf4e461a1d475f2dd2d70f4319689223d2aeb4ded40e2553f10ec99ddc99bc1","alt":"背书包走在校园小路上的学生","altEn":"Student with a backpack on a leafy campus path","tags":["校园","书包","学生","大学","campus","backpack","university"]},{"id":"education-07","theme":"education","w":1200,"h":1200,"size":95697,"sha256":"0d0d8661485eefd46a9caf1aaf277e6f20a03e918ba9351cfdd697405640abfd","alt":"手握笔写笔记的特写","altEn":"Hand writing in a notebook, close up","tags":["写字","笔记","手","writing","notes","pen"]},{"id":"education-08","theme":"education","w":1200,"h":1200,"size":132941,"sha256":"f5c0f5500a00e6ec9d08cea7c3dd471b75da3a5bff35b9c820b040f9bbf9514d","alt":"实验室里装着彩色液体的烧杯","altEn":"Laboratory beakers with colored liquids","tags":["实验","科学","烧杯","化学","lab","science","beaker","chemistry"]},{"id":"scenery-01","theme":"scenery","w":1200,"h":800,"size":80724,"sha256":"ab534b36e0122c59e87b9f5bbd800a6c37b9e13844f046f2f307b6ccb9c92de8","alt":"晨雾中的山和小村庄","altEn":"Misty mountains with a small village at dawn","tags":["山","雾","村庄","清晨","mountain","mist","village","dawn"]},{"id":"scenery-02","theme":"scenery","w":1200,"h":800,"size":78867,"sha256":"0a4a9b64924e1030f2e5ba04aba8a98da68619dbf9ae770d48bba47940071c4c","alt":"蓝调时刻的城市天际线","altEn":"City skyline at blue hour","tags":["城市","天际线","夜景","city","skyline","night"]},{"id":"scenery-03","theme":"scenery","w":1200,"h":800,"size":171114,"sha256":"fa5d995378aa9ea21e1d92d865dffc4acf54ca8f20284d266f4962b3597a850c","alt":"航拍碧绿海滩","altEn":"Aerial view of a turquoise beach","tags":["海","海滩","海边","海景","海岛","航拍","sea","beach","island","aerial"]},{"id":"scenery-04","theme":"scenery","w":1200,"h":800,"size":290900,"sha256":"52186e49dc6e69a091339dfb6faf8f1b3619e3f9ade601b618bd8ba70bb73e57","alt":"秋天的林间小路","altEn":"Forest path in autumn","tags":["森林","秋天","小路","树林","forest","autumn","path"]},{"id":"scenery-05","theme":"scenery","w":800,"h":1200,"size":197974,"sha256":"586dcc78beecce178555c48660e93b335461bdc470fe86cf9d98b45c985a9b98","alt":"绿色峡谷里的瀑布","altEn":"Waterfall in a green gorge","tags":["瀑布","峡谷","水","waterfall","gorge"]},{"id":"scenery-06","theme":"scenery","w":800,"h":1200,"size":170992,"sha256":"05f8b352c265d20478053a816c7f680a528f8282bea0abeef4ef97f8cd68c0a3","alt":"傍晚挂红灯笼的古镇小巷","altEn":"Old town alley with red lanterns in the evening","tags":["古镇","小巷","灯笼","傍晚","old town","alley","lantern"]},{"id":"scenery-07","theme":"scenery","w":1200,"h":1200,"size":125041,"sha256":"9a2dc0b3b834a711b7e7e57ec65c6e8ee59fdfddc5a37b0cce8d015ba640d65d","alt":"光影分明的沙漠沙丘","altEn":"Desert dunes with long shadows","tags":["沙漠","沙丘","desert","dunes"]},{"id":"scenery-08","theme":"scenery","w":1200,"h":1200,"size":149955,"sha256":"23505c6428e0f686fb999d3a18045ceb324ca6bdc6249dd5c61adbd5a8284bb0","alt":"平静湖面上的木船和倒影","altEn":"Calm lake with a wooden boat and its reflection","tags":["湖","船","倒影","lake","boat","reflection"]}]}
|