@schukai/monster 4.137.6 → 4.137.7

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/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.","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"},"type":"module","version":"4.137.6"}
1
+ {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","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"},"type":"module","version":"4.137.7"}
@@ -1905,7 +1905,7 @@ function getTemplate() {
1905
1905
  <monster-collapse data-monster-option-openByDefault="true"
1906
1906
  data-monster-role="login-collapse"
1907
1907
  exportparts="control:collapse-login-control,
1908
- container:collapse-login-container,
1908
+ container:collapse-login-container,
1909
1909
  deco:collapse-login-deco"
1910
1910
  part="login-collapse">
1911
1911
  <monster-field-set
@@ -8,6 +8,29 @@ import { initJSDOM } from "../../../util/jsdom.mjs";
8
8
  let expect = chai.expect;
9
9
  chai.use(chaiDom);
10
10
 
11
+ function waitForCondition(check, { timeout = 4000, interval = 25 } = {}) {
12
+ const startedAt = Date.now();
13
+ return new Promise((resolve, reject) => {
14
+ const tick = () => {
15
+ try {
16
+ if (check()) {
17
+ resolve();
18
+ return;
19
+ }
20
+ } catch (error) {
21
+ reject(error);
22
+ return;
23
+ }
24
+ if (Date.now() - startedAt >= timeout) {
25
+ reject(new Error('condition timed out'));
26
+ return;
27
+ }
28
+ setTimeout(tick, interval);
29
+ };
30
+ tick();
31
+ });
32
+ }
33
+
11
34
  describe('TableOfContent', function () {
12
35
  this.timeout(10000);
13
36
 
@@ -35,7 +58,7 @@ describe('TableOfContent', function () {
35
58
  mocks.innerHTML = '';
36
59
  });
37
60
 
38
- it('should bind to the first actually scrollable parent', function (done) {
61
+ it('should bind to the first actually scrollable parent', async function () {
39
62
  const target = document.getElementById('target');
40
63
  const outerScroller = document.createElement('div');
41
64
  const innerWrapper = document.createElement('div');
@@ -91,25 +114,13 @@ describe('TableOfContent', function () {
91
114
  outerScroller.appendChild(innerWrapper);
92
115
  target.appendChild(outerScroller);
93
116
 
94
- setTimeout(() => {
95
- try {
96
- const navigation = tableOfContent.shadowRoot.querySelector('.navigation');
97
- expect(navigation.style.top).to.equal('50px');
98
-
99
- outerScroller.scrollTop = 120;
100
- outerScroller.dispatchEvent(new window.Event('scroll'));
101
-
102
- setTimeout(() => {
103
- try {
104
- expect(navigation.style.top).to.equal('170px');
105
- done();
106
- } catch (error) {
107
- done(error);
108
- }
109
- }, 20);
110
- } catch (error) {
111
- done(error);
112
- }
113
- }, 30);
117
+ const navigation = tableOfContent.shadowRoot.querySelector('.navigation');
118
+
119
+ await waitForCondition(() => navigation.style.top === '50px');
120
+
121
+ outerScroller.scrollTop = 120;
122
+ outerScroller.dispatchEvent(new window.Event('scroll'));
123
+
124
+ await waitForCondition(() => navigation.style.top === '170px');
114
125
  });
115
126
  });
@@ -12,6 +12,9 @@ let expect = chai.expect;
12
12
 
13
13
  chai.use(chaiDom);
14
14
 
15
+ const validDataURL = 'https://example.test/data.json';
16
+ const allowedOrigins = ['https://example.test'];
17
+
15
18
  let html1 = `
16
19
 
17
20
  `;
@@ -63,7 +66,8 @@ describe('Data', function () {
63
66
  it('setEventTypes()', function (done) {
64
67
 
65
68
  const data = new Data({
66
- src: '/data.json'
69
+ src: validDataURL,
70
+ allowedOrigins
67
71
  });
68
72
 
69
73
  data.connect().available().then(() => {
@@ -74,24 +78,26 @@ describe('Data', function () {
74
78
 
75
79
  it('rejects executable script types', function () {
76
80
 
81
+ const scriptCount = document.querySelectorAll('script').length;
77
82
  const data = new Data({
78
83
  src: new DataUrl('console.log(1);', 'text/javascript').toString(),
79
84
  type: 'text/javascript'
80
85
  });
81
86
 
82
87
  expect(() => data.connect()).to.throw('unsupported data resource type');
83
- expect(document.querySelector('script')).not.to.exist;
88
+ expect(document.querySelectorAll('script')).to.have.length(scriptCount);
84
89
 
85
90
  })
86
91
 
87
92
  it('rejects remote origins by default', function () {
88
93
 
94
+ const scriptCount = document.querySelectorAll('script').length;
89
95
  const data = new Data({
90
96
  src: 'https://cdn.example/data.json'
91
97
  });
92
98
 
93
99
  expect(() => data.connect()).to.throw('data resource origin not allowed');
94
- expect(document.querySelector('script')).not.to.exist;
100
+ expect(document.querySelectorAll('script')).to.have.length(scriptCount);
95
101
 
96
102
  })
97
103
 
@@ -117,8 +123,9 @@ describe('Data', function () {
117
123
  };
118
124
 
119
125
  const data = new Data({
120
- src: '/data.json',
121
- id: 'data-error'
126
+ src: validDataURL,
127
+ id: 'data-error',
128
+ allowedOrigins
122
129
  });
123
130
 
124
131
  data.connect();
@@ -141,13 +148,14 @@ describe('Data', function () {
141
148
  describe('External Data', () => {
142
149
 
143
150
  let id = new ID('data').toString();
144
- let server, data, url = '/layzr.json';
151
+ let server, data, url = 'https://example.test/layzr.json';
145
152
 
146
153
  beforeEach(() => {
147
154
 
148
155
  data = new Data({
149
156
  src: url,
150
- id: id
157
+ id: id,
158
+ allowedOrigins
151
159
  });
152
160
 
153
161
  });
@@ -6,6 +6,10 @@ import {ResourceManager} from "../../../source/dom/resourcemanager.mjs";
6
6
  import {cleanupDOMFromTesting, initMutationObserverForTesting} from "../../util/cleanupdom.mjs";
7
7
  import {initJSDOM} from "../../util/jsdom.mjs";
8
8
 
9
+ const validDataURL = 'https://example.test/data.json';
10
+ const validExampleURL = 'https://example.test/example.json';
11
+ const allowedOrigins = ['https://example.test'];
12
+
9
13
  describe('ResourceManager', function () {
10
14
 
11
15
  let fetchReference, returnStatus;
@@ -70,7 +74,7 @@ describe('ResourceManager', function () {
70
74
  });
71
75
 
72
76
  it('add data should instance of ResourceManager', function () {
73
- expect(manager.addData('/data.json')).to.be.instanceOf(ResourceManager);
77
+ expect(manager.addData(validDataURL, {allowedOrigins})).to.be.instanceOf(ResourceManager);
74
78
  });
75
79
 
76
80
  describe('connect resources', function () {
@@ -83,7 +87,7 @@ describe('ResourceManager', function () {
83
87
  });
84
88
 
85
89
  it('add data and connect should instance of ResourceManager', function () {
86
- expect(manager.addData('/data.json').connect()).to.be.instanceOf(ResourceManager);
90
+ expect(manager.addData(validDataURL, {allowedOrigins}).connect()).to.be.instanceOf(ResourceManager);
87
91
  });
88
92
  })
89
93
 
@@ -98,13 +102,13 @@ describe('ResourceManager', function () {
98
102
  });
99
103
 
100
104
  it('add data and check availability should should return Promise', function () {
101
- expect(manager.addData('/data.json').available()).to.be.instanceOf(Promise);
105
+ expect(manager.addData(validDataURL, {allowedOrigins}).available()).to.be.instanceOf(Promise);
102
106
  });
103
107
  })
104
108
 
105
109
  describe('check availability example.json', function () {
106
110
  it('add data and check content', function (done) {
107
- manager.addData('/example.json').connect().available().then(r => {
111
+ manager.addData(validExampleURL, {allowedOrigins}).connect().available().then(r => {
108
112
  expect(document.querySelector('html').outerHTML).contains('>{"a":"test"}</script></head>');
109
113
  done();
110
114
  }).catch(e => done(e));
@@ -1,6 +1,5 @@
1
1
  /** this file was created automatically by the run-web-tests script */
2
2
  import "./prepare.js";
3
- import "../cases/components/layout/tabs.mjs";
4
3
  import "../cases/components/layout/slit-panel.mjs";
5
4
  import "../cases/components/layout/panel.mjs";
6
5
  import "../cases/components/layout/slider.mjs";
@@ -8,14 +7,10 @@ import "../cases/components/content/viewer.mjs";
8
7
  import "../cases/components/content/image-editor.mjs";
9
8
  import "../cases/components/form/buy-box.mjs";
10
9
  import "../cases/components/form/message-state-button.mjs";
11
- import "../cases/components/form/button-bar.mjs";
12
10
  import "../cases/components/form/reload.mjs";
13
11
  import "../cases/components/form/context-help.mjs";
14
12
  import "../cases/components/form/state-button.mjs";
15
- import "../cases/components/form/select.mjs";
16
13
  import "../cases/components/form/login.mjs";
17
- import "../cases/components/form/confirm-button.mjs";
18
- import "../cases/components/form/sheet.mjs";
19
14
  import "../cases/components/form/context-error.mjs";
20
15
  import "../cases/components/form/choice-cards.mjs";
21
16
  import "../cases/components/form/form.mjs";
@@ -32,10 +27,8 @@ import "../cases/components/host/host.mjs";
32
27
  import "../cases/components/host/overlay.mjs";
33
28
  import "../cases/components/host/util.mjs";
34
29
  import "../cases/components/host/details.mjs";
35
- import "../cases/components/datatable/drag-scroll.mjs";
36
30
  import "../cases/components/datatable/writeback-sanitizer.mjs";
37
31
  import "../cases/components/datatable/pagination.mjs";
38
- import "../cases/components/navigation/table-of-content.mjs";
39
32
  import "../cases/components/navigation/site-navigation.mjs";
40
33
  import "../cases/text/formatter.mjs";
41
34
  import "../cases/text/generate-range-comparison-expression.mjs";
@@ -10,7 +10,7 @@
10
10
  <body>
11
11
  <div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
12
12
  <h1 style='margin-bottom: 0.1em;'>Monster 4.137.5</h1>
13
- <div id="lastupdate" style='font-size:0.7em'>last update Mon May 25 11:56:58 CEST 2026</div>
13
+ <div id="lastupdate" style='font-size:0.7em'>last update Mon May 25 15:45:10 CEST 2026</div>
14
14
  </div>
15
15
  <div id="mocha-errors"
16
16
  style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>