dsh-workbench-message 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +26 -2
- package/cordis.patch.yml +7 -0
- package/lib/client.js +3798 -0
- package/lib/db/db.js +110 -0
- package/lib/domain/messages.js +374 -0
- package/lib/index.js +149 -0
- package/lib/infra/config.js +280 -0
- package/lib/infra/data.js +216 -0
- package/package.json +92 -4
package/lib/client.js
ADDED
|
@@ -0,0 +1,3798 @@
|
|
|
1
|
+
// 由 scripts/build-addon-clients.mjs 生成;请修改对应 client/client.src.cjs 后重新构建。
|
|
2
|
+
window.__ModuleLoader__ = window.__ModuleLoader__ || { modules: {}, load: function (m) { this.modules[m.id] = m.factory; } };
|
|
3
|
+
window.__ModuleLoader__.load({
|
|
4
|
+
id: "dsh-workbench-message",
|
|
5
|
+
factory: function (require) {
|
|
6
|
+
var module = { exports: {} };
|
|
7
|
+
var exports = module.exports;
|
|
8
|
+
"use strict";
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __esm = (fn, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
22
|
+
try {
|
|
23
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw mod = 0, e;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var __export = (target, all) => {
|
|
29
|
+
for (var name in all)
|
|
30
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
31
|
+
};
|
|
32
|
+
var __copyProps = (to, from, except, desc) => {
|
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
34
|
+
for (let key of __getOwnPropNames(from))
|
|
35
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
36
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
37
|
+
}
|
|
38
|
+
return to;
|
|
39
|
+
};
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
+
|
|
42
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
|
|
43
|
+
var toKebabCase;
|
|
44
|
+
var init_toKebabCase = __esm({
|
|
45
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs"() {
|
|
46
|
+
toKebabCase = (string) => string?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs
|
|
51
|
+
function toLucideIconData(iconName, iconNode, aliases = []) {
|
|
52
|
+
if (iconNode == null) {
|
|
53
|
+
throw new Error("[lucide]: iconNode is required when icon name is used");
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
name: toKebabCase(iconName),
|
|
57
|
+
size: 24,
|
|
58
|
+
node: iconNode,
|
|
59
|
+
...aliases.length > 0 ? { aliases } : {}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
var init_toLucideIconData = __esm({
|
|
63
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs"() {
|
|
64
|
+
init_toKebabCase();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs
|
|
69
|
+
var toCamelCase;
|
|
70
|
+
var init_toCamelCase = __esm({
|
|
71
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs"() {
|
|
72
|
+
toCamelCase = (string) => {
|
|
73
|
+
let out = "";
|
|
74
|
+
let upperNext = false;
|
|
75
|
+
for (const ch of string) {
|
|
76
|
+
if (ch === "-" || ch === "_" || ch <= " ") {
|
|
77
|
+
upperNext = out.length > 0;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (out.length === 0) {
|
|
81
|
+
out += ch.toLowerCase();
|
|
82
|
+
} else {
|
|
83
|
+
out += upperNext ? ch.toUpperCase() : ch;
|
|
84
|
+
}
|
|
85
|
+
upperNext = false;
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs
|
|
93
|
+
var toPascalCase;
|
|
94
|
+
var init_toPascalCase = __esm({
|
|
95
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs"() {
|
|
96
|
+
init_toCamelCase();
|
|
97
|
+
toPascalCase = (string) => {
|
|
98
|
+
const camelCase = toCamelCase(string);
|
|
99
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
105
|
+
var mergeClasses;
|
|
106
|
+
var init_mergeClasses = __esm({
|
|
107
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs"() {
|
|
108
|
+
mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
109
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
110
|
+
}).join(" ").trim();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs
|
|
115
|
+
var defaultAttributes;
|
|
116
|
+
var init_defaultAttributes = __esm({
|
|
117
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs"() {
|
|
118
|
+
defaultAttributes = {
|
|
119
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
120
|
+
width: 24,
|
|
121
|
+
height: 24,
|
|
122
|
+
viewBox: "0 0 24 24",
|
|
123
|
+
fill: "none",
|
|
124
|
+
stroke: "currentColor",
|
|
125
|
+
"stroke-width": 2,
|
|
126
|
+
"stroke-linecap": "round",
|
|
127
|
+
"stroke-linejoin": "round"
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs
|
|
133
|
+
function isDefined(value) {
|
|
134
|
+
return value !== null && value !== void 0;
|
|
135
|
+
}
|
|
136
|
+
function buildLucideIconNode(icon, params = {}) {
|
|
137
|
+
const attributeNames = params.attributeNames ?? {};
|
|
138
|
+
const getAttributeName = (attributeName) => attributeNames[attributeName] ?? attributeName;
|
|
139
|
+
const viewBoxWidth = icon.size ?? icon.width ?? defaultAttributes["width"];
|
|
140
|
+
const viewBoxHeight = icon.size ?? icon.height ?? defaultAttributes["height"];
|
|
141
|
+
const aliasClassNames = icon.aliases?.filter((alias) => typeof alias === "string" && alias.trim() !== "").map((alias) => `lucide-${alias}`) ?? [];
|
|
142
|
+
const iconClassNames = [...icon.name ? [`lucide-${icon.name}`] : [], ...aliasClassNames];
|
|
143
|
+
const classNamesFromClassName = params.className?.split(" ").filter(Boolean) ?? [];
|
|
144
|
+
const className = params.includeDefaultClasses === false ? mergeClasses(...classNamesFromClassName) : mergeClasses("lucide", ...iconClassNames, ...classNamesFromClassName);
|
|
145
|
+
const calculatedStrokeWidth = params.absoluteStrokeWidth ? Number(params.strokeWidth ?? defaultAttributes["stroke-width"]) * Number(icon.size ?? icon.width ?? defaultAttributes["width"]) / Number(params.size ?? params.width ?? defaultAttributes["width"]) : params.strokeWidth ?? defaultAttributes["stroke-width"];
|
|
146
|
+
const attributes = {
|
|
147
|
+
...Object.entries(defaultAttributes).reduce((attrs, [attrName, value]) => {
|
|
148
|
+
attrs[getAttributeName(attrName)] = value;
|
|
149
|
+
return attrs;
|
|
150
|
+
}, {}),
|
|
151
|
+
..."color" in params && params.color && {
|
|
152
|
+
[getAttributeName("stroke")]: params.color
|
|
153
|
+
},
|
|
154
|
+
..."size" in params && isDefined(params.size) && {
|
|
155
|
+
[getAttributeName("width")]: params.size,
|
|
156
|
+
[getAttributeName("height")]: params.size
|
|
157
|
+
},
|
|
158
|
+
..."width" in params && isDefined(params.width) && {
|
|
159
|
+
[getAttributeName("width")]: params.width
|
|
160
|
+
},
|
|
161
|
+
..."height" in params && isDefined(params.height) && {
|
|
162
|
+
[getAttributeName("height")]: params.height
|
|
163
|
+
},
|
|
164
|
+
[getAttributeName("stroke-width")]: calculatedStrokeWidth,
|
|
165
|
+
...className && {
|
|
166
|
+
[getAttributeName("class")]: className
|
|
167
|
+
},
|
|
168
|
+
[getAttributeName("viewBox")]: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,
|
|
169
|
+
...params.hasA11yProp === false ? {
|
|
170
|
+
[getAttributeName("aria-hidden")]: "true"
|
|
171
|
+
} : {},
|
|
172
|
+
..."attributes" in params && params.attributes
|
|
173
|
+
};
|
|
174
|
+
return [
|
|
175
|
+
"svg",
|
|
176
|
+
attributes,
|
|
177
|
+
icon.node.map((child) => {
|
|
178
|
+
const [name, attrs, children] = child;
|
|
179
|
+
const nextAttrs = params.nonScalingStroke ? { [getAttributeName("vector-effect")]: "non-scaling-stroke", ...attrs } : attrs;
|
|
180
|
+
return children ? [name, nextAttrs, children] : [name, nextAttrs];
|
|
181
|
+
})
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
var init_buildLucideIconNode = __esm({
|
|
185
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs"() {
|
|
186
|
+
init_defaultAttributes();
|
|
187
|
+
init_mergeClasses();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs
|
|
192
|
+
function buildLucideIconForReact(icon, params = {}) {
|
|
193
|
+
return buildLucideIconNode(icon, {
|
|
194
|
+
...params,
|
|
195
|
+
attributeNames: {
|
|
196
|
+
...params.attributeNames,
|
|
197
|
+
class: "className",
|
|
198
|
+
"stroke-width": "strokeWidth",
|
|
199
|
+
"stroke-linecap": "strokeLinecap",
|
|
200
|
+
"stroke-linejoin": "strokeLinejoin",
|
|
201
|
+
"vector-effect": "vectorEffect"
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
var init_buildLucideIconForReact = __esm({
|
|
206
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs"() {
|
|
207
|
+
init_buildLucideIconNode();
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs
|
|
212
|
+
var hasA11yProp;
|
|
213
|
+
var init_hasA11yProp = __esm({
|
|
214
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs"() {
|
|
215
|
+
hasA11yProp = (props) => {
|
|
216
|
+
for (const prop in props) {
|
|
217
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return false;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/context.mjs
|
|
227
|
+
var import_react, LucideContext, useLucideContext;
|
|
228
|
+
var init_context = __esm({
|
|
229
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/context.mjs"() {
|
|
230
|
+
"use strict";
|
|
231
|
+
"use client";
|
|
232
|
+
import_react = require("react");
|
|
233
|
+
LucideContext = (0, import_react.createContext)({});
|
|
234
|
+
useLucideContext = () => (0, import_react.useContext)(LucideContext);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/Icon.mjs
|
|
239
|
+
var import_react2, Icon;
|
|
240
|
+
var init_Icon = __esm({
|
|
241
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/Icon.mjs"() {
|
|
242
|
+
"use strict";
|
|
243
|
+
"use client";
|
|
244
|
+
import_react2 = require("react");
|
|
245
|
+
init_mergeClasses();
|
|
246
|
+
init_buildLucideIconForReact();
|
|
247
|
+
init_hasA11yProp();
|
|
248
|
+
init_context();
|
|
249
|
+
Icon = (0, import_react2.forwardRef)(
|
|
250
|
+
({
|
|
251
|
+
color,
|
|
252
|
+
size,
|
|
253
|
+
width,
|
|
254
|
+
height,
|
|
255
|
+
strokeWidth,
|
|
256
|
+
absoluteStrokeWidth,
|
|
257
|
+
nonScalingStroke,
|
|
258
|
+
className = "",
|
|
259
|
+
children,
|
|
260
|
+
iconNode = [],
|
|
261
|
+
icon = {
|
|
262
|
+
node: iconNode,
|
|
263
|
+
aliases: [],
|
|
264
|
+
size: 24
|
|
265
|
+
},
|
|
266
|
+
...rest
|
|
267
|
+
}, ref) => {
|
|
268
|
+
const {
|
|
269
|
+
size: contextSize = 24,
|
|
270
|
+
strokeWidth: contextStrokeWidth = 2,
|
|
271
|
+
absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
|
|
272
|
+
nonScalingStroke: contextNonScalingStroke = false,
|
|
273
|
+
color: contextColor = "currentColor",
|
|
274
|
+
className: contextClass = ""
|
|
275
|
+
} = useLucideContext() ?? {};
|
|
276
|
+
const hasAccessibleProp = Boolean(children) || hasA11yProp(rest);
|
|
277
|
+
const [name, svgAttributes, builtIconNode = []] = buildLucideIconForReact(icon, {
|
|
278
|
+
color: color ?? contextColor,
|
|
279
|
+
width: width ?? size ?? contextSize,
|
|
280
|
+
height: height ?? size ?? contextSize,
|
|
281
|
+
strokeWidth: strokeWidth ?? contextStrokeWidth,
|
|
282
|
+
absoluteStrokeWidth: absoluteStrokeWidth ?? contextAbsoluteStrokeWidth,
|
|
283
|
+
nonScalingStroke: nonScalingStroke ?? contextNonScalingStroke,
|
|
284
|
+
className: mergeClasses(contextClass, className),
|
|
285
|
+
hasA11yProp: hasAccessibleProp,
|
|
286
|
+
attributes: rest
|
|
287
|
+
});
|
|
288
|
+
return (0, import_react2.createElement)(
|
|
289
|
+
name,
|
|
290
|
+
{
|
|
291
|
+
ref,
|
|
292
|
+
...svgAttributes
|
|
293
|
+
},
|
|
294
|
+
[
|
|
295
|
+
...builtIconNode.map(([tag, attrs]) => (0, import_react2.createElement)(tag, attrs)),
|
|
296
|
+
...Array.isArray(children) ? children : [children]
|
|
297
|
+
]
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.mjs
|
|
305
|
+
function createLucideIcon(iconDataOrName, iconNode = [], aliases = []) {
|
|
306
|
+
const iconData = typeof iconDataOrName === "string" ? toLucideIconData(iconDataOrName, iconNode, aliases) : iconDataOrName;
|
|
307
|
+
const Component = (0, import_react3.forwardRef)(
|
|
308
|
+
({ className, ...props }, ref) => (0, import_react3.createElement)(Icon, {
|
|
309
|
+
ref,
|
|
310
|
+
icon: iconData,
|
|
311
|
+
className,
|
|
312
|
+
...props
|
|
313
|
+
})
|
|
314
|
+
);
|
|
315
|
+
if (iconData.name) {
|
|
316
|
+
Component.displayName = toPascalCase(iconData.name);
|
|
317
|
+
}
|
|
318
|
+
return Component;
|
|
319
|
+
}
|
|
320
|
+
var import_react3;
|
|
321
|
+
var init_createLucideIcon = __esm({
|
|
322
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.mjs"() {
|
|
323
|
+
import_react3 = require("react");
|
|
324
|
+
init_toLucideIconData();
|
|
325
|
+
init_toPascalCase();
|
|
326
|
+
init_Icon();
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/bell.mjs
|
|
331
|
+
var bell_exports = {};
|
|
332
|
+
__export(bell_exports, {
|
|
333
|
+
__iconData: () => __iconData,
|
|
334
|
+
default: () => Bell
|
|
335
|
+
});
|
|
336
|
+
var __iconData, Bell;
|
|
337
|
+
var init_bell = __esm({
|
|
338
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/bell.mjs"() {
|
|
339
|
+
init_createLucideIcon();
|
|
340
|
+
__iconData = {
|
|
341
|
+
name: "bell",
|
|
342
|
+
size: 24,
|
|
343
|
+
node: [
|
|
344
|
+
["path", { d: "M10.268 21a2 2 0 0 0 3.464 0", key: "vwvbt9" }],
|
|
345
|
+
[
|
|
346
|
+
"path",
|
|
347
|
+
{
|
|
348
|
+
d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",
|
|
349
|
+
key: "11g9vi"
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
]
|
|
353
|
+
};
|
|
354
|
+
__iconData.node;
|
|
355
|
+
Bell = createLucideIcon(__iconData);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/bell-off.mjs
|
|
360
|
+
var bell_off_exports = {};
|
|
361
|
+
__export(bell_off_exports, {
|
|
362
|
+
__iconData: () => __iconData2,
|
|
363
|
+
default: () => BellOff
|
|
364
|
+
});
|
|
365
|
+
var __iconData2, BellOff;
|
|
366
|
+
var init_bell_off = __esm({
|
|
367
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/bell-off.mjs"() {
|
|
368
|
+
init_createLucideIcon();
|
|
369
|
+
__iconData2 = {
|
|
370
|
+
name: "bell-off",
|
|
371
|
+
size: 24,
|
|
372
|
+
node: [
|
|
373
|
+
["path", { d: "M10.268 21a2 2 0 0 0 3.464 0", key: "vwvbt9" }],
|
|
374
|
+
[
|
|
375
|
+
"path",
|
|
376
|
+
{
|
|
377
|
+
d: "M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",
|
|
378
|
+
key: "178tsu"
|
|
379
|
+
}
|
|
380
|
+
],
|
|
381
|
+
["path", { d: "m2 2 20 20", key: "1ooewy" }],
|
|
382
|
+
["path", { d: "M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05", key: "1hqiys" }]
|
|
383
|
+
]
|
|
384
|
+
};
|
|
385
|
+
__iconData2.node;
|
|
386
|
+
BellOff = createLucideIcon(__iconData2);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/inbox.mjs
|
|
391
|
+
var inbox_exports = {};
|
|
392
|
+
__export(inbox_exports, {
|
|
393
|
+
__iconData: () => __iconData3,
|
|
394
|
+
default: () => Inbox
|
|
395
|
+
});
|
|
396
|
+
var __iconData3, Inbox;
|
|
397
|
+
var init_inbox = __esm({
|
|
398
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/inbox.mjs"() {
|
|
399
|
+
init_createLucideIcon();
|
|
400
|
+
__iconData3 = {
|
|
401
|
+
name: "inbox",
|
|
402
|
+
size: 24,
|
|
403
|
+
node: [
|
|
404
|
+
["polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12", key: "o97t9d" }],
|
|
405
|
+
[
|
|
406
|
+
"path",
|
|
407
|
+
{
|
|
408
|
+
d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",
|
|
409
|
+
key: "oot6mr"
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
]
|
|
413
|
+
};
|
|
414
|
+
__iconData3.node;
|
|
415
|
+
Inbox = createLucideIcon(__iconData3);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mail.mjs
|
|
420
|
+
var mail_exports = {};
|
|
421
|
+
__export(mail_exports, {
|
|
422
|
+
__iconData: () => __iconData4,
|
|
423
|
+
default: () => Mail
|
|
424
|
+
});
|
|
425
|
+
var __iconData4, Mail;
|
|
426
|
+
var init_mail = __esm({
|
|
427
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mail.mjs"() {
|
|
428
|
+
init_createLucideIcon();
|
|
429
|
+
__iconData4 = {
|
|
430
|
+
name: "mail",
|
|
431
|
+
size: 24,
|
|
432
|
+
node: [
|
|
433
|
+
["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7", key: "132q7q" }],
|
|
434
|
+
["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }]
|
|
435
|
+
]
|
|
436
|
+
};
|
|
437
|
+
__iconData4.node;
|
|
438
|
+
Mail = createLucideIcon(__iconData4);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mail-open.mjs
|
|
443
|
+
var mail_open_exports = {};
|
|
444
|
+
__export(mail_open_exports, {
|
|
445
|
+
__iconData: () => __iconData5,
|
|
446
|
+
default: () => MailOpen
|
|
447
|
+
});
|
|
448
|
+
var __iconData5, MailOpen;
|
|
449
|
+
var init_mail_open = __esm({
|
|
450
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mail-open.mjs"() {
|
|
451
|
+
init_createLucideIcon();
|
|
452
|
+
__iconData5 = {
|
|
453
|
+
name: "mail-open",
|
|
454
|
+
size: 24,
|
|
455
|
+
node: [
|
|
456
|
+
[
|
|
457
|
+
"path",
|
|
458
|
+
{
|
|
459
|
+
d: "M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",
|
|
460
|
+
key: "1jhwl8"
|
|
461
|
+
}
|
|
462
|
+
],
|
|
463
|
+
["path", { d: "m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10", key: "1qfld7" }]
|
|
464
|
+
]
|
|
465
|
+
};
|
|
466
|
+
__iconData5.node;
|
|
467
|
+
MailOpen = createLucideIcon(__iconData5);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chart-column.mjs
|
|
472
|
+
var chart_column_exports = {};
|
|
473
|
+
__export(chart_column_exports, {
|
|
474
|
+
__iconData: () => __iconData6,
|
|
475
|
+
default: () => ChartColumn
|
|
476
|
+
});
|
|
477
|
+
var __iconData6, ChartColumn;
|
|
478
|
+
var init_chart_column = __esm({
|
|
479
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chart-column.mjs"() {
|
|
480
|
+
init_createLucideIcon();
|
|
481
|
+
__iconData6 = {
|
|
482
|
+
name: "chart-column",
|
|
483
|
+
size: 24,
|
|
484
|
+
node: [
|
|
485
|
+
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
486
|
+
["path", { d: "M18 17V9", key: "2bz60n" }],
|
|
487
|
+
["path", { d: "M13 17V5", key: "1frdt8" }],
|
|
488
|
+
["path", { d: "M8 17v-3", key: "17ska0" }]
|
|
489
|
+
],
|
|
490
|
+
aliases: ["bar-chart-3"]
|
|
491
|
+
};
|
|
492
|
+
__iconData6.node;
|
|
493
|
+
ChartColumn = createLucideIcon(__iconData6);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings.mjs
|
|
498
|
+
var settings_exports = {};
|
|
499
|
+
__export(settings_exports, {
|
|
500
|
+
__iconData: () => __iconData7,
|
|
501
|
+
default: () => Settings
|
|
502
|
+
});
|
|
503
|
+
var __iconData7, Settings;
|
|
504
|
+
var init_settings = __esm({
|
|
505
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings.mjs"() {
|
|
506
|
+
init_createLucideIcon();
|
|
507
|
+
__iconData7 = {
|
|
508
|
+
name: "settings",
|
|
509
|
+
size: 24,
|
|
510
|
+
node: [
|
|
511
|
+
[
|
|
512
|
+
"path",
|
|
513
|
+
{
|
|
514
|
+
d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
|
|
515
|
+
key: "1i5ecw"
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
519
|
+
]
|
|
520
|
+
};
|
|
521
|
+
__iconData7.node;
|
|
522
|
+
Settings = createLucideIcon(__iconData7);
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/database.mjs
|
|
527
|
+
var database_exports = {};
|
|
528
|
+
__export(database_exports, {
|
|
529
|
+
__iconData: () => __iconData8,
|
|
530
|
+
default: () => Database
|
|
531
|
+
});
|
|
532
|
+
var __iconData8, Database;
|
|
533
|
+
var init_database = __esm({
|
|
534
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/database.mjs"() {
|
|
535
|
+
init_createLucideIcon();
|
|
536
|
+
__iconData8 = {
|
|
537
|
+
name: "database",
|
|
538
|
+
size: 24,
|
|
539
|
+
node: [
|
|
540
|
+
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
541
|
+
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
542
|
+
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
543
|
+
]
|
|
544
|
+
};
|
|
545
|
+
__iconData8.node;
|
|
546
|
+
Database = createLucideIcon(__iconData8);
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list.mjs
|
|
551
|
+
var list_exports = {};
|
|
552
|
+
__export(list_exports, {
|
|
553
|
+
__iconData: () => __iconData9,
|
|
554
|
+
default: () => List
|
|
555
|
+
});
|
|
556
|
+
var __iconData9, List;
|
|
557
|
+
var init_list = __esm({
|
|
558
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list.mjs"() {
|
|
559
|
+
init_createLucideIcon();
|
|
560
|
+
__iconData9 = {
|
|
561
|
+
name: "list",
|
|
562
|
+
size: 24,
|
|
563
|
+
node: [
|
|
564
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
565
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
566
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
567
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
568
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
569
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
570
|
+
]
|
|
571
|
+
};
|
|
572
|
+
__iconData9.node;
|
|
573
|
+
List = createLucideIcon(__iconData9);
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/check.mjs
|
|
578
|
+
var check_exports = {};
|
|
579
|
+
__export(check_exports, {
|
|
580
|
+
__iconData: () => __iconData10,
|
|
581
|
+
default: () => Check
|
|
582
|
+
});
|
|
583
|
+
var __iconData10, Check;
|
|
584
|
+
var init_check = __esm({
|
|
585
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/check.mjs"() {
|
|
586
|
+
init_createLucideIcon();
|
|
587
|
+
__iconData10 = {
|
|
588
|
+
name: "check",
|
|
589
|
+
size: 24,
|
|
590
|
+
node: [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]
|
|
591
|
+
};
|
|
592
|
+
__iconData10.node;
|
|
593
|
+
Check = createLucideIcon(__iconData10);
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/check-check.mjs
|
|
598
|
+
var check_check_exports = {};
|
|
599
|
+
__export(check_check_exports, {
|
|
600
|
+
__iconData: () => __iconData11,
|
|
601
|
+
default: () => CheckCheck
|
|
602
|
+
});
|
|
603
|
+
var __iconData11, CheckCheck;
|
|
604
|
+
var init_check_check = __esm({
|
|
605
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/check-check.mjs"() {
|
|
606
|
+
init_createLucideIcon();
|
|
607
|
+
__iconData11 = {
|
|
608
|
+
name: "check-check",
|
|
609
|
+
size: 24,
|
|
610
|
+
node: [
|
|
611
|
+
["path", { d: "M18 6 7 17l-5-5", key: "116fxf" }],
|
|
612
|
+
["path", { d: "m22 10-7.5 7.5L13 16", key: "ke71qq" }]
|
|
613
|
+
]
|
|
614
|
+
};
|
|
615
|
+
__iconData11.node;
|
|
616
|
+
CheckCheck = createLucideIcon(__iconData11);
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/search.mjs
|
|
621
|
+
var search_exports = {};
|
|
622
|
+
__export(search_exports, {
|
|
623
|
+
__iconData: () => __iconData12,
|
|
624
|
+
default: () => Search
|
|
625
|
+
});
|
|
626
|
+
var __iconData12, Search;
|
|
627
|
+
var init_search = __esm({
|
|
628
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/search.mjs"() {
|
|
629
|
+
init_createLucideIcon();
|
|
630
|
+
__iconData12 = {
|
|
631
|
+
name: "search",
|
|
632
|
+
size: 24,
|
|
633
|
+
node: [
|
|
634
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
635
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
636
|
+
]
|
|
637
|
+
};
|
|
638
|
+
__iconData12.node;
|
|
639
|
+
Search = createLucideIcon(__iconData12);
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.mjs
|
|
644
|
+
var refresh_cw_exports = {};
|
|
645
|
+
__export(refresh_cw_exports, {
|
|
646
|
+
__iconData: () => __iconData13,
|
|
647
|
+
default: () => RefreshCw
|
|
648
|
+
});
|
|
649
|
+
var __iconData13, RefreshCw;
|
|
650
|
+
var init_refresh_cw = __esm({
|
|
651
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.mjs"() {
|
|
652
|
+
init_createLucideIcon();
|
|
653
|
+
__iconData13 = {
|
|
654
|
+
name: "refresh-cw",
|
|
655
|
+
size: 24,
|
|
656
|
+
node: [
|
|
657
|
+
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
658
|
+
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
659
|
+
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
660
|
+
["path", { d: "M8 16H3v5", key: "1cv678" }]
|
|
661
|
+
]
|
|
662
|
+
};
|
|
663
|
+
__iconData13.node;
|
|
664
|
+
RefreshCw = createLucideIcon(__iconData13);
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/plus.mjs
|
|
669
|
+
var plus_exports = {};
|
|
670
|
+
__export(plus_exports, {
|
|
671
|
+
__iconData: () => __iconData14,
|
|
672
|
+
default: () => Plus
|
|
673
|
+
});
|
|
674
|
+
var __iconData14, Plus;
|
|
675
|
+
var init_plus = __esm({
|
|
676
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/plus.mjs"() {
|
|
677
|
+
init_createLucideIcon();
|
|
678
|
+
__iconData14 = {
|
|
679
|
+
name: "plus",
|
|
680
|
+
size: 24,
|
|
681
|
+
node: [
|
|
682
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
683
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
684
|
+
]
|
|
685
|
+
};
|
|
686
|
+
__iconData14.node;
|
|
687
|
+
Plus = createLucideIcon(__iconData14);
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/volume-2.mjs
|
|
692
|
+
var volume_2_exports = {};
|
|
693
|
+
__export(volume_2_exports, {
|
|
694
|
+
__iconData: () => __iconData15,
|
|
695
|
+
default: () => Volume2
|
|
696
|
+
});
|
|
697
|
+
var __iconData15, Volume2;
|
|
698
|
+
var init_volume_2 = __esm({
|
|
699
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/volume-2.mjs"() {
|
|
700
|
+
init_createLucideIcon();
|
|
701
|
+
__iconData15 = {
|
|
702
|
+
name: "volume-2",
|
|
703
|
+
size: 24,
|
|
704
|
+
node: [
|
|
705
|
+
[
|
|
706
|
+
"path",
|
|
707
|
+
{
|
|
708
|
+
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
709
|
+
key: "uqj9uw"
|
|
710
|
+
}
|
|
711
|
+
],
|
|
712
|
+
["path", { d: "M16 9a5 5 0 0 1 0 6", key: "1q6k2b" }],
|
|
713
|
+
["path", { d: "M19.364 18.364a9 9 0 0 0 0-12.728", key: "ijwkga" }]
|
|
714
|
+
]
|
|
715
|
+
};
|
|
716
|
+
__iconData15.node;
|
|
717
|
+
Volume2 = createLucideIcon(__iconData15);
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/volume-x.mjs
|
|
722
|
+
var volume_x_exports = {};
|
|
723
|
+
__export(volume_x_exports, {
|
|
724
|
+
__iconData: () => __iconData16,
|
|
725
|
+
default: () => VolumeX
|
|
726
|
+
});
|
|
727
|
+
var __iconData16, VolumeX;
|
|
728
|
+
var init_volume_x = __esm({
|
|
729
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/volume-x.mjs"() {
|
|
730
|
+
init_createLucideIcon();
|
|
731
|
+
__iconData16 = {
|
|
732
|
+
name: "volume-x",
|
|
733
|
+
size: 24,
|
|
734
|
+
node: [
|
|
735
|
+
[
|
|
736
|
+
"path",
|
|
737
|
+
{
|
|
738
|
+
d: "M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",
|
|
739
|
+
key: "1p7khw"
|
|
740
|
+
}
|
|
741
|
+
],
|
|
742
|
+
["path", { d: "m16.5 14.5 5-5", key: "cul3yw" }],
|
|
743
|
+
["path", { d: "m16.5 9.5 5 5", key: "1akey5" }]
|
|
744
|
+
]
|
|
745
|
+
};
|
|
746
|
+
__iconData16.node;
|
|
747
|
+
VolumeX = createLucideIcon(__iconData16);
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/moon.mjs
|
|
752
|
+
var moon_exports = {};
|
|
753
|
+
__export(moon_exports, {
|
|
754
|
+
__iconData: () => __iconData17,
|
|
755
|
+
default: () => Moon
|
|
756
|
+
});
|
|
757
|
+
var __iconData17, Moon;
|
|
758
|
+
var init_moon = __esm({
|
|
759
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/moon.mjs"() {
|
|
760
|
+
init_createLucideIcon();
|
|
761
|
+
__iconData17 = {
|
|
762
|
+
name: "moon",
|
|
763
|
+
size: 24,
|
|
764
|
+
node: [
|
|
765
|
+
[
|
|
766
|
+
"path",
|
|
767
|
+
{
|
|
768
|
+
d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
|
|
769
|
+
key: "kfwtm"
|
|
770
|
+
}
|
|
771
|
+
]
|
|
772
|
+
]
|
|
773
|
+
};
|
|
774
|
+
__iconData17.node;
|
|
775
|
+
Moon = createLucideIcon(__iconData17);
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/clock.mjs
|
|
780
|
+
var clock_exports = {};
|
|
781
|
+
__export(clock_exports, {
|
|
782
|
+
__iconData: () => __iconData18,
|
|
783
|
+
default: () => Clock
|
|
784
|
+
});
|
|
785
|
+
var __iconData18, Clock;
|
|
786
|
+
var init_clock = __esm({
|
|
787
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/clock.mjs"() {
|
|
788
|
+
init_createLucideIcon();
|
|
789
|
+
__iconData18 = {
|
|
790
|
+
name: "clock",
|
|
791
|
+
size: 24,
|
|
792
|
+
node: [
|
|
793
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
794
|
+
["path", { d: "M12 6v6l4 2", key: "mmk7yg" }]
|
|
795
|
+
]
|
|
796
|
+
};
|
|
797
|
+
__iconData18.node;
|
|
798
|
+
Clock = createLucideIcon(__iconData18);
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/info.mjs
|
|
803
|
+
var info_exports = {};
|
|
804
|
+
__export(info_exports, {
|
|
805
|
+
__iconData: () => __iconData19,
|
|
806
|
+
default: () => Info
|
|
807
|
+
});
|
|
808
|
+
var __iconData19, Info;
|
|
809
|
+
var init_info = __esm({
|
|
810
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/info.mjs"() {
|
|
811
|
+
init_createLucideIcon();
|
|
812
|
+
__iconData19 = {
|
|
813
|
+
name: "info",
|
|
814
|
+
size: 24,
|
|
815
|
+
node: [
|
|
816
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
817
|
+
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
818
|
+
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
819
|
+
]
|
|
820
|
+
};
|
|
821
|
+
__iconData19.node;
|
|
822
|
+
Info = createLucideIcon(__iconData19);
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/circle-check.mjs
|
|
827
|
+
var circle_check_exports = {};
|
|
828
|
+
__export(circle_check_exports, {
|
|
829
|
+
__iconData: () => __iconData20,
|
|
830
|
+
default: () => CircleCheck
|
|
831
|
+
});
|
|
832
|
+
var __iconData20, CircleCheck;
|
|
833
|
+
var init_circle_check = __esm({
|
|
834
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/circle-check.mjs"() {
|
|
835
|
+
init_createLucideIcon();
|
|
836
|
+
__iconData20 = {
|
|
837
|
+
name: "circle-check",
|
|
838
|
+
size: 24,
|
|
839
|
+
node: [
|
|
840
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
841
|
+
["path", { d: "m16 9-5.5 5.5L8 12", key: "xofnsj" }]
|
|
842
|
+
],
|
|
843
|
+
aliases: ["check-circle-2"]
|
|
844
|
+
};
|
|
845
|
+
__iconData20.node;
|
|
846
|
+
CircleCheck = createLucideIcon(__iconData20);
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/triangle-exclamation-point.mjs
|
|
851
|
+
var __iconData21, TriangleExclamationPoint;
|
|
852
|
+
var init_triangle_exclamation_point = __esm({
|
|
853
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/triangle-exclamation-point.mjs"() {
|
|
854
|
+
init_createLucideIcon();
|
|
855
|
+
__iconData21 = {
|
|
856
|
+
name: "triangle-exclamation-point",
|
|
857
|
+
size: 24,
|
|
858
|
+
node: [
|
|
859
|
+
[
|
|
860
|
+
"path",
|
|
861
|
+
{
|
|
862
|
+
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
|
|
863
|
+
key: "wmoenq"
|
|
864
|
+
}
|
|
865
|
+
],
|
|
866
|
+
["path", { d: "M12 9v4", key: "juzpu7" }],
|
|
867
|
+
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
868
|
+
],
|
|
869
|
+
aliases: ["alert-triangle", "triangle-alert"]
|
|
870
|
+
};
|
|
871
|
+
__iconData21.node;
|
|
872
|
+
TriangleExclamationPoint = createLucideIcon(__iconData21);
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/triangle-alert.mjs
|
|
877
|
+
var triangle_alert_exports = {};
|
|
878
|
+
__export(triangle_alert_exports, {
|
|
879
|
+
default: () => TriangleExclamationPoint
|
|
880
|
+
});
|
|
881
|
+
var init_triangle_alert = __esm({
|
|
882
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/triangle-alert.mjs"() {
|
|
883
|
+
init_triangle_exclamation_point();
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/circle-exclamation-point.mjs
|
|
888
|
+
var __iconData22, CircleExclamationPoint;
|
|
889
|
+
var init_circle_exclamation_point = __esm({
|
|
890
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/circle-exclamation-point.mjs"() {
|
|
891
|
+
init_createLucideIcon();
|
|
892
|
+
__iconData22 = {
|
|
893
|
+
name: "circle-exclamation-point",
|
|
894
|
+
size: 24,
|
|
895
|
+
node: [
|
|
896
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
897
|
+
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
898
|
+
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
899
|
+
],
|
|
900
|
+
aliases: ["alert-circle", "circle-alert"]
|
|
901
|
+
};
|
|
902
|
+
__iconData22.node;
|
|
903
|
+
CircleExclamationPoint = createLucideIcon(__iconData22);
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/circle-alert.mjs
|
|
908
|
+
var circle_alert_exports = {};
|
|
909
|
+
__export(circle_alert_exports, {
|
|
910
|
+
default: () => CircleExclamationPoint
|
|
911
|
+
});
|
|
912
|
+
var init_circle_alert = __esm({
|
|
913
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/circle-alert.mjs"() {
|
|
914
|
+
init_circle_exclamation_point();
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/rotate-ccw.mjs
|
|
919
|
+
var rotate_ccw_exports = {};
|
|
920
|
+
__export(rotate_ccw_exports, {
|
|
921
|
+
__iconData: () => __iconData23,
|
|
922
|
+
default: () => RotateCcw
|
|
923
|
+
});
|
|
924
|
+
var __iconData23, RotateCcw;
|
|
925
|
+
var init_rotate_ccw = __esm({
|
|
926
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/rotate-ccw.mjs"() {
|
|
927
|
+
init_createLucideIcon();
|
|
928
|
+
__iconData23 = {
|
|
929
|
+
name: "rotate-ccw",
|
|
930
|
+
size: 24,
|
|
931
|
+
node: [
|
|
932
|
+
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
933
|
+
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
934
|
+
]
|
|
935
|
+
};
|
|
936
|
+
__iconData23.node;
|
|
937
|
+
RotateCcw = createLucideIcon(__iconData23);
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/play.mjs
|
|
942
|
+
var play_exports = {};
|
|
943
|
+
__export(play_exports, {
|
|
944
|
+
__iconData: () => __iconData24,
|
|
945
|
+
default: () => Play
|
|
946
|
+
});
|
|
947
|
+
var __iconData24, Play;
|
|
948
|
+
var init_play = __esm({
|
|
949
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/play.mjs"() {
|
|
950
|
+
init_createLucideIcon();
|
|
951
|
+
__iconData24 = {
|
|
952
|
+
name: "play",
|
|
953
|
+
size: 24,
|
|
954
|
+
node: [
|
|
955
|
+
[
|
|
956
|
+
"path",
|
|
957
|
+
{
|
|
958
|
+
d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
|
|
959
|
+
key: "10ikf1"
|
|
960
|
+
}
|
|
961
|
+
]
|
|
962
|
+
]
|
|
963
|
+
};
|
|
964
|
+
__iconData24.node;
|
|
965
|
+
Play = createLucideIcon(__iconData24);
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
// packages/addons/message/client/ui/copy.cjs
|
|
970
|
+
var require_copy = __commonJS({
|
|
971
|
+
"packages/addons/message/client/ui/copy.cjs"(exports2, module2) {
|
|
972
|
+
"use strict";
|
|
973
|
+
module2.exports = {
|
|
974
|
+
zh: {
|
|
975
|
+
title: "\u6D88\u606F",
|
|
976
|
+
hint: "\u7EDF\u4E00\u6D88\u606F\u5165\u53E3 \xB7 \u4EC5\u672C\u673A\u4FDD\u5B58",
|
|
977
|
+
tabs: { stats: "\u7EDF\u8BA1", inbox: "\u6536\u4EF6\u7BB1", config: "\u914D\u7F6E", data: "\u6570\u636E", actions: "Action" },
|
|
978
|
+
loading: "\u6B63\u5728\u8BFB\u53D6\u6D88\u606F\u2026",
|
|
979
|
+
loadFail: "\u6D88\u606F\u52A0\u8F7D\u5931\u8D25",
|
|
980
|
+
retry: "\u91CD\u8BD5",
|
|
981
|
+
empty: "\u8FD8\u6CA1\u6709\u6D88\u606F\u3002\u5B50\u63D2\u4EF6\u6216 agent \u8C03\u7528 message.send \u540E\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",
|
|
982
|
+
unreadOnly: "\u53EA\u770B\u672A\u8BFB",
|
|
983
|
+
searchPlaceholder: "\u641C\u7D22\u6807\u9898\u6216\u6B63\u6587",
|
|
984
|
+
noMatch: "\u6CA1\u6709\u5339\u914D\u7684\u6D88\u606F",
|
|
985
|
+
markAll: "\u5168\u90E8\u5DF2\u8BFB",
|
|
986
|
+
markRead: "\u6807\u8BB0\u5DF2\u8BFB",
|
|
987
|
+
marked: "\u5DF2\u6807\u8BB0 {n} \u6761\u4E3A\u5DF2\u8BFB",
|
|
988
|
+
allRead: "\u6CA1\u6709\u672A\u8BFB\u6D88\u606F\u4E86",
|
|
989
|
+
unread: "\u672A\u8BFB",
|
|
990
|
+
unreadCount: "\u672A\u8BFB {n} \u6761",
|
|
991
|
+
total: "\u5171 {n} \u6761",
|
|
992
|
+
pageInfo: "\u7B2C {page} / {pages} \u9875",
|
|
993
|
+
prev: "\u4E0A\u4E00\u9875",
|
|
994
|
+
next: "\u4E0B\u4E00\u9875",
|
|
995
|
+
levelAll: "\u5168\u90E8\u7EA7\u522B",
|
|
996
|
+
sourceAll: "\u5168\u90E8\u6765\u6E90",
|
|
997
|
+
level: { info: "\u63D0\u793A", success: "\u6210\u529F", warning: "\u8B66\u544A", error: "\u9519\u8BEF" },
|
|
998
|
+
audience: { user: "\u7528\u6237", agent: "Agent", all: "\u5168\u90E8" },
|
|
999
|
+
from: "\u6765\u6E90",
|
|
1000
|
+
at: "\u65F6\u95F4",
|
|
1001
|
+
read: "\u5DF2\u8BFB",
|
|
1002
|
+
bodyEmpty: "\uFF08\u65E0\u6B63\u6587\uFF09",
|
|
1003
|
+
soundOn: "\u63D0\u793A\u97F3\u5DF2\u5F00\u542F",
|
|
1004
|
+
soundOff: "\u63D0\u793A\u97F3\u5DF2\u5173\u95ED",
|
|
1005
|
+
statsTitle: "\u6D88\u606F\u7EDF\u8BA1",
|
|
1006
|
+
statsHint: "\u53EA\u7EDF\u8BA1\u672C\u673A\u6D88\u606F\uFF1B\u672A\u8BFB\u4E0D\u6309\u65F6\u95F4\u6E05\u7406",
|
|
1007
|
+
statTotal: "\u603B\u6D88\u606F",
|
|
1008
|
+
statUnread: "\u672A\u8BFB",
|
|
1009
|
+
statRead: "\u5DF2\u8BFB",
|
|
1010
|
+
statOldest: "\u6700\u65E9\u672A\u8BFB",
|
|
1011
|
+
byLevel: "\u6309\u7EA7\u522B",
|
|
1012
|
+
bySource: "\u6309\u6765\u6E90",
|
|
1013
|
+
trend: "\u6700\u8FD1 {days} \u5929",
|
|
1014
|
+
noSource: "\uFF08\u672A\u6807\u6CE8\uFF09",
|
|
1015
|
+
noData: "\u6682\u65E0\u6570\u636E",
|
|
1016
|
+
configTitle: "\u6D88\u606F\u914D\u7F6E",
|
|
1017
|
+
configHint: "\u914D\u7F6E\u5B58\u672C\u5730 meta \u8868\uFF1B\u63D0\u793A\u97F3\u4E0E\u672C\u673A\u504F\u597D\u4E0D\u4F1A\u540C\u6B65\u5230\u5176\u4ED6\u8BBE\u5907",
|
|
1018
|
+
save: "\u4FDD\u5B58",
|
|
1019
|
+
saved: "\u5DF2\u4FDD\u5B58",
|
|
1020
|
+
resetAll: "\u5168\u90E8\u6062\u590D\u9ED8\u8BA4",
|
|
1021
|
+
resetOne: "\u6062\u590D\u9ED8\u8BA4",
|
|
1022
|
+
preview: "\u8BD5\u542C",
|
|
1023
|
+
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",
|
|
1024
|
+
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",
|
|
1025
|
+
volumeLabel: "\u97F3\u91CF {n}%",
|
|
1026
|
+
dataTitle: "\u6570\u636E",
|
|
1027
|
+
actionsTitle: "Action",
|
|
1028
|
+
openInbox: "\u6253\u5F00\u6536\u4EF6\u7BB1"
|
|
1029
|
+
},
|
|
1030
|
+
en: {
|
|
1031
|
+
title: "Messages",
|
|
1032
|
+
hint: "Single entry point \xB7 stored locally",
|
|
1033
|
+
tabs: { stats: "Stats", inbox: "Inbox", config: "Config", data: "Data", actions: "Actions" },
|
|
1034
|
+
loading: "Loading messages\u2026",
|
|
1035
|
+
loadFail: "Failed to load messages",
|
|
1036
|
+
retry: "Retry",
|
|
1037
|
+
empty: "No messages yet. Plugins or agents calling message.send will show up here.",
|
|
1038
|
+
unreadOnly: "Unread only",
|
|
1039
|
+
searchPlaceholder: "Search title or body",
|
|
1040
|
+
noMatch: "No matching messages",
|
|
1041
|
+
markAll: "Mark all read",
|
|
1042
|
+
markRead: "Mark read",
|
|
1043
|
+
marked: "Marked {n} as read",
|
|
1044
|
+
allRead: "Nothing unread",
|
|
1045
|
+
unread: "Unread",
|
|
1046
|
+
unreadCount: "{n} unread",
|
|
1047
|
+
total: "{n} total",
|
|
1048
|
+
pageInfo: "Page {page} / {pages}",
|
|
1049
|
+
prev: "Previous",
|
|
1050
|
+
next: "Next",
|
|
1051
|
+
levelAll: "All levels",
|
|
1052
|
+
sourceAll: "All sources",
|
|
1053
|
+
level: { info: "Info", success: "Success", warning: "Warning", error: "Error" },
|
|
1054
|
+
audience: { user: "User", agent: "Agent", all: "All" },
|
|
1055
|
+
from: "Source",
|
|
1056
|
+
at: "Time",
|
|
1057
|
+
read: "Read",
|
|
1058
|
+
bodyEmpty: "(no body)",
|
|
1059
|
+
soundOn: "Sound on",
|
|
1060
|
+
soundOff: "Sound off",
|
|
1061
|
+
statsTitle: "Message stats",
|
|
1062
|
+
statsHint: "Local messages only; unread never expires by time",
|
|
1063
|
+
statTotal: "Messages",
|
|
1064
|
+
statUnread: "Unread",
|
|
1065
|
+
statRead: "Read",
|
|
1066
|
+
statOldest: "Oldest unread",
|
|
1067
|
+
byLevel: "By level",
|
|
1068
|
+
bySource: "By source",
|
|
1069
|
+
trend: "Last {days} days",
|
|
1070
|
+
noSource: "(unlabelled)",
|
|
1071
|
+
noData: "No data",
|
|
1072
|
+
configTitle: "Message settings",
|
|
1073
|
+
configHint: "Stored in the local meta table; sound and list preferences are not synced",
|
|
1074
|
+
save: "Save",
|
|
1075
|
+
saved: "Saved",
|
|
1076
|
+
resetAll: "Reset all",
|
|
1077
|
+
resetOne: "Reset",
|
|
1078
|
+
preview: "Preview",
|
|
1079
|
+
quietNote: "Inside quiet hours nothing plays, but messages are still stored. Levels above can pass through.",
|
|
1080
|
+
readDaysNote: "Read messages older than the retention window are pruned; unread ones never expire by time.",
|
|
1081
|
+
volumeLabel: "Volume {n}%",
|
|
1082
|
+
dataTitle: "Data",
|
|
1083
|
+
actionsTitle: "Actions",
|
|
1084
|
+
openInbox: "Open inbox"
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1090
|
+
// packages/addons/message/client/ui/styles.cjs
|
|
1091
|
+
var require_styles = __commonJS({
|
|
1092
|
+
"packages/addons/message/client/ui/styles.cjs"(exports2, module2) {
|
|
1093
|
+
"use strict";
|
|
1094
|
+
module2.exports = [
|
|
1095
|
+
".wbm-root{--wbm-line:var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent));--wbm-surface:var(--dsw-alias-bg-layer-1,color-mix(in oklab,currentColor 4%,transparent));--wbm-accent:var(--dsw-alias-brand-primary,#11a89b);display:flex;flex-direction:column;gap:12px;min-height:0;color:inherit;font-size:13px}",
|
|
1096
|
+
".wbm-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px}",
|
|
1097
|
+
".wbm-grow{flex:1;min-width:0}",
|
|
1098
|
+
".wbm-input{flex:1;min-width:140px;max-width:280px;border:1px solid var(--wbm-line);border-radius:8px;background:transparent;color:inherit;padding:6px 9px;font-size:12.5px}",
|
|
1099
|
+
".wbm-select{border:1px solid var(--wbm-line);border-radius:8px;background:transparent;color:inherit;padding:5px 8px;font-size:12.5px}",
|
|
1100
|
+
".wbm-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--wbm-line);background:transparent;color:inherit;border-radius:8px;padding:5px 10px;font-size:12.5px;cursor:pointer}",
|
|
1101
|
+
".wbm-btn:hover{border-color:color-mix(in oklab,var(--wbm-accent) 45%,var(--wbm-line))}",
|
|
1102
|
+
".wbm-btn.primary{background:var(--wbm-accent);border-color:var(--wbm-accent);color:var(--dsw-alias-label-primary-inverted,#fff);font-weight:600}",
|
|
1103
|
+
".wbm-btn:disabled{opacity:.5;cursor:default}",
|
|
1104
|
+
".wbm-check{display:inline-flex;align-items:center;gap:5px;font-size:12.5px;cursor:pointer}",
|
|
1105
|
+
".wbm-sumbox{display:flex;gap:10px;flex-wrap:wrap;font-size:11.5px;opacity:.7}",
|
|
1106
|
+
".wbm-list{display:flex;flex-direction:column;gap:8px;min-height:0;overflow:auto;overscroll-behavior:contain;padding:2px}",
|
|
1107
|
+
".wbm-card{border:1px solid var(--wbm-line);border-left-width:3px;border-radius:10px;padding:9px 11px;background:var(--wbm-surface);display:flex;flex-direction:column;gap:4px}",
|
|
1108
|
+
".wbm-card.lv-info{border-left-color:color-mix(in oklab,var(--wbm-accent) 60%,transparent)}",
|
|
1109
|
+
".wbm-card.lv-success{border-left-color:var(--dsw-alias-state-success-primary,#2fa84f)}",
|
|
1110
|
+
".wbm-card.lv-warning{border-left-color:var(--dsw-alias-state-warning-primary,#d9822b)}",
|
|
1111
|
+
".wbm-card.lv-error{border-left-color:var(--dsw-alias-state-error-primary,#e5484d)}",
|
|
1112
|
+
".wbm-card.is-unread{box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--wbm-accent) 22%,transparent)}",
|
|
1113
|
+
".wbm-card-top{display:flex;align-items:center;gap:6px;flex-wrap:wrap}",
|
|
1114
|
+
".wbm-title{font-weight:600;font-size:12.8px;min-width:0;overflow-wrap:anywhere}",
|
|
1115
|
+
".wbm-badge{font-size:10.5px;border-radius:999px;padding:1px 7px;border:1px solid var(--wbm-line);opacity:.8}",
|
|
1116
|
+
".wbm-badge.lv-warning{color:var(--dsw-alias-state-warning-primary,#d9822b);border-color:color-mix(in oklab,var(--dsw-alias-state-warning-primary,#d9822b) 45%,transparent)}",
|
|
1117
|
+
".wbm-badge.lv-error{color:var(--dsw-alias-state-error-primary,#e5484d);border-color:color-mix(in oklab,var(--dsw-alias-state-error-primary,#e5484d) 45%,transparent)}",
|
|
1118
|
+
".wbm-badge.lv-success{color:var(--dsw-alias-state-success-primary,#2fa84f);border-color:color-mix(in oklab,var(--dsw-alias-state-success-primary,#2fa84f) 45%,transparent)}",
|
|
1119
|
+
".wbm-meta{display:flex;gap:8px;flex-wrap:wrap;font-size:11px;opacity:.6}",
|
|
1120
|
+
".wbm-body{font-size:12px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;opacity:.9}",
|
|
1121
|
+
".wbm-ops{display:flex;gap:6px;flex-wrap:wrap}",
|
|
1122
|
+
".wbm-pager{display:flex;align-items:center;gap:8px;justify-content:flex-end;font-size:11.5px}",
|
|
1123
|
+
".wbm-empty{border:1px dashed var(--wbm-line);border-radius:10px;padding:26px 12px;text-align:center;opacity:.6;font-size:12.5px}",
|
|
1124
|
+
".wbm-err{border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,#e5484d) 40%,transparent);border-radius:10px;padding:10px 12px;color:var(--dsw-alias-state-error-primary,#e5484d);font-size:12.5px;display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
|
|
1125
|
+
".wbm-toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);z-index:820;background:var(--dsw-alias-toast-bg,rgba(20,20,20,.88));color:var(--dsw-alias-toast-label,#fff);border-radius:9px;padding:9px 14px;font-size:12.5px;pointer-events:none}",
|
|
1126
|
+
".wbm-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px}",
|
|
1127
|
+
".wbm-kpi{border:1px solid var(--wbm-line);border-radius:10px;padding:9px 11px;background:var(--wbm-surface);display:flex;flex-direction:column;gap:2px}",
|
|
1128
|
+
".wbm-kpi b{font-size:19px;font-weight:600}",
|
|
1129
|
+
".wbm-kpi span{font-size:11px;opacity:.65}",
|
|
1130
|
+
".wbm-section{border:1px solid var(--wbm-line);border-radius:10px;padding:10px 12px;background:var(--wbm-surface);display:flex;flex-direction:column;gap:7px}",
|
|
1131
|
+
".wbm-section h3{margin:0;font-size:12.5px;font-weight:600}",
|
|
1132
|
+
".wbm-bars{display:flex;flex-direction:column;gap:5px}",
|
|
1133
|
+
".wbm-bar{display:grid;grid-template-columns:88px 1fr 46px;gap:7px;align-items:center;font-size:11.5px}",
|
|
1134
|
+
".wbm-bar-track{height:7px;border-radius:999px;background:color-mix(in oklab,currentColor 10%,transparent);overflow:hidden}",
|
|
1135
|
+
".wbm-bar-fill{height:100%;border-radius:999px;background:var(--wbm-accent)}",
|
|
1136
|
+
".wbm-bar-fill.lv-warning{background:var(--dsw-alias-state-warning-primary,#d9822b)}",
|
|
1137
|
+
".wbm-bar-fill.lv-error{background:var(--dsw-alias-state-error-primary,#e5484d)}",
|
|
1138
|
+
".wbm-bar-fill.lv-success{background:var(--dsw-alias-state-success-primary,#2fa84f)}",
|
|
1139
|
+
".wbm-trend{display:flex;align-items:flex-end;gap:3px;height:64px}",
|
|
1140
|
+
".wbm-trend-col{flex:1;display:flex;flex-direction:column;justify-content:flex-end;gap:3px;align-items:center;font-size:9px;opacity:.75}",
|
|
1141
|
+
".wbm-trend-bar{width:100%;min-height:2px;border-radius:3px 3px 0 0;background:color-mix(in oklab,var(--wbm-accent) 65%,transparent)}",
|
|
1142
|
+
".wbm-field{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;padding:7px 0;border-bottom:1px dashed color-mix(in oklab,var(--wbm-line) 70%,transparent)}",
|
|
1143
|
+
".wbm-field:last-child{border-bottom:none}",
|
|
1144
|
+
".wbm-field-main{display:flex;flex-direction:column;gap:2px;min-width:0}",
|
|
1145
|
+
".wbm-field-label{font-size:12.5px;font-weight:500}",
|
|
1146
|
+
".wbm-field-hint{font-size:11px;opacity:.6;line-height:1.45}",
|
|
1147
|
+
".wbm-field-ctl{display:flex;align-items:center;gap:6px}",
|
|
1148
|
+
".wbm-range{width:130px}",
|
|
1149
|
+
".wbm-note{font-size:11.5px;opacity:.62;line-height:1.5}",
|
|
1150
|
+
".wbm-time{width:86px;border:1px solid var(--wbm-line);border-radius:7px;background:transparent;color:inherit;padding:4px 6px;font-size:12px}",
|
|
1151
|
+
".wbm-num{width:74px;border:1px solid var(--wbm-line);border-radius:7px;background:transparent;color:inherit;padding:4px 6px;font-size:12px}",
|
|
1152
|
+
".wbm-multis{display:flex;gap:6px;flex-wrap:wrap}",
|
|
1153
|
+
"@media (max-width:760px){.wbm-toolbar{gap:6px}.wbm-input{max-width:none}.wbm-bar{grid-template-columns:70px 1fr 38px}}"
|
|
1154
|
+
].join("");
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
|
|
1158
|
+
// packages/addons/message/client/notify/notifier.cjs
|
|
1159
|
+
var require_notifier = __commonJS({
|
|
1160
|
+
"packages/addons/message/client/notify/notifier.cjs"(exports2, module2) {
|
|
1161
|
+
"use strict";
|
|
1162
|
+
var DOMAIN = "wb-addon-message";
|
|
1163
|
+
var BASE = "/workbench/api";
|
|
1164
|
+
var CFG_TTL = 3e4;
|
|
1165
|
+
var SUPPRESS_MS = 5e3;
|
|
1166
|
+
var LEVELS = ["info", "success", "warning", "error"];
|
|
1167
|
+
var state = {
|
|
1168
|
+
running: false,
|
|
1169
|
+
source: null,
|
|
1170
|
+
cfg: { at: 0, values: null },
|
|
1171
|
+
audio: null,
|
|
1172
|
+
lastKey: "",
|
|
1173
|
+
lastAt: 0
|
|
1174
|
+
};
|
|
1175
|
+
function unwrap(r) {
|
|
1176
|
+
return r && r.result !== void 0 ? r.result : r;
|
|
1177
|
+
}
|
|
1178
|
+
function call(action, args) {
|
|
1179
|
+
return fetch(BASE + "/domains/" + DOMAIN + "/actions/" + action, {
|
|
1180
|
+
method: "POST",
|
|
1181
|
+
headers: { "content-type": "application/json" },
|
|
1182
|
+
body: JSON.stringify(args || {})
|
|
1183
|
+
}).then(function(r) {
|
|
1184
|
+
return r.json();
|
|
1185
|
+
}).then(unwrap);
|
|
1186
|
+
}
|
|
1187
|
+
function loadConfig(force) {
|
|
1188
|
+
var fresh = state.cfg.values && Date.now() - state.cfg.at < CFG_TTL;
|
|
1189
|
+
if (!force && fresh) return Promise.resolve(state.cfg.values);
|
|
1190
|
+
return call("message.configGet").then(function(body) {
|
|
1191
|
+
if (!body || !body.values) return state.cfg.values || {};
|
|
1192
|
+
state.cfg = { at: Date.now(), values: body.values };
|
|
1193
|
+
return body.values;
|
|
1194
|
+
}).catch(function() {
|
|
1195
|
+
return state.cfg.values || {};
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
function ensureAudio() {
|
|
1199
|
+
if (state.audio) return state.audio;
|
|
1200
|
+
var Ctor = typeof window !== "undefined" && (window.AudioContext || window.webkitAudioContext) || null;
|
|
1201
|
+
if (!Ctor) return null;
|
|
1202
|
+
try {
|
|
1203
|
+
state.audio = new Ctor();
|
|
1204
|
+
} catch (e) {
|
|
1205
|
+
state.audio = null;
|
|
1206
|
+
}
|
|
1207
|
+
return state.audio;
|
|
1208
|
+
}
|
|
1209
|
+
function unlock() {
|
|
1210
|
+
var audio = ensureAudio();
|
|
1211
|
+
if (audio && audio.state === "suspended" && typeof audio.resume === "function") audio.resume();
|
|
1212
|
+
}
|
|
1213
|
+
function installUnlock() {
|
|
1214
|
+
if (typeof document === "undefined" || !document.addEventListener) return;
|
|
1215
|
+
document.addEventListener("pointerdown", unlock, { once: true, capture: true, passive: true });
|
|
1216
|
+
}
|
|
1217
|
+
function inWindow(from, to, date) {
|
|
1218
|
+
var minutes = date.getHours() * 60 + date.getMinutes();
|
|
1219
|
+
var parse = function(text) {
|
|
1220
|
+
var parts = String(text || "").split(":");
|
|
1221
|
+
var h = Number(parts[0]);
|
|
1222
|
+
var m = Number(parts[1]);
|
|
1223
|
+
if (!Number.isFinite(h) || !Number.isFinite(m)) return null;
|
|
1224
|
+
return h * 60 + m;
|
|
1225
|
+
};
|
|
1226
|
+
var start2 = parse(from);
|
|
1227
|
+
var end = parse(to);
|
|
1228
|
+
if (start2 === null || end === null) return false;
|
|
1229
|
+
if (start2 === end) return true;
|
|
1230
|
+
if (start2 < end) return minutes >= start2 && minutes < end;
|
|
1231
|
+
return minutes >= start2 || minutes < end;
|
|
1232
|
+
}
|
|
1233
|
+
function isQuiet(values, date) {
|
|
1234
|
+
if (!values || values["quiet.enabled"] !== true) return false;
|
|
1235
|
+
return inWindow(values["quiet.from"], values["quiet.to"], date);
|
|
1236
|
+
}
|
|
1237
|
+
function passQuiet(values, level) {
|
|
1238
|
+
var levels = values && Array.isArray(values["quiet.levels"]) ? values["quiet.levels"] : ["warning", "error"];
|
|
1239
|
+
return levels.indexOf(level) >= 0;
|
|
1240
|
+
}
|
|
1241
|
+
function playTone(level, volume) {
|
|
1242
|
+
var audio = ensureAudio();
|
|
1243
|
+
if (!audio) return false;
|
|
1244
|
+
unlock();
|
|
1245
|
+
var pattern;
|
|
1246
|
+
var freq;
|
|
1247
|
+
if (level === "error") {
|
|
1248
|
+
freq = 520;
|
|
1249
|
+
pattern = [130, 70, 130, 70, 130];
|
|
1250
|
+
} else if (level === "warning") {
|
|
1251
|
+
freq = 660;
|
|
1252
|
+
pattern = [110, 60, 110, 60, 110];
|
|
1253
|
+
} else {
|
|
1254
|
+
freq = 880;
|
|
1255
|
+
pattern = [90, 60, 90];
|
|
1256
|
+
}
|
|
1257
|
+
var gain = Math.max(0, Math.min(1, Number(volume === void 0 ? 0.4 : volume))) * 0.22;
|
|
1258
|
+
var t = audio.currentTime + 0.01;
|
|
1259
|
+
for (var i = 0; i < pattern.length; i += 1) {
|
|
1260
|
+
var dur = pattern[i] / 1e3;
|
|
1261
|
+
if (i % 2 === 0) {
|
|
1262
|
+
var osc = audio.createOscillator();
|
|
1263
|
+
var amp = audio.createGain();
|
|
1264
|
+
osc.type = "sine";
|
|
1265
|
+
osc.frequency.value = freq;
|
|
1266
|
+
amp.gain.setValueAtTime(1e-4, t);
|
|
1267
|
+
amp.gain.exponentialRampToValueAtTime(Math.max(2e-4, gain), t + 0.012);
|
|
1268
|
+
amp.gain.exponentialRampToValueAtTime(1e-4, t + dur);
|
|
1269
|
+
osc.connect(amp);
|
|
1270
|
+
amp.connect(audio.destination);
|
|
1271
|
+
osc.start(t);
|
|
1272
|
+
osc.stop(t + dur + 0.02);
|
|
1273
|
+
}
|
|
1274
|
+
t += dur;
|
|
1275
|
+
}
|
|
1276
|
+
return true;
|
|
1277
|
+
}
|
|
1278
|
+
function maybePlay(values, message) {
|
|
1279
|
+
if (!values) return false;
|
|
1280
|
+
if (values["sound.enabled"] === false) return false;
|
|
1281
|
+
if (!message || message.audience === "agent") return false;
|
|
1282
|
+
var hidden = typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
1283
|
+
if (hidden && values["sound.whileHidden"] !== true) return false;
|
|
1284
|
+
var level = LEVELS.indexOf(message.level) >= 0 ? message.level : "info";
|
|
1285
|
+
if (isQuiet(values, /* @__PURE__ */ new Date()) && !passQuiet(values, level)) return false;
|
|
1286
|
+
return playTone(level, values["sound.volume"]);
|
|
1287
|
+
}
|
|
1288
|
+
function handleEvent(payload) {
|
|
1289
|
+
if (!payload || payload.domainId !== DOMAIN || payload.event !== "message.created") return;
|
|
1290
|
+
var message = payload.data && payload.data.message;
|
|
1291
|
+
if (!message || !message.id) return;
|
|
1292
|
+
var now = Date.now();
|
|
1293
|
+
if (state.lastKey === message.id && now - state.lastAt < SUPPRESS_MS) return;
|
|
1294
|
+
state.lastKey = message.id;
|
|
1295
|
+
state.lastAt = now;
|
|
1296
|
+
loadConfig(false).then(function(values) {
|
|
1297
|
+
maybePlay(values, message);
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
function start() {
|
|
1301
|
+
if (state.running) return;
|
|
1302
|
+
state.running = true;
|
|
1303
|
+
installUnlock();
|
|
1304
|
+
if (typeof window === "undefined" || typeof window.EventSource !== "function") return;
|
|
1305
|
+
try {
|
|
1306
|
+
state.source = new window.EventSource(BASE + "/events");
|
|
1307
|
+
state.source.addEventListener("domain-event", function(event) {
|
|
1308
|
+
try {
|
|
1309
|
+
handleEvent(JSON.parse(event.data));
|
|
1310
|
+
} catch (e) {
|
|
1311
|
+
}
|
|
1312
|
+
});
|
|
1313
|
+
} catch (e) {
|
|
1314
|
+
state.source = null;
|
|
1315
|
+
}
|
|
1316
|
+
loadConfig(true);
|
|
1317
|
+
}
|
|
1318
|
+
function stop() {
|
|
1319
|
+
state.running = false;
|
|
1320
|
+
if (state.source && typeof state.source.close === "function") state.source.close();
|
|
1321
|
+
state.source = null;
|
|
1322
|
+
}
|
|
1323
|
+
function preview(level) {
|
|
1324
|
+
var lv = LEVELS.indexOf(level) >= 0 ? level : "info";
|
|
1325
|
+
return loadConfig(false).then(function(values) {
|
|
1326
|
+
return playTone(lv, values["sound.volume"] === void 0 ? 0.4 : values["sound.volume"]);
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
module2.exports = { start, stop, preview, refreshConfig: function() {
|
|
1330
|
+
return loadConfig(true);
|
|
1331
|
+
} };
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
// packages/addons/message/client/views/config.cjs
|
|
1336
|
+
var require_config = __commonJS({
|
|
1337
|
+
"packages/addons/message/client/views/config.cjs"(exports2, module2) {
|
|
1338
|
+
"use strict";
|
|
1339
|
+
var React = require("react");
|
|
1340
|
+
var h = React.createElement;
|
|
1341
|
+
var notifier = require_notifier();
|
|
1342
|
+
var DOMAIN = "message";
|
|
1343
|
+
function unwrap(r) {
|
|
1344
|
+
return r && r.result !== void 0 ? r.result : r;
|
|
1345
|
+
}
|
|
1346
|
+
function useConfig(api, fallback) {
|
|
1347
|
+
var fb = fallback || {};
|
|
1348
|
+
var stateS = React.useState({
|
|
1349
|
+
ready: false,
|
|
1350
|
+
values: Object.assign({}, fb),
|
|
1351
|
+
items: [],
|
|
1352
|
+
groups: [],
|
|
1353
|
+
overrides: {},
|
|
1354
|
+
error: "",
|
|
1355
|
+
state: null
|
|
1356
|
+
});
|
|
1357
|
+
var state = stateS[0];
|
|
1358
|
+
var setState = stateS[1];
|
|
1359
|
+
React.useEffect(function() {
|
|
1360
|
+
var alive = true;
|
|
1361
|
+
Promise.resolve(api.call(DOMAIN + ".configGet")).then(function(r) {
|
|
1362
|
+
if (!alive) return;
|
|
1363
|
+
if (r && r.ok === false) throw new Error(r && r.error || "load failed");
|
|
1364
|
+
var body = unwrap(r);
|
|
1365
|
+
if (!body || !body.values) throw new Error("empty config");
|
|
1366
|
+
setState({
|
|
1367
|
+
ready: true,
|
|
1368
|
+
values: Object.assign({}, fb, body.values),
|
|
1369
|
+
items: body.items || [],
|
|
1370
|
+
groups: body.groups || [],
|
|
1371
|
+
overrides: body.overrides || {},
|
|
1372
|
+
error: "",
|
|
1373
|
+
state: body
|
|
1374
|
+
});
|
|
1375
|
+
}).catch(function(e) {
|
|
1376
|
+
if (!alive) return;
|
|
1377
|
+
setState({ ready: true, values: Object.assign({}, fb), items: [], groups: [], overrides: {}, error: String(e && e.message || e), state: null });
|
|
1378
|
+
});
|
|
1379
|
+
return function() {
|
|
1380
|
+
alive = false;
|
|
1381
|
+
};
|
|
1382
|
+
}, [api]);
|
|
1383
|
+
function setValues(next) {
|
|
1384
|
+
if (!next || typeof next !== "object") return;
|
|
1385
|
+
setState(function(prev) {
|
|
1386
|
+
var values = Object.assign({}, prev.values, next);
|
|
1387
|
+
var body = prev.state;
|
|
1388
|
+
if (body && typeof body === "object") body = Object.assign({}, body, { values });
|
|
1389
|
+
return Object.assign({}, prev, { values, state: body });
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
return Object.assign({}, state, { setValues });
|
|
1393
|
+
}
|
|
1394
|
+
function labelOf(item, lang) {
|
|
1395
|
+
return lang === "en" ? item.en || item.zh || item.id : item.zh || item.en || item.id;
|
|
1396
|
+
}
|
|
1397
|
+
function hintOf(item, lang) {
|
|
1398
|
+
return lang === "en" ? item.hintEn || "" : item.hintZh || "";
|
|
1399
|
+
}
|
|
1400
|
+
function ConfigView(props) {
|
|
1401
|
+
var api = props.api;
|
|
1402
|
+
var t = props.t;
|
|
1403
|
+
var lang = props.lang;
|
|
1404
|
+
var cfg = useConfig(api, {});
|
|
1405
|
+
var toastS = React.useState("");
|
|
1406
|
+
var toast = toastS[0];
|
|
1407
|
+
var setToast = toastS[1];
|
|
1408
|
+
var localS = React.useState({});
|
|
1409
|
+
var local = localS[0];
|
|
1410
|
+
var setLocal = localS[1];
|
|
1411
|
+
function values() {
|
|
1412
|
+
return Object.assign({}, cfg.values, local);
|
|
1413
|
+
}
|
|
1414
|
+
function toastOnce(message) {
|
|
1415
|
+
setToast(message);
|
|
1416
|
+
setTimeout(function() {
|
|
1417
|
+
setToast("");
|
|
1418
|
+
}, 2e3);
|
|
1419
|
+
}
|
|
1420
|
+
var seqRef = React.useRef(0);
|
|
1421
|
+
function dropLocal(id, value) {
|
|
1422
|
+
setLocal(function(prev) {
|
|
1423
|
+
if (!(id in prev)) return prev;
|
|
1424
|
+
if (JSON.stringify(prev[id]) !== JSON.stringify(value)) return prev;
|
|
1425
|
+
var next = Object.assign({}, prev);
|
|
1426
|
+
delete next[id];
|
|
1427
|
+
return next;
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
function save(id, value) {
|
|
1431
|
+
var seq = ++seqRef.current;
|
|
1432
|
+
var patch = {};
|
|
1433
|
+
patch[id] = value;
|
|
1434
|
+
setLocal(function(prev) {
|
|
1435
|
+
var next = Object.assign({}, prev);
|
|
1436
|
+
next[id] = value;
|
|
1437
|
+
return next;
|
|
1438
|
+
});
|
|
1439
|
+
return Promise.resolve(api.call(DOMAIN + ".configSet", { values: patch })).then(function(r) {
|
|
1440
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
|
|
1441
|
+
var body = unwrap(r) || {};
|
|
1442
|
+
if (seq !== seqRef.current) return body;
|
|
1443
|
+
if (typeof cfg.setValues === "function") cfg.setValues(body.values);
|
|
1444
|
+
setLocal({});
|
|
1445
|
+
toastOnce(t.saved);
|
|
1446
|
+
if (notifier && typeof notifier.refreshConfig === "function") notifier.refreshConfig();
|
|
1447
|
+
return body;
|
|
1448
|
+
}).catch(function(e) {
|
|
1449
|
+
dropLocal(id, value);
|
|
1450
|
+
toastOnce(String(e && e.message || e));
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
function resetAll() {
|
|
1454
|
+
Promise.resolve(api.call(DOMAIN + ".configReset", {})).then(function(r) {
|
|
1455
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
|
|
1456
|
+
var body = unwrap(r) || {};
|
|
1457
|
+
if (typeof cfg.setValues === "function") cfg.setValues(body.values);
|
|
1458
|
+
seqRef.current += 1;
|
|
1459
|
+
setLocal({});
|
|
1460
|
+
toastOnce(t.saved);
|
|
1461
|
+
if (notifier && typeof notifier.refreshConfig === "function") notifier.refreshConfig();
|
|
1462
|
+
}).catch(function(e) {
|
|
1463
|
+
toastOnce(String(e && e.message || e));
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
function control(item) {
|
|
1467
|
+
var value = values()[item.id];
|
|
1468
|
+
if (item.type === "bool") {
|
|
1469
|
+
return h("input", {
|
|
1470
|
+
type: "checkbox",
|
|
1471
|
+
"aria-label": labelOf(item, lang),
|
|
1472
|
+
checked: value === true,
|
|
1473
|
+
onChange: function(e) {
|
|
1474
|
+
save(item.id, e.target.checked);
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
if (item.type === "number") {
|
|
1479
|
+
var pct = Math.round((Number(value) || 0) * 100);
|
|
1480
|
+
return h(
|
|
1481
|
+
"span",
|
|
1482
|
+
{ className: "wbm-field-ctl" },
|
|
1483
|
+
h("input", {
|
|
1484
|
+
className: "wbm-range",
|
|
1485
|
+
type: "range",
|
|
1486
|
+
min: item.min === void 0 ? 0 : item.min,
|
|
1487
|
+
max: item.max === void 0 ? 1 : item.max,
|
|
1488
|
+
step: 0.05,
|
|
1489
|
+
value: Number(value) || 0,
|
|
1490
|
+
"aria-label": labelOf(item, lang),
|
|
1491
|
+
onChange: function(e) {
|
|
1492
|
+
save(item.id, Number(e.target.value));
|
|
1493
|
+
}
|
|
1494
|
+
}),
|
|
1495
|
+
h("span", { className: "wbm-note" }, String(pct) + "%")
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1498
|
+
if (item.type === "int") {
|
|
1499
|
+
return h("input", {
|
|
1500
|
+
className: "wbm-num",
|
|
1501
|
+
type: "number",
|
|
1502
|
+
min: item.min,
|
|
1503
|
+
max: item.max,
|
|
1504
|
+
value: value === void 0 ? "" : value,
|
|
1505
|
+
"aria-label": labelOf(item, lang),
|
|
1506
|
+
onChange: function(e) {
|
|
1507
|
+
save(item.id, Number(e.target.value));
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
if (item.type === "time") {
|
|
1512
|
+
return h("input", {
|
|
1513
|
+
className: "wbm-time",
|
|
1514
|
+
type: "time",
|
|
1515
|
+
value: value || "",
|
|
1516
|
+
"aria-label": labelOf(item, lang),
|
|
1517
|
+
onChange: function(e) {
|
|
1518
|
+
save(item.id, e.target.value);
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
if (item.type === "enum") {
|
|
1523
|
+
return h(
|
|
1524
|
+
"select",
|
|
1525
|
+
{
|
|
1526
|
+
className: "wbm-select",
|
|
1527
|
+
value: String(value === void 0 ? "" : value),
|
|
1528
|
+
"aria-label": labelOf(item, lang),
|
|
1529
|
+
onChange: function(e) {
|
|
1530
|
+
var hit = (item.values || []).filter(function(option) {
|
|
1531
|
+
return String(option.value) === e.target.value;
|
|
1532
|
+
})[0];
|
|
1533
|
+
save(item.id, hit ? hit.value : e.target.value);
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1536
|
+
(item.values || []).map(function(option) {
|
|
1537
|
+
return h("option", { key: String(option.value), value: String(option.value) }, lang === "en" ? option.en : option.zh);
|
|
1538
|
+
})
|
|
1539
|
+
);
|
|
1540
|
+
}
|
|
1541
|
+
if (item.type === "multi") {
|
|
1542
|
+
var picked = Array.isArray(value) ? value : [];
|
|
1543
|
+
return h(
|
|
1544
|
+
"span",
|
|
1545
|
+
{ className: "wbm-multis" },
|
|
1546
|
+
(item.values || []).map(function(option) {
|
|
1547
|
+
var on = picked.indexOf(option.value) >= 0;
|
|
1548
|
+
return h(
|
|
1549
|
+
"label",
|
|
1550
|
+
{ className: "wbm-check", key: option.value },
|
|
1551
|
+
h("input", {
|
|
1552
|
+
type: "checkbox",
|
|
1553
|
+
checked: on,
|
|
1554
|
+
onChange: function() {
|
|
1555
|
+
var next = picked.slice();
|
|
1556
|
+
if (on) next = next.filter(function(x) {
|
|
1557
|
+
return x !== option.value;
|
|
1558
|
+
});
|
|
1559
|
+
else next.push(option.value);
|
|
1560
|
+
save(item.id, next);
|
|
1561
|
+
}
|
|
1562
|
+
}),
|
|
1563
|
+
h("span", null, lang === "en" ? option.en : option.zh)
|
|
1564
|
+
);
|
|
1565
|
+
})
|
|
1566
|
+
);
|
|
1567
|
+
}
|
|
1568
|
+
return h("input", {
|
|
1569
|
+
className: "wbm-input",
|
|
1570
|
+
type: "text",
|
|
1571
|
+
value: String(value === void 0 ? "" : value),
|
|
1572
|
+
"aria-label": labelOf(item, lang),
|
|
1573
|
+
onChange: function(e) {
|
|
1574
|
+
save(item.id, e.target.value);
|
|
1575
|
+
}
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
if (cfg.error) return h("div", { className: "wbm-err", role: "alert" }, h("span", null, cfg.error));
|
|
1579
|
+
if (!cfg.ready) return h("div", { className: "wbm-empty", role: "status", "aria-busy": "true" }, t.loading);
|
|
1580
|
+
if (!cfg.items.length) return h("div", { className: "wbm-empty" }, t.noData);
|
|
1581
|
+
var groups = cfg.groups.length ? cfg.groups : [{ id: "", zh: "", en: "" }];
|
|
1582
|
+
return h(
|
|
1583
|
+
"div",
|
|
1584
|
+
{ className: "wbm-root wbm-config" },
|
|
1585
|
+
h(
|
|
1586
|
+
"div",
|
|
1587
|
+
{ className: "wbm-toolbar" },
|
|
1588
|
+
h("span", { className: "wbm-grow" }),
|
|
1589
|
+
h(
|
|
1590
|
+
"button",
|
|
1591
|
+
{ type: "button", className: "wbm-btn", onClick: resetAll },
|
|
1592
|
+
props.Icon ? h(props.Icon, { name: "reset", size: 13 }) : null,
|
|
1593
|
+
h("span", null, t.resetAll)
|
|
1594
|
+
)
|
|
1595
|
+
),
|
|
1596
|
+
h(
|
|
1597
|
+
"div",
|
|
1598
|
+
{ className: "wbm-note" },
|
|
1599
|
+
t.configHint
|
|
1600
|
+
),
|
|
1601
|
+
groups.map(function(group) {
|
|
1602
|
+
var items = cfg.items.filter(function(item) {
|
|
1603
|
+
return item.group === group.id;
|
|
1604
|
+
});
|
|
1605
|
+
if (!items.length) return null;
|
|
1606
|
+
return h(
|
|
1607
|
+
"div",
|
|
1608
|
+
{ className: "wbm-section", key: group.id || "all" },
|
|
1609
|
+
group.zh || group.en ? h("h3", null, lang === "en" ? group.en || group.zh : group.zh || group.en) : null,
|
|
1610
|
+
items.map(function(item) {
|
|
1611
|
+
return h(
|
|
1612
|
+
"div",
|
|
1613
|
+
{ className: "wbm-field", key: item.id, "data-config": item.id },
|
|
1614
|
+
h(
|
|
1615
|
+
"div",
|
|
1616
|
+
{ className: "wbm-field-main" },
|
|
1617
|
+
h("span", { className: "wbm-field-label" }, labelOf(item, lang)),
|
|
1618
|
+
hintOf(item, lang) ? h("span", { className: "wbm-field-hint" }, hintOf(item, lang)) : null
|
|
1619
|
+
),
|
|
1620
|
+
h(
|
|
1621
|
+
"div",
|
|
1622
|
+
{ className: "wbm-field-ctl" },
|
|
1623
|
+
control(item),
|
|
1624
|
+
item.id.indexOf("sound.") === 0 && notifier && typeof notifier.preview === "function" ? h(
|
|
1625
|
+
"button",
|
|
1626
|
+
{ type: "button", className: "wbm-btn", onClick: function() {
|
|
1627
|
+
notifier.preview("info");
|
|
1628
|
+
} },
|
|
1629
|
+
props.Icon ? h(props.Icon, { name: "play", size: 12 }) : null,
|
|
1630
|
+
h("span", null, t.preview)
|
|
1631
|
+
) : null
|
|
1632
|
+
)
|
|
1633
|
+
);
|
|
1634
|
+
})
|
|
1635
|
+
);
|
|
1636
|
+
}),
|
|
1637
|
+
h("div", { className: "wbm-note" }, t.quietNote),
|
|
1638
|
+
h("div", { className: "wbm-note" }, t.readDaysNote),
|
|
1639
|
+
toast ? h("div", { className: "wbm-toast", role: "status" }, toast) : null
|
|
1640
|
+
);
|
|
1641
|
+
}
|
|
1642
|
+
module2.exports = { ConfigView, useConfig, DOMAIN };
|
|
1643
|
+
}
|
|
1644
|
+
});
|
|
1645
|
+
|
|
1646
|
+
// packages/addons/message/client/views/inbox.cjs
|
|
1647
|
+
var require_inbox = __commonJS({
|
|
1648
|
+
"packages/addons/message/client/views/inbox.cjs"(exports2, module2) {
|
|
1649
|
+
"use strict";
|
|
1650
|
+
module2.exports = function(deps) {
|
|
1651
|
+
var React = deps.React;
|
|
1652
|
+
var h = React.createElement;
|
|
1653
|
+
function fmt(template, vars) {
|
|
1654
|
+
return String(template).replace(/\{(\w+)\}/g, function(m, key) {
|
|
1655
|
+
return vars[key] === void 0 ? m : String(vars[key]);
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
function unwrap(r) {
|
|
1659
|
+
return r && r.result !== void 0 ? r.result : r;
|
|
1660
|
+
}
|
|
1661
|
+
function timeText(ts, lang) {
|
|
1662
|
+
if (!ts) return "";
|
|
1663
|
+
try {
|
|
1664
|
+
return new Date(ts).toLocaleString(lang === "en" ? "en-US" : "zh-CN", { hour12: false });
|
|
1665
|
+
} catch (e) {
|
|
1666
|
+
return String(ts);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
function icon(props, name, size) {
|
|
1670
|
+
return props.Icon ? h(props.Icon, { name, size: size || 13 }) : null;
|
|
1671
|
+
}
|
|
1672
|
+
function MessageCard(props) {
|
|
1673
|
+
var m = props.message;
|
|
1674
|
+
var t = props.t;
|
|
1675
|
+
var lang = props.lang;
|
|
1676
|
+
var level = m.level || "info";
|
|
1677
|
+
return h(
|
|
1678
|
+
"article",
|
|
1679
|
+
{ className: "wbm-card lv-" + level + (m.read ? "" : " is-unread") + " wbm-msg", "data-id": m.id },
|
|
1680
|
+
h(
|
|
1681
|
+
"div",
|
|
1682
|
+
{ className: "wbm-card-top" },
|
|
1683
|
+
h("span", { className: "wbm-badge lv-" + level }, t.level && t.level[level] || level),
|
|
1684
|
+
h("span", { className: "wbm-title" }, m.title),
|
|
1685
|
+
h("span", { className: "wbm-grow" }),
|
|
1686
|
+
m.read ? h("span", { className: "wbm-badge" }, t.read) : null
|
|
1687
|
+
),
|
|
1688
|
+
h(
|
|
1689
|
+
"div",
|
|
1690
|
+
{ className: "wbm-meta" },
|
|
1691
|
+
m.source ? h("span", null, t.from + "\uFF1A" + m.source) : null,
|
|
1692
|
+
h("span", null, timeText(m.createdAt, lang)),
|
|
1693
|
+
m.audience && m.audience !== "all" ? h("span", null, t.audience && t.audience[m.audience] || m.audience) : null
|
|
1694
|
+
),
|
|
1695
|
+
h("div", { className: "wbm-body" }, m.body || t.bodyEmpty),
|
|
1696
|
+
m.read ? null : h(
|
|
1697
|
+
"div",
|
|
1698
|
+
{ className: "wbm-ops" },
|
|
1699
|
+
h(
|
|
1700
|
+
"button",
|
|
1701
|
+
{ type: "button", className: "wbm-btn", onClick: function() {
|
|
1702
|
+
props.onMark([m.id]);
|
|
1703
|
+
} },
|
|
1704
|
+
icon(props, "check"),
|
|
1705
|
+
h("span", null, t.markRead)
|
|
1706
|
+
)
|
|
1707
|
+
)
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
return function InboxView(props) {
|
|
1711
|
+
var api = props.api;
|
|
1712
|
+
var t = props.t;
|
|
1713
|
+
var lang = props.lang;
|
|
1714
|
+
var pageSize = 20;
|
|
1715
|
+
var dataS = React.useState(null);
|
|
1716
|
+
var data = dataS[0];
|
|
1717
|
+
var setData = dataS[1];
|
|
1718
|
+
var busyS = React.useState(true);
|
|
1719
|
+
var busy = busyS[0];
|
|
1720
|
+
var setBusy = busyS[1];
|
|
1721
|
+
var errS = React.useState("");
|
|
1722
|
+
var error = errS[0];
|
|
1723
|
+
var setError = errS[1];
|
|
1724
|
+
var pageS = React.useState(1);
|
|
1725
|
+
var page = pageS[0];
|
|
1726
|
+
var setPage = pageS[1];
|
|
1727
|
+
var unreadS = React.useState(false);
|
|
1728
|
+
var unreadOnly = unreadS[0];
|
|
1729
|
+
var setUnreadOnly = unreadS[1];
|
|
1730
|
+
var levelS = React.useState("");
|
|
1731
|
+
var level = levelS[0];
|
|
1732
|
+
var setLevel = levelS[1];
|
|
1733
|
+
var textS = React.useState("");
|
|
1734
|
+
var text = textS[0];
|
|
1735
|
+
var setText = textS[1];
|
|
1736
|
+
var draftS = React.useState("");
|
|
1737
|
+
var draft = draftS[0];
|
|
1738
|
+
var setDraft = draftS[1];
|
|
1739
|
+
var tickS = React.useState(0);
|
|
1740
|
+
var tick = tickS[0];
|
|
1741
|
+
var setTick = tickS[1];
|
|
1742
|
+
var toastS = React.useState("");
|
|
1743
|
+
var toast = toastS[0];
|
|
1744
|
+
var setToast = toastS[1];
|
|
1745
|
+
React.useEffect(function() {
|
|
1746
|
+
var timer = setTimeout(function() {
|
|
1747
|
+
setText(draft.trim());
|
|
1748
|
+
setPage(1);
|
|
1749
|
+
}, 260);
|
|
1750
|
+
return function() {
|
|
1751
|
+
clearTimeout(timer);
|
|
1752
|
+
};
|
|
1753
|
+
}, [draft]);
|
|
1754
|
+
React.useEffect(function() {
|
|
1755
|
+
var alive = true;
|
|
1756
|
+
setBusy(true);
|
|
1757
|
+
var args = { pageNumber: page, pageSize };
|
|
1758
|
+
if (unreadOnly) args.unreadOnly = true;
|
|
1759
|
+
if (level) args.level = level;
|
|
1760
|
+
if (text) args.text = text;
|
|
1761
|
+
Promise.resolve(api.call("message.list", args)).then(function(r) {
|
|
1762
|
+
if (!alive) return;
|
|
1763
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
|
|
1764
|
+
setData(unwrap(r) || { records: [], total: 0, unread: 0, pageNumber: 1 });
|
|
1765
|
+
setError("");
|
|
1766
|
+
}).catch(function(e) {
|
|
1767
|
+
if (!alive) return;
|
|
1768
|
+
setError(String(e && e.message || e) || t.loadFail);
|
|
1769
|
+
}).then(function() {
|
|
1770
|
+
if (alive) setBusy(false);
|
|
1771
|
+
});
|
|
1772
|
+
return function() {
|
|
1773
|
+
alive = false;
|
|
1774
|
+
};
|
|
1775
|
+
}, [api, page, unreadOnly, level, text, tick]);
|
|
1776
|
+
var unsubscribe = null;
|
|
1777
|
+
React.useEffect(function() {
|
|
1778
|
+
if (!api || typeof api.subscribe !== "function") return void 0;
|
|
1779
|
+
unsubscribe = api.subscribe(function(evt) {
|
|
1780
|
+
if (!evt || evt.domainId !== "wb-addon-message") return;
|
|
1781
|
+
setTick(function(x) {
|
|
1782
|
+
return x + 1;
|
|
1783
|
+
});
|
|
1784
|
+
});
|
|
1785
|
+
return function() {
|
|
1786
|
+
if (unsubscribe) unsubscribe();
|
|
1787
|
+
};
|
|
1788
|
+
}, [api]);
|
|
1789
|
+
function toastOnce(message) {
|
|
1790
|
+
setToast(message);
|
|
1791
|
+
setTimeout(function() {
|
|
1792
|
+
setToast("");
|
|
1793
|
+
}, 2200);
|
|
1794
|
+
}
|
|
1795
|
+
function mark(ids, all) {
|
|
1796
|
+
var args = all ? { all: true } : { ids };
|
|
1797
|
+
Promise.resolve(api.call("message.markRead", args)).then(function(r) {
|
|
1798
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
|
|
1799
|
+
var body = unwrap(r) || {};
|
|
1800
|
+
toastOnce(fmt(t.marked, { n: body.updated || 0 }));
|
|
1801
|
+
setTick(function(x) {
|
|
1802
|
+
return x + 1;
|
|
1803
|
+
});
|
|
1804
|
+
}).catch(function(e) {
|
|
1805
|
+
toastOnce(String(e && e.message || e));
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
var records = data && data.records || [];
|
|
1809
|
+
var total = data ? data.total : 0;
|
|
1810
|
+
var unread = data ? data.unread : 0;
|
|
1811
|
+
var pages = Math.max(1, Math.ceil(total / pageSize));
|
|
1812
|
+
return h(
|
|
1813
|
+
"div",
|
|
1814
|
+
{ className: "wbm-root wbm-inbox" },
|
|
1815
|
+
h(
|
|
1816
|
+
"div",
|
|
1817
|
+
{ className: "wbm-toolbar" },
|
|
1818
|
+
h(
|
|
1819
|
+
"label",
|
|
1820
|
+
{ className: "wbm-check" },
|
|
1821
|
+
h("input", { type: "checkbox", checked: unreadOnly, onChange: function(e) {
|
|
1822
|
+
setUnreadOnly(e.target.checked);
|
|
1823
|
+
setPage(1);
|
|
1824
|
+
} }),
|
|
1825
|
+
h("span", null, t.unreadOnly)
|
|
1826
|
+
),
|
|
1827
|
+
h(
|
|
1828
|
+
"select",
|
|
1829
|
+
{ className: "wbm-select", value: level, "aria-label": t.levelAll, onChange: function(e) {
|
|
1830
|
+
setLevel(e.target.value);
|
|
1831
|
+
setPage(1);
|
|
1832
|
+
} },
|
|
1833
|
+
h("option", { value: "" }, t.levelAll),
|
|
1834
|
+
["info", "success", "warning", "error"].map(function(lv) {
|
|
1835
|
+
return h("option", { key: lv, value: lv }, t.level[lv]);
|
|
1836
|
+
})
|
|
1837
|
+
),
|
|
1838
|
+
h("input", {
|
|
1839
|
+
className: "wbm-input",
|
|
1840
|
+
type: "search",
|
|
1841
|
+
value: draft,
|
|
1842
|
+
placeholder: t.searchPlaceholder,
|
|
1843
|
+
"aria-label": t.searchPlaceholder,
|
|
1844
|
+
onChange: function(e) {
|
|
1845
|
+
setDraft(e.target.value);
|
|
1846
|
+
}
|
|
1847
|
+
}),
|
|
1848
|
+
h("span", { className: "wbm-grow" }),
|
|
1849
|
+
h("span", { className: "wbm-sumbox" }, h("span", null, fmt(t.total, { n: total })), h("span", null, fmt(t.unreadCount, { n: unread }))),
|
|
1850
|
+
h(
|
|
1851
|
+
"button",
|
|
1852
|
+
{ type: "button", className: "wbm-btn", disabled: !unread, onClick: function() {
|
|
1853
|
+
mark(null, true);
|
|
1854
|
+
} },
|
|
1855
|
+
icon(props, "check-check"),
|
|
1856
|
+
h("span", null, t.markAll)
|
|
1857
|
+
),
|
|
1858
|
+
h(
|
|
1859
|
+
"button",
|
|
1860
|
+
{ type: "button", className: "wbm-btn", onClick: function() {
|
|
1861
|
+
setTick(function(x) {
|
|
1862
|
+
return x + 1;
|
|
1863
|
+
});
|
|
1864
|
+
} },
|
|
1865
|
+
icon(props, "refresh"),
|
|
1866
|
+
h("span", null, t.retry)
|
|
1867
|
+
)
|
|
1868
|
+
),
|
|
1869
|
+
error ? h("div", { className: "wbm-err", role: "alert" }, h("span", null, error), h("button", { type: "button", className: "wbm-btn", onClick: function() {
|
|
1870
|
+
setTick(function(x) {
|
|
1871
|
+
return x + 1;
|
|
1872
|
+
});
|
|
1873
|
+
} }, t.retry)) : null,
|
|
1874
|
+
busy && !data ? h("div", { className: "wbm-empty", role: "status", "aria-busy": "true" }, t.loading) : null,
|
|
1875
|
+
!busy && !records.length ? h("div", { className: "wbm-empty" }, text || level || unreadOnly ? t.noMatch : t.empty) : null,
|
|
1876
|
+
records.length ? h(
|
|
1877
|
+
"div",
|
|
1878
|
+
{ className: "wbm-list" },
|
|
1879
|
+
records.map(function(m) {
|
|
1880
|
+
return h(MessageCard, { key: m.id, message: m, t, lang, Icon: props.Icon, onMark: mark });
|
|
1881
|
+
})
|
|
1882
|
+
) : null,
|
|
1883
|
+
pages > 1 ? h(
|
|
1884
|
+
"div",
|
|
1885
|
+
{ className: "wbm-pager" },
|
|
1886
|
+
h("span", null, fmt(t.pageInfo, { page, pages })),
|
|
1887
|
+
h("button", { type: "button", className: "wbm-btn", disabled: page <= 1, onClick: function() {
|
|
1888
|
+
setPage(page - 1);
|
|
1889
|
+
} }, t.prev),
|
|
1890
|
+
h("button", { type: "button", className: "wbm-btn", disabled: page >= pages, onClick: function() {
|
|
1891
|
+
setPage(page + 1);
|
|
1892
|
+
} }, t.next)
|
|
1893
|
+
) : null,
|
|
1894
|
+
toast ? h("div", { className: "wbm-toast", role: "status" }, toast) : null
|
|
1895
|
+
);
|
|
1896
|
+
};
|
|
1897
|
+
};
|
|
1898
|
+
}
|
|
1899
|
+
});
|
|
1900
|
+
|
|
1901
|
+
// packages/addons/message/client/views/stats.cjs
|
|
1902
|
+
var require_stats = __commonJS({
|
|
1903
|
+
"packages/addons/message/client/views/stats.cjs"(exports2, module2) {
|
|
1904
|
+
"use strict";
|
|
1905
|
+
module2.exports = function(deps) {
|
|
1906
|
+
var React = deps.React;
|
|
1907
|
+
var h = React.createElement;
|
|
1908
|
+
function fmt(template, vars) {
|
|
1909
|
+
return String(template).replace(/\{(\w+)\}/g, function(m, key) {
|
|
1910
|
+
return vars[key] === void 0 ? m : String(vars[key]);
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
function unwrap(r) {
|
|
1914
|
+
return r && r.result !== void 0 ? r.result : r;
|
|
1915
|
+
}
|
|
1916
|
+
return function StatsView(props) {
|
|
1917
|
+
var api = props.api;
|
|
1918
|
+
var t = props.t;
|
|
1919
|
+
var lang = props.lang;
|
|
1920
|
+
var dataS = React.useState(null);
|
|
1921
|
+
var data = dataS[0];
|
|
1922
|
+
var setData = dataS[1];
|
|
1923
|
+
var busyS = React.useState(true);
|
|
1924
|
+
var busy = busyS[0];
|
|
1925
|
+
var setBusy = busyS[1];
|
|
1926
|
+
var errS = React.useState("");
|
|
1927
|
+
var error = errS[0];
|
|
1928
|
+
var setError = errS[1];
|
|
1929
|
+
var tickS = React.useState(0);
|
|
1930
|
+
var tick = tickS[0];
|
|
1931
|
+
var setTick = tickS[1];
|
|
1932
|
+
React.useEffect(function() {
|
|
1933
|
+
var alive = true;
|
|
1934
|
+
setBusy(true);
|
|
1935
|
+
Promise.resolve(api.call("message.stats", { days: 14 })).then(function(r) {
|
|
1936
|
+
if (!alive) return;
|
|
1937
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
|
|
1938
|
+
setData(unwrap(r) || null);
|
|
1939
|
+
setError("");
|
|
1940
|
+
}).catch(function(e) {
|
|
1941
|
+
if (!alive) return;
|
|
1942
|
+
setError(String(e && e.message || e) || t.loadFail);
|
|
1943
|
+
}).then(function() {
|
|
1944
|
+
if (alive) setBusy(false);
|
|
1945
|
+
});
|
|
1946
|
+
return function() {
|
|
1947
|
+
alive = false;
|
|
1948
|
+
};
|
|
1949
|
+
}, [api, tick]);
|
|
1950
|
+
if (busy && !data) return h("div", { className: "wbm-empty", role: "status", "aria-busy": "true" }, t.loading);
|
|
1951
|
+
if (error) return h("div", { className: "wbm-err", role: "alert" }, h("span", null, error), h("button", { type: "button", className: "wbm-btn", onClick: function() {
|
|
1952
|
+
setTick(tick + 1);
|
|
1953
|
+
} }, t.retry));
|
|
1954
|
+
if (!data) return h("div", { className: "wbm-empty" }, t.noData);
|
|
1955
|
+
var totals = data.totals || { total: 0, unread: 0, read: 0 };
|
|
1956
|
+
var maxLevel = Math.max(1, (data.byLevel || []).reduce(function(max, row) {
|
|
1957
|
+
return Math.max(max, row.total);
|
|
1958
|
+
}, 0));
|
|
1959
|
+
var maxTrend = Math.max(1, (data.trend || []).reduce(function(max, row) {
|
|
1960
|
+
return Math.max(max, row.count);
|
|
1961
|
+
}, 0));
|
|
1962
|
+
return h(
|
|
1963
|
+
"div",
|
|
1964
|
+
{ className: "wbm-root wbm-stats" },
|
|
1965
|
+
h(
|
|
1966
|
+
"div",
|
|
1967
|
+
{ className: "wbm-cards" },
|
|
1968
|
+
h("div", { className: "wbm-kpi" }, h("b", null, String(totals.total)), h("span", null, t.statTotal)),
|
|
1969
|
+
h("div", { className: "wbm-kpi" }, h("b", null, String(totals.unread)), h("span", null, t.statUnread)),
|
|
1970
|
+
h("div", { className: "wbm-kpi" }, h("b", null, String(totals.read)), h("span", null, t.statRead)),
|
|
1971
|
+
h(
|
|
1972
|
+
"div",
|
|
1973
|
+
{ className: "wbm-kpi" },
|
|
1974
|
+
h("b", { style: { fontSize: "13px" } }, data.oldestUnread ? new Date(data.oldestUnread.createdAt).toLocaleDateString(lang === "en" ? "en-US" : "zh-CN") : "\u2014"),
|
|
1975
|
+
h("span", null, t.statOldest)
|
|
1976
|
+
)
|
|
1977
|
+
),
|
|
1978
|
+
h(
|
|
1979
|
+
"div",
|
|
1980
|
+
{ className: "wbm-section" },
|
|
1981
|
+
h("h3", null, t.byLevel),
|
|
1982
|
+
h(
|
|
1983
|
+
"div",
|
|
1984
|
+
{ className: "wbm-bars" },
|
|
1985
|
+
(data.byLevel || []).map(function(row) {
|
|
1986
|
+
return h(
|
|
1987
|
+
"div",
|
|
1988
|
+
{ className: "wbm-bar", key: row.level },
|
|
1989
|
+
h("span", null, t.level && t.level[row.level] || row.level),
|
|
1990
|
+
h("span", { className: "wbm-bar-track" }, h("span", { className: "wbm-bar-fill lv-" + row.level, style: { width: Math.round(row.total / maxLevel * 100) + "%" } })),
|
|
1991
|
+
h("span", null, String(row.total))
|
|
1992
|
+
);
|
|
1993
|
+
})
|
|
1994
|
+
)
|
|
1995
|
+
),
|
|
1996
|
+
h(
|
|
1997
|
+
"div",
|
|
1998
|
+
{ className: "wbm-section" },
|
|
1999
|
+
h("h3", null, t.bySource),
|
|
2000
|
+
(data.bySource || []).length ? h(
|
|
2001
|
+
"div",
|
|
2002
|
+
{ className: "wbm-bars" },
|
|
2003
|
+
data.bySource.map(function(row) {
|
|
2004
|
+
var max = Math.max(1, data.bySource[0].total);
|
|
2005
|
+
return h(
|
|
2006
|
+
"div",
|
|
2007
|
+
{ className: "wbm-bar", key: row.source },
|
|
2008
|
+
h("span", null, row.source || t.noSource),
|
|
2009
|
+
h("span", { className: "wbm-bar-track" }, h("span", { className: "wbm-bar-fill", style: { width: Math.round(row.total / max * 100) + "%" } })),
|
|
2010
|
+
h("span", null, String(row.total))
|
|
2011
|
+
);
|
|
2012
|
+
})
|
|
2013
|
+
) : h("div", { className: "wbm-note" }, t.noData)
|
|
2014
|
+
),
|
|
2015
|
+
h(
|
|
2016
|
+
"div",
|
|
2017
|
+
{ className: "wbm-section" },
|
|
2018
|
+
h("h3", null, fmt(t.trend, { days: data.days })),
|
|
2019
|
+
h(
|
|
2020
|
+
"div",
|
|
2021
|
+
{ className: "wbm-trend" },
|
|
2022
|
+
(data.trend || []).map(function(row) {
|
|
2023
|
+
return h(
|
|
2024
|
+
"div",
|
|
2025
|
+
{ className: "wbm-trend-col", key: row.date, title: row.date + " \xB7 " + row.count },
|
|
2026
|
+
h("span", { className: "wbm-trend-bar", style: { height: Math.max(2, Math.round(row.count / maxTrend * 56)) + "px" } }),
|
|
2027
|
+
h("span", null, row.date.slice(5))
|
|
2028
|
+
);
|
|
2029
|
+
})
|
|
2030
|
+
),
|
|
2031
|
+
h("div", { className: "wbm-note" }, t.statsHint)
|
|
2032
|
+
)
|
|
2033
|
+
);
|
|
2034
|
+
};
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
2038
|
+
|
|
2039
|
+
// packages/addons/lib/data-copy.cjs
|
|
2040
|
+
var require_data_copy = __commonJS({
|
|
2041
|
+
"packages/addons/lib/data-copy.cjs"(exports2, module2) {
|
|
2042
|
+
"use strict";
|
|
2043
|
+
var COPY = {
|
|
2044
|
+
zh: {
|
|
2045
|
+
title: "\u6570\u636E",
|
|
2046
|
+
subtitle: "\u53EA\u8BFB\u6D4F\u89C8\u672C\u63D2\u4EF6\u8D1F\u8D23\u7684\u8868\uFF1B\u7CFB\u7EDF\u5217\u4E0E\u5DF2\u5220\u9664\u884C\u9ED8\u8BA4\u9690\u85CF",
|
|
2047
|
+
tables: "\u8868",
|
|
2048
|
+
rows: "\u884C",
|
|
2049
|
+
deleted: "\u5DF2\u5220\u9664",
|
|
2050
|
+
rowCount: "\u5171 {n} \u884C",
|
|
2051
|
+
deletedCount: "\u5176\u4E2D {n} \u884C\u5DF2\u5220\u9664",
|
|
2052
|
+
search: "\u641C\u7D22\u6240\u6709\u6587\u672C\u5217\u2026",
|
|
2053
|
+
pageSize: "\u6BCF\u9875",
|
|
2054
|
+
includeDeleted: "\u542B\u5DF2\u5220\u9664",
|
|
2055
|
+
showSystem: "\u7CFB\u7EDF\u5217",
|
|
2056
|
+
refresh: "\u5237\u65B0",
|
|
2057
|
+
loading: "\u8F7D\u5165\u4E2D\u2026",
|
|
2058
|
+
empty: "\u8FD9\u5F20\u8868\u8FD8\u6CA1\u6709\u6570\u636E",
|
|
2059
|
+
emptyTable: "\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u8868",
|
|
2060
|
+
loadFail: "\u6570\u636E\u670D\u52A1\u4E0D\u53EF\u7528\uFF08\u63D2\u4EF6\u7248\u672C\u8FC7\u65E7\uFF1F\uFF09",
|
|
2061
|
+
retry: "\u91CD\u8BD5",
|
|
2062
|
+
queryFail: "\u67E5\u8BE2\u5931\u8D25\uFF1A",
|
|
2063
|
+
noRows: "\u6CA1\u6709\u5339\u914D\u7684\u884C",
|
|
2064
|
+
prev: "\u4E0A\u4E00\u9875",
|
|
2065
|
+
next: "\u4E0B\u4E00\u9875",
|
|
2066
|
+
pageInfo: "\u7B2C {page} / {pages} \u9875",
|
|
2067
|
+
jump: "\u8DF3\u8F6C",
|
|
2068
|
+
total: "\u5171 {n} \u884C",
|
|
2069
|
+
copied: "\u5DF2\u590D\u5236",
|
|
2070
|
+
copy: "\u590D\u5236",
|
|
2071
|
+
close: "\u5173\u95ED",
|
|
2072
|
+
drawerTitle: "{column} \xB7 \u7B2C {row} \u884C",
|
|
2073
|
+
nullText: "NULL",
|
|
2074
|
+
emptyText: "\u7A7A",
|
|
2075
|
+
yes: "\u662F",
|
|
2076
|
+
no: "\u5426",
|
|
2077
|
+
json: "JSON",
|
|
2078
|
+
queryTime: "{n} ms",
|
|
2079
|
+
sortAsc: "\u5347\u5E8F",
|
|
2080
|
+
sortDesc: "\u964D\u5E8F",
|
|
2081
|
+
filterCol: "\u7B5B\u9009\u2026",
|
|
2082
|
+
filterClear: "\u6E05\u9664\u7B5B\u9009",
|
|
2083
|
+
index: "\u8868\u7D22\u5F15",
|
|
2084
|
+
indexSub: "\u5F53\u524D\u9009\u4E2D\u8868\u7684\u7D22\u5F15\uFF08\u53EA\u8BFB\uFF09\uFF1B\u884C\u6570\u4E3A\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
|
|
2085
|
+
idxName: "\u7D22\u5F15\u540D",
|
|
2086
|
+
idxColumns: "\u5217",
|
|
2087
|
+
idxType: "\u7C7B\u578B",
|
|
2088
|
+
idxSource: "\u6765\u6E90",
|
|
2089
|
+
idxUnique: "\u552F\u4E00",
|
|
2090
|
+
idxNormal: "\u666E\u901A",
|
|
2091
|
+
idxAuto: "\u81EA\u52A8",
|
|
2092
|
+
idxCreated: "\u663E\u5F0F\u521B\u5EFA",
|
|
2093
|
+
idxCount: "\u5171 {n} \u4E2A\u7D22\u5F15",
|
|
2094
|
+
idxNoExtra: "\u8BE5\u8868\u9664\u4E3B\u952E\u5916\u6CA1\u6709\u989D\u5916\u7D22\u5F15",
|
|
2095
|
+
idxRowsHelp: "\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF08\u542B\u5DF2\u5220\u9664\u884C\uFF09\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
|
|
2096
|
+
idxTable: "\u8868",
|
|
2097
|
+
idxRows: "\u884C\u6570",
|
|
2098
|
+
idxCols: "\u5217\u6570",
|
|
2099
|
+
idxKey: "\u4E3B\u952E",
|
|
2100
|
+
idxIndexes: "\u7D22\u5F15",
|
|
2101
|
+
idxLastWrite: "\u6700\u8FD1\u5199\u5165",
|
|
2102
|
+
idxNone: "\u65E0",
|
|
2103
|
+
idxEmpty: "\u5F53\u524D\u8868\u6CA1\u6709\u53EF\u7528\u7684\u7D22\u5F15\u7EDF\u8BA1",
|
|
2104
|
+
idxTables: "\u8868",
|
|
2105
|
+
idxAt: "\u7EDF\u8BA1\u65F6\u95F4"
|
|
2106
|
+
},
|
|
2107
|
+
en: {
|
|
2108
|
+
title: "Data",
|
|
2109
|
+
subtitle: "Read-only view of this plugin's tables; system and deleted rows are hidden by default",
|
|
2110
|
+
tables: "Tables",
|
|
2111
|
+
rows: "rows",
|
|
2112
|
+
deleted: "deleted",
|
|
2113
|
+
rowCount: "{n} rows",
|
|
2114
|
+
deletedCount: "{n} deleted",
|
|
2115
|
+
search: "Search all text columns\u2026",
|
|
2116
|
+
pageSize: "Rows",
|
|
2117
|
+
includeDeleted: "Deleted",
|
|
2118
|
+
showSystem: "System",
|
|
2119
|
+
refresh: "Refresh",
|
|
2120
|
+
loading: "Loading\u2026",
|
|
2121
|
+
empty: "This table has no rows yet",
|
|
2122
|
+
emptyTable: "No tables to show",
|
|
2123
|
+
loadFail: "Data service unavailable (plugin too old?)",
|
|
2124
|
+
retry: "Retry",
|
|
2125
|
+
queryFail: "Query failed: ",
|
|
2126
|
+
noRows: "No matching rows",
|
|
2127
|
+
prev: "Previous",
|
|
2128
|
+
next: "Next",
|
|
2129
|
+
pageInfo: "Page {page} / {pages}",
|
|
2130
|
+
jump: "Jump",
|
|
2131
|
+
total: "{n} rows",
|
|
2132
|
+
copied: "Copied",
|
|
2133
|
+
copy: "Copy",
|
|
2134
|
+
close: "Close",
|
|
2135
|
+
drawerTitle: "{column} \xB7 row {row}",
|
|
2136
|
+
nullText: "NULL",
|
|
2137
|
+
emptyText: "empty",
|
|
2138
|
+
yes: "Yes",
|
|
2139
|
+
no: "No",
|
|
2140
|
+
json: "JSON",
|
|
2141
|
+
queryTime: "{n} ms",
|
|
2142
|
+
sortAsc: "ascending",
|
|
2143
|
+
sortDesc: "descending",
|
|
2144
|
+
filterCol: "Filter\u2026",
|
|
2145
|
+
filterClear: "Clear filter",
|
|
2146
|
+
index: "Table index",
|
|
2147
|
+
indexSub: "Indexes of the selected table (read-only); rows are the table total, not index entries",
|
|
2148
|
+
idxName: "Index name",
|
|
2149
|
+
idxColumns: "Columns",
|
|
2150
|
+
idxType: "Type",
|
|
2151
|
+
idxSource: "Source",
|
|
2152
|
+
idxUnique: "Unique",
|
|
2153
|
+
idxNormal: "Normal",
|
|
2154
|
+
idxAuto: "Automatic",
|
|
2155
|
+
idxCreated: "Explicit",
|
|
2156
|
+
idxCount: "{n} indexes",
|
|
2157
|
+
idxNoExtra: "This table has no indexes other than its primary key",
|
|
2158
|
+
idxRowsHelp: "Total table rows (including deleted rows), not index entries",
|
|
2159
|
+
idxTable: "Table",
|
|
2160
|
+
idxRows: "Rows",
|
|
2161
|
+
idxCols: "Cols",
|
|
2162
|
+
idxKey: "Primary key",
|
|
2163
|
+
idxIndexes: "Indexes",
|
|
2164
|
+
idxLastWrite: "Last write",
|
|
2165
|
+
idxNone: "\u2014",
|
|
2166
|
+
idxEmpty: "No index statistics available for this table",
|
|
2167
|
+
idxTables: "Tables",
|
|
2168
|
+
idxAt: "Generated"
|
|
2169
|
+
}
|
|
2170
|
+
};
|
|
2171
|
+
module2.exports = COPY;
|
|
2172
|
+
}
|
|
2173
|
+
});
|
|
2174
|
+
|
|
2175
|
+
// packages/addons/lib/visual-tokens.cjs
|
|
2176
|
+
var require_visual_tokens = __commonJS({
|
|
2177
|
+
"packages/addons/lib/visual-tokens.cjs"(exports2, module2) {
|
|
2178
|
+
module2.exports = `
|
|
2179
|
+
:where(.wbt-root,.wbi-root,.wbi-cfg,.wbt-data,.wbs-data,.wbg-data,.wbi-data,.wb-desc){--wb-radius-sm:8px;--wb-radius-card:12px;--wb-space-sm:8px;--wb-space-md:14px;--wb-border:var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent));--wb-description-bg:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 7%,transparent);--wb-description-line:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 34%,transparent);--wb-motion:140ms;--wb-btn-bg:transparent;--wb-btn-hover-bg:color-mix(in oklab,currentColor 6%,transparent);--wb-btn-active-bg:color-mix(in oklab,currentColor 11%,transparent);--wb-btn-primary-bg:var(--dsw-alias-brand-primary,#2563eb);--wb-btn-primary-fg:var(--dsw-alias-label-primary-inverted,#fff);--wb-btn-danger-fg:var(--dsw-alias-state-error-primary,#b91c1c);--wb-btn-size-sm:32px;--wb-btn-focus:2px solid var(--dsw-alias-brand-primary,#2563eb);--wb-btn-focus-offset:2px}
|
|
2180
|
+
.wb-desc{background:var(--wb-description-bg);border-left-color:var(--wb-description-line);border-radius:0 var(--wb-radius-sm) var(--wb-radius-sm) 0}
|
|
2181
|
+
`;
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
|
|
2185
|
+
// packages/addons/lib/data-style.cjs
|
|
2186
|
+
var require_data_style = __commonJS({
|
|
2187
|
+
"packages/addons/lib/data-style.cjs"(exports2, module2) {
|
|
2188
|
+
"use strict";
|
|
2189
|
+
module2.exports = function(DOMAIN, PREFIX) {
|
|
2190
|
+
var P = PREFIX + "-data";
|
|
2191
|
+
var CSS = [
|
|
2192
|
+
require_visual_tokens(),
|
|
2193
|
+
"." + P + "-search:has(.wbi-svg) input{padding-left:30px}." + P + "-search>.wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%)}",
|
|
2194
|
+
"." + P + "-btn{transition:background var(--wb-motion),border-color var(--wb-motion)}",
|
|
2195
|
+
"@media(max-width:480px){." + P + "-head>." + P + "-btn:has(.wbi-svg){width:32px;height:32px;padding:0;justify-content:center}." + P + "-head>." + P + "-btn:has(.wbi-svg) ." + P + "-btnlabel{display:none}}",
|
|
2196
|
+
"." + P + "{--cfg-line:var(--wb-border);--cfg-surface:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));--cfg-muted:var(--dsw-alias-label-secondary,color-mix(in oklab,currentColor 62%,transparent));--cfg-faint:var(--dsw-alias-label-tertiary,color-mix(in oklab,currentColor 42%,transparent));--cfg-hover:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent));display:grid;grid-template-columns:216px minmax(0,1fr);gap:16px;width:100%;min-width:0;color:inherit;font-size:13px;align-items:start}",
|
|
2197
|
+
"." + P + "-side{position:sticky;top:12px;display:flex;flex-direction:column;gap:3px;border:1px solid var(--cfg-line);border-radius:var(--wb-radius-card);background:var(--cfg-surface);padding:8px;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
|
|
2198
|
+
"." + P + "-sidetitle{display:flex;align-items:center;justify-content:space-between;padding:6px 10px 8px;font-size:11px;font-weight:660;letter-spacing:.6px;text-transform:uppercase;color:var(--cfg-faint)}",
|
|
2199
|
+
"." + P + "-stab{display:flex;flex-direction:column;gap:3px;align-items:stretch;border:1px solid transparent;background:transparent;border-radius:9px;padding:8px 10px;font:inherit;color:inherit;text-align:left;cursor:pointer;position:relative;transition:background .12s ease,border-color .12s ease}",
|
|
2200
|
+
"." + P + "-stab:hover{background:var(--cfg-hover)}",
|
|
2201
|
+
"." + P + "-stab:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
2202
|
+
"." + P + "-stab.on{background:color-mix(in oklab,currentColor 6%,transparent);border-color:var(--cfg-line)}",
|
|
2203
|
+
"." + P + "-stab.on::before{content:'';position:absolute;left:-1px;top:9px;bottom:9px;width:2px;border-radius:2px;background:var(--dsw-alias-brand-primary,currentColor)}",
|
|
2204
|
+
"." + P + "-stabname{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;line-height:1.4;min-width:0}",
|
|
2205
|
+
"." + P + "-stabname span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
2206
|
+
"." + P + "-sidetable{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px;color:var(--cfg-muted);margin-top:3px;letter-spacing:.2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
2207
|
+
"." + P + "-sidecount{margin-left:auto;font-size:10.5px;font-variant-numeric:tabular-nums;color:var(--cfg-muted);background:color-mix(in oklab,currentColor 8%,transparent);border-radius:999px;padding:1px 7px;flex:none}",
|
|
2208
|
+
"." + P + "-main{display:flex;flex-direction:column;gap:10px;min-width:0;border:1px solid var(--cfg-line);border-radius:var(--wb-radius-card);background:var(--cfg-surface);padding:14px 16px 12px;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
|
|
2209
|
+
"." + P + "-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}",
|
|
2210
|
+
"." + P + "-headmain{min-width:0;flex:1}",
|
|
2211
|
+
"." + P + "-head h2{margin:0;font-size:16px;font-weight:660;letter-spacing:.1px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
2212
|
+
"." + P + "-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;font-weight:500;color:var(--cfg-muted);background:color-mix(in oklab,currentColor 6%,transparent);border-radius:6px;padding:2px 6px}",
|
|
2213
|
+
"." + P + "-sub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55;margin-top:4px}",
|
|
2214
|
+
"." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:2px 0 4px}",
|
|
2215
|
+
"." + P + "-search{position:relative;flex:1;min-width:180px;max-width:340px}",
|
|
2216
|
+
"." + P + "-search input{width:100%;border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:8px 11px;font:inherit;font-size:12.5px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}",
|
|
2217
|
+
"." + P + "-search input:hover{border-color:color-mix(in oklab,currentColor 28%,var(--cfg-line))}",
|
|
2218
|
+
"." + P + "-search input:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
|
|
2219
|
+
"." + P + "-select{border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:7px 10px;font:inherit;font-size:12px;outline:none}",
|
|
2220
|
+
"." + P + "-select:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
|
|
2221
|
+
"." + P + "-switch{position:relative;display:inline-flex;align-items:center;gap:7px;cursor:pointer;font-size:12px;color:var(--cfg-muted);user-select:none;padding:4px 2px}",
|
|
2222
|
+
"." + P + "-switch input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}",
|
|
2223
|
+
"." + P + "-track{position:relative;width:34px;height:20px;border-radius:999px;background:color-mix(in oklab,currentColor 18%,transparent);transition:background .16s ease;flex:none}",
|
|
2224
|
+
"." + P + "-track::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-primary,currentColor);transition:transform .16s ease,background .16s ease}",
|
|
2225
|
+
"." + P + "-switch input:checked+." + P + "-track{background:var(--dsw-alias-brand-primary,currentColor)}",
|
|
2226
|
+
"." + P + "-switch input:checked+." + P + "-track::after{transform:translateX(14px);background:var(--dsw-alias-label-primary-inverted,var(--dsw-alias-bg-base))}",
|
|
2227
|
+
"." + P + "-switch input:focus-visible+." + P + "-track{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
2228
|
+
"." + P + "-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--cfg-line);background:transparent;color:var(--cfg-muted);border-radius:8px;padding:6px 10px;font:inherit;font-size:11.5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,color .12s ease}",
|
|
2229
|
+
"." + P + "-btn:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
|
|
2230
|
+
"." + P + "-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
2231
|
+
"." + P + "-btn:disabled{opacity:.45;cursor:not-allowed}",
|
|
2232
|
+
"." + P + "-btn[aria-busy='true']{opacity:.6}",
|
|
2233
|
+
"." + P + "-tablewrap{overflow:auto;max-height:calc(100vh - 300px);border:1px solid var(--cfg-line);border-radius:11px;background:var(--dsw-alias-bg-base,transparent)}",
|
|
2234
|
+
"." + P + "-table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;font-size:12.5px}",
|
|
2235
|
+
"." + P + "-table th{position:sticky;top:0;z-index:2;background:var(--cfg-surface);border-bottom:1px solid var(--cfg-line);padding:0;text-align:left;font-weight:600;white-space:nowrap}",
|
|
2236
|
+
"." + P + "-thbtn{display:flex;align-items:baseline;gap:6px;width:100%;border:0;background:transparent;color:inherit;font:inherit;font-size:11.5px;font-weight:660;letter-spacing:.2px;padding:9px 12px;cursor:pointer;text-align:left;white-space:nowrap}",
|
|
2237
|
+
"." + P + "-thbtn:hover{background:var(--cfg-hover)}",
|
|
2238
|
+
"." + P + "-thbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:-2px}",
|
|
2239
|
+
"." + P + "-coltype{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:500;color:var(--cfg-faint);letter-spacing:.3px}",
|
|
2240
|
+
"." + P + "-sortmark{color:var(--dsw-alias-brand-primary,currentColor);font-size:10px}",
|
|
2241
|
+
"." + P + "-rownum{position:sticky;left:0;z-index:1;background:var(--cfg-surface);color:var(--cfg-faint);text-align:right;font-variant-numeric:tabular-nums;font-size:10.5px;padding:0 8px;width:1%;white-space:nowrap;border-right:1px solid color-mix(in oklab,currentColor 7%,transparent)}",
|
|
2242
|
+
"." + P + "-table thead ." + P + "-rownum{z-index:3}",
|
|
2243
|
+
"." + P + "-cell{padding:7px 12px;border-bottom:1px solid color-mix(in oklab,currentColor 6%,transparent);max-width:340px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:default;vertical-align:top}",
|
|
2244
|
+
"." + P + "-table tbody tr:hover ." + P + "-cell{background:var(--cfg-hover)}",
|
|
2245
|
+
"." + P + "-table tbody tr:nth-child(even) ." + P + "-cell,." + P + "-table tbody tr:nth-child(even) ." + P + "-rownum{background:color-mix(in oklab,currentColor 2.5%,transparent)}",
|
|
2246
|
+
"." + P + "-cell.num{text-align:right;font-variant-numeric:tabular-nums}",
|
|
2247
|
+
"." + P + "-cell.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
|
|
2248
|
+
"." + P + "-cell.null{color:var(--cfg-faint);font-style:italic}",
|
|
2249
|
+
"." + P + "-cell.json .v{color:var(--dsw-alias-brand-primary,inherit)}",
|
|
2250
|
+
"." + P + "-tr.deleted ." + P + "-cell,." + P + "-tr.deleted ." + P + "-rownum{opacity:.55}",
|
|
2251
|
+
"." + P + "-tr.deleted ." + P + "-cell .v{text-decoration:line-through;text-decoration-color:color-mix(in oklab,currentColor 35%,transparent)}",
|
|
2252
|
+
"." + P + "-delbadge{display:inline-block;margin-left:6px;font-size:9.5px;line-height:1.5;padding:0 5px;border-radius:999px;background:color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 14%,transparent);color:var(--dsw-alias-state-error-primary,inherit);vertical-align:middle}",
|
|
2253
|
+
"." + P + "-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-top:2px;font-size:11.5px;color:var(--cfg-muted)}",
|
|
2254
|
+
"." + P + "-grow{flex:1}",
|
|
2255
|
+
"." + P + "-pageinfo{font-variant-numeric:tabular-nums}",
|
|
2256
|
+
"." + P + "-jump{width:56px;border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:7px;padding:4px 7px;font:inherit;font-size:11.5px;text-align:right;outline:none}",
|
|
2257
|
+
"." + P + "-jump:focus{border-color:var(--dsw-alias-brand-primary,currentColor)}",
|
|
2258
|
+
"." + P + "-empty{border:1px dashed var(--cfg-line);border-radius:11px;padding:44px 16px;text-align:center;font-size:12.5px;color:var(--cfg-muted)}",
|
|
2259
|
+
"." + P + "-err{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 32%,var(--cfg-line));border-radius:10px;padding:9px 12px;color:var(--dsw-alias-state-error-primary,inherit);font-size:12px;line-height:1.5}",
|
|
2260
|
+
"." + P + "-skwrap{display:flex;flex-direction:column;gap:1px;padding:2px}",
|
|
2261
|
+
"." + P + "-sk{height:26px;border-radius:4px;background:var(--dsw-alias-bg-skeleton,color-mix(in oklab,currentColor 6%,transparent));animation:" + PREFIX + "-data-pulse 1.4s ease-in-out infinite}",
|
|
2262
|
+
"@keyframes " + PREFIX + "-data-pulse{0%,100%{opacity:.6}50%{opacity:1}}",
|
|
2263
|
+
"." + P + "-toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);z-index:40;background:var(--dsw-alias-bg-layer-1,var(--cfg-surface));border:1px solid var(--cfg-line);border-radius:999px;padding:7px 14px;font-size:12px;color:var(--dsw-alias-label-primary,inherit);box-shadow:0 6px 24px color-mix(in oklab,currentColor 18%,transparent)}",
|
|
2264
|
+
"." + P + "-mask{position:fixed;inset:0;z-index:30;background:color-mix(in oklab,currentColor 26%,transparent)}",
|
|
2265
|
+
"." + P + "-drawer{position:fixed;top:0;right:0;bottom:0;z-index:31;width:min(520px,92vw);display:flex;flex-direction:column;gap:12px;background:var(--dsw-alias-bg-layer-1,var(--cfg-surface));border-left:1px solid var(--cfg-line);box-shadow:-8px 0 28px color-mix(in oklab,currentColor 16%,transparent);padding:18px 20px}",
|
|
2266
|
+
"." + P + "-drawer h3{margin:0;font-size:14px;font-weight:660;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
2267
|
+
"." + P + "-drawer pre{margin:0;flex:1;overflow:auto;border:1px solid var(--cfg-line);border-radius:10px;background:var(--dsw-alias-bg-base,transparent);padding:12px 14px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.65;white-space:pre-wrap;word-break:break-word}",
|
|
2268
|
+
"." + P + "-drawerfoot{display:flex;gap:8px;justify-content:flex-end}",
|
|
2269
|
+
"." + P + "-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}",
|
|
2270
|
+
"@media (max-width:900px){." + P + "{grid-template-columns:minmax(0,1fr)}." + P + "-side{position:static;flex-direction:row;flex-wrap:wrap;gap:6px;padding:6px}." + P + "-sidetitle{display:none}." + P + "-stab{padding:6px 10px;flex:none}." + P + "-sidecount{display:none}." + P + "-tablewrap{max-height:calc(100vh - 260px)}}",
|
|
2271
|
+
"@media (prefers-reduced-motion:reduce){." + P + " *,." + P + "-track,." + P + "-track::after,." + P + "-sk,." + P + "-drawer{transition:none;animation:none}}",
|
|
2272
|
+
"." + P + "-idxsub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55}",
|
|
2273
|
+
"." + P + "-idxsum{display:flex;gap:16px;flex-wrap:wrap;font-size:11.5px;color:var(--cfg-muted)}",
|
|
2274
|
+
"." + P + "-idxsum b{font-weight:660;color:var(--dsw-alias-label-primary,inherit);font-variant-numeric:tabular-nums}",
|
|
2275
|
+
"." + P + "-idxtable{width:100%;table-layout:fixed}." + P + "-idxtable ." + P + "-cell{white-space:normal;overflow-wrap:anywhere;max-width:none}." + P + "-idxtable th:first-child{width:30%}." + P + "-idxtable th:nth-child(2){width:28%}",
|
|
2276
|
+
"." + P + "-idxtags{display:flex;flex-wrap:wrap;gap:4px;max-width:280px}",
|
|
2277
|
+
"." + P + "-idxchip{display:inline-block;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;line-height:1.6;border-radius:999px;padding:0 7px;background:color-mix(in oklab,currentColor 7%,transparent);color:var(--cfg-muted);white-space:nowrap}",
|
|
2278
|
+
"." + P + "-idxchip.u{background:color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 15%,transparent);color:var(--dsw-alias-brand-primary,inherit)}",
|
|
2279
|
+
"." + P + "-idxnone{color:var(--cfg-faint)}",
|
|
2280
|
+
"." + P + "-frow th{padding:0 8px 6px;border-bottom:1px solid var(--cfg-line)}",
|
|
2281
|
+
"." + P + "-fcell{position:relative;display:block;min-width:96px}",
|
|
2282
|
+
"." + P + "-finput{width:100%;box-sizing:border-box;border:1px solid transparent;border-radius:6px;background:color-mix(in oklab,currentColor 4%,transparent);color:inherit;font:inherit;font-size:11.5px;padding:3px 18px 3px 6px;min-width:0}",
|
|
2283
|
+
"." + P + "-finput:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
|
|
2284
|
+
"." + P + "-finput:focus{outline:none;border-color:var(--dsw-alias-brand-primary,currentColor);background:var(--cfg-surface)}",
|
|
2285
|
+
"." + P + "-fclear{position:absolute;right:2px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--cfg-muted);cursor:pointer;font-size:13px;line-height:1;padding:2px 4px;border-radius:4px}",
|
|
2286
|
+
"." + P + "-fclear:hover{color:inherit;background:var(--cfg-hover)}",
|
|
2287
|
+
"." + P + "-emptycell{padding:22px 12px;text-align:center;color:var(--cfg-muted)}",
|
|
2288
|
+
"." + P + " *{box-sizing:border-box}",
|
|
2289
|
+
"." + P + "-tabs{display:flex;gap:6px;border-bottom:1px solid var(--cfg-line);padding-bottom:9px}",
|
|
2290
|
+
"." + P + "-tabs [aria-selected=true]{background:var(--cfg-hover);color:inherit;font-weight:660}",
|
|
2291
|
+
"." + P + "-images{display:flex;gap:5px;align-items:center}",
|
|
2292
|
+
"." + P + "-images img{width:36px;height:36px;object-fit:cover;border-radius:5px}",
|
|
2293
|
+
"." + P + "-gallery{display:flex;flex-direction:column;gap:12px;overflow:auto;flex:1}",
|
|
2294
|
+
"." + P + "-gallery img{width:100%;height:auto;object-fit:contain;border-radius:8px}"
|
|
2295
|
+
].join("\n");
|
|
2296
|
+
if (DOMAIN === "storage") {
|
|
2297
|
+
var buttons = "." + P + " :is(button)";
|
|
2298
|
+
CSS += buttons + "{border:none;background:var(--wb-btn-bg);min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm)}" + buttons + ":enabled:hover{background:var(--wb-btn-hover-bg)}" + buttons + ":enabled:active{background:var(--wb-btn-active-bg)}" + buttons + ":disabled{background:var(--wb-btn-bg);color:var(--cfg-muted)}" + buttons + ":focus-visible{outline:var(--wb-btn-focus);outline-offset:var(--wb-btn-focus-offset)}." + P + "-fcell:has(button) input{padding-right:34px}";
|
|
2299
|
+
}
|
|
2300
|
+
function injectCss() {
|
|
2301
|
+
if (typeof document === "undefined") return;
|
|
2302
|
+
var old = document.getElementById("wb-addon-" + DOMAIN + "-data-css");
|
|
2303
|
+
if (old) {
|
|
2304
|
+
old.textContent = CSS;
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
var style = document.createElement("style");
|
|
2308
|
+
style.id = "wb-addon-" + DOMAIN + "-data-css";
|
|
2309
|
+
style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
|
|
2310
|
+
style.textContent = CSS;
|
|
2311
|
+
document.head.appendChild(style);
|
|
2312
|
+
}
|
|
2313
|
+
return injectCss;
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
});
|
|
2317
|
+
|
|
2318
|
+
// packages/addons/lib/data-view.cjs
|
|
2319
|
+
var require_data_view = __commonJS({
|
|
2320
|
+
"packages/addons/lib/data-view.cjs"(exports2, module2) {
|
|
2321
|
+
"use strict";
|
|
2322
|
+
var React = require("react");
|
|
2323
|
+
var h = React.createElement;
|
|
2324
|
+
var COPY = require_data_copy();
|
|
2325
|
+
module2.exports = function createDataView(options) {
|
|
2326
|
+
var DOMAIN = options.domain;
|
|
2327
|
+
function icon(name) {
|
|
2328
|
+
return options.Icon ? h(options.Icon, { name }) : null;
|
|
2329
|
+
}
|
|
2330
|
+
var P = options.prefix + "-data";
|
|
2331
|
+
var configView = { useConfig: options.useConfig };
|
|
2332
|
+
var columnHooks = options.columns || {};
|
|
2333
|
+
var injectCss = require_data_style()(DOMAIN, options.prefix);
|
|
2334
|
+
var CFG_FALLBACK = {
|
|
2335
|
+
"data.pageSize": 50,
|
|
2336
|
+
"data.showSystemColumns": false,
|
|
2337
|
+
"data.includeDeleted": false
|
|
2338
|
+
};
|
|
2339
|
+
var PAGE_SIZES = [10, 25, 50, 100, 200];
|
|
2340
|
+
function unwrap(r) {
|
|
2341
|
+
return r && r.result !== void 0 ? r.result : r;
|
|
2342
|
+
}
|
|
2343
|
+
function fmt(template, vars) {
|
|
2344
|
+
return String(template).replace(/\{(\w+)\}/g, function(m, key) {
|
|
2345
|
+
return vars[key] === void 0 ? m : String(vars[key]);
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
function pad2(n) {
|
|
2349
|
+
return n < 10 ? "0" + n : String(n);
|
|
2350
|
+
}
|
|
2351
|
+
function timeText(ms) {
|
|
2352
|
+
var d = new Date(Number(ms));
|
|
2353
|
+
if (!Number.isFinite(d.getTime())) return String(ms);
|
|
2354
|
+
return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()) + " " + pad2(d.getHours()) + ":" + pad2(d.getMinutes());
|
|
2355
|
+
}
|
|
2356
|
+
function looksJson(value) {
|
|
2357
|
+
var text = String(value).trim();
|
|
2358
|
+
if (!text || text[0] !== "{" && text[0] !== "[") return false;
|
|
2359
|
+
try {
|
|
2360
|
+
JSON.parse(text);
|
|
2361
|
+
return true;
|
|
2362
|
+
} catch (e) {
|
|
2363
|
+
return false;
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
function rawText(value, col) {
|
|
2367
|
+
if (value === null || value === void 0) return "";
|
|
2368
|
+
return String(value);
|
|
2369
|
+
}
|
|
2370
|
+
function DataView(props) {
|
|
2371
|
+
var api = props.api;
|
|
2372
|
+
var lang = props.lang === "en" ? "en" : "zh";
|
|
2373
|
+
var t = Object.assign({}, COPY[lang], { indexSub: fmt(COPY[lang].indexSub, { tables: options.tables.join(" / "), domain: DOMAIN }) });
|
|
2374
|
+
var cfgWrap = configView.useConfig(api, CFG_FALLBACK);
|
|
2375
|
+
var cfg = cfgWrap.values;
|
|
2376
|
+
var tablesS = React.useState(null);
|
|
2377
|
+
var tables = tablesS[0], setTables = tablesS[1];
|
|
2378
|
+
var activeS = React.useState("");
|
|
2379
|
+
var active = activeS[0], setActive = activeS[1];
|
|
2380
|
+
var dataS = React.useState(null);
|
|
2381
|
+
var data = dataS[0], setData = dataS[1];
|
|
2382
|
+
var loadingS = React.useState(false);
|
|
2383
|
+
var loadingRows = loadingS[0], setLoadingRows = loadingS[1];
|
|
2384
|
+
var loadingTablesS = React.useState(true);
|
|
2385
|
+
var loadingTables = loadingTablesS[0], setLoadingTables = loadingTablesS[1];
|
|
2386
|
+
var errorS = React.useState("");
|
|
2387
|
+
var error = errorS[0], setError = errorS[1];
|
|
2388
|
+
var pageS = React.useState(1);
|
|
2389
|
+
var page = pageS[0], setPage = pageS[1];
|
|
2390
|
+
var sizeS = React.useState(0);
|
|
2391
|
+
var pageSize = sizeS[0], setPageSize = sizeS[1];
|
|
2392
|
+
var sortS = React.useState("");
|
|
2393
|
+
var sort = sortS[0], setSort = sortS[1];
|
|
2394
|
+
var orderS = React.useState("desc");
|
|
2395
|
+
var order = orderS[0], setOrder = orderS[1];
|
|
2396
|
+
var searchDraftS = React.useState("");
|
|
2397
|
+
var searchDraft = searchDraftS[0], setSearchDraft = searchDraftS[1];
|
|
2398
|
+
var searchS = React.useState("");
|
|
2399
|
+
var search = searchS[0], setSearch = searchS[1];
|
|
2400
|
+
var filterDraftS = React.useState({});
|
|
2401
|
+
var filterDraft = filterDraftS[0], setFilterDraft = filterDraftS[1];
|
|
2402
|
+
var filtersS = React.useState({});
|
|
2403
|
+
var filters = filtersS[0], setFilters = filtersS[1];
|
|
2404
|
+
var includeDeletedS = React.useState(null);
|
|
2405
|
+
var includeDeletedRaw = includeDeletedS[0], setIncludeDeleted = includeDeletedS[1];
|
|
2406
|
+
var showSystemS = React.useState(null);
|
|
2407
|
+
var showSystemRaw = showSystemS[0], setShowSystem = showSystemS[1];
|
|
2408
|
+
var drawerS = React.useState(null);
|
|
2409
|
+
var drawer = drawerS[0], setDrawer = drawerS[1];
|
|
2410
|
+
var toastS = React.useState("");
|
|
2411
|
+
var toast = toastS[0], setToast = toastS[1];
|
|
2412
|
+
var filtersKey = JSON.stringify(filters);
|
|
2413
|
+
var reqRef = React.useRef(0);
|
|
2414
|
+
var toastTimer = React.useRef(null);
|
|
2415
|
+
var refreshS = React.useState(0);
|
|
2416
|
+
function refresh() {
|
|
2417
|
+
loadTables();
|
|
2418
|
+
refreshS[1](function(n) {
|
|
2419
|
+
return n + 1;
|
|
2420
|
+
});
|
|
2421
|
+
}
|
|
2422
|
+
var indexReqRef = React.useRef(0);
|
|
2423
|
+
var indexS = React.useState(null);
|
|
2424
|
+
var index = indexS[0], setIndex = indexS[1];
|
|
2425
|
+
var indexBusyS = React.useState(false);
|
|
2426
|
+
var indexBusy = indexBusyS[0], setIndexBusy = indexBusyS[1];
|
|
2427
|
+
var cfgSize = Number(cfg["data.pageSize"]) || 50;
|
|
2428
|
+
var size = pageSize || (PAGE_SIZES.indexOf(cfgSize) >= 0 ? cfgSize : 50);
|
|
2429
|
+
var includeDeleted = includeDeletedRaw === null ? cfg["data.includeDeleted"] === true : includeDeletedRaw;
|
|
2430
|
+
var showSystem = showSystemRaw === null ? cfg["data.showSystemColumns"] === true : showSystemRaw;
|
|
2431
|
+
function say(text) {
|
|
2432
|
+
setToast(text);
|
|
2433
|
+
if (toastTimer.current) clearTimeout(toastTimer.current);
|
|
2434
|
+
toastTimer.current = setTimeout(function() {
|
|
2435
|
+
setToast("");
|
|
2436
|
+
}, 1600);
|
|
2437
|
+
}
|
|
2438
|
+
function loadTables() {
|
|
2439
|
+
setLoadingTables(true);
|
|
2440
|
+
Promise.resolve((options.tablesLoader || function(a) {
|
|
2441
|
+
return a.call(DOMAIN + ".dataTables");
|
|
2442
|
+
})(api)).then(function(r) {
|
|
2443
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
|
|
2444
|
+
var body = unwrap(r);
|
|
2445
|
+
if (!body || !Array.isArray(body.tables)) throw new Error(t.loadFail);
|
|
2446
|
+
setTables(body.tables);
|
|
2447
|
+
setError("");
|
|
2448
|
+
if (!active && body.tables.length) setActive(body.tables[0].name);
|
|
2449
|
+
}).catch(function(e) {
|
|
2450
|
+
setError(String(e && e.message || e) || t.loadFail);
|
|
2451
|
+
}).then(function() {
|
|
2452
|
+
setLoadingTables(false);
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
React.useEffect(function() {
|
|
2456
|
+
injectCss();
|
|
2457
|
+
loadTables();
|
|
2458
|
+
return function() {
|
|
2459
|
+
indexReqRef.current++;
|
|
2460
|
+
if (toastTimer.current) clearTimeout(toastTimer.current);
|
|
2461
|
+
};
|
|
2462
|
+
}, []);
|
|
2463
|
+
function selectTable(name) {
|
|
2464
|
+
if (name === active) return;
|
|
2465
|
+
reqRef.current++;
|
|
2466
|
+
setActive(name);
|
|
2467
|
+
setData(null);
|
|
2468
|
+
setDrawer(null);
|
|
2469
|
+
setError("");
|
|
2470
|
+
setLoadingRows(true);
|
|
2471
|
+
setPage(1);
|
|
2472
|
+
setSort("");
|
|
2473
|
+
setOrder("desc");
|
|
2474
|
+
setSearch("");
|
|
2475
|
+
setSearchDraft("");
|
|
2476
|
+
setFilterDraft({});
|
|
2477
|
+
setFilters({});
|
|
2478
|
+
}
|
|
2479
|
+
React.useEffect(function() {
|
|
2480
|
+
if (searchDraft === search) return void 0;
|
|
2481
|
+
var timer = setTimeout(function() {
|
|
2482
|
+
setSearch(searchDraft);
|
|
2483
|
+
setPage(1);
|
|
2484
|
+
}, 280);
|
|
2485
|
+
return function() {
|
|
2486
|
+
clearTimeout(timer);
|
|
2487
|
+
};
|
|
2488
|
+
}, [searchDraft]);
|
|
2489
|
+
React.useEffect(function() {
|
|
2490
|
+
if (JSON.stringify(filterDraft) === JSON.stringify(filters)) return void 0;
|
|
2491
|
+
var timer = setTimeout(function() {
|
|
2492
|
+
setFilters(filterDraft);
|
|
2493
|
+
setPage(1);
|
|
2494
|
+
}, 280);
|
|
2495
|
+
return function() {
|
|
2496
|
+
clearTimeout(timer);
|
|
2497
|
+
};
|
|
2498
|
+
}, [filterDraft]);
|
|
2499
|
+
React.useEffect(function() {
|
|
2500
|
+
if (!active || !cfgWrap.ready || index) return void 0;
|
|
2501
|
+
var req = ++reqRef.current;
|
|
2502
|
+
setLoadingRows(true);
|
|
2503
|
+
var args = { table: active, page, pageSize: size, order, includeDeleted };
|
|
2504
|
+
if (sort) args.sort = sort;
|
|
2505
|
+
if (search) args.search = search;
|
|
2506
|
+
if (Object.keys(filters).length) args.filters = filters;
|
|
2507
|
+
Promise.resolve((options.query || function(a, q) {
|
|
2508
|
+
return a.call(DOMAIN + ".dataQuery", q);
|
|
2509
|
+
})(api, args)).then(function(r) {
|
|
2510
|
+
if (req !== reqRef.current) return;
|
|
2511
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.queryFail);
|
|
2512
|
+
var body = unwrap(r);
|
|
2513
|
+
if (!body) throw new Error(t.queryFail);
|
|
2514
|
+
setData(body);
|
|
2515
|
+
setError("");
|
|
2516
|
+
if (body.page !== page) setPage(body.page);
|
|
2517
|
+
}).catch(function(e) {
|
|
2518
|
+
if (req !== reqRef.current) return;
|
|
2519
|
+
setError(String(e && e.message || e) || t.queryFail);
|
|
2520
|
+
}).then(function() {
|
|
2521
|
+
if (req === reqRef.current) setLoadingRows(false);
|
|
2522
|
+
});
|
|
2523
|
+
return function() {
|
|
2524
|
+
reqRef.current++;
|
|
2525
|
+
};
|
|
2526
|
+
}, [active, page, size, sort, order, search, includeDeleted, cfgWrap.ready, filtersKey, refreshS[0], !!index]);
|
|
2527
|
+
React.useEffect(function() {
|
|
2528
|
+
if (!drawer) return void 0;
|
|
2529
|
+
function onKey(e) {
|
|
2530
|
+
if (e.key === "Escape") setDrawer(null);
|
|
2531
|
+
}
|
|
2532
|
+
document.addEventListener("keydown", onKey);
|
|
2533
|
+
return function() {
|
|
2534
|
+
document.removeEventListener("keydown", onKey);
|
|
2535
|
+
};
|
|
2536
|
+
}, [drawer]);
|
|
2537
|
+
var current = null;
|
|
2538
|
+
if (tables) {
|
|
2539
|
+
for (var i = 0; i < tables.length; i++) if (tables[i].name === active) current = tables[i];
|
|
2540
|
+
}
|
|
2541
|
+
function leaveIndex() {
|
|
2542
|
+
indexReqRef.current++;
|
|
2543
|
+
setIndex(null);
|
|
2544
|
+
setIndexBusy(false);
|
|
2545
|
+
setError("");
|
|
2546
|
+
}
|
|
2547
|
+
function loadIndex() {
|
|
2548
|
+
reqRef.current++;
|
|
2549
|
+
setError("");
|
|
2550
|
+
var req = ++indexReqRef.current;
|
|
2551
|
+
setIndex([]);
|
|
2552
|
+
setIndexBusy(true);
|
|
2553
|
+
Promise.resolve(api.call(DOMAIN + ".dataTables", { stats: true })).then(function(r) {
|
|
2554
|
+
if (req !== indexReqRef.current) return;
|
|
2555
|
+
if (r && r.ok === false) throw new Error(r.error || t.loadFail);
|
|
2556
|
+
var payload = unwrap(r) || {};
|
|
2557
|
+
var rows = (payload.tables || []).map(function(tb) {
|
|
2558
|
+
return { table: tb, stats: tb.stats || null };
|
|
2559
|
+
});
|
|
2560
|
+
setIndex(rows);
|
|
2561
|
+
setError("");
|
|
2562
|
+
setIndexBusy(false);
|
|
2563
|
+
}).catch(function(e) {
|
|
2564
|
+
if (req !== indexReqRef.current) return;
|
|
2565
|
+
setError(String(e.message || e));
|
|
2566
|
+
setIndex([]);
|
|
2567
|
+
setIndexBusy(false);
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
function renderIndex() {
|
|
2571
|
+
var row = (index || []).filter(function(r) {
|
|
2572
|
+
return r.table.name === active;
|
|
2573
|
+
})[0];
|
|
2574
|
+
var tb = row ? row.table : current;
|
|
2575
|
+
var st = row && row.stats;
|
|
2576
|
+
var indexes = st ? st.indexes || [] : [];
|
|
2577
|
+
var hasExtra = indexes.some(function(ix) {
|
|
2578
|
+
return ix.origin !== "pk";
|
|
2579
|
+
});
|
|
2580
|
+
var count = st && st.rows !== void 0 ? st.rows : tb && tb.count;
|
|
2581
|
+
return h(
|
|
2582
|
+
"div",
|
|
2583
|
+
{ className: P + "-idx" },
|
|
2584
|
+
h(
|
|
2585
|
+
"div",
|
|
2586
|
+
{ className: P + "-head" },
|
|
2587
|
+
h(
|
|
2588
|
+
"div",
|
|
2589
|
+
{ className: P + "-headmain" },
|
|
2590
|
+
h("h2", null, icon("database"), tableLabel(tb), h("span", { className: P + "-code" }, active)),
|
|
2591
|
+
h("div", { className: P + "-idxsub" }, t.indexSub)
|
|
2592
|
+
),
|
|
2593
|
+
h("button", {
|
|
2594
|
+
type: "button",
|
|
2595
|
+
className: P + "-btn",
|
|
2596
|
+
"aria-label": t.refresh,
|
|
2597
|
+
title: t.refresh,
|
|
2598
|
+
"aria-busy": indexBusy ? "true" : "false",
|
|
2599
|
+
onClick: function() {
|
|
2600
|
+
loadIndex();
|
|
2601
|
+
}
|
|
2602
|
+
}, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
|
|
2603
|
+
),
|
|
2604
|
+
st ? h(
|
|
2605
|
+
"div",
|
|
2606
|
+
{ className: P + "-idxsum" },
|
|
2607
|
+
h("span", null, t.idxRows, " ", h("b", null, String(count))),
|
|
2608
|
+
h("span", null, t.idxCols, " ", h("b", null, String(st.columnCount === void 0 ? (tb.columns || []).length : st.columnCount))),
|
|
2609
|
+
h("span", null, fmt(t.idxCount, { n: indexes.length }))
|
|
2610
|
+
) : null,
|
|
2611
|
+
indexBusy ? options.Skeleton ? h(options.Skeleton, { lang, label: t.loading }) : h("div", { className: P + "-empty", role: "status", "aria-busy": "true" }, t.loading) : !st ? h("div", { className: P + "-empty" }, t.idxEmpty) : !hasExtra ? h("div", { className: P + "-empty" }, t.idxNoExtra) : h(
|
|
2612
|
+
"div",
|
|
2613
|
+
{ className: P + "-tablewrap" },
|
|
2614
|
+
h(
|
|
2615
|
+
"table",
|
|
2616
|
+
{ className: P + "-table " + P + "-idxtable" },
|
|
2617
|
+
h("thead", null, h(
|
|
2618
|
+
"tr",
|
|
2619
|
+
null,
|
|
2620
|
+
[t.idxName, t.idxColumns, t.idxType, t.idxSource, t.idxRows].map(function(label) {
|
|
2621
|
+
return h("th", { scope: "col", key: label }, h("span", { className: P + "-thbtn" }, label));
|
|
2622
|
+
})
|
|
2623
|
+
)),
|
|
2624
|
+
h("tbody", null, indexes.map(function(ix) {
|
|
2625
|
+
return h(
|
|
2626
|
+
"tr",
|
|
2627
|
+
{ className: P + "-tr", key: ix.name },
|
|
2628
|
+
h("td", { className: P + "-cell mono" }, ix.name),
|
|
2629
|
+
h("td", { className: P + "-cell mono" }, (ix.columns || []).join(", ") || t.idxNone),
|
|
2630
|
+
h("td", { className: P + "-cell" }, ix.origin === "pk" ? t.idxKey : ix.unique ? t.idxUnique : t.idxNormal),
|
|
2631
|
+
h("td", { className: P + "-cell" }, /^sqlite_autoindex_/.test(ix.name) ? t.idxAuto : t.idxCreated),
|
|
2632
|
+
h("td", { className: P + "-cell num", title: t.idxRowsHelp }, String(count))
|
|
2633
|
+
);
|
|
2634
|
+
}))
|
|
2635
|
+
)
|
|
2636
|
+
)
|
|
2637
|
+
);
|
|
2638
|
+
}
|
|
2639
|
+
function tableLabel(tb) {
|
|
2640
|
+
if (!tb || !tb.label) return "";
|
|
2641
|
+
return lang === "en" ? tb.label.en || tb.label.zh : tb.label.zh || tb.label.en;
|
|
2642
|
+
}
|
|
2643
|
+
function colLabel(col) {
|
|
2644
|
+
if (!col.label) return col.name;
|
|
2645
|
+
return lang === "en" ? col.label.en || col.label.zh : col.label.zh || col.label.en;
|
|
2646
|
+
}
|
|
2647
|
+
function visibleColumns() {
|
|
2648
|
+
var cols = data && data.columns ? data.columns.map(function(col) {
|
|
2649
|
+
var hook = columnHooks[col.name];
|
|
2650
|
+
return hook && hook.kind ? Object.assign({}, col, { kind: hook.kind, type: hook.type || col.type }) : col;
|
|
2651
|
+
}) : [];
|
|
2652
|
+
return cols.filter(function(c) {
|
|
2653
|
+
return showSystem || !c.system;
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
function toggleSort(name) {
|
|
2657
|
+
if (sort !== name) {
|
|
2658
|
+
setSort(name);
|
|
2659
|
+
setOrder("desc");
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
if (order === "desc") {
|
|
2663
|
+
setOrder("asc");
|
|
2664
|
+
return;
|
|
2665
|
+
}
|
|
2666
|
+
setSort("");
|
|
2667
|
+
setOrder("desc");
|
|
2668
|
+
}
|
|
2669
|
+
function ariaSort(name) {
|
|
2670
|
+
if (sort !== name) return "none";
|
|
2671
|
+
return order === "asc" ? "ascending" : "descending";
|
|
2672
|
+
}
|
|
2673
|
+
function copyCell(value) {
|
|
2674
|
+
var text = value === null || value === void 0 ? "" : String(value);
|
|
2675
|
+
try {
|
|
2676
|
+
if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text);
|
|
2677
|
+
else {
|
|
2678
|
+
var ta = document.createElement("textarea");
|
|
2679
|
+
ta.value = text;
|
|
2680
|
+
ta.style.position = "fixed";
|
|
2681
|
+
ta.style.opacity = "0";
|
|
2682
|
+
document.body.appendChild(ta);
|
|
2683
|
+
ta.select();
|
|
2684
|
+
document.execCommand("copy");
|
|
2685
|
+
document.body.removeChild(ta);
|
|
2686
|
+
}
|
|
2687
|
+
say(t.copied);
|
|
2688
|
+
} catch (e) {
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
function cellText(col, value) {
|
|
2692
|
+
if (value === null || value === void 0) return null;
|
|
2693
|
+
if (col.kind === "bool") return value ? t.yes : t.no;
|
|
2694
|
+
if (col.kind === "timestamp") return timeText(value);
|
|
2695
|
+
return String(value);
|
|
2696
|
+
}
|
|
2697
|
+
function cellClass(col, value) {
|
|
2698
|
+
var cls = P + "-cell";
|
|
2699
|
+
if (value === null || value === void 0) return cls + " null";
|
|
2700
|
+
if (col.kind === "number") return cls + " num";
|
|
2701
|
+
if (col.kind === "id" || col.kind === "path") return cls + " mono";
|
|
2702
|
+
if (col.kind === "text" && looksJson(value)) return cls + " json";
|
|
2703
|
+
return cls;
|
|
2704
|
+
}
|
|
2705
|
+
function cellTitle(col, value) {
|
|
2706
|
+
if (value === null || value === void 0) return t.nullText;
|
|
2707
|
+
if (col.kind === "timestamp") return String(value);
|
|
2708
|
+
if (col.kind === "bool") return value ? "1" : "0";
|
|
2709
|
+
return String(value);
|
|
2710
|
+
}
|
|
2711
|
+
function renderCell(row, col) {
|
|
2712
|
+
var value = row[col.name];
|
|
2713
|
+
var hook = columnHooks[col.name];
|
|
2714
|
+
function openDetail() {
|
|
2715
|
+
setDrawer({ column: colLabel(col), name: col.name, row: (data.page - 1) * data.pageSize + row.__i + 1, value });
|
|
2716
|
+
}
|
|
2717
|
+
var text = cellText(col, value);
|
|
2718
|
+
var content;
|
|
2719
|
+
if (text === null) content = h("span", { className: "v" }, t.nullText);
|
|
2720
|
+
else if (text === "") content = h("span", { className: "v" }, '""');
|
|
2721
|
+
else content = h("span", { className: "v" }, text);
|
|
2722
|
+
if (hook && hook.render) content = hook.render({ value, row, col, lang, prefix: P, openDetail });
|
|
2723
|
+
return h("td", {
|
|
2724
|
+
key: col.name,
|
|
2725
|
+
className: cellClass(col, value),
|
|
2726
|
+
title: cellTitle(col, value),
|
|
2727
|
+
onClick: function() {
|
|
2728
|
+
copyCell(value);
|
|
2729
|
+
},
|
|
2730
|
+
onDoubleClick: openDetail
|
|
2731
|
+
}, content);
|
|
2732
|
+
}
|
|
2733
|
+
function activeFilterCount() {
|
|
2734
|
+
var n = 0;
|
|
2735
|
+
for (var k in filters) if (Object.prototype.hasOwnProperty.call(filters, k)) n++;
|
|
2736
|
+
return n;
|
|
2737
|
+
}
|
|
2738
|
+
function filterCell(col) {
|
|
2739
|
+
var val = filterDraft[col.name] === void 0 ? "" : filterDraft[col.name];
|
|
2740
|
+
return h(
|
|
2741
|
+
"th",
|
|
2742
|
+
{ key: col.name, scope: "col", className: P + "-fth" },
|
|
2743
|
+
h(
|
|
2744
|
+
"span",
|
|
2745
|
+
{ className: P + "-fcell" },
|
|
2746
|
+
h("input", {
|
|
2747
|
+
className: P + "-finput",
|
|
2748
|
+
type: "search",
|
|
2749
|
+
value: val,
|
|
2750
|
+
placeholder: t.filterCol,
|
|
2751
|
+
"aria-label": t.filterCol + " " + colLabel(col),
|
|
2752
|
+
title: colLabel(col) + " \xB7 " + t.filterCol,
|
|
2753
|
+
onChange: function(e) {
|
|
2754
|
+
var v = e.target.value;
|
|
2755
|
+
setFilterDraft(function(prev) {
|
|
2756
|
+
var next = Object.assign({}, prev);
|
|
2757
|
+
if (v) next[col.name] = v;
|
|
2758
|
+
else delete next[col.name];
|
|
2759
|
+
return next;
|
|
2760
|
+
});
|
|
2761
|
+
}
|
|
2762
|
+
}),
|
|
2763
|
+
val ? h("button", {
|
|
2764
|
+
type: "button",
|
|
2765
|
+
className: P + "-fclear",
|
|
2766
|
+
title: t.filterClear,
|
|
2767
|
+
"aria-label": t.filterClear + " " + colLabel(col),
|
|
2768
|
+
onClick: function() {
|
|
2769
|
+
setFilterDraft(function(prev) {
|
|
2770
|
+
var next = Object.assign({}, prev);
|
|
2771
|
+
delete next[col.name];
|
|
2772
|
+
return next;
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
}, "\xD7") : null
|
|
2776
|
+
)
|
|
2777
|
+
);
|
|
2778
|
+
}
|
|
2779
|
+
function renderRows() {
|
|
2780
|
+
if (loadingRows && !data && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
|
|
2781
|
+
if (loadingRows && !data) {
|
|
2782
|
+
return h(
|
|
2783
|
+
"div",
|
|
2784
|
+
{ className: P + "-skwrap", "aria-busy": "true" },
|
|
2785
|
+
h("span", { className: P + "-sr" }, t.loading),
|
|
2786
|
+
[0, 1, 2, 3, 4, 5, 6, 7].map(function(i2) {
|
|
2787
|
+
return h("div", { key: i2, className: P + "-sk" });
|
|
2788
|
+
})
|
|
2789
|
+
);
|
|
2790
|
+
}
|
|
2791
|
+
if (error) {
|
|
2792
|
+
return h(
|
|
2793
|
+
"div",
|
|
2794
|
+
{ className: P + "-err", role: "alert" },
|
|
2795
|
+
h("span", null, t.queryFail + error),
|
|
2796
|
+
h("button", { type: "button", className: P + "-btn", onClick: refresh }, t.retry)
|
|
2797
|
+
);
|
|
2798
|
+
}
|
|
2799
|
+
if (!data) return h("div", { className: P + "-empty" }, t.empty);
|
|
2800
|
+
var cols = visibleColumns();
|
|
2801
|
+
var rows = data.rows || [];
|
|
2802
|
+
var narrowing = !!search || activeFilterCount() > 0;
|
|
2803
|
+
return h(
|
|
2804
|
+
"div",
|
|
2805
|
+
{ className: P + "-tablewrap" },
|
|
2806
|
+
h(
|
|
2807
|
+
"table",
|
|
2808
|
+
{ className: P + "-table" },
|
|
2809
|
+
h(
|
|
2810
|
+
"thead",
|
|
2811
|
+
null,
|
|
2812
|
+
h(
|
|
2813
|
+
"tr",
|
|
2814
|
+
null,
|
|
2815
|
+
h("th", { className: P + "-rownum", scope: "col" }, "#"),
|
|
2816
|
+
cols.map(function(col) {
|
|
2817
|
+
return h(
|
|
2818
|
+
"th",
|
|
2819
|
+
{ key: col.name, scope: "col", "aria-sort": ariaSort(col.name) },
|
|
2820
|
+
h(
|
|
2821
|
+
"button",
|
|
2822
|
+
{
|
|
2823
|
+
type: "button",
|
|
2824
|
+
className: P + "-thbtn",
|
|
2825
|
+
title: colLabel(col) + " \xB7 " + col.type,
|
|
2826
|
+
onClick: function() {
|
|
2827
|
+
toggleSort(col.name);
|
|
2828
|
+
}
|
|
2829
|
+
},
|
|
2830
|
+
h("span", null, colLabel(col)),
|
|
2831
|
+
h("span", { className: P + "-coltype" }, String(col.type || "").toLowerCase()),
|
|
2832
|
+
sort === col.name ? h("span", { className: P + "-sortmark", "aria-hidden": "true" }, order === "asc" ? "\u25B2" : "\u25BC") : null
|
|
2833
|
+
)
|
|
2834
|
+
);
|
|
2835
|
+
})
|
|
2836
|
+
),
|
|
2837
|
+
h(
|
|
2838
|
+
"tr",
|
|
2839
|
+
{ className: P + "-frow" },
|
|
2840
|
+
h("th", { className: P + "-rownum", scope: "col" }, ""),
|
|
2841
|
+
cols.map(filterCell)
|
|
2842
|
+
)
|
|
2843
|
+
),
|
|
2844
|
+
h("tbody", null, rows.length ? rows.map(function(row, idx) {
|
|
2845
|
+
row.__i = idx;
|
|
2846
|
+
var deleted = row.deleted_at !== null && row.deleted_at !== void 0;
|
|
2847
|
+
return h(
|
|
2848
|
+
"tr",
|
|
2849
|
+
{ key: row.id || idx, className: P + "-tr" + (deleted ? " deleted" : "") },
|
|
2850
|
+
h("td", { className: P + "-rownum" }, (data.page - 1) * data.pageSize + idx + 1),
|
|
2851
|
+
cols.map(function(col) {
|
|
2852
|
+
var cell = renderCell(row, col);
|
|
2853
|
+
if (deleted && col.name === "id") {
|
|
2854
|
+
return React.cloneElement(cell, { key: col.name }, cell.props.children, h("span", { className: P + "-delbadge" }, t.deleted));
|
|
2855
|
+
}
|
|
2856
|
+
return cell;
|
|
2857
|
+
})
|
|
2858
|
+
);
|
|
2859
|
+
}) : h("tr", null, h("td", { className: P + "-emptycell", colSpan: cols.length + 1 }, narrowing ? t.noRows : t.empty)))
|
|
2860
|
+
)
|
|
2861
|
+
);
|
|
2862
|
+
}
|
|
2863
|
+
function renderFoot() {
|
|
2864
|
+
var pages = data ? data.pages : 1;
|
|
2865
|
+
var total = data ? data.total : 0;
|
|
2866
|
+
return h(
|
|
2867
|
+
"div",
|
|
2868
|
+
{ className: P + "-foot" },
|
|
2869
|
+
h("span", null, fmt(t.total, { n: total })),
|
|
2870
|
+
h("span", { className: P + "-grow" }),
|
|
2871
|
+
h("button", { type: "button", className: P + "-btn", disabled: !data || page <= 1, onClick: function() {
|
|
2872
|
+
setPage(Math.max(1, page - 1));
|
|
2873
|
+
} }, "\u2039 " + t.prev),
|
|
2874
|
+
h("span", { className: P + "-pageinfo" }, fmt(t.pageInfo, { page: data ? data.page : 1, pages })),
|
|
2875
|
+
h("button", { type: "button", className: P + "-btn", disabled: !data || page >= pages, onClick: function() {
|
|
2876
|
+
setPage(Math.min(pages, page + 1));
|
|
2877
|
+
} }, t.next + " \u203A"),
|
|
2878
|
+
h("input", {
|
|
2879
|
+
className: P + "-jump",
|
|
2880
|
+
type: "number",
|
|
2881
|
+
min: 1,
|
|
2882
|
+
max: pages,
|
|
2883
|
+
"aria-label": t.jump,
|
|
2884
|
+
onKeyDown: function(e) {
|
|
2885
|
+
if (e.key === "Enter") {
|
|
2886
|
+
var n = Math.floor(Number(e.target.value));
|
|
2887
|
+
if (n >= 1) setPage(Math.min(pages, n));
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
}),
|
|
2891
|
+
data && data.queryMs !== void 0 ? h("span", null, fmt(t.queryTime, { n: data.queryMs })) : null
|
|
2892
|
+
);
|
|
2893
|
+
}
|
|
2894
|
+
if (!tables && loadingTables && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
|
|
2895
|
+
if (!tables && loadingTables) {
|
|
2896
|
+
return h("div", { className: P + "-skwrap", "aria-busy": "true" }, h("span", { className: P + "-sr" }, t.loading), [0, 1, 2, 3].map(function(i2) {
|
|
2897
|
+
return h("div", { key: i2, className: P + "-sk" });
|
|
2898
|
+
}));
|
|
2899
|
+
}
|
|
2900
|
+
if (!tables) {
|
|
2901
|
+
return h("div", { className: P + "-err", role: "alert" }, h("span", null, t.loadFail), h("button", { type: "button", className: P + "-btn", onClick: loadTables }, t.retry));
|
|
2902
|
+
}
|
|
2903
|
+
if (!tables.length) return h("div", { className: P + "-empty" }, t.emptyTable);
|
|
2904
|
+
return h(
|
|
2905
|
+
"div",
|
|
2906
|
+
{ className: P },
|
|
2907
|
+
h(
|
|
2908
|
+
"div",
|
|
2909
|
+
{ className: P + "-side" },
|
|
2910
|
+
h("div", { className: P + "-sidetitle" }, h("span", null, icon("table"), t.tables), h("span", null, String(tables.length))),
|
|
2911
|
+
tables.map(function(tb) {
|
|
2912
|
+
return h(
|
|
2913
|
+
"button",
|
|
2914
|
+
{
|
|
2915
|
+
key: tb.name,
|
|
2916
|
+
type: "button",
|
|
2917
|
+
className: P + "-stab" + (tb.name === active ? " on" : ""),
|
|
2918
|
+
"aria-pressed": tb.name === active,
|
|
2919
|
+
onClick: function() {
|
|
2920
|
+
selectTable(tb.name);
|
|
2921
|
+
}
|
|
2922
|
+
},
|
|
2923
|
+
h(
|
|
2924
|
+
"span",
|
|
2925
|
+
{ className: P + "-stabname" },
|
|
2926
|
+
h("span", null, tableLabel(tb)),
|
|
2927
|
+
h("span", { className: P + "-sidecount" }, tb.count === void 0 || tb.count === null ? "" : String(tb.count))
|
|
2928
|
+
),
|
|
2929
|
+
h("span", { className: P + "-sidetable" }, tb.name)
|
|
2930
|
+
);
|
|
2931
|
+
})
|
|
2932
|
+
),
|
|
2933
|
+
h(
|
|
2934
|
+
"div",
|
|
2935
|
+
{ className: P + "-main" },
|
|
2936
|
+
h(
|
|
2937
|
+
"div",
|
|
2938
|
+
{ className: P + "-tabs", role: "tablist", "aria-label": t.title },
|
|
2939
|
+
h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !index, onClick: leaveIndex }, icon("list"), lang === "en" ? "Row data" : "\u884C\u6570\u636E"),
|
|
2940
|
+
h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !!index, onClick: loadIndex }, icon("database"), t.index)
|
|
2941
|
+
),
|
|
2942
|
+
index && error ? h("div", { className: P + "-err", role: "alert" }, error) : null,
|
|
2943
|
+
index ? renderIndex() : [
|
|
2944
|
+
h(
|
|
2945
|
+
"div",
|
|
2946
|
+
{ className: P + "-head" },
|
|
2947
|
+
h(
|
|
2948
|
+
"div",
|
|
2949
|
+
{ className: P + "-headmain" },
|
|
2950
|
+
h("h2", null, icon("database"), tableLabel(current), h("span", { className: P + "-code" }, active)),
|
|
2951
|
+
h(
|
|
2952
|
+
"div",
|
|
2953
|
+
{ className: P + "-sub" },
|
|
2954
|
+
current && data && data.total !== void 0 ? fmt(t.rowCount, { n: data.total }) : "",
|
|
2955
|
+
current && current.deletedCount ? " \xB7 " + fmt(t.deletedCount, { n: current.deletedCount }) : "",
|
|
2956
|
+
" \xB7 " + t.subtitle
|
|
2957
|
+
)
|
|
2958
|
+
),
|
|
2959
|
+
h("button", {
|
|
2960
|
+
type: "button",
|
|
2961
|
+
className: P + "-btn",
|
|
2962
|
+
"aria-label": t.refresh,
|
|
2963
|
+
title: t.refresh,
|
|
2964
|
+
"aria-busy": loadingRows ? "true" : "false",
|
|
2965
|
+
onClick: refresh
|
|
2966
|
+
}, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
|
|
2967
|
+
),
|
|
2968
|
+
h(
|
|
2969
|
+
"div",
|
|
2970
|
+
{ className: P + "-toolbar" },
|
|
2971
|
+
h(
|
|
2972
|
+
"div",
|
|
2973
|
+
{ className: P + "-search" },
|
|
2974
|
+
icon("search"),
|
|
2975
|
+
h("input", {
|
|
2976
|
+
type: "search",
|
|
2977
|
+
value: searchDraft,
|
|
2978
|
+
placeholder: t.search,
|
|
2979
|
+
"aria-label": t.search,
|
|
2980
|
+
onChange: function(e) {
|
|
2981
|
+
setSearchDraft(e.target.value);
|
|
2982
|
+
}
|
|
2983
|
+
})
|
|
2984
|
+
),
|
|
2985
|
+
h(
|
|
2986
|
+
"label",
|
|
2987
|
+
{ className: P + "-switch" },
|
|
2988
|
+
h("input", { type: "checkbox", checked: includeDeleted, onChange: function(e) {
|
|
2989
|
+
setIncludeDeleted(e.target.checked);
|
|
2990
|
+
setPage(1);
|
|
2991
|
+
} }),
|
|
2992
|
+
h("span", { className: P + "-track" }),
|
|
2993
|
+
h("span", null, t.includeDeleted)
|
|
2994
|
+
),
|
|
2995
|
+
h(
|
|
2996
|
+
"label",
|
|
2997
|
+
{ className: P + "-switch" },
|
|
2998
|
+
h("input", { type: "checkbox", checked: showSystem, onChange: function(e) {
|
|
2999
|
+
setShowSystem(e.target.checked);
|
|
3000
|
+
} }),
|
|
3001
|
+
h("span", { className: P + "-track" }),
|
|
3002
|
+
h("span", null, t.showSystem)
|
|
3003
|
+
),
|
|
3004
|
+
h("span", { className: P + "-grow" }),
|
|
3005
|
+
h(
|
|
3006
|
+
"label",
|
|
3007
|
+
{ style: { display: "inline-flex", alignItems: "center", gap: "6px", fontSize: "11.5px", color: "var(--cfg-muted)" } },
|
|
3008
|
+
h("span", null, t.pageSize),
|
|
3009
|
+
h("select", {
|
|
3010
|
+
className: P + "-select",
|
|
3011
|
+
value: size,
|
|
3012
|
+
onChange: function(e) {
|
|
3013
|
+
setPageSize(Number(e.target.value));
|
|
3014
|
+
setPage(1);
|
|
3015
|
+
}
|
|
3016
|
+
}, PAGE_SIZES.map(function(n) {
|
|
3017
|
+
return h("option", { key: n, value: n }, String(n));
|
|
3018
|
+
}))
|
|
3019
|
+
)
|
|
3020
|
+
),
|
|
3021
|
+
renderRows(),
|
|
3022
|
+
renderFoot()
|
|
3023
|
+
]
|
|
3024
|
+
),
|
|
3025
|
+
drawer ? h(
|
|
3026
|
+
"div",
|
|
3027
|
+
null,
|
|
3028
|
+
h("div", { className: P + "-mask", onClick: function() {
|
|
3029
|
+
setDrawer(null);
|
|
3030
|
+
} }),
|
|
3031
|
+
h(
|
|
3032
|
+
"aside",
|
|
3033
|
+
{ className: P + "-drawer", role: "dialog", "aria-modal": "true", "aria-label": drawer.column },
|
|
3034
|
+
h("h3", null, fmt(t.drawerTitle, { column: drawer.column, row: drawer.row }), h("span", { className: P + "-code" }, drawer.name)),
|
|
3035
|
+
columnHooks[drawer.name] && columnHooks[drawer.name].detail ? columnHooks[drawer.name].detail({ value: drawer.value, lang, prefix: P }) : h("pre", null, drawerText(drawer.value)),
|
|
3036
|
+
h(
|
|
3037
|
+
"div",
|
|
3038
|
+
{ className: P + "-drawerfoot" },
|
|
3039
|
+
h("button", { type: "button", className: P + "-btn", onClick: function() {
|
|
3040
|
+
copyCell(drawer.value);
|
|
3041
|
+
} }, t.copy),
|
|
3042
|
+
h("button", { type: "button", className: P + "-btn", onClick: function() {
|
|
3043
|
+
setDrawer(null);
|
|
3044
|
+
} }, t.close)
|
|
3045
|
+
)
|
|
3046
|
+
)
|
|
3047
|
+
) : null,
|
|
3048
|
+
toast ? h("div", { className: P + "-toast", role: "status" }, toast) : null
|
|
3049
|
+
);
|
|
3050
|
+
}
|
|
3051
|
+
function drawerText(value) {
|
|
3052
|
+
if (value === null || value === void 0) return "NULL";
|
|
3053
|
+
if (typeof value === "string" && looksJson(value)) {
|
|
3054
|
+
try {
|
|
3055
|
+
return JSON.stringify(JSON.parse(value), null, 2);
|
|
3056
|
+
} catch (e) {
|
|
3057
|
+
return value;
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
if (typeof value === "object") {
|
|
3061
|
+
try {
|
|
3062
|
+
return JSON.stringify(value, null, 2);
|
|
3063
|
+
} catch (e) {
|
|
3064
|
+
return String(value);
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
return String(value);
|
|
3068
|
+
}
|
|
3069
|
+
return { DataView, DOMAIN };
|
|
3070
|
+
};
|
|
3071
|
+
}
|
|
3072
|
+
});
|
|
3073
|
+
|
|
3074
|
+
// packages/addons/message/client/views/data.cjs
|
|
3075
|
+
var require_data = __commonJS({
|
|
3076
|
+
"packages/addons/message/client/views/data.cjs"(exports2, module2) {
|
|
3077
|
+
"use strict";
|
|
3078
|
+
module2.exports = require_data_view()({
|
|
3079
|
+
domain: "message",
|
|
3080
|
+
prefix: "wbm",
|
|
3081
|
+
tables: ["message"],
|
|
3082
|
+
useConfig: require_config().useConfig
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
3085
|
+
});
|
|
3086
|
+
|
|
3087
|
+
// packages/addons/lib/highlight.cjs
|
|
3088
|
+
var require_highlight = __commonJS({
|
|
3089
|
+
"packages/addons/lib/highlight.cjs"(exports2, module2) {
|
|
3090
|
+
"use strict";
|
|
3091
|
+
module2.exports = function(React) {
|
|
3092
|
+
var h = React.createElement;
|
|
3093
|
+
function sourceOf(keyword) {
|
|
3094
|
+
var pattern = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3095
|
+
return pattern.replace(/[a-zA-Z]/g, function(letter) {
|
|
3096
|
+
return "[" + letter.toLowerCase() + letter.toUpperCase() + "]";
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
return function createHighlight(prefix) {
|
|
3100
|
+
var className = String(prefix || "wb") + "-hit";
|
|
3101
|
+
function hit(rawText, rawKeyword) {
|
|
3102
|
+
var text = rawText == null ? "" : String(rawText);
|
|
3103
|
+
var keyword = rawKeyword == null ? "" : String(rawKeyword);
|
|
3104
|
+
if (!keyword) return text;
|
|
3105
|
+
var matcher, match, end = 0, parts = [];
|
|
3106
|
+
try {
|
|
3107
|
+
matcher = new RegExp(sourceOf(keyword), "g");
|
|
3108
|
+
} catch (error) {
|
|
3109
|
+
return text;
|
|
3110
|
+
}
|
|
3111
|
+
while (match = matcher.exec(text)) {
|
|
3112
|
+
if (match.index > end) parts.push(text.slice(end, match.index));
|
|
3113
|
+
parts.push(h("mark", { className, key: match.index }, match[0]));
|
|
3114
|
+
end = match.index + match[0].length;
|
|
3115
|
+
if (!match[0]) matcher.lastIndex += 1;
|
|
3116
|
+
}
|
|
3117
|
+
if (!parts.length) return text;
|
|
3118
|
+
if (end < text.length) parts.push(text.slice(end));
|
|
3119
|
+
return parts;
|
|
3120
|
+
}
|
|
3121
|
+
function Highlight(props) {
|
|
3122
|
+
return hit(props.text, props.keyword);
|
|
3123
|
+
}
|
|
3124
|
+
Highlight.hit = hit;
|
|
3125
|
+
return Highlight;
|
|
3126
|
+
};
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
});
|
|
3130
|
+
|
|
3131
|
+
// packages/addons/lib/action-schema-style.cjs
|
|
3132
|
+
var require_action_schema_style = __commonJS({
|
|
3133
|
+
"packages/addons/lib/action-schema-style.cjs"(exports2, module2) {
|
|
3134
|
+
"use strict";
|
|
3135
|
+
module2.exports = function(PREFIX, DOMAIN) {
|
|
3136
|
+
var P = PREFIX + "-as";
|
|
3137
|
+
var CSS = [
|
|
3138
|
+
"." + P + "{display:flex;flex-direction:column;gap:12px;width:100%;min-width:0;font-size:13px;color:inherit}",
|
|
3139
|
+
"." + P + "-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
3140
|
+
"." + P + "-title{font-size:15px;font-weight:660;margin:0}",
|
|
3141
|
+
"." + P + "-badge{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--wb-border,#e3e5e9);border-radius:999px;padding:1px 8px;font-size:11px;color:var(--dsw-alias-label-secondary,currentColor);font-variant-numeric:tabular-nums}",
|
|
3142
|
+
"." + P + "-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
|
|
3143
|
+
"." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
3144
|
+
"." + P + "-search{position:relative;flex:1 1 220px;min-width:0;display:flex;align-items:center}",
|
|
3145
|
+
"." + P + "-search input{width:100%;border:1px solid var(--wb-border,#e3e5e9);border-radius:8px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));color:inherit;font:inherit;padding:6px 10px 6px 30px}",
|
|
3146
|
+
"." + P + "-search input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
3147
|
+
"." + P + "-search .wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
3148
|
+
"." + P + " select{border:1px solid var(--wb-border,#e3e5e9);border-radius:8px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));color:inherit;font:inherit;padding:6px 8px}",
|
|
3149
|
+
"." + P + " select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
3150
|
+
"." + P + "-list{display:flex;flex-direction:column;gap:8px}",
|
|
3151
|
+
"." + P + "-card{border:1px solid var(--wb-border,#e3e5e9);border-radius:10px;padding:10px 12px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));display:flex;flex-direction:column;gap:8px;min-width:0}",
|
|
3152
|
+
"." + P + "-cardhead{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
3153
|
+
"." + P + "-cardhead code{font-weight:640}",
|
|
3154
|
+
"." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px}",
|
|
3155
|
+
// 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
|
|
3156
|
+
"." + P + " mark." + P + "-hit{background:color-mix(in oklab,var(--dsw-alias-brand-primary,#4f6ef7) 22%,transparent);color:inherit;border-radius:2px;padding:0;font:inherit;box-decoration-break:clone;-webkit-box-decoration-break:clone}",
|
|
3157
|
+
"." + P + "-table{width:100%;border-collapse:collapse;font-size:12px;table-layout:auto}",
|
|
3158
|
+
"." + P + "-table th{text-align:left;font-weight:620;font-size:11px;letter-spacing:.4px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary,inherit);padding:4px 8px 4px 0;white-space:nowrap}",
|
|
3159
|
+
"." + P + "-table td{padding:4px 8px 4px 0;vertical-align:top;border-top:1px solid color-mix(in oklab,currentColor 8%,transparent);line-height:1.5}",
|
|
3160
|
+
"." + P + "-req{color:var(--dsw-alias-state-error-primary,#d9534f);font-weight:620}",
|
|
3161
|
+
"." + P + "-opt{color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
3162
|
+
"." + P + "-none{color:var(--dsw-alias-label-tertiary,inherit);font-size:12px}",
|
|
3163
|
+
"." + P + "-example{position:relative;display:flex;flex-direction:column;gap:4px}",
|
|
3164
|
+
"." + P + "-examplehead{display:flex;align-items:center;justify-content:space-between;gap:8px}",
|
|
3165
|
+
"." + P + "-pre{margin:0;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);color:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;line-height:1.5;overflow:auto;max-height:280px;white-space:pre-wrap;word-break:break-word}",
|
|
3166
|
+
"." + P + "-copy{border:1px solid var(--wb-border,#e3e5e9);border-radius:7px;background:transparent;color:inherit;font:inherit;font-size:11.5px;padding:2px 8px;cursor:pointer}",
|
|
3167
|
+
"." + P + "-copy:hover{background:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent))}",
|
|
3168
|
+
"." + P + "-copy:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
3169
|
+
"." + P + " details>summary{cursor:pointer;font-size:11.5px;color:var(--dsw-alias-label-secondary,inherit);width:max-content}",
|
|
3170
|
+
"." + P + " details>summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
3171
|
+
"." + P + "-empty{padding:24px;text-align:center;border:1px dashed var(--wb-border,#e3e5e9);border-radius:10px;color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
3172
|
+
"." + P + "-error{padding:12px;border:1px solid var(--dsw-alias-state-error-primary,#d9534f);border-radius:10px;color:var(--dsw-alias-state-error-primary,#d9534f);display:flex;gap:10px;align-items:center}",
|
|
3173
|
+
"." + P + "-toast{position:sticky;bottom:8px;align-self:flex-start;border-radius:999px;padding:3px 10px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);font-size:11.5px}",
|
|
3174
|
+
"@media(max-width:600px){." + P + "-table thead{display:none}." + P + "-table td{display:block;border-top:0;padding:2px 0}." + P + "-table tr{display:block;border-top:1px solid color-mix(in oklab,currentColor 8%,transparent);padding:4px 0}}"
|
|
3175
|
+
].join("\n");
|
|
3176
|
+
return function injectCss() {
|
|
3177
|
+
if (typeof document === "undefined") return;
|
|
3178
|
+
var id = "wb-addon-" + DOMAIN + "-actions-css";
|
|
3179
|
+
var old = document.getElementById(id);
|
|
3180
|
+
if (old) {
|
|
3181
|
+
old.textContent = CSS;
|
|
3182
|
+
return;
|
|
3183
|
+
}
|
|
3184
|
+
var style = document.createElement("style");
|
|
3185
|
+
style.id = id;
|
|
3186
|
+
style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
|
|
3187
|
+
style.textContent = CSS;
|
|
3188
|
+
document.head.appendChild(style);
|
|
3189
|
+
};
|
|
3190
|
+
};
|
|
3191
|
+
}
|
|
3192
|
+
});
|
|
3193
|
+
|
|
3194
|
+
// packages/addons/lib/action-schema-view.cjs
|
|
3195
|
+
var require_action_schema_view = __commonJS({
|
|
3196
|
+
"packages/addons/lib/action-schema-view.cjs"(exports2, module2) {
|
|
3197
|
+
"use strict";
|
|
3198
|
+
var React = require("react");
|
|
3199
|
+
var createHighlight = require_highlight()(React);
|
|
3200
|
+
var h = React.createElement;
|
|
3201
|
+
var COPY = {
|
|
3202
|
+
zh: {
|
|
3203
|
+
title: "Action",
|
|
3204
|
+
hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
|
|
3205
|
+
domain: "\u57DF",
|
|
3206
|
+
versionLabel: "\u7248\u672C",
|
|
3207
|
+
shell: "\u5BBF\u4E3B",
|
|
3208
|
+
count: function(shown, total) {
|
|
3209
|
+
return shown + " / " + total + " \u4E2A action";
|
|
3210
|
+
},
|
|
3211
|
+
search: "\u641C\u7D22\u540D\u79F0\u3001\u63CF\u8FF0\u3001\u53C2\u6570\uFF08\u547D\u4E2D\u5904\u9AD8\u4EAE\uFF09",
|
|
3212
|
+
filterReq: "\u5FC5\u586B\u7B5B\u9009",
|
|
3213
|
+
all: "\u5168\u90E8",
|
|
3214
|
+
onlyRequired: "\u542B\u5FC5\u586B\u9879",
|
|
3215
|
+
onlyOptional: "\u65E0\u5FC5\u586B\u9879",
|
|
3216
|
+
filterType: "\u53C2\u6570\u7C7B\u578B",
|
|
3217
|
+
allTypes: "\u5168\u90E8\u7C7B\u578B",
|
|
3218
|
+
colName: "\u53C2\u6570",
|
|
3219
|
+
colType: "\u7C7B\u578B",
|
|
3220
|
+
colReq: "\u5FC5\u586B",
|
|
3221
|
+
colExtra: "\u9ED8\u8BA4 / \u679A\u4E3E / \u7EA6\u675F",
|
|
3222
|
+
colDesc: "\u8BF4\u660E",
|
|
3223
|
+
required: "\u5FC5\u586B",
|
|
3224
|
+
optional: "\u53EF\u9009",
|
|
3225
|
+
noParams: "\u65E0\u53C2\u6570",
|
|
3226
|
+
paramCount: function(n) {
|
|
3227
|
+
return n + " \u4E2A\u53C2\u6570";
|
|
3228
|
+
},
|
|
3229
|
+
examples: "\u793A\u4F8B",
|
|
3230
|
+
noExamples: "\u65E0\u793A\u4F8B",
|
|
3231
|
+
copy: "\u590D\u5236",
|
|
3232
|
+
copied: "\u5DF2\u590D\u5236",
|
|
3233
|
+
raw: "\u539F\u59CB JSON Schema",
|
|
3234
|
+
loading: "\u8F7D\u5165\u4E2D\u2026",
|
|
3235
|
+
loadFail: "\u8BFB\u53D6 action schema \u5931\u8D25",
|
|
3236
|
+
retry: "\u91CD\u8BD5",
|
|
3237
|
+
empty: "\u6CA1\u6709\u5339\u914D\u7684 action",
|
|
3238
|
+
emptyRegistry: "\u8BE5\u57DF\u6CA1\u6709\u6CE8\u518C action",
|
|
3239
|
+
envelope: "\u9ED8\u8BA4",
|
|
3240
|
+
enumLabel: "\u679A\u4E3E",
|
|
3241
|
+
range: "\u8303\u56F4",
|
|
3242
|
+
length: "\u957F\u5EA6",
|
|
3243
|
+
pattern: "\u6B63\u5219",
|
|
3244
|
+
format: "\u683C\u5F0F",
|
|
3245
|
+
items: "\u5143\u7D20\u6570"
|
|
3246
|
+
},
|
|
3247
|
+
en: {
|
|
3248
|
+
title: "Actions",
|
|
3249
|
+
hint: "runtime registry \xB7 read-only",
|
|
3250
|
+
domain: "Domain",
|
|
3251
|
+
versionLabel: "Version",
|
|
3252
|
+
shell: "Host",
|
|
3253
|
+
count: function(shown, total) {
|
|
3254
|
+
return shown + " / " + total + " actions";
|
|
3255
|
+
},
|
|
3256
|
+
search: "Search name, description, params (matches highlighted)",
|
|
3257
|
+
filterReq: "Required",
|
|
3258
|
+
all: "All",
|
|
3259
|
+
onlyRequired: "Has required",
|
|
3260
|
+
onlyOptional: "No required",
|
|
3261
|
+
filterType: "Param type",
|
|
3262
|
+
allTypes: "All types",
|
|
3263
|
+
colName: "Param",
|
|
3264
|
+
colType: "Type",
|
|
3265
|
+
colReq: "Required",
|
|
3266
|
+
colExtra: "Default / enum / constraints",
|
|
3267
|
+
colDesc: "Description",
|
|
3268
|
+
required: "required",
|
|
3269
|
+
optional: "optional",
|
|
3270
|
+
noParams: "No parameters",
|
|
3271
|
+
paramCount: function(n) {
|
|
3272
|
+
return n + " params";
|
|
3273
|
+
},
|
|
3274
|
+
examples: "Examples",
|
|
3275
|
+
noExamples: "No examples",
|
|
3276
|
+
copy: "Copy",
|
|
3277
|
+
copied: "Copied",
|
|
3278
|
+
raw: "Raw JSON Schema",
|
|
3279
|
+
loading: "Loading\u2026",
|
|
3280
|
+
loadFail: "Failed to read action schema",
|
|
3281
|
+
retry: "Retry",
|
|
3282
|
+
empty: "No matching action",
|
|
3283
|
+
emptyRegistry: "This domain has no registered action",
|
|
3284
|
+
envelope: "Default",
|
|
3285
|
+
enumLabel: "Enum",
|
|
3286
|
+
range: "Range",
|
|
3287
|
+
length: "Length",
|
|
3288
|
+
pattern: "Pattern",
|
|
3289
|
+
format: "Format",
|
|
3290
|
+
items: "Items"
|
|
3291
|
+
}
|
|
3292
|
+
};
|
|
3293
|
+
function typeLabel(schema) {
|
|
3294
|
+
if (!schema || typeof schema !== "object") return "";
|
|
3295
|
+
if (Array.isArray(schema.type)) return schema.type.join(" | ");
|
|
3296
|
+
if (typeof schema.type === "string") {
|
|
3297
|
+
if (schema.type === "array" && schema.items) {
|
|
3298
|
+
var inner = typeLabel(schema.items);
|
|
3299
|
+
return inner ? inner + "[]" : "array";
|
|
3300
|
+
}
|
|
3301
|
+
return schema.type;
|
|
3302
|
+
}
|
|
3303
|
+
if (Array.isArray(schema.oneOf)) return schema.oneOf.map(typeLabel).filter(Boolean).join(" | ");
|
|
3304
|
+
if (Array.isArray(schema.anyOf)) return schema.anyOf.map(typeLabel).filter(Boolean).join(" | ");
|
|
3305
|
+
return "";
|
|
3306
|
+
}
|
|
3307
|
+
function typeNames(schema) {
|
|
3308
|
+
var label = typeLabel(schema);
|
|
3309
|
+
if (!label) return [];
|
|
3310
|
+
return label.split("|").map(function(x) {
|
|
3311
|
+
return x.trim().replace(/\[\]$/, "");
|
|
3312
|
+
}).filter(Boolean);
|
|
3313
|
+
}
|
|
3314
|
+
function scalar(value) {
|
|
3315
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
3316
|
+
return String(value);
|
|
3317
|
+
}
|
|
3318
|
+
function extraText(schema, t) {
|
|
3319
|
+
if (!schema || typeof schema !== "object") return "";
|
|
3320
|
+
var parts = [];
|
|
3321
|
+
if (Object.prototype.hasOwnProperty.call(schema, "default")) {
|
|
3322
|
+
parts.push(t.envelope + " " + scalar(schema.default));
|
|
3323
|
+
}
|
|
3324
|
+
if (Array.isArray(schema.enum)) {
|
|
3325
|
+
parts.push(t.enumLabel + " " + schema.enum.map(scalar).join(" / "));
|
|
3326
|
+
}
|
|
3327
|
+
if (typeof schema.minimum === "number" || typeof schema.maximum === "number") {
|
|
3328
|
+
var lo = typeof schema.minimum === "number" ? schema.minimum : null;
|
|
3329
|
+
var hi = typeof schema.maximum === "number" ? schema.maximum : null;
|
|
3330
|
+
if (lo !== null && hi !== null) parts.push(t.range + " \u2265" + lo + " \u4E14 \u2264" + hi);
|
|
3331
|
+
else if (lo !== null) parts.push(t.range + " \u2265" + lo);
|
|
3332
|
+
else parts.push(t.range + " \u2264" + hi);
|
|
3333
|
+
}
|
|
3334
|
+
if (typeof schema.minLength === "number" || typeof schema.maxLength === "number") {
|
|
3335
|
+
parts.push(t.length + " " + (schema.minLength ?? 0) + "\u2013" + (schema.maxLength ?? "\u221E"));
|
|
3336
|
+
}
|
|
3337
|
+
if (typeof schema.minItems === "number" || typeof schema.maxItems === "number") {
|
|
3338
|
+
parts.push(t.items + " " + (schema.minItems ?? 0) + "\u2013" + (schema.maxItems ?? "\u221E"));
|
|
3339
|
+
}
|
|
3340
|
+
if (typeof schema.pattern === "string") parts.push(t.pattern + " " + schema.pattern);
|
|
3341
|
+
if (typeof schema.format === "string") parts.push(t.format + " " + schema.format);
|
|
3342
|
+
return parts.join(" \xB7 ");
|
|
3343
|
+
}
|
|
3344
|
+
function paramRows(action) {
|
|
3345
|
+
var input = action && action.input && typeof action.input === "object" ? action.input : {};
|
|
3346
|
+
var props = input.properties && typeof input.properties === "object" ? input.properties : {};
|
|
3347
|
+
var required = Array.isArray(input.required) ? input.required : [];
|
|
3348
|
+
return Object.keys(props).map(function(key) {
|
|
3349
|
+
var schema = props[key] && typeof props[key] === "object" ? props[key] : {};
|
|
3350
|
+
return {
|
|
3351
|
+
name: key,
|
|
3352
|
+
schema,
|
|
3353
|
+
type: typeLabel(schema),
|
|
3354
|
+
types: typeNames(schema),
|
|
3355
|
+
required: required.indexOf(key) >= 0,
|
|
3356
|
+
description: typeof schema.description === "string" ? schema.description : ""
|
|
3357
|
+
};
|
|
3358
|
+
});
|
|
3359
|
+
}
|
|
3360
|
+
module2.exports = function createActionSchemaView(options) {
|
|
3361
|
+
var raw = String(options.domain || "");
|
|
3362
|
+
var DOMAIN = raw.indexOf("wb-addon-") === 0 ? raw : "wb-addon-" + raw;
|
|
3363
|
+
var prefix = options.prefix;
|
|
3364
|
+
var P = prefix + "-as";
|
|
3365
|
+
var Icon2 = options.Icon || null;
|
|
3366
|
+
var injectCss = require_action_schema_style()(prefix, DOMAIN);
|
|
3367
|
+
var Highlight = createHighlight(P);
|
|
3368
|
+
function icon(name, size) {
|
|
3369
|
+
return Icon2 ? h(Icon2, { name, size: size || 14 }) : null;
|
|
3370
|
+
}
|
|
3371
|
+
function plainCopy(text) {
|
|
3372
|
+
if (typeof document === "undefined") return;
|
|
3373
|
+
var area = document.createElement("textarea");
|
|
3374
|
+
area.value = text;
|
|
3375
|
+
area.setAttribute("readonly", "readonly");
|
|
3376
|
+
area.style.position = "fixed";
|
|
3377
|
+
area.style.opacity = "0";
|
|
3378
|
+
document.body.appendChild(area);
|
|
3379
|
+
area.select();
|
|
3380
|
+
try {
|
|
3381
|
+
document.execCommand("copy");
|
|
3382
|
+
} catch (e) {
|
|
3383
|
+
}
|
|
3384
|
+
document.body.removeChild(area);
|
|
3385
|
+
}
|
|
3386
|
+
function ActionSchemaView(props) {
|
|
3387
|
+
var lang = props.lang === "en" ? "en" : "zh";
|
|
3388
|
+
var t = COPY[lang];
|
|
3389
|
+
var api = props.api;
|
|
3390
|
+
var snapState = React.useState(null);
|
|
3391
|
+
var snap = snapState[0], setSnap = snapState[1];
|
|
3392
|
+
var errState = React.useState("");
|
|
3393
|
+
var err = errState[0], setErr = errState[1];
|
|
3394
|
+
var loadingState = React.useState(true);
|
|
3395
|
+
var loading = loadingState[0], setLoading = loadingState[1];
|
|
3396
|
+
var reloadState = React.useState(0);
|
|
3397
|
+
var reload = reloadState[0], setReload = reloadState[1];
|
|
3398
|
+
var queryState = React.useState("");
|
|
3399
|
+
var query = queryState[0], setQuery = queryState[1];
|
|
3400
|
+
var reqState = React.useState("all");
|
|
3401
|
+
var reqMode = reqState[0], setReqMode = reqState[1];
|
|
3402
|
+
var typeState = React.useState("");
|
|
3403
|
+
var typePick = typeState[0], setTypePick = typeState[1];
|
|
3404
|
+
var toastState = React.useState("");
|
|
3405
|
+
var toast = toastState[0], setToast = toastState[1];
|
|
3406
|
+
React.useEffect(function() {
|
|
3407
|
+
injectCss();
|
|
3408
|
+
}, []);
|
|
3409
|
+
React.useEffect(function() {
|
|
3410
|
+
var alive = true;
|
|
3411
|
+
setLoading(true);
|
|
3412
|
+
setErr("");
|
|
3413
|
+
var pending;
|
|
3414
|
+
var actionName = DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
|
|
3415
|
+
if (api && typeof api.call === "function") {
|
|
3416
|
+
pending = Promise.resolve(api.call(actionName)).then(function(r) {
|
|
3417
|
+
if (r && r.ok === false) return r;
|
|
3418
|
+
return r && r.result || r;
|
|
3419
|
+
});
|
|
3420
|
+
} else {
|
|
3421
|
+
pending = Promise.reject(new Error("no call api"));
|
|
3422
|
+
}
|
|
3423
|
+
Promise.resolve(pending).then(function(r) {
|
|
3424
|
+
if (!alive) return;
|
|
3425
|
+
if (!r || r.ok === false) {
|
|
3426
|
+
setSnap(null);
|
|
3427
|
+
setErr(String(r && (r.error || r.text) || t.loadFail));
|
|
3428
|
+
} else {
|
|
3429
|
+
setSnap(r);
|
|
3430
|
+
}
|
|
3431
|
+
setLoading(false);
|
|
3432
|
+
}, function(e) {
|
|
3433
|
+
if (!alive) return;
|
|
3434
|
+
setSnap(null);
|
|
3435
|
+
setErr(String(e && e.message || e || t.loadFail));
|
|
3436
|
+
setLoading(false);
|
|
3437
|
+
});
|
|
3438
|
+
return function() {
|
|
3439
|
+
alive = false;
|
|
3440
|
+
};
|
|
3441
|
+
}, [reload]);
|
|
3442
|
+
function copy(text) {
|
|
3443
|
+
var done = function() {
|
|
3444
|
+
setToast(t.copied);
|
|
3445
|
+
};
|
|
3446
|
+
if (typeof navigator !== "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
|
|
3447
|
+
navigator.clipboard.writeText(text).then(done, function() {
|
|
3448
|
+
plainCopy(text);
|
|
3449
|
+
done();
|
|
3450
|
+
});
|
|
3451
|
+
return;
|
|
3452
|
+
}
|
|
3453
|
+
plainCopy(text);
|
|
3454
|
+
done();
|
|
3455
|
+
}
|
|
3456
|
+
var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
|
|
3457
|
+
return a && a.domain === DOMAIN;
|
|
3458
|
+
}) : [];
|
|
3459
|
+
var info = snap && Array.isArray(snap.domains) ? snap.domains.filter(function(d) {
|
|
3460
|
+
return d && d.id === DOMAIN;
|
|
3461
|
+
})[0] || null : null;
|
|
3462
|
+
var typeOptions = [];
|
|
3463
|
+
all.forEach(function(a) {
|
|
3464
|
+
paramRows(a).forEach(function(row) {
|
|
3465
|
+
row.types.forEach(function(name) {
|
|
3466
|
+
if (typeOptions.indexOf(name) < 0) typeOptions.push(name);
|
|
3467
|
+
});
|
|
3468
|
+
});
|
|
3469
|
+
});
|
|
3470
|
+
typeOptions.sort();
|
|
3471
|
+
var kw = String(query || "").trim();
|
|
3472
|
+
var q = kw.toLowerCase();
|
|
3473
|
+
var visible = all.filter(function(a) {
|
|
3474
|
+
var rows = paramRows(a);
|
|
3475
|
+
if (q) {
|
|
3476
|
+
var hay = [a.name || "", a.description || ""].concat(rows.map(function(row) {
|
|
3477
|
+
return row.name + " " + row.type + " " + row.description;
|
|
3478
|
+
})).join(" ").toLowerCase();
|
|
3479
|
+
if (hay.indexOf(q) < 0) return false;
|
|
3480
|
+
}
|
|
3481
|
+
var hasRequired = rows.some(function(row) {
|
|
3482
|
+
return row.required;
|
|
3483
|
+
});
|
|
3484
|
+
if (reqMode === "required" && !hasRequired) return false;
|
|
3485
|
+
if (reqMode === "optional" && hasRequired) return false;
|
|
3486
|
+
if (typePick && !rows.some(function(row) {
|
|
3487
|
+
return row.types.indexOf(typePick) >= 0;
|
|
3488
|
+
})) return false;
|
|
3489
|
+
return true;
|
|
3490
|
+
});
|
|
3491
|
+
function paramRow(row) {
|
|
3492
|
+
var extra = extraText(row.schema, t);
|
|
3493
|
+
return h(
|
|
3494
|
+
"tr",
|
|
3495
|
+
{ key: row.name },
|
|
3496
|
+
h("td", { className: P + "-mono" }, Highlight.hit(row.name, kw)),
|
|
3497
|
+
h("td", { className: P + "-mono" }, Highlight.hit(row.type, kw)),
|
|
3498
|
+
h("td", { className: row.required ? P + "-req" : P + "-opt" }, row.required ? t.required : t.optional),
|
|
3499
|
+
// extra(默认 / 枚举 / 约束)不在过滤 haystack 里,因此也不高亮,保持「显示即命中」口径。
|
|
3500
|
+
h("td", { className: P + "-mono" }, extra),
|
|
3501
|
+
h("td", null, Highlight.hit(row.description, kw))
|
|
3502
|
+
);
|
|
3503
|
+
}
|
|
3504
|
+
function card(action) {
|
|
3505
|
+
var rows = paramRows(action);
|
|
3506
|
+
var examples = Array.isArray(action.examples) ? action.examples : [];
|
|
3507
|
+
return h(
|
|
3508
|
+
"div",
|
|
3509
|
+
{ className: P + "-card", key: action.name },
|
|
3510
|
+
h(
|
|
3511
|
+
"div",
|
|
3512
|
+
{ className: P + "-cardhead" },
|
|
3513
|
+
h("code", { className: P + "-mono" }, Highlight.hit(action.name, kw)),
|
|
3514
|
+
// 域名在页头已展示一次,卡片内不再重复(所有条目必然同域,见 visible 过滤)。
|
|
3515
|
+
h("span", { className: P + "-badge" }, rows.length ? t.paramCount(rows.length) : t.noParams),
|
|
3516
|
+
rows.some(function(row) {
|
|
3517
|
+
return row.required;
|
|
3518
|
+
}) ? h("span", { className: P + "-badge " + P + "-req" }, t.required) : null
|
|
3519
|
+
),
|
|
3520
|
+
action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
|
|
3521
|
+
rows.length ? h(
|
|
3522
|
+
"table",
|
|
3523
|
+
{ className: P + "-table" },
|
|
3524
|
+
h("thead", null, h(
|
|
3525
|
+
"tr",
|
|
3526
|
+
null,
|
|
3527
|
+
h("th", null, t.colName),
|
|
3528
|
+
h("th", null, t.colType),
|
|
3529
|
+
h("th", null, t.colReq),
|
|
3530
|
+
h("th", null, t.colExtra),
|
|
3531
|
+
h("th", null, t.colDesc)
|
|
3532
|
+
)),
|
|
3533
|
+
h("tbody", null, rows.map(paramRow))
|
|
3534
|
+
) : h("div", { className: P + "-none" }, t.noParams),
|
|
3535
|
+
h(
|
|
3536
|
+
"div",
|
|
3537
|
+
{ className: P + "-example" },
|
|
3538
|
+
h(
|
|
3539
|
+
"div",
|
|
3540
|
+
{ className: P + "-examplehead" },
|
|
3541
|
+
h("span", { className: P + "-none" }, t.examples),
|
|
3542
|
+
examples.length ? h("button", {
|
|
3543
|
+
type: "button",
|
|
3544
|
+
className: P + "-copy",
|
|
3545
|
+
"data-copy-example": action.name,
|
|
3546
|
+
onClick: function() {
|
|
3547
|
+
copy(JSON.stringify(examples.length === 1 ? examples[0] : examples, null, 2));
|
|
3548
|
+
}
|
|
3549
|
+
}, t.copy) : null
|
|
3550
|
+
),
|
|
3551
|
+
examples.length ? examples.map(function(example, index) {
|
|
3552
|
+
return h("pre", { className: P + "-pre", key: index }, JSON.stringify(example, null, 2));
|
|
3553
|
+
}) : h("div", { className: P + "-none" }, t.noExamples)
|
|
3554
|
+
),
|
|
3555
|
+
h(
|
|
3556
|
+
"details",
|
|
3557
|
+
null,
|
|
3558
|
+
h("summary", null, t.raw),
|
|
3559
|
+
h("pre", { className: P + "-pre" }, JSON.stringify(action.input || {}, null, 2))
|
|
3560
|
+
)
|
|
3561
|
+
);
|
|
3562
|
+
}
|
|
3563
|
+
var body;
|
|
3564
|
+
if (loading) {
|
|
3565
|
+
body = h("div", { className: P + "-empty", role: "status" }, t.loading);
|
|
3566
|
+
} else if (err) {
|
|
3567
|
+
body = h(
|
|
3568
|
+
"div",
|
|
3569
|
+
{ className: P + "-error", role: "alert" },
|
|
3570
|
+
h("span", null, t.loadFail + "\uFF1A" + err),
|
|
3571
|
+
h("button", { type: "button", className: P + "-copy", onClick: function() {
|
|
3572
|
+
setReload(reload + 1);
|
|
3573
|
+
} }, t.retry)
|
|
3574
|
+
);
|
|
3575
|
+
} else if (!all.length) {
|
|
3576
|
+
body = h("div", { className: P + "-empty" }, t.emptyRegistry);
|
|
3577
|
+
} else if (!visible.length) {
|
|
3578
|
+
body = h("div", { className: P + "-empty" }, t.empty);
|
|
3579
|
+
} else {
|
|
3580
|
+
body = h("div", { className: P + "-list" }, visible.map(card));
|
|
3581
|
+
}
|
|
3582
|
+
return h(
|
|
3583
|
+
"div",
|
|
3584
|
+
{ className: P },
|
|
3585
|
+
h(
|
|
3586
|
+
"div",
|
|
3587
|
+
{ className: P + "-head" },
|
|
3588
|
+
h("h3", { className: P + "-title" }, t.title),
|
|
3589
|
+
h("span", { className: P + "-badge" }, t.domain + " " + DOMAIN),
|
|
3590
|
+
info && info.version ? h("span", { className: P + "-badge" }, t.versionLabel + " v" + info.version) : null,
|
|
3591
|
+
snap && snap.shellVersion ? h("span", { className: P + "-badge" }, t.shell + " v" + snap.shellVersion) : null,
|
|
3592
|
+
h("span", { className: P + "-badge" }, t.count(visible.length, all.length)),
|
|
3593
|
+
h("span", { className: P + "-none" }, t.hint)
|
|
3594
|
+
),
|
|
3595
|
+
snap ? h(
|
|
3596
|
+
"div",
|
|
3597
|
+
{ className: P + "-toolbar" },
|
|
3598
|
+
h(
|
|
3599
|
+
"label",
|
|
3600
|
+
{ className: P + "-search" },
|
|
3601
|
+
icon("search", 14),
|
|
3602
|
+
h("input", {
|
|
3603
|
+
type: "search",
|
|
3604
|
+
value: query,
|
|
3605
|
+
placeholder: t.search,
|
|
3606
|
+
"aria-label": t.search,
|
|
3607
|
+
onChange: function(e) {
|
|
3608
|
+
setQuery(e.target.value);
|
|
3609
|
+
}
|
|
3610
|
+
})
|
|
3611
|
+
),
|
|
3612
|
+
h(
|
|
3613
|
+
"label",
|
|
3614
|
+
{ className: P + "-none" },
|
|
3615
|
+
t.filterReq + " ",
|
|
3616
|
+
h(
|
|
3617
|
+
"select",
|
|
3618
|
+
{ value: reqMode, "aria-label": t.filterReq, onChange: function(e) {
|
|
3619
|
+
setReqMode(e.target.value);
|
|
3620
|
+
} },
|
|
3621
|
+
h("option", { value: "all" }, t.all),
|
|
3622
|
+
h("option", { value: "required" }, t.onlyRequired),
|
|
3623
|
+
h("option", { value: "optional" }, t.onlyOptional)
|
|
3624
|
+
)
|
|
3625
|
+
),
|
|
3626
|
+
h(
|
|
3627
|
+
"label",
|
|
3628
|
+
{ className: P + "-none" },
|
|
3629
|
+
t.filterType + " ",
|
|
3630
|
+
h(
|
|
3631
|
+
"select",
|
|
3632
|
+
{ value: typePick, "aria-label": t.filterType, onChange: function(e) {
|
|
3633
|
+
setTypePick(e.target.value);
|
|
3634
|
+
} },
|
|
3635
|
+
h("option", { value: "" }, t.allTypes),
|
|
3636
|
+
typeOptions.map(function(name) {
|
|
3637
|
+
return h("option", { value: name, key: name }, name);
|
|
3638
|
+
})
|
|
3639
|
+
)
|
|
3640
|
+
)
|
|
3641
|
+
) : null,
|
|
3642
|
+
body,
|
|
3643
|
+
toast ? h("div", { className: P + "-toast", role: "status" }, toast) : null
|
|
3644
|
+
);
|
|
3645
|
+
}
|
|
3646
|
+
return { ActionSchemaView, DOMAIN, typeLabel, paramRows };
|
|
3647
|
+
};
|
|
3648
|
+
}
|
|
3649
|
+
});
|
|
3650
|
+
|
|
3651
|
+
// packages/addons/message/client/views/actions.cjs
|
|
3652
|
+
var require_actions = __commonJS({
|
|
3653
|
+
"packages/addons/message/client/views/actions.cjs"(exports2, module2) {
|
|
3654
|
+
"use strict";
|
|
3655
|
+
module2.exports = require_action_schema_view()({
|
|
3656
|
+
domain: "message",
|
|
3657
|
+
prefix: "wbm"
|
|
3658
|
+
});
|
|
3659
|
+
}
|
|
3660
|
+
});
|
|
3661
|
+
|
|
3662
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/message-square.mjs
|
|
3663
|
+
var message_square_exports = {};
|
|
3664
|
+
__export(message_square_exports, {
|
|
3665
|
+
__iconData: () => __iconData25,
|
|
3666
|
+
default: () => MessageSquare
|
|
3667
|
+
});
|
|
3668
|
+
var __iconData25, MessageSquare;
|
|
3669
|
+
var init_message_square = __esm({
|
|
3670
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/message-square.mjs"() {
|
|
3671
|
+
init_createLucideIcon();
|
|
3672
|
+
__iconData25 = {
|
|
3673
|
+
name: "message-square",
|
|
3674
|
+
size: 24,
|
|
3675
|
+
node: [
|
|
3676
|
+
[
|
|
3677
|
+
"path",
|
|
3678
|
+
{
|
|
3679
|
+
d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
|
|
3680
|
+
key: "18887p"
|
|
3681
|
+
}
|
|
3682
|
+
]
|
|
3683
|
+
]
|
|
3684
|
+
};
|
|
3685
|
+
__iconData25.node;
|
|
3686
|
+
MessageSquare = createLucideIcon(__iconData25);
|
|
3687
|
+
}
|
|
3688
|
+
});
|
|
3689
|
+
|
|
3690
|
+
// packages/addons/message/client/client.src.cjs
|
|
3691
|
+
(function() {
|
|
3692
|
+
var root = typeof window !== "undefined" ? window : null;
|
|
3693
|
+
var host = root && root.__WB_HOST__;
|
|
3694
|
+
if (!host || !host.react) {
|
|
3695
|
+
if (typeof console !== "undefined") console.error("[dsh-workbench-message] \u5BBF\u4E3B\u524D\u7AEF\u672A\u5C31\u7EEA\uFF0C\u65E0\u6CD5\u6CE8\u518C\u63D2\u4EF6\u754C\u9762");
|
|
3696
|
+
module.exports = { name: "dsh-workbench-message", inject: [], apply: function() {
|
|
3697
|
+
} };
|
|
3698
|
+
return;
|
|
3699
|
+
}
|
|
3700
|
+
var React = host.react;
|
|
3701
|
+
var h = host.h;
|
|
3702
|
+
var ICONS = {
|
|
3703
|
+
bell: (init_bell(), __toCommonJS(bell_exports)).default,
|
|
3704
|
+
"bell-off": (init_bell_off(), __toCommonJS(bell_off_exports)).default,
|
|
3705
|
+
inbox: (init_inbox(), __toCommonJS(inbox_exports)).default,
|
|
3706
|
+
mail: (init_mail(), __toCommonJS(mail_exports)).default,
|
|
3707
|
+
"mail-open": (init_mail_open(), __toCommonJS(mail_open_exports)).default,
|
|
3708
|
+
chart: (init_chart_column(), __toCommonJS(chart_column_exports)).default,
|
|
3709
|
+
settings: (init_settings(), __toCommonJS(settings_exports)).default,
|
|
3710
|
+
database: (init_database(), __toCommonJS(database_exports)).default,
|
|
3711
|
+
list: (init_list(), __toCommonJS(list_exports)).default,
|
|
3712
|
+
check: (init_check(), __toCommonJS(check_exports)).default,
|
|
3713
|
+
"check-check": (init_check_check(), __toCommonJS(check_check_exports)).default,
|
|
3714
|
+
search: (init_search(), __toCommonJS(search_exports)).default,
|
|
3715
|
+
refresh: (init_refresh_cw(), __toCommonJS(refresh_cw_exports)).default,
|
|
3716
|
+
plus: (init_plus(), __toCommonJS(plus_exports)).default,
|
|
3717
|
+
volume: (init_volume_2(), __toCommonJS(volume_2_exports)).default,
|
|
3718
|
+
mute: (init_volume_x(), __toCommonJS(volume_x_exports)).default,
|
|
3719
|
+
moon: (init_moon(), __toCommonJS(moon_exports)).default,
|
|
3720
|
+
clock: (init_clock(), __toCommonJS(clock_exports)).default,
|
|
3721
|
+
info: (init_info(), __toCommonJS(info_exports)).default,
|
|
3722
|
+
success: (init_circle_check(), __toCommonJS(circle_check_exports)).default,
|
|
3723
|
+
warning: (init_triangle_alert(), __toCommonJS(triangle_alert_exports)).default,
|
|
3724
|
+
error: (init_circle_alert(), __toCommonJS(circle_alert_exports)).default,
|
|
3725
|
+
reset: (init_rotate_ccw(), __toCommonJS(rotate_ccw_exports)).default,
|
|
3726
|
+
play: (init_play(), __toCommonJS(play_exports)).default
|
|
3727
|
+
};
|
|
3728
|
+
function Icon2(props) {
|
|
3729
|
+
var C = ICONS[props.name] || ICONS.info;
|
|
3730
|
+
return h(C, { size: props.size || 14, strokeWidth: 2, "aria-hidden": "true", className: "wbg-svg" });
|
|
3731
|
+
}
|
|
3732
|
+
function tabIcon(name) {
|
|
3733
|
+
return function() {
|
|
3734
|
+
return h(Icon2, { name, size: 14 });
|
|
3735
|
+
};
|
|
3736
|
+
}
|
|
3737
|
+
var COPY = require_copy();
|
|
3738
|
+
var CSS = require_styles();
|
|
3739
|
+
var configView = require_config();
|
|
3740
|
+
var inboxFactory = require_inbox();
|
|
3741
|
+
var statsFactory = require_stats();
|
|
3742
|
+
var DataView = require_data().DataView;
|
|
3743
|
+
var ActionSchemaView = require_actions().ActionSchemaView;
|
|
3744
|
+
var notifier = require_notifier();
|
|
3745
|
+
var InboxView = inboxFactory({ React });
|
|
3746
|
+
var StatsView = statsFactory({ React });
|
|
3747
|
+
function langOf(props) {
|
|
3748
|
+
return props.lang === "en" ? "en" : "zh";
|
|
3749
|
+
}
|
|
3750
|
+
function withCopy(Inner, extra) {
|
|
3751
|
+
return function Wrapped(props) {
|
|
3752
|
+
var lang = langOf(props);
|
|
3753
|
+
var view = Object.assign(
|
|
3754
|
+
{ api: props.api, lang, t: COPY[lang], Icon: Icon2 },
|
|
3755
|
+
typeof extra === "function" ? extra(props) : extra || {}
|
|
3756
|
+
);
|
|
3757
|
+
return h(Inner, view);
|
|
3758
|
+
};
|
|
3759
|
+
}
|
|
3760
|
+
var Inbox2 = withCopy(InboxView, null);
|
|
3761
|
+
var Stats = withCopy(StatsView, null);
|
|
3762
|
+
var Config = withCopy(configView.ConfigView, null);
|
|
3763
|
+
function ensureStyles() {
|
|
3764
|
+
if (typeof document === "undefined" || !document.head) return;
|
|
3765
|
+
if (document.getElementById("wb-message-style")) return;
|
|
3766
|
+
var style = document.createElement("style");
|
|
3767
|
+
style.id = "wb-message-style";
|
|
3768
|
+
style.textContent = CSS;
|
|
3769
|
+
document.head.appendChild(style);
|
|
3770
|
+
}
|
|
3771
|
+
ensureStyles();
|
|
3772
|
+
host.registerAddon({
|
|
3773
|
+
id: "wb-addon-message",
|
|
3774
|
+
version: "0.1.0",
|
|
3775
|
+
icon: (init_message_square(), __toCommonJS(message_square_exports)).default,
|
|
3776
|
+
views: [
|
|
3777
|
+
{ id: "stats", icon: tabIcon("chart"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: Stats },
|
|
3778
|
+
{ id: "inbox", icon: tabIcon("inbox"), title: { zh: "\u6536\u4EF6\u7BB1", en: "Inbox" }, component: Inbox2 },
|
|
3779
|
+
{ id: "config", icon: tabIcon("settings"), title: { zh: "\u914D\u7F6E", en: "Config" }, component: Config },
|
|
3780
|
+
{ id: "data", icon: tabIcon("database"), title: { zh: "\u6570\u636E", en: "Data" }, component: DataView },
|
|
3781
|
+
{ id: "actions", icon: tabIcon("list"), title: { zh: "Action", en: "Actions" }, component: ActionSchemaView }
|
|
3782
|
+
]
|
|
3783
|
+
});
|
|
3784
|
+
try {
|
|
3785
|
+
notifier.start();
|
|
3786
|
+
} catch (e) {
|
|
3787
|
+
if (typeof console !== "undefined") console.warn("[dsh-workbench-message] \u63D0\u793A\u97F3\u542F\u52A8\u5931\u8D25", e);
|
|
3788
|
+
}
|
|
3789
|
+
module.exports = {
|
|
3790
|
+
name: "dsh-workbench-message",
|
|
3791
|
+
inject: [],
|
|
3792
|
+
apply: function() {
|
|
3793
|
+
}
|
|
3794
|
+
};
|
|
3795
|
+
})();
|
|
3796
|
+
return module.exports;
|
|
3797
|
+
},
|
|
3798
|
+
});
|