@schukai/monster 4.154.4 → 4.154.6
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/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/source/components/content/image-editor.mjs +19 -0
- package/source/components/files/stylesheet/file-manager.mjs +1 -1
- package/test/cases/components/content/image-editor.mjs +27 -0
- package/test/cases/components/files/file-manager.mjs +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [4.154.6] - 2026-10-04
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **file-manager:** bound editor viewport height ([#590](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/590))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [4.154.5] - 2026-10-04
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **image-editor:** load raw SVG markup ([#589](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/589))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
5
21
|
## [4.154.4] - 2026-10-04
|
|
6
22
|
|
|
7
23
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","exports":{".":"./source/monster.mjs","./CHANGELOG.md":"./CHANGELOG.md","./LICENSE":"./LICENSE","./README.md":"./README.md","./package.json":"./package.json","./source/*":"./source/*","./test/*":"./test/*"},"files":["source","test/cases","test/util","CHANGELOG.md"],"homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"sideEffects":["./source/monster.mjs","./source/components/**","./source/i18n/**","./test/**"],"type":"module","version":"4.154.
|
|
1
|
+
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","exports":{".":"./source/monster.mjs","./CHANGELOG.md":"./CHANGELOG.md","./LICENSE":"./LICENSE","./README.md":"./README.md","./package.json":"./package.json","./source/*":"./source/*","./test/*":"./test/*"},"files":["source","test/cases","test/util","CHANGELOG.md"],"homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"sideEffects":["./source/monster.mjs","./source/components/**","./source/i18n/**","./test/**"],"type":"module","version":"4.154.6"}
|
|
@@ -1181,6 +1181,25 @@ function setImageFromData(data, options) {
|
|
|
1181
1181
|
|
|
1182
1182
|
if (isString(data)) {
|
|
1183
1183
|
const trimmed = data.trim();
|
|
1184
|
+
const normalizedContentType = contentType
|
|
1185
|
+
.split(";", 1)[0]
|
|
1186
|
+
.trim()
|
|
1187
|
+
.toLowerCase();
|
|
1188
|
+
const svgMarkup = trimmed.replace(/^<\?xml[\s\S]*?\?>\s*/iu, "");
|
|
1189
|
+
if (
|
|
1190
|
+
normalizedContentType === "image/svg+xml" &&
|
|
1191
|
+
/^<svg(?:\s|>)/iu.test(svgMarkup)
|
|
1192
|
+
) {
|
|
1193
|
+
return loadImageFromSource.call(
|
|
1194
|
+
this,
|
|
1195
|
+
`data:image/svg+xml;charset=utf-8,${encodeURIComponent(trimmed)}`,
|
|
1196
|
+
{
|
|
1197
|
+
storeOriginal,
|
|
1198
|
+
resetAspect: storeOriginal,
|
|
1199
|
+
resetView: storeOriginal,
|
|
1200
|
+
},
|
|
1201
|
+
);
|
|
1202
|
+
}
|
|
1184
1203
|
if (trimmed.startsWith("data:") || trimmed.startsWith("blob:")) {
|
|
1185
1204
|
return loadImageFromSource.call(this, trimmed, {
|
|
1186
1205
|
storeOriginal,
|
|
@@ -25,7 +25,7 @@ try {
|
|
|
25
25
|
FileManagerStyleSheet.insertRule(
|
|
26
26
|
`
|
|
27
27
|
@layer filemanager {
|
|
28
|
-
:host{box-sizing:border-box;display:block;height:
|
|
28
|
+
:host{box-sizing:border-box;display:block;height:var(--monster-file-manager-height,clamp(320px,70vh,720px));min-height:320px}
|
|
29
29
|
[data-monster-role=control]{box-sizing:border-box;display:flex;flex-direction:column;gap:var(--monster-space-4);height:100%}
|
|
30
30
|
[data-monster-role=toolbar]{align-items:center;display:flex;gap:var(--monster-space-4);justify-content:space-between}
|
|
31
31
|
[data-monster-role=actions]{display:flex;gap:var(--monster-space-3);justify-content:flex-end}
|
|
@@ -109,4 +109,31 @@ describe('ImageEditor', function () {
|
|
|
109
109
|
'<monster-button-bar class="grid-span-full monster-margin-top-2">',
|
|
110
110
|
);
|
|
111
111
|
});
|
|
112
|
+
|
|
113
|
+
it('loads raw SVG markup with its documented content type issue #589', async function () {
|
|
114
|
+
const OriginalImage = globalThis.Image;
|
|
115
|
+
const sources = [];
|
|
116
|
+
|
|
117
|
+
class ImageMock {
|
|
118
|
+
set src(value) {
|
|
119
|
+
sources.push(value);
|
|
120
|
+
queueMicrotask(() => this.onerror?.(new Error('test stop')));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
globalThis.Image = ImageMock;
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
const element = document.createElement('monster-image-editor');
|
|
128
|
+
const markup = '<svg xmlns="http://www.w3.org/2000/svg"><rect width="4" height="3"/></svg>';
|
|
129
|
+
|
|
130
|
+
await element.setImage(markup, {contentType: 'image/svg+xml'}).catch(() => {});
|
|
131
|
+
|
|
132
|
+
expect(sources).to.have.length(1);
|
|
133
|
+
expect(sources[0]).to.match(/^data:image\/svg\+xml;charset=utf-8,/);
|
|
134
|
+
expect(decodeURIComponent(sources[0].split(',', 2)[1])).to.equal(markup);
|
|
135
|
+
} finally {
|
|
136
|
+
globalThis.Image = OriginalImage;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
112
139
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { expect } from "chai";
|
|
3
|
+
|
|
4
|
+
const styleSheetSource = readFileSync(
|
|
5
|
+
new URL(
|
|
6
|
+
"../../../../source/components/files/stylesheet/file-manager.mjs",
|
|
7
|
+
import.meta.url,
|
|
8
|
+
),
|
|
9
|
+
"utf8",
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
describe("FileManager layout", () => {
|
|
13
|
+
it("uses a bounded default height that consumers can override", () => {
|
|
14
|
+
expect(styleSheetSource).to.include(
|
|
15
|
+
"height:var(--monster-file-manager-height,clamp(320px,70vh,720px))",
|
|
16
|
+
);
|
|
17
|
+
expect(styleSheetSource).not.to.include("height:stretch");
|
|
18
|
+
expect(styleSheetSource).not.to.include("height:fill-available");
|
|
19
|
+
});
|
|
20
|
+
});
|