@telosmaylx/dsh-session-notify 0.1.9 → 0.1.10
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 +590 -0
- package/README.ja.md +590 -0
- package/README.ko.md +590 -0
- package/README.md +11 -4
- package/README.zh-TW.md +590 -0
- package/lib/client.js +17 -24
- package/package.json +5 -1
package/lib/client.js
CHANGED
|
@@ -975,6 +975,7 @@ window.__ModuleLoader__.load({
|
|
|
975
975
|
var titleTplOpenState = useState(false) // 「按原因定制标题」折叠区展开状态
|
|
976
976
|
var titleTplOpen = titleTplOpenState[0]
|
|
977
977
|
var setTitleTplOpen = titleTplOpenState[1]
|
|
978
|
+
var titleInputRef = useRef(null) // 全局推送标题 input(「+ 会话标题」在光标处插入)
|
|
978
979
|
|
|
979
980
|
/** 用户手势内请求通知权限(Chromium 忽略非手势的自动请求,必须由点击触发);授权结果经重渲染刷新状态区。 */
|
|
980
981
|
function requestPermissionNow() {
|
|
@@ -1254,34 +1255,26 @@ window.__ModuleLoader__.load({
|
|
|
1254
1255
|
h('div', { style: { fontSize: '13px', color: 'var(--dsw-alias-label-secondary, inherit)' } }, t.titleLabel),
|
|
1255
1256
|
h('button', {
|
|
1256
1257
|
type: 'button', title: t.insertTitle,
|
|
1257
|
-
onClick: function () {
|
|
1258
|
+
onClick: function () {
|
|
1259
|
+
var el = titleInputRef.current
|
|
1260
|
+
var val = String(cur.titleTemplate ?? '')
|
|
1261
|
+
var pos = el ? (el.selectionStart != null ? el.selectionStart : val.length) : val.length
|
|
1262
|
+
var next = val.slice(0, pos) + '{title}' + val.slice(pos)
|
|
1263
|
+
setVal('titleTemplate', next)
|
|
1264
|
+
setTimeout(function () {
|
|
1265
|
+
if (el) { el.focus(); var np = pos + 7; el.setSelectionRange(np, np) }
|
|
1266
|
+
}, 0)
|
|
1267
|
+
},
|
|
1258
1268
|
style: { appearance: 'none', font: 'inherit', fontSize: '12px', cursor: 'pointer', padding: '3px 10px', borderRadius: '999px', border: '1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))', background: 'none', color: 'var(--dsw-alias-label-secondary, inherit)' },
|
|
1259
|
-
}, t.
|
|
1269
|
+
}, '+ ' + t.tokens.title),
|
|
1260
1270
|
),
|
|
1261
|
-
h(
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
hint: '',
|
|
1271
|
+
h('input', {
|
|
1272
|
+
ref: titleInputRef,
|
|
1273
|
+
value: String(cur.titleTemplate ?? ''),
|
|
1265
1274
|
placeholder: t.titleHint,
|
|
1266
|
-
onChange: function (
|
|
1267
|
-
|
|
1268
|
-
if (handle) editorRefs.current.title = handle
|
|
1269
|
-
else delete editorRefs.current.title
|
|
1270
|
-
},
|
|
1275
|
+
onChange: function (e) { setVal('titleTemplate', e.target.value) },
|
|
1276
|
+
style: Object.assign({}, SELECT_STYLE, { flex: 1, fontSize: '13px' }),
|
|
1271
1277
|
}),
|
|
1272
|
-
menuFor === 'title'
|
|
1273
|
-
? h('div', { key: 'menu-title', style: { display: 'flex', flexWrap: 'wrap', gap: '6px', padding: '8px', borderRadius: '8px', border: '1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))', background: 'var(--dsw-alias-bg-layer-2, rgba(127,127,127,0.10))' } },
|
|
1274
|
-
h('button', {
|
|
1275
|
-
type: 'button', onClick: function () {
|
|
1276
|
-
var handle = editorRefs.current.title
|
|
1277
|
-
if (handle) handle.insertAtCaret('title')
|
|
1278
|
-
else setVal('titleTemplate', String(cur.titleTemplate ?? '') + '{title}')
|
|
1279
|
-
// 插入后保持菜单展开:方便连续插入多个标签,由用户自行折叠
|
|
1280
|
-
},
|
|
1281
|
-
style: { appearance: 'none', font: 'inherit', fontSize: '12px', cursor: 'pointer', padding: '4px 10px', borderRadius: '999px', border: '1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))', background: 'none', color: 'var(--dsw-alias-label-secondary, inherit)' },
|
|
1282
|
-
}, '+ ' + t.tokens.title)
|
|
1283
|
-
)
|
|
1284
|
-
: null,
|
|
1285
1278
|
),
|
|
1286
1279
|
// 按原因定制标题(折叠区,避免界面臃肿):留空 = 用上方全局模板或语言默认标题
|
|
1287
1280
|
h('div', { key: 'title-tpl', style: { display: 'flex', flexDirection: 'column', gap: '6px', padding: '12px 0', borderTop: DIVIDER } },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telosmaylx/dsh-session-notify",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "DSH session completion notifier: appends a plugin system message to the session log on turn/end and pushes browser notifications (Web Notification + toast), with a fully customizable official settings panel (presets, 5-language templates, cache-hit rate & tok/s from official projections).",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"scripts",
|
|
23
23
|
"cordis.patch.yml",
|
|
24
24
|
"README.md",
|
|
25
|
+
"README.en.md",
|
|
26
|
+
"README.zh-TW.md",
|
|
27
|
+
"README.ja.md",
|
|
28
|
+
"README.ko.md",
|
|
25
29
|
"LICENSE"
|
|
26
30
|
],
|
|
27
31
|
"publishConfig": {
|