@vibes.diy/base 14.3.457 → 14.3.459

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.
Files changed (48) hide show
  1. package/attachments/attachment-types.d.ts +1 -0
  2. package/attachments/attachment-types.js +9 -0
  3. package/attachments/composer-file-paste.d.ts +7 -0
  4. package/attachments/composer-file-paste.js +25 -0
  5. package/attachments/process-attachment.js +3 -3
  6. package/components/AttachmentRow.js +8 -1
  7. package/components/AttachmentThumb.d.ts +7 -0
  8. package/components/AttachmentThumb.js +24 -0
  9. package/components/ChatMessageRow.js +1 -1
  10. package/components/HandlePickerMenu.js +1 -1
  11. package/components/HiddenMenuWrapper.js +3 -3
  12. package/components/HiddenMenuWrapper.styles.js +1 -1
  13. package/components/SharePanelView.js +1 -1
  14. package/components/SubTabStrip.js +4 -4
  15. package/components/VibesButton.js +3 -3
  16. package/components/VibesPanel.js +2 -2
  17. package/components/ViewerTagView.js +1 -1
  18. package/components/index.d.ts +1 -0
  19. package/components/index.js +1 -0
  20. package/components/vibe-menu/VibeMenu.js +7 -2
  21. package/components/vibe-menu/cards/share-actions.d.ts +6 -2
  22. package/components/vibe-menu/cards/share-actions.js +6 -8
  23. package/components/vibe-menu/cards/share-parts.js +12 -3
  24. package/components/vibe-menu/geometry.d.ts +6 -0
  25. package/components/vibe-menu/geometry.js +4 -0
  26. package/components/vibe-menu/parts/Composer.d.ts +6 -1
  27. package/components/vibe-menu/parts/Composer.js +36 -8
  28. package/components/vibe-menu/parts/SectionStrip.js +2 -0
  29. package/components/vibe-menu/parts/StarterChips.d.ts +12 -31
  30. package/components/vibe-menu/parts/StarterChips.js +6 -11
  31. package/components/vibe-menu/parts/StatusChipRow.js +1 -1
  32. package/components/vibe-menu/parts/use-composer-draft.d.ts +1 -0
  33. package/components/vibe-menu/parts/use-composer-draft.js +3 -0
  34. package/components/vibe-menu/shell/VibeMenuShell.d.ts +2 -0
  35. package/components/vibe-menu/shell/VibeMenuShell.js +16 -8
  36. package/components/vibe-menu/shell/shell.styles.d.ts +1 -0
  37. package/components/vibe-menu/shell/shell.styles.js +66 -1
  38. package/components/vibe-menu/shell/useMenuSequencer.js +3 -1
  39. package/components/vibe-menu/slices.d.ts +6 -1
  40. package/components/vibe-menu/slices.js +2 -0
  41. package/components/vibe-menu/vibe-menu.styles.d.ts +1 -1
  42. package/components/vibe-menu/vibe-menu.styles.js +14 -0
  43. package/index.d.ts +1 -0
  44. package/index.js +1 -0
  45. package/package.json +5 -5
  46. package/theme/tokens.d.ts +5 -0
  47. package/theme/tokens.js +5 -0
  48. package/utils/normalize-avatar-image.js +3 -3
@@ -1,44 +1,24 @@
1
1
  import * as React from "react";
