feat(shell): 一级导航(52px 纯图标)+ 插件整页 + 快捷键弹窗分区罗列(v3.25.59)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m5s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m5s
This commit is contained in:
1 parent
6db5a143a8
commit
7b2f07bdad
37 files changed
+676
-177
No files matched your search
@@ -1194,7 +1194,7 @@
|
||||
if (refs.zoomAnim) { cancelAnimationFrame(refs.zoomAnim); refs.zoomAnim = null }
|
||||
// 面板区域(抽屉/历史图/工具栏/侧栏/弹窗等)滚轮只滚动内容,不缩放画布
|
||||
const t0 = e.target
|
||||
if (t0 && t0.closest && t0.closest('.iwb-dock, .iwb-drawer, .iwb-toolbar, .iwb-rightrail, .iwb-wsrail, .iwb-statusbar, .iwb-minimap, .iwb-hint-bottom, .iwb-lib, .iwb-modal, .iwb-fullpanel')) return
|
||||
if (t0 && t0.closest && t0.closest('.iwb-dock, .iwb-drawer, .iwb-toolbar, .iwb-rightrail, .iwb-navrail, .iwb-plugin-page, .iwb-statusbar, .iwb-minimap, .iwb-hint-bottom, .iwb-lib, .iwb-modal, .iwb-fullpanel')) return
|
||||
e.preventDefault()
|
||||
// 标记"缩放窗口"(去抖 160ms):缩放下每帧会生成新的 nodes 数组,让节点 memo 在此期间放宽比较
|
||||
try {
|
||||
@@ -1923,7 +1923,7 @@
|
||||
// (面板常停靠左侧),候选位与禁区相交也一律跳过。世界→屏幕换算:screen = world * scale + vp
|
||||
const blockedRects = []
|
||||
try {
|
||||
document.querySelectorAll('.iwb-fullmask, .iwb-wsrail, .iwb-lib, .iwb-lib-embedded').forEach((elm) => {
|
||||
document.querySelectorAll('.iwb-fullmask, .iwb-navrail, .iwb-plugin-page, .iwb-lib, .iwb-lib-embedded').forEach((elm) => {
|
||||
const r = elm.getBoundingClientRect()
|
||||
if (r && r.width > 4 && r.height > 4) blockedRects.push(r)
|
||||
})
|
||||
@@ -1982,7 +1982,7 @@
|
||||
const obstacles = refs.nodes.map((n) => ({ x: n.x, y: n.y, w: nodeWidth(n), h: refs.measuredH[n.id] || n.h || nodeTypeH(n.type) }))
|
||||
// 浮层(插件面板/资源中心/左右侧栏)也是禁区:落在这些区域等于被盖住看不见,与 findSpot 同一份清单
|
||||
try {
|
||||
document.querySelectorAll('.iwb-fullmask, .iwb-wsrail, .iwb-lib, .iwb-lib-embedded').forEach((elm) => {
|
||||
document.querySelectorAll('.iwb-fullmask, .iwb-navrail, .iwb-plugin-page, .iwb-lib, .iwb-lib-embedded').forEach((elm) => {
|
||||
const r = elm.getBoundingClientRect()
|
||||
if (!r || r.width <= 4 || r.height <= 4) return
|
||||
obstacles.push({ x: (r.left - vp.x) / vp.scale, y: (r.top - vp.y) / vp.scale, w: r.width / vp.scale, h: r.height / vp.scale })
|
||||
@@ -2075,7 +2075,7 @@
|
||||
const topNode = nodeList.find((n) => n.y === minY)
|
||||
if (hasNodeTitle(topNode)) minY -= NODE_HEAD_H
|
||||
// 排除左侧工作台栏(含展开态)与可见的右侧提示词库,避免节点被遮挡
|
||||
const railEl = document.querySelector('.iwb-wsrail')
|
||||
const railEl = document.querySelector('.iwb-navrail, .iwb-plugin-page')
|
||||
const railW = railEl ? railEl.getBoundingClientRect().width : 0
|
||||
const libEl = document.querySelector('.iwb-lib')
|
||||
const libW = (libEl && libEl.getBoundingClientRect().width > 0) ? libEl.getBoundingClientRect().width : 0
|
||||
|
||||
+3
-1
@@ -143,7 +143,9 @@
|
||||
useEffect(function () {
|
||||
const r = global.document && global.document.documentElement
|
||||
if (!r) return
|
||||
const lw = dock.left.open ? dock.left.w : 0
|
||||
// 一级导航常驻在窗口最左(52px):左停靠栏整体右移,工具栏居中基准也要含它
|
||||
const NAV_W = 52
|
||||
const lw = dock.left.open ? (NAV_W + dock.left.w) : NAV_W
|
||||
const rw = dock.right.open ? dock.right.w : 0
|
||||
r.style.setProperty('--iwb-dock-l', lw + 'px')
|
||||
r.style.setProperty('--iwb-dock-r', rw + 'px')
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/* ui-hotkey-help.js —— 快捷键弹窗内容(v3.25.59 重构)
|
||||
*
|
||||
* 旧实现:30+ 行「键位 + 长句说明」平铺,查一条要扫屏。
|
||||
* 新实现(用户裁定):
|
||||
* · 上:分区罗列 —— 视图 / 编辑 / 界面 / 文件,键位用等宽小标签右对齐
|
||||
* · 下:「更多操作说明」折叠区,放原来那些长句(拖拽/连线/插入/中断恢复)
|
||||
* · 键位取自 config.canvas.hotkeys(缺省回落 HOTKEY_DEFAULTS),用户改键后这里跟着变
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
const React = global.React || {}
|
||||
const el = (type, prop, ...children) => React.createElement(type, prop, ...children)
|
||||
|
||||
const GROUPS = [
|
||||
{
|
||||
name: '视图',
|
||||
rows: [['fitView', '适应整个画布'], ['fitSelection', '适应选中节点'], ['zoomIn', '放大'], ['zoomOut', '缩小'], ['pan', '按住平移画布']],
|
||||
},
|
||||
{
|
||||
name: '编辑',
|
||||
rows: [['undo', '撤销'], ['redo', '重做'], ['copy', '复制节点'], ['paste', '粘贴节点'], ['cut', '剪切节点'], ['duplicate', '复制选中节点'], ['delete', '删除选中']],
|
||||
},
|
||||
{
|
||||
name: '界面',
|
||||
rows: [['toggleLeftDock', '左侧栏'], ['toggleLibrary', '右侧栏'], ['help', '本快捷键帮助'], ['cancel', '取消 / 关闭弹层'], ['toolSelect', '选择工具'], ['toolPan', '抓手工具']],
|
||||
},
|
||||
{
|
||||
name: '文件与分组',
|
||||
rows: [['save', '保存画布'], ['exportCanvas', '导出画布'], ['selectAll', '全选节点'], ['group', '编组'], ['ungroup', '取消编组'], ['rename', '重命名节点'], ['runAll', '运行全部生图节点']],
|
||||
},
|
||||
]
|
||||
|
||||
// 长句说明:原来的「操作说明」内容,收进折叠区
|
||||
const DETAILS = [
|
||||
['拖拽 / 框选', '拖动画布空白 = 框选节点(Shift 追加、Alt 反选);拖动节点 = 移动;Ctrl/Cmd + 点击 = 多选'],
|
||||
['空格 / 鼠标中键', '按住拖动平移画布;抓手工具(H)等效,V 切回选择'],
|
||||
['滚轮', '缩放画布;节点右下角可拖拽改尺寸'],
|
||||
['双击节点标题', '居中放大该节点;重命名走气泡铅笔 / 右键菜单 / F2'],
|
||||
['右键', '自定义菜单:添加节点 / 复制选中 / 导出节点组 / 收藏 / 删除 / 该节点操作'],
|
||||
['连线', '从出端口拖到目标区域自动连接(绿框可连、红框不可连);点选连线 Delete 断开,双击直接断开'],
|
||||
['Alt + 拖到连线', '插入:节点吸附到连线中间并拆成两条;链中间单入单出的节点 Alt 拖出 = 脱离'],
|
||||
['拖入图片', '本地文件 / 图库历史 / 提示词卡片 / 节点组卡片拖进画布都会生成对应节点'],
|
||||
['任务卡复选框', '勾选 = 参与「生成全部 / 输出出图」;取消勾选 = 跳过;张数下拉在生成按钮前'],
|
||||
['中断恢复', '生成中途刷新或关闭:重开后底部横幅可一键继续(跳过已完成张,24 小时内有效)'],
|
||||
['提示词变量', '提示词里写 {date} {time} {model},发送生成时自动替换'],
|
||||
]
|
||||
|
||||
function HotkeyTable (props) {
|
||||
const hotkeys = props.hotkeys || {}
|
||||
const defaults = props.defaults || {}
|
||||
const keyOf = (id) => String(hotkeys[id] || defaults[id] || '').trim()
|
||||
return el('div', { className: 'iwb-hotkey-grid' },
|
||||
GROUPS.map((g) => el('section', { key: g.name, className: 'iwb-hotkey-group' },
|
||||
el('h4', { className: 'iwb-hotkey-gname' }, g.name),
|
||||
g.rows.map(([id, label]) => el('div', { key: id, className: 'iwb-hotkey-row' },
|
||||
el('span', { className: 'iwb-hotkey-name' }, label),
|
||||
el('kbd', { className: 'iwb-hotkey-key' }, keyOf(id) || '未设置'),
|
||||
)),
|
||||
)),
|
||||
)
|
||||
}
|
||||
|
||||
function HotkeyHelp (props) {
|
||||
const [openDetails, setOpenDetails] = React.useState(!!(props && props.detailsOpen))
|
||||
return el('div', { className: 'iwb-hotkey-help' },
|
||||
el(HotkeyTable, { hotkeys: props && props.hotkeys, defaults: props && props.defaults }),
|
||||
el('div', { className: 'iwb-hotkey-more' },
|
||||
el('button', {
|
||||
type: 'button',
|
||||
className: 'iwb-hotkey-toggle',
|
||||
onClick: () => setOpenDetails((v) => !v),
|
||||
}, (openDetails ? '▾ ' : '▸ ') + '更多操作说明'),
|
||||
openDetails ? el('div', { className: 'iwb-hotkey-details' },
|
||||
DETAILS.map(([k, v]) => el('div', { key: k, className: 'iwb-hotkey-detail-row' },
|
||||
el('b', null, k), el('span', null, v))),
|
||||
) : null,
|
||||
),
|
||||
el('div', { className: 'iwb-hotkey-note' }, '键位可在「设置 → 快捷键」修改;改完这里会同步。'),
|
||||
)
|
||||
}
|
||||
|
||||
global.IWBUIHotkeyHelp = { HotkeyHelp, HotkeyTable }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -0,0 +1,60 @@
|
||||
/* ui-nav-rail.js —— 最左侧一级导航(v3.25.59)
|
||||
*
|
||||
* 设计(用户裁定):
|
||||
* · 52px、**纯图标**(无文字),占原来 wsrail 的槽位,不额外挤占画布
|
||||
* · 顶部:软件 logo(品牌占位,不跳转)
|
||||
* · 主组:首页(画布库)/ 列表(画布工作区)/ 插件(整页插件管理)
|
||||
* · 底部组:帮助 / 快捷键 / 皮肤 / 设置 / 更多
|
||||
* · 选中态 = 深色圆底 + 白色图标;未选中 = 线性图标;悬停 = 浅灰圆底
|
||||
*
|
||||
* 纯展示组件:所有回调与当前视图经 props 传入,不读 Workbench 局部状态。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
const React = global.React || {}
|
||||
const el = (type, prop, ...children) => React.createElement(type, prop, ...children)
|
||||
|
||||
function IWBUINavRail (props) {
|
||||
const I = props.I
|
||||
const view = props.view || 'canvas' // 'home' | 'canvas' | 'plugins'
|
||||
const onHome = props.onHome
|
||||
const onCanvas = props.onCanvas
|
||||
const onPlugins = props.onPlugins
|
||||
const onHelp = props.onHelp
|
||||
const onHotkeys = props.onHotkeys
|
||||
const onSkin = props.onSkin
|
||||
const onSettings = props.onSettings
|
||||
const onMore = props.onMore
|
||||
const skinIcon = props.skinIcon || 'moon'
|
||||
|
||||
const item = (key, iconName, title, active, onClick) => el('button', {
|
||||
key,
|
||||
type: 'button',
|
||||
className: 'iwb-nav-item' + (active ? ' on' : ''),
|
||||
title,
|
||||
'aria-label': title,
|
||||
'aria-pressed': active ? 'true' : 'false',
|
||||
onPointerDown: (e) => e.stopPropagation(),
|
||||
onClick: (e) => { e.stopPropagation(); if (typeof onClick === 'function') onClick(e) },
|
||||
}, I(iconName))
|
||||
|
||||
return el('nav', { className: 'iwb-navrail', 'aria-label': '一级导航' },
|
||||
el('div', { className: 'iwb-navrail-logo', title: '无限画布', onPointerDown: (e) => e.stopPropagation() }, I('palette')),
|
||||
el('div', { className: 'iwb-navrail-group' },
|
||||
item('home', 'home', '首页(画布库)', view === 'home', onHome),
|
||||
item('canvas', 'layer', '列表(画布工作区)', view === 'canvas', onCanvas),
|
||||
item('plugins', 'box', '插件', view === 'plugins', onPlugins),
|
||||
),
|
||||
el('div', { className: 'iwb-navrail-spacer' }),
|
||||
el('div', { className: 'iwb-navrail-group' },
|
||||
item('help', 'help', '帮助', false, onHelp),
|
||||
item('hotkeys', 'circle-dot', '快捷键', false, onHotkeys),
|
||||
item('skin', skinIcon, '切换主题', false, onSkin),
|
||||
item('settings', 'settings', '设置', false, onSettings),
|
||||
item('more', 'more', '更多', false, onMore),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
global.IWBUINavRail = IWBUINavRail
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -0,0 +1,52 @@
|
||||
/* ui-plugin-page.js —— 插件整页(v3.25.59)
|
||||
*
|
||||
* 用户裁定:一级导航主组的「插件」图标进入**整页**,内容与「设置 → 插件管理」一致。
|
||||
*
|
||||
* 为什么单独成文件而不是塞进 ui-settings-modal.js:
|
||||
* 后者已接近「单组件行数棘轮」上限,再放一个页面组件会直接打红。
|
||||
* 这里只做「页面壳 + 把插件管理块渲染出来」,数据由宿主经 props 注入。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
const React = global.React || {}
|
||||
const el = (type, prop, ...children) => React.createElement(type, prop, ...children)
|
||||
|
||||
function IWBUIPluginPage (props) {
|
||||
const I = props.I
|
||||
const [rev, setRev] = React.useState(0)
|
||||
const [busy, setBusy] = React.useState('')
|
||||
const [msg, setMsg] = React.useState(null)
|
||||
const PluginHost = props.PluginHost
|
||||
const S = props.Sections || ((typeof window !== 'undefined') ? window.IWBUISettingsSections : null)
|
||||
const items = React.useMemo(
|
||||
() => ((PluginHost && typeof PluginHost.list === 'function') ? PluginHost.list() : []),
|
||||
[rev, PluginHost]
|
||||
)
|
||||
const body = S ? S.renderPluginsTab({
|
||||
PluginHost,
|
||||
pluginBusy: busy,
|
||||
pluginItems: items,
|
||||
setMsg: setMsg,
|
||||
setPluginBusy: setBusy,
|
||||
setPluginsRev: setRev,
|
||||
setTab: function () {},
|
||||
wEnsurePluginLoaded: props.wEnsurePluginLoaded,
|
||||
wRuntimePlugins: props.wRuntimePlugins || [],
|
||||
}) : el('div', { className: 'iwb-hint' }, '插件模块未就绪')
|
||||
|
||||
return el('div', { className: 'iwb-plugin-page' },
|
||||
el('div', { className: 'iwb-plugin-page-head' },
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => { if (props.onBack) props.onBack() } },
|
||||
I ? I('chevronLeft') : null, '返回画布'),
|
||||
el('span', { className: 'iwb-plugin-page-title' }, '插件'),
|
||||
el('span', { className: 'iwb-plugin-page-sub' }, '管理与市场(与「设置 → 插件管理」同一份数据)'),
|
||||
),
|
||||
el('div', { className: 'iwb-plugin-page-body' },
|
||||
body,
|
||||
msg ? el('div', { className: 'iwb-status-' + (msg.type === 'err' ? 'err' : 'ok') }, msg.text) : null,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
global.IWBUIPluginPage = IWBUIPluginPage
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
Reference in new issue
Block a user