Skip to content

Commit 4c1f68e

Browse files
committed
Merge branch 'release/1.0.0-alpha.13' into master
2 parents c72480a + 8dbdf37 commit 4c1f68e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+11386
-10891
lines changed

.eslintrc.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ module.exports = {
1010
},
1111
rules: {
1212
'class-methods-use-this': 'off',
13-
'no-underscore-dangle': ['error', { allow: ['__base__', '__isChild__', '__isBase__'] }],
13+
'no-underscore-dangle': [
14+
'error',
15+
{ allow: ['__base__', '__isChild__', '__isBase__', '__isAsync__', '_excludeFromAutoBind'] },
16+
],
1417
},
1518
settings: {
1619
'import/resolver': {
17-
alias: [
18-
['~', './src'],
19-
],
20-
}
20+
alias: [['~', './src']],
21+
},
2122
},
2223
overrides: [
2324
{

demo/src/index.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@
5050
<!-- END BreakpointObserverDemo -->
5151

5252
<div
53+
data-ref="modal"
5354
data-component="Modal"
54-
data-options='{ "activeBreakpoints": "m l", "debug": true, "styles": { "modal": { "active": "transition-all duration-500" } } }'
55+
data-options='{ "activeBreakpoints": "m l", "styles": { "modal": { "active": "transition-all duration-500" } } }'
5556
class="text-center"
5657
>
5758
<!--
@@ -243,28 +244,28 @@ <h2 id="components-tabs" class="text-lg mb-4">Tabs</h2>
243244
data-options='{ "styles": { "btn": { "open": { "borderBottomColor": "#fff" } } } }'
244245
>
245246
<div class="flex px-4 border-b">
246-
<button data-ref="btn" class="-mb-px -ml-px p-4 border">Tab #1</button>
247-
<button data-ref="btn" class="-mb-px -ml-px p-4 border">Tab #2</button>
248-
<button data-ref="btn" class="-mb-px -ml-px p-4 border">Tab #3</button>
247+
<button data-ref="btn[]" class="-mb-px -ml-px p-4 border">Tab #1</button>
248+
<button data-ref="btn[]" class="-mb-px -ml-px p-4 border">Tab #2</button>
249+
<button data-ref="btn[]" class="-mb-px -ml-px p-4 border">Tab #3</button>
249250
</div>
250251
<div class="p-4">
251-
<div data-ref="content" aria-hidden="false">
252+
<div data-ref="content[]" aria-hidden="false">
252253
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Adipisci nemo quod nobis
253254
laudantium iusto maiores molestias animi quos error quo consequatur, eum veniam sequi
254255
repellat placeat rerum a labore. Sit.
255256
</div>
256-
<div data-ref="content" aria-hidden="true">
257+
<div data-ref="content[]" aria-hidden="true">
257258
Nunc ultrices arcu quis mollis mollis. Duis at turpis et nibh pellentesque dapibus.
258259
Quisque luctus neque a placerat sodales. Sed a mauris efficitur eros fringilla viverra.
259260
Donec eleifend risus ligula. Donec non tellus lacinia, tempus enim id, lacinia arcu.
260261
Phasellus sit amet mollis nibh, at porta nunc. Fusce faucibus erat quis risus molestie,
261262
ac aliquam purus finibus. Pellentesque aliquet augue non sollicitudin semper. Vivamus
262263
est odio, efficitur vitae lacus id, eleifend maximus felis.
263264
</div>
264-
<div data-ref="content" aria-hidden="true" style="display: none;">
265+
<div data-ref="content[]" aria-hidden="true">
265266
<img
266267
data-src="https://placekitten.com/299/299"
267-
data-options='{ "log": true }'
268+
data-options='{ "debug": true }'
268269
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
269270
width="300"
270271
height="300"

demo/src/js/app.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { Base, Modal, Tabs, Accordion } from '../../../src';
2-
import { withBreakpointObserver } from '../../../src/decorators';
1+
import { Base, Modal, Tabs, Accordion } from '~/src';
2+
import { withBreakpointObserver } from '~/src/decorators';
33
import BreakpointManagerDemo from './components/BreakPointManagerDemo';
44
import BreakpointObserverDemo from './components/BreakpointObserverDemo';
55

66
class App extends Base {
77
get config() {
88
return {
99
name: 'App',
10+
log: true,
1011
components: {
1112
Accordion,
1213
BreakpointManagerDemo,
@@ -24,6 +25,10 @@ class App extends Base {
2425
this.$log('Mounted 🎉');
2526
}
2627

28+
onModalOpen(...args) {
29+
this.$log('onModalOpen', ...args);
30+
}
31+
2732
loaded() {
2833
this.$log('Loaded');
2934
}

demo/src/js/components/BreakPointManagerDemo/BreakpointManagerDemoBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Base } from '../../../../../src';
1+
import { Base } from '~/src';
22

33
export default class BreakpointManagerDemoBase extends Base {
44
get config() {

demo/src/js/components/BreakPointManagerDemo/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Base } from '../../../../../src/abstracts';
2-
import { withBreakpointManager } from '../../../../../src/decorators';
1+
import { Base } from '~/src/abstracts';
2+
import { withBreakpointManager } from '~/src/decorators';
33
import BreakpointManagerDemoMobile from './BreakpointManagerDemoMobile';
44
import BreakpointManagerDemoTablet from './BreakpointManagerDemoTablet';
55
import BreakpointManagerDemoDesktop from './BreakpointManagerDemoDesktop';

demo/src/js/components/BreakpointObserverDemo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Base } from '../../../../src/abstracts';
2-
import { withBreakpointObserver } from '../../../../src/decorators';
1+
import { Base } from '~/src/abstracts';
2+
import { withBreakpointObserver } from '~/src/decorators';
33

44
export default class BreakpointObserverDemo extends withBreakpointObserver(Base) {
55
get config() {

demo/src/js/components/Cursor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Base } from '../../../../src';
1+
import { Base } from '~/src';
22

33
export default class Cursor extends Base {
44
get config() {

demo/src/js/components/Lazyload.js

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { Base } from '../../../../src';
2-
import transition, { setClassesOrStyles } from '../../../../src/utils/css/transition';
1+
import { Base } from '~/src';
2+
import { withIntersectionObserver } from '~/src/decorators';
3+
import transition, { setClassesOrStyles } from '~/src/utils/css/transition';
34

4-
export default class Lazyload extends Base {
5+
export default class Lazyload extends withIntersectionObserver(Base) {
56
get config() {
67
return {
78
name: 'Lazyload',
9+
log: true,
810
styles: {
911
unloaded: { opacity: 0 },
1012
active: { transition: 'opacity 0.5s' },
@@ -15,34 +17,28 @@ export default class Lazyload extends Base {
1517

1618
mounted() {
1719
setClassesOrStyles(this.$el, this.$options.styles.unloaded);
18-
19-
this.observer = new IntersectionObserver(
20-
([entry]) => {
21-
if (entry.isIntersecting) {
22-
window.requestIdleCallback(this.load);
23-
}
24-
},
25-
{
26-
threshold: 1.0,
27-
}
28-
);
29-
}
30-
31-
loaded() {
32-
this.observer.observe(this.$el);
3320
}
3421

35-
destroyed() {
36-
this.observer.disconnect();
22+
intersected([entry]) {
23+
if (entry.isIntersecting) {
24+
window.requestIdleCallback(this.load);
25+
}
3726
}
3827

3928
load() {
4029
const { unloaded, active, loaded } = this.$options.styles;
4130
const src = this.$el.getAttribute('data-src');
31+
32+
if (!src || this.isLoaded) {
33+
this.$destroy();
34+
return;
35+
}
36+
4237
const img = new Image();
4338
img.onload = () => {
4439
this.$el.setAttribute('src', src);
4540
this.$el.removeAttribute('data-src');
41+
this.isLoaded = true;
4642
transition(this.$el, {
4743
from: unloaded,
4844
active,

demo/src/js/components/Skew.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { Base } from '../../../../src';
1+
import { Base } from '~/src';
2+
import { withIntersectionObserver } from '~/src/decorators';
23

3-
export default class Skew extends Base {
4+
export default class Skew extends withIntersectionObserver(Base) {
45
get config() {
56
return {
67
name: 'Skew',
@@ -9,15 +10,10 @@ export default class Skew extends Base {
910

1011
mounted() {
1112
this.isVisible = false;
12-
this.observer = new IntersectionObserver(([entry]) => {
13-
this.isVisible = entry.intersectionRatio > 0;
14-
});
15-
16-
this.observer.observe(this.$el);
1713
}
1814

19-
destroyed() {
20-
this.observer.disconnect();
15+
intersected([entry]) {
16+
this.isVisible = entry.intersectionRatio > 0;
2117
}
2218

2319
scrolled({ delta }) {

0 commit comments

Comments
 (0)