feat(promptlib): 分组胶囊改为适应面板宽度自动换行 v1.0.1

与节点组同一问题:宿主 .iwb-lib-chips 是 nowrap + .iwb-lib-chips-scroll 单行滚动(右侧渐隐),
分组多时靠后的分类看不见也点不到。
- 去掉滚动容器,胶囊行加 .iwb-plp-chips,自带 styles.css 用双类选择器改 flex-wrap: wrap
- +/⚙ 由「钉在滚动区右侧」改为随胶囊一起换行(与 grouplib 一致),归到 .iwb-plp-add
This commit is contained in:
qiqi committed 2026-11-20 17:37:40 +08:00
1 parent ceb97aecee
commit 5da8f6d3f1
3 files changed
+27 -11

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@iwb-plugin/promptlib",
"private": true,
"version": "1.0.0",
"version": "1.0.1",
"description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供",
"ibwPlugin": {
"id": "promptlib",
+10 -10
View File
@@ -410,9 +410,10 @@
fixed.appendChild(scope)
}
// 分组胶囊:滚动区 + 右侧固定 + / ⚙
var chips = el('div', { class: 'iwb-lib-chips' })
var chipsScroll = el('div', { class: 'iwb-lib-chips-scroll' })
// 分组胶囊:与节点组一致 —— 适应面板宽度自动换行。
// 宿主 .iwb-lib-chips 是 nowrap + .iwb-lib-chips-scroll 单行滚动(右侧渐隐),
// 分组多时靠后的分类看不见也点不到;换行规则在插件自带 styles.css 的 .iwb-plp-chips 里。
var chips = el('div', { class: 'iwb-lib-chips iwb-plp-chips' })
var chip = function (label, value, count, drop) {
var active = (value === 'all' && (filter === 'all' || words().length)) || filter === value
var b = el('button', { class: 'iwb-chip' + (active ? ' iwb-chip-active' : '') + (drop ? ' iwb-chip-drop' : ''), title: drop ? '拖拽提示词卡片到此 = 移动到该分组' : '' })
@@ -431,11 +432,10 @@
}
return b
}
chipsScroll.appendChild(chip('全部', 'all', prompts.length))
chipsScroll.appendChild(chip('未分组', '__none__', countOf('__none__'), true))
gs.forEach(function (g) { chipsScroll.appendChild(chip(g.name, g.name, countOf(g.name), true)) })
chips.appendChild(chipsScroll)
var addChip = el('button', { class: 'iwb-chip iwb-chip-add', title: '新建分组', text: '+' })
chips.appendChild(chip('全部', 'all', prompts.length))
chips.appendChild(chip('未分组', '__none__', countOf('__none__'), true))
gs.forEach(function (g) { chips.appendChild(chip(g.name, g.name, countOf(g.name), true)) })
var addChip = el('button', { class: 'iwb-chip iwb-plp-add iwb-chip-add', title: '新建分组', text: '+' })
addChip.addEventListener('click', function () {
var input = el('input', { class: 'iwb-input', placeholder: '新分组名称' })
var mask = el('div', { class: 'iwb-modal-mask' })
@@ -462,7 +462,7 @@
setTimeout(function () { try { input.focus() } catch (e) { /* ignore */ } }, 0)
})
chips.appendChild(addChip)
var mgChip = el('button', { class: 'iwb-chip iwb-chip-add', title: '管理分组(重命名 / 排序 / 删除)', text: '⚙' })
var mgChip = el('button', { class: 'iwb-chip iwb-plp-add iwb-chip-add', title: '管理分组(重命名 / 排序 / 删除)', text: '⚙' })
mgChip.addEventListener('click', openManager)
chips.appendChild(mgChip)
fixed.appendChild(chips)
@@ -573,7 +573,7 @@
global.IWBPluginHost.register({
id: 'promptlib',
name: '提示词库',
version: '1.0.0',
version: '1.0.1',
apiVersion: 1,
capabilities: ['panels', 'promptlib'],
data: { schemaVersion: 1, maxBytes: 65536 },
+16
View File
@@ -0,0 +1,16 @@
/* promptlib(提示词库)自带样式
作用域全部带 .iwb-plp-*,不影响宿主与其他插件;样式随插件发布,不必等客户端发版。 */
/* 分组胶囊「适应面板宽度」自动换行。
宿主的 .iwb-lib-chips 是 flex-wrap: nowrap(配 .iwb-lib-chips-scroll 做单行横向滚动 + 右侧渐隐),
分组多时靠后的分类看不见也点不到。双类选择器提高优先级(不依赖样式注入顺序)。 */
.iwb-lib-chips.iwb-plp-chips {
flex-wrap: wrap;
row-gap: 6px;
}
/* + / ⚙ 是动作按钮,不是分组名:不参与压缩,并与最后一个分组稍作分隔 */
.iwb-plp-chips .iwb-plp-add {
flex: 0 0 auto;
margin-left: 2px;
}