@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.
Files changed (116) hide show
  1. package/Makefile +49 -0
  2. package/README.md +47 -0
  3. package/knowarkjs.code-workspace +29 -0
  4. package/lib/base/component/README.rst +113 -0
  5. package/lib/base/component/component.js +115 -0
  6. package/lib/base/component/component.test.js +327 -0
  7. package/lib/base/component/index.js +3 -0
  8. package/lib/base/index.js +1 -0
  9. package/lib/base/styles/index.js +3 -0
  10. package/lib/base/styles/styles.js +320 -0
  11. package/lib/base/utils/define.js +21 -0
  12. package/lib/base/utils/define.test.js +62 -0
  13. package/lib/base/utils/format.js +24 -0
  14. package/lib/base/utils/format.test.js +19 -0
  15. package/lib/base/utils/helpers.js +96 -0
  16. package/lib/base/utils/helpers.test.js +154 -0
  17. package/lib/base/utils/index.js +5 -0
  18. package/lib/base/utils/slots.js +18 -0
  19. package/lib/base/utils/slots.test.js +52 -0
  20. package/lib/base/utils/uuid.js +9 -0
  21. package/lib/base/utils/uuid.test.js +19 -0
  22. package/lib/components/audio/README.md +22 -0
  23. package/lib/components/audio/components/audio.js +103 -0
  24. package/lib/components/audio/components/audio.test.js +127 -0
  25. package/lib/components/audio/index.js +1 -0
  26. package/lib/components/audio/styles/ark.css.js +83 -0
  27. package/lib/components/audio/styles/index.js +2 -0
  28. package/lib/components/camera/README.md +64 -0
  29. package/lib/components/camera/components/camera.js +85 -0
  30. package/lib/components/camera/components/camera.test.js +104 -0
  31. package/lib/components/camera/index.js +1 -0
  32. package/lib/components/camera/styles/ark.css.js +17 -0
  33. package/lib/components/camera/styles/index.js +2 -0
  34. package/lib/components/capture/components/capture.js +54 -0
  35. package/lib/components/capture/components/capture.test.js +112 -0
  36. package/lib/components/capture/index.js +1 -0
  37. package/lib/components/droparea/README.md +51 -0
  38. package/lib/components/droparea/components/droparea-preview.js +159 -0
  39. package/lib/components/droparea/components/droparea-preview.test.js +105 -0
  40. package/lib/components/droparea/components/droparea.js +165 -0
  41. package/lib/components/droparea/components/droparea.test.js +320 -0
  42. package/lib/components/droparea/index.js +1 -0
  43. package/lib/components/droparea/styles/ark.css.js +235 -0
  44. package/lib/components/droparea/styles/index.js +3 -0
  45. package/lib/components/emit/components/emit.js +33 -0
  46. package/lib/components/emit/components/emit.test.js +138 -0
  47. package/lib/components/emit/index.js +1 -0
  48. package/lib/components/index.js +9 -0
  49. package/lib/components/list/README.md +103 -0
  50. package/lib/components/list/components/item.test.js +93 -0
  51. package/lib/components/list/components/list.item.js +22 -0
  52. package/lib/components/list/components/list.js +96 -0
  53. package/lib/components/list/components/list.test.js +267 -0
  54. package/lib/components/list/index.js +2 -0
  55. package/lib/components/paginator/README.md +32 -0
  56. package/lib/components/paginator/components/paginator.js +110 -0
  57. package/lib/components/paginator/components/paginator.test.js +131 -0
  58. package/lib/components/paginator/index.js +1 -0
  59. package/lib/components/paginator/styles/ark.css.js +196 -0
  60. package/lib/components/paginator/styles/index.js +2 -0
  61. package/lib/components/spinner/README.md +41 -0
  62. package/lib/components/spinner/components/spinner.js +105 -0
  63. package/lib/components/spinner/components/spinner.test.js +50 -0
  64. package/lib/components/spinner/index.js +1 -0
  65. package/lib/components/spinner/styles/ark.css.js +658 -0
  66. package/lib/components/spinner/styles/index.js +2 -0
  67. package/lib/components/splitview/README.md +63 -0
  68. package/lib/components/splitview/components/splitview.detail.js +46 -0
  69. package/lib/components/splitview/components/splitview.detail.test.js +92 -0
  70. package/lib/components/splitview/components/splitview.js +69 -0
  71. package/lib/components/splitview/components/splitview.master.js +26 -0
  72. package/lib/components/splitview/components/splitview.master.test.js +55 -0
  73. package/lib/components/splitview/components/splitview.test.js +76 -0
  74. package/lib/components/splitview/index.js +3 -0
  75. package/lib/components/translate/README.md +56 -0
  76. package/lib/components/translate/components/translate.js +100 -0
  77. package/lib/components/translate/components/translate.test.js +226 -0
  78. package/lib/components/translate/index.js +1 -0
  79. package/lib/index.js +2 -0
  80. package/package.json +68 -0
  81. package/showcase/design/.htaccess +8 -0
  82. package/showcase/design/core/factories/development/development.factory.js +5 -0
  83. package/showcase/design/core/factories/development/index.js +1 -0
  84. package/showcase/design/core/factories/index.js +11 -0
  85. package/showcase/design/core/factories/standard.factory.js +19 -0
  86. package/showcase/design/index.html +22 -0
  87. package/showcase/design/index.js +7 -0
  88. package/showcase/design/screens/base/audio/audioDemo.js +32 -0
  89. package/showcase/design/screens/base/audio/index.js +25 -0
  90. package/showcase/design/screens/base/camera/cameraDemo.js +83 -0
  91. package/showcase/design/screens/base/camera/index.js +25 -0
  92. package/showcase/design/screens/base/droparea/dropareaDemo.js +88 -0
  93. package/showcase/design/screens/base/droparea/index.js +25 -0
  94. package/showcase/design/screens/base/index.js +42 -0
  95. package/showcase/design/screens/base/list/index.js +25 -0
  96. package/showcase/design/screens/base/list/listDemo.js +89 -0
  97. package/showcase/design/screens/base/paginator/index.js +25 -0
  98. package/showcase/design/screens/base/paginator/paginatorDemo.js +82 -0
  99. package/showcase/design/screens/base/root.component.js +294 -0
  100. package/showcase/design/screens/base/root.routes.js +28 -0
  101. package/showcase/design/screens/base/spinner/index.js +25 -0
  102. package/showcase/design/screens/base/spinner/spinnerDemo.js +55 -0
  103. package/showcase/design/screens/base/splitview/detailDemo.js +40 -0
  104. package/showcase/design/screens/base/splitview/index.js +25 -0
  105. package/showcase/design/screens/base/splitview/splitViewDemo.js +58 -0
  106. package/showcase/design/screens/base/translate/index.js +20 -0
  107. package/showcase/design/screens/base/translate/translateDemo.js +43 -0
  108. package/showcase/design/screens/main.js +12 -0
  109. package/showcase/design/screens/screens.routes.js +23 -0
  110. package/showcase/index.html +86 -0
  111. package/showcase/index.js +5 -0
  112. package/showcase/locales/en/default.json +5 -0
  113. package/showcase/locales/es/default.json +5 -0
  114. package/showcase/locales/fr/default.json +5 -0
  115. package/tsconfig.json +23 -0
  116. package/webpack.config.cjs +118 -0
