dsh-design-studio 0.25.3 → 0.27.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 -1
- package/README.md +1 -1
- package/lib/browser.js +19 -0
- package/lib/client.js +574 -34
- package/lib/handoff.js +73 -42
- package/lib/htmlpack.js +693 -0
- package/lib/impl.js +123 -0
- package/lib/index.js +279 -38
- package/lib/picker.js +136 -0
- package/lib/serve.js +4 -2
- package/lib/slot.js +37 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -42,7 +42,7 @@ If DSH can't reach the npm registry, it falls back to a mirror in China. To upda
|
|
|
42
42
|
- **Open what you have:** click "Browse…" on the empty page to pick an HTML file, or drop an HTML file or folder onto the sidebar (desktop app); you can also type a path or a dev-server port.
|
|
43
43
|
- **Design check:** one click finds overflowing text, low contrast, small tap targets and tiny text, marked right on the page. In Design mode the model also checks its own work and fixes what it finds.
|
|
44
44
|
- **Versions and compare:** every turn is saved; drag a slider to compare, and go back to any version.
|
|
45
|
-
- **Export and phone preview:** showcase images, PDF and PowerPoint (links between screens still work); scan a QR code to see it on your phone at real size. Slides and posters larger than the default canvas now use the page's real size. You can also set it by adding `WIDTHxHEIGHT` after the type, for example `<meta name="dsh-design" content="slides 1440x810">`. Export options let you pick the page size (16:9, 4:3, A3 landscape or custom), what each page shows (one screen, full page or a set height) and two screens per page. If anything would be cut off, you get a checklist first, with a one-click fix that fits the canvas to the content.
|
|
45
|
+
- **Export and phone preview:** showcase images, PDF and PowerPoint (links between screens still work), or a clickable HTML demo that opens with a double-click (device frame included, ready to send to a client); scan a QR code to see it on your phone at real size. Slides and posters larger than the default canvas now use the page's real size. You can also set it by adding `WIDTHxHEIGHT` after the type, for example `<meta name="dsh-design" content="slides 1440x810">`. Export options let you pick the page size (16:9, 4:3, A3 landscape or custom), what each page shows (one screen, full page or a set height) and two screens per page. If anything would be cut off, you get a checklist first, with a one-click fix that fits the canvas to the content.
|
|
46
46
|
- **Diagrams:** mind maps, technical route charts (the kind in grant proposals and theses), product roadmaps and system architecture diagrams. Lines, branches and arrows are laid out for you and re-flow when you change text or add nodes; colors follow the design style, and a high-resolution PNG or PDF export drops straight into Word or PowerPoint. For grant-proposal and final-report frameworks, the model first lists how the parts relate (which problem maps to which task) for you to confirm, then draws labelled arrows between the blocks, in a bold 3D-gradient "proposal" style by default or after a reference image you give it.
|
|
47
47
|
- **DSH plugins:** design a plugin inside the real DSH desktop frame (left sidebar entry, settings section, session tab or right sidebar panel, in light and dark). Only the plugin area is designed, so you see exactly how it looks once installed; the design check warns if the frame gets changed.
|
|
48
48
|
- **Design library and gallery:** everything you've designed, plus saved references and styles, lives in the Library. Browse templates, design systems and style cards others shared, and "Start from this" copies one for you to keep editing. Share your own with "Share to the gallery": it's checked, zipped and submitted on a web page, and listed once reviewed. The gallery catalog comes from npm mirrors and is used only when its signature and checksums match; to keep it offline, turn on "Design library offline" on the Plugins page.
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
- **打开已有的页面**:首页输入框左边的「+」→「打开已有的 HTML…」选一个,或把 HTML 文件 / 文件夹拖进右侧栏就能预览(桌面版);也能输路径或开发服务器端口。
|
|
43
43
|
- **设计体检**:一键查文字溢出、对比度不够、按钮太小、字太小,问题直接标在页面上;模型做完也会自己查一遍再改。
|
|
44
44
|
- **版本和对比**:每轮自动存一版,左右拖动对比,随时回到任意一版。
|
|
45
|
-
- **导出和手机上看**:导出展示图、PDF、PPT
|
|
45
|
+
- **导出和手机上看**:导出展示图、PDF、PPT(屏和屏之间的跳转照样能点),或一个双击就能开的 HTML 演示(带外壳、点得动,发给客户直接看);扫码在手机上按真机尺寸看。页面比默认画幅大的幻灯片、海报,画幅自动跟页面走;也可以在类型后面跟 `宽x高` 指定,比如 `<meta name="dsh-design" content="slides 1440x810">`。导出选项里可以选版面(16:9、4:3、A3 横向、自定义)、每页取景(一屏、整页、指定高度)和每页拼 2 屏;有内容会被裁时,导出前先给一张清单,可以一键按内容改画幅。
|
|
46
46
|
- **图表**:思维导图、技术路线图(申报书、开题报告那种)、产品路线图、系统架构图。连线、分叉、箭头自动排好,改字、加节点自己重排;配色跟着设计风格走,导出高清 PNG 或 PDF 贴进 Word / PPT。申报书、结题报告的框架图先帮你理清「哪个问题对应哪项内容」请你确认再画,版块之间画出带关系词的箭头;默认是立体渐变的「申报书炫酷样式」,也能照你给的参考图画。
|
|
47
47
|
- **DSH 插件**:给 DSH 做插件界面时,四周直接套上 DSH 桌面端的外框(左侧栏入口、设置分区、会话标签页、右侧栏面板四个位置,浅色、深色都有),只设计插件那一块,一眼看出装进 DSH 是什么样;外框被改了体检会提醒。
|
|
48
48
|
- **设计库和设计市场**:以前做过的设计、收的参考图和风格都在「设计库」里;市场里逛大家分享的模板、设计系统和风格卡,点「用这个开始」复制一份接着改。自己做的点「分享到设计市场」,查过打成 zip,在网页里交上去,审过就上架。市场目录从 npm 镜像取,签了名、核对过才用;不想让它联网,在插件页打开「设计库不联网」。
|
package/lib/browser.js
CHANGED
|
@@ -265,6 +265,25 @@ export function createBrowser({ bin = findBrowser(), log = () => {}, idleMs = ID
|
|
|
265
265
|
// 换深浅色媒体(prefers-color-scheme),不重开页面:存外框时浅色、深色都在真的媒体环境下量
|
|
266
266
|
media: (dk) => c('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: dk ? 'dark' : 'light' }, { name: 'prefers-reduced-motion', value: 'reduce' }] }),
|
|
267
267
|
mouse: (x, y) => c('Input.dispatchMouseEvent', { type: 'mouseMoved', x, y }), // 把鼠标挪到页面上某处(测「鼠标停在外框上」用)
|
|
268
|
+
// 在页面里最后一个子 iframe 里跑一段(沙盒、不透明源的也行:开一个隔离环境,DOM 是同一份)。测 HTML 演示包用
|
|
269
|
+
frameEval: async (expression) => {
|
|
270
|
+
const { frameTree } = await c('Page.getFrameTree')
|
|
271
|
+
const kids = frameTree.childFrames || []
|
|
272
|
+
let r
|
|
273
|
+
if (kids.length) {
|
|
274
|
+
const { executionContextId } = await c('Page.createIsolatedWorld', { frameId: kids[kids.length - 1].frame.id, worldName: 'ddp-test' })
|
|
275
|
+
r = await c('Runtime.evaluate', { expression, contextId: executionContextId, awaitPromise: true, returnByValue: true })
|
|
276
|
+
} else {
|
|
277
|
+
// 沙盒 iframe 在单独的进程里(站点隔离):是另一个目标,连上去跑
|
|
278
|
+
const { targetInfos } = await call('Target.getTargets')
|
|
279
|
+
const fr = targetInfos.filter((x) => x.type === 'iframe')
|
|
280
|
+
if (!fr.length) throw new Error('no child frame')
|
|
281
|
+
const { sessionId: fs2 } = await call('Target.attachToTarget', { targetId: fr[fr.length - 1].targetId, flatten: true })
|
|
282
|
+
try { r = await call('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true }, fs2) } finally { call('Target.detachFromTarget', { sessionId: fs2 }).catch(() => {}) }
|
|
283
|
+
}
|
|
284
|
+
if (r.exceptionDetails) throw new Error((r.exceptionDetails.exception && r.exceptionDetails.exception.description) || r.exceptionDetails.text || 'eval failed')
|
|
285
|
+
return r.result ? r.result.value : undefined
|
|
286
|
+
},
|
|
268
287
|
eval: async (expression) => {
|
|
269
288
|
const r = await c('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true })
|
|
270
289
|
if (r.exceptionDetails) throw new Error((r.exceptionDetails.exception && r.exceptionDetails.exception.description) || r.exceptionDetails.text || 'eval failed')
|