@brightspace-ui/core 3.314.2 → 3.314.4
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.
|
@@ -168,9 +168,9 @@ class DemoSnippet extends LitElement {
|
|
|
168
168
|
|
|
169
169
|
// fix script whitespace
|
|
170
170
|
text = setIndent(text.replace(/\t/g, ' '))
|
|
171
|
-
.replace(/( *)<script( type="module")?>([^\n]+?)<\/script>/
|
|
172
|
-
.replace(/( *)<\/script>/
|
|
173
|
-
.replace(/<script( type="module")?>/
|
|
171
|
+
.replace(/( *)<script( type="module")?>([^\n]+?)<\/script>/gi, '$1<script$2>\n$1 $3\n$1</script>') // convert single line scripts to multi-line
|
|
172
|
+
.replace(/( *)<\/script>/gi, '\n$1</script>')
|
|
173
|
+
.replace(/<script( type="module")?>/gi, '<script$1>\n')
|
|
174
174
|
.replace(/(\n *)?<script data-demo-hide(.+?)<\/script>/gis, '');
|
|
175
175
|
|
|
176
176
|
const startTags = new Set([...text.matchAll(/<[^/](.*?)>/g)].map(m => m[0]));
|
|
@@ -96,7 +96,8 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
96
96
|
* Whether the divider is controlling a left/right panel or a bottom drawer
|
|
97
97
|
* @type {'panel'|'drawer'}
|
|
98
98
|
*/
|
|
99
|
-
panelType: { type: String, attribute: 'panel-type' }
|
|
99
|
+
panelType: { type: String, attribute: 'panel-type' },
|
|
100
|
+
_active: { state: true }
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
static styles = css`
|
|
@@ -115,7 +116,8 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
115
116
|
.divider:hover {
|
|
116
117
|
background-color: var(--d2l-color-corundum);
|
|
117
118
|
}
|
|
118
|
-
.divider:focus-within
|
|
119
|
+
.divider:focus-within,
|
|
120
|
+
.divider.active {
|
|
119
121
|
background-color: var(--d2l-color-celestine);
|
|
120
122
|
}
|
|
121
123
|
:host([panel-position="start"]) .divider.collapsed,
|
|
@@ -150,11 +152,13 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
150
152
|
background-color: var(--d2l-color-gypsum);
|
|
151
153
|
border-color: var(--d2l-color-celestine);
|
|
152
154
|
}
|
|
153
|
-
.slider:focus .divider-handle
|
|
155
|
+
.slider:focus .divider-handle,
|
|
156
|
+
.divider.active .divider-handle {
|
|
154
157
|
background-color: var(--d2l-color-celestine-minus-1);
|
|
155
158
|
border-color: var(--d2l-color-celestine-minus-1);
|
|
156
159
|
}
|
|
157
|
-
.slider:focus .divider-handle .handle-icon
|
|
160
|
+
.slider:focus .divider-handle .handle-icon,
|
|
161
|
+
.divider.active .divider-handle .handle-icon {
|
|
158
162
|
color: white;
|
|
159
163
|
}
|
|
160
164
|
|
|
@@ -173,7 +177,8 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
173
177
|
.divider-arrow d2l-icon-custom {
|
|
174
178
|
color: var(--d2l-color-celestine);
|
|
175
179
|
}
|
|
176
|
-
.divider:focus-within .divider-arrow:not([hidden])
|
|
180
|
+
.divider:focus-within .divider-arrow:not([hidden]),
|
|
181
|
+
.divider.active .divider-arrow:not([hidden]) {
|
|
177
182
|
display: flex;
|
|
178
183
|
}
|
|
179
184
|
.divider-arrow:hover {
|
|
@@ -228,11 +233,20 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
228
233
|
this.minSize = 0;
|
|
229
234
|
this.panelPosition = 'start';
|
|
230
235
|
this.panelType = 'panel';
|
|
236
|
+
|
|
237
|
+
this._active = false;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
disconnectedCallback() {
|
|
241
|
+
super.disconnectedCallback();
|
|
242
|
+
document.removeEventListener('pointerdown', this.#handleDocumentPointerDown, { capture: true });
|
|
243
|
+
this._active = false;
|
|
231
244
|
}
|
|
232
245
|
|
|
233
246
|
render() {
|
|
234
247
|
const dividerClasses = {
|
|
235
248
|
divider: true,
|
|
249
|
+
active: this._active,
|
|
236
250
|
collapsed: this.currentSize <= this.collapsedSize,
|
|
237
251
|
maxed: this.currentSize === this.maxSize
|
|
238
252
|
};
|
|
@@ -273,11 +287,27 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
273
287
|
`;
|
|
274
288
|
}
|
|
275
289
|
|
|
290
|
+
updated(changedProperties) {
|
|
291
|
+
super.updated(changedProperties);
|
|
292
|
+
if (changedProperties.has('_active')) {
|
|
293
|
+
if (this._active) {
|
|
294
|
+
document.addEventListener('pointerdown', this.#handleDocumentPointerDown, { capture: true });
|
|
295
|
+
} else if (changedProperties.get('_active')) {
|
|
296
|
+
document.removeEventListener('pointerdown', this.#handleDocumentPointerDown, { capture: true });
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
276
301
|
#clickedArrow;
|
|
277
302
|
#clickedHandle = false;
|
|
278
303
|
#draggedDivider = false;
|
|
279
304
|
#dragStats;
|
|
280
305
|
|
|
306
|
+
#handleDocumentPointerDown = (e) => {
|
|
307
|
+
if (e.composedPath().includes(this)) return;
|
|
308
|
+
this._active = false;
|
|
309
|
+
};
|
|
310
|
+
|
|
281
311
|
#handlePointerMove = (e) => {
|
|
282
312
|
if (!this.#dragStats || e.pointerId !== this.#dragStats.pointerId) return;
|
|
283
313
|
const delta = this.panelType === 'panel' ? (e.clientX - this.#dragStats.startX) : (e.clientY - this.#dragStats.startY);
|
|
@@ -401,6 +431,13 @@ class PageDivider extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
401
431
|
const path = e.composedPath();
|
|
402
432
|
this.#clickedHandle = path.some(el => el.classList?.contains('divider-handle'));
|
|
403
433
|
this.#clickedArrow = path.find(el => el.classList?.contains('divider-arrow'));
|
|
434
|
+
|
|
435
|
+
// iOS clears focus on the slider once the tap completes, so we use a
|
|
436
|
+
// persistent `active` state to keep focus styles applied and the arrows visible.
|
|
437
|
+
if (e.pointerType === 'touch') {
|
|
438
|
+
this._active = true;
|
|
439
|
+
}
|
|
440
|
+
|
|
404
441
|
if (this.#clickedArrow) return; // Arrows don't support dragging
|
|
405
442
|
|
|
406
443
|
const startSize = this.collapsed ? this.collapsedSize : this.currentSize;
|
package/custom-elements.json
CHANGED
|
@@ -13400,7 +13400,7 @@
|
|
|
13400
13400
|
"properties": [
|
|
13401
13401
|
{
|
|
13402
13402
|
"name": "styles",
|
|
13403
|
-
"default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\tdisplay: inline-block;\\n\\t\\t\\tflex: none;\\n\\t\\t}\\n\\t\\t.divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-mica);\\n\\t\\t\\tcursor: ew-resize;\\n\\t\\t\\theight: 100%;\\n\\t\\t\\tposition: relative;\\n\\t\\t\\ttouch-action: none;\\n\\t\\t\\twidth: ${DIVIDER_WIDTH}px;\\n\\t\\t}\\n\\t\\t.divider:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-corundum);\\n\\t\\t}\\n\\t\\t.divider:focus-within {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t:host([panel-position=\\\"start\\\"]) .divider.collapsed,\\n\\t\\t:host([panel-position=\\\"end\\\"]) .divider.maxed {\\n\\t\\t\\tcursor: var(--d2l-cursor-resize-inline-end, e-resize);\\n\\t\\t}\\n\\t\\t:host([panel-position=\\\"start\\\"]) .divider.maxed,\\n\\t\\t:host([panel-position=\\\"end\\\"]) .divider.collapsed {\\n\\t\\t\\tcursor: var(--d2l-cursor-resize-inline-start, w-resize);\\n\\t\\t}\\n\\n\\t\\t.slider {\\n\\t\\t\\tinset-inline-start: -${DIVIDER_HANDLE_SIZE / 2 - DIVIDER_WIDTH / 2}px;\\n\\t\\t\\toutline: none;\\n\\t\\t\\tposition: absolute;\\n\\t\\t\\ttop: 55px;\\n\\t\\t}\\n\\n\\t\\t.divider-handle {\\n\\t\\t\\talign-items: center;\\n\\t\\t\\tbackground-color: white;\\n\\t\\t\\tborder: 1px solid var(--d2l-color-mica);\\n\\t\\t\\tborder-radius: 50%;\\n\\t\\t\\tbox-sizing: border-box;\\n\\t\\t\\tcursor: pointer;\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\theight: ${DIVIDER_HANDLE_SIZE}px;\\n\\t\\t\\tjustify-content: center;\\n\\t\\t\\twidth: ${DIVIDER_HANDLE_SIZE}px;\\n\\t\\t}\\n\\t\\t.divider-handle:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-gypsum);\\n\\t\\t\\tborder-color: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t.slider:focus .divider-handle {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine-minus-1);\\n\\t\\t\\tborder-color: var(--d2l-color-celestine-minus-1);\\n\\t\\t}\\n\\t\\t.slider:focus .divider-handle .handle-icon {\\n\\t\\t\\tcolor: white;\\n\\t\\t}\\n\\n\\t\\t.divider-arrow {\\n\\t\\t\\talign-items: center;\\n\\t\\t\\tbackground-color: rgba(255, 255, 255, 0.5);\\n\\t\\t\\tcursor: pointer;\\n\\t\\t\\tdisplay: none;\\n\\t\\t\\theight: 24px;\\n\\t\\t\\tinset-block-start: max(50%, 97px); /* Do not hide behind slider on short screens */\\n\\t\\t\\tjustify-content: center;\\n\\t\\t\\tposition: absolute;\\n\\t\\t\\ttransform: translateY(-50%);\\n\\t\\t\\twidth: 24px;\\n\\t\\t}\\n\\t\\t.divider-arrow d2l-icon-custom {\\n\\t\\t\\tcolor: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t.divider:focus-within .divider-arrow:not([hidden]) {\\n\\t\\t\\tdisplay: flex;\\n\\t\\t}\\n\\t\\t.divider-arrow:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-gypsum);\\n\\t\\t}\\n\\t\\t.divider-arrow:hover d2l-icon-custom {\\n\\t\\t\\tcolor: var(--d2l-color-celestine-minus-1);\\n\\t\\t}\\n\\t\\t.divider-arrow.start {\\n\\t\\t\\tborder-end-start-radius: 6px;\\n\\t\\t\\tborder-start-start-radius: 6px;\\n\\t\\t\\tinset-inline-end: 100%;\\n\\t\\t}\\n\\t\\t.divider-arrow.end {\\n\\t\\t\\tborder-end-end-radius: 6px;\\n\\t\\t\\tborder-start-end-radius: 6px;\\n\\t\\t\\tinset-inline-start: 100%;\\n\\t\\t}\\n\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine);\\n\\t\\t\\tcursor: ns-resize;\\n\\t\\t\\theight: ${DIVIDER_WIDTH}px;\\n\\t\\t\\twidth: 100%;\\n\\t\\t}\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .divider.collapsed {\\n\\t\\t\\tcursor: n-resize;\\n\\t\\t}\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .divider.maxed {\\n\\t\\t\\tcursor: s-resize;\\n\\t\\t}\\n\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .slider {\\n\\t\\t\\tinset-inline-end: 18px;\\n\\t\\t\\ttop: auto;\\n\\t\\t}\\n\\n\\t\\t/* TO DO: Lots more drawer styling to come */\\n\\n\\t`\""
|
|
13403
|
+
"default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\tdisplay: inline-block;\\n\\t\\t\\tflex: none;\\n\\t\\t}\\n\\t\\t.divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-mica);\\n\\t\\t\\tcursor: ew-resize;\\n\\t\\t\\theight: 100%;\\n\\t\\t\\tposition: relative;\\n\\t\\t\\ttouch-action: none;\\n\\t\\t\\twidth: ${DIVIDER_WIDTH}px;\\n\\t\\t}\\n\\t\\t.divider:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-corundum);\\n\\t\\t}\\n\\t\\t.divider:focus-within,\\n\\t\\t.divider.active {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t:host([panel-position=\\\"start\\\"]) .divider.collapsed,\\n\\t\\t:host([panel-position=\\\"end\\\"]) .divider.maxed {\\n\\t\\t\\tcursor: var(--d2l-cursor-resize-inline-end, e-resize);\\n\\t\\t}\\n\\t\\t:host([panel-position=\\\"start\\\"]) .divider.maxed,\\n\\t\\t:host([panel-position=\\\"end\\\"]) .divider.collapsed {\\n\\t\\t\\tcursor: var(--d2l-cursor-resize-inline-start, w-resize);\\n\\t\\t}\\n\\n\\t\\t.slider {\\n\\t\\t\\tinset-inline-start: -${DIVIDER_HANDLE_SIZE / 2 - DIVIDER_WIDTH / 2}px;\\n\\t\\t\\toutline: none;\\n\\t\\t\\tposition: absolute;\\n\\t\\t\\ttop: 55px;\\n\\t\\t}\\n\\n\\t\\t.divider-handle {\\n\\t\\t\\talign-items: center;\\n\\t\\t\\tbackground-color: white;\\n\\t\\t\\tborder: 1px solid var(--d2l-color-mica);\\n\\t\\t\\tborder-radius: 50%;\\n\\t\\t\\tbox-sizing: border-box;\\n\\t\\t\\tcursor: pointer;\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\theight: ${DIVIDER_HANDLE_SIZE}px;\\n\\t\\t\\tjustify-content: center;\\n\\t\\t\\twidth: ${DIVIDER_HANDLE_SIZE}px;\\n\\t\\t}\\n\\t\\t.divider-handle:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-gypsum);\\n\\t\\t\\tborder-color: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t.slider:focus .divider-handle,\\n\\t\\t.divider.active .divider-handle {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine-minus-1);\\n\\t\\t\\tborder-color: var(--d2l-color-celestine-minus-1);\\n\\t\\t}\\n\\t\\t.slider:focus .divider-handle .handle-icon,\\n\\t\\t.divider.active .divider-handle .handle-icon {\\n\\t\\t\\tcolor: white;\\n\\t\\t}\\n\\n\\t\\t.divider-arrow {\\n\\t\\t\\talign-items: center;\\n\\t\\t\\tbackground-color: rgba(255, 255, 255, 0.5);\\n\\t\\t\\tcursor: pointer;\\n\\t\\t\\tdisplay: none;\\n\\t\\t\\theight: 24px;\\n\\t\\t\\tinset-block-start: max(50%, 97px); /* Do not hide behind slider on short screens */\\n\\t\\t\\tjustify-content: center;\\n\\t\\t\\tposition: absolute;\\n\\t\\t\\ttransform: translateY(-50%);\\n\\t\\t\\twidth: 24px;\\n\\t\\t}\\n\\t\\t.divider-arrow d2l-icon-custom {\\n\\t\\t\\tcolor: var(--d2l-color-celestine);\\n\\t\\t}\\n\\t\\t.divider:focus-within .divider-arrow:not([hidden]),\\n\\t\\t.divider.active .divider-arrow:not([hidden]) {\\n\\t\\t\\tdisplay: flex;\\n\\t\\t}\\n\\t\\t.divider-arrow:hover {\\n\\t\\t\\tbackground-color: var(--d2l-color-gypsum);\\n\\t\\t}\\n\\t\\t.divider-arrow:hover d2l-icon-custom {\\n\\t\\t\\tcolor: var(--d2l-color-celestine-minus-1);\\n\\t\\t}\\n\\t\\t.divider-arrow.start {\\n\\t\\t\\tborder-end-start-radius: 6px;\\n\\t\\t\\tborder-start-start-radius: 6px;\\n\\t\\t\\tinset-inline-end: 100%;\\n\\t\\t}\\n\\t\\t.divider-arrow.end {\\n\\t\\t\\tborder-end-end-radius: 6px;\\n\\t\\t\\tborder-start-end-radius: 6px;\\n\\t\\t\\tinset-inline-start: 100%;\\n\\t\\t}\\n\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .divider {\\n\\t\\t\\tbackground-color: var(--d2l-color-celestine);\\n\\t\\t\\tcursor: ns-resize;\\n\\t\\t\\theight: ${DIVIDER_WIDTH}px;\\n\\t\\t\\twidth: 100%;\\n\\t\\t}\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .divider.collapsed {\\n\\t\\t\\tcursor: n-resize;\\n\\t\\t}\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .divider.maxed {\\n\\t\\t\\tcursor: s-resize;\\n\\t\\t}\\n\\n\\t\\t:host([panel-type=\\\"drawer\\\"]) .slider {\\n\\t\\t\\tinset-inline-end: 18px;\\n\\t\\t\\ttop: auto;\\n\\t\\t}\\n\\n\\t\\t/* TO DO: Lots more drawer styling to come */\\n\\n\\t`\""
|
|
13404
13404
|
},
|
|
13405
13405
|
{
|
|
13406
13406
|
"name": "focusElementSelector",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.314.
|
|
3
|
+
"version": "3.314.4",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|