@knowark/componarkjs 1.13.2 → 1.13.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.
- package/lib/base/component/component.js +1 -1
- package/lib/base/component/component.test.js +4 -2
- package/lib/base/utils/helpers.test.js +2 -2
- package/lib/components/audio/components/audio.js +3 -2
- package/lib/components/camera/components/camera.js +3 -3
- package/lib/components/capture/components/capture.js +3 -3
- package/lib/components/droparea/components/droparea-preview.js +9 -8
- package/lib/components/droparea/components/droparea-preview.test.js +4 -2
- package/lib/components/droparea/components/droparea.js +6 -4
- package/lib/components/droparea/components/droparea.test.js +2 -1
- package/lib/components/emit/components/emit.js +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/list/components/{list.item.js → item.js} +1 -1
- package/lib/components/list/components/item.test.js +1 -1
- package/lib/components/list/components/list.js +2 -2
- package/lib/components/list/index.js +1 -1
- package/lib/components/paginator/components/paginator.js +3 -2
- package/lib/components/spinner/components/spinner.js +1 -1
- package/lib/components/splitview/components/splitview.detail.js +1 -1
- package/lib/components/splitview/components/splitview.detail.test.js +3 -1
- package/lib/components/splitview/components/splitview.js +4 -2
- package/lib/components/splitview/components/splitview.master.js +2 -1
- package/lib/components/splitview/components/splitview.master.test.js +1 -1
- package/lib/components/splitview/components/splitview.test.js +1 -1
- package/lib/components/translate/components/translate.js +4 -2
- package/package.json +6 -2
- package/showcase/components/index.html +1 -1
- package/showcase/index.js +1 -0
- package/{jsconfig.json → tsconfig.json} +8 -10
- package/types/base/component/component.d.ts +48 -0
- package/types/base/component/component.d.ts.map +1 -0
- package/types/base/component/component.test.d.ts +2 -0
- package/types/base/component/component.test.d.ts.map +1 -0
- package/types/base/component/index.d.ts +8 -0
- package/types/base/component/index.d.ts.map +1 -0
- package/types/base/index.d.ts +2 -0
- package/types/base/index.d.ts.map +1 -0
- package/types/base/styles/index.d.ts +3 -0
- package/types/base/styles/index.d.ts.map +1 -0
- package/types/base/styles/styles.d.ts +3 -0
- package/types/base/styles/styles.d.ts.map +1 -0
- package/types/base/utils/define.d.ts +5 -0
- package/types/base/utils/define.d.ts.map +1 -0
- package/types/base/utils/define.test.d.ts +2 -0
- package/types/base/utils/define.test.d.ts.map +1 -0
- package/types/base/utils/format.d.ts +13 -0
- package/types/base/utils/format.d.ts.map +1 -0
- package/types/base/utils/format.test.d.ts +2 -0
- package/types/base/utils/format.test.d.ts.map +1 -0
- package/types/base/utils/helpers.d.ts +11 -0
- package/types/base/utils/helpers.d.ts.map +1 -0
- package/types/base/utils/helpers.test.d.ts +2 -0
- package/types/base/utils/helpers.test.d.ts.map +1 -0
- package/types/base/utils/index.d.ts +6 -0
- package/types/base/utils/index.d.ts.map +1 -0
- package/types/base/utils/slots.d.ts +15 -0
- package/types/base/utils/slots.d.ts.map +1 -0
- package/types/base/utils/slots.test.d.ts +2 -0
- package/types/base/utils/slots.test.d.ts.map +1 -0
- package/types/base/utils/uuid.d.ts +3 -0
- package/types/base/utils/uuid.d.ts.map +1 -0
- package/types/base/utils/uuid.test.d.ts +2 -0
- package/types/base/utils/uuid.test.d.ts.map +1 -0
- package/types/components/audio/components/audio.d.ts +18 -0
- package/types/components/audio/components/audio.d.ts.map +1 -0
- package/types/components/audio/components/audio.test.d.ts +2 -0
- package/types/components/audio/components/audio.test.d.ts.map +1 -0
- package/types/components/audio/index.d.ts +2 -0
- package/types/components/audio/index.d.ts.map +1 -0
- package/types/components/audio/styles/ark.css.d.ts +3 -0
- package/types/components/audio/styles/ark.css.d.ts.map +1 -0
- package/types/components/audio/styles/index.d.ts +3 -0
- package/types/components/audio/styles/index.d.ts.map +1 -0
- package/types/components/camera/components/camera.d.ts +18 -0
- package/types/components/camera/components/camera.d.ts.map +1 -0
- package/types/components/camera/components/camera.test.d.ts +2 -0
- package/types/components/camera/components/camera.test.d.ts.map +1 -0
- package/types/components/camera/index.d.ts +2 -0
- package/types/components/camera/index.d.ts.map +1 -0
- package/types/components/camera/styles/ark.css.d.ts +3 -0
- package/types/components/camera/styles/ark.css.d.ts.map +1 -0
- package/types/components/camera/styles/index.d.ts +3 -0
- package/types/components/camera/styles/index.d.ts.map +1 -0
- package/types/components/capture/components/capture.d.ts +10 -0
- package/types/components/capture/components/capture.d.ts.map +1 -0
- package/types/components/capture/components/capture.test.d.ts +2 -0
- package/types/components/capture/components/capture.test.d.ts.map +1 -0
- package/types/components/capture/index.d.ts +2 -0
- package/types/components/capture/index.d.ts.map +1 -0
- package/types/components/droparea/components/droparea-preview.d.ts +21 -0
- package/types/components/droparea/components/droparea-preview.d.ts.map +1 -0
- package/types/components/droparea/components/droparea-preview.test.d.ts +2 -0
- package/types/components/droparea/components/droparea-preview.test.d.ts.map +1 -0
- package/types/components/droparea/components/droparea.d.ts +32 -0
- package/types/components/droparea/components/droparea.d.ts.map +1 -0
- package/types/components/droparea/components/droparea.test.d.ts +2 -0
- package/types/components/droparea/components/droparea.test.d.ts.map +1 -0
- package/types/components/droparea/index.d.ts +2 -0
- package/types/components/droparea/index.d.ts.map +1 -0
- package/types/components/droparea/styles/ark.css.d.ts +3 -0
- package/types/components/droparea/styles/ark.css.d.ts.map +1 -0
- package/types/components/droparea/styles/index.d.ts +3 -0
- package/types/components/droparea/styles/index.d.ts.map +1 -0
- package/types/components/emit/components/emit.d.ts +10 -0
- package/types/components/emit/components/emit.d.ts.map +1 -0
- package/types/components/emit/components/emit.test.d.ts +2 -0
- package/types/components/emit/components/emit.test.d.ts.map +1 -0
- package/types/components/emit/index.d.ts +2 -0
- package/types/components/emit/index.d.ts.map +1 -0
- package/types/components/index.d.ts +10 -0
- package/types/components/index.d.ts.map +1 -0
- package/types/components/list/components/item.d.ts +8 -0
- package/types/components/list/components/item.d.ts.map +1 -0
- package/types/components/list/components/item.test.d.ts +2 -0
- package/types/components/list/components/item.test.d.ts.map +1 -0
- package/types/components/list/components/list.d.ts +13 -0
- package/types/components/list/components/list.d.ts.map +1 -0
- package/types/components/list/components/list.test.d.ts +2 -0
- package/types/components/list/components/list.test.d.ts.map +1 -0
- package/types/components/list/index.d.ts +3 -0
- package/types/components/list/index.d.ts.map +1 -0
- package/types/components/paginator/components/paginator.d.ts +32 -0
- package/types/components/paginator/components/paginator.d.ts.map +1 -0
- package/types/components/paginator/components/paginator.test.d.ts +2 -0
- package/types/components/paginator/components/paginator.test.d.ts.map +1 -0
- package/types/components/paginator/index.d.ts +2 -0
- package/types/components/paginator/index.d.ts.map +1 -0
- package/types/components/paginator/styles/ark.css.d.ts +3 -0
- package/types/components/paginator/styles/ark.css.d.ts.map +1 -0
- package/types/components/paginator/styles/index.d.ts +3 -0
- package/types/components/paginator/styles/index.d.ts.map +1 -0
- package/types/components/spinner/components/spinner.d.ts +11 -0
- package/types/components/spinner/components/spinner.d.ts.map +1 -0
- package/types/components/spinner/components/spinner.test.d.ts +2 -0
- package/types/components/spinner/components/spinner.test.d.ts.map +1 -0
- package/types/components/spinner/index.d.ts +2 -0
- package/types/components/spinner/index.d.ts.map +1 -0
- package/types/components/spinner/styles/ark.css.d.ts +3 -0
- package/types/components/spinner/styles/ark.css.d.ts.map +1 -0
- package/types/components/spinner/styles/index.d.ts +3 -0
- package/types/components/spinner/styles/index.d.ts.map +1 -0
- package/types/components/splitview/components/splitview.d.ts +12 -0
- package/types/components/splitview/components/splitview.d.ts.map +1 -0
- package/types/components/splitview/components/splitview.detail.d.ts +10 -0
- package/types/components/splitview/components/splitview.detail.d.ts.map +1 -0
- package/types/components/splitview/components/splitview.detail.test.d.ts +2 -0
- package/types/components/splitview/components/splitview.detail.test.d.ts.map +1 -0
- package/types/components/splitview/components/splitview.master.d.ts +8 -0
- package/types/components/splitview/components/splitview.master.d.ts.map +1 -0
- package/types/components/splitview/components/splitview.master.test.d.ts +2 -0
- package/types/components/splitview/components/splitview.master.test.d.ts.map +1 -0
- package/types/components/splitview/components/splitview.test.d.ts +2 -0
- package/types/components/splitview/components/splitview.test.d.ts.map +1 -0
- package/types/components/splitview/index.d.ts +4 -0
- package/types/components/splitview/index.d.ts.map +1 -0
- package/types/components/translate/components/translate.d.ts +18 -0
- package/types/components/translate/components/translate.d.ts.map +1 -0
- package/types/components/translate/components/translate.test.d.ts +2 -0
- package/types/components/translate/components/translate.test.d.ts.map +1 -0
- package/types/components/translate/index.d.ts +2 -0
- package/types/components/translate/index.d.ts.map +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -0
- package/knowarkjs.code-workspace +0 -29
|
@@ -53,7 +53,7 @@ export class Component extends globalThis.HTMLElement {
|
|
|
53
53
|
|
|
54
54
|
connectedCallback () {
|
|
55
55
|
try {
|
|
56
|
-
!(
|
|
56
|
+
!Boolean(Object.keys(this.local).length) && this.init({})
|
|
57
57
|
this.render()
|
|
58
58
|
} catch (error) {
|
|
59
59
|
this.emit('error', error)
|
|
@@ -119,7 +119,8 @@ describe('Component', () => {
|
|
|
119
119
|
})
|
|
120
120
|
|
|
121
121
|
it('calls the load method on connectedCallback', async () => {
|
|
122
|
-
const component =
|
|
122
|
+
const component = /** @type {Component} */ (
|
|
123
|
+
document.createElement('mock-component'))
|
|
123
124
|
const initSpy = jest.spyOn(component, 'init')
|
|
124
125
|
const renderSpy = jest.spyOn(component, 'render')
|
|
125
126
|
const loadSpy = jest.spyOn(component, 'load')
|
|
@@ -133,7 +134,8 @@ describe('Component', () => {
|
|
|
133
134
|
|
|
134
135
|
it('catches and re-raises connectedCallback errors', async () => {
|
|
135
136
|
expect.assertions(1)
|
|
136
|
-
const component =
|
|
137
|
+
const component = /** @type {Component} */ (
|
|
138
|
+
document.createElement('mock-component'))
|
|
137
139
|
const consoleError = console.error
|
|
138
140
|
console.error = jest.fn()
|
|
139
141
|
component.render = () => {
|
|
@@ -52,7 +52,7 @@ describe('Helpers', () => {
|
|
|
52
52
|
|
|
53
53
|
it('can listen events', () => {
|
|
54
54
|
const element = document.createElement('div')
|
|
55
|
-
element
|
|
55
|
+
Object.defineProperty(element, 'binding', {value: 'listen'})
|
|
56
56
|
element.innerHTML = /* html */`
|
|
57
57
|
<button listen on-click="myMethod"></button>
|
|
58
58
|
`
|
|
@@ -69,7 +69,7 @@ describe('Helpers', () => {
|
|
|
69
69
|
|
|
70
70
|
it('ignores missing methods when listening', () => {
|
|
71
71
|
const element = document.createElement('div')
|
|
72
|
-
element
|
|
72
|
+
Object.defineProperty(element, 'binding', {value: 'listen'})
|
|
73
73
|
element.innerHTML = /* html */`
|
|
74
74
|
<button listen on-click="missing"></button>
|
|
75
75
|
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from '
|
|
1
|
+
import { Component } from '#base/index.js'
|
|
2
2
|
import styles from '../styles/index.js'
|
|
3
3
|
|
|
4
4
|
const tag = 'ark-audio'
|
|
@@ -93,7 +93,8 @@ export class Audio extends Component {
|
|
|
93
93
|
|
|
94
94
|
/** @param {any} event */
|
|
95
95
|
_onData (event) {
|
|
96
|
-
const audio =
|
|
96
|
+
const audio = /** @type {HTMLAudioElement} */ (
|
|
97
|
+
this.querySelector('.ark-audio__audio'))
|
|
97
98
|
audio.src = this.global.URL.createObjectURL(event.data)
|
|
98
99
|
const reader = new this.global.FileReader()
|
|
99
100
|
reader.readAsDataURL(event.data)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from '
|
|
1
|
+
import { Component } from '#base/index.js'
|
|
2
2
|
import styles from '../styles/index.js'
|
|
3
3
|
|
|
4
4
|
const tag = 'ark-camera'
|
|
@@ -34,8 +34,8 @@ export class Camera extends Component {
|
|
|
34
34
|
|
|
35
35
|
/** @returns {string} */
|
|
36
36
|
dataURL (width = null, height = null) {
|
|
37
|
-
/** @type {HTMLCanvasElement} */
|
|
38
|
-
|
|
37
|
+
const canvas = /** @type {HTMLCanvasElement} */ (
|
|
38
|
+
this.canvas.cloneNode(true))
|
|
39
39
|
|
|
40
40
|
canvas.width = width || this.width
|
|
41
41
|
canvas.height = height || this.height
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Component } from
|
|
1
|
+
import { Component } from "#base/index.js"
|
|
2
2
|
|
|
3
3
|
const tag = 'ark-capture'
|
|
4
4
|
export class Capture extends Component {
|
|
5
5
|
constructor () {
|
|
6
6
|
super()
|
|
7
|
-
|
|
8
|
-
this.addEventListener(
|
|
7
|
+
this.receive = this.receive || 'emit'
|
|
8
|
+
this.addEventListener(this.receive, this.handle.bind(this))
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
reflectedProperties () {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Component } from '
|
|
1
|
+
import { Component } from '#base/index.js'
|
|
2
2
|
import './droparea.js'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
/** @import {Droparea} from './droparea.js' */
|
|
5
|
+
|
|
4
6
|
const tag = 'ark-droparea-preview'
|
|
5
7
|
|
|
6
8
|
export class DropareaPreview extends Component {
|
|
@@ -38,7 +40,7 @@ export class DropareaPreview extends Component {
|
|
|
38
40
|
this.toggleVisibility()
|
|
39
41
|
|
|
40
42
|
if (!this.droparea.hasAttribute('single')) {
|
|
41
|
-
picture.setAttribute('index', this.fileIndex(file))
|
|
43
|
+
picture.setAttribute('index', String(this.fileIndex(file)))
|
|
42
44
|
this.enableDragSort('drag-sort-enable')
|
|
43
45
|
}
|
|
44
46
|
}
|
|
@@ -109,14 +111,13 @@ export class DropareaPreview extends Component {
|
|
|
109
111
|
const newList = []
|
|
110
112
|
nodeList.forEach((item, index) => {
|
|
111
113
|
newList.push(this.droparea.fileList[item.getAttribute('index')])
|
|
112
|
-
item.setAttribute('index', index)
|
|
114
|
+
item.setAttribute('index', String(index))
|
|
113
115
|
})
|
|
114
116
|
this.droparea.fileList = newList
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
fileExists (file) {
|
|
118
|
-
|
|
119
|
-
return present
|
|
120
|
+
return this.files.some((item) => item.name === file.name)
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
removeFile (file, event) {
|
|
@@ -125,7 +126,7 @@ export class DropareaPreview extends Component {
|
|
|
125
126
|
this.droparea.fileList.splice(fileIndex, 1)
|
|
126
127
|
element.parentNode.remove()
|
|
127
128
|
this.selectAll('li').forEach((item, index) =>
|
|
128
|
-
item.setAttribute('index', index)
|
|
129
|
+
item.setAttribute('index', String(index))
|
|
129
130
|
)
|
|
130
131
|
this.toggleVisibility()
|
|
131
132
|
this.dispatchAlterEvent()
|
|
@@ -136,7 +137,7 @@ export class DropareaPreview extends Component {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
get droparea () {
|
|
139
|
-
return this.closest('.ark-droparea')
|
|
140
|
+
return /** @type {Droparea} */ (this.closest('.ark-droparea'))
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
get mediaList () {
|
|
@@ -10,8 +10,10 @@ describe('Droparea', () => {
|
|
|
10
10
|
return event
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
global.URL.createObjectURL =
|
|
14
|
-
|
|
13
|
+
global.URL.createObjectURL = (
|
|
14
|
+
/** @type {(obj: Blob | MediaSource) => string} */ (jest.fn()))
|
|
15
|
+
global.document.elementFromPoint = (
|
|
16
|
+
/** @type {(x: number, y: number) => Element} */ (jest.fn()))
|
|
15
17
|
|
|
16
18
|
let container = null
|
|
17
19
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Component } from '
|
|
2
|
-
import './droparea-preview.js'
|
|
1
|
+
import { Component } from '#base/index.js'
|
|
3
2
|
import styles from '../styles/index.js'
|
|
4
|
-
|
|
3
|
+
import './droparea-preview.js'
|
|
4
|
+
|
|
5
|
+
/** @import {DropareaPreview} from './droparea-preview.js' */
|
|
6
|
+
|
|
5
7
|
const tag = 'ark-droparea'
|
|
6
8
|
|
|
7
9
|
export class Droparea extends Component {
|
|
@@ -169,7 +171,7 @@ export class Droparea extends Component {
|
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
get preview () {
|
|
172
|
-
return this.select('ark-droparea-preview')
|
|
174
|
+
return /** @type {DropareaPreview} */ (this.select('ark-droparea-preview'))
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
get mediaList () {
|
package/lib/components/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ListItem } from './components/
|
|
1
|
+
export { ListItem } from './components/item.js'
|
|
2
2
|
export { List } from './components/list.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from '
|
|
1
|
+
import { Component } from '#base/index.js'
|
|
2
2
|
import styles from '../styles/index.js'
|
|
3
3
|
|
|
4
4
|
const tag = 'ark-paginator'
|
|
@@ -103,7 +103,8 @@ export class Paginator extends Component {
|
|
|
103
103
|
/** @param {Event} event */
|
|
104
104
|
_move (event) {
|
|
105
105
|
event.stopPropagation()
|
|
106
|
-
const
|
|
106
|
+
const target = /** @type {HTMLElement} */ (event.target)
|
|
107
|
+
const page = parseInt(target.dataset.page)
|
|
107
108
|
this._setCurrentPage(page)
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Component } from 'base/
|
|
1
|
+
import { Component } from '#base/index.js'
|
|
2
2
|
import './splitview.detail.js'
|
|
3
3
|
|
|
4
|
+
/** @import {SplitViewDetail} from './splitview.detail.js' */
|
|
5
|
+
|
|
4
6
|
class MockMain extends Component {
|
|
5
7
|
init (context = {}) {
|
|
6
8
|
this.name = this.name || context.name || null
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Component, css } from
|
|
1
|
+
import { Component, css } from "#base/index.js"
|
|
2
|
+
|
|
3
|
+
/** @import {SplitViewDetail} from './splitview.detail.js' */
|
|
2
4
|
|
|
3
5
|
const tag = 'ark-splitview'
|
|
4
6
|
export class SplitView extends Component {
|
|
@@ -19,7 +21,7 @@ export class SplitView extends Component {
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
get detail () {
|
|
22
|
-
return this.select('ark-splitview-detail')
|
|
24
|
+
return /** @type {SplitViewDetail} */ (this.select('ark-splitview-detail'))
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
render () {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Component } from
|
|
1
|
+
import { Component } from "#base/index.js"
|
|
2
2
|
|
|
3
3
|
const tag = 'ark-splitview-master'
|
|
4
4
|
export class SplitViewMaster extends Component {
|
|
5
5
|
constructor () {
|
|
6
6
|
super()
|
|
7
|
+
this.masterEvent = this.masterEvent
|
|
7
8
|
this.addEventListener(
|
|
8
9
|
this.masterEvent, this.onMasterEvent.bind(this))
|
|
9
10
|
}
|
|
@@ -23,7 +23,7 @@ describe('SplitViewMaster', () => {
|
|
|
23
23
|
|
|
24
24
|
expect(master).toBeTruthy()
|
|
25
25
|
expect(master).toBe(master.init())
|
|
26
|
-
expect(master.getAttribute('master-event')).
|
|
26
|
+
expect(master.getAttribute('master-event')).toEqual('')
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
it('can be instantiated with master-event attribute', () => {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { Component } from
|
|
1
|
+
import { Component } from "#base/index.js"
|
|
2
2
|
|
|
3
3
|
const tag = 'ark-translate'
|
|
4
4
|
export class Translate extends Component {
|
|
5
5
|
init (context = {}) {
|
|
6
|
+
this.languages = this.languages
|
|
6
7
|
this.global = context.global || window
|
|
7
8
|
this.endpoint = context.endpoint || this.endpoint || '/locales'
|
|
8
9
|
this.namespace = context.namespace || this.namespace || 'default'
|
|
9
10
|
this.root = context.root || this.root || 'body'
|
|
10
11
|
this.dictionary = context.dictionary || {}
|
|
11
12
|
|
|
12
|
-
const dictionary =
|
|
13
|
+
const dictionary = (
|
|
14
|
+
/** @type {HTMLTemplateElement} */ (this.querySelector('template')))
|
|
13
15
|
if (dictionary) {
|
|
14
16
|
const content = dictionary.content.textContent
|
|
15
17
|
this.dictionary = JSON.parse(content)
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knowark/componarkjs",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.4",
|
|
4
4
|
"author": "Knowark",
|
|
5
5
|
"description": "Knowark's Web Components Library",
|
|
6
6
|
"license": "ISC",
|
|
7
|
-
"main": "lib/index.js",
|
|
8
7
|
"type": "module",
|
|
8
|
+
"main": "lib/index.js",
|
|
9
|
+
"types": "types/index.d.ts",
|
|
9
10
|
"scripts": {
|
|
10
11
|
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' npx jest --coverage",
|
|
11
12
|
"dev": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' webpack serve --mode development --env development",
|
|
@@ -63,5 +64,8 @@
|
|
|
63
64
|
"transformIgnorePatterns": [
|
|
64
65
|
"node_modules/(?!@knowark)"
|
|
65
66
|
]
|
|
67
|
+
},
|
|
68
|
+
"imports": {
|
|
69
|
+
"#base/*": "./lib/base/*"
|
|
66
70
|
}
|
|
67
71
|
}
|
package/showcase/index.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
+
"include": ["lib/**/*"],
|
|
2
3
|
"compilerOptions": {
|
|
3
4
|
"target": "esnext",
|
|
4
|
-
"module": "
|
|
5
|
+
"module": "nodenext",
|
|
5
6
|
"moduleResolution": "nodenext",
|
|
6
7
|
"allowJs": true,
|
|
7
8
|
"checkJs": true,
|
|
8
9
|
"baseUrl": "lib",
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"emitDeclarationOnly": true,
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"outDir": "types",
|
|
9
14
|
"paths": {
|
|
10
|
-
"
|
|
15
|
+
"#base*": [
|
|
11
16
|
"base",
|
|
12
17
|
"base*"
|
|
13
|
-
],
|
|
14
|
-
"*": [
|
|
15
|
-
"*"
|
|
16
18
|
]
|
|
17
19
|
}
|
|
18
|
-
}
|
|
19
|
-
"exclude": [
|
|
20
|
-
"node_modules",
|
|
21
|
-
"*/node_modules/"
|
|
22
|
-
]
|
|
20
|
+
}
|
|
23
21
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export class Component extends HTMLElement {
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} tag
|
|
4
|
+
* @param {CustomElementConstructor} element
|
|
5
|
+
* @param {string} styles **/
|
|
6
|
+
static define(tag: string, element: CustomElementConstructor, styles?: string): void;
|
|
7
|
+
binding: string;
|
|
8
|
+
local: {};
|
|
9
|
+
/**
|
|
10
|
+
* @param {object} styleMap
|
|
11
|
+
* @return {string} **/
|
|
12
|
+
styleNames(styleMap: object): string;
|
|
13
|
+
/**
|
|
14
|
+
* @param {object} context
|
|
15
|
+
* @return {Component} */
|
|
16
|
+
init(context?: object): Component;
|
|
17
|
+
/** @return {string[]} */
|
|
18
|
+
reflectedProperties(): string[];
|
|
19
|
+
get slots(): {
|
|
20
|
+
[x: string]: HTMLElement[];
|
|
21
|
+
};
|
|
22
|
+
/** @param {string} content */
|
|
23
|
+
set content(content: string);
|
|
24
|
+
/** @return {string} */
|
|
25
|
+
get content(): string;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
/** @return {Component} */
|
|
28
|
+
render(): Component;
|
|
29
|
+
/** @param {object} context */
|
|
30
|
+
load(context?: object): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} selectors
|
|
33
|
+
* @return {Component} */
|
|
34
|
+
select(selectors: string): Component;
|
|
35
|
+
/**
|
|
36
|
+
* @param {string} selectors
|
|
37
|
+
* @return {NodeListOf<Component>} */
|
|
38
|
+
selectAll(selectors: string): NodeListOf<Component>;
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} type
|
|
41
|
+
* @param {any} detail */
|
|
42
|
+
emit(type: string, detail: any): void;
|
|
43
|
+
/**
|
|
44
|
+
* @param {string} resource
|
|
45
|
+
* @return {any} */
|
|
46
|
+
resolve(resource: string): any;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../lib/base/component/component.js"],"names":[],"mappings":"AAIA;IAQE;;;iCAG6B;IAC7B,mBAHW,MAAM,WACN,wBAAwB,WACxB,MAAM,QAGhB;IAXC,gBAAuB;IACvB,UAAe;IAYjB;;2BAEuB;IACvB,qBAFW,MAAM,GACL,MAAM,CAGjB;IAED;;6BAEyB;IACzB,eAFW,MAAM,GACL,SAAS,CAGpB;IAED,yBAAyB;IACzB,uBADa,MAAM,EAAE,CAGpB;IAED;;MAEC;IAED,8BAA8B;IAC9B,6BAEC;IAED,uBAAuB;IACvB,sBAEC;IAED,0BASC;IAED,0BAA0B;IAC1B,UADa,SAAS,CAKrB;IAED,8BAA8B;IAC9B,eADY,MAAM,iBACU;IAE5B;;6BAEyB;IACzB,kBAFW,MAAM,GACL,SAAS,CAGpB;IAED;;yCAEqC;IACrC,qBAFW,MAAM,GACL,UAAU,CAAC,SAAS,CAAC,CAKhC;IAED;;6BAEyB;IACzB,WAFW,MAAM,UACN,GAAG,QASb;IAED;;uBAEmB;IACnB,kBAFW,MAAM,GACL,GAAG,CASd;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.test.d.ts","sourceRoot":"","sources":["../../../lib/base/component/component.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Component } from "./component.js";
|
|
2
|
+
export const css: (template: {
|
|
3
|
+
raw: readonly string[] | ArrayLike<string>;
|
|
4
|
+
}, ...substitutions: any[]) => string;
|
|
5
|
+
export const html: (template: {
|
|
6
|
+
raw: readonly string[] | ArrayLike<string>;
|
|
7
|
+
}, ...substitutions: any[]) => string;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/base/component/index.js"],"names":[],"mappings":";AACA;;sCAA6B;AAC7B;;sCAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/base/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/base/styles/index.js"],"names":[],"mappings":";mBAAmB,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../lib/base/styles/styles.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/define.js"],"names":[],"mappings":"AAEA;;6BAE6B;AAC7B,4BAHY,MAAM,WACP,wBAAwB,WACxB,MAAM,mBAehB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.test.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/define.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert Strings from camelCase to kebab-case
|
|
3
|
+
* @param {string} input @returns {string} */
|
|
4
|
+
export function camelToKebab(input: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Convert Strings from kebab-case to camelCase
|
|
7
|
+
* @param {string} input @returns {string} */
|
|
8
|
+
export function kebabToCamel(input: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Convert Strings from snake to camelCase
|
|
11
|
+
* @param {string} input @returns {string} */
|
|
12
|
+
export function snakeToCamel(input: string): string;
|
|
13
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/format.js"],"names":[],"mappings":"AAAA;;6CAE6C;AAC7C,oCADW,MAAM,GAAkB,MAAM,CAGxC;AAED;;6CAE6C;AAC7C,oCADW,MAAM,GAAkB,MAAM,CAKxC;AAED;;6CAE6C;AAC7C,oCADW,MAAM,GAAkB,MAAM,CAKxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/format.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @param {HTMLElement} self */
|
|
2
|
+
export function listen(self: HTMLElement): void;
|
|
3
|
+
/** @param {HTMLElement} self @param {string[]} properties */
|
|
4
|
+
export function reflect(self: HTMLElement, properties: string[]): void;
|
|
5
|
+
/** @param {object} object @param {string} path @param {any} value */
|
|
6
|
+
export function set(object: object, path: string, value: any): void;
|
|
7
|
+
/** @param {object} object @param {string} path @param {any} fallback */
|
|
8
|
+
export function get(object: object, path: string, fallback: any): any;
|
|
9
|
+
/** @param {object} object @return {string} */
|
|
10
|
+
export function keys(object: object): string;
|
|
11
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/helpers.js"],"names":[],"mappings":"AAEA,gCAAgC;AAChC,6BADY,WAAW,QAyDtB;AAeD,6DAA6D;AAC7D,8BADY,WAAW,cAAe,MAAM,EAAE,QAiB7C;AAUD,qEAAqE;AACrE,4BADY,MAAM,QAAiB,MAAM,SAAe,GAAG,QAS1D;AAED,wEAAwE;AACxE,4BADY,MAAM,QAAiB,MAAM,YAAe,GAAG,OAM1D;AAED,8CAA8C;AAC9C,6BADY,MAAM,GAAkB,MAAM,CAIzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.test.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/helpers.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {HTMLElement} container
|
|
3
|
+
* @return {Object<string, Array<HTMLElement>>}
|
|
4
|
+
* */
|
|
5
|
+
export function getSlots(container: HTMLElement): {
|
|
6
|
+
[x: string]: Array<HTMLElement>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @param {HTMLElement} container
|
|
10
|
+
* @return {Object<string, Array<HTMLElement>>}
|
|
11
|
+
* */
|
|
12
|
+
export function slot(container: HTMLElement): {
|
|
13
|
+
[x: string]: Array<HTMLElement>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=slots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/slots.js"],"names":[],"mappings":"AAAA;;;KAGK;AACL,oCAHW,WAAW,GACV;QAAO,MAAM,GAAE,KAAK,CAAC,WAAW,CAAC;CAAC,CAa7C;AAfD;;;KAGK;AACL,gCAHW,WAAW,GACV;QAAO,MAAM,GAAE,KAAK,CAAC,WAAW,CAAC;CAAC,CAa7C"}
|