@sealpixel/react 1.0.0-rc.2 → 1.0.0-rc.20
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/LICENSE.md +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +49 -10
- package/dist/index.js.map +1 -1
- package/package.json +12 -7
- package/dist/index.d.ts.map +0 -1
package/LICENSE.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Licensor:** nine feet UG (haftungsbeschränkt), Germany (https://9feet.io)
|
|
6
6
|
|
|
7
|
-
**Licensed Work:** Sealpixel, in every version the Licensor publishes: the source code, the npm packages under the `@sealpixel` scope and the unscoped `sealpixel` package, the Rust crates, the WebAssembly binaries, the documentation and the example projects. The Licensed Work is (c) 2026 nine feet UG (haftungsbeschränkt).
|
|
7
|
+
**Licensed Work:** Sealpixel, in every version the Licensor publishes: the source code, the npm packages under the `@sealpixel` scope and the unscoped `sealpixel` package, the Rust crates, the WebAssembly binaries, the documentation and the example projects, except the package `@sealpixel/c2pa-sign` and the crate `sealpixel-c2pa-sign`, which are licensed under the Business Source License 1.1 with their own parameters in `packages/c2pa-sign/LICENSE.md`. The Licensed Work is (c) 2026 nine feet UG (haftungsbeschränkt).
|
|
8
8
|
|
|
9
9
|
**Additional Use Grant:** You may make production use of the Licensed Work if you are a Small User. You are a Small User if you are a natural person acting for yourself, or if the organization you act for had less than EUR 1,000,000 of gross revenue in its most recent completed financial year. Revenue is counted across the whole group: the organization, everything that controls it, everything it controls, and everything under common control with it. Where the work is done for a client, the client's revenue decides.
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ This Additional Use Grant does not permit offering the Licensed Work, or a work
|
|
|
16
16
|
|
|
17
17
|
For information about alternative licensing arrangements for the Licensed Work, please visit: https://sealpixel.dev/pricing
|
|
18
18
|
|
|
19
|
-
Organizations, and anyone who develops with the Licensed Work for an organization, obtain the commercial license this License refers to as developer seats under the Sealpixel Developer Seat License
|
|
19
|
+
Organizations, and anyone who develops with the Licensed Work for an organization, obtain the commercial license this License refers to as developer seats under the Sealpixel Developer Seat License, published at https://sealpixel.dev/license#seats and as `LICENSE-COMMERCIAL.md` in the source repository.
|
|
20
20
|
|
|
21
21
|
## Notice
|
|
22
22
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,7 @@ import { type EditorSession, type ExportResult, type SealpixelError, type Sessio
|
|
|
3
3
|
import { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';
|
|
4
4
|
import * as React from 'react';
|
|
5
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, {
|
|
6
|
+
declare const LitSealpixelEditor: import("@lit/react").ReactWebComponent<SealpixelEditorElement, {
|
|
11
7
|
onChange: EventName<CustomEvent<{
|
|
12
8
|
log: unknown;
|
|
13
9
|
index: number;
|
|
@@ -17,6 +13,11 @@ export declare const SealpixelEditor: import("@lit/react").ReactWebComponent<Sea
|
|
|
17
13
|
onReady: EventName<CustomEvent<void>>;
|
|
18
14
|
onLoad: EventName<CustomEvent<SourceDescriptor>>;
|
|
19
15
|
}>;
|
|
16
|
+
/**
|
|
17
|
+
* `<SealpixelEditor>` for React 18 and 19. Props map to the element's properties.
|
|
18
|
+
* Controlled: pass `editLog` and `onChange`; uncontrolled: `defaultEditLog`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SealpixelEditor: typeof LitSealpixelEditor;
|
|
20
21
|
export type SealpixelEditorProps = React.ComponentProps<typeof SealpixelEditor>;
|
|
21
22
|
/**
|
|
22
23
|
* Headless use: one session per component instance, state via
|
|
@@ -26,4 +27,3 @@ export declare function useSealpixelSession(options: SessionOptions): {
|
|
|
26
27
|
session: EditorSession;
|
|
27
28
|
state: SessionState;
|
|
28
29
|
};
|
|
29
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,7 @@ import { createComponent } from '@lit/react';
|
|
|
2
2
|
import { createEditorSession, } from '@sealpixel/core';
|
|
3
3
|
import { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';
|
|
4
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({
|
|
5
|
+
const LitSealpixelEditor = createComponent({
|
|
10
6
|
react: React,
|
|
11
7
|
tagName: 'sealpixel-editor',
|
|
12
8
|
elementClass: SealpixelEditorElement,
|
|
@@ -18,17 +14,60 @@ export const SealpixelEditor = createComponent({
|
|
|
18
14
|
onLoad: 'sealpixel:load',
|
|
19
15
|
},
|
|
20
16
|
});
|
|
17
|
+
/**
|
|
18
|
+
* `<SealpixelEditor>` for React 18 and 19. Props map to the element's properties.
|
|
19
|
+
* Controlled: pass `editLog` and `onChange`; uncontrolled: `defaultEditLog`.
|
|
20
|
+
*/
|
|
21
|
+
export const SealpixelEditor = React.forwardRef(function SealpixelEditor(props, ref) {
|
|
22
|
+
const { onReady } = props;
|
|
23
|
+
const element = React.useRef(null);
|
|
24
|
+
const announced = React.useRef(null);
|
|
25
|
+
const setRef = React.useCallback((node) => {
|
|
26
|
+
element.current = node;
|
|
27
|
+
if (typeof ref === 'function')
|
|
28
|
+
ref(node);
|
|
29
|
+
else if (ref)
|
|
30
|
+
ref.current = node;
|
|
31
|
+
}, [ref]);
|
|
32
|
+
// The element creates its session and fires `sealpixel:ready` when React
|
|
33
|
+
// inserts it. @lit/react attaches listeners later, in a layout effect, so
|
|
34
|
+
// that first event reaches nobody. This layout effect runs after the child's
|
|
35
|
+
// and delivers it once per element.
|
|
36
|
+
React.useLayoutEffect(() => {
|
|
37
|
+
const node = element.current;
|
|
38
|
+
if (!node || announced.current === node)
|
|
39
|
+
return;
|
|
40
|
+
announced.current = node;
|
|
41
|
+
if (node.isConnected)
|
|
42
|
+
onReady?.(new CustomEvent('sealpixel:ready'));
|
|
43
|
+
}, [onReady]);
|
|
44
|
+
return React.createElement(LitSealpixelEditor, { ...props, ref: setRef });
|
|
45
|
+
});
|
|
46
|
+
// #region headless
|
|
21
47
|
/**
|
|
22
48
|
* Headless use: one session per component instance, state via
|
|
23
49
|
* `useSyncExternalStore`. Dispose happens on unmount.
|
|
24
50
|
*/
|
|
25
51
|
export function useSealpixelSession(options) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
React.useEffect(() =>
|
|
52
|
+
const [session, setSession] = React.useState(() => createEditorSession(options));
|
|
53
|
+
const disposed = React.useRef(null);
|
|
54
|
+
const latestOptions = React.useRef(options);
|
|
55
|
+
latestOptions.current = options;
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
// StrictMode, and a component that React hides and shows again, run the
|
|
58
|
+
// cleanup and then this effect again. The disposed session cannot be used
|
|
59
|
+
// again, so replace it.
|
|
60
|
+
if (disposed.current === session) {
|
|
61
|
+
setSession(createEditorSession(latestOptions.current));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
return () => {
|
|
65
|
+
disposed.current = session;
|
|
66
|
+
session.dispose();
|
|
67
|
+
};
|
|
68
|
+
}, [session]);
|
|
31
69
|
const state = React.useSyncExternalStore((listener) => session.subscribe(() => listener()), () => session.getState(), () => session.getState());
|
|
32
70
|
return { session, state };
|
|
33
71
|
}
|
|
72
|
+
// #endregion headless
|
|
34
73
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"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ACjC,UAAU,CAAC,mBAAmB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;YACvD,OAAO;QACT,CAAC;QACD,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;YAC3B,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACd,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;AACD,sBAAsB","sourcesContent":["import { createComponent, type EventName } from '@lit/react';\nimport {\n createEditorSession,\n type EditorSession,\n type ExportResult,\n type SealpixelError,\n type SessionOptions,\n type SessionState,\n type SourceDescriptor,\n} from '@sealpixel/core';\nimport { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';\nimport * as React from 'react';\n\nexport type { EditorSession, SessionOptions, SessionState } from '@sealpixel/core';\n\nconst LitSealpixelEditor = createComponent({\n react: React,\n tagName: 'sealpixel-editor',\n elementClass: SealpixelEditorElement,\n events: {\n onChange: 'sealpixel:change' as EventName<CustomEvent<{ log: unknown; index: number }>>,\n onProcess: 'sealpixel:process' as EventName<CustomEvent<ExportResult>>,\n onError: 'sealpixel:error' as EventName<CustomEvent<SealpixelError>>,\n onReady: 'sealpixel:ready' as EventName<CustomEvent<void>>,\n onLoad: 'sealpixel:load' as EventName<CustomEvent<SourceDescriptor>>,\n },\n});\n\n/**\n * `<SealpixelEditor>` for React 18 and 19. Props map to the element's properties.\n * Controlled: pass `editLog` and `onChange`; uncontrolled: `defaultEditLog`.\n */\nexport const SealpixelEditor: typeof LitSealpixelEditor = React.forwardRef<\n SealpixelEditorElement,\n React.ComponentPropsWithoutRef<typeof LitSealpixelEditor>\n>(function SealpixelEditor(props, ref) {\n const { onReady } = props;\n const element = React.useRef<SealpixelEditorElement | null>(null);\n const announced = React.useRef<SealpixelEditorElement | null>(null);\n const setRef = React.useCallback(\n (node: SealpixelEditorElement | null) => {\n element.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n // The element creates its session and fires `sealpixel:ready` when React\n // inserts it. @lit/react attaches listeners later, in a layout effect, so\n // that first event reaches nobody. This layout effect runs after the child's\n // and delivers it once per element.\n React.useLayoutEffect(() => {\n const node = element.current;\n if (!node || announced.current === node) return;\n announced.current = node;\n if (node.isConnected) onReady?.(new CustomEvent('sealpixel:ready'));\n }, [onReady]);\n return React.createElement(LitSealpixelEditor, { ...props, ref: setRef });\n});\n\nexport type SealpixelEditorProps = React.ComponentProps<typeof SealpixelEditor>;\n\n// #region headless\n/**\n * Headless use: one session per component instance, state via\n * `useSyncExternalStore`. Dispose happens on unmount.\n */\nexport function useSealpixelSession(options: SessionOptions): {\n session: EditorSession;\n state: SessionState;\n} {\n const [session, setSession] = React.useState(() => createEditorSession(options));\n const disposed = React.useRef<EditorSession | null>(null);\n const latestOptions = React.useRef(options);\n latestOptions.current = options;\n React.useEffect(() => {\n // StrictMode, and a component that React hides and shows again, run the\n // cleanup and then this effect again. The disposed session cannot be used\n // again, so replace it.\n if (disposed.current === session) {\n setSession(createEditorSession(latestOptions.current));\n return;\n }\n return () => {\n disposed.current = session;\n session.dispose();\n };\n }, [session]);\n const state = React.useSyncExternalStore(\n (listener) => session.subscribe(() => listener()),\n () => session.getState(),\n () => session.getState(),\n );\n return { session, state };\n}\n// #endregion headless\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealpixel/react",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.20",
|
|
4
4
|
"description": "React bindings for the Sealpixel image editor: <SealpixelEditor> with controlled and uncontrolled edit logs, and useSealpixelSession for headless use.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"repository": {
|
|
@@ -25,22 +25,27 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@lit/react": "^1.0.8",
|
|
28
|
-
"@sealpixel/core": "1.0.0-rc.
|
|
29
|
-
"@sealpixel/element": "1.0.0-rc.
|
|
30
|
-
"@sealpixel/ui": "1.0.0-rc.
|
|
28
|
+
"@sealpixel/core": "1.0.0-rc.20",
|
|
29
|
+
"@sealpixel/element": "1.0.0-rc.20",
|
|
30
|
+
"@sealpixel/ui": "1.0.0-rc.20"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "^18.0.0 || ^19.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
+
"@sealpixel/config": "0.0.0",
|
|
36
37
|
"@types/node": "^24.0.0",
|
|
37
38
|
"@types/react": "^19.0.0",
|
|
39
|
+
"@types/react-dom": "^19.0.0",
|
|
40
|
+
"happy-dom": "^20.0.0",
|
|
38
41
|
"react": "^19.0.0",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
42
|
+
"react-dom": "^19.0.0",
|
|
43
|
+
"typescript": "^6.0.0",
|
|
44
|
+
"vitest": "^5.0.0"
|
|
41
45
|
},
|
|
42
46
|
"scripts": {
|
|
43
47
|
"build": "tsc -p tsconfig.build.json",
|
|
44
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
48
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
49
|
+
"test": "vitest run"
|
|
45
50
|
}
|
|
46
51
|
}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|