dsh-mobile-plugin 0.5.39 → 0.5.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/docs/extension-authoring.md +34 -2
- package/extensions/README.md +7 -3
- package/extensions/catalog.json +1 -8
- package/lib/client.js +1 -40
- package/lib/mobile/extension-data.js +8 -82
- package/lib/mobile/extension-dev.js +56 -0
- package/lib/mobile/permissions.js +2 -3
- package/lib/mobile/third-party-extensions.js +49 -2
- package/lib/mobile/uploads.js +3 -31
- package/lib/panel/index.html +11 -11
- package/lib/routes/control-plane.js +0 -41
- package/lib/routes/mobile-api.js +2 -14
- package/package.json +3 -1
- package/extensions/magpie/agentcompact.js +0 -104
- package/extensions/magpie/app.css +0 -4902
- package/extensions/magpie/app.js +0 -24474
- package/extensions/magpie/autobackup.js +0 -185
- package/extensions/magpie/autoresetown.js +0 -151
- package/extensions/magpie/balfound.js +0 -38
- package/extensions/magpie/boot.js +0 -23
- package/extensions/magpie/cfgblocked.js +0 -39
- package/extensions/magpie/checkinnow.js +0 -111
- package/extensions/magpie/claudemode.js +0 -92
- package/extensions/magpie/compat.js +0 -41
- package/extensions/magpie/context.css +0 -433
- package/extensions/magpie/context.js +0 -1576
- package/extensions/magpie/ctxtext.js +0 -223
- package/extensions/magpie/fonts.js +0 -42
- package/extensions/magpie/i18n.js +0 -18942
- package/extensions/magpie/icons/ai21.svg +0 -1
- package/extensions/magpie/icons/ai302-color.svg +0 -1
- package/extensions/magpie/icons/ai360-color.svg +0 -1
- package/extensions/magpie/icons/aihubmix-color.svg +0 -1
- package/extensions/magpie/icons/aionui.svg +0 -1
- package/extensions/magpie/icons/air.svg +0 -4
- package/extensions/magpie/icons/alibaba-color.svg +0 -1
- package/extensions/magpie/icons/alibabacloud-color.svg +0 -1
- package/extensions/magpie/icons/alma.png +0 -0
- package/extensions/magpie/icons/anthropic.svg +0 -1
- package/extensions/magpie/icons/antigravity-color.svg +0 -1
- package/extensions/magpie/icons/anyscale-color.svg +0 -1
- package/extensions/magpie/icons/app-alma.png +0 -0
- package/extensions/magpie/icons/app-cc-switch.png +0 -0
- package/extensions/magpie/icons/apple-touch-icon.png +0 -0
- package/extensions/magpie/icons/aside.svg +0 -28
- package/extensions/magpie/icons/astrbot.svg +0 -1
- package/extensions/magpie/icons/atomcode.png +0 -0
- package/extensions/magpie/icons/aws.svg +0 -1
- package/extensions/magpie/icons/azure-color.svg +0 -1
- package/extensions/magpie/icons/azureai-color.svg +0 -1
- package/extensions/magpie/icons/baichuan-color.svg +0 -1
- package/extensions/magpie/icons/baidu-color.svg +0 -1
- package/extensions/magpie/icons/baiducloud-color.svg +0 -1
- package/extensions/magpie/icons/bailian-color.svg +0 -1
- package/extensions/magpie/icons/baseten.svg +0 -1
- package/extensions/magpie/icons/bedrock-color.svg +0 -1
- package/extensions/magpie/icons/burncloud-color.svg +0 -1
- package/extensions/magpie/icons/bytedance-color.svg +0 -1
- package/extensions/magpie/icons/cerebras.svg +0 -1
- package/extensions/magpie/icons/chatglm-color.svg +0 -1
- package/extensions/magpie/icons/cherryin-color.svg +0 -1
- package/extensions/magpie/icons/chutes.svg +0 -1
- package/extensions/magpie/icons/cindy.png +0 -0
- package/extensions/magpie/icons/claude-color.svg +0 -1
- package/extensions/magpie/icons/claudecode-color.svg +0 -1
- package/extensions/magpie/icons/cline.svg +0 -1
- package/extensions/magpie/icons/cloudflare-color.svg +0 -1
- package/extensions/magpie/icons/codebuddy-color.svg +0 -1
- package/extensions/magpie/icons/codex-color.svg +0 -1
- package/extensions/magpie/icons/cohere-color.svg +0 -1
- package/extensions/magpie/icons/cometapi-color.svg +0 -1
- package/extensions/magpie/icons/commandcode.svg +0 -1
- package/extensions/magpie/icons/copilot-color.svg +0 -1
- package/extensions/magpie/icons/coze.svg +0 -1
- package/extensions/magpie/icons/crush.png +0 -0
- package/extensions/magpie/icons/curl.svg +0 -1
- package/extensions/magpie/icons/cursor.svg +0 -1
- package/extensions/magpie/icons/deepinfra-color.svg +0 -1
- package/extensions/magpie/icons/deepmind-color.svg +0 -1
- package/extensions/magpie/icons/deepseek-color.svg +0 -1
- package/extensions/magpie/icons/deveco-color.svg +0 -12
- package/extensions/magpie/icons/devin.svg +0 -1
- package/extensions/magpie/icons/doubao-color.svg +0 -1
- package/extensions/magpie/icons/empryo-color.svg +0 -1
- package/extensions/magpie/icons/factory.svg +0 -1
- package/extensions/magpie/icons/favicon.svg +0 -1
- package/extensions/magpie/icons/featherless-color.svg +0 -1
- package/extensions/magpie/icons/fireworks-color.svg +0 -1
- package/extensions/magpie/icons/friendli.svg +0 -1
- package/extensions/magpie/icons/fx.svg +0 -1
- package/extensions/magpie/icons/gemini-color.svg +0 -1
- package/extensions/magpie/icons/geminicli-color.svg +0 -1
- package/extensions/magpie/icons/gemma-color.svg +0 -1
- package/extensions/magpie/icons/giteeai.svg +0 -1
- package/extensions/magpie/icons/github.svg +0 -1
- package/extensions/magpie/icons/githubcopilot.svg +0 -1
- package/extensions/magpie/icons/glama.svg +0 -1
- package/extensions/magpie/icons/gmicloud.svg +0 -1
- package/extensions/magpie/icons/google-color.svg +0 -1
- package/extensions/magpie/icons/googlecloud-color.svg +0 -1
- package/extensions/magpie/icons/goose.svg +0 -1
- package/extensions/magpie/icons/grok.svg +0 -1
- package/extensions/magpie/icons/groq.svg +0 -1
- package/extensions/magpie/icons/hanako.png +0 -0
- package/extensions/magpie/icons/hermes.svg +0 -1
- package/extensions/magpie/icons/huawei-color.svg +0 -1
- package/extensions/magpie/icons/huaweicloud-color.svg +0 -1
- package/extensions/magpie/icons/huggingface-color.svg +0 -1
- package/extensions/magpie/icons/hunyuan-color.svg +0 -1
- package/extensions/magpie/icons/hyperbolic-color.svg +0 -1
- package/extensions/magpie/icons/icon-512.png +0 -0
- package/extensions/magpie/icons/iflytekcloud-color.svg +0 -1
- package/extensions/magpie/icons/inference.svg +0 -1
- package/extensions/magpie/icons/infinigence-color.svg +0 -1
- package/extensions/magpie/icons/internlm-color.svg +0 -1
- package/extensions/magpie/icons/jcode.svg +0 -1
- package/extensions/magpie/icons/jina.svg +0 -1
- package/extensions/magpie/icons/kilo.svg +0 -1
- package/extensions/magpie/icons/kilocode.svg +0 -1
- package/extensions/magpie/icons/kimi-code-desktop.png +0 -0
- package/extensions/magpie/icons/kimi.svg +0 -1
- package/extensions/magpie/icons/kiro-color.svg +0 -1
- package/extensions/magpie/icons/kling-color.svg +0 -1
- package/extensions/magpie/icons/lambda.svg +0 -1
- package/extensions/magpie/icons/leptonai-color.svg +0 -1
- package/extensions/magpie/icons/liquid.svg +0 -1
- package/extensions/magpie/icons/liveagent-color.svg +0 -1
- package/extensions/magpie/icons/llmapi.svg +0 -1
- package/extensions/magpie/icons/lmstudio.svg +0 -1
- package/extensions/magpie/icons/lody.png +0 -0
- package/extensions/magpie/icons/longcat.svg +0 -1
- package/extensions/magpie/icons/magpie.svg +0 -1
- package/extensions/magpie/icons/meta-color.svg +0 -1
- package/extensions/magpie/icons/metaai-color.svg +0 -1
- package/extensions/magpie/icons/microsoft-color.svg +0 -1
- package/extensions/magpie/icons/mimocode.svg +0 -1
- package/extensions/magpie/icons/minimax-color.svg +0 -1
- package/extensions/magpie/icons/mistermorph-color.svg +0 -1
- package/extensions/magpie/icons/mistral-color.svg +0 -1
- package/extensions/magpie/icons/mlx-serve.png +0 -0
- package/extensions/magpie/icons/modelscope-color.svg +0 -1
- package/extensions/magpie/icons/monica-color.svg +0 -1
- package/extensions/magpie/icons/moonshot.svg +0 -1
- package/extensions/magpie/icons/morph-color.svg +0 -1
- package/extensions/magpie/icons/mothx.png +0 -0
- package/extensions/magpie/icons/nebius.svg +0 -1
- package/extensions/magpie/icons/newapi-color.svg +0 -1
- package/extensions/magpie/icons/nousresearch.svg +0 -1
- package/extensions/magpie/icons/nova-color.svg +0 -1
- package/extensions/magpie/icons/novita-color.svg +0 -1
- package/extensions/magpie/icons/nvidia-color.svg +0 -1
- package/extensions/magpie/icons/ollama.svg +0 -1
- package/extensions/magpie/icons/omlx.svg +0 -1
- package/extensions/magpie/icons/omo.svg +0 -1
- package/extensions/magpie/icons/omp.svg +0 -1
- package/extensions/magpie/icons/openai.svg +0 -1
- package/extensions/magpie/icons/openchamber.svg +0 -11
- package/extensions/magpie/icons/openclaw.svg +0 -1
- package/extensions/magpie/icons/opencode.svg +0 -1
- package/extensions/magpie/icons/openmausbot.svg +0 -1
- package/extensions/magpie/icons/openrouter.svg +0 -1
- package/extensions/magpie/icons/openwebui.svg +0 -1
- package/extensions/magpie/icons/parasail.svg +0 -1
- package/extensions/magpie/icons/penguin-color.svg +0 -1
- package/extensions/magpie/icons/perplexity-color.svg +0 -1
- package/extensions/magpie/icons/phala-color.svg +0 -1
- package/extensions/magpie/icons/pi.svg +0 -1
- package/extensions/magpie/icons/pipellm-color.svg +0 -5
- package/extensions/magpie/icons/poe.svg +0 -1
- package/extensions/magpie/icons/ppio-color.svg +0 -1
- package/extensions/magpie/icons/prime-agent.svg +0 -1
- package/extensions/magpie/icons/qiniu-color.svg +0 -1
- package/extensions/magpie/icons/qoder.svg +0 -1
- package/extensions/magpie/icons/qwen-color.svg +0 -1
- package/extensions/magpie/icons/qwenpaw.svg +0 -1
- package/extensions/magpie/icons/raycast.svg +0 -1
- package/extensions/magpie/icons/reasonix-color.svg +0 -48
- package/extensions/magpie/icons/reka.svg +0 -1
- package/extensions/magpie/icons/replicate.svg +0 -1
- package/extensions/magpie/icons/roocode.svg +0 -1
- package/extensions/magpie/icons/rtk.png +0 -0
- package/extensions/magpie/icons/sambanova-color.svg +0 -1
- package/extensions/magpie/icons/sensenova-color.svg +0 -1
- package/extensions/magpie/icons/siliconcloud-color.svg +0 -1
- package/extensions/magpie/icons/snow.png +0 -0
- package/extensions/magpie/icons/snowflake-color.svg +0 -1
- package/extensions/magpie/icons/sophnet-color.svg +0 -1
- package/extensions/magpie/icons/spark-color.svg +0 -1
- package/extensions/magpie/icons/stepfun-color.svg +0 -1
- package/extensions/magpie/icons/straico-color.svg +0 -1
- package/extensions/magpie/icons/submodel-color.svg +0 -1
- package/extensions/magpie/icons/t3code.svg +0 -4
- package/extensions/magpie/icons/targon-color.svg +0 -1
- package/extensions/magpie/icons/tencent-color.svg +0 -1
- package/extensions/magpie/icons/tencentcloud-color.svg +0 -1
- package/extensions/magpie/icons/tiangong-color.svg +0 -1
- package/extensions/magpie/icons/together-color.svg +0 -1
- package/extensions/magpie/icons/trae.svg +0 -1
- package/extensions/magpie/icons/typesafe.png +0 -0
- package/extensions/magpie/icons/upstage-color.svg +0 -1
- package/extensions/magpie/icons/venice-color.svg +0 -1
- package/extensions/magpie/icons/vercel.svg +0 -1
- package/extensions/magpie/icons/vertexai-color.svg +0 -1
- package/extensions/magpie/icons/vllm-color.svg +0 -1
- package/extensions/magpie/icons/volcengine-color.svg +0 -1
- package/extensions/magpie/icons/voyage-color.svg +0 -1
- package/extensions/magpie/icons/vscode.svg +0 -1
- package/extensions/magpie/icons/wenxin-color.svg +0 -1
- package/extensions/magpie/icons/windsurf.svg +0 -1
- package/extensions/magpie/icons/workbuddy-color.svg +0 -1
- package/extensions/magpie/icons/workersai-color.svg +0 -1
- package/extensions/magpie/icons/xai.svg +0 -1
- package/extensions/magpie/icons/xiaomimimo.svg +0 -1
- package/extensions/magpie/icons/xinference-color.svg +0 -1
- package/extensions/magpie/icons/yi.svg +0 -1
- package/extensions/magpie/icons/yuanbao-color.svg +0 -1
- package/extensions/magpie/icons/yylx.svg +0 -5
- package/extensions/magpie/icons/zai.svg +0 -1
- package/extensions/magpie/icons/zcode.png +0 -0
- package/extensions/magpie/icons/zed.svg +0 -1
- package/extensions/magpie/icons/zenmux.svg +0 -1
- package/extensions/magpie/icons/zeroone.svg +0 -1
- package/extensions/magpie/icons/zhipu-color.svg +0 -1
- package/extensions/magpie/icons/zoo-code.png +0 -0
- package/extensions/magpie/index.html +0 -572
- package/extensions/magpie/kernel.js +0 -274
- package/extensions/magpie/keyspend.js +0 -63
- package/extensions/magpie/layout.js +0 -26
- package/extensions/magpie/manifest.json +0 -37
- package/extensions/magpie/navlamp.js +0 -47
- package/extensions/magpie/omarchy.css +0 -72
- package/extensions/magpie/omarchy.js +0 -46
- package/extensions/magpie/passerrors.js +0 -21
- package/extensions/magpie/pluginpages.js +0 -405
- package/extensions/magpie/plugins/gateway/client.js +0 -1194
- package/extensions/magpie/plugins/gateway/keys.js +0 -972
- package/extensions/magpie/plugins/gateway/settings.js +0 -459
- package/extensions/magpie/plugins/library/client.js +0 -6788
- package/extensions/magpie/plugins/library/i18n.js +0 -3228
- package/extensions/magpie/plugins/library/library.css +0 -848
- package/extensions/magpie/plugins/otel/i18n.js +0 -48
- package/extensions/magpie/plugins/otel/page.js +0 -189
- package/extensions/magpie/plugins/redact/client.js +0 -46
- package/extensions/magpie/plugins/redact/demo.js +0 -461
- package/extensions/magpie/plugins/redact/i18n.js +0 -432
- package/extensions/magpie/plugins/redact/page.js +0 -985
- package/extensions/magpie/plugins/redact/redact.css +0 -385
- package/extensions/magpie/plugins/redact/settings.js +0 -248
- package/extensions/magpie/plugins/redact/xq_dark.jpg +0 -0
- package/extensions/magpie/plugins/redact/xq_dark.webm +0 -0
- package/extensions/magpie/plugins/redact/xq_light.jpg +0 -0
- package/extensions/magpie/plugins/redact/xq_light.webm +0 -0
- package/extensions/magpie/plugins/routing/client.js +0 -8593
- package/extensions/magpie/plugins/routing/i18n.js +0 -2696
- package/extensions/magpie/plugins/routing/routing.css +0 -1111
- package/extensions/magpie/plugins/search/settings.js +0 -460
- package/extensions/magpie/plugins/sessions/client.js +0 -1622
- package/extensions/magpie/plugins/sessions/i18n.js +0 -360
- package/extensions/magpie/plugins/sessions/sessions.css +0 -181
- package/extensions/magpie/plugins/sessions/settings.js +0 -100
- package/extensions/magpie/plugins/usage/client.js +0 -150
- package/extensions/magpie/plugins/usage/i18n.js +0 -984
- package/extensions/magpie/plugins/usage/page.js +0 -4307
- package/extensions/magpie/plugins.css +0 -319
- package/extensions/magpie/plugins.js +0 -1926
- package/extensions/magpie/profilerename.js +0 -27
- package/extensions/magpie/purposes.js +0 -2
- package/extensions/magpie/quitask.js +0 -79
- package/extensions/magpie/quotaall.js +0 -142
- package/extensions/magpie/ratewindows.js +0 -123
- package/extensions/magpie/registry.js +0 -87
- package/extensions/magpie/resetask.js +0 -137
- package/extensions/magpie/ruleedit.js +0 -53
- package/extensions/magpie/scrollends.js +0 -91
- package/extensions/magpie/settingshints.js +0 -75
- package/extensions/magpie/signsheets.js +0 -86
- package/extensions/magpie/start.js +0 -26
- package/extensions/magpie/syncfiles.js +0 -216
- package/extensions/magpie/theme.js +0 -29
- package/extensions/magpie/traywindows.js +0 -41
- package/extensions/magpie/webfonts.js +0 -130
- package/extensions/magpie/whatsnew.js +0 -252
- package/extensions/magpie.zip +0 -0
- package/lib/canvas-app.html +0 -442
- package/lib/mobile/canvas-store.js +0 -365
- package/lib/mobile/magpie-web.js +0 -425
- package/lib/routes/canvas-desktop.js +0 -196
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// A browser tab's fonts: the ones on the computer the browser runs on,
|
|
2
|
-
// which may not be the one magpie runs on (Norcleeh on Discord: magpie in
|
|
3
|
-
// Docker, its web GUI listed the container's fonts, never his own). Only
|
|
4
|
-
// a tab loads this (app.js loadFonts imports it); the app's windows list the
|
|
5
|
-
// installed fonts magpie reads itself.
|
|
6
|
-
//
|
|
7
|
-
// A tab's list is the server's families it draws, plus:
|
|
8
|
-
// - its computer's own, from the Local Font Access API (Chromium, on
|
|
9
|
-
// https or localhost), asked the first time the family menu is opened,
|
|
10
|
-
// since it needs a press and asks the user's permission once; read at
|
|
11
|
-
// once when that permission is already given;
|
|
12
|
-
// - the families chosen in this tab (kept in localStorage by fonts.js);
|
|
13
|
-
// - any family typed into the menu's search that this browser draws, for
|
|
14
|
-
// Safari, Firefox, a plain-http address or a refused permission.
|
|
15
|
-
// "Draws" is a canvas probe: text in the family measures apart from
|
|
16
|
-
// monospace's or serif's.
|
|
17
|
-
window.webFonts = (() => {
|
|
18
|
-
let ctx, local = null, asked = false, base = [];
|
|
19
|
-
const extra = [], seen = new Map();
|
|
20
|
-
const quoted = window.desktopFonts.quoted;
|
|
21
|
-
// The two generics' widths are measured once: each family then costs one
|
|
22
|
-
// or two measures, not two or four.
|
|
23
|
-
let generic;
|
|
24
|
-
const width = (f) => (ctx.font = "72px " + f, ctx.measureText("mmmlli WwQ@ 0123 中文").width);
|
|
25
|
-
function drawn(name) {
|
|
26
|
-
if (!seen.has(name)) {
|
|
27
|
-
ctx ||= document.createElement("canvas").getContext("2d");
|
|
28
|
-
generic ||= ["monospace", "serif"].map((b) => [b, width(b)]);
|
|
29
|
-
seen.set(name, !!name && generic.some(([b, w]) => width(quoted(name) + "," + b) !== w));
|
|
30
|
-
}
|
|
31
|
-
return seen.get(name);
|
|
32
|
-
}
|
|
33
|
-
const face = (family, name = "Regular", weight = 400, style = "normal", stretch = 100) => ({ family, name, weight, style, stretch });
|
|
34
|
-
const regular = (family) => [face(family), face(family, "Bold", 700)];
|
|
35
|
-
const same = window.desktopFonts.same;
|
|
36
|
-
// a face's CSS traits from the style name the system gives it
|
|
37
|
-
// ("SemiBold Condensed Italic")
|
|
38
|
-
const first = (rules, s, d) => (rules.find(([re]) => re.test(s)) || [, d])[1];
|
|
39
|
-
const WEIGHTS = [[/thin|hairline/, 100], [/(extra|ultra)-?light/, 200], [/light/, 300], [/(semi|demi)-?bold/, 600],
|
|
40
|
-
[/(extra|ultra)-?bold/, 800], [/black|heavy/, 900], [/medium/, 500], [/bold/, 700]];
|
|
41
|
-
const STRETCHES = [[/ultra-?condensed/, 50], [/extra-?condensed/, 62.5], [/semi-?condensed/, 87.5], [/condensed|narrow/, 75],
|
|
42
|
-
[/semi-?expanded/, 112.5], [/extra-?expanded/, 150], [/ultra-?expanded/, 200], [/expanded|wide/, 125]];
|
|
43
|
-
function group(data) {
|
|
44
|
-
const fams = new Map();
|
|
45
|
-
for (const d of data) {
|
|
46
|
-
if (!d.family) continue;
|
|
47
|
-
const s = String(d.style || "").toLowerCase().replace(/\s+/g, "");
|
|
48
|
-
const f = face(d.family, d.style || "Regular", first(WEIGHTS, s, 400), /italic/.test(s) ? "italic" : /oblique/.test(s) ? "oblique" : "normal", first(STRETCHES, s, 100));
|
|
49
|
-
const styles = fams.get(d.family) || [];
|
|
50
|
-
if (!styles.some((o) => o.weight === f.weight && o.style === f.style && o.stretch === f.stretch)) styles.push(f);
|
|
51
|
-
fams.set(d.family, styles);
|
|
52
|
-
}
|
|
53
|
-
return [...fams].map(([name, styles]) => ({ name, styles: styles.sort((a, b) => a.weight - b.weight || (a.style > b.style) - (a.style < b.style) || a.stretch - b.stretch) }));
|
|
54
|
-
}
|
|
55
|
-
function merge() {
|
|
56
|
-
const out = new Map();
|
|
57
|
-
for (const f of [...base, ...(local || []), ...extra]) out.set(f.name, f);
|
|
58
|
-
const own = window.desktopFonts.own() || {};
|
|
59
|
-
for (const c of [own.uiFont, own.codeFont]) {
|
|
60
|
-
if (typeof c?.family !== "string" || !drawn(c.family)) continue;
|
|
61
|
-
const f = out.get(c.family) || { name: c.family, styles: regular(c.family) };
|
|
62
|
-
out.set(c.family, f.styles.some((s) => same(s, c)) ? f : { ...f, styles: [...f.styles, c] });
|
|
63
|
-
}
|
|
64
|
-
return [...out.values()].sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
|
65
|
-
}
|
|
66
|
-
// called in the press that opens the menu: queryLocalFonts needs it
|
|
67
|
-
async function read() {
|
|
68
|
-
local = group(await window.queryLocalFonts());
|
|
69
|
-
}
|
|
70
|
-
// list: the tab's families, from the server's (/api/fonts)
|
|
71
|
-
// The probe yields every few milliseconds: a measure of a family not yet
|
|
72
|
-
// drawn loads it, and probing a Mac's whole list at once held the click
|
|
73
|
-
// that opened Settings in one task, 2.6 s with the CPU slowed 4x.
|
|
74
|
-
async function list(server) {
|
|
75
|
-
const out = [];
|
|
76
|
-
let start = performance.now();
|
|
77
|
-
for (const f of server) {
|
|
78
|
-
if (drawn(f.name)) out.push(f);
|
|
79
|
-
if (performance.now() - start > 8) await new Promise((r) => setTimeout(r)), start = performance.now();
|
|
80
|
-
}
|
|
81
|
-
base = out;
|
|
82
|
-
if (!asked && window.queryLocalFonts) try {
|
|
83
|
-
if ((await navigator.permissions.query({ name: "local-fonts" })).state === "granted") await read(), asked = true;
|
|
84
|
-
} catch {}
|
|
85
|
-
return merge();
|
|
86
|
-
}
|
|
87
|
-
// ask: the first time a family menu opens where the browser can tell
|
|
88
|
-
// this computer's fonts, they join the list (app.js fontList)
|
|
89
|
-
const catalogue = () => window.desktopFonts.catalogue(fontList = merge());
|
|
90
|
-
function ask() {
|
|
91
|
-
if (asked || !window.queryLocalFonts) return;
|
|
92
|
-
asked = true; // a refusal isn't asked again on this page
|
|
93
|
-
return read().then(catalogue, () => {});
|
|
94
|
-
}
|
|
95
|
-
// typing: the open family menu's search also takes a family the list
|
|
96
|
-
// lacks; it is offered when this browser draws it, and chosen for key
|
|
97
|
-
function typing(key) {
|
|
98
|
-
const box = protoMenu?.box, q = box?.querySelector(".sc-q");
|
|
99
|
-
if (!q) return;
|
|
100
|
-
q.placeholder = t("Search or type a font name…");
|
|
101
|
-
q.setAttribute("aria-label", q.placeholder);
|
|
102
|
-
const b = el("button", "pm-item typed-font"), words = el("span", "pm-words"), name = el("span", "pm-name"), note = el("span", "pm-note");
|
|
103
|
-
b.type = "button";
|
|
104
|
-
b.hidden = true;
|
|
105
|
-
words.append(name, note);
|
|
106
|
-
b.append(el("span", "pm-tick"), words);
|
|
107
|
-
box.lastChild.before(b); // above Refresh fonts
|
|
108
|
-
hoverFocus(b);
|
|
109
|
-
let family = "";
|
|
110
|
-
q.addEventListener("input", () => {
|
|
111
|
-
family = q.value.trim();
|
|
112
|
-
const low = family.toLowerCase(), ok = drawn(family);
|
|
113
|
-
b.hidden = !family || (fontList || []).some((f) => f.name.toLowerCase() === low);
|
|
114
|
-
b.disabled = !ok;
|
|
115
|
-
name.textContent = t("Use “{name}”", { name: family });
|
|
116
|
-
note.textContent = ok ? "" : t("This browser can't find this font");
|
|
117
|
-
});
|
|
118
|
-
// Enter takes it when no listed family matched (app.js took that one)
|
|
119
|
-
q.addEventListener("keydown", (e) => { if (e.key === "Enter" && !e.defaultPrevented && !b.hidden && !b.disabled) b.click(); });
|
|
120
|
-
b.onclick = (e) => {
|
|
121
|
-
e.stopPropagation();
|
|
122
|
-
closeProtoMenu();
|
|
123
|
-
const styles = regular(family);
|
|
124
|
-
extra.push({ name: family, styles });
|
|
125
|
-
catalogue();
|
|
126
|
-
chooseFont(key, styles[0]);
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
return { list, ask, typing, drawn };
|
|
130
|
-
})();
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
// The release notes' dialogs: What's new (after an update, and Settings'
|
|
2
|
-
// row) and the ask before an update is put in. app.js imports this when
|
|
3
|
-
// one opens (notesJS), so it weighs nothing on the core.
|
|
4
|
-
// wnRange is Settings' pick of which notes (Linka): since the last update,
|
|
5
|
-
// or this version and 10, 20, 50 or 100 before it
|
|
6
|
-
function wnRange(last) {
|
|
7
|
-
const name = (v) => v ? t("This version and {n} before", { n: v }) : t("Since the last update");
|
|
8
|
-
const b = el("button", "sess-pick wn-range");
|
|
9
|
-
b.type = "button";
|
|
10
|
-
b.setAttribute("aria-haspopup", "menu");
|
|
11
|
-
b.append(el("span", "", name(last)), svg(CHEV, 11, 1.6));
|
|
12
|
-
b.onclick = (e) => {
|
|
13
|
-
e.stopPropagation();
|
|
14
|
-
if (b.classList.contains("open")) return closeProtoMenu();
|
|
15
|
-
openProtoMenu(b, ["", "10", "20", "50", "100"].map((v) => ({ v, name: name(v), note: "", literalName: true })), last, (v) => v !== last && openWhatsNew(b, v), "Release notes shown", "sess-menu", "right");
|
|
16
|
-
};
|
|
17
|
-
return b;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// auto: shown by itself after an update, with "Don't show again today"
|
|
21
|
-
// (#525: releases come many a day); Settings' row opens it without one.
|
|
22
|
-
// more (from Settings): failed, the current version's notes couldn't be
|
|
23
|
-
// had, retry asks again; current and url, the version and its release
|
|
24
|
-
// page, for a dialog with no notes.
|
|
25
|
-
function showWhatsNew(releases, auto, more = {}) {
|
|
26
|
-
const ed = el("div", "editor whatsnew");
|
|
27
|
-
const head = el("div", "ehead");
|
|
28
|
-
head.append(el("b", "", t("What's new in {v}", { v: "v" + (releases[0]?.version || more.current) })));
|
|
29
|
-
if (!auto) head.append(el("span", "grow"), wnRange(more.last || ""));
|
|
30
|
-
ed.append(head);
|
|
31
|
-
if (releases.length > 1) {
|
|
32
|
-
const sec = el("section", "wn-rel");
|
|
33
|
-
const wait = releases.filter((r) => r.pending);
|
|
34
|
-
if (wait.length) {
|
|
35
|
-
const h = el("div", "wn-ver");
|
|
36
|
-
h.append(el("b", "", "v" + wait.at(-1).version + (wait.length > 1 ? " – v" + wait[0].version : "")), el("span", "badge", t("Not installed yet")));
|
|
37
|
-
sec.append(h);
|
|
38
|
-
}
|
|
39
|
-
sec.append(mergedNotes(releases, more.total));
|
|
40
|
-
ed.append(sec);
|
|
41
|
-
}
|
|
42
|
-
else for (const r of releases) {
|
|
43
|
-
const sec = el("section", "wn-rel");
|
|
44
|
-
const h = el("div", "wn-ver");
|
|
45
|
-
h.append(el("b", "", "v" + r.version));
|
|
46
|
-
if (r.pending) h.append(el("span", "badge", t("Not installed yet")));
|
|
47
|
-
sec.append(h, noteBlocks(r.notes));
|
|
48
|
-
ed.append(sec);
|
|
49
|
-
}
|
|
50
|
-
if (more.failed || !releases.length) {
|
|
51
|
-
const sec = el("section", "wn-rel wn-none" + (more.failed ? " wn-failed" : ""));
|
|
52
|
-
const h = el("div", "wn-ver");
|
|
53
|
-
if (more.current) h.append(el("b", "", "v" + more.current));
|
|
54
|
-
const p = el("p", "wn-msg", more.failed ? t("Couldn't load the release notes") : t("No release notes provided."));
|
|
55
|
-
const acts = el("div", "wn-acts");
|
|
56
|
-
if (more.failed && more.retry) {
|
|
57
|
-
const again = el("button", "text", t("Try again"));
|
|
58
|
-
again.onclick = async (e) => {
|
|
59
|
-
e.stopPropagation();
|
|
60
|
-
again.disabled = true;
|
|
61
|
-
again.classList.add("busy");
|
|
62
|
-
await more.retry();
|
|
63
|
-
};
|
|
64
|
-
acts.append(again);
|
|
65
|
-
}
|
|
66
|
-
if (more.url) acts.append(noteLink(t("Open the release page"), more.url));
|
|
67
|
-
sec.append(h, p, acts);
|
|
68
|
-
head.after(sec); // above the notes kept from before
|
|
69
|
-
}
|
|
70
|
-
const bar = el("div", "bar");
|
|
71
|
-
const ok = el("button", "text primary", t("Close"));
|
|
72
|
-
ok.onclick = cancelAsk;
|
|
73
|
-
if (auto) {
|
|
74
|
-
// told at once, so Escape or a click outside keeps it as well as Close
|
|
75
|
-
const [quiet, box] = tick(t("Don't show again today"), false);
|
|
76
|
-
quiet.classList.add("wn-quiet");
|
|
77
|
-
box.onchange = () => api("whatsnew/today", { on: box.checked }).catch(statusErr);
|
|
78
|
-
bar.append(quiet);
|
|
79
|
-
}
|
|
80
|
-
bar.append(el("span", "grow"), ok);
|
|
81
|
-
ed.append(bar);
|
|
82
|
-
confirmAsk = ed;
|
|
83
|
-
openModal(ed);
|
|
84
|
-
$("#modal").classList.add("lib");
|
|
85
|
-
ok.focus(NO_SCROLL);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// noteBlocks draws a release's markdown as text: headings (tHeading),
|
|
89
|
-
// bullets, paragraphs, inline bold, code and links, never as HTML; #123
|
|
90
|
-
// links the issue.
|
|
91
|
-
function noteBlocks(md) {
|
|
92
|
-
const box = el("div", "wn-notes");
|
|
93
|
-
let list = null;
|
|
94
|
-
for (const line of String(md || "").split(/\r?\n/)) {
|
|
95
|
-
const h = /^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(line);
|
|
96
|
-
const li = /^\s*[-*+]\s+(.*)$/.exec(line);
|
|
97
|
-
if (h) {
|
|
98
|
-
list = null;
|
|
99
|
-
box.append(inlineMD(el("div", "wn-h wn-h" + Math.min(h[1].length, 4)), tHeading(h[2])));
|
|
100
|
-
} else if (li) {
|
|
101
|
-
if (!list) box.append(list = el("ul"));
|
|
102
|
-
list.append(inlineMD(el("li"), li[1]));
|
|
103
|
-
} else if (!line.trim()) {
|
|
104
|
-
list = null;
|
|
105
|
-
} else if (list && /^\s{2,}\S/.test(line)) {
|
|
106
|
-
inlineMD(list.lastElementChild, " " + line.trim());
|
|
107
|
-
} else {
|
|
108
|
-
list = null;
|
|
109
|
-
box.append(inlineMD(el("p"), line.trim()));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return box;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// NOTE_ORDER: the merged notes' sections, what's new first
|
|
116
|
-
const NOTE_ORDER = ["Features", "Improvements", "Performance Improvements", "Bug Fixes", "Security", "Provider Changes", "Changes", "Documentation"];
|
|
117
|
-
|
|
118
|
-
// mergedNotes draws many releases' notes as one (the owner: nine releases
|
|
119
|
-
// of a line each read as a scattered list): their bullets gathered under
|
|
120
|
-
// one heading per kind, New features first, each with the version it came
|
|
121
|
-
// in, newest first, and a line that says the range. A line outside a list
|
|
122
|
-
// is a bullet of its own; a release with no notes is left out.
|
|
123
|
-
// total: how many releases there are in all when the server kept only the
|
|
124
|
-
// newest (update.MostNotes), so 156 behind doesn't read "40 releases"
|
|
125
|
-
// (sujingshen on X).
|
|
126
|
-
function mergedNotes(releases, total = 0) {
|
|
127
|
-
const secs = new Map();
|
|
128
|
-
for (const r of releases) {
|
|
129
|
-
const of = (k) => secs.get(k) || secs.set(k, []).get(k);
|
|
130
|
-
let sec = null, li = null;
|
|
131
|
-
const put = (text) => {
|
|
132
|
-
sec ??= of(t("Changes"));
|
|
133
|
-
li = sec.some((b) => b.text === text) ? null : { text, v: r.version };
|
|
134
|
-
if (li) sec.push(li);
|
|
135
|
-
};
|
|
136
|
-
for (const line of String(r.notes || "").split(/\r?\n/)) {
|
|
137
|
-
const h = /^\s{0,3}#{1,6}\s+(.*?)\s*#*\s*$/.exec(line);
|
|
138
|
-
const b = /^\s*[-*+]\s+(.*)$/.exec(line);
|
|
139
|
-
if (h) {
|
|
140
|
-
sec = of(tHeading(h[1]));
|
|
141
|
-
li = null;
|
|
142
|
-
} else if (b) put(b[1]);
|
|
143
|
-
else if (!line.trim()) li = null;
|
|
144
|
-
else if (li && /^\s{2,}\S/.test(line)) li.text += " " + line.trim();
|
|
145
|
-
else put(line.trim());
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const rank = (k) => { const i = NOTE_ORDER.findIndex((o) => t(o) === k); return i < 0 ? NOTE_ORDER.length : i; };
|
|
149
|
-
const box = el("div", "wn-notes wn-merged");
|
|
150
|
-
const vs = releases.map((r) => r.version);
|
|
151
|
-
const span = total > vs.length
|
|
152
|
-
? t("{n} releases · the newest {m} shown, {from} – {to}", { n: total, m: vs.length, from: "v" + vs.at(-1), to: "v" + vs[0] })
|
|
153
|
-
: t("{n} releases · {from} – {to}", { n: vs.length, from: "v" + vs.at(-1), to: "v" + vs[0] });
|
|
154
|
-
box.append(el("div", "wn-span", span));
|
|
155
|
-
for (const [k, items] of [...secs].filter(([, x]) => x.length).sort((a, b) => rank(a[0]) - rank(b[0]))) {
|
|
156
|
-
const h = el("div", "wn-h wn-h2");
|
|
157
|
-
h.append(k, el("span", "wn-n", String(items.length)));
|
|
158
|
-
const list = el("ul");
|
|
159
|
-
for (const it of items) {
|
|
160
|
-
const e = inlineMD(el("li"), it.text);
|
|
161
|
-
e.append(el("span", "wn-v", "v" + it.v));
|
|
162
|
-
list.append(e);
|
|
163
|
-
}
|
|
164
|
-
box.append(h, list);
|
|
165
|
-
}
|
|
166
|
-
return box;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// inlineMD appends text to e with **bold**, `code`, [links](https://…),
|
|
170
|
-
// bare https:// links and #123 issue links; only http(s) addresses link.
|
|
171
|
-
function inlineMD(e, s) {
|
|
172
|
-
const re = /\*\*(.+?)\*\*|`([^`]+)`|\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<>)]+)|(^|[\s(\[])#(\d+)\b/g;
|
|
173
|
-
let at = 0, m;
|
|
174
|
-
while ((m = re.exec(s))) {
|
|
175
|
-
if (m.index > at) e.append(s.slice(at, m.index));
|
|
176
|
-
if (m[1] !== undefined) e.append(inlineMD(el("b"), m[1]));
|
|
177
|
-
else if (m[2] !== undefined) e.append(el("code", "", m[2]));
|
|
178
|
-
else if (m[3] !== undefined) e.append(noteLink(m[3], m[4]));
|
|
179
|
-
else if (m[5] !== undefined) e.append(noteLink(m[5], m[5]));
|
|
180
|
-
else e.append(m[6], noteLink("#" + m[7], ISSUES + m[7]));
|
|
181
|
-
at = re.lastIndex;
|
|
182
|
-
}
|
|
183
|
-
if (at < s.length) e.append(s.slice(at));
|
|
184
|
-
return e;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// a link in the notes opens in the browser, as the app's other links do
|
|
188
|
-
function noteLink(text, url) {
|
|
189
|
-
const a = el("a", "wn-link", text);
|
|
190
|
-
a.href = url;
|
|
191
|
-
a.target = "_blank";
|
|
192
|
-
a.rel = "noopener";
|
|
193
|
-
a.onclick = (e) => { e.preventDefault(); e.stopPropagation(); api("open", { url }).catch(() => {}); };
|
|
194
|
-
return a;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// confirmUpdate shows what changed before an update downloaded is put in
|
|
198
|
-
// (Hu9956, #844: every update came unseen, its notes three clicks away in
|
|
199
|
-
// Settings › About): every release's notes after this one up to it, newest
|
|
200
|
-
// first, with Restart to update and Later. The update's own notes show at
|
|
201
|
-
// once; the releases between come in after. go restarts. The tray's panel,
|
|
202
|
-
// with no room for a dialog, restarts as before.
|
|
203
|
-
async function confirmUpdate(u, go) {
|
|
204
|
-
const ed = el("div", "editor whatsnew update-ask");
|
|
205
|
-
const head = el("div", "ehead");
|
|
206
|
-
const title = el("b", "", t("Update to {v}", { v: "v" + u.latest }));
|
|
207
|
-
head.append(title);
|
|
208
|
-
if (u.current) head.append(el("span", "wn-since", t("What changed since {v}", { v: "v" + u.current })));
|
|
209
|
-
const box = el("div", "wn-list");
|
|
210
|
-
const draw = (releases, total) => {
|
|
211
|
-
box.replaceChildren();
|
|
212
|
-
if (releases.length > 1) {
|
|
213
|
-
const sec = el("section", "wn-rel");
|
|
214
|
-
sec.append(mergedNotes(releases, total));
|
|
215
|
-
box.append(sec);
|
|
216
|
-
}
|
|
217
|
-
else for (const r of releases) {
|
|
218
|
-
const sec = el("section", "wn-rel");
|
|
219
|
-
const h = el("div", "wn-ver");
|
|
220
|
-
h.append(el("b", "", "v" + r.version));
|
|
221
|
-
sec.append(h, noteBlocks(r.notes));
|
|
222
|
-
box.append(sec);
|
|
223
|
-
}
|
|
224
|
-
if (!releases.length) {
|
|
225
|
-
const sec = el("section", "wn-rel wn-none");
|
|
226
|
-
sec.append(el("p", "wn-msg", t("No release notes provided.")));
|
|
227
|
-
if (u.url) sec.append(noteLink(t("Open the release page"), u.url));
|
|
228
|
-
box.append(sec);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
draw(u.notes ? [{ version: u.latest, notes: u.notes }] : []);
|
|
232
|
-
const bar = el("div", "bar");
|
|
233
|
-
const later = el("button", "text", t("Later"));
|
|
234
|
-
later.onclick = cancelAsk;
|
|
235
|
-
const ok = el("button", "text primary", t("Restart to update"));
|
|
236
|
-
ok.onclick = (e) => { e.stopPropagation(); closeConfirmAsk(); go(); };
|
|
237
|
-
bar.append(el("span", "grow"), later, ok);
|
|
238
|
-
ed.append(head, box, bar);
|
|
239
|
-
confirmAsk = ed;
|
|
240
|
-
openModal(ed);
|
|
241
|
-
$("#modal").classList.add("lib");
|
|
242
|
-
ok.focus(NO_SCROLL);
|
|
243
|
-
// the notes' answer asks the feed again first, and names a release out
|
|
244
|
-
// since the one downloaded (#910), which the restart then waits for
|
|
245
|
-
const w = await api(updatePath("update/notes")).catch(() => null);
|
|
246
|
-
if (confirmAsk !== ed) return;
|
|
247
|
-
if (w?.latest && w.latest !== u.latest) title.textContent = t("Update to {v}", { v: "v" + w.latest });
|
|
248
|
-
if (w?.releases?.length) draw(w.releases, w.total);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
window.wnShow = showWhatsNew;
|
|
252
|
-
window.wnConfirm = confirmUpdate;
|
package/extensions/magpie.zip
DELETED
|
Binary file
|