@knowark/componarkjs 1.7.3 → 1.7.5

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.
Files changed (77) hide show
  1. package/Makefile +6 -3
  2. package/jsconfig.json +23 -0
  3. package/lib/base/component/component.js +27 -26
  4. package/lib/base/component/component.test.js +76 -32
  5. package/lib/base/styles/styles.js +34 -5
  6. package/lib/base/utils/define.js +6 -7
  7. package/lib/base/utils/define.test.js +5 -5
  8. package/lib/base/utils/helpers.js +14 -10
  9. package/lib/base/utils/helpers.test.js +13 -13
  10. package/lib/base/utils/uuid.js +4 -4
  11. package/lib/components/audio/components/audio.js +6 -6
  12. package/lib/components/audio/components/audio.test.js +11 -10
  13. package/lib/components/audio/styles/ark.css.js +1 -1
  14. package/lib/components/camera/components/camera.test.js +6 -6
  15. package/lib/components/camera/styles/ark.css.js +1 -1
  16. package/lib/components/camera/styles/index.js +1 -1
  17. package/lib/components/capture/components/capture.js +2 -2
  18. package/lib/components/capture/components/capture.test.js +1 -1
  19. package/lib/components/droparea/components/droparea-preview.js +27 -26
  20. package/lib/components/droparea/components/droparea-preview.test.js +9 -9
  21. package/lib/components/droparea/components/droparea.js +19 -19
  22. package/lib/components/droparea/components/droparea.test.js +42 -42
  23. package/lib/components/droparea/styles/ark.css.js +1 -1
  24. package/lib/components/emit/components/emit.js +4 -4
  25. package/lib/components/emit/components/emit.test.js +5 -5
  26. package/lib/components/list/components/item.test.js +12 -14
  27. package/lib/components/list/components/list.js +25 -25
  28. package/lib/components/list/components/list.test.js +27 -29
  29. package/lib/components/paginator/components/paginator.js +2 -2
  30. package/lib/components/paginator/components/paginator.test.js +15 -18
  31. package/lib/components/paginator/styles/ark.css.js +1 -1
  32. package/lib/components/spinner/components/spinner.js +17 -17
  33. package/lib/components/spinner/styles/index.js +1 -1
  34. package/lib/components/splitview/components/splitview.detail.js +3 -3
  35. package/lib/components/splitview/components/splitview.detail.test.js +23 -23
  36. package/lib/components/splitview/components/splitview.js +3 -3
  37. package/lib/components/splitview/components/splitview.master.js +3 -3
  38. package/lib/components/splitview/components/splitview.master.test.js +2 -2
  39. package/lib/components/splitview/components/splitview.test.js +5 -7
  40. package/lib/components/translate/components/translate.js +17 -19
  41. package/lib/components/translate/components/translate.test.js +13 -14
  42. package/package.json +1 -1
  43. package/showcase/assets/knowark.svg +1 -0
  44. package/showcase/{design/screens/base/audio/audioDemo.js → components/demos/audio.js} +6 -10
  45. package/showcase/{design/screens/base/camera/cameraDemo.js → components/demos/camera.js} +6 -7
  46. package/showcase/{design/screens/base/droparea/dropareaDemo.js → components/demos/droparea.js} +7 -7
  47. package/showcase/{design/screens/base/list/listDemo.js → components/demos/list.js} +2 -3
  48. package/showcase/{design/screens/base/paginator/paginatorDemo.js → components/demos/paginator.js} +9 -9
  49. package/showcase/{design/screens/base/splitview/splitViewDemo.js → components/demos/splitview.js} +42 -9
  50. package/showcase/{design/screens/base/translate/translateDemo.js → components/demos/translate.js} +4 -5
  51. package/showcase/components/index.html +81 -0
  52. package/showcase/index.html +40 -82
  53. package/showcase/index.js +0 -1
  54. package/webpack.config.cjs +50 -50
  55. package/showcase/design/core/factories/development/development.factory.js +0 -5
  56. package/showcase/design/core/factories/development/index.js +0 -1
  57. package/showcase/design/core/factories/index.js +0 -11
  58. package/showcase/design/core/factories/standard.factory.js +0 -19
  59. package/showcase/design/index.html +0 -22
  60. package/showcase/design/index.js +0 -7
  61. package/showcase/design/screens/base/audio/index.js +0 -25
  62. package/showcase/design/screens/base/camera/index.js +0 -25
  63. package/showcase/design/screens/base/droparea/index.js +0 -25
  64. package/showcase/design/screens/base/index.js +0 -42
  65. package/showcase/design/screens/base/list/index.js +0 -25
  66. package/showcase/design/screens/base/paginator/index.js +0 -25
  67. package/showcase/design/screens/base/root.component.js +0 -294
  68. package/showcase/design/screens/base/root.routes.js +0 -28
  69. package/showcase/design/screens/base/spinner/index.js +0 -25
  70. package/showcase/design/screens/base/spinner/spinnerDemo.js +0 -55
  71. package/showcase/design/screens/base/splitview/detailDemo.js +0 -40
  72. package/showcase/design/screens/base/splitview/index.js +0 -25
  73. package/showcase/design/screens/base/translate/index.js +0 -20
  74. package/showcase/design/screens/main.js +0 -12
  75. package/showcase/design/screens/screens.routes.js +0 -23
  76. package/tsconfig.json +0 -23
  77. /package/showcase/{design/.htaccess → .htaccess} +0 -0
