@hussmartinez/image-sdk 0.6.0 → 0.7.1

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/dist/styles.css CHANGED
@@ -104,6 +104,43 @@
104
104
  }
105
105
  }
106
106
 
107
+ /*
108
+ * An animation's bar sits under the stage (docs/adr/0011). The rows change
109
+ * only when it's there, so a still's layout is the same as without it.
110
+ */
111
+ .hm-image-editor-layout:has(> .hm-image-editor-timeline) {
112
+ grid-template-rows: auto minmax(calc(var(--hm-space-12) * 2.5), 1fr) auto minmax(0, auto);
113
+ grid-template-areas: "toolbar" "stage" "timeline" "inspector";
114
+ }
115
+
116
+ @container (width >= 720px) {
117
+ .hm-image-editor-layout:has(> .hm-image-editor-timeline) {
118
+ grid-template-rows: auto minmax(0, 1fr) auto;
119
+ grid-template-areas: "toolbar toolbar" "stage inspector" "timeline inspector";
120
+ }
121
+ }
122
+
123
+ .hm-image-editor-timeline {
124
+ grid-area: timeline;
125
+ }
126
+
127
+ /* Play, the scrubber taking the room, and where it is, on one line that wraps when narrow. */
128
+ .hm-image-timeline {
129
+ display: flex;
130
+ flex-wrap: wrap;
131
+ align-items: center;
132
+ gap: var(--hm-gap-normal);
133
+ }
134
+
135
+ .hm-image-timeline-scrubber {
136
+ flex: 1 1 calc(var(--hm-space-12) * 2);
137
+ min-inline-size: 0;
138
+ }
139
+
140
+ .hm-image-timeline-position {
141
+ font-variant-numeric: tabular-nums;
142
+ }
143
+
107
144
  .hm-image-editor--styled {
108
145
  font-family: var(--hm-font-family);
109
146
  color: var(--hm-color-text);
@@ -165,11 +202,30 @@
165
202
 
166
203
  .hm-image-stage-opening {
167
204
  display: flex;
205
+ /* A progress bar, its count and Cancel wrap on a narrow stage. */
206
+ flex-wrap: wrap;
168
207
  align-items: center;
169
208
  justify-content: center;
170
209
  gap: var(--hm-gap-normal);
171
210
  }
172
211
 
212
+ /*
213
+ * Over the first frame of an animation still opening (docs/adr/0011), the
214
+ * progress moves to the stage's foot, on a surface, so the image shows.
215
+ */
216
+ .hm-image-stage-opening--over-image {
217
+ align-self: end;
218
+ justify-self: center;
219
+ margin: var(--hm-inset-normal);
220
+ padding: var(--hm-inset-tight) var(--hm-inset-normal);
221
+ }
222
+
223
+ .hm-image-editor--styled .hm-image-stage-opening--over-image {
224
+ background: var(--hm-color-surface);
225
+ border: var(--hm-border-width) solid var(--hm-color-border);
226
+ border-radius: var(--hm-radius-surface);
227
+ }
228
+
173
229
  /* The notices and a failure, stacked at the stage's foot, over the image. */
174
230
  .hm-image-stage-foot {
175
231
  align-self: end;
@@ -578,6 +634,104 @@
578
634
  }
579
635
  }
580
636
 
