@vibes.diy/prompts 14.3.15 → 14.3.16

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.
@@ -112,7 +112,34 @@ When an item's picture is intrinsic to what it is — a card in a deck, a creatu
112
112
  />
113
113
  ```
114
114
 
115
- Do **not** hide first generation behind an "Illustrate" / "Generate image" button — a button leaves every item blank until tapped, which reads as "the app has no pictures." Reserve buttons and `showControls` for *regeneration* of an image that already exists. (For incidental or user-optional images — an avatar upload, a one-off hero graphic — an explicit action is still fine; this rule is about items whose identity includes a picture.)
115
+ Let the first picture arrive with the item itself, so every card opens already illustrated and the app reads as a picture app from the first glance. For these items, buttons and `showControls` are for *regenerating* an image that already exists. Pictures that are extras rather than identity — an avatar upload, a one-off hero graphic, and the text-first snippets below — come from an explicit action the person chooses.
116
+
117
+ ## Pictures on Request for Text-First Snippets
118
+
119
+ When each item's substance is its words — a generated joke, a short verse, a pun, a one-liner — give every snippet its own picture button and save the picture on that snippet's record. Tapping the button shows a "Making a picture…" state until the image opens in its place. ImgGen keeps the picture under the snippet's own `_id` in `database`, so it is there after a reload, viewing it again costs nothing, and a snippet with a saved picture shows it straight away. Keep the snippet's words in a field like `text`; a `prompt` field on the record is ImgGen's cue to draw right away.
120
+
121
+ ```jsx
122
+ import { ImgGen, useImgGen } from "use-vibes";
123
+
124
+ function PunCard({ pun, database }) {
125
+ const [wanted, setWanted] = React.useState(false);
126
+ const { document: saved } = useImgGen({ _id: pun._id, database });
127
+ const hasPicture = Object.keys(saved?._files ?? {}).length > 0;
128
+ return (
129
+ <li>
130
+ <p>{pun.text}</p>
131
+ {wanted || hasPicture ? (
132
+ <figure>
133
+ <ImgGen _id={pun._id} database={database} prompt={`A cheerful cartoon of this pun: ${pun.text}`} />
134
+ {hasPicture ? null : <figcaption>Making a picture…</figcaption>}
135
+ </figure>
136
+ ) : (
137
+ <button onClick={() => setWanted(true)}>Picture this</button>
138
+ )}
139
+ </li>
140
+ );
141
+ }
142
+ ```
116
143
 
117
144
  ## Gallery Pattern
118
145
 
package/llms/image-gen.md CHANGED
@@ -112,7 +112,34 @@ When an item's picture is intrinsic to what it is — a card in a deck, a creatu
112
112
  />
113
113
  ```
114
114
 
115
- Do **not** hide first generation behind an "Illustrate" / "Generate image" button — a button leaves every item blank until tapped, which reads as "the app has no pictures." Reserve buttons and `showControls` for *regeneration* of an image that already exists. (For incidental or user-optional images — an avatar upload, a one-off hero graphic — an explicit action is still fine; this rule is about items whose identity includes a picture.)
115
+ Let the first picture arrive with the item itself, so every card opens already illustrated and the app reads as a picture app from the first glance. For these items, buttons and `showControls` are for *regenerating* an image that already exists. Pictures that are extras rather than identity — an avatar upload, a one-off hero graphic, and the text-first snippets below — come from an explicit action the person chooses.
116
+
117
+ ## Pictures on Request for Text-First Snippets
118
+
119
+ When each item's substance is its words — a generated joke, a short verse, a pun, a one-liner — give every snippet its own picture button and save the picture on that snippet's record. Tapping the button shows a "Making a picture…" state until the image opens in its place. ImgGen keeps the picture under the snippet's own `_id` in `database`, so it is there after a reload, viewing it again costs nothing, and a snippet with a saved picture shows it straight away. Keep the snippet's words in a field like `text`; a `prompt` field on the record is ImgGen's cue to draw right away.
120
+
121
+ ```jsx
122
+ import { ImgGen, useImgGen } from "use-vibes";
123
+
124
+ function PunCard({ pun, database }) {
125
+ const [wanted, setWanted] = React.useState(false);
126
+ const { document: saved } = useImgGen({ _id: pun._id, database });
127
+ const hasPicture = Object.keys(saved?._files ?? {}).length > 0;
128
+ return (
129
+ <li>
130
+ <p>{pun.text}</p>
131
+ {wanted || hasPicture ? (
132
+ <figure>
133
+ <ImgGen _id={pun._id} database={database} prompt={`A cheerful cartoon of this pun: ${pun.text}`} />
134
+ {hasPicture ? null : <figcaption>Making a picture…</figcaption>}
135
+ </figure>
136
+ ) : (
137
+ <button onClick={() => setWanted(true)}>Picture this</button>
138
+ )}
139
+ </li>
140
+ );
141
+ }
142
+ ```
116
143
 
117
144
  ## Gallery Pattern
118
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/prompts",
3
- "version": "14.3.15",
3
+ "version": "14.3.16",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "exports": {
@@ -37,9 +37,9 @@
37
37
  "license": "Apache-2.0",
38
38
  "dependencies": {
39
39
  "@adviser/cement": "~0.5.34",
40
- "@vibes.diy/call-ai-v2": "14.3.15",
41
- "@vibes.diy/identity": "14.3.15",
42
- "@vibes.diy/use-vibes-types": "14.3.15",
40
+ "@vibes.diy/call-ai-v2": "14.3.16",
41
+ "@vibes.diy/identity": "14.3.16",
42
+ "@vibes.diy/use-vibes-types": "14.3.16",
43
43
  "arktype": "~2.2.3",
44
44
  "json-schema-faker": "~0.6.3"
45
45
  },