@molecule/app-feature-image-canvas-solid 0.0.0-stage → 1.1.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,129 @@
1
+ /**
2
+ * Types for the Solid Canvas2D image-editing surface — the same types
3
+ * `@molecule/app-feature-image-canvas-react` exports.
4
+ *
5
+ * @module
6
+ */
7
+ /**
8
+ * A two-dimensional offset, in CSS pixels, applied to the rendered image
9
+ * relative to the centre of the canvas. Positive `x` shifts the image
10
+ * right; positive `y` shifts it down.
11
+ */
12
+ export interface PanOffset {
13
+ /** Horizontal offset, in CSS pixels. */
14
+ x: number;
15
+ /** Vertical offset, in CSS pixels. */
16
+ y: number;
17
+ }
18
+ /**
19
+ * Filter parameters applied to the source image before it is rendered to
20
+ * the canvas. Every field is optional — omitted fields disable that
21
+ * filter. Values are clamped at compose time so out-of-range numbers are
22
+ * safe.
23
+ *
24
+ * Implementation note: composition uses the Canvas2D `filter` property
25
+ * (CSS `<filter-function>` syntax). Compose order is preserved.
26
+ */
27
+ export interface ImageCanvasFilters {
28
+ /**
29
+ * Brightness multiplier. `1` is identity, `0` is black, `2` is twice
30
+ * as bright. Values < 0 are clamped to 0.
31
+ */
32
+ brightness?: number;
33
+ /**
34
+ * Contrast multiplier. `1` is identity, `0` is fully grey, `2` is
35
+ * twice the contrast. Values < 0 are clamped to 0.
36
+ */
37
+ contrast?: number;
38
+ /**
39
+ * Saturation multiplier. `1` is identity, `0` is grayscale, `2` is
40
+ * twice as saturated. Values < 0 are clamped to 0.
41
+ */
42
+ saturation?: number;
43
+ /**
44
+ * Hue rotation in degrees. Normalised modulo 360 — any finite value
45
+ * is accepted.
46
+ */
47
+ hue?: number;
48
+ /**
49
+ * Sepia amount in `[0, 1]`. `0` disables; `1` applies fully. Values
50
+ * outside the range are clamped.
51
+ */
52
+ sepia?: number;
53
+ /**
54
+ * Grayscale amount in `[0, 1]`. `0` disables; `1` applies fully.
55
+ * Values outside the range are clamped.
56
+ */
57
+ grayscale?: number;
58
+ /**
59
+ * Gaussian blur radius in CSS pixels. `0` disables. Negative values
60
+ * are clamped to 0.
61
+ */
62
+ blur?: number;
63
+ /**
64
+ * Sharpen strength in `[0, 1]`. Approximated as a negative-blur
65
+ * contrast bump using the CSS `contrast()` filter; `0` disables.
66
+ * Values outside the range are clamped.
67
+ */
68
+ sharpen?: number;
69
+ }
70
+ /**
71
+ * Imperative export handle exposed via `exportRef`. Callers use this to
72
+ * grab the current rendered image (with all filters, zoom, and pan
73
+ * baked in) as a data URL.
74
+ */
75
+ export interface ImageCanvasExportHandle {
76
+ /**
77
+ * Snapshot the current canvas as a data URL.
78
+ *
79
+ * @param type - Image MIME type. Defaults to `image/png`.
80
+ * @param quality - Lossy quality in `[0, 1]` for `image/jpeg` /
81
+ * `image/webp`. Ignored for `image/png`.
82
+ * @returns A data URL string, or an empty string if the canvas is not
83
+ * yet mounted.
84
+ */
85
+ toDataURL: (type?: string, quality?: number) => string;
86
+ }
87
+ /** ImageCanvas component props (React's prop names). */
88
+ export interface ImageCanvasProps {
89
+ /**
90
+ * Image source. Either a string (URL or data URL) — which the
91
+ * component loads into an internal `HTMLImageElement` — or an
92
+ * already-loaded `HTMLImageElement` the caller manages.
93
+ */
94
+ src: string | HTMLImageElement;
95
+ /** Filter chain applied to the rendered image. */
96
+ filters?: ImageCanvasFilters;
97
+ /**
98
+ * Zoom factor. `1` is identity. Values <= 0 fall back to `1`.
99
+ * Defaults to `1`.
100
+ */
101
+ zoom?: number;
102
+ /**
103
+ * Pan offset in CSS pixels relative to the centre of the canvas.
104
+ * Defaults to `{ x: 0, y: 0 }`.
105
+ */
106
+ pan?: PanOffset;
107
+ /**
108
+ * Optional callback fired when the user pans or zooms the canvas.
109
+ * Use this for controlled-component patterns.
110
+ */
111
+ onChange?: (next: {
112
+ zoom: number;
113
+ pan: PanOffset;
114
+ }) => void;
115
+ /**
116
+ * Imperative handle exposing `toDataURL()` for the caller to grab
117
+ * the rendered result.
118
+ */
119
+ exportRef?: {
120
+ current: ImageCanvasExportHandle | null;
121
+ };
122
+ /** Pixel width of the canvas. Defaults to `512`. */
123
+ width?: number;
124
+ /** Pixel height of the canvas. Defaults to `512`. */
125
+ height?: number;
126
+ /** Extra classes merged onto the root element. */
127
+ className?: string;
128
+ }
129
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,wCAAwC;IACxC,CAAC,EAAE,MAAM,CAAA;IACT,sCAAsC;IACtC,CAAC,EAAE,MAAM,CAAA;CACV;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;OAQG;IACH,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CACvD;AAED,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;IAC9B,kDAAkD;IAClD,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,SAAS,CAAA;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,SAAS,CAAA;KAAE,KAAK,IAAI,CAAA;IAC3D;;;OAGG;IACH,SAAS,CAAC,EAAE;QAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAA;KAAE,CAAA;IACvD,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types for the Solid Canvas2D image-editing surface — the same types
3
+ * `@molecule/app-feature-image-canvas-react` exports.
4
+ *
5
+ * @module
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,68 @@
1
1
  {
2
2
  "name": "@molecule/app-feature-image-canvas-solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Canvas2D image-editing surface — accepts an image source, applies a filter chain (brightness, contrast, saturation, hue, sepia, grayscale, blur, sharpen), supports zoom + pan, exports back to data URL",
5
+ "homepage": "https://www.molecule.dev/packages/app-feature-image-canvas-solid",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "image-canvas",
28
+ "image",
29
+ "canvas",
30
+ "filters",
31
+ "photo-editor",
32
+ "solid"
33
+ ],
34
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
35
+ "license": "Apache-2.0",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/molecule-dev/molecule.git",
39
+ "directory": "packages/app/features/feature-image-canvas-solid"
40
+ },
41
+ "engines": {
42
+ "node": ">=20"
43
+ },
44
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "peerDependencies": {
49
+ "@molecule/app-solid": "^3.5.0",
50
+ "@molecule/app-ui": "^1.0.1",
51
+ "@molecule/app-ui-solid": "^1.1.0",
52
+ "solid-js": "^1.8.0"
53
+ },
54
+ "devDependencies": {
55
+ "@molecule/app-framework-conformance": "0.0.0",
56
+ "@molecule/app-i18n": "1.2.2",
57
+ "@molecule/app-icons": "1.0.4",
58
+ "@molecule/app-solid": "3.9.0",
59
+ "@molecule/app-ui": "1.5.0",
60
+ "@molecule/app-ui-solid": "1.2.1",
61
+ "@types/node": "26.6.5",
62
+ "jsdom": "30.1.3",
63
+ "solid-js": "1.9.17",
64
+ "typescript": "6.0.3",
65
+ "vite-plugin-solid": "2.11.15",
66
+ "vitest": "4.1.12"
67
+ }
68
+ }