Skip to content

Commit 2661cfb

Browse files
committed
Merge branch 'release/1.0.0'
2 parents c734a7a + cbb79af commit 2661cfb

File tree

261 files changed

+13403
-6120
lines changed

Some content is hidden

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

261 files changed

+13403
-6120
lines changed

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
'class-methods-use-this': 'off',
1313
'no-underscore-dangle': [
1414
'error',
15-
{ allow: ['__base__', '__isChild__', '__isBase__', '__isAsync__', '_excludeFromAutoBind'] },
15+
{ allow: ['__base__', '_excludeFromAutoBind'] },
1616
],
1717
},
1818
settings: {
@@ -30,5 +30,11 @@ module.exports = {
3030
'require-jsdoc': 'off',
3131
},
3232
},
33+
{
34+
files: ['**/*.ts'],
35+
parser: '@typescript-eslint/parser',
36+
plugins: ['@typescript-eslint'],
37+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
38+
},
3339
],
3440
};

.github/workflows/tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: Tests
2+
23
on:
34
push:
45
branches:
56
- master
67
- develop
78
pull_request:
9+
810
jobs:
911
Unit:
1012
runs-on: ubuntu-latest
@@ -15,6 +17,10 @@ jobs:
1517
node-version: 14
1618
- name: Install modules
1719
run: npm ci
20+
- name: Run code quality tests
21+
run: npm run lint:eslint -- --format=compact
22+
- name: Run types tests
23+
run: npm run lint:types
1824
- name: Run tests
1925
run: npm run test -- --coverage
2026
- name: Upload coverage to Codecov

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ dist/*.html
2626
demo/dist/
2727
docs/.vuepress/dist/
2828
coverage/
29+
/full.d.ts
30+
/index.d.ts

babel.config.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,8 @@ module.exports = {
99
],
1010
plugins:
1111
process.env.NODE_TARGET === 'bundle'
12-
? [
13-
'@babel/plugin-proposal-class-properties',
14-
'@babel/plugin-proposal-export-default-from',
15-
'@babel/plugin-proposal-export-namespace-from',
16-
]
17-
: [
18-
'@babel/plugin-transform-runtime',
19-
'@babel/plugin-proposal-class-properties',
20-
'@babel/plugin-proposal-export-default-from',
21-
'@babel/plugin-proposal-export-namespace-from',
22-
],
12+
? ['@babel/plugin-proposal-class-properties']
13+
: ['@babel/plugin-transform-runtime', '@babel/plugin-proposal-class-properties'],
2314
parserOpts: {
2415
plugins: ['dynamicImport', 'classProperties'],
2516
},

codecov.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
informational: true
6+
patch:
7+
default:
8+
informational: true

demo/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
rules: {
55
'class-methods-use-this': 'off',
66
'require-jsdoc': 'off',
7-
'no-underscore-dangle': ['error', { allow: ['__base__', '__isChild__', '__isBase__'] }],
7+
'no-underscore-dangle': ['error', { allow: ['__base__'] }],
88
'import/no-extraneous-dependencies': 'off',
99
},
1010
};

demo/src/index.html

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
<!-- BEGIN BreakpointObserverDemo -->
2323
<div
2424
data-component="BreakpointObserverDemo"
25-
data-options='{ "name": "BreakpointObserverDemoTable", "activeBreakpoints": "m" }'
25+
data-option-name="BreakpointObserverDemoTable"
26+
data-option-active-breakpoints="m"
2627
class="relative flex items-center justify-center w-full h-32 mb-10 text-white text-center"
2728
>
2829
<div class="z-under absolute inset-0 opacity-75 bg-black rounded"></div>
@@ -37,7 +38,8 @@
3738
<!-- BEGIN BreakpointObserverDemo -->
3839
<div
3940
data-component="BreakpointObserverDemo"
40-
data-options='{ "name": "BreakpointObserverDemoMobileDesktop", "inactiveBreakpoints": "m" }'
41+
data-option-name="BreakpointObserverDemoMobileDesktop"
42+
data-option-inactive-breakpoints=m"
4143
class="relative flex items-center justify-center w-full h-32 mb-10 text-white text-center"
4244
>
4345
<div class="z-under absolute inset-0 opacity-75 bg-black rounded"></div>
@@ -52,7 +54,8 @@
5254
<div
5355
data-ref="modal"
5456
data-component="Modal"
55-
data-options='{ "activeBreakpoints": "m l", "styles": { "modal": { "active": "transition-all duration-500" } } }'
57+
data-option-active-breakpoints="m l"
58+
data-option-styles='{ "modal": { "active": "transition-all duration-500" } }'
5659
class="text-center"
5760
>
5861
<!--
@@ -125,11 +128,13 @@
125128
<br />
126129
<br />
127130
<!-- BEGIN Accordion component-->
128-
<div data-component="Accordion" data-options='{ "autoclose": false }'>
131+
<div data-component="Accordion"
132+
data-option-autoclose
133+
data-option-item='{ "styles": { "container": { "active": "transition-all duration-500 ease-out-expo" } } }'>
129134
<div
130135
data-component="AccordionItem"
131136
class="border -mb-px"
132-
data-options='{ "isOpen": true, "styles": { "container": { "active": "transition-all duration-500 ease-out-expo" } } }'
137+
data-option-is-open
133138
>
134139
<button data-ref="btn" class="block w-full p-4 text-left cursor-pointer">
135140
Lorem ipsum
@@ -145,7 +150,6 @@
145150
<div
146151
data-component="AccordionItem"
147152
class="border -mb-px"
148-
data-options='{ "styles": { "container": { "active": "transition-all duration-500 ease-out-expo" } } }'
149153
>
150154
<button data-ref="btn" class="block w-full p-4 text-left cursor-pointer">
151155
Lorem ipsum
@@ -161,7 +165,6 @@
161165
<div
162166
data-component="AccordionItem"
163167
class="border -mb-px"
164-
data-options='{ "styles": { "container": { "active": "transition-all duration-500 ease-out-expo" } } }'
165168
>
166169
<button data-ref="btn" class="block w-full p-4 text-left cursor-pointer">
167170
Lorem ipsum
@@ -184,7 +187,7 @@
184187
<div
185188
data-component="AccordionItem"
186189
class="border -mb-px"
187-
data-options='{ "styles": { "container": { "active": "transition-all duration-500 ease-out-expo" }, "icon": { "open": "transform rotate-180", "active": "transition duration-500 ease-out-expo" } } }'
190+
data-option-styles='{ "container": { "active": "transition-all duration-500 ease-out-expo" }, "icon": { "open": "transform rotate-180", "active": "transition duration-500 ease-out-expo" } }'
188191
>
189192
<button data-ref="btn" class="flex justify-between w-full p-4 text-left cursor-pointer">
190193
Show image #1
@@ -193,7 +196,7 @@
193196
<div data-ref="container" class="relative overflow-hidden">
194197
<div data-ref="content" class="w-full p-4 pt-0">
195198
<img
196-
data-options='{ "log": true }'
199+
data-option-log
197200
data-src="https://placekitten.com/200/100"
198201
width="200"
199202
height="100"
@@ -205,7 +208,7 @@
205208
<div
206209
data-component="AccordionItem"
207210
class="border -mb-px"
208-
data-options='{ "styles": { "container": { "active": "transition-all duration-500 ease-out-expo" }, "icon": { "open": "transform rotate-180", "active": "transition duration-500 ease-out-expo" } } }'
211+
data-option-styles='{ "container": { "active": "transition-all duration-500 ease-out-expo" }, "icon": { "open": "transform rotate-180", "active": "transition duration-500 ease-out-expo" } }'
209212
>
210213
<button data-ref="btn" class="flex justify-between w-full p-4 text-left cursor-pointer">
211214
Show image #2
@@ -220,7 +223,7 @@
220223
<div
221224
data-component="AccordionItem"
222225
class="border -mb-px"
223-
data-options='{ "styles": { "container": { "active": "transition-all duration-500 ease-out-expo" }, "icon": { "open": "transform rotate-180", "active": "transition duration-500 ease-out-expo" } } }'
226+
data-option-styles='{ "container": { "active": "transition-all duration-500 ease-out-expo" }, "icon": { "open": "transform rotate-180", "active": "transition duration-500 ease-out-expo" } }'
224227
>
225228
<button data-ref="btn" class="flex justify-between w-full p-4 text-left cursor-pointer">
226229
Show image #3
@@ -241,7 +244,7 @@
241244
<h2 id="components-tabs" class="text-lg mb-4">Tabs</h2>
242245
<div
243246
data-component="Tabs"
244-
data-options='{ "styles": { "btn": { "open": { "borderBottomColor": "#fff" } } } }'
247+
data-option-styles='{ "btn": { "open": { "borderBottomColor": "#fff" } } }'
245248
>
246249
<div class="flex px-4 border-b">
247250
<button data-ref="btn[]" class="-mb-px -ml-px p-4 border">Tab #1</button>
@@ -265,7 +268,7 @@ <h2 id="components-tabs" class="text-lg mb-4">Tabs</h2>
265268
<div data-ref="content[]" aria-hidden="true">
266269
<img
267270
data-src="https://placekitten.com/299/299"
268-
data-options='{ "debug": true }'
271+
data-option-debug
269272
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
270273
width="300"
271274
height="300"

demo/src/js/app.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1-
import Base from '~/src';
2-
import { Modal, Tabs, Accordion } from '~/src/components';
3-
import { withBreakpointObserver } from '~/src/decorators';
1+
import Base from '../../../src';
2+
import { Modal, Tabs, Accordion } from '../../../src/components';
3+
import withBreakpointObserver from '../../../src/decorators/withBreakpointObserver';
44
import BreakpointManagerDemo from './components/BreakPointManagerDemo';
55
import BreakpointObserverDemo from './components/BreakpointObserverDemo';
66

7+
/**
8+
* @typedef {import(../../../src/abstracts/Base/index).BaseConfig} BaseConfig
9+
*/
710
class App extends Base {
8-
get config() {
9-
return {
10-
name: 'App',
11-
log: true,
12-
components: {
13-
Accordion,
14-
BreakpointManagerDemo,
15-
BreakpointObserverDemo,
16-
Cursor: () => import(/* webpackChunkName: "Cursor" */ './components/Cursor'),
17-
Skew: () => import(/* webpackChunkName: "Skew" */ './components/Skew'),
18-
'[data-src]': () => import(/* webpackChunkName: "Lazyload" */ './components/Lazyload'),
19-
Modal: withBreakpointObserver(Modal),
20-
Tabs,
21-
},
22-
};
23-
}
11+
/** @type {Baseconfig} */
12+
static config = {
13+
name: 'App',
14+
refs: ['modal'],
15+
log: true,
16+
foo: 'dede',
17+
components: {
18+
Accordion,
19+
BreakpointManagerDemo,
20+
BreakpointObserverDemo,
21+
Cursor: () => import(/* webpackChunkName: "Cursor" */ './components/Cursor'),
22+
Skew: () => import(/* webpackChunkName: "Skew" */ './components/Skew'),
23+
'[data-src]': () => import(/* webpackChunkName: "Lazyload" */ './components/Lazyload'),
24+
Modal: withBreakpointObserver(Modal),
25+
Tabs,
26+
},
27+
};
2428

29+
/**
30+
* @inheritdoc
31+
*/
2532
mounted() {
2633
this.$log('Mounted 🎉');
2734
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import Base from '~/src';
1+
import Base from '../../../../../src';
22

33
export default class BreakpointManagerDemoBase extends Base {
4-
get config() {
5-
return {
6-
log: false,
7-
};
8-
}
4+
static config = {
5+
log: false,
6+
refs: ['content'],
7+
};
98

109
mounted() {
1110
this.$log('mounted');
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import BreakpointManagerDemoBase from './BreakpointManagerDemoBase';
22

33
export default class BreakpointManagerDemoDesktop extends BreakpointManagerDemoBase {
4-
get config() {
5-
return {
6-
...(super.config || {}),
7-
name: 'BreakpointManagerDemoDesktop',
8-
};
9-
}
4+
static config = {
5+
...(BreakpointManagerDemoBase.config || {}),
6+
name: 'BreakpointManagerDemoDesktop',
7+
};
108
}

0 commit comments

Comments
 (0)