@vibes.diy/base 2.0.3 → 2.0.7
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/README.md +6 -0
- package/components/ControlsBar.d.ts +20 -0
- package/components/ControlsBar.js +104 -0
- package/components/ControlsBar.js.map +1 -0
- package/components/ExpandedVibesPill.d.ts +7 -0
- package/components/ExpandedVibesPill.js +183 -0
- package/components/ExpandedVibesPill.js.map +1 -0
- package/components/ImgVibes.d.ts +14 -0
- package/components/ImgVibes.js +123 -0
- package/components/ImgVibes.js.map +1 -0
- package/components/ImgVibesUtils/AsyncImg.d.ts +7 -0
- package/components/ImgVibesUtils/AsyncImg.js +41 -0
- package/components/ImgVibesUtils/AsyncImg.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesDisplay.d.ts +3 -0
- package/components/ImgVibesUtils/ImgVibesDisplay.js +230 -0
- package/components/ImgVibesUtils/ImgVibesDisplay.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesDisplayPlaceholder.d.ts +3 -0
- package/components/ImgVibesUtils/ImgVibesDisplayPlaceholder.js +97 -0
- package/components/ImgVibesUtils/ImgVibesDisplayPlaceholder.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesDisplayUtils.d.ts +27 -0
- package/components/ImgVibesUtils/ImgVibesDisplayUtils.js +90 -0
- package/components/ImgVibesUtils/ImgVibesDisplayUtils.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesError.d.ts +3 -0
- package/components/ImgVibesUtils/ImgVibesError.js +9 -0
- package/components/ImgVibesUtils/ImgVibesError.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesFileDrop.d.ts +11 -0
- package/components/ImgVibesUtils/ImgVibesFileDrop.js +56 -0
- package/components/ImgVibesUtils/ImgVibesFileDrop.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesModal.d.ts +25 -0
- package/components/ImgVibesUtils/ImgVibesModal.js +67 -0
- package/components/ImgVibesUtils/ImgVibesModal.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesModeUtils.d.ts +9 -0
- package/components/ImgVibesUtils/ImgVibesModeUtils.js +58 -0
- package/components/ImgVibesUtils/ImgVibesModeUtils.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesPromptWaiting.d.ts +11 -0
- package/components/ImgVibesUtils/ImgVibesPromptWaiting.js +40 -0
- package/components/ImgVibesUtils/ImgVibesPromptWaiting.js.map +1 -0
- package/components/ImgVibesUtils/ImgVibesUploadWaiting.d.ts +16 -0
- package/components/ImgVibesUtils/ImgVibesUploadWaiting.js +154 -0
- package/components/ImgVibesUtils/ImgVibesUploadWaiting.js.map +1 -0
- package/components/ImgVibesUtils/index.d.ts +6 -0
- package/components/ImgVibesUtils/index.js +7 -0
- package/components/ImgVibesUtils/index.js.map +1 -0
- package/components/ImgVibesUtils/overlays/DeleteConfirmationOverlay.d.ts +9 -0
- package/components/ImgVibesUtils/overlays/DeleteConfirmationOverlay.js +31 -0
- package/components/ImgVibesUtils/overlays/DeleteConfirmationOverlay.js.map +1 -0
- package/components/ImgVibesUtils/overlays/ImageOverlay.d.ts +22 -0
- package/components/ImgVibesUtils/overlays/ImageOverlay.js +11 -0
- package/components/ImgVibesUtils/overlays/ImageOverlay.js.map +1 -0
- package/components/ImgVibesUtils/types.d.ts +29 -0
- package/components/ImgVibesUtils/types.js +2 -0
- package/components/ImgVibesUtils/types.js.map +1 -0
- package/components/ImgVibesUtils.d.ts +2 -0
- package/components/ImgVibesUtils.js +3 -0
- package/components/ImgVibesUtils.js.map +1 -0
- package/components/PromptBar.d.ts +11 -0
- package/components/PromptBar.js +24 -0
- package/components/PromptBar.js.map +1 -0
- package/components/VibesSwitch.js +2 -2
- package/components/VibesSwitch.js.map +1 -1
- package/components/VibesSwitch.styles.js +1 -1
- package/components/VibesSwitch.styles.js.map +1 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/index.js.map +1 -1
- package/hooks/img-vibes/index.d.ts +1 -0
- package/hooks/img-vibes/index.js +2 -0
- package/hooks/img-vibes/index.js.map +1 -0
- package/hooks/img-vibes/use-img-vibes.d.ts +2 -0
- package/hooks/img-vibes/use-img-vibes.js +94 -0
- package/hooks/img-vibes/use-img-vibes.js.map +1 -0
- package/hooks/img-vibes/utils.d.ts +12 -0
- package/hooks/img-vibes/utils.js +55 -0
- package/hooks/img-vibes/utils.js.map +1 -0
- package/index.d.ts +11 -0
- package/index.js +8 -0
- package/index.js.map +1 -1
- package/package.json +7 -2
- package/utils/debug.d.ts +2 -0
- package/utils/debug.js +8 -0
- package/utils/debug.js.map +1 -0
- package/utils/style-utils.d.ts +4 -0
- package/utils/style-utils.js +15 -0
- package/utils/style-utils.js.map +1 -0
- package/utils/styles.d.ts +325 -0
- package/utils/styles.js +328 -0
- package/utils/styles.js.map +1 -0
package/README.md
CHANGED
|
@@ -19,6 +19,12 @@ Create beautiful, interactive mini apps with zero setup. Your creations are auto
|
|
|
19
19
|
- Install with `pnpm i`
|
|
20
20
|
- Run `pnpm dev`
|
|
21
21
|
|
|
22
|
+
## Community
|
|
23
|
+
|
|
24
|
+
We are committed to providing a welcoming and inclusive environment for all contributors. Please review our [Code of Conduct](CODE_OF_CONDUCT.md) before participating.
|
|
25
|
+
|
|
26
|
+
Interested in contributing? Check out our [Contributing Guide](CONTRIBUTING.md) to get started.
|
|
27
|
+
|
|
22
28
|
## Your Work is Always Safe
|
|
23
29
|
|
|
24
30
|
Every app you create is automatically saved, so you can:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ImgVibesClasses } from "@vibes.diy/use-vibes-types";
|
|
3
|
+
interface ControlsBarProps {
|
|
4
|
+
readonly handleDeleteConfirm: () => void;
|
|
5
|
+
readonly handlePrevVersion: () => void;
|
|
6
|
+
readonly handleNextVersion: () => void;
|
|
7
|
+
readonly handleRegen: () => void;
|
|
8
|
+
readonly versionIndex: number;
|
|
9
|
+
readonly totalVersions: number;
|
|
10
|
+
readonly classes?: Partial<ImgVibesClasses>;
|
|
11
|
+
readonly showControls?: boolean;
|
|
12
|
+
readonly editedPrompt: string | null;
|
|
13
|
+
readonly promptText: string;
|
|
14
|
+
readonly progress?: number;
|
|
15
|
+
readonly showDelete?: boolean;
|
|
16
|
+
readonly versionFlash?: boolean;
|
|
17
|
+
readonly isRegenerating?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function ControlsBar({ handleDeleteConfirm, handlePrevVersion, handleNextVersion, handleRegen, versionIndex, totalVersions, classes, showControls, editedPrompt, promptText, progress, showDelete, versionFlash, isRegenerating }: ControlsBarProps): React.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { combineClasses, defaultClasses } from "../utils/style-utils.js";
|
|
3
|
+
import { imgVibesStyles, imgVibesTheme } from "../utils/styles.js";
|
|
4
|
+
import { logDebug } from "../utils/debug.js";
|
|
5
|
+
export function ControlsBar({ handleDeleteConfirm, handlePrevVersion, handleNextVersion, handleRegen, versionIndex, totalVersions, classes = defaultClasses, showControls = true, editedPrompt, promptText, progress = 100, showDelete = true, versionFlash = false, isRegenerating = false, }) {
|
|
6
|
+
const [showConfirmation, setShowConfirmation] = React.useState(false);
|
|
7
|
+
const cancelTimerRef = React.useRef(null);
|
|
8
|
+
const isConfirming = showConfirmation;
|
|
9
|
+
const onDeleteClick = () => {
|
|
10
|
+
if (isConfirming) {
|
|
11
|
+
logDebug("ControlsBar: Delete confirmed, calling handleDeleteConfirm");
|
|
12
|
+
handleDeleteConfirm();
|
|
13
|
+
setShowConfirmation(false);
|
|
14
|
+
if (cancelTimerRef.current) {
|
|
15
|
+
window.clearTimeout(cancelTimerRef.current);
|
|
16
|
+
cancelTimerRef.current = null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
logDebug("ControlsBar: Showing delete confirmation");
|
|
21
|
+
setShowConfirmation(true);
|
|
22
|
+
cancelTimerRef.current = window.setTimeout(() => {
|
|
23
|
+
setShowConfirmation(false);
|
|
24
|
+
}, 6500);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
return () => {
|
|
29
|
+
if (cancelTimerRef.current) {
|
|
30
|
+
window.clearTimeout(cancelTimerRef.current);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
return (React.createElement(React.Fragment, null,
|
|
35
|
+
progress < 100 && (React.createElement("div", { className: "imggen-progress", style: {
|
|
36
|
+
...imgVibesStyles.progress,
|
|
37
|
+
width: `${progress}%`,
|
|
38
|
+
} })),
|
|
39
|
+
React.createElement("div", { className: combineClasses(classes.controls), style: imgVibesStyles.controls }, showControls ? (React.createElement(React.Fragment, null,
|
|
40
|
+
React.createElement("div", { style: {
|
|
41
|
+
display: "flex",
|
|
42
|
+
gap: "6px",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
justifyContent: "flex-start",
|
|
45
|
+
} }, showDelete && (React.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px" } },
|
|
46
|
+
React.createElement("button", { "aria-label": "Delete image", onClick: onDeleteClick, className: combineClasses("imggen-button imggen-delete-button", classes.button), style: {
|
|
47
|
+
...imgVibesStyles.button,
|
|
48
|
+
position: "static",
|
|
49
|
+
top: "auto",
|
|
50
|
+
right: "auto",
|
|
51
|
+
backgroundColor: isConfirming ? imgVibesTheme.colors.errorBorder : imgVibesStyles.button.background,
|
|
52
|
+
color: isConfirming ? "white" : imgVibesStyles.button.color,
|
|
53
|
+
opacity: isConfirming ? 1 : imgVibesStyles.button.opacity,
|
|
54
|
+
} }, "\u2715"),
|
|
55
|
+
isConfirming && (React.createElement("div", { className: "fade-transition", style: { animationDelay: "6s" } },
|
|
56
|
+
React.createElement("button", { onClick: () => {
|
|
57
|
+
handleDeleteConfirm();
|
|
58
|
+
setShowConfirmation(false);
|
|
59
|
+
}, "aria-label": "Confirm delete", style: {
|
|
60
|
+
fontSize: imgVibesTheme.typography.fontSize,
|
|
61
|
+
fontWeight: "bold",
|
|
62
|
+
whiteSpace: "nowrap",
|
|
63
|
+
border: `1px solid ${imgVibesTheme.colors.errorBorder}`,
|
|
64
|
+
background: imgVibesTheme.colors.errorBorder,
|
|
65
|
+
color: "white",
|
|
66
|
+
borderRadius: imgVibesTheme.dimensions.borderRadius,
|
|
67
|
+
cursor: "pointer",
|
|
68
|
+
padding: "2px 8px",
|
|
69
|
+
} }, "Delete image?"),
|
|
70
|
+
React.createElement("button", { onClick: () => {
|
|
71
|
+
logDebug("ControlsBar: Delete canceled");
|
|
72
|
+
setShowConfirmation(false);
|
|
73
|
+
if (cancelTimerRef.current) {
|
|
74
|
+
window.clearTimeout(cancelTimerRef.current);
|
|
75
|
+
}
|
|
76
|
+
}, "aria-label": "Cancel delete", style: {
|
|
77
|
+
fontSize: imgVibesTheme.typography.fontSize,
|
|
78
|
+
whiteSpace: "nowrap",
|
|
79
|
+
border: "none",
|
|
80
|
+
background: "none",
|
|
81
|
+
color: imgVibesTheme.colors.text,
|
|
82
|
+
cursor: "pointer",
|
|
83
|
+
padding: "0 4px",
|
|
84
|
+
} }, "Cancel")))))),
|
|
85
|
+
React.createElement("div", { className: "imggen-control-group", style: imgVibesStyles.controlGroup },
|
|
86
|
+
totalVersions > 1 && (React.createElement("button", { "aria-label": "Previous version", disabled: versionIndex === 0, onClick: handlePrevVersion, className: combineClasses("imggen-button", classes.button), style: imgVibesStyles.button }, "\u25C0\uFE0E")),
|
|
87
|
+
totalVersions > 1 && (React.createElement("span", { className: `imggen-version-indicator version-indicator ${versionFlash ? "imggen-version-flash" : ""}`, "aria-live": "polite" },
|
|
88
|
+
versionIndex + 1,
|
|
89
|
+
" / ",
|
|
90
|
+
totalVersions)),
|
|
91
|
+
totalVersions > 1 && (React.createElement("button", { "aria-label": "Next version", disabled: versionIndex >= totalVersions - 1, onClick: handleNextVersion, className: combineClasses("imggen-button", classes.button), style: imgVibesStyles.button }, "\u25B6\uFE0E")),
|
|
92
|
+
React.createElement("button", { "aria-label": "Regenerate image", onClick: () => {
|
|
93
|
+
handleRegen();
|
|
94
|
+
}, disabled: isRegenerating, className: combineClasses("imggen-button", classes.button, editedPrompt !== null && editedPrompt.trim() !== promptText ? "imggen-button-highlight" : "", isRegenerating ? "imggen-button-disabled" : ""), style: {
|
|
95
|
+
...imgVibesStyles.button,
|
|
96
|
+
backgroundColor: editedPrompt !== null && editedPrompt.trim() !== promptText
|
|
97
|
+
? imgVibesTheme.colors.accent
|
|
98
|
+
: imgVibesStyles.button.background,
|
|
99
|
+
opacity: isRegenerating ? 0.3 : imgVibesStyles.button.opacity,
|
|
100
|
+
cursor: isRegenerating ? "not-allowed" : imgVibesStyles.button.cursor,
|
|
101
|
+
} },
|
|
102
|
+
React.createElement("span", { className: isRegenerating ? "imggen-regen-spinning" : "" }, "\u27F3"))))) : progress < 100 ? (React.createElement("div", { className: "imggen-status-text", style: imgVibesStyles.statusText }, "Generating...")) : null)));
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=ControlsBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControlsBar.js","sourceRoot":"","sources":["../../jsr/components/ControlsBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAiC7C,MAAM,UAAU,WAAW,CAAC,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,OAAO,GAAG,cAAc,EACxB,YAAY,GAAG,IAAI,EACnB,YAAY,EACZ,UAAU,EACV,QAAQ,GAAG,GAAG,EACd,UAAU,GAAG,IA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AAM;qBACtE;oBAED,8BAAM,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,aAAU,CACjE,CACL,CACL,CACJ,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,CACnB,6BAAK,SAAS,EAAC,oBAAoB,EAAC,KAAK,EAAE,cAAc,CAAC,UAAU,oBAE9D,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACL,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { switchColors } from "./VibesSwitch.styles.js";
|
|
3
|
+
function PillActionButton({ height, label, icon, bgColor, labelColor, onClick, }) {
|
|
4
|
+
const [hovered, setHovered] = useState(false);
|
|
5
|
+
const btnWidth = height * 0.75;
|
|
6
|
+
return (React.createElement("button", { type: "button", onClick: onClick, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), style: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
justifyContent: "center",
|
|
10
|
+
height: "100%",
|
|
11
|
+
border: "none",
|
|
12
|
+
cursor: "pointer",
|
|
13
|
+
overflow: "hidden",
|
|
14
|
+
padding: 0,
|
|
15
|
+
background: bgColor,
|
|
16
|
+
borderRadius: 0,
|
|
17
|
+
transition: "width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
18
|
+
width: hovered ? height * 1.8 : btnWidth,
|
|
19
|
+
flexShrink: 0,
|
|
20
|
+
} },
|
|
21
|
+
React.createElement("div", { style: {
|
|
22
|
+
width: btnWidth,
|
|
23
|
+
height: "100%",
|
|
24
|
+
display: "flex",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
justifyContent: "center",
|
|
27
|
+
flexShrink: 0,
|
|
28
|
+
} },
|
|
29
|
+
React.createElement("svg", { width: height * 0.55 * 0.75, height: height * 0.55 * 0.75, viewBox: "0 0 35 35", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
30
|
+
React.createElement("circle", { cx: "17.5", cy: "17.5", r: "17.5", fill: "var(--vibes-near-black, #1a1a1a)" }),
|
|
31
|
+
React.createElement("foreignObject", { x: "7", y: "7", width: "21", height: "21" },
|
|
32
|
+
React.createElement("div", { style: {
|
|
33
|
+
display: "flex",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "center",
|
|
36
|
+
width: "100%",
|
|
37
|
+
height: "100%",
|
|
38
|
+
color: "var(--vibes-cream, #FFFEF0)",
|
|
39
|
+
} }, icon)))),
|
|
40
|
+
React.createElement("span", { style: {
|
|
41
|
+
color: labelColor || "var(--vibes-near-black, #1a1a1a)",
|
|
42
|
+
fontSize: height * 0.16,
|
|
43
|
+
fontWeight: 700,
|
|
44
|
+
whiteSpace: "nowrap",
|
|
45
|
+
textTransform: "uppercase",
|
|
46
|
+
letterSpacing: "1.5px",
|
|
47
|
+
opacity: hovered ? 1 : 0,
|
|
48
|
+
width: hovered ? "auto" : 0,
|
|
49
|
+
maxWidth: hovered ? 120 : 0,
|
|
50
|
+
padding: hovered ? "0 14px 0 4px" : 0,
|
|
51
|
+
overflow: "hidden",
|
|
52
|
+
transition: "all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
53
|
+
fontFamily: "'Inter', sans-serif",
|
|
54
|
+
} }, label)));
|
|
55
|
+
}
|
|
56
|
+
const outerPath = "M293.353,298.09c-41.038,0-82.078,0.125-123.115-0.077c-11.993-0.06-24.011-0.701-35.964-1.703c-15.871-1.331-29.73-7.937-41.948-17.946c-16.769-13.736-27.207-31.417-30.983-52.7c-4.424-24.93,1.404-47.685,16.506-67.913c11.502-15.407,26.564-26.1,45.258-30.884c7.615-1.949,15.631-2.91,23.501-3.165c20.08-0.652,40.179-0.853,60.271-0.879c69.503-0.094,139.007-0.106,208.51,0.02c14.765,0.026,29.583,0.097,44.28,1.313c36.984,3.059,61.78,23.095,74.653,57.301c17.011,45.199-8.414,96.835-54.29,111.864c-7.919,2.595-16.165,3.721-24.434,3.871c-25.614,0.467-51.234,0.742-76.853,0.867C350.282,298.197,321.817,298.09,293.353,298.09z";
|
|
57
|
+
const diyD = "M426.866,285.985c-7.999-0.416-19.597-0.733-31.141-1.687c-15.692-1.297-28.809-8.481-40.105-19.104c-12.77-12.008-20.478-26.828-22.714-44.177c-3.048-23.644,3.384-44.558,19.646-62.143c9.174-9.92,20.248-17.25,33.444-20.363c7.786-1.837,15.944-2.399,23.973-2.828c9.988-0.535,20.023-0.666,30.021-0.371c10.191,0.301,20.433,0.806,30.521,2.175c12.493,1.696,23.132,7.919,32.552,16.091c14.221,12.337,22.777,27.953,25.184,46.594c2.822,21.859-2.605,41.617-16.777,58.695c-9.494,11.441-21.349,19.648-35.722,23.502c-6.656,1.785-13.724,2.278-20.647,2.77C446.914,285.721,438.682,285.667,426.866,285.985z";
|
|
58
|
+
const vibesD = "M165.866,285.985c-7.999-0.416-19.597-0.733-31.141-1.687c-15.692-1.297-28.809-8.481-40.105-19.104c-12.77-12.008-20.478-26.828-22.714-44.177c-3.048-23.644,3.384-44.558,19.646-62.143c9.174-9.92,20.248-17.25,33.444-20.363c7.786-1.837,15.944-2.399,23.973-2.828c9.988-0.535,111.023-0.666,121.021-0.371c10.191,0.301,20.433,0.806,30.521,2.175c12.493,1.696,23.132,7.919,32.552,16.091c14.221,12.337,22.777,27.953,25.184,46.594c2.822,21.859-2.605,41.617-16.777,58.695c-9.494,11.441-21.349,19.648-35.722,23.502c-6.656,1.785-13.724,2.278-20.647,2.77C276.914,285.721,177.682,285.667,165.866,285.985z";
|
|
59
|
+
const vibesLetters = [
|
|
60
|
+
{
|
|
61
|
+
delay: "0.5s",
|
|
62
|
+
d: "M181.891,205.861c0-5.043-0.001-10.086,0-15.129c0.001-5.046,1.679-7.539,6.606-7.695c9.292-0.294,18.653-1.051,27.888,0.707c7.614,1.449,11.523,5.954,11.902,13.446c0.066,1.312-0.313,2.752-0.857,3.966c-1.401,3.123-1.399,6.266-0.673,9.507c0.301,1.342,0.443,2.723,0.787,4.053c1.274,4.925-1.78,10.114-6.085,11.937c-3.111,1.318-6.561,2.327-9.909,2.497c-7.303,0.37-14.639,0.136-21.96,0.101c-1.165-0.005-2.345-0.181-3.488-0.422c-2.657-0.56-4.162-2.962-4.197-6.801C181.854,216.639,181.891,211.25,181.891,205.861z M204.442,192.385c-2.757,0-5.514,0-8.271,0c-3.695,0-5.151,1.669-4.712,5.403c0.369,3.14,1.05,3.735,4.225,3.737c5.024,0.004,10.05,0.109,15.07-0.014c2.028-0.05,4.167-0.27,6.04-0.98c3.182-1.207,3.639-4.256,1.008-6.455c-1.073-0.896-2.659-1.509-4.06-1.618C210.659,192.22,207.544,192.385,204.442,192.385z M204.334,211.104c0,0.045,0,0.091,0,0.137c-3.101,0-6.203-0.055-9.302,0.037c-0.823,0.024-2.257,0.373-2.344,0.794c-0.447,2.154-0.959,4.444-0.639,6.563c0.276,1.822,2.447,1.451,3.882,1.441c5.989-0.042,11.98-0.118,17.961-0.385c1.416-0.063,2.859-0.79,4.176-1.441c1.79-0.886,1.833-2.475,1.029-4.046c-1.166-2.276-3.297-3.024-5.677-3.081C210.394,211.049,207.363,211.104,204.334,211.104z",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
delay: "0.8s",
|
|
66
|
+
d: "M291.409,229.748c-3.621-0.394-7.838-0.587-11.94-1.379c-3.577-0.69-6.343-2.991-8.213-6.163c-1.763-2.99-0.301-5.6,3.139-5.292c2.287,0.205,4.512,1.129,6.758,1.755c6.281,1.751,12.643,1.892,19.053,0.951c0.667-0.098,1.31-0.416,1.941-0.686c1.502-0.644,2.55-1.682,2.581-3.415c0.031-1.74-1.195-2.749-2.579-3.132c-2.298-0.637-4.688-1.021-7.065-1.273c-5.062-0.536-10.252-0.401-15.187-1.475c-9.677-2.105-11.678-10.53-10.101-16.009c1.62-5.625,5.911-8.92,11.318-9.73c8.388-1.257,16.925-1.491,25.279,0.654c3.702,0.951,6.615,3.072,7.883,6.931c0.918,2.792-0.332,4.6-3.268,4.357c-1.684-0.139-3.367-0.676-4.974-1.248c-6.711-2.387-13.572-2.897-20.569-1.783c-1.001,0.159-2.146,0.414-2.875,1.034c-0.901,0.766-2.016,1.981-1.98,2.964c0.041,1.128,0.995,2.733,1.991,3.206c1.81,0.857,3.925,1.279,5.948,1.441c5.152,0.41,10.356,0.296,15.479,0.905c7.98,0.949,13.779,9.833,11.241,17.125c-1.959,5.628-6.44,8.489-12.143,9.322C299.455,229.344,295.715,229.419,291.409,229.748z",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
delay: "1.2s",
|
|
70
|
+
d: "M235.786,208.14c0-6.905-0.01-13.809,0.004-20.714c0.007-3.474,0.948-4.428,4.415-3.758c6.62,1.279,13.232,2.651,19.759,4.331c1.7,0.438,3.404,1.896,4.515,3.341c1.777,2.31,0.433,5.367-2.463,5.745c-1.86,0.243-3.819-0.138-5.717-0.368c-2.183-0.264-4.339-0.783-6.525-0.976c-1.572-0.138-3.065,0.375-3.8,1.959c-0.76,1.638-0.319,3.329,0.942,4.34c1.619,1.296,3.522,2.327,5.447,3.128c2.146,0.894,4.539,1.207,6.66,2.145c1.446,0.64,2.982,1.687,3.786,2.981c0.689,1.11,0.928,3.094,0.378,4.202c-0.492,0.991-2.32,1.795-3.579,1.825c-2.238,0.052-4.483-0.652-6.741-0.832c-1.614-0.127-3.333-0.203-4.865,0.212c-2.574,0.699-3.225,3.013-1.719,5.218c1.396,2.044,3.431,3.141,5.757,3.761c2.791,0.744,5.637,1.315,8.373,2.222c3.19,1.058,4.791,3.496,4.801,6.723c0.011,3.365-1.759,5.021-5.138,4.424c-4.402-0.778-8.759-1.81-13.134-2.735c-2.357-0.499-4.718-0.981-7.069-1.511c-3.263-0.737-4.132-1.805-4.141-5.154c-0.019-6.836-0.006-13.672-0.006-20.508C235.747,208.141,235.766,208.14,235.786,208.14z",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
delay: "0.6s",
|
|
74
|
+
d: "M135.138,229.842c-2.941-0.084-5.296-1.462-6.684-3.9c-1.827-3.21-3.328-6.618-4.81-10.011c-3.55-8.128-7.021-16.291-10.486-24.455c-0.48-1.132-0.902-2.329-1.087-3.536c-0.417-2.72,1.238-4.585,3.938-4.119c1.591,0.275,3.569,0.98,4.45,2.173c2.226,3.015,4.175,6.299,5.784,9.69c2.208,4.654,3.898,9.552,6.032,14.244c0.628,1.379,2.009,2.416,3.045,3.609c0.892-1.159,2.042-2.201,2.63-3.498c2.697-5.953,5.22-11.985,7.841-17.974c1.423-3.252,3.089-6.418,6.532-7.905c1.238-0.535,3.012-0.712,4.184-0.214c0.81,0.344,1.377,2.126,1.385,3.271c0.009,1.458-0.479,2.997-1.059,4.371c-4.227,10.013-8.504,20.005-12.833,29.974c-0.79,1.819-1.762,3.589-2.875,5.229C139.73,228.848,137.671,229.894,135.138,229.842z",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
delay: "1.3s",
|
|
78
|
+
d: "M164.636,206.263c0-6.691,0.054-13.383-0.036-20.073c-0.024-1.851,0.716-2.67,2.449-2.81c0.274-0.022,0.549-0.054,0.823-0.076c5.488-0.445,6.091,0.105,6.091,5.562c0,12.348,0,24.695,0,37.043c0,2.887-0.354,3.405-3.222,3.618c-1.628,0.121-3.338-0.001-4.91-0.408c-0.593-0.153-1.265-1.408-1.278-2.171c-0.096-5.584-0.034-11.172-0.022-16.759c0.002-1.308,0-2.617,0-3.926C164.566,206.263,164.601,206.263,164.636,206.263z",
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
const diyLetters = [
|
|
82
|
+
{
|
|
83
|
+
d: "M388.313,210.147c0-6.356,0.034-12.713-0.023-19.069c-0.015-1.61,0.359-2.472,2.19-2.346c2.887,0.198,5.809,0.045,8.671,0.398c4.396,0.542,8.019,4.294,8.144,8.904c0.223,8.142,0.265,16.304-0.074,24.439c-0.248,5.945-4.552,9.662-10.491,9.831c-1.999,0.057-4.003-0.081-6.006-0.09c-1.746-0.008-2.439-0.853-2.428-2.584C388.34,223.136,388.313,216.642,388.313,210.147z M393.418,210.324c-0.037,0-0.075,0-0.114,0c0,4.55-0.038,9.101,0.015,13.65c0.031,2.688,0.926,3.439,3.56,3.239c3.273-0.248,5.493-2.511,5.534-6.04c0.082-7.099,0.054-14.2-0.033-21.299c-0.041-3.268-1.739-5.241-4.87-6.092c-2.68-0.728-4.025,0.161-4.07,2.896C393.364,201.226,393.418,205.775,393.418,210.324z",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
d: "M478.079,200.8c0.674-1.566,1.121-2.53,1.506-3.519c0.673-1.73,1.252-3.5,1.981-5.205c0.315-0.737,0.766-1.654,1.407-1.961c1.094-0.523,2.388-0.63,3.598-0.912c0.205,1.142,0.798,2.381,0.537,3.404c-0.606,2.388-1.448,4.756-2.507,6.984c-3.981,8.389-4.352,17.254-3.78,26.282c0.091,1.438,0.031,2.899-0.105,4.335c-0.14,1.473-0.989,2.428-2.542,2.497c-1.514,0.067-2.311-0.903-2.54-2.23c-0.232-1.348-0.394-2.754-0.277-4.108c0.94-10.972-1.116-21.38-5.626-31.375c-0.586-1.298-0.899-2.762-1.093-4.183c-0.233-1.712,0.825-2.592,2.379-1.843c1.164,0.561,2.345,1.55,2.973,2.657c1.078,1.897,1.712,4.043,2.568,6.07C476.918,198.547,477.37,199.361,478.079,200.8z",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
d: "M440.516,210.627c0,6.281,0.007,12.563-0.004,18.844c-0.004,2.067-0.805,3.038-2.531,3.015c-1.877-0.025-2.365-1.136-2.359-2.876c0.046-12.631,0.019-25.263,0.029-37.895c0.002-2.592,0.525-3.205,2.419-3.148c1.856,0.057,2.479,1.03,2.466,2.803C440.484,197.788,440.515,204.208,440.516,210.627z",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
d: "M416.875,210.721c0.068-3.305,1.849-5.306,4.727-5.309c2.765-0.003,4.924,2.404,4.816,5.371c-0.106,2.956-2.355,5.212-5.12,5.138C418.626,215.849,416.813,213.718,416.875,210.721z",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
d: "M449.933,210.636c0.102-3.331,1.886-5.279,4.778-5.22c2.67,0.055,4.829,2.432,4.762,5.243c-0.073,3.021-2.404,5.36-5.242,5.261C451.606,215.829,449.84,213.657,449.933,210.636z",
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
export function ExpandedVibesPill({ size = 75, className, onRemix }) {
|
|
99
|
+
const [phase, setPhase] = useState("idle");
|
|
100
|
+
const handleClick = () => {
|
|
101
|
+
if (phase === "idle")
|
|
102
|
+
setPhase("bubble");
|
|
103
|
+
else if (phase === "open")
|
|
104
|
+
setPhase("collapsing");
|
|
105
|
+
};
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
let t;
|
|
108
|
+
if (phase === "bubble")
|
|
109
|
+
t = setTimeout(() => setPhase("expanding"), 250);
|
|
110
|
+
else if (phase === "expanding")
|
|
111
|
+
t = setTimeout(() => setPhase("open"), 500);
|
|
112
|
+
else if (phase === "collapsing")
|
|
113
|
+
t = setTimeout(() => setPhase("shrinking"), 400);
|
|
114
|
+
else if (phase === "shrinking")
|
|
115
|
+
t = setTimeout(() => setPhase("idle"), 300);
|
|
116
|
+
return () => clearTimeout(t);
|
|
117
|
+
}, [phase]);
|
|
118
|
+
const numericSize = typeof size === "number" ? size : parseFloat(size) || 75;
|
|
119
|
+
const height = numericSize;
|
|
120
|
+
const scale = height / 300;
|
|
121
|
+
const showBubble = phase !== "idle";
|
|
122
|
+
const expanded = phase === "expanding" || phase === "open";
|
|
123
|
+
const shrinking = phase === "shrinking";
|
|
124
|
+
const buttonsVisible = phase === "open";
|
|
125
|
+
const creamSlid = phase !== "idle" && phase !== "shrinking";
|
|
126
|
+
const pillWidth = 600 * scale;
|
|
127
|
+
const btnWidth = height * 0.75;
|
|
128
|
+
const btnExpandedWidth = height * 1.8;
|
|
129
|
+
const visibleButtons = 1;
|
|
130
|
+
const btnPadding = 10;
|
|
131
|
+
const trayExtra = btnExpandedWidth + btnWidth * (visibleButtons - 1) + btnPadding;
|
|
132
|
+
const trayCollapsed = pillWidth + 8;
|
|
133
|
+
const trayExpanded = pillWidth + trayExtra + 8;
|
|
134
|
+
return (React.createElement("div", { style: { position: "relative", display: "inline-block", cursor: "pointer" }, onClick: handleClick },
|
|
135
|
+
React.createElement("div", { style: {
|
|
136
|
+
position: "absolute",
|
|
137
|
+
top: 123 * scale - 4,
|
|
138
|
+
right: -4,
|
|
139
|
+
height: 175 * scale + 8,
|
|
140
|
+
width: expanded ? trayExpanded : trayCollapsed,
|
|
141
|
+
zIndex: 1,
|
|
142
|
+
background: "var(--vibes-cream, #FFFEF0)",
|
|
143
|
+
border: "1px solid var(--vibes-near-black, #1a1a1a)",
|
|
144
|
+
borderRadius: `${87 * scale + 4}px`,
|
|
145
|
+
transformOrigin: `calc(100% - ${300 * scale}px) center`,
|
|
146
|
+
transform: shrinking ? "scale(0)" : showBubble ? "scale(1)" : "scale(0)",
|
|
147
|
+
opacity: showBubble ? 1 : 0,
|
|
148
|
+
transition: phase === "shrinking"
|
|
149
|
+
? "transform 0.25s ease, opacity 0.01s ease 0.25s"
|
|
150
|
+
: phase === "collapsing"
|
|
151
|
+
? "width 0.4s ease"
|
|
152
|
+
: phase === "bubble"
|
|
153
|
+
? "transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.01s ease"
|
|
154
|
+
: "width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
155
|
+
overflow: "hidden",
|
|
156
|
+
display: "flex",
|
|
157
|
+
alignItems: "center",
|
|
158
|
+
justifyContent: "flex-start",
|
|
159
|
+
padding: 0,
|
|
160
|
+
gap: 0,
|
|
161
|
+
boxSizing: "border-box",
|
|
162
|
+
} },
|
|
163
|
+
React.createElement("div", { style: {
|
|
164
|
+
display: "flex",
|
|
165
|
+
height: "100%",
|
|
166
|
+
gap: 0,
|
|
167
|
+
opacity: buttonsVisible ? 1 : 0,
|
|
168
|
+
transition: "opacity 0.3s ease",
|
|
169
|
+
pointerEvents: buttonsVisible ? "auto" : "none",
|
|
170
|
+
} },
|
|
171
|
+
React.createElement(PillActionButton, { height: height, label: "Remix", bgColor: "var(--vibes-yellow, #fedd00)", labelColor: "var(--vibes-near-black, #1a1a1a)", onClick: (e) => {
|
|
172
|
+
e.stopPropagation();
|
|
173
|
+
onRemix?.();
|
|
174
|
+
}, icon: React.createElement("svg", { width: "13", height: "13", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
175
|
+
React.createElement("path", { d: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" }),
|
|
176
|
+
React.createElement("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" })) }))),
|
|
177
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", height: height, viewBox: "0 0 600 300", fill: "currentColor", className: className, style: { position: "relative", zIndex: 2 } },
|
|
178
|
+
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", fill: "#000", d: outerPath }),
|
|
179
|
+
React.createElement("path", { fill: switchColors.secondary, fillRule: "evenodd", clipRule: "evenodd", d: creamSlid ? vibesD : diyD, style: { transition: "d 0.4s ease, transform 0.4s ease", transform: creamSlid ? "translateX(3px)" : "none" } }),
|
|
180
|
+
vibesLetters.map((l, i) => (React.createElement("path", { key: `v${i}`, fillRule: "evenodd", clipRule: "evenodd", style: { transition: `fill ${l.delay} ease`, fill: creamSlid ? switchColors.primary : switchColors.secondary }, d: l.d }))),
|
|
181
|
+
diyLetters.map((l, i) => (React.createElement("path", { key: `d${i}`, fillRule: "evenodd", clipRule: "evenodd", style: { transition: "fill 1s ease", fill: creamSlid ? switchColors.secondary : switchColors.primary }, d: l.d }))))));
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=ExpandedVibesPill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandedVibesPill.js","sourceRoot":"","sources":["../../jsr/components/ExpandedVibesPill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQvD,SAAS,gBAAgB,CAAC,EACxB,MAAM,EACN,KAAK,EACL,IAAI,EACJ,OAAO,EACP,UAAU,EACV,OAAO,GAQR;IACC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,CACL,gCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EACpC,YAAY,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EACrC,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,SAAS;YACjB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,CAAC;YACV,UAAU,EAAE,OAAO;YACnB,YAAY,EAAE,CAAC;YACf,UAAU,EAAE,8CAA8C;YAC1D,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ;YACxC,UAAU,EAAE,CAAC;SACd;QAED,6BACE,KAAK,EAAE;gBACL,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,QAAQ;gBACpB,cAAc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|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Database } from "@fireproof/use-fireproof";
|
|
3
|
+
export interface ImgVibesProps {
|
|
4
|
+
prompt?: string;
|
|
5
|
+
_id?: string;
|
|
6
|
+
images?: File[];
|
|
7
|
+
database?: string | Database;
|
|
8
|
+
className?: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
showControls?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function ImgVibes({ prompt, _id: propId, images, database, className, alt, style, showControls }: ImgVibesProps): React.JSX.Element;
|
|
14
|
+
export default ImgVibes;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { useState, useCallback, useMemo } from "react";
|
|
2
|
+
import { useImgVibes } from "../hooks/img-vibes/use-img-vibes.js";
|
|
3
|
+
function promptToId(prompt) {
|
|
4
|
+
let hash = 0x811c9dc5;
|
|
5
|
+
for (let i = 0; i < prompt.length; i++) {
|
|
6
|
+
hash ^= prompt.charCodeAt(i);
|
|
7
|
+
hash = Math.imul(hash, 0x01000193);
|
|
8
|
+
}
|
|
9
|
+
return `img-${(hash >>> 0).toString(36)}`;
|
|
10
|
+
}
|
|
11
|
+
export function ImgVibes({ prompt, _id: propId, images, database, className, alt, style, showControls = true }) {
|
|
12
|
+
const inputImage = images?.[0];
|
|
13
|
+
const imageKey = inputImage ? `${inputImage.name}-${inputImage.size}-${inputImage.lastModified}` : "";
|
|
14
|
+
const stableId = useMemo(() => propId ?? (prompt ? promptToId(prompt + imageKey) : undefined), [propId, prompt, imageKey]);
|
|
15
|
+
const [generationId, setGenerationId] = useState(undefined);
|
|
16
|
+
const [versionIndex, setVersionIndex] = useState(null);
|
|
17
|
+
const { assetUrl, loading, progress, error, document } = useImgVibes({
|
|
18
|
+
prompt,
|
|
19
|
+
_id: stableId,
|
|
20
|
+
database,
|
|
21
|
+
skip: !prompt && !stableId,
|
|
22
|
+
generationId,
|
|
23
|
+
inputImage,
|
|
24
|
+
});
|
|
25
|
+
const versions = document?.versions ?? [];
|
|
26
|
+
const currentVersion = versionIndex ?? document?.currentVersion ?? 0;
|
|
27
|
+
const fallbackAssetUrl = versions[document?.currentVersion ?? 0]?.assetUrl;
|
|
28
|
+
const displayUrl = versionIndex !== null ? versions[versionIndex]?.assetUrl : (assetUrl ?? fallbackAssetUrl);
|
|
29
|
+
const hasMultipleVersions = versions.length > 1;
|
|
30
|
+
const hasExistingImage = versions.length > 0 && !!displayUrl;
|
|
31
|
+
const handleRegen = useCallback(() => {
|
|
32
|
+
setGenerationId(crypto.randomUUID());
|
|
33
|
+
setVersionIndex(null);
|
|
34
|
+
}, []);
|
|
35
|
+
const handlePrev = useCallback(() => {
|
|
36
|
+
setVersionIndex((prev) => {
|
|
37
|
+
const cur = prev ?? document?.currentVersion ?? 0;
|
|
38
|
+
return cur > 0 ? cur - 1 : cur;
|
|
39
|
+
});
|
|
40
|
+
}, [document?.currentVersion]);
|
|
41
|
+
const handleNext = useCallback(() => {
|
|
42
|
+
setVersionIndex((prev) => {
|
|
43
|
+
const cur = prev ?? document?.currentVersion ?? 0;
|
|
44
|
+
return cur < versions.length - 1 ? cur + 1 : cur;
|
|
45
|
+
});
|
|
46
|
+
}, [document?.currentVersion, versions.length]);
|
|
47
|
+
if (!prompt && !stableId) {
|
|
48
|
+
return (React.createElement("div", { className: className, style: { padding: 20, textAlign: "center", color: "#888" } }, "No prompt provided"));
|
|
49
|
+
}
|
|
50
|
+
if (error && !hasExistingImage) {
|
|
51
|
+
return (React.createElement("div", { className: className, style: { padding: 20, textAlign: "center", color: "#e53e3e" } },
|
|
52
|
+
React.createElement("strong", null, "Error"),
|
|
53
|
+
React.createElement("div", null, error.message)));
|
|
54
|
+
}
|
|
55
|
+
if (!hasExistingImage) {
|
|
56
|
+
return (React.createElement("div", { className: className, style: { padding: 20, textAlign: "center", color: "#888" } },
|
|
57
|
+
React.createElement("div", null, "Generating image..."),
|
|
58
|
+
React.createElement("div", { style: { fontSize: 14, marginTop: 8 } }, prompt)));
|
|
59
|
+
}
|
|
60
|
+
return (React.createElement("div", { style: { position: "relative", display: "inline-block" } },
|
|
61
|
+
React.createElement("img", { src: displayUrl, alt: alt || prompt || "", className: className, style: style ?? { maxWidth: "100%", height: "auto" } }),
|
|
62
|
+
loading && (React.createElement("div", { style: {
|
|
63
|
+
position: "absolute",
|
|
64
|
+
top: 0,
|
|
65
|
+
left: 0,
|
|
66
|
+
width: "100%",
|
|
67
|
+
height: 6,
|
|
68
|
+
overflow: "hidden",
|
|
69
|
+
backgroundColor: "rgba(0, 0, 0, 0.1)",
|
|
70
|
+
zIndex: 10,
|
|
71
|
+
}, "aria-hidden": "true" },
|
|
72
|
+
React.createElement("div", { style: {
|
|
73
|
+
width: `${progress ?? 0}%`,
|
|
74
|
+
height: "100%",
|
|
75
|
+
backgroundColor: "#0074d9",
|
|
76
|
+
transition: "width 0.5s ease-out",
|
|
77
|
+
} }))),
|
|
78
|
+
error && (React.createElement("div", { title: error.message, style: {
|
|
79
|
+
position: "absolute",
|
|
80
|
+
top: 10,
|
|
81
|
+
right: 10,
|
|
82
|
+
backgroundColor: "rgba(229, 62, 62, 0.9)",
|
|
83
|
+
color: "#fff",
|
|
84
|
+
padding: "4px 8px",
|
|
85
|
+
borderRadius: 4,
|
|
86
|
+
fontSize: 12,
|
|
87
|
+
zIndex: 11,
|
|
88
|
+
maxWidth: "80%",
|
|
89
|
+
overflow: "hidden",
|
|
90
|
+
textOverflow: "ellipsis",
|
|
91
|
+
whiteSpace: "nowrap",
|
|
92
|
+
} },
|
|
93
|
+
"Error: ",
|
|
94
|
+
error.message)),
|
|
95
|
+
showControls && (React.createElement("div", { style: {
|
|
96
|
+
position: "absolute",
|
|
97
|
+
bottom: 8,
|
|
98
|
+
right: 8,
|
|
99
|
+
display: "flex",
|
|
100
|
+
gap: 4,
|
|
101
|
+
opacity: 0.8,
|
|
102
|
+
} },
|
|
103
|
+
hasMultipleVersions && (React.createElement(React.Fragment, null,
|
|
104
|
+
React.createElement("button", { onClick: handlePrev, disabled: currentVersion <= 0, style: btnStyle, title: "Previous version" }, "\u2039"),
|
|
105
|
+
React.createElement("span", { style: { ...btnStyle, cursor: "default", minWidth: 40, textAlign: "center" } },
|
|
106
|
+
currentVersion + 1,
|
|
107
|
+
"/",
|
|
108
|
+
versions.length),
|
|
109
|
+
React.createElement("button", { onClick: handleNext, disabled: currentVersion >= versions.length - 1, style: btnStyle, title: "Next version" }, "\u203A"))),
|
|
110
|
+
React.createElement("button", { onClick: handleRegen, disabled: loading, style: btnStyle, title: "Regenerate" }, "\u21BB")))));
|
|
111
|
+
}
|
|
112
|
+
const btnStyle = {
|
|
113
|
+
background: "rgba(0,0,0,0.6)",
|
|
114
|
+
color: "#fff",
|
|
115
|
+
border: "none",
|
|
116
|
+
borderRadius: 4,
|
|
117
|
+
padding: "4px 8px",
|
|
118
|
+
fontSize: 14,
|
|
119
|
+
cursor: "pointer",
|
|
120
|
+
lineHeight: 1,
|
|
121
|
+
};
|
|
122
|
+
export default ImgVibes;
|
|
123
|
+
//# sourceMappingURL=ImgVibes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImgVibes.js","sourceRoot":"","sources":["../../jsr/components/ImgVibes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAalE,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,IAAI,GAAG,UAAU,CAAC;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UA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E5F;gBACT,8BAAM,KAAK,EAAE,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;oBAC/E,cAAc,GAAG,CAAC;;oBAAG,QAAQ,CAAC,MAAM,CAChC;gBACP,gCAAQ,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAC,cAAc,aAE1G,CACR,CACJ;YACD,gCAAQ,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAC,YAAY,aAE3E,CACL,CACP,CACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,QAAQ,GAAwB;IACpC,UAAU,EAAE,iBAAiB;IAC7B,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,SAAS;IACjB,UAAU,EAAE,CAAC;CACd,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DocFileMeta } from "@fireproof/use-fireproof";
|
|
3
|
+
interface AsyncImgProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
4
|
+
file: DocFileMeta | File | null | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function AsyncImg({ file, ...props }: AsyncImgProps): React.JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export function AsyncImg({ file, ...props }) {
|
|
3
|
+
const [src, setSrc] = React.useState(null);
|
|
4
|
+
React.useEffect(() => {
|
|
5
|
+
let objectUrl = null;
|
|
6
|
+
let isMounted = true;
|
|
7
|
+
if (!file) {
|
|
8
|
+
setSrc(null);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if ("file" in file && typeof file.file === "function") {
|
|
12
|
+
file
|
|
13
|
+
.file()
|
|
14
|
+
.then((fileObj) => {
|
|
15
|
+
if (!isMounted)
|
|
16
|
+
return;
|
|
17
|
+
if (fileObj.type.startsWith("image/")) {
|
|
18
|
+
objectUrl = URL.createObjectURL(fileObj);
|
|
19
|
+
setSrc(objectUrl);
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
.catch((error) => {
|
|
23
|
+
console.error("[AsyncImg] Failed to load file:", error);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else if (file instanceof File) {
|
|
27
|
+
if (file.type.startsWith("image/")) {
|
|
28
|
+
objectUrl = URL.createObjectURL(file);
|
|
29
|
+
setSrc(objectUrl);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
isMounted = false;
|
|
34
|
+
if (objectUrl) {
|
|
35
|
+
URL.revokeObjectURL(objectUrl);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, [file]);
|
|
39
|
+
return src ? React.createElement("img", { src: src, ...props }) : null;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=AsyncImg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncImg.js","sourceRoot":"","sources":["../../../jsr/components/ImgVibesUtils/AsyncImg.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,UAAU,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAiB;IACxD,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAE1D,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,SAAS,GAAkB,IAAI,CAAC;QACpC,IAA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
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ImgVibesDisplayProps } from "./types.js";
|
|
3
|
+
export declare function ImgVibesDisplay({ document, className, alt, onDelete, onRegen, onPromptEdit, classes, loading, progress, error, debug }: Partial<ImgVibesDisplayProps>): React.JSX.Element;
|