@blockquote-web-components/blockquote-tabs 1.4.3 → 1.4.5
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/define/blockquote-tab.js +1 -1
- package/define/blockquote-tabpanel.js +1 -1
- package/define/blockquote-tabs.js +1 -1
- package/package.json +7 -7
- package/src/BlockquoteTabs.js +20 -23
- package/src/index.js +3 -3
- package/src/tab/BlockquoteTab.js +8 -8
- package/src/tabpanel/BlockquoteTabPanel.js +2 -2
package/define/blockquote-tab.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote-web-components/blockquote-tabs",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"description": "Webcomponent blockquote-tabs following open-wc recommendations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit",
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
]
|
|
90
90
|
},
|
|
91
91
|
"prettier": {
|
|
92
|
-
"arrowParens": "avoid",
|
|
93
92
|
"bracketSameLine": true,
|
|
93
|
+
"bracketSpacing": false,
|
|
94
94
|
"htmlWhitespaceSensitivity": "ignore",
|
|
95
95
|
"printWidth": 100,
|
|
96
96
|
"singleQuote": true,
|
|
97
|
-
"trailingComma": "
|
|
97
|
+
"trailingComma": "es5",
|
|
98
98
|
"overrides": [
|
|
99
99
|
{
|
|
100
100
|
"files": "*.{scss,css}",
|
|
@@ -115,19 +115,19 @@
|
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@blockquote-web-components/blockquote-mixin-slot-content": "^1.7.
|
|
118
|
+
"@blockquote-web-components/blockquote-mixin-slot-content": "^1.7.2",
|
|
119
119
|
"@juggle/resize-observer": "^3.4.0",
|
|
120
120
|
"@lit-labs/observers": "^2.0.0",
|
|
121
121
|
"lit": "^3.1.1"
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
124
|
"@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.9.1",
|
|
125
|
-
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.11.
|
|
126
|
-
"@blockquote-web-components/blockquote-foundations-sass": "^1.1.
|
|
125
|
+
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.11.2",
|
|
126
|
+
"@blockquote-web-components/blockquote-foundations-sass": "^1.1.4"
|
|
127
127
|
},
|
|
128
128
|
"publishConfig": {
|
|
129
129
|
"access": "public"
|
|
130
130
|
},
|
|
131
131
|
"customElements": "custom-elements.json",
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "0d8e9582b65cca369553640cc72d2ca93f2c0a61"
|
|
133
133
|
}
|
package/src/BlockquoteTabs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import {html, LitElement, nothing} from 'lit';
|
|
2
|
+
import {ref, createRef} from 'lit/directives/ref.js';
|
|
3
|
+
import {ResizeObserver as ResizeObserverPolyfill} from '@juggle/resize-observer';
|
|
4
|
+
import {ResizeController} from '@lit-labs/observers/resize-controller.js';
|
|
5
|
+
import {BlockquoteMixinSlotContent} from '@blockquote-web-components/blockquote-mixin-slot-content';
|
|
6
|
+
import {styles} from './styles/blockquote-tabs-styles.css.js';
|
|
7
7
|
|
|
8
8
|
/* A minimal library which polyfills the ResizeObserver */
|
|
9
9
|
window.ResizeObserver || /* c8 ignore next */ (window.ResizeObserver = ResizeObserverPolyfill);
|
|
@@ -123,6 +123,8 @@ export class BlockquoteTabs extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
123
123
|
},
|
|
124
124
|
skipInitial: true,
|
|
125
125
|
});
|
|
126
|
+
|
|
127
|
+
this.addEventListener('slotchanges', this._onSlotChanges);
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
_selectedIsInRange(idx) {
|
|
@@ -145,11 +147,6 @@ export class BlockquoteTabs extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
145
147
|
return this._tabList.length;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
|
-
connectedCallback() {
|
|
149
|
-
super.connectedCallback?.();
|
|
150
|
-
this.shadowRoot?.addEventListener('slotchanges', this._onSlotChanges);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
150
|
firstUpdated(props) {
|
|
154
151
|
super.firstUpdated && super.firstUpdated(props);
|
|
155
152
|
const tabSlot = this.shadowRoot?.querySelector('[name="tab"]');
|
|
@@ -182,13 +179,13 @@ export class BlockquoteTabs extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
182
179
|
}
|
|
183
180
|
}
|
|
184
181
|
|
|
185
|
-
_onSlotChanges = ev => {
|
|
182
|
+
_onSlotChanges = (ev) => {
|
|
186
183
|
ev.stopPropagation();
|
|
187
184
|
ev.preventDefault();
|
|
188
185
|
|
|
189
186
|
this._slotChangesCount += 1;
|
|
190
187
|
|
|
191
|
-
const {
|
|
188
|
+
const {detail} = ev;
|
|
192
189
|
const assignedNodesList = detail.assignedNodesContent.assignedNodes;
|
|
193
190
|
|
|
194
191
|
if (detail.assignedSlotContent.slotName === 'tab') {
|
|
@@ -259,18 +256,18 @@ export class BlockquoteTabs extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
259
256
|
`;
|
|
260
257
|
}
|
|
261
258
|
|
|
262
|
-
_scrollEdge({
|
|
259
|
+
_scrollEdge({target = this._scrollContentRef.value} = {}) {
|
|
263
260
|
// @ts-ignore
|
|
264
|
-
const {
|
|
261
|
+
const {scrollLeft, scrollWidth, offsetWidth} = target;
|
|
265
262
|
const overflowingWidth = scrollWidth - offsetWidth;
|
|
266
263
|
this._hasScrollLeftIndicator = scrollLeft > 0;
|
|
267
264
|
this._hasScrollRightIndicator = scrollLeft < overflowingWidth;
|
|
268
265
|
}
|
|
269
266
|
|
|
270
|
-
_onTabClick = ev => {
|
|
267
|
+
_onTabClick = (ev) => {
|
|
271
268
|
const findSelectedTab = ev
|
|
272
269
|
.composedPath()
|
|
273
|
-
.find(tab => tab instanceof Element && tab.slot === 'tab');
|
|
270
|
+
.find((tab) => tab instanceof Element && tab.slot === 'tab');
|
|
274
271
|
|
|
275
272
|
const findSelectedTabIdxFromOne = this._tabList.indexOf(findSelectedTab) + 1;
|
|
276
273
|
|
|
@@ -281,7 +278,7 @@ export class BlockquoteTabs extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
281
278
|
this.selected = findSelectedTabIdxFromOne;
|
|
282
279
|
};
|
|
283
280
|
|
|
284
|
-
_onTabKeyDown = ev => {
|
|
281
|
+
_onTabKeyDown = (ev) => {
|
|
285
282
|
let idx = '';
|
|
286
283
|
|
|
287
284
|
switch (ev.key) {
|
|
@@ -352,23 +349,23 @@ export class BlockquoteTabs extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
352
349
|
|
|
353
350
|
_scrollIntoViewWithOffset(
|
|
354
351
|
tabScroller = this._selectedTab,
|
|
355
|
-
behavior = this._observeScrollBehavior ? 'smooth' : 'auto'
|
|
352
|
+
behavior = this._observeScrollBehavior ? 'smooth' : 'auto'
|
|
356
353
|
) {
|
|
357
354
|
const scrollContentNode = this._scrollContentRef.value;
|
|
358
355
|
if (!scrollContentNode) {
|
|
359
356
|
return;
|
|
360
357
|
}
|
|
361
358
|
const [rootA, rootB] = this._indicators || [];
|
|
362
|
-
const {
|
|
363
|
-
const {
|
|
359
|
+
const {right: boundaryight} = scrollContentNode.getBoundingClientRect();
|
|
360
|
+
const {offsetLeft: scrollerLeft} = tabScroller;
|
|
364
361
|
const {
|
|
365
362
|
left: tabScrollerXLeft,
|
|
366
363
|
right: tabScrollerXRight,
|
|
367
364
|
width: tabScrollerWidth,
|
|
368
365
|
} = tabScroller.getBoundingClientRect();
|
|
369
366
|
|
|
370
|
-
const {
|
|
371
|
-
const {
|
|
367
|
+
const {right: rootARight} = rootA.getBoundingClientRect();
|
|
368
|
+
const {width: rootBWidth, left: rootBLeft} = rootB.getBoundingClientRect();
|
|
372
369
|
|
|
373
370
|
if (tabScrollerXRight > rootBLeft || tabScrollerXLeft < rootARight) {
|
|
374
371
|
const left =
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export {BlockquoteTabs} from './BlockquoteTabs.js';
|
|
2
|
+
export {BlockquoteTab} from './tab/BlockquoteTab.js';
|
|
3
|
+
export {BlockquoteTabPanel} from './tabpanel/BlockquoteTabPanel.js';
|
package/src/tab/BlockquoteTab.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {html, LitElement} from 'lit';
|
|
2
|
+
import {BlockquoteMixinSlotContent} from '@blockquote-web-components/blockquote-mixin-slot-content';
|
|
3
|
+
import {styles} from './styles/blockquote-tab-styles.css.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 
|
|
@@ -30,6 +30,8 @@ export class BlockquoteTab extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
30
30
|
slot: 'tab',
|
|
31
31
|
tabindex: 0,
|
|
32
32
|
};
|
|
33
|
+
|
|
34
|
+
this.addEventListener('slotchanges', this._onSlotChanges);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
static get styles() {
|
|
@@ -38,8 +40,6 @@ export class BlockquoteTab extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
38
40
|
|
|
39
41
|
connectedCallback() {
|
|
40
42
|
super.connectedCallback?.();
|
|
41
|
-
this.shadowRoot?.addEventListener('slotchanges', this._onSlotChanges);
|
|
42
|
-
|
|
43
43
|
this.__setArrayAttibute(this.globalRootAttributes);
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -58,12 +58,12 @@ export class BlockquoteTab extends BlockquoteMixinSlotContent(LitElement) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
_onSlotChanges = ev => {
|
|
62
|
-
const {
|
|
61
|
+
_onSlotChanges = (ev) => {
|
|
62
|
+
const {detail} = ev;
|
|
63
63
|
ev.stopPropagation();
|
|
64
64
|
ev.preventDefault();
|
|
65
65
|
const assignedNodesList = detail.assignedSlotContent.assignedSlot;
|
|
66
|
-
Object.assign(assignedNodesList.dataset, {
|
|
66
|
+
Object.assign(assignedNodesList.dataset, {text: this.textContent});
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
render() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {html, LitElement} from 'lit';
|
|
2
|
+
import {styles} from './styles/blockquote-tabpanel-styles.css.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 
|