@knowark/componarkjs 1.7.3
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 +49 -0
- package/README.md +47 -0
- package/knowarkjs.code-workspace +29 -0
- package/lib/base/component/README.rst +113 -0
- package/lib/base/component/component.js +115 -0
- package/lib/base/component/component.test.js +327 -0
- package/lib/base/component/index.js +3 -0
- package/lib/base/index.js +1 -0
- package/lib/base/styles/index.js +3 -0
- package/lib/base/styles/styles.js +320 -0
- package/lib/base/utils/define.js +21 -0
- package/lib/base/utils/define.test.js +62 -0
- package/lib/base/utils/format.js +24 -0
- package/lib/base/utils/format.test.js +19 -0
- package/lib/base/utils/helpers.js +96 -0
- package/lib/base/utils/helpers.test.js +154 -0
- package/lib/base/utils/index.js +5 -0
- package/lib/base/utils/slots.js +18 -0
- package/lib/base/utils/slots.test.js +52 -0
- package/lib/base/utils/uuid.js +9 -0
- package/lib/base/utils/uuid.test.js +19 -0
- package/lib/components/audio/README.md +22 -0
- package/lib/components/audio/components/audio.js +103 -0
- package/lib/components/audio/components/audio.test.js +127 -0
- package/lib/components/audio/index.js +1 -0
- package/lib/components/audio/styles/ark.css.js +83 -0
- package/lib/components/audio/styles/index.js +2 -0
- package/lib/components/camera/README.md +64 -0
- package/lib/components/camera/components/camera.js +85 -0
- package/lib/components/camera/components/camera.test.js +104 -0
- package/lib/components/camera/index.js +1 -0
- package/lib/components/camera/styles/ark.css.js +17 -0
- package/lib/components/camera/styles/index.js +2 -0
- package/lib/components/capture/components/capture.js +54 -0
- package/lib/components/capture/components/capture.test.js +112 -0
- package/lib/components/capture/index.js +1 -0
- package/lib/components/droparea/README.md +51 -0
- package/lib/components/droparea/components/droparea-preview.js +159 -0
- package/lib/components/droparea/components/droparea-preview.test.js +105 -0
- package/lib/components/droparea/components/droparea.js +165 -0
- package/lib/components/droparea/components/droparea.test.js +320 -0
- package/lib/components/droparea/index.js +1 -0
- package/lib/components/droparea/styles/ark.css.js +235 -0
- package/lib/components/droparea/styles/index.js +3 -0
- package/lib/components/emit/components/emit.js +33 -0
- package/lib/components/emit/components/emit.test.js +138 -0
- package/lib/components/emit/index.js +1 -0
- package/lib/components/index.js +9 -0
- package/lib/components/list/README.md +103 -0
- package/lib/components/list/components/item.test.js +93 -0
- package/lib/components/list/components/list.item.js +22 -0
- package/lib/components/list/components/list.js +96 -0
- package/lib/components/list/components/list.test.js +267 -0
- package/lib/components/list/index.js +2 -0
- package/lib/components/paginator/README.md +32 -0
- package/lib/components/paginator/components/paginator.js +110 -0
- package/lib/components/paginator/components/paginator.test.js +131 -0
- package/lib/components/paginator/index.js +1 -0
- package/lib/components/paginator/styles/ark.css.js +196 -0
- package/lib/components/paginator/styles/index.js +2 -0
- package/lib/components/spinner/README.md +41 -0
- package/lib/components/spinner/components/spinner.js +105 -0
- package/lib/components/spinner/components/spinner.test.js +50 -0
- package/lib/components/spinner/index.js +1 -0
- package/lib/components/spinner/styles/ark.css.js +658 -0
- package/lib/components/spinner/styles/index.js +2 -0
- package/lib/components/splitview/README.md +63 -0
- package/lib/components/splitview/components/splitview.detail.js +46 -0
- package/lib/components/splitview/components/splitview.detail.test.js +92 -0
- package/lib/components/splitview/components/splitview.js +69 -0
- package/lib/components/splitview/components/splitview.master.js +26 -0
- package/lib/components/splitview/components/splitview.master.test.js +55 -0
- package/lib/components/splitview/components/splitview.test.js +76 -0
- package/lib/components/splitview/index.js +3 -0
- package/lib/components/translate/README.md +56 -0
- package/lib/components/translate/components/translate.js +100 -0
- package/lib/components/translate/components/translate.test.js +226 -0
- package/lib/components/translate/index.js +1 -0
- package/lib/index.js +2 -0
- package/package.json +68 -0
- package/showcase/design/.htaccess +8 -0
- package/showcase/design/core/factories/development/development.factory.js +5 -0
- package/showcase/design/core/factories/development/index.js +1 -0
- package/showcase/design/core/factories/index.js +11 -0
- package/showcase/design/core/factories/standard.factory.js +19 -0
- package/showcase/design/index.html +22 -0
- package/showcase/design/index.js +7 -0
- package/showcase/design/screens/base/audio/audioDemo.js +32 -0
- package/showcase/design/screens/base/audio/index.js +25 -0
- package/showcase/design/screens/base/camera/cameraDemo.js +83 -0
- package/showcase/design/screens/base/camera/index.js +25 -0
- package/showcase/design/screens/base/droparea/dropareaDemo.js +88 -0
- package/showcase/design/screens/base/droparea/index.js +25 -0
- package/showcase/design/screens/base/index.js +42 -0
- package/showcase/design/screens/base/list/index.js +25 -0
- package/showcase/design/screens/base/list/listDemo.js +89 -0
- package/showcase/design/screens/base/paginator/index.js +25 -0
- package/showcase/design/screens/base/paginator/paginatorDemo.js +82 -0
- package/showcase/design/screens/base/root.component.js +294 -0
- package/showcase/design/screens/base/root.routes.js +28 -0
- package/showcase/design/screens/base/spinner/index.js +25 -0
- package/showcase/design/screens/base/spinner/spinnerDemo.js +55 -0
- package/showcase/design/screens/base/splitview/detailDemo.js +40 -0
- package/showcase/design/screens/base/splitview/index.js +25 -0
- package/showcase/design/screens/base/splitview/splitViewDemo.js +58 -0
- package/showcase/design/screens/base/translate/index.js +20 -0
- package/showcase/design/screens/base/translate/translateDemo.js +43 -0
- package/showcase/design/screens/main.js +12 -0
- package/showcase/design/screens/screens.routes.js +23 -0
- package/showcase/index.html +86 -0
- package/showcase/index.js +5 -0
- package/showcase/locales/en/default.json +5 -0
- package/showcase/locales/es/default.json +5 -0
- package/showcase/locales/fr/default.json +5 -0
- package/tsconfig.json +23 -0
- package/webpack.config.cjs +118 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { jest } from '@jest/globals'
|
|
2
|
+
import './droparea.js'
|
|
3
|
+
|
|
4
|
+
describe('Droparea', () => {
|
|
5
|
+
const createBubbledEvent = (type, props = {}) => {
|
|
6
|
+
const event = new Event(type, {
|
|
7
|
+
bubbles: true,
|
|
8
|
+
})
|
|
9
|
+
Object.assign(event, props)
|
|
10
|
+
return event
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
global.URL.createObjectURL = jest.fn()
|
|
14
|
+
|
|
15
|
+
let container = null
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
container = document.createElement('div')
|
|
19
|
+
document.body.appendChild(container)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
container.remove()
|
|
24
|
+
container = null
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('can be instantiated', () => {
|
|
28
|
+
container.innerHTML = /* html */ `
|
|
29
|
+
<ark-droparea></ark-droparea>
|
|
30
|
+
`
|
|
31
|
+
|
|
32
|
+
const droparea = container.querySelector('ark-droparea')
|
|
33
|
+
expect(droparea).toBe(droparea.init())
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('drag files to zone highlights the drop area', () => {
|
|
37
|
+
container.innerHTML = /* html */ `
|
|
38
|
+
<ark-droparea></ark-droparea>
|
|
39
|
+
`
|
|
40
|
+
|
|
41
|
+
const droparea = container.querySelector('ark-droparea')
|
|
42
|
+
const dropZone = droparea.dropZone
|
|
43
|
+
const dragNode = dropZone
|
|
44
|
+
|
|
45
|
+
dragNode.dispatchEvent(
|
|
46
|
+
createBubbledEvent('dragover', {
|
|
47
|
+
clientX: 0,
|
|
48
|
+
clientY: 1,
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
expect(dropZone.classList['1']).toBe('highlight')
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('drag files outside the zone unhighlight the drop area', () => {
|
|
55
|
+
container.innerHTML = /* html */ `
|
|
56
|
+
<ark-droparea></ark-droparea>
|
|
57
|
+
`
|
|
58
|
+
|
|
59
|
+
const droparea = container.querySelector('ark-droparea')
|
|
60
|
+
const dropZone = droparea.dropZone
|
|
61
|
+
|
|
62
|
+
dropZone.dispatchEvent(
|
|
63
|
+
createBubbledEvent('dragleave', {
|
|
64
|
+
clientX: 0,
|
|
65
|
+
clientY: 1,
|
|
66
|
+
})
|
|
67
|
+
)
|
|
68
|
+
expect(dropZone.classList.length).toBe(1)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('Allows dropping multiple files to the component', () => {
|
|
72
|
+
container.innerHTML = /* html */ `
|
|
73
|
+
<ark-droparea></ark-droparea>
|
|
74
|
+
`
|
|
75
|
+
|
|
76
|
+
const droparea = container.querySelector('ark-droparea')
|
|
77
|
+
const dropZone = droparea.querySelector('.ark-droparea__form')
|
|
78
|
+
const myFile = new File(['image'], 'Doggy.png', {
|
|
79
|
+
type: 'image/png',
|
|
80
|
+
})
|
|
81
|
+
const myFile2 = new File(['image'], 'Scooby.png', {
|
|
82
|
+
type: 'image/png',
|
|
83
|
+
})
|
|
84
|
+
const dropEvent = createBubbledEvent('drop', {
|
|
85
|
+
clientX: 0,
|
|
86
|
+
clientY: 1,
|
|
87
|
+
dataTransfer: {
|
|
88
|
+
files: [myFile, myFile2],
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
dropZone.dispatchEvent(dropEvent)
|
|
93
|
+
expect(droparea.fileList[0].name).toEqual(myFile.name)
|
|
94
|
+
expect(droparea.fileList[1].name).toEqual(myFile2.name)
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it('Can recieve a single file', () => {
|
|
98
|
+
container.innerHTML = /* html */ `
|
|
99
|
+
<ark-droparea single></ark-droparea>
|
|
100
|
+
`
|
|
101
|
+
|
|
102
|
+
const droparea = container.querySelector('ark-droparea')
|
|
103
|
+
const dropZone = droparea.querySelector('.ark-droparea__form')
|
|
104
|
+
const myFile = new File(['image'], 'Snoopy.png', {
|
|
105
|
+
type: 'image/png',
|
|
106
|
+
})
|
|
107
|
+
const myFile2 = new File(['image'], 'Scooby.png', {
|
|
108
|
+
type: 'image/png',
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const dropEvent = createBubbledEvent('drop', {
|
|
112
|
+
clientX: 0,
|
|
113
|
+
clientY: 1,
|
|
114
|
+
dataTransfer: {
|
|
115
|
+
files: [myFile, myFile2],
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
dropZone.dispatchEvent(dropEvent)
|
|
120
|
+
expect(droparea.fileList.length).toBe(1)
|
|
121
|
+
expect(droparea.fileList[1]).toBeFalsy()
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it('Returns the file list as object URL', () => {
|
|
125
|
+
container.innerHTML = /* html */ `
|
|
126
|
+
<ark-droparea></ark-droparea>
|
|
127
|
+
`
|
|
128
|
+
|
|
129
|
+
const droparea = container.querySelector('ark-droparea')
|
|
130
|
+
const dropZone = droparea.querySelector('.ark-droparea__form')
|
|
131
|
+
const myFile = new File(['image'], 'Snoopy.png', {
|
|
132
|
+
type: 'image/png',
|
|
133
|
+
})
|
|
134
|
+
const myFile2 = new File(['image'], 'Scooby.png', {
|
|
135
|
+
type: 'image/png',
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const dropEvent = createBubbledEvent('drop', {
|
|
139
|
+
clientX: 0,
|
|
140
|
+
clientY: 1,
|
|
141
|
+
dataTransfer: {
|
|
142
|
+
files: [myFile, myFile2],
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
dropZone.dispatchEvent(dropEvent)
|
|
147
|
+
expect(droparea.fileList.length).toEqual(2)
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('Returns a media list of file metadata objects', () => {
|
|
151
|
+
container.innerHTML = /* html */ `
|
|
152
|
+
<ark-droparea></ark-droparea>
|
|
153
|
+
`
|
|
154
|
+
|
|
155
|
+
const droparea = container.querySelector('ark-droparea')
|
|
156
|
+
const dropZone = droparea.querySelector('.ark-droparea__form')
|
|
157
|
+
const myFile = new File(['image'], 'Snoopy.png', {
|
|
158
|
+
type: 'image/png',
|
|
159
|
+
})
|
|
160
|
+
const myFile2 = new File(['image'], 'Scooby.png', {
|
|
161
|
+
type: 'image/png',
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
const dropEvent = createBubbledEvent('drop', {
|
|
165
|
+
clientX: 0,
|
|
166
|
+
clientY: 1,
|
|
167
|
+
dataTransfer: {
|
|
168
|
+
files: [myFile, myFile2],
|
|
169
|
+
},
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
dropZone.dispatchEvent(dropEvent)
|
|
173
|
+
expect(droparea.mediaList.length).toEqual(2)
|
|
174
|
+
expect(droparea.mediaList).toEqual([
|
|
175
|
+
{
|
|
176
|
+
name: 'Snoopy.png',
|
|
177
|
+
size: 5,
|
|
178
|
+
type: 'image/png',
|
|
179
|
+
url: undefined,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'Scooby.png',
|
|
183
|
+
size: 5,
|
|
184
|
+
type: 'image/png',
|
|
185
|
+
url: undefined,
|
|
186
|
+
},
|
|
187
|
+
])
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
it('Can select files from input', () => {
|
|
191
|
+
container.innerHTML = /* html */ `
|
|
192
|
+
<ark-droparea></ark-droparea>
|
|
193
|
+
`
|
|
194
|
+
|
|
195
|
+
const droparea = container.querySelector('ark-droparea')
|
|
196
|
+
const dropOpen = droparea.querySelector('.ark-droparea__open')
|
|
197
|
+
const input = droparea.querySelector('.ark-droparea__input')
|
|
198
|
+
const myFile = new File(['image'], 'Snoopy.png', {
|
|
199
|
+
type: 'image/png',
|
|
200
|
+
})
|
|
201
|
+
const changeEvent = createBubbledEvent('change', {})
|
|
202
|
+
Object.defineProperty(changeEvent, 'target', {
|
|
203
|
+
value: {
|
|
204
|
+
files: [myFile],
|
|
205
|
+
},
|
|
206
|
+
})
|
|
207
|
+
dropOpen.click()
|
|
208
|
+
input.dispatchEvent(changeEvent)
|
|
209
|
+
expect(droparea.fileList.length).toBeTruthy()
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
it('Can limit the file formats that component recieves', () => {
|
|
213
|
+
container.innerHTML = /* html */ `
|
|
214
|
+
<ark-droparea accept="jpg, png"></ark-droparea>
|
|
215
|
+
`
|
|
216
|
+
|
|
217
|
+
const droparea = container.querySelector('ark-droparea')
|
|
218
|
+
const input = droparea.querySelector('.ark-droparea__input')
|
|
219
|
+
const myFile = new File(['image'], 'Snoopy.jpg', {
|
|
220
|
+
type: 'image/png',
|
|
221
|
+
})
|
|
222
|
+
const myFile2 = new File(['image'], 'Scrappy.png', {
|
|
223
|
+
type: 'image/png',
|
|
224
|
+
})
|
|
225
|
+
const changeEvent = createBubbledEvent('change', {})
|
|
226
|
+
Object.defineProperty(changeEvent, 'target', {
|
|
227
|
+
value: {
|
|
228
|
+
files: [myFile, myFile2],
|
|
229
|
+
},
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
input.dispatchEvent(changeEvent)
|
|
233
|
+
expect(droparea.fileList.length).toBeTruthy()
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it("Does not allow dropping a file that doesn't not exist in accept'", () => {
|
|
237
|
+
container.innerHTML = /* html */ `
|
|
238
|
+
<ark-droparea accept="jpg, png"></ark-droparea>
|
|
239
|
+
`
|
|
240
|
+
|
|
241
|
+
const droparea = container.querySelector('ark-droparea')
|
|
242
|
+
const input = droparea.querySelector('.ark-droparea__input')
|
|
243
|
+
const myFile = new File(['text'], 'Snoopy.txt', {
|
|
244
|
+
type: 'text/txt',
|
|
245
|
+
})
|
|
246
|
+
const changeEvent = createBubbledEvent('change', {})
|
|
247
|
+
Object.defineProperty(changeEvent, 'target', {
|
|
248
|
+
value: {
|
|
249
|
+
files: [myFile],
|
|
250
|
+
},
|
|
251
|
+
})
|
|
252
|
+
input.dispatchEvent(changeEvent)
|
|
253
|
+
expect(droparea.fileList.length).toBeFalsy()
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
it("General file type values can be specified'", () => {
|
|
257
|
+
container.innerHTML = /* html */ `
|
|
258
|
+
<ark-droparea accept="audio, image, video, text">
|
|
259
|
+
</ark-droparea>
|
|
260
|
+
`
|
|
261
|
+
|
|
262
|
+
const droparea = container.querySelector('ark-droparea')
|
|
263
|
+
const dropZone = droparea.querySelector('.ark-droparea__form')
|
|
264
|
+
const myFile = new File(['audio'], 'autechre.mp3', {
|
|
265
|
+
type: 'audio/mp3',
|
|
266
|
+
})
|
|
267
|
+
const myFile2 = new File(['video'], 'cats.mov', {
|
|
268
|
+
type: 'video/mov',
|
|
269
|
+
})
|
|
270
|
+
const myFile3 = new File(['image'], 'snoopy.jpg', {
|
|
271
|
+
type: 'image/jpg',
|
|
272
|
+
})
|
|
273
|
+
const myFile4 = new File(['text'], 'styles.css', {
|
|
274
|
+
type: 'text/css',
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
const files = [myFile, myFile2, myFile3, myFile4]
|
|
278
|
+
const dropEvent = createBubbledEvent('drop', {
|
|
279
|
+
clientX: 0,
|
|
280
|
+
clientY: 1,
|
|
281
|
+
dataTransfer: {
|
|
282
|
+
files: files,
|
|
283
|
+
},
|
|
284
|
+
})
|
|
285
|
+
dropZone.dispatchEvent(dropEvent)
|
|
286
|
+
|
|
287
|
+
droparea.fileList.forEach((file, i) => {
|
|
288
|
+
expect(file.type).toBe(files[i].type)
|
|
289
|
+
})
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
it('Size of files can be limited', () => {
|
|
293
|
+
container.innerHTML = /* html */ `
|
|
294
|
+
<ark-droparea max-size= "2"></ark-droparea>
|
|
295
|
+
`
|
|
296
|
+
|
|
297
|
+
const droparea = container.querySelector('ark-droparea')
|
|
298
|
+
const dropZone = droparea.querySelector('.ark-droparea__form')
|
|
299
|
+
const myFile = new File(['image'], 'Doggy.png', {
|
|
300
|
+
type: 'image/png',
|
|
301
|
+
})
|
|
302
|
+
const myFile2 = new File(['image'], 'Scooby.png', {
|
|
303
|
+
type: 'image/png',
|
|
304
|
+
})
|
|
305
|
+
Object.defineProperty(myFile2, 'size', { value: 1024 * 1024 + 1 })
|
|
306
|
+
|
|
307
|
+
const dropEvent = createBubbledEvent('drop', {
|
|
308
|
+
clientX: 0,
|
|
309
|
+
clientY: 1,
|
|
310
|
+
dataTransfer: {
|
|
311
|
+
files: [myFile, myFile2],
|
|
312
|
+
},
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
droparea.maxSizeValidate([])
|
|
316
|
+
droparea.maxSizeValidate(myFile2)
|
|
317
|
+
dropZone.dispatchEvent(dropEvent)
|
|
318
|
+
expect(droparea.maxSizeValidate).toBeCalled
|
|
319
|
+
})
|
|
320
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Droparea } from './components/droparea.js'
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
const css = String.raw; export default css`
|
|
2
|
+
.ark-droparea__form {
|
|
3
|
+
background: var(--canvas, white);
|
|
4
|
+
color: var(--ink, black);
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
padding: 0.5rem;
|
|
8
|
+
border: 2px dashed black;
|
|
9
|
+
transition: all 0.1s ease-in-out;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* THEME */
|
|
13
|
+
.ark-droparea__form[background=primary] {
|
|
14
|
+
background: var(--primary);
|
|
15
|
+
color: white;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ark-droparea__form.ark-droparea__form[color=primary] {
|
|
19
|
+
color: var(--primary);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ark-droparea__form[background=secondary] {
|
|
23
|
+
background: var(--secondary);
|
|
24
|
+
color: white;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ark-droparea__form.ark-droparea__form[color=secondary] {
|
|
28
|
+
color: var(--secondary);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ark-droparea__form[background=success] {
|
|
32
|
+
background: var(--success);
|
|
33
|
+
color: white;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ark-droparea__form.ark-droparea__form[color=success] {
|
|
37
|
+
color: var(--success);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ark-droparea__form[background=danger] {
|
|
41
|
+
background: var(--danger);
|
|
42
|
+
color: white;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ark-droparea__form.ark-droparea__form[color=danger] {
|
|
46
|
+
color: var(--danger);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ark-droparea__form[background=warning] {
|
|
50
|
+
background: var(--warning);
|
|
51
|
+
color: white;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ark-droparea__form.ark-droparea__form[color=warning] {
|
|
55
|
+
color: var(--warning);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ark-droparea__form[background=info] {
|
|
59
|
+
background: var(--info);
|
|
60
|
+
color: white;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ark-droparea__form.ark-droparea__form[color=info] {
|
|
64
|
+
color: var(--info);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ark-droparea__form[background=dark] {
|
|
68
|
+
background: var(--dark);
|
|
69
|
+
color: white;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ark-droparea__form.ark-droparea__form[color=dark] {
|
|
73
|
+
color: var(--dark);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ark-droparea__form[background=muted] {
|
|
77
|
+
background: var(--muted);
|
|
78
|
+
color: white;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ark-droparea__form.ark-droparea__form[color=muted] {
|
|
82
|
+
color: var(--muted);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ark-droparea__form[background=light] {
|
|
86
|
+
background: var(--light);
|
|
87
|
+
color: white;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ark-droparea__form.ark-droparea__form[color=light] {
|
|
91
|
+
color: var(--light);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ark-droparea__form [data-message] {
|
|
95
|
+
color: red;
|
|
96
|
+
font-size: 1rem;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.ark-droparea__form>* {
|
|
100
|
+
margin: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.ark-droparea__form input {
|
|
104
|
+
position: absolute;
|
|
105
|
+
visibility: hidden;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ark-droparea__form.highlight {
|
|
109
|
+
border: 2px solid black;
|
|
110
|
+
opacity: 0.5;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.ark-droparea__message {
|
|
114
|
+
font-size: 1.5rem;
|
|
115
|
+
user-select: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.ark-droparea-preview__list {
|
|
119
|
+
display: none;
|
|
120
|
+
grid-auto-flow: column;
|
|
121
|
+
grid-auto-columns: min-content;
|
|
122
|
+
overflow-x: auto;
|
|
123
|
+
overflow-y: hidden;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
border-radius: 5px;
|
|
126
|
+
border: 1px solid #e1e1e1;
|
|
127
|
+
user-select: none;
|
|
128
|
+
padding: 1.2rem;
|
|
129
|
+
gap: 0.8rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ark-droparea-preview__list::-webkit-scrollbar {
|
|
133
|
+
height: 10px;
|
|
134
|
+
width: 0.2rem;
|
|
135
|
+
border-radius: 15px;
|
|
136
|
+
background-color: rgba(89, 34, 114, 0.137);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.ark-droparea-preview__list::-webkit-scrollbar-thumb {
|
|
140
|
+
height: 10px;
|
|
141
|
+
background-color: white;
|
|
142
|
+
border: 1px solid #aaaaaa;
|
|
143
|
+
border-radius: 15px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.ark-droparea-preview__frame {
|
|
147
|
+
box-sizing: border-box;
|
|
148
|
+
display: grid;
|
|
149
|
+
width: 110px;
|
|
150
|
+
height: 110px;
|
|
151
|
+
align-items: center;
|
|
152
|
+
background-repeat: no-repeat;
|
|
153
|
+
background-size: cover;
|
|
154
|
+
background-color: var(--primary);
|
|
155
|
+
border-radius: 4px;
|
|
156
|
+
box-shadow: -3px 4px 6px -4px rgba(1, 31, 255, 0.71);
|
|
157
|
+
transition: all 0.1s ease-in-out;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ark-droparea-preview__frame:hover,
|
|
161
|
+
.ark-droparea-preview__frame:active {
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
box-shadow: -3px 4px 15px -4px rgba(120, 10, 255, 0.71);
|
|
164
|
+
transform: scale(1.05);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ark-droparea-preview__frame:hover .ark-droparea__remove,
|
|
168
|
+
.ark-droparea-preview__frame:active .ark-droparea__remove {
|
|
169
|
+
visibility: visible;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.ark-droparea-preview__frame:after {
|
|
173
|
+
content: "";
|
|
174
|
+
background-color: transparent;
|
|
175
|
+
display: block;
|
|
176
|
+
position: relative;
|
|
177
|
+
right: -3rem;
|
|
178
|
+
width: 5rem;
|
|
179
|
+
height: 1px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.ark-droparea-preview__frame p {
|
|
183
|
+
box-sizing: border-box;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
white-space: pre-wrap;
|
|
186
|
+
width: inherit;
|
|
187
|
+
font-size: 0.6rem;
|
|
188
|
+
padding: 0.2rem;
|
|
189
|
+
line-height: 1.2;
|
|
190
|
+
text-align: center;
|
|
191
|
+
color: white;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.ark-droparea__remove {
|
|
195
|
+
visibility: hidden;
|
|
196
|
+
position: absolute;
|
|
197
|
+
top: 6px;
|
|
198
|
+
right: 6px;
|
|
199
|
+
width: 30px;
|
|
200
|
+
height: 30px;
|
|
201
|
+
border: 1px solid white;
|
|
202
|
+
border-radius: 50%;
|
|
203
|
+
color: black;
|
|
204
|
+
outline: none;
|
|
205
|
+
font-size: 1rem;
|
|
206
|
+
opacity: 0.8;
|
|
207
|
+
transition: all 0.1s ease-in-out;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.ark-droparea__remove:hover {
|
|
211
|
+
background: black;
|
|
212
|
+
color: #ff7676;
|
|
213
|
+
transform: scale(1);
|
|
214
|
+
cursor: pointer;
|
|
215
|
+
opacity: 1;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.ark-droparea__open {
|
|
219
|
+
user-select: none;
|
|
220
|
+
border: 2px solid black;
|
|
221
|
+
padding: 0.5rem;
|
|
222
|
+
border-radius: 4px;
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
transition: all 0.2s ease-out;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.ark-droparea__open:hover {
|
|
228
|
+
box-shadow: 2px 4px 13px -3px rgba(0, 0, 0, 0.56);
|
|
229
|
+
background-color: white;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.ark-droparea__open:active {
|
|
233
|
+
transform: scale(0.95);
|
|
234
|
+
}
|
|
235
|
+
`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component } from '../../../base/component/index.js'
|
|
2
|
+
|
|
3
|
+
const tag = 'ark-emit'
|
|
4
|
+
export class Emit extends Component {
|
|
5
|
+
constructor () {
|
|
6
|
+
super()
|
|
7
|
+
const type = this['receive'] || 'click'
|
|
8
|
+
this.source = JSON.parse(this._pop(':scope > data')?.textContent || null)
|
|
9
|
+
this.addEventListener(type, this.handle.bind(this))
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
reflectedProperties () {
|
|
13
|
+
return ['receive', 'dispatch']
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
handle (event) {
|
|
17
|
+
const detail = Object.assign({}, event.detail)
|
|
18
|
+
if (this.source) Object.assign(detail, this.source)
|
|
19
|
+
|
|
20
|
+
const value = event.target.value
|
|
21
|
+
if (value) Object.assign(detail, { value })
|
|
22
|
+
|
|
23
|
+
const type = this['dispatch'] || 'emit'
|
|
24
|
+
this.emit(type, detail)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_pop (selector) {
|
|
28
|
+
const element = this.querySelector(selector)
|
|
29
|
+
element?.remove()
|
|
30
|
+
return element
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
Component.define(tag, Emit)
|