chore(plugin): 同步 gallery 1.5.1 / grouplib 1.0.2 + 回归(胶囊滚动容器、.iwb-hint 作用域)
This commit is contained in:
1 parent
1d308377a5
commit
bd138b7a7e
7 files changed
+32
-17
No files matched your search
@@ -372,7 +372,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'gallery',
|
||||
name: '图库',
|
||||
version: '1.5.0',
|
||||
version: '1.5.1',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'gallery'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "gallery",
|
||||
"name": "图库",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"图库"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "1b831a6bd2e3ab405a8524294cf422c04ff1bc950d0e2c012e1a686fec77926a",
|
||||
"styles.css": "94c57b2d18deef3f672242efe1812ba1dc88dad90f03648d68feaa64bc70f572"
|
||||
"main.js": "83ea7f97379bc9cf9cc70e83b1578b114b37607dccac96fcd729fe8ce0027a42",
|
||||
"styles.css": "75fb6f379f2c94939e1de98c56082bc5cbef299283e7cc1325e569f3bfdd5f1f"
|
||||
}
|
||||
}
|
||||
@@ -65,4 +65,5 @@
|
||||
.iwb-history-actions { display: flex; gap: 4px; padding: 4px 2px 0; }
|
||||
.iwb-history-actions .iwb-btn-sm { padding: 1px 6px; font-size: 10px; }
|
||||
.iwb-history-more { display: flex; justify-content: center; padding: 4px 0 2px; }
|
||||
.iwb-hint { font-size: 11px; color: var(--iwb-text2); text-align: center; padding: 12px 6px; }
|
||||
/* 只作用于图库自己的空态提示:不加前缀会泄漏到设置页等使用 .iwb-hint 的地方(文字被居中) */
|
||||
.iwb-history-embedded .iwb-hint { font-size: 11px; color: var(--iwb-text2); text-align: center; padding: 12px 6px; }
|
||||
+6
-6
@@ -22,17 +22,17 @@
|
||||
"dir": "gallery",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"files": {
|
||||
"main.js": "1b831a6bd2e3ab405a8524294cf422c04ff1bc950d0e2c012e1a686fec77926a",
|
||||
"styles.css": "94c57b2d18deef3f672242efe1812ba1dc88dad90f03648d68feaa64bc70f572"
|
||||
"main.js": "83ea7f97379bc9cf9cc70e83b1578b114b37607dccac96fcd729fe8ce0027a42",
|
||||
"styles.css": "75fb6f379f2c94939e1de98c56082bc5cbef299283e7cc1325e569f3bfdd5f1f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "grouplib",
|
||||
"file": "plugin-grouplib.084fb3f7615a.js",
|
||||
"version": "1.0.1",
|
||||
"integrity": "sha256-CE+z92FarkfIm+AZk3EksCKRee/Nf8dqB/zNNe+7iHg="
|
||||
"file": "plugin-grouplib.0f63972e5c8c.js",
|
||||
"version": "1.0.2",
|
||||
"integrity": "sha256-D2OXLlyMDZecVN1XpGgLHX66mfY15j0YHMoPyBIi1U0="
|
||||
},
|
||||
{
|
||||
"id": "image-annotate",
|
||||
|
||||
+9
-6
@@ -281,8 +281,11 @@
|
||||
}
|
||||
fixed.appendChild(topRow)
|
||||
|
||||
// 分类胶囊
|
||||
// 分类胶囊:宿主的 .iwb-lib-chips-scroll 负责「单行 + 横向滚动 + 右侧渐隐」,
|
||||
// 直接铺在 .iwb-lib-chips 里会被 nowrap 裁掉(分组多时右侧分类看不见)
|
||||
var chips = el('div', { class: 'iwb-lib-chips' })
|
||||
var chipsScroll = el('div', { class: 'iwb-lib-chips-scroll' })
|
||||
chips.appendChild(chipsScroll)
|
||||
function chip (label, value, count, extra) {
|
||||
var b = el('button', { class: 'iwb-chip' + (filter === value ? ' iwb-chip-active' : '') + (extra || ''), title: value === '__none__' ? '未分组;拖拽节点组卡片到此 = 移出分组' : (value === 'all' ? '' : '拖拽节点组卡片到此 = 移动到该分组') })
|
||||
b.appendChild(document.createTextNode(label))
|
||||
@@ -297,15 +300,15 @@
|
||||
})
|
||||
return b
|
||||
}
|
||||
chips.appendChild(chip('全部', 'all', list.length))
|
||||
chips.appendChild(chip('未分组', '__none__', countOf('__none__'), ' iwb-chip-drop'))
|
||||
chipsScroll.appendChild(chip('全部', 'all', list.length))
|
||||
chipsScroll.appendChild(chip('未分组', '__none__', countOf('__none__'), ' iwb-chip-drop'))
|
||||
gs.forEach(function (g) { chips.appendChild(chip(g.name, g.name, countOf(g.name), ' iwb-chip-drop')) })
|
||||
var addChip = el('button', { class: 'iwb-chip iwb-chip-add', title: '新建分组', text: '+' })
|
||||
addChip.addEventListener('click', function () { newOpen = !newOpen; render() })
|
||||
chips.appendChild(addChip)
|
||||
chipsScroll.appendChild(addChip)
|
||||
var mgChip = el('button', { class: 'iwb-chip iwb-chip-add', title: '管理分组(重命名 / 排序 / 删除)', text: '⚙' })
|
||||
mgChip.addEventListener('click', openManager)
|
||||
chips.appendChild(mgChip)
|
||||
chipsScroll.appendChild(mgChip)
|
||||
fixed.appendChild(chips)
|
||||
|
||||
if (newOpen) {
|
||||
@@ -432,7 +435,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'grouplib',
|
||||
name: '节点组',
|
||||
version: '1.0.1',
|
||||
version: '1.0.2',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'grouplib'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
@@ -13,6 +13,13 @@ const { JSDOM } = require('jsdom')
|
||||
const src = fs.readFileSync(path.resolve(__dirname, '..', '..', 'iwb-plugins-desktop', 'gallery', 'src', 'index.js'), 'utf8')
|
||||
// 插件自带样式:图标按钮无外框、工具组横排,靠这份 CSS 保证(不依赖客户端 style.css)
|
||||
const pluginCss = fs.readFileSync(path.resolve(__dirname, '..', '..', 'iwb-plugins-desktop', 'gallery', 'styles.css'), 'utf8')
|
||||
// 插件样式会注入到整页:不允许出现未限定作用域的 .iwb-hint(会把设置页说明文字变成居中)
|
||||
assertNoGlobalHint()
|
||||
function assertNoGlobalHint () {
|
||||
const bad = pluginCss.split('\n').filter((line) => /^\.iwb-hint\s*\{/.test(line.trim()))
|
||||
if (bad.length) throw new Error('图库 styles.css 存在未限定作用域的 .iwb-hint:' + bad.join(' / '))
|
||||
if (pluginCss.indexOf('.iwb-history-embedded .iwb-hint') < 0) throw new Error('图库 styles.css 应把 .iwb-hint 限定在 .iwb-history-embedded 下')
|
||||
}
|
||||
|
||||
const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
|
||||
|
||||
@@ -57,6 +57,10 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
|
||||
const cards = () => Array.from(host.querySelectorAll('.iwb-pcard'))
|
||||
assert.strictEqual(cards().length, 2, '应渲染两个节点组卡片,实际 ' + cards().length)
|
||||
// 胶囊必须在横向滚动容器里(否则分组多了右侧分类被裁掉)
|
||||
const chipsWrap = host.querySelector('.iwb-lib-chips')
|
||||
assert.ok(chipsWrap && chipsWrap.querySelector('.iwb-lib-chips-scroll'), '胶囊行应有 .iwb-lib-chips-scroll 滚动容器')
|
||||
assert.ok(chipsWrap.querySelector('.iwb-lib-chips-scroll .iwb-chip'), '胶囊应放在滚动容器内')
|
||||
const chips = Array.from(host.querySelectorAll('.iwb-chip')).map((c) => c.textContent)
|
||||
assert.ok(chips.some((t) => t.indexOf('全部') === 0 && /2$/.test(t)), '应有「全部 2」胶囊:' + chips.join('|'))
|
||||
assert.ok(chips.some((t) => t.indexOf('未分组') === 0 && /1$/.test(t)), '应有「未分组 1」胶囊:' + chips.join('|'))
|
||||
|
||||
Reference in new issue
Block a user