@hussmartinez/image-sdk 0.4.0 → 0.6.0

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
@@ -380,6 +380,11 @@
380
380
  cursor: move;
381
381
  }
382
382
 
383
+ /* An arrow's two ends: handles at the points themselves, wherever its frame is. */
384
+ .hm-image-layer-handle[data-hm-end] {
385
+ cursor: crosshair;
386
+ }
387
+
383
388
  .hm-image-layer-frame:hover {
384
389
  outline: var(--hm-border-width) dashed var(--hm-color-accent);
385
390
  }
@@ -452,7 +457,38 @@
452
457
  overflow: hidden;
453
458
  text-overflow: ellipsis;
454
459
  white-space: nowrap;
455
- justify-content: start;
460
+ }
461
+
462
+ /*
463
+ * The surface a stroke is drawn on (docs/adr/0015): it takes every press
464
+ * on the stage, and no touch gesture scrolls or zooms the page under one.
465
+ */
466
+ .hm-image-draw-overlay {
467
+ position: absolute;
468
+ inset: 0;
469
+ touch-action: none;
470
+ cursor: crosshair;
471
+ }
472
+
473
+ .hm-image-draw-panel {
474
+ display: grid;
475
+ gap: var(--hm-gap-normal);
476
+ }
477
+
478
+ .hm-image-draw-intro {
479
+ margin: 0;
480
+ }
481
+
482
+ .hm-image-editor--styled .hm-image-draw-intro {
483
+ color: var(--hm-color-text-muted);
484
+ }
485
+
486
+ /* Remove at the start, Done at the end. */
487
+ .hm-image-draw-actions {
488
+ display: flex;
489
+ flex-wrap: wrap;
490
+ justify-content: space-between;
491
+ gap: var(--hm-gap-tight);
456
492
  }
457
493
 
458
494
  .hm-image-editor-inspector:empty {
@@ -469,7 +505,8 @@
469
505
  /* Left and top, then width and height: two columns that shrink with the inspector. */
470
506
  .hm-image-crop-fields,
471
507
  .hm-image-redact-fields,
472
- .hm-image-layers-fields {
508
+ .hm-image-layers-fields,
509
+ .hm-image-layer-ends {
473
510
  display: grid;
474
511
  grid-template-columns: repeat(2, minmax(0, 1fr));
475
512
  gap: var(--hm-gap-tight);
@@ -541,8 +578,7 @@
541
578
  }
542
579
  }
543
580
 
544
- .hm-image-redact-areas ul,
545
- .hm-image-layers-list ul {
581
+ .hm-image-redact-areas ul {
546
582
  display: grid;
547
583
  gap: var(--hm-gap-tight);
548
584
  margin: 0;
@@ -551,8 +587,7 @@
551
587
  }
552
588
 
553
589
  /* An area's button takes the row, and its remove button the end. */
554
- .hm-image-redact-areas li,
555
- .hm-image-layers-list li {
590
+ .hm-image-redact-areas li {
556
591
  display: grid;
557
592
  grid-template-columns: minmax(0, 1fr) auto;
558
593
  gap: var(--hm-gap-tight);
@@ -0,0 +1,311 @@
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/v3.schema.json",
4
+ "title": "hm-image-command, version 3",
5
+ "description": "One user-level edit to an hm-image-plan (docs/formats/hm-image-plan.md, sdk-core ADR 0045). Version 2's commands are unchanged; this version adds the stroke commands, and drawings and arrows among the layers a command may carry. Beyond this schema, the reducer checks a crop against the plan's source, keys and indexes against the plan's lists, and each layer, stroke and redaction that results.",
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/v3.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/v3.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/v3.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/v3.schema.json#/$defs/metadataField"
67
+ },
68
+ "value": {
69
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v3.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/v3.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/v3.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/v3.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/v3.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/v3.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/v3.schema.json#/$defs/key"
174
+ },
175
+ "props": {
176
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v3.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/v3.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/v3.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/v3.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/v3.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/v3.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/v3.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/v3.schema.json#/$defs/key"
301
+ },
302
+ "props": {
303
+ "$ref": "https://github.com/ie-huss-martinez/image-sdk/blob/main/formats/hm-image-plan/v3.schema.json#/$defs/redactionProps"
304
+ }
305
+ }
306
+ }
307
+ }
308
+ }
309
+ }
310
+ ]
311
+ }