@floless/app 0.96.0 → 0.96.1
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/floless-server.cjs +2 -2
- package/dist/web/app.css +4 -1
- package/dist/web/workspaces.js +47 -2
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -53106,7 +53106,7 @@ function appVersion() {
|
|
|
53106
53106
|
return resolveVersion({
|
|
53107
53107
|
isSea: isSea2(),
|
|
53108
53108
|
sqVersionXml: readSqVersionXml(),
|
|
53109
|
-
define: true ? "0.96.
|
|
53109
|
+
define: true ? "0.96.1" : void 0,
|
|
53110
53110
|
pkgVersion: readPkgVersion()
|
|
53111
53111
|
});
|
|
53112
53112
|
}
|
|
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
|
|
|
53116
53116
|
return "dev";
|
|
53117
53117
|
}
|
|
53118
53118
|
function appChannel() {
|
|
53119
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.96.
|
|
53119
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.96.1" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
package/dist/web/app.css
CHANGED
|
@@ -3979,8 +3979,11 @@ tr.hist-diff-row[hidden] { display:none; }
|
|
|
3979
3979
|
.kb-gleg.con::before { background: color-mix(in srgb, var(--accent) 55%, var(--text-muted)); }
|
|
3980
3980
|
.kb-gleg.per::before { background: color-mix(in srgb, var(--accent) 25%, var(--text-muted)); }
|
|
3981
3981
|
.kb-g-hint { font-size: 10.5px; color: var(--text-dim); }
|
|
3982
|
-
.kb-graph-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; }
|
|
3982
|
+
.kb-graph-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; position: relative; }
|
|
3983
3983
|
.kb-graph-svg { width: 100%; height: 100%; }
|
|
3984
|
+
.kb-g-fit { position: absolute; top: 10px; right: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-muted); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; font: inherit; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
|
|
3985
|
+
.kb-g-fit:hover { color: var(--text); border-color: var(--accent); }
|
|
3986
|
+
.kb-g-fit[hidden] { display: none; }
|
|
3984
3987
|
.kb-g-edge { stroke: color-mix(in srgb, var(--border-strong) 90%, transparent); stroke-width: 1.5; }
|
|
3985
3988
|
.kb-g-node { cursor: pointer; }
|
|
3986
3989
|
.kb-g-hit { fill: transparent; } /* wider click/focus target */
|
package/dist/web/workspaces.js
CHANGED
|
@@ -968,8 +968,39 @@
|
|
|
968
968
|
const legend = '<div class="kb-g-legend"><span class="kb-gleg src">Source</span><span class="kb-gleg con">Concept</span><span class="kb-gleg per">Person</span></div>';
|
|
969
969
|
const note = graph.truncated ? `<div class="kb-view-note">Showing ${graph.nodes.length} — graph truncated (some pages omitted)</div>` : '';
|
|
970
970
|
return '<section class="kb-col kb-graph"><div class="kb-graph-head"><span>Knowledge graph</span>' + overview + '</div>' +
|
|
971
|
-
'<div class="kb-graph-sub">' + legend + '<span class="kb-g-hint">Click a node to open its page</span></div>' +
|
|
972
|
-
`<div class="kb-graph-body"><svg viewBox="0 0 ${W} ${H}" class="kb-graph-svg" role="group" aria-label="Knowledge graph">${lines}${dots}</svg
|
|
971
|
+
'<div class="kb-graph-sub">' + legend + '<span class="kb-g-hint">Click a node to open its page · scroll to zoom</span></div>' +
|
|
972
|
+
`<div class="kb-graph-body"><svg viewBox="0 0 ${W} ${H}" data-vb-base="0 0 ${W} ${H}" class="kb-graph-svg" role="group" aria-label="Knowledge graph">${lines}${dots}</svg>` +
|
|
973
|
+
`<button type="button" class="kb-g-fit" data-kb-fit hidden data-tip="Zoom to fit (Home)" aria-label="Zoom to fit">⤢ Fit</button></div>${note}</section>`;
|
|
974
|
+
}
|
|
975
|
+
// View-only pan/zoom: we mutate the live SVG viewBox, never re-layout. The base 0 0 W H box IS the
|
|
976
|
+
// fit; the Fit button + Home key restore it, and it shows only while zoomed/panned. Zoom resets on a
|
|
977
|
+
// generation re-render (rare) — ponytail: persisting it across re-layouts isn't worth the state.
|
|
978
|
+
function kbGraphSvgEl() { return $wsKnowledge.querySelector('.kb-graph-svg'); }
|
|
979
|
+
function kbSetVb(svg, x, y, w, h) {
|
|
980
|
+
svg.setAttribute('viewBox', `${x} ${y} ${w} ${h}`);
|
|
981
|
+
const [bx, by, bw] = svg.dataset.vbBase.split(' ').map(Number);
|
|
982
|
+
const off = Math.abs(w - bw) > 0.5 || Math.abs(x - bx) > 0.5 || Math.abs(y - by) > 0.5;
|
|
983
|
+
const fit = svg.parentElement.querySelector('[data-kb-fit]');
|
|
984
|
+
if (fit) fit.hidden = !off;
|
|
985
|
+
}
|
|
986
|
+
function kbFitGraph(svg) { const b = svg.dataset.vbBase.split(' ').map(Number); kbSetVb(svg, b[0], b[1], b[2], b[3]); }
|
|
987
|
+
function kbZoomGraph(svg, clientX, clientY, factor) {
|
|
988
|
+
const [x, y, w, h] = svg.getAttribute('viewBox').split(' ').map(Number);
|
|
989
|
+
const [, , bw, bh] = svg.dataset.vbBase.split(' ').map(Number);
|
|
990
|
+
const rect = svg.getBoundingClientRect();
|
|
991
|
+
// The SVG keeps the default preserveAspectRatio="xMidYMid meet", so the viewBox is letterboxed
|
|
992
|
+
// inside the element rect whenever the pane isn't 600:440. Map the cursor through the FITTED box
|
|
993
|
+
// (min-scale + centering offset), not the raw rect, or the zoom anchor drifts on the boxed axis.
|
|
994
|
+
const scale = Math.min(rect.width / w, rect.height / h);
|
|
995
|
+
const cx = x + (clientX - rect.left - (rect.width - w * scale) / 2) / scale; // cursor in viewBox coords — hold it fixed
|
|
996
|
+
const cy = y + (clientY - rect.top - (rect.height - h * scale) / 2) / scale;
|
|
997
|
+
const nw = Math.min(bw, Math.max(bw / 8, w * factor)); // fit = max zoom-out; 8× = max zoom-in
|
|
998
|
+
const nh = nw * (bh / bw);
|
|
999
|
+
let nx = cx - (cx - x) * (nw / w);
|
|
1000
|
+
let ny = cy - (cy - y) * (nh / h);
|
|
1001
|
+
nx = Math.max(0, Math.min(bw - nw, nx)); // never pan past the content box
|
|
1002
|
+
ny = Math.max(0, Math.min(bh - nh, ny));
|
|
1003
|
+
kbSetVb(svg, nx, ny, nw, nh);
|
|
973
1004
|
}
|
|
974
1005
|
function kbGraphTruncatedEmpty() { return '<section class="kb-col kb-placeholder"><div class="kb-ph-inner"><span class="kb-ph-ico" aria-hidden="true">✦</span><div class="kb-ph-title">Graph incomplete</div><div class="kb-ph-sub">Some knowledge pages couldn’t be loaded, so the graph is incomplete and nothing could be shown. Click a file on the left to preview it.</div></div></section>'; }
|
|
975
1006
|
function kbGraphEmpty(st) {
|
|
@@ -1618,6 +1649,7 @@
|
|
|
1618
1649
|
if (knowledgeState) paintKnowledge(knowledgeState);
|
|
1619
1650
|
return;
|
|
1620
1651
|
}
|
|
1652
|
+
if (e.target.closest('[data-kb-fit]')) { const svg = kbGraphSvgEl(); if (svg) kbFitGraph(svg); return; }
|
|
1621
1653
|
// Open a graph node's page.
|
|
1622
1654
|
const nodeEl = e.target.closest('[data-kb-node]');
|
|
1623
1655
|
if (nodeEl) { setViewer({ mode: 'page', slug: nodeEl.getAttribute('data-kb-node') }); if (knowledgeState) paintKnowledge(knowledgeState); return; }
|
|
@@ -1653,9 +1685,22 @@
|
|
|
1653
1685
|
if (adjBtn) { if (adjBtn.getAttribute('aria-disabled') !== 'true') kbAdjustSubmit(); return; } // aria-disabled still receives clicks
|
|
1654
1686
|
if (e.target.closest('#kb-drop')) $wsKnowledgeFile.click();
|
|
1655
1687
|
});
|
|
1688
|
+
// Scroll to zoom the graph toward the cursor. passive:false pins this listener non-passive so
|
|
1689
|
+
// preventDefault stays valid (defensive — a plain element isn't force-passive like window/document).
|
|
1690
|
+
$wsKnowledge.addEventListener('wheel', (e) => {
|
|
1691
|
+
const svg = e.target.closest('.kb-graph-svg');
|
|
1692
|
+
if (!svg) return;
|
|
1693
|
+
e.preventDefault();
|
|
1694
|
+
kbZoomGraph(svg, e.clientX, e.clientY, e.deltaY < 0 ? 0.85 : 1 / 0.85);
|
|
1695
|
+
}, { passive: false });
|
|
1656
1696
|
// Graph nodes are keyboard-focusable (tabindex="0" role="button") but SVG <g> elements have no
|
|
1657
1697
|
// native activation behaviour, so Enter/Space must be wired explicitly.
|
|
1658
1698
|
$wsKnowledge.addEventListener('keydown', (e) => {
|
|
1699
|
+
// Home zooms the graph back to fit — but not while typing in the Adjust box (Home = line start there).
|
|
1700
|
+
if (e.key === 'Home' && !e.target.closest('input, textarea') && !e.target.isContentEditable) {
|
|
1701
|
+
const svg = kbGraphSvgEl();
|
|
1702
|
+
if (svg) { e.preventDefault(); kbFitGraph(svg); return; }
|
|
1703
|
+
}
|
|
1659
1704
|
// Cmd/Ctrl+Enter submits the Adjust box; bare Enter keeps inserting a newline (prose stays multi-line).
|
|
1660
1705
|
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey) && e.target.id === 'kb-adjust-input') {
|
|
1661
1706
|
e.preventDefault();
|