@luci-dev/capture 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +35 -13
- package/dist/component.js.map +1 -1
- package/dist/dom.js +3 -3
- package/dist/dom.js.map +1 -1
- package/dist/layout.js +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/luci-capture.js +4769 -1470
- package/dist/ui/devSettings.d.ts.map +1 -1
- package/dist/ui/devSettings.js +5 -9
- package/dist/ui/devSettings.js.map +1 -1
- package/dist/ui/figmaPanel.d.ts +80 -0
- package/dist/ui/figmaPanel.d.ts.map +1 -0
- package/dist/ui/figmaPanel.js +290 -0
- package/dist/ui/figmaPanel.js.map +1 -0
- package/dist/ui/index.d.ts +3 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +2 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/mount.d.ts +7 -1
- package/dist/ui/mount.d.ts.map +1 -1
- package/dist/ui/mount.js +11 -2
- package/dist/ui/mount.js.map +1 -1
- package/dist/ui/onSpec.d.ts +34 -1
- package/dist/ui/onSpec.d.ts.map +1 -1
- package/dist/ui/onSpec.js +313 -30
- package/dist/ui/onSpec.js.map +1 -1
- package/dist/ui/specWatcher.d.ts +31 -10
- package/dist/ui/specWatcher.d.ts.map +1 -1
- package/dist/ui/specWatcher.js +825 -146
- package/dist/ui/specWatcher.js.map +1 -1
- package/dist/ui/styles.d.ts +3 -3
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/styles.js +79 -12
- package/dist/ui/styles.js.map +1 -1
- package/dist/ui/toolbar.d.ts +18 -0
- package/dist/ui/toolbar.d.ts.map +1 -1
- package/dist/ui/toolbar.js +95 -17
- package/dist/ui/toolbar.js.map +1 -1
- package/dist/ui/tools.d.ts +6 -1
- package/dist/ui/tools.d.ts.map +1 -1
- package/dist/ui/tools.js +18 -2
- package/dist/ui/tools.js.map +1 -1
- package/package.json +3 -3
package/dist/ui/toolbar.js
CHANGED
|
@@ -12,6 +12,7 @@ import { addToBasket, exportBasket, exportItem, mergeInBasket, noteInBasket, rem
|
|
|
12
12
|
import { manualState } from '../states.js';
|
|
13
13
|
import { elementName } from '../naming.js';
|
|
14
14
|
import { LUCI_UI_ATTRIBUTE } from '../dom.js';
|
|
15
|
+
import { stableMatchForElement } from './specWatcher.js';
|
|
15
16
|
import { elementAt, eligibilityOf, eventTarget, firstChildOf, hoverLabel, parentOf, scrollableAncestor, touchScreen } from './picker.js';
|
|
16
17
|
import { ButtonSpinner, Loading, nextPaint } from './loading.js';
|
|
17
18
|
import { projectLabel } from './projectLabel.js';
|
|
@@ -74,7 +75,7 @@ function SaveButton(props) {
|
|
|
74
75
|
const title = props.projectName
|
|
75
76
|
? `Into ${props.projectName}/.luci/design/, where your agent reads it`
|
|
76
77
|
: "Into the project's .luci/design/, where your agent reads it";
|
|
77
|
-
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", class: `btn-secondary${isSavedCurrent ? ' btn-with-ico' : ''}`, "data-action": "save-to-project", "data-saved": isSavedCurrent ? 'true' : undefined, disabled: state.busy || state.removing || isSavedCurrent, title: title, onClick: (e) => { e.stopPropagation(); void run(); }, children: state.busy ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Saving\u2026"] }) : isSavedCurrent ? _jsxs(_Fragment, { children: [_jsx(Icon, { icon: IconSuccess, size: "compact" }), "Saved to project"] }) : label }), state.done && (_jsxs("span", { class: "row", style: { gap: '6px', alignItems: 'center' }, children: [_jsx("span", { class: "dim", "data-part": "saved", children: state.done }), props.unsave && !state.confirmRemove && (_jsx("button", { type: "button", class: "btn-danger btn-sm", "data-action": "unsave-from-project", disabled: state.busy || state.removing, onClick: (e) => { e.stopPropagation(); void runUnsave(); }, children: state.removing ? 'Removing…' : state.replaced ? 'Remove' : 'Unsave' })), props.unsave && state.confirmRemove && (_jsxs(
|
|
78
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", class: `btn-secondary${isSavedCurrent ? ' btn-with-ico' : ''}`, "data-action": "save-to-project", "data-saved": isSavedCurrent ? 'true' : undefined, disabled: state.busy || state.removing || isSavedCurrent, title: title, onClick: (e) => { e.stopPropagation(); void run(); }, children: state.busy ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Saving\u2026"] }) : isSavedCurrent ? _jsxs(_Fragment, { children: [_jsx(Icon, { icon: IconSuccess, size: "compact" }), "Saved to project"] }) : label }), state.done && (_jsxs("span", { class: "row", style: { gap: '6px', alignItems: 'center' }, children: [_jsx("span", { class: "dim", "data-part": "saved", children: state.done }), props.unsave && !state.confirmRemove && (_jsx("button", { type: "button", class: "btn-danger-text btn-sm", "data-action": "unsave-from-project", disabled: state.busy || state.removing, onClick: (e) => { e.stopPropagation(); void runUnsave(); }, children: state.removing ? 'Removing…' : state.replaced ? 'Remove' : 'Unsave' })), props.unsave && state.confirmRemove && (_jsxs("div", { class: "confirm-card", "data-part": "unsave-confirm-box", children: [_jsx("span", { class: "dim", children: "Remove this saved file from your project?" }), _jsxs("span", { class: "row", style: { gap: '6px', alignItems: 'center' }, children: [_jsx("button", { type: "button", class: "btn-danger btn-sm", "data-action": "confirm-unsave", disabled: state.removing, onClick: (e) => { e.stopPropagation(); void runUnsave(); }, children: "Remove" }), _jsx("button", { type: "button", class: "btn-ghost btn-sm", onClick: (e) => { e.stopPropagation(); setState(prev => ({ ...prev, confirmRemove: false })); }, children: "Cancel" })] })] }))] })), state.removedMsg && _jsx("span", { class: "dim", "data-part": "unsaved", children: state.removedMsg }), 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" }))] }))] }));
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
81
|
* Grouped project actions for Capture preview: Save to project (+ Saved/Unsave/Remove states),
|
|
@@ -131,7 +132,7 @@ function ProjectActions(props) {
|
|
|
131
132
|
const title = props.projectName
|
|
132
133
|
? `Into ${props.projectName}/.luci/design/, where your agent reads it`
|
|
133
134
|
: "Into the project's .luci/design/, where your agent reads it";
|
|
134
|
-
return (_jsxs("div", { class: "project-actions", "data-part": "project-actions", children: [_jsxs("div", { class: "project-actions-row", children: [props.save && (_jsx("button", { type: "button", class: `btn-secondary btn-sm${isSavedCurrent ? ' btn-with-ico' : ''}`, "data-action": "save-to-project", "data-saved": isSavedCurrent ? 'true' : undefined, disabled: saveState.busy || saveState.removing || isSavedCurrent, title: title, onClick: (e) => { e.stopPropagation(); void runSave(); }, children: saveState.busy ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Saving\u2026"] }) : isSavedCurrent ? _jsxs(_Fragment, { children: [_jsx(Icon, { icon: IconSuccess, size: "compact" }), "Saved to project"] }) : label })), saveState.done && props.unsave && !saveState.confirmRemove && (_jsx("button", { type: "button", class: "btn-danger btn-sm", "data-action": "unsave-from-project", disabled: saveState.busy || saveState.removing, onClick: (e) => { e.stopPropagation(); void runUnsave(); }, children: saveState.removing ? 'Removing…' : saveState.replaced ? 'Remove' : 'Unsave' })), saveState.done && props.unsave && saveState.confirmRemove && (_jsxs(
|
|
135
|
+
return (_jsxs("div", { class: "project-actions", "data-part": "project-actions", children: [_jsxs("div", { class: "project-actions-row", children: [props.save && (_jsx("button", { type: "button", class: `btn-secondary btn-sm${isSavedCurrent ? ' btn-with-ico' : ''}`, "data-action": "save-to-project", "data-saved": isSavedCurrent ? 'true' : undefined, disabled: saveState.busy || saveState.removing || isSavedCurrent, title: title, onClick: (e) => { e.stopPropagation(); void runSave(); }, children: saveState.busy ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Saving\u2026"] }) : isSavedCurrent ? _jsxs(_Fragment, { children: [_jsx(Icon, { icon: IconSuccess, size: "compact" }), "Saved to project"] }) : label })), saveState.done && props.unsave && !saveState.confirmRemove && (_jsx("button", { type: "button", class: "btn-danger-text btn-sm", "data-action": "unsave-from-project", disabled: saveState.busy || saveState.removing, onClick: (e) => { e.stopPropagation(); void runUnsave(); }, children: saveState.removing ? 'Removing…' : saveState.replaced ? 'Remove' : 'Unsave' })), saveState.done && props.unsave && saveState.confirmRemove && (_jsxs("div", { class: "confirm-card", "data-part": "unsave-confirm-box", children: [_jsx("span", { class: "dim", children: "Remove this saved file from your project?" }), _jsxs("span", { class: "row", style: { gap: '6px', alignItems: 'center' }, children: [_jsx("button", { type: "button", class: "btn-danger btn-sm", "data-action": "confirm-unsave", disabled: saveState.removing, onClick: (e) => { e.stopPropagation(); void runUnsave(); }, children: "Remove" }), _jsx("button", { type: "button", class: "btn-ghost btn-sm", onClick: (e) => { e.stopPropagation(); setSaveState(prev => ({ ...prev, confirmRemove: false })); }, children: "Cancel" })] })] })), props.makeRule && (_jsx("button", { type: "button", class: "btn-secondary btn-sm", "data-action": "make-rule", disabled: ruleState.busy || Boolean(ruleState.done), title: "Save it into the project and propose a rule for .luci/rules.md that points at it; you review the rule before it counts", onClick: (e) => { e.stopPropagation(); void runMakeRule(); }, children: ruleState.busy ? _jsxs(_Fragment, { children: [_jsx(ButtonSpinner, {}), "Proposing\u2026"] }) : ruleState.done ? 'Rule proposed' : 'Make it a rule' }))] }), (saveState.done || saveState.removedMsg) && (_jsxs("div", { class: "project-actions-meta", children: [saveState.done && _jsx("span", { class: "dim", "data-part": "saved", children: saveState.done }), saveState.removedMsg && _jsx("span", { class: "dim", "data-part": "unsaved", children: saveState.removedMsg }), saveState.done && props.onViewOnSpec && (_jsxs("button", { type: "button", class: "btn-ghost btn-sm btn-with-ico", "data-action": "view-on-spec-pin", title: "Highlight this component's On spec pin on the page", onClick: (e) => { e.stopPropagation(); props.onViewOnSpec(); }, children: [_jsx(Icon, { icon: IconOnSpec, size: "compact" }), _jsx("span", { children: "Show on page" })] }))] })), saveState.error && (_jsxs("div", { class: "project-actions-meta", children: [_jsx("span", { class: "error", "data-part": "save-error", children: saveState.error }), props.onDownload && (_jsx("button", { type: "button", class: "btn-secondary btn-sm", "data-action": "download-fallback", onClick: props.onDownload, children: "Download file instead" }))] })), ruleState.error && _jsx("span", { class: "error", "data-part": "rule-error", children: ruleState.error }), ruleState.done && (_jsxs("div", { class: "stack rule", "data-part": "rule", children: [_jsxs("span", { class: "dim", children: [ruleState.done.existed ? 'This rule is already waiting for your review' : 'Proposed for your review', " in ", _jsx("code", { children: ruleState.done.path }), " (the capture is saved too). To keep it, move this line into ", _jsx("code", { children: ".luci/rules.md" }), "; Luci never edits rules.md itself."] }), _jsx("code", { "data-part": "rule-text", children: ruleState.done.rule })] }))] }));
|
|
135
136
|
}
|
|
136
137
|
const STATE_ORDER = ['hover', 'focus', 'focus-visible', 'active', 'disabled'];
|
|
137
138
|
/** The "Capture by hand" choice that walks through every state Luci could not read. */
|
|
@@ -218,6 +219,12 @@ export function Toolbar(props) {
|
|
|
218
219
|
const [candidate, setCandidate] = useState(null);
|
|
219
220
|
const [notice, setNotice] = useState(null);
|
|
220
221
|
const [picked, setPicked] = useState(null);
|
|
222
|
+
const [figmaPick, setFigmaPick] = useState(props.figmaPick ?? null);
|
|
223
|
+
const figmaPickRef = useRef(figmaPick);
|
|
224
|
+
figmaPickRef.current = figmaPick;
|
|
225
|
+
const formatFigmaSizeHint = (req) => req.sizes.length > 0
|
|
226
|
+
? `Figma · ${req.label} ${req.sizes.map(s => `${s.width} × ${s.height}`).join(', ')}`
|
|
227
|
+
: `Figma · ${req.label}`;
|
|
221
228
|
const [result, setResult] = useState(null);
|
|
222
229
|
const [choice, setChoice] = useState(ALL_SPACING);
|
|
223
230
|
const [settings, setSettings] = useState(props.settings);
|
|
@@ -789,6 +796,17 @@ export function Toolbar(props) {
|
|
|
789
796
|
if (!choosing)
|
|
790
797
|
return;
|
|
791
798
|
const onKey = (e) => {
|
|
799
|
+
if (figmaPickRef.current && e.key === 'Escape') {
|
|
800
|
+
e.preventDefault();
|
|
801
|
+
const cur = figmaPickRef.current;
|
|
802
|
+
setFigmaPick(null);
|
|
803
|
+
setPicking(false);
|
|
804
|
+
setPicked(null);
|
|
805
|
+
aim(null);
|
|
806
|
+
setNotice(null);
|
|
807
|
+
cur.onCancel?.();
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
792
810
|
const focused = e.composedPath()[0];
|
|
793
811
|
if (focused instanceof HTMLElement && /^(INPUT|SELECT|TEXTAREA|BUTTON)$/.test(focused.tagName) && e.key === 'Enter')
|
|
794
812
|
return;
|
|
@@ -802,12 +820,68 @@ export function Toolbar(props) {
|
|
|
802
820
|
}
|
|
803
821
|
else if (e.key === 'Enter' && picked?.eligibility.status === 'allowed') {
|
|
804
822
|
e.preventDefault();
|
|
805
|
-
|
|
823
|
+
if (figmaPickRef.current)
|
|
824
|
+
void confirmFigmaPick();
|
|
825
|
+
else
|
|
826
|
+
void produce(false);
|
|
806
827
|
}
|
|
807
828
|
};
|
|
808
829
|
doc.addEventListener('keydown', onKey, true);
|
|
809
830
|
return () => doc.removeEventListener('keydown', onKey, true);
|
|
810
|
-
}, [choosing, picked]);
|
|
831
|
+
}, [choosing, picked, figmaPick]);
|
|
832
|
+
const cancelFigmaPick = () => {
|
|
833
|
+
const cur = figmaPickRef.current;
|
|
834
|
+
setFigmaPick(null);
|
|
835
|
+
setPicking(false);
|
|
836
|
+
setPicked(null);
|
|
837
|
+
aim(null);
|
|
838
|
+
setNotice(null);
|
|
839
|
+
setTool(null);
|
|
840
|
+
cur?.onCancel?.();
|
|
841
|
+
};
|
|
842
|
+
const confirmFigmaPick = async () => {
|
|
843
|
+
const cur = figmaPickRef.current;
|
|
844
|
+
if (!cur || !picked || picked.eligibility.status !== 'allowed')
|
|
845
|
+
return;
|
|
846
|
+
setBusy('Saving match…');
|
|
847
|
+
try {
|
|
848
|
+
const pickedEl = picked.live.nodes[picked.entry.id];
|
|
849
|
+
const match = pickedEl
|
|
850
|
+
? stableMatchForElement(pickedEl, doc)
|
|
851
|
+
: { selector: picked.entry.selector };
|
|
852
|
+
await cur.onConfirm(match.selector ?? '', match);
|
|
853
|
+
setFigmaPick(null);
|
|
854
|
+
setPicked(null);
|
|
855
|
+
aim(null);
|
|
856
|
+
setTool(null);
|
|
857
|
+
}
|
|
858
|
+
catch (err) {
|
|
859
|
+
setNotice(err instanceof Error ? err.message : String(err));
|
|
860
|
+
}
|
|
861
|
+
finally {
|
|
862
|
+
setBusy(null);
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
useEffect(() => {
|
|
866
|
+
if (props.figmaPick)
|
|
867
|
+
startPicking('component');
|
|
868
|
+
}, []);
|
|
869
|
+
useEffect(() => {
|
|
870
|
+
props.registerFigmaPickInput?.({
|
|
871
|
+
start: (req) => {
|
|
872
|
+
setFigmaPick(req);
|
|
873
|
+
startPicking('component');
|
|
874
|
+
},
|
|
875
|
+
cancel: () => {
|
|
876
|
+
setFigmaPick(null);
|
|
877
|
+
setPicking(false);
|
|
878
|
+
setPicked(null);
|
|
879
|
+
aim(null);
|
|
880
|
+
setNotice(null);
|
|
881
|
+
setTool(null);
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
});
|
|
811
885
|
useEffect(() => {
|
|
812
886
|
props.registerPixelInput?.((hex) => {
|
|
813
887
|
const live = liveSnapshot(doc);
|
|
@@ -887,9 +961,14 @@ export function Toolbar(props) {
|
|
|
887
961
|
const onKey = (e) => {
|
|
888
962
|
if (e.key === 'Escape') {
|
|
889
963
|
e.preventDefault();
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
964
|
+
if (figmaPickRef.current) {
|
|
965
|
+
cancelFigmaPick();
|
|
966
|
+
}
|
|
967
|
+
else {
|
|
968
|
+
setPicking(false);
|
|
969
|
+
aim(null);
|
|
970
|
+
setNotice(null);
|
|
971
|
+
}
|
|
893
972
|
return;
|
|
894
973
|
}
|
|
895
974
|
// While picking, arrows and Enter belong to the picker, wherever focus is, except in a form field
|
|
@@ -1603,7 +1682,7 @@ export function Toolbar(props) {
|
|
|
1603
1682
|
: t === 'text'
|
|
1604
1683
|
? 'Read font family, size, weight and line height'
|
|
1605
1684
|
: t === 'color'
|
|
1606
|
-
? 'Inspect fill colour, token and contrast
|
|
1685
|
+
? 'Inspect fill colour, token and contrast, or Pixel eyedropper'
|
|
1607
1686
|
: 'Measure padding, margin or drag between two elements', 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, tip: "Capture text, colours, spacing, components and sections for this whole 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, tip: "Compare a built element against a saved .design.md file, part by part", 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} · Collect, compare, merge or send captures`, 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 })] }), !isExtensionToolbar && 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 })] })] })), isExtensionToolbar && idle && (_jsxs("div", { class: "sub with-luci", role: "note", "data-part": "start-guide", children: [_jsx(Mascot, { pose: "frame", size: 96 }), _jsxs("div", { class: "sub-body", children: [_jsxs("p", { class: "hint", children: [_jsx("strong", { children: "Capture" }), " extracts components, typography, colours, and spacing for your coding agent. Pick a tool, then click an element."] }), _jsxs("p", { class: "keys", children: ["Switch to ", _jsx("strong", { children: "Team Feedback" }), " to click elements, leave plain notes, and share a review with your team."] })] })] })), isDevToolbar && idle && !greeting && (_jsxs("div", { class: "sub with-luci", role: "note", "data-part": "intro", children: [_jsx(Mascot, { pose: "frame", 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 && (isDevToolbar ? (_jsx(DevSettingsPanel, { currentMode: "capture", uiPrefs: uiPrefs, onUiPrefsChange: setUiPrefs, projectInfo: props.projectInfo, store: props.store, captureSettings: settings, onCaptureSettingsChange: changeSettings, debuggerPermission: props.debuggerPermission, ...(props.onSpecSettings ? { onSpecSettings: props.onSpecSettings } : {}), ...(props.updates ? { updates: props.updates } : {}), ...(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: isDevToolbar ? COPY.capture.devTitle : COPY.capture.title }), _jsx("span", { class: "brand-sub", "data-part": "brand-sub", children: isDevToolbar ? COPY.capture.devByline : COPY.capture.byline })] }), _jsx("p", { class: "brand-desc", children: isDevToolbar ? 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, {})] }), !isDevToolbar && (_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
|
|
1608
1687
|
? _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 })
|
|
1609
1688
|
: 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 ? 'offline' : (activeProject.initialized === false ? 'warning' : 'online')}`, "aria-hidden": "true" }), _jsx("div", { class: "project-info", children: !projectChecked ? (_jsx("span", { class: "project-name", "data-part": "project-checking", children: "Checking the connection\u2026" })) : activeProject?.project ? (activeProject.initialized === false ? (_jsxs(_Fragment, { children: [_jsxs("span", { class: "project-name", children: ["Connected, but this folder isn't set up for Luci. Run ", _jsx("code", { children: "luci init" }), " in your project folder."] }), _jsx("span", { class: "project-path dim", children: projectLabel(activeProject) })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { class: "project-name", children: activeProject.name ? `Connected to ${activeProject.name}` : 'Not connected to a project' }), _jsx("span", { class: "project-path dim", children: projectLabel(activeProject) })] }))) : (_jsxs(_Fragment, { children: [_jsx("span", { class: "project-name", children: "Not connected to a 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 => {
|
|
@@ -1616,9 +1695,7 @@ export function Toolbar(props) {
|
|
|
1616
1695
|
? (useDebugger
|
|
1617
1696
|
? 'Luci uses it during a capture for exact states and widths, then detaches it'
|
|
1618
1697
|
: 'Luci never attaches it: states come from stylesheet rules, widths from a hidden frame')
|
|
1619
|
-
: '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) }), (props.updates || props.extensionVersion) && (_jsxs(_Fragment, { children: [_jsx("hr", { class: "settings-divider" }), _jsx(UpdatesSettingsSection, { ...(props.updates ? { updates: props.updates } : {}), ...(props.extensionVersion ? { extensionVersion: props.extensionVersion } : {}) })] })), _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", title: "Smart uses rem for text and spacing, preserves authored %/vw/vh for layouts, and keeps borders and radii in px", children: [_jsx("span", { class: "dim", children: "Units" }), _jsxs(Select, { "data-setting": "units", value: settings.units ?? 'smart', onChange: e => changeSettings({ ...settings, units: e.currentTarget.value }), children: [_jsx("option", { value: "smart", children: "Smart (rem / % / px)" }), _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: DESIGN.md for Google Stitch, Luci's tables, Tailwind CSS, or CSS Variables", children: [_jsx("span", { class: "dim", children: "File" }), _jsxs(Select, { "data-setting": "style", value: settings.style ?? 'stitch', onChange: e => changeSettings({ ...settings, style: e.currentTarget.value }), children: [_jsx("option", { value: "stitch", children: "DESIGN.md (Stitch)" }), _jsx("option", { value: "luci", children: "Luci tables" }), _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: () => { const luci = luciExport(); return props.saveToProject(luci.fileName, luci.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
|
|
1620
|
-
? _jsx("button", { type: "button", class: "btn-danger", "data-action": "clear-basket-confirm", onClick: () => { saveBasket([]); setConfirmClear(false); }, children: "Yes, empty the basket" })
|
|
1621
|
-
: _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 ? {
|
|
1698
|
+
: '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) }), (props.updates || props.extensionVersion) && (_jsxs(_Fragment, { children: [_jsx("hr", { class: "settings-divider" }), _jsx(UpdatesSettingsSection, { ...(props.updates ? { updates: props.updates } : {}), ...(props.extensionVersion ? { extensionVersion: props.extensionVersion } : {}) })] })), _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", title: "Smart uses rem for text and spacing, preserves authored %/vw/vh for layouts, and keeps borders and radii in px", children: [_jsx("span", { class: "dim", children: "Units" }), _jsxs(Select, { "data-setting": "units", value: settings.units ?? 'smart', onChange: e => changeSettings({ ...settings, units: e.currentTarget.value }), children: [_jsx("option", { value: "smart", children: "Smart (rem / % / px)" }), _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: DESIGN.md for Google Stitch, Luci's tables, Tailwind CSS, or CSS Variables", children: [_jsx("span", { class: "dim", children: "File" }), _jsxs(Select, { "data-setting": "style", value: settings.style ?? 'stitch', onChange: e => changeSettings({ ...settings, style: e.currentTarget.value }), children: [_jsx("option", { value: "stitch", children: "DESIGN.md (Stitch)" }), _jsx("option", { value: "luci", children: "Luci tables" }), _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: () => { const luci = luciExport(); return props.saveToProject(luci.fileName, luci.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-text btn-sm", 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 && (_jsx("button", { type: "button", class: "btn-danger-text btn-sm", "data-action": "clear-basket", onClick: () => setConfirmClear(true), children: "Empty basket" }))] }), basket.length > 0 && confirmClear && (_jsxs("div", { class: "confirm-card", "data-part": "clear-basket-confirm-box", children: [_jsx("p", { class: "dim", style: { margin: 0 }, children: basket.length === 1 ? 'Remove 1 item from the basket?' : `Remove all ${basket.length} items from the basket?` }), _jsxs("div", { class: "row", children: [_jsx("button", { type: "button", class: "btn-danger btn-sm", "data-action": "clear-basket-confirm", onClick: () => { saveBasket([]); setConfirmClear(false); }, children: "Remove" }), _jsx("button", { type: "button", class: "btn-ghost btn-sm", onClick: () => setConfirmClear(false), children: "Cancel" })] })] })), 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 ? {
|
|
1622
1699
|
onDragOver: (e) => { e.preventDefault(); },
|
|
1623
1700
|
onDrop: (e) => {
|
|
1624
1701
|
e.preventDefault();
|
|
@@ -1628,10 +1705,11 @@ export function Toolbar(props) {
|
|
|
1628
1705
|
}
|
|
1629
1706
|
} : {}), children: [_jsx(Mascot, { pose: checkDesign ? 'compare' : TOOL_POSES[tool], size: 96 }), _jsxs("div", { class: "sub-body", children: [tool === 'color' && (_jsxs("div", { class: "seg", role: "group", "aria-label": "Pick a colour from", children: [_jsx("button", { type: "button", "aria-pressed": !dropperOpen && !pixelMode && !imageMode, "data-color-mode": "element", onClick: () => { setPixelMode(false); setImageMode(false); startPicking('color'); }, children: "Element" }), _jsx("button", { type: "button", "aria-pressed": dropperOpen || pixelMode, "data-color-mode": "pixel", "data-action": "eyedropper", disabled: !canPickPixels, title: canPickPixels ? 'Pick any spot on the page' : 'This browser cannot pick pixels. Click an element instead.', onClick: () => { setImageMode(false); void startPixel(); }, children: "Pixel" }), _jsx("button", { type: "button", "aria-pressed": imageMode, "data-color-mode": "image", title: "Estimate the colours of a screenshot or any image", onClick: startImage, children: "Image" })] })), _jsx("p", { class: "hint", "data-part": "hint", children: imageMode ? (imageBusy ? 'Reading the image…' : 'Drop a screenshot here, paste one, or choose a file. Luci estimates its colours: every value is a guess.')
|
|
1630
1707
|
: pixelMode ? 'Point at any spot. Click to take its colour.'
|
|
1631
|
-
:
|
|
1632
|
-
:
|
|
1708
|
+
: figmaPick ? 'Hover and click the matching element. Press ↑ to select the element around it. Esc cancels.'
|
|
1709
|
+
: checkDesign ? `Click the component you built. Luci checks it against ${checkDesign.label}.`
|
|
1710
|
+
: `${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)
|
|
1633
1711
|
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)
|
|
1634
|
-
forgetWatch(); }, autoNote: autoNote, design: checkDesign, el: picked.el, selector: picked.entry.selector, overlay: diffOverlay, onOverlay: setDiffOverlay, ...(props.addCheckNotes ? { addNotes: props.addCheckNotes } : {}), ...(props.checkNotesWhere ? { notesWhere: props.checkNotesWhere } : {}), onCopy: copyText, onAgain: () => startPicking('component'), onChangeDesign: openCheck }, `${picked.entry.selector} ${checkDesign.file}`)), !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", title: "Smart uses rem for text and spacing, preserves authored %/vw/vh for layouts, and keeps borders and radii in px", children: [_jsx("span", { class: "field-label", children: "Units" }), _jsxs(Select, { "data-setting": "units", value: settings.units ?? 'smart', onChange: e => changeSettings({ ...settings, units: e.currentTarget.value }), children: [_jsx("option", { value: "smart", children: "Smart (rem / % / px)" }), _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: DESIGN.md for Google Stitch, Luci's tables, Tailwind CSS, or CSS Variables", children: [_jsx("span", { class: "field-label", children: "File" }), _jsxs(Select, { "data-setting": "style", value: settings.style ?? 'stitch', onChange: e => changeSettings({ ...settings, style: e.currentTarget.value }), children: [_jsx("option", { value: "stitch", children: "DESIGN.md (Stitch)" }), _jsx("option", { value: "luci", children: "Luci tables" }), _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.')
|
|
1712
|
+
forgetWatch(); }, autoNote: autoNote, design: checkDesign, el: picked.el, selector: picked.entry.selector, overlay: diffOverlay, onOverlay: setDiffOverlay, ...(props.addCheckNotes ? { addNotes: props.addCheckNotes } : {}), ...(props.checkNotesWhere ? { notesWhere: props.checkNotesWhere } : {}), onCopy: copyText, onAgain: () => startPicking('component'), onChangeDesign: openCheck }, `${picked.entry.selector} ${checkDesign.file}`)), !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 && figmaPick && !result && tool && (_jsx("div", { class: "panel", role: "dialog", "aria-label": "Match Figma layer", "data-part": "figma-selected", 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)] })] }), _jsx("div", { class: "dim", "data-part": "figma-size-hint", children: formatFigmaSizeHint(figmaPick) }), _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."] }), busy ? _jsx(Loading, { text: busy }) : (_jsxs("div", { class: "row", children: [_jsx("button", { type: "button", class: "btn-primary", "data-action": "figma-use-element", disabled: picked.eligibility.status !== 'allowed', onClick: () => void confirmFigmaPick(), children: "Use this element" }), _jsx("button", { type: "button", class: "btn-secondary", "data-action": "figma-pick-again", onClick: () => startPicking('component'), children: "Pick again" }), _jsx("button", { type: "button", class: "btn-ghost", "data-action": "figma-pick-cancel", onClick: cancelFigmaPick, children: "Cancel" })] }))] }) })), !settingsOpen && !picking && !basketOpen && picked && !checkDesign && !figmaPick && !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", title: "Smart uses rem for text and spacing, preserves authored %/vw/vh for layouts, and keeps borders and radii in px", children: [_jsx("span", { class: "field-label", children: "Units" }), _jsxs(Select, { "data-setting": "units", value: settings.units ?? 'smart', onChange: e => changeSettings({ ...settings, units: e.currentTarget.value }), children: [_jsx("option", { value: "smart", children: "Smart (rem / % / px)" }), _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: DESIGN.md for Google Stitch, Luci's tables, Tailwind CSS, or CSS Variables", children: [_jsx("span", { class: "field-label", children: "File" }), _jsxs(Select, { "data-setting": "style", value: settings.style ?? 'stitch', onChange: e => changeSettings({ ...settings, style: e.currentTarget.value }), children: [_jsx("option", { value: "stitch", children: "DESIGN.md (Stitch)" }), _jsx("option", { value: "luci", children: "Luci tables" }), _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.')
|
|
1635
1713
|
: checked(s) ? 'Checked in the browser. Nothing changes.'
|
|
1636
1714
|
: '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 => {
|
|
1637
1715
|
const next = remapOutput(result.output, tokens, pageSettings.rootFontSize);
|
|
@@ -1643,7 +1721,7 @@ export function Toolbar(props) {
|
|
|
1643
1721
|
setResult({ ok: true, output: remapped.original });
|
|
1644
1722
|
setRemapped(null);
|
|
1645
1723
|
setCopied(false);
|
|
1646
|
-
} }), _jsx("hr", { class: "settings-divider" }), _jsxs("label", { class: "field-stack", children: [_jsxs("span", { class: "field-label", children: ["Note for your agent ", _jsx("span", { class: "dim", children: "(optional)" })] }), _jsx("textarea", { "data-part": "instructions", rows: 2, value: instructions, placeholder: "e.g. Use this as our primary button, with our brand blue #1d4ed8 and a 12px radius.", onInput: e => changeInstructions(e.currentTarget.value) })] })] }), _jsxs("div", { class: "md-section", children: [_jsxs("div", { class: "md-head", children: [_jsxs("span", { class: "md-title", children: ["The file ", _jsx("span", { class: "dim", children: "(you can edit it)" })] }), edited !== null && (_jsxs("span", { class: "row", children: [_jsx("span", { class: "dim", "data-part": "edited-note", children: "Edited by hand. Units and colours no longer change it." }), _jsx("button", { type: "button", class: "btn-danger", "data-action": "undo-edits", onClick: () => setEdited(null), children: "Undo my edits" })] }))] }), _jsx("textarea", { class: "preview", "data-part": "preview", spellcheck: false, value: markdown, onInput: e => { setEdited(e.currentTarget.value); setCopied(false); } }), _jsxs("div", { class: "row actions", children: [_jsx(Button, { variant: "primary", size: "md", iconOnly: true, tipAbove: true, tipAlign: "left", icon: copied ? IconSuccess : IconCopy, "data-action": "copy", onClick: copy, label: copied ? COPY.common.copied : sectionFiles.length && !isCustomExport ? COPY.capture.actions.copySection : COPY.capture.actions.copy }), sectionFiles.length && !isCustomExport
|
|
1724
|
+
} }), _jsx("hr", { class: "settings-divider" }), _jsxs("label", { class: "field-stack", children: [_jsxs("span", { class: "field-label", children: ["Note for your agent ", _jsx("span", { class: "dim", children: "(optional)" })] }), _jsx("textarea", { "data-part": "instructions", rows: 2, value: instructions, placeholder: "e.g. Use this as our primary button, with our brand blue #1d4ed8 and a 12px radius.", onInput: e => changeInstructions(e.currentTarget.value) })] })] }), _jsxs("div", { class: "md-section", children: [_jsxs("div", { class: "md-head", children: [_jsxs("span", { class: "md-title", children: ["The file ", _jsx("span", { class: "dim", children: "(you can edit it)" })] }), edited !== null && (_jsxs("span", { class: "row", children: [_jsx("span", { class: "dim", "data-part": "edited-note", children: "Edited by hand. Units and colours no longer change it." }), _jsx("button", { type: "button", class: "btn-danger-text", "data-action": "undo-edits", onClick: () => setEdited(null), children: "Undo my edits" })] }))] }), _jsx("textarea", { class: "preview", "data-part": "preview", spellcheck: false, value: markdown, onInput: e => { setEdited(e.currentTarget.value); setCopied(false); } }), _jsxs("div", { class: "row actions", children: [_jsx(Button, { variant: "primary", size: "md", iconOnly: true, tipAbove: true, tipAlign: "left", icon: copied ? IconSuccess : IconCopy, "data-action": "copy", onClick: copy, label: copied ? COPY.common.copied : sectionFiles.length && !isCustomExport ? COPY.capture.actions.copySection : COPY.capture.actions.copy }), sectionFiles.length && !isCustomExport
|
|
1647
1725
|
? _jsx(Button, { variant: "secondary", size: "md", iconOnly: true, tipAbove: true, icon: IconDownload, "data-action": "download-zip", onClick: downloadZip, label: COPY.capture.actions.downloadZip(sectionFiles.length + 1) })
|
|
1648
1726
|
: _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)
|
|
1649
1727
|
openBasket();
|
|
@@ -1665,7 +1743,7 @@ export function Toolbar(props) {
|
|
|
1665
1743
|
return (_jsxs(_Fragment, { children: [_jsx("div", { class: "blink-ring", "data-part": "blink-ring", style: { left: `${r.left - 3}px`, top: `${r.top - 3}px`, width: `${r.width + 6}px`, height: `${r.height + 6}px` } }, `check-blink-${checkBlink.key}`), _jsxs("div", { class: "blink-pill", role: "status", "data-part": "blink-pill", style: { left: `${Math.max(8, Math.min(r.left, win.innerWidth - 220))}px`, top: `${Math.max(8, r.top - 28)}px` }, children: [_jsx("span", { class: "blink-pill-dot", "aria-hidden": "true" }), checkBlink.label] })] }));
|
|
1666
1744
|
})(), choosing && picked && !pixelMode && (() => {
|
|
1667
1745
|
const r = picked.el.getBoundingClientRect();
|
|
1668
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { class: `highlight locked${picked.eligibility.status === 'blocked' ? ' blocked' : ''}`, "data-part": "selection", style: { top: `${r.top}px`, left: `${r.left}px`, width: `${r.width}px`, height: `${r.height}px` } }),
|
|
1669
|
-
})(), hovered && rect && (_jsxs(_Fragment, { children: [_jsx("div", { class: `highlight${hoverElig?.status === 'blocked' ? ' blocked' : ''}`, style: { top: `${rect.top}px`, left: `${rect.left}px`, width: `${rect.width}px`, height: `${rect.height}px` } }), cs && (_jsxs(_Fragment, { children: [_jsx("div", { class: "pad", style: { top: `${rect.top + px(cs.borderTopWidth)}px`, left: `${rect.left + px(cs.borderLeftWidth)}px`, width: `${rect.width - px(cs.borderLeftWidth) - px(cs.borderRightWidth)}px`, height: `${rect.height - px(cs.borderTopWidth) - px(cs.borderBottomWidth)}px`, borderWidth: `${cs.paddingTop} ${cs.paddingRight} ${cs.paddingBottom} ${cs.paddingLeft}` } }), _jsx("div", { class: "margin", style: { top: `${rect.top - px(cs.marginTop)}px`, left: `${rect.left - px(cs.marginLeft)}px`, width: `${rect.width + px(cs.marginLeft) + px(cs.marginRight)}px`, height: `${rect.height + px(cs.marginTop) + px(cs.marginBottom)}px`, borderWidth: `${cs.marginTop} ${cs.marginRight} ${cs.marginBottom} ${cs.marginLeft}` } })] })), _jsxs("div", { class: "label", "data-part": "hover-label", style: { top: `${Math.max(4, rect.top - 28)}px`, left: `${Math.max(4, rect.left)}px` }, children: [hoverLabel(hovered), cs && `\npadding ${cs.padding} margin ${cs.margin}${/flex|grid/.test(cs.display) ? ` gap ${cs.rowGap} ${cs.columnGap}` : ''}`, hoverElig && hoverElig.status !== 'allowed' && _jsx("span", { class: "reason", children: hoverElig.reason })] })] }))] }));
|
|
1746
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { class: `highlight locked${picked.eligibility.status === 'blocked' ? ' blocked' : ''}`, "data-part": "selection", style: { top: `${r.top}px`, left: `${r.left}px`, width: `${r.width}px`, height: `${r.height}px` } }), _jsxs("div", { class: "label", style: { top: `${Math.max(4, r.top - 28)}px`, left: `${Math.max(4, r.left)}px` }, children: [hoverLabel(hovered ?? picked.el), figmaPick && `\n${formatFigmaSizeHint(figmaPick)}`] })] }));
|
|
1747
|
+
})(), hovered && rect && (_jsxs(_Fragment, { children: [_jsx("div", { class: `highlight${hoverElig?.status === 'blocked' ? ' blocked' : ''}`, style: { top: `${rect.top}px`, left: `${rect.left}px`, width: `${rect.width}px`, height: `${rect.height}px` } }), cs && (_jsxs(_Fragment, { children: [_jsx("div", { class: "pad", style: { top: `${rect.top + px(cs.borderTopWidth)}px`, left: `${rect.left + px(cs.borderLeftWidth)}px`, width: `${rect.width - px(cs.borderLeftWidth) - px(cs.borderRightWidth)}px`, height: `${rect.height - px(cs.borderTopWidth) - px(cs.borderBottomWidth)}px`, borderWidth: `${cs.paddingTop} ${cs.paddingRight} ${cs.paddingBottom} ${cs.paddingLeft}` } }), _jsx("div", { class: "margin", style: { top: `${rect.top - px(cs.marginTop)}px`, left: `${rect.left - px(cs.marginLeft)}px`, width: `${rect.width + px(cs.marginLeft) + px(cs.marginRight)}px`, height: `${rect.height + px(cs.marginTop) + px(cs.marginBottom)}px`, borderWidth: `${cs.marginTop} ${cs.marginRight} ${cs.marginBottom} ${cs.marginLeft}` } })] })), _jsxs("div", { class: "label", "data-part": "hover-label", style: { top: `${Math.max(4, rect.top - 28)}px`, left: `${Math.max(4, rect.left)}px` }, children: [hoverLabel(hovered), cs && `\npadding ${cs.padding} margin ${cs.margin}${/flex|grid/.test(cs.display) ? ` gap ${cs.rowGap} ${cs.columnGap}` : ''}`, figmaPick && `\n${formatFigmaSizeHint(figmaPick)}`, hoverElig && hoverElig.status !== 'allowed' && _jsx("span", { class: "reason", children: hoverElig.reason })] })] }))] }));
|
|
1670
1748
|
}
|
|
1671
1749
|
//# sourceMappingURL=toolbar.js.map
|