@@ -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['textContent']
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]['name']}</option>
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 = value.split(':')
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
- || {})[namespace] || null)
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
- "hello": "Hola",
207
- "world": "Mundo",
208
- "happy": "Feliz"
204
+ hello: 'Hola',
205
+ world: 'Mundo',
206
+ happy: 'Feliz'
209
207
  })
210
208
  })
211
- translate.init({ global: {
212
- fetch: mockFetch, document: 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowark/componarkjs",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "author": "Knowark",
5
5
  "description": "Knowark's Web Components Library",
6
6
  "license": "ISC",
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="107 253.112 287.776 287.776" width="287.776pt" height="287.776pt"><g><circle vector-effect="non-scaling-stroke" cx="250.88815644671115" cy="396.9999999999993" r="143.88815644671132" fill="rgb(0,30,61)"/><g><path d=" M 344.921 390.854 C 339.37 405.032 325.062 415.132 308.305 415.132 L 191.334 415.132 C 191.334 415.132 191.334 415.132 191.334 415.132 L 191.334 415.132 L 188.972 415.132 L 188.972 415.065 C 173.514 414.182 160.463 404.697 154.998 391.551 C 159.372 391.471 163.739 391.112 168.077 390.471 C 178.473 388.939 188.727 386.562 198.738 383.364 C 206.917 380.753 214.969 377.739 222.854 374.332 C 232.397 370.206 241.789 365.744 251.013 360.948 C 259.668 365.92 268.591 370.398 277.749 374.366 C 286.53 378.158 295.562 381.364 304.769 383.95 C 313.366 386.369 322.122 388.203 330.97 389.45 C 335.601 390.098 340.254 390.572 344.921 390.854 Z M 346.809 384.274 C 347.197 382.157 347.4 379.979 347.4 377.756 C 347.4 357.127 329.882 340.38 308.305 340.38 C 304.304 340.38 300.443 340.955 296.81 342.032 C 288.479 326.354 270.576 315.505 249.857 315.505 C 229.129 315.505 211.22 326.362 202.893 342.051 C 199.242 340.962 195.359 340.38 191.334 340.38 C 169.757 340.38 152.238 357.127 152.238 377.756 L 152.238 377.756 C 152.238 380.187 152.482 382.563 152.953 384.863 C 157.685 384.877 162.417 384.537 167.106 383.85 C 177.134 382.368 187.036 380.075 196.696 376.986 C 204.673 374.441 212.517 371.503 220.201 368.18 C 230.723 363.635 241.06 358.671 251.189 353.289 C 260.598 358.88 270.358 363.869 280.402 368.213 C 288.915 371.897 297.663 375.002 306.586 377.505 C 314.89 379.84 323.352 381.615 331.899 382.812 C 336.845 383.51 341.82 383.997 346.809 384.274 Z " fill-rule="evenodd" fill="rgb(0,255,255)"/><path d=" M 160.192 461.165 L 152.526 461.165 L 152.526 426.582 L 151.975 421.557 L 160.192 420.789 L 160.192 442.128 L 166.831 433.934 L 175.375 433.934 L 166.305 443.836 L 161.195 445.643 L 165.93 447.203 L 177.905 461.165 L 169.186 461.165 L 160.192 449.827 L 160.192 461.165 L 160.192 461.165 Z M 180.085 434.108 L 188.252 433.291 L 188.252 437.969 L 190.507 434.231 L 190.507 434.231 Q 191.308 433.959 192.148 433.736 L 192.148 433.736 L 192.148 433.736 Q 192.987 433.513 193.864 433.513 L 193.864 433.513 L 193.864 433.513 Q 194.941 433.513 195.956 433.575 L 195.956 433.575 L 195.956 433.575 Q 196.97 433.637 197.897 433.872 L 197.897 433.872 L 197.897 433.872 Q 198.824 434.108 199.651 434.565 L 199.651 434.565 L 199.651 434.565 Q 200.478 435.023 201.204 435.816 L 201.204 435.816 L 201.204 435.816 Q 201.981 436.657 202.407 437.648 L 202.407 437.648 L 202.407 437.648 Q 202.833 438.638 203.021 439.616 L 203.021 439.616 L 203.021 439.616 Q 203.209 440.593 203.246 441.522 L 203.246 441.522 L 203.246 441.522 Q 203.284 442.45 203.284 443.168 L 203.284 443.168 L 203.284 461.165 L 195.116 461.165 L 195.116 442.425 L 195.116 442.425 Q 195.116 441.41 194.929 440.73 L 194.929 440.73 L 194.929 440.73 Q 194.741 440.049 194.415 439.64 L 194.415 439.64 L 194.415 439.64 Q 194.089 439.232 193.626 439.059 L 193.626 439.059 L 193.626 439.059 Q 193.162 438.885 192.611 438.885 L 192.611 438.885 L 192.611 438.885 Q 192.185 438.885 191.647 439.034 L 191.647 439.034 L 191.647 439.034 Q 191.108 439.182 190.532 439.442 L 190.532 439.442 L 190.532 439.442 Q 189.956 439.702 189.367 440.098 L 189.367 440.098 L 189.367 440.098 Q 188.778 440.494 188.252 440.965 L 188.252 440.965 L 188.252 461.165 L 180.085 461.165 L 180.085 434.108 L 180.085 434.108 Z M 222.024 461.586 L 222.024 461.586 L 222.024 461.586 Q 219.017 461.586 216.537 460.509 L 216.537 460.509 L 216.537 460.509 Q 214.057 459.432 212.265 457.538 L 212.265 457.538 L 212.265 457.538 Q 210.474 455.645 209.484 453.07 L 209.484 453.07 L 209.484 453.07 Q 208.495 450.495 208.495 447.475 L 208.495 447.475 L 208.495 447.475 Q 208.495 444.48 209.447 441.918 L 209.447 441.918 L 209.447 441.918 Q 210.399 439.356 212.165 437.487 L 212.165 437.487 L 212.165 437.487 Q 213.931 435.618 216.424 434.565 L 216.424 434.565 L 216.424 434.565 Q 218.917 433.513 222.024 433.513 L 222.024 433.513 L 222.024 433.513 Q 225.03 433.513 227.523 434.565 L 227.523 434.565 L 227.523 434.565 Q 230.015 435.618 231.807 437.487 L 231.807 437.487 L 231.807 437.487 Q 233.598 439.356 234.588 441.918 L 234.588 441.918 L 234.588 441.918 Q 235.577 444.48 235.577 447.475 L 235.577 447.475 L 235.577 447.475 Q 235.577 450.495 234.625 453.07 L 234.625 453.07 L 234.625 453.07 Q 233.673 455.645 231.907 457.538 L 231.907 457.538 L 231.907 457.538 Q 230.141 459.432 227.635 460.509 L 227.635 460.509 L 227.635 460.509 Q 225.13 461.586 222.024 461.586 Z M 227.41 448.094 L 227.41 448.094 L 227.41 448.094 Q 227.41 446.411 227.109 444.777 L 227.109 444.777 L 227.109 444.777 Q 226.809 443.143 226.145 441.844 L 226.145 441.844 L 226.145 441.844 Q 225.481 440.544 224.441 439.752 L 224.441 439.752 L 224.441 439.752 Q 223.401 438.96 221.923 438.96 L 221.923 438.96 L 221.923 438.96 Q 220.545 438.96 219.543 439.64 L 219.543 439.64 L 219.543 439.64 Q 218.541 440.321 217.902 441.46 L 217.902 441.46 L 217.902 441.46 Q 217.263 442.599 216.963 444.047 L 216.963 444.047 L 216.963 444.047 Q 216.662 445.495 216.662 447.03 L 216.662 447.03 L 216.662 447.03 Q 216.662 448.738 216.963 450.372 L 216.963 450.372 L 216.963 450.372 Q 217.263 452.006 217.927 453.28 L 217.927 453.28 L 217.927 453.28 Q 218.591 454.555 219.618 455.347 L 219.618 455.347 L 219.618 455.347 Q 220.646 456.14 222.099 456.14 L 222.099 456.14 L 222.099 456.14 Q 223.477 456.14 224.479 455.459 L 224.479 455.459 L 224.479 455.459 Q 225.481 454.778 226.132 453.639 L 226.132 453.639 L 226.132 453.639 Q 226.784 452.501 227.097 451.065 L 227.097 451.065 L 227.097 451.065 Q 227.41 449.629 227.41 448.094 Z M 259.127 433.934 L 260.856 441.361 L 262.735 454.432 L 264.238 441.361 L 266.017 434.083 L 273.658 433.34 L 265.866 461.165 L 259.328 461.165 L 257.449 453.738 L 255.77 440.866 L 253.941 453.738 L 252.238 461.165 L 245.699 461.165 L 238.158 434.108 L 245.824 433.291 L 247.678 441.361 L 249.331 454.481 L 251.085 441.361 L 252.939 433.934 L 259.127 433.934 L 259.127 433.934 Z M 298.335 456.09 L 298.912 461.165 L 290.419 461.165 L 290.419 457.155 L 287.412 461.462 L 287.412 461.462 Q 287.212 461.512 286.936 461.549 L 286.936 461.549 L 286.936 461.549 Q 286.661 461.586 286.134 461.586 L 286.134 461.586 L 286.134 461.586 Q 283.98 461.586 282.051 460.979 L 282.051 460.979 L 282.051 460.979 Q 280.122 460.373 278.669 459.197 L 278.669 459.197 L 278.669 459.197 Q 277.216 458.021 276.351 456.288 L 276.351 456.288 L 276.351 456.288 Q 275.487 454.555 275.487 452.303 L 275.487 452.303 L 275.487 452.303 Q 275.487 450.718 275.963 449.431 L 275.963 449.431 L 275.963 449.431 Q 276.439 448.144 277.278 447.129 L 277.278 447.129 L 277.278 447.129 Q 278.117 446.114 279.22 445.371 L 279.22 445.371 L 279.22 445.371 Q 280.322 444.628 281.587 444.146 L 281.587 444.146 L 281.587 444.146 Q 282.853 443.663 284.193 443.428 L 284.193 443.428 L 284.193 443.428 Q 285.533 443.193 286.811 443.193 L 286.811 443.193 L 286.811 443.193 Q 287.938 443.193 288.828 443.267 L 288.828 443.267 L 288.828 443.267 Q 289.717 443.341 290.394 443.465 L 290.394 443.465 L 290.394 443.465 Q 290.368 442.475 290.243 441.645 L 290.243 441.645 L 290.243 441.645 Q 290.118 440.816 289.792 440.197 L 289.792 440.197 L 289.792 440.197 Q 289.467 439.578 288.915 439.232 L 288.915 439.232 L 288.915 439.232 Q 288.364 438.885 287.512 438.885 L 287.512 438.885 L 287.512 438.885 Q 285.383 438.885 283.429 439.368 L 283.429 439.368 L 283.429 439.368 Q 281.475 439.851 279.896 440.42 L 279.896 440.42 L 277.291 435.84 L 277.291 435.84 Q 279.245 434.974 281.124 434.454 L 281.124 434.454 L 281.124 434.454 Q 282.326 434.108 283.967 433.81 L 283.967 433.81 L 283.967 433.81 Q 285.608 433.513 287.738 433.513 L 287.738 433.513 L 287.738 433.513 Q 290.995 433.513 293.062 434.293 L 293.062 434.293 L 293.062 434.293 Q 295.129 435.073 296.294 436.496 L 296.294 436.496 L 296.294 436.496 Q 297.458 437.92 297.897 439.913 L 297.897 439.913 L 297.897 439.913 Q 298.335 441.905 298.335 444.307 L 298.335 444.307 L 298.335 456.09 L 298.335 456.09 Z M 290.419 453.986 L 290.419 448.416 L 290.419 448.416 Q 289.817 448.342 289.103 448.28 L 289.103 448.28 L 289.103 448.28 Q 288.389 448.218 287.738 448.218 L 287.738 448.218 L 287.738 448.218 Q 286.836 448.218 285.972 448.466 L 285.972 448.466 L 285.972 448.466 Q 285.107 448.713 284.431 449.208 L 284.431 449.208 L 284.431 449.208 Q 283.754 449.703 283.329 450.471 L 283.329 450.471 L 283.329 450.471 Q 282.903 451.238 282.903 452.278 L 282.903 452.278 L 282.903 452.278 Q 282.903 453.12 283.178 453.837 L 283.178 453.837 L 283.178 453.837 Q 283.454 454.555 283.905 455.088 L 283.905 455.088 L 283.905 455.088 Q 284.356 455.62 284.919 455.917 L 284.919 455.917 L 284.919 455.917 Q 285.483 456.214 286.059 456.214 L 286.059 456.214 L 286.059 456.214 Q 286.786 456.214 287.45 455.991 L 287.45 455.991 L 287.45 455.991 Q 288.114 455.768 288.677 455.434 L 288.677 455.434 L 288.677 455.434 Q 289.241 455.1 289.679 454.704 L 289.679 454.704 L 289.679 454.704 Q 290.118 454.308 290.419 453.986 L 290.419 453.986 L 290.419 453.986 Z M 320.958 434.33 L 320.608 439.702 L 320.608 439.702 Q 320.107 439.455 319.706 439.294 L 319.706 439.294 L 319.706 439.294 Q 319.305 439.133 318.904 439.034 L 318.904 439.034 L 318.904 439.034 Q 318.503 438.935 318.065 438.91 L 318.065 438.91 L 318.065 438.91 Q 317.626 438.885 317.05 438.885 L 317.05 438.885 L 317.05 438.885 Q 316.349 438.885 315.635 439.219 L 315.635 439.219 L 315.635 439.219 Q 314.921 439.554 314.257 440.123 L 314.257 440.123 L 314.257 440.123 Q 313.593 440.692 313.042 441.423 L 313.042 441.423 L 313.042 441.423 Q 312.49 442.153 312.115 442.945 L 312.115 442.945 L 312.115 461.165 L 303.947 461.165 L 303.947 434.108 L 312.115 433.291 L 312.115 439.009 L 314.47 433.934 L 314.47 433.934 Q 314.87 433.786 315.609 433.65 L 315.609 433.65 L 315.609 433.65 Q 316.349 433.513 317 433.513 L 317 433.513 L 317 433.513 Q 318.378 433.513 319.267 433.724 L 319.267 433.724 L 319.267 433.724 Q 320.157 433.934 320.958 434.33 L 320.958 434.33 L 320.958 434.33 Z M 331.806 461.165 L 324.14 461.165 L 324.14 426.582 L 323.589 421.557 L 331.806 420.789 L 331.806 442.128 L 338.445 433.934 L 346.989 433.934 L 337.919 443.836 L 332.808 445.643 L 337.544 447.203 L 349.519 461.165 L 340.8 461.165 L 331.806 449.827 L 331.806 461.165 L 331.806 461.165 Z " fill="rgb(0,255,255)"/></g></g></svg>
@@ -1,18 +1,14 @@
1
- import { Component } from 'base/component/index.js'
1
+ import { Component } from '@knowark/componarkjs'
2
2
 
3
3
  export class AudioDemo extends Component {
4
- init (context) {
5
- return super.init(context)
6
- }
7
-
8
4
  render () {
5
+ this.style.cssText = '--padding:4; --margin:2;'
9
6
  this.content = /* html */ `
10
7
  <ark-audio></ark-audio>
11
8
 
12
- <a
13
- target="_blank"
14
- href="https://github.com/knowark/componark/blob/master/lib/components/audio/README.md">
15
- * Reference
9
+ <a target="_blank"
10
+ href="https://github.com/knowark/componark/blob/master/lib/components/audio/README.md">
11
+ * Reference
16
12
  </a>
17
13
  `
18
14
  return super.render()
@@ -28,5 +24,5 @@ const styles = `
28
24
  margin: 1rem;
29
25
  }
30
26
  `
31
-
27
+
32
28
  Component.define('demo-audio', AudioDemo, styles)
@@ -1,4 +1,4 @@
1
- import { Component } from 'base/component/index.js'
1
+ import { Component } from '@knowark/componarkjs'
2
2
 
3
3
  const tag = 'demo-camera'
4
4
  export class CameraDemo extends Component {
@@ -24,25 +24,25 @@ export class CameraDemo extends Component {
24
24
  </a>
25
25
  `
26
26
 
27
- this.camera['start']()
27
+ this.camera.start()
28
28
 
29
29
  return super.render()
30
30
  }
31
31
 
32
32
  disconnectedCallback () {
33
- this.camera['stop']()
33
+ this.camera.stop()
34
34
  }
35
35
 
36
36
  takepicture () {
37
- this.photo.setAttribute('src', this.camera['dataURL'](200, 200))
37
+ this.photo.setAttribute('src', this.camera.dataURL(200, 200))
38
38
  }
39
39
 
40
40
  startCamera () {
41
- this.camera['start']()
41
+ this.camera.start()
42
42
  }
43
43
 
44
44
  stopCamera () {
45
- this.camera['stop']()
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 */`
@@ -1,12 +1,12 @@
1
- import { Component } from 'base/component/index.js'
1
+ 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 = []
@@ -1,4 +1,4 @@
1
- import { Component } from 'base/component/index.js'
1
+ import { Component } from '@knowark/componarkjs'
2
2
 
3
3
  const tag = 'demo-list'
4
4
  export class ListDemo extends Component {
@@ -60,7 +60,7 @@ export class ListDemo extends Component {
60
60
  templateList
61
61
  .init({
62
62
  source: sourceTemplate,
63
- template: 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)
@@ -1,15 +1,15 @@
1
- import { Component } from 'base/component/index.js'
1
+ 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: 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
  }
@@ -1,8 +1,6 @@
1
- import { Component } from 'base/component/index.js'
2
- import './detailDemo.js'
3
-
4
- const tag = 'demo-splitview'
1
+ import { Component } from '@knowark/componarkjs'
5
2
 
3
+ let tag = 'demo-splitview'
6
4
  export class SplitViewDemo extends Component {
7
5
  render () {
8
6
  this.content = /* html */ `
@@ -31,7 +29,6 @@ export class SplitViewDemo extends Component {
31
29
  return super.render()
32
30
  }
33
31
 
34
-
35
32
  initList () {
36
33
  const template = item => /* html */ `
37
34
  <h1>${item.year}</h1>
@@ -48,11 +45,47 @@ export class SplitViewDemo extends Component {
48
45
  ]
49
46
 
50
47
  this.select('[data-list]').init({
51
- source: source,
52
- template: template
48
+ source,
49
+ template
53
50
  }).render()
54
-
55
51
  }
56
52
  }
57
-
58
53
  Component.define(tag, SplitViewDemo)
54
+
55
+ tag = 'demo-splitview-detail'
56
+ export class SplitviewDetailDemo extends Component {
57
+ init (context = {}) {
58
+ if (!context.data) return super.init()
59
+
60
+ const data = context.data
61
+ this.first = data.first
62
+ this.second = data.second
63
+ this.year = data.year
64
+ return super.init()
65
+ }
66
+
67
+ render () {
68
+ this.content = this.first
69
+ ? /* html */ `
70
+ <button listen on-click="onClick"
71
+ style="margin:8px; --display-large:none;"
72
+ >Close</button>
73
+ <h1>${this.year}</h1>
74
+ <p>
75
+ <span data-first>FIRST: ${this.first}</span>
76
+ <span> | </span>
77
+ <span data-second>SECOND: ${this.second}</span>
78
+ </p>
79
+ `
80
+ : /* html */ `
81
+ <h1>Ark Detail Example</h1>
82
+ `
83
+ return super.render()
84
+ }
85
+
86
+ onClick (event) {
87
+ event.stopPropagation()
88
+ this.emit('close')
89
+ }
90
+ }
91
+ Component.define(tag, SplitviewDetailDemo)
@@ -1,9 +1,9 @@
1
- import { Component } from "base/component/index.js"
1
+ import { Component } from '@knowark/componarkjs'
2
2
 
3
- const tag = "demo-translate"
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
 
@@ -0,0 +1,81 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Componark - Components</title>
6
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
7
+ <link rel="stylesheet"href="https://unpkg.com/@knowark/styleark@0.6.1/dist/styles.min.css">
8
+ <script type="importmap">
9
+ {
10
+ "imports": {
11
+ "@knowark/componarkjs": "https://unpkg.com/@knowark/componarkjs@1.7.3/lib/index.js"
12
+ }
13
+ }
14
+ </script>
15
+ <style>
16
+ :root {
17
+ --secondary: #00ffff;
18
+ --primary: #001e3d;
19
+ font-family: "Roboto";
20
+ }
21
+
22
+ html, body {
23
+ height: 100%;
24
+ }
25
+ </style>
26
+ </head>
27
+ <body>
28
+ <app-root style="height:100%;;"></app-root>
29
+ <script type="module">
30
+ import { Component, html } from '@knowark/componarkjs'
31
+
32
+ const tag = 'app-root'
33
+ class RootComponent extends Component {
34
+ render () {
35
+ this.content = html`
36
+ <nav style="background:var(--primary); --padding:4; --height:4">
37
+ <a href="/" style="text-decoration:none; color:white">COMPONARK</a>
38
+ </nav>
39
+ <main style="height:calc(100% - (var(--height-step) * 4));
40
+ --grid: auto-flow / 1fr 5fr">
41
+ <aside id="menu" style="--flow:row; overflow:auto"
42
+ listen on-click="onMenuItem">
43
+ ${[
44
+ { component: 'audio' },
45
+ { component: 'camera' },
46
+ //{ component: 'capture' },
47
+ //{ component: 'droparea' },
48
+ //{ component: 'emit' },
49
+ { component: 'list' },
50
+ { component: 'paginator' },
51
+ { component: 'splitview' },
52
+ { component: 'translate' },
53
+ ].map(item => html`
54
+ <button style="height:100%; width:100%; font-weight:bold;
55
+ text-align:center; text-transform:capitalize; cursor:pointer;
56
+ --all:unset; --background-hover:var(--primary);
57
+ --color-hover:var(--light);">
58
+ ${item.component}
59
+ </button>
60
+ `).join('\n')}
61
+ </aside>
62
+ <article id="content" style="background:var(--muted); --padding:4">
63
+ </article>
64
+ </main>
65
+ `
66
+ return super.render()
67
+ }
68
+
69
+ async onMenuItem (event) {
70
+ const component = event.target.textContent.trim()
71
+ const file = `./demos/${component}.js`
72
+ const module = await import(file)
73
+ this.querySelector('#content').innerHTML = `
74
+ <demo-${component}></demo-${component}>
75
+ `
76
+ }
77
+ }
78
+ Component.define(tag, RootComponent)
79
+ </script>
80
+ </body>
81
+ </html>