@@ -0,0 +1,42 @@
1
+ /** @typedef {import('./root.component').RootComponent} RootComponent */
2
+ import './root.component.js'
3
+ import { setRoutes } from './root.routes.js'
4
+
5
+ export function hub (parentResolver, prefix) {
6
+ const resolver = parentResolver.forge({
7
+ strategy: {
8
+ RootComponent: {
9
+ method: 'rootComponent'
10
+ }
11
+ },
12
+ factory: new RootFactory(prefix)
13
+ })
14
+
15
+ const rootComponent = resolver.resolve('RootComponent')
16
+ setRoutes(resolver, rootComponent, prefix)
17
+
18
+ return rootComponent
19
+ }
20
+
21
+ export class RootFactory {
22
+ /** @param {string} prefix */
23
+ constructor (prefix) {
24
+ RootFactory.prefix = prefix
25
+ // @ts-ignore
26
+ this._rootComponent.prefix = prefix
27
+ // @ts-ignore
28
+ this._rootComponent.dependencies = []
29
+ }
30
+
31
+ /** @param {string} method */
32
+ extract (method) {
33
+ return this[`_${method}`]
34
+ }
35
+
36
+ _rootComponent () {
37
+ const rootComponent = /** @type {RootComponent} */
38
+ (document.createElement('app-root'))
39
+ return rootComponent.init({ path: RootFactory.prefix })
40
+ }
41
+ }
42
+ RootFactory.prefix = undefined
@@ -0,0 +1,25 @@
1
+ import { ListDemo } from './listDemo.js'
2
+
3
+ export function hub (parentResolver) {
4
+ const resolver = parentResolver.forge({
5
+ strategy: {
6
+ ListDemo: {
7
+ method: 'component'
8
+ }
9
+ },
10
+ factory: new ComponentFactory()
11
+ })
12
+
13
+ return resolver.resolve('ListDemo')
14
+ }
15
+
16
+ export class ComponentFactory {
17
+ /** @param {string} method */
18
+ extract (method) {
19
+ return this[`_${method}`]
20
+ }
21
+
22
+ _component () {
23
+ return new ListDemo()
24
+ }
25
+ }
@@ -0,0 +1,89 @@
1
+ import { Component } from 'base/component/index.js'
2
+
3
+ const tag = 'demo-list'
4
+ export class ListDemo extends Component {
5
+ init (context) {
6
+ return super.init({})
7
+ }
8
+
9
+ render () {
10
+ this.innerHTML = /* html */ `
11
+ <h1>Default List</h1>
12
+
13
+ <ark-list background="light" color="dark" data-default-list click-disabled></ark-list>
14
+
15
+ <h1>Template List <span data-template-selected></span></h1>
16
+
17
+ <ark-list background="light" color="primary" data-template-list action default
18
+ listen on-list:selected="onTemplateListSelected"></ark-list>
19
+
20
+ <a
21
+ class="reference"
22
+ target="_blank"
23
+ href="https://github.com/knowark/componark/tree/master/lib/components/list/README.md">
24
+ * Reference
25
+ </a>
26
+ `
27
+
28
+ return super.render()
29
+ }
30
+
31
+ load () {
32
+ const sourceDefault = ['Colombia', 'Uruguay', 'Brasil', 'Perú']
33
+
34
+ // DEFAULT LIST
35
+
36
+ const defaultList = this.select('[data-default-list]')
37
+ defaultList
38
+ .init({
39
+ source: sourceDefault
40
+ })
41
+ .render()
42
+
43
+ // TEMPLATE LIST
44
+
45
+ const sourceTemplate = [
46
+ { first: 'Colombia', second: 'Argentina', year: 2016 },
47
+ { first: 'Uruguay', second: 'Colombia', year: 2017 },
48
+ { first: 'Brasil', second: 'Argentina', year: 2018 },
49
+ { first: 'Perú', second: 'Bolivia', year: 2019 }
50
+ ]
51
+
52
+ const template = item => /* html */ `
53
+ <h1>${item.year}</h1>
54
+ <span data-first>FIRST: ${item.first}</span>
55
+ <span> | </span>
56
+ <span data-second>SECOND: ${item.second}</span>
57
+ `
58
+
59
+ const templateList = this.select('[data-template-list]')
60
+ templateList
61
+ .init({
62
+ source: sourceTemplate,
63
+ template: template
64
+ })
65
+ .render()
66
+
67
+ return super.load()
68
+ }
69
+
70
+ onTemplateListSelected (event) {
71
+ const detail = event.detail
72
+
73
+ const index = detail.index
74
+ const data = detail.data
75
+
76
+ this.select('[data-template-selected]').innerText = `
77
+ [${index}] ${data.year} - ${data.first}
78
+ `.trim()
79
+ }
80
+ }
81
+
82
+ const styles = /* css */`
83
+ .ark-list{
84
+ margin-bottom:20px;
85
+ }
86
+ `
87
+
88
+
89
+ Component.define(tag, ListDemo, styles)
@@ -0,0 +1,25 @@
1
+ import { PaginatorDemo } from './paginatorDemo.js'
2
+
3
+ export function hub (parentResolver) {
4
+ const resolver = parentResolver.forge({
5
+ strategy: {
6
+ PaginatorDemo: {
7
+ method: 'component'
8
+ }
9
+ },
10
+ factory: new ComponentFactory()
11
+ })
12
+
13
+ return resolver.resolve('PaginatorDemo')
14
+ }
15
+
16
+ export class ComponentFactory {
17
+ /** @param {string} method */
18
+ extract (method) {
19
+ return this[`_${method}`]
20
+ }
21
+
22
+ _component () {
23
+ return new PaginatorDemo()
24
+ }
25
+ }
@@ -0,0 +1,82 @@
1
+ import { Component } from 'base/component/index.js'
2
+
3
+ const tag = 'demo-paginator'
4
+ export class PaginatorDemo extends Component {
5
+ init(context = {}) {
6
+ this.limit = 1
7
+ this.offset = 0
8
+ this.page = 1
9
+ return super.init(context)
10
+ }
11
+
12
+ render() {
13
+ this.content = /* html */ `
14
+ <ark-list background="light" color="dark"></ark-list>
15
+ <ark-paginator listen on-page-changed="onPageChanged"
16
+ displayed-pages="4" page-size="1"></ark-paginator>
17
+
18
+ <a
19
+ target="_blank"
20
+ href="https://github.com/knowark/componark/blob/master/lib/components/paginator/README.md"
21
+ class="reference">
22
+ * Reference
23
+ </a>
24
+ `
25
+ return super.render()
26
+ }
27
+
28
+ async load() {
29
+ const template = (item) => /* html */ `
30
+ <h1>${item.year}</h1>
31
+ <span data-first>FIRST: ${item.first}</span>
32
+ <span> | </span>
33
+ <span data-second>SECOND: ${item.second}</span>
34
+ `
35
+
36
+ const source = () => {
37
+ let list = this.list
38
+ if (this.limit) list = list.slice(0, this.limit)
39
+ if (this.offset) list = list.slice(this.offset)
40
+ return list
41
+ }
42
+
43
+ this.select('ark-list')
44
+ .init({
45
+ source: source(),
46
+ template: template,
47
+ })
48
+ .render()
49
+
50
+ const paginator = this.select('ark-paginator')
51
+ paginator
52
+ .init({
53
+ collectionSize: this.list.length,
54
+ currentPage: this.page,
55
+ })
56
+ .render()
57
+ return super.load()
58
+ }
59
+
60
+ /** @param {CustomEvent} event */
61
+ async onPageChanged(event) {
62
+ event.stopPropagation()
63
+ this.limit = event.detail.limit
64
+ this.offset = event.detail.offset
65
+ this.page = event.detail.page
66
+ await this.update()
67
+ }
68
+
69
+ get list() {
70
+ return [
71
+ { first: 'Colombia', second: 'Argentina', year: 2016 },
72
+ { first: 'Uruguay', second: 'Colombia', year: 2017 },
73
+ { first: 'Brasil', second: 'Argentina', year: 2018 },
74
+ { first: 'Perú', second: 'Bolivia', year: 2019 },
75
+ { first: 'Argentina', second: 'Argentina', year: 2020 },
76
+ { first: 'Chile', second: 'Colombia', year: 2021 },
77
+ { first: 'Colombia', second: 'Argentina', year: 2022 },
78
+ { first: 'Uruguay', second: 'Bolivia', year: 2023 },
79
+ ]
80
+ }
81
+ }
82
+ Component.define(tag, PaginatorDemo)
@@ -0,0 +1,294 @@
1
+ import { Component } from 'base/component'
2
+
3
+ // @ts-ignore
4
+ // eslint-disable-next-line no-undef
5
+ export const version = VERSION
6
+
7
+ const design = process.env.ARK_DESIGN
8
+
9
+ const tag = 'app-root'
10
+ export class RootComponent extends Component {
11
+ render() {
12
+ this.content = /* html */ `
13
+ <nav class="app-root__navbar">
14
+ <div class="app-root__menu">
15
+ <span class="material-icons">
16
+ list
17
+ </span>
18
+ </div>
19
+ <div class="app-root__brand">
20
+ <a href="/">
21
+ <h1 class="app-root__title">COMPONARK</h1>
22
+ <p class="app-root__subtitle">web components</p>
23
+ </a>
24
+ </div>
25
+ <div class="app-root__actions">
26
+ <a class="app-root__navitem" href="#">style ${design.toUpperCase()}</a>
27
+ </div>
28
+ </nav>
29
+
30
+ <aside class="app-root__sidebar">
31
+ <div class="${tag}__sidebar-content">
32
+ ${this.locations
33
+ .map(
34
+ (location) => `
35
+ <a class="app-root__sideitem" href="/${design}${location.path}">
36
+ ${location.name}
37
+ </a>
38
+ `
39
+ )
40
+ .join('')}
41
+ </div>
42
+ </aside>
43
+
44
+ <section class="app-root__content" data-content></section>
45
+
46
+ `
47
+ this.showMenu()
48
+ return super.render()
49
+ }
50
+
51
+ /** @param {Component} component */
52
+ setContentComponent(component) {
53
+ if (!component) return
54
+ const container = this.select('[data-content]')
55
+
56
+ container.firstChild?.remove()
57
+ container.append(component)
58
+ component.render().load()
59
+ }
60
+
61
+ /** @param {CustomEvent} event */
62
+ selectEventListener(event) {
63
+ event.stopImmediatePropagation()
64
+ const style = event.detail.value
65
+ }
66
+
67
+ /** @param {CustomEvent} event */
68
+ onListItemSelected(event) {
69
+ this.dispatchEvent(
70
+ new CustomEvent('navigate', {
71
+ bubbles: true,
72
+ detail: { path: event.detail.data.path },
73
+ })
74
+ )
75
+ }
76
+
77
+ showMenu() {
78
+ this.querySelector('.app-root__menu').addEventListener('click', () => {
79
+ this.querySelector('.app-root__sidebar').style.display = 'grid'
80
+ })
81
+ }
82
+
83
+ get locations() {
84
+ return [
85
+ { name: 'Audio', path: '/base/audio' },
86
+ { name: 'Camera', path: '/base/camera' },
87
+ { name: 'Droparea', path: '/base/droparea' },
88
+ { name: 'List', path: '/base/list' },
89
+ { name: 'Paginator', path: '/base/paginator' },
90
+ { name: 'Spinner', path: '/base/spinner' },
91
+ { name: 'SplitView', path: '/base/splitview' },
92
+ { name: 'Translate', path: '/base/translate' },
93
+ ]
94
+ }
95
+ }
96
+
97
+ const styles = /* css */ `
98
+
99
+ html {
100
+ height: 100%;
101
+ height: -webkit-fill-available;
102
+ }
103
+
104
+ body {
105
+ margin: 0;
106
+ padding: 0;
107
+ background-color: #eff3f8;
108
+ height: 100%;
109
+ }
110
+
111
+ :root {
112
+ /*
113
+ --primary: #1976d2;
114
+ --secondary: orange;
115
+ --success: green;
116
+ --danger: red;
117
+ --warning: yellow;
118
+ --info: cyan;
119
+ --dark: black;
120
+ --muted: gray;
121
+ --light: lightgray;
122
+ */
123
+ --xs: 0.3rem;
124
+ --sm: 0.8rem;
125
+ --md: 1rem;
126
+ --lg: 2rem;
127
+ --xl: 3rem;
128
+ }
129
+
130
+ .${tag} {
131
+ display: grid;
132
+ height: 100%;
133
+ grid-template-rows: 0.05fr 1fr;
134
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
135
+ letter-spacing: 0.02em;
136
+ }
137
+
138
+ .${tag}__navbar {
139
+ grid-column: 1 / 13;
140
+ display: grid;
141
+ grid-template-columns: repeat(6, 1fr);
142
+ background-color: rgb(0 30 61);
143
+ color: #00ffff;
144
+ text-decoration: none
145
+ overflow: hidden;
146
+ border-bottom:4px solid rgb(160 255 255 / 53%);
147
+ box-shadow: 0px 0px 4px rgba(0,0,0,.6);
148
+ }
149
+
150
+ .${tag} .material-icons {
151
+ font-size: 2.5rem;
152
+ }
153
+
154
+ .${tag}__navitem {
155
+ text-decoration: none;
156
+ padding: 2vw;
157
+ color: cyan;
158
+ height:auto;
159
+ }
160
+
161
+ .${tag}__sideitems {
162
+ display: flex;
163
+ flex-direction: column;
164
+ }
165
+
166
+ .${tag}__navitem,
167
+ .${tag}__sideitem {
168
+ transition: background 0.1s ease;
169
+ }
170
+
171
+ .${tag}__navitem:hover,
172
+ .${tag}__sideitem:hover {
173
+ background-color: rgb(38 54 70);
174
+ color: cyan;
175
+ }
176
+ .${tag}__navitem:active,
177
+ .${tag}__sideitem:active {
178
+ background-color: rgb(239, 243, 248);
179
+ color: cyan;
180
+ }
181
+ .${tag}__navitem:hover, .app-root__sideitem:hover {
182
+ background-color: rgb(131 170 209);
183
+ color: rgb(0 1 2);
184
+ font-weight: bold;
185
+ }
186
+
187
+ .${tag}__brand {
188
+ display: grid;
189
+ align-items: center;
190
+ padding: 0 1rem;
191
+ height: 100%;
192
+ width: fit-content;
193
+ justify-self: start;
194
+ }
195
+
196
+ .${tag}__brand a {
197
+ text-decoration: none;
198
+ text-align: center;
199
+ margin: 0;
200
+ color: white;
201
+ transition: .1s;
202
+ }
203
+
204
+ .${tag}__brand:hover a {
205
+ color: rgb(0, 255, 255);
206
+ transition: .1s;
207
+ }
208
+
209
+
210
+ .${tag}__actions {
211
+ display: grid;
212
+ grid-auto-flow: column;
213
+ align-items: center;
214
+ justify-items: center;
215
+ grid-column: 6;
216
+ }
217
+
218
+ .${tag}__title {
219
+ all: inherit;
220
+ font-weight: 700;
221
+ font-size: 1.3rem;
222
+ }
223
+
224
+ .${tag}__subtitle {
225
+ all: inherit;
226
+ font-size:0.9rem;
227
+ font-weight: 300;
228
+ text-align:center;
229
+ }
230
+
231
+ .${tag}__sidebar {
232
+ display: grid;
233
+ height: 100%;
234
+ width: 240px;
235
+ grid-row: 2 / -1;
236
+ background-color: #001e3d;
237
+ color: #00ffff;
238
+ text-decoration: none;
239
+ overflow-x: hidden;
240
+ }
241
+
242
+ .${tag}__sidebar-content {
243
+ display: inherit;
244
+ }
245
+
246
+ .${tag}__navbar-brand {
247
+ display: none;
248
+ }
249
+
250
+ .${tag}__sideitem {
251
+ text-decoration: none;
252
+ padding: 1vw;
253
+ color: rgb(160 255 255);
254
+ border-bottom: 1px solid #8080801c;
255
+ }
256
+
257
+ .${tag}__menu {
258
+ display: none;
259
+ text-align:center;
260
+ user-select: none;
261
+ cursor: pointer;
262
+ }
263
+
264
+ .${tag}__content {
265
+ grid-area: 2 / 2 / auto / 13;
266
+ padding: 2vmin;
267
+ overflow-x: hidden;
268
+ overflow-y: auto;
269
+ }
270
+
271
+ @media only screen and (max-width: 800px) {
272
+ .${tag}__sidebar {
273
+ display: none;
274
+ position: absolute;
275
+ z-index: 1000;
276
+ width: 150px;
277
+ }
278
+
279
+ .${tag}__menu {
280
+ display: grid;
281
+ }
282
+
283
+ .${tag}__content {
284
+ grid-area: 2 / 1 / auto / 13;
285
+ }
286
+
287
+ .${tag}__brand {
288
+ grid-column: 3 / 5;
289
+ justify-self: center;
290
+ }
291
+
292
+ }
293
+ `
294
+ Component.define(tag, RootComponent, styles)
@@ -0,0 +1,28 @@
1
+ export function setRoutes(resolver, rootComponent, prefix) {
2
+ /** @param {string} path @returns {{ path: string, action: function }} */
3
+ function getComponentRoute(path, dependencies = []) {
4
+ return {
5
+ path: path,
6
+ action: async () => {
7
+ for (const dependency of dependencies) {
8
+ await import(`components/${dependency}/index.js`)
9
+ }
10
+ await import(`components/${path}/index.js`)
11
+ const module = await import(`./${path}/index.js`)
12
+ rootComponent.setContentComponent(module.hub(resolver))
13
+ },
14
+ }
15
+ }
16
+
17
+ const router = resolver.resolve('Router')
18
+ router.addRoutes(prefix, [
19
+ getComponentRoute('audio'),
20
+ getComponentRoute('camera'),
21
+ getComponentRoute('droparea'),
22
+ getComponentRoute('list'),
23
+ getComponentRoute('paginator', ['list']),
24
+ getComponentRoute('spinner'),
25
+ getComponentRoute('splitview', ['list']),
26
+ getComponentRoute('translate'),
27
+ ])
28
+ }
@@ -0,0 +1,25 @@
1
+ import { SpinnerDemo } from './spinnerDemo.js'
2
+
3
+ export function hub (parentResolver) {
4
+ const resolver = parentResolver.forge({
5
+ strategy: {
6
+ SpinnerDemo: {
7
+ method: 'component'
8
+ }
9
+ },
10
+ factory: new ComponentFactory()
11
+ })
12
+
13
+ return resolver.resolve('SpinnerDemo')
14
+ }
15
+
16
+ export class ComponentFactory {
17
+ /** @param {string} method */
18
+ extract (method) {
19
+ return this[`_${method}`]
20
+ }
21
+
22
+ _component () {
23
+ return new SpinnerDemo()
24
+ }
25
+ }
@@ -0,0 +1,55 @@
1
+ import { Component } from 'base/component/index.js'
2
+
3
+ const tag = 'demo-spinner'
4
+ export class SpinnerDemo extends Component {
5
+ init(context) {
6
+ return super.init()
7
+ }
8
+
9
+ render() {
10
+ this.content = /* html */ `
11
+ <h1>spinner</h1>
12
+
13
+ <div class="spinner-container">
14
+ <div>
15
+ <ark-spinner></ark-spinner>
16
+ <p style="margin-top:16px">circle</p>
17
+ </div>
18
+ <div>
19
+ <ark-spinner scale="1.5" type="chase"></ark-spinner>
20
+ <p style="margin-top:16px">chase</p>
21
+ </div>
22
+ <div>
23
+ <ark-spinner type="rect"></ark-spinner>
24
+ <p style="margin-top:16px">rect</p>
25
+ </div>
26
+ <div>
27
+ <ark-spinner type="bounce"></ark-spinner>
28
+ <p style="margin-top:16px">bounce</p>
29
+ </div>
30
+ <div>
31
+ <ark-spinner type="loader"></ark-spinner>
32
+ <p style="margin-top:16px">loader</p>
33
+ </div>
34
+ </div>
35
+
36
+ <a
37
+ target="_blank" href="https://github.com/knowark/componark/blob/master/lib/components/spinner/README.md">
38
+ * Reference
39
+ </a>
40
+ `
41
+ return super.render()
42
+ }
43
+ }
44
+
45
+ const styles = /* css */`
46
+ .spinner-container{
47
+ display: flex;
48
+ gap:1.5rem;
49
+ flex-wrap: wrap;
50
+ justify-content: center;
51
+ align-items: center;
52
+ width: 100%;
53
+ }
54
+ `
55
+ Component.define(tag, SpinnerDemo, styles)
@@ -0,0 +1,40 @@
1
+ import { Component } from "base/component/index.js"
2
+
3
+ const tag = "demo-splitview-detail"
4
+
5
+ export class SplitviewDetailDemo extends Component {
6
+ init(context = {}) {
7
+ if (!context.data) return super.init()
8
+
9
+ const data = context.data
10
+ this.first = data.first
11
+ this.second = data.second
12
+ this.year = data.year
13
+ return super.init()
14
+ }
15
+
16
+ render() {
17
+ this.content = this.first
18
+ ? /* html */ `
19
+ <button listen on-click="onClick"
20
+ style="margin:8px; --display-large:none;"
21
+ >Close</button>
22
+ <h1>${this.year}</h1>
23
+ <p>
24
+ <span data-first>FIRST: ${this.first}</span>
25
+ <span> | </span>
26
+ <span data-second>SECOND: ${this.second}</span>
27
+ </p>
28
+ `
29
+ : /* html */ `
30
+ <h1>Ark Detail Example</h1>
31
+ `
32
+ return super.render()
33
+ }
34
+
35
+ onClick (event) {
36
+ event.stopPropagation()
37
+ this.emit('close')
38
+ }
39
+ }
40
+ Component.define(tag, SplitviewDetailDemo)