@mintplayer/web-components 1.0.0 → 1.1.0
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/a11y/index.mjs +2 -56
- package/calendar/index.mjs +2 -363
- package/checkbox/index.mjs +4 -0
- package/checkbox/src/components/index.d.ts +2 -0
- package/checkbox/src/components/mp-checkbox.d.ts +69 -0
- package/checkbox/src/index.d.ts +2 -0
- package/chunks/color-C4VT0EL7.mjs +847 -0
- package/chunks/form-check.styles-jBlHetYX.mjs +151 -0
- package/chunks/live-announcer-CZDTKulf.mjs +58 -0
- package/chunks/mp-calendar.element-UC68iDbi.mjs +365 -0
- package/chunks/mp-checkbox-BokLL7BS.mjs +211 -0
- package/chunks/mp-datatable-CpAu8JJD.mjs +750 -0
- package/chunks/mp-pagination-BGxsawFL.mjs +326 -0
- package/chunks/mp-select-BDS1-YGn.mjs +254 -0
- package/chunks/mp-splitter-C8cGCmac.mjs +633 -0
- package/chunks/mp-tab-page-D1b4x-y2.mjs +414 -0
- package/chunks/mp-timepicker.element-BwEiwX92.mjs +428 -0
- package/chunks/mp-toggle-button-dLZNDUVz.mjs +534 -0
- package/chunks/mp-treeview-Bfq4_IVW.mjs +474 -0
- package/code-snippet/index.mjs +16 -13
- package/datatable/index.mjs +7 -0
- package/datatable/src/components/index.d.ts +2 -0
- package/datatable/src/components/mp-datatable.d.ts +156 -0
- package/datatable/src/index.d.ts +6 -0
- package/datatable/src/sort/compute-next-sort.d.ts +18 -0
- package/datatable/src/sort/index.d.ts +3 -0
- package/datatable/src/sort/sort-rows.d.ts +6 -0
- package/datatable/src/styles/datatable.styles.d.ts +2 -0
- package/datatable/src/styles/index.d.ts +1 -0
- package/datatable/src/types/column-def.d.ts +30 -0
- package/datatable/src/types/index.d.ts +1 -0
- package/datepicker/index.mjs +240 -0
- package/datepicker/src/index.d.ts +1 -0
- package/datepicker/src/mp-datepicker.element.d.ts +94 -0
- package/datepicker/src/mp-datepicker.element.template.d.ts +2 -0
- package/datetime-picker/index.mjs +427 -0
- package/datetime-picker/src/index.d.ts +1 -0
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +174 -0
- package/datetime-picker/src/mp-datetime-picker.element.template.d.ts +2 -0
- package/dock/index.mjs +2402 -0
- package/dock/src/components/index.d.ts +1 -0
- package/dock/src/components/mint-dock-manager.element.d.ts +313 -0
- package/dock/src/components/mint-dock-manager.element.template.d.ts +2 -0
- package/dock/src/index.d.ts +2 -0
- package/dock/src/types/dock-layout.d.ts +65 -0
- package/dock/src/types/index.d.ts +1 -0
- package/file-manager/index.mjs +1263 -0
- package/file-manager/src/components/index.d.ts +2 -0
- package/file-manager/src/components/mp-file-manager.d.ts +320 -0
- package/file-manager/src/index.d.ts +5 -0
- package/file-manager/src/styles/file-manager.styles.d.ts +2 -0
- package/file-manager/src/styles/index.d.ts +1 -0
- package/file-manager/src/types/file-system-node.d.ts +24 -0
- package/file-manager/src/types/index.d.ts +3 -0
- package/file-manager/src/types/messages.d.ts +43 -0
- package/multi-range/index.mjs +407 -0
- package/multi-range/src/index.d.ts +2 -0
- package/multi-range/src/mint-multi-range.element.d.ts +124 -0
- package/multi-range/src/mint-multi-range.element.template.d.ts +2 -0
- package/multi-range/src/types/multi-range-orientation.d.ts +1 -0
- package/otp-input/index.mjs +362 -0
- package/otp-input/src/index.d.ts +4 -0
- package/otp-input/src/mint-otp-input.element.d.ts +134 -0
- package/otp-input/src/mint-otp-input.element.template.d.ts +2 -0
- package/otp-input/src/types/otp-input-case.d.ts +1 -0
- package/otp-input/src/types/otp-input-size.d.ts +1 -0
- package/otp-input/src/types/otp-input-type.d.ts +1 -0
- package/overlay/index.mjs +260 -0
- package/overlay/src/index.d.ts +2 -0
- package/overlay/src/overlay-controller.d.ts +205 -0
- package/package.json +1 -1
- package/pagination/index.mjs +5 -0
- package/pagination/src/components/index.d.ts +2 -0
- package/pagination/src/components/mp-pagination.d.ts +95 -0
- package/pagination/src/index.d.ts +2 -0
- package/pagination/src/styles/index.d.ts +1 -0
- package/pagination/src/styles/pagination.styles.d.ts +2 -0
- package/query-builder/index.mjs +3720 -0
- package/query-builder/src/context.d.ts +14 -0
- package/query-builder/src/dnd/drag-controller.d.ts +69 -0
- package/query-builder/src/index.d.ts +23 -0
- package/query-builder/src/model/default-tree.d.ts +7 -0
- package/query-builder/src/model/editor.d.ts +15 -0
- package/query-builder/src/model/errors.d.ts +6 -0
- package/query-builder/src/model/expression.d.ts +22 -0
- package/query-builder/src/model/field-def.d.ts +17 -0
- package/query-builder/src/model/messages.d.ts +17 -0
- package/query-builder/src/model/operator-overrides.d.ts +21 -0
- package/query-builder/src/model/operators.d.ts +8 -0
- package/query-builder/src/model/saved-query.d.ts +6 -0
- package/query-builder/src/model/sort.d.ts +9 -0
- package/query-builder/src/model/tree-ops.d.ts +56 -0
- package/query-builder/src/mp-query-builder.element.d.ts +158 -0
- package/query-builder/src/mp-query-builder.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-condition.element.d.ts +44 -0
- package/query-builder/src/mp-query-condition.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-group.element.d.ts +52 -0
- package/query-builder/src/mp-query-group.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-subquery.element.d.ts +37 -0
- package/query-builder/src/mp-query-subquery.element.template.d.ts +2 -0
- package/query-builder/src/preview/render-expression.d.ts +23 -0
- package/query-builder/src/value-editors/builtin-editors.d.ts +6 -0
- package/query-builder/src/visitor/visit-tree.d.ts +29 -0
- package/query-builder/src/visitor/visitor-types.d.ts +15 -0
- package/radio/index.mjs +162 -0
- package/radio/src/components/index.d.ts +2 -0
- package/radio/src/components/mp-radio.d.ts +63 -0
- package/radio/src/index.d.ts +2 -0
- package/ribbon/index.mjs +3151 -0
- package/ribbon/src/index.d.ts +10 -0
- package/ribbon/src/items/index.d.ts +15 -0
- package/ribbon/src/items/mp-ribbon-button.element.d.ts +10 -0
- package/ribbon/src/items/mp-ribbon-checkbox.element.d.ts +11 -0
- package/ribbon/src/items/mp-ribbon-color-picker.element.d.ts +12 -0
- package/ribbon/src/items/mp-ribbon-combobox.element.d.ts +19 -0
- package/ribbon/src/items/mp-ribbon-dropdown-button.element.d.ts +16 -0
- package/ribbon/src/items/mp-ribbon-gallery-item.element.d.ts +15 -0
- package/ribbon/src/items/mp-ribbon-gallery.element.d.ts +11 -0
- package/ribbon/src/items/mp-ribbon-group-button.element.d.ts +18 -0
- package/ribbon/src/items/mp-ribbon-item-base.d.ts +68 -0
- package/ribbon/src/items/mp-ribbon-menu-item.element.d.ts +13 -0
- package/ribbon/src/items/mp-ribbon-menu-separator.element.d.ts +6 -0
- package/ribbon/src/items/mp-ribbon-split-button.element.d.ts +23 -0
- package/ribbon/src/items/mp-ribbon-template-item.element.d.ts +12 -0
- package/ribbon/src/items/mp-ribbon-toggle-button.element.d.ts +12 -0
- package/ribbon/src/mp-quick-access-toolbar.element.d.ts +35 -0
- package/ribbon/src/mp-ribbon-contextual-tab-set.element.d.ts +18 -0
- package/ribbon/src/mp-ribbon-group.element.d.ts +59 -0
- package/ribbon/src/mp-ribbon-tab.element.d.ts +72 -0
- package/ribbon/src/mp-ribbon.element.d.ts +211 -0
- package/ribbon/src/types/ribbon.types.d.ts +4 -0
- package/scheduler/index.mjs +3567 -0
- package/scheduler/src/components/mp-scheduler.d.ts +238 -0
- package/scheduler/src/drag/drag-manager.d.ts +90 -0
- package/scheduler/src/drag/drag-preview.d.ts +42 -0
- package/scheduler/src/drag/drag-state-machine.d.ts +102 -0
- package/scheduler/src/drag/drag-types.d.ts +104 -0
- package/scheduler/src/drag/index.d.ts +4 -0
- package/scheduler/src/events/event-types.d.ts +58 -0
- package/scheduler/src/events/index.d.ts +2 -0
- package/scheduler/src/events/scheduler-event-emitter.d.ts +52 -0
- package/scheduler/src/index.d.ts +6 -0
- package/scheduler/src/input/index.d.ts +2 -0
- package/scheduler/src/input/input-handler.d.ts +105 -0
- package/scheduler/src/input/pointer-event.d.ts +39 -0
- package/scheduler/src/state/scheduler-state.d.ts +189 -0
- package/scheduler/src/styles/scheduler.styles.d.ts +2 -0
- package/scheduler/src/views/base-view.d.ts +87 -0
- package/scheduler/src/views/day-view.d.ts +25 -0
- package/scheduler/src/views/index.d.ts +6 -0
- package/scheduler/src/views/month-view.d.ts +27 -0
- package/scheduler/src/views/timeline-view.d.ts +23 -0
- package/scheduler/src/views/week-view.d.ts +28 -0
- package/scheduler/src/views/year-view.d.ts +25 -0
- package/scheduler-core/index.mjs +174 -0
- package/scheduler-core/src/index.d.ts +3 -0
- package/scheduler-core/src/models/drag-state.d.ts +43 -0
- package/scheduler-core/src/models/event.d.ts +111 -0
- package/scheduler-core/src/models/events.d.ts +108 -0
- package/scheduler-core/src/models/index.d.ts +7 -0
- package/scheduler-core/src/models/options.d.ts +88 -0
- package/scheduler-core/src/models/resource.d.ts +58 -0
- package/scheduler-core/src/models/time-slot.d.ts +31 -0
- package/scheduler-core/src/models/types.d.ts +20 -0
- package/scheduler-core/src/services/date.service.d.ts +140 -0
- package/scheduler-core/src/services/index.d.ts +4 -0
- package/scheduler-core/src/services/position.service.d.ts +35 -0
- package/scheduler-core/src/services/resource.service.d.ts +83 -0
- package/scheduler-core/src/services/timeline.service.d.ts +103 -0
- package/scheduler-core/src/utils/color.d.ts +24 -0
- package/scheduler-core/src/utils/dom.d.ts +54 -0
- package/scheduler-core/src/utils/id.d.ts +16 -0
- package/scheduler-core/src/utils/index.d.ts +3 -0
- package/select/index.mjs +4 -0
- package/select/src/components/index.d.ts +2 -0
- package/select/src/components/mp-select.d.ts +82 -0
- package/select/src/index.d.ts +2 -0
- package/splitter/index.mjs +10 -0
- package/splitter/src/components/index.d.ts +2 -0
- package/splitter/src/components/mp-splitter.d.ts +109 -0
- package/splitter/src/index.d.ts +11 -0
- package/splitter/src/input/index.d.ts +4 -0
- package/splitter/src/input/input-handler.d.ts +36 -0
- package/splitter/src/input/pointer-event.d.ts +9 -0
- package/splitter/src/managers/index.d.ts +2 -0
- package/splitter/src/managers/resize-manager.d.ts +13 -0
- package/splitter/src/state/index.d.ts +2 -0
- package/splitter/src/state/splitter-state.d.ts +24 -0
- package/splitter/src/styles/index.d.ts +1 -0
- package/splitter/src/styles/splitter.styles.d.ts +2 -0
- package/splitter/src/types/direction.d.ts +1 -0
- package/splitter/src/types/index.d.ts +5 -0
- package/splitter/src/types/panel-info.d.ts +6 -0
- package/splitter/src/types/point.d.ts +4 -0
- package/splitter/src/types/resize-operation.d.ts +13 -0
- package/tab-control/index.mjs +6 -0
- package/tab-control/src/components/index.d.ts +3 -0
- package/tab-control/src/components/mp-tab-control.d.ts +50 -0
- package/tab-control/src/components/mp-tab-page.d.ts +35 -0
- package/tab-control/src/index.d.ts +4 -0
- package/tab-control/src/styles/index.d.ts +1 -0
- package/tab-control/src/styles/tab-control.styles.d.ts +2 -0
- package/tab-control/src/types/index.d.ts +1 -0
- package/tab-control/src/types/tabs-position.d.ts +1 -0
- package/tile-manager/index.mjs +867 -0
- package/tile-manager/src/components/index.d.ts +2 -0
- package/tile-manager/src/components/mint-tile-manager.element.d.ts +204 -0
- package/tile-manager/src/components/mint-tile-manager.element.template.d.ts +2 -0
- package/tile-manager/src/index.d.ts +4 -0
- package/tile-manager/src/types/grid-rect.d.ts +12 -0
- package/tile-manager/src/types/index.d.ts +3 -0
- package/tile-manager/src/types/tile-layout-snapshot.d.ts +15 -0
- package/tile-manager/src/types/tile-position.d.ts +10 -0
- package/tile-manager/src/utils/index.d.ts +1 -0
- package/tile-manager/src/utils/pack.d.ts +24 -0
- package/timepicker/index.mjs +5 -0
- package/timepicker/src/index.d.ts +2 -0
- package/timepicker/src/mp-time-list.element.d.ts +76 -0
- package/timepicker/src/mp-time-list.element.template.d.ts +2 -0
- package/timepicker/src/mp-timepicker.element.d.ts +87 -0
- package/timepicker/src/mp-timepicker.element.template.d.ts +2 -0
- package/toggle-button/index.mjs +5 -0
- package/toggle-button/src/components/index.d.ts +2 -0
- package/toggle-button/src/components/mp-toggle-button.d.ts +50 -0
- package/toggle-button/src/index.d.ts +3 -0
- package/toggle-button/src/styles/index.d.ts +1 -0
- package/toggle-button/src/styles/toggle-button.styles.d.ts +2 -0
- package/treeview/index.mjs +5 -0
- package/treeview/src/components/index.d.ts +2 -0
- package/treeview/src/components/mp-treeview.d.ts +113 -0
- package/treeview/src/index.d.ts +4 -0
- package/treeview/src/styles/index.d.ts +1 -0
- package/treeview/src/styles/treeview.styles.d.ts +2 -0
- package/treeview/src/types/index.d.ts +1 -0
- package/treeview/src/types/tree-node.d.ts +14 -0
- package/custom-elements.json +0 -1774
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { unsafeCSS as I, LitElement as y, html as d, nothing as n } from "lit";
|
|
2
|
+
import { repeat as C } from "lit/directives/repeat.js";
|
|
3
|
+
import { unsafeHTML as b } from "lit/directives/unsafe-html.js";
|
|
4
|
+
const $ = I(`:host {
|
|
5
|
+
display: block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
--mp-treeview-indent: 20px;
|
|
8
|
+
--mp-treeview-row-padding-y: 0.5rem;
|
|
9
|
+
--mp-treeview-row-padding-x: 0.75rem;
|
|
10
|
+
--mp-treeview-row-hover-bg: var(--bs-list-group-action-hover-bg, rgba(0, 0, 0, 0.04));
|
|
11
|
+
--mp-treeview-row-selected-bg: var(--bs-list-group-active-bg, var(--bs-primary));
|
|
12
|
+
--mp-treeview-row-selected-color: var(--bs-list-group-active-color, #fff);
|
|
13
|
+
--mp-treeview-row-focus-outline: 2px solid var(--bs-primary, #1389fd);
|
|
14
|
+
--mp-treeview-chevron-color: var(--bs-secondary-color, #6c757d);
|
|
15
|
+
--mp-treeview-border-color: var(--bs-list-group-border-color, var(--bs-border-color, rgba(0, 0, 0, 0.125)));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
* {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
ul {
|
|
23
|
+
list-style: none;
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.treeview-root {
|
|
29
|
+
border: 1px solid var(--mp-treeview-border-color);
|
|
30
|
+
border-radius: var(--bs-list-group-border-radius, 0.375rem);
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([hide-borders]) .treeview-root {
|
|
35
|
+
border: 0;
|
|
36
|
+
border-radius: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.treeview-row {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 0.5rem;
|
|
43
|
+
padding: var(--mp-treeview-row-padding-y) var(--mp-treeview-row-padding-x);
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
user-select: none;
|
|
46
|
+
border-top: 1px solid var(--mp-treeview-border-color);
|
|
47
|
+
background-color: transparent;
|
|
48
|
+
color: inherit;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([hide-borders]) .treeview-row {
|
|
52
|
+
border-top: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.treeview-row:first-child {
|
|
56
|
+
border-top: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.treeview-row:hover {
|
|
60
|
+
background-color: var(--mp-treeview-row-hover-bg);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.treeview-row[data-selected=true] {
|
|
64
|
+
background-color: var(--mp-treeview-row-selected-bg);
|
|
65
|
+
color: var(--mp-treeview-row-selected-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.treeview-row:focus {
|
|
69
|
+
outline: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.treeview-row:focus-visible {
|
|
73
|
+
outline: var(--mp-treeview-row-focus-outline);
|
|
74
|
+
outline-offset: -2px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.treeview-chevron {
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
width: 1rem;
|
|
82
|
+
height: 1rem;
|
|
83
|
+
flex: 0 0 auto;
|
|
84
|
+
color: var(--mp-treeview-chevron-color);
|
|
85
|
+
transition: transform 0.15s ease-in-out;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.treeview-chevron[data-expanded=true] {
|
|
89
|
+
transform: rotate(90deg);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.treeview-chevron.invisible {
|
|
93
|
+
visibility: hidden;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.treeview-chevron svg {
|
|
97
|
+
width: 0.75rem;
|
|
98
|
+
height: 0.75rem;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.treeview-chevron.loading svg {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.treeview-spinner {
|
|
106
|
+
display: inline-block;
|
|
107
|
+
width: 0.75rem;
|
|
108
|
+
height: 0.75rem;
|
|
109
|
+
border-radius: 50%;
|
|
110
|
+
border: 1.5px solid currentColor;
|
|
111
|
+
border-top-color: transparent;
|
|
112
|
+
animation: mp-treeview-spin 0.8s linear infinite;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@keyframes mp-treeview-spin {
|
|
116
|
+
to {
|
|
117
|
+
transform: rotate(360deg);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
.treeview-row[data-error=true] .treeview-chevron::after {
|
|
121
|
+
content: "!";
|
|
122
|
+
color: var(--bs-danger, #dc3545);
|
|
123
|
+
margin-left: 0.25rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.treeview-icon {
|
|
127
|
+
display: inline-flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
width: 1rem;
|
|
131
|
+
height: 1rem;
|
|
132
|
+
flex: 0 0 auto;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.treeview-icon svg {
|
|
136
|
+
width: 1rem;
|
|
137
|
+
height: 1rem;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.treeview-label {
|
|
141
|
+
flex: 1 1 auto;
|
|
142
|
+
white-space: nowrap;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
text-overflow: ellipsis;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.treeview-body {
|
|
148
|
+
flex: 1 1 auto;
|
|
149
|
+
min-width: 0;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@media (prefers-reduced-motion: reduce) {
|
|
153
|
+
.treeview-chevron {
|
|
154
|
+
transition: none !important;
|
|
155
|
+
}
|
|
156
|
+
}`), S = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>';
|
|
157
|
+
let E = 0;
|
|
158
|
+
class R extends y {
|
|
159
|
+
constructor() {
|
|
160
|
+
super(...arguments), this.instanceId = `mp-treeview-${++E}`, this._items = [], this._expandedIds = /* @__PURE__ */ new Set(), this._selectedIds = /* @__PURE__ */ new Set(), this._selectionMode = "single", this._hideBorders = !1, this._loadingIds = /* @__PURE__ */ new Set(), this._errorIds = /* @__PURE__ */ new Map(), this._focusedId = null, this._visibleOrder = [], this._byId = /* @__PURE__ */ new Map(), this._parentById = /* @__PURE__ */ new Map();
|
|
161
|
+
}
|
|
162
|
+
static {
|
|
163
|
+
this.styles = [$];
|
|
164
|
+
}
|
|
165
|
+
static get observedAttributes() {
|
|
166
|
+
return [
|
|
167
|
+
...super.observedAttributes ?? [],
|
|
168
|
+
"selection-mode",
|
|
169
|
+
"hide-borders"
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
get items() {
|
|
173
|
+
return this._items;
|
|
174
|
+
}
|
|
175
|
+
set items(e) {
|
|
176
|
+
this._items = Array.isArray(e) ? e : [], this.rebuildIndex(), this.syncFocusAfterUpdate(), this.requestUpdate();
|
|
177
|
+
}
|
|
178
|
+
rebuildIndex() {
|
|
179
|
+
this._byId.clear(), this._parentById.clear();
|
|
180
|
+
const e = (t, s) => {
|
|
181
|
+
for (const i of t)
|
|
182
|
+
this._byId.set(i.id, i), this._parentById.set(i.id, s), i.children && i.children.length > 0 && e(i.children, i);
|
|
183
|
+
};
|
|
184
|
+
e(this._items, null);
|
|
185
|
+
}
|
|
186
|
+
get expandedIds() {
|
|
187
|
+
return [...this._expandedIds];
|
|
188
|
+
}
|
|
189
|
+
set expandedIds(e) {
|
|
190
|
+
this._expandedIds = new Set(e ?? []), this.requestUpdate();
|
|
191
|
+
}
|
|
192
|
+
get selectedIds() {
|
|
193
|
+
return [...this._selectedIds];
|
|
194
|
+
}
|
|
195
|
+
set selectedIds(e) {
|
|
196
|
+
this._selectedIds = new Set(e ?? []), this.requestUpdate();
|
|
197
|
+
}
|
|
198
|
+
get selectionMode() {
|
|
199
|
+
return this._selectionMode;
|
|
200
|
+
}
|
|
201
|
+
set selectionMode(e) {
|
|
202
|
+
if (this._selectionMode = e, e === "none")
|
|
203
|
+
this._selectedIds.clear();
|
|
204
|
+
else if (e === "single" && this._selectedIds.size > 1) {
|
|
205
|
+
const t = this._selectedIds.values().next().value;
|
|
206
|
+
this._selectedIds = new Set(t ? [t] : []);
|
|
207
|
+
}
|
|
208
|
+
this.requestUpdate();
|
|
209
|
+
}
|
|
210
|
+
get hideBorders() {
|
|
211
|
+
return this._hideBorders;
|
|
212
|
+
}
|
|
213
|
+
set hideBorders(e) {
|
|
214
|
+
this._hideBorders = !!e, this.toggleAttribute("hide-borders", this._hideBorders), this.requestUpdate();
|
|
215
|
+
}
|
|
216
|
+
get iconResolver() {
|
|
217
|
+
return this._iconResolver;
|
|
218
|
+
}
|
|
219
|
+
set iconResolver(e) {
|
|
220
|
+
this._iconResolver = e, this.requestUpdate();
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Per-node DOM renderer. When set, the WC calls this for each node's body
|
|
224
|
+
* (chevron stays). The returned Node replaces the default icon+label.
|
|
225
|
+
* Set by Angular wrapper to bridge `*bsTreeviewNode` templates into the
|
|
226
|
+
* shadow DOM via EmbeddedViewRef-managed nodes.
|
|
227
|
+
*/
|
|
228
|
+
get nodeRenderer() {
|
|
229
|
+
return this._nodeRenderer;
|
|
230
|
+
}
|
|
231
|
+
set nodeRenderer(e) {
|
|
232
|
+
this._nodeRenderer = e, this.requestUpdate();
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Async children loader. Invoked once per node when a `lazy` (or
|
|
236
|
+
* children-less) node is first expanded. While the promise is in flight
|
|
237
|
+
* the chevron is replaced by a spinner; on rejection an error indicator
|
|
238
|
+
* is shown and the node can be re-expanded to retry.
|
|
239
|
+
*/
|
|
240
|
+
get loadChildren() {
|
|
241
|
+
return this._loadChildren;
|
|
242
|
+
}
|
|
243
|
+
set loadChildren(e) {
|
|
244
|
+
this._loadChildren = e;
|
|
245
|
+
}
|
|
246
|
+
attributeChangedCallback(e, t, s) {
|
|
247
|
+
if (super.attributeChangedCallback(e, t, s), e === "selection-mode") {
|
|
248
|
+
const i = s ?? "single";
|
|
249
|
+
(i === "none" || i === "single" || i === "multiple") && (this.selectionMode = i);
|
|
250
|
+
} else e === "hide-borders" && (this._hideBorders = s !== null, this.requestUpdate());
|
|
251
|
+
}
|
|
252
|
+
connectedCallback() {
|
|
253
|
+
super.connectedCallback(), this.hasAttribute("role") || this.setAttribute("role", "tree");
|
|
254
|
+
}
|
|
255
|
+
render() {
|
|
256
|
+
return this._visibleOrder = this.computeVisibleOrder(this._items), this._focusedId === null && this._visibleOrder.length > 0 && (this._focusedId = this._visibleOrder[0].id), d`
|
|
257
|
+
<div class="treeview-root">
|
|
258
|
+
<ul role="presentation">
|
|
259
|
+
${this.renderNodes(this._items, 1)}
|
|
260
|
+
</ul>
|
|
261
|
+
</div>
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
renderNodes(e, t) {
|
|
265
|
+
return d`
|
|
266
|
+
${C(
|
|
267
|
+
e,
|
|
268
|
+
(s) => s.id,
|
|
269
|
+
(s, i) => this.renderNode(s, t, i, e.length)
|
|
270
|
+
)}
|
|
271
|
+
`;
|
|
272
|
+
}
|
|
273
|
+
renderNode(e, t, s, i) {
|
|
274
|
+
const r = !!(e.children && e.children.length > 0), c = !!e.lazy && !r, u = r || c, l = this._loadingIds.has(e.id), v = this._errorIds.get(e.id), a = this._expandedIds.has(e.id), p = this._selectedIds.has(e.id), f = this._focusedId === e.id, m = f ? 0 : -1, w = e.iconKey && this._iconResolver ? this._iconResolver(e.iconKey, e) : void 0, _ = (t - 1) * 20, x = `${this.instanceId}-row-${e.id}`, g = this._nodeRenderer ? this._nodeRenderer(e, {
|
|
275
|
+
level: t,
|
|
276
|
+
expanded: a,
|
|
277
|
+
selected: p,
|
|
278
|
+
focused: f,
|
|
279
|
+
hasChildren: u
|
|
280
|
+
}) : void 0;
|
|
281
|
+
return d`
|
|
282
|
+
<li role="none">
|
|
283
|
+
<div
|
|
284
|
+
id=${x}
|
|
285
|
+
class="treeview-row"
|
|
286
|
+
role="treeitem"
|
|
287
|
+
data-node-id=${e.id}
|
|
288
|
+
data-selected=${p ? "true" : "false"}
|
|
289
|
+
data-loading=${l ? "true" : "false"}
|
|
290
|
+
data-error=${v ? "true" : "false"}
|
|
291
|
+
aria-level=${t}
|
|
292
|
+
aria-setsize=${i}
|
|
293
|
+
aria-posinset=${s + 1}
|
|
294
|
+
aria-expanded=${u ? a ? "true" : "false" : n}
|
|
295
|
+
aria-busy=${l ? "true" : n}
|
|
296
|
+
aria-selected=${this._selectionMode !== "none" ? p ? "true" : "false" : n}
|
|
297
|
+
tabindex=${m}
|
|
298
|
+
style=${`padding-left:${_ + 12}px`}
|
|
299
|
+
@click=${(o) => this.onRowClick(e, o)}
|
|
300
|
+
@keydown=${(o) => this.onRowKeydown(e, o)}
|
|
301
|
+
title=${v ?? n}
|
|
302
|
+
>
|
|
303
|
+
<span
|
|
304
|
+
class=${`treeview-chevron${u ? "" : " invisible"}${l ? " loading" : ""}`}
|
|
305
|
+
data-expanded=${a ? "true" : "false"}
|
|
306
|
+
@click=${(o) => this.onChevronClick(e, o)}
|
|
307
|
+
aria-hidden="true"
|
|
308
|
+
>${l ? d`<span class="treeview-spinner" aria-hidden="true"></span>` : b(S)}</span>
|
|
309
|
+
${g ? d`<span class="treeview-body">${g}</span>` : d`
|
|
310
|
+
${w ? d`<span class="treeview-icon" aria-hidden="true">${b(w)}</span>` : n}
|
|
311
|
+
<span class="treeview-label">${e.label}</span>
|
|
312
|
+
`}
|
|
313
|
+
</div>
|
|
314
|
+
${r && a ? d`<ul role="group">${this.renderNodes(e.children, t + 1)}</ul>` : n}
|
|
315
|
+
</li>
|
|
316
|
+
`;
|
|
317
|
+
}
|
|
318
|
+
computeVisibleOrder(e) {
|
|
319
|
+
const t = [], s = (i) => {
|
|
320
|
+
for (const r of i)
|
|
321
|
+
t.push(r), r.children && r.children.length > 0 && this._expandedIds.has(r.id) && s(r.children);
|
|
322
|
+
};
|
|
323
|
+
return s(e), t;
|
|
324
|
+
}
|
|
325
|
+
syncFocusAfterUpdate() {
|
|
326
|
+
this._focusedId !== null && !this._byId.has(this._focusedId) && (this._focusedId = null);
|
|
327
|
+
}
|
|
328
|
+
/** O(1) lookup against the precomputed index. */
|
|
329
|
+
findNode(e, t) {
|
|
330
|
+
return this._byId.get(t) ?? null;
|
|
331
|
+
}
|
|
332
|
+
/** O(1) lookup against the precomputed parent map. */
|
|
333
|
+
findParent(e, t) {
|
|
334
|
+
return this._parentById.get(t) ?? null;
|
|
335
|
+
}
|
|
336
|
+
onRowClick(e, t) {
|
|
337
|
+
t.stopPropagation(), this.focusNode(e.id), this.toggleSelection(e, t.ctrlKey || t.metaKey), e.children && e.children.length > 0 && this.toggleExpansion(e);
|
|
338
|
+
}
|
|
339
|
+
onChevronClick(e, t) {
|
|
340
|
+
!e.children || e.children.length === 0 || (t.stopPropagation(), this.focusNode(e.id), this.toggleExpansion(e));
|
|
341
|
+
}
|
|
342
|
+
onRowKeydown(e, t) {
|
|
343
|
+
const s = !!(e.children && e.children.length > 0), i = this._expandedIds.has(e.id);
|
|
344
|
+
switch (t.key) {
|
|
345
|
+
case "ArrowDown": {
|
|
346
|
+
t.preventDefault(), this.focusRelative(e, 1);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
case "ArrowUp": {
|
|
350
|
+
t.preventDefault(), this.focusRelative(e, -1);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
case "ArrowRight": {
|
|
354
|
+
t.preventDefault(), (s || e.lazy) && !i ? this.expand(e) : s && i && this.focusNode(e.children[0].id);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
case "ArrowLeft": {
|
|
358
|
+
if (t.preventDefault(), (s || e.lazy) && i)
|
|
359
|
+
this.collapse(e);
|
|
360
|
+
else {
|
|
361
|
+
const r = this.findParent(this._items, e.id);
|
|
362
|
+
r && this.focusNode(r.id);
|
|
363
|
+
}
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
case "Home": {
|
|
367
|
+
t.preventDefault(), this._visibleOrder.length > 0 && this.focusNode(this._visibleOrder[0].id);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
case "End": {
|
|
371
|
+
t.preventDefault(), this._visibleOrder.length > 0 && this.focusNode(this._visibleOrder[this._visibleOrder.length - 1].id);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
case "Enter": {
|
|
375
|
+
t.preventDefault(), this.toggleSelection(e, !1), (s || e.lazy) && this.toggleExpansion(e);
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
case " ":
|
|
379
|
+
// Space
|
|
380
|
+
case "Spacebar": {
|
|
381
|
+
t.preventDefault(), this.toggleSelection(e, this._selectionMode === "multiple");
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
focusRelative(e, t) {
|
|
387
|
+
const s = this._visibleOrder, i = s.findIndex((c) => c.id === e.id);
|
|
388
|
+
if (i === -1) return;
|
|
389
|
+
const r = Math.max(0, Math.min(s.length - 1, i + t));
|
|
390
|
+
r !== i && this.focusNode(s[r].id);
|
|
391
|
+
}
|
|
392
|
+
focusNode(e) {
|
|
393
|
+
this._focusedId = e, this.requestUpdate(), requestAnimationFrame(() => {
|
|
394
|
+
this.shadowRoot?.querySelector(`[data-node-id="${k(e)}"]`)?.focus({ preventScroll: !1 });
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
toggleSelection(e, t) {
|
|
398
|
+
if (this._selectionMode !== "none") {
|
|
399
|
+
if (this._selectionMode === "single")
|
|
400
|
+
this._selectedIds = /* @__PURE__ */ new Set([e.id]);
|
|
401
|
+
else if (t) {
|
|
402
|
+
const s = new Set(this._selectedIds);
|
|
403
|
+
s.has(e.id) ? s.delete(e.id) : s.add(e.id), this._selectedIds = s;
|
|
404
|
+
} else
|
|
405
|
+
this._selectedIds = /* @__PURE__ */ new Set([e.id]);
|
|
406
|
+
this.requestUpdate(), this.dispatchEvent(
|
|
407
|
+
new CustomEvent("tree-node-select", {
|
|
408
|
+
detail: { node: e, selectedIds: [...this._selectedIds] },
|
|
409
|
+
bubbles: !0,
|
|
410
|
+
composed: !0
|
|
411
|
+
})
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
toggleExpansion(e) {
|
|
416
|
+
!(e.children && e.children.length > 0) && !e.lazy || (this._expandedIds.has(e.id) ? this.collapse(e) : this.expand(e));
|
|
417
|
+
}
|
|
418
|
+
expand(e) {
|
|
419
|
+
const t = !!(e.children && e.children.length > 0);
|
|
420
|
+
if (!t && !e.lazy || this._expandedIds.has(e.id)) return;
|
|
421
|
+
if (!t && e.lazy && this._loadChildren && !this._loadingIds.has(e.id)) {
|
|
422
|
+
this._loadingIds.add(e.id), this._errorIds.delete(e.id), this.requestUpdate(), this._loadChildren(e.id).then(
|
|
423
|
+
(i) => {
|
|
424
|
+
this._loadingIds.delete(e.id);
|
|
425
|
+
const r = new Set(this._expandedIds);
|
|
426
|
+
r.add(e.id), this._expandedIds = r, this.requestUpdate(), this.dispatchEvent(
|
|
427
|
+
new CustomEvent("tree-node-expand", {
|
|
428
|
+
detail: { node: e, expandedIds: [...this._expandedIds], loadedChildren: i },
|
|
429
|
+
bubbles: !0,
|
|
430
|
+
composed: !0
|
|
431
|
+
})
|
|
432
|
+
);
|
|
433
|
+
},
|
|
434
|
+
(i) => {
|
|
435
|
+
this._loadingIds.delete(e.id), this._errorIds.set(e.id, i instanceof Error ? i.message : String(i)), this.requestUpdate(), this.dispatchEvent(
|
|
436
|
+
new CustomEvent("tree-node-load-error", {
|
|
437
|
+
detail: { node: e, error: i },
|
|
438
|
+
bubbles: !0,
|
|
439
|
+
composed: !0
|
|
440
|
+
})
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
const s = new Set(this._expandedIds);
|
|
447
|
+
s.add(e.id), this._expandedIds = s, this.requestUpdate(), this.dispatchEvent(
|
|
448
|
+
new CustomEvent("tree-node-expand", {
|
|
449
|
+
detail: { node: e, expandedIds: [...this._expandedIds] },
|
|
450
|
+
bubbles: !0,
|
|
451
|
+
composed: !0
|
|
452
|
+
})
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
collapse(e) {
|
|
456
|
+
if (!this._expandedIds.has(e.id)) return;
|
|
457
|
+
const t = new Set(this._expandedIds);
|
|
458
|
+
t.delete(e.id), this._expandedIds = t, this.requestUpdate(), this.dispatchEvent(
|
|
459
|
+
new CustomEvent("tree-node-collapse", {
|
|
460
|
+
detail: { node: e, expandedIds: [...this._expandedIds] },
|
|
461
|
+
bubbles: !0,
|
|
462
|
+
composed: !0
|
|
463
|
+
})
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function k(h) {
|
|
468
|
+
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(h) : h.replace(/["\\]/g, "\\$&");
|
|
469
|
+
}
|
|
470
|
+
typeof customElements < "u" && !customElements.get("mp-treeview") && customElements.define("mp-treeview", R);
|
|
471
|
+
export {
|
|
472
|
+
R as M,
|
|
473
|
+
$ as t
|
|
474
|
+
};
|
package/code-snippet/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { LitElement as g, css as
|
|
1
|
+
import { LitElement as g, css as u, html as m } from "lit";
|
|
2
2
|
import { property as p, state as h } from "lit/decorators.js";
|
|
3
3
|
import { unsafeHTML as b } from "lit/directives/unsafe-html.js";
|
|
4
4
|
import n from "highlight.js/lib/common";
|
|
5
5
|
var f = Object.defineProperty, a = (r, t, e, s) => {
|
|
6
|
-
for (var o = void 0, l = r.length - 1,
|
|
7
|
-
(
|
|
6
|
+
for (var o = void 0, l = r.length - 1, c; l >= 0; l--)
|
|
7
|
+
(c = r[l]) && (o = c(t, e, o) || o);
|
|
8
8
|
return o && f(t, e, o), o;
|
|
9
9
|
};
|
|
10
|
-
const
|
|
10
|
+
const d = "mp-code-snippet";
|
|
11
11
|
class i extends g {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments), this.language = "", this.code = "", this.detectedLanguage = "code", this.highlighted = "", this.toastVisible = !1, this.toastTimer = null;
|
|
14
14
|
}
|
|
15
15
|
static {
|
|
16
|
-
this.styles =
|
|
16
|
+
this.styles = u`
|
|
17
17
|
/* Verbatim port of highlight.js's a11y-dark.css — the same theme
|
|
18
18
|
the master branch's ngx-highlightjs setup loads for the Angular
|
|
19
19
|
demo. That theme has only a dark variant; the code-snippet
|
|
@@ -103,11 +103,12 @@ class i extends g {
|
|
|
103
103
|
/* Default slot is hidden; content is hoisted into the <code> on each render. */
|
|
104
104
|
slot { display: none; }
|
|
105
105
|
|
|
106
|
-
/* a11y-dark token
|
|
107
|
-
port of highlight.js's a11y-dark.css.
|
|
108
|
-
(
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
/* a11y-dark token to colour mapping. Selectors + colours are a 1:1
|
|
107
|
+
port of highlight.js's a11y-dark.css. Token classes the JSON
|
|
108
|
+
grammar emits (hljs-attr for keys, hljs-punctuation for braces /
|
|
109
|
+
colons) are added explicitly — without them, JSON would render as
|
|
110
|
+
mostly white text since attr / punctuation have no mapped ancestor
|
|
111
|
+
in JSON's parse tree to inherit from. */
|
|
111
112
|
/* Comment */
|
|
112
113
|
.hljs-comment, .hljs-quote { color: #d4d0ab; }
|
|
113
114
|
/* Red */
|
|
@@ -118,10 +119,12 @@ class i extends g {
|
|
|
118
119
|
.hljs-number, .hljs-built_in, .hljs-literal, .hljs-type,
|
|
119
120
|
.hljs-params, .hljs-meta, .hljs-link { color: #f5ab35; }
|
|
120
121
|
/* Yellow */
|
|
121
|
-
.hljs-attribute { color: #ffd700; }
|
|
122
|
+
.hljs-attribute, .hljs-attr { color: #ffd700; }
|
|
122
123
|
/* Green */
|
|
123
124
|
.hljs-string, .hljs-symbol, .hljs-bullet,
|
|
124
125
|
.hljs-addition { color: #abe338; }
|
|
126
|
+
/* Muted (JSON punctuation — braces, brackets, commas, colons) */
|
|
127
|
+
.hljs-punctuation { color: #c8c8c2; }
|
|
125
128
|
/* Blue */
|
|
126
129
|
.hljs-title, .hljs-section { color: #00e0e0; }
|
|
127
130
|
/* Purple */
|
|
@@ -177,7 +180,7 @@ class i extends g {
|
|
|
177
180
|
}, 3e3);
|
|
178
181
|
}
|
|
179
182
|
render() {
|
|
180
|
-
return
|
|
183
|
+
return m`
|
|
181
184
|
<slot @slotchange=${this.onSlotChange}></slot>
|
|
182
185
|
<button
|
|
183
186
|
type="button"
|
|
@@ -212,7 +215,7 @@ a([
|
|
|
212
215
|
a([
|
|
213
216
|
h()
|
|
214
217
|
], i.prototype, "toastVisible");
|
|
215
|
-
typeof customElements < "u" && !customElements.get(
|
|
218
|
+
typeof customElements < "u" && !customElements.get(d) && customElements.define(d, i);
|
|
216
219
|
export {
|
|
217
220
|
i as MpCodeSnippet
|
|
218
221
|
};
|