stillmade-sdk 0.1.12 → 0.1.14

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.
@@ -0,0 +1,334 @@
1
+ // Generated by scripts/build-owned-blocks.mjs. Edit the owned source files.
2
+ export default {
3
+ "manifest": {
4
+ "schemaVersion": 1,
5
+ "sdkVersion": "0.1.0",
6
+ "id": "sm.pick-photos",
7
+ "version": "1.0.0",
8
+ "name": "Pick best photos",
9
+ "description": "Check every photo with StillMade's vision capability and keep only the best ones: sharp, well lit, clear faces, varied, and true to your note.",
10
+ "kind": "task",
11
+ "runtime": "javascript",
12
+ "entry": "src/run.js",
13
+ "license": "MIT",
14
+ "provenance": {
15
+ "notice": "Original source (authorship declared by the packager)\nLicense: MIT\nChanges: Original implementation declared by the packager; no reused repository or dependency code.\nFiles: LICENSE, src/run.js\n\nMIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
16
+ "portableSources": [
17
+ {
18
+ "kind": "original",
19
+ "license": "MIT",
20
+ "paths": [
21
+ "LICENSE",
22
+ "src/run.js"
23
+ ],
24
+ "evidence": [
25
+ "upstream/0/LICENSE",
26
+ "upstream/0/src/run.js"
27
+ ],
28
+ "changes": "Original implementation declared by the packager; no reused repository or dependency code."
29
+ }
30
+ ]
31
+ },
32
+ "inputs": {
33
+ "photos": {
34
+ "type": "image[]",
35
+ "primary": true,
36
+ "required": true,
37
+ "imageMode": "reference",
38
+ "description": "The photos to choose from, up to 100.",
39
+ "semantic": "image",
40
+ "accepts": [
41
+ "source_image"
42
+ ]
43
+ },
44
+ "keep": {
45
+ "type": "integer",
46
+ "default": 12,
47
+ "min": 1,
48
+ "max": 50,
49
+ "required": false,
50
+ "description": "How many photos to keep.",
51
+ "semantic": "photo_keep_count"
52
+ },
53
+ "instruction": {
54
+ "type": "text",
55
+ "default": "",
56
+ "required": false,
57
+ "description": "What the photos are for, such as: a memorial tribute for Grandma; prefer clear faces and happy moments.",
58
+ "semantic": "photo_selection_instruction"
59
+ },
60
+ "notes": {
61
+ "type": "json",
62
+ "required": false,
63
+ "description": "One note per photo from the photo check. StillMade fills this in when the Step runs; leave it empty.",
64
+ "semantic": "photo_notes",
65
+ "schema": [
66
+ {
67
+ "ok": "boolean?",
68
+ "sharp": "number?",
69
+ "light": "number?",
70
+ "people": "integer?",
71
+ "facesClear": "boolean?",
72
+ "smiling": "boolean?",
73
+ "eyesClosed": "boolean?",
74
+ "tags": "string[]?",
75
+ "text": "string?"
76
+ }
77
+ ]
78
+ }
79
+ },
80
+ "outputs": {
81
+ "photos": {
82
+ "type": "image[]",
83
+ "primary": true,
84
+ "description": "Only the chosen photos, unchanged, in the order they were taken when dates are known, otherwise best first.",
85
+ "semantic": "image"
86
+ },
87
+ "reasons": {
88
+ "type": "text",
89
+ "description": "Why each photo was kept.",
90
+ "semantic": "plain_text"
91
+ }
92
+ },
93
+ "permissions": {
94
+ "project": [],
95
+ "network": [],
96
+ "filesystem": [],
97
+ "secrets": []
98
+ },
99
+ "ui": [
100
+ {
101
+ "port": "photos",
102
+ "control": "asset"
103
+ },
104
+ {
105
+ "port": "keep",
106
+ "control": "number",
107
+ "label": "How many to keep"
108
+ },
109
+ {
110
+ "port": "instruction",
111
+ "control": "text",
112
+ "label": "What they are for"
113
+ },
114
+ {
115
+ "port": "photos",
116
+ "control": "gallery"
117
+ }
118
+ ],
119
+ "platforms": {
120
+ "phone": {
121
+ "supported": true
122
+ },
123
+ "browser": {
124
+ "supported": true
125
+ },
126
+ "desktop": {
127
+ "supported": true
128
+ }
129
+ }
130
+ },
131
+ "code": "// Pick best photos: rank the photos from their notes (one per photo, made by\n// Photo notes when the Step runs) and return only the chosen ones, unchanged.\nconst MAX_PHOTOS=100;\nconst photos=Array.isArray(input.photos)?input.photos:[];\nif(!photos.length)throw new Error('Add photos to choose from.');\nif(photos.length>MAX_PHOTOS)throw new Error('Pick best photos checks up to 100 photos at a time. You added '+String(photos.length)+'. Remove some, or split them into groups of 100 or fewer.');\nconst notes=Array.isArray(input.notes)?input.notes:null;\nif(!notes||notes.length!==photos.length)throw new Error('Pick best photos needs its photo check. Run this Step in your project to check the photos.');\nconst keep=Math.max(1,Math.min(50,Math.round(Number(input.keep)||12)));\nconst instruction=typeof input.instruction==='string'?input.instruction.toLowerCase():'';\n\nconst STOP=new Set(['the','and','for','with','that','this','from','into','our','her','his','their','them','who','are','was','were','has','have','had','want','like','prefer','some','more','most','very','only','photos','photo','pictures','picture','images','image','video','please','make','show','use','good','best','nice','tribute','about']);\nconst words=text=>String(text||'').toLowerCase().split(/[^a-z0-9]+/).filter(word=>word.length>=3&&!STOP.has(word));\nconst stem=word=>word.slice(0,5);\nconst wanted=[...new Set(words(instruction).map(stem))];\nconst wantsFaces=/face|people|person|portrait|family|everyone|group/.test(instruction);\nconst wantsHappy=/happy|smil|joy|laugh|fun|cheer/.test(instruction);\nconst wantsSharp=/clear|sharp|focus|quality/.test(instruction);\nconst level=value=>{const number=Number(value);return Number.isFinite(number)?Math.max(0,Math.min(10,number)):5;};\n\nconst notesFor=(note)=>{\n const ok=!!note&&typeof note==='object'&&note.ok!==false;\n const tags=Array.isArray(note&&note.tags)?note.tags.map(tag=>String(tag).toLowerCase()).slice(0,12):[];\n const text=String(note&&note.text||'');\n return {ok,sharp:level(note&&note.sharp),light:level(note&&note.light),people:Math.max(0,Math.min(50,Math.round(Number(note&&note.people)||0))),facesClear:note&&note.facesClear===true,smiling:note&&note.smiling===true,eyesClosed:note&&note.eyesClosed===true,tags,text,signature:new Set([...tags.flatMap(words),...words(text)].map(stem))};\n};\nconst fitOf=note=>{\n if(!wanted.length)return 0;\n let hits=0;for(const word of wanted)if(note.signature.has(word))hits++;\n return hits/wanted.length;\n};\nconst scoreOf=note=>{\n if(!note.ok)return -100;\n const quality=(note.sharp*.6+note.light*.4)/10;\n let score=3*quality+(note.people>0?1:0)+(note.facesClear?1.5:0)+(note.smiling?1:0)-(note.eyesClosed?1.5:0)+3*fitOf(note);\n if(wantsFaces)score+=(note.facesClear?1.5:0)+(note.people>0?1:0);\n if(wantsHappy)score+=note.smiling?2:0;\n if(wantsSharp)score+=2*quality;\n if(note.sharp<=2)score-=2;\n return Math.round(score*1000)/1000;\n};\nconst similarity=(a,b)=>{\n if(!a.signature.size||!b.signature.size)return 0;\n let shared=0;for(const word of a.signature)if(b.signature.has(word))shared++;\n return shared/(a.signature.size+b.signature.size-shared);\n};\nconst dateOf=photo=>{\n for(const key of ['takenAt','capturedAt','createdAt','date']){\n const value=photo&&photo[key];\n const time=typeof value==='number'?value:typeof value==='string'?Date.parse(value):NaN;\n if(Number.isFinite(time))return time;\n }\n return null;\n};\n\n// Exact repeats of one saved version count once.\nconst seen=new Set();\nconst rows=[];\nphotos.forEach((photo,index)=>{\n const key=photo&&photo.assetId&&photo.versionId?photo.assetId+':'+photo.versionId:String(photo&&photo.url||index);\n if(seen.has(key))return;\n seen.add(key);\n const note=notesFor(notes[index]);\n rows.push({photo,index,note,score:scoreOf(note),fit:fitOf(note)});\n});\nconst ranked=rows.filter(row=>row.note.ok).sort((a,b)=>b.score-a.score||a.index-b.index);\nif(!ranked.length)throw new Error('None of these photos could be checked. Try clearer photos, or run the Step again.');\n\n// Near-duplicates (the same scene and people) give way to the best of them,\n// unless there are not enough different photos to fill the count.\nconst NEAR=.7;\nconst chosen=[],skipped=[];\nfor(const row of ranked){\n if(chosen.length>=keep)break;\n const twin=chosen.find(other=>Math.abs(other.note.people-row.note.people)<=1&&similarity(other.note,row.note)>=NEAR);\n if(twin){row.twin=twin;skipped.push(row);}else chosen.push(row);\n}\nfor(const row of skipped){if(chosen.length>=keep)break;chosen.push(row);}\n\nconst dated=chosen.every(row=>dateOf(row.photo)!==null);\nconst ordered=dated?chosen.slice().sort((a,b)=>dateOf(a.photo)-dateOf(b.photo)||a.index-b.index):chosen;\nconst nameOf=row=>row.photo&&typeof row.photo.name==='string'&&row.photo.name.trim()?row.photo.name.trim():'Photo '+String(row.index+1);\nconst why=row=>{\n const parts=[];\n const quality=(row.note.sharp*.6+row.note.light*.4);\n parts.push(quality>=7.5?'sharp and well lit':quality>=5?'clear enough':'the best of a weak set');\n if(row.note.people)parts.push(String(row.note.people)+(row.note.people===1?' person':' people'));\n if(row.note.facesClear)parts.push('clear faces');\n if(row.note.smiling)parts.push('smiling');\n if(row.fit>0)parts.push('fits your note');\n if(row.twin)parts.push('similar to another pick, kept to fill the count');\n return parts.join(', ');\n};\nconst lines=ordered.map((row,at)=>String(at+1)+'. '+nameOf(row)+': '+why(row)+'.');\nconst left=rows.length-chosen.length;\nconst header='Kept '+String(chosen.length)+' of '+String(photos.length)+' photos'+(dated?', in the order they were taken':', best first')+'.'+(left>0?' '+String(left)+' left out'+(skipped.length>chosen.filter(row=>row.twin).length?', some as near-duplicates':'')+'.':'');\nreturn {photos:ordered.map(row=>row.photo),reasons:[header,...lines].join('\\n')};\n",
132
+ "tests": [
133
+ {
134
+ "name": "keeps the sharpest varied photos and drops a near-duplicate",
135
+ "input": {
136
+ "photos": [
137
+ {
138
+ "kind": "image",
139
+ "assetId": "photo-1",
140
+ "versionId": "v1",
141
+ "url": "/api/media/photo-1"
142
+ },
143
+ {
144
+ "kind": "image",
145
+ "assetId": "photo-2",
146
+ "versionId": "v1",
147
+ "url": "/api/media/photo-2"
148
+ },
149
+ {
150
+ "kind": "image",
151
+ "assetId": "photo-3",
152
+ "versionId": "v1",
153
+ "url": "/api/media/photo-3"
154
+ },
155
+ {
156
+ "kind": "image",
157
+ "assetId": "photo-4",
158
+ "versionId": "v1",
159
+ "url": "/api/media/photo-4"
160
+ }
161
+ ],
162
+ "keep": 2,
163
+ "instruction": "Memorial tribute for Grandma; prefer clear faces",
164
+ "notes": [
165
+ {
166
+ "sharp": 9,
167
+ "light": 8,
168
+ "people": 2,
169
+ "facesClear": true,
170
+ "smiling": true,
171
+ "eyesClosed": false,
172
+ "tags": [
173
+ "grandma",
174
+ "garden",
175
+ "family"
176
+ ],
177
+ "text": "Two people smiling in a garden."
178
+ },
179
+ {
180
+ "sharp": 2,
181
+ "light": 3,
182
+ "people": 0,
183
+ "facesClear": false,
184
+ "smiling": false,
185
+ "eyesClosed": false,
186
+ "tags": [
187
+ "blur"
188
+ ],
189
+ "text": "A blurred hallway."
190
+ },
191
+ {
192
+ "sharp": 9,
193
+ "light": 8,
194
+ "people": 2,
195
+ "facesClear": true,
196
+ "smiling": true,
197
+ "eyesClosed": false,
198
+ "tags": [
199
+ "grandma",
200
+ "garden",
201
+ "family"
202
+ ],
203
+ "text": "Two people smiling in a garden."
204
+ },
205
+ {
206
+ "sharp": 8,
207
+ "light": 8,
208
+ "people": 1,
209
+ "facesClear": true,
210
+ "smiling": false,
211
+ "eyesClosed": false,
212
+ "tags": [
213
+ "kitchen",
214
+ "baking",
215
+ "grandma"
216
+ ],
217
+ "text": "A woman baking in a kitchen."
218
+ }
219
+ ]
220
+ },
221
+ "expected": {
222
+ "photos": [
223
+ {
224
+ "kind": "image",
225
+ "assetId": "photo-1",
226
+ "versionId": "v1",
227
+ "url": "/api/media/photo-1"
228
+ },
229
+ {
230
+ "kind": "image",
231
+ "assetId": "photo-4",
232
+ "versionId": "v1",
233
+ "url": "/api/media/photo-4"
234
+ }
235
+ ],
236
+ "reasons": "Kept 2 of 4 photos, best first. 2 left out, some as near-duplicates.\n1. Photo 1: sharp and well lit, 2 people, clear faces, smiling, fits your note.\n2. Photo 4: sharp and well lit, 1 person, clear faces, fits your note."
237
+ }
238
+ },
239
+ {
240
+ "name": "orders dated picks by when they were taken",
241
+ "input": {
242
+ "photos": [
243
+ {
244
+ "kind": "image",
245
+ "assetId": "photo-1",
246
+ "versionId": "v1",
247
+ "url": "/api/media/photo-1",
248
+ "takenAt": "2020-05-01T10:00:00Z"
249
+ },
250
+ {
251
+ "kind": "image",
252
+ "assetId": "photo-2",
253
+ "versionId": "v1",
254
+ "url": "/api/media/photo-2",
255
+ "takenAt": "2019-01-01T10:00:00Z"
256
+ }
257
+ ],
258
+ "keep": 2,
259
+ "notes": [
260
+ {
261
+ "sharp": 9,
262
+ "light": 9,
263
+ "people": 1,
264
+ "facesClear": true,
265
+ "smiling": true,
266
+ "eyesClosed": false,
267
+ "tags": [
268
+ "park"
269
+ ],
270
+ "text": "A child in a park."
271
+ },
272
+ {
273
+ "sharp": 6,
274
+ "light": 6,
275
+ "people": 0,
276
+ "facesClear": false,
277
+ "smiling": false,
278
+ "eyesClosed": false,
279
+ "tags": [
280
+ "lake"
281
+ ],
282
+ "text": "A quiet lake."
283
+ }
284
+ ]
285
+ },
286
+ "expected": {
287
+ "photos": [
288
+ {
289
+ "kind": "image",
290
+ "assetId": "photo-2",
291
+ "versionId": "v1",
292
+ "url": "/api/media/photo-2",
293
+ "takenAt": "2019-01-01T10:00:00Z"
294
+ },
295
+ {
296
+ "kind": "image",
297
+ "assetId": "photo-1",
298
+ "versionId": "v1",
299
+ "url": "/api/media/photo-1",
300
+ "takenAt": "2020-05-01T10:00:00Z"
301
+ }
302
+ ],
303
+ "reasons": "Kept 2 of 2 photos, in the order they were taken.\n1. Photo 2: clear enough.\n2. Photo 1: sharp and well lit, 1 person, clear faces, smiling."
304
+ }
305
+ }
306
+ ],
307
+ "portable": {
308
+ "format": "stillmade-block/1",
309
+ "dependencies": [],
310
+ "sources": [
311
+ {
312
+ "kind": "original",
313
+ "license": "MIT",
314
+ "paths": [
315
+ "LICENSE",
316
+ "src/run.js"
317
+ ],
318
+ "evidence": [
319
+ "upstream/0/LICENSE",
320
+ "upstream/0/src/run.js"
321
+ ],
322
+ "changes": "Original implementation declared by the packager; no reused repository or dependency code."
323
+ }
324
+ ],
325
+ "files": {
326
+ "upstream/0/LICENSE": "MIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
327
+ "upstream/0/src/run.js": "// Pick best photos: rank the photos from their notes (one per photo, made by\n// Photo notes when the Step runs) and return only the chosen ones, unchanged.\nconst MAX_PHOTOS=100;\nconst photos=Array.isArray(input.photos)?input.photos:[];\nif(!photos.length)throw new Error('Add photos to choose from.');\nif(photos.length>MAX_PHOTOS)throw new Error('Pick best photos checks up to 100 photos at a time. You added '+String(photos.length)+'. Remove some, or split them into groups of 100 or fewer.');\nconst notes=Array.isArray(input.notes)?input.notes:null;\nif(!notes||notes.length!==photos.length)throw new Error('Pick best photos needs its photo check. Run this Step in your project to check the photos.');\nconst keep=Math.max(1,Math.min(50,Math.round(Number(input.keep)||12)));\nconst instruction=typeof input.instruction==='string'?input.instruction.toLowerCase():'';\n\nconst STOP=new Set(['the','and','for','with','that','this','from','into','our','her','his','their','them','who','are','was','were','has','have','had','want','like','prefer','some','more','most','very','only','photos','photo','pictures','picture','images','image','video','please','make','show','use','good','best','nice','tribute','about']);\nconst words=text=>String(text||'').toLowerCase().split(/[^a-z0-9]+/).filter(word=>word.length>=3&&!STOP.has(word));\nconst stem=word=>word.slice(0,5);\nconst wanted=[...new Set(words(instruction).map(stem))];\nconst wantsFaces=/face|people|person|portrait|family|everyone|group/.test(instruction);\nconst wantsHappy=/happy|smil|joy|laugh|fun|cheer/.test(instruction);\nconst wantsSharp=/clear|sharp|focus|quality/.test(instruction);\nconst level=value=>{const number=Number(value);return Number.isFinite(number)?Math.max(0,Math.min(10,number)):5;};\n\nconst notesFor=(note)=>{\n const ok=!!note&&typeof note==='object'&&note.ok!==false;\n const tags=Array.isArray(note&&note.tags)?note.tags.map(tag=>String(tag).toLowerCase()).slice(0,12):[];\n const text=String(note&&note.text||'');\n return {ok,sharp:level(note&&note.sharp),light:level(note&&note.light),people:Math.max(0,Math.min(50,Math.round(Number(note&&note.people)||0))),facesClear:note&&note.facesClear===true,smiling:note&&note.smiling===true,eyesClosed:note&&note.eyesClosed===true,tags,text,signature:new Set([...tags.flatMap(words),...words(text)].map(stem))};\n};\nconst fitOf=note=>{\n if(!wanted.length)return 0;\n let hits=0;for(const word of wanted)if(note.signature.has(word))hits++;\n return hits/wanted.length;\n};\nconst scoreOf=note=>{\n if(!note.ok)return -100;\n const quality=(note.sharp*.6+note.light*.4)/10;\n let score=3*quality+(note.people>0?1:0)+(note.facesClear?1.5:0)+(note.smiling?1:0)-(note.eyesClosed?1.5:0)+3*fitOf(note);\n if(wantsFaces)score+=(note.facesClear?1.5:0)+(note.people>0?1:0);\n if(wantsHappy)score+=note.smiling?2:0;\n if(wantsSharp)score+=2*quality;\n if(note.sharp<=2)score-=2;\n return Math.round(score*1000)/1000;\n};\nconst similarity=(a,b)=>{\n if(!a.signature.size||!b.signature.size)return 0;\n let shared=0;for(const word of a.signature)if(b.signature.has(word))shared++;\n return shared/(a.signature.size+b.signature.size-shared);\n};\nconst dateOf=photo=>{\n for(const key of ['takenAt','capturedAt','createdAt','date']){\n const value=photo&&photo[key];\n const time=typeof value==='number'?value:typeof value==='string'?Date.parse(value):NaN;\n if(Number.isFinite(time))return time;\n }\n return null;\n};\n\n// Exact repeats of one saved version count once.\nconst seen=new Set();\nconst rows=[];\nphotos.forEach((photo,index)=>{\n const key=photo&&photo.assetId&&photo.versionId?photo.assetId+':'+photo.versionId:String(photo&&photo.url||index);\n if(seen.has(key))return;\n seen.add(key);\n const note=notesFor(notes[index]);\n rows.push({photo,index,note,score:scoreOf(note),fit:fitOf(note)});\n});\nconst ranked=rows.filter(row=>row.note.ok).sort((a,b)=>b.score-a.score||a.index-b.index);\nif(!ranked.length)throw new Error('None of these photos could be checked. Try clearer photos, or run the Step again.');\n\n// Near-duplicates (the same scene and people) give way to the best of them,\n// unless there are not enough different photos to fill the count.\nconst NEAR=.7;\nconst chosen=[],skipped=[];\nfor(const row of ranked){\n if(chosen.length>=keep)break;\n const twin=chosen.find(other=>Math.abs(other.note.people-row.note.people)<=1&&similarity(other.note,row.note)>=NEAR);\n if(twin){row.twin=twin;skipped.push(row);}else chosen.push(row);\n}\nfor(const row of skipped){if(chosen.length>=keep)break;chosen.push(row);}\n\nconst dated=chosen.every(row=>dateOf(row.photo)!==null);\nconst ordered=dated?chosen.slice().sort((a,b)=>dateOf(a.photo)-dateOf(b.photo)||a.index-b.index):chosen;\nconst nameOf=row=>row.photo&&typeof row.photo.name==='string'&&row.photo.name.trim()?row.photo.name.trim():'Photo '+String(row.index+1);\nconst why=row=>{\n const parts=[];\n const quality=(row.note.sharp*.6+row.note.light*.4);\n parts.push(quality>=7.5?'sharp and well lit':quality>=5?'clear enough':'the best of a weak set');\n if(row.note.people)parts.push(String(row.note.people)+(row.note.people===1?' person':' people'));\n if(row.note.facesClear)parts.push('clear faces');\n if(row.note.smiling)parts.push('smiling');\n if(row.fit>0)parts.push('fits your note');\n if(row.twin)parts.push('similar to another pick, kept to fill the count');\n return parts.join(', ');\n};\nconst lines=ordered.map((row,at)=>String(at+1)+'. '+nameOf(row)+': '+why(row)+'.');\nconst left=rows.length-chosen.length;\nconst header='Kept '+String(chosen.length)+' of '+String(photos.length)+' photos'+(dated?', in the order they were taken':', best first')+'.'+(left>0?' '+String(left)+' left out'+(skipped.length>chosen.filter(row=>row.twin).length?', some as near-duplicates':'')+'.':'');\nreturn {photos:ordered.map(row=>row.photo),reasons:[header,...lines].join('\\n')};\n"
328
+ },
329
+ "lineage": {
330
+ "parents": [],
331
+ "changes": "Packaged original Block source for StillMade."
332
+ }
333
+ }
334
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stillmade-sdk",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "StillMade Block SDK, CLI and examples",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "type": "module",
@@ -1401,6 +1401,8 @@ label:has(> textarea) {
1401
1401
  The shape of a Block page, top to bottom:
1402
1402
  .sm-block one workspace, no cards inside cards
1403
1403
  .sm-stage the thing being made (preview, media, result); biggest area
1404
+ .sm-settings settings side by side; .sm-choices[data-segmented] for short ones
1405
+ .sm-list many items, one line each; an item opens in place
1404
1406
  .sm-choices picks shown as pictures or icons, not word lists
1405
1407
  .sm-shape a frame shape at its real ratio (style="--r:9/16")
1406
1408
  .sm-field the few inputs a person actually needs
@@ -1424,7 +1426,21 @@ label:has(> textarea) {
1424
1426
  :where(.sm-block[data-layout="split"]){grid-template-columns:minmax(0,1.6fr) minmax(260px,1fr);align-items:start}
1425
1427
  :where(.sm-block[data-layout="split"]) > :where(.sm-stage){grid-row:span 6}
1426
1428
  }
1429
+ /* Wide views (October 19, 2026): the controls keep a reading width on the left and
1430
+ the result fills the rest on the right. Under 860px everything stacks with the
1431
+ result first. data-layout="stack" opts out; "split" keeps its older layout. */
1432
+ @container (min-width:860px){
1433
+ :where(.sm-block:not([data-layout]):has(> .sm-stage)){grid-template-columns:minmax(300px,380px) minmax(0,1fr);align-items:start;column-gap:var(--s-5,24px);row-gap:var(--s-4,16px)}
1434
+ :where(.sm-block:not([data-layout]):has(> .sm-stage)) > :where(*){grid-column:1}
1435
+ :where(.sm-block:not([data-layout]):has(> .sm-stage)) > :where(.sm-stage){grid-column:2;grid-row:1 / span 12;align-self:stretch;min-height:min(70vh,640px)}
1436
+ /* A stage with a real shape keeps it: a min-height would widen a 16:9 stage past its column. */
1437
+ :where(.sm-block:not([data-layout]):has(> .sm-stage)) > :where(.sm-stage[data-ratio]){align-self:start;min-height:0}
1438
+ }
1427
1439
  :where(.sm-row){display:flex;flex-wrap:wrap;align-items:center;gap:var(--s-2,8px)}
1440
+ /* Long text shows five lines on a phone until someone opens it (data-open). */
1441
+ @container (max-width:519px){
1442
+ :where(.sm-clamp:not([data-open])){display:-webkit-box;-webkit-line-clamp:var(--sm-lines,5);-webkit-box-orient:vertical;overflow:hidden}
1443
+ }
1428
1444
 
1429
1445
  /* ---------- The stage: the object being made gets the main surface ---------- */
1430
1446
  :where(.sm-stage){position:relative;display:grid;place-items:center;min-height:220px;padding:var(--s-3,12px);border-radius:var(--r-3,8px);background:var(--bg-inset);overflow:hidden}
@@ -1465,8 +1481,8 @@ label:has(> textarea) {
1465
1481
  :where(.sm-fields){display:grid;gap:var(--s-4,16px);grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr))}
1466
1482
  /* Compact: on a view wider than a phone a short field is one row, its label beside the control. */
1467
1483
  @container (min-width:520px){
1468
- /* Picture choices keep the full width: their legend is their label, and the tiles need the row. */
1469
- :where(.sm-field:not(:has(textarea,.sm-choices))){grid-template-columns:minmax(5rem,9rem) minmax(0,1fr);align-items:center;gap:var(--s-2,8px)}
1484
+ /* Picture choices, file tiles and lists keep the full width: their label sits above, and they need the row. */
1485
+ :where(.sm-field:not(:has(textarea,.sm-choices,.sm-gallery,.sm-list))){grid-template-columns:minmax(5rem,9rem) minmax(0,1fr);align-items:center;gap:var(--s-2,8px)}
1470
1486
  :where(.sm-field) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select){min-height:36px;padding:6px 10px}
1471
1487
  :where(.sm-fields){gap:var(--s-2,8px) var(--s-4,16px)}
1472
1488
  }
