@schukai/monster 4.129.10 → 4.130.1

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.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/source/components/content/image-editor.mjs +1 -0
  3. package/source/components/datatable/change-button.mjs +1 -1
  4. package/source/components/datatable/pagination.mjs +2 -1
  5. package/source/components/datatable/save-button.mjs +1 -0
  6. package/source/components/files/file-manager.mjs +1 -0
  7. package/source/components/form/action-button.mjs +2 -1
  8. package/source/components/form/api-button.mjs +2 -1
  9. package/source/components/form/context-error.mjs +1 -0
  10. package/source/components/form/context-help.mjs +1 -0
  11. package/source/components/form/context-hint.mjs +2 -0
  12. package/source/components/form/context-info.mjs +2 -0
  13. package/source/components/form/context-note.mjs +2 -0
  14. package/source/components/form/context-success.mjs +2 -0
  15. package/source/components/form/context-warning.mjs +2 -0
  16. package/source/components/form/credential-button.mjs +1 -0
  17. package/source/components/form/field-set.mjs +2 -1
  18. package/source/components/form/message-state-button.mjs +2 -1
  19. package/source/components/form/quantity.mjs +2 -1
  20. package/source/components/form/repeat-field-set.mjs +1 -0
  21. package/source/components/form/state-button.mjs +2 -1
  22. package/source/components/form/toggle-switch.mjs +1 -0
  23. package/source/components/layout/tabs.mjs +1 -1
  24. package/source/components/layout/vertical-tabs.mjs +1 -1
  25. package/source/components/notify/monitor-attribute-errors.mjs +1 -1
  26. package/source/components/state/log.mjs +1 -0
  27. package/source/components/state/state.mjs +1 -0
  28. package/source/components/state/thread.mjs +1 -0
  29. package/test/cases/components/layout/tabs.mjs +59 -0
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.129.10"}
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.130.1"}
@@ -274,6 +274,7 @@ const rotateResetButtonElementSymbol = Symbol("rotateResetButtonElement");
274
274
  * An Image Editor Component
275
275
  *
276
276
  * @fragments /fragments/components/content/image-editor/
277
+ * @example /examples/components/content/image-editor-basic Basic editor workflow
277
278
  *
278
279
  * @since 4.68.0
279
280
  * @copyright Volker Schukai
