@sealpixel/react 1.0.0-rc.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/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # @sealpixel/react
2
+
3
+ ```tsx
4
+ import { SealpixelEditor } from "@sealpixel/react";
5
+ <SealpixelEditor src={file} editLog={log} onChange={(e) => setLog(e.detail)} />
6
+ ```
@@ -0,0 +1,29 @@
1
+ import { type EventName } from '@lit/react';
2
+ import { type EditorSession, type ExportResult, type SealpixelError, type SessionOptions, type SessionState, type SourceDescriptor } from '@sealpixel/core';
3
+ import { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';
4
+ import * as React from 'react';
5
+ export type { EditorSession, SessionOptions, SessionState } from '@sealpixel/core';
6
+ /**
7
+ * `<SealpixelEditor>` for React 18 and 19. Props map to the element's properties.
8
+ * Controlled: pass `editLog` and `onChange`; uncontrolled: `defaultEditLog`.
9
+ */
10
+ export declare const SealpixelEditor: import("@lit/react").ReactWebComponent<SealpixelEditorElement, {
11
+ onChange: EventName<CustomEvent<{
12
+ log: unknown;
13
+ index: number;
14
+ }>>;
15
+ onProcess: EventName<CustomEvent<ExportResult>>;
16
+ onError: EventName<CustomEvent<SealpixelError>>;
17
+ onReady: EventName<CustomEvent<void>>;
18
+ onLoad: EventName<CustomEvent<SourceDescriptor>>;
19
+ }>;
20
+ export type SealpixelEditorProps = React.ComponentProps<typeof SealpixelEditor>;
21
+ /**
22
+ * Headless use: one session per component instance, state via
23
+ * `useSyncExternalStore`. Dispose happens on unmount.
24
+ */
25
+ export declare function useSealpixelSession(options: SessionOptions): {
26
+ session: EditorSession;
27
+ state: SessionState;
28
+ };
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnF;;;GAGG;AACH,eAAO,MAAM,eAAe;cAKQ,SAAS,CAAC,WAAW,CAAC;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;eACrD,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;aACxC,SAAS,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;aACtC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC9B,SAAS,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;EAEtE,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC;AAEhF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG;IAC5D,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;CACrB,CAWA"}
package/dist/index.js ADDED
@@ -0,0 +1,34 @@
1
+ import { createComponent } from '@lit/react';
2
+ import { createEditorSession, } from '@sealpixel/core';
3
+ import { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';
4
+ import * as React from 'react';
5
+ /**
6
+ * `<SealpixelEditor>` for React 18 and 19. Props map to the element's properties.
7
+ * Controlled: pass `editLog` and `onChange`; uncontrolled: `defaultEditLog`.
8
+ */
9
+ export const SealpixelEditor = createComponent({
10
+ react: React,
11
+ tagName: 'sealpixel-editor',
12
+ elementClass: SealpixelEditorElement,
13
+ events: {
14
+ onChange: 'sealpixel:change',
15
+ onProcess: 'sealpixel:process',
16
+ onError: 'sealpixel:error',
17
+ onReady: 'sealpixel:ready',
18
+ onLoad: 'sealpixel:load',
19
+ },
20
+ });
21
+ /**
22
+ * Headless use: one session per component instance, state via
23
+ * `useSyncExternalStore`. Dispose happens on unmount.
24
+ */
25
+ export function useSealpixelSession(options) {
26
+ const ref = React.useRef(null);
27
+ if (ref.current === null)
28
+ ref.current = createEditorSession(options);
29
+ const session = ref.current;
30
+ React.useEffect(() => () => session.dispose(), [session]);
31
+ const state = React.useSyncExternalStore((listener) => session.subscribe(() => listener()), () => session.getState(), () => session.getState());
32
+ return { session, state };
33
+ }
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,mBAAmB,GAOpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;IAC7C,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,kBAAkB;IAC3B,YAAY,EAAE,sBAAsB;IACpC,MAAM,EAAE;QACN,QAAQ,EAAE,kBAA6E;QACvF,SAAS,EAAE,mBAA2D;QACtE,OAAO,EAAE,iBAA2D;QACpE,OAAO,EAAE,iBAAiD;QAC1D,MAAM,EAAE,gBAA4D;KACrE;CACF,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IAIzD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAuB,IAAI,CAAC,CAAC;IACrD,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI;QAAE,GAAG,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC5B,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,KAAK,CAAC,oBAAoB,CACtC,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,EACjD,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EACxB,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CACzB,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@sealpixel/react",
3
+ "version": "1.0.0-rc.0",
4
+ "description": "React bindings for the Sealpixel image editor: <SealpixelEditor> with controlled and uncontrolled edit logs, and useSealpixelSession for headless use.",
5
+ "license": "BUSL-1.1",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/9feet/sealpixel.git",
9
+ "directory": "packages/react"
10
+ },
11
+ "homepage": "https://docs.sealpixel.dev",
12
+ "bugs": "https://github.com/9feet/sealpixel/issues",
13
+ "type": "module",
14
+ "sideEffects": false,
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.build.json",
28
+ "typecheck": "tsc -p tsconfig.json --noEmit"
29
+ },
30
+ "dependencies": {
31
+ "@lit/react": "^1.0.8",
32
+ "@sealpixel/core": "workspace:*",
33
+ "@sealpixel/element": "workspace:*",
34
+ "@sealpixel/ui": "workspace:*"
35
+ },
36
+ "peerDependencies": {
37
+ "react": "^18.0.0 || ^19.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "@sealpixel/config": "workspace:*",
41
+ "@types/node": "^24.0.0",
42
+ "@types/react": "^19.0.0",
43
+ "react": "^19.0.0",
44
+ "typescript": "^5.9.0"
45
+ }
46
+ }