@sealpixel/ui 1.0.0-rc.17 → 1.0.0-rc.18
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/dist/components/sealpixel-button.js +1 -1
- package/dist/components/sealpixel-button.js.map +1 -1
- package/dist/components/sealpixel-editor.js +6 -6
- package/dist/components/sealpixel-editor.js.map +1 -1
- package/dist/components/sealpixel-nav.js +1 -1
- package/dist/components/sealpixel-nav.js.map +1 -1
- package/dist/components/sealpixel-slider.d.ts +12 -16
- package/dist/components/sealpixel-slider.js +64 -10
- package/dist/components/sealpixel-slider.js.map +1 -1
- package/dist/components/sealpixel-stage.js +13 -1
- package/dist/components/sealpixel-stage.js.map +1 -1
- package/dist/components/sealpixel-stepper.js +4 -4
- package/dist/components/sealpixel-stepper.js.map +1 -1
- package/dist/components/sealpixel-toolbar.js +3 -3
- package/dist/components/sealpixel-toolbar.js.map +1 -1
- package/dist/tools/crop-rotation.d.ts +12 -0
- package/dist/tools/crop-rotation.js +19 -0
- package/dist/tools/crop-rotation.js.map +1 -1
- package/dist/tools/crop.js +17 -7
- package/dist/tools/crop.js.map +1 -1
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ export class SealpixelButton extends LitElement {
|
|
|
22
22
|
background: var(--sealpixel-color-surface-2);
|
|
23
23
|
color: var(--sealpixel-color-fg);
|
|
24
24
|
font: inherit;
|
|
25
|
-
font-size:
|
|
25
|
+
font-size: calc(var(--sealpixel-font-size) * 13 / 14);
|
|
26
26
|
font-weight: 500;
|
|
27
27
|
cursor: pointer;
|
|
28
28
|
display: inline-flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sealpixel-button.js","sourceRoot":"","sources":["../../src/components/sealpixel-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,OAAO,eAAgB,SAAQ,UAAU;aAC7B,WAAM,GAAG;QACvB,IAAI;QACJ,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmFF;KACF,CAAC;aAEc,eAAU,GAAG;QAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;QAC1C,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;QACzC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;QACxC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KACxB,CAAC;IAOF;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;;kBAGG,IAAI,CAAC,QAAQ;qBACV,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;mBACjC,IAAI,CAAC,KAAK,IAAI,SAAS;cAC5B,IAAI,CAAC,KAAK,IAAI,SAAS;;;cAGvB,CAAC;IACb,CAAC","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { base } from '../theme.js';\n\nexport class SealpixelButton extends LitElement {\n static override styles = [\n base,\n css`\n :host {\n display: inline-block;\n }\n /*\n * The fill carries the button, not an outline. On a surface two steps\n * lighter than the bar a control reads on its own, and a row of six\n * outlined boxes was competing with the photo above it. The border stays\n * declared, transparent, so a theme can put it back and nothing shifts.\n */\n button {\n min-width: var(--sealpixel-control-height);\n min-height: var(--sealpixel-control-height);\n padding: 0 calc(var(--sealpixel-space) * 1.5);\n border: 1px solid transparent;\n border-radius: var(--sealpixel-radius-pill);\n background: var(--sealpixel-color-surface-2);\n color: var(--sealpixel-color-fg);\n font: inherit;\n font-size:
|
|
1
|
+
{"version":3,"file":"sealpixel-button.js","sourceRoot":"","sources":["../../src/components/sealpixel-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,OAAO,eAAgB,SAAQ,UAAU;aAC7B,WAAM,GAAG;QACvB,IAAI;QACJ,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmFF;KACF,CAAC;aAEc,eAAU,GAAG;QAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;QAC1C,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;QACzC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;QACxC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KACxB,CAAC;IAOF;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;;kBAGG,IAAI,CAAC,QAAQ;qBACV,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;mBACjC,IAAI,CAAC,KAAK,IAAI,SAAS;cAC5B,IAAI,CAAC,KAAK,IAAI,SAAS;;;cAGvB,CAAC;IACb,CAAC","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { base } from '../theme.js';\n\nexport class SealpixelButton extends LitElement {\n static override styles = [\n base,\n css`\n :host {\n display: inline-block;\n }\n /*\n * The fill carries the button, not an outline. On a surface two steps\n * lighter than the bar a control reads on its own, and a row of six\n * outlined boxes was competing with the photo above it. The border stays\n * declared, transparent, so a theme can put it back and nothing shifts.\n */\n button {\n min-width: var(--sealpixel-control-height);\n min-height: var(--sealpixel-control-height);\n padding: 0 calc(var(--sealpixel-space) * 1.5);\n border: 1px solid transparent;\n border-radius: var(--sealpixel-radius-pill);\n background: var(--sealpixel-color-surface-2);\n color: var(--sealpixel-color-fg);\n font: inherit;\n font-size: calc(var(--sealpixel-font-size) * 13 / 14);\n font-weight: 500;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--sealpixel-space);\n width: 100%;\n transition:\n background var(--sealpixel-transition),\n border-color var(--sealpixel-transition),\n color var(--sealpixel-transition),\n box-shadow var(--sealpixel-duration) var(--sealpixel-ease-out),\n opacity var(--sealpixel-transition),\n transform var(--sealpixel-duration) var(--sealpixel-ease-spring);\n }\n button:hover:not(:disabled) {\n background: var(--sealpixel-color-surface-3, var(--sealpixel-color-surface-2));\n }\n /*\n * The press scales down rather than nudging the button down by a pixel.\n * A translate moves the label against a static border and reads as a\n * glitch on a 44 px target; the scale keeps every edge moving together.\n * It also settles fast enough to finish inside a normal tap.\n */\n button:active:not(:disabled) {\n transform: scale(0.96);\n transition-duration: var(--sealpixel-duration-fast);\n transition-timing-function: var(--sealpixel-ease);\n }\n button:disabled {\n opacity: 0.45;\n cursor: default;\n }\n :host([variant='primary']) button {\n background: var(--sealpixel-color-accent);\n border-color: var(--sealpixel-color-accent);\n color: var(--sealpixel-color-accent-fg);\n }\n :host([variant='ghost']) button {\n background: transparent;\n border-color: transparent;\n }\n :host([pressed]) button {\n background: var(--sealpixel-color-accent-soft, transparent);\n border-color: var(--sealpixel-color-accent);\n color: var(--sealpixel-color-fg);\n }\n /*\n * A brightness filter used to do this. It repaints the whole button\n * including its text and washes out a light accent, so the hover now\n * lifts the button instead of bleaching it.\n */\n :host([variant='primary']) button {\n box-shadow: var(--sealpixel-shadow-sm, none);\n }\n :host([variant='primary']) button:hover:not(:disabled) {\n box-shadow: var(--sealpixel-shadow-raised, none);\n transform: translateY(-1px);\n }\n :host([variant='primary']) button:active:not(:disabled) {\n box-shadow: var(--sealpixel-shadow-sm, none);\n transform: scale(0.96);\n }\n `,\n ];\n\n static override properties = {\n disabled: { type: Boolean, reflect: true },\n pressed: { type: Boolean, reflect: true },\n variant: { type: String, reflect: true },\n label: { type: String },\n };\n\n declare disabled: boolean;\n declare pressed: boolean;\n declare variant: 'default' | 'primary' | 'ghost';\n declare label: string;\n\n constructor() {\n super();\n this.disabled = false;\n this.pressed = false;\n this.variant = 'default';\n this.label = '';\n }\n\n override render() {\n return html`<button\n part=\"button\"\n type=\"button\"\n ?disabled=${this.disabled}\n aria-pressed=${this.pressed ? 'true' : 'false'}\n aria-label=${this.label || undefined}\n title=${this.label || undefined}\n >\n <slot></slot>\n </button>`;\n }\n}\n"]}
|
|
@@ -285,7 +285,7 @@ export class SealpixelEditor extends LitElement {
|
|
|
285
285
|
padding: 0;
|
|
286
286
|
min-height: 0;
|
|
287
287
|
height: auto;
|
|
288
|
-
font-size:
|
|
288
|
+
font-size: calc(var(--sealpixel-font-size) * 11 / 14);
|
|
289
289
|
background: transparent;
|
|
290
290
|
color: var(--sealpixel-color-fg-muted);
|
|
291
291
|
}
|
|
@@ -441,7 +441,7 @@ export class SealpixelEditor extends LitElement {
|
|
|
441
441
|
border: 1px solid var(--sealpixel-color-border);
|
|
442
442
|
box-shadow: var(--sealpixel-shadow, 0 8px 24px rgba(0, 0, 0, 0.3));
|
|
443
443
|
color: var(--sealpixel-color-fg);
|
|
444
|
-
font-size:
|
|
444
|
+
font-size: calc(var(--sealpixel-font-size) * 13 / 14);
|
|
445
445
|
white-space: nowrap;
|
|
446
446
|
backdrop-filter: blur(8px);
|
|
447
447
|
cursor: pointer;
|
|
@@ -540,14 +540,14 @@ export class SealpixelEditor extends LitElement {
|
|
|
540
540
|
/* The label names the control; it is not the thing being read. */
|
|
541
541
|
.panel .field > span,
|
|
542
542
|
.panel .field > .lab {
|
|
543
|
-
font-size:
|
|
543
|
+
font-size: calc(var(--sealpixel-font-size) * 11 / 14);
|
|
544
544
|
letter-spacing: 0.012em;
|
|
545
545
|
line-height: 1.2;
|
|
546
546
|
}
|
|
547
547
|
.panel .hint {
|
|
548
548
|
margin: 0;
|
|
549
549
|
color: var(--sealpixel-color-fg-muted);
|
|
550
|
-
font-size:
|
|
550
|
+
font-size: calc(var(--sealpixel-font-size) * 12 / 14);
|
|
551
551
|
}
|
|
552
552
|
/*
|
|
553
553
|
* Width and height are one measurement, so they sit against the link that
|
|
@@ -643,7 +643,7 @@ export class SealpixelEditor extends LitElement {
|
|
|
643
643
|
.panel input:not([type='checkbox']):not([type='color']),
|
|
644
644
|
.panel select {
|
|
645
645
|
font: inherit;
|
|
646
|
-
font-size:
|
|
646
|
+
font-size: calc(var(--sealpixel-font-size) * 13 / 14);
|
|
647
647
|
color: var(--sealpixel-color-fg);
|
|
648
648
|
background: var(--sealpixel-color-surface-2);
|
|
649
649
|
border: 1px solid transparent;
|
|
@@ -729,7 +729,7 @@ export class SealpixelEditor extends LitElement {
|
|
|
729
729
|
border-radius: var(--sealpixel-radius);
|
|
730
730
|
background: var(--sealpixel-color-danger);
|
|
731
731
|
color: white;
|
|
732
|
-
font-size:
|
|
732
|
+
font-size: calc(var(--sealpixel-font-size) * 12 / 14);
|
|
733
733
|
box-shadow: var(--sealpixel-shadow-raised, none);
|
|
734
734
|
animation: sealpixel-panel-in var(--sealpixel-duration) var(--sealpixel-ease-out) both;
|
|
735
735
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s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Q;CACT,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,MAA+B;IAClD,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC;QAAE,OAAO,KAAK,CAAC;IACnD,IAAI,MAAM,CAAC,iBAAiB,IAAI,MAAM,YAAY,mBAAmB;QAAE,OAAO,IAAI,CAAC;IACnF,OAAO,MAAM,YAAY,gBAAgB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,WAAW,CAAC,CAAS;IAC5B,IAAI,CAAC,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,IAAI,CAAC;IAC9B,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1E,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAChD,CAAC","sourcesContent":["import {\n type AnyPlugin,\n type AssetResolver,\n canonicalJson,\n configurePlugins,\n createAssetResolver,\n createEditorSession,\n type EditorSession,\n type ExportResult,\n type OutputOptions,\n type PluginOptionsMap,\n type Renderer,\n SealpixelError,\n type SessionOptions,\n type SessionState,\n type SourceDescriptor,\n} from '@sealpixel/core';\nimport { defaultPlugins } from '@sealpixel/plugins';\nimport { css, html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { SessionController } from '../controllers/session-controller.js';\nimport { createI18n, type Dictionary, type I18n } from '../i18n.js';\nimport { resolveLocale } from '../locales/index.js';\nimport { base, tokens } from '../theme.js';\nimport type { UiTool, UiToolContext } from '../tool.js';\nimport { toolsFor } from '../tools/index.js';\nimport type { SealpixelStage } from './sealpixel-stage.js';\n\nexport type EditorSource = File | Blob | Uint8Array | string;\n\n/** `plugin-options='{\"filter\":{...}}'` attribute ↔ property. */\nfunction jsonAttribute<T extends object>(name: string) {\n return {\n fromAttribute: (value: string | null) => {\n if (value === null || value.trim() === '') return null;\n try {\n return JSON.parse(value) as T;\n } catch {\n console.warn(`[sealpixel] ${name} is not valid JSON`);\n return null;\n }\n },\n toAttribute: (value: T | null) => (value ? JSON.stringify(value) : null),\n };\n}\n\n/**\n * The default editor. Headless `EditorSession` underneath; this element adds\n * the responsive shell, tools and events.\n *\n * Events: `sealpixel:ready`, `sealpixel:load`, `sealpixel:change` ({ log, index }),\n * `sealpixel:process` (ExportResult), `sealpixel:error` (SealpixelError).\n */\n/**\n * What makes a settings bar worth its height: a control, or anything that\n * draws. Plain `div`s are the tools' own scaffolding and never count.\n */\nconst PANEL_CONTENT = 'select, input, textarea, button, img, svg, canvas, a, [role]';\n\nexport class SealpixelEditor extends LitElement {\n static override styles = [\n tokens,\n base,\n css`\n :host {\n display: block;\n container-type: inline-size;\n background: var(--sealpixel-color-bg);\n color: var(--sealpixel-color-fg);\n height: 100%;\n min-height: 480px;\n min-width: 0;\n overflow: hidden;\n }\n :host(:focus) {\n outline: none;\n }\n .root {\n position: relative;\n display: grid;\n height: 100%;\n min-width: 0;\n grid-template:\n 'nav' auto\n 'stage' 1fr\n 'panel' auto\n 'toolbar' auto / 1fr;\n padding-bottom: env(safe-area-inset-bottom);\n }\n .root > * {\n min-width: 0;\n min-height: 0;\n }\n sealpixel-stage {\n grid-area: stage;\n min-height: 160px;\n }\n sealpixel-nav {\n grid-area: nav;\n }\n sealpixel-toolbar {\n grid-area: toolbar;\n }\n .panel {\n grid-area: panel;\n background: var(--sealpixel-color-surface);\n border-top: 1px solid var(--sealpixel-color-border);\n padding: var(--sealpixel-space) calc(var(--sealpixel-space) * 1.5);\n /*\n * The configured height, not a fitted one: a bar that grew and shrank\n * as the user moved between tools would resize the stage under them,\n * and the image would shift every time they changed their mind.\n *\n * The exception is a tool whose settings do not fit at all. Then the\n * bar takes the height they need, measured by syncPanelFit(), because\n * the alternative is worse: a fixed-height wrapping flex container has\n * no scrollable cross-axis overflow, so nothing scrolls and the sticky\n * choice row is pulled up over the settings. 34cqh caps both heights,\n * so a busy tool can never take the stage on a short viewport.\n */\n height: min(34cqh, max(var(--sealpixel-panel-size), var(--sealpixel-panel-fit, 0px)));\n overflow: auto;\n /*\n * A bottom bar lays its blocks across the width and wraps, where the\n * old right-hand column stacked them. Stacking five blocks in a bar\n * that is one or two rows tall would push the last of them out of\n * sight, so a block takes a full row only when it asks for one.\n */\n display: flex;\n flex-wrap: wrap;\n /*\n * Safe centring places the blocks in the middle while they fit and\n * at the start once they do not. Plain centring overflows a fixed bar\n * at both ends, and nothing scrolls back to what sits above the top.\n */\n align-items: center;\n align-content: safe center;\n justify-content: safe center;\n gap: var(--sealpixel-space) calc(var(--sealpixel-space) * 2);\n scrollbar-width: thin;\n scroll-behavior: smooth;\n }\n /*\n * A tool whose panel lays out to nothing gets no bar. Without this the\n * fixed height above reserves an empty surface and takes it off the\n * stage; see syncPanelFill(), which sets the attribute.\n */\n .panel[data-empty] {\n height: 0;\n padding: 0;\n border-top: 0;\n overflow: hidden;\n }\n /*\n * A dial needs room to be worth dragging, but it must not grow into all\n * of it: a dial that stretches pushes the controls beside it against the\n * two edges of the bar, and they stop reading as one group.\n */\n .panel > sealpixel-slider {\n flex: 0 1 360px;\n min-width: 240px;\n }\n /* Chips, presets and asset libraries always get their own full row. */\n .panel > .strip,\n .panel > .grid {\n flex: 1 1 100%;\n }\n .panel > .row,\n .panel > .rows,\n .panel > .field,\n .panel > .hint {\n flex: 0 1 auto;\n }\n /*\n * A tool panel has two kinds of control: the choice of what to work with\n * (a shape, a frame style, a preset, a parameter) and the settings for\n * whatever is chosen. The choice belongs at the bottom, next to the tool\n * rail it continues, and its settings appear above it. Side by side they\n * read as one undifferentiated row of buttons and it is not obvious which\n * of them changes what.\n *\n * Ordering here rather than in each tool keeps a panel's source in\n * reading order and lets a third-party tool join in with one class.\n */\n .panel > * {\n order: 1;\n }\n /*\n * Switching tools rebuilds the panel, so the rows rise on the new\n * children and never on a value change inside the open tool, where Lit\n * patches the same nodes.\n *\n * Transform only, deliberately. A fade would put the labels at partial\n * opacity for a moment, and a contrast audit that samples the panel\n * during that moment reports text it can read on screen as failing.\n * Transform also keeps the panel's own height still, which the layout\n * around it is measured against.\n */\n .panel > * {\n animation: sealpixel-panel-in var(--sealpixel-duration) var(--sealpixel-ease-out) both;\n }\n .panel > *:nth-child(2) {\n animation-delay: 25ms;\n }\n .panel > *:nth-child(n + 3) {\n animation-delay: 50ms;\n }\n @keyframes sealpixel-panel-in {\n from {\n transform: translateY(8px);\n }\n }\n /* Phones: option grids become one horizontal strip so the stage keeps its height. */\n .panel .grid,\n .panel .strip {\n display: flex;\n gap: var(--sealpixel-space);\n overflow-x: auto;\n scrollbar-width: none;\n padding-bottom: 2px;\n scroll-snap-type: x proximity;\n }\n .panel .grid::-webkit-scrollbar,\n .panel .strip::-webkit-scrollbar {\n display: none;\n }\n .panel .grid > *,\n .panel .strip > * {\n flex: 0 0 auto;\n min-width: 96px;\n scroll-snap-align: start;\n }\n .panel .strip > * {\n min-width: 0;\n }\n /*\n * The strip centres while it fits and scrolls from the first item once\n * it does not, so a short row of presets is not stranded at the left\n * edge of a wide bar.\n */\n .panel .strip {\n justify-content: safe center;\n align-items: end;\n scroll-behavior: smooth;\n }\n .panel .chips {\n gap: 2px;\n }\n /*\n * A segmented control: one pill holds the row, the segments share it. Six\n * separate buttons put six borders in a row and made the choice look like\n * six unrelated actions; one container says they are one decision with\n * one answer at a time.\n */\n .panel .group {\n display: inline-flex;\n gap: 2px;\n padding: 2px;\n background: var(--sealpixel-color-surface-2);\n border-radius: var(--sealpixel-radius-pill);\n flex: 0 0 auto;\n }\n .panel .group sealpixel-button::part(button) {\n background: transparent;\n border-color: transparent;\n min-height: calc(var(--sealpixel-control-height) - 4px);\n min-width: calc(var(--sealpixel-control-height) - 4px);\n padding: 0 calc(var(--sealpixel-space) * 1.25);\n }\n .panel .group sealpixel-button:hover::part(button) {\n background: color-mix(in srgb, var(--sealpixel-color-fg) 7%, transparent);\n }\n .panel .group sealpixel-button[pressed]::part(button) {\n background: var(--sealpixel-color-surface);\n color: var(--sealpixel-color-accent);\n box-shadow: var(--sealpixel-shadow-sm, none);\n }\n\n /* Filter tiles: the image is the control, the label only names it. */\n .panel .tiles {\n gap: calc(var(--sealpixel-space) * 0.75);\n }\n /*\n * The one control in the bar that gets bigger. Everywhere else the chrome\n * shrank; here the chrome is the point, because a preset is judged by\n * looking at it.\n */\n .panel .thumb {\n display: block;\n width: 100%;\n height: 64px;\n object-fit: cover;\n border-radius: var(--sealpixel-radius);\n background: var(--sealpixel-color-surface-2);\n box-shadow: 0 0 0 1px var(--sealpixel-color-border);\n transition:\n box-shadow var(--sealpixel-duration) var(--sealpixel-ease),\n transform var(--sealpixel-duration) var(--sealpixel-ease-spring);\n }\n .panel .tiles sealpixel-button {\n min-width: 84px;\n max-width: 84px;\n }\n .panel .tiles sealpixel-button::part(button) {\n flex-direction: column;\n gap: 6px;\n padding: 0;\n min-height: 0;\n height: auto;\n font-size: 11px;\n background: transparent;\n color: var(--sealpixel-color-fg-muted);\n }\n .panel .tiles sealpixel-button:hover .thumb {\n transform: translateY(-2px);\n }\n .panel .tiles sealpixel-button[pressed] .thumb {\n box-shadow:\n 0 0 0 2px var(--sealpixel-color-surface),\n 0 0 0 4px var(--sealpixel-color-accent);\n }\n .panel .tiles sealpixel-button[pressed]::part(button) {\n background: transparent;\n border-color: transparent;\n color: var(--sealpixel-color-fg);\n }\n /* Separates the untouched image from the presets. */\n .panel .divider {\n flex: 0 0 auto;\n align-self: stretch;\n width: 1px;\n min-width: 1px;\n margin: 6px calc(var(--sealpixel-space) * 0.5);\n background: var(--sealpixel-color-border);\n opacity: 0.55;\n }\n .panel .row.compact > sealpixel-button {\n flex: 0 0 auto;\n min-width: 72px;\n }\n /* Phones: sibling groups share one line and hints make room for the stage. */\n .panel .rows {\n display: flex;\n gap: var(--sealpixel-space);\n align-items: end;\n }\n /*\n * Content width, not an equal share. An equal share squeezed a text field\n * and a colour well down to a few pixels each and their labels ran into\n * one another; only a dial has a reason to take the leftover room.\n */\n .panel .rows > * {\n flex: 0 1 auto;\n min-width: 0;\n }\n /*\n * A dial needs travel to be worth dragging. Inside a settings row it was\n * sharing the width equally with a colour swatch and a checkbox and ended\n * up a few ticks wide, which is not a control any more. The row grows to\n * give it that width instead of shrinking to its contents.\n */\n /*\n * A settings row scrolls sideways when it is wider than the bar, the way\n * the choice row does. Letting it overflow instead left the last control\n * cut off at the edge with nothing to say it was there.\n */\n .panel > .rows {\n flex: 0 1 auto;\n max-width: 100%;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n scroll-behavior: smooth;\n padding-bottom: 1px;\n }\n .panel > .rows::-webkit-scrollbar {\n display: none;\n }\n .panel > .rows > * {\n flex-shrink: 0;\n }\n .panel .rows > sealpixel-slider {\n flex: 0 1 260px;\n min-width: 220px;\n }\n .panel .rows .row {\n flex-wrap: nowrap;\n }\n .panel .rows .row > sealpixel-button {\n flex: 1 1 0;\n min-width: 0;\n }\n /*\n * A field fills its label, but never shrinks to nothing: a text box a\n * few pixels wide hides what was typed into it, and a select that narrow\n * hides which option is chosen.\n */\n .panel .rows select,\n .panel .rows input:not([type='checkbox']):not([type='color']) {\n width: 100%;\n min-width: 7em;\n }\n .panel .rows input[type='text'],\n .panel .rows textarea {\n min-width: 11em;\n }\n .panel .rows > .field:has(input[type='color']),\n .panel .rows > .field.check {\n flex: 0 0 auto;\n }\n /* A colour well is square, which makes the disc round. */\n .panel .rows > .field:has(input[type='color']) input {\n width: var(--sealpixel-control-height);\n aspect-ratio: 1;\n }\n .panel .swatches {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-bottom: 6px;\n }\n .panel .swatch {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n border: 0;\n box-shadow: 0 0 0 1px var(--sealpixel-color-border);\n cursor: pointer;\n padding: 0;\n transition:\n transform var(--sealpixel-duration) var(--sealpixel-ease-spring),\n border-color var(--sealpixel-transition),\n box-shadow var(--sealpixel-duration) var(--sealpixel-ease);\n }\n .panel .swatch:hover {\n transform: scale(1.12);\n }\n .panel .swatch:active {\n transform: scale(0.94);\n }\n /* The ring sits off the disc, so the colour itself is never covered. */\n .panel .swatch[aria-pressed='true'] {\n box-shadow:\n 0 0 0 2px var(--sealpixel-color-surface),\n 0 0 0 3.5px var(--sealpixel-color-accent);\n }\n .panel:empty {\n display: none;\n }\n .toast {\n position: absolute;\n left: 50%;\n bottom: calc(var(--sealpixel-toolbar-size) + var(--sealpixel-space) * 2);\n /* Sits above the stage, never over the bar the user is working in. */\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n gap: var(--sealpixel-space);\n max-width: calc(100% - var(--sealpixel-space) * 4);\n padding: calc(var(--sealpixel-space) * 1.25) calc(var(--sealpixel-space) * 2);\n border-radius: 999px;\n background: color-mix(in srgb, var(--sealpixel-color-surface) 92%, transparent);\n border: 1px solid var(--sealpixel-color-border);\n box-shadow: var(--sealpixel-shadow, 0 8px 24px rgba(0, 0, 0, 0.3));\n color: var(--sealpixel-color-fg);\n font-size: 13px;\n white-space: nowrap;\n backdrop-filter: blur(8px);\n cursor: pointer;\n z-index: 2;\n animation: sealpixel-toast-in var(--sealpixel-duration) var(--sealpixel-ease-out) both;\n }\n .toast:hover {\n border-color: var(--sealpixel-color-fg-muted);\n }\n .toast code {\n font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;\n color: var(--sealpixel-color-fg-muted);\n padding: 2px 8px;\n border-radius: 999px;\n background: var(--sealpixel-color-surface-2);\n }\n @keyframes sealpixel-toast-in {\n from {\n opacity: 0;\n transform: translate(-50%, 12px) scale(0.96);\n }\n }\n /*\n * Wide layouts move the tool rail to the left edge and nothing else. The\n * panel stays a bottom bar at every width, so a control sits in the same\n * place on a phone and on a desktop, and the stage keeps the full width\n * it needs for a landscape image.\n */\n @container (min-width: 48rem) {\n /*\n * The rail runs the full height beside both the stage and the bar.\n * Stopping it above the bar cost it the bar's height, and with ten or\n * more tools the last of them ended up scrolled out of sight behind\n * the settings of the one already open.\n */\n .root {\n grid-template:\n 'nav nav' auto\n 'toolbar stage' 1fr\n 'toolbar panel' auto / var(--sealpixel-toolbar-size) 1fr;\n }\n .panel {\n height: max(var(--sealpixel-panel-size), var(--sealpixel-panel-fit, 0px));\n padding: var(--sealpixel-space) calc(var(--sealpixel-space) * 2);\n }\n .panel[data-empty] {\n height: 0;\n padding: 0;\n }\n .toast {\n bottom: calc(var(--sealpixel-space) * 2);\n }\n }\n .panel .row {\n display: flex;\n gap: var(--sealpixel-space);\n flex-wrap: wrap;\n }\n .panel > .choice {\n order: 2;\n flex: 1 1 100%;\n justify-content: safe center;\n /*\n * Pinned to the foot of the bar. The choice is what gets the user out\n * of the tool they are in, so it has to stay reachable even when a\n * busy panel scrolls its settings.\n */\n position: sticky;\n bottom: 0;\n z-index: 1;\n background: var(--sealpixel-color-surface);\n padding-top: 4px;\n /*\n * One line that scrolls, never two that wrap. A wrapped second line\n * falls below the bar and takes whatever was on it out of reach, and\n * on a phone that was the reset button.\n */\n flex-wrap: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n scroll-behavior: smooth;\n }\n .panel > .choice::-webkit-scrollbar {\n display: none;\n }\n .panel > .choice > * {\n flex-shrink: 0;\n }\n .panel .field {\n display: grid;\n gap: 3px;\n justify-items: center;\n color: var(--sealpixel-color-fg-muted);\n }\n /* The label names the control; it is not the thing being read. */\n .panel .field > span,\n .panel .field > .lab {\n font-size: 11px;\n letter-spacing: 0.012em;\n line-height: 1.2;\n }\n .panel .hint {\n margin: 0;\n color: var(--sealpixel-color-fg-muted);\n font-size: 12px;\n }\n /*\n * Width and height are one measurement, so they sit against the link that\n * binds them rather than being two fields that happen to be adjacent.\n */\n .panel .dims {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n }\n .panel .dims input[type='number'] {\n width: 5.5em;\n min-width: 0;\n text-align: center;\n font-variant-numeric: tabular-nums;\n appearance: textfield;\n }\n .panel .dims input::-webkit-outer-spin-button,\n .panel .dims input::-webkit-inner-spin-button {\n appearance: none;\n margin: 0;\n }\n /* A value the link worked out, not one that was typed. */\n .panel .dims input.derived {\n color: var(--sealpixel-color-fg-muted);\n font-weight: 400;\n }\n .panel .dims sealpixel-button::part(button) {\n min-width: calc(var(--sealpixel-control-height) - 6px);\n min-height: calc(var(--sealpixel-control-height) - 6px);\n padding: 0;\n background: transparent;\n color: var(--sealpixel-color-fg-muted);\n }\n .panel .dims sealpixel-button[pressed]::part(button) {\n background: var(--sealpixel-color-accent-soft);\n color: var(--sealpixel-color-accent);\n }\n .panel .anchors {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 4px;\n max-width: 180px;\n }\n .panel .field.check {\n grid-template-columns: auto 1fr;\n align-items: center;\n }\n .panel textarea {\n font: inherit;\n color: var(--sealpixel-color-fg);\n background: var(--sealpixel-color-surface-2);\n border: 1px solid var(--sealpixel-color-border);\n border-radius: var(--sealpixel-radius-sm);\n padding: var(--sealpixel-space);\n resize: vertical;\n }\n /* A colour is a disc, not a box: it shows the colour and nothing else. */\n .panel input[type='color'] {\n /* Without this the engine keeps its own swatch metrics inside the box\n and the disc comes out an ellipse. */\n appearance: none;\n min-height: var(--sealpixel-control-height);\n height: var(--sealpixel-control-height);\n width: var(--sealpixel-control-height);\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: transparent;\n cursor: pointer;\n overflow: hidden;\n }\n /* The swatch has to be told to fill the box; it does not by default. */\n .panel input[type='color']::-webkit-color-swatch-wrapper {\n padding: 0;\n width: 100%;\n height: 100%;\n }\n .panel input[type='color']::-webkit-color-swatch {\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 50%;\n box-shadow: 0 0 0 1px var(--sealpixel-color-border);\n }\n .panel input[type='color']::-moz-color-swatch {\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 50%;\n box-shadow: 0 0 0 1px var(--sealpixel-color-border);\n }\n .panel input:not([type='checkbox']):not([type='color']),\n .panel select {\n font: inherit;\n font-size: 13px;\n color: var(--sealpixel-color-fg);\n background: var(--sealpixel-color-surface-2);\n border: 1px solid transparent;\n border-radius: var(--sealpixel-radius-pill);\n min-height: var(--sealpixel-control-height);\n padding: 0 calc(var(--sealpixel-space) * 1.5);\n }\n /*\n * The chevron is drawn rather than left to the platform, so a select sits\n * next to a pill button instead of looking like a form field that walked\n * in from another page. The right padding keeps the text off it.\n */\n .panel select {\n appearance: none;\n padding-right: calc(var(--sealpixel-space) * 3);\n background-image:\n linear-gradient(45deg, transparent 50%, currentColor 50%),\n linear-gradient(135deg, currentColor 50%, transparent 50%);\n background-size: 5px 5px, 5px 5px;\n background-position:\n right 14px top 52%,\n right 10px top 52%;\n background-repeat: no-repeat;\n color: var(--sealpixel-color-fg);\n }\n .empty {\n grid-area: stage;\n display: grid;\n place-content: center;\n gap: var(--sealpixel-space);\n text-align: center;\n color: var(--sealpixel-color-fg-muted);\n padding: var(--sealpixel-space);\n }\n .empty {\n transition:\n background var(--sealpixel-duration) var(--sealpixel-ease),\n color var(--sealpixel-duration) var(--sealpixel-ease);\n }\n .empty.dragover {\n outline: 2px dashed var(--sealpixel-color-accent);\n outline-offset: -8px;\n background: var(--sealpixel-color-accent-soft, transparent);\n color: var(--sealpixel-color-fg);\n }\n /*\n * A source is loading: the mark, its core breathing. The outer square\n * stands still and the inner one swells and fades, in the muted\n * foreground so nothing reads as a warning. It stops under\n * prefers-reduced-motion and still reads as the mark.\n */\n .empty.loading {\n justify-items: center;\n gap: calc(var(--sealpixel-space) * 2);\n }\n .empty.loading p {\n margin: 0;\n }\n .mark {\n display: block;\n width: 40px;\n height: 40px;\n color: var(--sealpixel-color-fg-muted);\n }\n .mark .core {\n transform-origin: 16px 16px;\n animation: sealpixel-loading-breathe 1.8s var(--sealpixel-ease) infinite;\n }\n @keyframes sealpixel-loading-breathe {\n 50% {\n opacity: 0.45;\n transform: scale(0.62);\n }\n }\n }\n .error {\n grid-area: nav;\n align-self: end;\n justify-self: center;\n margin-top: calc(var(--sealpixel-toolbar-size) + 4px);\n z-index: 1;\n padding: 6px 10px;\n border-radius: var(--sealpixel-radius);\n background: var(--sealpixel-color-danger);\n color: white;\n font-size: 12px;\n box-shadow: var(--sealpixel-shadow-raised, none);\n animation: sealpixel-panel-in var(--sealpixel-duration) var(--sealpixel-ease-out) both;\n }\n `,\n ];\n\n static override properties = {\n plugins: { attribute: false },\n pluginOptions: {\n attribute: 'plugin-options',\n converter: jsonAttribute<PluginOptionsMap>('plugin-options'),\n },\n session: { attribute: false },\n renderer: { attribute: false },\n assets: { attribute: false },\n limits: {\n attribute: 'limits',\n converter: jsonAttribute<NonNullable<SessionOptions['limits']>>('limits'),\n },\n src: { attribute: false },\n editLog: { attribute: false },\n defaultEditLog: { attribute: false },\n output: { attribute: false },\n theme: { type: String, reflect: true },\n locale: { type: String },\n dictionary: { attribute: false },\n tools: { attribute: false },\n activeTool: { type: String, attribute: 'active-tool' },\n showExport: { type: String, attribute: 'show-export' },\n showDownload: { type: String, attribute: 'show-download' },\n showHistory: { type: String, attribute: 'show-history' },\n downloadLabel: { type: String, attribute: 'download-label' },\n _busy: { state: true },\n _processListeners: { state: true },\n _toast: { state: true },\n _dragover: { state: true },\n _wide: { state: true },\n _pluginTools: { state: true },\n };\n\n declare plugins: readonly AnyPlugin[] | null;\n /** `{ pluginId: partialOptions }` applied to `plugins` (or the defaults) through each plugin's `configure()`. */\n declare pluginOptions: PluginOptionsMap | null;\n declare session: EditorSession | null;\n declare renderer: Renderer | null;\n /** Fonts and images. Defaults to a fetch resolver over the plugins' declarations. */\n declare assets: AssetResolver | null;\n /**\n * How much of the original stays in the browser; `SessionOptions['limits']`\n * (JSON in the attribute). Above `maxClientMegapixels` (16 by default) the\n * image is not resident: Export and Download are disabled, and the host\n * renders the original outside the browser.\n */\n declare limits: SessionOptions['limits'] | null;\n declare src: EditorSource | null;\n /** Controlled mode: the host owns the log. */\n declare editLog: unknown;\n /** Uncontrolled: applied once on load. */\n declare defaultEditLog: unknown;\n declare output: OutputOptions;\n declare theme: 'dark' | 'light' | 'auto';\n declare locale: string;\n /** Overrides the shipped dictionary for `locale`; shipped locales resolve automatically. */\n declare dictionary: Dictionary | null;\n declare tools: Record<string, UiTool> | null;\n declare activeTool: string | null;\n /**\n * When the Export button is shown. `auto` (default) shows it only while a\n * `sealpixel:process` listener is attached, because Export hands the result to\n * the host and does nothing visible otherwise. Download is always shown.\n */\n declare showExport: 'auto' | 'always' | 'never';\n /** `always` (default) or `never`. Hosts that only consume `sealpixel:process` hide the button. */\n declare showDownload: 'always' | 'never';\n /** `all` (default), `buttons` (undo and redo, no timeline) or `none` (also disables the undo/redo shortcuts). */\n declare showHistory: 'all' | 'buttons' | 'none';\n /** Custom text for the Download button; the localized label when null. */\n declare downloadLabel: string | null;\n declare _busy: boolean;\n declare _processListeners: number;\n declare _toast: { text: string; hash: string } | null;\n declare _dragover: boolean;\n declare _wide: boolean;\n /** Tools loaded from `plugin.tool()`, keyed by plugin id. */\n declare _pluginTools: Record<string, UiTool>;\n private resizeObserver: ResizeObserver | null = null;\n private toolLoads = new Set<string>();\n\n /**\n * Used when no `renderer` property is set. `@sealpixel/element` installs a\n * factory that starts the bundled worker; without it the editor renders inline.\n */\n static defaultRendererFactory: ((plugins: readonly AnyPlugin[]) => Renderer) | null = null;\n\n private readonly ctl = new SessionController(this, null);\n private i18n: I18n = createI18n('en');\n private ownsSession = false;\n private lastEmittedVersion = -1;\n private lastAppliedControlled = '';\n private hint: { filter?: string; transform?: string; rotate?: number } | null = null;\n private previousTool: UiTool | null = null;\n /** The source the tools last heard about; `load` replaces the object, so identity is the guard. */\n private lastSource: SourceDescriptor | null = null;\n private loadedSrc: EditorSource | null = null;\n /** The edit log of a session released while the element was out of the document. */\n private detachedLog: { log: unknown; index: number } | null = null;\n /** Whether the owned session was released while the element was out of the document. */\n private released = false;\n\n constructor() {\n super();\n this.plugins = null;\n this.pluginOptions = null;\n this.session = null;\n this.renderer = null;\n this.assets = null;\n this.limits = null;\n this.src = null;\n this.editLog = undefined;\n this.defaultEditLog = undefined;\n this.output = { format: 'image/png' };\n this.theme = 'dark';\n this.locale = 'en';\n this.dictionary = null;\n this.tools = null;\n this.activeTool = null;\n this.showExport = 'auto';\n this.showDownload = 'always';\n this.showHistory = 'all';\n this.downloadLabel = null;\n this._busy = false;\n this._processListeners = 0;\n this._toast = null;\n this._dragover = false;\n this._wide = false;\n this._pluginTools = {};\n }\n\n // Export hands the result to the host, so the button is shown only while\n // someone listens for `sealpixel:process`. Listener counts are tracked here.\n override addEventListener<K extends keyof HTMLElementEventMap>(\n type: K,\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown,\n options?: boolean | AddEventListenerOptions,\n ): void;\n override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject | ((ev: Event) => unknown),\n options?: boolean | AddEventListenerOptions,\n ): void {\n super.addEventListener(type, listener as EventListenerOrEventListenerObject, options);\n if (type === 'sealpixel:process') this._processListeners += 1;\n }\n\n override removeEventListener<K extends keyof HTMLElementEventMap>(\n type: K,\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject | ((ev: Event) => unknown),\n options?: boolean | EventListenerOptions,\n ): void {\n super.removeEventListener(type, listener as EventListenerOrEventListenerObject, options);\n if (type === 'sealpixel:process' && this._processListeners > 0) this._processListeners -= 1;\n }\n\n /** A renderer the editor made through the factory dies with the session; a host's renderer lives on. */\n private disposeOwnedRenderer(): void {\n if (this.sessionRenderer && this.sessionRenderer !== this.renderer) {\n this.sessionRenderer.dispose();\n }\n this.sessionRenderer = null;\n }\n\n /** `plugins` (or the defaults) with `pluginOptions` applied. Invalid options raise `sealpixel:error`. */\n private effectivePlugins(): readonly AnyPlugin[] {\n const base = this.plugins ?? defaultPlugins;\n if (!this.pluginOptions) return base;\n try {\n return configurePlugins(base, this.pluginOptions);\n } catch (error) {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n return base;\n }\n }\n\n /** The live session, created on first connection when none was passed. */\n getSession(): EditorSession {\n if (!this.ctl.session) this.ensureSession();\n return this.ctl.session as EditorSession;\n }\n getEditLog() {\n return this.getSession().getEditLog();\n }\n setEditLog(saved: unknown, index?: number) {\n this.getSession().setEditLog(saved, index);\n }\n undo() {\n this.getSession().undo();\n }\n redo() {\n this.getSession().redo();\n }\n timeTravel(index: number) {\n this.getSession().timeTravel(index);\n }\n async export(output: OutputOptions = this.output, options: { embedEditLog?: boolean } = {}) {\n return this.getSession().export({ output, ...options });\n }\n async download(\n options: { output?: OutputOptions; filename?: string; embedEditLog?: boolean } = {},\n ) {\n return this.getSession().download({ output: this.output, ...options });\n }\n\n private ensureSession(): void {\n if (this.ctl.session) return;\n if (this.session) {\n this.ctl.session = this.session;\n return;\n }\n const plugins = this.effectivePlugins();\n const renderer = this.renderer ?? SealpixelEditor.defaultRendererFactory?.(plugins) ?? null;\n this.sessionRenderer = renderer;\n const assets =\n this.assets ?? createAssetResolver({ assets: plugins.flatMap((p) => p.assets ?? []) });\n this.sessionAssets = this.assets;\n this.sessionLimits = this.limits;\n const session = createEditorSession({\n plugins,\n assets,\n ...(renderer ? { renderer } : {}),\n ...(this.limits ? { limits: this.limits } : {}),\n });\n this.ownsSession = true;\n this.ctl.session = session;\n this.dispatchEvent(new CustomEvent('sealpixel:ready', { bubbles: true, composed: true }));\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.ensureSession();\n // Out of the document long enough to lose the session: the source comes\n // back with the edit log it had when it left.\n if (this.released) {\n const restore = this.detachedLog ?? undefined;\n this.released = false;\n this.detachedLog = null;\n if (this.loadedSrc) void this.loadSource(this.loadedSrc, restore);\n }\n // Keyboard shortcuts need focus inside the editor. WebKit does not focus\n // buttons on click, so pull focus in on any pointer interaction.\n if (!this.hasAttribute('tabindex')) this.tabIndex = -1;\n this.addEventListener('keydown', this.onKeydown);\n this.addEventListener('pointerdown', this.onPointerDown);\n this.resizeObserver = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width ?? this.clientWidth;\n this._wide = width >= 768;\n });\n this.resizeObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this.onKeydown);\n this.removeEventListener('pointerdown', this.onPointerDown);\n this.resizeObserver?.disconnect();\n // A move in the DOM (an append into another parent, a portal, a keyed\n // reorder) disconnects and connects again in the same task. Disposing here\n // would throw the image and its history away on every move, so the\n // session goes only if the element is still out after the task.\n if (this.ownsSession) {\n queueMicrotask(() => {\n if (!this.isConnected) this.releaseSession();\n });\n }\n }\n\n /** Disposes the owned session and keeps its edit log for a later connection. */\n private releaseSession(): void {\n const session = this.ctl.session;\n if (!this.ownsSession || !session) return;\n this.released = true;\n this.detachedLog = session.getState().status === 'ready' ? session.getEditLog() : null;\n session.dispose();\n this.disposeOwnedRenderer();\n this.ctl.session = null;\n this.ownsSession = false;\n this.lastEmittedVersion = -1;\n this.lastSource = null;\n // The tools activate again on the session that replaces this one.\n this.previousTool = null;\n }\n\n override willUpdate(changed: Map<string, unknown>): void {\n if (changed.has('locale') || changed.has('dictionary')) {\n // A dictionary changes the strings it names; every other string stays\n // in the shipped locale.\n this.i18n = createI18n(this.locale, {\n ...resolveLocale(this.locale),\n ...(this.dictionary ?? {}),\n });\n }\n if (changed.has('session') && this.session && this.session !== this.ctl.session) {\n if (this.ownsSession) {\n this.ctl.session?.dispose();\n this.disposeOwnedRenderer();\n }\n this.ownsSession = false;\n this.ctl.session = this.session;\n }\n // A new plugin list or renderer needs a new session; reload the current source into it.\n if (\n (changed.has('plugins') ||\n changed.has('pluginOptions') ||\n changed.has('renderer') ||\n changed.has('assets') ||\n changed.has('limits')) &&\n this.ownsSession &&\n !this.sessionMatchesProps()\n ) {\n this.ctl.session?.dispose();\n this.disposeOwnedRenderer();\n this.ctl.session = null;\n this.ownsSession = false;\n this.toolLoads.clear();\n this._pluginTools = {};\n this.lastEmittedVersion = -1;\n this.lastSource = null;\n this.ensureSession();\n if (this.loadedSrc) void this.loadSource(this.loadedSrc);\n }\n if (changed.has('src') && this.src && this.src !== this.loadedSrc) {\n this.loadedSrc = this.src;\n void this.loadSource(this.src);\n }\n if (changed.has('editLog') && this.editLog != null) this.applyControlled();\n }\n\n override updated(): void {\n const state = this.ctl.state;\n const session = this.ctl.session;\n if (!state || !session) return;\n if (state.version !== this.lastEmittedVersion && state.status === 'ready') {\n this.lastEmittedVersion = state.version;\n const detail = session.getEditLog();\n this.lastAppliedControlled = canonicalJson(detail);\n this.dispatchEvent(\n new CustomEvent('sealpixel:change', { detail, bubbles: true, composed: true }),\n );\n }\n if (state.error && state.error !== this.lastError) {\n this.lastError = state.error;\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: state.error, bubbles: true, composed: true }),\n );\n }\n this.syncActiveTool();\n this.syncSource(state);\n this.syncPanelFill();\n }\n private lastError: unknown = null;\n\n /** Tells every tool, active or not, that a new source has loaded. Once per source. */\n private syncSource(state: SessionState): void {\n if (state.status !== 'ready' || !state.source || state.source === this.lastSource) return;\n this.lastSource = state.source;\n const ctx = this.toolContext(state);\n for (const tool of this.currentTools()) tool.onSource?.(ctx);\n }\n\n /**\n * Collapses the settings bar when the open tool has nothing to put in it.\n *\n * A tool renders its own structure, and a structure can hold nothing: crop\n * with `rotation`, `flip` and `reset` off and a single enforced aspect emits\n * two empty wrappers. The bar is a fixed height on purpose — see `.panel` —\n * so that reserved an empty bordered surface and took the same height off\n * the stage. On the landing page's avatar card that was 240 px of nothing\n * against a 178 px stage, and the photo rendered at 10 percent.\n *\n * Read from the DOM rather than asked of the tool: every tool would\n * otherwise have to declare it, and a tool whose panel empties out only\n * under some options would get it wrong.\n *\n * Not measured by size either. The empty wrappers still lay out — the row\n * is 8px from its own gap and the group 4px from its border — so a\n * bounding box tells content and scaffolding apart not at all. What counts\n * is a control or a word: a custom element, a form control, or any text.\n */\n private syncPanelFill(): void {\n const panel = this.renderRoot.querySelector('.panel') as HTMLElement | null;\n if (!panel) return;\n const filled =\n (panel.textContent ?? '').trim().length > 0 ||\n Array.from(panel.querySelectorAll('*')).some(\n (node) => node.tagName.includes('-') || node.matches(PANEL_CONTENT),\n );\n panel.toggleAttribute('data-empty', !filled);\n this.syncPanelFit(panel, filled);\n }\n\n /**\n * Lets the settings bar grow to the height its content needs.\n *\n * The bar is a fixed height so that moving between tools does not resize\n * the stage under the user. When a tool needs more than that height, the\n * overflow has nowhere to go: a wrapping flex container of fixed height has\n * no scrollable cross-axis overflow, so `overflow: auto` never produces a\n * scrollbar, and the sticky choice row — which pins itself inside the\n * scrollport — is dragged up over the settings instead. The colour swatch\n * ends up half covered and the fill toggle disappears behind the shapes.\n *\n * WebKit is where this surfaced, on a real iPhone: it lays these controls\n * taller than Blink does, and at phone width crop, finetune and annotate\n * needed 138, 140 and 136 pixels against the 112 the bar had. Raising the\n * default would have taken those pixels off every stage in every engine, so\n * the height is measured instead and only the bar that needs more gets it.\n * `34cqh` still caps it, so a busy tool cannot eat the stage.\n */\n private syncPanelFit(panel: HTMLElement, filled: boolean): void {\n panel.style.removeProperty('--sealpixel-panel-fit');\n if (!filled) return;\n // Read after the reset, so a bar that has since shrunk measures its own\n // content and not the height it was given last time.\n const needed = panel.scrollHeight;\n if (needed > panel.clientHeight) {\n panel.style.setProperty('--sealpixel-panel-fit', `${needed}px`);\n }\n }\n\n private async loadSource(src: EditorSource, restore?: unknown): Promise<void> {\n const session = this.getSession();\n try {\n // `null` is \"no saved log\", the same as `undefined`: framework props\n // commonly type an absent log as null.\n const saved = this.editLog ?? restore ?? this.defaultEditLog ?? undefined;\n const bytes = src instanceof Uint8Array ? src : src;\n const descriptor = await session.load(bytes, saved === undefined ? {} : { editLog: saved });\n // Option defaults become real ops in an otherwise empty log.\n if (saved === undefined && session.getState().history.log.ops.length === 0) {\n for (const op of session.registry.initialOps(descriptor)) {\n session.dispatch({\n ...op,\n id: `init-${Math.random().toString(36).slice(2, 8)}`,\n } as Parameters<typeof session.dispatch>[0]);\n }\n }\n this.dispatchEvent(\n new CustomEvent('sealpixel:load', { detail: descriptor, bubbles: true, composed: true }),\n );\n if (!this.activeTool) {\n const first = this.currentTools()[0];\n if (first) this.activeTool = first.id;\n }\n } catch (error) {\n // A newer `src` replaced this load. That load reports its own outcome.\n if ((error as Error | null)?.name === 'ABORTED') return;\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n }\n }\n\n private applyControlled(): void {\n const session = this.ctl.session;\n if (!session || session.getState().status !== 'ready' || this.editLog == null) return;\n const wanted = this.editLog as { log?: unknown; index?: number };\n const key = canonicalJson(wanted);\n if (key === this.lastAppliedControlled) return;\n try {\n session.setEditLog(wanted, wanted.index);\n this.lastAppliedControlled = key;\n } catch (error) {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n }\n }\n\n /** Whether the owned session was built from the current `plugins`, `renderer`, `assets` and `limits`. */\n private sessionMatchesProps(): boolean {\n const session = this.ctl.session;\n if (!session) return false;\n if (this.renderer && this.renderer !== this.sessionRenderer) return false;\n if (this.assets && this.assets !== this.sessionAssets) return false;\n if (canonicalJson(this.limits ?? null) !== canonicalJson(this.sessionLimits ?? null))\n return false;\n // Compare id, version and resolved options (options JSON may contain commas, so no string splitting).\n const key = (plugins: readonly AnyPlugin[]) =>\n canonicalJson(\n [...plugins]\n .sort((a, b) => a.id.localeCompare(b.id))\n .map((p) => [p.id, p.version, p.options ?? null]),\n );\n return key(this.effectivePlugins()) === key(session.registry.plugins);\n }\n private sessionRenderer: Renderer | null = null;\n private sessionAssets: AssetResolver | null = null;\n private sessionLimits: SessionOptions['limits'] | null = null;\n\n private currentTools(): UiTool[] {\n const plugins = this.effectivePlugins();\n this.loadPluginTools(plugins);\n return toolsFor(plugins, { ...this._pluginTools, ...(this.tools ?? {}) });\n }\n\n /** Plugins may ship their own tool; load each once and re-render when it arrives. */\n private loadPluginTools(plugins: readonly AnyPlugin[]): void {\n for (const plugin of plugins) {\n if (!plugin.tool || this.toolLoads.has(plugin.id)) continue;\n this.toolLoads.add(plugin.id);\n plugin\n .tool()\n .then((tool) => {\n this._pluginTools = { ...this._pluginTools, [plugin.id]: tool as unknown as UiTool };\n })\n .catch((error) => {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n });\n }\n }\n\n private get stage(): SealpixelStage | null {\n return this.renderRoot.querySelector('sealpixel-stage');\n }\n\n private toolContext(state: SessionState): UiToolContext {\n const session = this.getSession();\n const stage = this.stage;\n return {\n session,\n state,\n document: state.document,\n dispatch: (op) => {\n try {\n session.dispatch(op);\n } catch (error) {\n // A tool asked for something the options forbid: tell the user, keep the log intact.\n if (error instanceof SealpixelError && error.name === 'OPTION_VIOLATION') {\n this._toast = { text: error.message, hash: '' };\n this.announce(error.message);\n return;\n }\n throw error;\n }\n },\n t: this.i18n.t,\n stage: {\n width: state.preview?.image.width ?? 0,\n height: state.preview?.image.height ?? 0,\n zoom: stage?.zoom ?? 1,\n geometry: state.preview?.geometry ?? null,\n toImage: (x, y) => stage?.toImage(x, y) ?? { x: 0, y: 0 },\n },\n hint: (hint) => {\n this.hint = hint;\n const s = this.stage;\n if (s) {\n s.hintFilter = hint?.filter ?? '';\n s.hintTransform = hint?.transform ?? '';\n s.hintRotate = hint?.rotate ?? 0;\n }\n },\n refresh: () => this.requestUpdate(),\n animateNextView: () => this.stage?.glideNextView(),\n clipPreview: (clip) => {\n const s = this.stage;\n if (s) s.clip = clip ?? '';\n },\n layout: this._wide ? 'wide' : 'narrow',\n options: <T>(pluginId: string) =>\n session.registry.byId.get(pluginId)?.options as T | undefined,\n };\n }\n\n private syncActiveTool(): void {\n const state = this.ctl.state;\n if (!state || state.status !== 'ready') return;\n const tool = this.currentTools().find((t) => t.id === this.activeTool) ?? null;\n if (tool === this.previousTool) return;\n const ctx = this.toolContext(state);\n this.previousTool?.deactivate?.(ctx);\n tool?.activate?.(ctx);\n this.previousTool = tool;\n }\n\n private onPointerDown = () => {\n if (!this.matches(':focus-within')) this.focus({ preventScroll: true });\n };\n\n private onKeydown = (e: KeyboardEvent) => {\n const session = this.ctl.session;\n if (!session || session.getState().status !== 'ready') return;\n // Undo inside a text field belongs to the field: it takes back the typing,\n // not the last edit of the image.\n if (isTextEntry(e.composedPath()[0])) return;\n const mod = e.metaKey || e.ctrlKey;\n if (this.showHistory === 'none') return;\n if (mod && e.key.toLowerCase() === 'z') {\n e.preventDefault();\n if (e.shiftKey) session.redo();\n else session.undo();\n } else if (mod && e.key.toLowerCase() === 'y') {\n e.preventDefault();\n session.redo();\n }\n };\n\n private async onExport(): Promise<void> {\n const session = this.getSession();\n this._busy = true;\n try {\n const result: ExportResult = await session.export({ output: this.output });\n this.dispatchEvent(\n new CustomEvent('sealpixel:process', { detail: result, bubbles: true, composed: true }),\n );\n this.toast('toast.exported', result);\n } catch (error) {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n } finally {\n this._busy = false;\n }\n }\n\n private async onDownload(): Promise<void> {\n const session = this.getSession();\n this._busy = true;\n try {\n const { result } = await session.download({ output: this.output });\n this.dispatchEvent(\n new CustomEvent('sealpixel:process', { detail: result, bubbles: true, composed: true }),\n );\n this.toast('toast.downloaded', result);\n } catch (error) {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n } finally {\n this._busy = false;\n }\n }\n\n private announce(text: string): void {\n const live = this.renderRoot.querySelector('#live');\n if (live) live.textContent = text;\n }\n\n private toastTimer: ReturnType<typeof setTimeout> | null = null;\n\n /** Brief confirmation over the stage: format, size and hash of the result. */\n private toast(\n key: 'toast.exported' | 'toast.downloaded',\n result: Pick<ExportResult, 'mimeType' | 'width' | 'height' | 'hash' | 'bytes'>,\n ): void {\n const format = result.mimeType.replace('image/', '').toUpperCase();\n const size = formatBytes(result.bytes.byteLength);\n const text = this.i18n.t(key, { format, width: result.width, height: result.height, size });\n this._toast = { text, hash: result.hash.slice(0, 12) };\n this.announce(text);\n if (this.toastTimer) clearTimeout(this.toastTimer);\n this.toastTimer = setTimeout(() => {\n this._toast = null;\n this.toastTimer = null;\n }, 5000);\n }\n\n private onFiles(files: FileList | null): void {\n const file = files?.[0];\n if (file) this.src = file;\n }\n\n override render() {\n const state = this.ctl.state;\n const tools = this.currentTools();\n const tool = tools.find((t) => t.id === this.activeTool) ?? null;\n const ready = state?.status === 'ready';\n const ctx = state && ready ? this.toolContext(state) : null;\n const badges: Record<string, number> = {};\n if (ctx) {\n for (const t of tools) {\n const n = t.badge?.(ctx);\n if (n) badges[t.id] = n;\n }\n }\n const wide = this._wide;\n return html`\n <div class=\"root\" part=\"root\">\n <sealpixel-nav\n part=\"nav\"\n exportparts=\"undo, redo, history, export, download, dimensions, button\"\n .state=${state}\n .t=${this.i18n.t}\n .busy=${this._busy}\n .canExport=${state?.resident ?? false}\n .showExport=${this.showExport === 'always' || (this.showExport === 'auto' && this._processListeners > 0)}\n .showDownload=${this.showDownload !== 'never'}\n .showHistory=${this.showHistory}\n .downloadLabel=${this.downloadLabel}\n @nav-undo=${() => this.getSession().undo()}\n @nav-redo=${() => this.getSession().redo()}\n @nav-time-travel=${(e: CustomEvent<number>) => this.getSession().timeTravel(e.detail)}\n @nav-export=${() => this.onExport()}\n @nav-download=${() => this.onDownload()}\n ></sealpixel-nav>\n ${\n ready\n ? html`<sealpixel-stage\n part=\"stage\"\n exportparts=\"viewport, canvas, overlay, status\"\n .preview=${state?.preview ?? null}\n .t=${this.i18n.t}\n .pending=${state?.previewPending ?? false}\n .overlay=${ctx && tool?.overlay ? tool.overlay(ctx) : null}\n @stage-view=${() => this.requestUpdate()}\n ></sealpixel-stage>`\n : this.renderEmpty(state)\n }\n <div class=\"panel\" part=\"panel\">${ctx && tool ? tool.panel(ctx) : nothing}</div>\n <sealpixel-toolbar\n part=\"toolbar\"\n exportparts=\"tool, badge\"\n .tools=${tools}\n .badges=${badges}\n .active=${this.activeTool}\n .t=${this.i18n.t}\n .orientation=${wide ? 'vertical' : 'horizontal'}\n @tool-select=${(e: CustomEvent<string>) => {\n this.activeTool = e.detail;\n }}\n ></sealpixel-toolbar>\n ${state?.error ? html`<div class=\"error\" role=\"alert\">${this.i18n.t('editor.error', { message: state.error.message })}</div>` : nothing}\n ${\n this._toast\n ? html`<div class=\"toast\" part=\"toast\" data-testid=\"toast\" @click=${() => {\n this._toast = null;\n }}>\n <span>${this._toast.text}</span>\n ${this._toast.hash ? html`<code>${this._toast.hash}</code>` : nothing}\n </div>`\n : nothing\n }\n <span id=\"live\" class=\"visually-hidden\" role=\"status\" aria-live=\"polite\"></span>\n </div>\n `;\n }\n\n private renderEmpty(state: SessionState | null): TemplateResult {\n if (state?.status === 'loading') {\n return html`<div class=\"empty loading\" part=\"empty\" role=\"status\">\n <svg class=\"mark\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n <rect x=\"3\" y=\"3\" width=\"26\" height=\"26\" rx=\"5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <rect class=\"core\" x=\"11\" y=\"11\" width=\"10\" height=\"10\" rx=\"1.5\" fill=\"currentColor\" />\n </svg>\n <p>${this.i18n.t('editor.loading')}</p>\n </div>`;\n }\n return html`<div\n class=\"empty ${this._dragover ? 'dragover' : ''}\"\n part=\"empty\"\n @dragover=${(e: DragEvent) => {\n e.preventDefault();\n this._dragover = true;\n }}\n @dragleave=${() => {\n this._dragover = false;\n }}\n @drop=${(e: DragEvent) => {\n e.preventDefault();\n this._dragover = false;\n this.onFiles(e.dataTransfer?.files ?? null);\n }}\n >\n <p>${this.i18n.t('editor.empty')}</p>\n <label>\n <input class=\"visually-hidden\" type=\"file\" accept=\"image/png,image/jpeg,image/webp\" @change=${(e: Event) => this.onFiles((e.target as HTMLInputElement).files)} />\n <sealpixel-button variant=\"primary\" @click=${(e: Event) => ((e.currentTarget as HTMLElement).previousElementSibling as HTMLInputElement).click()}>\n ${this.i18n.t('editor.choose')}\n </sealpixel-button>\n </label>\n </div>`;\n }\n}\n\n/** Input types that hold no text, so Cmd/Ctrl+Z on them has nothing of their own to undo. */\nconst NON_TEXT_INPUTS = new Set([\n 'button',\n 'checkbox',\n 'color',\n 'file',\n 'image',\n 'radio',\n 'range',\n 'reset',\n 'submit',\n]);\n\nfunction isTextEntry(target: EventTarget | undefined): boolean {\n if (!(target instanceof HTMLElement)) return false;\n if (target.isContentEditable || target instanceof HTMLTextAreaElement) return true;\n return target instanceof HTMLInputElement && !NON_TEXT_INPUTS.has(target.type);\n}\n\nfunction formatBytes(n: number): string {\n if (n < 1024) return `${n} B`;\n if (n < 1024 * 1024) return `${(n / 1024).toFixed(n < 10240 ? 1 : 0)} KB`;\n return `${(n / (1024 * 1024)).toFixed(1)} MB`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sealpixel-editor.js","sourceRoot":"","sources":["../../src/components/sealpixel-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EAMnB,cAAc,GAIf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,UAAU,EAA8B,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,aAA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C,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1E,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAChD,CAAC","sourcesContent":["import {\n type AnyPlugin,\n type AssetResolver,\n canonicalJson,\n configurePlugins,\n createAssetResolver,\n createEditorSession,\n type EditorSession,\n type ExportResult,\n type OutputOptions,\n type PluginOptionsMap,\n type Renderer,\n SealpixelError,\n type SessionOptions,\n type SessionState,\n type SourceDescriptor,\n} from '@sealpixel/core';\nimport { defaultPlugins } from '@sealpixel/plugins';\nimport { css, html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { SessionController } from '../controllers/session-controller.js';\nimport { createI18n, type Dictionary, type I18n } from '../i18n.js';\nimport { resolveLocale } from '../locales/index.js';\nimport { base, tokens } from '../theme.js';\nimport type { UiTool, UiToolContext } from '../tool.js';\nimport { toolsFor } from '../tools/index.js';\nimport type { SealpixelStage } from './sealpixel-stage.js';\n\nexport type EditorSource = File | Blob | Uint8Array | string;\n\n/** `plugin-options='{\"filter\":{...}}'` attribute ↔ property. */\nfunction jsonAttribute<T extends object>(name: string) {\n return {\n fromAttribute: (value: string | null) => {\n if (value === null || value.trim() === '') return null;\n try {\n return JSON.parse(value) as T;\n } catch {\n console.warn(`[sealpixel] ${name} is not valid JSON`);\n return null;\n }\n },\n toAttribute: (value: T | null) => (value ? JSON.stringify(value) : null),\n };\n}\n\n/**\n * The default editor. Headless `EditorSession` underneath; this element adds\n * the responsive shell, tools and events.\n *\n * Events: `sealpixel:ready`, `sealpixel:load`, `sealpixel:change` ({ log, index }),\n * `sealpixel:process` (ExportResult), `sealpixel:error` (SealpixelError).\n */\n/**\n * What makes a settings bar worth its height: a control, or anything that\n * draws. Plain `div`s are the tools' own scaffolding and never count.\n */\nconst PANEL_CONTENT = 'select, input, textarea, button, img, svg, canvas, a, [role]';\n\nexport class SealpixelEditor extends LitElement {\n static override styles = [\n tokens,\n base,\n css`\n :host {\n display: block;\n container-type: inline-size;\n background: var(--sealpixel-color-bg);\n color: var(--sealpixel-color-fg);\n height: 100%;\n min-height: 480px;\n min-width: 0;\n overflow: hidden;\n }\n :host(:focus) {\n outline: none;\n }\n .root {\n position: relative;\n display: grid;\n height: 100%;\n min-width: 0;\n grid-template:\n 'nav' auto\n 'stage' 1fr\n 'panel' auto\n 'toolbar' auto / 1fr;\n padding-bottom: env(safe-area-inset-bottom);\n }\n .root > * {\n min-width: 0;\n min-height: 0;\n }\n sealpixel-stage {\n grid-area: stage;\n min-height: 160px;\n }\n sealpixel-nav {\n grid-area: nav;\n }\n sealpixel-toolbar {\n grid-area: toolbar;\n }\n .panel {\n grid-area: panel;\n background: var(--sealpixel-color-surface);\n border-top: 1px solid var(--sealpixel-color-border);\n padding: var(--sealpixel-space) calc(var(--sealpixel-space) * 1.5);\n /*\n * The configured height, not a fitted one: a bar that grew and shrank\n * as the user moved between tools would resize the stage under them,\n * and the image would shift every time they changed their mind.\n *\n * The exception is a tool whose settings do not fit at all. Then the\n * bar takes the height they need, measured by syncPanelFit(), because\n * the alternative is worse: a fixed-height wrapping flex container has\n * no scrollable cross-axis overflow, so nothing scrolls and the sticky\n * choice row is pulled up over the settings. 34cqh caps both heights,\n * so a busy tool can never take the stage on a short viewport.\n */\n height: min(34cqh, max(var(--sealpixel-panel-size), var(--sealpixel-panel-fit, 0px)));\n overflow: auto;\n /*\n * A bottom bar lays its blocks across the width and wraps, where the\n * old right-hand column stacked them. Stacking five blocks in a bar\n * that is one or two rows tall would push the last of them out of\n * sight, so a block takes a full row only when it asks for one.\n */\n display: flex;\n flex-wrap: wrap;\n /*\n * Safe centring places the blocks in the middle while they fit and\n * at the start once they do not. Plain centring overflows a fixed bar\n * at both ends, and nothing scrolls back to what sits above the top.\n */\n align-items: center;\n align-content: safe center;\n justify-content: safe center;\n gap: var(--sealpixel-space) calc(var(--sealpixel-space) * 2);\n scrollbar-width: thin;\n scroll-behavior: smooth;\n }\n /*\n * A tool whose panel lays out to nothing gets no bar. Without this the\n * fixed height above reserves an empty surface and takes it off the\n * stage; see syncPanelFill(), which sets the attribute.\n */\n .panel[data-empty] {\n height: 0;\n padding: 0;\n border-top: 0;\n overflow: hidden;\n }\n /*\n * A dial needs room to be worth dragging, but it must not grow into all\n * of it: a dial that stretches pushes the controls beside it against the\n * two edges of the bar, and they stop reading as one group.\n */\n .panel > sealpixel-slider {\n flex: 0 1 360px;\n min-width: 240px;\n }\n /* Chips, presets and asset libraries always get their own full row. */\n .panel > .strip,\n .panel > .grid {\n flex: 1 1 100%;\n }\n .panel > .row,\n .panel > .rows,\n .panel > .field,\n .panel > .hint {\n flex: 0 1 auto;\n }\n /*\n * A tool panel has two kinds of control: the choice of what to work with\n * (a shape, a frame style, a preset, a parameter) and the settings for\n * whatever is chosen. The choice belongs at the bottom, next to the tool\n * rail it continues, and its settings appear above it. Side by side they\n * read as one undifferentiated row of buttons and it is not obvious which\n * of them changes what.\n *\n * Ordering here rather than in each tool keeps a panel's source in\n * reading order and lets a third-party tool join in with one class.\n */\n .panel > * {\n order: 1;\n }\n /*\n * Switching tools rebuilds the panel, so the rows rise on the new\n * children and never on a value change inside the open tool, where Lit\n * patches the same nodes.\n *\n * Transform only, deliberately. A fade would put the labels at partial\n * opacity for a moment, and a contrast audit that samples the panel\n * during that moment reports text it can read on screen as failing.\n * Transform also keeps the panel's own height still, which the layout\n * around it is measured against.\n */\n .panel > * {\n animation: sealpixel-panel-in var(--sealpixel-duration) var(--sealpixel-ease-out) both;\n }\n .panel > *:nth-child(2) {\n animation-delay: 25ms;\n }\n .panel > *:nth-child(n + 3) {\n animation-delay: 50ms;\n }\n @keyframes sealpixel-panel-in {\n from {\n transform: translateY(8px);\n }\n }\n /* Phones: option grids become one horizontal strip so the stage keeps its height. */\n .panel .grid,\n .panel .strip {\n display: flex;\n gap: var(--sealpixel-space);\n overflow-x: auto;\n scrollbar-width: none;\n padding-bottom: 2px;\n scroll-snap-type: x proximity;\n }\n .panel .grid::-webkit-scrollbar,\n .panel .strip::-webkit-scrollbar {\n display: none;\n }\n .panel .grid > *,\n .panel .strip > * {\n flex: 0 0 auto;\n min-width: 96px;\n scroll-snap-align: start;\n }\n .panel .strip > * {\n min-width: 0;\n }\n /*\n * The strip centres while it fits and scrolls from the first item once\n * it does not, so a short row of presets is not stranded at the left\n * edge of a wide bar.\n */\n .panel .strip {\n justify-content: safe center;\n align-items: end;\n scroll-behavior: smooth;\n }\n .panel .chips {\n gap: 2px;\n }\n /*\n * A segmented control: one pill holds the row, the segments share it. Six\n * separate buttons put six borders in a row and made the choice look like\n * six unrelated actions; one container says they are one decision with\n * one answer at a time.\n */\n .panel .group {\n display: inline-flex;\n gap: 2px;\n padding: 2px;\n background: var(--sealpixel-color-surface-2);\n border-radius: var(--sealpixel-radius-pill);\n flex: 0 0 auto;\n }\n .panel .group sealpixel-button::part(button) {\n background: transparent;\n border-color: transparent;\n min-height: calc(var(--sealpixel-control-height) - 4px);\n min-width: calc(var(--sealpixel-control-height) - 4px);\n padding: 0 calc(var(--sealpixel-space) * 1.25);\n }\n .panel .group sealpixel-button:hover::part(button) {\n background: color-mix(in srgb, var(--sealpixel-color-fg) 7%, transparent);\n }\n .panel .group sealpixel-button[pressed]::part(button) {\n background: var(--sealpixel-color-surface);\n color: var(--sealpixel-color-accent);\n box-shadow: var(--sealpixel-shadow-sm, none);\n }\n\n /* Filter tiles: the image is the control, the label only names it. */\n .panel .tiles {\n gap: calc(var(--sealpixel-space) * 0.75);\n }\n /*\n * The one control in the bar that gets bigger. Everywhere else the chrome\n * shrank; here the chrome is the point, because a preset is judged by\n * looking at it.\n */\n .panel .thumb {\n display: block;\n width: 100%;\n height: 64px;\n object-fit: cover;\n border-radius: var(--sealpixel-radius);\n background: var(--sealpixel-color-surface-2);\n box-shadow: 0 0 0 1px var(--sealpixel-color-border);\n transition:\n box-shadow var(--sealpixel-duration) var(--sealpixel-ease),\n transform var(--sealpixel-duration) var(--sealpixel-ease-spring);\n }\n .panel .tiles sealpixel-button {\n min-width: 84px;\n max-width: 84px;\n }\n .panel .tiles sealpixel-button::part(button) {\n flex-direction: column;\n gap: 6px;\n padding: 0;\n min-height: 0;\n height: auto;\n font-size: calc(var(--sealpixel-font-size) * 11 / 14);\n background: transparent;\n color: var(--sealpixel-color-fg-muted);\n }\n .panel .tiles sealpixel-button:hover .thumb {\n transform: translateY(-2px);\n }\n .panel .tiles sealpixel-button[pressed] .thumb {\n box-shadow:\n 0 0 0 2px var(--sealpixel-color-surface),\n 0 0 0 4px var(--sealpixel-color-accent);\n }\n .panel .tiles sealpixel-button[pressed]::part(button) {\n background: transparent;\n border-color: transparent;\n color: var(--sealpixel-color-fg);\n }\n /* Separates the untouched image from the presets. */\n .panel .divider {\n flex: 0 0 auto;\n align-self: stretch;\n width: 1px;\n min-width: 1px;\n margin: 6px calc(var(--sealpixel-space) * 0.5);\n background: var(--sealpixel-color-border);\n opacity: 0.55;\n }\n .panel .row.compact > sealpixel-button {\n flex: 0 0 auto;\n min-width: 72px;\n }\n /* Phones: sibling groups share one line and hints make room for the stage. */\n .panel .rows {\n display: flex;\n gap: var(--sealpixel-space);\n align-items: end;\n }\n /*\n * Content width, not an equal share. An equal share squeezed a text field\n * and a colour well down to a few pixels each and their labels ran into\n * one another; only a dial has a reason to take the leftover room.\n */\n .panel .rows > * {\n flex: 0 1 auto;\n min-width: 0;\n }\n /*\n * A dial needs travel to be worth dragging. Inside a settings row it was\n * sharing the width equally with a colour swatch and a checkbox and ended\n * up a few ticks wide, which is not a control any more. The row grows to\n * give it that width instead of shrinking to its contents.\n */\n /*\n * A settings row scrolls sideways when it is wider than the bar, the way\n * the choice row does. Letting it overflow instead left the last control\n * cut off at the edge with nothing to say it was there.\n */\n .panel > .rows {\n flex: 0 1 auto;\n max-width: 100%;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n scroll-behavior: smooth;\n padding-bottom: 1px;\n }\n .panel > .rows::-webkit-scrollbar {\n display: none;\n }\n .panel > .rows > * {\n flex-shrink: 0;\n }\n .panel .rows > sealpixel-slider {\n flex: 0 1 260px;\n min-width: 220px;\n }\n .panel .rows .row {\n flex-wrap: nowrap;\n }\n .panel .rows .row > sealpixel-button {\n flex: 1 1 0;\n min-width: 0;\n }\n /*\n * A field fills its label, but never shrinks to nothing: a text box a\n * few pixels wide hides what was typed into it, and a select that narrow\n * hides which option is chosen.\n */\n .panel .rows select,\n .panel .rows input:not([type='checkbox']):not([type='color']) {\n width: 100%;\n min-width: 7em;\n }\n .panel .rows input[type='text'],\n .panel .rows textarea {\n min-width: 11em;\n }\n .panel .rows > .field:has(input[type='color']),\n .panel .rows > .field.check {\n flex: 0 0 auto;\n }\n /* A colour well is square, which makes the disc round. */\n .panel .rows > .field:has(input[type='color']) input {\n width: var(--sealpixel-control-height);\n aspect-ratio: 1;\n }\n .panel .swatches {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-bottom: 6px;\n }\n .panel .swatch {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n border: 0;\n box-shadow: 0 0 0 1px var(--sealpixel-color-border);\n cursor: pointer;\n padding: 0;\n transition:\n transform var(--sealpixel-duration) var(--sealpixel-ease-spring),\n border-color var(--sealpixel-transition),\n box-shadow var(--sealpixel-duration) var(--sealpixel-ease);\n }\n .panel .swatch:hover {\n transform: scale(1.12);\n }\n .panel .swatch:active {\n transform: scale(0.94);\n }\n /* The ring sits off the disc, so the colour itself is never covered. */\n .panel .swatch[aria-pressed='true'] {\n box-shadow:\n 0 0 0 2px var(--sealpixel-color-surface),\n 0 0 0 3.5px var(--sealpixel-color-accent);\n }\n .panel:empty {\n display: none;\n }\n .toast {\n position: absolute;\n left: 50%;\n bottom: calc(var(--sealpixel-toolbar-size) + var(--sealpixel-space) * 2);\n /* Sits above the stage, never over the bar the user is working in. */\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n gap: var(--sealpixel-space);\n max-width: calc(100% - var(--sealpixel-space) * 4);\n padding: calc(var(--sealpixel-space) * 1.25) calc(var(--sealpixel-space) * 2);\n border-radius: 999px;\n background: color-mix(in srgb, var(--sealpixel-color-surface) 92%, transparent);\n border: 1px solid var(--sealpixel-color-border);\n box-shadow: var(--sealpixel-shadow, 0 8px 24px rgba(0, 0, 0, 0.3));\n color: var(--sealpixel-color-fg);\n font-size: calc(var(--sealpixel-font-size) * 13 / 14);\n white-space: nowrap;\n backdrop-filter: blur(8px);\n cursor: pointer;\n z-index: 2;\n animation: sealpixel-toast-in var(--sealpixel-duration) var(--sealpixel-ease-out) both;\n }\n .toast:hover {\n border-color: var(--sealpixel-color-fg-muted);\n }\n .toast code {\n font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;\n color: var(--sealpixel-color-fg-muted);\n padding: 2px 8px;\n border-radius: 999px;\n background: var(--sealpixel-color-surface-2);\n }\n @keyframes sealpixel-toast-in {\n from {\n opacity: 0;\n transform: translate(-50%, 12px) scale(0.96);\n }\n }\n /*\n * Wide layouts move the tool rail to the left edge and nothing else. The\n * panel stays a bottom bar at every width, so a control sits in the same\n * place on a phone and on a desktop, and the stage keeps the full width\n * it needs for a landscape image.\n */\n @container (min-width: 48rem) {\n /*\n * The rail runs the full height beside both the stage and the bar.\n * Stopping it above the bar cost it the bar's height, and with ten or\n * more tools the last of them ended up scrolled out of sight behind\n * the settings of the one already open.\n */\n .root {\n grid-template:\n 'nav nav' auto\n 'toolbar stage' 1fr\n 'toolbar panel' auto / var(--sealpixel-toolbar-size) 1fr;\n }\n .panel {\n height: max(var(--sealpixel-panel-size), var(--sealpixel-panel-fit, 0px));\n padding: var(--sealpixel-space) calc(var(--sealpixel-space) * 2);\n }\n .panel[data-empty] {\n height: 0;\n padding: 0;\n }\n .toast {\n bottom: calc(var(--sealpixel-space) * 2);\n }\n }\n .panel .row {\n display: flex;\n gap: var(--sealpixel-space);\n flex-wrap: wrap;\n }\n .panel > .choice {\n order: 2;\n flex: 1 1 100%;\n justify-content: safe center;\n /*\n * Pinned to the foot of the bar. The choice is what gets the user out\n * of the tool they are in, so it has to stay reachable even when a\n * busy panel scrolls its settings.\n */\n position: sticky;\n bottom: 0;\n z-index: 1;\n background: var(--sealpixel-color-surface);\n padding-top: 4px;\n /*\n * One line that scrolls, never two that wrap. A wrapped second line\n * falls below the bar and takes whatever was on it out of reach, and\n * on a phone that was the reset button.\n */\n flex-wrap: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n scroll-behavior: smooth;\n }\n .panel > .choice::-webkit-scrollbar {\n display: none;\n }\n .panel > .choice > * {\n flex-shrink: 0;\n }\n .panel .field {\n display: grid;\n gap: 3px;\n justify-items: center;\n color: var(--sealpixel-color-fg-muted);\n }\n /* The label names the control; it is not the thing being read. */\n .panel .field > span,\n .panel .field > .lab {\n font-size: calc(var(--sealpixel-font-size) * 11 / 14);\n letter-spacing: 0.012em;\n line-height: 1.2;\n }\n .panel .hint {\n margin: 0;\n color: var(--sealpixel-color-fg-muted);\n font-size: calc(var(--sealpixel-font-size) * 12 / 14);\n }\n /*\n * Width and height are one measurement, so they sit against the link that\n * binds them rather than being two fields that happen to be adjacent.\n */\n .panel .dims {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n }\n .panel .dims input[type='number'] {\n width: 5.5em;\n min-width: 0;\n text-align: center;\n font-variant-numeric: tabular-nums;\n appearance: textfield;\n }\n .panel .dims input::-webkit-outer-spin-button,\n .panel .dims input::-webkit-inner-spin-button {\n appearance: none;\n margin: 0;\n }\n /* A value the link worked out, not one that was typed. */\n .panel .dims input.derived {\n color: var(--sealpixel-color-fg-muted);\n font-weight: 400;\n }\n .panel .dims sealpixel-button::part(button) {\n min-width: calc(var(--sealpixel-control-height) - 6px);\n min-height: calc(var(--sealpixel-control-height) - 6px);\n padding: 0;\n background: transparent;\n color: var(--sealpixel-color-fg-muted);\n }\n .panel .dims sealpixel-button[pressed]::part(button) {\n background: var(--sealpixel-color-accent-soft);\n color: var(--sealpixel-color-accent);\n }\n .panel .anchors {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 4px;\n max-width: 180px;\n }\n .panel .field.check {\n grid-template-columns: auto 1fr;\n align-items: center;\n }\n .panel textarea {\n font: inherit;\n color: var(--sealpixel-color-fg);\n background: var(--sealpixel-color-surface-2);\n border: 1px solid var(--sealpixel-color-border);\n border-radius: var(--sealpixel-radius-sm);\n padding: var(--sealpixel-space);\n resize: vertical;\n }\n /* A colour is a disc, not a box: it shows the colour and nothing else. */\n .panel input[type='color'] {\n /* Without this the engine keeps its own swatch metrics inside the box\n and the disc comes out an ellipse. */\n appearance: none;\n min-height: var(--sealpixel-control-height);\n height: var(--sealpixel-control-height);\n width: var(--sealpixel-control-height);\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: transparent;\n cursor: pointer;\n overflow: hidden;\n }\n /* The swatch has to be told to fill the box; it does not by default. */\n .panel input[type='color']::-webkit-color-swatch-wrapper {\n padding: 0;\n width: 100%;\n height: 100%;\n }\n .panel input[type='color']::-webkit-color-swatch {\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 50%;\n box-shadow: 0 0 0 1px var(--sealpixel-color-border);\n }\n .panel input[type='color']::-moz-color-swatch {\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 50%;\n box-shadow: 0 0 0 1px var(--sealpixel-color-border);\n }\n .panel input:not([type='checkbox']):not([type='color']),\n .panel select {\n font: inherit;\n font-size: calc(var(--sealpixel-font-size) * 13 / 14);\n color: var(--sealpixel-color-fg);\n background: var(--sealpixel-color-surface-2);\n border: 1px solid transparent;\n border-radius: var(--sealpixel-radius-pill);\n min-height: var(--sealpixel-control-height);\n padding: 0 calc(var(--sealpixel-space) * 1.5);\n }\n /*\n * The chevron is drawn rather than left to the platform, so a select sits\n * next to a pill button instead of looking like a form field that walked\n * in from another page. The right padding keeps the text off it.\n */\n .panel select {\n appearance: none;\n padding-right: calc(var(--sealpixel-space) * 3);\n background-image:\n linear-gradient(45deg, transparent 50%, currentColor 50%),\n linear-gradient(135deg, currentColor 50%, transparent 50%);\n background-size: 5px 5px, 5px 5px;\n background-position:\n right 14px top 52%,\n right 10px top 52%;\n background-repeat: no-repeat;\n color: var(--sealpixel-color-fg);\n }\n .empty {\n grid-area: stage;\n display: grid;\n place-content: center;\n gap: var(--sealpixel-space);\n text-align: center;\n color: var(--sealpixel-color-fg-muted);\n padding: var(--sealpixel-space);\n }\n .empty {\n transition:\n background var(--sealpixel-duration) var(--sealpixel-ease),\n color var(--sealpixel-duration) var(--sealpixel-ease);\n }\n .empty.dragover {\n outline: 2px dashed var(--sealpixel-color-accent);\n outline-offset: -8px;\n background: var(--sealpixel-color-accent-soft, transparent);\n color: var(--sealpixel-color-fg);\n }\n /*\n * A source is loading: the mark, its core breathing. The outer square\n * stands still and the inner one swells and fades, in the muted\n * foreground so nothing reads as a warning. It stops under\n * prefers-reduced-motion and still reads as the mark.\n */\n .empty.loading {\n justify-items: center;\n gap: calc(var(--sealpixel-space) * 2);\n }\n .empty.loading p {\n margin: 0;\n }\n .mark {\n display: block;\n width: 40px;\n height: 40px;\n color: var(--sealpixel-color-fg-muted);\n }\n .mark .core {\n transform-origin: 16px 16px;\n animation: sealpixel-loading-breathe 1.8s var(--sealpixel-ease) infinite;\n }\n @keyframes sealpixel-loading-breathe {\n 50% {\n opacity: 0.45;\n transform: scale(0.62);\n }\n }\n }\n .error {\n grid-area: nav;\n align-self: end;\n justify-self: center;\n margin-top: calc(var(--sealpixel-toolbar-size) + 4px);\n z-index: 1;\n padding: 6px 10px;\n border-radius: var(--sealpixel-radius);\n background: var(--sealpixel-color-danger);\n color: white;\n font-size: calc(var(--sealpixel-font-size) * 12 / 14);\n box-shadow: var(--sealpixel-shadow-raised, none);\n animation: sealpixel-panel-in var(--sealpixel-duration) var(--sealpixel-ease-out) both;\n }\n `,\n ];\n\n static override properties = {\n plugins: { attribute: false },\n pluginOptions: {\n attribute: 'plugin-options',\n converter: jsonAttribute<PluginOptionsMap>('plugin-options'),\n },\n session: { attribute: false },\n renderer: { attribute: false },\n assets: { attribute: false },\n limits: {\n attribute: 'limits',\n converter: jsonAttribute<NonNullable<SessionOptions['limits']>>('limits'),\n },\n src: { attribute: false },\n editLog: { attribute: false },\n defaultEditLog: { attribute: false },\n output: { attribute: false },\n theme: { type: String, reflect: true },\n locale: { type: String },\n dictionary: { attribute: false },\n tools: { attribute: false },\n activeTool: { type: String, attribute: 'active-tool' },\n showExport: { type: String, attribute: 'show-export' },\n showDownload: { type: String, attribute: 'show-download' },\n showHistory: { type: String, attribute: 'show-history' },\n downloadLabel: { type: String, attribute: 'download-label' },\n _busy: { state: true },\n _processListeners: { state: true },\n _toast: { state: true },\n _dragover: { state: true },\n _wide: { state: true },\n _pluginTools: { state: true },\n };\n\n declare plugins: readonly AnyPlugin[] | null;\n /** `{ pluginId: partialOptions }` applied to `plugins` (or the defaults) through each plugin's `configure()`. */\n declare pluginOptions: PluginOptionsMap | null;\n declare session: EditorSession | null;\n declare renderer: Renderer | null;\n /** Fonts and images. Defaults to a fetch resolver over the plugins' declarations. */\n declare assets: AssetResolver | null;\n /**\n * How much of the original stays in the browser; `SessionOptions['limits']`\n * (JSON in the attribute). Above `maxClientMegapixels` (16 by default) the\n * image is not resident: Export and Download are disabled, and the host\n * renders the original outside the browser.\n */\n declare limits: SessionOptions['limits'] | null;\n declare src: EditorSource | null;\n /** Controlled mode: the host owns the log. */\n declare editLog: unknown;\n /** Uncontrolled: applied once on load. */\n declare defaultEditLog: unknown;\n declare output: OutputOptions;\n declare theme: 'dark' | 'light' | 'auto';\n declare locale: string;\n /** Overrides the shipped dictionary for `locale`; shipped locales resolve automatically. */\n declare dictionary: Dictionary | null;\n declare tools: Record<string, UiTool> | null;\n declare activeTool: string | null;\n /**\n * When the Export button is shown. `auto` (default) shows it only while a\n * `sealpixel:process` listener is attached, because Export hands the result to\n * the host and does nothing visible otherwise. Download is always shown.\n */\n declare showExport: 'auto' | 'always' | 'never';\n /** `always` (default) or `never`. Hosts that only consume `sealpixel:process` hide the button. */\n declare showDownload: 'always' | 'never';\n /** `all` (default), `buttons` (undo and redo, no timeline) or `none` (also disables the undo/redo shortcuts). */\n declare showHistory: 'all' | 'buttons' | 'none';\n /** Custom text for the Download button; the localized label when null. */\n declare downloadLabel: string | null;\n declare _busy: boolean;\n declare _processListeners: number;\n declare _toast: { text: string; hash: string } | null;\n declare _dragover: boolean;\n declare _wide: boolean;\n /** Tools loaded from `plugin.tool()`, keyed by plugin id. */\n declare _pluginTools: Record<string, UiTool>;\n private resizeObserver: ResizeObserver | null = null;\n private toolLoads = new Set<string>();\n\n /**\n * Used when no `renderer` property is set. `@sealpixel/element` installs a\n * factory that starts the bundled worker; without it the editor renders inline.\n */\n static defaultRendererFactory: ((plugins: readonly AnyPlugin[]) => Renderer) | null = null;\n\n private readonly ctl = new SessionController(this, null);\n private i18n: I18n = createI18n('en');\n private ownsSession = false;\n private lastEmittedVersion = -1;\n private lastAppliedControlled = '';\n private hint: { filter?: string; transform?: string; rotate?: number } | null = null;\n private previousTool: UiTool | null = null;\n /** The source the tools last heard about; `load` replaces the object, so identity is the guard. */\n private lastSource: SourceDescriptor | null = null;\n private loadedSrc: EditorSource | null = null;\n /** The edit log of a session released while the element was out of the document. */\n private detachedLog: { log: unknown; index: number } | null = null;\n /** Whether the owned session was released while the element was out of the document. */\n private released = false;\n\n constructor() {\n super();\n this.plugins = null;\n this.pluginOptions = null;\n this.session = null;\n this.renderer = null;\n this.assets = null;\n this.limits = null;\n this.src = null;\n this.editLog = undefined;\n this.defaultEditLog = undefined;\n this.output = { format: 'image/png' };\n this.theme = 'dark';\n this.locale = 'en';\n this.dictionary = null;\n this.tools = null;\n this.activeTool = null;\n this.showExport = 'auto';\n this.showDownload = 'always';\n this.showHistory = 'all';\n this.downloadLabel = null;\n this._busy = false;\n this._processListeners = 0;\n this._toast = null;\n this._dragover = false;\n this._wide = false;\n this._pluginTools = {};\n }\n\n // Export hands the result to the host, so the button is shown only while\n // someone listens for `sealpixel:process`. Listener counts are tracked here.\n override addEventListener<K extends keyof HTMLElementEventMap>(\n type: K,\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown,\n options?: boolean | AddEventListenerOptions,\n ): void;\n override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject | ((ev: Event) => unknown),\n options?: boolean | AddEventListenerOptions,\n ): void {\n super.addEventListener(type, listener as EventListenerOrEventListenerObject, options);\n if (type === 'sealpixel:process') this._processListeners += 1;\n }\n\n override removeEventListener<K extends keyof HTMLElementEventMap>(\n type: K,\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject | ((ev: Event) => unknown),\n options?: boolean | EventListenerOptions,\n ): void {\n super.removeEventListener(type, listener as EventListenerOrEventListenerObject, options);\n if (type === 'sealpixel:process' && this._processListeners > 0) this._processListeners -= 1;\n }\n\n /** A renderer the editor made through the factory dies with the session; a host's renderer lives on. */\n private disposeOwnedRenderer(): void {\n if (this.sessionRenderer && this.sessionRenderer !== this.renderer) {\n this.sessionRenderer.dispose();\n }\n this.sessionRenderer = null;\n }\n\n /** `plugins` (or the defaults) with `pluginOptions` applied. Invalid options raise `sealpixel:error`. */\n private effectivePlugins(): readonly AnyPlugin[] {\n const base = this.plugins ?? defaultPlugins;\n if (!this.pluginOptions) return base;\n try {\n return configurePlugins(base, this.pluginOptions);\n } catch (error) {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n return base;\n }\n }\n\n /** The live session, created on first connection when none was passed. */\n getSession(): EditorSession {\n if (!this.ctl.session) this.ensureSession();\n return this.ctl.session as EditorSession;\n }\n getEditLog() {\n return this.getSession().getEditLog();\n }\n setEditLog(saved: unknown, index?: number) {\n this.getSession().setEditLog(saved, index);\n }\n undo() {\n this.getSession().undo();\n }\n redo() {\n this.getSession().redo();\n }\n timeTravel(index: number) {\n this.getSession().timeTravel(index);\n }\n async export(output: OutputOptions = this.output, options: { embedEditLog?: boolean } = {}) {\n return this.getSession().export({ output, ...options });\n }\n async download(\n options: { output?: OutputOptions; filename?: string; embedEditLog?: boolean } = {},\n ) {\n return this.getSession().download({ output: this.output, ...options });\n }\n\n private ensureSession(): void {\n if (this.ctl.session) return;\n if (this.session) {\n this.ctl.session = this.session;\n return;\n }\n const plugins = this.effectivePlugins();\n const renderer = this.renderer ?? SealpixelEditor.defaultRendererFactory?.(plugins) ?? null;\n this.sessionRenderer = renderer;\n const assets =\n this.assets ?? createAssetResolver({ assets: plugins.flatMap((p) => p.assets ?? []) });\n this.sessionAssets = this.assets;\n this.sessionLimits = this.limits;\n const session = createEditorSession({\n plugins,\n assets,\n ...(renderer ? { renderer } : {}),\n ...(this.limits ? { limits: this.limits } : {}),\n });\n this.ownsSession = true;\n this.ctl.session = session;\n this.dispatchEvent(new CustomEvent('sealpixel:ready', { bubbles: true, composed: true }));\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.ensureSession();\n // Out of the document long enough to lose the session: the source comes\n // back with the edit log it had when it left.\n if (this.released) {\n const restore = this.detachedLog ?? undefined;\n this.released = false;\n this.detachedLog = null;\n if (this.loadedSrc) void this.loadSource(this.loadedSrc, restore);\n }\n // Keyboard shortcuts need focus inside the editor. WebKit does not focus\n // buttons on click, so pull focus in on any pointer interaction.\n if (!this.hasAttribute('tabindex')) this.tabIndex = -1;\n this.addEventListener('keydown', this.onKeydown);\n this.addEventListener('pointerdown', this.onPointerDown);\n this.resizeObserver = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width ?? this.clientWidth;\n this._wide = width >= 768;\n });\n this.resizeObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this.onKeydown);\n this.removeEventListener('pointerdown', this.onPointerDown);\n this.resizeObserver?.disconnect();\n // A move in the DOM (an append into another parent, a portal, a keyed\n // reorder) disconnects and connects again in the same task. Disposing here\n // would throw the image and its history away on every move, so the\n // session goes only if the element is still out after the task.\n if (this.ownsSession) {\n queueMicrotask(() => {\n if (!this.isConnected) this.releaseSession();\n });\n }\n }\n\n /** Disposes the owned session and keeps its edit log for a later connection. */\n private releaseSession(): void {\n const session = this.ctl.session;\n if (!this.ownsSession || !session) return;\n this.released = true;\n this.detachedLog = session.getState().status === 'ready' ? session.getEditLog() : null;\n session.dispose();\n this.disposeOwnedRenderer();\n this.ctl.session = null;\n this.ownsSession = false;\n this.lastEmittedVersion = -1;\n this.lastSource = null;\n // The tools activate again on the session that replaces this one.\n this.previousTool = null;\n }\n\n override willUpdate(changed: Map<string, unknown>): void {\n if (changed.has('locale') || changed.has('dictionary')) {\n // A dictionary changes the strings it names; every other string stays\n // in the shipped locale.\n this.i18n = createI18n(this.locale, {\n ...resolveLocale(this.locale),\n ...(this.dictionary ?? {}),\n });\n }\n if (changed.has('session') && this.session && this.session !== this.ctl.session) {\n if (this.ownsSession) {\n this.ctl.session?.dispose();\n this.disposeOwnedRenderer();\n }\n this.ownsSession = false;\n this.ctl.session = this.session;\n }\n // A new plugin list or renderer needs a new session; reload the current source into it.\n if (\n (changed.has('plugins') ||\n changed.has('pluginOptions') ||\n changed.has('renderer') ||\n changed.has('assets') ||\n changed.has('limits')) &&\n this.ownsSession &&\n !this.sessionMatchesProps()\n ) {\n this.ctl.session?.dispose();\n this.disposeOwnedRenderer();\n this.ctl.session = null;\n this.ownsSession = false;\n this.toolLoads.clear();\n this._pluginTools = {};\n this.lastEmittedVersion = -1;\n this.lastSource = null;\n this.ensureSession();\n if (this.loadedSrc) void this.loadSource(this.loadedSrc);\n }\n if (changed.has('src') && this.src && this.src !== this.loadedSrc) {\n this.loadedSrc = this.src;\n void this.loadSource(this.src);\n }\n if (changed.has('editLog') && this.editLog != null) this.applyControlled();\n }\n\n override updated(): void {\n const state = this.ctl.state;\n const session = this.ctl.session;\n if (!state || !session) return;\n if (state.version !== this.lastEmittedVersion && state.status === 'ready') {\n this.lastEmittedVersion = state.version;\n const detail = session.getEditLog();\n this.lastAppliedControlled = canonicalJson(detail);\n this.dispatchEvent(\n new CustomEvent('sealpixel:change', { detail, bubbles: true, composed: true }),\n );\n }\n if (state.error && state.error !== this.lastError) {\n this.lastError = state.error;\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: state.error, bubbles: true, composed: true }),\n );\n }\n this.syncActiveTool();\n this.syncSource(state);\n this.syncPanelFill();\n }\n private lastError: unknown = null;\n\n /** Tells every tool, active or not, that a new source has loaded. Once per source. */\n private syncSource(state: SessionState): void {\n if (state.status !== 'ready' || !state.source || state.source === this.lastSource) return;\n this.lastSource = state.source;\n const ctx = this.toolContext(state);\n for (const tool of this.currentTools()) tool.onSource?.(ctx);\n }\n\n /**\n * Collapses the settings bar when the open tool has nothing to put in it.\n *\n * A tool renders its own structure, and a structure can hold nothing: crop\n * with `rotation`, `flip` and `reset` off and a single enforced aspect emits\n * two empty wrappers. The bar is a fixed height on purpose — see `.panel` —\n * so that reserved an empty bordered surface and took the same height off\n * the stage. On the landing page's avatar card that was 240 px of nothing\n * against a 178 px stage, and the photo rendered at 10 percent.\n *\n * Read from the DOM rather than asked of the tool: every tool would\n * otherwise have to declare it, and a tool whose panel empties out only\n * under some options would get it wrong.\n *\n * Not measured by size either. The empty wrappers still lay out — the row\n * is 8px from its own gap and the group 4px from its border — so a\n * bounding box tells content and scaffolding apart not at all. What counts\n * is a control or a word: a custom element, a form control, or any text.\n */\n private syncPanelFill(): void {\n const panel = this.renderRoot.querySelector('.panel') as HTMLElement | null;\n if (!panel) return;\n const filled =\n (panel.textContent ?? '').trim().length > 0 ||\n Array.from(panel.querySelectorAll('*')).some(\n (node) => node.tagName.includes('-') || node.matches(PANEL_CONTENT),\n );\n panel.toggleAttribute('data-empty', !filled);\n this.syncPanelFit(panel, filled);\n }\n\n /**\n * Lets the settings bar grow to the height its content needs.\n *\n * The bar is a fixed height so that moving between tools does not resize\n * the stage under the user. When a tool needs more than that height, the\n * overflow has nowhere to go: a wrapping flex container of fixed height has\n * no scrollable cross-axis overflow, so `overflow: auto` never produces a\n * scrollbar, and the sticky choice row — which pins itself inside the\n * scrollport — is dragged up over the settings instead. The colour swatch\n * ends up half covered and the fill toggle disappears behind the shapes.\n *\n * WebKit is where this surfaced, on a real iPhone: it lays these controls\n * taller than Blink does, and at phone width crop, finetune and annotate\n * needed 138, 140 and 136 pixels against the 112 the bar had. Raising the\n * default would have taken those pixels off every stage in every engine, so\n * the height is measured instead and only the bar that needs more gets it.\n * `34cqh` still caps it, so a busy tool cannot eat the stage.\n */\n private syncPanelFit(panel: HTMLElement, filled: boolean): void {\n panel.style.removeProperty('--sealpixel-panel-fit');\n if (!filled) return;\n // Read after the reset, so a bar that has since shrunk measures its own\n // content and not the height it was given last time.\n const needed = panel.scrollHeight;\n if (needed > panel.clientHeight) {\n panel.style.setProperty('--sealpixel-panel-fit', `${needed}px`);\n }\n }\n\n private async loadSource(src: EditorSource, restore?: unknown): Promise<void> {\n const session = this.getSession();\n try {\n // `null` is \"no saved log\", the same as `undefined`: framework props\n // commonly type an absent log as null.\n const saved = this.editLog ?? restore ?? this.defaultEditLog ?? undefined;\n const bytes = src instanceof Uint8Array ? src : src;\n const descriptor = await session.load(bytes, saved === undefined ? {} : { editLog: saved });\n // Option defaults become real ops in an otherwise empty log.\n if (saved === undefined && session.getState().history.log.ops.length === 0) {\n for (const op of session.registry.initialOps(descriptor)) {\n session.dispatch({\n ...op,\n id: `init-${Math.random().toString(36).slice(2, 8)}`,\n } as Parameters<typeof session.dispatch>[0]);\n }\n }\n this.dispatchEvent(\n new CustomEvent('sealpixel:load', { detail: descriptor, bubbles: true, composed: true }),\n );\n if (!this.activeTool) {\n const first = this.currentTools()[0];\n if (first) this.activeTool = first.id;\n }\n } catch (error) {\n // A newer `src` replaced this load. That load reports its own outcome.\n if ((error as Error | null)?.name === 'ABORTED') return;\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n }\n }\n\n private applyControlled(): void {\n const session = this.ctl.session;\n if (!session || session.getState().status !== 'ready' || this.editLog == null) return;\n const wanted = this.editLog as { log?: unknown; index?: number };\n const key = canonicalJson(wanted);\n if (key === this.lastAppliedControlled) return;\n try {\n session.setEditLog(wanted, wanted.index);\n this.lastAppliedControlled = key;\n } catch (error) {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n }\n }\n\n /** Whether the owned session was built from the current `plugins`, `renderer`, `assets` and `limits`. */\n private sessionMatchesProps(): boolean {\n const session = this.ctl.session;\n if (!session) return false;\n if (this.renderer && this.renderer !== this.sessionRenderer) return false;\n if (this.assets && this.assets !== this.sessionAssets) return false;\n if (canonicalJson(this.limits ?? null) !== canonicalJson(this.sessionLimits ?? null))\n return false;\n // Compare id, version and resolved options (options JSON may contain commas, so no string splitting).\n const key = (plugins: readonly AnyPlugin[]) =>\n canonicalJson(\n [...plugins]\n .sort((a, b) => a.id.localeCompare(b.id))\n .map((p) => [p.id, p.version, p.options ?? null]),\n );\n return key(this.effectivePlugins()) === key(session.registry.plugins);\n }\n private sessionRenderer: Renderer | null = null;\n private sessionAssets: AssetResolver | null = null;\n private sessionLimits: SessionOptions['limits'] | null = null;\n\n private currentTools(): UiTool[] {\n const plugins = this.effectivePlugins();\n this.loadPluginTools(plugins);\n return toolsFor(plugins, { ...this._pluginTools, ...(this.tools ?? {}) });\n }\n\n /** Plugins may ship their own tool; load each once and re-render when it arrives. */\n private loadPluginTools(plugins: readonly AnyPlugin[]): void {\n for (const plugin of plugins) {\n if (!plugin.tool || this.toolLoads.has(plugin.id)) continue;\n this.toolLoads.add(plugin.id);\n plugin\n .tool()\n .then((tool) => {\n this._pluginTools = { ...this._pluginTools, [plugin.id]: tool as unknown as UiTool };\n })\n .catch((error) => {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n });\n }\n }\n\n private get stage(): SealpixelStage | null {\n return this.renderRoot.querySelector('sealpixel-stage');\n }\n\n private toolContext(state: SessionState): UiToolContext {\n const session = this.getSession();\n const stage = this.stage;\n return {\n session,\n state,\n document: state.document,\n dispatch: (op) => {\n try {\n session.dispatch(op);\n } catch (error) {\n // A tool asked for something the options forbid: tell the user, keep the log intact.\n if (error instanceof SealpixelError && error.name === 'OPTION_VIOLATION') {\n this._toast = { text: error.message, hash: '' };\n this.announce(error.message);\n return;\n }\n throw error;\n }\n },\n t: this.i18n.t,\n stage: {\n width: state.preview?.image.width ?? 0,\n height: state.preview?.image.height ?? 0,\n zoom: stage?.zoom ?? 1,\n geometry: state.preview?.geometry ?? null,\n toImage: (x, y) => stage?.toImage(x, y) ?? { x: 0, y: 0 },\n },\n hint: (hint) => {\n this.hint = hint;\n const s = this.stage;\n if (s) {\n s.hintFilter = hint?.filter ?? '';\n s.hintTransform = hint?.transform ?? '';\n s.hintRotate = hint?.rotate ?? 0;\n }\n },\n refresh: () => this.requestUpdate(),\n animateNextView: () => this.stage?.glideNextView(),\n clipPreview: (clip) => {\n const s = this.stage;\n if (s) s.clip = clip ?? '';\n },\n layout: this._wide ? 'wide' : 'narrow',\n options: <T>(pluginId: string) =>\n session.registry.byId.get(pluginId)?.options as T | undefined,\n };\n }\n\n private syncActiveTool(): void {\n const state = this.ctl.state;\n if (!state || state.status !== 'ready') return;\n const tool = this.currentTools().find((t) => t.id === this.activeTool) ?? null;\n if (tool === this.previousTool) return;\n const ctx = this.toolContext(state);\n this.previousTool?.deactivate?.(ctx);\n tool?.activate?.(ctx);\n this.previousTool = tool;\n }\n\n private onPointerDown = () => {\n if (!this.matches(':focus-within')) this.focus({ preventScroll: true });\n };\n\n private onKeydown = (e: KeyboardEvent) => {\n const session = this.ctl.session;\n if (!session || session.getState().status !== 'ready') return;\n // Undo inside a text field belongs to the field: it takes back the typing,\n // not the last edit of the image.\n if (isTextEntry(e.composedPath()[0])) return;\n const mod = e.metaKey || e.ctrlKey;\n if (this.showHistory === 'none') return;\n if (mod && e.key.toLowerCase() === 'z') {\n e.preventDefault();\n if (e.shiftKey) session.redo();\n else session.undo();\n } else if (mod && e.key.toLowerCase() === 'y') {\n e.preventDefault();\n session.redo();\n }\n };\n\n private async onExport(): Promise<void> {\n const session = this.getSession();\n this._busy = true;\n try {\n const result: ExportResult = await session.export({ output: this.output });\n this.dispatchEvent(\n new CustomEvent('sealpixel:process', { detail: result, bubbles: true, composed: true }),\n );\n this.toast('toast.exported', result);\n } catch (error) {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n } finally {\n this._busy = false;\n }\n }\n\n private async onDownload(): Promise<void> {\n const session = this.getSession();\n this._busy = true;\n try {\n const { result } = await session.download({ output: this.output });\n this.dispatchEvent(\n new CustomEvent('sealpixel:process', { detail: result, bubbles: true, composed: true }),\n );\n this.toast('toast.downloaded', result);\n } catch (error) {\n this.dispatchEvent(\n new CustomEvent('sealpixel:error', { detail: error, bubbles: true, composed: true }),\n );\n } finally {\n this._busy = false;\n }\n }\n\n private announce(text: string): void {\n const live = this.renderRoot.querySelector('#live');\n if (live) live.textContent = text;\n }\n\n private toastTimer: ReturnType<typeof setTimeout> | null = null;\n\n /** Brief confirmation over the stage: format, size and hash of the result. */\n private toast(\n key: 'toast.exported' | 'toast.downloaded',\n result: Pick<ExportResult, 'mimeType' | 'width' | 'height' | 'hash' | 'bytes'>,\n ): void {\n const format = result.mimeType.replace('image/', '').toUpperCase();\n const size = formatBytes(result.bytes.byteLength);\n const text = this.i18n.t(key, { format, width: result.width, height: result.height, size });\n this._toast = { text, hash: result.hash.slice(0, 12) };\n this.announce(text);\n if (this.toastTimer) clearTimeout(this.toastTimer);\n this.toastTimer = setTimeout(() => {\n this._toast = null;\n this.toastTimer = null;\n }, 5000);\n }\n\n private onFiles(files: FileList | null): void {\n const file = files?.[0];\n if (file) this.src = file;\n }\n\n override render() {\n const state = this.ctl.state;\n const tools = this.currentTools();\n const tool = tools.find((t) => t.id === this.activeTool) ?? null;\n const ready = state?.status === 'ready';\n const ctx = state && ready ? this.toolContext(state) : null;\n const badges: Record<string, number> = {};\n if (ctx) {\n for (const t of tools) {\n const n = t.badge?.(ctx);\n if (n) badges[t.id] = n;\n }\n }\n const wide = this._wide;\n return html`\n <div class=\"root\" part=\"root\">\n <sealpixel-nav\n part=\"nav\"\n exportparts=\"undo, redo, history, export, download, dimensions, button\"\n .state=${state}\n .t=${this.i18n.t}\n .busy=${this._busy}\n .canExport=${state?.resident ?? false}\n .showExport=${this.showExport === 'always' || (this.showExport === 'auto' && this._processListeners > 0)}\n .showDownload=${this.showDownload !== 'never'}\n .showHistory=${this.showHistory}\n .downloadLabel=${this.downloadLabel}\n @nav-undo=${() => this.getSession().undo()}\n @nav-redo=${() => this.getSession().redo()}\n @nav-time-travel=${(e: CustomEvent<number>) => this.getSession().timeTravel(e.detail)}\n @nav-export=${() => this.onExport()}\n @nav-download=${() => this.onDownload()}\n ></sealpixel-nav>\n ${\n ready\n ? html`<sealpixel-stage\n part=\"stage\"\n exportparts=\"viewport, canvas, overlay, status\"\n .preview=${state?.preview ?? null}\n .t=${this.i18n.t}\n .pending=${state?.previewPending ?? false}\n .overlay=${ctx && tool?.overlay ? tool.overlay(ctx) : null}\n @stage-view=${() => this.requestUpdate()}\n ></sealpixel-stage>`\n : this.renderEmpty(state)\n }\n <div class=\"panel\" part=\"panel\">${ctx && tool ? tool.panel(ctx) : nothing}</div>\n <sealpixel-toolbar\n part=\"toolbar\"\n exportparts=\"tool, badge\"\n .tools=${tools}\n .badges=${badges}\n .active=${this.activeTool}\n .t=${this.i18n.t}\n .orientation=${wide ? 'vertical' : 'horizontal'}\n @tool-select=${(e: CustomEvent<string>) => {\n this.activeTool = e.detail;\n }}\n ></sealpixel-toolbar>\n ${state?.error ? html`<div class=\"error\" role=\"alert\">${this.i18n.t('editor.error', { message: state.error.message })}</div>` : nothing}\n ${\n this._toast\n ? html`<div class=\"toast\" part=\"toast\" data-testid=\"toast\" @click=${() => {\n this._toast = null;\n }}>\n <span>${this._toast.text}</span>\n ${this._toast.hash ? html`<code>${this._toast.hash}</code>` : nothing}\n </div>`\n : nothing\n }\n <span id=\"live\" class=\"visually-hidden\" role=\"status\" aria-live=\"polite\"></span>\n </div>\n `;\n }\n\n private renderEmpty(state: SessionState | null): TemplateResult {\n if (state?.status === 'loading') {\n return html`<div class=\"empty loading\" part=\"empty\" role=\"status\">\n <svg class=\"mark\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n <rect x=\"3\" y=\"3\" width=\"26\" height=\"26\" rx=\"5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <rect class=\"core\" x=\"11\" y=\"11\" width=\"10\" height=\"10\" rx=\"1.5\" fill=\"currentColor\" />\n </svg>\n <p>${this.i18n.t('editor.loading')}</p>\n </div>`;\n }\n return html`<div\n class=\"empty ${this._dragover ? 'dragover' : ''}\"\n part=\"empty\"\n @dragover=${(e: DragEvent) => {\n e.preventDefault();\n this._dragover = true;\n }}\n @dragleave=${() => {\n this._dragover = false;\n }}\n @drop=${(e: DragEvent) => {\n e.preventDefault();\n this._dragover = false;\n this.onFiles(e.dataTransfer?.files ?? null);\n }}\n >\n <p>${this.i18n.t('editor.empty')}</p>\n <label>\n <input class=\"visually-hidden\" type=\"file\" accept=\"image/png,image/jpeg,image/webp\" @change=${(e: Event) => this.onFiles((e.target as HTMLInputElement).files)} />\n <sealpixel-button variant=\"primary\" @click=${(e: Event) => ((e.currentTarget as HTMLElement).previousElementSibling as HTMLInputElement).click()}>\n ${this.i18n.t('editor.choose')}\n </sealpixel-button>\n </label>\n </div>`;\n }\n}\n\n/** Input types that hold no text, so Cmd/Ctrl+Z on them has nothing of their own to undo. */\nconst NON_TEXT_INPUTS = new Set([\n 'button',\n 'checkbox',\n 'color',\n 'file',\n 'image',\n 'radio',\n 'range',\n 'reset',\n 'submit',\n]);\n\nfunction isTextEntry(target: EventTarget | undefined): boolean {\n if (!(target instanceof HTMLElement)) return false;\n if (target.isContentEditable || target instanceof HTMLTextAreaElement) return true;\n return target instanceof HTMLInputElement && !NON_TEXT_INPUTS.has(target.type);\n}\n\nfunction formatBytes(n: number): string {\n if (n < 1024) return `${n} B`;\n if (n < 1024 * 1024) return `${(n / 1024).toFixed(n < 10240 ? 1 : 0)} KB`;\n return `${(n / (1024 * 1024)).toFixed(1)} MB`;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sealpixel-nav.js","sourceRoot":"","sources":["../../src/components/sealpixel-nav.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,yDAAyD;AACzD,MAAM,OAAO,YAAa,SAAQ,UAAU;aAC1B,WAAM,GAAG;QACvB,IAAI;QACJ,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiFF;KACF,CAAC;aAEc,eAAU,GAAG;QAC3B,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;QAC3B,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;QACvB,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACvB,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QAC5B,UAAU,EAAE,EAA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AC,cAAc,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,WAAW,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;gBACzN,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC;gCAC9C;YACtB,CAAC,CAAC,OACN;KACD,CAAC;IACJ,CAAC;IAEO,IAAI,CAAC,IAAY,EAAE,MAAgB;QACzC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChG,CAAC","sourcesContent":["import type { SessionState } from '@sealpixel/core';\nimport { css, html, LitElement, nothing } from 'lit';\nimport { icons } from '../icons.js';\nimport { base } from '../theme.js';\n\n/** Undo, redo, history scrubber, export and download. */\nexport class SealpixelNav extends LitElement {\n static override styles = [\n base,\n css`\n :host {\n display: flex;\n align-items: center;\n gap: var(--sealpixel-space);\n padding: 4px var(--sealpixel-space);\n background: var(--sealpixel-color-surface);\n border-bottom: 1px solid var(--sealpixel-color-border);\n min-height: var(--sealpixel-toolbar-size);\n min-width: 0;\n container-type: inline-size;\n overflow: hidden;\n }\n sealpixel-button {\n flex: 0 0 auto;\n }\n .history {\n flex: 1;\n display: flex;\n align-items: center;\n gap: var(--sealpixel-space);\n min-width: 0;\n }\n input[type='range'] {\n flex: 1;\n min-width: 60px;\n accent-color: var(--sealpixel-color-accent);\n height: var(--sealpixel-touch-target);\n margin: 0;\n appearance: none;\n background: transparent;\n }\n input[type='range']::-webkit-slider-runnable-track {\n height: 3px;\n border-radius: 999px;\n background: var(--sealpixel-color-surface-3, var(--sealpixel-color-border));\n }\n input[type='range']::-moz-range-track {\n height: 3px;\n border-radius: 999px;\n background: var(--sealpixel-color-surface-3, var(--sealpixel-color-border));\n }\n input[type='range']::-webkit-slider-thumb {\n appearance: none;\n width: 16px;\n height: 16px;\n margin-top: -6.5px;\n border-radius: 50%;\n background: var(--sealpixel-color-accent);\n border: 3px solid var(--sealpixel-color-surface);\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);\n }\n input[type='range']::-moz-range-thumb {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: var(--sealpixel-color-accent);\n border: 3px solid var(--sealpixel-color-surface);\n }\n .status {\n color: var(--sealpixel-color-fg-muted);\n font-size:
|
|
1
|
+
{"version":3,"file":"sealpixel-nav.js","sourceRoot":"","sources":["../../src/components/sealpixel-nav.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,yDAAyD;AACzD,MAAM,OAAO,YAAa,SAAQ,UAAU;aAC1B,WAAM,GAAG;QACvB,IAAI;QACJ,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiFF;KACF,CAAC;aAEc,eAAU,GAAG;QAC3B,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;QAC3B,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;QACvB,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACvB,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QAC5B,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QAC7B,YAAY,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QAC/B,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QAC7B,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KAChC,CA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Aa,IAAI,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC;gCAC9C;YACtB,CAAC,CAAC,OACN;KACD,CAAC;IACJ,CAAC;IAEO,IAAI,CAAC,IAAY,EAAE,MAAgB;QACzC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChG,CAAC","sourcesContent":["import type { SessionState } from '@sealpixel/core';\nimport { css, html, LitElement, nothing } from 'lit';\nimport { icons } from '../icons.js';\nimport { base } from '../theme.js';\n\n/** Undo, redo, history scrubber, export and download. */\nexport class SealpixelNav extends LitElement {\n static override styles = [\n base,\n css`\n :host {\n display: flex;\n align-items: center;\n gap: var(--sealpixel-space);\n padding: 4px var(--sealpixel-space);\n background: var(--sealpixel-color-surface);\n border-bottom: 1px solid var(--sealpixel-color-border);\n min-height: var(--sealpixel-toolbar-size);\n min-width: 0;\n container-type: inline-size;\n overflow: hidden;\n }\n sealpixel-button {\n flex: 0 0 auto;\n }\n .history {\n flex: 1;\n display: flex;\n align-items: center;\n gap: var(--sealpixel-space);\n min-width: 0;\n }\n input[type='range'] {\n flex: 1;\n min-width: 60px;\n accent-color: var(--sealpixel-color-accent);\n height: var(--sealpixel-touch-target);\n margin: 0;\n appearance: none;\n background: transparent;\n }\n input[type='range']::-webkit-slider-runnable-track {\n height: 3px;\n border-radius: 999px;\n background: var(--sealpixel-color-surface-3, var(--sealpixel-color-border));\n }\n input[type='range']::-moz-range-track {\n height: 3px;\n border-radius: 999px;\n background: var(--sealpixel-color-surface-3, var(--sealpixel-color-border));\n }\n input[type='range']::-webkit-slider-thumb {\n appearance: none;\n width: 16px;\n height: 16px;\n margin-top: -6.5px;\n border-radius: 50%;\n background: var(--sealpixel-color-accent);\n border: 3px solid var(--sealpixel-color-surface);\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);\n }\n input[type='range']::-moz-range-thumb {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: var(--sealpixel-color-accent);\n border: 3px solid var(--sealpixel-color-surface);\n }\n .status {\n color: var(--sealpixel-color-fg-muted);\n font-size: calc(var(--sealpixel-font-size) * 12 / 14);\n white-space: nowrap;\n font-variant-numeric: tabular-nums;\n }\n [part='dimensions'] {\n padding: 4px 10px;\n border-radius: 999px;\n background: var(--sealpixel-color-surface-2);\n }\n .spacer {\n flex: 1;\n }\n @container (max-width: 36rem) {\n .status {\n display: none;\n }\n sealpixel-button[part='export'] {\n display: none;\n }\n }\n `,\n ];\n\n static override properties = {\n state: { attribute: false },\n t: { attribute: false },\n busy: { type: Boolean },\n canExport: { type: Boolean },\n showExport: { type: Boolean },\n showDownload: { type: Boolean },\n showHistory: { type: String },\n downloadLabel: { type: String },\n };\n\n declare state: SessionState | null;\n declare t: (key: string, params?: Record<string, string | number>) => string;\n declare busy: boolean;\n declare canExport: boolean;\n /** False hides Export: nobody listens for the result. */\n declare showExport: boolean;\n /** False hides Download; hosts that only consume `sealpixel:process` set it. */\n declare showDownload: boolean;\n /** `all`: undo, redo and the timeline; `buttons`: undo and redo only; `none`: nothing. */\n declare showHistory: 'all' | 'buttons' | 'none';\n /** Overrides the localized Download label. */\n declare downloadLabel: string | null;\n\n constructor() {\n super();\n this.state = null;\n this.t = (k) => k;\n this.busy = false;\n this.canExport = true;\n this.showExport = true;\n this.showDownload = true;\n this.showHistory = 'all';\n this.downloadLabel = null;\n }\n\n override render() {\n const s = this.state;\n const ready = s?.status === 'ready';\n const total = s?.history.log.ops.length ?? 0;\n const index = s?.history.index ?? 0;\n const out = s?.preview?.geometry.logicalOut;\n return html`\n ${\n this.showHistory === 'none'\n ? nothing\n : html`<sealpixel-button variant=\"ghost\" part=\"undo\" exportparts=\"button\" .label=${this.t('nav.undo')} ?disabled=${!ready || index === 0} @click=${() => this.emit('undo')}>${icons.undo}</sealpixel-button>\n <sealpixel-button variant=\"ghost\" part=\"redo\" exportparts=\"button\" .label=${this.t('nav.redo')} ?disabled=${!ready || index >= total} @click=${() => this.emit('redo')}>${icons.redo}</sealpixel-button>`\n }\n ${\n this.showHistory === 'all'\n ? html`<div class=\"history\">\n <input\n part=\"history\"\n type=\"range\"\n min=\"0\"\n max=${total}\n step=\"1\"\n .value=${String(index)}\n ?disabled=${!ready || total === 0}\n aria-label=${this.t('nav.history')}\n aria-valuetext=${`${index} / ${total}`}\n @input=${(e: Event) => this.emit('time-travel', Number((e.target as HTMLInputElement).value))}\n />\n <span class=\"status\" aria-hidden=\"true\">${index}/${total}</span>\n </div>`\n : html`<div class=\"spacer\"></div>`\n }\n <span class=\"status\" role=\"status\" aria-live=\"polite\" part=\"dimensions\">\n ${out ? this.t('status.dimensions', { width: out.width, height: out.height }) : ''}\n </span>\n ${\n this.showExport\n ? html`<sealpixel-button part=\"export\" exportparts=\"button\" .label=${this.t('nav.export')} ?disabled=${!ready || this.busy || !this.canExport} @click=${() => this.emit('export')}>\n ${this.t('nav.export')}\n </sealpixel-button>`\n : nothing\n }\n ${\n this.showDownload\n ? html`<sealpixel-button variant=\"primary\" part=\"download\" exportparts=\"button\" .label=${this.downloadLabel ?? this.t('nav.download')} ?disabled=${!ready || this.busy || !this.canExport} @click=${() => this.emit('download')}>\n ${icons.download} ${this.downloadLabel ?? this.t('nav.download')}\n </sealpixel-button>`\n : nothing\n }\n `;\n }\n\n private emit(name: string, detail?: unknown): void {\n this.dispatchEvent(new CustomEvent(`nav-${name}`, { detail, bubbles: true, composed: true }));\n }\n}\n"]}
|