637
+ /*
638
+ * The frames panel (docs/adr/0011). Its list scrolls within a fixed
639
+ * height wherever the inspector is, since an animation may have thousands
640
+ * of frames; only the rows in view draw their thumbnails.
641
+ */
642
+ .hm-image-frames-panel {
643
+ display: grid;
644
+ gap: var(--hm-gap-normal);
645
+ }
646
+
647
+ /*
648
+ * Under the stage, the list shows three and a half rows, so it's seen to
649
+ * scroll, and keeps its height whatever is done to the frames. A row is
650
+ * as tall as its thumbnail, half of --hm-space-12.
651
+ */
652
+ .hm-image-frames-list {
653
+ box-sizing: border-box;
654
+ block-size: calc(3.5 * (var(--hm-space-12) / 2 + var(--hm-gap-normal)));
655
+ overflow-y: auto;
656
+ }
657
+
658
+ /*
659
+ * Beside the stage, the list takes the inspector's height that the
660
+ * controls under it leave, so they're always in view.
661
+ */
662
+ @container (width >= 720px) {
663
+ .hm-image-editor-inspector:has(> .hm-image-frames-panel) {
664
+ align-content: stretch;
665
+ }
666
+
667
+ .hm-image-frames-panel {
668
+ grid-template-rows: minmax(calc(2 * var(--hm-space-12) / 2), 1fr);
669
+ min-block-size: 0;
670
+ }
671
+
672
+ .hm-image-frames-list {
673
+ block-size: auto;
674
+ min-block-size: 0;
675
+ }
676
+ }
677
+
678
+ /* A frame's row: its thumbnail, then its name, cut short when the inspector is narrow. */
679
+ .hm-image-frames-list .hm-image-frame-row {
680
+ display: flex;
681
+ align-items: center;
682
+ gap: var(--hm-gap-tight);
683
+ min-inline-size: 0;
684
+ }
685
+
686
+ .hm-image-frame-thumbnail {
687
+ display: block;
688
+ flex: none;
689
+ }
690
+
691
+ .hm-image-editor--styled .hm-image-frame-thumbnail {
692
+ background: var(--hm-color-surface-sunken);
693
+ border-radius: var(--hm-radius-sm);
694
+ }
695
+
696
+ .hm-image-frame-thumbnail-canvas {
697
+ display: block;
698
+ inline-size: 100%;
699
+ block-size: 100%;
700
+ }
701
+
702
+ .hm-image-frame-name {
703
+ min-inline-size: 0;
704
+ overflow: hidden;
705
+ text-overflow: ellipsis;
706
+ white-space: nowrap;
707
+ }
708
+
709
+ .hm-image-frames-order {
710
+ display: flex;
711
+ flex-wrap: wrap;
712
+ align-items: center;
713
+ gap: var(--hm-gap-tight);
714
+ }
715
+
716
+ .hm-image-frames-problem {
717
+ margin: 0;
718
+ }
719
+
720
+ .hm-image-editor--styled .hm-image-frames-problem {
721
+ color: var(--hm-color-danger-text);
722
+ }
723
+
724
+ .hm-image-frames-fields {
725
+ display: grid;
726
+ gap: var(--hm-gap-tight);
727
+ justify-items: start;
728
+ }
729
+
730
+ .hm-image-frames-actions {
731
+ display: flex;
732
+ justify-content: end;
733
+ }
734
+
581
735
  .hm-image-redact-areas ul {
582
736
  display: grid;
583
737
  gap: var(--hm-gap-tight);
@@ -0,0 +1,418 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-command/v4.schema.json",
4
+ "title": "hm-image-command, version 4",
5
+ "description": "One user-level edit to an hm-image-plan (docs/formats/hm-image-plan.md, sdk-core ADR 0045). Version 3's commands are unchanged; this version adds the commands that edit an animation's frames and its loop count (docs/adr/0011). Beyond this schema, the reducer checks a crop against the plan's source, keys and indexes against the plan's lists, each layer, stroke, redaction and frame that results, that the plan has an animation for a frame command, and that an animation keeps at least one frame.",
6
+ "oneOf": [
7
+ {
8
+ "description": "Sets the crop, or removes it with null.",
9
+ "type": "object",
10
+ "required": ["type", "crop"],
11
+ "additionalProperties": false,
12
+ "properties": {
13
+ "type": {
14
+ "const": "image.setCrop"
15
+ },
16
+ "crop": {
17
+ "oneOf": [
18
+ {
19
+ "type": "null"
20
+ },
21
+ {
22
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/crop"
23
+ }
24
+ ]
25
+ }
26
+ }
27
+ },
28
+ {
29
+ "description": "Sets the rotation and flips.",
30
+ "type": "object",
31
+ "required": ["type", "orientation"],
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "type": {
35
+ "const": "image.setOrientation"
36
+ },
37
+ "orientation": {
38
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/orientation"
39
+ }
40
+ }
41
+ },
42
+ {
43
+ "description": "Sets the export's size.",
44
+ "type": "object",
45
+ "required": ["type", "output"],
46
+ "additionalProperties": false,
47
+ "properties": {
48
+ "type": {
49
+ "const": "image.setOutput"
50
+ },
51
+ "output": {
52
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/output"
53
+ }
54
+ }
55
+ },
56
+ {
57
+ "description": "Sets one kept metadata field.",
58
+ "type": "object",
59
+ "required": ["type", "field", "value"],
60
+ "additionalProperties": false,
61
+ "properties": {
62
+ "type": {
63
+ "const": "image.setMetadata"
64
+ },
65
+ "field": {
66
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/metadataField"
67
+ },
68
+ "value": {
69
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/metadataValue"
70
+ }
71
+ }
72
+ },
73
+ {
74
+ "description": "Sets some develop adjustments.",
75
+ "type": "object",
76
+ "required": ["type", "values"],
77
+ "additionalProperties": false,
78
+ "properties": {
79
+ "type": {
80
+ "const": "image.setDevelop"
81
+ },
82
+ "values": {
83
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/developValues"
84
+ }
85
+ }
86
+ },
87
+ {
88
+ "description": "Sets the filter, or removes it with null.",
89
+ "type": "object",
90
+ "required": ["type", "filter"],
91
+ "additionalProperties": false,
92
+ "properties": {
93
+ "type": {
94
+ "const": "image.setFilter"
95
+ },
96
+ "filter": {
97
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/filter"
98
+ }
99
+ }
100
+ },
101
+ {
102
+ "description": "Inserts layers at an index: 0 is under every layer.",
103
+ "type": "object",
104
+ "required": ["type", "at", "layers"],
105
+ "additionalProperties": false,
106
+ "properties": {
107
+ "type": {
108
+ "const": "image.insertLayers"
109
+ },
110
+ "at": {
111
+ "type": "integer",
112
+ "minimum": 0
113
+ },
114
+ "layers": {
115
+ "type": "array",
116
+ "minItems": 1,
117
+ "items": {
118
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/layer"
119
+ }
120
+ }
121
+ }
122
+ },
123
+ {
124
+ "description": "Removes layers, by key.",
125
+ "type": "object",
126
+ "required": ["type", "keys"],
127
+ "additionalProperties": false,
128
+ "properties": {
129
+ "type": {
130
+ "const": "image.removeLayers"
131
+ },
132
+ "keys": {
133
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/keys"
134
+ }
135
+ }
136
+ },
137
+ {
138
+ "description": "Moves layers to an index of the list without them, keeping their order.",
139
+ "type": "object",
140
+ "required": ["type", "keys", "to"],
141
+ "additionalProperties": false,
142
+ "properties": {
143
+ "type": {
144
+ "const": "image.moveLayers"
145
+ },
146
+ "keys": {
147
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/keys"
148
+ },
149
+ "to": {
150
+ "type": "integer",
151
+ "minimum": 0
152
+ }
153
+ }
154
+ },
155
+ {
156
+ "description": "Sets some fields of some layers.",
157
+ "type": "object",
158
+ "required": ["type", "updates"],
159
+ "additionalProperties": false,
160
+ "properties": {
161
+ "type": {
162
+ "const": "image.updateLayers"
163
+ },
164
+ "updates": {
165
+ "type": "array",
166
+ "minItems": 1,
167
+ "items": {
168
+ "type": "object",
169
+ "required": ["key", "props"],
170
+ "additionalProperties": false,
171
+ "properties": {
172
+ "key": {
173
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/key"
174
+ },
175
+ "props": {
176
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/layerProps"
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ },
183
+ {
184
+ "description": "Appends strokes to a drawing layer: one stroke for each gesture.",
185
+ "type": "object",
186
+ "required": ["type", "key", "strokes"],
187
+ "additionalProperties": false,
188
+ "properties": {
189
+ "type": {
190
+ "const": "image.addStrokes"
191
+ },
192
+ "key": {
193
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/key"
194
+ },
195
+ "strokes": {
196
+ "type": "array",
197
+ "minItems": 1,
198
+ "maxItems": 1024,
199
+ "items": {
200
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/drawnStroke"
201
+ }
202
+ }
203
+ }
204
+ },
205
+ {
206
+ "description": "Removes strokes from a drawing layer, by index. A drawing keeps at least one.",
207
+ "type": "object",
208
+ "required": ["type", "key", "indexes"],
209
+ "additionalProperties": false,
210
+ "properties": {
211
+ "type": {
212
+ "const": "image.removeStrokes"
213
+ },
214
+ "key": {
215
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/key"
216
+ },
217
+ "indexes": {
218
+ "type": "array",
219
+ "minItems": 1,
220
+ "maxItems": 1024,
221
+ "items": {
222
+ "type": "integer",
223
+ "minimum": 0
224
+ }
225
+ }
226
+ }
227
+ },
228
+ {
229
+ "description": "Inserts redactions at an index.",
230
+ "type": "object",
231
+ "required": ["type", "at", "redactions"],
232
+ "additionalProperties": false,
233
+ "properties": {
234
+ "type": {
235
+ "const": "image.insertRedactions"
236
+ },
237
+ "at": {
238
+ "type": "integer",
239
+ "minimum": 0
240
+ },
241
+ "redactions": {
242
+ "type": "array",
243
+ "minItems": 1,
244
+ "items": {
245
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/redaction"
246
+ }
247
+ }
248
+ }
249
+ },
250
+ {
251
+ "description": "Removes redactions, by key.",
252
+ "type": "object",
253
+ "required": ["type", "keys"],
254
+ "additionalProperties": false,
255
+ "properties": {
256
+ "type": {
257
+ "const": "image.removeRedactions"
258
+ },
259
+ "keys": {
260
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/keys"
261
+ }
262
+ }
263
+ },
264
+ {
265
+ "description": "Moves redactions to an index of the list without them, keeping their order.",
266
+ "type": "object",
267
+ "required": ["type", "keys", "to"],
268
+ "additionalProperties": false,
269
+ "properties": {
270
+ "type": {
271
+ "const": "image.moveRedactions"
272
+ },
273
+ "keys": {
274
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/keys"
275
+ },
276
+ "to": {
277
+ "type": "integer",
278
+ "minimum": 0
279
+ }
280
+ }
281
+ },
282
+ {
283
+ "description": "Sets some fields of some redactions.",
284
+ "type": "object",
285
+ "required": ["type", "updates"],
286
+ "additionalProperties": false,
287
+ "properties": {
288
+ "type": {
289
+ "const": "image.updateRedactions"
290
+ },
291
+ "updates": {
292
+ "type": "array",
293
+ "minItems": 1,
294
+ "items": {
295
+ "type": "object",
296
+ "required": ["key", "props"],
297
+ "additionalProperties": false,
298
+ "properties": {
299
+ "key": {
300
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/key"
301
+ },
302
+ "props": {
303
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/redactionProps"
304
+ }
305
+ }
306
+ }
307
+ }
308
+ }
309
+ },
310
+ {
311
+ "description": "Inserts frames into the animation at an index, such as duplicates.",
312
+ "type": "object",
313
+ "required": ["type", "at", "frames"],
314
+ "additionalProperties": false,
315
+ "properties": {
316
+ "type": {
317
+ "const": "image.insertFrames"
318
+ },
319
+ "at": {
320
+ "type": "integer",
321
+ "minimum": 0
322
+ },
323
+ "frames": {
324
+ "type": "array",
325
+ "minItems": 1,
326
+ "items": {
327
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/frame"
328
+ }
329
+ }
330
+ }
331
+ },
332
+ {
333
+ "description": "Removes frames, by key. An animation keeps at least one.",
334
+ "type": "object",
335
+ "required": ["type", "keys"],
336
+ "additionalProperties": false,
337
+ "properties": {
338
+ "type": {
339
+ "const": "image.removeFrames"
340
+ },
341
+ "keys": {
342
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/keys"
343
+ }
344
+ }
345
+ },
346
+ {
347
+ "description": "Moves frames to an index of the list without them, keeping their order.",
348
+ "type": "object",
349
+ "required": ["type", "keys", "to"],
350
+ "additionalProperties": false,
351
+ "properties": {
352
+ "type": {
353
+ "const": "image.moveFrames"
354
+ },
355
+ "keys": {
356
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/keys"
357
+ },
358
+ "to": {
359
+ "type": "integer",
360
+ "minimum": 0
361
+ }
362
+ }
363
+ },
364
+ {
365
+ "description": "Reverses the order the frames play in.",
366
+ "type": "object",
367
+ "required": ["type"],
368
+ "additionalProperties": false,
369
+ "properties": {
370
+ "type": {
371
+ "const": "image.reverseFrames"
372
+ }
373
+ }
374
+ },
375
+ {
376
+ "description": "Sets some frames' delays.",
377
+ "type": "object",
378
+ "required": ["type", "updates"],
379
+ "additionalProperties": false,
380
+ "properties": {
381
+ "type": {
382
+ "const": "image.updateFrames"
383
+ },
384
+ "updates": {
385
+ "type": "array",
386
+ "minItems": 1,
387
+ "items": {
388
+ "type": "object",
389
+ "required": ["key", "props"],
390
+ "additionalProperties": false,
391
+ "properties": {
392
+ "key": {
393
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/key"
394
+ },
395
+ "props": {
396
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/frameProps"
397
+ }
398
+ }
399
+ }
400
+ }
401
+ }
402
+ },
403
+ {
404
+ "description": "Sets how many times the animation repeats: null for once, 0 for ever.",
405
+ "type": "object",
406
+ "required": ["type", "loop"],
407
+ "additionalProperties": false,
408
+ "properties": {
409
+ "type": {
410
+ "const": "image.setLoop"
411
+ },
412
+ "loop": {
413
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v4.schema.json#/$defs/loop"
414
+ }
415
+ }
416
+ }
417
+ ]
418
+ }