@schukai/monster 4.154.8 → 4.154.10
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/dom/customelement.mjs +13 -3
- package/source/types/version.mjs +2 -2
- package/test/cases/dom/customelement.mjs +48 -0
- package/test/cases/monster.mjs +13 -19
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [4.154.10] - 2026-10-10
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **custom-element:** preserve early option fallbacks ([#576](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/576))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [4.154.9] - 2026-10-10
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **release:** synchronize embedded package version ([#593](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/593))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
5
21
|
## [4.154.8] - 2026-10-05
|
|
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.10"}
|
|
@@ -540,15 +540,25 @@ class CustomElement extends HTMLElement {
|
|
|
540
540
|
/**
|
|
541
541
|
* nested options can be specified by path `a.b.c`
|
|
542
542
|
*
|
|
543
|
+
* Before the constructor has initialized the option observer, this method
|
|
544
|
+
* returns the supplied default value. This preserves option reads from
|
|
545
|
+
* derived `defaults` and `customization` getters during initialization.
|
|
546
|
+
*
|
|
543
547
|
* @param {string} path
|
|
544
548
|
* @param {*} defaultValue
|
|
545
549
|
* @return {*}
|
|
546
550
|
* @since 1.10.0
|
|
547
551
|
*/
|
|
548
552
|
getOption(path, defaultValue = undefined) {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
553
|
+
const optionObserver = this[internalSymbol];
|
|
554
|
+
if (optionObserver === undefined) {
|
|
555
|
+
return defaultValue;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
return new Pathfinder(optionObserver.getRealSubject().options).getVia(
|
|
559
|
+
path,
|
|
560
|
+
defaultValue,
|
|
561
|
+
);
|
|
552
562
|
}
|
|
553
563
|
|
|
554
564
|
/**
|
package/source/types/version.mjs
CHANGED
|
@@ -155,8 +155,8 @@ function getMonsterVersion() {
|
|
|
155
155
|
return monsterVersion;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
/**
|
|
159
|
-
monsterVersion = new Version("4.
|
|
158
|
+
/** Managed by the release script; keep synchronized with package.json. */
|
|
159
|
+
monsterVersion = new Version("4.154.10");
|
|
160
160
|
|
|
161
161
|
return monsterVersion;
|
|
162
162
|
}
|
|
@@ -1232,6 +1232,54 @@ describe('DOM', function () {
|
|
|
1232
1232
|
mocks.innerHTML = html1;
|
|
1233
1233
|
})
|
|
1234
1234
|
|
|
1235
|
+
it('should return the fallback while defaults and customization initialize options', function () {
|
|
1236
|
+
const htmlTAG = 'monster-testclass-early-option-576';
|
|
1237
|
+
|
|
1238
|
+
if (!customElements.get(htmlTAG)) {
|
|
1239
|
+
class EarlyOptionComponent extends CustomElement {
|
|
1240
|
+
static getTag() {
|
|
1241
|
+
return htmlTAG;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
get defaults() {
|
|
1245
|
+
return Object.assign({}, super.defaults, {
|
|
1246
|
+
fromDefaults: this.getOption(
|
|
1247
|
+
'source.value',
|
|
1248
|
+
'defaults-fallback',
|
|
1249
|
+
),
|
|
1250
|
+
fromCustomization: 'initial',
|
|
1251
|
+
templates: {
|
|
1252
|
+
main: '<span></span>',
|
|
1253
|
+
},
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
get customization() {
|
|
1258
|
+
return new Map([
|
|
1259
|
+
[
|
|
1260
|
+
'fromCustomization',
|
|
1261
|
+
this.getOption(
|
|
1262
|
+
'source.value',
|
|
1263
|
+
'customization-fallback',
|
|
1264
|
+
),
|
|
1265
|
+
],
|
|
1266
|
+
]);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
registerCustomElement(EarlyOptionComponent);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
const element = document.createElement(htmlTAG);
|
|
1274
|
+
|
|
1275
|
+
expect(element.getOption('fromDefaults')).to.equal(
|
|
1276
|
+
'defaults-fallback',
|
|
1277
|
+
);
|
|
1278
|
+
expect(element.getOption('fromCustomization')).to.equal(
|
|
1279
|
+
'customization-fallback',
|
|
1280
|
+
);
|
|
1281
|
+
});
|
|
1282
|
+
|
|
1235
1283
|
// Pathfinder.exists() is load bearing as an input validator here:
|
|
1236
1284
|
// the option name is undefined for every unknown
|
|
1237
1285
|
// data-monster-option-* attribute, and the constructor plus every
|
package/test/cases/monster.mjs
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {expect} from "chai"
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
it('should ' + monsterVersion + ' is ' + m, function () {
|
|
15
|
-
expect(m.compareTo(monsterVersion)).is.equal(0);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import packageData from "../../package.json" with { type: "json" };
|
|
3
|
+
import { Version, getMonsterVersion } from "../../source/types/version.mjs";
|
|
4
|
+
|
|
5
|
+
describe("Monster", () => {
|
|
6
|
+
describe(".getMonsterVersion()", () => {
|
|
7
|
+
it("should match the package version", () => {
|
|
8
|
+
const packageVersion = new Version(packageData.version);
|
|
9
|
+
const monsterVersion = getMonsterVersion();
|
|
10
|
+
|
|
11
|
+
expect(monsterVersion.compareTo(packageVersion)).to.equal(0);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
20
14
|
});
|