finch-markdown-editor 0.2.20 → 0.2.22

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/dist/panel.css CHANGED
@@ -1,3 +1,9 @@
1
+ /* Every Finch theme token is referenced through one of these local aliases,
2
+ never as a bare `var(--finch-x)` with no fallback: the platform injects the
3
+ real values asynchronously (see the boot gate below), and a declaration
4
+ whose var() has no fallback is simply dropped while that is still pending.
5
+ The light/dark branches mean the aliases also resolve to a plausible colour
6
+ if the tokens never arrive at all. */
1
7
  :root{
2
8
  --bg:var(--finch-bg-main,#f7f7f8);
3
9
  --card:var(--finch-bg-elevated,#fff);
@@ -5,6 +11,8 @@
5
11
  --muted:var(--finch-text-secondary,#777);
6
12
  --border:var(--finch-border,#ddd);
7
13
  --accent:var(--finch-accent,#3f6b56);
14
+ --hover:var(--finch-bg-hover,#ececef);
15
+ --active:var(--finch-bg-active,#e2e2e7);
8
16
  }
9
17
  @media (prefers-color-scheme: dark) {
10
18
  :root{
@@ -14,8 +22,20 @@
14
22
  --muted:var(--finch-text-secondary,#aaa);
15
23
  --border:var(--finch-border,#3c3c43);
16
24
  --accent:var(--finch-accent,#70a889);
25
+ --hover:var(--finch-bg-hover,#2b2b32);
26
+ --active:var(--finch-bg-active,#34343d);
17
27
  }
18
28
  }
29
+ /* Boot gate. `md-boot` hides the app tree for the first frame(s): panel.html
30
+ paints the surface immediately (from the theme values this page saw last
31
+ time — see the inline script there), but whether the host is about to push
32
+ a document is still unknown, and the empty-state home page must never flash
33
+ in front of it. panel.ts drops this class as soon as the host answers.
34
+ `visibility:hidden` rather than `display:none`, because CodeMirror has to
35
+ measure its line layout while it is still hidden — and because `visibility`
36
+ on an ancestor is inherited and never re-enabled by a descendant, one class
37
+ covers the whole tree while leaving the painted body background alone. */
38
+ html.md-boot .app{visibility:hidden}
19
39
  *{box-sizing:border-box}
20
40
  html,body{height:100%}
21
41
  body{margin:0;background:var(--bg);color:var(--text);font:13px var(--finch-font-body,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif)}
@@ -107,7 +127,7 @@ body.non-mac-platform .cm-scroller.cm-scrollbar-active{scrollbar-color:color-mix
107
127
  treatment used elsewhere — it's a routine "save" action here, not
108
128
  something that needs to compete visually with the rest of the chrome. */
109
129
  body.app-view .status-inline-btn{color:var(--text)}
110
- body.app-view .status-inline-btn:hover{background:var(--finch-bg-hover,var(--bg));color:var(--text);border-color:var(--border)}
130
+ body.app-view .status-inline-btn:hover{background:var(--hover);color:var(--text);border-color:var(--border)}
111
131
  .status:empty{padding:0;border-top:0}
112
132
  /* Changed glyphs briefly take the accent color, then settle back to normal
113
133
  text. Nested syntax spans receive the same animation; no background flash. */
@@ -167,7 +187,7 @@ body.app-view .status-inline-btn:hover{background:var(--finch-bg-hover,var(--bg)
167
187
  .actions{position:absolute;right:32px;bottom:32px;z-index:8;display:flex;align-items:center;gap:3px;padding:5px;border-radius:11px;background:var(--card);border:1px solid var(--border);box-shadow:0 6px 20px rgba(0,0,0,.18);transition:gap .15s ease}
168
188
  .actions[hidden]{display:none}
169
189
  .actions button{position:relative;display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:0;border-radius:7px;background:transparent;color:var(--text);font:inherit;cursor:pointer;white-space:nowrap}
170
- .actions button:hover:not(:disabled){background:var(--finch-bg-hover,var(--bg))}
190
+ .actions button:hover:not(:disabled){background:var(--hover)}
171
191
  .actions button[data-tooltip]::after{content:attr(data-tooltip);position:absolute;left:50%;bottom:calc(100% + 8px);z-index:20;padding:6px 8px;border:1px solid var(--border);border-radius:7px;background:linear-gradient(135deg,color-mix(in srgb,var(--card) 96%,#fff),var(--bg));box-shadow:0 5px 16px rgba(0,0,0,.2);color:var(--text);font-size:12px;line-height:1;white-space:nowrap;pointer-events:none;opacity:0;transform:translate(-50%,3px);transition:opacity .16s ease,transform .16s ease}
172
192
  .actions button[data-tooltip]:hover::after{opacity:1;transform:translate(-50%,0)}
173
193
  /* Center tooltips over ordinary buttons; at either end of the floating bar,
@@ -192,7 +212,7 @@ body.app-view .status-inline-btn:hover{background:var(--finch-bg-hover,var(--bg)
192
212
 
193
213
  /* Full-screen App View shell. The same document remains a compact, host-toolbar-
194
214
  driven Panel App until finch:env explicitly identifies the appView surface. */
195
- .app-toolbar{height:48px;flex:none;align-items:center;gap:12px;padding:7px 12px;border-bottom:1px solid var(--border);background:var(--finch-bg-main)}
215
+ .app-toolbar{height:48px;flex:none;align-items:center;gap:12px;padding:7px 12px;border-bottom:1px solid var(--border);background:var(--bg)}
196
216
  body.app-view .app-toolbar{display:flex!important}
197
217
  .app-toolbar-group{display:flex;align-items:center;gap:6px;flex:none}
198
218
  .app-toolbar-end{margin-left:auto}
@@ -204,10 +224,10 @@ body.app-view .app-toolbar{display:flex!important}
204
224
  blockification vs. the span's own line-height baseline) and visibly
205
225
  drift a couple of px apart even though both parents are
206
226
  align-items:center flex boxes. */
207
- .app-tool svg{display:block;width:17px;height:17px;stroke-width:1.8}.app-tool:hover:not(:disabled){background:var(--finch-bg-hover,var(--bg))}
208
- .app-tool:disabled{opacity:.4;cursor:default}.app-tool.checked{color:var(--text);background:var(--finch-bg-active,color-mix(in srgb,var(--text) 10%,transparent))}.app-tool.dirty{background:transparent}
227
+ .app-tool svg{display:block;width:17px;height:17px;stroke-width:1.8}.app-tool:hover:not(:disabled){background:var(--hover)}
228
+ .app-tool:disabled{opacity:.4;cursor:default}.app-tool.checked{color:var(--text);background:var(--active)}.app-tool.dirty{background:transparent}
209
229
  .app-tool-label{min-width:auto;padding:0 9px}.app-word-count{min-width:0;padding-inline:8px;color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums;cursor:pointer}.app-word-count svg{width:14px;height:14px;flex:none}.app-word-count svg[hidden]{display:none!important}.app-word-count:hover{color:var(--text)}.ic-save,.ic-save-check{display:inline-flex;align-items:center}.ic-save[hidden],.ic-save-check[hidden]{display:none}.app-menu-wrap{position:relative}.app-menu{position:absolute;z-index:32;top:calc(100% + 7px);right:0;min-width:174px;padding:5px;border:1px solid var(--border);border-radius:9px;background:var(--card);box-shadow:0 2px 8px rgba(0,0,0,.12)}
210
- .app-menu button{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;padding:7px 9px;border:0;border-radius:6px;background:transparent;color:var(--text);font:12px var(--finch-font-body,system-ui);text-align:left;cursor:pointer}.app-menu button:hover{background:var(--finch-bg-hover,var(--bg))}.app-menu button.checked{color:var(--text);background:var(--finch-bg-active,color-mix(in srgb,var(--text) 10%,transparent));font-weight:600}.app-menu button:disabled{color:var(--muted);cursor:default;opacity:.5}.app-menu button:disabled:hover{background:transparent}.app-menu hr{margin:5px 3px;border:0;border-top:1px solid var(--border)}
230
+ .app-menu button{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;padding:7px 9px;border:0;border-radius:6px;background:transparent;color:var(--text);font:12px var(--finch-font-body,system-ui);text-align:left;cursor:pointer}.app-menu button:hover{background:var(--hover)}.app-menu button.checked{color:var(--text);background:var(--active);font-weight:600}.app-menu button:disabled{color:var(--muted);cursor:default;opacity:.5}.app-menu button:disabled:hover{background:transparent}.app-menu hr{margin:5px 3px;border:0;border-top:1px solid var(--border)}
211
231
  .app-document-meta{min-width:0;display:flex;flex-direction:column;gap:1px}.app-document-meta strong,.app-document-meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.app-document-meta strong{font-size:13px}.app-document-meta span{max-width:34vw;color:var(--muted);font-size:11px}
212
232
  /* Focus mode ("专注") in App View: instead of just dimming inactive editor
213
233
  lines (see codemirror.ts), collapse the entire toolbar down to a single
@@ -306,14 +326,14 @@ body.app-view .actions{right:28px;bottom:28px}
306
326
  .library-drawer>header .library-header-actions{display:flex;flex-direction:row;align-items:center;gap:2px}
307
327
  .library-icon-btn{border:0;background:transparent;color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:7px;padding:0}
308
328
  .library-icon-btn svg{width:16px;height:16px}
309
- .library-icon-btn:hover{background:var(--finch-bg-hover,var(--bg));color:var(--text)}
329
+ .library-icon-btn:hover{background:var(--hover);color:var(--text)}
310
330
  .library-icon-btn.active{background:color-mix(in srgb,var(--accent) 16%,transparent);color:var(--accent)}
311
331
  .library-header-actions #libraryClose{border:0;background:transparent;color:var(--muted);font-size:24px;cursor:pointer;line-height:1;width:28px;height:28px;border-radius:7px}
312
- .library-header-actions #libraryClose:hover{background:var(--finch-bg-hover,var(--bg));color:var(--text)}
332
+ .library-header-actions #libraryClose:hover{background:var(--hover);color:var(--text)}
313
333
  /* Reorder mode: groups collapse to flat draggable header rows (no expand/
314
334
  collapse, no per-document rows) so ordering is the only thing to do. */
315
335
  .library-group-reorder{display:flex;align-items:center;gap:8px;min-height:38px;padding:0 9px;border-radius:9px;cursor:grab;user-select:none;touch-action:none}
316
- .library-group-reorder:hover{background:var(--finch-bg-hover,var(--bg))}
336
+ .library-group-reorder:hover{background:var(--hover)}
317
337
  .library-group-reorder.dragging{opacity:.32}
318
338
  .library-group-reorder[data-draggable]:not([data-draggable="true"]),.library-group-reorder:not([data-draggable]){cursor:default;opacity:.7}
319
339
  .library-reorder-handle{flex:none;width:14px;text-align:center;color:var(--muted);font-size:13px;line-height:1;letter-spacing:-1px}
@@ -325,14 +345,14 @@ body.app-view .actions{right:28px;bottom:28px}
325
345
  path + time metadata instead of cramming all three into one text run. */
326
346
  .library-groups{flex:1;overflow:auto;padding:10px 12px 20px}
327
347
  .library-group{margin:0 0 8px;border:0;border-radius:9px}.library-group[open]{background:color-mix(in srgb,var(--text) 2%,transparent)}
328
- .library-group summary{display:flex;align-items:center;gap:7px;min-height:32px;padding:0 9px;list-style:none;color:var(--muted);font-size:12px;font-weight:600;cursor:pointer;user-select:none;touch-action:none}.library-group summary::-webkit-details-marker{display:none}.library-group summary::before{content:'›';color:var(--muted);font-size:17px;font-weight:400;line-height:1;transform:rotate(0deg);transition:transform .14s ease}.library-group[open] summary::before{transform:rotate(90deg)}.library-group summary:hover{background:var(--finch-bg-hover,var(--bg));border-radius:8px}.library-group.dragging{opacity:.32}
348
+ .library-group summary{display:flex;align-items:center;gap:7px;min-height:32px;padding:0 9px;list-style:none;color:var(--muted);font-size:12px;font-weight:600;cursor:pointer;user-select:none;touch-action:none}.library-group summary::-webkit-details-marker{display:none}.library-group summary::before{content:'›';color:var(--muted);font-size:17px;font-weight:400;line-height:1;transform:rotate(0deg);transition:transform .14s ease}.library-group[open] summary::before{transform:rotate(90deg)}.library-group summary:hover{background:var(--hover);border-radius:8px}.library-group.dragging{opacity:.32}
329
349
  .library-group-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}.library-group-count{margin-left:auto;color:var(--muted);font-size:11px;font-weight:400}.library-items{padding:0 4px 4px}
330
350
  /* Custom drag ghost: a floating clone that follows the pointer, replacing
331
351
  the browser's native (unstylable) HTML5 drag screenshot. Collapsed
332
352
  (.library-items hidden) since drags always start from a collapsed row. */
333
353
  .library-drag-ghost{position:fixed;left:0;top:0;z-index:9999;pointer-events:none;margin:0;border-radius:10px;background:var(--card,var(--bg));box-shadow:0 10px 28px color-mix(in srgb,#000 22%,transparent),0 2px 6px color-mix(in srgb,#000 12%,transparent);transform:scale(1.02) rotate(-1deg);opacity:.96;overflow:hidden}
334
354
  .library-drag-ghost .library-items{display:none}.library-drag-ghost summary{cursor:grabbing}
335
- .library-row{display:block;width:100%;padding:9px 9px 8px;border:0;border-radius:7px;background:transparent;color:var(--text);text-align:left;cursor:pointer}.library-row:hover{background:var(--finch-bg-hover,var(--bg))}.library-row-main,.library-row strong,.library-row-meta,.library-row-path{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.library-row strong{font-size:13px;line-height:1.35;font-weight:600}.library-row-meta{display:flex;align-items:center;gap:7px;margin-top:3px;color:var(--muted);font-size:11px;line-height:1.3}.library-row-path,.library-row time{color:var(--muted)}.library-row-path{flex:1}.library-row time{flex:none;opacity:.86}
355
+ .library-row{display:block;width:100%;padding:9px 9px 8px;border:0;border-radius:7px;background:transparent;color:var(--text);text-align:left;cursor:pointer}.library-row:hover{background:var(--hover)}.library-row-main,.library-row strong,.library-row-meta,.library-row-path{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.library-row strong{font-size:13px;line-height:1.35;font-weight:600}.library-row-meta{display:flex;align-items:center;gap:7px;margin-top:3px;color:var(--muted);font-size:11px;line-height:1.3}.library-row-path,.library-row time{color:var(--muted)}.library-row-path{flex:1}.library-row time{flex:none;opacity:.86}
336
356
  @media(max-width:850px){body.app-view .stage{grid-template-columns:minmax(0,1fr) 6px min(var(--preview-width,480px),40vw)}.app-toolbar{gap:6px}.app-tool-label{padding:0 8px}}
337
357
  /* Keep the App View toolbar usable when the Finch window is narrow. Icon-only
338
358
  buttons retain their localized tooltip/aria label; only the two redundant
package/dist/panel.html CHANGED
@@ -1,11 +1,40 @@
1
1
  <!doctype html>
2
- <html lang="zh-CN">
2
+ <!-- `md-boot` hides the app tree for the first frame(s): panel.ts drops it once
3
+ the host has said whether a document is coming, so the empty-state home
4
+ page never flashes in front of one. The surface behind it is painted
5
+ immediately (see the inline script below) — see the boot comments in
6
+ panel.css and panel.ts. -->
7
+ <html lang="zh-CN" class="md-boot">
3
8
  <head>
4
9
  <meta charset="utf-8">
5
10
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
11
  <title>写字</title>
7
12
  <link rel="stylesheet" href="panel.css">
8
-
13
+ <script>
14
+ // Pre-paint theme. The platform injects the real `--finch-*` tokens at webview
15
+ // dom-ready, which is after this document has painted once — so the first
16
+ // frame used to come from panel.css's generic light/dark fallback, i.e. some
17
+ // other skin's colours, and visibly corrected itself a moment later.
18
+ //
19
+ // Instead, start from the values that were actually in effect the last time
20
+ // this page was open and let panel.ts hand the surfaces back to the platform
21
+ // tokens as soon as they land (`adoptPlatformTheme`), refreshing this cache
22
+ // for next time. Runs inline, before this document's first paint. Values are
23
+ // the resolved panel.css aliases, applied on <html> itself so they outrank the
24
+ // `:root` rules until the overrides are removed.
25
+ (function () {
26
+ try {
27
+ var cached = JSON.parse(localStorage.getItem('md-theme-aliases') || 'null');
28
+ if (!cached) return;
29
+ var root = document.documentElement;
30
+ for (var name in cached) {
31
+ if (Object.prototype.hasOwnProperty.call(cached, name) && cached[name]) {
32
+ root.style.setProperty('--' + name, cached[name]);
33
+ }
34
+ }
35
+ } catch (_) {}
36
+ })();
37
+ </script>
9
38
  </head>
10
39
  <body>
11
40
  <main class="app">