@luci-dev/capture 0.5.5 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +15 -0
- package/dist/luci-capture.js +158 -90
- package/dist/ui/devSettings.d.ts +3 -1
- package/dist/ui/devSettings.d.ts.map +1 -1
- package/dist/ui/devSettings.js +13 -10
- package/dist/ui/devSettings.js.map +1 -1
- package/dist/ui/mount.d.ts +1 -1
- package/dist/ui/mount.d.ts.map +1 -1
- package/dist/ui/picker.d.ts +5 -0
- package/dist/ui/picker.d.ts.map +1 -1
- package/dist/ui/picker.js +12 -0
- package/dist/ui/picker.js.map +1 -1
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/styles.js +51 -13
- package/dist/ui/styles.js.map +1 -1
- package/dist/ui/toolbar.d.ts +1 -1
- package/dist/ui/toolbar.d.ts.map +1 -1
- package/dist/ui/toolbar.js +30 -22
- package/dist/ui/toolbar.js.map +1 -1
- package/package.json +3 -3
- package/dist/ui/screenshot.d.ts +0 -39
- package/dist/ui/screenshot.d.ts.map +0 -1
- package/dist/ui/screenshot.js +0 -59
- package/dist/ui/screenshot.js.map +0 -1
package/dist/ui/styles.js
CHANGED
|
@@ -32,7 +32,7 @@ ${UI_CSS}
|
|
|
32
32
|
.luci-theme[data-dock="left"] .sub,
|
|
33
33
|
.luci-theme[data-dock="left"] .panel { right: auto; left: var(--luci-space-12); }
|
|
34
34
|
|
|
35
|
-
/* The toolbar pill (
|
|
35
|
+
/* The toolbar pill (the brand kit, On-page toolbar): Charcoal in both themes, float shadow, no stroke */
|
|
36
36
|
.bar {
|
|
37
37
|
--luci-color-focus: var(--luci-color-muzzle-50);
|
|
38
38
|
position: fixed;
|
|
@@ -48,7 +48,8 @@ ${UI_CSS}
|
|
|
48
48
|
border-radius: 32px;
|
|
49
49
|
background: var(--luci-color-bar);
|
|
50
50
|
color: var(--luci-color-bar-ink);
|
|
51
|
-
|
|
51
|
+
/* Charcoal in both themes, so always with the inner edge: it stays apart from a dark page */
|
|
52
|
+
box-shadow: var(--luci-elevation-bar);
|
|
52
53
|
}
|
|
53
54
|
/* Above the cards, so the tools' tooltips are never under a card */
|
|
54
55
|
.shell > .bar { position: relative; z-index: 2; }
|
|
@@ -93,6 +94,7 @@ ${UI_CSS}
|
|
|
93
94
|
.luci-theme .bar .basket-pill[aria-pressed="true"],
|
|
94
95
|
.luci-theme .bar .basket-pill[aria-pressed="true"]:hover:not(:disabled),
|
|
95
96
|
.luci-theme .bar button.basket-pill[aria-pressed="true"]:hover:not(:disabled) { background: var(--luci-color-collar-lime-300); color: var(--luci-color-on-accent); }
|
|
97
|
+
.bar .basket-n { display: none; }
|
|
96
98
|
.brand { display: inline-flex; align-items: center; gap: var(--luci-space-8); padding: 0 var(--luci-space-8) 0 0;
|
|
97
99
|
font: var(--luci-type-display-weight) var(--luci-type-heading-size)/1 var(--luci-font-display); color: var(--luci-color-bar-ink); }
|
|
98
100
|
/* The dev toolbar's mode switch, on Charcoal */
|
|
@@ -107,7 +109,8 @@ ${UI_CSS}
|
|
|
107
109
|
* --luci-y its distances from that corner's edges (default bottom right, 12 px, by its button; the
|
|
108
110
|
* person can drag it anywhere). Everything opens from the bar, on the side with room: cards just above
|
|
109
111
|
* a bar in the bottom half, just below one in the top half, aligned to its side. A panel takes the
|
|
110
|
-
* hint's place while it is open.
|
|
112
|
+
* hint's place while it is open. --luci-bar-h is the bar's measured height (it can wrap), so a card
|
|
113
|
+
* never opens under it. The extension sets none of this (its bar keeps its own place).
|
|
111
114
|
*/
|
|
112
115
|
:host([data-h="right"]) :is(.shell, .bar:not(.shell > .bar), .sub:not(.shell > .sub), .panel:not(.shell > .panel), .menu) { left: auto; right: var(--luci-x, 12px); }
|
|
113
116
|
:host([data-h="left"]) :is(.shell, .bar:not(.shell > .bar), .sub:not(.shell > .sub), .panel:not(.shell > .panel), .menu) { right: auto; left: var(--luci-x, 12px); }
|
|
@@ -115,14 +118,14 @@ ${UI_CSS}
|
|
|
115
118
|
:host([data-h="left"]) .shell { align-items: flex-start; }
|
|
116
119
|
:host([data-v="bottom"]) :is(.shell, .bar:not(.shell > .bar)) { top: auto; bottom: var(--luci-y, 12px); }
|
|
117
120
|
:host([data-v="bottom"]) .shell { flex-direction: column-reverse; }
|
|
118
|
-
:host([data-v="bottom"]) :is(.sub:not(.shell > .sub), .panel:not(.shell > .panel)) { top: auto; bottom: calc(var(--luci-y, 12px) +
|
|
119
|
-
:host([data-v="bottom"]) .menu { top: auto; bottom: calc(var(--luci-y, 12px) + 64px); }
|
|
121
|
+
:host([data-v="bottom"]) :is(.sub:not(.shell > .sub), .panel:not(.shell > .panel)) { top: auto; bottom: calc(var(--luci-y, 12px) + var(--luci-bar-h, 64px) + 8px); }
|
|
122
|
+
:host([data-v="bottom"]) .menu { top: auto; bottom: calc(var(--luci-y, 12px) + var(--luci-bar-h, 64px)); }
|
|
120
123
|
:host([data-v="top"]) :is(.shell, .bar:not(.shell > .bar)) { bottom: auto; top: var(--luci-y, 12px); }
|
|
121
|
-
:host([data-v="top"]) :is(.sub:not(.shell > .sub), .panel:not(.shell > .panel)) { bottom: auto; top: calc(var(--luci-y, 12px) +
|
|
122
|
-
:host([data-v="top"]) .menu { bottom: auto; top: calc(var(--luci-y, 12px) + 64px); }
|
|
124
|
+
:host([data-v="top"]) :is(.sub:not(.shell > .sub), .panel:not(.shell > .panel)) { bottom: auto; top: calc(var(--luci-y, 12px) + var(--luci-bar-h, 64px) + 8px); }
|
|
125
|
+
:host([data-v="top"]) .menu { bottom: auto; top: calc(var(--luci-y, 12px) + var(--luci-bar-h, 64px)); }
|
|
123
126
|
:host([data-v]) .shell { max-height: calc(100vh - var(--luci-y, 12px) - 12px); }
|
|
124
|
-
:host([data-v]) .panel:not(.shell > .panel) { max-height: min(72vh, calc(100vh - var(--luci-y, 12px) -
|
|
125
|
-
:host([data-v]) .layout-panel:not(.shell > .panel) { max-height: min(80vh, calc(100vh - var(--luci-y, 12px) -
|
|
127
|
+
:host([data-v]) .panel:not(.shell > .panel) { max-height: min(72vh, calc(100vh - var(--luci-y, 12px) - var(--luci-bar-h, 64px) - 32px)); }
|
|
128
|
+
:host([data-v]) .layout-panel:not(.shell > .panel) { max-height: min(80vh, calc(100vh - var(--luci-y, 12px) - var(--luci-bar-h, 64px) - 32px)); }
|
|
126
129
|
:host([data-v]) .luci-theme:has(> .panel) > .sub:not([role="alert"]) { display: none; }
|
|
127
130
|
:host([data-v="bottom"]) :is(.sub, .panel, .menu) { animation: luci-rise var(--luci-motion-base, 200ms) both; }
|
|
128
131
|
:host([data-v="top"]) :is(.sub, .panel, .menu) { animation: luci-drop var(--luci-motion-base, 200ms) both; }
|
|
@@ -140,13 +143,44 @@ ${UI_CSS}
|
|
|
140
143
|
:host([data-v]) .bar button, :host([data-v]) .bar .menu-btn { cursor: pointer; }
|
|
141
144
|
:host([data-moving]) .bar, :host([data-moving]) .bar * { cursor: grabbing; user-select: none; }
|
|
142
145
|
/* New page's canvas covers the window: its tools and its panel keep clear of the bar */
|
|
143
|
-
:host([data-v="bottom"]) .wf { padding-bottom: calc(var(--luci-y, 12px) +
|
|
146
|
+
:host([data-v="bottom"]) .wf { padding-bottom: calc(var(--luci-y, 12px) + var(--luci-bar-h, 64px) + 12px); }
|
|
144
147
|
:host([data-v="bottom"]) .wf-tools { padding-top: var(--luci-space-12); }
|
|
145
|
-
:host([data-v="top"]) .wf-tools { padding-top: calc(var(--luci-y, 12px) +
|
|
148
|
+
:host([data-v="top"]) .wf-tools { padding-top: calc(var(--luci-y, 12px) + var(--luci-bar-h, 64px) + 12px); }
|
|
146
149
|
:host([data-v="top"]) .panel[data-part="sketch-panel"]:not(.shell > .panel) { top: auto; bottom: var(--luci-space-12); }
|
|
147
150
|
|
|
151
|
+
/*
|
|
152
|
+
* Phones and narrow windows (dev toolbar): the bar spans the window's width in two planned rows instead
|
|
153
|
+
* of wrapping wherever it runs out of room. Row 1: Luci, the mode switch, Close. Row 2: the mode's tools,
|
|
154
|
+
* spread evenly at the 44 px touch target. The first separator is the line break. Cards open full width
|
|
155
|
+
* from the bar, above it (or below a bar dragged to the top).
|
|
156
|
+
*/
|
|
157
|
+
@media (max-width: 639px) {
|
|
158
|
+
:host([data-v]) :is(.shell, .bar:not(.shell > .bar), .sub:not(.shell > .sub), .panel:not(.shell > .panel), .menu) { left: 8px; right: 8px; }
|
|
159
|
+
:host([data-v]) :is(.sub:not(.shell > .sub), .panel:not(.shell > .panel)) { width: auto; }
|
|
160
|
+
:host([data-v]) .shell { align-items: stretch; max-width: none; }
|
|
161
|
+
:host([data-v]) .shell > :is(.sub, .panel) { width: auto; }
|
|
162
|
+
:host([data-v]) .bar { justify-content: space-between; row-gap: var(--luci-space-4); column-gap: 0; padding: 6px; border-radius: var(--luci-radius-xl); max-width: none; }
|
|
163
|
+
:host([data-v]) .bar > * { order: 3; }
|
|
164
|
+
:host([data-v]) .bar > :is(.menu-btn, .modes) { order: 0; }
|
|
165
|
+
:host([data-v]) .bar > [data-action="close"] { order: 1; }
|
|
166
|
+
:host([data-v]) .bar > .modes + .bar-sep { order: 2; flex-basis: 100%; width: 0; height: 0; margin: 0; background: none; }
|
|
167
|
+
:host([data-v]) .bar > .bar-sep:not(.modes + .bar-sep) { display: none; }
|
|
168
|
+
:host([data-v]) .bar .modes { flex: 1 1 auto; margin: 0 var(--luci-space-4); }
|
|
169
|
+
:host([data-v]) .bar .modes button { flex: 1 1 0; padding-inline: var(--luci-space-8); }
|
|
170
|
+
:host([data-v]) .luci-theme .bar :is(.tool, .split .caret) { --luci-btn-h: 44px; }
|
|
171
|
+
/* Where notes go, as its dot only (the words stay as its label) */
|
|
172
|
+
:host([data-v]) .bar .conn { width: 28px; height: 44px; justify-content: center; padding: 0; font-size: 0; }
|
|
173
|
+
:host([data-v]) .bar .conn::before { width: 10px; height: 10px; }
|
|
174
|
+
/* Layout's inspector leaves the top of the page in view, where the selected element can be */
|
|
175
|
+
:host([data-v]) .layout-panel:not(.shell > .panel) { max-height: min(45vh, calc(100vh - var(--luci-y, 12px) - var(--luci-bar-h, 64px) - 32px)); }
|
|
176
|
+
/* The basket as its icon and count (its label still says "Basket, n items") */
|
|
177
|
+
:host([data-v]) .luci-theme .bar .basket-pill { gap: var(--luci-space-4); padding: 0 var(--luci-space-12) 0 var(--luci-space-8); }
|
|
178
|
+
:host([data-v]) .bar .basket-full { display: none; }
|
|
179
|
+
:host([data-v]) .bar .basket-n { display: inline; }
|
|
180
|
+
}
|
|
181
|
+
|
|
148
182
|
/* Cards under the pill: the hint while picking, and every panel (radius-xl, float shadow, no stroke) */
|
|
149
|
-
.sub, .panel { background: var(--luci-color-surface); border-radius: var(--luci-radius-xl); box-shadow: var(--luci-
|
|
183
|
+
.sub, .panel { background: var(--luci-color-surface); border-radius: var(--luci-radius-xl); box-shadow: var(--luci-elevation); }
|
|
150
184
|
.sub {
|
|
151
185
|
position: fixed;
|
|
152
186
|
top: 84px;
|
|
@@ -208,6 +242,8 @@ ${UI_CSS}
|
|
|
208
242
|
/* The first-run greeting */
|
|
209
243
|
.greet { flex-direction: row; align-items: center; gap: var(--luci-space-16); }
|
|
210
244
|
.greet .t-title { margin: 0; }
|
|
245
|
+
/* The words wrap beside Luci on a narrow window (panels keep their children's size otherwise) */
|
|
246
|
+
.greet > .stack { flex-shrink: 1; min-width: 0; }
|
|
211
247
|
|
|
212
248
|
/* Segmented control */
|
|
213
249
|
.seg { display: inline-flex; align-self: flex-start; gap: var(--luci-space-4); padding: var(--luci-space-4); background: var(--luci-color-surface-sunken); border-radius: var(--luci-radius-full); }
|
|
@@ -264,6 +300,8 @@ label { display: inline-flex; gap: var(--luci-space-4); align-items: center; col
|
|
|
264
300
|
|
|
265
301
|
/* Page overlays while picking: drawn over the host page, never part of it */
|
|
266
302
|
.pick-layer, .pixel-layer { position: fixed; inset: 0; z-index: 2147483640; cursor: crosshair; background: transparent; touch-action: none; }
|
|
303
|
+
/* Picking an element by touch takes taps, not drags: the page still scrolls and zooms under the finger */
|
|
304
|
+
.pick-layer { touch-action: pan-x pan-y pinch-zoom; }
|
|
267
305
|
.highlight { position: fixed; z-index: 2147483646; pointer-events: none; border: 2px solid var(--luci-color-pick); background: var(--luci-color-pick-fill); border-radius: 2px; }
|
|
268
306
|
.highlight.locked { border-width: 2px; border-style: solid; }
|
|
269
307
|
.highlight.blocked { border-color: var(--luci-color-pick-blocked); background: var(--luci-color-pick-blocked-fill); }
|
|
@@ -272,7 +310,7 @@ label { display: inline-flex; gap: var(--luci-space-4); align-items: center; col
|
|
|
272
310
|
@media (prefers-reduced-motion: no-preference) { .highlight { transition: top 60ms, left 60ms, width 60ms, height 60ms; } }
|
|
273
311
|
/* The label and the pixel swatch read like tooltips: Charcoal fill, Muzzle White text */
|
|
274
312
|
.label, .swatch { position: fixed; z-index: 2147483647; pointer-events: none; padding: var(--luci-space-4) var(--luci-space-8); border-radius: var(--luci-radius-md);
|
|
275
|
-
background: var(--luci-color-muzzle-900); color: var(--luci-color-muzzle-50); box-shadow: var(--luci-
|
|
313
|
+
background: var(--luci-color-muzzle-900); color: var(--luci-color-muzzle-50); box-shadow: var(--luci-elevation-bar);
|
|
276
314
|
font: var(--luci-type-code-weight) 12px/1.4 var(--luci-font-code); }
|
|
277
315
|
.label { max-width: 360px; white-space: pre-wrap; }
|
|
278
316
|
.label .reason { display: block; color: var(--luci-color-nose-pink-300); font-family: var(--luci-font-body); }
|
package/dist/ui/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG;;EAEzB,MAAM
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG;;EAEzB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyZP,CAAC"}
|
package/dist/ui/toolbar.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export interface ToolbarProps {
|
|
|
54
54
|
movable?: boolean;
|
|
55
55
|
/** Where "Use my tokens" finds the person's tokens (v0.4). Default: tokens pasted, kept in the page's storage. */
|
|
56
56
|
myTokens?: MyTokensSource;
|
|
57
|
-
/**
|
|
57
|
+
/** Whether Chrome lets Luci use the debugger (the extension; a required permission there), and a way to open help about it. */
|
|
58
58
|
debuggerPermission?: {
|
|
59
59
|
get: () => Promise<boolean>;
|
|
60
60
|
request?: () => void;
|
package/dist/ui/toolbar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../src/ui/toolbar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAA6C,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAaL,KAAK,QAAQ,EAUb,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAqH,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAQlK,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAEyG,KAAK,UAAU,EAC9H,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAmC,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EAcL,KAAK,kBAAkB,EAOvB,KAAK,MAAM,EAEX,KAAK,MAAM,EACZ,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,QAAQ,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IACvD,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAC3D,kHAAkH;IAClH,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,2FAA2F;IAC3F,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,uGAAuG;IACvG,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,sGAAsG;IACtG,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,kFAAkF;IAClF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,mHAAmH;IACnH,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACrG,+FAA+F;IAC/F,WAAW,CAAC,EAAE;QACZ,GAAG,EAAE,MAAM,OAAO,CAAC;YAAE,OAAO,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC,CAAC;QAC7E,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACzC,CAAC;IACF,qGAAqG;IACrG,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,qHAAqH;IACrH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,qFAAqF;IACrF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oHAAoH;IACpH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IACzE,yIAAyI;IACzI,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kHAAkH;IAClH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../src/ui/toolbar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAA6C,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAaL,KAAK,QAAQ,EAUb,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAqH,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAQlK,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAEyG,KAAK,UAAU,EAC9H,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAmC,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EAcL,KAAK,kBAAkB,EAOvB,KAAK,MAAM,EAEX,KAAK,MAAM,EACZ,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,QAAQ,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IACvD,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAC3D,kHAAkH;IAClH,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,2FAA2F;IAC3F,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,uGAAuG;IACvG,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,sGAAsG;IACtG,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,kFAAkF;IAClF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,mHAAmH;IACnH,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACrG,+FAA+F;IAC/F,WAAW,CAAC,EAAE;QACZ,GAAG,EAAE,MAAM,OAAO,CAAC;YAAE,OAAO,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC,CAAC;QAC7E,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACzC,CAAC;IACF,qGAAqG;IACrG,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,qHAAqH;IACrH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,qFAAqF;IACrF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oHAAoH;IACpH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IACzE,yIAAyI;IACzI,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kHAAkH;IAClH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,+HAA+H;IAC/H,kBAAkB,CAAC,EAAE;QACnB,GAAG,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;KACtB,CAAC;IACF,+GAA+G;IAC/G,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oFAAoF;IACpF,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACnG,oDAAoD;IACpD,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AA6CD,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AA4D9E,0EAA0E;AAC1E,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKvD,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAKlF,CAAC;AACF,qDAAqD;AACrD,eAAO,MAAM,YAAY,gGAA2F,CAAC;AA8BrH,4FAA4F;AAC5F,eAAO,MAAM,IAAI;aAAK,SAAS,EAAE,GAAG;aAAE,IAAI,EAAE,GAAG;aAAE,KAAK,EAAE,GAAG;aAAE,OAAO,EAAE,GAAG;aAAE,IAAI,EAAE,GAAG;aAAE,KAAK,EAAE,GAAG;aAAE,MAAM,EAAE,GAAG;aAAE,IAAI,EAAE,GAAG;CAAW,CAAC;AAGpI,oGAAoG;AACpG,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAA6E,CAAC;AAY1I,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,gCA+zD1C"}
|
package/dist/ui/toolbar.js
CHANGED
|
@@ -11,7 +11,7 @@ import { addToBasket, exportBasket, exportItem, mergeInBasket, noteInBasket, rem
|
|
|
11
11
|
import { manualState } from '../states.js';
|
|
12
12
|
import { elementName } from '../naming.js';
|
|
13
13
|
import { LUCI_UI_ATTRIBUTE } from '../dom.js';
|
|
14
|
-
import { elementAt, eligibilityOf, eventTarget, firstChildOf, hoverLabel, parentOf, scrollableAncestor } from './picker.js';
|
|
14
|
+
import { elementAt, eligibilityOf, eventTarget, firstChildOf, hoverLabel, parentOf, scrollableAncestor, touchScreen } from './picker.js';
|
|
15
15
|
import { ButtonSpinner, Loading, nextPaint } from './loading.js';
|
|
16
16
|
import { ModeSwitch } from './modeSwitch.js';
|
|
17
17
|
import { Button, COPY, EmptyState, Icon, IconBasket, IconCheck, IconClose, IconColour, IconComponent, IconCopy, IconDownload, IconInfo, IconPage, IconSpacing, IconSuccess, IconText, LUCI_REPO_URL, Mascot, RepoButton, Select, useShortcuts } from '@luci-dev/ui';
|
|
@@ -42,7 +42,7 @@ function SaveButton(props) {
|
|
|
42
42
|
const title = props.projectName
|
|
43
43
|
? `Into ${props.projectName}/.luci/design/, where your agent reads it`
|
|
44
44
|
: "Into the project's .luci/design/, where your agent reads it";
|
|
45
|
-
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", "data-action": "save-to-project", disabled: state.busy, title: title, onClick: () => void run(), children: state.busy ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Saving\u2026"] }) : label }), state.done && _jsx("span", { class: "dim", "data-part": "saved", children: state.done }), state.error && _jsx("span", { class: "error", "data-part": "save-error", children: state.error })] }));
|
|
45
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", "data-action": "save-to-project", disabled: state.busy, title: title, onClick: () => void run(), children: state.busy ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Saving\u2026"] }) : label }), state.done && _jsx("span", { class: "dim", "data-part": "saved", children: state.done }), state.error && (_jsxs(_Fragment, { children: [_jsx("span", { class: "error", "data-part": "save-error", children: state.error }), props.onDownload && (_jsx("button", { type: "button", class: "btn-secondary", "data-action": "download-fallback", onClick: props.onDownload, children: "Download file instead" }))] }))] }));
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* "Make it a rule" (v0.3.2): the capture is saved into the project, then a rule pointing at it is
|
|
@@ -729,7 +729,7 @@ export function Toolbar(props) {
|
|
|
729
729
|
area.scrollBy(e.deltaX, e.deltaY);
|
|
730
730
|
}
|
|
731
731
|
};
|
|
732
|
-
const pickUp = (x, y) => {
|
|
732
|
+
const pickUp = (x, y, touch = false) => {
|
|
733
733
|
{
|
|
734
734
|
const target = elementAt(doc, x, y);
|
|
735
735
|
const start = drag.current;
|
|
@@ -737,6 +737,12 @@ export function Toolbar(props) {
|
|
|
737
737
|
if (!target || !start || !tool)
|
|
738
738
|
return;
|
|
739
739
|
const moved = Math.hypot(x - start.x, y - start.y) > DRAG_PX;
|
|
740
|
+
// By touch (no hover), a first tap shows what would be taken; a second tap on it takes it
|
|
741
|
+
if (touch && !moved && target !== candidateRef.current) {
|
|
742
|
+
trail.current = [];
|
|
743
|
+
aim(target);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
740
746
|
if (tool === 'spacing' && moved && target !== start.el) {
|
|
741
747
|
// A drag between two elements measures the distance between them (FR15)
|
|
742
748
|
const blocked = [start.el, target].map(eligibilityOf).find(x => x.status !== 'allowed');
|
|
@@ -1065,6 +1071,13 @@ export function Toolbar(props) {
|
|
|
1065
1071
|
return;
|
|
1066
1072
|
props.debuggerPermission.get().then(setDebuggerGranted).catch(() => setDebuggerGranted(false));
|
|
1067
1073
|
}, [props.debuggerPermission, settingsOpen]);
|
|
1074
|
+
/** "About the debugger": the help page at its debugger section, whatever the debugger's state. */
|
|
1075
|
+
const openDebuggerHelp = () => {
|
|
1076
|
+
if (props.onHelp)
|
|
1077
|
+
props.onHelp('debugger-permission');
|
|
1078
|
+
else
|
|
1079
|
+
props.debuggerPermission?.request?.();
|
|
1080
|
+
};
|
|
1068
1081
|
// Direct send to project (v0.4.4): push basket captures straight to .luci/design/
|
|
1069
1082
|
const [itemSent, setItemSent] = useState({});
|
|
1070
1083
|
const [basketSending, setBasketSending] = useState(false);
|
|
@@ -1082,7 +1095,7 @@ export function Toolbar(props) {
|
|
|
1082
1095
|
catch (err) {
|
|
1083
1096
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1084
1097
|
setItemSent(prev => ({ ...prev, [item.id]: { error: msg } }));
|
|
1085
|
-
setBasketStatus({ text: msg, error: true });
|
|
1098
|
+
setBasketStatus({ text: msg, error: true, download: () => downloadText(fileName, markdown) });
|
|
1086
1099
|
}
|
|
1087
1100
|
};
|
|
1088
1101
|
const sendAllToProject = async () => {
|
|
@@ -1101,7 +1114,8 @@ export function Toolbar(props) {
|
|
|
1101
1114
|
setBasketStatus({ text: `Saved ${saved} capture${saved === 1 ? '' : 's'} into ${target}.` });
|
|
1102
1115
|
}
|
|
1103
1116
|
catch (err) {
|
|
1104
|
-
|
|
1117
|
+
const all = exportBasket(basket, settings);
|
|
1118
|
+
setBasketStatus({ text: err instanceof Error ? err.message : String(err), error: true, download: () => downloadText(all.fileName, all.markdown) });
|
|
1105
1119
|
}
|
|
1106
1120
|
finally {
|
|
1107
1121
|
setBasketSending(false);
|
|
@@ -1318,7 +1332,7 @@ export function Toolbar(props) {
|
|
|
1318
1332
|
setBasketOpen(false);
|
|
1319
1333
|
else
|
|
1320
1334
|
openBasket(); };
|
|
1321
|
-
// Single-key shortcuts while the toolbar is open (never while typing;
|
|
1335
|
+
// Single-key shortcuts while the toolbar is open (never while typing; the brand kit, section 7)
|
|
1322
1336
|
useShortcuts(doc, [
|
|
1323
1337
|
...TOOLS.map(t => ({ key: KEYS[t], run: () => pickTool(t) })),
|
|
1324
1338
|
{ key: KEYS.page, run: () => void captureWholePage() },
|
|
@@ -1430,28 +1444,21 @@ export function Toolbar(props) {
|
|
|
1430
1444
|
const hoverElig = hovered ? eligibilityOf(hovered) : null;
|
|
1431
1445
|
const rect = hovered?.getBoundingClientRect();
|
|
1432
1446
|
const cs = hovered && tool === 'spacing' ? win.getComputedStyle(hovered) : null;
|
|
1433
|
-
return (_jsxs("div", { class: "luci luci-theme", "data-theme": uiPrefs.theme, "data-dock": uiPrefs.dock, children: [_jsxs("div", { class: "shell", "data-part": "shell", ref: shellRef, style: shellStyle, ...(props.movable ? { 'data-movable': '' } : {}), ...(moving ? { 'data-moving': '' } : {}), ...(place ? { 'data-h': place.h, 'data-v': place.v } : {}), children: [_jsxs("div", { class: "bar", role: "toolbar", "aria-label": props.modes ? COPY.capture.devTitle : COPY.capture.title, ref: barRef, onPointerDown: startMove, onClickCapture: swallowDragClick, children: [_jsx("button", { type: "button", class: "menu-btn", "data-action": "settings", "aria-label": COPY.common.menu, "aria-pressed": settingsOpen, "aria-keyshortcuts": KEYS.menu, "data-tip": `${COPY.common.menu} ${KEYS.menu}`, onClick: toggleMenu, children: _jsx(LuciLogo, { size: 48 }) }), props.modes && _jsx(ModeSwitch, { ...props.modes }), _jsx("span", { class: "bar-sep", "aria-hidden": "true" }), TOOLS.map(t => (_jsx(Button, { iconOnly: true, size: "lg", class: "tool", icon: TOOL_ICONS[t], label: COPY.capture.tools[t], shortcut: KEYS[t], "data-tool": t, "aria-pressed": currentTool === t, onClick: () => pickTool(t) }))), _jsx(Button, { iconOnly: true, size: "lg", class: "tool", icon: IconPage, label: COPY.capture.tools.page, shortcut: KEYS.page, "data-action": "whole-page", "aria-pressed": wholePage && (pageBusy || Boolean(result)), onClick: captureWholePage }), _jsx(Button, { iconOnly: true, size: "lg", class: "tool", icon: IconCheck, label: COPY.capture.tools.check, shortcut: KEYS.check, "data-action": "check", "aria-pressed": checking, onClick: openCheck }), _jsx("span", { class: "bar-sep", "aria-hidden": "true" }), _jsxs("button", { type: "button", class: "basket-pill", "data-action": "basket", "aria-pressed": basketOpen && !settingsOpen, "aria-label": COPY.capture.basketLabel(basket.length), "aria-keyshortcuts": KEYS.basket, "data-tip": `Basket ${KEYS.basket}`, onClick: toggleBasket, children: [_jsx(Icon, { icon: IconBasket }), COPY.capture.basket(basket.length)] }), _jsx(Button, { iconOnly: true, size: "lg", class: "tool", icon: IconClose, label: COPY.common.close, "data-action": "close", onClick: props.onClose })] }), greeting && (_jsxs("div", { class: "panel greet", role: "status", "data-part": "greeting", children: [_jsx(Mascot, { pose: "hello", size: 96 }), _jsxs("div", { class: "stack", children: [_jsx("p", { class: "t-title", children: COPY.capture.greeting.title }), _jsx("p", { class: "hint", children: COPY.capture.greeting.body })] })] })), props.modes && idle && !greeting && (_jsxs("div", { class: "sub with-luci", role: "note", "data-part": "intro", children: [_jsx(Mascot, { pose: "peek", size: 96 }), _jsxs("div", { class: "sub-body", children: [_jsx("p", { class: "hint", children: COPY.devToolbar.intro.capture.body }), _jsx("p", { class: "keys", children: COPY.devToolbar.intro.capture.keys })] })] })), settingsOpen && (props.modes ? (_jsx(DevSettingsPanel, { currentMode: "capture", uiPrefs: uiPrefs, onUiPrefsChange: setUiPrefs, projectInfo: props.projectInfo, store: props.store, captureSettings: settings, onCaptureSettingsChange: changeSettings, debuggerPermission: props.debuggerPermission })) : (_jsxs("div", { class: "panel", role: "dialog", "aria-label": COPY.common.menu, "data-part": "settings", children: [_jsxs("div", { class: "menu-head", children: [_jsx(Mascot, { pose: "sit", size: 96 }), _jsxs("div", { class: "brand-stack", children: [_jsxs("div", { class: "brand-title-line", children: [_jsx("span", { class: "brand-title", "data-part": "brand-title", children: props.modes ? COPY.capture.devTitle : COPY.capture.title }), _jsx("span", { class: "brand-sub", "data-part": "brand-sub", children: props.modes ? COPY.capture.devByline : COPY.capture.byline })] }), _jsx("p", { class: "brand-desc", children: props.modes ? COPY.capture.devDescription : COPY.capture.description }), props.onHelp && _jsx("div", { class: "row", children: _jsx(Button, { variant: "secondary", icon: IconInfo, "data-action": "help", onClick: () => props.onHelp(), children: COPY.common.help }) })] }), _jsx(RepoButton, {})] }), !props.modes && (_jsxs("div", { class: "invite", "data-part": "invite", children: [_jsx("p", { class: "invite-title", children: COPY.capture.invite.title }), _jsx("p", { class: "invite-body", children: COPY.capture.invite.body }), LUCI_REPO_URL
|
|
1447
|
+
return (_jsxs("div", { class: "luci luci-theme", "data-theme": uiPrefs.theme, "data-dock": uiPrefs.dock, children: [_jsxs("div", { class: "shell", "data-part": "shell", ref: shellRef, style: shellStyle, ...(props.movable ? { 'data-movable': '' } : {}), ...(moving ? { 'data-moving': '' } : {}), ...(place ? { 'data-h': place.h, 'data-v': place.v } : {}), children: [_jsxs("div", { class: "bar", role: "toolbar", "aria-label": props.modes ? COPY.capture.devTitle : COPY.capture.title, ref: barRef, onPointerDown: startMove, onClickCapture: swallowDragClick, children: [_jsx("button", { type: "button", class: "menu-btn", "data-action": "settings", "aria-label": COPY.common.menu, "aria-pressed": settingsOpen, "aria-keyshortcuts": KEYS.menu, "data-tip": `${COPY.common.menu} ${KEYS.menu}`, onClick: toggleMenu, children: _jsx(LuciLogo, { size: 48 }) }), props.modes && _jsx(ModeSwitch, { ...props.modes }), _jsx("span", { class: "bar-sep", "aria-hidden": "true" }), TOOLS.map(t => (_jsx(Button, { iconOnly: true, size: "lg", class: "tool", icon: TOOL_ICONS[t], label: COPY.capture.tools[t], shortcut: KEYS[t], "data-tool": t, "aria-pressed": currentTool === t, onClick: () => pickTool(t) }))), _jsx(Button, { iconOnly: true, size: "lg", class: "tool", icon: IconPage, label: COPY.capture.tools.page, shortcut: KEYS.page, "data-action": "whole-page", "aria-pressed": wholePage && (pageBusy || Boolean(result)), onClick: captureWholePage }), _jsx(Button, { iconOnly: true, size: "lg", class: "tool", icon: IconCheck, label: COPY.capture.tools.check, shortcut: KEYS.check, "data-action": "check", "aria-pressed": checking, onClick: openCheck }), _jsx("span", { class: "bar-sep", "aria-hidden": "true" }), _jsxs("button", { type: "button", class: "basket-pill", "data-action": "basket", "aria-pressed": basketOpen && !settingsOpen, "aria-label": COPY.capture.basketLabel(basket.length), "aria-keyshortcuts": KEYS.basket, "data-tip": `Basket ${KEYS.basket}`, onClick: toggleBasket, children: [_jsx(Icon, { icon: IconBasket }), _jsx("span", { class: "basket-full", children: COPY.capture.basket(basket.length) }), _jsx("span", { class: "basket-n", children: basket.length })] }), _jsx(Button, { iconOnly: true, size: "lg", class: "tool", icon: IconClose, label: COPY.common.close, "data-action": "close", onClick: props.onClose })] }), greeting && (_jsxs("div", { class: "panel greet", role: "status", "data-part": "greeting", children: [_jsx(Mascot, { pose: "hello", size: 96 }), _jsxs("div", { class: "stack", children: [_jsx("p", { class: "t-title", children: COPY.capture.greeting.title }), _jsx("p", { class: "hint", children: COPY.capture.greeting.body })] })] })), props.modes && idle && !greeting && (_jsxs("div", { class: "sub with-luci", role: "note", "data-part": "intro", children: [_jsx(Mascot, { pose: "peek", size: 96 }), _jsxs("div", { class: "sub-body", children: [_jsx("p", { class: "hint", children: COPY.devToolbar.intro.capture.body }), _jsx("p", { class: "keys", children: COPY.devToolbar.intro.capture.keys })] })] })), settingsOpen && (props.modes ? (_jsx(DevSettingsPanel, { currentMode: "capture", uiPrefs: uiPrefs, onUiPrefsChange: setUiPrefs, projectInfo: props.projectInfo, store: props.store, captureSettings: settings, onCaptureSettingsChange: changeSettings, debuggerPermission: props.debuggerPermission, ...(props.onHelp ? { onHelp: props.onHelp } : {}) })) : (_jsxs("div", { class: "panel", role: "dialog", "aria-label": COPY.common.menu, "data-part": "settings", children: [_jsxs("div", { class: "menu-head", children: [_jsx(Mascot, { pose: "sit", size: 96 }), _jsxs("div", { class: "brand-stack", children: [_jsxs("div", { class: "brand-title-line", children: [_jsx("span", { class: "brand-title", "data-part": "brand-title", children: props.modes ? COPY.capture.devTitle : COPY.capture.title }), _jsx("span", { class: "brand-sub", "data-part": "brand-sub", children: props.modes ? COPY.capture.devByline : COPY.capture.byline })] }), _jsx("p", { class: "brand-desc", children: props.modes ? COPY.capture.devDescription : COPY.capture.description }), props.onHelp && _jsx("div", { class: "row", children: _jsx(Button, { variant: "secondary", icon: IconInfo, "data-action": "help", onClick: () => props.onHelp(), children: COPY.common.help }) })] }), _jsx(RepoButton, {})] }), !props.modes && (_jsxs("div", { class: "invite", "data-part": "invite", children: [_jsx("p", { class: "invite-title", children: COPY.capture.invite.title }), _jsx("p", { class: "invite-body", children: COPY.capture.invite.body }), LUCI_REPO_URL
|
|
1434
1448
|
? _jsx("a", { class: "btn-link invite-action", "data-action": "take-home", href: LUCI_REPO_URL, target: "_blank", rel: "noopener noreferrer", children: COPY.capture.invite.action })
|
|
1435
1449
|
: props.onHelp && _jsx(Button, { variant: "link", class: "invite-action", "data-action": "take-home", onClick: () => props.onHelp('take-luci-home'), children: COPY.capture.invite.action })] })), _jsxs("div", { class: "project-card", "data-part": "connected-project", children: [_jsxs("div", { class: "project-header", children: [_jsx("span", { class: `status-dot ${activeProject?.project ? 'online' : 'offline'}`, "aria-hidden": "true" }), _jsxs("div", { class: "project-info", children: [_jsx("span", { class: "project-name", children: activeProject?.name ? `Connected to ${activeProject.name}` : 'Not connected to a project' }), activeProject?.project && _jsx("span", { class: "project-path dim", title: activeProject.project, children: activeProject.project }), !activeProject?.project && _jsxs("span", { class: "project-hint dim", children: ["Run ", _jsx("code", { children: "luci serve" }), " in your project terminal"] })] })] }), props.projectInfo?.setUrl && (_jsxs("div", { class: "project-port-row", children: [_jsx("label", { class: "dim", for: "luci-bridge-url", children: "Bridge:" }), _jsx("input", { id: "luci-bridge-url", type: "text", class: "port-input", "data-part": "port-input", value: bridgePortInput, placeholder: "http://127.0.0.1:4545", onChange: e => {
|
|
1436
1450
|
const val = e.currentTarget.value;
|
|
1437
1451
|
setBridgePortInput(val);
|
|
1438
1452
|
void props.projectInfo?.setUrl?.(val).then(refreshProject);
|
|
1439
1453
|
} })] }))] }), props.debuggerPermission && (_jsxs("div", { class: "project-card", "data-part": "debugger-permission", children: [_jsxs("div", { class: "project-header", children: [_jsx("span", { class: `status-dot ${debuggerGranted && useDebugger ? 'online' : 'offline'}`, "aria-hidden": "true" }), _jsxs("div", { class: "project-info", children: [_jsx("span", { class: "project-name", children: debuggerGranted
|
|
1440
|
-
? (useDebugger ? 'Debugger:
|
|
1441
|
-
: 'Debugger:
|
|
1454
|
+
? (useDebugger ? 'Debugger: on' : 'Debugger: off')
|
|
1455
|
+
: 'Debugger: not available' }), _jsx("span", { class: "project-hint dim", children: debuggerGranted
|
|
1442
1456
|
? (useDebugger
|
|
1443
|
-
? '
|
|
1444
|
-
: '
|
|
1445
|
-
: 'CSS rules & frame fallback active' })] })] }), _jsx("div", { class: "project-port-row", children: debuggerGranted ? (_jsx("button", { type: "button", class: "btn-secondary", "data-action": "toggle-debugger", onClick: () => changeSettings({ ...settings, useDebugger: !useDebugger }), children: useDebugger ? 'Disable debugger' : 'Enable debugger' })) : (_jsx("button", { type: "button", class: "btn-secondary", "data-action": "enable-debugger", onClick: () => {
|
|
1446
|
-
if (props.debuggerPermission?.request) {
|
|
1447
|
-
props.debuggerPermission.request();
|
|
1448
|
-
}
|
|
1449
|
-
else if (props.onHelp) {
|
|
1450
|
-
props.onHelp('debugger-permission');
|
|
1451
|
-
}
|
|
1452
|
-
}, children: "Enable in Help" })) })] })), _jsx("hr", { class: "settings-divider" }), _jsx(AppearanceControls, { prefs: uiPrefs, onChange: setUiPrefs, movable: Boolean(props.movable || props.modes), moved: props.movable ? Boolean(place) : Boolean(props.modes && uiPrefs.devPlace) }), _jsx("hr", { class: "settings-divider" }), _jsxs("div", { class: "stack", children: [_jsx("span", { class: "field-label", children: "Default file format" }), _jsxs("div", { class: "settings-grid", children: [_jsxs("label", { class: "field-stack", children: [_jsx("span", { class: "dim", children: "Units" }), _jsxs(Select, { "data-setting": "units", value: settings.units ?? 'px', onChange: e => changeSettings({ ...settings, units: e.currentTarget.value }), children: [_jsx("option", { value: "px", children: "px" }), _jsx("option", { value: "rem", children: "rem" }), _jsx("option", { value: "both", children: "both" })] })] }), _jsxs("label", { class: "field-stack", children: [_jsx("span", { class: "dim", children: "Colours" }), _jsxs(Select, { "data-setting": "colors", value: settings.colors ?? 'hex', onChange: e => changeSettings({ ...settings, colors: e.currentTarget.value }), children: [_jsx("option", { value: "hex", children: "hex" }), _jsx("option", { value: "rgb", children: "rgb" }), _jsx("option", { value: "hsl", children: "hsl" }), _jsx("option", { value: "oklch", children: "oklch" })] })] }), _jsxs("label", { class: "field-stack", title: "The file's source line: the page address, or only the site name", children: [_jsx("span", { class: "dim", children: "Source" }), _jsxs(Select, { "data-setting": "source", value: settings.source ?? 'page', onChange: e => changeSettings({ ...settings, source: e.currentTarget.value }), children: [_jsx("option", { value: "page", children: "page address" }), _jsx("option", { value: "site", children: "site name only" })] })] }), _jsxs("label", { class: "field-stack", title: "The file you copy, download and export: Luci's tables, DESIGN.md for Google Stitch, Tailwind CSS, or CSS Variables", children: [_jsx("span", { class: "dim", children: "File" }), _jsxs(Select, { "data-setting": "style", value: settings.style ?? 'luci', onChange: e => changeSettings({ ...settings, style: e.currentTarget.value }), children: [_jsx("option", { value: "luci", children: "Luci tables" }), _jsx("option", { value: "stitch", children: "DESIGN.md (Stitch)" }), _jsx("option", { value: "tailwind", children: "Tailwind v4 (@theme)" }), _jsx("option", { value: "tailwind-v3", children: "Tailwind v3 (config.js)" }), _jsx("option", { value: "css-vars", children: "CSS Variables (tokens.css)" })] })] })] })] }), _jsx("hr", { class: "settings-divider" }), _jsxs("div", { class: "stack", children: [_jsx("span", { class: "field-label", children: "Keys" }), _jsxs("div", { class: "shortcut-list", "data-part": "keys", children: [_jsx("span", { children: TOOLS.map(t => _jsxs(_Fragment, { children: [_jsx("kbd", { class: "kbd", children: KEYS[t] }), " "] })) }), _jsx("span", { class: "dim", children: "Component, Text, Colour, Spacing" }), _jsxs("span", { children: [_jsx("kbd", { class: "kbd", children: KEYS.page }), " ", _jsx("kbd", { class: "kbd", children: KEYS.check })] }), _jsx("span", { class: "dim", children: "Whole page, Check a build" }), _jsxs("span", { children: [_jsx("kbd", { class: "kbd", children: KEYS.basket }), " ", _jsx("kbd", { class: "kbd", children: KEYS.menu })] }), _jsx("span", { class: "dim", children: "Basket, this menu" }), _jsxs("span", { children: [_jsx("kbd", { class: "kbd", children: "\u2191" }), " ", _jsx("kbd", { class: "kbd", children: "\u2193" })] }), _jsx("span", { class: "dim", children: "Wider or narrower selection" }), _jsx("span", { children: _jsx("kbd", { class: "kbd", children: "Enter" }) }), _jsx("span", { class: "dim", children: "Pick, then take This one" }), _jsx("span", { children: _jsx("kbd", { class: "kbd", children: "Esc" }) }), _jsx("span", { class: "dim", children: "Stop picking, or close the panel" })] })] })] }))), !settingsOpen && pageBusy && !basketOpen && (_jsx("div", { class: "panel", children: _jsx(Loading, { sleep: true, text: COPY.capture.readingPage, step: pageStep }) })), !settingsOpen && basketOpen && (_jsx("div", { class: "panel", role: "dialog", "aria-label": "Basket", "data-part": "basket", children: comparison ? (_jsxs(_Fragment, { children: [_jsx("h2", { children: "Compare" }), _jsxs("p", { class: "hint", "data-part": "compare-summary", children: ["A: ", comparison.result.a.name, " (", sourceLabel(comparison.items[0]), comparison.result.a.note ? `, your note: ${comparison.result.a.note}` : '', "). B: ", comparison.result.b.name, " (", sourceLabel(comparison.items[1]), comparison.result.b.note ? `, your note: ${comparison.result.b.note}` : '', "). ", comparison.result.same.length, " value", comparison.result.same.length === 1 ? ' is' : 's are', " the same; ", comparison.result.differences.length, " differ", comparison.result.differences.length === 1 ? 's' : '', "."] }), comparison.result.differences.length ? (_jsx("div", { class: "compare-scroll", children: _jsxs("table", { class: "compare", "data-part": "compare-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { class: "col-what", children: "What" }), _jsx("th", { class: "col-a", children: "A" }), _jsx("th", { class: "col-b", children: "B" })] }) }), _jsx("tbody", { children: comparison.result.differences.map(d => _jsxs("tr", { children: [_jsx("td", { class: "col-what", children: d.what }), _jsx("td", { class: "col-a", children: d.a }), _jsx("td", { class: "col-b", children: d.b })] })) })] }) })) : _jsx("p", { class: "hint", children: "No differences: every value compared is the same." }), _jsxs("div", { class: "row actions", children: [_jsx(Button, { variant: "primary", size: "md", iconOnly: true, tipAbove: true, tipAlign: "left", icon: copied ? IconSuccess : IconCopy, label: copied ? COPY.common.copied : 'Copy the comparison', "data-action": "copy-compare", onClick: () => void copyText(formatCompareReport(comparison.result, { a: comparison.items[0].name, b: comparison.items[1].name })) }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "compare-back", onClick: () => { setComparison(null); setCopied(false); }, children: "Back to the basket" })] })] })) : basketExport && exported ? (_jsxs(_Fragment, { children: [_jsx("h2", { children: basketExport.title }), _jsx("div", { class: "file", "data-part": "file-name", children: exported.fileName }), _jsx("pre", { "data-part": "preview", children: exported.markdown }), _jsxs("div", { class: "row actions", children: [_jsx(Button, { variant: "primary", size: "md", iconOnly: true, tipAbove: true, tipAlign: "left", icon: copied ? IconSuccess : IconCopy, label: copied ? COPY.common.copied : COPY.capture.actions.copy, "data-action": "copy", onClick: () => void copyText(exported.markdown) }), _jsx(Button, { variant: "secondary", size: "md", iconOnly: true, tipAbove: true, icon: IconDownload, label: COPY.capture.actions.download, "data-action": "download", onClick: () => downloadText(exported.fileName, exported.markdown) }), props.saveToProject && _jsx(SaveButton, { save: () => props.saveToProject(exported.fileName, exported.markdown), projectName: activeProject?.name }, exported.fileName), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "basket-back", onClick: () => { setBasketExport(null); setCopied(false); }, children: "Back to the basket" })] })] })) : (_jsxs(_Fragment, { children: [_jsx("h2", { children: "Basket" }), !basket.length ? (_jsx(EmptyState, { pose: "box", title: COPY.capture.basketEmpty.title, body: COPY.capture.basketEmpty.body, part: "basket-empty" })) : (_jsx("ul", { class: "items", children: basket.map(item => (_jsxs("li", { "data-item": item.id, children: [_jsxs("span", { class: "meta", children: [groupOf(item.capture), " \u00B7 ", sourceLabel(item)] }), basket.length > 1 && (_jsxs("label", { class: "compare-pick", title: "Pick two items to compare them", children: [_jsx("input", { type: "checkbox", "data-item-compare": true, checked: compareIds.includes(item.id), onChange: e => setCompareIds(ids => (e.currentTarget.checked ? [...ids.filter(i => i !== item.id), item.id].slice(-2) : ids.filter(i => i !== item.id))) }), "Compare"] })), _jsx("input", { type: "text", "aria-label": "Name", "data-item-name": true, value: item.name, onChange: e => saveBasket(renameInBasket(basket, item.id, e.currentTarget.value)) }), _jsxs("span", { class: "row", children: [_jsx("button", { type: "button", class: "btn-secondary", "data-item-export": true, onClick: () => setBasketExport({ title: item.name, item }), children: "Export" }), props.saveToProject && (_jsx("button", { type: "button", class: "btn-secondary", "data-item-send-project": true, title: activeProject?.name ? `Save this capture to ${activeProject.name}/.luci/design/` : "Save this capture to .luci/design/ in your project", onClick: () => void sendOneToProject(item), children: itemSent[item.id]?.error ? 'Failed' : itemSent[item.id] ? 'Saved' : 'Send to project' })), _jsx("button", { class: "btn-danger", type: "button", "data-item-remove": true, "aria-label": `Remove ${item.name}`, onClick: () => saveBasket(removeFromBasket(basket, item.id)), children: "Remove" })] }), _jsx("textarea", { "data-item-note": true, "aria-label": `Note for your agent about ${item.name}`, placeholder: "Note for your agent (optional). What to use it for, what to change.", value: item.capture.instructions ?? '', onChange: e => saveBasket(noteInBasket(basket, item.id, e.currentTarget.value)) })] }))) })), mergeable.length > 0 && (_jsxs("div", { class: "stack", "data-part": "merge", children: [_jsxs("span", { class: "dim", children: ["One site, several pages: ", mergeable.map(g => `${g.type} from ${g.pages.length} pages of ${g.site}`).join(', '), ". Merge them into one site file. Each row says which pages use it; values that differ are listed as conflicts."] }), _jsx("span", { class: "row", children: _jsxs("button", { type: "button", class: "btn-secondary", "data-action": "merge-systems", onClick: mergeSystemsNow, children: ["Merge into site system", mergeable.length === 1 ? '' : 's', " (", mergeable.length, ")"] }) })] })), mergedNote && _jsx("p", { class: "hint", "data-part": "merged", children: mergedNote }), compareItems && (_jsxs("div", { class: "row", "data-part": "compare-pick", children: [_jsxs("span", { class: "dim", children: [compareItems[0].name, " and ", compareItems[1].name] }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "compare", onClick: () => { setComparison({ items: compareItems, result: compareCaptures(compareItems[0].capture, compareItems[1].capture) }); setCopied(false); }, children: "Compare the two" })] })), _jsxs("div", { class: "row", children: [_jsx("button", { type: "button", class: "btn-primary", "data-action": "export-all", disabled: !basket.length, onClick: () => setBasketExport({ title: `All ${basket.length} items, one file` }), children: "Export all as one file" }), props.saveToProject && (_jsx("button", { type: "button", class: "btn-secondary", "data-action": "send-all-project", disabled: !basket.length || basketSending, title: activeProject?.name ? `Save each capture in the basket to ${activeProject.name}/.luci/design/` : "Save each capture in the basket to .luci/design/ in your project", onClick: () => void sendAllToProject(), children: basketSending ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Sending\u2026"] }) : 'Send all to project' })), basket.length > 0 && (confirmClear
|
|
1457
|
+
? 'Luci uses it during a capture for exact states and widths, then detaches it'
|
|
1458
|
+
: 'Luci never attaches it: states come from stylesheet rules, widths from a hidden frame')
|
|
1459
|
+
: 'Chrome is not letting Luci use it: states come from stylesheet rules, widths from a hidden frame' })] })] }), _jsxs("div", { class: "project-port-row", children: [debuggerGranted && (_jsx("button", { type: "button", class: "btn-secondary", "data-action": "toggle-debugger", onClick: () => changeSettings({ ...settings, useDebugger: !useDebugger }), children: useDebugger ? "Don't use the debugger" : 'Use the debugger' })), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "debugger-help", onClick: openDebuggerHelp, children: "About the debugger" })] })] })), _jsx("hr", { class: "settings-divider" }), _jsx(AppearanceControls, { prefs: uiPrefs, onChange: setUiPrefs, movable: Boolean(props.movable || props.modes), moved: props.movable ? Boolean(place) : Boolean(props.modes && uiPrefs.devPlace) }), _jsx("hr", { class: "settings-divider" }), _jsxs("div", { class: "stack", children: [_jsx("span", { class: "field-label", children: "Default file format" }), _jsxs("div", { class: "settings-grid", children: [_jsxs("label", { class: "field-stack", children: [_jsx("span", { class: "dim", children: "Units" }), _jsxs(Select, { "data-setting": "units", value: settings.units ?? 'px', onChange: e => changeSettings({ ...settings, units: e.currentTarget.value }), children: [_jsx("option", { value: "px", children: "px" }), _jsx("option", { value: "rem", children: "rem" }), _jsx("option", { value: "both", children: "both" })] })] }), _jsxs("label", { class: "field-stack", children: [_jsx("span", { class: "dim", children: "Colours" }), _jsxs(Select, { "data-setting": "colors", value: settings.colors ?? 'hex', onChange: e => changeSettings({ ...settings, colors: e.currentTarget.value }), children: [_jsx("option", { value: "hex", children: "hex" }), _jsx("option", { value: "rgb", children: "rgb" }), _jsx("option", { value: "hsl", children: "hsl" }), _jsx("option", { value: "oklch", children: "oklch" })] })] }), _jsxs("label", { class: "field-stack", title: "The file's source line: the page address, or only the site name", children: [_jsx("span", { class: "dim", children: "Source" }), _jsxs(Select, { "data-setting": "source", value: settings.source ?? 'page', onChange: e => changeSettings({ ...settings, source: e.currentTarget.value }), children: [_jsx("option", { value: "page", children: "page address" }), _jsx("option", { value: "site", children: "site name only" })] })] }), _jsxs("label", { class: "field-stack", title: "The file you copy, download and export: Luci's tables, DESIGN.md for Google Stitch, Tailwind CSS, or CSS Variables", children: [_jsx("span", { class: "dim", children: "File" }), _jsxs(Select, { "data-setting": "style", value: settings.style ?? 'luci', onChange: e => changeSettings({ ...settings, style: e.currentTarget.value }), children: [_jsx("option", { value: "luci", children: "Luci tables" }), _jsx("option", { value: "stitch", children: "DESIGN.md (Stitch)" }), _jsx("option", { value: "tailwind", children: "Tailwind v4 (@theme)" }), _jsx("option", { value: "tailwind-v3", children: "Tailwind v3 (config.js)" }), _jsx("option", { value: "css-vars", children: "CSS Variables (tokens.css)" })] })] })] })] }), _jsx("hr", { class: "settings-divider" }), _jsxs("div", { class: "stack", children: [_jsx("span", { class: "field-label", children: "Keys" }), _jsxs("div", { class: "shortcut-list", "data-part": "keys", children: [_jsx("span", { children: TOOLS.map(t => _jsxs(_Fragment, { children: [_jsx("kbd", { class: "kbd", children: KEYS[t] }), " "] })) }), _jsx("span", { class: "dim", children: "Component, Text, Colour, Spacing" }), _jsxs("span", { children: [_jsx("kbd", { class: "kbd", children: KEYS.page }), " ", _jsx("kbd", { class: "kbd", children: KEYS.check })] }), _jsx("span", { class: "dim", children: "Whole page, Check a build" }), _jsxs("span", { children: [_jsx("kbd", { class: "kbd", children: KEYS.basket }), " ", _jsx("kbd", { class: "kbd", children: KEYS.menu })] }), _jsx("span", { class: "dim", children: "Basket, this menu" }), _jsxs("span", { children: [_jsx("kbd", { class: "kbd", children: "\u2191" }), " ", _jsx("kbd", { class: "kbd", children: "\u2193" })] }), _jsx("span", { class: "dim", children: "Wider or narrower selection" }), _jsx("span", { children: _jsx("kbd", { class: "kbd", children: "Enter" }) }), _jsx("span", { class: "dim", children: "Pick, then take This one" }), _jsx("span", { children: _jsx("kbd", { class: "kbd", children: "Esc" }) }), _jsx("span", { class: "dim", children: "Stop picking, or close the panel" })] })] })] }))), !settingsOpen && pageBusy && !basketOpen && (_jsx("div", { class: "panel", children: _jsx(Loading, { sleep: true, text: COPY.capture.readingPage, step: pageStep }) })), !settingsOpen && basketOpen && (_jsx("div", { class: "panel", role: "dialog", "aria-label": "Basket", "data-part": "basket", children: comparison ? (_jsxs(_Fragment, { children: [_jsx("h2", { children: "Compare" }), _jsxs("p", { class: "hint", "data-part": "compare-summary", children: ["A: ", comparison.result.a.name, " (", sourceLabel(comparison.items[0]), comparison.result.a.note ? `, your note: ${comparison.result.a.note}` : '', "). B: ", comparison.result.b.name, " (", sourceLabel(comparison.items[1]), comparison.result.b.note ? `, your note: ${comparison.result.b.note}` : '', "). ", comparison.result.same.length, " value", comparison.result.same.length === 1 ? ' is' : 's are', " the same; ", comparison.result.differences.length, " differ", comparison.result.differences.length === 1 ? 's' : '', "."] }), comparison.result.differences.length ? (_jsx("div", { class: "compare-scroll", children: _jsxs("table", { class: "compare", "data-part": "compare-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { class: "col-what", children: "What" }), _jsx("th", { class: "col-a", children: "A" }), _jsx("th", { class: "col-b", children: "B" })] }) }), _jsx("tbody", { children: comparison.result.differences.map(d => _jsxs("tr", { children: [_jsx("td", { class: "col-what", children: d.what }), _jsx("td", { class: "col-a", children: d.a }), _jsx("td", { class: "col-b", children: d.b })] })) })] }) })) : _jsx("p", { class: "hint", children: "No differences: every value compared is the same." }), _jsxs("div", { class: "row actions", children: [_jsx(Button, { variant: "primary", size: "md", iconOnly: true, tipAbove: true, tipAlign: "left", icon: copied ? IconSuccess : IconCopy, label: copied ? COPY.common.copied : 'Copy the comparison', "data-action": "copy-compare", onClick: () => void copyText(formatCompareReport(comparison.result, { a: comparison.items[0].name, b: comparison.items[1].name })) }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "compare-back", onClick: () => { setComparison(null); setCopied(false); }, children: "Back to the basket" })] })] })) : basketExport && exported ? (_jsxs(_Fragment, { children: [_jsx("h2", { children: basketExport.title }), _jsx("div", { class: "file", "data-part": "file-name", children: exported.fileName }), _jsx("pre", { "data-part": "preview", children: exported.markdown }), _jsxs("div", { class: "row actions", children: [_jsx(Button, { variant: "primary", size: "md", iconOnly: true, tipAbove: true, tipAlign: "left", icon: copied ? IconSuccess : IconCopy, label: copied ? COPY.common.copied : COPY.capture.actions.copy, "data-action": "copy", onClick: () => void copyText(exported.markdown) }), _jsx(Button, { variant: "secondary", size: "md", iconOnly: true, tipAbove: true, icon: IconDownload, label: COPY.capture.actions.download, "data-action": "download", onClick: () => downloadText(exported.fileName, exported.markdown) }), props.saveToProject && _jsx(SaveButton, { save: () => props.saveToProject(exported.fileName, exported.markdown), onDownload: () => downloadText(exported.fileName, exported.markdown), projectName: activeProject?.name }, exported.fileName), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "basket-back", onClick: () => { setBasketExport(null); setCopied(false); }, children: "Back to the basket" })] })] })) : (_jsxs(_Fragment, { children: [_jsx("h2", { children: "Basket" }), !basket.length ? (_jsx(EmptyState, { pose: "box", title: COPY.capture.basketEmpty.title, body: COPY.capture.basketEmpty.body, part: "basket-empty" })) : (_jsx("ul", { class: "items", children: basket.map(item => (_jsxs("li", { "data-item": item.id, children: [_jsxs("span", { class: "meta", children: [groupOf(item.capture), " \u00B7 ", sourceLabel(item)] }), basket.length > 1 && (_jsxs("label", { class: "compare-pick", title: "Pick two items to compare them", children: [_jsx("input", { type: "checkbox", "data-item-compare": true, checked: compareIds.includes(item.id), onChange: e => setCompareIds(ids => (e.currentTarget.checked ? [...ids.filter(i => i !== item.id), item.id].slice(-2) : ids.filter(i => i !== item.id))) }), "Compare"] })), _jsx("input", { type: "text", "aria-label": "Name", "data-item-name": true, value: item.name, onChange: e => saveBasket(renameInBasket(basket, item.id, e.currentTarget.value)) }), _jsxs("span", { class: "row", children: [_jsx("button", { type: "button", class: "btn-secondary", "data-item-export": true, onClick: () => setBasketExport({ title: item.name, item }), children: "Export" }), props.saveToProject && (_jsx("button", { type: "button", class: "btn-secondary", "data-item-send-project": true, title: activeProject?.name ? `Save this capture to ${activeProject.name}/.luci/design/` : "Save this capture to .luci/design/ in your project", onClick: () => void sendOneToProject(item), children: itemSent[item.id]?.error ? 'Failed' : itemSent[item.id] ? 'Saved' : 'Send to project' })), _jsx("button", { class: "btn-danger", type: "button", "data-item-remove": true, "aria-label": `Remove ${item.name}`, onClick: () => saveBasket(removeFromBasket(basket, item.id)), children: "Remove" })] }), _jsx("textarea", { "data-item-note": true, "aria-label": `Note for your agent about ${item.name}`, placeholder: "Note for your agent (optional). What to use it for, what to change.", value: item.capture.instructions ?? '', onChange: e => saveBasket(noteInBasket(basket, item.id, e.currentTarget.value)) })] }))) })), mergeable.length > 0 && (_jsxs("div", { class: "stack", "data-part": "merge", children: [_jsxs("span", { class: "dim", children: ["One site, several pages: ", mergeable.map(g => `${g.type} from ${g.pages.length} pages of ${g.site}`).join(', '), ". Merge them into one site file. Each row says which pages use it; values that differ are listed as conflicts."] }), _jsx("span", { class: "row", children: _jsxs("button", { type: "button", class: "btn-secondary", "data-action": "merge-systems", onClick: mergeSystemsNow, children: ["Merge into site system", mergeable.length === 1 ? '' : 's', " (", mergeable.length, ")"] }) })] })), mergedNote && _jsx("p", { class: "hint", "data-part": "merged", children: mergedNote }), compareItems && (_jsxs("div", { class: "row", "data-part": "compare-pick", children: [_jsxs("span", { class: "dim", children: [compareItems[0].name, " and ", compareItems[1].name] }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "compare", onClick: () => { setComparison({ items: compareItems, result: compareCaptures(compareItems[0].capture, compareItems[1].capture) }); setCopied(false); }, children: "Compare the two" })] })), _jsxs("div", { class: "row", children: [_jsx("button", { type: "button", class: "btn-primary", "data-action": "export-all", disabled: !basket.length, onClick: () => setBasketExport({ title: `All ${basket.length} items, one file` }), children: "Export all as one file" }), props.saveToProject && (_jsx("button", { type: "button", class: "btn-secondary", "data-action": "send-all-project", disabled: !basket.length || basketSending, title: activeProject?.name ? `Save each capture in the basket to ${activeProject.name}/.luci/design/` : "Save each capture in the basket to .luci/design/ in your project", onClick: () => void sendAllToProject(), children: basketSending ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Sending\u2026"] }) : 'Send all to project' })), basket.length > 0 && (confirmClear
|
|
1453
1460
|
? _jsx("button", { type: "button", class: "btn-danger", "data-action": "clear-basket-confirm", onClick: () => { saveBasket([]); setConfirmClear(false); }, children: "Yes, empty the basket" })
|
|
1454
|
-
: _jsx("button", { type: "button", class: "btn-danger", "data-action": "clear-basket", onClick: () => setConfirmClear(true), children: "Empty basket" }))] }), basketStatus && _jsx("p", { class: basketStatus.error ? 'error' : 'hint', "data-
|
|
1461
|
+
: _jsx("button", { type: "button", class: "btn-danger", "data-action": "clear-basket", onClick: () => setConfirmClear(true), children: "Empty basket" }))] }), basketStatus && (_jsxs("div", { class: "row", "data-part": "basket-status", children: [_jsx("p", { class: basketStatus.error ? 'error' : 'hint', style: { margin: 0 }, children: basketStatus.text }), basketStatus.error && basketStatus.download && (_jsx("button", { type: "button", class: "btn-secondary", "data-action": "download-fallback", onClick: basketStatus.download, children: "Download file instead" }))] }))] })) })), !settingsOpen && (picking || dropperOpen || pixelMode || imageMode) && tool && (_jsxs("div", { class: `sub with-luci${imageMode ? ' image-drop' : ''}`, "data-part": "tool-hint", role: "note", ...(imageMode ? {
|
|
1455
1462
|
onDragOver: (e) => { e.preventDefault(); },
|
|
1456
1463
|
onDrop: (e) => {
|
|
1457
1464
|
e.preventDefault();
|
|
@@ -1463,7 +1470,7 @@ export function Toolbar(props) {
|
|
|
1463
1470
|
: pixelMode ? 'Point at any spot. Click to take its colour.'
|
|
1464
1471
|
: checkDesign ? `Click the component you built. Luci checks it against ${checkDesign.label}.`
|
|
1465
1472
|
: `${TOOL_HINTS[tool]}${tool === 'color' && !canPickPixels ? ' This browser cannot pick pixels.' : ''}` }), imageMode && (_jsxs("div", { class: "row", children: [_jsx("input", { ref: imageInput, type: "file", accept: "image/*", "data-part": "image-file", hidden: true, onChange: e => { const f = e.currentTarget.files?.[0]; if (f)
|
|
1466
|
-
void readImageFile(f, f.name); } }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "choose-image", disabled: imageBusy, onClick: () => imageInput.current?.click(), children: "Choose an image" })] })), _jsx("p", { class: "keys", children: pixelMode || imageMode ? 'Esc: back to Element' : '↑ ↓ after clicking: wider or narrower · Esc: stop' })] })] })), !settingsOpen && picking && notice && (_jsx("div", { class: "panel", role: "status", children: _jsx("p", { class: "error", "data-part": "notice", children: notice }) })), !settingsOpen && checkOpen && !basketOpen && (_jsx(DesignChooser, { ...(props.designs ? { designs: props.designs } : {}), basket: basket, onChoose: chooseDesign, onCancel: endCheck })), !settingsOpen && !picking && !basketOpen && checkOutcome && checkDesign && picked && (_jsx(CheckResultPanel, { outcome: checkOutcome, watching: watchCheck, onWatch: on => { setWatchCheck(on); setAutoNote(null); if (!on)
|
|
1473
|
+
void readImageFile(f, f.name); } }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "choose-image", disabled: imageBusy, onClick: () => imageInput.current?.click(), children: "Choose an image" })] })), _jsx("p", { class: "keys", children: pixelMode || imageMode ? 'Esc: back to Element' : touchScreen(win) ? 'Tap once to see an element, again to take it' : '↑ ↓ after clicking: wider or narrower · Esc: stop' })] })] })), !settingsOpen && picking && notice && (_jsx("div", { class: "panel", role: "status", children: _jsx("p", { class: "error", "data-part": "notice", children: notice }) })), !settingsOpen && checkOpen && !basketOpen && (_jsx(DesignChooser, { ...(props.designs ? { designs: props.designs } : {}), basket: basket, onChoose: chooseDesign, onCancel: endCheck })), !settingsOpen && !picking && !basketOpen && checkOutcome && checkDesign && picked && (_jsx(CheckResultPanel, { outcome: checkOutcome, watching: watchCheck, onWatch: on => { setWatchCheck(on); setAutoNote(null); if (!on)
|
|
1467
1474
|
forgetWatch(); }, autoNote: autoNote, design: checkDesign, el: picked.el, selector: picked.entry.selector, ...(props.addCheckNotes ? { addNotes: props.addCheckNotes } : {}), ...(props.checkNotesWhere ? { notesWhere: props.checkNotesWhere } : {}), onCopy: copyText, onAgain: () => startPicking('component'), onChangeDesign: openCheck }, `${picked.entry.selector} ${checkDesign.file} ${checkVersion}`)), !settingsOpen && !picking && !basketOpen && picked && checkDesign && !checkOutcome && !result && (_jsx("div", { class: "panel", role: "dialog", "aria-label": "Design check", "data-part": "check-selected", children: _jsxs("div", { class: "selected-card", children: [_jsxs("div", { class: "selected-head", children: [_jsxs("h2", { children: ["Built: ", _jsx("span", { "data-part": "selected-name", children: elementName(picked.entry.tag, picked.entry.role) })] }), _jsxs("span", { class: "dim", children: [Math.round(picked.el.getBoundingClientRect().width), " \u00D7 ", Math.round(picked.el.getBoundingClientRect().height)] })] }), _jsxs("div", { class: "row", children: [_jsx("button", { type: "button", class: "btn-secondary", "data-action": "widen", disabled: !widerOf(picked.el), onClick: widen, title: "Select the element around this one (\u2191)", children: "\u2191 Wider" }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "narrow", disabled: !narrowerOf(picked.el), onClick: narrow, title: "Select the element inside this one (\u2193)", children: "\u2193 Narrower" }), _jsx("span", { class: "dim", children: "or \u2191 \u2193" })] }), picked.eligibility.status !== 'allowed' && _jsxs("p", { class: "error", "data-part": "notice", children: [picked.eligibility.reason, " Go wider or narrower."] }), busy ? _jsx(Loading, { text: busy }) : (_jsxs(_Fragment, { children: [_jsxs("div", { class: "row", children: [_jsx("button", { type: "button", class: "btn-primary", "data-action": "check-run", disabled: picked.eligibility.status !== 'allowed', onClick: () => void runCheck(), children: "Check against the design" }), _jsx("button", { type: "button", class: "btn-secondary", onClick: () => startPicking('component'), children: "Pick again" }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "check-design", onClick: openCheck, children: "Change design" })] }), _jsxs("p", { class: "tip-box", "data-part": "check-against", children: ["Design: ", checkDesign.label] })] }))] }) })), !settingsOpen && !picking && !basketOpen && picked && !checkDesign && !result && tool && (_jsx("div", { class: "panel", role: "dialog", "aria-label": "Capture", children: _jsxs("div", { class: "selected-card", children: [_jsxs("div", { class: "selected-head", children: [_jsxs("h2", { children: ["Selected \u00B7 ", _jsx("span", { "data-part": "selected-name", children: elementName(picked.entry.tag, picked.entry.role) })] }), _jsxs("span", { class: "dim", children: [Math.round(picked.el.getBoundingClientRect().width), " \u00D7 ", Math.round(picked.el.getBoundingClientRect().height)] })] }), _jsxs("div", { class: "row", children: [_jsx("button", { type: "button", class: "btn-secondary", "data-action": "widen", disabled: !widerOf(picked.el), onClick: widen, title: "Select the element around this one (\u2191)", children: "\u2191 Wider" }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "narrow", disabled: !narrowerOf(picked.el), onClick: narrow, title: "Select the element inside this one (\u2193)", children: "\u2193 Narrower" }), _jsx("span", { class: "dim", children: "or \u2191 \u2193" })] }), picked.eligibility.status === 'redirected' && _jsx("p", { class: "hint", children: picked.eligibility.reason }), picked.eligibility.status === 'blocked' && _jsxs("p", { class: "error", "data-part": "notice", children: [picked.eligibility.reason, " Go wider or narrower."] }), tool === 'spacing' && picked.eligibility.status === 'allowed' && spacingChoices(picked.entry).length > 1 && (_jsxs("div", { class: "row", children: [_jsxs("button", { type: "button", class: "btn-secondary", "aria-pressed": choice === ALL_SPACING, "data-choice": "all", onClick: () => setChoice(ALL_SPACING), children: ["All (", spacingChoices(picked.entry).length, ")"] }), spacingChoices(picked.entry).map((u, i) => (_jsxs("button", { type: "button", class: "btn-secondary", "aria-pressed": choice === i, "data-choice": u.property, onClick: () => setChoice(i), children: [u.property, " ", u.computed] })))] })), busy ? _jsx(Loading, { text: busy }) : (_jsxs(_Fragment, { children: [_jsxs("div", { class: "row", children: [picked.eligibility.status === 'allowed' && (_jsx("button", { type: "button", class: "btn-primary", "data-output": "one", onClick: () => void produce(false), children: "This one" })), picked.eligibility.status !== 'blocked' && (_jsx("button", { type: "button", class: picked.eligibility.status === 'allowed' ? 'btn-secondary' : 'btn-primary', "data-output": "system", onClick: () => void produce(true), children: "The whole system" })), tool === 'component' && picked.eligibility.status === 'allowed' && (_jsx("button", { type: "button", class: "btn-secondary", "data-output": "section", title: SECTION_HINT, onClick: () => void produce(false, true), children: "This section" })), _jsx("button", { type: "button", class: "btn-secondary", onClick: () => startPicking(tool), children: "Pick again" })] }), picked.eligibility.status !== 'blocked' && (_jsxs("p", { class: "tip-box", "data-part": "output-hints", children: [picked.eligibility.status === 'allowed' && _jsxs(_Fragment, { children: ["This one: ", OUTPUT_HINTS[tool].one, ". "] }), "The whole system: ", OUTPUT_HINTS[tool].system, ".", tool === 'component' && picked.eligibility.status === 'allowed' && _jsxs(_Fragment, { children: [" This section: ", SECTION_HINT, "."] })] }))] }))] }) })), !settingsOpen && !picking && !basketOpen && result && (_jsx("div", { class: result.ok ? 'panel result-panel' : 'panel', role: "dialog", "aria-label": "Capture file", children: result.ok ? (_jsxs(_Fragment, { children: [_jsxs("div", { class: "panel-body", children: [_jsxs("div", { class: "file-row", children: [_jsx("div", { class: "file", "data-part": "file-name", children: outputName }), _jsx("span", { class: "scope-pill badge", children: result.output.capture.meta.scope })] }), sectionFiles.length > 0 && (_jsxs("div", { class: "stack", "data-part": "section-files", children: [_jsxs("span", { class: "dim", children: ["Plus ", sectionFiles.length, " component file", sectionFiles.length === 1 ? '' : 's', ", each described once. The section file places them."] }), _jsx("ul", { class: "files", children: sectionFiles.map(f => (_jsxs("li", { "data-file": f.fileName, children: [_jsx("code", { children: f.fileName }), " ", _jsx("button", { type: "button", class: "btn-secondary", "data-file-view": true, onClick: () => setViewFile(f), children: "View" })] }))) })] })), viewFile && (_jsxs("div", { class: "stack", "data-part": "file-view-box", children: [_jsxs("span", { class: "row", children: [_jsx("code", { children: viewFile.fileName }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "file-view-close", onClick: () => setViewFile(null), children: "Back to the section file" })] }), _jsx("pre", { class: "preview", "data-part": "file-view", children: viewFile.markdown })] })), _jsxs("div", { class: "settings-grid", children: [_jsxs("label", { class: "field-stack", children: [_jsx("span", { class: "field-label", children: "Units" }), _jsxs(Select, { "data-setting": "units", value: settings.units ?? 'px', onChange: e => changeSettings({ ...settings, units: e.currentTarget.value }), children: [_jsx("option", { value: "px", children: "px" }), _jsx("option", { value: "rem", children: "rem" }), _jsx("option", { value: "both", children: "both" })] })] }), _jsxs("label", { class: "field-stack", children: [_jsx("span", { class: "field-label", children: "Colours" }), _jsxs(Select, { "data-setting": "colors", value: settings.colors ?? 'hex', onChange: e => changeSettings({ ...settings, colors: e.currentTarget.value }), children: [_jsx("option", { value: "hex", children: "hex" }), _jsx("option", { value: "rgb", children: "rgb" }), _jsx("option", { value: "hsl", children: "hsl" }), _jsx("option", { value: "oklch", children: "oklch" })] })] }), _jsxs("label", { class: "field-stack", title: "The file's source line: the page address, or only the site name", children: [_jsx("span", { class: "field-label", children: "Source" }), _jsxs(Select, { "data-setting": "source", value: settings.source ?? 'page', onChange: e => changeSettings({ ...settings, source: e.currentTarget.value }), children: [_jsx("option", { value: "page", children: "page address" }), _jsx("option", { value: "site", children: "site name only" })] })] }), _jsxs("label", { class: "field-stack", title: "The file you copy and download: Luci's tables, DESIGN.md for Google Stitch, Tailwind CSS, or CSS Variables", children: [_jsx("span", { class: "field-label", children: "File" }), _jsxs(Select, { "data-setting": "style", value: settings.style ?? 'luci', onChange: e => changeSettings({ ...settings, style: e.currentTarget.value }), children: [_jsx("option", { value: "luci", children: "Luci tables" }), _jsx("option", { value: "stitch", children: "DESIGN.md (Stitch)" }), _jsx("option", { value: "tailwind", children: "Tailwind v4 (@theme)" }), _jsx("option", { value: "tailwind-v3", children: "Tailwind v3 (config.js)" }), _jsx("option", { value: "css-vars", children: "CSS Variables (tokens.css)" })] })] })] }), isCustomExport && props.saveToProject && _jsx("p", { class: "dim", "data-part": "stitch-note", children: "Save to project keeps Luci's tables: the design check and your agent's tools read them." }), stateNote && _jsx("p", { class: "hint", "data-part": "state-note", children: stateNote }), componentCtx && result.output.capture.meta.scope === 'component' && (_jsxs("div", { class: "stack", "data-part": "manual-state", children: [_jsx("hr", { class: "settings-divider" }), _jsxs("div", { class: "stack", "data-part": "states-summary", children: [_jsx("span", { class: "field-label", children: "States in this file" }), _jsxs("div", { class: "states-list", children: [_jsx("span", { class: "state default detected", "data-state": "default", title: "Resting state", children: "Default \u2713" }), componentCtx.states.map(s => (_jsxs("span", { class: s.detected ? 'state detected' : 'state missing', "data-state": s.state, title: s.detected ? (s.trigger ? `In the file. Set by the ${s.trigger.element} around it.` : 'In the file.')
|
|
1468
1475
|
: checked(s) ? 'Checked in the browser. Nothing changes.'
|
|
1469
1476
|
: 'Not detected. It may change through JavaScript. Capture it by hand below.', children: [s.state, " ", s.detected ? `✓${s.trigger ? ` (via ${s.trigger.element.split(' ')[0]})` : ''}` : checked(s) ? '– no change' : '– not detected'] })))] })] }), _jsx("hr", { class: "settings-divider" }), countdown !== null && capturing ? (_jsxs("div", { class: "row", children: [_jsxs("p", { class: "hint", "data-part": "countdown", children: [capturing.total > 1 ? `${capturing.index} of ${capturing.total}: ` : '', "Put it in its ", _jsx("strong", { children: capturing.state }), " state now (", STATE_HOW[capturing.state], "). Capturing in ", countdown, "\u2026"] }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "cancel-capture", onClick: cancelCapture, children: "Stop" })] })) : (_jsxs("div", { class: "manual-row", children: [_jsxs("div", { class: "section-copy", children: [_jsx("label", { class: "field-label", for: "luci-manual-state", children: "Capture by hand" }), _jsx("span", { class: "dim", children: "Set hover, focus or active yourself. 3 second countdown." })] }), _jsxs("div", { class: "manual-actions", children: [_jsxs(Select, { id: "luci-manual-state", "data-setting": "manual-state", value: manualTarget, onChange: e => setManualTarget(e.currentTarget.value), children: [missingStates(componentCtx.states).length > 0 && _jsxs("option", { value: ALL_MISSING, children: ["All missing states (", missingStates(componentCtx.states).length, ")"] }), STATE_ORDER.filter(s => s !== 'disabled').map(s => _jsx("option", { value: s, children: s }))] }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "capture-state", onClick: captureCurrentState, children: manualTarget === ALL_MISSING ? 'Capture' : 'Capture state' })] })] }))] })), picked && (result.output.capture.meta.scope === 'component' || result.output.capture.meta.scope === 'section') && result.output.capture.meta.selector === picked.entry.selector && (_jsxs("div", { class: "stack", "data-part": "responsive", children: [_jsx("hr", { class: "settings-divider" }), widthBusy ? _jsx(Loading, { text: widthBusy }) : (_jsxs("div", { class: "manual-row", children: [_jsxs("div", { class: "section-copy", children: [_jsx("span", { class: "field-label", children: "Breakpoints" }), !widthNote && _jsx("span", { class: "dim", children: responsiveRef.current ? 'In the file, under Responsive.' : 'The site\'s own breakpoints. 2 or 3 widths.' })] }), _jsx("div", { class: "manual-actions", children: _jsx("button", { type: "button", class: "btn-secondary", "data-action": "responsive", title: "Read it at the widths where the site's media queries change it, and add the changes to the file", onClick: () => void addResponsive(), children: responsiveRef.current ? 'Read the widths again' : 'How it changes by width' }) })] })), widthNote && _jsx("p", { class: widthNote.error ? 'error' : 'hint', "data-part": "responsive-note", children: widthNote.text })] })), _jsx("hr", { class: "settings-divider" }), _jsx(RemapSection, { source: myTokens, edited: edited !== null, applied: remapped && remapped.fileName === result.output.fileName ? remapped.summary : null, onApply: tokens => {
|
|
@@ -1481,7 +1488,8 @@ export function Toolbar(props) {
|
|
|
1481
1488
|
: _jsx(Button, { variant: "secondary", size: "md", iconOnly: true, tipAbove: true, icon: IconDownload, "data-action": "download", onClick: download, label: COPY.capture.actions.download }), _jsx(Button, { variant: "secondary", size: "md", iconOnly: true, tipAbove: true, icon: added ? IconSuccess : IconBasket, "data-action": "add-to-basket", label: added ? COPY.capture.actions.inBasket : COPY.capture.actions.addToBasket, onClick: () => { if (added)
|
|
1482
1489
|
openBasket();
|
|
1483
1490
|
else
|
|
1484
|
-
void addCurrent(); } }), tool && _jsx(Button, { variant: "secondary", size: "md", iconOnly: true, tipAbove: true, icon: TOOL_ICONS[tool], "data-action": "pick-again", label: COPY.capture.actions.pickAgain, onClick: () => startPicking(tool) }), props.saveToProject && output && _jsx(SaveButton, { save: saveAll, projectName: activeProject?.name }, output.fileName), props.makeRule && output && output.capture.meta.scope === 'component' && (_jsx(RuleButton, { make: () => props.makeRule(output.fileName, markdown) }, `rule ${output.fileName}`))] })] })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { class: "greet", children: [_jsx(Mascot, { pose: "annoyed", size: 96 }), _jsx("p", { class: "error", "data-part": "error", children: result.message })] }), tool && _jsx("div", { class: "row", children: _jsx(Button, { variant: "secondary", icon: TOOL_ICONS[tool], "data-action": "pick-again", onClick: () => startPicking(tool), children: COPY.capture.actions.pickAgain }) })] })) }))] }), picking && tool && (_jsx("div", { class: "pick-layer", "data-part": "pick-layer", onPointerMove: e =>
|
|
1491
|
+
void addCurrent(); } }), tool && _jsx(Button, { variant: "secondary", size: "md", iconOnly: true, tipAbove: true, icon: TOOL_ICONS[tool], "data-action": "pick-again", label: COPY.capture.actions.pickAgain, onClick: () => startPicking(tool) }), props.saveToProject && output && _jsx(SaveButton, { save: saveAll, onDownload: sectionFiles.length ? downloadZip : download, projectName: activeProject?.name }, output.fileName), props.makeRule && output && output.capture.meta.scope === 'component' && (_jsx(RuleButton, { make: () => props.makeRule(output.fileName, markdown) }, `rule ${output.fileName}`))] })] })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { class: "greet", children: [_jsx(Mascot, { pose: "annoyed", size: 96 }), _jsx("p", { class: "error", "data-part": "error", children: result.message })] }), tool && _jsx("div", { class: "row", children: _jsx(Button, { variant: "secondary", icon: TOOL_ICONS[tool], "data-action": "pick-again", onClick: () => startPicking(tool), children: COPY.capture.actions.pickAgain }) })] })) }))] }), picking && tool && (_jsx("div", { class: "pick-layer", "data-part": "pick-layer", onPointerMove: e => { if (e.pointerType !== 'touch')
|
|
1492
|
+
pickMove(e.clientX, e.clientY); }, onPointerDown: e => { e.preventDefault(); e.currentTarget.setPointerCapture?.(e.pointerId); pickDown(e.clientX, e.clientY); }, onPointerUp: e => { e.preventDefault(); pickUp(e.clientX, e.clientY, e.pointerType === 'touch'); }, onPointerCancel: () => { drag.current = null; }, onWheel: e => pickWheel(e), onContextMenu: e => e.preventDefault() })), pixelMode && (_jsxs(_Fragment, { children: [_jsx("div", { class: "pixel-layer", "data-part": "pixel-layer", onPointerMove: e => setPixelHover(samplePixel(e.clientX, e.clientY)), onPointerLeave: () => setPixelHover(null), onClick: e => pickPixelAt(e.clientX, e.clientY) }), pixelHover && shot.current && (() => {
|
|
1485
1493
|
// The loupe and the hex sit below and right of the pointer, or flip to stay in the window
|
|
1486
1494
|
const left = pixelHover.x + 20 + LOUPE_PX > win.innerWidth ? pixelHover.x - 20 - LOUPE_PX : pixelHover.x + 20;
|
|
1487
1495
|
const top = pixelHover.y + 20 + LOUPE_PX + 36 > win.innerHeight ? pixelHover.y - 20 - LOUPE_PX - 36 : pixelHover.y + 20;
|