@@ -187,7 +187,7 @@ function initControlReferences() {
187
187
  const selector2 = this.getOption("overlay.selector");
188
188
 
189
189
  if (isString(selector2)) {
190
- const element = findElementWithSelectorUpwards(this, selector);
190
+ const element = findElementWithSelectorUpwards(this, selector2);
191
191
  if (element === null) {
192
192
  throw new Error("the selector must match exactly one element");
193
193
  }
@@ -102,7 +102,8 @@ const compactNextIcon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" heig
102
102
  *
103
103
  * @fragments /fragments/components/datatable/pagination
104
104
  *
105
- * @example /examples/components/datatable/pagination-simple Pagination
105
+ * @example /examples/components/datatable/pagination-simple Datasource pagination
106
+ * @example /examples/components/datatable/pagination-programmatic Programmatic pagination state
106
107
  *
107
108
  * @copyright Volker Schukai
108
109
  * @summary The Pagination component is used to show the current page and the total number of pages.
@@ -84,6 +84,7 @@ const internalDisableVersionSymbol = Symbol("internalDisableVersion");
84
84
  * @fragments /fragments/components/datatable/save-button
85
85
  *
86
86
  * @example /examples/components/datatable/save-button-simple Simple example
87
+ * @example /examples/components/datatable/save-button-workflow Draft changes workflow
87
88
  *
88
89
  * @issue https://localhost.alvine.dev:8440/development/issues/closed/274.html
89
90
  *
@@ -137,6 +137,7 @@ const saveAllButtonSymbol = Symbol("saveAllButton");
137
137
  * A file manager for navigating and editing files.
138
138
  *
139
139
  * @fragments /fragments/components/files/file-manager/
140
+ * @example /examples/components/files/file-manager-basic Basic file manager workflow
140
141
  *
141
142
  * @since 4.44.0
142
143
  * @summary A file manager control that builds a tree navigation from an API and opens files in tabs.
@@ -46,7 +46,8 @@ const containerElementSymbol = Symbol("containerElement");
46
46
  *
47
47
  * @fragments /fragments/components/form/action-button
48
48
  *
49
- * @example /examples/components/form/action-button
49
+ * @example /examples/components/form/action-button Inline menu
50
+ * @example /examples/components/form/action-button-bulk-actions Bulk action menu
50
51
  *
51
52
  * @issue https://localhost.alvine.dev:8440/development/issues/closed/264.html
52
53
  *
@@ -57,10 +57,11 @@ const containerElementSymbol = Symbol("containerElement");
57
57
  * @fragments /fragments/components/form/api-button/
58
58
  *
59
59
  * @example /examples/components/form/api-button-simple API Button
60
+ * @example /examples/components/form/api-button-workflow API workflow with events
60
61
  *
61
62
  * @since 3.32.0
62
63
  * @copyright Volker Schukai
63
- * @summary A api button control
64
+ * @summary An API button that loads actions dynamically and executes follow-up requests
64
65
  * @fires monster-button-set
65
66
  * @fires monster-api-button-click
66
67
  * @fires monster-api-button-successful
@@ -60,6 +60,7 @@ const iconElementSymbol = Symbol("iconElement");
60
60
  * @fragments /fragments/components/form/context-error
61
61
  *
62
62
  * @example /examples/components/form/context-error-simple
63
+ * @example /examples/components/form/context-error-live-validation
63
64
  *
64
65
  * @since 3.55.0
65
66
  * @copyright Volker Schukai
@@ -25,6 +25,7 @@ export { ContextHelp };
25
25
  * @fragments /fragments/components/form/context-help
26
26
  *
27
27
  * @example /examples/components/form/context-help-simple
28
+ * @example /examples/components/form/context-help-inline-guidance
28
29
  *
29
30
  * @since 3.29.0
30
31
  * @copyright Volker Schukai
@@ -24,6 +24,8 @@ export { ContextHint };
24
24
  * A context hint control.
25
25
  *
26
26
  * @fragments /fragments/components/form/context-hint
27
+ * @example /examples/components/form/context-hint-inline
28
+ * @example /examples/components/form/context-hint-shortcuts
27
29
  *
28
30
  * @since 3.55.0
29
31
  * @copyright Volker Schukai
@@ -24,6 +24,8 @@ export { ContextInfo };
24
24
  * A context info control.
25
25
  *
26
26
  * @fragments /fragments/components/form/context-info
27
+ * @example /examples/components/form/context-info-workspace
28
+ * @example /examples/components/form/context-info-retention
27
29
  *
28
30
  * @since 3.55.0
29
31
  * @copyright Volker Schukai
@@ -24,6 +24,8 @@ export { ContextNote };
24
24
  * A context note control.
25
25
  *
26
26
  * @fragments /fragments/components/form/context-note
27
+ * @example /examples/components/form/context-note-handover
28
+ * @example /examples/components/form/context-note-review
27
29
  *
28
30
  * @since 3.55.0
29
31
  * @copyright Volker Schukai
@@ -24,6 +24,8 @@ export { ContextSuccess };
24
24
  * A context success control.
25
25
  *
26
26
  * @fragments /fragments/components/form/context-success
27
+ * @example /examples/components/form/context-success-domain
28
+ * @example /examples/components/form/context-success-checklist
27
29
  *
28
30
  * @since 3.55.0
29
31
  * @copyright Volker Schukai
@@ -24,6 +24,8 @@ export { ContextWarning };
24
24
  * A context warning control.
25
25
  *
26
26
  * @fragments /fragments/components/form/context-warning
27
+ * @example /examples/components/form/context-warning-retention
28
+ * @example /examples/components/form/context-warning-delete
27
29
  *
28
30
  * @since 3.55.0
29
31
  * @copyright Volker Schukai
@@ -53,6 +53,7 @@ const passwordWiredSymbol = Symbol("passwordWired");
53
53
  * @fragments /fragments/components/form/credential-button/
54
54
  *
55
55
  * @example /examples/components/form/credential-button-simple
56
+ * @example /examples/components/form/credential-button-retry
56
57
  *
57
58
  * @since 3.91.0
58
59
  * @copyright Volker Schukai
@@ -75,7 +75,8 @@ const extendedSwitchElementSymbol = Symbol("extendedSwitchElement");
75
75
  *
76
76
  * @fragments /fragments/components/form/field-set/
77
77
  *
78
- * @example /examples/components/form/field-set-simple
78
+ * @example /examples/components/form/field-set-simple Shipping field set
79
+ * @example /examples/components/form/field-set-preferences Compact settings field set
79
80
  *
80
81
  * @since 3.65.0
81
82
  * @copyright Volker Schukai
@@ -51,7 +51,8 @@ const MESSAGE_LAYOUT_WIDE = "wide";
51
51
  * or manual actions.
52
52
  *
53
53
  * @fragments /fragments/components/form/message-state-button/
54
- * @example /examples/components/form/message-state-button-simple
54
+ * @example /examples/components/form/message-state-button-simple Success message
55
+ * @example /examples/components/form/message-state-button-retry Retry and error message
55
56
  *
56
57
  * @since 2.11.0
57
58
  * @copyright Volker Schukai
@@ -53,7 +53,8 @@ const holdIntervalSymbol = Symbol("holdInterval");
53
53
  *
54
54
  * @fragments /fragments/components/form/quantity/
55
55
  *
56
- * @example /examples/components/form/quantity-simple
56
+ * @example /examples/components/form/quantity-simple Basic quantity control
57
+ * @example /examples/components/form/quantity-decimal Decimal pricing stepper
57
58
  *
58
59
  * @since 4.41.0
59
60
  * @copyright Volker Schukai
@@ -70,6 +70,7 @@ const itemDefaultsSymbol = Symbol("itemDefaults");
70
70
  * A repeatable field-set control that manages array data.
71
71
  *
72
72
  * @fragments /fragments/components/form/repeat-field-set/
73
+ * @example /examples/components/form/repeat-field-set-simple Repeatable contacts
73
74
  *
74
75
  * @since 3.78.0
75
76
  * @summary A repeatable field-set control
@@ -27,7 +27,8 @@ export { StateButton };
27
27
  *
28
28
  * @fragments /fragments/components/form/state-button/
29
29
  *
30
- * @example /examples/components/form/state-button-simple
30
+ * @example /examples/components/form/state-button-simple Simple state cycle
31
+ * @example /examples/components/form/state-button-deployment Deployment state sequence
31
32
  *
32
33
  * @since 1.5.0
33
34
  * @copyright Volker Schukai
@@ -58,6 +58,7 @@ export const STATE_OFF = "off";
58
58
  * @fragments /fragments/components/form/toggle-switch
59
59
  *
60
60
  * @example /examples/components/form/toggle-switch-simple Simple example
61
+ * @example /examples/components/form/toggle-switch-custom-values Custom values and labels
61
62
  *
62
63
  * @since 3.57.0
63
64
  * @copyright Volker Schukai
@@ -216,7 +216,7 @@ class Tabs extends CustomElement {
216
216
  features: {
217
217
  openDelay: null,
218
218
  removeBehavior: "auto",
219
- openFirst: false,
219
+ openFirst: true,
220
220
  },
221
221
 
222
222
  classes: {
@@ -217,7 +217,7 @@ class VerticalTabs extends CustomElement {
217
217
  features: {
218
218
  openDelay: null,
219
219
  removeBehavior: "auto",
220
- openFirst: false,
220
+ openFirst: true,
221
221
  },
222
222
 
223
223
  classes: {
@@ -47,7 +47,7 @@ const mutationObserversSymbol = Symbol("mutationObservers");
47
47
  *
48
48
  * @since 3.98.0
49
49
  * @copyright Volker Schukai
50
- * @summary A beautiful MonitorAttributeErrors that can make your life easier and also looks good.
50
+ * @summary Watches the DOM for `data-monster-error` attributes and can forward them to `monster-notify`.
51
51
  */
52
52
  class MonitorAttributeErrors extends CustomElement {
53
53
  /**
@@ -58,6 +58,7 @@ const timeAgoIntervalSymbol = Symbol("timeAgoInterval");
58
58
  * @fragments /fragments/components/state/log
59
59
  *
60
60
  * @example /examples/components/state/log-simple Log
61
+ * @example /examples/components/state/log-live-feed Live deployment feed
61
62
  *
62
63
  * @issue https://localhost.alvine.dev:8444/development/issues/closed/270.html
63
64
  *
@@ -28,6 +28,7 @@ export { State };
28
28
  * @fragments /fragments/components/state/state
29
29
  *
30
30
  * @example /examples/components/state/state-simple State
31
+ * @example /examples/components/state/state-actionable Actionable empty state
31
32
  *
32
33
  * @since 1.5.0
33
34
  * @copyright Volker Schukai
@@ -54,6 +54,7 @@ const timeAgoIntervalSymbol = Symbol("timeAgoInterval");
54
54
  * @fragments /fragments/components/state/thread
55
55
  *
56
56
  * @example /examples/components/state/thread-simple Thread
57
+ * @example /examples/components/state/thread-review Review thread with nested replies
57
58
  *
58
59
  * @issue https://localhost.alvine.dev:8444/development/issues/open/374.html
59
60
  *
@@ -28,6 +28,21 @@ let html1 = `
28
28
  </monster-tabs>
29
29
  `;
30
30
 
31
+ // language=html
32
+ let htmlActiveSecond = `
33
+ <monster-tabs id="mytabs">
34
+ <div data-monster-button-label="TAB1">
35
+ Das ist tab 1
36
+ </div>
37
+ <div data-monster-button-label="TAB2" class="active">
38
+ Das ist tab 2
39
+ </div>
40
+ <div data-monster-button-label="TAB3">
41
+ Das ist tab 3
42
+ </div>
43
+ </monster-tabs>
44
+ `;
45
+
31
46
  let Tabs;
32
47
 
33
48
  describe('Tabs', function () {
@@ -122,6 +137,50 @@ describe('Tabs', function () {
122
137
  }, 0);
123
138
  });
124
139
 
140
+ it('should open the first tab by default when no tab is predefined as active', function (done) {
141
+
142
+ let mocks = document.getElementById('mocks');
143
+ mocks.innerHTML = html1;
144
+
145
+ setTimeout(() => {
146
+ try {
147
+ const tabs = document.getElementById('mytabs');
148
+ expect(tabs).is.instanceof(Tabs);
149
+
150
+ setTimeout(() => {
151
+ expect(tabs.children[0].classList.contains('active')).to.equal(true);
152
+ expect(tabs.children[1].classList.contains('active')).to.equal(false);
153
+ expect(tabs.getActiveTab()).to.equal(tabs.children[0].getAttribute('id'));
154
+ done();
155
+ }, 100);
156
+ } catch (e) {
157
+ return done(e);
158
+ }
159
+ }, 0);
160
+ });
161
+
162
+ it('should keep a predefined active tab instead of opening the first tab', function (done) {
163
+
164
+ let mocks = document.getElementById('mocks');
165
+ mocks.innerHTML = htmlActiveSecond;
166
+
167
+ setTimeout(() => {
168
+ try {
169
+ const tabs = document.getElementById('mytabs');
170
+ expect(tabs).is.instanceof(Tabs);
171
+
172
+ setTimeout(() => {
173
+ expect(tabs.children[0].classList.contains('active')).to.equal(false);
174
+ expect(tabs.children[1].classList.contains('active')).to.equal(true);
175
+ expect(tabs.getActiveTab()).to.equal(tabs.children[1].getAttribute('id'));
176
+ done();
177
+ }, 100);
178
+ } catch (e) {
179
+ return done(e);
180
+ }
181
+ }, 0);
182
+ });
183
+
125
184
  });
126
185
 
127
186