@sealpixel/astro 1.0.0-rc.12 → 1.0.0-rc.14
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 +1 -1
- package/dist/index.d.ts +2 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -25
- package/dist/index.js.map +1 -1
- package/package.json +7 -13
- package/src/components/SealpixelEditor.astro +2 -5
- package/src/components/hydrate.ts +0 -3
- package/dist/render-route.d.ts +0 -16
- package/dist/render-route.d.ts.map +0 -1
- package/dist/render-route.js +0 -27
- package/dist/render-route.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# @sealpixel/astro
|
|
2
2
|
|
|
3
|
-
`astro add @sealpixel/astro`, then `<SealpixelEditor src="/photo.jpg" />` from `@sealpixel/astro/SealpixelEditor.astro`, or use the React, Vue or Svelte bindings inside an island.
|
|
3
|
+
`astro add @sealpixel/astro`, then `<SealpixelEditor src="/photo.jpg" />` from `@sealpixel/astro/SealpixelEditor.astro`, or use the React, Vue or Svelte bindings inside an island.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import type { AstroIntegration } from 'astro';
|
|
2
|
-
export interface SealpixelAstroOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Inject `POST /api/sealpixel/render` backed by `@sealpixel/server` with the
|
|
5
|
-
* first-party plugins and inline sources. Requires an SSR adapter.
|
|
6
|
-
*
|
|
7
|
-
* The object form sets the route `path`, the handler's `cors` and
|
|
8
|
-
* `limits.maxMegapixels`. Without `cors` the handler's own default applies:
|
|
9
|
-
* no CORS headers, so only the same origin can call the route. Without
|
|
10
|
-
* `maxMegapixels` the route reads `SEALPIXEL_MAX_MEGAPIXELS`, then uses 40.
|
|
11
|
-
*/
|
|
12
|
-
renderRoute?: boolean | {
|
|
13
|
-
path?: string;
|
|
14
|
-
cors?: string[] | '*';
|
|
15
|
-
maxMegapixels?: number;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
2
|
/**
|
|
19
3
|
* `astro add @sealpixel/astro`. Keeps the Sealpixel packages out of Vite's
|
|
20
4
|
* dependency pre-bundling so `new URL(..., import.meta.url)` for the wasm and
|
|
21
|
-
* the worker keep working
|
|
5
|
+
* the worker keep working.
|
|
22
6
|
*/
|
|
23
|
-
export default function sealpixel(
|
|
7
|
+
export default function sealpixel(): AstroIntegration;
|
|
24
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,IAAI,gBAAgB,CAyBpD"}
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
/** Carries the object form of `renderRoute` into the injected route. */
|
|
2
|
-
const ROUTE_CONFIG_ID = 'virtual:sealpixel/render-route-config';
|
|
3
1
|
/**
|
|
4
2
|
* `astro add @sealpixel/astro`. Keeps the Sealpixel packages out of Vite's
|
|
5
3
|
* dependency pre-bundling so `new URL(..., import.meta.url)` for the wasm and
|
|
6
|
-
* the worker keep working
|
|
4
|
+
* the worker keep working.
|
|
7
5
|
*/
|
|
8
|
-
export default function sealpixel(
|
|
6
|
+
export default function sealpixel() {
|
|
9
7
|
return {
|
|
10
8
|
name: '@sealpixel/astro',
|
|
11
9
|
hooks: {
|
|
12
|
-
'astro:config:setup': ({ updateConfig
|
|
13
|
-
const route = typeof options.renderRoute === 'object' ? options.renderRoute : {};
|
|
14
|
-
const routeConfig = {
|
|
15
|
-
...(route.cors === undefined ? {} : { cors: route.cors }),
|
|
16
|
-
...(route.maxMegapixels === undefined ? {} : { maxMegapixels: route.maxMegapixels }),
|
|
17
|
-
};
|
|
18
|
-
const resolvedId = `\0${ROUTE_CONFIG_ID}`;
|
|
10
|
+
'astro:config:setup': ({ updateConfig }) => {
|
|
19
11
|
updateConfig({
|
|
20
12
|
vite: {
|
|
21
13
|
optimizeDeps: {
|
|
@@ -31,22 +23,8 @@ export default function sealpixel(options = {}) {
|
|
|
31
23
|
],
|
|
32
24
|
},
|
|
33
25
|
worker: { format: 'es' },
|
|
34
|
-
plugins: [
|
|
35
|
-
{
|
|
36
|
-
name: '@sealpixel/astro:render-route-config',
|
|
37
|
-
resolveId: (id) => (id === ROUTE_CONFIG_ID ? resolvedId : undefined),
|
|
38
|
-
load: (id) => id === resolvedId ? `export default ${JSON.stringify(routeConfig)};` : undefined,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
26
|
},
|
|
42
27
|
});
|
|
43
|
-
if (options.renderRoute) {
|
|
44
|
-
injectRoute({
|
|
45
|
-
pattern: route.path ?? '/api/sealpixel/render',
|
|
46
|
-
entrypoint: '@sealpixel/astro/render-route',
|
|
47
|
-
prerender: false,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
28
|
},
|
|
51
29
|
},
|
|
52
30
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE;YACL,oBAAoB,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;gBACzC,YAAY,CAAC;oBACX,IAAI,EAAE;wBACJ,YAAY,EAAE;4BACZ,OAAO,EAAE;gCACP,iBAAiB;gCACjB,iBAAiB;gCACjB,eAAe;gCACf,oBAAoB;gCACpB,oBAAoB;gCACpB,kBAAkB;gCAClB,gBAAgB;gCAChB,mBAAmB;6BACpB;yBACF;wBACD,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;qBACzB;iBACF,CAAC,CAAC;YACL,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealpixel/astro",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
4
|
-
"description": "Astro integration for the Sealpixel image editor: Vite config for the wasm and worker, a <SealpixelEditor /> component
|
|
3
|
+
"version": "1.0.0-rc.14",
|
|
4
|
+
"description": "Astro integration for the Sealpixel image editor: Vite config for the wasm and worker, and a <SealpixelEditor /> component.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -23,19 +23,13 @@
|
|
|
23
23
|
"default": "./dist/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./SealpixelEditor.astro": "./src/components/SealpixelEditor.astro",
|
|
26
|
-
"./render-route": {
|
|
27
|
-
"types": "./dist/render-route.d.ts",
|
|
28
|
-
"default": "./dist/render-route.js"
|
|
29
|
-
},
|
|
30
26
|
"./package.json": "./package.json"
|
|
31
27
|
},
|
|
32
28
|
"dependencies": {
|
|
33
|
-
"@sealpixel/core": "1.0.0-rc.
|
|
34
|
-
"@sealpixel/element": "1.0.0-rc.
|
|
35
|
-
"@sealpixel/
|
|
36
|
-
"@sealpixel/
|
|
37
|
-
"@sealpixel/ui": "1.0.0-rc.12",
|
|
38
|
-
"@sealpixel/wasm": "1.0.0-rc.12"
|
|
29
|
+
"@sealpixel/core": "1.0.0-rc.13",
|
|
30
|
+
"@sealpixel/element": "1.0.0-rc.13",
|
|
31
|
+
"@sealpixel/ui": "1.0.0-rc.13",
|
|
32
|
+
"@sealpixel/wasm": "1.0.0-rc.13"
|
|
39
33
|
},
|
|
40
34
|
"peerDependencies": {
|
|
41
35
|
"astro": ">=5.0.0"
|
|
@@ -51,6 +45,6 @@
|
|
|
51
45
|
"scripts": {
|
|
52
46
|
"build": "tsc -p tsconfig.build.json",
|
|
53
47
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
54
|
-
"test": "vitest run
|
|
48
|
+
"test": "vitest run"
|
|
55
49
|
}
|
|
56
50
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
/**
|
|
3
3
|
* Client-only editor. Props that are plain data (`src` url, `theme`, `locale`,
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
4
|
+
* `editLog`) travel as attributes; complex options belong in an island using
|
|
5
|
+
* @sealpixel/react, @sealpixel/vue or @sealpixel/svelte.
|
|
6
6
|
*/
|
|
7
7
|
interface Props {
|
|
8
8
|
src?: string;
|
|
9
9
|
theme?: 'dark' | 'light' | 'auto';
|
|
10
10
|
locale?: string;
|
|
11
|
-
serverEndpoint?: string;
|
|
12
11
|
editLog?: unknown;
|
|
13
12
|
/** `{ pluginId: partialOptions }`, serialised into the `plugin-options` attribute. */
|
|
14
13
|
pluginOptions?: Record<string, unknown>;
|
|
@@ -23,7 +22,6 @@ const {
|
|
|
23
22
|
src,
|
|
24
23
|
theme = 'dark',
|
|
25
24
|
locale = 'en',
|
|
26
|
-
serverEndpoint,
|
|
27
25
|
editLog,
|
|
28
26
|
pluginOptions,
|
|
29
27
|
showExport,
|
|
@@ -43,7 +41,6 @@ const id = `sealpixel-${Math.random().toString(36).slice(2, 10)}`;
|
|
|
43
41
|
style={style}
|
|
44
42
|
data-src={src}
|
|
45
43
|
data-locale={locale}
|
|
46
|
-
data-server-endpoint={serverEndpoint}
|
|
47
44
|
data-edit-log={editLog === undefined ? undefined : JSON.stringify(editLog)}
|
|
48
45
|
plugin-options={pluginOptions === undefined ? undefined : JSON.stringify(pluginOptions)}
|
|
49
46
|
show-export={showExport}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
type EditorElement = HTMLElement & {
|
|
8
8
|
src: unknown;
|
|
9
9
|
locale: string;
|
|
10
|
-
serverEndpoint: string | null;
|
|
11
10
|
defaultEditLog: unknown;
|
|
12
11
|
};
|
|
13
12
|
|
|
@@ -19,8 +18,6 @@ function hydrateEditors(): void {
|
|
|
19
18
|
if (el.hasAttribute('data-hydrated')) continue;
|
|
20
19
|
el.setAttribute('data-hydrated', '1');
|
|
21
20
|
el.locale = el.getAttribute('data-locale') ?? 'en';
|
|
22
|
-
const serverEndpoint = el.getAttribute('data-server-endpoint');
|
|
23
|
-
if (serverEndpoint) el.serverEndpoint = serverEndpoint;
|
|
24
21
|
const editLog = el.getAttribute('data-edit-log');
|
|
25
22
|
if (editLog) el.defaultEditLog = JSON.parse(editLog);
|
|
26
23
|
const src = el.getAttribute('data-src');
|
package/dist/render-route.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Astro API route running `@sealpixel/server` in the SSR runtime (Node, Deno,
|
|
3
|
-
* Bun, Cloudflare via the fetch handler). Inline sources only; hosts wanting
|
|
4
|
-
* S3 sources write their own route with `createSealpixelHandler`.
|
|
5
|
-
*/
|
|
6
|
-
export declare const prerender = false;
|
|
7
|
-
export declare function POST({ request }: {
|
|
8
|
-
request: Request;
|
|
9
|
-
}): Promise<Response>;
|
|
10
|
-
export declare function GET({ request }: {
|
|
11
|
-
request: Request;
|
|
12
|
-
}): Promise<Response>;
|
|
13
|
-
export declare function OPTIONS({ request }: {
|
|
14
|
-
request: Request;
|
|
15
|
-
}): Promise<Response>;
|
|
16
|
-
//# sourceMappingURL=render-route.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render-route.d.ts","sourceRoot":"","sources":["../src/render-route.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,eAAO,MAAM,SAAS,QAAQ,CAAC;AAE/B,wBAAgB,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEzE;AAED,wBAAgB,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAExE;AAED,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE5E"}
|
package/dist/render-route.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Astro API route running `@sealpixel/server` in the SSR runtime (Node, Deno,
|
|
3
|
-
* Bun, Cloudflare via the fetch handler). Inline sources only; hosts wanting
|
|
4
|
-
* S3 sources write their own route with `createSealpixelHandler`.
|
|
5
|
-
*/
|
|
6
|
-
import config from 'virtual:sealpixel/render-route-config';
|
|
7
|
-
import { defaultPlugins } from '@sealpixel/plugins';
|
|
8
|
-
import { createSealpixelHandler, inlineSource } from '@sealpixel/server';
|
|
9
|
-
const handler = createSealpixelHandler({
|
|
10
|
-
plugins: defaultPlugins,
|
|
11
|
-
sources: [inlineSource()],
|
|
12
|
-
...(config.cors === undefined ? {} : { cors: config.cors }),
|
|
13
|
-
limits: {
|
|
14
|
-
maxMegapixels: config.maxMegapixels ?? Number(process.env['SEALPIXEL_MAX_MEGAPIXELS'] ?? 40),
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
export const prerender = false;
|
|
18
|
-
export function POST({ request }) {
|
|
19
|
-
return handler(request);
|
|
20
|
-
}
|
|
21
|
-
export function GET({ request }) {
|
|
22
|
-
return handler(request);
|
|
23
|
-
}
|
|
24
|
-
export function OPTIONS({ request }) {
|
|
25
|
-
return handler(request);
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=render-route.js.map
|
package/dist/render-route.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render-route.js","sourceRoot":"","sources":["../src/render-route.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,MAAM,MAAM,uCAAuC,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,OAAO,GAAG,sBAAsB,CAAC;IACrC,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,CAAC,YAAY,EAAE,CAAC;IACzB,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3D,MAAM,EAAE;QACN,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAC;KAC7F;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;AAE/B,MAAM,UAAU,IAAI,CAAC,EAAE,OAAO,EAAwB;IACpD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAAwB;IACnD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAAE,OAAO,EAAwB;IACvD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC"}
|