@schukai/monster 3.55.5 → 3.56.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +23 -0
- package/package.json +2 -2
- package/source/components/datatable/change-button.mjs +265 -0
- package/source/components/datatable/dataset.mjs +76 -5
- package/source/components/datatable/datasource/dom.mjs +1 -1
- package/source/components/datatable/datasource/rest.mjs +401 -345
- package/source/components/datatable/datasource.mjs +8 -0
- package/source/components/datatable/datatable.mjs +600 -600
- package/source/components/datatable/filter/range.mjs +1 -3
- package/source/components/datatable/filter/select.mjs +1 -1
- package/source/components/datatable/filter.mjs +1 -3
- package/source/components/datatable/save-button.mjs +301 -0
- package/source/components/datatable/status.mjs +6 -2
- package/source/components/datatable/style/change-button.pcss +19 -0
- package/source/components/datatable/style/save-button.pcss +44 -0
- package/source/components/datatable/stylesheet/change-button.mjs +27 -0
- package/source/components/datatable/stylesheet/save-button.mjs +27 -0
- package/source/components/datatable/util.mjs +3 -1
- package/source/components/form/button-bar.mjs +3 -3
- package/source/components/form/button.mjs +1 -2
- package/source/components/form/form.mjs +1 -1
- package/source/components/form/message-state-button.mjs +1 -1
- package/source/components/form/select.mjs +1744 -1777
- package/source/components/form/state-button.mjs +1 -1
- package/source/components/form/style/tabs.pcss +8 -1
- package/source/components/form/stylesheet/tabs.mjs +1 -1
- package/source/components/form/tabs.mjs +9 -3
- package/source/components/form/tree-select.mjs +6 -2
- package/source/components/host/overlay.mjs +4 -1
- package/source/components/tree-menu/tree-menu.mjs +0 -1
- package/source/data/datasource/server/restapi.mjs +2 -3
- package/source/data/datasource/server.mjs +1 -1
- package/source/data/extend.mjs +55 -55
- package/source/data/pathfinder.mjs +6 -4
- package/source/dom/constants.mjs +9 -0
- package/source/dom/customelement.mjs +25 -7
- package/source/dom/updater.mjs +34 -3
- package/source/i18n/translations.mjs +1 -1
- package/source/monster.mjs +0 -1
- package/source/types/noderecursiveiterator.mjs +2 -3
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
@@ -101,7 +101,7 @@ class StateButton extends Button {
|
|
101
101
|
*
|
102
102
|
* @since 3.18.0 a previously set timeout is cleared
|
103
103
|
*
|
104
|
-
* @param {
|
104
|
+
* @param {string} state
|
105
105
|
* @param {number} timeout
|
106
106
|
* @return {Monster.Components.Form.StateButton}
|
107
107
|
* @throws {TypeError} value is not a string
|
@@ -1,8 +1,10 @@
|
|
1
|
+
@import "../../style/property.pcss";
|
1
2
|
@import "../../style/display.pcss";
|
2
3
|
@import "../../style/border.pcss";
|
3
4
|
@import "../../style/popper.pcss";
|
4
5
|
@import "../../style/control.pcss";
|
5
6
|
@import "../../style/badge.pcss";
|
7
|
+
@import '../../style/mixin/button.pcss';
|
6
8
|
@import '../../style/mixin/typography.pcss';
|
7
9
|
@import '../../style/mixin/hover.pcss';
|
8
10
|
|
@@ -26,7 +28,8 @@ nav[data-monster-role=nav] {
|
|
26
28
|
box-shadow: var(--monster-box-shadow-1);
|
27
29
|
border-color: var(--monster-bg-color-primary-2);
|
28
30
|
|
29
|
-
flex-wrap: nowrap
|
31
|
+
flex-wrap: nowrap;
|
32
|
+
|
30
33
|
}
|
31
34
|
|
32
35
|
[data-monster-role=nav] button .remove-tab {
|
@@ -45,6 +48,10 @@ nav[data-monster-role=nav] {
|
|
45
48
|
[data-monster-role=nav] button span {
|
46
49
|
display: flex;
|
47
50
|
white-space: pre;
|
51
|
+
font-family: var(--monster-font-family);
|
52
|
+
font-size: 1rem;
|
53
|
+
line-height: 1.4;
|
54
|
+
font-weight: normal;
|
48
55
|
}
|
49
56
|
|
50
57
|
[data-monster-role=nav] button {
|
@@ -20,7 +20,7 @@ const TabsStyleSheet = new CSSStyleSheet();
|
|
20
20
|
try {
|
21
21
|
TabsStyleSheet.insertRule(`
|
22
22
|
@layer tabs {
|
23
|
-
.block{display:block}.inline{display:inline}.inline-block{display:inline-block}.grid{display:grid}.inline-grid{display:inline-grid}.flex{display:flex}.inline-flex{display:inline-flex}.hidden,.hide,.none{display:none}.visible{visibility:visible}.invisible{visibility:hidden}.monster-border-primary-1,.monster-border-primary-2,.monster-border-primary-3,.monster-border-primary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);border-shadow:var(--monster-box-shadow-1)}.monster-border-0{border-radius:0;border-style:none;border-width:0;border-shadow:none}.monster-border-primary-1{border-color:var(--monster-bg-color-primary-1)}.monster-border-primary-2{border-color:var(--monster-bg-color-primary-2)}.monster-border-primary-3{border-color:var(--monster-bg-color-primary-3)}.monster-border-primary-4{border-color:var(--monster-bg-color-primary-4)}.monster-border-secondary-1,.monster-border-secondary-2,.monster-border-secondary-3,.monster-border-secondary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);border-shadow:var(--monster-box-shadow-1)}.monster-border-secondary-1{border-color:var(--monster-bg-color-secondary-1)}.monster-border-secondary-2{border-color:var(--monster-bg-color-secondary-2)}.monster-border-secondary-3{border-color:var(--monster-bg-color-secondary-3)}.monster-border-secondary-4{border-color:var(--monster-bg-color-secondary-4)}.monster-border-tertiary-1,.monster-border-tertiary-2,.monster-border-tertiary-3,.monster-border-tertiary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);border-shadow:var(--monster-box-shadow-1)}.monster-border-tertiary-1{border-color:var(--monster-bg-color-tertiary-1)}.monster-border-tertiary-2{border-color:var(--monster-bg-color-tertiary-2)}.monster-border-tertiary-3{border-color:var(--monster-bg-color-tertiary-3)}.monster-border-tertiary-4{border-color:var(--monster-bg-color-tertiary-4)}div[data-monster-role=popper]{background:var(--monster-bg-color-primary-1);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;color:var(--monster-color-primary-1);display:none;padding:1.1em;z-index:var(--monster-z-index-modal)}[data-popper-arrow],[data-popper-arrow]:before{background:inherit;height:calc(max(var(--monster-popper-witharrrow-distance), -1*var(--monster-popper-witharrrow-distance))*2);position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1*var(--monster-popper-witharrrow-distance))*2)}[data-popper-arrow]{visibility:hidden}[data-popper-arrow]:before{box-sizing:border-box;content:\"\";transform:rotate(45deg);visibility:visible}div[data-popper-placement^=top]>[data-popper-arrow]{bottom:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width)/2)}div[data-popper-placement^=top]>[data-popper-arrow]:before{border-bottom:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-left:transparent;border-right:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-top:transparent}div[data-popper-placement^=bottom]>[data-popper-arrow]{top:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width))}div[data-popper-placement^=bottom]>[data-popper-arrow]:before{border-bottom:transparent;border-left:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-right:transparent;border-top:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4)}div[data-popper-placement^=left]>[data-popper-arrow]{right:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width))}div[data-popper-placement^=left]>[data-popper-arrow]:before{border-bottom:transparent;border-left:transparent;border-right:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-top:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4)}div[data-popper-placement^=right]>[data-popper-arrow]{left:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width)/2)}div[data-popper-placement^=right]>[data-popper-arrow]:before{border-bottom:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-left:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-right:transparent;border-top:transparent}[data-monster-role=control]{outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}.monster-badge-primary{padding:.25em .4em}.monster-badge-primary,.monster-badge-primary-pill{background-color:var(--monster-bg-color-primary-4);border-radius:.25rem;color:var(--monster-color-primary-4);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-primary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-secondary{padding:.25em .4em}.monster-badge-secondary,.monster-badge-secondary-pill{background-color:var(--monster-bg-color-secondary-3);border-radius:.25rem;color:var(--monster-color-secondary-3);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-secondary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-tertiary{padding:.25em .4em}.monster-badge-tertiary,.monster-badge-tertiary-pill{background-color:var(--monster-bg-color-tertiary-3);border-radius:.25rem;color:var(--monster-color-tertiary-3);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-tertiary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-destructive{padding:.25em .4em}.monster-badge-destructive,.monster-badge-destructive-pill{background-color:var(--monster-bg-color-destructive-1);border-radius:.25rem;color:var(--monster-color-destructive-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-destructive-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-success{padding:.25em .4em}.monster-badge-success,.monster-badge-success-pill{background-color:var(--monster-bg-color-success-1);border-radius:.25rem;color:var(--monster-color-success-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-success-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-warning{padding:.25em .4em}.monster-badge-warning,.monster-badge-warning-pill{background-color:var(--monster-bg-color-warning-1);border-radius:.25rem;color:var(--monster-color-warning-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-warning-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-error{padding:.25em .4em}.monster-badge-error,.monster-badge-error-pill{background-color:var(--monster-bg-color-error-1);border-radius:.25rem;color:var(--monster-color-error-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-error-pill{border-radius:10rem;padding:.25em .6em}[data-monster-role=nav] button.hidden{display:none}nav[data-monster-role=nav]{align-items:flex-end;border-bottom-style:var(--monster-border-style);border-bottom-width:thin;border-color:var(--monster-bg-color-primary-2);border-radius:var(--monster-border-radius);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;display:flex;flex-direction:row;flex-wrap:nowrap;margin-bottom:.75rem;overflow:hidden}[data-monster-role=nav] button .remove-tab{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor'%3E%3Cpath d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E\");background-position:100% 100%;background-repeat:no-repeat;background-size:16px;flex-wrap:nowrap;height:16px;min-height:16px;order:2;width:16px}[data-monster-role=nav] button span{display:flex;white-space:pre}[data-monster-role=nav] button{align-content:center;align-items:center;align-self:stretch;background-color:var(--monster-color-gray-1);border:none;border-bottom:var(--monster-border-style);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);box-shadow:var(--monster-box-shadow-1);color:var(--monster-color-gray-6);cursor:pointer;display:flex;font-size:1rem;font-weight:400;justify-content:center;line-height:1.5;margin-right:.75rem;outline:none;padding:.375rem 0;text-align:center;text-decoration:none;transition:color .8s;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle}@media (prefers-color-scheme:dark){[data-monster-role=nav] button{background-color:var(--monster-color-gray-6);color:var(--monster-color-gray-1)}}[data-monster-role=nav] button:not([disabled]):hover,[data-monster-role=nav] button[data-monster-state=active],[data-monster-role=nav] button[data-monster-state=active]:not([disabled]):hover{border-bottom-style:var(--monster-border-style);border-color:var(--monster-bg-color-secondary-3);border-radius:var(--monster-border-radius);box-shadow:var(--monster-box-shadow-1);color:var(--monster-bg-color-secondary-3)}[data-monster-role=nav] button[disabled]{background-color:var(--monster-bg-color-primary-disabled-1);color:var(--monster-color-primary-disabled-1);cursor:not-allowed}[data-monster-role=nav] button[data-monster-role=switch]{align-self:center;border:0;order:2;touch-action:none}[data-monster-role=nav] button[data-monster-role=switch]:not([disabled]):hover{border-bottom-width:0}[data-monster-role=nav] button img{height:1.3rem;margin-left:.4rem;width:1.3rem}::slotted(:not([slot]):not(.active)){display:none}::slotted(*){align-self:center}::slotted([slot]){border-bottom-style:var(--monster-border-style);border-bottom-width:var(--monster-border-width);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);box-shadow:var(--monster-box-shadow-1)}::slotted([slot=start]){margin-right:.75rem;order:0}::slotted([slot=end]){margin-left:.75rem;order:3}[data-monster-role=nav] [data-monster-role=popper-nav] button:not([disabled]){border:0;justify-content:left;padding-left:15px;padding-right:15px;width:100%}[data-monster-role=nav] [data-monster-role=popper-nav] button:hover,[data-monster-role=nav] [data-monster-role=popper-nav] button[data-monster-state=active],[data-monster-role=nav] [data-monster-role=popper-nav] button[data-monster-state=active]:not([disabled]):hover{border:0}
|
23
|
+
:after,:before,:root{--monster-font-family:-apple-system,BlinkMacSystemFont,\"Quicksand\",\"Segoe UI\",\"Roboto\",\"Oxygen\",\"Ubuntu\",\"Cantarell\",\"Fira Sans\",\"Droid Sans\",\"Helvetica Neue\",Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";--monster-color-primary-1:var(--monster-color-gray-6);--monster-color-primary-2:var(--monster-color-gray-6);--monster-color-primary-3:var(--monster-color-gray-1);--monster-color-primary-4:var(--monster-color-gray-1);--monster-bg-color-primary-1:var(--monster-color-gray-1);--monster-bg-color-primary-2:var(--monster-color-gray-2);--monster-bg-color-primary-3:var(--monster-color-gray-3);--monster-bg-color-primary-4:var(--monster-color-gray-6);--monster-color-secondary-1:var(--monster-color-red-4);--monster-color-secondary-2:var(--monster-color-red-4);--monster-color-secondary-3:var(--monster-color-red-1);--monster-color-secondary-4:var(--monster-color-red-1);--monster-bg-color-secondary-1:var(--monster-color-gray-1);--monster-bg-color-secondary-2:var(--monster-color-red-2);--monster-bg-color-secondary-3:var(--monster-color-red-3);--monster-bg-color-secondary-4:var(--monster-color-red-6);--monster-color-tertiary-1:var(--monster-color-magenta-4);--monster-color-tertiary-2:var(--monster-color-magenta-4);--monster-color-tertiary-3:var(--monster-color-magenta-6);--monster-color-tertiary-4:var(--monster-color-magenta-1);--monster-bg-color-tertiary-1:var(--monster-color-gray-1);--monster-bg-color-tertiary-2:var(--monster-color-magenta-1);--monster-bg-color-tertiary-3:var(--monster-color-magenta-2);--monster-bg-color-tertiary-4:var(--monster-color-magenta-6);--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-4);--monster-color-destructive-3:var(--monster-color-red-6);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-4);--monster-bg-color-destructive-2:var(--monster-color-gray-1);--monster-bg-color-destructive-3:var(--monster-color-red-2);--monster-bg-color-destructive-4:var(--monster-color-red-5);--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-4);--monster-color-success-3:var(--monster-color-green-6);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-3);--monster-bg-color-success-2:var(--monster-color-gray-1);--monster-bg-color-success-3:var(--monster-color-green-2);--monster-bg-color-success-4:var(--monster-color-green-5);--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-4);--monster-color-warning-3:var(--monster-color-orange-6);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-3);--monster-bg-color-warning-2:var(--monster-color-gray-1);--monster-bg-color-warning-3:var(--monster-color-orange-2);--monster-bg-color-warning-4:var(--monster-color-orange-5);--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-4);--monster-color-error-3:var(--monster-color-red-6);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-4);--monster-bg-color-error-2:var(--monster-color-gray-1);--monster-bg-color-error-3:var(--monster-color-red-2);--monster-bg-color-error-4:var(--monster-color-red-5);--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6);--monster-color-primary-disabled-1:var(--monster-color-gray-3);--monster-color-primary-disabled-2:var(--monster-color-gray-1);--monster-color-primary-disabled-3:var(--monster-color-gray-4);--monster-color-primary-disabled-4:var(--monster-color-gray-4);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-1);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-6);--monster-color-gradient-1:#833ab4;--monster-color-gradient-2:#fd1d1d;--monster-color-gradient-3:#fcb045;--monster-box-shadow-1:none;--monster-box-shadow-2:-1px 1px 10px 1px hsla(0,0%,76%,.61);--monster-text-shadow:none;--monster-border-style:solid;--monster-border-width:2px;--monster-border-radius:0;--monster-popper-witharrrow-distance:-4px;--monster-z-index-default:0;--monster-z-index-outline:10;--monster-z-index-dropdown:200;--monster-z-index-dropdown-overlay:210;--monster-z-index-sticky:300;--monster-z-index-sticky-overlay:310;--monster-z-index-fixed:400;--monster-z-index-fixed-overlay:410;--monster-z-index-modal-backdrop:500;--monster-z-index-modal-backdrop-overlay:510;--monster-z-index-offcanvas:600;--monster-z-index-offcanvas-overlay:610;--monster-z-index-modal:700;--monster-z-index-modal-overlay:710;--monster-z-index-popover:800;--monster-z-index-popover-overlay:810;--monster-z-index-tooltip:800;--monster-z-index-tooltip-overlay:910;--monster-space-0:0;--monster-space-1:2px;--monster-space-2:4px;--monster-space-3:6px;--monster-space-4:10px;--monster-space-5:16px;--monster-space-6:26px;--monster-space-7:42px;--monster-breakpoint-0:480px;--monster-breakpoint-4:480px;--monster-breakpoint-7:768px;--monster-breakpoint-9:992px;--monster-breakpoint-12:1200px}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-1:var(--monster-color-gray-1);--monster-color-primary-2:var(--monster-color-gray-1);--monster-color-primary-3:var(--monster-color-gray-6);--monster-color-primary-4:var(--monster-color-gray-6);--monster-bg-color-primary-1:var(--monster-color-gray-6);--monster-bg-color-primary-2:var(--monster-color-gray-3);--monster-bg-color-primary-3:var(--monster-color-gray-2);--monster-bg-color-primary-4:var(--monster-color-gray-1);--monster-color-secondary-1:var(--monster-color-red-1);--monster-color-secondary-2:var(--monster-color-red-1);--monster-color-secondary-3:var(--monster-color-red-6);--monster-color-secondary-4:var(--monster-color-red-4);--monster-bg-color-secondary-1:var(--monster-color-gray-6);--monster-bg-color-secondary-2:var(--monster-color-red-3);--monster-bg-color-secondary-3:var(--monster-color-red-2);--monster-bg-color-secondary-4:var(--monster-color-red-1);--monster-color-tertiary-1:var(--monster-color-magenta-1);--monster-color-tertiary-2:var(--monster-color-magenta-6);--monster-color-tertiary-3:var(--monster-color-magenta-4);--monster-color-tertiary-4:var(--monster-color-magenta-4);--monster-bg-color-tertiary-1:var(--monster-color-gray-6);--monster-bg-color-tertiary-2:var(--monster-color-magenta-2);--monster-bg-color-tertiary-3:var(--monster-color-magenta-1);--monster-bg-color-tertiary-4:var(--monster-color-magenta-1);--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-3);--monster-color-destructive-3:var(--monster-color-red-4);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-5);--monster-bg-color-destructive-2:var(--monster-color-gray-6);--monster-bg-color-destructive-3:var(--monster-color-red-1);--monster-bg-color-destructive-4:var(--monster-color-red-4);--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-2);--monster-color-success-3:var(--monster-color-green-4);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-5);--monster-bg-color-success-2:var(--monster-color-gray-6);--monster-bg-color-success-3:var(--monster-color-green-1);--monster-bg-color-success-4:var(--monster-color-green-3);--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-3);--monster-color-warning-3:var(--monster-color-orange-4);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-5);--monster-bg-color-warning-2:var(--monster-color-gray-6);--monster-bg-color-warning-3:var(--monster-color-orange-1);--monster-bg-color-warning-4:var(--monster-color-orange-3);--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-3);--monster-color-error-3:var(--monster-color-red-4);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-5);--monster-bg-color-error-2:var(--monster-color-gray-6);--monster-bg-color-error-3:var(--monster-color-red-1);--monster-bg-color-error-4:var(--monster-color-red-4);--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6);--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-3);--monster-color-primary-disabled-4:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-6);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-1)}}.block{display:block}.inline{display:inline}.inline-block{display:inline-block}.grid{display:grid}.inline-grid{display:inline-grid}.flex{display:flex}.inline-flex{display:inline-flex}.hidden,.hide,.none{display:none}.visible{visibility:visible}.invisible{visibility:hidden}.monster-border-primary-1,.monster-border-primary-2,.monster-border-primary-3,.monster-border-primary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);border-shadow:var(--monster-box-shadow-1)}.monster-border-0{border-radius:0;border-style:none;border-width:0;border-shadow:none}.monster-border-primary-1{border-color:var(--monster-bg-color-primary-1)}.monster-border-primary-2{border-color:var(--monster-bg-color-primary-2)}.monster-border-primary-3{border-color:var(--monster-bg-color-primary-3)}.monster-border-primary-4{border-color:var(--monster-bg-color-primary-4)}.monster-border-secondary-1,.monster-border-secondary-2,.monster-border-secondary-3,.monster-border-secondary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);border-shadow:var(--monster-box-shadow-1)}.monster-border-secondary-1{border-color:var(--monster-bg-color-secondary-1)}.monster-border-secondary-2{border-color:var(--monster-bg-color-secondary-2)}.monster-border-secondary-3{border-color:var(--monster-bg-color-secondary-3)}.monster-border-secondary-4{border-color:var(--monster-bg-color-secondary-4)}.monster-border-tertiary-1,.monster-border-tertiary-2,.monster-border-tertiary-3,.monster-border-tertiary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);border-shadow:var(--monster-box-shadow-1)}.monster-border-tertiary-1{border-color:var(--monster-bg-color-tertiary-1)}.monster-border-tertiary-2{border-color:var(--monster-bg-color-tertiary-2)}.monster-border-tertiary-3{border-color:var(--monster-bg-color-tertiary-3)}.monster-border-tertiary-4{border-color:var(--monster-bg-color-tertiary-4)}div[data-monster-role=popper]{background:var(--monster-bg-color-primary-1);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;color:var(--monster-color-primary-1);display:none;padding:1.1em;z-index:var(--monster-z-index-modal)}[data-popper-arrow],[data-popper-arrow]:before{background:inherit;height:calc(max(var(--monster-popper-witharrrow-distance), -1*var(--monster-popper-witharrrow-distance))*2);position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1*var(--monster-popper-witharrrow-distance))*2)}[data-popper-arrow]{visibility:hidden}[data-popper-arrow]:before{box-sizing:border-box;content:\"\";transform:rotate(45deg);visibility:visible}div[data-popper-placement^=top]>[data-popper-arrow]{bottom:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width)/2)}div[data-popper-placement^=top]>[data-popper-arrow]:before{border-bottom:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-left:transparent;border-right:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-top:transparent}div[data-popper-placement^=bottom]>[data-popper-arrow]{top:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width))}div[data-popper-placement^=bottom]>[data-popper-arrow]:before{border-bottom:transparent;border-left:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-right:transparent;border-top:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4)}div[data-popper-placement^=left]>[data-popper-arrow]{right:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width))}div[data-popper-placement^=left]>[data-popper-arrow]:before{border-bottom:transparent;border-left:transparent;border-right:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-top:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4)}div[data-popper-placement^=right]>[data-popper-arrow]{left:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width)/2)}div[data-popper-placement^=right]>[data-popper-arrow]:before{border-bottom:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-left:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-right:transparent;border-top:transparent}[data-monster-role=control]{outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}.monster-badge-primary{padding:.25em .4em}.monster-badge-primary,.monster-badge-primary-pill{background-color:var(--monster-bg-color-primary-4);border-radius:.25rem;color:var(--monster-color-primary-4);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-primary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-secondary{padding:.25em .4em}.monster-badge-secondary,.monster-badge-secondary-pill{background-color:var(--monster-bg-color-secondary-3);border-radius:.25rem;color:var(--monster-color-secondary-3);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-secondary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-tertiary{padding:.25em .4em}.monster-badge-tertiary,.monster-badge-tertiary-pill{background-color:var(--monster-bg-color-tertiary-3);border-radius:.25rem;color:var(--monster-color-tertiary-3);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-tertiary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-destructive{padding:.25em .4em}.monster-badge-destructive,.monster-badge-destructive-pill{background-color:var(--monster-bg-color-destructive-1);border-radius:.25rem;color:var(--monster-color-destructive-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-destructive-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-success{padding:.25em .4em}.monster-badge-success,.monster-badge-success-pill{background-color:var(--monster-bg-color-success-1);border-radius:.25rem;color:var(--monster-color-success-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-success-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-warning{padding:.25em .4em}.monster-badge-warning,.monster-badge-warning-pill{background-color:var(--monster-bg-color-warning-1);border-radius:.25rem;color:var(--monster-color-warning-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-warning-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-error{padding:.25em .4em}.monster-badge-error,.monster-badge-error-pill{background-color:var(--monster-bg-color-error-1);border-radius:.25rem;color:var(--monster-color-error-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-error-pill{border-radius:10rem;padding:.25em .6em}[data-monster-role=nav] button.hidden{display:none}nav[data-monster-role=nav]{align-items:flex-end;border-bottom-style:var(--monster-border-style);border-bottom-width:thin;border-color:var(--monster-bg-color-primary-2);border-radius:var(--monster-border-radius);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;display:flex;flex-direction:row;flex-wrap:nowrap;margin-bottom:.75rem;overflow:hidden}[data-monster-role=nav] button .remove-tab{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor'%3E%3Cpath d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E\");background-position:100% 100%;background-repeat:no-repeat;background-size:16px;flex-wrap:nowrap;height:16px;min-height:16px;order:2;width:16px}[data-monster-role=nav] button span{display:flex;font-family:var(--monster-font-family);font-size:1rem;font-weight:400;line-height:1.4;white-space:pre}[data-monster-role=nav] button{align-content:center;align-items:center;align-self:stretch;background-color:var(--monster-color-gray-1);border:none;border-bottom:var(--monster-border-style);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);box-shadow:var(--monster-box-shadow-1);color:var(--monster-color-gray-6);cursor:pointer;display:flex;font-size:1rem;font-weight:400;justify-content:center;line-height:1.5;margin-right:.75rem;outline:none;padding:.375rem 0;text-align:center;text-decoration:none;transition:color .8s;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle}@media (prefers-color-scheme:dark){[data-monster-role=nav] button{background-color:var(--monster-color-gray-6);color:var(--monster-color-gray-1)}}[data-monster-role=nav] button:not([disabled]):hover,[data-monster-role=nav] button[data-monster-state=active],[data-monster-role=nav] button[data-monster-state=active]:not([disabled]):hover{border-bottom-style:var(--monster-border-style);border-color:var(--monster-bg-color-secondary-3);border-radius:var(--monster-border-radius);box-shadow:var(--monster-box-shadow-1);color:var(--monster-bg-color-secondary-3)}[data-monster-role=nav] button[disabled]{background-color:var(--monster-bg-color-primary-disabled-1);color:var(--monster-color-primary-disabled-1);cursor:not-allowed}[data-monster-role=nav] button[data-monster-role=switch]{align-self:center;border:0;order:2;touch-action:none}[data-monster-role=nav] button[data-monster-role=switch]:not([disabled]):hover{border-bottom-width:0}[data-monster-role=nav] button img{height:1.3rem;margin-left:.4rem;width:1.3rem}::slotted(:not([slot]):not(.active)){display:none}::slotted(*){align-self:center}::slotted([slot]){border-bottom-style:var(--monster-border-style);border-bottom-width:var(--monster-border-width);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);box-shadow:var(--monster-box-shadow-1)}::slotted([slot=start]){margin-right:.75rem;order:0}::slotted([slot=end]){margin-left:.75rem;order:3}[data-monster-role=nav] [data-monster-role=popper-nav] button:not([disabled]){border:0;justify-content:left;padding-left:15px;padding-right:15px;width:100%}[data-monster-role=nav] [data-monster-role=popper-nav] button:hover,[data-monster-role=nav] [data-monster-role=popper-nav] button[data-monster-state=active],[data-monster-role=nav] [data-monster-role=popper-nav] button[data-monster-state=active]:not([disabled]):hover{border:0}
|
24
24
|
}`, 0);
|
25
25
|
} catch (e) {
|
26
26
|
addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
|
@@ -225,6 +225,7 @@ class Tabs extends CustomElement {
|
|
225
225
|
|
226
226
|
classes: {
|
227
227
|
button: "monster-theme-primary-1",
|
228
|
+
popper: "monster-theme-primary-1",
|
228
229
|
},
|
229
230
|
|
230
231
|
popper: {
|
@@ -329,6 +330,10 @@ function initPopperSwitch() {
|
|
329
330
|
switchButton.setAttribute(ATTRIBUTE_ROLE, "switch");
|
330
331
|
switchButton.setAttribute("part", "switch");
|
331
332
|
switchButton.classList.add("hidden");
|
333
|
+
const classList = this.getOption("classes.button");
|
334
|
+
if (classList) {
|
335
|
+
switchButton.classList.add(classList);
|
336
|
+
}
|
332
337
|
switchButton.innerHTML =
|
333
338
|
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/></svg>';
|
334
339
|
this[navElementSymbol].prepend(switchButton);
|
@@ -505,7 +510,7 @@ function initPopper() {
|
|
505
510
|
* @private
|
506
511
|
* @param {HTMLElement} element
|
507
512
|
*/
|
508
|
-
function show(element) {
|
513
|
+
function show(element) {
|
509
514
|
if (!this.shadowRoot) {
|
510
515
|
throw new Error("no shadow-root is defined");
|
511
516
|
}
|
@@ -588,7 +593,7 @@ function show(element) {;
|
|
588
593
|
/**
|
589
594
|
* @private
|
590
595
|
*/
|
591
|
-
function initEventHandler() {
|
596
|
+
function initEventHandler() {
|
592
597
|
|
593
598
|
if (!this.shadowRoot) {
|
594
599
|
throw new Error("no shadow-root is defined");
|
@@ -1053,7 +1058,8 @@ function getTemplate() {
|
|
1053
1058
|
data-monster-attributes="data-monster-marker path:marker"
|
1054
1059
|
data-monster-insert="buttons path:buttons.standard">
|
1055
1060
|
<slot name="start" class="invisible"></slot>
|
1056
|
-
<div data-monster-role="popper" part="popper" tabindex="-1"
|
1061
|
+
<div data-monster-role="popper" part="popper" tabindex="-1"
|
1062
|
+
data-monster-attributes="class path:classes.popper">
|
1057
1063
|
<div data-popper-arrow></div>
|
1058
1064
|
|
1059
1065
|
|
@@ -16,7 +16,11 @@ import {
|
|
16
16
|
assembleMethodSymbol,
|
17
17
|
registerCustomElement,
|
18
18
|
} from "../../dom/customelement.mjs";
|
19
|
-
import {
|
19
|
+
import {
|
20
|
+
findTargetElementFromEvent,
|
21
|
+
fireCustomEvent,
|
22
|
+
fireEvent,
|
23
|
+
} from "../../dom/events.mjs";
|
20
24
|
import { Formatter } from "../../text/formatter.mjs";
|
21
25
|
import { isString } from "../../types/is.mjs";
|
22
26
|
import { Node } from "../../types/node.mjs";
|
@@ -204,7 +208,7 @@ class TreeSelect extends Select {
|
|
204
208
|
fireCustomEvent(this, "monster-options-set", {
|
205
209
|
options,
|
206
210
|
});
|
207
|
-
|
211
|
+
|
208
212
|
return this;
|
209
213
|
}
|
210
214
|
|
@@ -127,6 +127,7 @@ class Overlay extends CustomElement {
|
|
127
127
|
* @property {string} classes.overlay Css class to hide the overlay. This class is removed when the component is ready.
|
128
128
|
* @property {Object} features Feature definitions
|
129
129
|
* @property {boolean} features.escapeKey If true the overlay can be closed with the escape key
|
130
|
+
* @property {boolean} features.openButton If true the overlay can be opened with a button
|
130
131
|
*/
|
131
132
|
get defaults() {
|
132
133
|
return Object.assign({}, super.defaults, {
|
@@ -146,6 +147,7 @@ class Overlay extends CustomElement {
|
|
146
147
|
},
|
147
148
|
features: {
|
148
149
|
escapeKey: true,
|
150
|
+
openButton: true,
|
149
151
|
},
|
150
152
|
});
|
151
153
|
}
|
@@ -326,7 +328,8 @@ function getTemplate() {
|
|
326
328
|
data-monster-attributes="part path:host-overlay.name, data-monster-role path:host-container.overlay"></div>
|
327
329
|
</template>
|
328
330
|
|
329
|
-
<div data-monster-role="overlay-open" part="open"
|
331
|
+
<div data-monster-role="overlay-open" part="open"
|
332
|
+
data-monster-attributes="class path:features.openButton | if:visible:hidden"></div>
|
330
333
|
|
331
334
|
<div id="overlay" data-monster-role="overlay" part="overlay" data-monster-insert="host-overlay path:overlay"
|
332
335
|
data-monster-attributes="class path:classes.overlay">
|
@@ -88,7 +88,7 @@ class RestAPI extends Server {
|
|
88
88
|
},
|
89
89
|
responseCallback: undefined,
|
90
90
|
acceptedStatus: [200, 201],
|
91
|
-
url:
|
91
|
+
url: null,
|
92
92
|
mapping: {
|
93
93
|
transformer: undefined,
|
94
94
|
callbacks: [],
|
@@ -107,7 +107,7 @@ class RestAPI extends Server {
|
|
107
107
|
},
|
108
108
|
responseCallback: undefined,
|
109
109
|
acceptedStatus: [200],
|
110
|
-
url:
|
110
|
+
url: null,
|
111
111
|
mapping: {
|
112
112
|
transformer: undefined,
|
113
113
|
callbacks: [],
|
@@ -123,7 +123,6 @@ class RestAPI extends Server {
|
|
123
123
|
* @throws {Error} the data cannot be read
|
124
124
|
*/
|
125
125
|
read() {
|
126
|
-
|
127
126
|
let init = this.getOption("read.init");
|
128
127
|
if (!isObject(init)) init = {};
|
129
128
|
if (!init["method"]) init["method"] = "GET";
|
@@ -81,7 +81,7 @@ class Server extends Datasource {
|
|
81
81
|
*/
|
82
82
|
function doTransform(type, obj) {
|
83
83
|
const transformation = this.getOption(`${type}.mapping.transformer`);
|
84
|
-
if (transformation !== undefined) {
|
84
|
+
if (transformation !== undefined && transformation !== null) {
|
85
85
|
const pipe = new Pipe(transformation);
|
86
86
|
const callbacks = this.getOption(`${type}.mapping.callbacks`);
|
87
87
|
|
package/source/data/extend.mjs
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {isArray, isObject} from "../types/is.mjs";
|
9
|
-
import {typeOf} from "../types/typeof.mjs";
|
8
|
+
import { isArray, isObject } from "../types/is.mjs";
|
9
|
+
import { typeOf } from "../types/typeof.mjs";
|
10
10
|
|
11
|
-
export {extend};
|
11
|
+
export { extend };
|
12
12
|
|
13
13
|
/**
|
14
14
|
* Extend copies all enumerable own properties from one or
|
@@ -25,65 +25,65 @@ export {extend};
|
|
25
25
|
* @param args
|
26
26
|
*/
|
27
27
|
function extend(...args) {
|
28
|
-
|
29
|
-
|
28
|
+
let o;
|
29
|
+
let i;
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
if (typeof args !== "object" || args[0] === null) {
|
32
|
+
throw new Error(`unsupported argument ${JSON.stringify(args[0])}`);
|
33
|
+
}
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
for (i = 0; i < args.length; i++) {
|
36
|
+
const a = args[i];
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
if (!(isObject(a) || isArray(a))) {
|
39
|
+
throw new Error(`unsupported argument ${JSON.stringify(a)}`);
|
40
|
+
}
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
if (o === undefined) {
|
43
|
+
o = a;
|
44
|
+
continue;
|
45
|
+
}
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
for (const k in a) {
|
48
|
+
const v = a?.[k];
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
if (v === o?.[k]) {
|
51
|
+
continue;
|
52
|
+
}
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
if (isArray(o[k])) {
|
72
|
-
o[k] = [];
|
73
|
-
o[k].push(...v);
|
74
|
-
continue;
|
75
|
-
}
|
54
|
+
if ((isObject(v) && typeOf(v) === "object") || isArray(v)) {
|
55
|
+
if (o[k] === undefined) {
|
56
|
+
if (isArray(v)) {
|
57
|
+
o[k] = [];
|
58
|
+
} else {
|
59
|
+
o[k] = {};
|
60
|
+
}
|
61
|
+
} else {
|
62
|
+
if (typeOf(o[k]) !== typeOf(v)) {
|
63
|
+
throw new Error(
|
64
|
+
`type mismatch: ${JSON.stringify(o[k])}(${typeOf(
|
65
|
+
o[k],
|
66
|
+
)}) != ${JSON.stringify(v)}(${typeOf(v)})`,
|
67
|
+
);
|
68
|
+
}
|
69
|
+
}
|
76
70
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
}
|
83
|
-
o[k] = v;
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
71
|
+
if (isArray(o[k])) {
|
72
|
+
o[k] = [];
|
73
|
+
o[k].push(...v);
|
74
|
+
continue;
|
75
|
+
}
|
87
76
|
|
88
|
-
|
77
|
+
o[k] = extend(o[k], v);
|
78
|
+
} else {
|
79
|
+
if (isArray(o)) {
|
80
|
+
o.push(v);
|
81
|
+
continue;
|
82
|
+
}
|
83
|
+
o[k] = v;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
return o;
|
89
89
|
}
|
@@ -83,10 +83,12 @@ const WILDCARD = "*";
|
|
83
83
|
*/
|
84
84
|
class Pathfinder extends Base {
|
85
85
|
/**
|
86
|
-
*
|
87
|
-
*
|
88
|
-
* @
|
89
|
-
|
86
|
+
* Creates a new instance of the constructor.
|
87
|
+
*
|
88
|
+
* @param {object} object - The object parameter for the constructor.
|
89
|
+
*
|
90
|
+
* @throws {Error} Throws an error if the provided object parameter is a simple type.
|
91
|
+
*/
|
90
92
|
constructor(object) {
|
91
93
|
super();
|
92
94
|
|
package/source/dom/constants.mjs
CHANGED
@@ -19,6 +19,7 @@ export {
|
|
19
19
|
ATTRIBUTE_UPDATER_INSERT_REFERENCE,
|
20
20
|
ATTRIBUTE_UPDATER_REMOVE,
|
21
21
|
ATTRIBUTE_UPDATER_BIND,
|
22
|
+
ATTRIBUTE_UPDATER_BIND_TYPE,
|
22
23
|
ATTRIBUTE_TEMPLATE_PREFIX,
|
23
24
|
ATTRIBUTE_ROLE,
|
24
25
|
ATTRIBUTE_DISABLED,
|
@@ -199,6 +200,14 @@ const ATTRIBUTE_UPDATER_REMOVE = `${ATTRIBUTE_PREFIX}remove`;
|
|
199
200
|
*/
|
200
201
|
const ATTRIBUTE_UPDATER_BIND = `${ATTRIBUTE_PREFIX}bind`;
|
201
202
|
|
203
|
+
/**
|
204
|
+
* @memberOf Monster.DOM
|
205
|
+
* @type {string}
|
206
|
+
* @license AGPLv3
|
207
|
+
* @since 1.9.0
|
208
|
+
*/
|
209
|
+
const ATTRIBUTE_UPDATER_BIND_TYPE = `${ATTRIBUTE_UPDATER_BIND}-type`;
|
210
|
+
|
202
211
|
/**
|
203
212
|
* @memberOf Monster.DOM
|
204
213
|
* @type {string}
|
@@ -95,6 +95,12 @@ const attributeMutationObserverSymbol = Symbol(
|
|
95
95
|
"@schukai/monster/dom/@@mutationObserver",
|
96
96
|
);
|
97
97
|
|
98
|
+
/**
|
99
|
+
* @private
|
100
|
+
* @type {symbol}
|
101
|
+
*/
|
102
|
+
const updateCloneDataSymbol = Symbol("@schukai/monster/dom/@@updateCloneData");
|
103
|
+
|
98
104
|
/**
|
99
105
|
* @private
|
100
106
|
* @type {symbol}
|
@@ -465,7 +471,7 @@ class CustomElement extends HTMLElement {
|
|
465
471
|
* @return {*}
|
466
472
|
* @since 1.10.0
|
467
473
|
*/
|
468
|
-
getOption(path, defaultValue=undefined) {
|
474
|
+
getOption(path, defaultValue = undefined) {
|
469
475
|
let value;
|
470
476
|
|
471
477
|
try {
|
@@ -503,13 +509,10 @@ class CustomElement extends HTMLElement {
|
|
503
509
|
if (isString(options)) {
|
504
510
|
options = parseOptionsJSON.call(this, options);
|
505
511
|
}
|
506
|
-
// 2024-01-21: remove this.defaults, otherwise it will overwrite
|
512
|
+
// 2024-01-21: remove this.defaults, otherwise it will overwrite
|
507
513
|
// the current settings that have already been made.
|
508
514
|
// https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/136
|
509
|
-
extend(
|
510
|
-
this[internalSymbol].getSubject()["options"],
|
511
|
-
options,
|
512
|
-
);
|
515
|
+
extend(this[internalSymbol].getSubject()["options"], options);
|
513
516
|
|
514
517
|
return this;
|
515
518
|
}
|
@@ -583,11 +586,16 @@ class CustomElement extends HTMLElement {
|
|
583
586
|
} catch (e) {
|
584
587
|
nodeList = elements;
|
585
588
|
}
|
589
|
+
|
590
|
+
this[updateCloneDataSymbol] = clone(
|
591
|
+
this[internalSymbol].getRealSubject()["options"],
|
592
|
+
);
|
593
|
+
|
586
594
|
addObjectWithUpdaterToElement.call(
|
587
595
|
this,
|
588
596
|
nodeList,
|
589
597
|
customElementUpdaterLinkSymbol,
|
590
|
-
|
598
|
+
this[updateCloneDataSymbol],
|
591
599
|
);
|
592
600
|
|
593
601
|
// Attach a mutation observer to observe changes to the attributes of the element
|
@@ -596,6 +604,16 @@ class CustomElement extends HTMLElement {
|
|
596
604
|
return this;
|
597
605
|
}
|
598
606
|
|
607
|
+
/**
|
608
|
+
* You know what you are doing? This function is only for advanced users.
|
609
|
+
* The result is a clone of the internal data.
|
610
|
+
*
|
611
|
+
* @returns {*}
|
612
|
+
*/
|
613
|
+
getInternalUpdateCloneData() {
|
614
|
+
return clone(this[updateCloneDataSymbol]);
|
615
|
+
}
|
616
|
+
|
599
617
|
/**
|
600
618
|
* This method is called every time the element is inserted into the DOM. It checks if the custom element
|
601
619
|
* has already been initialized and if not, calls the assembleMethod to initialize it.
|
package/source/dom/updater.mjs
CHANGED
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
ATTRIBUTE_ERRORMESSAGE,
|
14
14
|
ATTRIBUTE_UPDATER_ATTRIBUTES,
|
15
15
|
ATTRIBUTE_UPDATER_BIND,
|
16
|
+
ATTRIBUTE_UPDATER_BIND_TYPE,
|
16
17
|
ATTRIBUTE_UPDATER_INSERT,
|
17
18
|
ATTRIBUTE_UPDATER_INSERT_REFERENCE,
|
18
19
|
ATTRIBUTE_UPDATER_REMOVE,
|
@@ -21,7 +22,7 @@ import {
|
|
21
22
|
} from "./constants.mjs";
|
22
23
|
|
23
24
|
import { Base } from "../types/base.mjs";
|
24
|
-
import { isArray, isInstance, isIterable } from "../types/is.mjs";
|
25
|
+
import { isArray, isString, isInstance, isIterable } from "../types/is.mjs";
|
25
26
|
import { Observer } from "../types/observer.mjs";
|
26
27
|
import { ProxyObserver } from "../types/proxyobserver.mjs";
|
27
28
|
import { validateArray, validateInstance } from "../types/validate.mjs";
|
@@ -311,7 +312,7 @@ function retrieveAndSetValue(element) {
|
|
311
312
|
throw new Error("the bind argument must start as a value with a path");
|
312
313
|
}
|
313
314
|
|
314
|
-
path = path.substring(5);
|
315
|
+
path = path.substring(5); // remove path: from the string
|
315
316
|
|
316
317
|
let value;
|
317
318
|
|
@@ -342,7 +343,7 @@ function retrieveAndSetValue(element) {
|
|
342
343
|
break;
|
343
344
|
}
|
344
345
|
|
345
|
-
// values from
|
346
|
+
// values from custom elements
|
346
347
|
} else if (
|
347
348
|
(element?.constructor?.prototype &&
|
348
349
|
!!Object.getOwnPropertyDescriptor(
|
@@ -356,6 +357,36 @@ function retrieveAndSetValue(element) {
|
|
356
357
|
throw new Error("unsupported object");
|
357
358
|
}
|
358
359
|
|
360
|
+
if (isString(value)) {
|
361
|
+
const type = element.getAttribute(ATTRIBUTE_UPDATER_BIND_TYPE);
|
362
|
+
switch (type) {
|
363
|
+
case "number":
|
364
|
+
case "int":
|
365
|
+
case "float":
|
366
|
+
case "integer":
|
367
|
+
value = Number(value);
|
368
|
+
if (isNaN(value)) {
|
369
|
+
value = 0;
|
370
|
+
}
|
371
|
+
break;
|
372
|
+
case "boolean":
|
373
|
+
case "bool":
|
374
|
+
case "checkbox":
|
375
|
+
value = value === "true" || value === "1" || value === "on";
|
376
|
+
break;
|
377
|
+
case "array":
|
378
|
+
case "list":
|
379
|
+
value = value.split(",");
|
380
|
+
break;
|
381
|
+
case "object":
|
382
|
+
case "json":
|
383
|
+
value = JSON.parse(value);
|
384
|
+
break;
|
385
|
+
default:
|
386
|
+
break;
|
387
|
+
}
|
388
|
+
}
|
389
|
+
|
359
390
|
const copy = clone(this[internalSymbol].subject.getRealSubject());
|
360
391
|
const pf = new Pathfinder(copy);
|
361
392
|
pf.setVia(path, value);
|
@@ -90,7 +90,7 @@ class Translations extends Base {
|
|
90
90
|
* The appropriate text for this number is then selected. If no suitable key is found, `defaultText` is taken.
|
91
91
|
*
|
92
92
|
* @param {string} key
|
93
|
-
* @param {integer|
|
93
|
+
* @param {integer|string} count
|
94
94
|
* @param {string|undefined} defaultText
|
95
95
|
* @return {string}
|
96
96
|
*/
|
package/source/monster.mjs
CHANGED
@@ -44,10 +44,10 @@ class NodeRecursiveIterator extends Base {
|
|
44
44
|
// iterator is a NodeList
|
45
45
|
if (isInstance(node, NodeList)) {
|
46
46
|
const children = node;
|
47
|
-
|
47
|
+
const n = new Node();
|
48
48
|
n.childNodes = children;
|
49
49
|
this[isNodeListSymbol] = true;
|
50
|
-
this[internalSymbol]
|
50
|
+
this[internalSymbol] = n;
|
51
51
|
return;
|
52
52
|
}
|
53
53
|
|
@@ -80,7 +80,6 @@ class NodeRecursiveIterator extends Base {
|
|
80
80
|
yield* new NodeRecursiveIterator(node);
|
81
81
|
}
|
82
82
|
}
|
83
|
-
|
84
83
|
};
|
85
84
|
|
86
85
|
/**
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED