@sealpixel/ui 1.0.0-rc.20 → 1.0.0-rc.22
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/editor/empty-state.d.ts +14 -0
- package/dist/components/editor/empty-state.js +38 -0
- package/dist/components/editor/empty-state.js.map +1 -0
- package/dist/components/editor/json-attribute.d.ts +5 -0
- package/dist/components/editor/json-attribute.js +18 -0
- package/dist/components/editor/json-attribute.js.map +1 -0
- package/dist/components/editor/panel-fit.d.ts +20 -0
- package/dist/components/editor/panel-fit.js +60 -0
- package/dist/components/editor/panel-fit.js.map +1 -0
- package/dist/components/editor/styles.d.ts +2 -0
- package/dist/components/editor/styles.js +697 -0
- package/dist/components/editor/styles.js.map +1 -0
- package/dist/components/editor/toast.d.ts +8 -0
- package/dist/components/editor/toast.js +21 -0
- package/dist/components/editor/toast.js.map +1 -0
- package/dist/components/sealpixel-editor.d.ts +9 -44
- package/dist/components/sealpixel-editor.js +45 -888
- package/dist/components/sealpixel-editor.js.map +1 -1
- package/dist/components/sealpixel-stage.js +11 -2
- package/dist/components/sealpixel-stage.js.map +1 -1
- package/dist/controllers/history-shortcuts-controller.d.ts +18 -0
- package/dist/controllers/history-shortcuts-controller.js +68 -0
- package/dist/controllers/history-shortcuts-controller.js.map +1 -0
- package/dist/locales/de.js +16 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.js +16 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +16 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +16 -0
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/ja.js +16 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/pt.js +16 -0
- package/dist/locales/pt.js.map +1 -1
- package/dist/tools/annotate.d.ts +58 -0
- package/dist/tools/annotate.js +136 -12
- package/dist/tools/annotate.js.map +1 -1
- package/dist/tools/assist.d.ts +3 -0
- package/dist/tools/assist.js +44 -9
- package/dist/tools/assist.js.map +1 -1
- package/dist/tools/crop-mask.d.ts +2 -0
- package/dist/tools/crop-mask.js +11 -0
- package/dist/tools/crop-mask.js.map +1 -1
- package/dist/tools/crop.d.ts +9 -0
- package/dist/tools/crop.js +117 -48
- package/dist/tools/crop.js.map +1 -1
- package/dist/tools/filter.js +41 -19
- package/dist/tools/filter.js.map +1 -1
- package/dist/tools/finetune.js +10 -7
- package/dist/tools/finetune.js.map +1 -1
- package/dist/tools/frame.js +10 -10
- package/dist/tools/frame.js.map +1 -1
- package/dist/tools/instance-state.d.ts +8 -0
- package/dist/tools/instance-state.js +32 -0
- package/dist/tools/instance-state.js.map +1 -0
- package/dist/tools/keys.d.ts +95 -3
- package/dist/tools/keys.js +135 -2
- package/dist/tools/keys.js.map +1 -1
- package/dist/tools/redact.d.ts +18 -10
- package/dist/tools/redact.js +233 -35
- package/dist/tools/redact.js.map +1 -1
- package/dist/tools/region-transform.d.ts +23 -14
- package/dist/tools/region-transform.js +45 -32
- package/dist/tools/region-transform.js.map +1 -1
- package/dist/tools/resize.js +11 -9
- package/dist/tools/resize.js.map +1 -1
- package/dist/tools/sticker.js +7 -3
- package/dist/tools/sticker.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/editor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,2GAA2G;AAC3G,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqrB1B,CAAC","sourcesContent":["import { css } from 'lit';\n\n/** The styles of `<sealpixel-editor>`: the shell grid, the settings bar, the toast and the empty state. */\nexport const editorStyles = 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 .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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { nothing, type TemplateResult } from 'lit';
|
|
2
|
+
/** Brief confirmation over the stage. `hash` is empty when there is no result to name. */
|
|
3
|
+
export declare function renderToast(toast: {
|
|
4
|
+
text: string;
|
|
5
|
+
hash: string;
|
|
6
|
+
} | null, dismiss: () => void): TemplateResult | typeof nothing;
|
|
7
|
+
/** A byte count for people: B, KB or MB. */
|
|
8
|
+
export declare function formatBytes(n: number): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { html, nothing } from 'lit';
|
|
2
|
+
/** Brief confirmation over the stage. `hash` is empty when there is no result to name. */
|
|
3
|
+
export function renderToast(toast, dismiss) {
|
|
4
|
+
return toast
|
|
5
|
+
? html `<div class="toast" part="toast" data-testid="toast" @click=${() => {
|
|
6
|
+
dismiss();
|
|
7
|
+
}}>
|
|
8
|
+
<span>${toast.text}</span>
|
|
9
|
+
${toast.hash ? html `<code>${toast.hash}</code>` : nothing}
|
|
10
|
+
</div>`
|
|
11
|
+
: nothing;
|
|
12
|
+
}
|
|
13
|
+
/** A byte count for people: B, KB or MB. */
|
|
14
|
+
export function formatBytes(n) {
|
|
15
|
+
if (n < 1024)
|
|
16
|
+
return `${n} B`;
|
|
17
|
+
if (n < 1024 * 1024)
|
|
18
|
+
return `${(n / 1024).toFixed(n < 10240 ? 1 : 0)} KB`;
|
|
19
|
+
return `${(n / (1024 * 1024)).toFixed(1)} MB`;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../src/components/editor/toast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAEzD,0FAA0F;AAC1F,MAAM,UAAU,WAAW,CACzB,KAA4C,EAC5C,OAAmB;IAEnB,OAAO,KAAK;QACV,CAAC,CAAC,IAAI,CAAA,8DAA8D,GAAG,EAAE;YACrE,OAAO,EAAE,CAAC;QACZ,CAAC;wBACiB,KAAK,CAAC,IAAI;kBAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,SAAS,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO;qBACpD;QACjB,CAAC,CAAC,OAAO,CAAC;AACd,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,WAAW,CAAC,CAAS;IACnC,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 { html, nothing, type TemplateResult } from 'lit';\n\n/** Brief confirmation over the stage. `hash` is empty when there is no result to name. */\nexport function renderToast(\n toast: { text: string; hash: string } | null,\n dismiss: () => void,\n): TemplateResult | typeof nothing {\n return toast\n ? html`<div class=\"toast\" part=\"toast\" data-testid=\"toast\" @click=${() => {\n dismiss();\n }}>\n <span>${toast.text}</span>\n ${toast.hash ? html`<code>${toast.hash}</code>` : nothing}\n </div>`\n : nothing;\n}\n\n/** A byte count for people: B, KB or MB. */\nexport function 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,8 +1,15 @@
|
|
|
1
1
|
import { type AnyPlugin, type AssetResolver, type EditorSession, type ExportResult, type OutputOptions, type PluginOptionsMap, type Renderer, type SessionOptions } from '@sealpixel/core';
|
|
2
|
-
import { LitElement
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
3
|
import { type Dictionary } from '../i18n.js';
|
|
4
4
|
import type { UiTool } from '../tool.js';
|
|
5
5
|
export type EditorSource = File | Blob | Uint8Array | string;
|
|
6
|
+
/**
|
|
7
|
+
* The default editor. Headless `EditorSession` underneath; this element adds
|
|
8
|
+
* the responsive shell, tools and events.
|
|
9
|
+
*
|
|
10
|
+
* Events: `sealpixel:ready`, `sealpixel:load`, `sealpixel:change` ({ log, index }),
|
|
11
|
+
* `sealpixel:process` (ExportResult), `sealpixel:error` (SealpixelError).
|
|
12
|
+
*/
|
|
6
13
|
export declare class SealpixelEditor extends LitElement {
|
|
7
14
|
static styles: import("lit").CSSResult[];
|
|
8
15
|
static properties: {
|
|
@@ -211,45 +218,6 @@ export declare class SealpixelEditor extends LitElement {
|
|
|
211
218
|
private lastError;
|
|
212
219
|
/** Tells every tool, active or not, that a new source has loaded. Once per source. */
|
|
213
220
|
private syncSource;
|
|
214
|
-
/**
|
|
215
|
-
* Collapses the settings bar when the open tool has nothing to put in it.
|
|
216
|
-
*
|
|
217
|
-
* A tool renders its own structure, and a structure can hold nothing: crop
|
|
218
|
-
* with `rotation`, `flip` and `reset` off and a single enforced aspect emits
|
|
219
|
-
* two empty wrappers. The bar is a fixed height on purpose — see `.panel` —
|
|
220
|
-
* so that reserved an empty bordered surface and took the same height off
|
|
221
|
-
* the stage. On the landing page's avatar card that was 240 px of nothing
|
|
222
|
-
* against a 178 px stage, and the photo rendered at 10 percent.
|
|
223
|
-
*
|
|
224
|
-
* Read from the DOM rather than asked of the tool: every tool would
|
|
225
|
-
* otherwise have to declare it, and a tool whose panel empties out only
|
|
226
|
-
* under some options would get it wrong.
|
|
227
|
-
*
|
|
228
|
-
* Not measured by size either. The empty wrappers still lay out — the row
|
|
229
|
-
* is 8px from its own gap and the group 4px from its border — so a
|
|
230
|
-
* bounding box tells content and scaffolding apart not at all. What counts
|
|
231
|
-
* is a control or a word: a custom element, a form control, or any text.
|
|
232
|
-
*/
|
|
233
|
-
private syncPanelFill;
|
|
234
|
-
/**
|
|
235
|
-
* Lets the settings bar grow to the height its content needs.
|
|
236
|
-
*
|
|
237
|
-
* The bar is a fixed height so that moving between tools does not resize
|
|
238
|
-
* the stage under the user. When a tool needs more than that height, the
|
|
239
|
-
* overflow has nowhere to go: a wrapping flex container of fixed height has
|
|
240
|
-
* no scrollable cross-axis overflow, so `overflow: auto` never produces a
|
|
241
|
-
* scrollbar, and the sticky choice row — which pins itself inside the
|
|
242
|
-
* scrollport — is dragged up over the settings instead. The colour swatch
|
|
243
|
-
* ends up half covered and the fill toggle disappears behind the shapes.
|
|
244
|
-
*
|
|
245
|
-
* WebKit is where this surfaced, on a real iPhone: it lays these controls
|
|
246
|
-
* taller than Blink does, and at phone width crop, finetune and annotate
|
|
247
|
-
* needed 138, 140 and 136 pixels against the 112 the bar had. Raising the
|
|
248
|
-
* default would have taken those pixels off every stage in every engine, so
|
|
249
|
-
* the height is measured instead and only the bar that needs more gets it.
|
|
250
|
-
* `34cqh` still caps it, so a busy tool cannot eat the stage.
|
|
251
|
-
*/
|
|
252
|
-
private syncPanelFit;
|
|
253
221
|
private loadSource;
|
|
254
222
|
private applyControlled;
|
|
255
223
|
/** Whether the owned session was built from the current `plugins`, `renderer`, `assets` and `limits`. */
|
|
@@ -263,8 +231,6 @@ export declare class SealpixelEditor extends LitElement {
|
|
|
263
231
|
private get stage();
|
|
264
232
|
private toolContext;
|
|
265
233
|
private syncActiveTool;
|
|
266
|
-
private onPointerDown;
|
|
267
|
-
private onKeydown;
|
|
268
234
|
private onExport;
|
|
269
235
|
private onDownload;
|
|
270
236
|
private announce;
|
|
@@ -272,6 +238,5 @@ export declare class SealpixelEditor extends LitElement {
|
|
|
272
238
|
/** Brief confirmation over the stage: format, size and hash of the result. */
|
|
273
239
|
private toast;
|
|
274
240
|
private onFiles;
|
|
275
|
-
render(): TemplateResult<1>;
|
|
276
|
-
private renderEmpty;
|
|
241
|
+
render(): import("lit").TemplateResult<1>;
|
|
277
242
|
}
|