@vibes.diy/base 14.3.446 → 14.3.448

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.
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { useState, useCallback, useEffect, useMemo } from "react";
3
3
  import { getRegisteredVibeApi } from "@vibes.diy/vibe-runtime";
4
- import { IMG_GEN_PAUSED_MESSAGE, isCaptureRefused } from "@vibes.diy/vibe-types";
4
+ import { IMG_GEN_PAUSED_MESSAGE, IMG_GEN_WAITING_MESSAGE, isCaptureRefused } from "@vibes.diy/vibe-types";
5
5
  import { useImgGen } from "../hooks/img-gen/use-img-gen.js";
6
6
  import { usePictureSrc } from "../hooks/img-gen/use-picture-src.js";
7
7
  import { registeredPictureStore } from "../hooks/img-gen/local-pictures.js";
@@ -24,7 +24,7 @@ export function ImgGen({ prompt, _id: propId, images, database, className, alt,
24
24
  const [generationId, setGenerationId] = useState(undefined);
25
25
  const [tapGenerationId, setTapGenerationId] = useState(undefined);
26
26
  const [versionIndex, setVersionIndex] = useState(null);
27
- const { loading, progress, error, document, pending, needsTap, paused, previewUrl, mintedUrls, reportUnavailable } = useImgGen({
27
+ const { loading, progress, error, document, pending, needsTap, paused, waiting, previewUrl, mintedUrls, reportUnavailable } = useImgGen({
28
28
  prompt,
29
29
  _id: stableId,
30
30
  database: database,
@@ -112,7 +112,12 @@ export function ImgGen({ prompt, _id: propId, images, database, className, alt,
112
112
  React.createElement("div", { style: { fontSize: 14, marginTop: 8 } }, prompt)));
113
113
  }
114
114
  return (React.createElement("div", { className: className, style: { padding: 20, textAlign: "center", color: "#888" } },
115
- photoGoingIn && picture.unavailable === false ? (React.createElement(PhotoSteps, { safetyPassed: safetyPassed })) : (React.createElement("div", null, pending === true || picture.unavailable ? "Loading image..." : "Generating image...")),
115
+ photoGoingIn && picture.unavailable === false ? (React.createElement(PhotoSteps, { safetyPassed: safetyPassed })) : (React.createElement("div", null, pending === true || picture.unavailable
116
+ ? "Loading image..."
117
+ :
118
+ waiting === true
119
+ ? IMG_GEN_WAITING_MESSAGE
120
+ : "Generating image...")),
116
121
  React.createElement("div", { style: { fontSize: 14, marginTop: 8 } }, prompt)));
117
122
  }
118
123
  return (React.createElement("div", { style: { position: "relative", display: "inline-block" } },
@@ -104,6 +104,7 @@ export declare const GUEST_SIGN_IN_BONUS = "Sign in to keep your apps and get 1,
104
104
  export declare const GUEST_TURN_WALL: Readonly<{
105
105
  line: "Keep building with a free account. Your app and this prompt come with you, plus 1,000 bonus credits and 1,000 every month.";
106
106
  action: "Create free account";
107
+ heldChange: "Your change is ready, and it sends as soon as you’re in.";
107
108
  }>;
108
109
  export declare const GUEST_OUT_OF_CREDITS_LINE = "You\u2019ve used your guest credits. Builds we lost along the way were on us. Sign in to keep your apps and get 1,000 bonus credits, plus 1,000 every month.";
109
110
  export declare const GUEST_SHARE_ASK: Readonly<{
@@ -126,6 +126,7 @@ export const GUEST_SIGN_IN_BONUS = "Sign in to keep your apps and get 1,000 bonu
126
126
  export const GUEST_TURN_WALL = Object.freeze({
127
127
  line: `Keep building with a free account. Your app and this prompt come with you, plus 1,000 bonus credits and 1,000 every month.`,
128
128
  action: "Create free account",
129
+ heldChange: "Your change is ready, and it sends as soon as you’re in.",
129
130
  });
130
131
  export const GUEST_OUT_OF_CREDITS_LINE = `You’ve used your guest credits. Builds we lost along the way were on us. ${GUEST_SIGN_IN_BONUS}`;
131
132
  export const GUEST_SHARE_ASK = Object.freeze({
@@ -278,6 +278,8 @@ export function useImgGen(opts) {
278
278
  const myHandle = mountParams.viewerEnv?.viewer?.userHandle ?? (temporaryDraft ? "draft" : undefined);
279
279
  const [needsTap, setNeedsTap] = useState(false);
280
280
  const [paused, setPaused] = useState(undefined);
281
+ const [waiting, setWaiting] = useState(false);
282
+ const waitingGenRef = useRef(null);
281
283
  const playgroundModeRef = useRef(false);
282
284
  const tapSpentRef = useRef(undefined);
283
285
  const playgroundSpentKeyRef = useRef(undefined);
@@ -673,6 +675,8 @@ export function useImgGen(opts) {
673
675
  setProgress(10);
674
676
  setError(null);
675
677
  setPaused(undefined);
678
+ setWaiting(false);
679
+ waitingGenRef.current = null;
676
680
  const target = {
677
681
  dbName,
678
682
  docId: hostDocId,
@@ -687,6 +691,12 @@ export function useImgGen(opts) {
687
691
  model,
688
692
  target,
689
693
  ...(tapRun ? { userActivation: true } : {}),
694
+ onWaiting: (isWaiting) => {
695
+ if (currentGenRef.current !== genKey || unmountSignalRef.current.aborted)
696
+ return;
697
+ waitingGenRef.current = isWaiting ? genKey : null;
698
+ setWaiting(isWaiting);
699
+ },
690
700
  onPreview: (blob) => {
691
701
  if (currentGenRef.current !== genKey || unmountSignalRef.current.aborted)
692
702
  return;
@@ -697,6 +707,10 @@ export function useImgGen(opts) {
697
707
  setPreviewUrl(url);
698
708
  },
699
709
  }));
710
+ if (waitingGenRef.current === genKey) {
711
+ waitingGenRef.current = null;
712
+ setWaiting(false);
713
+ }
700
714
  if (rFiles.isErr()) {
701
715
  if (earlyPreviewRef.current?.genKey === genKey)
702
716
  dropEarlyPreview();
@@ -1103,6 +1117,7 @@ export function useImgGen(opts) {
1103
1117
  pending,
1104
1118
  needsTap,
1105
1119
  ...(paused !== undefined ? { paused } : {}),
1120
+ ...(waiting && loading ? { waiting: true } : {}),
1106
1121
  ...(previewUrl !== undefined ? { previewUrl } : {}),
1107
1122
  mintedUrls,
1108
1123
  reportUnavailable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/base",
3
- "version": "14.3.446",
3
+ "version": "14.3.448",
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.446",
14
- "@vibes.diy/use-vibes-types": "14.3.446",
15
- "@vibes.diy/vibe-runtime": "14.3.446",
16
- "@vibes.diy/vibe-types": "14.3.446",
13
+ "@vibes.diy/api-types": "14.3.448",
14
+ "@vibes.diy/use-vibes-types": "14.3.448",
15
+ "@vibes.diy/vibe-runtime": "14.3.448",
16
+ "@vibes.diy/vibe-types": "14.3.448",
17
17
  "arktype": "~2.2.9",
18
18
  "officeparser": "~8.8.0",
19
19
  "qrcode-generator": "~2.0.4",