@vibes.diy/base 14.3.458 → 14.3.460
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/attachments/attachment-types.d.ts +1 -0
- package/attachments/attachment-types.js +9 -0
- package/attachments/composer-file-paste.d.ts +7 -0
- package/attachments/composer-file-paste.js +25 -0
- package/components/AttachmentRow.js +8 -1
- package/components/AttachmentThumb.d.ts +7 -0
- package/components/AttachmentThumb.js +24 -0
- package/components/BrutalistCard.js +2 -1
- package/components/LayoutControls.js +10 -10
- package/components/NotificationDetailView.js +4 -4
- package/components/StyleControls.js +3 -3
- package/components/SubTabStrip.js +4 -4
- package/components/VibesWindowFrame.styles.d.ts +1 -1
- package/components/VibesWindowFrame.styles.js +10 -5
- package/components/VibesWindowHeader.js +1 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/vibe-menu/VibeMenu.js +7 -2
- package/components/vibe-menu/geometry.d.ts +6 -0
- package/components/vibe-menu/geometry.js +4 -0
- package/components/vibe-menu/parts/Composer.d.ts +6 -1
- package/components/vibe-menu/parts/Composer.js +36 -8
- package/components/vibe-menu/parts/SectionStrip.js +2 -0
- package/components/vibe-menu/parts/StarterChips.d.ts +12 -31
- package/components/vibe-menu/parts/StarterChips.js +23 -12
- package/components/vibe-menu/parts/use-composer-draft.d.ts +1 -0
- package/components/vibe-menu/parts/use-composer-draft.js +3 -0
- package/components/vibe-menu/shell/VibeMenuShell.d.ts +2 -0
- package/components/vibe-menu/shell/VibeMenuShell.js +13 -7
- package/components/vibe-menu/shell/shell.styles.d.ts +1 -0
- package/components/vibe-menu/shell/shell.styles.js +66 -1
- package/components/vibe-menu/shell/useMenuSequencer.js +3 -1
- package/components/vibe-menu/slices.d.ts +4 -1
- package/components/vibe-menu/vibe-menu.styles.d.ts +1 -1
- package/components/vibe-menu/vibe-menu.styles.js +14 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +5 -5
- package/theme/global-styles.js +2 -9
- package/theme/patterns.js +0 -6
- package/theme/tokens.d.ts +5 -0
- package/theme/tokens.js +5 -0
|
@@ -2,11 +2,13 @@ import * as React from "react";
|
|
|
2
2
|
import { attachmentRemoveName, leftOutSentence, } from "../../../attachments/use-attachments.js";
|
|
3
3
|
import { ATTACHMENT_ACCEPT } from "../../../attachments/attachment-types.js";
|
|
4
4
|
import { composerFileDrop } from "../../../attachments/composer-file-drop.js";
|
|
5
|
+
import { composerFilePaste } from "../../../attachments/composer-file-paste.js";
|
|
5
6
|
import { Glyph } from "./Glyph.js";
|
|
6
7
|
import { SendCap } from "./SendCap.js";
|
|
7
8
|
import { useHeldEnterFocus } from "./held-enter-focus.js";
|
|
8
9
|
import { foldKeyboardAfterSend } from "./fold-keyboard.js";
|
|
9
10
|
import { FacesGlyph } from "./ThinkingLine.js";
|
|
11
|
+
import { AttachmentThumb, chipThumbBlob } from "../../AttachmentThumb.js";
|
|
10
12
|
import { DictationCancelIcon, DictationCheckIcon, DictationSpinner, DictationWave, MicIcon, joinDictated, useDictation, } from "../../dictation/dictation.js";
|
|
11
13
|
import { REFUSED_SEND_COPY, REFUSED_SEND_IDEAS, changeRefusedSendLine, refusedSendKind, } from "./refused-send.js";
|
|
12
14
|
function RefusedSendLine(props) {
|
|
@@ -69,46 +71,71 @@ function useIdeaHeld(hold, draft, seed) {
|
|
|
69
71
|
}, [via, text, onIdeaHeld]);
|
|
70
72
|
return via !== undefined;
|
|
71
73
|
}
|
|
74
|
+
function changeBoxAsk(files, words) {
|
|
75
|
+
if (files.length === 0)
|
|
76
|
+
return "Start a new app with these words?";
|
|
77
|
+
const photos = files.every((f) => f.kind === "image");
|
|
78
|
+
const noun = photos ? "photo" : "file";
|
|
79
|
+
if (words) {
|
|
80
|
+
return files.length === 1
|
|
81
|
+
? `Start a new app with these words and ${noun}?`
|
|
82
|
+
: `Start a new app with these words and ${files.length} ${noun}s?`;
|
|
83
|
+
}
|
|
84
|
+
return files.length === 1 ? `Start a new app with this ${noun}?` : `Start a new app with these ${files.length} ${noun}s?`;
|
|
85
|
+
}
|
|
72
86
|
export const CHANGE_BOX_HINT_COPY = Object.freeze({
|
|
73
87
|
lead: "Changes this app",
|
|
74
88
|
door: "New idea? Start a new app",
|
|
75
89
|
ask: "Start a new app with these words?",
|
|
90
|
+
askWith: changeBoxAsk,
|
|
76
91
|
yes: "Yes",
|
|
77
92
|
keep: "Keep editing",
|
|
78
93
|
});
|
|
79
94
|
function ChangeBoxHintLine(props) {
|
|
80
95
|
const { door, draft } = props;
|
|
96
|
+
const files = draft.attachments.readyAttachments;
|
|
97
|
+
const riding = draft.attachments.attachments.filter((c) => c.status !== "error");
|
|
98
|
+
const busy = draft.attachments.busy;
|
|
99
|
+
const holding = `${draft.text}\u0000${riding.length}`;
|
|
81
100
|
const [askedFor, setAskedFor] = React.useState(undefined);
|
|
82
|
-
if (askedFor !== undefined && askedFor !==
|
|
101
|
+
if (askedFor !== undefined && askedFor !== holding)
|
|
83
102
|
setAskedFor(undefined);
|
|
84
103
|
const typed = draft.text.trim();
|
|
85
|
-
if (typed === "")
|
|
104
|
+
if (typed === "" && riding.length === 0)
|
|
86
105
|
return null;
|
|
87
106
|
if (draft.suggestion !== undefined && draft.suggestion === draft.text)
|
|
88
107
|
return null;
|
|
89
108
|
function carry() {
|
|
109
|
+
if (busy)
|
|
110
|
+
return;
|
|
90
111
|
setAskedFor(undefined);
|
|
91
112
|
draft.setText("");
|
|
92
|
-
|
|
113
|
+
draft.attachments.clear();
|
|
114
|
+
door.onStartNewApp(typed, files);
|
|
93
115
|
}
|
|
94
|
-
if (askedFor ===
|
|
116
|
+
if (askedFor === holding) {
|
|
95
117
|
return (React.createElement("p", { className: "vm-door-line", "data-change-box-hint": "", "data-change-box-confirm": "", "aria-live": "polite" },
|
|
96
|
-
React.createElement("span", null, CHANGE_BOX_HINT_COPY.
|
|
118
|
+
React.createElement("span", null, CHANGE_BOX_HINT_COPY.askWith(riding, typed !== "")),
|
|
97
119
|
React.createElement("span", { "aria-hidden": "true" }, " \u00B7 "),
|
|
98
|
-
React.createElement("button", { type: "button", className: "vm-door", onClick: carry }, CHANGE_BOX_HINT_COPY.yes),
|
|
120
|
+
React.createElement("button", { type: "button", className: "vm-door", onClick: carry, disabled: busy }, CHANGE_BOX_HINT_COPY.yes),
|
|
99
121
|
React.createElement("span", { "aria-hidden": "true" }, " \u00B7 "),
|
|
100
122
|
React.createElement("button", { type: "button", className: "vm-door", onClick: () => setAskedFor(undefined) }, CHANGE_BOX_HINT_COPY.keep)));
|
|
101
123
|
}
|
|
102
124
|
return (React.createElement("p", { className: "vm-door-line", "data-change-box-hint": "" },
|
|
103
125
|
React.createElement("span", null, CHANGE_BOX_HINT_COPY.lead),
|
|
104
126
|
React.createElement("span", { "aria-hidden": "true" }, " \u00B7 "),
|
|
105
|
-
React.createElement("button", { type: "button", className: "vm-door", onClick: () => setAskedFor(
|
|
127
|
+
React.createElement("button", { type: "button", className: "vm-door", onClick: () => setAskedFor(holding) }, CHANGE_BOX_HINT_COPY.door)));
|
|
128
|
+
}
|
|
129
|
+
function ChipThumb(props) {
|
|
130
|
+
const blob = chipThumbBlob(props.chip);
|
|
131
|
+
return blob === undefined ? null : React.createElement(AttachmentThumb, { blob: blob, className: "vm-chip-thumb" });
|
|
106
132
|
}
|
|
107
133
|
function StagedAttachments(props) {
|
|
108
134
|
if (props.chips.length === 0)
|
|
109
135
|
return null;
|
|
110
136
|
return (React.createElement("div", { className: "vm-picks vm-attachments", "aria-live": "polite" }, props.chips.map((chip, index) => (React.createElement("button", { key: chip.id, className: "vm-chip is-name is-ghost", type: "button", "data-status": chip.status, title: chip.error, "aria-label": attachmentRemoveName(index), onClick: () => props.onRemove(chip.id) },
|
|
111
137
|
chip.status === "processing" ? React.createElement(FacesGlyph, { size: 12, ink: "current" }) : null,
|
|
138
|
+
React.createElement(ChipThumb, { chip: chip }),
|
|
112
139
|
React.createElement("span", null, chip.name))))));
|
|
113
140
|
}
|
|
114
141
|
export const STOP_GUARD_MS = 4000;
|
|
@@ -413,6 +440,7 @@ export function Composer(props) {
|
|
|
413
440
|
}
|
|
414
441
|
const stopHeldLabel = transcribing || dictationArmed.current ? "Adding your words…" : "Sending…";
|
|
415
442
|
const drop = composerFileDrop({ onFiles: attachments.add });
|
|
443
|
+
const paste = composerFilePaste({ onFiles: attachments.add });
|
|
416
444
|
const leftOutNote = leftOutSentence(attachments.leftOut);
|
|
417
445
|
const next = composer.hold?.next;
|
|
418
446
|
const sendCap = next !== undefined ? (React.createElement("button", { ref: nextCap, className: "vm-cap", type: "button", "data-next": "", "data-composer-submit": "vibe", disabled: composer.disabled === true || next.busy === true, "aria-busy": next.busy === true ? true : undefined, onClick: () => {
|
|
@@ -426,7 +454,7 @@ export function Composer(props) {
|
|
|
426
454
|
} }),
|
|
427
455
|
React.createElement(StagedAttachments, { chips: attachments.attachments, onRemove: attachments.remove }),
|
|
428
456
|
leftOutNote !== undefined ? (React.createElement("p", { className: "vm-attach-note", "aria-live": "polite", "data-testid": "attachment-left-out" }, leftOutNote)) : null,
|
|
429
|
-
React.createElement("label", { ref: box, className: [building ? "vm-composer is-building" : "vm-composer", dictating ? "is-dictating" : ""].join(" ").trim(), onDragOver: drop.onDragOver, onDrop: drop.onDrop },
|
|
457
|
+
React.createElement("label", { ref: box, className: [building ? "vm-composer is-building" : "vm-composer", dictating ? "is-dictating" : ""].join(" ").trim(), onDragOver: drop.onDragOver, onDrop: drop.onDrop, onPaste: paste },
|
|
430
458
|
React.createElement("textarea", { ref: props.fieldRef, rows: 1, value: draft.text, placeholder: transcribing ? "Writing down what you said…" : (props.placeholder ?? composer.placeholder), "aria-label": composer.cap === "Remix this" ? "Describe your remix" : "Describe a change", disabled: composer.disabled, onChange: (event) => {
|
|
431
459
|
if (dictation.note !== undefined)
|
|
432
460
|
dictation.clearNote();
|
|
@@ -13,6 +13,8 @@ export function tabFootprintRect(tab) {
|
|
|
13
13
|
if (run === null)
|
|
14
14
|
return box;
|
|
15
15
|
const r = run.getBoundingClientRect();
|
|
16
|
+
if (r.width === 0 && r.height === 0)
|
|
17
|
+
return box;
|
|
16
18
|
const left = Math.min(box.left, r.left);
|
|
17
19
|
const top = Math.min(box.top, r.top);
|
|
18
20
|
return new DOMRect(left, top, Math.max(box.right, r.right) - left, Math.max(box.bottom, r.bottom) - top);
|
|
@@ -1,44 +1,24 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export declare const STARTER_PAINTS: readonly [{
|
|
3
|
-
readonly name: "
|
|
4
|
-
readonly color: "#
|
|
3
|
+
readonly name: "orange";
|
|
4
|
+
readonly color: "#ff571e";
|
|
5
5
|
readonly ink: "menu-ink";
|
|
6
6
|
}, {
|
|
7
|
-
readonly name: "
|
|
8
|
-
readonly color: "#
|
|
7
|
+
readonly name: "pink";
|
|
8
|
+
readonly color: "#ef77a9";
|
|
9
9
|
readonly ink: "menu-ink";
|
|
10
10
|
}, {
|
|
11
|
-
readonly name: "
|
|
12
|
-
readonly color: "#
|
|
11
|
+
readonly name: "gold";
|
|
12
|
+
readonly color: "#e9ae20";
|
|
13
13
|
readonly ink: "menu-ink";
|
|
14
14
|
}, {
|
|
15
|
-
readonly name: "
|
|
16
|
-
readonly color: "#
|
|
17
|
-
readonly ink: "vibes-cream";
|
|
18
|
-
}, {
|
|
19
|
-
readonly name: "purple-neon";
|
|
20
|
-
readonly color: "#c084fc";
|
|
21
|
-
readonly ink: "menu-ink";
|
|
22
|
-
}, {
|
|
23
|
-
readonly name: "pink-neon";
|
|
24
|
-
readonly color: "#f472b6";
|
|
25
|
-
readonly ink: "menu-ink";
|
|
26
|
-
}, {
|
|
27
|
-
readonly name: "orange-neon";
|
|
28
|
-
readonly color: "#fb923c";
|
|
15
|
+
readonly name: "green";
|
|
16
|
+
readonly color: "#01a947";
|
|
29
17
|
readonly ink: "menu-ink";
|
|
30
18
|
}, {
|
|
31
|
-
readonly name: "
|
|
32
|
-
readonly color: "#
|
|
33
|
-
readonly ink: "
|
|
34
|
-
}, {
|
|
35
|
-
readonly name: "magenta-neon";
|
|
36
|
-
readonly color: "#e879f9";
|
|
37
|
-
readonly ink: "menu-ink";
|
|
38
|
-
}, {
|
|
39
|
-
readonly name: "lime-neon";
|
|
40
|
-
readonly color: "#a3e635";
|
|
41
|
-
readonly ink: "menu-ink";
|
|
19
|
+
readonly name: "navy";
|
|
20
|
+
readonly color: "#445796";
|
|
21
|
+
readonly ink: "vibes-cream";
|
|
42
22
|
}];
|
|
43
23
|
export declare const STARTER_PAINT_VARS: string;
|
|
44
24
|
export declare function starterPaintIndex(id: string): number;
|
|
@@ -46,6 +26,7 @@ export declare const STARTER_CHIPS_CSS: string;
|
|
|
46
26
|
export interface StarterChip {
|
|
47
27
|
readonly id: string;
|
|
48
28
|
readonly label: string;
|
|
29
|
+
readonly paint?: number;
|
|
49
30
|
}
|
|
50
31
|
export interface StarterChipsProps {
|
|
51
32
|
readonly chips: readonly StarterChip[];
|
|
@@ -2,16 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import { VIBE_MENU_LIGHT_VARS } from "../vibe-menu.styles.js";
|
|
3
3
|
import { colors } from "../../../theme/tokens.js";
|
|
4
4
|
export const STARTER_PAINTS = [
|
|
5
|
-
{ name: "
|
|
6
|
-
{ name: "
|
|
7
|
-
{ name: "
|
|
8
|
-
{ name: "
|
|
9
|
-
{ name: "
|
|
10
|
-
{ name: "pink-neon", color: colors.pinkNeon, ink: "menu-ink" },
|
|
11
|
-
{ name: "orange-neon", color: colors.orangeNeon, ink: "menu-ink" },
|
|
12
|
-
{ name: "cyan-neon", color: colors.cyanNeon, ink: "menu-ink" },
|
|
13
|
-
{ name: "magenta-neon", color: colors.magentaNeon, ink: "menu-ink" },
|
|
14
|
-
{ name: "lime-neon", color: colors.limeNeon, ink: "menu-ink" },
|
|
5
|
+
{ name: "orange", color: colors.brandOrange, ink: "menu-ink" },
|
|
6
|
+
{ name: "pink", color: colors.brandPink, ink: "menu-ink" },
|
|
7
|
+
{ name: "gold", color: colors.brandGold, ink: "menu-ink" },
|
|
8
|
+
{ name: "green", color: colors.brandGreen, ink: "menu-ink" },
|
|
9
|
+
{ name: "navy", color: colors.brandNavy, ink: "vibes-cream" },
|
|
15
10
|
];
|
|
16
11
|
export const STARTER_PAINT_VARS = STARTER_PAINTS.map((p) => `\n --starter-${p.name}: ${p.color};`).join("");
|
|
17
12
|
export function starterPaintIndex(id) {
|
|
@@ -27,23 +22,39 @@ export const STARTER_CHIPS_CSS = `
|
|
|
27
22
|
.vm-starters {${VIBE_MENU_LIGHT_VARS}${STARTER_PAINT_VARS}
|
|
28
23
|
color-scheme: normal;
|
|
29
24
|
display: flex;
|
|
25
|
+
flex-wrap: nowrap;
|
|
30
26
|
gap: var(--space-8);
|
|
31
27
|
padding: var(--space-2) 0;
|
|
32
28
|
overflow-x: auto;
|
|
29
|
+
scroll-snap-type: x mandatory;
|
|
33
30
|
scrollbar-width: none;
|
|
34
31
|
-webkit-overflow-scrolling: touch;
|
|
32
|
+
/* A mask reads only alpha: any opaque token draws the trailing fade. */
|
|
33
|
+
-webkit-mask-image: linear-gradient(90deg, var(--line) 80%, transparent);
|
|
34
|
+
mask-image: linear-gradient(90deg, var(--line) 80%, transparent);
|
|
35
35
|
}
|
|
36
36
|
.vm-starters::-webkit-scrollbar { display: none; }
|
|
37
|
+
@media (width >= 600px) {
|
|
38
|
+
.vm-starters {
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
overflow-x: visible;
|
|
42
|
+
scroll-snap-type: none;
|
|
43
|
+
-webkit-mask-image: none;
|
|
44
|
+
mask-image: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
37
47
|
.vm-starters[data-dealt="false"] { visibility: hidden; }
|
|
38
48
|
.vm-starter {
|
|
39
49
|
flex: 0 0 auto;
|
|
40
50
|
padding: var(--space-8) var(--space-16);
|
|
41
51
|
border: var(--stroke-rule) solid var(--line);
|
|
42
52
|
border-radius: var(--radius-full);
|
|
43
|
-
box-shadow: var(--stroke-rule) var(--stroke-rule) 0 var(--line);
|
|
53
|
+
box-shadow: var(--vibes-depth-chip, var(--stroke-rule) var(--stroke-rule) 0 var(--line));
|
|
44
54
|
font: 700 15px/1.2 var(--font-display);
|
|
45
55
|
white-space: nowrap;
|
|
46
56
|
cursor: pointer;
|
|
57
|
+
scroll-snap-align: start;
|
|
47
58
|
}
|
|
48
59
|
${PAINT_RULES}
|
|
49
60
|
.vm-starter:active { transform: translate(var(--stroke-rule), var(--stroke-rule)); box-shadow: none; }
|
|
@@ -56,7 +67,7 @@ ${PAINT_RULES}
|
|
|
56
67
|
export function StarterChips({ chips, onPick, disabled = false, dealt = true, ariaLabel = "Start with a kind of app", className, }) {
|
|
57
68
|
return (React.createElement(React.Fragment, null,
|
|
58
69
|
React.createElement("style", null, STARTER_CHIPS_CSS),
|
|
59
|
-
React.createElement("div", { className: className === undefined ? "vm-starters" : `vm-starters ${className}`, role: "group", "aria-label": ariaLabel, "data-dealt": dealt ? "true" : "false" }, chips.map((chip) => (React.createElement("button", { key: chip.id, type: "button", className: "vm-starter", "data-paint": starterPaintIndex(chip.id), "aria-disabled": disabled, onClick: () => {
|
|
70
|
+
React.createElement("div", { className: className === undefined ? "vm-starters" : `vm-starters ${className}`, role: "group", "aria-label": ariaLabel, "data-dealt": dealt ? "true" : "false" }, chips.map((chip) => (React.createElement("button", { key: chip.id, type: "button", className: "vm-starter", "data-paint": chip.paint ?? starterPaintIndex(chip.id), "aria-disabled": disabled, onClick: () => {
|
|
60
71
|
if (!disabled)
|
|
61
72
|
onPick(chip);
|
|
62
73
|
}, onKeyDown: (event) => {
|
|
@@ -11,6 +11,7 @@ export declare const DRAFT_CARRY_KEY = "vibes.draftCarry.";
|
|
|
11
11
|
export declare function firstBuildDraftKey(chatId: string): string;
|
|
12
12
|
export declare function carryComposerDraft(fromKey: string, toKey: string): void;
|
|
13
13
|
export declare function carrySavedComposerDraft(fromKey: string, toKey: string): void;
|
|
14
|
+
export declare function isFileOnlyPressText(text: string): boolean;
|
|
14
15
|
export interface UseComposerDraftInput {
|
|
15
16
|
readonly composer: ComposerSlice;
|
|
16
17
|
readonly resetKey: string | null;
|
|
@@ -78,6 +78,9 @@ export function carrySavedComposerDraft(fromKey, toKey) {
|
|
|
78
78
|
}
|
|
79
79
|
const ONE_FILE_TEXT = "Use the attached file.";
|
|
80
80
|
const MANY_FILES_TEXT = "Use the attached files.";
|
|
81
|
+
export function isFileOnlyPressText(text) {
|
|
82
|
+
return text === ONE_FILE_TEXT || text === MANY_FILES_TEXT;
|
|
83
|
+
}
|
|
81
84
|
const NO_FILES = [];
|
|
82
85
|
function queuedFilesOf(entries) {
|
|
83
86
|
return entries.some((e) => e.files.length > 0) ? entries.flatMap((e) => e.files) : NO_FILES;
|
|
@@ -32,6 +32,8 @@ export interface VibeMenuShellProps {
|
|
|
32
32
|
readonly switchActivity: VibeMenuSwitchActivity;
|
|
33
33
|
readonly onChiclet: () => void;
|
|
34
34
|
readonly frameCap?: boolean;
|
|
35
|
+
readonly dock?: boolean;
|
|
36
|
+
readonly dockCssQuery?: string;
|
|
35
37
|
readonly reducedMotion?: boolean;
|
|
36
38
|
readonly onStep?: (step: SequencerStep) => void;
|
|
37
39
|
readonly frame?: "viewport" | "contained";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { startTransition, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { SPLIT_BUILDER_QUERY } from "../geometry.js";
|
|
3
4
|
import { VibeMenuStyles, useLiveMenuSheet } from "../vibe-menu.styles.js";
|
|
4
5
|
import { MenuCard } from "../parts/MenuCard.js";
|
|
5
6
|
import { SectionStrip } from "../parts/SectionStrip.js";
|
|
6
7
|
import { LABELED_MENU_CSS, LabeledChoices } from "../parts/LabeledChoices.js";
|
|
7
8
|
import { VibesSwitchGlass } from "../parts/VibesSwitchGlass.js";
|
|
8
9
|
import { StatusChipRow } from "../parts/StatusChipRow.js";
|
|
9
|
-
import { VIBE_MENU_SHELL_CSS } from "./shell.styles.js";
|
|
10
|
-
import { useMenuSequencer } from "./useMenuSequencer.js";
|
|
10
|
+
import { VIBE_MENU_SHELL_CSS, splitDockCss } from "./shell.styles.js";
|
|
11
|
+
import { MENU_RESNAP_EVENT, useMenuSequencer } from "./useMenuSequencer.js";
|
|
11
12
|
import { shownKey, wantFor } from "./menu-sequence.js";
|
|
12
13
|
const DETACHED_LAYER_ATTRIBUTES = [
|
|
13
14
|
"data-vibe-menu-detached",
|
|
@@ -23,9 +24,9 @@ function isDetachedLayer(node) {
|
|
|
23
24
|
DETACHED_LAYER_CLASSES.some((name) => node.classList.contains(name) === true));
|
|
24
25
|
}
|
|
25
26
|
function useOutsideClose(input) {
|
|
26
|
-
const { phase, dispatch, menuRef } = input;
|
|
27
|
+
const { phase, dispatch, menuRef, docked } = input;
|
|
27
28
|
useEffect(() => {
|
|
28
|
-
if (phase === "collapsed")
|
|
29
|
+
if (phase === "collapsed" || docked === true)
|
|
29
30
|
return;
|
|
30
31
|
const listeningSince = performance.now();
|
|
31
32
|
function onOutsideClick(event) {
|
|
@@ -43,7 +44,7 @@ function useOutsideClose(input) {
|
|
|
43
44
|
}
|
|
44
45
|
window.addEventListener("click", onOutsideClick);
|
|
45
46
|
return () => window.removeEventListener("click", onOutsideClick);
|
|
46
|
-
}, [phase, dispatch, menuRef]);
|
|
47
|
+
}, [phase, dispatch, menuRef, docked]);
|
|
47
48
|
}
|
|
48
49
|
function useEscapeStepsBack(input) {
|
|
49
50
|
const { phase, dispatch } = input;
|
|
@@ -195,7 +196,11 @@ export function VibeMenuShell(props) {
|
|
|
195
196
|
if (live)
|
|
196
197
|
retained.current = content;
|
|
197
198
|
});
|
|
198
|
-
useOutsideClose({ phase: state.phase, dispatch, menuRef: refs.menu });
|
|
199
|
+
useOutsideClose({ phase: state.phase, dispatch, menuRef: refs.menu, docked: props.dock === true });
|
|
200
|
+
const docked = props.dock === true;
|
|
201
|
+
useLayoutEffect(() => {
|
|
202
|
+
refs.card.current?.dispatchEvent(new Event(MENU_RESNAP_EVENT));
|
|
203
|
+
}, [docked, refs.card]);
|
|
199
204
|
useEscapeStepsBack({ phase: state.phase, dispatch });
|
|
200
205
|
const choicesRef = useRef(null);
|
|
201
206
|
const labeledOn = props.labeled === "a" || props.labeled === "b";
|
|
@@ -216,9 +221,10 @@ export function VibeMenuShell(props) {
|
|
|
216
221
|
useEffect(() => {
|
|
217
222
|
onChipsShown?.(seenKey === "" ? [] : seenKey.split("|"));
|
|
218
223
|
}, [seenKey, onChipsShown]);
|
|
219
|
-
return (React.createElement("div", { className: "vm-layer", "data-vibe-menu": "", "data-frame": props.frame ?? "viewport", "data-frame-cap": props.frameCap === true ? "" : undefined, "data-reduced-motion": props.reducedMotion === true ? "true" : undefined },
|
|
224
|
+
return (React.createElement("div", { className: "vm-layer", "data-vibe-menu": "", "data-frame": props.frame ?? "viewport", "data-frame-cap": props.frameCap === true ? "" : undefined, "data-dock": docked ? "" : undefined, "data-reduced-motion": props.reducedMotion === true ? "true" : undefined },
|
|
220
225
|
React.createElement(VibeMenuStyles, null),
|
|
221
226
|
React.createElement("style", null, VIBE_MENU_SHELL_CSS),
|
|
227
|
+
React.createElement("style", null, splitDockCss(props.dockCssQuery ?? SPLIT_BUILDER_QUERY)),
|
|
222
228
|
labeled === null ? null : React.createElement("style", null, LABELED_MENU_CSS),
|
|
223
229
|
React.createElement("div", { ref: refs.menu, className: shown.section === null ? "vm-menu" : "vm-menu has-card", "data-phase": state.phase, "data-want": shownKey(wantFor(state)), "data-bar": shown.bar ? "open" : "closed", "data-section": shown.section ?? "", "data-card": shown.section === null ? undefined : "", "data-code-mode": codeModeOn ? "" : undefined, "data-log-open": logOpenOn ? "" : undefined, "data-switch-hidden": switchHidden ? "" : undefined, "data-labeled": labeled ?? undefined, inert: switchHidden },
|
|
224
230
|
React.createElement(MenuCard, { section: shown.section, cardRef: refs.card, bodyRef: refs.body, idle: shown.section === null },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { MENU_FULL_TABS_MIN_WIDTH, MENU_GEOMETRY, MENU_INLINE_TAB_LABELS_MIN_WIDTH, MENU_TOP_RESERVE_VAR } from "../geometry.js";
|
|
1
|
+
import { SPLIT_BUILDER_QUERY, MENU_FULL_TABS_MIN_WIDTH, MENU_GEOMETRY, MENU_INLINE_TAB_LABELS_MIN_WIDTH, MENU_TOP_RESERVE_VAR, } from "../geometry.js";
|
|
2
2
|
import { MOTION } from "../motion.js";
|
|
3
|
+
import { SAFE_AREA_BOTTOM, SAFE_AREA_RIGHT, SAFE_AREA_TOP } from "../../../theme/safe-area.js";
|
|
3
4
|
const G = MENU_GEOMETRY;
|
|
4
5
|
const SWITCH_HIDE_FADE_MS = 200;
|
|
5
6
|
export const VIBE_MENU_SHELL_CSS = `
|
|
@@ -906,3 +907,67 @@ export const VIBE_MENU_SHELL_CSS = `
|
|
|
906
907
|
animation: none !important;
|
|
907
908
|
}
|
|
908
909
|
`;
|
|
910
|
+
export function splitDockCss(query = SPLIT_BUILDER_QUERY) {
|
|
911
|
+
return `
|
|
912
|
+
@media ${query} {
|
|
913
|
+
.vm-layer[data-dock] {
|
|
914
|
+
left: 50%;
|
|
915
|
+
/* The panel's right edge clears the right safe inset (the Duo reports 84pt
|
|
916
|
+
for its corner clock/Wi-Fi cluster); the layer is inset-0 otherwise. */
|
|
917
|
+
right: ${SAFE_AREA_RIGHT};
|
|
918
|
+
top: var(--vm-vv-top, 0px);
|
|
919
|
+
bottom: auto;
|
|
920
|
+
height: var(--vm-vv-h, 100%);
|
|
921
|
+
border-left: 2px solid var(--line);
|
|
922
|
+
/* A drag on the panel's chrome (the bar, the header, blank card) would
|
|
923
|
+
scroll the page under it, and Safari answers that by sliding its
|
|
924
|
+
toolbar and resizing the viewport. The chrome takes no pans; a scroller
|
|
925
|
+
inside (transcript, code) resets touch-action, so it still scrolls. */
|
|
926
|
+
touch-action: none;
|
|
927
|
+
}
|
|
928
|
+
/* ...and no scroller inside hands its overscroll on to the page. */
|
|
929
|
+
.vm-layer[data-dock] * {
|
|
930
|
+
overscroll-behavior: contain;
|
|
931
|
+
}
|
|
932
|
+
/* Full height, no dead bands: the switch's glass rests a hair above the
|
|
933
|
+
bottom safe inset (or the keyboard: useDockedViewportVars writes
|
|
934
|
+
--vm-vv-safe-bottom: 0px while it is up, since the inset sits under it), and
|
|
935
|
+
the card runs from one edge below the top safe inset down to the bar. */
|
|
936
|
+
.vm-layer[data-dock] .vm-menu {
|
|
937
|
+
--vm-safe-bottom: var(--vm-vv-safe-bottom, ${SAFE_AREA_BOTTOM});
|
|
938
|
+
--vm-dock-foot: max(var(--vm-safe-bottom), 4px);
|
|
939
|
+
--vm-dock-head: max(${SAFE_AREA_TOP}, var(--vm-edge));
|
|
940
|
+
bottom: calc(var(--vm-ring) + var(--vm-dock-foot));
|
|
941
|
+
--vm-dock-card-h: min(
|
|
942
|
+
calc(100cqh - var(--vm-dock-head) - var(--vm-dock-foot) - 2 * var(--vm-ring) - var(--vm-pill-h)),
|
|
943
|
+
var(--vm-below-reserve)
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
.vm-layer[data-dock] .vm-menu .vm-card,
|
|
947
|
+
.vm-layer[data-dock] .vm-menu[data-code-mode] .vm-card {
|
|
948
|
+
height: var(--vm-dock-card-h);
|
|
949
|
+
max-height: var(--vm-dock-card-h);
|
|
950
|
+
}
|
|
951
|
+
/* The bar ends before the switch: Share's run under the pill's left curve
|
|
952
|
+
(#7329) gives way to a rounded end one gap short of the glass, so no tab's
|
|
953
|
+
colour runs under the switch. Tabs keep their boxes; Share's grows into the
|
|
954
|
+
room the run's reserve held. */
|
|
955
|
+
.vm-layer[data-dock] .vm-strip {
|
|
956
|
+
--vm-dock-gap: 6px;
|
|
957
|
+
--vm-strip-w: calc(100cqw - 2 * var(--vm-edge) - var(--vm-glass-w) - var(--vm-dock-gap));
|
|
958
|
+
--vm-slide-max: var(--vm-strip-w);
|
|
959
|
+
right: calc(var(--vm-glass-w) - var(--vm-ring) + var(--vm-dock-gap));
|
|
960
|
+
}
|
|
961
|
+
.vm-layer[data-dock] .vm-strip-slide {
|
|
962
|
+
border-right: 2px solid var(--line);
|
|
963
|
+
border-radius: var(--bar-tl, calc(var(--vm-bar-h) / 2)) calc(var(--vm-bar-h) / 2) calc(var(--vm-bar-h) / 2) calc(var(--vm-bar-h) / 2);
|
|
964
|
+
}
|
|
965
|
+
.vm-layer[data-dock] .vm-strip-inner {
|
|
966
|
+
padding-right: 0;
|
|
967
|
+
}
|
|
968
|
+
.vm-layer[data-dock] .vm-tab-run {
|
|
969
|
+
display: none;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
`;
|
|
973
|
+
}
|
|
@@ -479,11 +479,13 @@ export function useMenuSequencer(input) {
|
|
|
479
479
|
return;
|
|
480
480
|
const observer = new ResizeObserver(() => driver.resnap());
|
|
481
481
|
observer.observe(body);
|
|
482
|
+
const card = refs.card.current;
|
|
483
|
+
if (card !== null)
|
|
484
|
+
observer.observe(card);
|
|
482
485
|
function onResize() {
|
|
483
486
|
driver.resnap();
|
|
484
487
|
}
|
|
485
488
|
window.addEventListener("resize", onResize);
|
|
486
|
-
const card = refs.card.current;
|
|
487
489
|
card?.addEventListener(MENU_RESNAP_EVENT, onResize);
|
|
488
490
|
return () => {
|
|
489
491
|
observer.disconnect();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { Result } from "@adviser/cement";
|
|
3
|
-
import type { Banner, MenuEvent, MenuState, MenuView } from "./menu-state.js";
|
|
3
|
+
import type { Banner, MenuEvent, MenuState, MenuView, Section } from "./menu-state.js";
|
|
4
4
|
import type { MomentItem } from "./moments.js";
|
|
5
5
|
import type { ViewerRole } from "./open-resolver.js";
|
|
6
6
|
import type { CodeTab } from "./code-tabs.js";
|
|
@@ -413,6 +413,9 @@ export interface VibeMenuProps {
|
|
|
413
413
|
twinkling: boolean;
|
|
414
414
|
};
|
|
415
415
|
frameCap?: boolean;
|
|
416
|
+
dock?: boolean;
|
|
417
|
+
pillOpensSection?: Section;
|
|
418
|
+
onPillOpen?: () => void;
|
|
416
419
|
frame?: "viewport" | "contained";
|
|
417
420
|
reducedMotion?: boolean;
|
|
418
421
|
homeTabRow?: boolean;
|