This commit is contained in:
1 parent
8523120f6c
commit
f51626040c
3 files changed
+5
-29
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@iwb-plugin/promptlib",
|
||||
"private": true,
|
||||
"version": "1.4.5",
|
||||
"version": "1.4.6",
|
||||
"description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供",
|
||||
"ibwPlugin": {
|
||||
"id": "promptlib",
|
||||
|
||||
+4
-22
@@ -134,20 +134,6 @@
|
||||
step()
|
||||
}
|
||||
|
||||
var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带 .iwb-plp-*,不影响宿主与其他插件;样式随插件发布,不必等客户端发版。 */\n\n/* 分组胶囊「适应面板宽度」自动换行。\n 宿主的 .iwb-lib-chips 是 flex-wrap: nowrap(配 .iwb-lib-chips-scroll 做单行横向滚动 + 右侧渐隐),\n 分组多时靠后的分类看不见也点不到。双类选择器提高优先级(不依赖样式注入顺序)。 */\n.iwb-lib-chips.iwb-plp-chips {\n flex-wrap: wrap;\n row-gap: 6px;\n}\n\n/* + / ⚙ 是动作按钮,不是分组名:不参与压缩,并与最后一个分组稍作分隔 */\n.iwb-plp-chips .iwb-plp-add {\n flex: 0 0 auto;\n margin-left: 2px;\n}\n\n/* v1.0.2(2026-11-21):卡片化 —— 白卡 + 悬停 + 文本三行截断。\n 颜色一律走宿主 --iwb-plugin-* / --iwb-* token,不在插件里写死。 */\n.iwb-promptlib .iwb-pname { font-weight: 600; }\n.iwb-promptlib .iwb-ptext {\n display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;\n overflow: hidden; color: var(--iwb-text2, #4d5668);\n}\n.iwb-promptlib .iwb-lib-cards { gap: 8px; }\n\n/* v1.1.0(2026-11-21):封面网格 + 长文详情 + 宽编辑弹窗。\n 颜色全部走宿主 token,不写死。 */\n.iwb-plp-card {\n position: relative; border-radius: 10px; overflow: hidden; cursor: pointer;\n aspect-ratio: 1 / 1; border: 1px solid var(--iwb-border, #d5d9e0);\n transition: border-color .12s ease, transform .12s ease;\n}\n.iwb-plp-card:hover { border-color: var(--iwb-border2, #b9bfca); }\n.iwb-plp-cover { width: 100%; height: 100%; object-fit: cover; display: block; }\n.iwb-plp-t {\n position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 7px 6px;\n background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.66));\n color: #fff; font-size: 10.5px; line-height: 1.35; max-height: 48%;\n display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;\n text-shadow: 0 1px 2px rgba(0,0,0,.35);\n}\n/* 详情:长文阅读 */\n.iwb-plp-dhead { display: flex; align-items: center; gap: 6px; padding: 2px 0 8px; position: sticky; top: 0; z-index: 2; background: var(--iwb-plugin-surface, #fafafb); }\n.iwb-plp-dtop { align-items: flex-start; gap: 10px; margin-bottom: 8px; }\n.iwb-plp-dthumb { flex: 0 0 84px; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--iwb-border, #d5d9e0); }\n.iwb-plp-dmeta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }\n.iwb-plp-dtitle { font-size: 13px; font-weight: 600; color: var(--iwb-text, #1c2333); line-height: 1.45; }\n.iwb-plp-dtext {\n font-size: 12px; line-height: 1.75; color: var(--iwb-text2, #4d5668);\n white-space: pre-wrap; word-break: break-word; padding: 4px 0 12px;\n}\n.iwb-plp-dfoot { display: flex; align-items: center; gap: 6px; padding: 8px 0 2px; position: sticky; bottom: 0; background: var(--iwb-plugin-surface, #fafafb); }\n/* 编辑弹窗:760 宽 + 大文本框 */\n.iwb-promptlib-editor { width: 760px; max-width: 94vw; }\n.iwb-promptlib-editor .iwb-modal-body { max-height: 78vh; }\n.iwb-promptlib-text { min-height: 360px; height: 44vh; font-size: 12.5px; line-height: 1.9; resize: vertical; }\n.iwb-plp-editor-cover { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }\n.iwb-plp-editor-thumb { flex: 0 0 96px; width: 96px; height: 128px; border-radius: 8px; overflow: hidden; border: 1px solid var(--iwb-border, #d5d9e0); }\n.iwb-plp-editor-coverops { display: flex; flex-direction: column; gap: 8px; }\n\n/* v1.2.0:可拖动 / 可缩放的详情与编辑弹窗(同宽 880×640,最小 640×420) */\n.iwb-plp-mask { background: transparent; display: block; }\n.iwb-plp-dialog { display: flex; flex-direction: column; overflow: hidden; border-radius: 16px;\n box-shadow: 0 24px 60px rgba(0,0,0,.28); }\n.iwb-plp-dhead { display: flex; align-items: center; gap: 6px; padding: 10px 14px;\n border-bottom: 1px solid var(--iwb-border, #d5d9e0); cursor: move; user-select: none; }\n.iwb-plp-grip { display: grid; grid-template-columns: repeat(3, 3px); gap: 2px; margin-right: 6px; }\n.iwb-plp-grip i { width: 3px; height: 3px; border-radius: 50%; background: var(--iwb-border2, #b9bfca); display: block; }\n.iwb-plp-dbody { flex: 1 1 auto; min-height: 0; display: flex; gap: 14px; padding: 14px; }\n.iwb-plp-dcov { flex: 0 0 210px; width: 210px; height: 280px; border-radius: 10px; overflow: hidden;\n border: 1px solid var(--iwb-border, #d5d9e0); background: var(--iwb-plugin-inset, #f5f6f7); }\n.iwb-plp-dright { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }\n.iwb-plp-dtext { flex: 1 1 auto; min-height: 0; overflow: auto; white-space: pre-wrap; word-break: break-word;\n font-size: 12px; line-height: 1.9; color: var(--iwb-text2, #4d5668); }\n.iwb-plp-dfooter { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 14pLine truncated
|
||||
// v1.4.2:自带样式(不再依赖宿主注入 styles.css)—— 宿主样式加载失败时也能正确排版
|
||||
function ensureStyle () {
|
||||
try {
|
||||
if (document.querySelector('style[data-plugin="promptlib-inline"]')) return
|
||||
var n = document.createElement('style')
|
||||
n.setAttribute('data-plugin', 'promptlib-inline')
|
||||
try { const n0 = document.querySelector('style[nonce], link[nonce]'); if (n0 && n0.nonce) n.setAttribute('nonce', n0.nonce) } catch (e) { /* ignore */ }
|
||||
n.textContent = PLP_CSS
|
||||
;(document.body || document.head).appendChild(n)
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
ensureStyle()
|
||||
|
||||
// ---- 搜索 / 过滤 ----
|
||||
function words () { return query.trim().toLowerCase().split(/\s+/).filter(Boolean) }
|
||||
function matches (p) {
|
||||
@@ -344,10 +330,7 @@ var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带
|
||||
var coverPending = {}
|
||||
function coverOf (p) {
|
||||
if (!p || !p.cover) return ''
|
||||
var cov = p.cover
|
||||
if (typeof cov === 'string' && cov.charAt(0) === '{') { try { cov = JSON.parse(cov) } catch (e) { cov = '' } }
|
||||
if (!cov) return ''
|
||||
var ck = (typeof cov === 'object') ? ('b:' + String(cov.__blob || cov.__cache || 'obj')) : ('s:' + String(cov).slice(-32))
|
||||
var ck = (p.cover && typeof p.cover === 'object') ? ('b:' + String(p.cover.__blob || p.cover.__cache || 'obj')) : ('s:' + String(p.cover).slice(-32))
|
||||
var key = p.id + '|' + ck
|
||||
var hit = coverCache[key]
|
||||
if (hit) return hit
|
||||
@@ -355,7 +338,7 @@ var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带
|
||||
if (!coverPending[key]) {
|
||||
coverPending[key] = 1
|
||||
try {
|
||||
Promise.resolve(api.coverUrl(cov)).then(function (r) {
|
||||
Promise.resolve(api.coverUrl(p.cover)).then(function (r) {
|
||||
delete coverPending[key]
|
||||
if (r && r.ok && r.url) { coverCache[key] = r.url; render() }
|
||||
}).catch(function () { delete coverPending[key] })
|
||||
@@ -684,8 +667,7 @@ var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带
|
||||
items.forEach(function (p) {
|
||||
var starred = (p.group || '') === '收藏'
|
||||
var coverUrl = coverOf(p)
|
||||
var card = el('div', { class: 'iwb-plp-card' + (p.cover ? ' has-cover' : ' no-cover'), draggable: 'true', tabindex: '0', role: 'button', title: '单击查看详情 · 拖到画布插入 · 右键移动到分组' })
|
||||
card.addEventListener('keydown', function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openDetailModal(p) } })
|
||||
var card = el('div', { class: 'iwb-plp-card' + (p.cover ? ' has-cover' : ' no-cover'), draggable: 'true', title: '单击查看详情 · 拖到画布插入 · 右键移动到分组' })
|
||||
card.style.background = coverUrl ? 'var(--iwb-plugin-inset)' : gradOf(p)
|
||||
if (coverUrl) card.appendChild(el('img', { class: 'iwb-plp-cover', src: coverUrl, alt: '', draggable: 'false' }))
|
||||
card.appendChild(el('div', { class: 'iwb-plp-t', text: p.name || '未命名' }))
|
||||
@@ -733,7 +715,7 @@ var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带
|
||||
global.IWBPluginHost.register({
|
||||
id: 'promptlib',
|
||||
name: '提示词库',
|
||||
version: '1.4.5',
|
||||
version: '1.4.6',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'promptlib'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
|
||||
@@ -131,9 +131,3 @@
|
||||
/* v1.3.5:无封面的提示词也给一个方形占位(否则瀑布流里会塌成一条线) */
|
||||
.iwb-promptlib .iwb-plp-card.no-cover { aspect-ratio: 1 / 1; }
|
||||
.iwb-promptlib .iwb-plp-card.no-cover .iwb-plp-t { max-height: 60%; }
|
||||
|
||||
/* v1.4.1:键盘可达 —— 卡片可 Tab 聚焦,Enter/Space 打开详情 */
|
||||
.iwb-promptlib .iwb-plp-card:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px var(--iwb-brand, #6b7280);
|
||||
}
|
||||
Reference in new issue
Block a user