@hussmartinez/image-sdk 0.0.0-stage → 0.2.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.
@@ -0,0 +1,328 @@
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-plan/v1.schema.json",
4
+ "title": "hm-image-plan, version 1",
5
+ "description": "An image-sdk plan: one source, its crop, orientation, develop adjustments and filter, the export's size, and the metadata fields the user keeps (docs/formats/hm-image-plan.md, sdk-core ADR 0045). Positions are whole pixels of the oriented source. Beyond this schema, readers check that the base's source is one the document lists, and that its crop fits inside that source.",
6
+ "type": "object",
7
+ "required": ["format", "version", "sources", "base", "output", "metadata"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "format": {
11
+ "const": "hm-image-plan"
12
+ },
13
+ "version": {
14
+ "const": 1
15
+ },
16
+ "sources": {
17
+ "description": "The sources by id. The base names one of them.",
18
+ "type": "object",
19
+ "propertyNames": {
20
+ "minLength": 1
21
+ },
22
+ "additionalProperties": {
23
+ "$ref": "#/$defs/source"
24
+ }
25
+ },
26
+ "base": {
27
+ "$ref": "#/$defs/base"
28
+ },
29
+ "output": {
30
+ "$ref": "#/$defs/output"
31
+ },
32
+ "metadata": {
33
+ "$ref": "#/$defs/metadata"
34
+ }
35
+ },
36
+ "$defs": {
37
+ "pixels": {
38
+ "description": "A whole number of pixels from 0.",
39
+ "type": "integer",
40
+ "minimum": 0,
41
+ "maximum": 9007199254740991
42
+ },
43
+ "size": {
44
+ "description": "A whole number of pixels from 1.",
45
+ "type": "integer",
46
+ "minimum": 1,
47
+ "maximum": 9007199254740991
48
+ },
49
+ "asset": {
50
+ "description": "A content-addressed reference to a source's bytes. Documents never inline them.",
51
+ "type": "object",
52
+ "required": ["asset", "mediaType", "size"],
53
+ "additionalProperties": false,
54
+ "properties": {
55
+ "asset": {
56
+ "description": "sha256: and the lowercase hex SHA-256 of the bytes.",
57
+ "type": "string",
58
+ "pattern": "^sha256:[0-9a-f]{64}$"
59
+ },
60
+ "mediaType": {
61
+ "description": "The bytes' media type, in lowercase.",
62
+ "type": "string",
63
+ "maxLength": 255,
64
+ "pattern": "^[a-z0-9][a-z0-9!#$&^_.+-]*/[a-z0-9][a-z0-9!#$&^_.+-]*$"
65
+ },
66
+ "size": {
67
+ "description": "The size of the bytes.",
68
+ "type": "integer",
69
+ "minimum": 0,
70
+ "maximum": 9007199254740991
71
+ }
72
+ }
73
+ },
74
+ "source": {
75
+ "description": "A source's oriented size, after its EXIF orientation, which a crop must fit inside.",
76
+ "type": "object",
77
+ "required": ["width", "height"],
78
+ "additionalProperties": false,
79
+ "properties": {
80
+ "width": {
81
+ "$ref": "#/$defs/size"
82
+ },
83
+ "height": {
84
+ "$ref": "#/$defs/size"
85
+ },
86
+ "asset": {
87
+ "$ref": "#/$defs/asset"
88
+ }
89
+ }
90
+ },
91
+ "crop": {
92
+ "description": "A rectangle in whole pixels of the oriented source.",
93
+ "type": "object",
94
+ "required": ["x", "y", "width", "height"],
95
+ "additionalProperties": false,
96
+ "properties": {
97
+ "x": {
98
+ "$ref": "#/$defs/pixels"
99
+ },
100
+ "y": {
101
+ "$ref": "#/$defs/pixels"
102
+ },
103
+ "width": {
104
+ "$ref": "#/$defs/size"
105
+ },
106
+ "height": {
107
+ "$ref": "#/$defs/size"
108
+ }
109
+ }
110
+ },
111
+ "orientation": {
112
+ "description": "The plan's rotation, then its flips.",
113
+ "type": "object",
114
+ "required": ["rotate", "flipX", "flipY"],
115
+ "additionalProperties": false,
116
+ "properties": {
117
+ "rotate": {
118
+ "description": "Clockwise, in degrees.",
119
+ "enum": [0, 90, 180, 270]
120
+ },
121
+ "flipX": {
122
+ "type": "boolean"
123
+ },
124
+ "flipY": {
125
+ "type": "boolean"
126
+ }
127
+ }
128
+ },
129
+ "level": {
130
+ "description": "A develop adjustment: a whole number from -100 to 100, where 0 is unchanged.",
131
+ "type": "integer",
132
+ "minimum": -100,
133
+ "maximum": 100
134
+ },
135
+ "develop": {
136
+ "description": "Every develop adjustment, in the order they're applied.",
137
+ "type": "object",
138
+ "required": [
139
+ "temperature",
140
+ "tint",
141
+ "exposure",
142
+ "highlights",
143
+ "shadows",
144
+ "contrast",
145
+ "saturation",
146
+ "vibrance"
147
+ ],
148
+ "additionalProperties": false,
149
+ "properties": {
150
+ "temperature": {
151
+ "$ref": "#/$defs/level"
152
+ },
153
+ "tint": {
154
+ "$ref": "#/$defs/level"
155
+ },
156
+ "exposure": {
157
+ "$ref": "#/$defs/level"
158
+ },
159
+ "highlights": {
160
+ "$ref": "#/$defs/level"
161
+ },
162
+ "shadows": {
163
+ "$ref": "#/$defs/level"
164
+ },
165
+ "contrast": {
166
+ "$ref": "#/$defs/level"
167
+ },
168
+ "saturation": {
169
+ "$ref": "#/$defs/level"
170
+ },
171
+ "vibrance": {
172
+ "$ref": "#/$defs/level"
173
+ }
174
+ }
175
+ },
176
+ "developValues": {
177
+ "description": "Some develop adjustments; the others keep their values.",
178
+ "type": "object",
179
+ "required": [],
180
+ "additionalProperties": false,
181
+ "properties": {
182
+ "temperature": {
183
+ "$ref": "#/$defs/level"
184
+ },
185
+ "tint": {
186
+ "$ref": "#/$defs/level"
187
+ },
188
+ "exposure": {
189
+ "$ref": "#/$defs/level"
190
+ },
191
+ "highlights": {
192
+ "$ref": "#/$defs/level"
193
+ },
194
+ "shadows": {
195
+ "$ref": "#/$defs/level"
196
+ },
197
+ "contrast": {
198
+ "$ref": "#/$defs/level"
199
+ },
200
+ "saturation": {
201
+ "$ref": "#/$defs/level"
202
+ },
203
+ "vibrance": {
204
+ "$ref": "#/$defs/level"
205
+ }
206
+ }
207
+ },
208
+ "filter": {
209
+ "description": "A filter preset and its strength, or null for none.",
210
+ "oneOf": [
211
+ {
212
+ "type": "null"
213
+ },
214
+ {
215
+ "type": "object",
216
+ "required": ["preset", "strength"],
217
+ "additionalProperties": false,
218
+ "properties": {
219
+ "preset": {
220
+ "enum": ["vivid", "warm", "cool", "fade", "mono", "noir", "sepia"]
221
+ },
222
+ "strength": {
223
+ "type": "integer",
224
+ "minimum": 0,
225
+ "maximum": 100
226
+ }
227
+ }
228
+ }
229
+ ]
230
+ },
231
+ "output": {
232
+ "description": "The export's size: the composition scaled by a factor up to 1, or fitted inside a box without enlarging it. The scale is copied, never computed, so it compares exactly.",
233
+ "oneOf": [
234
+ {
235
+ "type": "object",
236
+ "required": ["kind", "scale"],
237
+ "additionalProperties": false,
238
+ "properties": {
239
+ "kind": {
240
+ "const": "scale"
241
+ },
242
+ "scale": {
243
+ "type": "number",
244
+ "exclusiveMinimum": 0,
245
+ "maximum": 1
246
+ }
247
+ }
248
+ },
249
+ {
250
+ "type": "object",
251
+ "required": ["kind", "width", "height"],
252
+ "additionalProperties": false,
253
+ "properties": {
254
+ "kind": {
255
+ "const": "fit"
256
+ },
257
+ "width": {
258
+ "$ref": "#/$defs/size"
259
+ },
260
+ "height": {
261
+ "$ref": "#/$defs/size"
262
+ }
263
+ }
264
+ }
265
+ ]
266
+ },
267
+ "metadataValue": {
268
+ "description": "Text to keep, or empty to keep nothing. Its length is in Unicode code points, as maxLength counts it.",
269
+ "type": "string",
270
+ "maxLength": 2000
271
+ },
272
+ "metadataField": {
273
+ "enum": ["title", "description", "artist", "copyright"]
274
+ },
275
+ "metadata": {
276
+ "description": "The fields the user keeps on export. Never a location.",
277
+ "type": "object",
278
+ "required": ["title", "description", "artist", "copyright"],
279
+ "additionalProperties": false,
280
+ "properties": {
281
+ "title": {
282
+ "$ref": "#/$defs/metadataValue"
283
+ },
284
+ "description": {
285
+ "$ref": "#/$defs/metadataValue"
286
+ },
287
+ "artist": {
288
+ "$ref": "#/$defs/metadataValue"
289
+ },
290
+ "copyright": {
291
+ "$ref": "#/$defs/metadataValue"
292
+ }
293
+ }
294
+ },
295
+ "base": {
296
+ "description": "The image being edited.",
297
+ "type": "object",
298
+ "required": ["source", "crop", "orientation", "develop", "filter"],
299
+ "additionalProperties": false,
300
+ "properties": {
301
+ "source": {
302
+ "description": "The id of a source the document lists.",
303
+ "type": "string",
304
+ "minLength": 1
305
+ },
306
+ "crop": {
307
+ "oneOf": [
308
+ {
309
+ "type": "null"
310
+ },
311
+ {
312
+ "$ref": "#/$defs/crop"
313
+ }
314
+ ]
315
+ },
316
+ "orientation": {
317
+ "$ref": "#/$defs/orientation"
318
+ },
319
+ "develop": {
320
+ "$ref": "#/$defs/develop"
321
+ },
322
+ "filter": {
323
+ "$ref": "#/$defs/filter"
324
+ }
325
+ }
326
+ }
327
+ }
328
+ }
package/package.json CHANGED
@@ -1,6 +1,120 @@
1
1
  {
2
2
  "name": "@hussmartinez/image-sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Client-side image SDK: a headless core, a React editor and a custom element. Images never leave the device.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ie-huss-martinez/image-sdk.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/ie-huss-martinez/image-sdk/issues"
12
+ },
13
+ "homepage": "https://github.com/ie-huss-martinez/image-sdk#readme",
14
+ "keywords": [
15
+ "image",
16
+ "image-editor",
17
+ "photo-editor",
18
+ "react",
19
+ "web-component",
20
+ "client-side"
21
+ ],
22
+ "type": "module",
23
+ "sideEffects": [
24
+ "**/*.css"
25
+ ],
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./react": {
32
+ "types": "./dist/react.d.ts",
33
+ "default": "./dist/react.js"
34
+ },
35
+ "./element": {
36
+ "types": "./dist/element.d.ts",
37
+ "default": "./dist/element.js"
38
+ },
39
+ "./styles.css": "./dist/styles.css",
40
+ "./formats/*": "./formats/*",
41
+ "./package.json": "./package.json"
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "formats"
46
+ ],
47
+ "engines": {
48
+ "node": ">=24"
49
+ },
50
+ "dependencies": {
51
+ "@hussmartinez/sdk-core": "^0.4.3",
52
+ "@hussmartinez/ui": "^0.7.0"
53
+ },
54
+ "peerDependencies": {
55
+ "react": ">=18.3",
56
+ "react-dom": ">=18.3"
57
+ },
58
+ "peerDependenciesMeta": {
59
+ "react": {
60
+ "optional": true
61
+ },
62
+ "react-dom": {
63
+ "optional": true
64
+ }
65
+ },
66
+ "devDependencies": {
67
+ "@arethetypeswrong/cli": "^0.18.5",
68
+ "@biomejs/biome": "^2.6.5",
69
+ "@changesets/changelog-github": "^1.0.1",
70
+ "@changesets/cli": "^3.0.3",
71
+ "@commitlint/cli": "^21.2.4",
72
+ "@hussmartinez/sdk-config": "^0.9.0",
73
+ "@microsoft/api-extractor": "^7.60.1",
74
+ "@size-limit/file": "^14.3.0",
75
+ "@types/node": "^24.19.2",
76
+ "@types/react": "^19.3.0",
77
+ "@types/react-dom": "^19.3.0",
78
+ "@vitest/browser-playwright": "5.1.0",
79
+ "dependency-cruiser": "^18.7.2",
80
+ "ajv": "^8.20.0",
81
+ "fast-check": "^4.10.2",
82
+ "husky": "^9.1.7",
83
+ "lint-staged": "^17.6.0",
84
+ "playwright": "1.65.0",
85
+ "publint": "^0.3.25",
86
+ "react": "^19.3.0",
87
+ "react-dom": "^19.3.0",
88
+ "secretlint": "^13.1.0",
89
+ "size-limit": "^14.3.0",
90
+ "stylelint": "^18.0.0",
91
+ "typescript": "^6.0.3",
92
+ "vite": "^8.3.6",
93
+ "vitest": "^5.1.0"
94
+ },
95
+ "scripts": {
96
+ "changeset": "changeset",
97
+ "lint": "biome check .",
98
+ "lint:css": "stylelint \"**/*.css\" --allow-empty-input",
99
+ "lint:deps": "hm-lint-deps src",
100
+ "check:single-copy": "hm-check-single-copy",
101
+ "check:playwright-image": "hm-check-playwright-image",
102
+ "conformance:update": "vitest run --project unit test/conformance --update",
103
+ "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.test.json",
104
+ "build": "vite build && pnpm check:api",
105
+ "test": "vitest run --project unit",
106
+ "test:browser": "hm-in-image vitest run --project browser",
107
+ "test:browser:all": "hm-in-image vitest run --project browser --mode all-browsers",
108
+ "bench": "vitest run --config vitest.bench.config.ts",
109
+ "build:examples": "pnpm --filter @hussmartinez/image-sdk-example-vite build",
110
+ "test:e2e": "pnpm --filter @hussmartinez/image-sdk-e2e test:e2e",
111
+ "test:visual": "hm-test-visual",
112
+ "test:visual:update": "hm-test-visual --update",
113
+ "check:size": "size-limit",
114
+ "check:api": "tsc -p tsconfig.build.json && api-extractor run && api-extractor run -c api-extractor.react.json && api-extractor run -c api-extractor.element.json",
115
+ "check:package": "publint run --pack pnpm --strict && attw --pack . --profile esm-only --exclude-entrypoints ./styles.css",
116
+ "api:update": "tsc -p tsconfig.build.json && api-extractor run --local && api-extractor run -c api-extractor.react.json --local && api-extractor run -c api-extractor.element.json --local",
117
+ "verify": "pnpm lint && pnpm lint:css && pnpm typecheck && pnpm lint:deps && pnpm check:single-copy && pnpm check:playwright-image && pnpm build && pnpm test && pnpm test:browser && pnpm build:examples && pnpm test:e2e && pnpm test:visual && pnpm check:size && pnpm check:api && pnpm check:package",
118
+ "verify:fast": "pnpm typecheck && pnpm test && pnpm lint:deps && pnpm check:single-copy && pnpm check:playwright-image && pnpm check:api"
119
+ }
6
120
  }