2
2
  export declare const STARTER_PAINTS: readonly [{
3
- readonly name: "blue";
4
- readonly color: "#3b82f6";
3
+ readonly name: "orange";
4
+ readonly color: "#ff571e";
5
5
  readonly ink: "menu-ink";
6
6
  }, {
7
- readonly name: "red";
8
- readonly color: "#ef4444";
7
+ readonly name: "pink";
8
+ readonly color: "#ef77a9";
9
9
  readonly ink: "menu-ink";
10
10
  }, {
11
- readonly name: "yellow";
12
- readonly color: "#eab308";
11
+ readonly name: "gold";
12
+ readonly color: "#e9ae20";
13
13
  readonly ink: "menu-ink";
14
14
  }, {
15
- readonly name: "gray";
16
- readonly color: "#6b7280";
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: "cyan-neon";
32
- readonly color: "#22d3ee";
33
- readonly ink: "menu-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: "blue", color: colors.blue, ink: "menu-ink" },
6
- { name: "red", color: colors.red, ink: "menu-ink" },
7
- { name: "yellow", color: colors.yellow, ink: "menu-ink" },
8
- { name: "gray", color: colors.gray, ink: "vibes-cream" },
9
- { name: "purple-neon", color: colors.purpleNeon, ink: "menu-ink" },
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) {
@@ -56,7 +51,7 @@ ${PAINT_RULES}
56
51
  export function StarterChips({ chips, onPick, disabled = false, dealt = true, ariaLabel = "Start with a kind of app", className, }) {
57
52
  return (React.createElement(React.Fragment, null,
58
53
  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: () => {
54
+ 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
55
  if (!disabled)
61
56
  onPick(chip);
62
57
  }, onKeyDown: (event) => {
@@ -56,7 +56,7 @@ export function nextStepChipText(label) {
56
56
  return `Next: ${head.trimEnd()}…`;
57
57
  }
58
58
  export function nextStepChipLabel(label) {
59
- return `Next idea for your app: ${label.trim()}. Tap to see it and the other ideas.`;
59
+ return `Next idea for your app: ${label.trim()}. Tap to build it.`;
60
60
  }
61
61
  export function pendingChipText(n) {
62
62
  return `${n} waiting`;
@@ -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",
@@ -15,15 +16,17 @@ const DETACHED_LAYER_ATTRIBUTES = [
15
16
  "data-vibe-version-menu",
16
17
  "data-vibe-toaster",
17
18
  ];
19
+ const DETACHED_LAYER_CLASSES = ["cl-modalBackdrop"];
18
20
  function isDetachedLayer(node) {
19
21
  if (node instanceof Element === false)
20
22
  return false;
21
- return DETACHED_LAYER_ATTRIBUTES.some((name) => node.hasAttribute(name) === true);
23
+ return (DETACHED_LAYER_ATTRIBUTES.some((name) => node.hasAttribute(name) === true) ||
24
+ DETACHED_LAYER_CLASSES.some((name) => node.classList.contains(name) === true));
22
25
  }
23
26
  function useOutsideClose(input) {
24
- const { phase, dispatch, menuRef } = input;
27
+ const { phase, dispatch, menuRef, docked } = input;
25
28
  useEffect(() => {
26
- if (phase === "collapsed")
29
+ if (phase === "collapsed" || docked === true)
27
30
  return;
28
31
  const listeningSince = performance.now();
29
32
  function onOutsideClick(event) {
@@ -41,7 +44,7 @@ function useOutsideClose(input) {
41
44
  }
42
45
  window.addEventListener("click", onOutsideClick);
43
46
  return () => window.removeEventListener("click", onOutsideClick);
44
- }, [phase, dispatch, menuRef]);
47
+ }, [phase, dispatch, menuRef, docked]);
45
48
  }
46
49
  function useEscapeStepsBack(input) {
47
50
  const { phase, dispatch } = input;
@@ -193,7 +196,11 @@ export function VibeMenuShell(props) {
193
196
  if (live)
194
197
  retained.current = content;
195
198
  });
196
- 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]);
197
204
  useEscapeStepsBack({ phase: state.phase, dispatch });
198
205
  const choicesRef = useRef(null);
199
206
  const labeledOn = props.labeled === "a" || props.labeled === "b";
@@ -214,9 +221,10 @@ export function VibeMenuShell(props) {
214
221
  useEffect(() => {
215
222
  onChipsShown?.(seenKey === "" ? [] : seenKey.split("|"));
216
223
  }, [seenKey, onChipsShown]);
217
- 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 },
218
225
  React.createElement(VibeMenuStyles, null),
219
226
  React.createElement("style", null, VIBE_MENU_SHELL_CSS),
227
+ React.createElement("style", null, splitDockCss(props.dockCssQuery ?? SPLIT_BUILDER_QUERY)),
220
228
  labeled === null ? null : React.createElement("style", null, LABELED_MENU_CSS),
221
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 },
222
230
  React.createElement(MenuCard, { section: shown.section, cardRef: refs.card, bodyRef: refs.body, idle: shown.section === null },
@@ -1 +1,2 @@
1
1
  export declare const VIBE_MENU_SHELL_CSS: string;
2
+ export declare function splitDockCss(query?: string): string;
@@ -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;
@@ -435,3 +438,5 @@ export declare const APPROVE_DATA_ONLY: Readonly<{
435
438
  readonly codeFailed: "Data access granted. Code access didn't go through.";
436
439
  readonly codeNeedsHandle: "Data access granted. Code access needs their handle.";
437
440
  }>;
441
+ export declare const REQUEST_ALREADY_ANSWERED = "That request was already decided elsewhere.";
442
+ export declare const REQUEST_ALREADY_IN_OTHER_ROLE = "Already in with a different access level.";
@@ -2,3 +2,5 @@ export const APPROVE_DATA_ONLY = Object.freeze({
2
2
  codeFailed: "Data access granted. Code access didn't go through.",
3
3
  codeNeedsHandle: "Data access granted. Code access needs their handle.",
4
4
  });
5
+ export const REQUEST_ALREADY_ANSWERED = "That request was already decided elsewhere.";
6
+ export const REQUEST_ALREADY_IN_OTHER_ROLE = "Already in with a different access level.";