@knowark/componarkjs 1.7.4 → 1.7.6
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/Makefile +3 -0
- package/jsconfig.json +23 -0
- package/lib/base/component/component.js +27 -26
- package/lib/base/component/component.test.js +76 -32
- package/lib/base/styles/styles.js +2 -2
- package/lib/base/utils/define.js +6 -7
- package/lib/base/utils/define.test.js +5 -5
- package/lib/base/utils/helpers.js +17 -12
- package/lib/base/utils/helpers.test.js +13 -13
- package/lib/base/utils/uuid.js +4 -4
- package/lib/components/audio/components/audio.js +6 -6
- package/lib/components/audio/components/audio.test.js +11 -10
- package/lib/components/audio/styles/ark.css.js +1 -1
- package/lib/components/camera/components/camera.test.js +6 -6
- package/lib/components/camera/styles/ark.css.js +1 -1
- package/lib/components/camera/styles/index.js +1 -1
- package/lib/components/capture/components/capture.js +2 -2
- package/lib/components/capture/components/capture.test.js +1 -1
- package/lib/components/droparea/components/droparea-preview.js +27 -26
- package/lib/components/droparea/components/droparea-preview.test.js +9 -9
- package/lib/components/droparea/components/droparea.js +19 -19
- package/lib/components/droparea/components/droparea.test.js +42 -42
- package/lib/components/droparea/styles/ark.css.js +1 -1
- package/lib/components/emit/components/emit.js +4 -4
- package/lib/components/emit/components/emit.test.js +5 -5
- package/lib/components/list/components/item.test.js +12 -14
- package/lib/components/list/components/list.js +25 -25
- package/lib/components/list/components/list.test.js +27 -29
- package/lib/components/paginator/components/paginator.js +2 -2
- package/lib/components/paginator/components/paginator.test.js +15 -18
- package/lib/components/paginator/styles/ark.css.js +1 -1
- package/lib/components/spinner/components/spinner.js +17 -17
- package/lib/components/spinner/styles/index.js +1 -1
- package/lib/components/splitview/components/splitview.detail.js +3 -3
- package/lib/components/splitview/components/splitview.detail.test.js +23 -23
- package/lib/components/splitview/components/splitview.js +3 -3
- package/lib/components/splitview/components/splitview.master.js +3 -3
- package/lib/components/splitview/components/splitview.master.test.js +2 -2
- package/lib/components/splitview/components/splitview.test.js +5 -7
- package/lib/components/translate/components/translate.js +17 -19
- package/lib/components/translate/components/translate.test.js +13 -14
- package/package.json +1 -1
- package/showcase/components/demos/audio.js +1 -1
- package/showcase/components/demos/camera.js +5 -6
- package/showcase/components/demos/droparea.js +6 -6
- package/showcase/components/demos/list.js +1 -2
- package/showcase/components/demos/paginator.js +8 -8
- package/showcase/components/demos/splitview.js +5 -7
- package/showcase/components/demos/translate.js +3 -4
- package/showcase/index.js +0 -1
- package/webpack.config.cjs +50 -50
- package/tsconfig.json +0 -23
|
@@ -11,14 +11,14 @@ export class Translate extends Component {
|
|
|
11
11
|
|
|
12
12
|
const dictionary = this.select('template')
|
|
13
13
|
if (dictionary) {
|
|
14
|
-
const content = dictionary.content
|
|
15
|
-
this.dictionary = JSON.parse(content)
|
|
14
|
+
const content = dictionary.content.textContent
|
|
15
|
+
this.dictionary = JSON.parse(content)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
return super.init(context)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
reflectedProperties() {
|
|
21
|
+
reflectedProperties () {
|
|
22
22
|
return ['languages', 'endpoint', 'namespace', 'root']
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -30,20 +30,20 @@ export class Translate extends Component {
|
|
|
30
30
|
this.content = `
|
|
31
31
|
<select listen on-change="onLanguageChanged">
|
|
32
32
|
${languages.map(code => `
|
|
33
|
-
<option value="${code}">${LANGUAGE_LIST[code]
|
|
33
|
+
<option value="${code}">${LANGUAGE_LIST[code].name}</option>
|
|
34
34
|
`)}
|
|
35
35
|
</select>
|
|
36
36
|
`
|
|
37
37
|
return super.render()
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
async onLanguageChanged(event) {
|
|
40
|
+
async onLanguageChanged (event) {
|
|
41
41
|
event.stopPropagation()
|
|
42
42
|
const language = event.target.value
|
|
43
43
|
await this.transliterate({ language })
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
async transliterate(options = {}) {
|
|
46
|
+
async transliterate (options = {}) {
|
|
47
47
|
const language = options.language || 'es'
|
|
48
48
|
const root = this.global.document.querySelector(
|
|
49
49
|
options.root || this.root)
|
|
@@ -56,11 +56,11 @@ export class Translate extends Component {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
parseKey(value) {
|
|
59
|
+
parseKey (value) {
|
|
60
60
|
let key = value
|
|
61
61
|
let namespace = this.namespace
|
|
62
62
|
|
|
63
|
-
const splitList
|
|
63
|
+
const splitList = value.split(':')
|
|
64
64
|
if (splitList.length > 1) {
|
|
65
65
|
namespace = splitList[0]
|
|
66
66
|
key = splitList[1]
|
|
@@ -69,17 +69,17 @@ export class Translate extends Component {
|
|
|
69
69
|
return { key, namespace }
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
async resolveDictionary(language, namespace) {
|
|
73
|
-
let dictionary = ((this.dictionary[language]
|
|
74
|
-
|
|
72
|
+
async resolveDictionary (language, namespace) {
|
|
73
|
+
let dictionary = ((this.dictionary[language] ||
|
|
74
|
+
{})[namespace] || null)
|
|
75
75
|
|
|
76
76
|
if (dictionary !== null) return dictionary
|
|
77
77
|
|
|
78
78
|
if (!this.global.fetch) return {}
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
const url = `${this.endpoint}/${language}/${namespace}.json`
|
|
81
81
|
const response = await this.global.fetch(url)
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
dictionary = await response.json()
|
|
84
84
|
|
|
85
85
|
this.dictionary[language] || (this.dictionary[language] = {})
|
|
@@ -87,14 +87,12 @@ export class Translate extends Component {
|
|
|
87
87
|
|
|
88
88
|
return dictionary
|
|
89
89
|
}
|
|
90
|
-
|
|
91
90
|
}
|
|
92
91
|
Component.define(tag, Translate)
|
|
93
92
|
|
|
94
|
-
|
|
95
93
|
const LANGUAGE_LIST = {
|
|
96
|
-
es: {name: 'Español'},
|
|
97
|
-
en: {name: 'English'},
|
|
98
|
-
fr: {name: 'Français'},
|
|
99
|
-
pt: {name: 'Português'}
|
|
94
|
+
es: { name: 'Español' },
|
|
95
|
+
en: { name: 'English' },
|
|
96
|
+
fr: { name: 'Français' },
|
|
97
|
+
pt: { name: 'Português' }
|
|
100
98
|
}
|
|
@@ -54,7 +54,7 @@ describe('Translate', () => {
|
|
|
54
54
|
</ark-translate>
|
|
55
55
|
`
|
|
56
56
|
container.appendChild(translateContainer)
|
|
57
|
-
const translate = /** @type Translate **/
|
|
57
|
+
const translate = /** @type Translate **/ (
|
|
58
58
|
translateContainer.querySelector('ark-translate'))
|
|
59
59
|
|
|
60
60
|
await translate.transliterate()
|
|
@@ -111,7 +111,7 @@ describe('Translate', () => {
|
|
|
111
111
|
const translate = /** @type Translate **/ (
|
|
112
112
|
translateContainer.querySelector('ark-translate'))
|
|
113
113
|
|
|
114
|
-
let options = { language: 'en'
|
|
114
|
+
let options = { language: 'en' }
|
|
115
115
|
await translate.transliterate(options)
|
|
116
116
|
|
|
117
117
|
const expectedRoot = document.createElement('div')
|
|
@@ -124,7 +124,6 @@ describe('Translate', () => {
|
|
|
124
124
|
`
|
|
125
125
|
expect(root).toEqual(expectedRoot)
|
|
126
126
|
|
|
127
|
-
|
|
128
127
|
// Unknown Namespace:
|
|
129
128
|
|
|
130
129
|
root.innerHTML = /* html */`
|
|
@@ -171,18 +170,17 @@ describe('Translate', () => {
|
|
|
171
170
|
container.appendChild(translateContainer)
|
|
172
171
|
const translate = /** @type Translate **/ (
|
|
173
172
|
translateContainer.querySelector('ark-translate'))
|
|
174
|
-
const mockEvent = {
|
|
175
|
-
target: {value: 'en'}, stopPropagation: () => {}}
|
|
173
|
+
const mockEvent = { target: { value: 'en' }, stopPropagation: () => {} }
|
|
176
174
|
let givenOptions = null
|
|
177
175
|
translate.transliterate = async (options) => {
|
|
178
|
-
givenOptions = options
|
|
176
|
+
givenOptions = options
|
|
177
|
+
}
|
|
179
178
|
|
|
180
179
|
await translate.onLanguageChanged(mockEvent)
|
|
181
180
|
|
|
182
|
-
expect(givenOptions).toEqual({language: 'en'})
|
|
181
|
+
expect(givenOptions).toEqual({ language: 'en' })
|
|
183
182
|
})
|
|
184
183
|
|
|
185
|
-
|
|
186
184
|
it('fetches its translation files from the server', async () => {
|
|
187
185
|
const root = document.createElement('div')
|
|
188
186
|
root.innerHTML = /* html */`
|
|
@@ -203,15 +201,16 @@ describe('Translate', () => {
|
|
|
203
201
|
|
|
204
202
|
const mockFetch = async (url) => ({
|
|
205
203
|
json: async () => ({
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
hello: 'Hola',
|
|
205
|
+
world: 'Mundo',
|
|
206
|
+
happy: 'Feliz'
|
|
209
207
|
})
|
|
210
208
|
})
|
|
211
|
-
translate.init({
|
|
212
|
-
fetch: mockFetch, document
|
|
209
|
+
translate.init({
|
|
210
|
+
global: { fetch: mockFetch, document }
|
|
211
|
+
})
|
|
213
212
|
|
|
214
|
-
await translate.transliterate({language: 'es'})
|
|
213
|
+
await translate.transliterate({ language: 'es' })
|
|
215
214
|
|
|
216
215
|
const expectedRoot = document.createElement('div')
|
|
217
216
|
expectedRoot.innerHTML = /* html */`
|
package/package.json
CHANGED
|
@@ -24,25 +24,25 @@ export class CameraDemo extends Component {
|
|
|
24
24
|
</a>
|
|
25
25
|
`
|
|
26
26
|
|
|
27
|
-
this.camera
|
|
27
|
+
this.camera.start()
|
|
28
28
|
|
|
29
29
|
return super.render()
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
disconnectedCallback () {
|
|
33
|
-
this.camera
|
|
33
|
+
this.camera.stop()
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
takepicture () {
|
|
37
|
-
this.photo.setAttribute('src', this.camera
|
|
37
|
+
this.photo.setAttribute('src', this.camera.dataURL(200, 200))
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
startCamera () {
|
|
41
|
-
this.camera
|
|
41
|
+
this.camera.start()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
stopCamera () {
|
|
45
|
-
this.camera
|
|
45
|
+
this.camera.stop()
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
get camera () {
|
|
@@ -53,7 +53,6 @@ export class CameraDemo extends Component {
|
|
|
53
53
|
get photo () {
|
|
54
54
|
return this.querySelector('[data-photo]')
|
|
55
55
|
}
|
|
56
|
-
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
const styles = /* css */`
|
|
@@ -2,11 +2,11 @@ import { Component } from '@knowark/componarkjs'
|
|
|
2
2
|
|
|
3
3
|
const tag = 'demo-droparea'
|
|
4
4
|
export class DropareaDemo extends Component {
|
|
5
|
-
init(context) {
|
|
5
|
+
init (context) {
|
|
6
6
|
return super.init(context)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
render() {
|
|
9
|
+
render () {
|
|
10
10
|
this.innerHTML = /* html */ `
|
|
11
11
|
<h1 class="title">
|
|
12
12
|
This is a drop area
|
|
@@ -38,7 +38,7 @@ export class DropareaDemo extends Component {
|
|
|
38
38
|
return super.render()
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
async load() {
|
|
41
|
+
async load () {
|
|
42
42
|
const myUrl =
|
|
43
43
|
'https://images.unsplash.com/photo-1530281700549-e82e7bf110d6?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1888&q=80'
|
|
44
44
|
|
|
@@ -46,15 +46,15 @@ export class DropareaDemo extends Component {
|
|
|
46
46
|
this.select('ark-droparea[data-load]').update({ contextFiles: [myFile] })
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
async getFileFromUrl(url, name, defaultType = 'image/jpeg') {
|
|
49
|
+
async getFileFromUrl (url, name, defaultType = 'image/jpeg') {
|
|
50
50
|
const response = await fetch(url)
|
|
51
51
|
const data = await response.blob()
|
|
52
52
|
return new File([data], name, {
|
|
53
|
-
type: response.headers.get('content-type') || defaultType
|
|
53
|
+
type: response.headers.get('content-type') || defaultType
|
|
54
54
|
})
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
async onFileList(event) {
|
|
57
|
+
async onFileList (event) {
|
|
58
58
|
const element = this.querySelector('[data-file-multi]')
|
|
59
59
|
const droparea = this.select('.ark-droparea')
|
|
60
60
|
const urlList = []
|
|
@@ -60,7 +60,7 @@ export class ListDemo extends Component {
|
|
|
60
60
|
templateList
|
|
61
61
|
.init({
|
|
62
62
|
source: sourceTemplate,
|
|
63
|
-
template
|
|
63
|
+
template
|
|
64
64
|
})
|
|
65
65
|
.render()
|
|
66
66
|
|
|
@@ -85,5 +85,4 @@ const styles = /* css */`
|
|
|
85
85
|
}
|
|
86
86
|
`
|
|
87
87
|
|
|
88
|
-
|
|
89
88
|
Component.define(tag, ListDemo, styles)
|
|
@@ -2,14 +2,14 @@ import { Component } from '@knowark/componarkjs'
|
|
|
2
2
|
|
|
3
3
|
const tag = 'demo-paginator'
|
|
4
4
|
export class PaginatorDemo extends Component {
|
|
5
|
-
init(context = {}) {
|
|
5
|
+
init (context = {}) {
|
|
6
6
|
this.limit = 1
|
|
7
7
|
this.offset = 0
|
|
8
8
|
this.page = 1
|
|
9
9
|
return super.init(context)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
render() {
|
|
12
|
+
render () {
|
|
13
13
|
this.content = /* html */ `
|
|
14
14
|
<ark-list background="light" color="dark"></ark-list>
|
|
15
15
|
<ark-paginator listen on-page-changed="onPageChanged"
|
|
@@ -25,7 +25,7 @@ export class PaginatorDemo extends Component {
|
|
|
25
25
|
return super.render()
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async load() {
|
|
28
|
+
async load () {
|
|
29
29
|
const template = (item) => /* html */ `
|
|
30
30
|
<h1>${item.year}</h1>
|
|
31
31
|
<span data-first>FIRST: ${item.first}</span>
|
|
@@ -43,7 +43,7 @@ export class PaginatorDemo extends Component {
|
|
|
43
43
|
this.select('ark-list')
|
|
44
44
|
.init({
|
|
45
45
|
source: source(),
|
|
46
|
-
template
|
|
46
|
+
template
|
|
47
47
|
})
|
|
48
48
|
.render()
|
|
49
49
|
|
|
@@ -51,14 +51,14 @@ export class PaginatorDemo extends Component {
|
|
|
51
51
|
paginator
|
|
52
52
|
.init({
|
|
53
53
|
collectionSize: this.list.length,
|
|
54
|
-
currentPage: this.page
|
|
54
|
+
currentPage: this.page
|
|
55
55
|
})
|
|
56
56
|
.render()
|
|
57
57
|
return super.load()
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/** @param {CustomEvent} event */
|
|
61
|
-
async onPageChanged(event) {
|
|
61
|
+
async onPageChanged (event) {
|
|
62
62
|
event.stopPropagation()
|
|
63
63
|
this.limit = event.detail.limit
|
|
64
64
|
this.offset = event.detail.offset
|
|
@@ -66,7 +66,7 @@ export class PaginatorDemo extends Component {
|
|
|
66
66
|
await this.update()
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
get list() {
|
|
69
|
+
get list () {
|
|
70
70
|
return [
|
|
71
71
|
{ first: 'Colombia', second: 'Argentina', year: 2016 },
|
|
72
72
|
{ first: 'Uruguay', second: 'Colombia', year: 2017 },
|
|
@@ -75,7 +75,7 @@ export class PaginatorDemo extends Component {
|
|
|
75
75
|
{ first: 'Argentina', second: 'Argentina', year: 2020 },
|
|
76
76
|
{ first: 'Chile', second: 'Colombia', year: 2021 },
|
|
77
77
|
{ first: 'Colombia', second: 'Argentina', year: 2022 },
|
|
78
|
-
{ first: 'Uruguay', second: 'Bolivia', year: 2023 }
|
|
78
|
+
{ first: 'Uruguay', second: 'Bolivia', year: 2023 }
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -29,7 +29,6 @@ export class SplitViewDemo extends Component {
|
|
|
29
29
|
return super.render()
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
32
|
initList () {
|
|
34
33
|
const template = item => /* html */ `
|
|
35
34
|
<h1>${item.year}</h1>
|
|
@@ -46,17 +45,16 @@ export class SplitViewDemo extends Component {
|
|
|
46
45
|
]
|
|
47
46
|
|
|
48
47
|
this.select('[data-list]').init({
|
|
49
|
-
source
|
|
50
|
-
template
|
|
48
|
+
source,
|
|
49
|
+
template
|
|
51
50
|
}).render()
|
|
52
|
-
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
Component.define(tag, SplitViewDemo)
|
|
56
54
|
|
|
57
|
-
tag =
|
|
55
|
+
tag = 'demo-splitview-detail'
|
|
58
56
|
export class SplitviewDetailDemo extends Component {
|
|
59
|
-
init(context = {}) {
|
|
57
|
+
init (context = {}) {
|
|
60
58
|
if (!context.data) return super.init()
|
|
61
59
|
|
|
62
60
|
const data = context.data
|
|
@@ -66,7 +64,7 @@ export class SplitviewDetailDemo extends Component {
|
|
|
66
64
|
return super.init()
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
render() {
|
|
67
|
+
render () {
|
|
70
68
|
this.content = this.first
|
|
71
69
|
? /* html */ `
|
|
72
70
|
<button listen on-click="onClick"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Component } from '@knowark/componarkjs'
|
|
2
2
|
|
|
3
|
-
const tag =
|
|
3
|
+
const tag = 'demo-translate'
|
|
4
4
|
export class TranslateDemo extends Component {
|
|
5
|
-
render() {
|
|
6
|
-
const context = JSON.stringify({name: 'Esteban'})
|
|
5
|
+
render () {
|
|
6
|
+
const context = JSON.stringify({ name: 'Esteban' })
|
|
7
7
|
this.content = /* html */ `
|
|
8
8
|
|
|
9
9
|
<section class="translate-demo_container">
|
|
@@ -29,7 +29,6 @@ export class TranslateDemo extends Component {
|
|
|
29
29
|
|
|
30
30
|
return super.render()
|
|
31
31
|
}
|
|
32
|
-
|
|
33
32
|
}
|
|
34
33
|
const styles = /* css */ `
|
|
35
34
|
|
package/showcase/index.js
CHANGED
package/webpack.config.cjs
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
const path = require(
|
|
2
|
-
const { DefinePlugin, EnvironmentPlugin } = require(
|
|
3
|
-
const { CleanWebpackPlugin } = require(
|
|
4
|
-
const CopyWebpackPlugin = require(
|
|
5
|
-
const HtmlWebpackPlugin = require(
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const { DefinePlugin, EnvironmentPlugin } = require('webpack')
|
|
3
|
+
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
|
4
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
5
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
6
6
|
|
|
7
7
|
module.exports = (env, argv) => {
|
|
8
|
-
const devMode = argv.mode ===
|
|
8
|
+
const devMode = argv.mode === 'development'
|
|
9
9
|
const target = env.TARGET
|
|
10
10
|
|
|
11
11
|
const commonConfig = {
|
|
12
12
|
mode: argv.mode,
|
|
13
13
|
entry: {
|
|
14
|
-
showcase:
|
|
14
|
+
showcase: './lib/showcase/design/index.js'
|
|
15
15
|
},
|
|
16
16
|
plugins: [
|
|
17
17
|
new CleanWebpackPlugin(),
|
|
18
18
|
new HtmlWebpackPlugin({
|
|
19
|
-
chunks: [
|
|
20
|
-
title:
|
|
21
|
-
template:
|
|
19
|
+
chunks: ['showcase', 'runtime'],
|
|
20
|
+
title: 'Componark',
|
|
21
|
+
template: './lib/showcase/design/index.html'
|
|
22
22
|
}),
|
|
23
23
|
new CopyWebpackPlugin({
|
|
24
|
-
patterns: [
|
|
24
|
+
patterns: ['lib/showcase/design/.htaccess']
|
|
25
25
|
}),
|
|
26
26
|
new DefinePlugin({
|
|
27
27
|
PRODUCTION: !devMode,
|
|
28
|
-
VERSION: JSON.stringify(require(
|
|
29
|
-
TARGET: JSON.stringify(target)
|
|
30
|
-
})
|
|
28
|
+
VERSION: JSON.stringify(require('./package.json').version),
|
|
29
|
+
TARGET: JSON.stringify(target)
|
|
30
|
+
})
|
|
31
31
|
],
|
|
32
32
|
module: {
|
|
33
33
|
rules: [
|
|
34
34
|
{
|
|
35
35
|
test: /\.(png|svg|jpg|gif)$/,
|
|
36
|
-
use: [
|
|
36
|
+
use: ['file-loader']
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
|
|
40
40
|
use: [
|
|
41
41
|
{
|
|
42
|
-
loader:
|
|
42
|
+
loader: 'file-loader',
|
|
43
43
|
options: {
|
|
44
|
-
name:
|
|
45
|
-
outputPath:
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
]
|
|
44
|
+
name: '[name].[ext]',
|
|
45
|
+
outputPath: 'fonts/'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
49
|
}
|
|
50
|
-
]
|
|
50
|
+
]
|
|
51
51
|
},
|
|
52
52
|
resolve: {
|
|
53
53
|
alias: {
|
|
54
|
-
base: path.resolve(__dirname,
|
|
55
|
-
components: path.resolve(__dirname,
|
|
56
|
-
screens: path.resolve(__dirname,
|
|
57
|
-
}
|
|
58
|
-
}
|
|
54
|
+
base: path.resolve(__dirname, './lib/base/'),
|
|
55
|
+
components: path.resolve(__dirname, './lib/components/'),
|
|
56
|
+
screens: path.resolve(__dirname, './lib/showcase/screens/')
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
const arkConfig = Object.assign({}, commonConfig, {
|
|
62
|
-
name:
|
|
62
|
+
name: 'ark',
|
|
63
63
|
mode: argv.mode,
|
|
64
64
|
output: {
|
|
65
|
-
publicPath:
|
|
66
|
-
filename:
|
|
67
|
-
path: path.join(__dirname,
|
|
65
|
+
publicPath: '/ark/',
|
|
66
|
+
filename: '[name].[contenthash].js',
|
|
67
|
+
path: path.join(__dirname, '/dist/ark')
|
|
68
68
|
},
|
|
69
69
|
plugins: commonConfig.plugins.concat([
|
|
70
70
|
new EnvironmentPlugin({
|
|
71
|
-
ARK_DESIGN:
|
|
72
|
-
})
|
|
73
|
-
])
|
|
71
|
+
ARK_DESIGN: 'ark'
|
|
72
|
+
})
|
|
73
|
+
])
|
|
74
74
|
})
|
|
75
75
|
|
|
76
76
|
const rootConfig = {
|
|
77
|
-
name:
|
|
77
|
+
name: 'root',
|
|
78
78
|
mode: argv.mode,
|
|
79
79
|
entry: {
|
|
80
|
-
index:
|
|
80
|
+
index: './lib/showcase/index.js'
|
|
81
81
|
},
|
|
82
82
|
plugins: [
|
|
83
83
|
new CleanWebpackPlugin(),
|
|
84
84
|
new DefinePlugin({
|
|
85
85
|
PRODUCTION: !devMode,
|
|
86
|
-
VERSION: JSON.stringify(require(
|
|
87
|
-
TARGET: JSON.stringify(target)
|
|
86
|
+
VERSION: JSON.stringify(require('./package.json').version),
|
|
87
|
+
TARGET: JSON.stringify(target)
|
|
88
88
|
}),
|
|
89
89
|
new CopyWebpackPlugin({
|
|
90
90
|
patterns: [
|
|
91
|
-
{ from:
|
|
92
|
-
]
|
|
91
|
+
{ from: 'lib/showcase/locales/', to: 'locales/' }
|
|
92
|
+
]
|
|
93
93
|
}),
|
|
94
94
|
new HtmlWebpackPlugin({
|
|
95
|
-
title:
|
|
96
|
-
template:
|
|
97
|
-
})
|
|
98
|
-
]
|
|
95
|
+
title: 'Componark',
|
|
96
|
+
template: './lib/showcase/index.html'
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (devMode) {
|
|
102
102
|
rootConfig.devServer = {
|
|
103
103
|
static: [
|
|
104
|
-
path.join(__dirname,
|
|
105
|
-
path.join(__dirname,
|
|
104
|
+
path.join(__dirname, 'dist'),
|
|
105
|
+
path.join(__dirname, 'dist/ark')
|
|
106
106
|
],
|
|
107
107
|
historyApiFallback: {
|
|
108
108
|
rewrites: [
|
|
109
|
-
{ from: /^\/$/, to:
|
|
110
|
-
{ from: /^\/ark/, to:
|
|
111
|
-
]
|
|
109
|
+
{ from: /^\/$/, to: '/index.html' },
|
|
110
|
+
{ from: /^\/ark/, to: '/ark/index.html' }
|
|
111
|
+
]
|
|
112
112
|
},
|
|
113
|
-
port: 7890
|
|
113
|
+
port: 7890
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2017",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"checkJs": true,
|
|
7
|
-
"noEmit": true,
|
|
8
|
-
"noImplicitThis": false,
|
|
9
|
-
"noImplicitAny": false,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"baseUrl": "lib",
|
|
13
|
-
"paths": {
|
|
14
|
-
"@base*": [
|
|
15
|
-
"base"
|
|
16
|
-
"base*"
|
|
17
|
-
],
|
|
18
|
-
"*": [
|
|
19
|
-
"*"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|