dsh-workbench-message 0.1.6 → 0.1.7
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/lib/client.js +533 -27
- package/lib/index.js +1 -1
- package/lib/infra/config.js +17 -1
- package/package.json +3 -3
package/lib/client.js
CHANGED
|
@@ -1119,6 +1119,8 @@ var require_copy = __commonJS({
|
|
|
1119
1119
|
saved: "\u5DF2\u4FDD\u5B58",
|
|
1120
1120
|
resetAll: "\u5168\u90E8\u6062\u590D\u9ED8\u8BA4",
|
|
1121
1121
|
resetOne: "\u6062\u590D\u9ED8\u8BA4",
|
|
1122
|
+
resetPos: "\u6062\u590D\u9ED8\u8BA4\u4F4D\u7F6E",
|
|
1123
|
+
resetPosHint: "\u6E05\u7A7A\u81EA\u5B9A\u4E49\u4F4D\u7F6E\uFF0C\u56DE\u5230\u300C\u60AC\u6D6E\u5165\u53E3\u4F4D\u7F6E\u300D\u9009\u5B9A\u7684\u89D2\uFF1B\u672A\u62D6\u62FD\u8FC7\u65F6\u4E0D\u53EF\u7528",
|
|
1122
1124
|
preview: "\u8BD5\u542C",
|
|
1123
1125
|
quietNote: "\u514D\u6253\u6270\u65F6\u95F4\u6BB5\u5185\u4E0D\u53D1\u58F0\uFF0C\u6D88\u606F\u7167\u5E38\u5165\u5E93\uFF1B\u300C\u514D\u6253\u6270\u4ECD\u54CD\u7684\u7EA7\u522B\u300D\u53EF\u4EE5\u653E\u884C\u91CD\u8981\u6D88\u606F",
|
|
1124
1126
|
readDaysNote: "\u5DF2\u8BFB\u6D88\u606F\u8D85\u8FC7\u4FDD\u7559\u5929\u6570\u4F1A\u88AB\u6E05\u7406\uFF1B\u672A\u8BFB\u6D88\u606F\u6C38\u4E0D\u6309\u65F6\u95F4\u6E05\u7406",
|
|
@@ -1175,6 +1177,8 @@ var require_copy = __commonJS({
|
|
|
1175
1177
|
saved: "Saved",
|
|
1176
1178
|
resetAll: "Reset all",
|
|
1177
1179
|
resetOne: "Reset",
|
|
1180
|
+
resetPos: "Reset position",
|
|
1181
|
+
resetPosHint: "Clears the custom position and returns to the corner chosen above; unavailable until dragged",
|
|
1178
1182
|
preview: "Preview",
|
|
1179
1183
|
quietNote: "Inside quiet hours nothing plays, but messages are still stored. Levels above can pass through.",
|
|
1180
1184
|
readDaysNote: "Read messages older than the retention window are pruned; unread ones never expire by time.",
|
|
@@ -1597,6 +1601,31 @@ var require_config = __commonJS({
|
|
|
1597
1601
|
toastOnce(String(e && e.message || e));
|
|
1598
1602
|
});
|
|
1599
1603
|
}
|
|
1604
|
+
function resetPositionRow() {
|
|
1605
|
+
var custom = values()["float.customPos"];
|
|
1606
|
+
return h(
|
|
1607
|
+
"div",
|
|
1608
|
+
{ className: "wbm-field", key: "float.resetPos" },
|
|
1609
|
+
h(
|
|
1610
|
+
"div",
|
|
1611
|
+
{ className: "wbm-field-main" },
|
|
1612
|
+
h("span", { className: "wbm-field-label" }, t.resetPos),
|
|
1613
|
+
h("span", { className: "wbm-field-hint" }, t.resetPosHint)
|
|
1614
|
+
),
|
|
1615
|
+
h(
|
|
1616
|
+
"div",
|
|
1617
|
+
{ className: "wbm-field-ctl" },
|
|
1618
|
+
h(
|
|
1619
|
+
"button",
|
|
1620
|
+
{ type: "button", className: "wbm-btn", disabled: !custom, onClick: function() {
|
|
1621
|
+
save("float.customPos", "");
|
|
1622
|
+
} },
|
|
1623
|
+
props.Icon ? h(props.Icon, { name: "reset", size: 12 }) : null,
|
|
1624
|
+
h("span", null, t.resetPos)
|
|
1625
|
+
)
|
|
1626
|
+
)
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1600
1629
|
function control(item) {
|
|
1601
1630
|
var value = values()[item.id];
|
|
1602
1631
|
if (item.type === "bool") {
|
|
@@ -1765,7 +1794,8 @@ var require_config = __commonJS({
|
|
|
1765
1794
|
) : null
|
|
1766
1795
|
)
|
|
1767
1796
|
);
|
|
1768
|
-
})
|
|
1797
|
+
}),
|
|
1798
|
+
group.id === "float" ? resetPositionRow() : null
|
|
1769
1799
|
);
|
|
1770
1800
|
}),
|
|
1771
1801
|
h("div", { className: "wbm-note" }, t.quietNote),
|
|
@@ -3902,24 +3932,30 @@ var require_style = __commonJS({
|
|
|
3902
3932
|
"use strict";
|
|
3903
3933
|
module2.exports = function floatStyles() {
|
|
3904
3934
|
return [
|
|
3905
|
-
".wbm-float-root{position:fixed;left:0;
|
|
3906
|
-
".wbm-float-root .wbm-float-btn{position:absolute;right:
|
|
3935
|
+
".wbm-float-root{position:fixed;left:0;top:0;width:0;height:0;z-index:860;pointer-events:none;-webkit-app-region:no-drag}",
|
|
3936
|
+
".wbm-float-root .wbm-float-btn{position:absolute;left:0;top:0;right:auto;bottom:auto;display:inline-flex;align-items:center;justify-content:center;",
|
|
3907
3937
|
"box-sizing:border-box;width:46px;height:46px;padding:0;flex:0 0 auto;border-radius:50%;",
|
|
3908
3938
|
"--wbm-float-bg:var(--dsw-alias-button-floating-fill,var(--wb-card,#2c2c2e));",
|
|
3909
3939
|
"--wbm-float-ink:var(--dsw-alias-label-primary,var(--wb-muted,currentColor));",
|
|
3910
3940
|
"--wbm-float-line:var(--dsw-alias-border-l2,var(--wb-border,rgba(255,255,255,.14)));",
|
|
3911
3941
|
"--wbm-float-danger:var(--dsw-alias-state-error-primary,var(--wb-danger,#dc2626));",
|
|
3912
3942
|
"border:1px solid var(--wbm-float-line);background:var(--wbm-float-bg);color:var(--wbm-float-ink);",
|
|
3913
|
-
"cursor:
|
|
3943
|
+
"cursor:grab;pointer-events:auto;-webkit-app-region:no-drag;overflow:visible;",
|
|
3944
|
+
// 触屏拖动时不要被页面滚动抢走指针,文字也不要被选中。
|
|
3945
|
+
"touch-action:none;-webkit-user-select:none;user-select:none;",
|
|
3914
3946
|
"box-shadow:0 8px 22px rgba(0,0,0,.24),0 1px 3px rgba(0,0,0,.18);",
|
|
3915
3947
|
"transition:transform .18s ease,box-shadow .18s ease,background .18s ease,border-color .18s ease}",
|
|
3948
|
+
// 首次定位完成后才允许 left/top 过渡(挂载瞬间不要从左上角滑过来)。
|
|
3949
|
+
".wbm-float-root .wbm-float-btn[data-ready]{transition:left .18s ease,top .18s ease,transform .18s ease,",
|
|
3950
|
+
"box-shadow .18s ease,background .18s ease,border-color .18s ease}",
|
|
3951
|
+
// 拖拽中必须跟手:关掉过渡,hover 的位移也一并取消。
|
|
3952
|
+
".wbm-float-root .wbm-float-btn[data-dragging=1]{cursor:grabbing;transition:none}",
|
|
3953
|
+
".wbm-float-root .wbm-float-btn[data-dragging=1]:hover{transform:none;",
|
|
3954
|
+
"box-shadow:0 8px 22px rgba(0,0,0,.24),0 1px 3px rgba(0,0,0,.18)}",
|
|
3916
3955
|
".wbm-float-root .wbm-float-btn:hover{transform:translateY(-1px);box-shadow:0 12px 26px rgba(0,0,0,.28),0 1px 3px rgba(0,0,0,.2);",
|
|
3917
3956
|
"background:var(--dsw-alias-button-floating-hover,var(--wbm-float-bg))}",
|
|
3918
3957
|
".wbm-float-root .wbm-float-btn:active{transform:translateY(0)}",
|
|
3919
3958
|
".wbm-float-root .wbm-float-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,var(--wb-accent,#2563eb));outline-offset:2px}",
|
|
3920
|
-
".wbm-float-root .wbm-float-btn[data-pos=bottom-left]{left:20px;right:auto}",
|
|
3921
|
-
// 页面底部有输入框时抬到它上面,避免压在发送按钮上(没有输入框就贴右下角)。
|
|
3922
|
-
".wbm-float-root .wbm-float-btn[data-lift]{bottom:var(--wbm-float-lift,76px)}",
|
|
3923
3959
|
".wbm-float-root .wbm-float-btn svg{display:block;width:21px;height:21px;flex:0 0 auto}",
|
|
3924
3960
|
".wbm-float-root .wbm-float-badge{position:absolute;top:-5px;right:-5px;min-width:18px;height:18px;padding:0 5px;",
|
|
3925
3961
|
"box-sizing:border-box;border-radius:999px;display:none;align-items:center;justify-content:center;",
|
|
@@ -3927,10 +3963,11 @@ var require_style = __commonJS({
|
|
|
3927
3963
|
"font-size:11px;font-weight:650;line-height:1;font-variant-numeric:tabular-nums;",
|
|
3928
3964
|
"box-shadow:0 0 0 2px var(--wbm-float-bg)}",
|
|
3929
3965
|
".wbm-float-root .wbm-float-btn[data-unread] .wbm-float-badge{display:inline-flex}",
|
|
3966
|
+
// 半隐藏时角标会有一半在视口外,直接收起角标;来新消息会先临时展开再显示。
|
|
3967
|
+
".wbm-float-root .wbm-float-btn[data-collapsed=1] .wbm-float-badge{display:none}",
|
|
3930
3968
|
".wbm-float-root .wbm-float-btn[data-pulse=1]{animation:wbm-float-bounce .6s cubic-bezier(.34,1.56,.64,1)}",
|
|
3931
3969
|
"@keyframes wbm-float-bounce{0%{transform:translateY(0)}35%{transform:translateY(-7px)}70%{transform:translateY(0)}100%{transform:translateY(0)}}",
|
|
3932
|
-
"@media (max-width:640px){.wbm-float-root .wbm-float-btn{width:40px;height:40px
|
|
3933
|
-
".wbm-float-root .wbm-float-btn[data-pos=bottom-left]{left:12px;right:auto}",
|
|
3970
|
+
"@media (max-width:640px){.wbm-float-root .wbm-float-btn{width:40px;height:40px}",
|
|
3934
3971
|
".wbm-float-root .wbm-float-btn svg{width:18px;height:18px}}",
|
|
3935
3972
|
// 降低动态偏好:不做位移,只让描边闪一次颜色。
|
|
3936
3973
|
"@media (prefers-reduced-motion: reduce){.wbm-float-root .wbm-float-btn[data-pulse=1]{animation:none;",
|
|
@@ -3960,6 +3997,7 @@ var require_button = __commonJS({
|
|
|
3960
3997
|
var lang = options.lang === "en" ? "en" : "zh";
|
|
3961
3998
|
var onActivate = typeof options.onActivate === "function" ? options.onActivate : function() {
|
|
3962
3999
|
};
|
|
4000
|
+
var onClick = typeof options.onClick === "function" ? options.onClick : null;
|
|
3963
4001
|
var count = 0;
|
|
3964
4002
|
var pulseTimer = null;
|
|
3965
4003
|
var btn = doc.createElement("button");
|
|
@@ -4017,8 +4055,27 @@ var require_button = __commonJS({
|
|
|
4017
4055
|
lang = next === "en" ? "en" : "zh";
|
|
4018
4056
|
announce(count);
|
|
4019
4057
|
}
|
|
4058
|
+
function setPoint(x, y) {
|
|
4059
|
+
btn.style.left = Math.round(x) + "px";
|
|
4060
|
+
btn.style.top = Math.round(y) + "px";
|
|
4061
|
+
}
|
|
4062
|
+
function setCollapsed(on) {
|
|
4063
|
+
if (on) btn.setAttribute("data-collapsed", "1");
|
|
4064
|
+
else btn.removeAttribute("data-collapsed");
|
|
4065
|
+
}
|
|
4066
|
+
function setDragging(on) {
|
|
4067
|
+
if (on) btn.setAttribute("data-dragging", "1");
|
|
4068
|
+
else btn.removeAttribute("data-dragging");
|
|
4069
|
+
}
|
|
4070
|
+
function setReady() {
|
|
4071
|
+
btn.setAttribute("data-ready", "1");
|
|
4072
|
+
}
|
|
4020
4073
|
btn.addEventListener("click", function(event) {
|
|
4021
4074
|
if (event && typeof event.preventDefault === "function") event.preventDefault();
|
|
4075
|
+
if (onClick) {
|
|
4076
|
+
onClick(event);
|
|
4077
|
+
return;
|
|
4078
|
+
}
|
|
4022
4079
|
onActivate();
|
|
4023
4080
|
});
|
|
4024
4081
|
function destroy() {
|
|
@@ -4026,23 +4083,159 @@ var require_button = __commonJS({
|
|
|
4026
4083
|
pulseTimer = null;
|
|
4027
4084
|
if (btn.parentNode) btn.parentNode.removeChild(btn);
|
|
4028
4085
|
}
|
|
4029
|
-
return {
|
|
4086
|
+
return {
|
|
4087
|
+
el: btn,
|
|
4088
|
+
setCount,
|
|
4089
|
+
pulse,
|
|
4090
|
+
setPosition,
|
|
4091
|
+
setLang,
|
|
4092
|
+
setPoint,
|
|
4093
|
+
setCollapsed,
|
|
4094
|
+
setDragging,
|
|
4095
|
+
setReady,
|
|
4096
|
+
destroy
|
|
4097
|
+
};
|
|
4030
4098
|
}
|
|
4031
4099
|
module2.exports = { createButton, ICON_PATH, PULSE_MS };
|
|
4032
4100
|
}
|
|
4033
4101
|
});
|
|
4034
4102
|
|
|
4103
|
+
// packages/addons/message/client/float/geometry.cjs
|
|
4104
|
+
var require_geometry = __commonJS({
|
|
4105
|
+
"packages/addons/message/client/float/geometry.cjs"(exports2, module2) {
|
|
4106
|
+
"use strict";
|
|
4107
|
+
var MIN_VISIBLE = 24;
|
|
4108
|
+
var EDGE_ZONE = 48;
|
|
4109
|
+
var EDGE_INSET = 20;
|
|
4110
|
+
var EDGE_INSET_NARROW = 12;
|
|
4111
|
+
var NARROW_WIDTH = 640;
|
|
4112
|
+
var SIZE = 46;
|
|
4113
|
+
var SIZE_NARROW = 40;
|
|
4114
|
+
var FALLBACK_WIDTH = 1280;
|
|
4115
|
+
var FALLBACK_HEIGHT = 800;
|
|
4116
|
+
function clamp(value, min, max) {
|
|
4117
|
+
if (!isFinite(value)) return min;
|
|
4118
|
+
if (max < min) return min;
|
|
4119
|
+
return Math.min(Math.max(value, min), max);
|
|
4120
|
+
}
|
|
4121
|
+
function viewport(doc, win) {
|
|
4122
|
+
var el = doc && doc.documentElement;
|
|
4123
|
+
var width = Number(el && el.clientWidth) || Number(win && win.innerWidth) || FALLBACK_WIDTH;
|
|
4124
|
+
var height = Number(el && el.clientHeight) || Number(win && win.innerHeight) || FALLBACK_HEIGHT;
|
|
4125
|
+
return { width: width > 0 ? width : FALLBACK_WIDTH, height: height > 0 ? height : FALLBACK_HEIGHT };
|
|
4126
|
+
}
|
|
4127
|
+
function sizeOf(el, viewportWidth) {
|
|
4128
|
+
var rect = null;
|
|
4129
|
+
if (el && typeof el.getBoundingClientRect === "function") {
|
|
4130
|
+
try {
|
|
4131
|
+
rect = el.getBoundingClientRect();
|
|
4132
|
+
} catch (e) {
|
|
4133
|
+
rect = null;
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
var size = rect && Number(rect.width) > 0 ? Number(rect.width) : 0;
|
|
4137
|
+
if (!size) size = viewportWidth <= NARROW_WIDTH ? SIZE_NARROW : SIZE;
|
|
4138
|
+
return size;
|
|
4139
|
+
}
|
|
4140
|
+
function marginOf(viewportWidth) {
|
|
4141
|
+
return viewportWidth <= NARROW_WIDTH ? EDGE_INSET_NARROW : EDGE_INSET;
|
|
4142
|
+
}
|
|
4143
|
+
function cornerPoint(corner, viewportWidth, viewportHeight, size, lift, margin) {
|
|
4144
|
+
var inset = margin === void 0 ? marginOf(viewportWidth) : margin;
|
|
4145
|
+
var x = corner === "bottom-left" ? inset : viewportWidth - inset - size;
|
|
4146
|
+
var y = viewportHeight - inset - size - (Number(lift) || 0);
|
|
4147
|
+
return { x: clamp(x, 0, Math.max(0, viewportWidth - size)), y: clamp(y, 0, Math.max(0, viewportHeight - size)) };
|
|
4148
|
+
}
|
|
4149
|
+
function parsePos(text) {
|
|
4150
|
+
if (typeof text !== "string") return null;
|
|
4151
|
+
var raw = text.trim();
|
|
4152
|
+
if (!raw) return null;
|
|
4153
|
+
var parts = raw.split(",");
|
|
4154
|
+
if (parts.length !== 2) return null;
|
|
4155
|
+
var rx = Number(parts[0]);
|
|
4156
|
+
var ry = Number(parts[1]);
|
|
4157
|
+
if (!isFinite(rx) || !isFinite(ry)) return null;
|
|
4158
|
+
if (rx < 0 || rx > 1 || ry < 0 || ry > 1) return null;
|
|
4159
|
+
return { rx, ry };
|
|
4160
|
+
}
|
|
4161
|
+
function formatPos(rx, ry) {
|
|
4162
|
+
return Number(rx).toFixed(4) + "," + Number(ry).toFixed(4);
|
|
4163
|
+
}
|
|
4164
|
+
function pointOf(rx, ry, viewportWidth, viewportHeight, size) {
|
|
4165
|
+
return {
|
|
4166
|
+
x: clamp(Number(rx) * viewportWidth - size / 2, 0, Math.max(0, viewportWidth - size)),
|
|
4167
|
+
y: clamp(Number(ry) * viewportHeight - size / 2, 0, Math.max(0, viewportHeight - size))
|
|
4168
|
+
};
|
|
4169
|
+
}
|
|
4170
|
+
function ratioOf(x, y, viewportWidth, viewportHeight, size) {
|
|
4171
|
+
var p = clampPoint(x, y, size, viewportWidth, viewportHeight);
|
|
4172
|
+
return {
|
|
4173
|
+
rx: clamp((p.x + size / 2) / viewportWidth, 0, 1),
|
|
4174
|
+
ry: clamp((p.y + size / 2) / viewportHeight, 0, 1)
|
|
4175
|
+
};
|
|
4176
|
+
}
|
|
4177
|
+
function clampPoint(x, y, size, viewportWidth, viewportHeight) {
|
|
4178
|
+
return {
|
|
4179
|
+
x: clamp(x, 0, Math.max(0, viewportWidth - size)),
|
|
4180
|
+
y: clamp(y, 0, Math.max(0, viewportHeight - size))
|
|
4181
|
+
};
|
|
4182
|
+
}
|
|
4183
|
+
function gaps(left, size, viewportWidth) {
|
|
4184
|
+
return { left, right: viewportWidth - left - size };
|
|
4185
|
+
}
|
|
4186
|
+
function nearEdge(left, size, viewportWidth) {
|
|
4187
|
+
var g = gaps(left, size, viewportWidth);
|
|
4188
|
+
return g.left <= EDGE_ZONE || g.right <= EDGE_ZONE;
|
|
4189
|
+
}
|
|
4190
|
+
function sideOf(left, size, viewportWidth) {
|
|
4191
|
+
var g = gaps(left, size, viewportWidth);
|
|
4192
|
+
return g.left <= g.right ? "left" : "right";
|
|
4193
|
+
}
|
|
4194
|
+
function collapsedPoint(side, size, viewportWidth, y) {
|
|
4195
|
+
return {
|
|
4196
|
+
x: side === "left" ? -size / 2 : viewportWidth - size / 2,
|
|
4197
|
+
y
|
|
4198
|
+
};
|
|
4199
|
+
}
|
|
4200
|
+
module2.exports = {
|
|
4201
|
+
MIN_VISIBLE,
|
|
4202
|
+
EDGE_ZONE,
|
|
4203
|
+
NARROW_WIDTH,
|
|
4204
|
+
SIZE,
|
|
4205
|
+
SIZE_NARROW,
|
|
4206
|
+
clamp,
|
|
4207
|
+
viewport,
|
|
4208
|
+
sizeOf,
|
|
4209
|
+
marginOf,
|
|
4210
|
+
cornerPoint,
|
|
4211
|
+
parsePos,
|
|
4212
|
+
formatPos,
|
|
4213
|
+
pointOf,
|
|
4214
|
+
ratioOf,
|
|
4215
|
+
clampPoint,
|
|
4216
|
+
nearEdge,
|
|
4217
|
+
sideOf,
|
|
4218
|
+
collapsedPoint
|
|
4219
|
+
};
|
|
4220
|
+
}
|
|
4221
|
+
});
|
|
4222
|
+
|
|
4035
4223
|
// packages/addons/message/client/float/mount.cjs
|
|
4036
4224
|
var require_mount = __commonJS({
|
|
4037
4225
|
"packages/addons/message/client/float/mount.cjs"(exports2, module2) {
|
|
4038
4226
|
"use strict";
|
|
4039
4227
|
var styles = require_style();
|
|
4040
4228
|
var buttons = require_button();
|
|
4229
|
+
var geo = require_geometry();
|
|
4041
4230
|
var DOMAIN = "wb-addon-message";
|
|
4042
4231
|
var BASE = "/workbench/api";
|
|
4043
4232
|
var STYLE_ID = "wb-message-float-style";
|
|
4044
4233
|
var ADDON_ID = "wb-addon-message";
|
|
4045
4234
|
var INBOX_VIEW = "inbox";
|
|
4235
|
+
var HOLD_MS = 2e3;
|
|
4236
|
+
var DRAG_THRESHOLD = 5;
|
|
4237
|
+
var JUST_DRAGGED_MS = 120;
|
|
4238
|
+
var POS_EPSILON = 1e-3;
|
|
4046
4239
|
function readLang(doc) {
|
|
4047
4240
|
var attr = doc && doc.documentElement && doc.documentElement.getAttribute("lang");
|
|
4048
4241
|
return attr && attr.toLowerCase().indexOf("en") === 0 ? "en" : "zh";
|
|
@@ -4083,14 +4276,74 @@ var require_mount = __commonJS({
|
|
|
4083
4276
|
seen: /* @__PURE__ */ new Set(),
|
|
4084
4277
|
count: 0,
|
|
4085
4278
|
enabled: true,
|
|
4086
|
-
|
|
4087
|
-
|
|
4279
|
+
corner: "bottom-right",
|
|
4280
|
+
idleSeconds: 3,
|
|
4281
|
+
edgeSnap: true,
|
|
4282
|
+
customText: "",
|
|
4283
|
+
hasCustom: false,
|
|
4284
|
+
rx: 0.5,
|
|
4285
|
+
ry: 0.5,
|
|
4286
|
+
lift: 0,
|
|
4287
|
+
size: geo.SIZE,
|
|
4288
|
+
collapsed: false,
|
|
4289
|
+
side: "right",
|
|
4290
|
+
x: 0,
|
|
4291
|
+
y: 0,
|
|
4292
|
+
hovered: false,
|
|
4293
|
+
focused: false,
|
|
4294
|
+
dragging: false,
|
|
4295
|
+
pressed: false,
|
|
4296
|
+
pressX: 0,
|
|
4297
|
+
pressY: 0,
|
|
4298
|
+
startX: 0,
|
|
4299
|
+
startY: 0,
|
|
4300
|
+
expandedByPress: false,
|
|
4301
|
+
justDraggedUntil: 0,
|
|
4302
|
+
holdUntil: 0,
|
|
4303
|
+
idleTimer: null,
|
|
4304
|
+
onVisible: null,
|
|
4305
|
+
onResize: null,
|
|
4306
|
+
onWindowUp: null
|
|
4088
4307
|
};
|
|
4308
|
+
function now() {
|
|
4309
|
+
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).getTime();
|
|
4310
|
+
}
|
|
4311
|
+
function later(fn, ms) {
|
|
4312
|
+
var setter = win && typeof win.setTimeout === "function" ? win.setTimeout.bind(win) : setTimeout;
|
|
4313
|
+
var timer = setter(fn, Math.max(0, ms || 0));
|
|
4314
|
+
if (timer && typeof timer.unref === "function") timer.unref();
|
|
4315
|
+
return timer;
|
|
4316
|
+
}
|
|
4317
|
+
function cancel(timer) {
|
|
4318
|
+
if (timer === null || timer === void 0) return;
|
|
4319
|
+
var clearer = win && typeof win.clearTimeout === "function" ? win.clearTimeout.bind(win) : clearTimeout;
|
|
4320
|
+
clearer(timer);
|
|
4321
|
+
}
|
|
4322
|
+
function disarm() {
|
|
4323
|
+
cancel(state.idleTimer);
|
|
4324
|
+
state.idleTimer = null;
|
|
4325
|
+
}
|
|
4089
4326
|
function hostOverlay() {
|
|
4090
4327
|
return doc && doc.querySelector ? doc.querySelector("[data-shell-overlay]") : null;
|
|
4091
4328
|
}
|
|
4329
|
+
function metrics() {
|
|
4330
|
+
var vp = geo.viewport(doc, win);
|
|
4331
|
+
var size = geo.sizeOf(state.btn && state.btn.el, vp.width);
|
|
4332
|
+
var origin = { x: 0, y: 0 };
|
|
4333
|
+
if (state.root && typeof state.root.getBoundingClientRect === "function") {
|
|
4334
|
+
var rect = state.root.getBoundingClientRect();
|
|
4335
|
+
origin.x = Number(rect && rect.left) || 0;
|
|
4336
|
+
origin.y = Number(rect && rect.top) || 0;
|
|
4337
|
+
}
|
|
4338
|
+
return { width: vp.width, height: vp.height, size, origin };
|
|
4339
|
+
}
|
|
4092
4340
|
function liftAboveComposer() {
|
|
4093
|
-
if (!state.btn
|
|
4341
|
+
if (!state.btn) return;
|
|
4342
|
+
state.lift = 0;
|
|
4343
|
+
if (!doc || typeof doc.querySelector !== "function") {
|
|
4344
|
+
state.btn.el.removeAttribute("data-lift");
|
|
4345
|
+
return;
|
|
4346
|
+
}
|
|
4094
4347
|
var composer = doc.querySelector("[data-shell-composer], .dsh-composer, [contenteditable=true], .wb-composer");
|
|
4095
4348
|
if (!composer || typeof composer.getBoundingClientRect !== "function") {
|
|
4096
4349
|
state.btn.el.removeAttribute("data-lift");
|
|
@@ -4103,6 +4356,7 @@ var require_mount = __commonJS({
|
|
|
4103
4356
|
return;
|
|
4104
4357
|
}
|
|
4105
4358
|
var lift = Math.min(Math.max(Math.round(height + 12), 48), 140);
|
|
4359
|
+
state.lift = lift;
|
|
4106
4360
|
state.btn.el.setAttribute("data-lift", "1");
|
|
4107
4361
|
state.btn.el.style.setProperty("--wbm-float-lift", lift + "px");
|
|
4108
4362
|
}
|
|
@@ -4111,19 +4365,112 @@ var require_mount = __commonJS({
|
|
|
4111
4365
|
var target = hostOverlay() || doc.body;
|
|
4112
4366
|
if (target && state.root.parentNode !== target) target.appendChild(state.root);
|
|
4113
4367
|
}
|
|
4368
|
+
function basePoint(m) {
|
|
4369
|
+
if (state.hasCustom) return geo.pointOf(state.rx, state.ry, m.width, m.height, m.size);
|
|
4370
|
+
return geo.cornerPoint(state.corner, m.width, m.height, m.size, state.lift, geo.marginOf(m.width));
|
|
4371
|
+
}
|
|
4372
|
+
function paint(point, m) {
|
|
4373
|
+
state.x = point.x;
|
|
4374
|
+
state.y = point.y;
|
|
4375
|
+
state.size = m.size;
|
|
4376
|
+
if (!state.btn) return;
|
|
4377
|
+
state.btn.setPoint(point.x - m.origin.x, point.y - m.origin.y);
|
|
4378
|
+
}
|
|
4379
|
+
function render() {
|
|
4380
|
+
if (!state.btn) return;
|
|
4381
|
+
var m = metrics();
|
|
4382
|
+
if (state.collapsed) {
|
|
4383
|
+
var base = basePoint(m);
|
|
4384
|
+
var top = geo.clamp(base.y, 0, Math.max(0, m.height - m.size));
|
|
4385
|
+
paint(geo.collapsedPoint(state.side, m.size, m.width, top), m);
|
|
4386
|
+
} else {
|
|
4387
|
+
paint(basePoint(m), m);
|
|
4388
|
+
}
|
|
4389
|
+
state.btn.setCollapsed(state.collapsed);
|
|
4390
|
+
if (!state.dragging) state.btn.setReady();
|
|
4391
|
+
}
|
|
4392
|
+
function expand() {
|
|
4393
|
+
if (!state.collapsed) return;
|
|
4394
|
+
state.collapsed = false;
|
|
4395
|
+
render();
|
|
4396
|
+
}
|
|
4397
|
+
function collapse() {
|
|
4398
|
+
if (!state.enabled || state.collapsed || !state.edgeSnap || state.idleSeconds <= 0) return;
|
|
4399
|
+
if (state.hovered || state.focused || state.dragging || state.pressed) return;
|
|
4400
|
+
var m = metrics();
|
|
4401
|
+
var base = basePoint(m);
|
|
4402
|
+
if (!geo.nearEdge(base.x, m.size, m.width)) return;
|
|
4403
|
+
state.side = geo.sideOf(base.x, m.size, m.width);
|
|
4404
|
+
state.collapsed = true;
|
|
4405
|
+
render();
|
|
4406
|
+
disarm();
|
|
4407
|
+
}
|
|
4408
|
+
function arm(ms) {
|
|
4409
|
+
disarm();
|
|
4410
|
+
if (!state.enabled || !state.edgeSnap || state.idleSeconds <= 0) return;
|
|
4411
|
+
var delay = ms === void 0 ? state.idleSeconds * 1e3 : ms;
|
|
4412
|
+
state.idleTimer = later(function() {
|
|
4413
|
+
state.idleTimer = null;
|
|
4414
|
+
tick();
|
|
4415
|
+
}, delay);
|
|
4416
|
+
}
|
|
4417
|
+
function tick() {
|
|
4418
|
+
if (!state.mounted) return;
|
|
4419
|
+
var wait = state.holdUntil - now();
|
|
4420
|
+
if (wait > 0) {
|
|
4421
|
+
arm(wait);
|
|
4422
|
+
return;
|
|
4423
|
+
}
|
|
4424
|
+
if (state.hovered || state.focused || state.dragging || state.pressed) return;
|
|
4425
|
+
collapse();
|
|
4426
|
+
}
|
|
4427
|
+
function persist() {
|
|
4428
|
+
if (!call) return;
|
|
4429
|
+
var last = geo.parsePos(state.customText);
|
|
4430
|
+
if (last && Math.abs(last.rx - state.rx) < POS_EPSILON && Math.abs(last.ry - state.ry) < POS_EPSILON) return;
|
|
4431
|
+
var text = geo.formatPos(state.rx, state.ry);
|
|
4432
|
+
state.customText = text;
|
|
4433
|
+
state.hasCustom = true;
|
|
4434
|
+
Promise.resolve(call("message.configSet", { values: { "float.customPos": text } })).catch(function() {
|
|
4435
|
+
});
|
|
4436
|
+
}
|
|
4114
4437
|
function applyConfig(values) {
|
|
4115
4438
|
if (!values) return;
|
|
4116
4439
|
if (values["float.enabled"] !== void 0) state.enabled = values["float.enabled"] !== false;
|
|
4117
|
-
if (values["float.position"])
|
|
4440
|
+
if (values["float.position"]) {
|
|
4441
|
+
state.corner = values["float.position"];
|
|
4442
|
+
if (!state.hasCustom) state.collapsed = false;
|
|
4443
|
+
}
|
|
4444
|
+
if (values["float.idleSeconds"] !== void 0) {
|
|
4445
|
+
state.idleSeconds = geo.clamp(Number(values["float.idleSeconds"]) || 0, 0, 60);
|
|
4446
|
+
}
|
|
4447
|
+
if (values["float.edgeSnap"] !== void 0) state.edgeSnap = values["float.edgeSnap"] !== false;
|
|
4448
|
+
if (values["float.customPos"] !== void 0) {
|
|
4449
|
+
var text = values["float.customPos"] === null || values["float.customPos"] === void 0 ? "" : String(values["float.customPos"]);
|
|
4450
|
+
var parsed = geo.parsePos(text);
|
|
4451
|
+
state.customText = text;
|
|
4452
|
+
state.hasCustom = !!parsed;
|
|
4453
|
+
if (parsed) {
|
|
4454
|
+
state.rx = parsed.rx;
|
|
4455
|
+
state.ry = parsed.ry;
|
|
4456
|
+
} else {
|
|
4457
|
+
state.collapsed = false;
|
|
4458
|
+
}
|
|
4459
|
+
}
|
|
4118
4460
|
if (!state.btn) return;
|
|
4119
|
-
state.btn.setPosition(state.
|
|
4461
|
+
state.btn.setPosition(state.corner);
|
|
4120
4462
|
liftAboveComposer();
|
|
4121
4463
|
state.btn.el.style.display = state.enabled ? "" : "none";
|
|
4122
4464
|
if (!state.enabled) {
|
|
4123
4465
|
state.count = 0;
|
|
4124
4466
|
state.btn.setCount(0);
|
|
4467
|
+
state.collapsed = false;
|
|
4468
|
+
disarm();
|
|
4125
4469
|
}
|
|
4126
4470
|
place();
|
|
4471
|
+
render();
|
|
4472
|
+
if (state.enabled) arm();
|
|
4473
|
+
else disarm();
|
|
4127
4474
|
}
|
|
4128
4475
|
function applyCount(next) {
|
|
4129
4476
|
state.count = next > 0 ? Math.floor(next) : 0;
|
|
@@ -4141,6 +4488,129 @@ var require_mount = __commonJS({
|
|
|
4141
4488
|
console.info("[dsh-workbench-message] \u5F53\u524D\u5BBF\u4E3B\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u6D88\u606F\u6536\u4EF6\u7BB1\uFF0C\u8BF7\u5728\u5DE6\u4FA7\u5BFC\u822A\u6253\u5F00\u300C\u6D88\u606F\u300D");
|
|
4142
4489
|
}
|
|
4143
4490
|
}
|
|
4491
|
+
function detachWindowUp() {
|
|
4492
|
+
if (!state.onWindowUp || !win || typeof win.removeEventListener !== "function") return;
|
|
4493
|
+
win.removeEventListener("mouseup", state.onWindowUp);
|
|
4494
|
+
state.onWindowUp = null;
|
|
4495
|
+
}
|
|
4496
|
+
function eventPoint(event) {
|
|
4497
|
+
return {
|
|
4498
|
+
x: event && typeof event.clientX === "number" ? event.clientX : 0,
|
|
4499
|
+
y: event && typeof event.clientY === "number" ? event.clientY : 0
|
|
4500
|
+
};
|
|
4501
|
+
}
|
|
4502
|
+
function onDown(event) {
|
|
4503
|
+
if (!state.enabled || !state.btn) return;
|
|
4504
|
+
if (event && typeof event.button === "number" && event.button !== 0) return;
|
|
4505
|
+
var m = metrics();
|
|
4506
|
+
var point = eventPoint(event);
|
|
4507
|
+
state.pressed = true;
|
|
4508
|
+
state.dragging = false;
|
|
4509
|
+
state.pressX = point.x;
|
|
4510
|
+
state.pressY = point.y;
|
|
4511
|
+
state.startX = state.x;
|
|
4512
|
+
state.startY = state.y;
|
|
4513
|
+
state.size = m.size;
|
|
4514
|
+
disarm();
|
|
4515
|
+
if (state.collapsed) {
|
|
4516
|
+
expand();
|
|
4517
|
+
state.expandedByPress = true;
|
|
4518
|
+
state.startX = state.x;
|
|
4519
|
+
state.startY = state.y;
|
|
4520
|
+
}
|
|
4521
|
+
if (typeof state.btn.el.setPointerCapture === "function" && event && event.pointerId !== void 0) {
|
|
4522
|
+
try {
|
|
4523
|
+
state.btn.el.setPointerCapture(event.pointerId);
|
|
4524
|
+
} catch (err) {
|
|
4525
|
+
}
|
|
4526
|
+
}
|
|
4527
|
+
if (win && typeof win.addEventListener === "function" && !state.onWindowUp) {
|
|
4528
|
+
state.onWindowUp = function() {
|
|
4529
|
+
endPress();
|
|
4530
|
+
};
|
|
4531
|
+
win.addEventListener("mouseup", state.onWindowUp);
|
|
4532
|
+
}
|
|
4533
|
+
}
|
|
4534
|
+
function onMove(event) {
|
|
4535
|
+
if (!state.pressed) return;
|
|
4536
|
+
var point = eventPoint(event);
|
|
4537
|
+
var dx = point.x - state.pressX;
|
|
4538
|
+
var dy = point.y - state.pressY;
|
|
4539
|
+
if (!state.dragging) {
|
|
4540
|
+
if (Math.sqrt(dx * dx + dy * dy) < DRAG_THRESHOLD) return;
|
|
4541
|
+
state.dragging = true;
|
|
4542
|
+
state.expandedByPress = false;
|
|
4543
|
+
state.holdUntil = 0;
|
|
4544
|
+
disarm();
|
|
4545
|
+
if (state.btn) state.btn.setDragging(true);
|
|
4546
|
+
}
|
|
4547
|
+
var m = metrics();
|
|
4548
|
+
paint(geo.clampPoint(state.startX + dx, state.startY + dy, m.size, m.width, m.height), m);
|
|
4549
|
+
}
|
|
4550
|
+
function endPress() {
|
|
4551
|
+
if (!state.pressed) return;
|
|
4552
|
+
state.pressed = false;
|
|
4553
|
+
detachWindowUp();
|
|
4554
|
+
if (!state.dragging) return;
|
|
4555
|
+
state.dragging = false;
|
|
4556
|
+
if (state.btn) state.btn.setDragging(false);
|
|
4557
|
+
var m = metrics();
|
|
4558
|
+
var ratio = geo.ratioOf(state.x, state.y, m.width, m.height, m.size);
|
|
4559
|
+
state.rx = ratio.rx;
|
|
4560
|
+
state.ry = ratio.ry;
|
|
4561
|
+
state.hasCustom = true;
|
|
4562
|
+
state.collapsed = false;
|
|
4563
|
+
render();
|
|
4564
|
+
persist();
|
|
4565
|
+
state.justDraggedUntil = now() + JUST_DRAGGED_MS;
|
|
4566
|
+
arm();
|
|
4567
|
+
}
|
|
4568
|
+
function onClick() {
|
|
4569
|
+
if (!state.enabled) return;
|
|
4570
|
+
if (now() < state.justDraggedUntil) return;
|
|
4571
|
+
if (state.expandedByPress) {
|
|
4572
|
+
state.expandedByPress = false;
|
|
4573
|
+
expand();
|
|
4574
|
+
arm();
|
|
4575
|
+
return;
|
|
4576
|
+
}
|
|
4577
|
+
if (state.collapsed) {
|
|
4578
|
+
expand();
|
|
4579
|
+
arm();
|
|
4580
|
+
return;
|
|
4581
|
+
}
|
|
4582
|
+
activate();
|
|
4583
|
+
}
|
|
4584
|
+
function onEnter() {
|
|
4585
|
+
state.hovered = true;
|
|
4586
|
+
expand();
|
|
4587
|
+
disarm();
|
|
4588
|
+
}
|
|
4589
|
+
function onLeave() {
|
|
4590
|
+
state.hovered = false;
|
|
4591
|
+
var wait = state.holdUntil - now();
|
|
4592
|
+
arm(wait > 0 ? wait : state.idleSeconds * 1e3);
|
|
4593
|
+
}
|
|
4594
|
+
function onFocus() {
|
|
4595
|
+
state.focused = true;
|
|
4596
|
+
expand();
|
|
4597
|
+
disarm();
|
|
4598
|
+
}
|
|
4599
|
+
function onBlur() {
|
|
4600
|
+
state.focused = false;
|
|
4601
|
+
arm();
|
|
4602
|
+
}
|
|
4603
|
+
function onResize() {
|
|
4604
|
+
if (!state.mounted) return;
|
|
4605
|
+
var m = metrics();
|
|
4606
|
+
if (state.hasCustom && !state.collapsed) {
|
|
4607
|
+
var ratio = geo.ratioOf(state.x, state.y, m.width, m.height, m.size);
|
|
4608
|
+
state.rx = ratio.rx;
|
|
4609
|
+
state.ry = ratio.ry;
|
|
4610
|
+
}
|
|
4611
|
+
if (state.collapsed) state.side = geo.sideOf(basePoint(m).x, m.size, m.width);
|
|
4612
|
+
render();
|
|
4613
|
+
}
|
|
4144
4614
|
function onEvent(event, data) {
|
|
4145
4615
|
if (!state.btn || !state.mounted) return;
|
|
4146
4616
|
if (event === "config") {
|
|
@@ -4159,6 +4629,12 @@ var require_mount = __commonJS({
|
|
|
4159
4629
|
if (state.seen.size > 500) state.seen.clear();
|
|
4160
4630
|
applyCount(state.count + 1);
|
|
4161
4631
|
if (state.btn) state.btn.pulse();
|
|
4632
|
+
if (state.collapsed) {
|
|
4633
|
+
state.collapsed = false;
|
|
4634
|
+
render();
|
|
4635
|
+
}
|
|
4636
|
+
state.holdUntil = now() + HOLD_MS;
|
|
4637
|
+
if (!state.hovered && !state.focused && !state.dragging) arm(HOLD_MS);
|
|
4162
4638
|
}
|
|
4163
4639
|
function refreshCount() {
|
|
4164
4640
|
if (!call) return Promise.resolve(state.count);
|
|
@@ -4178,6 +4654,25 @@ var require_mount = __commonJS({
|
|
|
4178
4654
|
return state.enabled;
|
|
4179
4655
|
});
|
|
4180
4656
|
}
|
|
4657
|
+
function bind() {
|
|
4658
|
+
var el = state.btn.el;
|
|
4659
|
+
el.addEventListener("pointerdown", onDown);
|
|
4660
|
+
el.addEventListener("pointermove", onMove);
|
|
4661
|
+
el.addEventListener("pointerup", endPress);
|
|
4662
|
+
el.addEventListener("pointercancel", endPress);
|
|
4663
|
+
el.addEventListener("pointerenter", onEnter);
|
|
4664
|
+
el.addEventListener("pointerleave", onLeave);
|
|
4665
|
+
el.addEventListener("focus", onFocus);
|
|
4666
|
+
el.addEventListener("blur", onBlur);
|
|
4667
|
+
if (win && typeof win.addEventListener === "function") {
|
|
4668
|
+
state.onResize = onResize;
|
|
4669
|
+
win.addEventListener("resize", state.onResize);
|
|
4670
|
+
state.onVisible = function() {
|
|
4671
|
+
if (doc.visibilityState === "visible") refreshCount();
|
|
4672
|
+
};
|
|
4673
|
+
win.addEventListener("visibilitychange", state.onVisible);
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4181
4676
|
function mount() {
|
|
4182
4677
|
if (state.mounted || !doc) return state;
|
|
4183
4678
|
injectStyles(doc);
|
|
@@ -4185,20 +4680,20 @@ var require_mount = __commonJS({
|
|
|
4185
4680
|
root.className = "wbm-float-root";
|
|
4186
4681
|
root.setAttribute("data-message-float", "1");
|
|
4187
4682
|
root.style.pointerEvents = "none";
|
|
4188
|
-
var btn = buttons.createButton({
|
|
4683
|
+
var btn = buttons.createButton({
|
|
4684
|
+
doc,
|
|
4685
|
+
lang: readLang(doc),
|
|
4686
|
+
onClick
|
|
4687
|
+
});
|
|
4189
4688
|
root.appendChild(btn.el);
|
|
4190
4689
|
state.root = root;
|
|
4191
4690
|
state.btn = btn;
|
|
4192
4691
|
state.mounted = true;
|
|
4193
4692
|
place();
|
|
4194
4693
|
liftAboveComposer();
|
|
4694
|
+
render();
|
|
4695
|
+
bind();
|
|
4195
4696
|
if (notifier && typeof notifier.subscribe === "function") state.unsubscribe = notifier.subscribe(onEvent);
|
|
4196
|
-
if (win && typeof win.addEventListener === "function") {
|
|
4197
|
-
state.onVisible = function() {
|
|
4198
|
-
if (doc.visibilityState === "visible") refreshCount();
|
|
4199
|
-
};
|
|
4200
|
-
win.addEventListener("visibilitychange", state.onVisible);
|
|
4201
|
-
}
|
|
4202
4697
|
loadConfig().then(function() {
|
|
4203
4698
|
if (state.enabled) refreshCount();
|
|
4204
4699
|
});
|
|
@@ -4207,9 +4702,14 @@ var require_mount = __commonJS({
|
|
|
4207
4702
|
function destroy() {
|
|
4208
4703
|
if (state.unsubscribe) state.unsubscribe();
|
|
4209
4704
|
state.unsubscribe = null;
|
|
4210
|
-
|
|
4211
|
-
|
|
4705
|
+
disarm();
|
|
4706
|
+
state.holdUntil = 0;
|
|
4707
|
+
detachWindowUp();
|
|
4708
|
+
if (win && typeof win.removeEventListener === "function") {
|
|
4709
|
+
if (state.onResize) win.removeEventListener("resize", state.onResize);
|
|
4710
|
+
if (state.onVisible) win.removeEventListener("visibilitychange", state.onVisible);
|
|
4212
4711
|
}
|
|
4712
|
+
state.onResize = null;
|
|
4213
4713
|
state.onVisible = null;
|
|
4214
4714
|
if (state.btn) state.btn.destroy();
|
|
4215
4715
|
if (state.root && state.root.parentNode) state.root.parentNode.removeChild(state.root);
|
|
@@ -4227,13 +4727,19 @@ var require_mount = __commonJS({
|
|
|
4227
4727
|
mounted: state.mounted,
|
|
4228
4728
|
count: state.count,
|
|
4229
4729
|
enabled: state.enabled,
|
|
4230
|
-
position: state.
|
|
4730
|
+
position: state.corner,
|
|
4731
|
+
collapsed: state.collapsed,
|
|
4732
|
+
side: state.side,
|
|
4733
|
+
custom: state.hasCustom,
|
|
4734
|
+
customText: state.customText,
|
|
4735
|
+
idleSeconds: state.idleSeconds,
|
|
4736
|
+
edgeSnap: state.edgeSnap,
|
|
4231
4737
|
seen: state.seen.size
|
|
4232
4738
|
};
|
|
4233
4739
|
}
|
|
4234
4740
|
};
|
|
4235
4741
|
}
|
|
4236
|
-
module2.exports = { createMount, STYLE_ID, DOMAIN };
|
|
4742
|
+
module2.exports = { createMount, STYLE_ID, DOMAIN, HOLD_MS };
|
|
4237
4743
|
}
|
|
4238
4744
|
});
|
|
4239
4745
|
|
|
@@ -4288,7 +4794,7 @@ var require_mount = __commonJS({
|
|
|
4288
4794
|
ensureStyles();
|
|
4289
4795
|
host.registerAddon({
|
|
4290
4796
|
id: "wb-addon-message",
|
|
4291
|
-
version: "0.1.
|
|
4797
|
+
version: "0.1.7",
|
|
4292
4798
|
icon: ICONS["message-square"],
|
|
4293
4799
|
views: [
|
|
4294
4800
|
{ id: "stats", icon: tabIcon("chart"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: Stats },
|
package/lib/index.js
CHANGED
|
@@ -82,7 +82,7 @@ export function apply(ctx) {
|
|
|
82
82
|
id: "wb-addon-message",
|
|
83
83
|
title: "消息",
|
|
84
84
|
description: "统一消息入口:子插件与 agent 都能发消息,含未读计数、提示音与保留期清理;含统计、收件箱、配置、数据与 Action 五个视图",
|
|
85
|
-
version: "0.1.
|
|
85
|
+
version: "0.1.7",
|
|
86
86
|
category: "comm",
|
|
87
87
|
tables: ["message"],
|
|
88
88
|
// 只在本机保存:显式声明不同步任何表(不写 sync 时宿主默认按行同步)。
|
package/lib/infra/config.js
CHANGED
|
@@ -80,6 +80,22 @@ const ITEMS = [
|
|
|
80
80
|
{ value: "bottom-left", zh: "左下角", en: "Bottom left" },
|
|
81
81
|
],
|
|
82
82
|
},
|
|
83
|
+
{
|
|
84
|
+
id: "float.customPos", group: "float", type: "string", surface: "ui", apply: "mount", default: "", maxLength: 32,
|
|
85
|
+
zh: "自定义位置", en: "Custom position",
|
|
86
|
+
hintZh: "拖拽后自动写入「rx,ry」归一化中心;清空即回到默认角,一般无需手改",
|
|
87
|
+
hintEn: "Written after a drag as normalized center \"rx,ry\"; clear it to return to the default corner",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "float.idleSeconds", group: "float", type: "int", surface: "ui", apply: "mount", default: 3, min: 0, max: 60,
|
|
91
|
+
zh: "空闲多久贴边收起(秒)", en: "Idle seconds before edge collapse",
|
|
92
|
+
hintZh: "0 表示不自动收起;只在按钮靠近左右边缘时生效", hintEn: "0 disables; only applies near the left or right edge",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "float.edgeSnap", group: "float", type: "bool", surface: "ui", apply: "mount", default: true,
|
|
96
|
+
zh: "靠近边缘自动半隐藏", en: "Auto collapse at the edge",
|
|
97
|
+
hintZh: "关闭后空闲也不会贴边,按钮始终完整显示", hintEn: "When off the button never collapses at the edge",
|
|
98
|
+
},
|
|
83
99
|
{
|
|
84
100
|
id: "list.pageSize", group: "list", type: "enum", surface: "ui", apply: "mount", default: 20,
|
|
85
101
|
zh: "每页条数", en: "Page size",
|
|
@@ -263,7 +279,7 @@ export function resetConfig(db, ids) {
|
|
|
263
279
|
export function registerConfigActions(api) {
|
|
264
280
|
const action = api.action;
|
|
265
281
|
action("message.configGet", {
|
|
266
|
-
description: "
|
|
282
|
+
description: "只读:消息插件的配置项定义、当前值与覆盖项(含提示音、免打扰、保留期、悬浮入口与列表分页)",
|
|
267
283
|
input: { type: "object", properties: {}, additionalProperties: false },
|
|
268
284
|
execute: () => configState(api.db),
|
|
269
285
|
render: (r) =>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-workbench-message",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "个人工作台消息插件:统一消息发送入口、收件箱、未读统计与提示音",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"id": "wb-addon-message",
|
|
17
17
|
"title": "消息",
|
|
18
18
|
"description": "统一消息入口 + 统计/收件箱/配置/数据四个视图:子插件与 agent 都能发消息,带未读计数与提示音",
|
|
19
|
-
"version": "0.1.
|
|
19
|
+
"version": "0.1.7",
|
|
20
20
|
"minShell": "0.8.0",
|
|
21
21
|
"tables": [
|
|
22
22
|
"message"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"./package.json": "./package.json"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"dsh-workbench-host": "^0.8.
|
|
52
|
+
"dsh-workbench-host": "^0.8.4"
|
|
53
53
|
},
|
|
54
54
|
"dsh": {
|
|
55
55
|
"bundle": {
|