@perkyzz/emvb 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/THIRD_PARTY_NOTICES.md +23 -1
- package/licenses/exif-js.LICENSE +21 -0
- package/licenses/fflate.LICENSE +21 -0
- package/licenses/glfx.js.LICENSE +19 -0
- package/licenses/mini-photo-editor.LICENSE +21 -0
- package/licenses/photocn.LICENSE +21 -0
- package/package.json +5 -3
- package/src/admin/agents-api.ts +39 -0
- package/src/admin/editor/CommandPalette.tsx +43 -2
- package/src/admin/editor/Editor.tsx +33 -0
- package/src/admin/editor/Timeline.tsx +108 -6
- package/src/admin/editor/collection-previews.ts +6 -1
- package/src/admin/editor/editor-chrome.tsx +49 -0
- package/src/admin/editor/editor-commands.ts +13 -0
- package/src/admin/editor/editor-css.ts +7 -0
- package/src/admin/editor/feature-css.ts +22 -3
- package/src/admin/editor/palette.ts +6 -2
- package/src/admin/editor/panels/ColorControl.tsx +24 -12
- package/src/admin/editor/panels/ElementPanel.tsx +1 -1
- package/src/admin/editor/panels/LayersPanel.tsx +13 -3
- package/src/admin/editor/panels/TokenScales.tsx +4 -2
- package/src/admin/editor/panels/VariableSection.tsx +5 -3
- package/src/admin/editor/panels/color-space.ts +12 -1
- package/src/admin/editor/panels/settings/AdvancedFields.tsx +84 -28
- package/src/admin/editor/panels/settings/AudienceEditor.tsx +42 -4
- package/src/admin/editor/panels/settings/DraftTextField.tsx +38 -9
- package/src/admin/editor/panels/settings/FieldControl.tsx +24 -7
- package/src/admin/editor/panels/settings/IconPicker.tsx +21 -1
- package/src/admin/editor/panels/settings/ImageSourcesField.tsx +111 -0
- package/src/admin/editor/panels/settings/MediaPicker.tsx +156 -7
- package/src/admin/editor/panels/settings/QueryStyleRows.tsx +178 -0
- package/src/admin/editor/panels/settings/RequiredFieldsNotice.tsx +76 -0
- package/src/admin/editor/panels/settings/advanced-rules.ts +3 -0
- package/src/admin/editor/panels/settings/link-rules.ts +19 -0
- package/src/admin/editor/panels/settings/number-input.ts +11 -0
- package/src/admin/editor/panels/settings/query-style.ts +65 -0
- package/src/admin/editor/panels/variable-values.ts +18 -2
- package/src/admin/editor/remote-change.ts +67 -0
- package/src/admin/editor/store.ts +7 -3
- package/src/admin/image-editor/BlurFocus.tsx +112 -0
- package/src/admin/image-editor/Canvas.tsx +261 -0
- package/src/admin/image-editor/CropOverlay.tsx +390 -0
- package/src/admin/image-editor/CurvesPanel.tsx +394 -0
- package/src/admin/image-editor/ExportDialog.tsx +354 -0
- package/src/admin/image-editor/ImageEditButton.tsx +83 -0
- package/src/admin/image-editor/ImageEditorDialog.tsx +786 -0
- package/src/admin/image-editor/MetadataPanel.tsx +183 -0
- package/src/admin/image-editor/announce.tsx +65 -0
- package/src/admin/image-editor/crop-geometry.ts +161 -0
- package/src/admin/image-editor/curve-math.ts +177 -0
- package/src/admin/image-editor/data-url-fetch.ts +59 -0
- package/src/admin/image-editor/engine.ts +55 -0
- package/src/admin/image-editor/exif.ts +82 -0
- package/src/admin/image-editor/flatten.ts +54 -0
- package/src/admin/image-editor/gpu-fit.ts +81 -0
- package/src/admin/image-editor/image-editor-css.ts +398 -0
- package/src/admin/image-editor/load.ts +109 -0
- package/src/admin/image-editor/panels.tsx +287 -0
- package/src/admin/image-editor/parts.tsx +565 -0
- package/src/admin/image-editor/save.ts +125 -0
- package/src/admin/image-editor/tone-panels.tsx +338 -0
- package/src/admin/image-editor/tools.ts +59 -0
- package/src/admin/image-editor/worker.ts +111 -0
- package/src/admin/index.tsx +3 -1
- package/src/admin/media-api.ts +132 -2
- package/src/admin/pages/AgentsPage.tsx +274 -0
- package/src/admin/ui.ts +33 -0
- package/src/astro/EmVBPage.astro +11 -2
- package/src/astro/floats/runtime.ts +10 -0
- package/src/astro/popups/runtime.ts +15 -0
- package/src/astro/render.ts +3 -0
- package/src/astro/resolve-theme.ts +15 -4
- package/src/astro/tabs/runtime.ts +60 -1
- package/src/astro/visitor.ts +4 -3
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +202 -26
- package/src/core/arrange.ts +13 -3
- package/src/core/css/generate.ts +9 -1
- package/src/core/data/bindings.ts +12 -6
- package/src/core/design/classes.ts +5 -3
- package/src/core/design/diff.ts +3 -1
- package/src/core/design/merge.ts +3 -1
- package/src/core/design/transfer.ts +13 -2
- package/src/core/design/variables.ts +2 -1
- package/src/core/elements/dynamic-elements.ts +9 -1
- package/src/core/elements/form-elements.ts +18 -3
- package/src/core/elements/index.ts +39 -11
- package/src/core/elements/plain-text.ts +2 -2
- package/src/core/forms/binding.ts +148 -1
- package/src/core/history/diff.ts +32 -4
- package/src/core/image-edit/schema.ts +145 -0
- package/src/core/image-edit/summary.ts +58 -0
- package/src/core/index.ts +14 -0
- package/src/core/limits.ts +10 -0
- package/src/core/migrate/index.ts +3 -1
- package/src/core/perf/meter.ts +9 -1
- package/src/core/render/dynamic-post.ts +23 -6
- package/src/core/render/form.ts +36 -11
- package/src/core/render/index.ts +75 -15
- package/src/core/render/pagination.ts +21 -2
- package/src/core/sanitize/embed-url.ts +7 -1
- package/src/core/sanitize/href.ts +13 -1
- package/src/core/schema/descriptors.ts +4 -1
- package/src/core/schema/layout.ts +21 -4
- package/src/core/share/link.ts +9 -3
- package/src/core/stable-json.ts +15 -0
- package/src/core/theme/dynamic.ts +32 -24
- package/src/core/theme/pagination.ts +30 -3
- package/src/core/theme/popup-rules.ts +10 -5
- package/src/mcp/errors.ts +44 -0
- package/src/mcp/index.ts +4 -0
- package/src/mcp/ports.ts +85 -0
- package/src/mcp/prompts.ts +76 -0
- package/src/mcp/publish.ts +60 -0
- package/src/mcp/queue.ts +19 -0
- package/src/mcp/rate-limit.ts +80 -0
- package/src/mcp/read.ts +486 -0
- package/src/mcp/refs.ts +84 -0
- package/src/mcp/settings.ts +18 -0
- package/src/mcp/tools.ts +265 -0
- package/src/mcp/write.ts +664 -0
- package/src/server/agent-settings.ts +159 -0
- package/src/server/design-routes.ts +71 -17
- package/src/server/icon-routes.ts +13 -6
- package/src/server/mcp-routes.ts +323 -0
- package/src/server/plugin.ts +32 -2
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles for the full-screen image editor (W-482, photocn layout in W-483). Kumo tokens only, so
|
|
3
|
+
* dark mode follows. Spacing and sizes follow photocn's shadcn editor (MIT, Copyright (c) 2026
|
|
4
|
+
* rbbydotdev): a 48 px toolbar, a 338 px resizable sidebar, 16 px panel padding, 44 px touch
|
|
5
|
+
* targets in the compact layout.
|
|
6
|
+
*
|
|
7
|
+
* No color-mix() over Kumo tokens here: the tokens are light-dark() values, and Chromium kept a
|
|
8
|
+
* color-mix() of them on the old scheme after the admin switched from dark to light (W-483 fix).
|
|
9
|
+
*/
|
|
10
|
+
export const IMAGE_EDITOR_CSS = `
|
|
11
|
+
.emvb-image-editor-popup.emvb-image-editor-popup {
|
|
12
|
+
padding: 0; display: flex; overflow: hidden;
|
|
13
|
+
width: 100vw; height: 100dvh; max-width: none; max-height: none;
|
|
14
|
+
border-radius: 0; border: 0; inset: 0; translate: none; top: 0; left: 0;
|
|
15
|
+
}
|
|
16
|
+
.emvb-ie-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
17
|
+
.emvb-ie {
|
|
18
|
+
--emvb-ie-check-a: var(--color-kumo-recessed);
|
|
19
|
+
--emvb-ie-check-b: var(--color-kumo-base);
|
|
20
|
+
flex: 1; min-width: 0; min-height: 0; display: flex; height: 100%;
|
|
21
|
+
color: var(--text-color-kumo-default); background: var(--color-kumo-base);
|
|
22
|
+
font-size: 14px; line-height: 20px;
|
|
23
|
+
}
|
|
24
|
+
.emvb-ie button { font: inherit; }
|
|
25
|
+
.emvb-ie .emvb-ie-btn { height: 32px; border-radius: 8px; font-size: 13px; font-weight: 500; gap: 6px; }
|
|
26
|
+
.emvb-ie .emvb-ie-btn-icon { width: 32px; padding: 0; }
|
|
27
|
+
.emvb-ie .emvb-ie-btn svg { width: 16px; height: 16px; flex: none; }
|
|
28
|
+
.emvb-ie .emvb-ie-btn[aria-pressed="true"] { background: var(--color-kumo-tint); }
|
|
29
|
+
|
|
30
|
+
/* Desktop: toolbar on top, canvas and a resizable sidebar (photocn layout.tsx). */
|
|
31
|
+
.emvb-ie-layout { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
|
|
32
|
+
.emvb-ie-toolbar {
|
|
33
|
+
display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px;
|
|
34
|
+
border-bottom: 1px solid var(--color-kumo-hairline); background: var(--color-kumo-base);
|
|
35
|
+
}
|
|
36
|
+
.emvb-ie-toolbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
|
|
37
|
+
.emvb-ie-file {
|
|
38
|
+
display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; max-width: 360px;
|
|
39
|
+
height: 32px; line-height: 32px; padding: 0 10px; border-radius: 8px;
|
|
40
|
+
border: 1px solid var(--color-kumo-hairline); font-size: 13px;
|
|
41
|
+
}
|
|
42
|
+
.emvb-ie-file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
43
|
+
.emvb-ie-file-size { flex: none; color: var(--text-color-kumo-subtle); font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
44
|
+
.emvb-ie-badge { display: inline-flex; align-items: center; gap: 4px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
45
|
+
.emvb-ie-workspace { display: grid; min-height: 0; }
|
|
46
|
+
.emvb-ie-main { min-width: 0; min-height: 0; overflow: hidden; padding: 16px; background: var(--color-kumo-tint); }
|
|
47
|
+
.emvb-ie-main-solo { display: flex; }
|
|
48
|
+
.emvb-ie-resize {
|
|
49
|
+
position: relative; z-index: 2; width: 0; cursor: col-resize; touch-action: none; outline: none;
|
|
50
|
+
}
|
|
51
|
+
.emvb-ie-resize::before { content: ""; position: absolute; inset: 0 -4px; }
|
|
52
|
+
.emvb-ie-resize > span {
|
|
53
|
+
position: absolute; top: 50%; left: -6px; width: 12px; height: 16px; margin-top: -8px;
|
|
54
|
+
border-radius: 3px; border: 1px solid var(--color-kumo-line); background: var(--color-kumo-tint);
|
|
55
|
+
}
|
|
56
|
+
.emvb-ie-resize > span::before, .emvb-ie-resize > span::after {
|
|
57
|
+
content: ""; position: absolute; top: 4px; bottom: 4px; width: 1px; background: var(--text-color-kumo-subtle);
|
|
58
|
+
}
|
|
59
|
+
.emvb-ie-resize > span::before { left: 3px; }
|
|
60
|
+
.emvb-ie-resize > span::after { right: 3px; }
|
|
61
|
+
.emvb-ie-resize:focus-visible > span { outline: 2px solid var(--color-kumo-focus, var(--color-kumo-brand)); }
|
|
62
|
+
.emvb-ie-sidebar {
|
|
63
|
+
min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto;
|
|
64
|
+
border-left: 1px solid var(--color-kumo-hairline); background: var(--color-kumo-base);
|
|
65
|
+
}
|
|
66
|
+
.emvb-ie-sidebar-tools { padding: 12px; border-bottom: 1px solid var(--color-kumo-hairline); }
|
|
67
|
+
|
|
68
|
+
/* Tool switcher: outlined icon toggles, the active one filled (photocn toolbar.tsx). */
|
|
69
|
+
.emvb-ie-switcher { display: flex; justify-content: space-between; gap: 4px; }
|
|
70
|
+
.emvb-ie-switch {
|
|
71
|
+
flex: 1 1 0; min-width: 0; max-width: 40px; height: 32px; display: grid; place-items: center;
|
|
72
|
+
border: 1px solid var(--color-kumo-line); border-radius: 8px; background: var(--color-kumo-base);
|
|
73
|
+
color: var(--text-color-kumo-default); cursor: pointer; padding: 0;
|
|
74
|
+
transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
|
|
75
|
+
}
|
|
76
|
+
.emvb-ie-switch svg { width: 16px; height: 16px; transition: transform 120ms ease; }
|
|
77
|
+
.emvb-ie-switch:hover { background: var(--color-kumo-tint); }
|
|
78
|
+
.emvb-ie-switch[aria-pressed="true"], .emvb-ie-switch[aria-pressed="true"]:hover {
|
|
79
|
+
background: var(--color-kumo-brand); border-color: var(--color-kumo-brand); color: #fff;
|
|
80
|
+
box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.2);
|
|
81
|
+
}
|
|
82
|
+
.emvb-ie-switch[aria-pressed="true"] svg { transform: scale(1.1); }
|
|
83
|
+
.emvb-ie-switch:focus-visible { outline: 2px solid var(--color-kumo-focus, var(--color-kumo-brand)); outline-offset: 2px; }
|
|
84
|
+
.emvb-ie-switch:disabled { opacity: 0.5; cursor: default; }
|
|
85
|
+
|
|
86
|
+
.emvb-ie-histogram {
|
|
87
|
+
display: flex; flex-direction: column; gap: 4px; padding: 8px 12px;
|
|
88
|
+
border-bottom: 1px solid var(--color-kumo-hairline); background: var(--color-kumo-tint);
|
|
89
|
+
}
|
|
90
|
+
.emvb-ie-histogram-head {
|
|
91
|
+
display: flex; justify-content: space-between; font-size: 10px; line-height: 14px;
|
|
92
|
+
text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-color-kumo-subtle);
|
|
93
|
+
}
|
|
94
|
+
.emvb-ie-mono { font-family: var(--font-mono, ui-monospace, monospace); text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
|
|
95
|
+
.emvb-ie-histogram canvas { display: block; width: 100%; height: 64px; border-radius: 4px; background: var(--color-kumo-base); }
|
|
96
|
+
|
|
97
|
+
/* Panels (photocn panel-header.tsx, crop-panel.tsx). */
|
|
98
|
+
.emvb-ie-panel { display: flex; flex-direction: column; min-width: 0; }
|
|
99
|
+
.emvb-ie-panel-head {
|
|
100
|
+
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
|
101
|
+
min-height: 48px; padding: 0 16px; border-bottom: 1px solid var(--color-kumo-hairline);
|
|
102
|
+
}
|
|
103
|
+
.emvb-ie-panel-titles { min-width: 0; }
|
|
104
|
+
.emvb-ie-panel-titles h2 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
105
|
+
.emvb-ie-panel-titles p { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-color-kumo-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
106
|
+
.emvb-ie-group { display: flex; flex-direction: column; gap: 20px; padding: 16px; margin: 0; border: 0; min-width: 0; }
|
|
107
|
+
.emvb-ie-group-tight { gap: 12px; }
|
|
108
|
+
.emvb-ie-sep { margin: 0; border: 0; border-top: 1px solid var(--color-kumo-hairline); }
|
|
109
|
+
.emvb-ie-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
110
|
+
.emvb-ie-row-fill { gap: 8px; }
|
|
111
|
+
.emvb-ie-row-fill > :first-child { flex: 1; min-width: 0; }
|
|
112
|
+
.emvb-ie-row-between { justify-content: space-between; gap: 8px; }
|
|
113
|
+
.emvb-ie-vsep { width: 1px; height: 20px; margin: 0 4px; background: var(--color-kumo-hairline); }
|
|
114
|
+
.emvb-ie-field { display: flex; flex-direction: column; gap: 8px; }
|
|
115
|
+
.emvb-ie-label { padding: 0; font-size: 14px; line-height: 20px; font-weight: 500; }
|
|
116
|
+
.emvb-ie .emvb-ie-select { width: 100%; height: 32px; }
|
|
117
|
+
|
|
118
|
+
.emvb-ie-slider { display: flex; flex-direction: column; gap: 10px; }
|
|
119
|
+
.emvb-ie-slider[data-disabled] { opacity: 0.5; }
|
|
120
|
+
.emvb-ie-slider-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
121
|
+
.emvb-ie-slider-head label { font-size: 14px; line-height: 20px; font-weight: 500; }
|
|
122
|
+
.emvb-ie-slider-value {
|
|
123
|
+
border: 0; background: none; padding: 0 4px; border-radius: 4px; cursor: pointer;
|
|
124
|
+
font-size: 12px; color: var(--text-color-kumo-subtle); font-variant-numeric: tabular-nums;
|
|
125
|
+
}
|
|
126
|
+
.emvb-ie-slider-value:hover { color: var(--text-color-kumo-default); }
|
|
127
|
+
.emvb-ie-slider-value:disabled { cursor: default; color: var(--text-color-kumo-subtle); }
|
|
128
|
+
.emvb-ie-slider input[type="range"] {
|
|
129
|
+
-webkit-appearance: none; appearance: none; width: 100%; height: 16px; margin: 0; background: transparent; cursor: pointer;
|
|
130
|
+
}
|
|
131
|
+
.emvb-ie-slider input[type="range"]::-webkit-slider-runnable-track {
|
|
132
|
+
height: 4px; border-radius: 9999px;
|
|
133
|
+
background: linear-gradient(to right, var(--color-kumo-tint) var(--emvb-ie-from), var(--text-color-kumo-default) var(--emvb-ie-from) var(--emvb-ie-to), var(--color-kumo-tint) var(--emvb-ie-to));
|
|
134
|
+
}
|
|
135
|
+
.emvb-ie-slider input[type="range"]::-moz-range-track { height: 4px; border-radius: 9999px; background: var(--color-kumo-tint); }
|
|
136
|
+
.emvb-ie-slider input[type="range"]::-moz-range-progress { height: 4px; border-radius: 9999px; background: var(--text-color-kumo-default); }
|
|
137
|
+
.emvb-ie-slider input[type="range"]::-webkit-slider-thumb {
|
|
138
|
+
-webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 9999px;
|
|
139
|
+
background: #fff; border: 1px solid var(--text-color-kumo-default); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
|
|
140
|
+
}
|
|
141
|
+
.emvb-ie-slider input[type="range"]::-moz-range-thumb {
|
|
142
|
+
width: 14px; height: 14px; border-radius: 9999px; background: #fff; border: 1px solid var(--text-color-kumo-default);
|
|
143
|
+
}
|
|
144
|
+
.emvb-ie-slider input[type="range"]:focus-visible { outline: none; }
|
|
145
|
+
.emvb-ie-slider input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--color-kumo-line); }
|
|
146
|
+
|
|
147
|
+
.emvb-ie .emvb-ie-done { width: 100%; }
|
|
148
|
+
.emvb-ie-shortcuts { font-size: 12px; line-height: 16px; color: var(--text-color-kumo-subtle); }
|
|
149
|
+
.emvb-ie-shortcuts summary { cursor: pointer; user-select: none; border-radius: 2px; }
|
|
150
|
+
.emvb-ie-shortcuts summary:hover { color: var(--text-color-kumo-default); }
|
|
151
|
+
.emvb-ie-shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; }
|
|
152
|
+
.emvb-ie-shortcuts dl > div { display: contents; }
|
|
153
|
+
.emvb-ie-shortcuts dd { margin: 0; }
|
|
154
|
+
.emvb-ie-shortcuts kbd, .emvb-ie kbd {
|
|
155
|
+
display: inline-block; padding: 0 4px; border-radius: 4px; border: 1px solid var(--color-kumo-line);
|
|
156
|
+
background: var(--color-kumo-tint); color: var(--text-color-kumo-default);
|
|
157
|
+
font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; line-height: 16px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.emvb-ie-soon {
|
|
161
|
+
display: flex; gap: 12px; padding: 12px; border-radius: 10px;
|
|
162
|
+
border: 1px dashed var(--color-kumo-line); background: var(--color-kumo-tint);
|
|
163
|
+
}
|
|
164
|
+
.emvb-ie-soon-icon {
|
|
165
|
+
flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
|
|
166
|
+
background: var(--color-kumo-base); border: 1px solid var(--color-kumo-hairline);
|
|
167
|
+
}
|
|
168
|
+
.emvb-ie-soon-icon svg { width: 16px; height: 16px; }
|
|
169
|
+
.emvb-ie-soon-title { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 13px; font-weight: 600; }
|
|
170
|
+
.emvb-ie-soon-title svg { width: 14px; height: 14px; color: var(--text-color-kumo-subtle); }
|
|
171
|
+
.emvb-ie-soon ul { margin: 0; padding-left: 16px; font-size: 12px; line-height: 18px; color: var(--text-color-kumo-subtle); }
|
|
172
|
+
.emvb-ie-note { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-color-kumo-subtle); }
|
|
173
|
+
|
|
174
|
+
/* The stage (photocn canvas.tsx): rounded, bordered, a checkerboard behind the photo. */
|
|
175
|
+
.emvb-ie-canvas { position: relative; height: 100%; min-height: 0; }
|
|
176
|
+
.emvb-ie-stage {
|
|
177
|
+
position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 8px;
|
|
178
|
+
border: 1px solid var(--color-kumo-hairline); touch-action: none; user-select: none;
|
|
179
|
+
background-color: var(--emvb-ie-check-b);
|
|
180
|
+
background-image: conic-gradient(var(--emvb-ie-check-a) 25%, transparent 0 50%, var(--emvb-ie-check-a) 0 75%, transparent 0);
|
|
181
|
+
background-size: 16px 16px;
|
|
182
|
+
}
|
|
183
|
+
.emvb-ie-stage-message { display: grid; place-items: center; }
|
|
184
|
+
.emvb-ie-canvas-el { position: absolute; display: block; pointer-events: none; }
|
|
185
|
+
.emvb-ie-loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: var(--text-color-kumo-subtle); }
|
|
186
|
+
.emvb-ie-loading svg { width: 20px; height: 20px; animation: emvb-ie-spin 0.9s linear infinite; }
|
|
187
|
+
.emvb-ie-spinner {
|
|
188
|
+
width: 20px; height: 20px; border-radius: 9999px; border: 2px solid var(--color-kumo-line);
|
|
189
|
+
border-top-color: var(--text-color-kumo-default); animation: emvb-ie-spin 0.9s linear infinite;
|
|
190
|
+
}
|
|
191
|
+
@keyframes emvb-ie-spin { to { transform: rotate(360deg); } }
|
|
192
|
+
.emvb-ie .emvb-ie-fit { position: absolute; right: 8px; bottom: 8px; }
|
|
193
|
+
.emvb-ie-error {
|
|
194
|
+
display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 420px; margin: 24px;
|
|
195
|
+
padding: 20px 24px; border-radius: 12px; text-align: center;
|
|
196
|
+
border: 1px solid var(--color-kumo-line); background: var(--color-kumo-base);
|
|
197
|
+
box-shadow: 0 8px 24px var(--color-kumo-shadow-drop, rgb(0 0 0 / 0.12));
|
|
198
|
+
}
|
|
199
|
+
.emvb-ie-error h3 { margin: 0; font-size: 14px; font-weight: 600; }
|
|
200
|
+
.emvb-ie-error p { margin: 0 0 4px; font-size: 13px; color: var(--text-color-kumo-subtle); }
|
|
201
|
+
.emvb-ie-error-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9999px; color: var(--text-color-kumo-danger); background: var(--color-kumo-danger-tint); }
|
|
202
|
+
.emvb-ie-error-icon svg { width: 20px; height: 20px; }
|
|
203
|
+
|
|
204
|
+
/* Crop overlay (photocn crop-overlay.tsx). */
|
|
205
|
+
.emvb-ie-crop { position: absolute; inset: 0; }
|
|
206
|
+
.emvb-ie-crop-mask, .emvb-ie-corner-outline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
|
|
207
|
+
.emvb-ie-crop-mask path { fill: rgb(0 0 0 / 0.55); }
|
|
208
|
+
.emvb-ie-corner-outline polygon { fill: none; stroke: rgb(255 255 255 / 0.9); }
|
|
209
|
+
.emvb-ie-crop-frame {
|
|
210
|
+
position: absolute; touch-action: none; cursor: move;
|
|
211
|
+
outline: 1px solid rgb(255 255 255 / 0.9); outline-offset: -1px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
|
|
212
|
+
}
|
|
213
|
+
.emvb-ie-crop-frame[data-disabled] { pointer-events: none; }
|
|
214
|
+
.emvb-ie-crop-frame:focus-visible { outline: 2px solid var(--color-kumo-focus, var(--color-kumo-brand)); outline-offset: 2px; }
|
|
215
|
+
.emvb-ie-crop-thirds { position: absolute; inset: 0; pointer-events: none; }
|
|
216
|
+
.emvb-ie-crop-thirds i { position: absolute; top: 0; bottom: 0; width: 1px; background: rgb(255 255 255 / 0.4); }
|
|
217
|
+
.emvb-ie-crop-thirds b { position: absolute; left: 0; right: 0; height: 1px; background: rgb(255 255 255 / 0.4); }
|
|
218
|
+
.emvb-ie-crop-handle, .emvb-ie-corner-handle {
|
|
219
|
+
position: absolute; z-index: 1; display: flex; align-items: center; justify-content: center;
|
|
220
|
+
width: 28px; height: 28px; translate: -50% -50%; padding: 0; border: 0; border-radius: 9999px;
|
|
221
|
+
background: transparent; outline: none; touch-action: none;
|
|
222
|
+
}
|
|
223
|
+
.emvb-ie-crop-handle:focus-visible, .emvb-ie-corner-handle:focus-visible { box-shadow: 0 0 0 2px var(--color-kumo-focus, var(--color-kumo-brand)); }
|
|
224
|
+
.emvb-ie-crop-handle > span { display: block; width: 10px; height: 10px; border-radius: 9999px; background: #fff; border: 1px solid rgb(0 0 0 / 0.3); box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); }
|
|
225
|
+
.emvb-ie-crop-handle[data-handle="nw"] > span, .emvb-ie-crop-handle[data-handle="ne"] > span,
|
|
226
|
+
.emvb-ie-crop-handle[data-handle="sw"] > span, .emvb-ie-crop-handle[data-handle="se"] > span { width: 14px; height: 14px; }
|
|
227
|
+
.emvb-ie-crop-handle[data-handle="nw"] { left: 0; top: 0; cursor: nwse-resize; }
|
|
228
|
+
.emvb-ie-crop-handle[data-handle="n"] { left: 50%; top: 0; cursor: ns-resize; }
|
|
229
|
+
.emvb-ie-crop-handle[data-handle="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
|
|
230
|
+
.emvb-ie-crop-handle[data-handle="e"] { left: 100%; top: 50%; cursor: ew-resize; }
|
|
231
|
+
.emvb-ie-crop-handle[data-handle="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
|
|
232
|
+
.emvb-ie-crop-handle[data-handle="s"] { left: 50%; top: 100%; cursor: ns-resize; }
|
|
233
|
+
.emvb-ie-crop-handle[data-handle="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
|
|
234
|
+
.emvb-ie-crop-handle[data-handle="w"] { left: 0; top: 50%; cursor: ew-resize; }
|
|
235
|
+
.emvb-ie-corner-handle { width: 36px; height: 36px; cursor: grab; }
|
|
236
|
+
.emvb-ie-corner-handle:active { cursor: grabbing; }
|
|
237
|
+
.emvb-ie-corner-handle > span { display: block; width: 16px; height: 16px; border-radius: 9999px; border: 2px solid #fff; background: var(--color-kumo-brand); box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); }
|
|
238
|
+
@media (pointer: coarse) {
|
|
239
|
+
.emvb-ie-crop-handle { width: 44px; height: 44px; }
|
|
240
|
+
.emvb-ie-corner-handle { width: 48px; height: 48px; }
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* Compact (phone) layout (photocn compact-layout.tsx). */
|
|
244
|
+
.emvb-ie-compact { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
|
|
245
|
+
.emvb-ie-compact-head {
|
|
246
|
+
display: flex; align-items: center; gap: 4px; height: 48px; flex: none; padding: 0 8px;
|
|
247
|
+
padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--color-kumo-hairline);
|
|
248
|
+
}
|
|
249
|
+
.emvb-ie-compact-head .emvb-ie-toolbar-end { gap: 4px; }
|
|
250
|
+
.emvb-ie .emvb-ie-touch { width: 44px; height: 44px; }
|
|
251
|
+
.emvb-ie-compact-canvas { flex: 1; min-height: 0; padding: 8px; transition: padding 200ms ease; }
|
|
252
|
+
.emvb-ie-compact-tools {
|
|
253
|
+
display: flex; flex: none; gap: 4px; overflow-x: auto; scrollbar-width: none;
|
|
254
|
+
padding: 4px 8px max(4px, env(safe-area-inset-bottom)); border-top: 1px solid var(--color-kumo-hairline);
|
|
255
|
+
}
|
|
256
|
+
.emvb-ie-compact-tools-inline { flex: 1; border-top: 0; padding-bottom: 0; }
|
|
257
|
+
.emvb-ie-compact-tool {
|
|
258
|
+
display: flex; flex: none; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
|
|
259
|
+
min-width: 56px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 10px; background: none;
|
|
260
|
+
color: var(--text-color-kumo-subtle); font-size: 11px; line-height: 14px; cursor: pointer;
|
|
261
|
+
transition: background-color 120ms ease, color 120ms ease;
|
|
262
|
+
}
|
|
263
|
+
.emvb-ie-compact-tool svg { width: 20px; height: 20px; }
|
|
264
|
+
.emvb-ie-compact-tool[aria-pressed="true"] { background: var(--color-kumo-brand); color: #fff; }
|
|
265
|
+
.emvb-ie-compact-tool:focus-visible { outline: 2px solid var(--color-kumo-focus, var(--color-kumo-brand)); }
|
|
266
|
+
.emvb-ie-compact-tool:disabled { opacity: 0.5; }
|
|
267
|
+
.emvb-ie-sheet {
|
|
268
|
+
position: absolute; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column;
|
|
269
|
+
border-radius: 14px 14px 0 0; border-top: 1px solid var(--color-kumo-line);
|
|
270
|
+
background: var(--color-kumo-elevated); box-shadow: 0 -8px 24px var(--color-kumo-shadow-drop, rgb(0 0 0 / 0.15));
|
|
271
|
+
transition: height 300ms ease-out, transform 300ms ease-out; transform: translateY(100%); pointer-events: none;
|
|
272
|
+
}
|
|
273
|
+
.emvb-ie-sheet[data-open] { transform: none; pointer-events: auto; }
|
|
274
|
+
.emvb-ie-sheet[data-dragging] { transition: none; }
|
|
275
|
+
.emvb-ie-sheet-grip { display: flex; align-items: center; justify-content: center; height: 24px; flex: none; cursor: grab; touch-action: none; }
|
|
276
|
+
.emvb-ie-sheet-grip > span { width: 48px; height: 6px; border-radius: 9999px; background: var(--color-kumo-line); }
|
|
277
|
+
.emvb-ie-sheet-tools { display: flex; align-items: center; gap: 4px; padding: 0 8px 4px; border-bottom: 1px solid var(--color-kumo-hairline); }
|
|
278
|
+
.emvb-ie-sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
|
|
279
|
+
/* Tone panels (W-484; photocn adjustments-panel, filters-panel, curves-panel, blur-panel). */
|
|
280
|
+
.emvb-ie-tabs-wrap { padding: 12px 16px; }
|
|
281
|
+
.emvb-ie-tabs [role="tablist"] { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
|
|
282
|
+
.emvb-ie-tabs [role="tab"] { justify-content: center; font-size: 13px; }
|
|
283
|
+
.emvb-ie-tab-label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
|
|
284
|
+
.emvb-ie-tab-label svg { width: 16px; height: 16px; }
|
|
285
|
+
.emvb-ie-dot { display: inline-block; width: 8px; height: 8px; border-radius: 9999px; }
|
|
286
|
+
.emvb-ie-dot[data-channel="rgb"] { background: var(--text-color-kumo-default) !important; }
|
|
287
|
+
.emvb-ie-group-sliders { gap: 16px; }
|
|
288
|
+
.emvb-ie-section-head { align-items: flex-start; }
|
|
289
|
+
.emvb-ie-section-titles { display: flex; flex-direction: column; min-width: 0; }
|
|
290
|
+
.emvb-ie-section-title { font-size: 14px; line-height: 20px; font-weight: 500; }
|
|
291
|
+
.emvb-ie-section-desc { font-size: 13px; line-height: 18px; color: var(--text-color-kumo-subtle); }
|
|
292
|
+
.emvb-ie-number {
|
|
293
|
+
width: 64px; height: 22px; margin: 0 -4px 0 0; padding: 0 4px; text-align: right; border-radius: 4px;
|
|
294
|
+
border: 1px solid transparent; background: transparent; color: var(--text-color-kumo-subtle);
|
|
295
|
+
font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;
|
|
296
|
+
}
|
|
297
|
+
.emvb-ie-number:hover:not(:disabled) { border-color: var(--color-kumo-line); }
|
|
298
|
+
.emvb-ie-number:focus { outline: none; border-color: var(--color-kumo-brand); color: var(--text-color-kumo-default); background: var(--color-kumo-base); }
|
|
299
|
+
.emvb-ie-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
|
|
300
|
+
.emvb-ie .emvb-ie-chip { width: 100%; min-width: 0; height: 36px; padding: 0 8px; font-size: 12px; justify-content: center; text-transform: capitalize; }
|
|
301
|
+
.emvb-ie .emvb-ie-chip[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--color-kumo-line); }
|
|
302
|
+
.emvb-ie-spin { animation: emvb-ie-spin 0.9s linear infinite; }
|
|
303
|
+
.emvb-ie-subgroup { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
|
|
304
|
+
.emvb-ie-caps { padding: 0; margin-bottom: 0; font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; color: var(--text-color-kumo-subtle); }
|
|
305
|
+
.emvb-ie-group-curves { gap: 12px; }
|
|
306
|
+
.emvb-ie-curves { display: flex; flex-direction: column; align-items: center; gap: 8px; }
|
|
307
|
+
.emvb-ie-curves-box {
|
|
308
|
+
position: relative; overflow: hidden; border-radius: 6px; border: 1px solid var(--color-kumo-hairline);
|
|
309
|
+
background: var(--color-kumo-tint); color: var(--text-color-kumo-default);
|
|
310
|
+
}
|
|
311
|
+
.emvb-ie-curves-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
|
|
312
|
+
.emvb-ie-curves-box svg { position: relative; display: block; touch-action: none; }
|
|
313
|
+
.emvb-ie-curves-box svg[data-disabled] { pointer-events: none; opacity: 0.6; }
|
|
314
|
+
.emvb-ie-curve-point { fill: var(--color-kumo-base); outline: none; }
|
|
315
|
+
.emvb-ie-curve-point:focus-visible, .emvb-ie-curve-point[data-selected] { stroke-width: 3px; }
|
|
316
|
+
.emvb-ie-curve-point:focus-visible { filter: drop-shadow(0 0 2px var(--color-kumo-brand)); }
|
|
317
|
+
.emvb-ie-hint { margin: 0; max-width: 260px; text-align: center; font-size: 12px; line-height: 16px; color: var(--text-color-kumo-subtle); }
|
|
318
|
+
.emvb-ie-hint-keys { display: block; margin-top: 4px; }
|
|
319
|
+
.emvb-ie-hint kbd { font-size: 10px; line-height: 14px; }
|
|
320
|
+
.emvb-ie-point-fields { display: flex; justify-content: center; gap: 16px; }
|
|
321
|
+
.emvb-ie-level { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-color-kumo-subtle); }
|
|
322
|
+
.emvb-ie-level input {
|
|
323
|
+
width: 56px; height: 28px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--color-kumo-line);
|
|
324
|
+
background: var(--color-kumo-base); color: var(--text-color-kumo-default); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;
|
|
325
|
+
}
|
|
326
|
+
.emvb-ie-level input:focus { outline: 2px solid var(--color-kumo-brand); outline-offset: -1px; }
|
|
327
|
+
.emvb-ie-overlay-box { position: absolute; }
|
|
328
|
+
.emvb-ie-blur-focus { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
|
|
329
|
+
.emvb-ie-blur-focus[data-disabled] { pointer-events: none; }
|
|
330
|
+
.emvb-ie-blur-handle {
|
|
331
|
+
position: absolute; width: 24px; height: 24px; translate: -50% -50%; border-radius: 9999px;
|
|
332
|
+
border: 2px solid rgb(255 255 255 / 0.9); background: rgb(255 255 255 / 0.1);
|
|
333
|
+
box-shadow: 0 0 0 2px rgb(0 0 0 / 0.5); outline: none; transition: scale 120ms ease;
|
|
334
|
+
}
|
|
335
|
+
.emvb-ie-blur-handle > span { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; translate: -50% -50%; border-radius: 9999px; background: #fff; }
|
|
336
|
+
.emvb-ie-blur-handle[data-dragging] { scale: 1.15; }
|
|
337
|
+
.emvb-ie-blur-handle:focus-visible { box-shadow: 0 0 0 2px rgb(0 0 0 / 0.5), 0 0 0 5px var(--color-kumo-brand); }
|
|
338
|
+
@media (pointer: coarse) { .emvb-ie-blur-handle { width: 32px; height: 32px; } }
|
|
339
|
+
@media (prefers-reduced-motion: reduce) {
|
|
340
|
+
.emvb-ie-sheet, .emvb-ie-compact-canvas, .emvb-ie-switch, .emvb-ie-switch svg, .emvb-ie-blur-handle { transition: none; }
|
|
341
|
+
}
|
|
342
|
+
/* W-487: no motion at all when the system asks for less, Kumo's own transitions included. */
|
|
343
|
+
@media (prefers-reduced-motion: reduce) {
|
|
344
|
+
.emvb-ie, .emvb-ie *, .emvb-ie-export, .emvb-ie-export * { transition-duration: 0s !important; animation-duration: 0s !important; }
|
|
345
|
+
}
|
|
346
|
+
.emvb-ie-meta-edits { margin: 0; font-size: 13px; line-height: 20px; display: flex; gap: 8px; }
|
|
347
|
+
.emvb-ie-meta-edits > .emvb-ie-subtle { flex: 0 0 112px; padding-left: 8px; }
|
|
348
|
+
/* W-485 export dialog (photocn export-dialog.tsx; a bottom sheet on phones like its drawer). */
|
|
349
|
+
.emvb-ie-scrim { position: fixed; inset: 0; z-index: 1; background: rgb(0 0 0 / 0.25); backdrop-filter: blur(4px); }
|
|
350
|
+
|
|
351
|
+
.emvb-ie-export.emvb-ie-export { width: min(448px, calc(100vw - 32px)); padding: 0; overflow: hidden; border-radius: 12px; }
|
|
352
|
+
.emvb-ie.emvb-ie-export-body { display: flex; flex-direction: column; gap: 16px; height: auto; padding: 16px 16px 0; background: transparent; }
|
|
353
|
+
.emvb-ie-export-head { position: relative; display: flex; flex-direction: column; gap: 4px; padding-right: 32px; }
|
|
354
|
+
.emvb-ie .emvb-ie-export-close { position: absolute; top: -6px; right: -6px; }
|
|
355
|
+
.emvb-ie-export-title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; }
|
|
356
|
+
.emvb-ie-export-desc { margin: 0; font-size: 14px; color: var(--text-color-kumo-subtle); }
|
|
357
|
+
.emvb-ie-export-fields { display: flex; flex-direction: column; gap: 16px; }
|
|
358
|
+
.emvb-ie-export-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
359
|
+
.emvb-ie .emvb-ie-export-format { width: 200px; flex: none; }
|
|
360
|
+
.emvb-ie-export-size { display: flex; flex-direction: column; gap: 8px; }
|
|
361
|
+
.emvb-ie-export-dims { display: flex; align-items: center; gap: 8px; color: var(--text-color-kumo-subtle); font-size: 12px; }
|
|
362
|
+
.emvb-ie .emvb-ie-export-px {
|
|
363
|
+
width: 96px; height: 32px; padding: 0 10px; text-align: left; font-size: 14px;
|
|
364
|
+
border: 1px solid var(--color-kumo-line); border-radius: 8px; background: transparent; color: var(--text-color-kumo-default);
|
|
365
|
+
}
|
|
366
|
+
.emvb-ie-subtle { margin: 0; font-size: 12px; color: var(--text-color-kumo-subtle); font-variant-numeric: tabular-nums; }
|
|
367
|
+
.emvb-ie .emvb-ie-link { border: 0; background: none; padding: 0; font-size: 12px; color: var(--text-color-kumo-subtle); cursor: pointer; }
|
|
368
|
+
.emvb-ie .emvb-ie-link:hover { color: var(--text-color-kumo-default); text-decoration: underline; }
|
|
369
|
+
.emvb-ie-alert { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; font-size: 13px; color: var(--text-color-kumo-danger); background: var(--color-kumo-danger-tint); }
|
|
370
|
+
.emvb-ie-alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
|
|
371
|
+
.emvb-ie-export-actions {
|
|
372
|
+
display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
|
|
373
|
+
margin: 0 -16px; padding: 12px 16px; border-top: 1px solid var(--color-kumo-hairline); background: var(--color-kumo-recessed);
|
|
374
|
+
}
|
|
375
|
+
.emvb-ie-spinner.emvb-ie-spinner-sm { width: 14px; height: 14px; }
|
|
376
|
+
@media (max-width: 767px) {
|
|
377
|
+
.emvb-ie-export.emvb-ie-export {
|
|
378
|
+
width: 100vw; max-width: none; top: auto; bottom: 0; left: 0; translate: none;
|
|
379
|
+
border-radius: 16px 16px 0 0;
|
|
380
|
+
}
|
|
381
|
+
.emvb-ie-export-head { text-align: center; padding: 8px 32px 0; }
|
|
382
|
+
.emvb-ie-export-actions { flex-direction: column-reverse; border-top: 0; background: transparent; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
|
|
383
|
+
.emvb-ie-export-actions > * { width: 100%; height: 40px; }
|
|
384
|
+
}
|
|
385
|
+
/* W-486 Metadata panel (photocn metadata-panel.tsx: p-3, gap-3, a w-28 label column, text-xs). */
|
|
386
|
+
.emvb-ie-meta { display: flex; flex-direction: column; gap: 12px; padding: 12px; }
|
|
387
|
+
.emvb-ie-meta-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
|
|
388
|
+
.emvb-ie-meta-head h2 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
389
|
+
.emvb-ie-rule { margin: 0; height: 1px; border: 0; background: var(--color-kumo-hairline); }
|
|
390
|
+
.emvb-ie-meta-table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 16px; }
|
|
391
|
+
.emvb-ie-meta-table tr { border-bottom: 1px solid var(--color-kumo-hairline); }
|
|
392
|
+
.emvb-ie-meta-table tr:last-child { border-bottom: 0; }
|
|
393
|
+
.emvb-ie-meta-table th { width: 112px; padding: 8px; text-align: left; vertical-align: top; font-weight: 400; color: var(--text-color-kumo-subtle); }
|
|
394
|
+
.emvb-ie-meta-table td { padding: 8px; overflow-wrap: anywhere; color: var(--text-color-kumo-default); }
|
|
395
|
+
.emvb-ie-alert.emvb-ie-alert-neutral { color: var(--text-color-kumo-default); background: var(--color-kumo-recessed); }
|
|
396
|
+
.emvb-ie-meta-gps { display: flex; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 8px; font-size: 12px; line-height: 16px; color: var(--text-color-kumo-default); background: var(--color-kumo-recessed); }
|
|
397
|
+
.emvb-ie-meta-gps svg { width: 16px; height: 16px; flex: none; color: var(--text-color-kumo-default); }
|
|
398
|
+
`;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the image editor reads its picture from (W-482). Re-opening an edited image starts from
|
|
3
|
+
* the untouched original (`edit.originalSrc`), never from the edited file. Only same-origin
|
|
4
|
+
* pictures can be edited: the admin CSP blocks other origins (`connect-src 'self'`) and a
|
|
5
|
+
* cross-origin image would taint the canvas. SVG and GIF are refused (plan: no vector or
|
|
6
|
+
* animation editing).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type EditableSource =
|
|
10
|
+
| { ok: true; url: string; name: string; fromOriginal: boolean }
|
|
11
|
+
| { ok: false; reason: "empty" | "external" | "format"; message: string };
|
|
12
|
+
|
|
13
|
+
export type LoadedSource =
|
|
14
|
+
| {
|
|
15
|
+
ok: true;
|
|
16
|
+
blob: Blob;
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
fromOriginal: boolean;
|
|
20
|
+
/** W-493: the recorded original is gone (404), so this is the edited copy, edited afresh. */
|
|
21
|
+
originalMissing?: boolean;
|
|
22
|
+
/** W-496: the picture was larger than the GPU can edit and was scaled down from this. */
|
|
23
|
+
reducedFrom?: { width: number; height: number };
|
|
24
|
+
}
|
|
25
|
+
| { ok: false; reason: "empty" | "external" | "format" | "network"; message: string };
|
|
26
|
+
|
|
27
|
+
const REFUSED_TYPES = /^image\/(svg\+xml|gif)$/i;
|
|
28
|
+
const REFUSED_EXT = /\.(svgz?|gif)$/i;
|
|
29
|
+
|
|
30
|
+
const MESSAGES = {
|
|
31
|
+
empty: "Choose a picture first, then edit it.",
|
|
32
|
+
external:
|
|
33
|
+
"This picture is on another website, so it can't be edited here. Upload a copy to the media library to edit it.",
|
|
34
|
+
format: "SVG and GIF pictures can't be edited. Use a JPEG, PNG, WebP or AVIF picture.",
|
|
35
|
+
network: "Couldn't load the picture. Check your connection and try again.",
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
function fileNameOf(pathname: string): string {
|
|
39
|
+
const last = pathname.split("/").findLast(Boolean) ?? "";
|
|
40
|
+
try {
|
|
41
|
+
return decodeURIComponent(last) || "image";
|
|
42
|
+
} catch {
|
|
43
|
+
return last || "image";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Decides what to load for an image element's props, without fetching anything. */
|
|
48
|
+
export function editableSource(props: Record<string, unknown>, origin: string): EditableSource {
|
|
49
|
+
const edit = props.edit as { originalSrc?: unknown } | undefined;
|
|
50
|
+
const original = typeof edit?.originalSrc === "string" ? edit.originalSrc.trim() : "";
|
|
51
|
+
const current = typeof props.src === "string" ? props.src.trim() : "";
|
|
52
|
+
const raw = original || current;
|
|
53
|
+
if (!raw) return { ok: false, reason: "empty", message: MESSAGES.empty };
|
|
54
|
+
let url: URL;
|
|
55
|
+
try {
|
|
56
|
+
url = new URL(raw, origin);
|
|
57
|
+
} catch {
|
|
58
|
+
return { ok: false, reason: "external", message: MESSAGES.external };
|
|
59
|
+
}
|
|
60
|
+
if (url.origin !== new URL(origin).origin || !/^https?:$/.test(url.protocol)) {
|
|
61
|
+
return { ok: false, reason: "external", message: MESSAGES.external };
|
|
62
|
+
}
|
|
63
|
+
if (REFUSED_EXT.test(url.pathname)) {
|
|
64
|
+
return { ok: false, reason: "format", message: MESSAGES.format };
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
ok: true,
|
|
68
|
+
url: `${url.pathname}${url.search}`,
|
|
69
|
+
name: fileNameOf(url.pathname),
|
|
70
|
+
fromOriginal: Boolean(original),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Fetches the picture as a Blob; the type check repeats on the real Content-Type. */
|
|
75
|
+
export async function loadEditableSource(
|
|
76
|
+
props: Record<string, unknown>,
|
|
77
|
+
origin: string,
|
|
78
|
+
fetchImpl: typeof fetch = fetch,
|
|
79
|
+
): Promise<LoadedSource> {
|
|
80
|
+
const source = editableSource(props, origin);
|
|
81
|
+
if (!source.ok) return source;
|
|
82
|
+
let response: Response;
|
|
83
|
+
try {
|
|
84
|
+
response = await fetchImpl(source.url, { credentials: "same-origin" });
|
|
85
|
+
} catch {
|
|
86
|
+
return { ok: false, reason: "network", message: MESSAGES.network };
|
|
87
|
+
}
|
|
88
|
+
if (response.status === 404 && source.fromOriginal) {
|
|
89
|
+
// W-493: the original was deleted; edit the copy the element shows instead.
|
|
90
|
+
const { edit: _gone, ...current } = props;
|
|
91
|
+
const copy = await loadEditableSource(current, origin, fetchImpl);
|
|
92
|
+
return copy.ok ? { ...copy, originalMissing: true } : copy;
|
|
93
|
+
}
|
|
94
|
+
if (!response.ok) return { ok: false, reason: "network", message: MESSAGES.network };
|
|
95
|
+
const blob = await response.blob();
|
|
96
|
+
const type =
|
|
97
|
+
(response.headers.get("content-type") ?? blob.type ?? "").split(";")[0]?.trim() ?? "";
|
|
98
|
+
if (REFUSED_TYPES.test(type)) return { ok: false, reason: "format", message: MESSAGES.format };
|
|
99
|
+
if (type && !type.startsWith("image/")) {
|
|
100
|
+
return { ok: false, reason: "network", message: MESSAGES.network };
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
ok: true,
|
|
104
|
+
blob,
|
|
105
|
+
name: source.name,
|
|
106
|
+
type: type || blob.type,
|
|
107
|
+
fromOriginal: source.fromOriginal,
|
|
108
|
+
};
|
|
109
|
+
}
|