@vibes.diy/base 14.3.344 → 14.3.345

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.
@@ -25,7 +25,7 @@ export function NotificationDetailView(props) {
25
25
  return (React.createElement("div", { "data-testid": "notification-detail-view", className: "flex flex-col", style: { gap: 14 } },
26
26
  React.createElement("div", null,
27
27
  React.createElement("div", { className: "text-light-primary dark:text-dark-primary", "data-testid": "notification-detail-headline", style: { fontSize: 19, fontWeight: 600, lineHeight: 1.25 } }, props.headline),
28
- props.body !== undefined && props.body !== "" && (React.createElement("p", { className: "text-light-secondary dark:text-dark-secondary", "data-testid": "notification-detail-body", style: { fontSize: 14, lineHeight: 1.45, margin: "6px 0 0" } }, props.body))),
28
+ props.body !== undefined && props.body !== "" && (React.createElement("p", { className: "text-light-secondary dark:text-dark-secondary ph-no-capture", "data-testid": "notification-detail-body", style: { fontSize: 14, lineHeight: 1.45, margin: "6px 0 0" } }, props.body))),
29
29
  buildBits.length > 0 && (React.createElement("p", { className: "text-light-secondary dark:text-dark-secondary", "data-testid": "notification-detail-build-meta", style: { fontSize: 13, lineHeight: 1.4, margin: 0 } }, buildBits.join(" · "))),
30
30
  props.actorHandle !== undefined && props.actorHandle !== "" && (React.createElement("div", { className: "flex items-center gap-2", "data-testid": "notification-detail-actor" },
31
31
  props.actorAvatarUrl !== undefined && props.actorAvatarUrl !== "" ? (React.createElement(ActorAvatar, { url: props.actorAvatarUrl, handle: props.actorHandle })) : (React.createElement("span", { "aria-hidden": "true", className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-black/10 font-semibold text-neutral-700 uppercase dark:bg-white/15 dark:text-neutral-200", style: { fontSize: 13 } }, props.actorHandle.slice(0, 1))),
@@ -6,7 +6,7 @@ export declare const CODE_DRILL_TITLES: Readonly<{
6
6
  readonly details: "App details";
7
7
  readonly help: "Help";
8
8
  }>;
9
- export declare const CODE_CARD_CSS = "\n[data-vibe-menu] .vm-prompt-request { margin: 0 0 var(--space-14); font: 400 16px/1.3 var(--font-display); color: var(--ink); overflow-wrap: anywhere; }\n/* The first build's request (PromptRequest, #7660) clamps to three lines so the\n status and expected-time bar stay on the first phone screen; \"Show all\" opens it. */\n[data-vibe-menu] .vm-prompt-request.is-clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n[data-vibe-menu] .vm-prompt-more { display: block; margin: calc(var(--space-12) * -1) 0 var(--space-14); padding: 0; font: 700 12px/1.6 var(--font-tab); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); cursor: pointer; }\n[data-vibe-menu] .vm-prompt-more:hover { color: var(--ink); }\n[data-vibe-menu] .vm-prompt-files { display: grid; gap: var(--space-12); margin-top: var(--space-16); }\n[data-vibe-menu] .vm-prompt-attached { margin-top: var(--space-2); font: 400 13px/1.4 var(--font-display); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n[data-vibe-menu] .vm-prompt-detail { font: 400 13px/1.4 var(--font-display); color: var(--muted); margin: var(--space-12) 0; overflow-wrap: anywhere; }\n[data-vibe-menu] .vm-prompt .vm-prompt-stop { flex: none; width: auto; height: 28px; margin-top: 0; }\n[data-vibe-menu] .vm-prompt-status { display: flex; align-items: center; gap: var(--space-12); border-top: var(--stroke-rule) solid var(--line-card); padding-top: var(--space-16); margin-bottom: var(--space-16); font: 400 14px/1.4 var(--font-display); color: var(--muted); }\n[data-vibe-menu] .vm-code .vm-moments { margin-bottom: var(--space-14); }\n/* The guest's Keep this app line (#7789): one quiet line in the card's flow\n above the composer, its button an inline text link. */\n[data-vibe-menu] .vm-keep-app { margin: 0 0 var(--space-12); line-height: 1.4; }\n[data-vibe-menu] .vm-keep-app > strong { color: var(--ink); font-weight: 700; }\n[data-vibe-menu] .vm-guest-build { margin: var(--space-8) 0 var(--space-12); line-height: 1.4; }\n[data-vibe-menu] .vm-guest-build > strong { color: var(--ink); font-weight: 700; }\n/* A guest's first build (#9462): the note and the build ask that later takes its\n place share one grid cell, the note kept as an invisible spacer under the ask,\n so the slot is always the taller of the two and the swap moves no line above it. */\n[data-vibe-menu] .vm-guest-slot { display: grid; }\n[data-vibe-menu] .vm-guest-slot > * { grid-area: 1 / 1; }\n[data-vibe-menu] .vm-keep-app-cta { display: inline; padding: 0; font: inherit; font-weight: 700; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }\n[data-vibe-menu] .vm-code .vm-suggestions { margin-bottom: var(--space-14); }\n[data-vibe-menu] .vm-codemode { display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0; }\n[data-vibe-menu] .vm-codemode[data-fill] { flex: 1 1 auto; }\n/* The pinned top (kicker, composer, moment) keeps to half the Code mode card\n (80cqh) and scrolls on its own past that, so on a short frame (phone\n landscape) a multi-line composer stays reachable and the tab strip stays in\n the card. At normal sizes it never reaches the cap: only the tab body scrolls. */\n[data-vibe-menu] .vm-codemode-top { flex: none; max-height: 40cqh; overflow-y: auto; overscroll-behavior: contain; }\n[data-vibe-menu] .vm-codemode .vm-composer,\n[data-vibe-menu] .vm-codemode .vm-moments { margin-bottom: 10px; }\n\n/* The build ask (#8951): the agent's one question under the first build's live\n line, in the live line's own type. The card's composer below takes the answer;\n nothing is focused until a tap, so the keyboard stays closed while the first\n look plays. */\n[data-vibe-menu] .vm-build-ask { display: flex; align-items: flex-start; gap: var(--space-8); margin: var(--space-8) 0 var(--space-10); }\n[data-vibe-menu] .vm-build-ask-q { flex: 1; min-width: 0; margin: 0; padding: 0; text-align: left; font: 400 16px/1.3 var(--font-display); color: var(--ink); text-wrap: pretty; cursor: text; }\n[data-vibe-menu] .vm-build-ask-x { flex: none; width: 28px; height: 28px; padding: 0; font: 400 18px/1 var(--font-tab); color: var(--muted); cursor: pointer; }\n";
9
+ export declare const CODE_CARD_CSS = "\n[data-vibe-menu] .vm-prompt-request { margin: 0 0 var(--space-14); font: 400 16px/1.3 var(--font-display); color: var(--ink); overflow-wrap: anywhere; }\n/* The first build's request (PromptRequest, #7660) clamps to three lines so the\n status and expected-time bar stay on the first phone screen; \"Show all\" opens it. */\n[data-vibe-menu] .vm-prompt-request.is-clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }\n[data-vibe-menu] .vm-prompt-more { display: block; margin: calc(var(--space-12) * -1) 0 var(--space-14); padding: 0; font: 700 12px/1.6 var(--font-tab); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); cursor: pointer; }\n[data-vibe-menu] .vm-prompt-more:hover { color: var(--ink); }\n[data-vibe-menu] .vm-prompt-files { display: grid; gap: var(--space-12); margin-top: var(--space-16); }\n[data-vibe-menu] .vm-prompt-attached { margin-top: var(--space-2); font: 400 13px/1.4 var(--font-display); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n[data-vibe-menu] .vm-prompt-detail { font: 400 13px/1.4 var(--font-display); color: var(--muted); margin: var(--space-12) 0; overflow-wrap: anywhere; }\n[data-vibe-menu] .vm-prompt .vm-prompt-stop { flex: none; width: auto; height: 28px; margin-top: 0; }\n[data-vibe-menu] .vm-prompt-status { display: flex; align-items: center; gap: var(--space-12); border-top: var(--stroke-rule) solid var(--line-card); padding-top: var(--space-16); margin-bottom: var(--space-16); font: 400 14px/1.4 var(--font-display); color: var(--muted); }\n[data-vibe-menu] .vm-code .vm-moments { margin-bottom: var(--space-14); }\n/* The guest's Keep this app line (#7789): one quiet line in the card's flow\n above the composer, its button an inline text link. */\n[data-vibe-menu] .vm-keep-app { margin: 0 0 var(--space-12); line-height: 1.4; }\n[data-vibe-menu] .vm-keep-app > strong { color: var(--ink); font-weight: 700; }\n[data-vibe-menu] .vm-guest-build { margin: var(--space-8) 0 var(--space-12); line-height: 1.4; }\n[data-vibe-menu] .vm-guest-build > strong { color: var(--ink); font-weight: 700; }\n/* A guest's first build (#9462): the note and the build ask that later takes its\n place share one grid cell, the note kept as an invisible spacer under the ask,\n so the slot is always the taller of the two and the swap moves no line above it. */\n[data-vibe-menu] .vm-guest-slot { display: grid; }\n[data-vibe-menu] .vm-guest-slot > * { grid-area: 1 / 1; }\n/* An account's first build (#9641): the build ask's own room, held the same way. */\n[data-vibe-menu] .vm-ask-slot { display: grid; }\n[data-vibe-menu] .vm-ask-slot > * { grid-area: 1 / 1; }\n[data-vibe-menu] .vm-keep-app-cta { display: inline; padding: 0; font: inherit; font-weight: 700; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }\n[data-vibe-menu] .vm-code .vm-suggestions { margin-bottom: var(--space-14); }\n[data-vibe-menu] .vm-codemode { display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0; }\n[data-vibe-menu] .vm-codemode[data-fill] { flex: 1 1 auto; }\n/* The pinned top (kicker, composer, moment) keeps to half the Code mode card\n (80cqh) and scrolls on its own past that, so on a short frame (phone\n landscape) a multi-line composer stays reachable and the tab strip stays in\n the card. At normal sizes it never reaches the cap: only the tab body scrolls. */\n[data-vibe-menu] .vm-codemode-top { flex: none; max-height: 40cqh; overflow-y: auto; overscroll-behavior: contain; }\n[data-vibe-menu] .vm-codemode .vm-composer,\n[data-vibe-menu] .vm-codemode .vm-moments { margin-bottom: 10px; }\n\n/* The build ask (#8951): the agent's one question under the first build's live\n line, in the live line's own type. The card's composer below takes the answer;\n nothing is focused until a tap, so the keyboard stays closed while the first\n look plays. */\n[data-vibe-menu] .vm-build-ask { display: flex; align-items: flex-start; gap: var(--space-8); margin: var(--space-8) 0 var(--space-10); }\n[data-vibe-menu] .vm-build-ask-q { flex: 1; min-width: 0; margin: 0; padding: 0; text-align: left; font: 400 16px/1.3 var(--font-display); color: var(--ink); text-wrap: pretty; cursor: text; }\n[data-vibe-menu] .vm-build-ask-x { flex: none; width: 28px; height: 28px; padding: 0; font: 400 18px/1 var(--font-tab); color: var(--muted); cursor: pointer; }\n";
10
10
  export declare const CODE_SUMMARY_LINE_CSS = "\n[data-vibe-menu] .vm-code.vm-ctab .vm-moment.is-summary > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n";
11
11
  export interface CodeCardProps {
12
12
  readonly viewer: ViewerSlice;
@@ -9,7 +9,7 @@ import { Suggestions } from "../parts/Chip.js";
9
9
  import { Composer, latestStopArm } from "../parts/Composer.js";
10
10
  import { DoneButton } from "../parts/DoneButton.js";
11
11
  import { KeepAppLine } from "../parts/KeepAppLine.js";
12
- import { BUILD_ASK_LINE_CSS, BuildAskLine } from "../parts/BuildAskLine.js";
12
+ import { BUILD_ASK_LINE_CSS, BuildAskLine, BuildAskRoom } from "../parts/BuildAskLine.js";
13
13
  import { AgentLog, MomentLine } from "../parts/MomentLine.js";
14
14
  import { PromptRequest } from "../parts/PromptRequest.js";
15
15
  import { Row } from "../parts/Row.js";
@@ -45,6 +45,9 @@ export const CODE_CARD_CSS = `
45
45
  so the slot is always the taller of the two and the swap moves no line above it. */
46
46
  [data-vibe-menu] .vm-guest-slot { display: grid; }
47
47
  [data-vibe-menu] .vm-guest-slot > * { grid-area: 1 / 1; }
48
+ /* An account's first build (#9641): the build ask's own room, held the same way. */
49
+ [data-vibe-menu] .vm-ask-slot { display: grid; }
50
+ [data-vibe-menu] .vm-ask-slot > * { grid-area: 1 / 1; }
48
51
  [data-vibe-menu] .vm-keep-app-cta { display: inline; padding: 0; font: inherit; font-weight: 700; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
49
52
  [data-vibe-menu] .vm-code .vm-suggestions { margin-bottom: var(--space-14); }
50
53
  [data-vibe-menu] .vm-codemode { display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0; }
@@ -94,6 +97,13 @@ export function CodeCard(props) {
94
97
  const pinnedLeftAt = React.useRef(undefined);
95
98
  const handoffSawBuild = React.useRef(false);
96
99
  const heldFirstBuild = React.useRef(null);
100
+ const [answering, setAnswering] = React.useState(false);
101
+ if (answering && (code.buildAsk === undefined || code.buildAsk === null))
102
+ setAnswering(false);
103
+ React.useLayoutEffect(() => {
104
+ if (answering)
105
+ composerField.current?.focus();
106
+ }, [answering]);
97
107
  React.useLayoutEffect(() => {
98
108
  if (focusAfterCodeMode.current && code.codeMode === false && composerField.current !== null) {
99
109
  focusAfterCodeMode.current = false;
@@ -154,7 +164,10 @@ export function CodeCard(props) {
154
164
  const keepAppNode = code.keepApp !== undefined && code.keepApp !== null ? (React.createElement(KeepAppLine, { keepApp: code.keepApp, visible: props.open === true })) : null;
155
165
  const buildAsk = editor ? (code.buildAsk ?? null) : null;
156
166
  const askOpen = buildAsk !== null;
157
- const buildAskNode = buildAsk !== null ? (React.createElement(BuildAskLine, { ask: buildAsk, visible: props.open === true, onAnswer: () => composerField.current?.focus() })) : null;
167
+ const buildAskNode = buildAsk !== null ? (React.createElement(BuildAskLine, { ask: buildAsk, visible: props.open === true, onAnswer: () => {
168
+ setAnswering(true);
169
+ composerField.current?.focus();
170
+ } })) : null;
158
171
  const kickerNode = requestHead ?? (kicker !== "" ? React.createElement("p", { className: "vm-kicker" }, kicker) : null);
159
172
  const head = (React.createElement(React.Fragment, null,
160
173
  kickerNode,
@@ -333,8 +346,11 @@ export function CodeCard(props) {
333
346
  ? { ...toggle, tail, history: hasHistory ? history : undefined }
334
347
  : chatLog;
335
348
  const building = working || bootHold;
336
- const showComposer = code.composerHidden !== true && (firstBuild === false || askOpen) && historyLoading === false && handoffHold === false;
337
- const guestBuildNode = editor === true && code.guestBuild === true && building === true && showComposer === false ? (React.createElement("p", { className: "vm-sub vm-guest-build", "data-guest-build-note": "" },
349
+ const showComposer = code.composerHidden !== true &&
350
+ (firstBuild === false || (askOpen && answering)) &&
351
+ historyLoading === false &&
352
+ handoffHold === false;
353
+ const guestBuildNode = editor === true && code.guestBuild === true && building === true && showComposer === false && buildAskNode === null ? (React.createElement("p", { className: "vm-sub vm-guest-build", "data-guest-build-note": "" },
338
354
  React.createElement("strong", null, GUEST_BUILD_NOTE.lead),
339
355
  " ",
340
356
  GUEST_BUILD_NOTE.body)) : null;
@@ -343,10 +359,13 @@ export function CodeCard(props) {
343
359
  React.createElement("strong", null, GUEST_BUILD_NOTE.lead),
344
360
  " ",
345
361
  GUEST_BUILD_NOTE.body)) : null;
362
+ const askRoom = editor === true && code.guestBuild !== true && (firstBuild || bootHold);
346
363
  const askSlot = guestSlot && (buildAskNode !== null || guestBuildNode !== null) ? (React.createElement("div", { className: "vm-guest-slot", "data-guest-build-slot": "" },
347
364
  guestSpacer,
348
365
  buildAskNode,
349
- guestBuildNode)) : (buildAskNode);
366
+ guestBuildNode)) : askRoom ? (React.createElement("div", { className: "vm-ask-slot", "data-build-ask-slot": "" },
367
+ buildAskNode,
368
+ React.createElement(BuildAskRoom, null))) : (buildAskNode);
350
369
  const reserveRow = rowItems.length === 0 && editor === true && logOpens === false && (firstBuild || (handoffHold && moment.pinned === null));
351
370
  const mainAction = showComposer ? (composerNode) : working ? (React.createElement(StopIconButton, { disabled: composer.stopDisabled === true, armedAt: latestStopArm(live?.expected?.fromMs, pinnedLeftAt.current), onStop: () => {
352
371
  heldFirstBuild.current = null;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { Result } from "@adviser/cement";
3
3
  import type { CardNav, ShareAppSlice, ShareEvent, ShareSheetSurface } from "../slices.js";
4
- import { type ShareImageInput } from "../share-image.js";
4
+ import { type ShareImage, type ShareImageInput } from "../share-image.js";
5
5
  export declare const SHARE_APP_HELP = "On iPhone this opens instantly, no download. Everywhere else it opens on the web.";
6
6
  export declare const CARD_STATUS_COPY: {
7
7
  readonly notYet: "Your app gets its own card on iPhone after Apple reviews it";
@@ -22,7 +22,7 @@ export declare function shareSheetClosed(surface: ShareSheetSurface, err: Error)
22
22
  export declare function shareAppSlug(url: string): string;
23
23
  export type ShareImageRenderer = (input: ShareImageInput, opts: {
24
24
  readonly signal: AbortSignal;
25
- }) => Promise<Result<Blob>>;
25
+ }) => Promise<Result<ShareImage>>;
26
26
  export declare const ShareImageRendererContext: React.Context<ShareImageRenderer>;
27
27
  export declare function ShareAppDrill({ app, nav, parent, onShareEvent, }: {
28
28
  readonly app: ShareAppSlice;
@@ -91,6 +91,9 @@ function renderSettled(renderImage, input, signal) {
91
91
  .then(() => renderImage(input, { signal }))
92
92
  .catch((e) => Result.Err(e instanceof Error ? e : new Error(String(e))));
93
93
  }
94
+ function imageReport(shown) {
95
+ return shown.screenshotMissed ? { image: shown.variant, screenshotMissed: true } : { image: shown.variant };
96
+ }
94
97
  function useShareImage(app) {
95
98
  const renderImage = useContext(ShareImageRendererContext);
96
99
  const [image, setImage] = useState(undefined);
@@ -98,24 +101,29 @@ function useShareImage(app) {
98
101
  useEffect(() => {
99
102
  const abort = new AbortController();
100
103
  const shown = [];
101
- function show(res, which) {
104
+ function show(res, wanted) {
102
105
  if (abort.signal.aborted === true)
103
106
  return;
104
107
  if (res.isErr()) {
105
- console.warn(`[ShareAppDrill] ${which} share image failed:`, res.Err().message);
108
+ console.warn(`[ShareAppDrill] ${wanted} share image failed:`, res.Err().message);
106
109
  return;
107
110
  }
108
- const blob = res.Ok();
111
+ const { blob, drawn } = res.Ok();
109
112
  const objectUrl = URL.createObjectURL(blob);
110
113
  shown.push(objectUrl);
111
- setImage({ objectUrl, file: new File([blob], `${shareAppSlug(url)}-share.png`, { type: "image/png" }) });
114
+ setImage({
115
+ objectUrl,
116
+ file: new File([blob], `${shareAppSlug(url)}-share.png`, { type: "image/png" }),
117
+ variant: drawn,
118
+ screenshotMissed: wanted === "screenshot" && drawn === "flat",
119
+ });
112
120
  }
113
121
  const input = { screenshotUrl, title, handle, url };
114
122
  void renderSettled(renderImage, { ...input, screenshotUrl: null }, abort.signal).then((flat) => {
115
123
  show(flat, "flat");
116
124
  if (screenshotUrl === null || abort.signal.aborted === true)
117
125
  return;
118
- return renderSettled(renderImage, input, abort.signal).then((full) => show(full, "full"));
126
+ return renderSettled(renderImage, input, abort.signal).then((full) => show(full, "screenshot"));
119
127
  });
120
128
  return function revokeShareImage() {
121
129
  abort.abort();
@@ -150,9 +158,12 @@ export function ShareAppDrill({ app, nav, parent = "Share", onShareEvent, }) {
150
158
  const image = useShareImage(app);
151
159
  const [failedUrl, setFailedUrl] = useState(undefined);
152
160
  useRequestCardOnce(app.onRequestCard);
153
- function imageFailed(objectUrl) {
154
- setFailedUrl(objectUrl);
155
- onShareEvent?.({ kind: "image-failed", surface: "app-image" });
161
+ function imageFailed(shown) {
162
+ setFailedUrl(shown.objectUrl);
163
+ onShareEvent?.({ kind: "image-failed", surface: "app-image", ...imageReport(shown) });
164
+ }
165
+ function imageLoaded(shown) {
166
+ onShareEvent?.({ kind: "image-loaded", surface: "app-image", ...imageReport(shown) });
156
167
  }
157
168
  function leave() {
158
169
  nav.onLeaveDrill();
@@ -200,7 +211,7 @@ export function ShareAppDrill({ app, nav, parent = "Share", onShareEvent, }) {
200
211
  return (React.createElement(React.Fragment, null,
201
212
  React.createElement(BackRow, { name: "Share as app", card: parent, top: true, onBack: leave }),
202
213
  React.createElement("div", { className: "vm-drill", "data-drill": "app" },
203
- React.createElement("div", { className: "vm-share-image" }, image === undefined ? null : failedUrl === image.objectUrl ? (React.createElement("span", { className: "vm-share-image-empty" }, "No preview")) : (React.createElement("img", { src: image.objectUrl, alt: `Share image for ${app.title}`, onError: () => imageFailed(image.objectUrl) }))),
214
+ React.createElement("div", { className: "vm-share-image" }, image === undefined ? null : failedUrl === image.objectUrl ? (React.createElement("span", { className: "vm-share-image-empty" }, "No preview")) : (React.createElement("img", { src: image.objectUrl, alt: `Share image for ${app.title}`, onLoad: () => imageLoaded(image), onError: () => imageFailed(image) }))),
204
215
  React.createElement("div", { className: "vm-share-actions" },
205
216
  React.createElement(Chip, { copy: true, label: "Save image", disabled: image === undefined, onClick: save }),
206
217
  React.createElement(CopyChip, { text: app.url, label: "Copy app link", ariaLabel: "Copy app link", onCopied: onShareEvent === undefined ? undefined : () => onShareEvent({ kind: "copied", surface: "app-link" }) }),
@@ -2,11 +2,12 @@ import * as React from "react";
2
2
  import { useContext, useState } from "react";
3
3
  import { exception2Result } from "@adviser/cement";
4
4
  import { shareTaggedUrl } from "@vibes.diy/api-types";
5
- import { GUEST_SHARE_ASK, GUEST_WAITING, JOIN_OR_SIGN_IN, SHARE_DEV_DRAFT_LINE, SHARE_HANDLE_ASK, SHARE_HANDLE_STEP, } from "../copy.js";
5
+ import { GUEST_SHARE_ASK, GUEST_WAITING, JOIN_OR_SIGN_IN, SHARE_AUDIENCE, SHARE_DEV_DRAFT_LINE, SHARE_HANDLE_ASK, SHARE_HANDLE_STEP, } from "../copy.js";
6
6
  import { ActionPill } from "../parts/ActionPill.js";
7
7
  import { CARD_TAB_ROW_CSS, CardTabRow, MainAction, Stretch } from "../parts/CardTabRow.js";
8
8
  import { SaveAskLine } from "../parts/SaveAskLine.js";
9
9
  import { Chip } from "../parts/Chip.js";
10
+ import { Glyph } from "../parts/Glyph.js";
10
11
  import { Row } from "../parts/Row.js";
11
12
  import { QrCode } from "../../QrCode.js";
12
13
  import { CopyChip, CopyLinkChip, shareCopied } from "./share-copy.js";
@@ -33,7 +34,7 @@ function ShareBody({ viewer, share, nav, onSignIn, actions }) {
33
34
  return (React.createElement("p", { className: "vm-share-empty", "data-share-draft": true }, SHARE_DEV_DRAFT_LINE));
34
35
  }
35
36
  if (viewer.identityPending === true)
36
- return React.createElement(ShareHero, { viewer: viewer, share: share, owner: false });
37
+ return React.createElement(ShareHero, { viewer: viewer, share: share, owner: false, audience: false });
37
38
  const drill = shareDrill(viewer, share, nav.view);
38
39
  if (drill !== null) {
39
40
  const fromSettings = drill !== "notifications" && drill !== "shareSettings" && drill !== "app";
@@ -42,7 +43,7 @@ function ShareBody({ viewer, share, nav, onSignIn, actions }) {
42
43
  }
43
44
  if (share.guestAsk !== undefined && share.guestAsk !== null) {
44
45
  return (React.createElement(React.Fragment, null,
45
- React.createElement(ShareHero, { viewer: viewer, share: share, owner: false }),
46
+ React.createElement(ShareHero, { viewer: viewer, share: share, owner: false, audience: false }),
46
47
  React.createElement(GuestKeepAsk, { share: share, guestAsk: share.guestAsk })));
47
48
  }
48
49
  const owner = share.canManage === true;
@@ -102,7 +103,7 @@ function EmbedReveal({ share, embed, owner, }) {
102
103
  React.createElement("textarea", { className: "vm-embed", readOnly: true, value: embed.autoHeightSnippet, "aria-label": "Auto-height embed code", onFocus: (e) => e.currentTarget.select() }),
103
104
  React.createElement(CopyChip, { text: embed.autoHeightSnippet, label: "Copy auto-height embed", ariaLabel: "Copy auto-height embed", onCopied: shareCopied(share, "auto-height-embed", owner) }))) : null));
104
105
  }
105
- function ShareHero({ viewer, share, owner, }) {
106
+ function ShareHero({ viewer, share, owner, audience = true, }) {
106
107
  const shareLink = useSendLink(viewer, share);
107
108
  const [embedOpen, setEmbedOpen] = useState(false);
108
109
  const [emailOpen, setEmailOpen] = useState(false);
@@ -123,6 +124,7 @@ function ShareHero({ viewer, share, owner, }) {
123
124
  React.createElement(FriendInviteChips, { share: share, emailOpen: emailOpen, onEmail: () => setEmailOpen((v) => v === false) }),
124
125
  shareLink !== null ? (React.createElement(Chip, { copy: true, glyph: "share", label: "Share\u2026", ariaLabel: `Share ${share.link.display}`, onClick: shareLink })) : null,
125
126
  embed !== null ? (React.createElement(Chip, { copy: true, ghost: embedOpen === false, label: "Embed", ariaLabel: "Embed", ariaExpanded: embedOpen, onClick: () => setEmbedOpen((v) => v === false) })) : null),
127
+ audience ? React.createElement(AudienceLine, { share: share }) : null,
126
128
  owner && share.handleAsk !== undefined && share.handleAsk !== null ? React.createElement(HandleAskLine, { ask: share.handleAsk }) : null,
127
129
  embed !== null && embedOpen ? React.createElement(EmbedReveal, { share: share, embed: embed, owner: owner }) : null,
128
130
  emailInvite !== null && emailOpen ? React.createElement(EmailInviteReveal, { invite: emailInvite, share: share }) : null));
@@ -210,6 +212,37 @@ function HandleAskLine({ ask }) {
210
212
  " ",
211
213
  React.createElement("span", { "aria-hidden": "true" }, "\u203A"))));
212
214
  }
215
+ function AudienceLine({ share }) {
216
+ const owner = share.canManage === true;
217
+ if (share.postureLoading || (owner && share.posture === "restricted" && share.rosterState === "loading")) {
218
+ return (React.createElement("p", { className: "vm-handle-ask vm-share-audience", "data-share-audience-pending": "", "aria-hidden": "true" },
219
+ React.createElement(Glyph, { name: "lock" }),
220
+ " "));
221
+ }
222
+ if (share.posture === "public") {
223
+ return (React.createElement("p", { className: "vm-handle-ask vm-share-audience", "data-share-audience": "public" },
224
+ React.createElement(Glyph, { name: "globe" }),
225
+ SHARE_AUDIENCE.public));
226
+ }
227
+ const members = share.roster.filter((m) => m.pendingEmail === false).length;
228
+ const who = owner === false
229
+ ? SHARE_AUDIENCE.members
230
+ : share.rosterState === "failed"
231
+ ? SHARE_AUDIENCE.added
232
+ : members === 0
233
+ ? SHARE_AUDIENCE.justYou
234
+ : SHARE_AUDIENCE.youAnd(members);
235
+ const pending = share.postureState === "pending";
236
+ return (React.createElement("p", { className: "vm-handle-ask vm-share-audience", "data-share-audience": "restricted" },
237
+ React.createElement(Glyph, { name: "lock" }),
238
+ who,
239
+ owner ? (React.createElement("span", { className: "vm-share-audience-act" },
240
+ React.createElement("span", { "aria-hidden": "true" }, " \u00B7 "),
241
+ React.createElement("button", { className: "vm-handle-ask-link", type: "button", "aria-busy": pending ? true : undefined, onClick: () => {
242
+ share.onShareEvent?.({ kind: "make-public", surface: "copy-line", postureState: share.postureState });
243
+ share.onPosture("public");
244
+ } }, pending ? SHARE_AUDIENCE.makingPublic : SHARE_AUDIENCE.makePublic))) : null));
245
+ }
213
246
  function handleStepOf(share) {
214
247
  const ask = share.handleAsk;
215
248
  if (ask === undefined || ask === null || ask.lead !== true)
@@ -242,7 +275,7 @@ export function shareTabItems(viewer, share) {
242
275
  items.push({ key: "shareSettings", label: SHARE_SETTINGS_LABEL, glyph: "settings", kind: "drill" });
243
276
  return items;
244
277
  }
245
- function LinkActions({ viewer, share, owner, }) {
278
+ function LinkActions({ viewer, share, owner, audience = true, }) {
246
279
  const shareLink = useSendLink(viewer, share);
247
280
  const [emailOpen, setEmailOpen] = useState(false);
248
281
  const emailInvite = share.emailInvite ?? null;
@@ -251,6 +284,7 @@ function LinkActions({ viewer, share, owner, }) {
251
284
  React.createElement(CopyLinkChip, { url: share.link.url, display: share.link.display, onCopied: shareCopied(share, "link", owner) }),
252
285
  React.createElement(FriendInviteChips, { share: share, emailOpen: emailOpen, onEmail: () => setEmailOpen((v) => v === false) }),
253
286
  shareLink !== null ? (React.createElement(Chip, { copy: true, glyph: "share", label: "Share\u2026", ariaLabel: `Share ${share.link.display}`, onClick: shareLink })) : null),
287
+ audience ? React.createElement(AudienceLine, { share: share }) : null,
254
288
  emailInvite !== null && emailOpen ? React.createElement(EmailInviteReveal, { invite: emailInvite, share: share }) : null));
255
289
  }
256
290
  function ShareTabHero({ share, owner, actions, }) {
@@ -287,7 +321,7 @@ function ShareTabBody({ viewer, share, nav, onSignIn, actions, }) {
287
321
  React.createElement(Stretch, null,
288
322
  React.createElement(ShareTabHero, { share: share, owner: false, actions: null })),
289
323
  React.createElement(MainAction, null,
290
- React.createElement(LinkActions, { viewer: viewer, share: share, owner: false })),
324
+ React.createElement(LinkActions, { viewer: viewer, share: share, owner: false, audience: false })),
291
325
  React.createElement(GuestKeepAsk, { share: share, guestAsk: share.guestAsk })));
292
326
  }
293
327
  const drill = shareDrill(viewer, share, nav.view);
@@ -1 +1 @@
1
- export declare const SHARE_CARD_CSS = "\n[data-vibe-menu] .vm-sr {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n}\n[data-vibe-menu] .vm-access-note {\n margin: calc(-1 * var(--space-4)) 0 var(--space-12);\n font-size: 13px;\n line-height: 1.3;\n color: var(--muted);\n}\n[data-vibe-menu] .vm-who-block > .vm-textbtn {\n margin: calc(-1 * var(--space-6)) 0 var(--space-8);\n height: 32px;\n text-align: left;\n}\n[data-vibe-menu] .vm-publish {\n margin-bottom: var(--space-12);\n}\n[data-vibe-menu] .vm-fail {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n margin: var(--space-6) 0;\n font-size: 13px;\n line-height: 1.3;\n}\n[data-vibe-menu] .vm-fail > span {\n flex: 1;\n min-width: 0;\n}\n[data-vibe-menu] .vm-share-empty {\n margin: 0;\n padding: var(--space-8) 0 var(--space-14);\n font: 400 16px/1.3 var(--font-display);\n}\n[data-vibe-menu] .vm-reveal {\n padding: var(--space-12) var(--space-16) var(--space-14);\n border-top: var(--stroke-hairline) solid var(--line-hairline);\n}\n/* The Share hero: the QR code open, with Copy link / Share\u2026 / Embed under it. */\n[data-vibe-menu] .vm-share-hero {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--space-12);\n padding: var(--space-8) 0 var(--space-16);\n}\n[data-vibe-menu] .vm-share-hero .vm-share-actions {\n justify-content: center;\n}\n/* #8326: the handle step leads the first share from a made handle; the pill spans the card. */\n[data-vibe-menu] .vm-share-handle-step {\n width: 100%;\n}\n[data-vibe-menu] .vm-handle-ask {\n margin: 0;\n max-width: 100%;\n text-align: center;\n font-size: 14px;\n line-height: 1.35;\n color: var(--muted);\n}\n[data-vibe-menu] .vm-handle-ask-name {\n overflow-wrap: anywhere;\n}\n[data-vibe-menu] .vm-handle-ask-link {\n font: inherit;\n color: var(--ink);\n text-decoration: underline;\n text-underline-offset: 2px;\n cursor: pointer;\n}\n[data-vibe-menu] .vm-input.vm-note-input {\n height: auto;\n min-height: 72px;\n margin-bottom: var(--space-8);\n padding: var(--space-12) var(--space-18);\n resize: none;\n}\n[data-vibe-menu] .vm-note-count {\n margin: 0 0 var(--space-8);\n text-align: right;\n font-size: 12px;\n color: var(--muted);\n}\n[data-vibe-menu] .vm-share-hero .vm-reveal {\n width: 100%;\n padding: var(--space-12) 0 0;\n}\n/* Text is a real sms: link wearing the chip: no underline, centered label. */\n[data-vibe-menu] a.vm-chip {\n display: inline-flex;\n align-items: center;\n text-decoration: none;\n}\n/* Email a friend: the address field, Send under it, the line under that. */\n[data-vibe-menu] .vm-reveal[data-reveal=\"email-invite\"] {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n}\n[data-vibe-menu] .vm-chip.has-glyph {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n}\n[data-vibe-menu] .vm-chip.has-glyph > svg {\n width: 14px;\n height: 14px;\n flex: none;\n}\n[data-vibe-menu] .vm-reveal + .vm-row,\n[data-vibe-menu] .vm-reveal + a.vm-row {\n border-top: var(--stroke-hairline) solid var(--line-hairline);\n}\n[data-vibe-menu] a.vm-row {\n color: var(--ink);\n text-decoration: none;\n}\n[data-vibe-menu] .vm-qr {\n display: inline-block;\n padding: var(--space-8);\n background: #ffffff;\n border: var(--stroke-rule) solid var(--line-card);\n border-radius: var(--radius-input);\n line-height: 0;\n}\n[data-vibe-menu] .vm-embed {\n display: block;\n width: 100%;\n height: calc(4.5em + 10px);\n margin-bottom: var(--space-8);\n padding: 8px 10px 0;\n resize: none;\n border: var(--stroke-rule) solid var(--line-card);\n border-radius: var(--radius-input);\n background: transparent;\n color: var(--ink);\n font: 400 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n/* Share as app: the 4:5 share image, held at its shape while it draws. */\n[data-vibe-menu] .vm-share-image {\n width: min(100%, 240px);\n aspect-ratio: 4 / 5;\n margin: 0 auto var(--space-14);\n overflow: hidden;\n border: var(--stroke-rule) solid var(--line-card);\n border-radius: var(--radius-card);\n}\n[data-vibe-menu] .vm-share-image > img {\n display: block;\n width: 100%;\n height: 100%;\n}\n[data-vibe-menu] .vm-share-image-empty {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n font-size: 12px;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--muted);\n}\n[data-vibe-menu] .vm-share-actions {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-8);\n}\n[data-vibe-menu] .vm-card-status {\n margin: var(--space-12) 0 0;\n}\n/* Phone sizing is the named container query (T5 note 5). The @media arm keeps\n the iOS no-zoom-on-focus guarantee keyed on the device as well. */\n@container vibe-menu (max-width: 480px) {\n [data-vibe-menu] .vm-embed {\n font-size: 16px;\n }\n}\n@media (max-width: 480px) {\n [data-vibe-menu] .vm-embed {\n font-size: 16px;\n }\n}\n";
1
+ export declare const SHARE_CARD_CSS = "\n[data-vibe-menu] .vm-sr {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n}\n[data-vibe-menu] .vm-access-note {\n margin: calc(-1 * var(--space-4)) 0 var(--space-12);\n font-size: 13px;\n line-height: 1.3;\n color: var(--muted);\n}\n[data-vibe-menu] .vm-who-block > .vm-textbtn {\n margin: calc(-1 * var(--space-6)) 0 var(--space-8);\n height: 32px;\n text-align: left;\n}\n[data-vibe-menu] .vm-publish {\n margin-bottom: var(--space-12);\n}\n[data-vibe-menu] .vm-fail {\n display: flex;\n align-items: center;\n gap: var(--space-8);\n margin: var(--space-6) 0;\n font-size: 13px;\n line-height: 1.3;\n}\n[data-vibe-menu] .vm-fail > span {\n flex: 1;\n min-width: 0;\n}\n[data-vibe-menu] .vm-share-empty {\n margin: 0;\n padding: var(--space-8) 0 var(--space-14);\n font: 400 16px/1.3 var(--font-display);\n}\n[data-vibe-menu] .vm-reveal {\n padding: var(--space-12) var(--space-16) var(--space-14);\n border-top: var(--stroke-hairline) solid var(--line-hairline);\n}\n/* The Share hero: the QR code open, with Copy link / Share\u2026 / Embed under it. */\n[data-vibe-menu] .vm-share-hero {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--space-12);\n padding: var(--space-8) 0 var(--space-16);\n}\n[data-vibe-menu] .vm-share-hero .vm-share-actions {\n justify-content: center;\n}\n/* #8326: the handle step leads the first share from a made handle; the pill spans the card. */\n[data-vibe-menu] .vm-share-handle-step {\n width: 100%;\n}\n[data-vibe-menu] .vm-handle-ask {\n margin: 0;\n max-width: 100%;\n text-align: center;\n font-size: 14px;\n line-height: 1.35;\n color: var(--muted);\n}\n[data-vibe-menu] .vm-handle-ask-name {\n overflow-wrap: anywhere;\n}\n[data-vibe-menu] .vm-handle-ask-link {\n font: inherit;\n color: var(--ink);\n text-decoration: underline;\n text-underline-offset: 2px;\n cursor: pointer;\n}\n/* #6658: who the link opens for, one quiet row under Copy link (29px at 390px in audition #9652). */\n[data-vibe-menu] p.vm-share-audience {\n margin-top: var(--space-10);\n}\n[data-vibe-menu] .vm-share-audience .vm-glyph {\n display: inline-block;\n width: 14px;\n height: 14px;\n vertical-align: -2px;\n margin-right: 4px;\n}\n/* Held at the line's height while who it opens for is still unknown, so the line lands without a jump. */\n[data-vibe-menu] .vm-share-audience[data-share-audience-pending] {\n visibility: hidden;\n}\n[data-vibe-menu] .vm-share-audience-act {\n white-space: nowrap;\n}\n[data-vibe-menu] .vm-input.vm-note-input {\n height: auto;\n min-height: 72px;\n margin-bottom: var(--space-8);\n padding: var(--space-12) var(--space-18);\n resize: none;\n}\n[data-vibe-menu] .vm-note-count {\n margin: 0 0 var(--space-8);\n text-align: right;\n font-size: 12px;\n color: var(--muted);\n}\n[data-vibe-menu] .vm-share-hero .vm-reveal {\n width: 100%;\n padding: var(--space-12) 0 0;\n}\n/* Text is a real sms: link wearing the chip: no underline, centered label. */\n[data-vibe-menu] a.vm-chip {\n display: inline-flex;\n align-items: center;\n text-decoration: none;\n}\n/* Email a friend: the address field, Send under it, the line under that. */\n[data-vibe-menu] .vm-reveal[data-reveal=\"email-invite\"] {\n display: flex;\n flex-direction: column;\n gap: var(--space-8);\n}\n[data-vibe-menu] .vm-chip.has-glyph {\n display: inline-flex;\n align-items: center;\n gap: var(--space-6);\n}\n[data-vibe-menu] .vm-chip.has-glyph > svg {\n width: 14px;\n height: 14px;\n flex: none;\n}\n[data-vibe-menu] .vm-reveal + .vm-row,\n[data-vibe-menu] .vm-reveal + a.vm-row {\n border-top: var(--stroke-hairline) solid var(--line-hairline);\n}\n[data-vibe-menu] a.vm-row {\n color: var(--ink);\n text-decoration: none;\n}\n[data-vibe-menu] .vm-qr {\n display: inline-block;\n padding: var(--space-8);\n background: #ffffff;\n border: var(--stroke-rule) solid var(--line-card);\n border-radius: var(--radius-input);\n line-height: 0;\n}\n[data-vibe-menu] .vm-embed {\n display: block;\n width: 100%;\n height: calc(4.5em + 10px);\n margin-bottom: var(--space-8);\n padding: 8px 10px 0;\n resize: none;\n border: var(--stroke-rule) solid var(--line-card);\n border-radius: var(--radius-input);\n background: transparent;\n color: var(--ink);\n font: 400 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n/* Share as app: the 4:5 share image, held at its shape while it draws. */\n[data-vibe-menu] .vm-share-image {\n width: min(100%, 240px);\n aspect-ratio: 4 / 5;\n margin: 0 auto var(--space-14);\n overflow: hidden;\n border: var(--stroke-rule) solid var(--line-card);\n border-radius: var(--radius-card);\n}\n[data-vibe-menu] .vm-share-image > img {\n display: block;\n width: 100%;\n height: 100%;\n}\n[data-vibe-menu] .vm-share-image-empty {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n font-size: 12px;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--muted);\n}\n[data-vibe-menu] .vm-share-actions {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-8);\n}\n[data-vibe-menu] .vm-card-status {\n margin: var(--space-12) 0 0;\n}\n/* Phone sizing is the named container query (T5 note 5). The @media arm keeps\n the iOS no-zoom-on-focus guarantee keyed on the device as well. */\n@container vibe-menu (max-width: 480px) {\n [data-vibe-menu] .vm-embed {\n font-size: 16px;\n }\n}\n@media (max-width: 480px) {\n [data-vibe-menu] .vm-embed {\n font-size: 16px;\n }\n}\n";
@@ -78,6 +78,24 @@ export const SHARE_CARD_CSS = `
78
78
  text-underline-offset: 2px;
79
79
  cursor: pointer;
80
80
  }
81
+ /* #6658: who the link opens for, one quiet row under Copy link (29px at 390px in audition #9652). */
82
+ [data-vibe-menu] p.vm-share-audience {
83
+ margin-top: var(--space-10);
84
+ }
85
+ [data-vibe-menu] .vm-share-audience .vm-glyph {
86
+ display: inline-block;
87
+ width: 14px;
88
+ height: 14px;
89
+ vertical-align: -2px;
90
+ margin-right: 4px;
91
+ }
92
+ /* Held at the line's height while who it opens for is still unknown, so the line lands without a jump. */
93
+ [data-vibe-menu] .vm-share-audience[data-share-audience-pending] {
94
+ visibility: hidden;
95
+ }
96
+ [data-vibe-menu] .vm-share-audience-act {
97
+ white-space: nowrap;
98
+ }
81
99
  [data-vibe-menu] .vm-input.vm-note-input {
82
100
  height: auto;
83
101
  min-height: 72px;
@@ -18,6 +18,15 @@ export declare const SHARE_HANDLE_STEP: Readonly<{
18
18
  line: "Your link carries the name you pick";
19
19
  shareAs: "Share as";
20
20
  }>;
21
+ export declare const SHARE_AUDIENCE: Readonly<{
22
+ public: "Anyone with the link can open it";
23
+ justYou: "Opens just for you";
24
+ youAnd: (members: number) => string;
25
+ members: "Opens for this app's members";
26
+ added: "Opens for people you've added";
27
+ makePublic: "Make public";
28
+ makingPublic: "Making it public…";
29
+ }>;
21
30
  export declare const CREATE_ACCOUNT_TO_KEEP_APPS = "Create a free account for all your devices";
22
31
  export declare const KEEP_APP_LINE: Readonly<{
23
32
  lead: "Keep this app:";
@@ -17,6 +17,15 @@ export const SIGN_IN_TO_KEEP_APP = "Sign in to keep your app";
17
17
  export const SHARE_DEV_DRAFT_LINE = "Sharing opens when your app is ready.";
18
18
  export const SHARE_HANDLE_ASK = Object.freeze({ sharedAs: "Shared as", choose: "Choose your handle" });
19
19
  export const SHARE_HANDLE_STEP = Object.freeze({ line: "Your link carries the name you pick", shareAs: "Share as" });
20
+ export const SHARE_AUDIENCE = Object.freeze({
21
+ public: "Anyone with the link can open it",
22
+ justYou: "Opens just for you",
23
+ youAnd: (members) => `Opens for you and ${members} ${members === 1 ? "member" : "members"}`,
24
+ members: "Opens for this app's members",
25
+ added: "Opens for people you've added",
26
+ makePublic: "Make public",
27
+ makingPublic: "Making it public…",
28
+ });
20
29
  export const CREATE_ACCOUNT_TO_KEEP_APPS = "Create a free account for all your devices";
21
30
  export const KEEP_APP_LINE = Object.freeze({
22
31
  lead: "Keep this app:",
@@ -4,10 +4,12 @@ import type { ComposerSlice } from "./Composer.js";
4
4
  export declare const BUILD_ASK_LINE: Readonly<{
5
5
  readonly dismiss: "Not now";
6
6
  }>;
7
+ export declare const BUILD_ASK_FALLBACK = "While it builds, tell me what goes in it, and it opens with yours inside.";
7
8
  export declare const BUILD_ASK_LINE_CSS = "\n/* The build ask (#8951): the agent's one question under the first build's live\n line, in the live line's own type. The card's composer below takes the answer;\n nothing is focused until a tap, so the keyboard stays closed while the first\n look plays. */\n[data-vibe-menu] .vm-build-ask { display: flex; align-items: flex-start; gap: var(--space-8); margin: var(--space-8) 0 var(--space-10); }\n[data-vibe-menu] .vm-build-ask-q { flex: 1; min-width: 0; margin: 0; padding: 0; text-align: left; font: 400 16px/1.3 var(--font-display); color: var(--ink); text-wrap: pretty; cursor: text; }\n[data-vibe-menu] .vm-build-ask-x { flex: none; width: 28px; height: 28px; padding: 0; font: 400 18px/1 var(--font-tab); color: var(--muted); cursor: pointer; }\n";
8
9
  export declare function BuildAskLine(props: {
9
10
  readonly ask: BuildAskSlice;
10
11
  readonly visible: boolean;
11
12
  readonly onAnswer: () => void;
12
13
  }): React.ReactElement;
14
+ export declare function BuildAskRoom(): React.ReactElement;
13
15
  export declare function withBuildAskAnswer(composer: ComposerSlice, ask: BuildAskSlice | null | undefined): ComposerSlice;
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  export const BUILD_ASK_LINE = Object.freeze({ dismiss: "Not now" });
3
+ export const BUILD_ASK_FALLBACK = "While it builds, tell me what goes in it, and it opens with yours inside.";
3
4
  export const BUILD_ASK_LINE_CSS = `
4
5
  /* The build ask (#8951): the agent's one question under the first build's live
5
6
  line, in the live line's own type. The card's composer below takes the answer;
@@ -20,6 +21,11 @@ export function BuildAskLine(props) {
20
21
  React.createElement("button", { type: "button", className: "vm-build-ask-q", onClick: props.onAnswer }, props.ask.question),
21
22
  React.createElement("button", { type: "button", className: "vm-build-ask-x", "aria-label": BUILD_ASK_LINE.dismiss, onClick: props.ask.onDismiss }, "\u00D7")));
22
23
  }
24
+ export function BuildAskRoom() {
25
+ return (React.createElement("div", { className: "vm-build-ask", "data-build-ask-spacer": "", "aria-hidden": "true", inert: true, style: { visibility: "hidden" } },
26
+ React.createElement("button", { type: "button", className: "vm-build-ask-q", tabIndex: -1 }, BUILD_ASK_FALLBACK),
27
+ React.createElement("button", { type: "button", className: "vm-build-ask-x", tabIndex: -1 }, "\u00D7")));
28
+ }
23
29
  export function withBuildAskAnswer(composer, ask) {
24
30
  if (ask === undefined || ask === null)
25
31
  return composer;
@@ -41,6 +41,18 @@ function ridesAlong(text, files) {
41
41
  return text;
42
42
  return `${text} · with your ${files === 1 ? "file" : `${files} files`}`;
43
43
  }
44
+ function queueWaitCause(w) {
45
+ switch (true) {
46
+ case w.queued === 0:
47
+ return undefined;
48
+ case w.waitsOnHost && w.flushable:
49
+ return "gave_up";
50
+ case w.building:
51
+ return "stale_build";
52
+ default:
53
+ return undefined;
54
+ }
55
+ }
44
56
  export function draftYouLines(draft, log) {
45
57
  const counts = draft.queuedFiles;
46
58
  const queued = counts === undefined ? draft.queued : draft.queued.map((t, i) => ridesAlong(t, counts[i] ?? 0));
@@ -255,14 +267,16 @@ export function useComposerDraft(input) {
255
267
  const building = composer.cap === "Stop";
256
268
  const { sendsNow } = composer;
257
269
  const held = composer.hold !== undefined;
270
+ const waitsOnHost = composer.queuesRefusedSend === true;
271
+ const turnMark = composer.turnMark;
258
272
  const onSubmitRef = React.useRef(composer.onSubmit);
259
273
  const onQueueFlushedRef = React.useRef(composer.onQueueFlushed);
260
274
  React.useLayoutEffect(() => {
261
275
  onSubmitRef.current = composer.onSubmit;
262
276
  onQueueFlushedRef.current = composer.onQueueFlushed;
263
277
  });
278
+ const flushable = held === false && (sendsNow === true || building === false);
264
279
  React.useEffect(() => {
265
- const flushable = held === false && (sendsNow === true || building === false);
266
280
  if (flushable === false || queued.length === 0)
267
281
  return;
268
282
  const batch = queued.join("\n\n");
@@ -275,29 +289,28 @@ export function useComposerDraft(input) {
275
289
  setFlushAttempt(0);
276
290
  return;
277
291
  }
278
- if (flushAttempt >= QUEUE_FLUSH_MAX_ATTEMPTS) {
292
+ if (waitsOnHost === false && flushAttempt >= QUEUE_FLUSH_MAX_ATTEMPTS) {
279
293
  handBackQueue("gave_up", queued, files);
280
294
  return;
281
295
  }
282
296
  const timer = setTimeout(() => setFlushAttempt((n) => n + 1), QUEUE_FLUSH_RETRY_MS);
283
297
  return () => clearTimeout(timer);
284
- }, [building, sendsNow, held, queued, queuedFiles, flushAttempt]);
285
- const waitingOnBuild = building === true && queued.length > 0;
286
- const turnMark = composer.turnMark;
298
+ }, [flushable, queued, queuedFiles, flushAttempt, turnMark]);
299
+ const waitCause = queueWaitCause({ waitsOnHost, flushable, building, queued: queued.length });
287
300
  const queuedFilesRef = React.useRef(queuedFiles);
288
301
  React.useEffect(() => {
289
302
  queuedFilesRef.current = queuedFiles;
290
303
  }, [queuedFiles]);
291
304
  React.useEffect(() => {
292
- if (waitingOnBuild === false)
305
+ if (waitCause === undefined)
293
306
  return;
294
307
  const timer = setTimeout(() => {
295
308
  const pending = queuedRef.current;
296
309
  if (pending.length > 0)
297
- handBackQueue("stale_build", pending, queuedFilesRef.current);
310
+ handBackQueue(waitCause, pending, queuedFilesRef.current);
298
311
  }, QUEUE_STALE_BUILD_MS);
299
312
  return () => clearTimeout(timer);
300
- }, [waitingOnBuild, turnMark]);
313
+ }, [waitCause, turnMark]);
301
314
  function handBackQueue(cause, pending, files) {
302
315
  const batch = pending.join("\n\n");
303
316
  onQueueDroppedRef.current?.({ cause, messages: pending.length, kept: "field" });
@@ -1,4 +1,5 @@
1
1
  import { Result } from "@adviser/cement";
2
+ import type { ShareAppImageVariant } from "./slices.js";
2
3
  export interface ShareImageInput {
3
4
  readonly screenshotUrl: string | null;
4
5
  readonly title: string;
@@ -20,4 +21,8 @@ export interface ShareImageDeps {
20
21
  readonly encode?: (canvas: PngEncodable) => Promise<Result<Blob>>;
21
22
  readonly signal?: AbortSignal;
22
23
  }
23
- export declare function renderShareImage(input: ShareImageInput, deps?: ShareImageDeps): Promise<Result<Blob>>;
24
+ export interface ShareImage {
25
+ readonly blob: Blob;
26
+ readonly drawn: ShareAppImageVariant;
27
+ }
28
+ export declare function renderShareImage(input: ShareImageInput, deps?: ShareImageDeps): Promise<Result<ShareImage>>;
@@ -246,6 +246,9 @@ function renderPass(pass) {
246
246
  return pass.encode(canvas);
247
247
  });
248
248
  }
249
+ function drawnAs(res, drawn) {
250
+ return res.isErr() ? Result.Err(res.Err()) : Result.Ok({ blob: res.Ok(), drawn });
251
+ }
249
252
  export function renderShareImage(input, deps = {}) {
250
253
  return exception2Result(async () => {
251
254
  const encode = deps.encode ?? encodePng;
@@ -259,10 +262,10 @@ export function renderShareImage(input, deps = {}) {
259
262
  const first = await renderPass({ input, font, screenshot, encode });
260
263
  screenshot?.release();
261
264
  if (first.isOk() || screenshot === undefined)
262
- return first;
265
+ return drawnAs(first, screenshot === undefined ? "flat" : "screenshot");
263
266
  if (aborted(deps.signal))
264
267
  return Result.Err(new Error(ABORTED));
265
268
  console.warn("[renderShareImage] retrying without the screenshot:", first.Err().message);
266
- return renderPass({ input, font, screenshot: undefined, encode });
269
+ return drawnAs(await renderPass({ input, font, screenshot: undefined, encode }), "flat");
267
270
  });
268
271
  }
@@ -161,13 +161,25 @@ export type ShareEvent = {
161
161
  readonly surface: ShareSheetSurface;
162
162
  readonly outcome: "aborted" | "error";
163
163
  readonly errorName: ShareSheetErrorName;
164
+ } | {
165
+ readonly kind: "make-public";
166
+ readonly surface: "copy-line";
167
+ readonly postureState: AccessToggleState;
164
168
  } | {
165
169
  readonly kind: "note-opened";
166
170
  readonly surface: "email";
167
171
  } | {
168
172
  readonly kind: "image-failed";
169
173
  readonly surface: "app-image";
174
+ readonly image: ShareAppImageVariant;
175
+ readonly screenshotMissed?: true;
176
+ } | {
177
+ readonly kind: "image-loaded";
178
+ readonly surface: "app-image";
179
+ readonly image: ShareAppImageVariant;
180
+ readonly screenshotMissed?: true;
170
181
  };
182
+ export type ShareAppImageVariant = "flat" | "screenshot";
171
183
  export interface EmailInviteSent {
172
184
  readonly note?: "sent" | "dropped";
173
185
  }
@@ -228,6 +240,7 @@ export interface ShareSlice {
228
240
  app: ShareAppSlice | null;
229
241
  canManage: boolean;
230
242
  roster: readonly RosterMember[];
243
+ rosterState?: "loading" | "failed";
231
244
  members: {
232
245
  onData(key: string, g: "read" | "write"): Promise<Result<void>>;
233
246
  onCode(key: string, on: boolean): Promise<Result<void>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/base",
3
- "version": "14.3.344",
3
+ "version": "14.3.345",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -10,10 +10,10 @@
10
10
  "dependencies": {
11
11
  "@adviser/cement": "~0.5.37",
12
12
  "@emotion/css": "~11.13.5",
13
- "@vibes.diy/api-types": "14.3.344",
14
- "@vibes.diy/use-vibes-types": "14.3.344",
15
- "@vibes.diy/vibe-runtime": "14.3.344",
16
- "@vibes.diy/vibe-types": "14.3.344",
13
+ "@vibes.diy/api-types": "14.3.345",
14
+ "@vibes.diy/use-vibes-types": "14.3.345",
15
+ "@vibes.diy/vibe-runtime": "14.3.345",
16
+ "@vibes.diy/vibe-types": "14.3.345",
17
17
  "arktype": "~2.2.9",
18
18
  "officeparser": "~8.7.1",
19
19
  "qrcode-generator": "~2.0.4",