dsh-design-studio 0.27.0 → 0.28.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/client.js +307 -32
- package/lib/index.js +120 -37
- package/lib/tunnel.js +598 -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), 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.
|
|
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), or share it as a temporary public link (beta; opens in WeChat or any browser, closes after 2 hours); 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(屏和屏之间的跳转照样能点),或一个双击就能开的 HTML
|
|
45
|
+
- **导出和手机上看**:导出展示图、PDF、PPT(屏和屏之间的跳转照样能点),或一个双击就能开的 HTML 演示(带外壳、点得动,发给客户直接看),也能临时发个公网链接(实验,微信里点开就能看,2 小时自动关);扫码在手机上按真机尺寸看。页面比默认画幅大的幻灯片、海报,画幅自动跟页面走;也可以在类型后面跟 `宽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/client.js
CHANGED
|
@@ -510,6 +510,55 @@ window.__ModuleLoader__.load({
|
|
|
510
510
|
phoneFail: '没打开:{msg}',
|
|
511
511
|
phoneHelp: '确认在同一个 Wi-Fi;手机开着代理 / VPN 的先关掉;电脑问「是否允许传入连接」时点允许。',
|
|
512
512
|
phoneTrouble: '打不开?',
|
|
513
|
+
pub: '公网链接(实验)',
|
|
514
|
+
exPub: '发公网链接(实验)',
|
|
515
|
+
pubWhat: '发个链接给不在身边的人看',
|
|
516
|
+
pubP1: '对方不用连同一个 Wi-Fi,微信里点开就能看、能点着换屏',
|
|
517
|
+
pubP2: '只放这套设计的整套演示,电脑上别的东西都碰不到',
|
|
518
|
+
pubP3: '2 小时后自动关,也能随时关;关了链接马上失效',
|
|
519
|
+
pubP4: '走 Cloudflare 的免费临时通道(trycloudflare.com),不经过我们的服务器',
|
|
520
|
+
pubGo: '生成链接',
|
|
521
|
+
pubStarting: '正在连 Cloudflare…',
|
|
522
|
+
pubStartingFine: '一般 10 秒左右',
|
|
523
|
+
pubReady: '公网可见',
|
|
524
|
+
pubLeft: '还剩 {t}',
|
|
525
|
+
pubViews: '打开过 {n} 次',
|
|
526
|
+
pubHow: '微信、浏览器里打开都行',
|
|
527
|
+
pubLive: '改了这几屏,对方刷新就是新的;换到别的设计会自动关。',
|
|
528
|
+
pubWarn: '拿到链接的人都能看,别发到公开的群里。',
|
|
529
|
+
pubCopied: '链接已复制,可以发到微信里',
|
|
530
|
+
pubStop: '停止分享',
|
|
531
|
+
pubNeed: '要先装 cloudflared:Cloudflare 的临时通道工具,免费、不用注册。',
|
|
532
|
+
pubDl: '下载(约 19 MB)',
|
|
533
|
+
pubDlFrom: '从 Cloudflare 官方 GitHub 下载,放进插件自己的目录。',
|
|
534
|
+
pubDling: '正在下载 cloudflared… {p}',
|
|
535
|
+
pubDlFail: '没下载下来:{msg}',
|
|
536
|
+
pubSelf: '也可以自己装:Mac 在终端里运行 brew install cloudflared;Windows 运行 winget install --id Cloudflare.cloudflared。装好后这里会出现「生成链接」。',
|
|
537
|
+
pubDlCancel: '取消下载',
|
|
538
|
+
pubGone: '设计换了(或者现在看的不是本地文件),没有生成。确认要放的是这套设计再点一次。',
|
|
539
|
+
pubScreens: '会放出这 {n} 屏:{names}。之后新加的屏不会自动放出去。',
|
|
540
|
+
pubShared: '放出去的是这 {n} 屏:{names}',
|
|
541
|
+
pubBrokenShort: '对方现在打不开',
|
|
542
|
+
pubBroken: '对方现在打开会看到「暂时打不开」:{why}。改好后对方刷新就行,也可以先停止分享。',
|
|
543
|
+
pubDlStalled: '下载卡住了(30 秒没动),多半是连不上 GitHub。可以再试,或者按下面的方法自己装。',
|
|
544
|
+
pubDlNoBuild: '这台电脑的系统没有现成的 cloudflared,要自己装。',
|
|
545
|
+
pubReconnecting: '正在重连',
|
|
546
|
+
pubReconnectingFine: '和 Cloudflare 暂时断了,正在自己重连,链接不变;90 秒还没连上就关掉。',
|
|
547
|
+
pubRetry: '再试',
|
|
548
|
+
pubFail: '没连上 Cloudflare:{msg}',
|
|
549
|
+
pubFailHint: '公司网络、代理软件有时会拦;换个网络或关掉代理再试。',
|
|
550
|
+
pubTooBig: '图片太多,演示超过 150 MB,发不了。少放几屏再试',
|
|
551
|
+
pubNoScreens: '一屏都没读到(文件被挪走或删了?)',
|
|
552
|
+
pubEndExpired: '上一个链接到 2 小时,自动关了。',
|
|
553
|
+
pubEndDropped: '上一个链接断了(网络变了或电脑睡着了),已经失效。',
|
|
554
|
+
pubEndMoved: '换了设计,上一个链接关了。',
|
|
555
|
+
pubAgain: '再生成一个(链接会变)',
|
|
556
|
+
pubTrouble: '对方打不开?',
|
|
557
|
+
pubHelp: '刚生成的链接要等几秒才打得开。微信里提示风险或打不开,让对方点右上角,选「在浏览器打开」。电脑睡着、合上盖子,链接也会断。',
|
|
558
|
+
pubOff: '公网链接关了:{why}',
|
|
559
|
+
pubWhyExpired: '到 2 小时了',
|
|
560
|
+
pubWhyDropped: '通道断了',
|
|
561
|
+
pubWhyMoved: '换了设计',
|
|
513
562
|
zoomIn: '放大',
|
|
514
563
|
zoomOut: '缩小',
|
|
515
564
|
fit: '适合画布',
|
|
@@ -1443,6 +1492,55 @@ window.__ModuleLoader__.load({
|
|
|
1443
1492
|
phoneFail: 'Could not start: {msg}',
|
|
1444
1493
|
phoneHelp: 'Check both are on the same Wi-Fi, turn off any VPN or proxy on the phone, and allow incoming connections if your computer asks.',
|
|
1445
1494
|
phoneTrouble: "Won't open?",
|
|
1495
|
+
pub: 'Public link (beta)',
|
|
1496
|
+
exPub: 'Public link (beta)',
|
|
1497
|
+
pubWhat: 'Send a link to someone who is not nearby',
|
|
1498
|
+
pubP1: 'No shared Wi-Fi needed: they open it in WeChat or any browser and can click through the screens',
|
|
1499
|
+
pubP2: 'Only this design\'s clickable demo goes out; nothing else on your computer is reachable',
|
|
1500
|
+
pubP3: 'Closes after 2 hours, or whenever you stop it; the link stops working right away',
|
|
1501
|
+
pubP4: 'Uses a free Cloudflare quick tunnel (trycloudflare.com), not our servers',
|
|
1502
|
+
pubGo: 'Create link',
|
|
1503
|
+
pubStarting: 'Connecting to Cloudflare…',
|
|
1504
|
+
pubStartingFine: 'Usually about 10 seconds',
|
|
1505
|
+
pubReady: 'Public',
|
|
1506
|
+
pubLeft: '{t} left',
|
|
1507
|
+
pubViews: 'Opened {n} times',
|
|
1508
|
+
pubHow: 'Opens in WeChat or any browser',
|
|
1509
|
+
pubLive: 'Edits to these screens show up when they refresh. Switching to another design closes the link.',
|
|
1510
|
+
pubWarn: 'Anyone with the link can see it. Don\'t post it in public groups.',
|
|
1511
|
+
pubCopied: 'Link copied. Paste it into a chat',
|
|
1512
|
+
pubStop: 'Stop sharing',
|
|
1513
|
+
pubNeed: 'This needs cloudflared, Cloudflare\'s free tunnel tool (no account needed).',
|
|
1514
|
+
pubDl: 'Download (about 19 MB)',
|
|
1515
|
+
pubDlFrom: 'Downloaded from Cloudflare\'s official GitHub into the plugin\'s own folder.',
|
|
1516
|
+
pubDling: 'Downloading cloudflared… {p}',
|
|
1517
|
+
pubDlFail: 'Download failed: {msg}',
|
|
1518
|
+
pubSelf: 'Or install it yourself: on a Mac run brew install cloudflared; on Windows run winget install --id Cloudflare.cloudflared. Create link shows up here once it is installed.',
|
|
1519
|
+
pubDlCancel: 'Cancel download',
|
|
1520
|
+
pubGone: 'The design changed (or this isn\'t a local file), so no link was created. Check it\'s the right design and try again.',
|
|
1521
|
+
pubScreens: 'Shares these {n} screens: {names}. Screens added later are not shared automatically.',
|
|
1522
|
+
pubShared: 'Sharing these {n} screens: {names}',
|
|
1523
|
+
pubBrokenShort: 'Visitors can\'t open it now',
|
|
1524
|
+
pubBroken: 'Visitors currently see "Not available": {why}. Once fixed they can just refresh, or you can stop sharing.',
|
|
1525
|
+
pubDlStalled: 'The download stalled (no progress for 30 seconds), probably because GitHub is unreachable. Try again, or install it yourself as below.',
|
|
1526
|
+
pubDlNoBuild: 'There is no ready-made cloudflared for this system. Please install it yourself.',
|
|
1527
|
+
pubReconnecting: 'Reconnecting',
|
|
1528
|
+
pubReconnectingFine: 'Lost the connection to Cloudflare for now and reconnecting. The link stays the same; it closes if not back within 90 seconds.',
|
|
1529
|
+
pubRetry: 'Try again',
|
|
1530
|
+
pubFail: 'Could not reach Cloudflare: {msg}',
|
|
1531
|
+
pubFailHint: 'Office networks and proxy apps sometimes block it. Try another network or turn off the proxy.',
|
|
1532
|
+
pubTooBig: 'Too many images: the demo would be over 150 MB. Try with fewer screens',
|
|
1533
|
+
pubNoScreens: 'None of the screens could be read (moved or deleted?)',
|
|
1534
|
+
pubEndExpired: 'The last link closed after 2 hours.',
|
|
1535
|
+
pubEndDropped: 'The last link dropped (network changed or the computer slept) and no longer works.',
|
|
1536
|
+
pubEndMoved: 'You switched designs, so the last link was closed.',
|
|
1537
|
+
pubAgain: 'Create a new link (it will change)',
|
|
1538
|
+
pubTrouble: "They can't open it?",
|
|
1539
|
+
pubHelp: 'A new link takes a few seconds to start working. If WeChat warns or won\'t open it, tap the top-right menu and open it in the browser. The link also drops if the computer sleeps.',
|
|
1540
|
+
pubOff: 'Public link closed: {why}',
|
|
1541
|
+
pubWhyExpired: '2 hours are up',
|
|
1542
|
+
pubWhyDropped: 'the tunnel dropped',
|
|
1543
|
+
pubWhyMoved: 'you switched designs',
|
|
1446
1544
|
zoomIn: 'Zoom in',
|
|
1447
1545
|
zoomOut: 'Zoom out',
|
|
1448
1546
|
fit: 'Fit',
|
|
@@ -2288,6 +2386,9 @@ window.__ModuleLoader__.load({
|
|
|
2288
2386
|
.ddp-phone .fine{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}
|
|
2289
2387
|
.ddp-phone .row{display:flex;gap:6px;margin-top:6px}
|
|
2290
2388
|
.ddp-phone .row .ddp-go{height:28px;padding:0 12px;font-size:12px}
|
|
2389
|
+
.ddp-phone .warn{color:#c2410c}
|
|
2390
|
+
.ddp-pub .ddp-publist{margin:2px 0 4px;padding:0 0 0 18px;text-align:left;display:flex;flex-direction:column;gap:3px}
|
|
2391
|
+
.ddp-pub .ddp-publink{width:100%;box-sizing:border-box;height:28px;padding:0 8px;border-radius:7px;border:.5px solid var(--dsw-alias-border-primary,rgba(0,0,0,.15));background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:11px/28px ui-monospace,SFMono-Regular,Menlo,monospace;text-overflow:ellipsis}
|
|
2291
2392
|
@keyframes ddp-pulse{50%{opacity:1}}
|
|
2292
2393
|
.ddp-tokens .none{padding:6px 6px 0;color:var(--dsw-alias-label-secondary);line-height:1.6}
|
|
2293
2394
|
.ddp-tokens .none .ddp-go{margin-top:10px}
|
|
@@ -7706,6 +7807,143 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
7706
7807
|
h('div', { className: 'bd' }, bd))
|
|
7707
7808
|
}
|
|
7708
7809
|
|
|
7810
|
+
/**
|
|
7811
|
+
* 公网链接(#27,实验):把整套 HTML 演示临时放到公网上(cloudflared 临时通道),给链接和二维码。
|
|
7812
|
+
* 开之前先说清楚是公网可见;没装 cloudflared 的先请人下载;连上了显示还剩多久、打开过几次
|
|
7813
|
+
*/
|
|
7814
|
+
function PubPanel({ t, sid, body, brief, onCopy, onClose }) {
|
|
7815
|
+
const [res, setRes] = useState(null)
|
|
7816
|
+
const [err, setErr] = useState('')
|
|
7817
|
+
const [busy, setBusy] = useState(false)
|
|
7818
|
+
const [, setNow] = useState(0)
|
|
7819
|
+
const resRef = useRef(null)
|
|
7820
|
+
// 回包可能乱序:只认比上一次用过的更晚发出的(关掉以后,之前发出去的 peek 晚到也不会把旧链接显示回来)
|
|
7821
|
+
const seq = useRef(0)
|
|
7822
|
+
const used = useRef(0)
|
|
7823
|
+
const send = (b) => { const n = ++seq.current; return post('pubshare', b).then((d) => { if (n > used.current) { used.current = n; take(d) } return d }) }
|
|
7824
|
+
const take = (d) => { resRef.current = d; setRes(d); setErr('') }
|
|
7825
|
+
useEffect(() => {
|
|
7826
|
+
let alive = true
|
|
7827
|
+
let tm = 0
|
|
7828
|
+
const tick = () => send({ session: sid, peek: true }).catch((e) => { if (alive) setErr(e.message) }).finally(() => {
|
|
7829
|
+
if (!alive) return
|
|
7830
|
+
const r = resRef.current
|
|
7831
|
+
const fast = r && ((r.on && r.state === 'starting') || (r.dl && !r.dl.done))
|
|
7832
|
+
tm = setTimeout(tick, fast ? 700 : 3000)
|
|
7833
|
+
})
|
|
7834
|
+
tick()
|
|
7835
|
+
const clock = setInterval(() => setNow(Date.now()), 1000)
|
|
7836
|
+
return () => { alive = false; seq.current++; used.current = seq.current; clearTimeout(tm); clearInterval(clock) }
|
|
7837
|
+
}, [sid])
|
|
7838
|
+
// 马上不显示旧链接和二维码(之前发出去还没回来的回包作废),再马上问一次完整状态,不等下一次轮询
|
|
7839
|
+
const dropNow = (ended) => {
|
|
7840
|
+
const r = resRef.current
|
|
7841
|
+
used.current = ++seq.current // 不管面板现在显示什么,之前发出去的都作废(第一次 peek 还没回来也一样)
|
|
7842
|
+
if (r && r.on) take({ on: false, ended, tool: r.tool })
|
|
7843
|
+
send({ session: sid, peek: true }).catch(() => {})
|
|
7844
|
+
}
|
|
7845
|
+
// 右侧栏的状态从开变成关(到点、断了、起不来)(起不来的具体原因等 peek 带回来,先不显示个代号)。
|
|
7846
|
+
// 面板正在「连」的时候不管:刚停了又点生成,停的那一刻的旧状态晚到,别把新的闪成关
|
|
7847
|
+
const briefOn = brief ? !!brief.on : null
|
|
7848
|
+
const briefWas = useRef(briefOn)
|
|
7849
|
+
useEffect(() => {
|
|
7850
|
+
const was = briefWas.current
|
|
7851
|
+
briefWas.current = briefOn
|
|
7852
|
+
const r = resRef.current
|
|
7853
|
+
if (was === true && briefOn === false && !(r && r.on && r.state === 'starting')) dropNow((brief && brief.ended) || '')
|
|
7854
|
+
}, [briefOn])
|
|
7855
|
+
// 换了设计(地址栏、拖进来、设计库 / 市场「用这个」……哪条路都算):链接已经跟着关了,面板马上跟上
|
|
7856
|
+
const tk = body().target
|
|
7857
|
+
const tkWas = useRef(tk)
|
|
7858
|
+
useEffect(() => {
|
|
7859
|
+
if (tkWas.current === tk) return
|
|
7860
|
+
tkWas.current = tk
|
|
7861
|
+
dropNow('moved')
|
|
7862
|
+
}, [tk])
|
|
7863
|
+
const start = () => {
|
|
7864
|
+
setBusy(true)
|
|
7865
|
+
send({ session: sid, on: true, ...body() }).then((d) => {
|
|
7866
|
+
if (!d.on && d.error === 'no-cloudflared' && !d.tool) return download()
|
|
7867
|
+
}).catch((e) => setErr(e.message)).finally(() => setBusy(false))
|
|
7868
|
+
}
|
|
7869
|
+
const download = () => send({ session: sid, download: true }).catch((e) => setErr(e.message))
|
|
7870
|
+
const cancel = () => send({ session: sid, cancel: true }).catch((e) => setErr(e.message))
|
|
7871
|
+
const stop = () => send({ session: sid, on: false }).catch((e) => setErr(e.message))
|
|
7872
|
+
// 下完了不自动生成:面板回到「会放出这几屏」+「生成链接」,按下载完时的画布让人再看一眼、自己点
|
|
7873
|
+
const left = (ms) => {
|
|
7874
|
+
const x = Math.max(0, Math.round(ms / 1000))
|
|
7875
|
+
return `${Math.floor(x / 3600)}:${String(Math.floor((x % 3600) / 60)).padStart(2, '0')}:${String(x % 60).padStart(2, '0')}`
|
|
7876
|
+
}
|
|
7877
|
+
// 会放出去的是哪几屏(画布上的全部屏,单看一屏时也是全部):生成前写清楚
|
|
7878
|
+
const shotList = (() => {
|
|
7879
|
+
const list = (body().screens || []).map((x) => x.label || x.key)
|
|
7880
|
+
if (!list.length) return ''
|
|
7881
|
+
return t('pubScreens', { n: list.length, names: list.join(t('sep')) })
|
|
7882
|
+
})()
|
|
7883
|
+
const errText = (r) => (r.error === 'tooBig' ? t('pubTooBig') : r.error === 'noScreens' ? t('pubNoScreens') : t('pubFail', { msg: r.message || r.error || '' }))
|
|
7884
|
+
// 接口拒了(点生成的那一刻换了设计、或者现在看的不是本地文件):别说成「没连上 Cloudflare」
|
|
7885
|
+
const errMsg = (m) => (m === 'designChanged' || m === 'not-file' ? t('pubGone') : t('pubFail', { msg: m }))
|
|
7886
|
+
const ended = (r) => (r.ended === 'expired' ? t('pubEndExpired') : r.ended === 'dropped' ? t('pubEndDropped') : r.ended === 'moved' ? t('pubEndMoved') : '')
|
|
7887
|
+
let bd
|
|
7888
|
+
if (err && !res) bd = h('p', null, errMsg(err))
|
|
7889
|
+
else if (!res) bd = h('p', null, t('phoneStarting'))
|
|
7890
|
+
else if (res.on && res.state === 'starting') {
|
|
7891
|
+
bd = [
|
|
7892
|
+
h('span', { key: 'st', className: 'st' }, h('i'), t('pubStarting')),
|
|
7893
|
+
h('p', { key: 'f', className: 'fine' }, t('pubStartingFine')),
|
|
7894
|
+
h('div', { key: 'row', className: 'row' }, h('button', { className: 'ddp-go sec', onClick: stop }, t('pubStop'))),
|
|
7895
|
+
]
|
|
7896
|
+
} else if (res.on) {
|
|
7897
|
+
bd = [
|
|
7898
|
+
h('div', { key: 'qr', className: 'qr' }, h(QrCode, { rows: res.qr || [] })),
|
|
7899
|
+
h('b', { key: 'how', className: 'how' }, t('pubHow')),
|
|
7900
|
+
h('input', { key: 'url', className: 'ddp-publink', readOnly: true, value: res.url, onFocus: (e) => e.target.select(), 'aria-label': t('pub') }),
|
|
7901
|
+
h('span', { key: 'st', className: 'st' + (res.state === 'reconnecting' || res.broken ? '' : ' ok') }, res.state === 'reconnecting' || res.broken ? h('i') : h(I.check), (res.broken ? t('pubBrokenShort') : res.state === 'reconnecting' ? t('pubReconnecting') : t('pubReady')) + ' · ' + t('pubLeft', { t: left(res.expires - Date.now()) }) + (res.views ? ' · ' + t('pubViews', { n: res.views }) : '')),
|
|
7902
|
+
res.state === 'reconnecting' ? h('p', { key: 'rc', className: 'fine warn' }, t('pubReconnectingFine')) : null,
|
|
7903
|
+
res.broken ? h('p', { key: 'broken', className: 'fine warn' }, t('pubBroken', { why: res.broken === 'tooBig' ? t('pubTooBig') : res.broken === 'noScreens' ? t('pubNoScreens') : res.broken })) : null,
|
|
7904
|
+
res.screens && res.screens.length ? h('p', { key: 'scr', className: 'fine' }, t('pubShared', { n: res.screens.length, names: res.screens.join(t('sep')) })) : null,
|
|
7905
|
+
h('p', { key: 'live', className: 'fine' }, t('pubLive')),
|
|
7906
|
+
h('p', { key: 'warn', className: 'fine warn' }, t('pubWarn')),
|
|
7907
|
+
h('div', { key: 'row', className: 'row' },
|
|
7908
|
+
h('button', { className: 'ddp-go sec', onClick: stop }, t('pubStop')),
|
|
7909
|
+
h('button', { className: 'ddp-go', onClick: () => onCopy(res.url) }, t('phoneCopy'))),
|
|
7910
|
+
h('details', { key: 'more', className: 'fine' }, h('summary', null, t('pubTrouble')), h('p', null, t('pubHelp'))),
|
|
7911
|
+
]
|
|
7912
|
+
} else if (res.dl && !res.dl.done && !res.tool) {
|
|
7913
|
+
const pct = res.dl.total ? Math.round((res.dl.got / res.dl.total) * 100) + '%' : Math.round(res.dl.got / 1048576) + ' MB'
|
|
7914
|
+
bd = [
|
|
7915
|
+
h('span', { key: 'st', className: 'st' }, h('i'), t('pubDling', { p: pct })),
|
|
7916
|
+
h('p', { key: 'f', className: 'fine' }, t('pubDlFrom')),
|
|
7917
|
+
h('p', { key: 'self', className: 'fine' }, t('pubSelf')),
|
|
7918
|
+
h('div', { key: 'row', className: 'row' }, h('button', { className: 'ddp-go sec', onClick: cancel }, t('pubDlCancel'))),
|
|
7919
|
+
]
|
|
7920
|
+
} else {
|
|
7921
|
+
// 没开:先说清楚是公网可见;本机没有 cloudflared 的,主按钮变成「下载」(下完接着生成)
|
|
7922
|
+
const why = res.error ? errText(res) : ended(res)
|
|
7923
|
+
const noTool = !res.tool
|
|
7924
|
+
bd = [
|
|
7925
|
+
h('b', { key: 'what', className: 'how' }, t('pubWhat')),
|
|
7926
|
+
h('ul', { key: 'ul', className: 'ddp-publist' }, ['pubP1', 'pubP2', 'pubP3', 'pubP4'].map((k) => h('li', { key: k }, t(k)))),
|
|
7927
|
+
shotList ? h('p', { key: 'scr', className: 'fine' }, shotList) : null,
|
|
7928
|
+
why && res.error !== 'no-cloudflared' ? h('p', { key: 'why', className: 'warn' }, why) : null,
|
|
7929
|
+
res.error === 'tunnel' || res.error === 'timeout' ? h('p', { key: 'hint', className: 'fine' }, t('pubFailHint')) : null,
|
|
7930
|
+
err ? h('p', { key: 'err', className: 'warn' }, errMsg(err)) : null,
|
|
7931
|
+
noTool ? h('p', { key: 'need' }, t('pubNeed')) : null,
|
|
7932
|
+
noTool && res.dl && res.dl.error ? h('p', { key: 'dlf', className: 'warn' }, res.dl.error === 'stalled' ? t('pubDlStalled') : res.dl.error === 'unsupported' ? t('pubDlNoBuild') : t('pubDlFail', { msg: res.dl.error })) : null,
|
|
7933
|
+
h('div', { key: 'row', className: 'row' },
|
|
7934
|
+
noTool && res.dl && res.dl.error ? h('button', { className: 'ddp-go sec', onClick: start, disabled: busy }, t('pubRetry')) : null,
|
|
7935
|
+
noTool
|
|
7936
|
+
? h('button', { className: 'ddp-go', disabled: busy, onClick: download }, t('pubDl'))
|
|
7937
|
+
: h('button', { className: 'ddp-go', onClick: start, disabled: busy }, why ? t('pubAgain') : t('pubGo'))),
|
|
7938
|
+
noTool ? h('p', { key: 'from', className: 'fine' }, t('pubDlFrom')) : null,
|
|
7939
|
+
noTool ? h('p', { key: 'self', className: 'fine' }, t('pubSelf')) : null,
|
|
7940
|
+
]
|
|
7941
|
+
}
|
|
7942
|
+
return h('div', { className: 'ddp-tokens ddp-phone ddp-pub', onPointerDown: (e) => e.stopPropagation() },
|
|
7943
|
+
h('header', null, h(I.web), h('b', null, t('pub')), h('button', { className: 'ddp-btn', title: '×', onClick: onClose }, h(I.close))),
|
|
7944
|
+
h('div', { className: 'bd' }, bd))
|
|
7945
|
+
}
|
|
7946
|
+
|
|
7709
7947
|
/** 版本面板:现在 + 存过的几版(新的在前),点一版看当时的样子 */
|
|
7710
7948
|
function HistoryPanel({ t, versions, ver, onPick, onClose }) {
|
|
7711
7949
|
const files = (list) => {
|
|
@@ -9199,29 +9437,33 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9199
9437
|
}
|
|
9200
9438
|
// 整套 HTML 演示(#26):服务端把每屏连同样式、图片、图标打进一个 .html,不截图(几秒出来)。
|
|
9201
9439
|
// 屏、版本、画幅、深浅色、调节滑块没存的值都按眼前的;外壳在演示页面里能开关
|
|
9440
|
+
// 公网链接(#27)也用这一份:右侧栏眼前的屏、画幅、深浅色、调节值
|
|
9441
|
+
const htmlBody = () => {
|
|
9442
|
+
const list = []
|
|
9443
|
+
const seen = new Set()
|
|
9444
|
+
for (const sc of shown) { // 看旧版本时 shown 就是那一版的几屏(都带 v)
|
|
9445
|
+
if (seen.has(sc.key)) continue
|
|
9446
|
+
seen.add(sc.key)
|
|
9447
|
+
list.push(sc)
|
|
9448
|
+
}
|
|
9449
|
+
const sp = splitTitles(list.map((sc) => (infoOf(ik(sc)) || {}).title || sc.label))
|
|
9450
|
+
const folder = st && st.target && st.target.kind === 'file' ? String(st.target.file).split(/[\\/]/).slice(-2, -1)[0] : ''
|
|
9451
|
+
const title = sp.brand || folder || (st && st.label) || ''
|
|
9452
|
+
return {
|
|
9453
|
+
target: targetKey, v: ver ? ver.n : 0,
|
|
9454
|
+
title, lang: t('lang') === 'en' ? 'en' : 'zh', kind, w: size[0], h: size[1], os: meta.os || '', dark: !!dark, tweak: ver ? null : tweak || null, // 旧版本不套调节滑块的值(和画布上一样)
|
|
9455
|
+
// 没开「深色」时页面跟着系统深浅色走:记下右侧栏这会儿是哪种,演示里照这个显示(不跟看的人电脑走)
|
|
9456
|
+
scheme: typeof matchMedia === 'function' && matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light',
|
|
9457
|
+
fit: !!webFit, // 网页开着「按画幅显示」:演示里默认也套浏览器框、按画幅缩放
|
|
9458
|
+
screens: list.map((sc) => ({ key: sc.key, label: labelOf(sc), top: !!(tops && tops[ik(sc)]) })),
|
|
9459
|
+
}
|
|
9460
|
+
}
|
|
9202
9461
|
const exportHtml = async () => {
|
|
9203
9462
|
if (!fileTarget) return
|
|
9204
9463
|
say(t('exporting'))
|
|
9205
9464
|
try {
|
|
9206
|
-
const
|
|
9207
|
-
const
|
|
9208
|
-
for (const sc of shown) { // 看旧版本时 shown 就是那一版的几屏(都带 v)
|
|
9209
|
-
if (seen.has(sc.key)) continue
|
|
9210
|
-
seen.add(sc.key)
|
|
9211
|
-
list.push(sc)
|
|
9212
|
-
}
|
|
9213
|
-
const sp = splitTitles(list.map((sc) => (infoOf(ik(sc)) || {}).title || sc.label))
|
|
9214
|
-
const folder = st && st.target && st.target.kind === 'file' ? String(st.target.file).split(/[\\/]/).slice(-2, -1)[0] : ''
|
|
9215
|
-
const title = sp.brand || folder || st.label || ''
|
|
9216
|
-
const r = await post('htmlpack', {
|
|
9217
|
-
session: sid, target: targetKey, v: ver ? ver.n : 0,
|
|
9218
|
-
name: (ver ? `v${ver.n}-` : '') + (title || 'design') + (dark ? '-dark' : ''),
|
|
9219
|
-
title, lang: t('lang') === 'en' ? 'en' : 'zh', kind, w: size[0], h: size[1], os: meta.os || '', dark: !!dark, tweak: ver ? null : tweak || null, // 旧版本不套调节滑块的值(和画布上一样)
|
|
9220
|
-
// 没开「深色」时页面跟着系统深浅色走:记下右侧栏这会儿是哪种,演示里照这个显示(不跟看的人电脑走)
|
|
9221
|
-
scheme: typeof matchMedia === 'function' && matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light',
|
|
9222
|
-
fit: !!webFit, // 网页开着「按画幅显示」:演示里默认也套浏览器框、按画幅缩放
|
|
9223
|
-
screens: list.map((sc) => ({ key: sc.key, label: labelOf(sc), top: !!(tops && tops[ik(sc)]) })),
|
|
9224
|
-
})
|
|
9465
|
+
const b = htmlBody()
|
|
9466
|
+
const r = await post('htmlpack', { session: sid, ...b, name: (ver ? `v${ver.n}-` : '') + (b.title || 'design') + (dark ? '-dark' : '') })
|
|
9225
9467
|
const file = String(r.path || '').split(/[\\/]/).pop()
|
|
9226
9468
|
const miss = Array.isArray(r.missing) ? r.missing.length : 0
|
|
9227
9469
|
say((miss ? t('exportedHtmlMiss', { name: file, n: r.count, miss }) : t('exportedHtml', { name: file, n: r.count })) + (r.ai ? ' · ' + t('xoAi', { n: r.ai }) : ''), { label: t('reveal'), run: () => post('reveal', { path: r.path }).catch(() => {}) })
|
|
@@ -9230,7 +9472,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9230
9472
|
say(m === 'designChanged' || m === 'not-file' ? t('xoGone') : m === 'tooBig' ? t('htmlTooBig') : m === 'noScreens' ? t('htmlNoScreens') : t('exportFail', { msg: m }))
|
|
9231
9473
|
}
|
|
9232
9474
|
}
|
|
9233
|
-
return { withFrames, measureAll, exportShots, exportHtml }
|
|
9475
|
+
return { withFrames, measureAll, exportShots, exportHtml, htmlBody }
|
|
9234
9476
|
}
|
|
9235
9477
|
|
|
9236
9478
|
// ── 画笔标注(从预览面板里拆出来的):台面上看得到的几屏截图拼好、叠上画的,存进 refs/ 交给模型,或者复制
|
|
@@ -9651,6 +9893,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
9651
9893
|
const [implAway, setImplAway] = useState('') // 真页面换到了别的路由(点了站内链接):那条路由
|
|
9652
9894
|
const [dark, setDark] = useState(false)
|
|
9653
9895
|
const [phone, setPhone] = useState(false) // 手机上看的面板
|
|
9896
|
+
const [pubP, setPubP] = useState(false) // 公网链接的面板
|
|
9654
9897
|
const [multi, setMulti] = useState(false) // 多尺寸并排
|
|
9655
9898
|
const ckGen = useRef(0) // 每量一次、每关一次面板 +1:量完发现不是最新的一次就不算数
|
|
9656
9899
|
const ckOpen = useRef(false) // 面板开着(或正在量):过期的一次结果回来时别清掉新一轮的标记
|
|
@@ -10153,7 +10396,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10153
10396
|
setTextEdit(false)
|
|
10154
10397
|
setPanel(false)
|
|
10155
10398
|
setHist(false)
|
|
10156
|
-
setPhone(false)
|
|
10399
|
+
setPhone(false); setPubP(false)
|
|
10157
10400
|
closeCheck()
|
|
10158
10401
|
setStyleEdit(true)
|
|
10159
10402
|
}
|
|
@@ -10348,10 +10591,31 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10348
10591
|
}
|
|
10349
10592
|
// ── 导出图片(makeExporter)──
|
|
10350
10593
|
// 在和做出来的比:导出的「这一屏」是比的那屏,画布没挂着(别的屏在背后挂)
|
|
10351
|
-
const { withFrames, measureAll, exportShots, exportHtml } = makeExporter({ apiOf, targetKey, sid, st, kind, size, dark, meta, tokens, t, say, canvas: canvas && !implSc, focus: implSc ? implSc.key : focus, sel, shown, ik, labelOf, infoOf, fileTarget, ver, apis, designNow, designSeq, ghostApis, ghostBatch, ghostQueue, setBackFrames, warned, tops, tweak, webFit,
|
|
10594
|
+
const { withFrames, measureAll, exportShots, exportHtml, htmlBody } = makeExporter({ apiOf, targetKey, sid, st, kind, size, dark, meta, tokens, t, say, canvas: canvas && !implSc, focus: implSc ? implSc.key : focus, sel, shown, ik, labelOf, infoOf, fileTarget, ver, apis, designNow, designSeq, ghostApis, ghostBatch, ghostQueue, setBackFrames, warned, tops, tweak, webFit,
|
|
10352
10595
|
onWarn: () => { if (pane !== 'export') openPane('export') } })
|
|
10353
10596
|
const designId = JSON.stringify([sid, targetKey, ver ? ver.n : 0])
|
|
10354
10597
|
if (designNow.current !== designId) { designNow.current = designId; designSeq.current++ }
|
|
10598
|
+
// 公网链接(#27)开着:右侧栏换了屏、画幅、深浅色、调节值,对方下次打开就按新的(看旧版本时不动)
|
|
10599
|
+
const pubOn = !!(st && st.pub && st.pub.on)
|
|
10600
|
+
const pubKey = pubOn && !ver ? JSON.stringify(htmlBody()) : ''
|
|
10601
|
+
const lastPub = useRef('')
|
|
10602
|
+
useEffect(() => {
|
|
10603
|
+
if (!pubKey) { lastPub.current = ''; return }
|
|
10604
|
+
if (lastPub.current === pubKey) return
|
|
10605
|
+
lastPub.current = pubKey
|
|
10606
|
+
// 刚开的那次也发:参数一样插件那边什么都不做,不一样(开的时候右侧栏正好在变)就补上
|
|
10607
|
+
post('pubshare', { session: sid, update: true, ...JSON.parse(pubKey) }).catch(() => {})
|
|
10608
|
+
}, [pubKey])
|
|
10609
|
+
// 面板关着的时候链接自己关了(到点、断了、换了设计):说一声
|
|
10610
|
+
const pubEnded = st && st.pub && !st.pub.on ? st.pub.ended || '' : ''
|
|
10611
|
+
const pubKnown = !!(st && st.pub) // 设计库 / 拖 ZIP 换设计的回包里没有 pub:当不知道,等完整状态回来再判断
|
|
10612
|
+
const pubWas = useRef(false)
|
|
10613
|
+
useEffect(() => {
|
|
10614
|
+
if (!pubKnown) return
|
|
10615
|
+
if (pubOn) { pubWas.current = true; return }
|
|
10616
|
+
if (pubWas.current && pubEnded && !pubP) say(t('pubOff', { why: t(pubEnded === 'expired' ? 'pubWhyExpired' : pubEnded === 'dropped' ? 'pubWhyDropped' : 'pubWhyMoved') }))
|
|
10617
|
+
pubWas.current = false
|
|
10618
|
+
}, [pubOn, pubEnded, pubKnown])
|
|
10355
10619
|
const doExport = async (mode, key, opts) => {
|
|
10356
10620
|
setExMenu(false)
|
|
10357
10621
|
if (mode === 'opts') { if (pane !== 'export') openPane('export'); return }
|
|
@@ -10444,7 +10708,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10444
10708
|
// ── 设计体检:画布上量所有屏,单页量这一屏;问题标在页面上,列在面板里 ──
|
|
10445
10709
|
// 设计体检:量、开面板、定位、交给模型(makeCheck)
|
|
10446
10710
|
const { closeCheck, checkList, measure, total, runCheck, focusIssue, fixIssues } = makeCheck({ kind, url, st, stRef, canvas, shown, focus, ik, labelOf, apis, apiOf, ck, setCk, ckGen, ckOpen, setCkCount, setReveal, setSel, insert, say, t,
|
|
10447
|
-
onOpen: () => { setPanel(false); setHist(false); setPhone(false); setAn(false) } })
|
|
10711
|
+
onOpen: () => { setPanel(false); setHist(false); setPhone(false); setPubP(false); setAn(false) } })
|
|
10448
10712
|
// 打开一套设计、模型又干完一轮(turns 变了):面板开着就再查一次(改没改好一眼看到);关着就悄悄量一下,问题数标在按钮上。
|
|
10449
10713
|
// 模型干着活时不量;等一会儿再量:刚写完的屏还在刷新、播生成动画
|
|
10450
10714
|
const autoCk = useRef(null)
|
|
@@ -10490,7 +10754,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10490
10754
|
useEffect(() => { setAnStates({}) }, [anFile ? anFile.sig : '']) // 文件变了(模型改过选择器):别的屏的旧结果作废,等页面重新报
|
|
10491
10755
|
const toggleAn = () => {
|
|
10492
10756
|
if (an) { setAn(false); setAnSel(''); return }
|
|
10493
|
-
setPanel(false); setHist(false); setPhone(false); setPane(''); closeCheck(); setStyleEdit(false); setMark(false)
|
|
10757
|
+
setPanel(false); setHist(false); setPhone(false); setPubP(false); setPane(''); closeCheck(); setStyleEdit(false); setMark(false)
|
|
10494
10758
|
setAn(true)
|
|
10495
10759
|
}
|
|
10496
10760
|
const focusAn = (a) => {
|
|
@@ -10531,6 +10795,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10531
10795
|
setPanel(false)
|
|
10532
10796
|
setHist(false)
|
|
10533
10797
|
setPhone(false)
|
|
10798
|
+
setPubP(false)
|
|
10534
10799
|
closeCheck()
|
|
10535
10800
|
setPane('')
|
|
10536
10801
|
// 之前点选 / 调样式留下的「已选」框别夹在标注里
|
|
@@ -10558,14 +10823,14 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10558
10823
|
useEffect(() => { if (checkOff) { setAn(false); setAnSel('') } }, [checkOff])
|
|
10559
10824
|
|
|
10560
10825
|
const toggleDemo = () => (demo ? setDemo(null) : startDemo())
|
|
10561
|
-
const openLook = (tab) => { if (tab) setLookTab(tab); setPanel(true); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10562
|
-
const toggleHist = () => { setHist(!hist); setPanel(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10826
|
+
const openLook = (tab) => { if (tab) setLookTab(tab); setPanel(true); setHist(false); setPhone(false); setPubP(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10827
|
+
const toggleHist = () => { setHist(!hist); setPanel(false); setPhone(false); setPubP(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10563
10828
|
// 右边同一时间只开一个面板:别的开了,这几个关掉;开这几个时别的关掉
|
|
10564
|
-
const oldOpen = !!(panel || hist || phone || ck || styleEdit)
|
|
10829
|
+
const oldOpen = !!(panel || hist || phone || pubP || ck || styleEdit)
|
|
10565
10830
|
useEffect(() => { if (oldOpen) setPane('') }, [oldOpen])
|
|
10566
10831
|
const openPane = (p) => {
|
|
10567
10832
|
const next = pane === p ? '' : p
|
|
10568
|
-
if (next) { setPanel(false); setHist(false); setPhone(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10833
|
+
if (next) { setPanel(false); setHist(false); setPhone(false); setPubP(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10569
10834
|
setPane(next)
|
|
10570
10835
|
}
|
|
10571
10836
|
const setTweak = (k, v) => setTw((c) => {
|
|
@@ -10607,7 +10872,8 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10607
10872
|
}), 'insertedSend')
|
|
10608
10873
|
setPane('')
|
|
10609
10874
|
}
|
|
10610
|
-
const togglePhone = () => { setPhone(!phone); setPanel(false); setHist(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10875
|
+
const togglePhone = () => { setPhone(!phone); setPubP(false); setPanel(false); setHist(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10876
|
+
const togglePub = () => { setPubP(!pubP); setPhone(false); setPanel(false); setHist(false); closeCheck(); setStyleEdit(false); setAn(false) }
|
|
10611
10877
|
const reload = () => setReloadSeq((x) => x + 1)
|
|
10612
10878
|
|
|
10613
10879
|
// 浮在画布上的几块,各管一件事,按钮都带字:左上 设计库 | 屏名 ▾(换屏、多尺寸、类型都在这个菜单里);
|
|
@@ -10670,7 +10936,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10670
10936
|
anOn ? h('button', { className: 'ddp-btn lab' + (anUp ? ' sel' : ''), ...tipA(t('an'), anCount && !anUp ? t('dAnN', { n: anCount }) : t('dAn')), disabled: checkOff, onClick: toggleAn },
|
|
10671
10937
|
h(I.note), h('span', { className: 'lb' }, t('an')), anCount && !anUp && !checkOff ? h('span', { className: 'bdg' }, anCount > 99 ? '99+' : String(anCount)) : null) : null,
|
|
10672
10938
|
h('span', { className: 'ddp-sep' }),
|
|
10673
|
-
h(DropMenu, { t, tip: [t('deliver'), t('dExport')], btnCls: 'pri', icon: I.download, label: t('deliver'), caret: true, open: exMenu, setOpen: setExMenu, disabled: !url, items: [
|
|
10939
|
+
h(DropMenu, { t, tip: [t('deliver'), t('dExport')], btnCls: 'pri', icon: I.download, label: t('deliver'), caret: true, has: pubOn && !pubP, open: exMenu, setOpen: setExMenu, disabled: !url, items: [
|
|
10674
10940
|
'hd:' + t('deliverCode'),
|
|
10675
10941
|
['', I.code, t('handoff'), pane === 'handoff', !!ver, () => openPane('handoff')],
|
|
10676
10942
|
['', I.overlay, t('implCmp'), !!implSc, !!ver || !exSc || implFar, () => (implSc ? implClose() : implOpen(exSc.key))],
|
|
@@ -10680,6 +10946,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
10680
10946
|
fileTarget ? 'hd:' + t('deliverShare') : null, // 只有本地的设计才能打包、分享
|
|
10681
10947
|
fileTarget ? ['', I.box, t('exZip'), false, false, () => doExport('zip')] : null,
|
|
10682
10948
|
fileTarget ? ['', I.share, t('exShare'), false, false, () => doExport('share')] : null,
|
|
10949
|
+
fileTarget ? ['', I.web, t('exPub'), pubP, !!ver, togglePub, pubOn ? t('phoneOnShort') : ''] : null, // 公网链接(实验):只有本地文件的设计(放的是整套 HTML 演示)
|
|
10683
10950
|
], foot: t('exWhere') }),
|
|
10684
10951
|
h(DropMenu, { t, cls: 'ddp-more', tip: [t('more'), phoneOn && !phone ? t('phoneOnTip') + ' · ' + t('dMore') : t('dMore')], icon: I.more, has: phoneOn && !phone, open: more, setOpen: setMore, items: [
|
|
10685
10952
|
dockTight ? ['', I.play, t('demoShort'), !!demo, !url || !!ver, () => { if (implSc) implClose(); toggleDemo() }] : null, // 侧栏太窄,底部工具坞放不下「试用」:挪到这里
|
|
@@ -11200,7 +11467,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
11200
11467
|
sel: sel || focus,
|
|
11201
11468
|
labelOf: shortOf,
|
|
11202
11469
|
reveal,
|
|
11203
|
-
inset: anUp || ck || styleEdit || panel || pane || hist || phone ? 296 : 0, // 右边的面板 276 宽,离边 10
|
|
11470
|
+
inset: anUp || ck || styleEdit || panel || pane || hist || phone || pubP ? 296 : 0, // 右边的面板 276 宽,离边 10
|
|
11204
11471
|
render: (sc, z) => renderScreen(sc, z, false),
|
|
11205
11472
|
sleep: sleepScreen,
|
|
11206
11473
|
flows,
|
|
@@ -11210,7 +11477,7 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
11210
11477
|
})
|
|
11211
11478
|
} else {
|
|
11212
11479
|
// 右边开着面板(体检、调样式、设计规范、换风格):手机这类有外框的让到面板左边(侧栏够宽时),别被挡住
|
|
11213
|
-
const sideOn = !!(anUp || ck || styleEdit || panel || pane || hist || phone) && box.w - 296 >= 240
|
|
11480
|
+
const sideOn = !!(anUp || ck || styleEdit || panel || pane || hist || phone || pubP) && box.w - 296 >= 240
|
|
11214
11481
|
// 网页铺满时右边开着面板(业务标注、体检、调样式…,#22):按现在的大小定住、整体缩到面板左边,不重排,右边的内容也不被挡
|
|
11215
11482
|
// 高度按铺满时真有的那么高:上面挂着横幅(看旧版本)时少 46,和下面 .ddp-body 的 vb 一样算
|
|
11216
11483
|
const sideLock = fill && sideOn && !mark ? { w: box.w, h: ah - (ver || demo || hintTop ? 46 : 0) } : null
|
|
@@ -11316,6 +11583,14 @@ ${Object.entries(CHIP_ICON).map(([k, d]) => `[data-composer-chip="${chipSrc(k)}"
|
|
|
11316
11583
|
onStop: () => { post('phone', { session: sid, on: false }).catch(() => {}); setPhone(false); if (poll && poll.state) poll.set({ ...poll.state, phone: { on: false, seen: 0 } }) },
|
|
11317
11584
|
onClose: () => setPhone(false),
|
|
11318
11585
|
}) : null,
|
|
11586
|
+
pubP ? h(PubPanel, {
|
|
11587
|
+
t,
|
|
11588
|
+
sid,
|
|
11589
|
+
body: htmlBody,
|
|
11590
|
+
brief: st && st.pub,
|
|
11591
|
+
onCopy: (link) => { navigator.clipboard.writeText(link).then(() => say(t('pubCopied'))).catch(() => say(link)) },
|
|
11592
|
+
onClose: () => setPubP(false),
|
|
11593
|
+
}) : null,
|
|
11319
11594
|
hist ? h(HistoryPanel, { t, versions, ver, onPick: (v) => { setVer(v); if (!v) setCmp(false) }, onClose: () => setHist(false) }) : null,
|
|
11320
11595
|
mark && !markOff ? h(MarkLayer, { t, sending: markBusy, frames: markFrames, onCancel: () => { markRun.current++; setMark(false) }, onSend: sendMark, onCopy: canCopyImage() ? copyMark : null }) : null,
|
|
11321
11596
|
demo ? h('div', { className: 'ddp-banner' + side },
|