@githumbi/grabby 0.4.0 → 0.5.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/CHANGELOG.md +10 -0
- package/dist/angular/index.d.ts +8 -0
- package/dist/angular/index.js +519 -41
- package/dist/angular/index.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/core/index.cjs +586 -108
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +519 -41
- package/dist/core/index.js.map +1 -1
- package/dist/export/index.d.cts +8 -0
- package/dist/export/index.d.ts +8 -0
- package/dist/grabby.global.js +217 -91
- package/dist/live/index.d.cts +1 -1
- package/dist/live/index.d.ts +1 -1
- package/dist/react/index.d.ts +8 -0
- package/dist/react/index.js +519 -41
- package/dist/react/index.js.map +1 -1
- package/dist/{types-DjpIHekd.d.cts → types-BQDEG-Gl.d.cts} +8 -0
- package/dist/{types-DjpIHekd.d.ts → types-BQDEG-Gl.d.ts} +8 -0
- package/package.json +1 -1
package/dist/core/index.cjs
CHANGED
|
@@ -1217,7 +1217,7 @@ function createElementPicker(deps) {
|
|
|
1217
1217
|
e.stopPropagation();
|
|
1218
1218
|
if (heldElement) return;
|
|
1219
1219
|
if (hoveredElement) {
|
|
1220
|
-
deps.onSelect(hoveredElement);
|
|
1220
|
+
deps.onSelect(hoveredElement, { x: e.clientX, y: e.clientY });
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
1223
|
return {
|
|
@@ -1475,7 +1475,8 @@ function createWebhookPlugin(url) {
|
|
|
1475
1475
|
type: "grabby.comment",
|
|
1476
1476
|
version: 1,
|
|
1477
1477
|
origin: typeof location !== "undefined" ? location.origin : null,
|
|
1478
|
-
|
|
1478
|
+
// The marker position is browser-only.
|
|
1479
|
+
comment: { ...comment, pin: void 0 }
|
|
1479
1480
|
})
|
|
1480
1481
|
}).catch(() => {
|
|
1481
1482
|
});
|
|
@@ -1567,6 +1568,9 @@ ${vars.join("\n")}
|
|
|
1567
1568
|
|
|
1568
1569
|
// src/core/toolbar/toolbar-renderer.ts
|
|
1569
1570
|
var TOOLBAR_ID = "__grabby-toolbar__";
|
|
1571
|
+
var COLLAPSED_SIZE = 42;
|
|
1572
|
+
var EASE_OUT_EXPO = "cubic-bezier(0.19, 1, 0.22, 1)";
|
|
1573
|
+
var MORPH_MS = 360;
|
|
1570
1574
|
var STYLE_ID3 = "__grabby-toolbar-styles__";
|
|
1571
1575
|
function syncSummary(comments) {
|
|
1572
1576
|
if (comments.length === 0) return null;
|
|
@@ -1588,7 +1592,13 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1588
1592
|
let badge = null;
|
|
1589
1593
|
let status = null;
|
|
1590
1594
|
let expandBadge = null;
|
|
1595
|
+
let content = null;
|
|
1591
1596
|
let collapsed = false;
|
|
1597
|
+
let morphTimer = null;
|
|
1598
|
+
function clearMorph() {
|
|
1599
|
+
if (morphTimer) clearTimeout(morphTimer);
|
|
1600
|
+
morphTimer = null;
|
|
1601
|
+
}
|
|
1592
1602
|
function injectStyles2() {
|
|
1593
1603
|
if (hasStyles(STYLE_ID3)) return;
|
|
1594
1604
|
addStyles(STYLE_ID3, `
|
|
@@ -1608,7 +1618,21 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1608
1618
|
box-shadow: 0 4px 16px var(--grabby-toolbar-shadow, rgba(0, 0, 0, 0.12));
|
|
1609
1619
|
pointer-events: auto;
|
|
1610
1620
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
1611
|
-
|
|
1621
|
+
box-sizing: border-box;
|
|
1622
|
+
height: ${COLLAPSED_SIZE}px;
|
|
1623
|
+
overflow: hidden;
|
|
1624
|
+
justify-content: flex-end;
|
|
1625
|
+
transition: opacity 0.2s ease, transform 0.2s ease,
|
|
1626
|
+
left ${MORPH_MS}ms ${EASE_OUT_EXPO}, width ${MORPH_MS}ms ${EASE_OUT_EXPO};
|
|
1627
|
+
}
|
|
1628
|
+
#${TOOLBAR_ID} .grabby-toolbar-content {
|
|
1629
|
+
display: flex;
|
|
1630
|
+
align-items: center;
|
|
1631
|
+
gap: 2px;
|
|
1632
|
+
flex-shrink: 0;
|
|
1633
|
+
transform-origin: right center;
|
|
1634
|
+
transition: opacity 0.24s ease-out, filter 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
|
1635
|
+
transform 0.42s ${EASE_OUT_EXPO}, visibility 0s;
|
|
1612
1636
|
}
|
|
1613
1637
|
#${TOOLBAR_ID}.grabby-toolbar-hidden {
|
|
1614
1638
|
opacity: 0;
|
|
@@ -1704,23 +1728,44 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1704
1728
|
background: var(--grabby-accent-hover, #1d4ed8);
|
|
1705
1729
|
color: #fff;
|
|
1706
1730
|
}
|
|
1707
|
-
#${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1731
|
+
#${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1732
|
+
position: absolute;
|
|
1733
|
+
left: 50%;
|
|
1734
|
+
top: 50%;
|
|
1735
|
+
translate: -50% -50%;
|
|
1736
|
+
color: var(--grabby-accent, #2563eb);
|
|
1737
|
+
opacity: 0;
|
|
1738
|
+
scale: 0.6;
|
|
1739
|
+
visibility: hidden;
|
|
1740
|
+
pointer-events: none;
|
|
1741
|
+
transition: opacity 0.2s ease-out, scale 0.3s ${EASE_OUT_EXPO}, visibility 0s 0.2s;
|
|
1742
|
+
}
|
|
1743
|
+
#${TOOLBAR_ID} button.grabby-btn-expand .grabby-badge { top: -3px; right: -5px; }
|
|
1708
1744
|
#${TOOLBAR_ID}.grabby-toolbar-collapsed {
|
|
1709
|
-
left:
|
|
1710
|
-
right: 20px;
|
|
1711
|
-
transform: none;
|
|
1745
|
+
left: calc(100% - 20px - ${COLLAPSED_SIZE / 2}px);
|
|
1712
1746
|
padding: 4px;
|
|
1713
1747
|
}
|
|
1714
|
-
#${TOOLBAR_ID}.grabby-toolbar-collapsed.grabby-toolbar-
|
|
1715
|
-
|
|
1748
|
+
#${TOOLBAR_ID}.grabby-toolbar-collapsed .grabby-toolbar-content {
|
|
1749
|
+
opacity: 0;
|
|
1750
|
+
filter: blur(6px);
|
|
1751
|
+
transform: scale(0.4);
|
|
1752
|
+
pointer-events: none;
|
|
1753
|
+
visibility: hidden;
|
|
1754
|
+
transition: opacity 0.24s ease-out, filter 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
|
1755
|
+
transform 0.42s ${EASE_OUT_EXPO}, visibility 0s 0.3s;
|
|
1716
1756
|
}
|
|
1717
|
-
#${TOOLBAR_ID}.grabby-toolbar-collapsed
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1757
|
+
#${TOOLBAR_ID}.grabby-toolbar-collapsed button.grabby-btn-expand {
|
|
1758
|
+
opacity: 1;
|
|
1759
|
+
scale: 1;
|
|
1760
|
+
visibility: visible;
|
|
1761
|
+
pointer-events: auto;
|
|
1762
|
+
transition: opacity 0.24s ease-out 0.08s, scale 0.36s ${EASE_OUT_EXPO} 0.08s, visibility 0s;
|
|
1763
|
+
}
|
|
1764
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1765
|
+
#${TOOLBAR_ID}, #${TOOLBAR_ID} .grabby-toolbar-content, #${TOOLBAR_ID} button.grabby-btn-expand {
|
|
1766
|
+
transition-duration: 0s !important;
|
|
1767
|
+
transition-delay: 0s !important;
|
|
1768
|
+
}
|
|
1724
1769
|
}
|
|
1725
1770
|
#${TOOLBAR_ID} .grabby-toolbar-left.grabby-toolbar-left-hidden {
|
|
1726
1771
|
max-width: 0;
|
|
@@ -1775,7 +1820,9 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1775
1820
|
leftGroup.appendChild(buttons.selection);
|
|
1776
1821
|
leftGroup.appendChild(buttons.history);
|
|
1777
1822
|
leftGroup.appendChild(divider);
|
|
1778
|
-
|
|
1823
|
+
content = document.createElement("div");
|
|
1824
|
+
content.className = "grabby-toolbar-content";
|
|
1825
|
+
content.appendChild(leftGroup);
|
|
1779
1826
|
if (options.review) {
|
|
1780
1827
|
status = document.createElement("span");
|
|
1781
1828
|
status.className = "grabby-toolbar-status";
|
|
@@ -1792,18 +1839,22 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1792
1839
|
e.stopPropagation();
|
|
1793
1840
|
_optionalChain([callbacks, 'access', _47 => _47.onFinish, 'optionalCall', _48 => _48()]);
|
|
1794
1841
|
});
|
|
1795
|
-
|
|
1796
|
-
|
|
1842
|
+
content.appendChild(status);
|
|
1843
|
+
content.appendChild(buttons.finish);
|
|
1797
1844
|
allElements.add(status);
|
|
1798
1845
|
}
|
|
1799
|
-
if (!options.hideEnable)
|
|
1800
|
-
|
|
1801
|
-
container.
|
|
1802
|
-
|
|
1846
|
+
if (!options.hideEnable) content.appendChild(buttons.enable);
|
|
1847
|
+
content.appendChild(buttons.dismiss);
|
|
1848
|
+
container.append(content, buttons.expand);
|
|
1849
|
+
if (collapsed) {
|
|
1850
|
+
container.classList.add("grabby-toolbar-collapsed");
|
|
1851
|
+
container.style.width = `${COLLAPSED_SIZE}px`;
|
|
1852
|
+
}
|
|
1803
1853
|
getUiRoot().appendChild(container);
|
|
1804
1854
|
allElements.clear();
|
|
1805
1855
|
allElements.add(container);
|
|
1806
1856
|
allElements.add(leftGroup);
|
|
1857
|
+
allElements.add(content);
|
|
1807
1858
|
allElements.add(divider);
|
|
1808
1859
|
for (const btn of Object.values(buttons)) {
|
|
1809
1860
|
allElements.add(btn);
|
|
@@ -1849,12 +1900,28 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1849
1900
|
}
|
|
1850
1901
|
},
|
|
1851
1902
|
collapse() {
|
|
1903
|
+
if (collapsed) return;
|
|
1852
1904
|
collapsed = true;
|
|
1853
|
-
|
|
1905
|
+
if (!container) return;
|
|
1906
|
+
clearMorph();
|
|
1907
|
+
container.style.width = `${container.offsetWidth}px`;
|
|
1908
|
+
void container.offsetWidth;
|
|
1909
|
+
container.classList.add("grabby-toolbar-collapsed");
|
|
1910
|
+
container.style.width = `${COLLAPSED_SIZE}px`;
|
|
1854
1911
|
},
|
|
1855
1912
|
expand() {
|
|
1913
|
+
if (!collapsed) return;
|
|
1856
1914
|
collapsed = false;
|
|
1857
|
-
|
|
1915
|
+
if (!container) return;
|
|
1916
|
+
clearMorph();
|
|
1917
|
+
container.classList.remove("grabby-toolbar-collapsed");
|
|
1918
|
+
const cs = getComputedStyle(container);
|
|
1919
|
+
const chrome = ["paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth"].reduce((sum, k) => sum + (parseFloat(cs[k]) || 0), 0);
|
|
1920
|
+
container.style.width = `${(_nullishCoalesce(_optionalChain([content, 'optionalAccess', _57 => _57.offsetWidth]), () => ( 0))) + chrome}px`;
|
|
1921
|
+
morphTimer = setTimeout(() => {
|
|
1922
|
+
morphTimer = null;
|
|
1923
|
+
if (!collapsed && container) container.style.width = "";
|
|
1924
|
+
}, MORPH_MS + 40);
|
|
1858
1925
|
},
|
|
1859
1926
|
isCollapsed() {
|
|
1860
1927
|
return collapsed;
|
|
@@ -1870,10 +1937,12 @@ function createToolbarRenderer(callbacks, options = {}) {
|
|
|
1870
1937
|
return false;
|
|
1871
1938
|
},
|
|
1872
1939
|
dispose() {
|
|
1873
|
-
|
|
1940
|
+
clearMorph();
|
|
1941
|
+
_optionalChain([container, 'optionalAccess', _58 => _58.remove, 'call', _59 => _59()]);
|
|
1874
1942
|
removeStyles(STYLE_ID3);
|
|
1875
1943
|
container = null;
|
|
1876
1944
|
leftGroup = null;
|
|
1945
|
+
content = null;
|
|
1877
1946
|
buttons = {};
|
|
1878
1947
|
badge = null;
|
|
1879
1948
|
expandBadge = null;
|
|
@@ -1921,7 +1990,7 @@ function header(comments, env, ctx) {
|
|
|
1921
1990
|
if (frameworks.length) meta.push(frameworks.join(", "));
|
|
1922
1991
|
const routes = uniq(comments.map((c) => c.page.route));
|
|
1923
1992
|
if (!ctx.showRoutes && routes.length === 1) meta.push(`page ${routes[0]}`);
|
|
1924
|
-
const vp = _optionalChain([comments, 'access',
|
|
1993
|
+
const vp = _optionalChain([comments, 'access', _60 => _60[0], 'optionalAccess', _61 => _61.page, 'access', _62 => _62.viewport]);
|
|
1925
1994
|
if (vp) meta.push(`${vp[0]}\xD7${vp[1]}`);
|
|
1926
1995
|
meta.push((_nullishCoalesce(env.now, () => ( /* @__PURE__ */ new Date()))).toISOString().slice(0, 10));
|
|
1927
1996
|
lines.push(meta.join(" \xB7 "));
|
|
@@ -1947,8 +2016,8 @@ function detailBlock(c, i, ctx, groupHasSource, headedComponent) {
|
|
|
1947
2016
|
const b = (text) => lines.push(` - ${text}`);
|
|
1948
2017
|
const where = [`\`${t.preview}\``, `(${t.kind})`];
|
|
1949
2018
|
if (t.component && t.component !== headedComponent) {
|
|
1950
|
-
where.push(_optionalChain([t, 'access',
|
|
1951
|
-
} else if (_optionalChain([t, 'access',
|
|
2019
|
+
where.push(_optionalChain([t, 'access', _63 => _63.source, 'optionalAccess', _64 => _64.line]) != null && groupHasSource ? `${t.component} line ${t.source.line}` : t.component);
|
|
2020
|
+
} else if (_optionalChain([t, 'access', _65 => _65.source, 'optionalAccess', _66 => _66.line]) != null && groupHasSource) {
|
|
1952
2021
|
where.push(`line ${t.source.line}`);
|
|
1953
2022
|
}
|
|
1954
2023
|
b(where.join(" "));
|
|
@@ -1964,7 +2033,7 @@ function detailBlock(c, i, ctx, groupHasSource, headedComponent) {
|
|
|
1964
2033
|
for (const [k, v] of Object.entries(t.extra)) b(`${k}: ${v}`);
|
|
1965
2034
|
b(`viewport: ${c.page.viewport[0]}\xD7${c.page.viewport[1]}`);
|
|
1966
2035
|
}
|
|
1967
|
-
if (_optionalChain([c, 'access',
|
|
2036
|
+
if (_optionalChain([c, 'access', _67 => _67.screenshot, 'optionalAccess', _68 => _68.url])) b(`screenshot: ${c.screenshot.url}`);
|
|
1968
2037
|
const meta = [];
|
|
1969
2038
|
if (ctx.showAuthors) meta.push(`by ${authorLabel(c.author)}`);
|
|
1970
2039
|
if (ctx.showRoutes) meta.push(`on ${c.page.route}`);
|
|
@@ -1990,7 +2059,7 @@ function formatExport(comments, level = "standard", env = {}) {
|
|
|
1990
2059
|
}
|
|
1991
2060
|
const groups = /* @__PURE__ */ new Map();
|
|
1992
2061
|
for (const c of ordered) {
|
|
1993
|
-
const key = _nullishCoalesce(_optionalChain([c, 'access',
|
|
2062
|
+
const key = _nullishCoalesce(_optionalChain([c, 'access', _69 => _69.target, 'access', _70 => _70.source, 'optionalAccess', _71 => _71.file]), () => ( ""));
|
|
1994
2063
|
const list = groups.get(key);
|
|
1995
2064
|
if (list) list.push(c);
|
|
1996
2065
|
else groups.set(key, [c]);
|
|
@@ -2000,7 +2069,7 @@ function formatExport(comments, level = "standard", env = {}) {
|
|
|
2000
2069
|
out.push("");
|
|
2001
2070
|
const components = uniq(list.map((c) => c.target.component));
|
|
2002
2071
|
const headed = file && components.length === 1 ? components[0] : null;
|
|
2003
|
-
const lines = uniq(list.map((c) => _nullishCoalesce(_optionalChain([c, 'access',
|
|
2072
|
+
const lines = uniq(list.map((c) => _nullishCoalesce(_optionalChain([c, 'access', _72 => _72.target, 'access', _73 => _73.source, 'optionalAccess', _74 => _74.line]), () => ( null))));
|
|
2004
2073
|
if (file) {
|
|
2005
2074
|
const loc = lines.length === 1 ? location2(file, lines[0], true) : file;
|
|
2006
2075
|
out.push(`## ${loc}${headed ? ` \xB7 ${headed}` : ""}`);
|
|
@@ -2185,7 +2254,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2185
2254
|
let visible = false;
|
|
2186
2255
|
let objectUrls = [];
|
|
2187
2256
|
function ensurePanel() {
|
|
2188
|
-
if (_optionalChain([panel, 'optionalAccess',
|
|
2257
|
+
if (_optionalChain([panel, 'optionalAccess', _75 => _75.isConnected])) return panel;
|
|
2189
2258
|
addStyles(STYLE_ID4, CSS2);
|
|
2190
2259
|
panel = h("div", { id: PANEL_ID, role: "dialog", "aria-label": "Comments" });
|
|
2191
2260
|
getUiRoot().appendChild(panel);
|
|
@@ -2196,7 +2265,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2196
2265
|
objectUrls = [];
|
|
2197
2266
|
}
|
|
2198
2267
|
function thumbnail(comment) {
|
|
2199
|
-
const localId = _optionalChain([comment, 'access',
|
|
2268
|
+
const localId = _optionalChain([comment, 'access', _76 => _76.screenshot, 'optionalAccess', _77 => _77.localId]);
|
|
2200
2269
|
if (!localId) return null;
|
|
2201
2270
|
const img = h("img", { class: "grabby-thumb", alt: "", loading: "lazy" });
|
|
2202
2271
|
img.addEventListener("error", () => img.remove(), { once: true });
|
|
@@ -2305,7 +2374,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2305
2374
|
h("strong", null, live ? "Nothing sent yet" : "No comments yet"),
|
|
2306
2375
|
live ? "Click Comment, then click the part of the page you want to talk about." : "Click the hand icon (or press Alt+G), then click anything on the page to comment on it."
|
|
2307
2376
|
) : h("div", { class: "grabby-panel-list" }, ...comments.map((c) => row2(c, showAuthors)));
|
|
2308
|
-
const who = _nullishCoalesce(_optionalChain([options, 'access',
|
|
2377
|
+
const who = _nullishCoalesce(_optionalChain([options, 'access', _78 => _78.identityLabel, 'optionalCall', _79 => _79()]), () => ( null));
|
|
2309
2378
|
let footer = null;
|
|
2310
2379
|
if (live && who) {
|
|
2311
2380
|
footer = h(
|
|
@@ -2318,7 +2387,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2318
2387
|
"data-grabby-change-identity": "",
|
|
2319
2388
|
onclick: (e) => {
|
|
2320
2389
|
e.stopPropagation();
|
|
2321
|
-
_optionalChain([callbacks, 'access',
|
|
2390
|
+
_optionalChain([callbacks, 'access', _80 => _80.onChangeIdentity, 'optionalCall', _81 => _81()]);
|
|
2322
2391
|
}
|
|
2323
2392
|
}, "Change")
|
|
2324
2393
|
);
|
|
@@ -2352,7 +2421,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2352
2421
|
},
|
|
2353
2422
|
hide() {
|
|
2354
2423
|
visible = false;
|
|
2355
|
-
_optionalChain([panel, 'optionalAccess',
|
|
2424
|
+
_optionalChain([panel, 'optionalAccess', _82 => _82.classList, 'access', _83 => _83.remove, 'call', _84 => _84("grabby-popover-visible")]);
|
|
2356
2425
|
},
|
|
2357
2426
|
isVisible() {
|
|
2358
2427
|
return visible;
|
|
@@ -2362,7 +2431,7 @@ function createCommentsPanel(callbacks, options = {}) {
|
|
|
2362
2431
|
},
|
|
2363
2432
|
dispose() {
|
|
2364
2433
|
revokeThumbs();
|
|
2365
|
-
_optionalChain([panel, 'optionalAccess',
|
|
2434
|
+
_optionalChain([panel, 'optionalAccess', _85 => _85.remove, 'call', _86 => _86()]);
|
|
2366
2435
|
removeStyles(STYLE_ID4);
|
|
2367
2436
|
panel = null;
|
|
2368
2437
|
visible = false;
|
|
@@ -2443,6 +2512,18 @@ function createCommentPopover(callbacks) {
|
|
|
2443
2512
|
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 4px; border: none;
|
|
2444
2513
|
background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer; text-decoration: underline;
|
|
2445
2514
|
}
|
|
2515
|
+
#${POPOVER_ID} .grabby-cp-edit-actions { display: flex; align-items: center; gap: 6px; }
|
|
2516
|
+
#${POPOVER_ID} .grabby-cp-edit-actions .grabby-cp-spacer { flex: 1; }
|
|
2517
|
+
#${POPOVER_ID} .grabby-cp-delete {
|
|
2518
|
+
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 6px; border: none;
|
|
2519
|
+
border-radius: 8px; background: transparent; color: #b91c1c; cursor: pointer;
|
|
2520
|
+
}
|
|
2521
|
+
#${POPOVER_ID} .grabby-cp-delete:hover { background: rgba(185, 28, 28, 0.08); }
|
|
2522
|
+
#${POPOVER_ID} .grabby-cp-cancel {
|
|
2523
|
+
font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 8px 10px; border: none;
|
|
2524
|
+
border-radius: 8px; background: transparent; color: var(--grabby-text-muted, #64748b); cursor: pointer;
|
|
2525
|
+
}
|
|
2526
|
+
#${POPOVER_ID} .grabby-cp-cancel:hover { background: var(--grabby-surface, #f1f5f9); }
|
|
2446
2527
|
#${POPOVER_ID} .grabby-cp-hint {
|
|
2447
2528
|
font-size: 11px;
|
|
2448
2529
|
color: var(--grabby-text-muted, #94a3b8);
|
|
@@ -2504,6 +2585,37 @@ function createCommentPopover(callbacks) {
|
|
|
2504
2585
|
function isEditable(el) {
|
|
2505
2586
|
return !!el && el !== textarea && el !== nameInput && isEditableElement(el);
|
|
2506
2587
|
}
|
|
2588
|
+
function save() {
|
|
2589
|
+
const v = _optionalChain([textarea, 'optionalAccess', _87 => _87.value, 'access', _88 => _88.trim, 'call', _89 => _89()]);
|
|
2590
|
+
if (!v) return;
|
|
2591
|
+
pendingValue = v;
|
|
2592
|
+
if (askIdentity) showIdentityStep();
|
|
2593
|
+
else finish();
|
|
2594
|
+
}
|
|
2595
|
+
function editActions() {
|
|
2596
|
+
const act = (fn) => (e) => {
|
|
2597
|
+
e.stopPropagation();
|
|
2598
|
+
fn();
|
|
2599
|
+
};
|
|
2600
|
+
const cancel = () => {
|
|
2601
|
+
const ctx = currentCtx;
|
|
2602
|
+
doHide();
|
|
2603
|
+
callbacks.onCancel(ctx);
|
|
2604
|
+
};
|
|
2605
|
+
const del = () => {
|
|
2606
|
+
const ctx = currentCtx;
|
|
2607
|
+
doHide();
|
|
2608
|
+
_optionalChain([callbacks, 'access', _90 => _90.onDelete, 'optionalCall', _91 => _91(ctx)]);
|
|
2609
|
+
};
|
|
2610
|
+
return h(
|
|
2611
|
+
"div",
|
|
2612
|
+
{ class: "grabby-cp-edit-actions" },
|
|
2613
|
+
callbacks.onDelete ? h("button", { type: "button", class: "grabby-cp-delete", "data-grabby-delete": "", onclick: act(del) }, "Delete") : null,
|
|
2614
|
+
h("span", { class: "grabby-cp-spacer" }),
|
|
2615
|
+
h("button", { type: "button", class: "grabby-cp-cancel", "data-grabby-cancel": "", onclick: act(cancel) }, "Cancel"),
|
|
2616
|
+
h("button", { type: "button", class: "grabby-cp-post", "data-grabby-save": "", onclick: act(save) }, "Save")
|
|
2617
|
+
);
|
|
2618
|
+
}
|
|
2507
2619
|
function finish(identity) {
|
|
2508
2620
|
const ctx = currentCtx;
|
|
2509
2621
|
const value = pendingValue;
|
|
@@ -2569,11 +2681,7 @@ function createCommentPopover(callbacks) {
|
|
|
2569
2681
|
e.stopImmediatePropagation();
|
|
2570
2682
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
2571
2683
|
e.preventDefault();
|
|
2572
|
-
|
|
2573
|
-
if (!v) return;
|
|
2574
|
-
pendingValue = v;
|
|
2575
|
-
if (askIdentity) showIdentityStep();
|
|
2576
|
-
else finish();
|
|
2684
|
+
save();
|
|
2577
2685
|
} else if (e.key === "Escape") {
|
|
2578
2686
|
e.preventDefault();
|
|
2579
2687
|
const ctx = currentCtx;
|
|
@@ -2607,6 +2715,7 @@ function createCommentPopover(callbacks) {
|
|
|
2607
2715
|
currentCtx = { mode: opts.mode, entryId: opts.entryId };
|
|
2608
2716
|
askIdentity = opts.askIdentity === true && opts.mode === "new";
|
|
2609
2717
|
visible = true;
|
|
2718
|
+
if (opts.mode === "edit") el.appendChild(editActions());
|
|
2610
2719
|
position(el, opts.anchor);
|
|
2611
2720
|
attachKey();
|
|
2612
2721
|
_optionalChain([textarea, 'optionalAccess', _100 => _100.focus, 'call', _101 => _101()]);
|
|
@@ -3138,9 +3247,10 @@ function createOutbox(deps) {
|
|
|
3138
3247
|
}, delay);
|
|
3139
3248
|
}
|
|
3140
3249
|
function wireShape(c) {
|
|
3141
|
-
const { screenshot: _shot, sync: _sync, ...rest } = c;
|
|
3250
|
+
const { screenshot: _shot, sync: _sync, pin: _pin, ...rest } = c;
|
|
3142
3251
|
void _shot;
|
|
3143
3252
|
void _sync;
|
|
3253
|
+
void _pin;
|
|
3144
3254
|
return rest;
|
|
3145
3255
|
}
|
|
3146
3256
|
function postComment(comment) {
|
|
@@ -3450,11 +3560,314 @@ function createFreezeOverlay() {
|
|
|
3450
3560
|
};
|
|
3451
3561
|
}
|
|
3452
3562
|
|
|
3563
|
+
// src/core/overlay/markers.ts
|
|
3564
|
+
var LAYER_ID = "__grabby-markers__";
|
|
3565
|
+
var TIP_ID = "__grabby-marker-tip__";
|
|
3566
|
+
var STYLE_ID9 = "__grabby-marker-styles__";
|
|
3567
|
+
var SIZE = 22;
|
|
3568
|
+
var ROUTE_CHECK_MS = 250;
|
|
3569
|
+
var LOOKUP_RETRY_MS = 500;
|
|
3570
|
+
var STAGGER_MS = 30;
|
|
3571
|
+
var TIP_MAX = 140;
|
|
3572
|
+
var ICON_EDIT = {
|
|
3573
|
+
size: 12,
|
|
3574
|
+
shapes: paths("M10.5 2.5l3 3L6 13H3v-3z", "M9 4l3 3")
|
|
3575
|
+
};
|
|
3576
|
+
function createMarkers(deps) {
|
|
3577
|
+
let layer = null;
|
|
3578
|
+
let tip = null;
|
|
3579
|
+
let visible = false;
|
|
3580
|
+
let route = "";
|
|
3581
|
+
let rafId = null;
|
|
3582
|
+
let lastRouteCheck = 0;
|
|
3583
|
+
let hovered = null;
|
|
3584
|
+
const entries = /* @__PURE__ */ new Map();
|
|
3585
|
+
function injectStyles2() {
|
|
3586
|
+
if (hasStyles(STYLE_ID9)) return;
|
|
3587
|
+
addStyles(STYLE_ID9, `
|
|
3588
|
+
#${LAYER_ID} {
|
|
3589
|
+
position: fixed;
|
|
3590
|
+
inset: 0;
|
|
3591
|
+
pointer-events: none;
|
|
3592
|
+
z-index: ${Z_INDEX_CROSSHAIR};
|
|
3593
|
+
}
|
|
3594
|
+
#${LAYER_ID} .grabby-marker {
|
|
3595
|
+
position: absolute;
|
|
3596
|
+
left: 0;
|
|
3597
|
+
top: 0;
|
|
3598
|
+
width: ${SIZE}px;
|
|
3599
|
+
height: ${SIZE}px;
|
|
3600
|
+
margin: 0;
|
|
3601
|
+
padding: 0;
|
|
3602
|
+
border: none;
|
|
3603
|
+
border-radius: 50%;
|
|
3604
|
+
background: var(--grabby-accent, #2563eb);
|
|
3605
|
+
color: #fff;
|
|
3606
|
+
box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
3607
|
+
font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
3608
|
+
display: flex;
|
|
3609
|
+
align-items: center;
|
|
3610
|
+
justify-content: center;
|
|
3611
|
+
cursor: pointer;
|
|
3612
|
+
pointer-events: auto;
|
|
3613
|
+
transition: transform 0.12s ease, box-shadow 0.15s ease;
|
|
3614
|
+
}
|
|
3615
|
+
#${LAYER_ID} .grabby-marker[hidden] { display: none; }
|
|
3616
|
+
#${LAYER_ID} .grabby-marker:hover,
|
|
3617
|
+
#${LAYER_ID} .grabby-marker:focus-visible {
|
|
3618
|
+
z-index: 1;
|
|
3619
|
+
outline: none;
|
|
3620
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 5px color-mix(in srgb, var(--grabby-accent, #2563eb) 35%, transparent), 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
3621
|
+
}
|
|
3622
|
+
#${LAYER_ID} .grabby-marker-edit { display: none; }
|
|
3623
|
+
#${LAYER_ID} .grabby-marker:hover .grabby-marker-num,
|
|
3624
|
+
#${LAYER_ID} .grabby-marker:focus-visible .grabby-marker-num { display: none; }
|
|
3625
|
+
#${LAYER_ID} .grabby-marker:hover .grabby-marker-edit,
|
|
3626
|
+
#${LAYER_ID} .grabby-marker:focus-visible .grabby-marker-edit { display: block; }
|
|
3627
|
+
#${LAYER_ID} .grabby-marker-in {
|
|
3628
|
+
animation: grabby-marker-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
|
|
3629
|
+
}
|
|
3630
|
+
#${LAYER_ID} .grabby-marker-out {
|
|
3631
|
+
animation: grabby-marker-out 0.2s ease-out both;
|
|
3632
|
+
pointer-events: none;
|
|
3633
|
+
}
|
|
3634
|
+
@keyframes grabby-marker-in {
|
|
3635
|
+
from { opacity: 0; scale: 0.3; }
|
|
3636
|
+
to { opacity: 1; scale: 1; }
|
|
3637
|
+
}
|
|
3638
|
+
@keyframes grabby-marker-out {
|
|
3639
|
+
from { opacity: 1; scale: 1; }
|
|
3640
|
+
to { opacity: 0; scale: 0.3; }
|
|
3641
|
+
}
|
|
3642
|
+
#${TIP_ID} {
|
|
3643
|
+
position: fixed;
|
|
3644
|
+
z-index: ${Z_INDEX_CROSSHAIR};
|
|
3645
|
+
max-width: 260px;
|
|
3646
|
+
padding: 8px 10px;
|
|
3647
|
+
border-radius: 10px;
|
|
3648
|
+
background: var(--grabby-label-bg, #1e293b);
|
|
3649
|
+
color: #fff;
|
|
3650
|
+
font: 12px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
3651
|
+
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
|
|
3652
|
+
pointer-events: none;
|
|
3653
|
+
white-space: pre-wrap;
|
|
3654
|
+
overflow-wrap: anywhere;
|
|
3655
|
+
animation: grabby-marker-tip-in 0.12s ease both;
|
|
3656
|
+
}
|
|
3657
|
+
#${TIP_ID}[hidden] { display: none; }
|
|
3658
|
+
#${TIP_ID} .grabby-marker-tip-hint { display: block; margin-top: 4px; opacity: 0.6; font-size: 11px; }
|
|
3659
|
+
@keyframes grabby-marker-tip-in {
|
|
3660
|
+
from { opacity: 0; transform: translateY(-2px); }
|
|
3661
|
+
to { opacity: 1; transform: none; }
|
|
3662
|
+
}
|
|
3663
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3664
|
+
#${LAYER_ID} .grabby-marker-in, #${LAYER_ID} .grabby-marker-out, #${TIP_ID} { animation: none; }
|
|
3665
|
+
}
|
|
3666
|
+
`);
|
|
3667
|
+
}
|
|
3668
|
+
function ensureLayer() {
|
|
3669
|
+
if (layer) return layer;
|
|
3670
|
+
injectStyles2();
|
|
3671
|
+
layer = document.createElement("div");
|
|
3672
|
+
layer.id = LAYER_ID;
|
|
3673
|
+
tip = document.createElement("div");
|
|
3674
|
+
tip.id = TIP_ID;
|
|
3675
|
+
tip.hidden = true;
|
|
3676
|
+
tip.setAttribute("role", "tooltip");
|
|
3677
|
+
getUiRoot().append(layer, tip);
|
|
3678
|
+
return layer;
|
|
3679
|
+
}
|
|
3680
|
+
function pageComments() {
|
|
3681
|
+
return deps.getComments().filter((c) => c.page.route === route).reverse();
|
|
3682
|
+
}
|
|
3683
|
+
function preview(text) {
|
|
3684
|
+
const flat = text.trim();
|
|
3685
|
+
return flat.length > TIP_MAX ? `${flat.slice(0, TIP_MAX - 1)}\u2026` : flat;
|
|
3686
|
+
}
|
|
3687
|
+
function createEntry(comment) {
|
|
3688
|
+
const number = document.createElement("span");
|
|
3689
|
+
number.className = "grabby-marker-num";
|
|
3690
|
+
const button = document.createElement("button");
|
|
3691
|
+
button.type = "button";
|
|
3692
|
+
button.className = "grabby-marker";
|
|
3693
|
+
button.dataset.grabbyMarker = comment.id;
|
|
3694
|
+
button.append(number, svgIcon(ICON_EDIT, "grabby-marker-edit"));
|
|
3695
|
+
const entry = { comment, button, number, element: null, lastLookup: 0 };
|
|
3696
|
+
button.addEventListener("click", (e) => {
|
|
3697
|
+
e.preventDefault();
|
|
3698
|
+
e.stopPropagation();
|
|
3699
|
+
hideTip();
|
|
3700
|
+
deps.onOpen(entry.comment, entry.element, button);
|
|
3701
|
+
});
|
|
3702
|
+
button.addEventListener("mouseenter", () => startHover(entry));
|
|
3703
|
+
button.addEventListener("focus", () => startHover(entry));
|
|
3704
|
+
button.addEventListener("mouseleave", () => endHover(entry));
|
|
3705
|
+
button.addEventListener("blur", () => endHover(entry));
|
|
3706
|
+
return entry;
|
|
3707
|
+
}
|
|
3708
|
+
function startHover(entry) {
|
|
3709
|
+
hovered = entry;
|
|
3710
|
+
showTip(entry);
|
|
3711
|
+
deps.onHover(entry.comment, entry.element);
|
|
3712
|
+
}
|
|
3713
|
+
function endHover(entry) {
|
|
3714
|
+
if (hovered !== entry) return;
|
|
3715
|
+
hovered = null;
|
|
3716
|
+
hideTip();
|
|
3717
|
+
deps.onHover(null, null);
|
|
3718
|
+
}
|
|
3719
|
+
function showTip(entry) {
|
|
3720
|
+
if (!tip) return;
|
|
3721
|
+
const hint = document.createElement("span");
|
|
3722
|
+
hint.className = "grabby-marker-tip-hint";
|
|
3723
|
+
hint.textContent = "Click to edit";
|
|
3724
|
+
tip.replaceChildren(document.createTextNode(preview(entry.comment.comment)), hint);
|
|
3725
|
+
tip.hidden = false;
|
|
3726
|
+
placeTip(entry);
|
|
3727
|
+
}
|
|
3728
|
+
function placeTip(entry) {
|
|
3729
|
+
if (!tip || tip.hidden) return;
|
|
3730
|
+
const m = entry.button.getBoundingClientRect();
|
|
3731
|
+
const t = tip.getBoundingClientRect();
|
|
3732
|
+
const left = Math.max(8, Math.min(m.left + m.width / 2 - t.width / 2, window.innerWidth - t.width - 8));
|
|
3733
|
+
const below = m.bottom + 8;
|
|
3734
|
+
const top = below + t.height > window.innerHeight - 8 ? m.top - 8 - t.height : below;
|
|
3735
|
+
tip.style.left = `${left}px`;
|
|
3736
|
+
tip.style.top = `${Math.max(8, top)}px`;
|
|
3737
|
+
}
|
|
3738
|
+
function hideTip() {
|
|
3739
|
+
if (tip) tip.hidden = true;
|
|
3740
|
+
}
|
|
3741
|
+
function animateIn(button, delay) {
|
|
3742
|
+
button.classList.remove("grabby-marker-out", "grabby-marker-in");
|
|
3743
|
+
button.style.animationDelay = `${delay}ms`;
|
|
3744
|
+
void button.offsetWidth;
|
|
3745
|
+
button.classList.add("grabby-marker-in");
|
|
3746
|
+
}
|
|
3747
|
+
function removeEntry(id, animate) {
|
|
3748
|
+
const entry = entries.get(id);
|
|
3749
|
+
if (!entry) return;
|
|
3750
|
+
entries.delete(id);
|
|
3751
|
+
if (hovered === entry) endHover(entry);
|
|
3752
|
+
if (!animate) {
|
|
3753
|
+
entry.button.remove();
|
|
3754
|
+
return;
|
|
3755
|
+
}
|
|
3756
|
+
entry.button.style.animationDelay = "0ms";
|
|
3757
|
+
entry.button.classList.remove("grabby-marker-in");
|
|
3758
|
+
entry.button.classList.add("grabby-marker-out");
|
|
3759
|
+
setTimeout(() => entry.button.remove(), 220);
|
|
3760
|
+
}
|
|
3761
|
+
function sync(fresh) {
|
|
3762
|
+
if (!visible) return;
|
|
3763
|
+
const host2 = ensureLayer();
|
|
3764
|
+
const list = pageComments();
|
|
3765
|
+
const ids = new Set(list.map((c) => c.id));
|
|
3766
|
+
for (const id of [...entries.keys()]) if (!ids.has(id)) removeEntry(id, !fresh);
|
|
3767
|
+
list.forEach((comment, i) => {
|
|
3768
|
+
let entry = entries.get(comment.id);
|
|
3769
|
+
const isNew = !entry;
|
|
3770
|
+
if (!entry) {
|
|
3771
|
+
entry = createEntry(comment);
|
|
3772
|
+
entries.set(comment.id, entry);
|
|
3773
|
+
host2.appendChild(entry.button);
|
|
3774
|
+
}
|
|
3775
|
+
entry.comment = comment;
|
|
3776
|
+
const n = String(i + 1);
|
|
3777
|
+
entry.number.textContent = n;
|
|
3778
|
+
entry.button.setAttribute("aria-label", `Comment ${n}: ${preview(comment.comment)}. Click to edit.`);
|
|
3779
|
+
if (fresh || isNew) animateIn(entry.button, fresh ? i * STAGGER_MS : 0);
|
|
3780
|
+
});
|
|
3781
|
+
if (hovered && entries.get(hovered.comment.id) === hovered) showTip(hovered);
|
|
3782
|
+
position(performance.now());
|
|
3783
|
+
schedule();
|
|
3784
|
+
}
|
|
3785
|
+
function position(now) {
|
|
3786
|
+
for (const entry of entries.values()) {
|
|
3787
|
+
if (!_optionalChain([entry, 'access', _134 => _134.element, 'optionalAccess', _135 => _135.isConnected])) {
|
|
3788
|
+
entry.element = null;
|
|
3789
|
+
if (now - entry.lastLookup >= LOOKUP_RETRY_MS) {
|
|
3790
|
+
entry.lastLookup = now;
|
|
3791
|
+
entry.element = deps.findElement(entry.comment);
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
const rect = _optionalChain([entry, 'access', _136 => _136.element, 'optionalAccess', _137 => _137.getBoundingClientRect, 'call', _138 => _138()]);
|
|
3795
|
+
if (!rect || rect.width === 0 && rect.height === 0) {
|
|
3796
|
+
entry.button.hidden = true;
|
|
3797
|
+
continue;
|
|
3798
|
+
}
|
|
3799
|
+
const pin = _nullishCoalesce(entry.comment.pin, () => ( { x: 1, y: 0 }));
|
|
3800
|
+
const x = rect.left + pin.x * rect.width - SIZE / 2;
|
|
3801
|
+
const y = rect.top + pin.y * rect.height - SIZE / 2;
|
|
3802
|
+
entry.button.hidden = false;
|
|
3803
|
+
entry.button.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
|
|
3804
|
+
}
|
|
3805
|
+
if (hovered) placeTip(hovered);
|
|
3806
|
+
}
|
|
3807
|
+
function frame() {
|
|
3808
|
+
rafId = null;
|
|
3809
|
+
const now = performance.now();
|
|
3810
|
+
if (!visible) return;
|
|
3811
|
+
if (now - lastRouteCheck >= ROUTE_CHECK_MS) {
|
|
3812
|
+
lastRouteCheck = now;
|
|
3813
|
+
const next = deps.currentRoute();
|
|
3814
|
+
if (next !== route) {
|
|
3815
|
+
route = next;
|
|
3816
|
+
for (const id of [...entries.keys()]) removeEntry(id, false);
|
|
3817
|
+
sync(true);
|
|
3818
|
+
return;
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
position(now);
|
|
3822
|
+
schedule();
|
|
3823
|
+
}
|
|
3824
|
+
function schedule() {
|
|
3825
|
+
if (rafId === null && visible) rafId = requestAnimationFrame(frame);
|
|
3826
|
+
}
|
|
3827
|
+
function stop() {
|
|
3828
|
+
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
3829
|
+
rafId = null;
|
|
3830
|
+
}
|
|
3831
|
+
return {
|
|
3832
|
+
setVisible(next) {
|
|
3833
|
+
if (next === visible) return;
|
|
3834
|
+
visible = next;
|
|
3835
|
+
if (next) {
|
|
3836
|
+
route = deps.currentRoute();
|
|
3837
|
+
lastRouteCheck = performance.now();
|
|
3838
|
+
sync(true);
|
|
3839
|
+
} else {
|
|
3840
|
+
stop();
|
|
3841
|
+
hideTip();
|
|
3842
|
+
if (hovered) endHover(hovered);
|
|
3843
|
+
for (const id of [...entries.keys()]) removeEntry(id, true);
|
|
3844
|
+
}
|
|
3845
|
+
},
|
|
3846
|
+
refresh() {
|
|
3847
|
+
sync(false);
|
|
3848
|
+
},
|
|
3849
|
+
isMarkerElement(el) {
|
|
3850
|
+
return !!layer && (layer === el || layer.contains(el));
|
|
3851
|
+
},
|
|
3852
|
+
dispose() {
|
|
3853
|
+
stop();
|
|
3854
|
+
entries.clear();
|
|
3855
|
+
_optionalChain([layer, 'optionalAccess', _139 => _139.remove, 'call', _140 => _140()]);
|
|
3856
|
+
_optionalChain([tip, 'optionalAccess', _141 => _141.remove, 'call', _142 => _142()]);
|
|
3857
|
+
layer = null;
|
|
3858
|
+
tip = null;
|
|
3859
|
+
hovered = null;
|
|
3860
|
+
visible = false;
|
|
3861
|
+
removeStyles(STYLE_ID9);
|
|
3862
|
+
}
|
|
3863
|
+
};
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3453
3866
|
// src/core/overlay/select-feedback.ts
|
|
3454
|
-
var
|
|
3867
|
+
var STYLE_ID10 = "__grabby-feedback-styles__";
|
|
3455
3868
|
function injectStyles() {
|
|
3456
|
-
if (hasStyles(
|
|
3457
|
-
addStyles(
|
|
3869
|
+
if (hasStyles(STYLE_ID10)) return;
|
|
3870
|
+
addStyles(STYLE_ID10, `
|
|
3458
3871
|
@keyframes grabby-flash {
|
|
3459
3872
|
0% { opacity: 1; }
|
|
3460
3873
|
100% { opacity: 0; transform: scale(1.02); }
|
|
@@ -3533,7 +3946,7 @@ function showSelectFeedback(element, label = "Selected") {
|
|
|
3533
3946
|
setTimeout(cleanup, 1200);
|
|
3534
3947
|
}
|
|
3535
3948
|
function disposeFeedbackStyles() {
|
|
3536
|
-
removeStyles(
|
|
3949
|
+
removeStyles(STYLE_ID10);
|
|
3537
3950
|
}
|
|
3538
3951
|
|
|
3539
3952
|
// src/core/storage/history-persistence.ts
|
|
@@ -3624,7 +4037,7 @@ function clearPersistedHistory() {
|
|
|
3624
4037
|
var baselineFrame = null;
|
|
3625
4038
|
var baselineCache = /* @__PURE__ */ new Map();
|
|
3626
4039
|
function baselineDoc() {
|
|
3627
|
-
if (_optionalChain([baselineFrame, 'optionalAccess',
|
|
4040
|
+
if (_optionalChain([baselineFrame, 'optionalAccess', _143 => _143.isConnected]) && baselineFrame.contentDocument) return baselineFrame.contentDocument;
|
|
3628
4041
|
try {
|
|
3629
4042
|
baselineFrame = document.createElement("iframe");
|
|
3630
4043
|
baselineFrame.setAttribute("aria-hidden", "true");
|
|
@@ -3654,8 +4067,8 @@ function baselineFor(tag, type, props) {
|
|
|
3654
4067
|
const missing = props.filter((p) => !cached.has(p));
|
|
3655
4068
|
if (missing.length > 0) {
|
|
3656
4069
|
const doc = baselineDoc();
|
|
3657
|
-
const view = _optionalChain([doc, 'optionalAccess',
|
|
3658
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
4070
|
+
const view = _optionalChain([doc, 'optionalAccess', _144 => _144.defaultView]);
|
|
4071
|
+
if (_optionalChain([doc, 'optionalAccess', _145 => _145.body]) && view) {
|
|
3659
4072
|
const probe = doc.createElement(tag);
|
|
3660
4073
|
if (type) probe.setAttribute("type", type);
|
|
3661
4074
|
doc.body.appendChild(probe);
|
|
@@ -3669,7 +4082,7 @@ function baselineFor(tag, type, props) {
|
|
|
3669
4082
|
return cached;
|
|
3670
4083
|
}
|
|
3671
4084
|
function disposeStyleBaseline() {
|
|
3672
|
-
_optionalChain([baselineFrame, 'optionalAccess',
|
|
4085
|
+
_optionalChain([baselineFrame, 'optionalAccess', _146 => _146.remove, 'call', _147 => _147()]);
|
|
3673
4086
|
baselineFrame = null;
|
|
3674
4087
|
baselineCache.clear();
|
|
3675
4088
|
}
|
|
@@ -3771,7 +4184,7 @@ function states(el) {
|
|
|
3771
4184
|
}
|
|
3772
4185
|
function actionFacts(el) {
|
|
3773
4186
|
const f = {};
|
|
3774
|
-
const imgAlt = _nullishCoalesce(_optionalChain([el, 'access',
|
|
4187
|
+
const imgAlt = _nullishCoalesce(_optionalChain([el, 'access', _148 => _148.querySelector, 'call', _149 => _149("img[alt]"), 'optionalAccess', _150 => _150.getAttribute, 'call', _151 => _151("alt")]), () => ( ""));
|
|
3775
4188
|
put(f, "label", accessibleLabel(el) || textOf(el, 80) || redact(_nullishCoalesce(el.getAttribute("title"), () => ( ""))) || redact(imgAlt));
|
|
3776
4189
|
if (el.tagName === "A") put(f, "href", sanitizeUrl(_nullishCoalesce(el.getAttribute("href"), () => ( ""))));
|
|
3777
4190
|
else if (el.tagName === "BUTTON" || el.tagName === "INPUT") put(f, "type", _nullishCoalesce(el.getAttribute("type"), () => ( (el.tagName === "BUTTON" ? "submit" : ""))));
|
|
@@ -3820,7 +4233,7 @@ function mediaFacts(el) {
|
|
|
3820
4233
|
put(f, "label", accessibleLabel(el) || textOf(_nullishCoalesce(el.querySelector("title"), () => ( el)), 40));
|
|
3821
4234
|
put(f, "viewBox", _nullishCoalesce(el.getAttribute("viewBox"), () => ( "")));
|
|
3822
4235
|
} else if (el.tagName === "VIDEO" || el.tagName === "AUDIO" || el.tagName === "IFRAME") {
|
|
3823
|
-
put(f, "src", basename3(_nullishCoalesce(_nullishCoalesce(el.getAttribute("src"), () => ( _optionalChain([el, 'access',
|
|
4236
|
+
put(f, "src", basename3(_nullishCoalesce(_nullishCoalesce(el.getAttribute("src"), () => ( _optionalChain([el, 'access', _152 => _152.querySelector, 'call', _153 => _153("source"), 'optionalAccess', _154 => _154.getAttribute, 'call', _155 => _155("src")]))), () => ( ""))));
|
|
3824
4237
|
put(f, "title", redact(_nullishCoalesce(el.getAttribute("title"), () => ( ""))));
|
|
3825
4238
|
}
|
|
3826
4239
|
put(f, "size", size(el));
|
|
@@ -3828,8 +4241,8 @@ function mediaFacts(el) {
|
|
|
3828
4241
|
return f;
|
|
3829
4242
|
}
|
|
3830
4243
|
function childLabel(child, resolver) {
|
|
3831
|
-
const resolved = _optionalChain([resolver, 'optionalCall',
|
|
3832
|
-
if (_optionalChain([resolved, 'optionalAccess',
|
|
4244
|
+
const resolved = _optionalChain([resolver, 'optionalCall', _156 => _156(child)]);
|
|
4245
|
+
if (_optionalChain([resolved, 'optionalAccess', _157 => _157.name]) && resolved.hostElement === child) return resolved.name;
|
|
3833
4246
|
const tag = child.tagName.toLowerCase();
|
|
3834
4247
|
if (/^h[1-6]$/.test(tag)) return "heading";
|
|
3835
4248
|
if (tag === "a") return "link";
|
|
@@ -3864,7 +4277,7 @@ function sectionFacts(el, resolver) {
|
|
|
3864
4277
|
const f = {};
|
|
3865
4278
|
put(f, "title", redact(el.ownerDocument.title));
|
|
3866
4279
|
put(f, "viewport", `${window.innerWidth}\xD7${window.innerHeight}`);
|
|
3867
|
-
const regions = Array.from(el.querySelectorAll('header, nav, main, aside, footer, section, [role="region"]')).filter((r) => !_optionalChain([r, 'access',
|
|
4280
|
+
const regions = Array.from(el.querySelectorAll('header, nav, main, aside, footer, section, [role="region"]')).filter((r) => !_optionalChain([r, 'access', _158 => _158.parentElement, 'optionalAccess', _159 => _159.closest, 'call', _160 => _160('header, nav, main, aside, footer, section, [role="region"]')]) || r.parentElement === el).slice(0, 8).map((r) => {
|
|
3868
4281
|
const heading = firstHeading2(r);
|
|
3869
4282
|
return heading ? `${r.tagName.toLowerCase()} "${truncate(heading, 30)}"` : r.tagName.toLowerCase();
|
|
3870
4283
|
});
|
|
@@ -3921,22 +4334,22 @@ function isAppFile(file) {
|
|
|
3921
4334
|
return !!file && !/(^|[\\/])node_modules[\\/]/.test(file);
|
|
3922
4335
|
}
|
|
3923
4336
|
function resolveStack(el, deps) {
|
|
3924
|
-
const comp = _nullishCoalesce(_optionalChain([deps, 'access',
|
|
4337
|
+
const comp = _nullishCoalesce(_optionalChain([deps, 'access', _161 => _161.componentResolver, 'optionalCall', _162 => _162(el)]), () => ( null));
|
|
3925
4338
|
const frames = [];
|
|
3926
4339
|
const named = [];
|
|
3927
|
-
for (const entry of _nullishCoalesce(_optionalChain([comp, 'optionalAccess',
|
|
4340
|
+
for (const entry of _nullishCoalesce(_optionalChain([comp, 'optionalAccess', _163 => _163.stack]), () => ( []))) {
|
|
3928
4341
|
const src = entry.filePath !== void 0 ? { filePath: entry.filePath, line: _nullishCoalesce(entry.line, () => ( null)) } : entry.hostElement && deps.sourceResolver ? deps.sourceResolver(entry.hostElement) : null;
|
|
3929
|
-
const frame = { name: entry.name, file: _nullishCoalesce(_optionalChain([src, 'optionalAccess',
|
|
4342
|
+
const frame = { name: entry.name, file: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _164 => _164.filePath]), () => ( null)), line: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _165 => _165.line]), () => ( null)) };
|
|
3930
4343
|
named.push(frame);
|
|
3931
4344
|
if (isAppFile(frame.file) && frames.length < MAX_STACK) frames.push(frame);
|
|
3932
4345
|
}
|
|
3933
|
-
return { component: _nullishCoalesce(_optionalChain([comp, 'optionalAccess',
|
|
4346
|
+
return { component: _nullishCoalesce(_optionalChain([comp, 'optionalAccess', _166 => _166.name]), () => ( null)), frames: frames.length > 0 ? frames : named.slice(0, 2) };
|
|
3934
4347
|
}
|
|
3935
4348
|
function resolveSource(el, deps, frames) {
|
|
3936
|
-
const own = _optionalChain([deps, 'access',
|
|
4349
|
+
const own = _optionalChain([deps, 'access', _167 => _167.sourceResolver, 'optionalCall', _168 => _168(el)]);
|
|
3937
4350
|
if (own && isAppFile(own.filePath)) return { file: own.filePath, line: own.line, column: own.column };
|
|
3938
4351
|
const first = frames.find((f) => isAppFile(f.file));
|
|
3939
|
-
return _optionalChain([first, 'optionalAccess',
|
|
4352
|
+
return _optionalChain([first, 'optionalAccess', _169 => _169.file]) ? { file: first.file, line: first.line, column: null } : null;
|
|
3940
4353
|
}
|
|
3941
4354
|
function captureTarget(el, deps) {
|
|
3942
4355
|
const cleanClasses = _nullishCoalesce(deps.cleanClasses, () => ( ((list) => list.filter((c) => !isNoiseClass(c)))));
|
|
@@ -3987,7 +4400,7 @@ function sandboxHtml() {
|
|
|
3987
4400
|
return policy ? policy.createHTML(SANDBOX_HTML) : null;
|
|
3988
4401
|
}
|
|
3989
4402
|
async function getSandbox() {
|
|
3990
|
-
if (_optionalChain([sandbox, 'optionalAccess',
|
|
4403
|
+
if (_optionalChain([sandbox, 'optionalAccess', _170 => _170.isConnected])) return sandbox;
|
|
3991
4404
|
const frame = document.createElement("iframe");
|
|
3992
4405
|
frame.setAttribute("aria-hidden", "true");
|
|
3993
4406
|
frame.setAttribute("tabindex", "-1");
|
|
@@ -4011,7 +4424,7 @@ async function getSandbox() {
|
|
|
4011
4424
|
return frame;
|
|
4012
4425
|
}
|
|
4013
4426
|
function disposeScreenshotSandbox() {
|
|
4014
|
-
_optionalChain([sandbox, 'optionalAccess',
|
|
4427
|
+
_optionalChain([sandbox, 'optionalAccess', _171 => _171.remove, 'call', _172 => _172()]);
|
|
4015
4428
|
sandbox = null;
|
|
4016
4429
|
}
|
|
4017
4430
|
function withTimeout(promise, ms) {
|
|
@@ -4171,7 +4584,7 @@ function resolveComponent(element) {
|
|
|
4171
4584
|
name: cleanComponentName(owning.constructor.name),
|
|
4172
4585
|
hostElement: _nullishCoalesce(host2, () => ( walk.parentElement))
|
|
4173
4586
|
});
|
|
4174
|
-
current = _nullishCoalesce(_nullishCoalesce(_optionalChain([host2, 'optionalAccess',
|
|
4587
|
+
current = _nullishCoalesce(_nullishCoalesce(_optionalChain([host2, 'optionalAccess', _173 => _173.parentElement]), () => ( _optionalChain([walk, 'access', _174 => _174.parentElement, 'optionalAccess', _175 => _175.parentElement]))), () => ( null));
|
|
4175
4588
|
while (current) {
|
|
4176
4589
|
const comp = ng.getComponent(current);
|
|
4177
4590
|
if (comp && !seen2.has(comp)) {
|
|
@@ -4305,14 +4718,14 @@ function resolveComponent2(element) {
|
|
|
4305
4718
|
let current = fiber;
|
|
4306
4719
|
while (current && stack.length < MAX_STACK2) {
|
|
4307
4720
|
const name = getComponentName(current.type);
|
|
4308
|
-
if (name && !isNoise(name) && _optionalChain([stack, 'access',
|
|
4721
|
+
if (name && !isNoise(name) && _optionalChain([stack, 'access', _176 => _176[stack.length - 1], 'optionalAccess', _177 => _177.name]) !== name) {
|
|
4309
4722
|
stack.push({ name, hostElement: findHostElement(current) });
|
|
4310
4723
|
}
|
|
4311
4724
|
current = current.return;
|
|
4312
4725
|
}
|
|
4313
4726
|
return {
|
|
4314
|
-
name: _nullishCoalesce(_optionalChain([stack, 'access',
|
|
4315
|
-
hostElement: _nullishCoalesce(_optionalChain([stack, 'access',
|
|
4727
|
+
name: _nullishCoalesce(_optionalChain([stack, 'access', _178 => _178[0], 'optionalAccess', _179 => _179.name]), () => ( null)),
|
|
4728
|
+
hostElement: _nullishCoalesce(_optionalChain([stack, 'access', _180 => _180[0], 'optionalAccess', _181 => _181.hostElement]), () => ( null)),
|
|
4316
4729
|
stack
|
|
4317
4730
|
};
|
|
4318
4731
|
}
|
|
@@ -4323,7 +4736,7 @@ var LOCATION = /^(.*?):(\d+):(\d+)(?::([A-Za-z_$][\w$.]*))?$/;
|
|
|
4323
4736
|
function resolveSource3(element) {
|
|
4324
4737
|
let current = element;
|
|
4325
4738
|
while (current) {
|
|
4326
|
-
const raw = _optionalChain([current, 'access',
|
|
4739
|
+
const raw = _optionalChain([current, 'access', _182 => _182.getAttribute, 'optionalCall', _183 => _183(SOURCE_ATTRIBUTE)]);
|
|
4327
4740
|
if (raw) return parseLocation(raw);
|
|
4328
4741
|
current = current.parentElement;
|
|
4329
4742
|
}
|
|
@@ -4335,7 +4748,7 @@ function parseLocation(raw) {
|
|
|
4335
4748
|
return { filePath: match[1], line: Number(match[2]), column: Number(match[3]) };
|
|
4336
4749
|
}
|
|
4337
4750
|
function ownStamp(element) {
|
|
4338
|
-
const raw = _optionalChain([element, 'optionalAccess',
|
|
4751
|
+
const raw = _optionalChain([element, 'optionalAccess', _184 => _184.getAttribute, 'optionalCall', _185 => _185(SOURCE_ATTRIBUTE)]);
|
|
4339
4752
|
if (!raw) return null;
|
|
4340
4753
|
const match = LOCATION.exec(raw);
|
|
4341
4754
|
if (!match) return { file: raw, line: null, column: null, name: null };
|
|
@@ -4350,8 +4763,8 @@ function nameFromStamps(result) {
|
|
|
4350
4763
|
const stack = [];
|
|
4351
4764
|
for (const entry of result.stack) {
|
|
4352
4765
|
const stamp = ownStamp(entry.hostElement);
|
|
4353
|
-
const name = _nullishCoalesce(_optionalChain([stamp, 'optionalAccess',
|
|
4354
|
-
if (name && _optionalChain([stack, 'access',
|
|
4766
|
+
const name = _nullishCoalesce(_optionalChain([stamp, 'optionalAccess', _186 => _186.name]), () => ( (stamp ? baseName(stamp.file) : null)));
|
|
4767
|
+
if (name && _optionalChain([stack, 'access', _187 => _187[stack.length - 1], 'optionalAccess', _188 => _188.name]) !== name) stack.push({ name, hostElement: entry.hostElement });
|
|
4355
4768
|
}
|
|
4356
4769
|
return stack[0] ? { name: stack[0].name, hostElement: stack[0].hostElement, stack } : null;
|
|
4357
4770
|
}
|
|
@@ -4387,7 +4800,7 @@ function vue3Name(inst) {
|
|
|
4387
4800
|
return t.__name || t.name || t.displayName || (t.__file ? baseName(t.__file) : null);
|
|
4388
4801
|
}
|
|
4389
4802
|
function vue3Host(inst) {
|
|
4390
|
-
return firstElement(_nullishCoalesce(_optionalChain([inst, 'access',
|
|
4803
|
+
return firstElement(_nullishCoalesce(_optionalChain([inst, 'access', _189 => _189.subTree, 'optionalAccess', _190 => _190.el]), () => ( _optionalChain([inst, 'access', _191 => _191.vnode, 'optionalAccess', _192 => _192.el]))));
|
|
4391
4804
|
}
|
|
4392
4805
|
function vue2Owner(el) {
|
|
4393
4806
|
let current = el;
|
|
@@ -4427,7 +4840,7 @@ function resolveVueComponent(el) {
|
|
|
4427
4840
|
}
|
|
4428
4841
|
function resolveVueSource(el) {
|
|
4429
4842
|
const inst3 = vue3Owner(el);
|
|
4430
|
-
const file = _nullishCoalesce(_optionalChain([inst3, 'optionalAccess',
|
|
4843
|
+
const file = _nullishCoalesce(_optionalChain([inst3, 'optionalAccess', _193 => _193.type, 'optionalAccess', _194 => _194.__file]), () => ( _optionalChain([vue2Owner, 'call', _195 => _195(el), 'optionalAccess', _196 => _196.$options, 'optionalAccess', _197 => _197.__file])));
|
|
4431
4844
|
return file ? { filePath: relativizePath(file), line: null, column: null } : NO_SOURCE;
|
|
4432
4845
|
}
|
|
4433
4846
|
var vueAdapter = {
|
|
@@ -4443,19 +4856,19 @@ function metaOf(el) {
|
|
|
4443
4856
|
let current = el;
|
|
4444
4857
|
while (current) {
|
|
4445
4858
|
const meta = current.__svelte_meta;
|
|
4446
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
4859
|
+
if (_optionalChain([meta, 'optionalAccess', _198 => _198.loc])) return { meta, el: current };
|
|
4447
4860
|
current = current.parentElement;
|
|
4448
4861
|
}
|
|
4449
4862
|
return null;
|
|
4450
4863
|
}
|
|
4451
4864
|
function lineOf(meta) {
|
|
4452
|
-
const line = _optionalChain([meta, 'access',
|
|
4865
|
+
const line = _optionalChain([meta, 'access', _199 => _199.loc, 'optionalAccess', _200 => _200.line]);
|
|
4453
4866
|
if (typeof line !== "number") return null;
|
|
4454
4867
|
return "parent" in meta ? line : line + 1;
|
|
4455
4868
|
}
|
|
4456
4869
|
function resolveSvelteComponent(el) {
|
|
4457
4870
|
const found = metaOf(el);
|
|
4458
|
-
if (!_optionalChain([found, 'optionalAccess',
|
|
4871
|
+
if (!_optionalChain([found, 'optionalAccess', _201 => _201.meta, 'access', _202 => _202.loc, 'optionalAccess', _203 => _203.file])) return null;
|
|
4459
4872
|
const { meta } = found;
|
|
4460
4873
|
const own = baseName(meta.loc.file);
|
|
4461
4874
|
const stack = [{ name: own, hostElement: found.el }];
|
|
@@ -4469,9 +4882,9 @@ function resolveSvelteComponent(el) {
|
|
|
4469
4882
|
}
|
|
4470
4883
|
function resolveSvelteSource(el) {
|
|
4471
4884
|
const found = metaOf(el);
|
|
4472
|
-
const file = _optionalChain([found, 'optionalAccess',
|
|
4885
|
+
const file = _optionalChain([found, 'optionalAccess', _204 => _204.meta, 'access', _205 => _205.loc, 'optionalAccess', _206 => _206.file]);
|
|
4473
4886
|
if (!found || !file) return NO_SOURCE;
|
|
4474
|
-
const column = _optionalChain([found, 'access',
|
|
4887
|
+
const column = _optionalChain([found, 'access', _207 => _207.meta, 'access', _208 => _208.loc, 'optionalAccess', _209 => _209.column]);
|
|
4475
4888
|
return {
|
|
4476
4889
|
filePath: relativizePath(file),
|
|
4477
4890
|
line: lineOf(found.meta),
|
|
@@ -4491,10 +4904,10 @@ var domAdapter = {
|
|
|
4491
4904
|
name: "HTML",
|
|
4492
4905
|
resolveComponent: (el) => {
|
|
4493
4906
|
const host2 = el.closest("[data-component]");
|
|
4494
|
-
const name = _optionalChain([host2, 'optionalAccess',
|
|
4907
|
+
const name = _optionalChain([host2, 'optionalAccess', _210 => _210.getAttribute, 'call', _211 => _211("data-component")]);
|
|
4495
4908
|
if (!host2 || !name) return null;
|
|
4496
4909
|
const stack = [];
|
|
4497
|
-
for (let h2 = host2; h2; h2 = _nullishCoalesce(_optionalChain([h2, 'access',
|
|
4910
|
+
for (let h2 = host2; h2; h2 = _nullishCoalesce(_optionalChain([h2, 'access', _212 => _212.parentElement, 'optionalAccess', _213 => _213.closest, 'call', _214 => _214("[data-component]")]), () => ( null))) {
|
|
4498
4911
|
const n = h2.getAttribute("data-component");
|
|
4499
4912
|
if (n) stack.push({ name: n, hostElement: h2 });
|
|
4500
4913
|
if (stack.length >= 12) break;
|
|
@@ -4516,7 +4929,7 @@ function composeAdapters(adapters = DEFAULT_ADAPTERS) {
|
|
|
4516
4929
|
for (const adapter of adapters) {
|
|
4517
4930
|
try {
|
|
4518
4931
|
const result = adapter.resolveComponent(el);
|
|
4519
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
4932
|
+
if (_optionalChain([result, 'optionalAccess', _215 => _215.name])) return { adapter, result };
|
|
4520
4933
|
} catch (e30) {
|
|
4521
4934
|
}
|
|
4522
4935
|
}
|
|
@@ -4524,7 +4937,7 @@ function composeAdapters(adapters = DEFAULT_ADAPTERS) {
|
|
|
4524
4937
|
}
|
|
4525
4938
|
return {
|
|
4526
4939
|
resolveComponent(el) {
|
|
4527
|
-
return _nullishCoalesce(_optionalChain([owner, 'call',
|
|
4940
|
+
return _nullishCoalesce(_optionalChain([owner, 'call', _216 => _216(el), 'optionalAccess', _217 => _217.result]), () => ( null));
|
|
4528
4941
|
},
|
|
4529
4942
|
resolveSource(el) {
|
|
4530
4943
|
const stamped = resolveSource3(el);
|
|
@@ -4533,15 +4946,15 @@ function composeAdapters(adapters = DEFAULT_ADAPTERS) {
|
|
|
4533
4946
|
const ordered = found ? [found.adapter, ...adapters.filter((a) => a !== found.adapter)] : adapters;
|
|
4534
4947
|
for (const adapter of ordered) {
|
|
4535
4948
|
try {
|
|
4536
|
-
const src = _optionalChain([adapter, 'access',
|
|
4537
|
-
if (_optionalChain([src, 'optionalAccess',
|
|
4949
|
+
const src = _optionalChain([adapter, 'access', _218 => _218.resolveSource, 'optionalCall', _219 => _219(el)]);
|
|
4950
|
+
if (_optionalChain([src, 'optionalAccess', _220 => _220.filePath])) return src;
|
|
4538
4951
|
} catch (e31) {
|
|
4539
4952
|
}
|
|
4540
4953
|
}
|
|
4541
4954
|
return null;
|
|
4542
4955
|
},
|
|
4543
4956
|
frameworkFor(el) {
|
|
4544
|
-
return _nullishCoalesce(_optionalChain([owner, 'call',
|
|
4957
|
+
return _nullishCoalesce(_optionalChain([owner, 'call', _221 => _221(el), 'optionalAccess', _222 => _222.adapter, 'access', _223 => _223.name]), () => ( "HTML"));
|
|
4545
4958
|
},
|
|
4546
4959
|
cleanClasses(classes) {
|
|
4547
4960
|
return adapters.reduce((list, a) => a.cleanClasses ? a.cleanClasses(list) : list, classes);
|
|
@@ -4573,7 +4986,7 @@ function getDefaultOptions() {
|
|
|
4573
4986
|
};
|
|
4574
4987
|
}
|
|
4575
4988
|
function init(options) {
|
|
4576
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4989
|
+
if (_optionalChain([options, 'optionalAccess', _224 => _224.mode]) === "live" && !_chunk6CBIOKZVcjs.consumeFeedbackLink.call(void 0, options.projectKey)) {
|
|
4577
4990
|
return createDormantApi(options);
|
|
4578
4991
|
}
|
|
4579
4992
|
return createGrabInstance(options);
|
|
@@ -4599,7 +5012,7 @@ function createDormantApi(options) {
|
|
|
4599
5012
|
real.show();
|
|
4600
5013
|
return;
|
|
4601
5014
|
}
|
|
4602
|
-
_optionalChain([flusher, 'optionalAccess',
|
|
5015
|
+
_optionalChain([flusher, 'optionalAccess', _225 => _225.dispose, 'call', _226 => _226()]);
|
|
4603
5016
|
_chunk6CBIOKZVcjs.startFeedbackSession.call(void 0, );
|
|
4604
5017
|
real = createGrabInstance(options);
|
|
4605
5018
|
for (const fn of queued.splice(0)) fn(real);
|
|
@@ -4721,7 +5134,10 @@ function createGrabInstance(options) {
|
|
|
4721
5134
|
let sourceResolver = adapters.resolveSource;
|
|
4722
5135
|
const cleanClasses = (list) => adapters.cleanClasses(list.filter((c) => !isNoiseClass(c)));
|
|
4723
5136
|
let selectedElement = null;
|
|
5137
|
+
let selectedPin;
|
|
4724
5138
|
let pendingShot = null;
|
|
5139
|
+
const commentedElements = /* @__PURE__ */ new Map();
|
|
5140
|
+
let editingFromMarker = false;
|
|
4725
5141
|
let level = loadLevel(merged.detailLevel);
|
|
4726
5142
|
let collapsed = loadCollapsed();
|
|
4727
5143
|
const pendingShotDeletes = /* @__PURE__ */ new Map();
|
|
@@ -4775,12 +5191,12 @@ function createGrabInstance(options) {
|
|
|
4775
5191
|
function toastDetail(c) {
|
|
4776
5192
|
return {
|
|
4777
5193
|
componentName: c.target.component,
|
|
4778
|
-
filePath: _nullishCoalesce(_optionalChain([c, 'access',
|
|
4779
|
-
line: _nullishCoalesce(_optionalChain([c, 'access',
|
|
4780
|
-
column: _nullishCoalesce(_optionalChain([c, 'access',
|
|
5194
|
+
filePath: _nullishCoalesce(_optionalChain([c, 'access', _227 => _227.target, 'access', _228 => _228.source, 'optionalAccess', _229 => _229.file]), () => ( null)),
|
|
5195
|
+
line: _nullishCoalesce(_optionalChain([c, 'access', _230 => _230.target, 'access', _231 => _231.source, 'optionalAccess', _232 => _232.line]), () => ( null)),
|
|
5196
|
+
column: _nullishCoalesce(_optionalChain([c, 'access', _233 => _233.target, 'access', _234 => _234.source, 'optionalAccess', _235 => _235.column]), () => ( null))
|
|
4781
5197
|
};
|
|
4782
5198
|
}
|
|
4783
|
-
function saveComment(element, text, shot) {
|
|
5199
|
+
function saveComment(element, text, shot, pin) {
|
|
4784
5200
|
const now = Date.now();
|
|
4785
5201
|
const comment = {
|
|
4786
5202
|
id: randomId(),
|
|
@@ -4797,11 +5213,13 @@ function createGrabInstance(options) {
|
|
|
4797
5213
|
target: captureTarget(element, { componentResolver, sourceResolver, cleanClasses }),
|
|
4798
5214
|
screenshot: null,
|
|
4799
5215
|
framework: adapters.frameworkFor(element),
|
|
4800
|
-
...outbox ? { sync: "pending" } : {}
|
|
5216
|
+
...outbox ? { sync: "pending" } : {},
|
|
5217
|
+
...pin ? { pin } : {}
|
|
4801
5218
|
};
|
|
5219
|
+
commentedElements.set(comment.id, element);
|
|
4802
5220
|
setComments([comment, ...comments()].slice(0, MAX_COMMENTS));
|
|
4803
5221
|
pluginRegistry.callHook("onComment", comment, element);
|
|
4804
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5222
|
+
_optionalChain([outbox, 'optionalAccess', _236 => _236.send, 'call', _237 => _237(comment.id)]);
|
|
4805
5223
|
if (shot) void attachScreenshot(comment.id, shot);
|
|
4806
5224
|
const count = comments().length;
|
|
4807
5225
|
if (live) {
|
|
@@ -4836,18 +5254,19 @@ function createGrabInstance(options) {
|
|
|
4836
5254
|
const updated = { ...current, screenshot: { localId: id, width: result.width, height: result.height } };
|
|
4837
5255
|
setComments(comments().map((c) => c.id === id ? updated : c));
|
|
4838
5256
|
pluginRegistry.callHook("onScreenshot", updated, result.blob);
|
|
4839
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5257
|
+
_optionalChain([outbox, 'optionalAccess', _238 => _238.sendScreenshot, 'call', _239 => _239(id)]);
|
|
4840
5258
|
}
|
|
4841
5259
|
function removeComments(ids, message, withdraw = false) {
|
|
4842
5260
|
if (ids.length === 0) return;
|
|
4843
5261
|
const idSet = new Set(ids);
|
|
4844
5262
|
const before = comments();
|
|
4845
5263
|
const removed = before.filter((c) => idSet.has(c.id));
|
|
5264
|
+
for (const id of ids) commentedElements.delete(id);
|
|
4846
5265
|
setComments(before.filter((c) => !idSet.has(c.id)));
|
|
4847
5266
|
const withdrawn = withdraw && outbox ? removed.filter((c) => c.sync !== void 0) : [];
|
|
4848
5267
|
const hadQueued = new Set(withdrawn.filter((c) => outbox.isQueued(c.id)).map((c) => c.id));
|
|
4849
5268
|
for (const c of withdrawn) outbox.remove(c.id, c.author.sessionId, message ? UNDO_MS + 500 : 0);
|
|
4850
|
-
const shotIds = removed.flatMap((c) => _optionalChain([c, 'access',
|
|
5269
|
+
const shotIds = removed.flatMap((c) => _optionalChain([c, 'access', _240 => _240.screenshot, 'optionalAccess', _241 => _241.localId]) ? [c.screenshot.localId] : []);
|
|
4851
5270
|
const key = randomId();
|
|
4852
5271
|
pendingShotDeletes.set(key, setTimeout(() => {
|
|
4853
5272
|
pendingShotDeletes.delete(key);
|
|
@@ -4866,7 +5285,7 @@ function createGrabInstance(options) {
|
|
|
4866
5285
|
const back = removed.filter((c) => !present.has(c.id)).map((c) => resend.has(c.id) ? { ...c, sync: "pending" } : c);
|
|
4867
5286
|
const restored = [...back, ...comments()].sort((a, b) => b.createdAt - a.createdAt);
|
|
4868
5287
|
setComments(restored);
|
|
4869
|
-
for (const id of resend) _optionalChain([outbox, 'optionalAccess',
|
|
5288
|
+
for (const id of resend) _optionalChain([outbox, 'optionalAccess', _242 => _242.send, 'call', _243 => _243(id)]);
|
|
4870
5289
|
showToast(`Restored ${removed.length} comment${removed.length === 1 ? "" : "s"}`);
|
|
4871
5290
|
}
|
|
4872
5291
|
}]
|
|
@@ -4899,12 +5318,19 @@ function createGrabInstance(options) {
|
|
|
4899
5318
|
}
|
|
4900
5319
|
function hideCommentPopover() {
|
|
4901
5320
|
commentPopover.hide();
|
|
5321
|
+
endMarkerEdit();
|
|
4902
5322
|
if (picker.isHolding()) {
|
|
4903
5323
|
selectedElement = null;
|
|
5324
|
+
selectedPin = void 0;
|
|
4904
5325
|
pendingShot = null;
|
|
4905
5326
|
picker.release();
|
|
4906
5327
|
}
|
|
4907
5328
|
}
|
|
5329
|
+
function endMarkerEdit() {
|
|
5330
|
+
if (!editingFromMarker) return;
|
|
5331
|
+
editingFromMarker = false;
|
|
5332
|
+
overlay.hide();
|
|
5333
|
+
}
|
|
4908
5334
|
function closeAllPopovers() {
|
|
4909
5335
|
commentsPanel.hide();
|
|
4910
5336
|
hideCommentPopover();
|
|
@@ -4941,8 +5367,14 @@ function createGrabInstance(options) {
|
|
|
4941
5367
|
pluginRegistry.callHook("onElementHover", element);
|
|
4942
5368
|
}
|
|
4943
5369
|
},
|
|
4944
|
-
onSelect(element) {
|
|
5370
|
+
onSelect(element, point) {
|
|
4945
5371
|
selectedElement = element;
|
|
5372
|
+
const rect = element.getBoundingClientRect();
|
|
5373
|
+
const frac = (v, start, size2) => size2 > 0 ? Math.min(1, Math.max(0, (v - start) / size2)) : 0.5;
|
|
5374
|
+
selectedPin = {
|
|
5375
|
+
x: Math.round(frac(point.x, rect.left, rect.width) * 1e3) / 1e3,
|
|
5376
|
+
y: Math.round(frac(point.y, rect.top, rect.height) * 1e3) / 1e3
|
|
5377
|
+
};
|
|
4946
5378
|
pendingShot = store.state.options.screenshots ? captureScreenshot(element) : null;
|
|
4947
5379
|
pluginRegistry.callHook("onElementSelect", element);
|
|
4948
5380
|
coachMark.dismiss();
|
|
@@ -4951,6 +5383,36 @@ function createGrabInstance(options) {
|
|
|
4951
5383
|
commentPopover.show({ anchor: element, mode: "new", askIdentity: shouldAskIdentity() });
|
|
4952
5384
|
}
|
|
4953
5385
|
});
|
|
5386
|
+
const markers = createMarkers({
|
|
5387
|
+
getComments: comments,
|
|
5388
|
+
currentRoute: () => sanitizeRoute(location, store.state.options.captureQueryParams),
|
|
5389
|
+
findElement(comment) {
|
|
5390
|
+
const known = commentedElements.get(comment.id);
|
|
5391
|
+
if (_optionalChain([known, 'optionalAccess', _244 => _244.isConnected])) return known;
|
|
5392
|
+
return safeQuery(comment.target.selector);
|
|
5393
|
+
},
|
|
5394
|
+
onHover(comment, element) {
|
|
5395
|
+
if (picker.isHolding() || editingFromMarker || commentPopover.isVisible()) return;
|
|
5396
|
+
if (comment && element) overlay.show(element, comment.target.component, null, []);
|
|
5397
|
+
else overlay.hide();
|
|
5398
|
+
},
|
|
5399
|
+
onOpen(comment, element, marker) {
|
|
5400
|
+
if (picker.isHolding()) return;
|
|
5401
|
+
closeAllPopovers();
|
|
5402
|
+
doDeactivate(true);
|
|
5403
|
+
editingFromMarker = true;
|
|
5404
|
+
if (element) overlay.show(element, comment.target.component, null, []);
|
|
5405
|
+
commentPopover.show({
|
|
5406
|
+
anchor: _nullishCoalesce(element, () => ( marker)),
|
|
5407
|
+
initialValue: comment.comment,
|
|
5408
|
+
mode: "edit",
|
|
5409
|
+
entryId: comment.id
|
|
5410
|
+
});
|
|
5411
|
+
}
|
|
5412
|
+
});
|
|
5413
|
+
function updateMarkers() {
|
|
5414
|
+
markers.setVisible(store.state.toolbar.visible && !collapsed && store.state.options.enabled);
|
|
5415
|
+
}
|
|
4954
5416
|
function doActivate() {
|
|
4955
5417
|
if (!store.state.options.enabled) return;
|
|
4956
5418
|
if (store.state.active) return;
|
|
@@ -5025,12 +5487,14 @@ function createGrabInstance(options) {
|
|
|
5025
5487
|
toolbar.collapse();
|
|
5026
5488
|
saveCollapsed(true);
|
|
5027
5489
|
updateToastOffset();
|
|
5490
|
+
updateMarkers();
|
|
5028
5491
|
}
|
|
5029
5492
|
function expandToolbar() {
|
|
5030
5493
|
collapsed = false;
|
|
5031
5494
|
toolbar.expand();
|
|
5032
5495
|
saveCollapsed(false);
|
|
5033
5496
|
updateToastOffset();
|
|
5497
|
+
updateMarkers();
|
|
5034
5498
|
}
|
|
5035
5499
|
const commentsPanel = createCommentsPanel({
|
|
5036
5500
|
onHover(comment) {
|
|
@@ -5093,7 +5557,7 @@ function createGrabInstance(options) {
|
|
|
5093
5557
|
});
|
|
5094
5558
|
const finishSheet = createFinishSheet({
|
|
5095
5559
|
onDone() {
|
|
5096
|
-
const done = comments().filter((c) => c.sync === "sent" && !_optionalChain([outbox, 'optionalAccess',
|
|
5560
|
+
const done = comments().filter((c) => c.sync === "sent" && !_optionalChain([outbox, 'optionalAccess', _245 => _245.isQueued, 'call', _246 => _246(c.id)])).map((c) => c.id);
|
|
5097
5561
|
if (!comments().length) {
|
|
5098
5562
|
exitFeedbackMode();
|
|
5099
5563
|
return;
|
|
@@ -5107,9 +5571,9 @@ function createGrabInstance(options) {
|
|
|
5107
5571
|
if (failed.length) {
|
|
5108
5572
|
const ids = new Set(failed.map((c) => c.id));
|
|
5109
5573
|
setComments(comments().map((c) => ids.has(c.id) ? { ...c, sync: "pending" } : c));
|
|
5110
|
-
for (const id of ids) _optionalChain([outbox, 'optionalAccess',
|
|
5574
|
+
for (const id of ids) _optionalChain([outbox, 'optionalAccess', _247 => _247.send, 'call', _248 => _248(id)]);
|
|
5111
5575
|
}
|
|
5112
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5576
|
+
_optionalChain([outbox, 'optionalAccess', _249 => _249.flush, 'call', _250 => _250()]);
|
|
5113
5577
|
}
|
|
5114
5578
|
});
|
|
5115
5579
|
const commentPopover = createCommentPopover({
|
|
@@ -5118,9 +5582,11 @@ function createGrabInstance(options) {
|
|
|
5118
5582
|
if (ctx.mode === "new") {
|
|
5119
5583
|
const element = selectedElement;
|
|
5120
5584
|
const shot = pendingShot;
|
|
5585
|
+
const pin = selectedPin;
|
|
5121
5586
|
selectedElement = null;
|
|
5587
|
+
selectedPin = void 0;
|
|
5122
5588
|
pendingShot = null;
|
|
5123
|
-
if (element) saveComment(element, value, shot);
|
|
5589
|
+
if (element) saveComment(element, value, shot, pin);
|
|
5124
5590
|
doDeactivate(true);
|
|
5125
5591
|
return;
|
|
5126
5592
|
}
|
|
@@ -5129,18 +5595,25 @@ function createGrabInstance(options) {
|
|
|
5129
5595
|
(c) => c.id === ctx.entryId ? { ...c, comment: value, updatedAt: Date.now(), ...outbox ? { sync: "pending" } : {} } : c
|
|
5130
5596
|
);
|
|
5131
5597
|
setComments(updated);
|
|
5132
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5598
|
+
_optionalChain([outbox, 'optionalAccess', _251 => _251.send, 'call', _252 => _252(ctx.entryId)]);
|
|
5133
5599
|
showToast("Comment updated");
|
|
5134
|
-
|
|
5600
|
+
if (editingFromMarker) endMarkerEdit();
|
|
5601
|
+
else commentsPanel.show([...updated]);
|
|
5135
5602
|
},
|
|
5136
5603
|
onCancel(ctx) {
|
|
5137
5604
|
if (ctx.mode === "new") {
|
|
5138
5605
|
selectedElement = null;
|
|
5606
|
+
selectedPin = void 0;
|
|
5139
5607
|
pendingShot = null;
|
|
5140
5608
|
doDeactivate(true);
|
|
5141
5609
|
return;
|
|
5142
5610
|
}
|
|
5143
|
-
|
|
5611
|
+
if (editingFromMarker) endMarkerEdit();
|
|
5612
|
+
else commentsPanel.show([...comments()]);
|
|
5613
|
+
},
|
|
5614
|
+
onDelete(ctx) {
|
|
5615
|
+
endMarkerEdit();
|
|
5616
|
+
if (ctx.entryId) removeComments([ctx.entryId], "Comment deleted", true);
|
|
5144
5617
|
}
|
|
5145
5618
|
});
|
|
5146
5619
|
function handleDocumentClick(e) {
|
|
@@ -5154,7 +5627,7 @@ function createGrabInstance(options) {
|
|
|
5154
5627
|
document.addEventListener("click", handleDocumentClick);
|
|
5155
5628
|
function handlePageHide() {
|
|
5156
5629
|
flushPendingWrite();
|
|
5157
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5630
|
+
_optionalChain([outbox, 'optionalAccess', _253 => _253.flushOnExit, 'call', _254 => _254()]);
|
|
5158
5631
|
}
|
|
5159
5632
|
function handleVisibilityChange() {
|
|
5160
5633
|
if (document.visibilityState === "hidden") flushPendingWrite();
|
|
@@ -5296,6 +5769,7 @@ function createGrabInstance(options) {
|
|
|
5296
5769
|
overlay.dispose();
|
|
5297
5770
|
crosshair.dispose();
|
|
5298
5771
|
freezeOverlay.dispose();
|
|
5772
|
+
markers.dispose();
|
|
5299
5773
|
disposeToast();
|
|
5300
5774
|
disposeFeedbackStyles();
|
|
5301
5775
|
pluginRegistry.dispose();
|
|
@@ -5306,7 +5780,7 @@ function createGrabInstance(options) {
|
|
|
5306
5780
|
copySheet.dispose();
|
|
5307
5781
|
finishSheet.dispose();
|
|
5308
5782
|
coachMark.dispose();
|
|
5309
|
-
_optionalChain([outbox, 'optionalAccess',
|
|
5783
|
+
_optionalChain([outbox, 'optionalAccess', _255 => _255.dispose, 'call', _256 => _256()]);
|
|
5310
5784
|
themeManager.dispose();
|
|
5311
5785
|
disposeStyleBaseline();
|
|
5312
5786
|
disposeScreenshotSandbox();
|
|
@@ -5332,8 +5806,11 @@ function createGrabInstance(options) {
|
|
|
5332
5806
|
doDeactivate(true);
|
|
5333
5807
|
}
|
|
5334
5808
|
}
|
|
5809
|
+
if (key === "options") updateMarkers();
|
|
5335
5810
|
if (key === "toolbar") {
|
|
5336
5811
|
updateToastOffset();
|
|
5812
|
+
updateMarkers();
|
|
5813
|
+
markers.refresh();
|
|
5337
5814
|
if (state.options.persistHistory) {
|
|
5338
5815
|
if (state.toolbar.comments.length > 0) {
|
|
5339
5816
|
saveHistory(state.toolbar.comments);
|
|
@@ -5355,6 +5832,7 @@ function createGrabInstance(options) {
|
|
|
5355
5832
|
if (merged.webhookUrl) {
|
|
5356
5833
|
api.registerPlugin(createWebhookPlugin(merged.webhookUrl));
|
|
5357
5834
|
}
|
|
5835
|
+
updateMarkers();
|
|
5358
5836
|
return api;
|
|
5359
5837
|
}
|
|
5360
5838
|
|