@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,25 @@
1
+ import { SplitViewDemo } from './splitViewDemo.js'
2
+
3
+ export function hub (parentResolver) {
4
+ const resolver = parentResolver.forge({
5
+ strategy: {
6
+ SplitViewDemo: {
7
+ method: 'component'
8
+ }
9
+ },
10
+ factory: new ComponentFactory()
11
+ })
12
+
13
+ return resolver.resolve('SplitViewDemo')
14
+ }
15
+
16
+ export class ComponentFactory {
17
+ /** @param {string} method */
18
+ extract (method) {
19
+ return this[`_${method}`]
20
+ }
21
+
22
+ _component () {
23
+ return new SplitViewDemo()
24
+ }
25
+ }
@@ -0,0 +1,58 @@
1
+ import { Component } from 'base/component/index.js'
2
+ import './detailDemo.js'
3
+
4
+ const tag = 'demo-splitview'
5
+
6
+ export class SplitViewDemo extends Component {
7
+ render () {
8
+ this.content = /* html */ `
9
+ <ark-splitview>
10
+ <ark-splitview-master resize master-event="list:selected">
11
+ <ark-list background='light' color='dark' data-list></ark-list>
12
+ </ark-splitview-master>
13
+
14
+ <ark-splitview-detail style="background:grey" title="Demo" hidden>
15
+ <ark-icon slot="icon" name='fas fa-chevron-left'></ark-icon>
16
+ <demo-splitview-detail></demo-splitview-detail>
17
+ </ark-splitview-detail>
18
+
19
+ </ark-splitview>
20
+
21
+ <a
22
+ target="_blank"
23
+ href="https://github.com/knowark/componark/blob/master/lib/components/splitview/README.md"
24
+ class="reference">
25
+ * Reference
26
+ </a>
27
+ `
28
+
29
+ this.initList()
30
+
31
+ return super.render()
32
+ }
33
+
34
+
35
+ initList () {
36
+ const template = item => /* html */ `
37
+ <h1>${item.year}</h1>
38
+ <span data-first>FIRST: ${item.first}</span>
39
+ <span> | </span>
40
+ <span data-second>SECOND: ${item.second}</span>
41
+ `
42
+
43
+ const source = [
44
+ { first: 'Colombia', second: 'Argentina', year: 2016 },
45
+ { first: 'Uruguay', second: 'Colombia', year: 2017 },
46
+ { first: 'Brasil', second: 'Argentina', year: 2018 },
47
+ { first: 'Perú', second: 'Bolivia', year: 2019 }
48
+ ]
49
+
50
+ this.select('[data-list]').init({
51
+ source: source,
52
+ template: template
53
+ }).render()
54
+
55
+ }
56
+ }
57
+
58
+ Component.define(tag, SplitViewDemo)
@@ -0,0 +1,20 @@
1
+ import { TranslateDemo } from './translateDemo.js'
2
+
3
+ export function hub (parentResolver) {
4
+ const resolver = parentResolver.forge({
5
+ factory: new ComponentFactory()
6
+ })
7
+
8
+ return resolver.resolve('TranslateDemo')
9
+ }
10
+
11
+ export class ComponentFactory {
12
+ /** @param {string} method */
13
+ extract (method) {
14
+ return this[`${method}`]
15
+ }
16
+
17
+ translateDemo () {
18
+ return new TranslateDemo()
19
+ }
20
+ }
@@ -0,0 +1,43 @@
1
+ import { Component } from "base/component/index.js"
2
+
3
+ const tag = "demo-translate"
4
+ export class TranslateDemo extends Component {
5
+ render() {
6
+ const context = JSON.stringify({name: 'Esteban'})
7
+ this.content = /* html */ `
8
+
9
+ <section class="translate-demo_container">
10
+ <span>
11
+ <ark-translate languages='en,es,fr'></ark-translate>
12
+ </span>
13
+
14
+ <span>
15
+ <span data-i18n="hello">Hello</span>
16
+ <span data-i18n="world">World</span>
17
+ <span>
18
+ <strong data-i18n="magic">Magic</strong>
19
+ </span>
20
+ </span>
21
+
22
+ <a
23
+ target="_blank"
24
+ href="https://github.com/knowark/componark/blob/master/lib/components/translate/README.md">
25
+ * Reference
26
+ </a>
27
+ </section>
28
+ `
29
+
30
+ return super.render()
31
+ }
32
+
33
+ }
34
+ const styles = /* css */ `
35
+
36
+ .translate-demo_container {
37
+ display: grid;
38
+ }
39
+
40
+
41
+ `
42
+
43
+ Component.define(tag, TranslateDemo, styles)
@@ -0,0 +1,12 @@
1
+ import { Injectark } from '@knowark/injectarkjs'
2
+ import { buildInjector } from '../core/factories/index.js'
3
+ import { setMainRoutes } from './screens.routes.js'
4
+
5
+ /** @param {string} target */
6
+ export function main (target) {
7
+ const { strategy, factory } = buildInjector(target)
8
+ const resolver = new Injectark({ strategy: strategy, factory: factory })
9
+ const mainComponent = document.querySelector('main')
10
+ const prefix = '/'
11
+ setMainRoutes(mainComponent, resolver, prefix)
12
+ }
@@ -0,0 +1,23 @@
1
+ export function setMainRoutes (mainComponent, resolver, prefix) {
2
+ const router = resolver.resolve('Router')
3
+ router.addRoutes(prefix, [
4
+ {
5
+ path: '',
6
+ action: async () => {
7
+ return router.navigate('/base/accordion')
8
+ }
9
+ },
10
+ {
11
+ path: 'base',
12
+ action: async () => {
13
+ const module = await import('./base/index.js')
14
+ const _prefix = prefix + 'base/'
15
+ setMainComponent(mainComponent, module.hub(resolver, _prefix))
16
+ }
17
+ }
18
+ ])
19
+ }
20
+
21
+ function setMainComponent (mainComponent, screenComponent) {
22
+ mainComponent.parentElement.replaceChild(screenComponent, mainComponent)
23
+ }
@@ -0,0 +1,86 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link rel="preconnect" href="https://fonts.googleapis.com">
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
12
+ <title></title>
13
+ </head>
14
+ <style>
15
+ * {
16
+ box-sizing: border-box;
17
+ margin: 0;
18
+ }
19
+
20
+ html {
21
+ height: 100%;
22
+ }
23
+
24
+ body {
25
+ display: grid;
26
+ align-items: center;
27
+ justify-items: center;
28
+ color: #001e3d;
29
+ font-family: "Roboto","Helvetica","Arial",sans-serif;
30
+ min-height: 100%;
31
+ }
32
+
33
+ .titles {
34
+ display: flex;
35
+ gap: 0.8rem;
36
+ }
37
+
38
+ #version {
39
+ align-self: center;
40
+ font-weight: 300;
41
+ font-size: 0.9rem;
42
+ }
43
+
44
+ .themes {
45
+ padding: 0;
46
+ display: flex;
47
+ gap: 1rem;
48
+ flex-direction: column;
49
+ align-self: center;
50
+ text-align: center;
51
+ list-style-type: none;
52
+ }
53
+
54
+ .theme__link {
55
+ user-select: none;
56
+ padding: 1rem;
57
+ background: #001e3d;
58
+ color: #00ffff;
59
+ border-radius: 5px;
60
+ text-decoration: none;
61
+ font-weight: bold;
62
+ transition: all 0.2s ease-in-out;
63
+ }
64
+
65
+ .theme__link:hover {
66
+ background: #00ffff;
67
+ color: #001e3d;
68
+ }
69
+ </style>
70
+
71
+ <body>
72
+ <main>
73
+ <div class="titles">
74
+ <img src="../showcase/logo-knowark.svg" alt="" class="brand">
75
+ <h1>Componark</h1>
76
+ <h2 id="version"></h2>
77
+ </div>
78
+ <ul class="themes">
79
+ <a class="theme__link" href="/ark/base/accordion">
80
+ <li> ARK </li>
81
+ </a>
82
+ </ul>
83
+ </main>
84
+ </body>
85
+
86
+ </html>
@@ -0,0 +1,5 @@
1
+
2
+ const version = VERSION
3
+
4
+ const versionElement = document.getElementById('version')
5
+ versionElement.textContent = version
@@ -0,0 +1,5 @@
1
+ {
2
+ "hello": "Hello",
3
+ "world": "World",
4
+ "magic": "Magic"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "hello": "Hola",
3
+ "world": "Mundo",
4
+ "magic": "Mágico"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "hello": "Bonjour",
3
+ "world": "Monde",
4
+ "magic": "Magie"
5
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "module": "commonjs",
5
+ "allowJs": true,
6
+ "checkJs": true,
7
+ "noEmit": true,
8
+ "noImplicitThis": false,
9
+ "noImplicitAny": false,
10
+ "esModuleInterop": true,
11
+ "resolveJsonModule": true,
12
+ "baseUrl": "lib",
13
+ "paths": {
14
+ "@base*": [
15
+ "base"
16
+ "base*"
17
+ ],
18
+ "*": [
19
+ "*"
20
+ ]
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,118 @@
1
+ const path = require("path")
2
+ const { DefinePlugin, EnvironmentPlugin } = require("webpack")
3
+ const { CleanWebpackPlugin } = require("clean-webpack-plugin")
4
+ const CopyWebpackPlugin = require("copy-webpack-plugin")
5
+ const HtmlWebpackPlugin = require("html-webpack-plugin")
6
+
7
+ module.exports = (env, argv) => {
8
+ const devMode = argv.mode === "development"
9
+ const target = env.TARGET
10
+
11
+ const commonConfig = {
12
+ mode: argv.mode,
13
+ entry: {
14
+ showcase: "./lib/showcase/design/index.js",
15
+ },
16
+ plugins: [
17
+ new CleanWebpackPlugin(),
18
+ new HtmlWebpackPlugin({
19
+ chunks: ["showcase", "runtime"],
20
+ title: "Componark",
21
+ template: "./lib/showcase/design/index.html",
22
+ }),
23
+ new CopyWebpackPlugin({
24
+ patterns: ["lib/showcase/design/.htaccess"],
25
+ }),
26
+ new DefinePlugin({
27
+ PRODUCTION: !devMode,
28
+ VERSION: JSON.stringify(require("./package.json").version),
29
+ TARGET: JSON.stringify(target),
30
+ }),
31
+ ],
32
+ module: {
33
+ rules: [
34
+ {
35
+ test: /\.(png|svg|jpg|gif)$/,
36
+ use: ["file-loader"],
37
+ },
38
+ {
39
+ test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
40
+ use: [
41
+ {
42
+ loader: "file-loader",
43
+ options: {
44
+ name: "[name].[ext]",
45
+ outputPath: "fonts/",
46
+ },
47
+ },
48
+ ],
49
+ }
50
+ ],
51
+ },
52
+ resolve: {
53
+ alias: {
54
+ base: path.resolve(__dirname, "./lib/base/"),
55
+ components: path.resolve(__dirname, "./lib/components/"),
56
+ screens: path.resolve(__dirname, "./lib/showcase/screens/"),
57
+ },
58
+ },
59
+ }
60
+
61
+ const arkConfig = Object.assign({}, commonConfig, {
62
+ name: "ark",
63
+ mode: argv.mode,
64
+ output: {
65
+ publicPath: "/ark/",
66
+ filename: "[name].[contenthash].js",
67
+ path: path.join(__dirname, "/dist/ark"),
68
+ },
69
+ plugins: commonConfig.plugins.concat([
70
+ new EnvironmentPlugin({
71
+ ARK_DESIGN: "ark",
72
+ }),
73
+ ]),
74
+ })
75
+
76
+ const rootConfig = {
77
+ name: "root",
78
+ mode: argv.mode,
79
+ entry: {
80
+ index: "./lib/showcase/index.js",
81
+ },
82
+ plugins: [
83
+ new CleanWebpackPlugin(),
84
+ new DefinePlugin({
85
+ PRODUCTION: !devMode,
86
+ VERSION: JSON.stringify(require("./package.json").version),
87
+ TARGET: JSON.stringify(target),
88
+ }),
89
+ new CopyWebpackPlugin({
90
+ patterns: [
91
+ { from: "lib/showcase/locales/", to: "locales/" }
92
+ ],
93
+ }),
94
+ new HtmlWebpackPlugin({
95
+ title: "Componark",
96
+ template: "./lib/showcase/index.html",
97
+ }),
98
+ ],
99
+ }
100
+
101
+ if (devMode) {
102
+ rootConfig.devServer = {
103
+ static: [
104
+ path.join(__dirname, "dist"),
105
+ path.join(__dirname, "dist/ark"),
106
+ ],
107
+ historyApiFallback: {
108
+ rewrites: [
109
+ { from: /^\/$/, to: "/index.html" },
110
+ { from: /^\/ark/, to: "/ark/index.html" },
111
+ ],
112
+ },
113
+ port: 7890,
114
+ }
115
+ }
116
+
117
+ return [rootConfig, arkConfig]
118
+ }