@@ -1493,12 +1509,54 @@ label:has(> textarea) {
1493
1509
  :where(.sm-choices) :where(.sm-shape){--sm-shape-size:36px;align-self:center;margin:6px auto 2px}
1494
1510
  :where(.sm-choices[data-compact]) :where(.sm-shape){--sm-shape-size:20px;margin:0}
1495
1511
 
1512
+ /* Segmented: three or four short words or numbers in one connected row (Low / Med / High). */
1513
+ :where(.sm-choices[data-segmented]){display:flex;gap:0;width:fit-content;max-width:100%}
1514
+ :where(.sm-choices[data-segmented]) > :where(label){display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:4px 12px;border-radius:0;font-size:var(--fs-body-s,.875rem);white-space:nowrap}
1515
+ :where(.sm-choices[data-segmented]) > :where(label + label){margin-inline-start:-1px}
1516
+ :where(.sm-choices[data-segmented]) > :where(label:first-of-type){border-start-start-radius:var(--r-pill,999px);border-end-start-radius:var(--r-pill,999px)}
1517
+ :where(.sm-choices[data-segmented]) > :where(label:last-of-type){border-start-end-radius:var(--r-pill,999px);border-end-end-radius:var(--r-pill,999px)}
1518
+ :where(.sm-choices[data-segmented]) > :where(label:has(input:checked)){position:relative;z-index:1;background:var(--bg-elev-2)}
1519
+ :where(.sm-choices[data-segmented]) :where(.sm-glyph){--sm-glyph-size:16px;margin:0}
1520
+ /* Settings side by side: a grid of short settings, each label above its control. */
1521
+ :where(.sm-settings){display:grid;gap:var(--s-3,12px) var(--s-4,16px);grid-template-columns:repeat(auto-fill,minmax(min(100%,11rem),1fr));align-items:start;min-width:0}
1522
+ :where(.sm-settings) > :where(.sm-field){grid-template-columns:minmax(0,1fr);gap:4px}
1523
+ :where(.sm-settings) > :where(.sm-choices) > :where(legend),:where(.sm-settings) :where(.sm-label){font-size:var(--fs-caption,.8125rem)}
1524
+ /* On a phone, a row of chips or segments scrolls sideways instead of wrapping. */
1525
+ @container (max-width:519px){
1526
+ :where(.sm-choices[data-compact],.sm-choices[data-segmented]){display:flex;flex-wrap:nowrap;width:auto;overflow-x:auto;scrollbar-width:none}
1527
+ :where(.sm-choices[data-compact]) > :where(label){flex:none}
1528
+ :where(.sm-choices[data-segmented]) > :where(label){flex:none}
1529
+ }
1530
+
1531
+ /* ---------- One-line list: many items, one short row each ----------
1532
+ <ol class="sm-list"><li><img alt=""><span class="sm-line">Text</span><small>Wide</small></li></ol>
1533
+ An item that opens in place is <li><details><summary>…the row…</summary>…its fields…</details></li>.
1534
+ data-peek shows the first three on a phone, with a last <li class="sm-list-more"> button to open the rest. */
1535
+ :where(.sm-list){display:grid;margin:0;padding:0;list-style:none;border:1px solid var(--border-tok);border-radius:var(--r-3,8px);background:var(--bg-elev-1);min-width:0;overflow:hidden}
1536
+ :where(.sm-list) > :where(li){display:flex;align-items:center;gap:var(--s-2,8px);min-width:0;min-height:40px;padding:4px var(--s-2,8px);border-bottom:1px solid var(--divider)}
1537
+ :where(.sm-list) > :where(li:last-child){border-bottom:0}
1538
+ :where(.sm-list) > :where(li:has(> details)){display:block;padding:0}
1539
+ :where(.sm-list) > :where(li) > :where(details) > :where(summary){display:flex;align-items:center;gap:var(--s-2,8px);min-height:40px;padding:4px var(--s-2,8px);list-style:none;cursor:pointer}
1540
+ :where(.sm-list) > :where(li) > :where(details) > :where(summary)::-webkit-details-marker{display:none}
1541
+ :where(.sm-list) > :where(li) > :where(details[open]){background:var(--bg-inset)}
1542
+ :where(.sm-list) > :where(li) > :where(details) > :where(:not(summary)){padding:var(--s-2,8px) var(--s-3,12px) var(--s-3,12px)}
1543
+ :where(.sm-list) :where(img,video,canvas,.sm-swatch){flex:none;width:40px;height:26px;object-fit:cover;border-radius:var(--r-2,4px);background:var(--bg-inset)}
1544
+ :where(.sm-list) :where(.sm-line){flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1545
+ :where(.sm-list) :where(small){flex:none;color:var(--fg-subtle);font-size:var(--fs-caption,.8125rem);white-space:nowrap;font-variant-numeric:tabular-nums}
1546
+ :where(.sm-list) > :where(.sm-list-more){display:none}
1547
+ @container (max-width:519px){
1548
+ :where(.sm-list[data-peek]:not([data-open])) > :where(li:nth-child(n+4):not(.sm-list-more)){display:none}
1549
+ :where(.sm-list[data-peek]:not([data-open])) > :where(.sm-list-more){display:flex;color:var(--fg-muted)}
1550
+ }
1551
+
1496
1552
  /* ---------- Media gallery ---------- */
1497
1553
  :where(.sm-gallery){display:grid;gap:var(--s-2,8px);grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--sm-tile,140px)),1fr));margin:0;padding:0;list-style:none}
1498
1554
  :where(.sm-gallery) > :where(*){position:relative;margin:0;border-radius:var(--r-3,8px);overflow:hidden;background:var(--bg-inset)}
1499
1555
  :where(.sm-gallery) :where(img,video,canvas){display:block;width:100%;aspect-ratio:var(--sm-tile-ratio,1);object-fit:cover}
1500
1556
  :where(.sm-gallery) :where(figcaption){padding:6px 8px;font-size:var(--fs-caption,.8125rem);color:var(--fg-muted)}
1501
1557
  :where(.sm-gallery) :where([aria-selected="true"],.is-selected){box-shadow:inset 0 0 0 2px var(--fg)}
1558
+ /* Small tiles: more per row as the screen widens, never bigger tiles. */
1559
+ :where(.sm-gallery[data-size="small"]){--sm-tile:92px;--sm-tile-ratio:3/2}
1502
1560
 
1503
1561
  /* ---------- Status: a glyph and a few words, next to the action ---------- */
1504
1562
  :where(.sm-status){display:inline-flex;align-items:center;gap:var(--s-2,8px);min-height:24px;font-size:var(--fs-body-s,.875rem);color:var(--fg-muted)}