@luci-dev/capture 0.5.4 → 0.5.6

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.
@@ -11,10 +11,10 @@ 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
- import { Badge, 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';
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';
18
18
  import { AppearanceControls, LuciLogo, useUiPrefs } from './theme.js';
19
19
  import { DevSettingsPanel } from './devSettings.js';
20
20
  import { zip } from './zip.js';
@@ -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');
@@ -1430,7 +1436,7 @@ export function Toolbar(props) {
1430
1436
  const hoverElig = hovered ? eligibilityOf(hovered) : null;
1431
1437
  const rect = hovered?.getBoundingClientRect();
1432
1438
  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(Badge, { brand: true, children: "Beta" }), _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
1439
+ 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 })) : (_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
1440
  ? _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
1441
  : 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
1442
  const val = e.currentTarget.value;
@@ -1449,7 +1455,7 @@ export function Toolbar(props) {
1449
1455
  else if (props.onHelp) {
1450
1456
  props.onHelp('debugger-permission');
1451
1457
  }
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]), "). B: ", comparison.result.b.name, " (", sourceLabel(comparison.items[1]), "). ", 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' : activeProject?.name ? `Send to ${activeProject.name}` : 'Send' })), _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"] }) : activeProject?.name ? `Send all to ${activeProject.name}` : 'Send all to project' })), basket.length > 0 && (confirmClear
1458
+ }, 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
1453
1459
  ? _jsx("button", { type: "button", class: "btn-danger", "data-action": "clear-basket-confirm", onClick: () => { saveBasket([]); setConfirmClear(false); }, children: "Yes, empty the basket" })
1454
1460
  : _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-part": "basket-status", children: basketStatus.text })] })) })), !settingsOpen && (picking || dropperOpen || pixelMode || imageMode) && tool && (_jsxs("div", { class: `sub with-luci${imageMode ? ' image-drop' : ''}`, "data-part": "tool-hint", role: "note", ...(imageMode ? {
1455
1461
  onDragOver: (e) => { e.preventDefault(); },
@@ -1463,7 +1469,7 @@ export function Toolbar(props) {
1463
1469
  : pixelMode ? 'Point at any spot. Click to take its colour.'
1464
1470
  : checkDesign ? `Click the component you built. Luci checks it against ${checkDesign.label}.`
1465
1471
  : `${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)
1472
+ 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
1473
  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
1474
  : checked(s) ? 'Checked in the browser. Nothing changes.'
1469
1475
  : '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 +1487,8 @@ export function Toolbar(props) {
1481
1487
  : _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
1488
  openBasket();
1483
1489
  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 => 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); }, 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 && (() => {
1490
+ 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 => { if (e.pointerType !== 'touch')
1491
+ 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
1492
  // The loupe and the hex sit below and right of the pointer, or flip to stay in the window
1486
1493
  const left = pixelHover.x + 20 + LOUPE_PX > win.innerWidth ? pixelHover.x - 20 - LOUPE_PX : pixelHover.x + 20;
1487
1494
  const top = pixelHover.y + 20 + LOUPE_PX + 36 > win.innerHeight ? pixelHover.y - 20 - LOUPE_PX - 36 : pixelHover.y + 20;