@cocreate/api 1.10.31 → 1.12.0
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/CHANGELOG.md +24 -0
- package/CoCreate.config.js +2 -2
- package/demo/index.html +1 -1
- package/docs/form.html +16 -16
- package/docs/index.html +20 -20
- package/docs/module.html +14 -14
- package/docs/server.html +16 -16
- package/package.json +8 -8
- package/src/client.js +183 -181
- package/src/server.js +15 -12
- package/webpack.config.js +79 -73
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# [1.12.0](https://github.com/CoCreate-app/CoCreate-api/compare/v1.11.0...v1.12.0) (2023-08-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* bump cocreate dependencies for the latest updates and features ([e7ad0fb](https://github.com/CoCreate-app/CoCreate-api/commit/e7ad0fbceff3a97079f395fe417062e1ba2b2b00))
|
|
7
|
+
|
|
8
|
+
# [1.11.0](https://github.com/CoCreate-app/CoCreate-api/compare/v1.10.31...v1.11.0) (2023-08-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* crud attributes renamed ([739fd2e](https://github.com/CoCreate-app/CoCreate-api/commit/739fd2ec4db058f064561373395adeaf5da2265e))
|
|
14
|
+
* render-array and render-object attributes renamed to render ([558b8cd](https://github.com/CoCreate-app/CoCreate-api/commit/558b8cd0b3ca4c648ea39dbea9de4bf37ea5adeb))
|
|
15
|
+
* replace -target -selector ([8daf241](https://github.com/CoCreate-app/CoCreate-api/commit/8daf24163608a51eb0daad64fc4f430a56e14be9))
|
|
16
|
+
* updated actions callback data object ([8034616](https://github.com/CoCreate-app/CoCreate-api/commit/803461695887e239074761ecf52a5240313699fa))
|
|
17
|
+
* webpack.config and package.json make use of mode=production instead of process.env ([af618e8](https://github.com/CoCreate-app/CoCreate-api/commit/af618e8b4c9f2369f91f7486d94ab7f974ede83f))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* name attribute and variable renamed to key ([9e8016d](https://github.com/CoCreate-app/CoCreate-api/commit/9e8016d583d02fb9a0e0dfa0b8c1e153e56b0981))
|
|
23
|
+
* update template_id to render-selector attribute. update filter attributes to filter selector-attributes ([d22a5be](https://github.com/CoCreate-app/CoCreate-api/commit/d22a5beb7e6afe50c41f4dccde6a92000366d219))
|
|
24
|
+
|
|
1
25
|
## [1.10.31](https://github.com/CoCreate-app/CoCreate-api/compare/v1.10.30...v1.10.31) (2023-06-14)
|
|
2
26
|
|
|
3
27
|
|
package/CoCreate.config.js
CHANGED
package/demo/index.html
CHANGED
package/docs/form.html
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
<!-- CoCreate CSS -->
|
|
15
15
|
<!-- CoCreate CSS -->
|
|
16
16
|
<link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
|
|
17
|
-
<link rel="stylesheet" href="/docs/index.css"
|
|
17
|
+
<link rel="stylesheet" href="/docs/index.css" array="files" object="60888216117c640e7596303f" key="src" type="text/css" save="true" />
|
|
18
18
|
<link rel="manifest" href="/manifest.webmanifest" />
|
|
19
19
|
</head>
|
|
20
20
|
|
|
21
21
|
<body>
|
|
22
|
-
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10"
|
|
22
|
+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" array="files" object="60395ef42b3ac232657040fd" key="src">
|
|
23
23
|
</nav>
|
|
24
|
-
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-
|
|
25
|
-
<menu
|
|
24
|
+
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-selector="[content_id='content']" resize-property="margin-left" resize-value="width">
|
|
25
|
+
<menu array="files" object="603717b07de7fb350ae9fec8" key="src"></menu>
|
|
26
26
|
<div resize="right"></div>
|
|
27
27
|
</sidenav>
|
|
28
28
|
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="CoCreate-api-form">
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
<div class="display:flex align-items:center font-size:20px position:absolute right:0 padding:5px background:white">
|
|
34
34
|
<div class="display:flex align-items:center transition:0.3s padding-left:10px" share-network="true" share-text="An api helper component in vanilla javascript to setup thirdparty api intergrations. Apis can be accessible using HTML5 attributes and/or JavaScript API"
|
|
35
|
-
share-title="CoCreate API form" share-height="600" share-width="700" share-media="https://cdn.cocreate.app/docs/api.png" hover="display:block!important" hover-
|
|
35
|
+
share-title="CoCreate API form" share-height="600" share-width="700" share-media="https://cdn.cocreate.app/docs/api.png" hover="display:block!important" hover-selector=".social-networks">
|
|
36
36
|
<div class="display:none social-networks">
|
|
37
37
|
<a class="margin-right:15px" share-network="twitter" title="Share on twitter"><i class="height:20px fill:#505050" src="/assets/svg/twitter.svg"></i></a>
|
|
38
38
|
<a class="margin-right:15px" share-network="facebook" title="Share on Facebook"><i class="height:20px fill:#505050" src="/assets/svg/facebook.svg"></i></a>
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
<div class="flex-grow:1 width:400px width:300px@xs padding:0px_10px margin-top:60px">
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
<div id="api-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
53
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
52
|
+
<div id="api-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-install-section">
|
|
53
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-install']">
|
|
54
54
|
<h2 class="padding:5px_0px">Install</h2>
|
|
55
55
|
<a class="margin-left:10px display:none" href="#api-install"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
56
56
|
</span>
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
<pre><code class="language-html"><script>https://cdn.cocreate.app/api/latest/CoCreate-api.min.js</script></code></pre>
|
|
64
64
|
|
|
65
65
|
<div>
|
|
66
|
-
<h2 id="api-server-run" hover="display:block" hover-
|
|
66
|
+
<h2 id="api-server-run" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey padding:5px_0px">Server run</h2>
|
|
67
67
|
<a class="display:none" href="#api-server-run"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
68
68
|
</div>
|
|
69
69
|
<pre><code class="language-javascript">npm run start</code></pre>
|
|
70
70
|
|
|
71
71
|
<div>
|
|
72
|
-
<h2 id="api-dependencies" hover="display:block" hover-
|
|
72
|
+
<h2 id="api-dependencies" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">Dependencies components</h2>
|
|
73
73
|
<a class="display:none" href="#api-dependencies"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
74
74
|
</div>
|
|
75
75
|
<p class="padding:10px_0px line-height:1.5">
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
<div>
|
|
82
|
-
<h2 id="api-development" hover="display:block" hover-
|
|
82
|
+
<h2 id="api-development" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">Development Guide</h2>
|
|
83
83
|
<a class="display:none" href="#api-development"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
84
84
|
</div>
|
|
85
85
|
|
|
@@ -170,8 +170,8 @@
|
|
|
170
170
|
<div class="flex-grow:1 width:300px padding:0px_10px margin-top:60px border-bottom:1px_solid_lightgrey">
|
|
171
171
|
|
|
172
172
|
<!-- SandBox -->
|
|
173
|
-
<div id="api-demo" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
174
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
173
|
+
<div id="api-demo" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-demo-section">
|
|
174
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-demo']">
|
|
175
175
|
<h2 class="padding:5px_0px">Demo</h2>
|
|
176
176
|
<a class="margin-left:10px display:none" href="#api-demo"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
177
177
|
</span>
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
<div class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px" id="playground">
|
|
183
183
|
|
|
184
184
|
<div id="demo-code" resizable class="position:relative height:50%">
|
|
185
|
-
<textarea type="code" lang="html"
|
|
185
|
+
<textarea type="code" lang="html" array="demos" object="" key="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
|
|
186
186
|
<div resize="bottom" class="background:lightgrey"></div>
|
|
187
187
|
</div>
|
|
188
188
|
|
|
@@ -191,11 +191,11 @@
|
|
|
191
191
|
</div>
|
|
192
192
|
|
|
193
193
|
<div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
|
194
|
-
<a class="margin-right:10px" id="eye" show="#eye-slash" hide="#eye, #demo-preview" toggle="code-height" toggle-
|
|
195
|
-
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" toggle="code-height" toggle-
|
|
194
|
+
<a class="margin-right:10px" id="eye" show="#eye-slash" hide="#eye, #demo-preview" toggle="code-height" toggle-selector="#demo-code"><i class="height:18px fill:#505050" src="/assets/svg/eye.svg"></i></a>
|
|
195
|
+
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" toggle="code-height" toggle-selector="#demo-code"><i class="height:20px fill:#505050" src="/assets/svg/eye-slash.svg"></i></a>
|
|
196
196
|
<a class="margin-right:10px" id="code" show="#code-slash" hide="#code, #demo-code"><i class="height:20px fill:#505050" src="/assets/svg/code.svg"></i></a>
|
|
197
197
|
<a class="margin-right:10px" hidden id="code-slash" show="#code, #demo-code" hide="#code-slash"><i class="display:flex height:18px fill:#505050" src="/assets/svg/code.svg"></i></a>
|
|
198
|
-
<a class="margin-right:5px" fullscreen fullscreen-
|
|
198
|
+
<a class="margin-right:5px" fullscreen fullscreen-selector="#playground"></a>
|
|
199
199
|
</div>
|
|
200
200
|
|
|
201
201
|
</div>
|
package/docs/index.html
CHANGED
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
<!-- CoCreate CSS -->
|
|
16
16
|
<link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
|
|
17
|
-
<link rel="stylesheet" href="/docs/index.css"
|
|
17
|
+
<link rel="stylesheet" href="/docs/index.css" array="files" object="60888216117c640e7596303f" key="src" type="text/css" save="true" />
|
|
18
18
|
|
|
19
19
|
<link rel="manifest" href="/manifest.webmanifest" />
|
|
20
20
|
</head>
|
|
21
21
|
|
|
22
22
|
<body>
|
|
23
|
-
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10"
|
|
24
|
-
|
|
23
|
+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" array="files" object="60395ef42b3ac232657040fd"
|
|
24
|
+
key="src">
|
|
25
25
|
</nav>
|
|
26
|
-
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-
|
|
27
|
-
<menu
|
|
26
|
+
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-selector="[content_id='content']" resize-property="margin-left" resize-value="width">
|
|
27
|
+
<menu array="files" object="603717b07de7fb350ae9fec8" key="src"></menu>
|
|
28
28
|
<div resize="right"></div>
|
|
29
29
|
</sidenav>
|
|
30
30
|
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="CoCreate-api">
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</div>
|
|
35
35
|
<div class="display:flex align-items:center font-size:20px position:absolute right:0 padding:5px background:white">
|
|
36
36
|
<div class="display:flex align-items:center transition:0.3s padding-left:10px" share-network="true" share-text="Enter decription here" share-title="testing im a title" share-height="600" share-width="700" share-media="https://cdn.cocreate.app/docs/api.png"
|
|
37
|
-
hover="display:block!important" hover-
|
|
37
|
+
hover="display:block!important" hover-selector=".social-networks">
|
|
38
38
|
<div class="display:none social-networks">
|
|
39
39
|
<a class="margin-right:15px" share-network="twitter" title="Share on twitter"><i class="height:20px fill:#505050" src="/assets/svg/twitter.svg"></i></a>
|
|
40
40
|
<a class="margin-right:15px" share-network="facebook" title="Share on Facebook"><i class="height:20px fill:#505050" src="/assets/svg/facebook.svg"></i></a>
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
<div id="api-section" class="display:flex flex-wrap:wrap">
|
|
51
51
|
<div class="flex-grow:1 width:400px width:300px@xs padding:0px_10px margin-top:60px">
|
|
52
52
|
|
|
53
|
-
<div id="api-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
54
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
53
|
+
<div id="api-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-install-section">
|
|
54
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-install']">
|
|
55
55
|
<h2 class="padding:5px_0px">Install</h2>
|
|
56
56
|
<a class="margin-left:10px display:none" href="#api-install"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
57
57
|
</span>
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<pre><code class="language-html"><script>https://cdn.cocreate.app/api/latest/CoCreate-api.min.js</script></code></pre>
|
|
63
63
|
|
|
64
64
|
<div>
|
|
65
|
-
<h2 id="api-dependencies" hover="display:block" hover-
|
|
65
|
+
<h2 id="api-dependencies" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">Dependencies components</h2>
|
|
66
66
|
<a class="display:none" href="#api-dependencies"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
67
67
|
</div>
|
|
68
68
|
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
</p>
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
<div id="api-usage" class="margin-top:80px border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
77
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
76
|
+
<div id="api-usage" class="margin-top:80px border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-usage-section">
|
|
77
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-usage']">
|
|
78
78
|
<h2 class="padding:5px_0px">Usage</h2>
|
|
79
79
|
<a class="margin-left:10px display:none" href="#api-usage"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
80
80
|
</span>
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
<pre><code class="language-html"><script>https://cdn.cocreate.app/api/latest/CoCreate-api.min.js</script></code></pre>
|
|
89
89
|
|
|
90
90
|
<div>
|
|
91
|
-
<h2 id="api-server-run" hover="display:block" hover-
|
|
91
|
+
<h2 id="api-server-run" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey padding:5px_0px">Server run</h2>
|
|
92
92
|
<a class="display:none" href="#api-server-run"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
93
93
|
</div>
|
|
94
94
|
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
</p>
|
|
111
111
|
|
|
112
112
|
<div>
|
|
113
|
-
<h2 id="api-functions" hover="display:block" hover-
|
|
113
|
+
<h2 id="api-functions" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey padding:5px_0px">CoCreate-api functions</h2>
|
|
114
114
|
<a class="display:none" href="#api-functions"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
115
115
|
</div>
|
|
116
116
|
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
<h2 class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">How Does It Works</h2>
|
|
186
186
|
<p>CoCreate-fetch works based on cocreate.js and template. </p>
|
|
187
187
|
|
|
188
|
-
<p>To fetch the array data, the template wrapper should define <code class="language-js">
|
|
188
|
+
<p>To fetch the array data, the template wrapper should define <code class="language-js">document</code>. <code class="language-js">template_id</code></p>
|
|
189
189
|
|
|
190
190
|
<h2 class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">Effects and Styles</h2>
|
|
191
191
|
|
|
@@ -197,8 +197,8 @@
|
|
|
197
197
|
<div class="flex-grow:1 width:300px padding:0px_10px margin-top:60px border-bottom:1px_solid_lightgrey">
|
|
198
198
|
|
|
199
199
|
<!-- SandBox -->
|
|
200
|
-
<div id="api-demo" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
201
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
200
|
+
<div id="api-demo" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-demo-section">
|
|
201
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-demo']">
|
|
202
202
|
<h2 class="padding:5px_0px">Demo</h2>
|
|
203
203
|
<a class="margin-left:10px display:none" href="#api-demo"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
204
204
|
</span>
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
<div class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px" id="playground">
|
|
209
209
|
|
|
210
210
|
<div id="demo-code" resizable class="position:relative height:50%">
|
|
211
|
-
<textarea type="code" lang="html"
|
|
211
|
+
<textarea type="code" lang="html" array="demos" object="" key="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
|
|
212
212
|
<div resize="bottom" class="background:lightgrey"></div>
|
|
213
213
|
</div>
|
|
214
214
|
|
|
@@ -217,11 +217,11 @@
|
|
|
217
217
|
</div>
|
|
218
218
|
|
|
219
219
|
<div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
|
220
|
-
<a class="margin-right:10px" id="eye" show="#eye-slash" hide="#eye, #demo-preview" toggle="code-height" toggle-
|
|
221
|
-
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" toggle="code-height" toggle-
|
|
220
|
+
<a class="margin-right:10px" id="eye" show="#eye-slash" hide="#eye, #demo-preview" toggle="code-height" toggle-selector="#demo-code"><i class="height:18px fill:#505050" src="/assets/svg/eye.svg"></i></a>
|
|
221
|
+
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" toggle="code-height" toggle-selector="#demo-code"><i class="height:20px fill:#505050" src="/assets/svg/eye-slash.svg"></i></a>
|
|
222
222
|
<a class="margin-right:10px" id="code" show="#code-slash" hide="#code, #demo-code"><i class="height:20px fill:#505050" src="/assets/svg/code.svg"></i></a>
|
|
223
223
|
<a class="margin-right:10px" hidden id="code-slash" show="#code, #demo-code" hide="#code-slash"><i class="display:flex height:18px fill:#505050" src="/assets/svg/code.svg"></i></a>
|
|
224
|
-
<a class="margin-right:5px" fullscreen fullscreen-
|
|
224
|
+
<a class="margin-right:5px" fullscreen fullscreen-selector="#playground"></a>
|
|
225
225
|
</div>
|
|
226
226
|
|
|
227
227
|
</div>
|
package/docs/module.html
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
<!-- CoCreate CSS -->
|
|
16
16
|
<link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
|
|
17
|
-
<link rel="stylesheet" href="/docs/index.css"
|
|
17
|
+
<link rel="stylesheet" href="/docs/index.css" array="files" object="60888216117c640e7596303f" key="src" type="text/css" save="true" />
|
|
18
18
|
<link rel="manifest" href="/manifest.webmanifest">
|
|
19
19
|
</head>
|
|
20
20
|
|
|
21
21
|
<body>
|
|
22
|
-
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10"
|
|
22
|
+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" array="files" object="60395ef42b3ac232657040fd" key="src">
|
|
23
23
|
</nav>
|
|
24
|
-
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-
|
|
25
|
-
<menu
|
|
24
|
+
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-selector="[content_id='content']" resize-property="margin-left" resize-value="width">
|
|
25
|
+
<menu array="files" object="603717b07de7fb350ae9fec8" key="src"></menu>
|
|
26
26
|
<div resize="right"></div>
|
|
27
27
|
</sidenav>
|
|
28
28
|
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="CoCreate-api-module">
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
<div id="api-section" class="display:flex flex-wrap:wrap">
|
|
39
39
|
<div class="flex-grow:1 width:400px width:300px@xs padding:0px_10px margin-top:60px">
|
|
40
40
|
|
|
41
|
-
<div id="api-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
42
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
41
|
+
<div id="api-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-install-section">
|
|
42
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-install']">
|
|
43
43
|
<h2 class="padding:5px_0px">Install</h2>
|
|
44
44
|
<a class="margin-left:10px display:none" href="#api-install"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
45
45
|
</span>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<pre><code class="language-html"><script>https://cdn.cocreate.app/api/latest/CoCreate-api.min.js</script></code></pre>
|
|
53
53
|
|
|
54
54
|
<div>
|
|
55
|
-
<h2 id="api-dependencies" hover="display:block" hover-
|
|
55
|
+
<h2 id="api-dependencies" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">Dependencies components</h2>
|
|
56
56
|
<a class="display:none" href="#api-dependencies"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
57
57
|
</div>
|
|
58
58
|
<p class="padding:10px_0px line-height:1.5">
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
<div>
|
|
65
|
-
<h2 id="api-development" hover="display:block" hover-
|
|
65
|
+
<h2 id="api-development" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">Development Guide</h2>
|
|
66
66
|
<a class="display:none" href="#api-development"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
67
67
|
</div>
|
|
68
68
|
|
|
@@ -159,8 +159,8 @@
|
|
|
159
159
|
<div class="flex-grow:1 width:300px padding:0px_10px margin-top:60px border-bottom:1px_solid_lightgrey">
|
|
160
160
|
|
|
161
161
|
<!-- SandBox -->
|
|
162
|
-
<div id="api-demo" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
163
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
162
|
+
<div id="api-demo" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-demo-section">
|
|
163
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-demo']">
|
|
164
164
|
<h2 class="padding:5px_0px">Demo</h2>
|
|
165
165
|
<a class="margin-left:10px display:none" href="#api-demo"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
166
166
|
</span>
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
<div class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px" id="playground">
|
|
173
173
|
|
|
174
174
|
<div id="demo-code" resizable class="position:relative height:50%">
|
|
175
|
-
<textarea type="code" lang="html"
|
|
175
|
+
<textarea type="code" lang="html" array="demos" object="" key="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
|
|
176
176
|
<div resize="bottom" class="background:lightgrey"></div>
|
|
177
177
|
</div>
|
|
178
178
|
|
|
@@ -181,11 +181,11 @@
|
|
|
181
181
|
</div>
|
|
182
182
|
|
|
183
183
|
<div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
|
184
|
-
<a class="margin-right:10px" id="eye" show="#eye-slash" hide="#eye, #demo-preview" toggle="code-height" toggle-
|
|
185
|
-
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" toggle="code-height" toggle-
|
|
184
|
+
<a class="margin-right:10px" id="eye" show="#eye-slash" hide="#eye, #demo-preview" toggle="code-height" toggle-selector="#demo-code"><i class="height:18px fill:#505050" src="/assets/svg/eye.svg"></i></a>
|
|
185
|
+
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" toggle="code-height" toggle-selector="#demo-code"><i class="height:20px fill:#505050" src="/assets/svg/eye-slash.svg"></i></a>
|
|
186
186
|
<a class="margin-right:10px" id="code" show="#code-slash" hide="#code, #demo-code"><i class="height:20px fill:#505050" src="/assets/svg/code.svg"></i></a>
|
|
187
187
|
<a class="margin-right:10px" hidden id="code-slash" show="#code, #demo-code" hide="#code-slash"><i class="display:flex height:18px fill:#505050" src="/assets/svg/code.svg"></i></a>
|
|
188
|
-
<a class="margin-right:5px" fullscreen fullscreen-
|
|
188
|
+
<a class="margin-right:5px" fullscreen fullscreen-selector="#playground"></a>
|
|
189
189
|
</div>
|
|
190
190
|
|
|
191
191
|
</div>
|
package/docs/server.html
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
<!-- CoCreate CSS -->
|
|
16
16
|
<link rel="stylesheet" href="https://cdn.cocreate.app/latest/CoCreate.min.css" type="text/css" />
|
|
17
|
-
<link rel="stylesheet" href="/docs/index.css"
|
|
17
|
+
<link rel="stylesheet" href="/docs/index.css" array="files" object="60888216117c640e7596303f" key="src" type="text/css" save="true" />
|
|
18
18
|
<link rel="manifest" href="/manifest.webmanifest">
|
|
19
19
|
</head>
|
|
20
20
|
|
|
21
21
|
<body>
|
|
22
|
-
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10"
|
|
22
|
+
<nav class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px" content_id="content" scroll="sticky-nav,hide-nav" scroll-up="10" scroll-down="10" array="files" object="60395ef42b3ac232657040fd" key="src">
|
|
23
23
|
</nav>
|
|
24
|
-
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-
|
|
25
|
-
<menu
|
|
24
|
+
<sidenav id="menuL" class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl" resizable resize-selector="[content_id='content']" resize-property="margin-left" resize-value="width">
|
|
25
|
+
<menu array="files" object="603717b07de7fb350ae9fec8" key="src"></menu>
|
|
26
26
|
<div resize="right"></div>
|
|
27
27
|
</sidenav>
|
|
28
28
|
<main class="padding-top:15px padding:15px@lg@xl" content_id="content" id="CoCreate-api-server">
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
<div class="display:flex align-items:center font-size:20px position:absolute right:0 padding:5px background:white">
|
|
34
34
|
<div class="display:flex align-items:center transition:0.3s padding-left:10px" share-network="true" share-text="An api helper component in vanilla javascript to setup thirdparty api intergrations. Apis can be accessible using HTML5 attributes and/or JavaScript API"
|
|
35
|
-
share-title="CoCreate API server" share-height="600" share-width="700" share-media="https://cdn.cocreate.app/docs/api.png" hover="display:block!important" hover-
|
|
35
|
+
share-title="CoCreate API server" share-height="600" share-width="700" share-media="https://cdn.cocreate.app/docs/api.png" hover="display:block!important" hover-selector=".social-networks">
|
|
36
36
|
<div class="display:none social-networks">
|
|
37
37
|
<a class="margin-right:15px" share-network="twitter" title="Share on twitter"><i class="height:20px fill:#505050" src="/assets/svg/twitter.svg"></i></a>
|
|
38
38
|
<a class="margin-right:15px" share-network="facebook" title="Share on Facebook"><i class="height:20px fill:#505050" src="/assets/svg/facebook.svg"></i></a>
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
client component and server side for api processing.</h1>
|
|
48
48
|
<div id="api-section" class="display:flex flex-wrap:wrap">
|
|
49
49
|
<div class="flex-grow:1 width:400px width:300px@xs padding:0px_10px margin-top:60px">
|
|
50
|
-
<div id="api-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
51
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
50
|
+
<div id="api-install" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-install-section">
|
|
51
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-install']">
|
|
52
52
|
<h2 class="padding:5px_0px">Install</h2>
|
|
53
53
|
<a class="margin-left:10px display:none" href="#api-install"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
54
54
|
</span>
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
<pre><code class="language-html"><script>https://cdn.cocreate.app/api/latest/CoCreate-api.min.js</script></code></pre>
|
|
61
61
|
|
|
62
62
|
<div>
|
|
63
|
-
<h2 id="api-server-run" hover="display:block" hover-
|
|
63
|
+
<h2 id="api-server-run" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey padding:5px_0px">Server run</h2>
|
|
64
64
|
<a class="display:none" href="#api-server-run"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
65
65
|
</div>
|
|
66
66
|
<pre><code class="language-javascript">npm run start</code></pre>
|
|
67
67
|
|
|
68
68
|
<div>
|
|
69
|
-
<h2 id="api-dependencies" hover="display:block" hover-
|
|
69
|
+
<h2 id="api-dependencies" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">Dependencies components</h2>
|
|
70
70
|
<a class="display:none" href="#api-dependencies"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
71
71
|
</div>
|
|
72
72
|
<p class="padding:10px_0px line-height:1.5">
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
<div>
|
|
79
|
-
<h2 id="api-development" hover="display:block" hover-
|
|
79
|
+
<h2 id="api-development" hover="display:block" hover-selector="" class="border-bottom:1px_solid_lightgrey margin-top:80px padding:5px_0px">Development Guide</h2>
|
|
80
80
|
<a class="display:none" href="#api-development"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
81
81
|
</div>
|
|
82
82
|
|
|
@@ -171,8 +171,8 @@
|
|
|
171
171
|
<div class="flex-grow:1 width:300px padding:0px_10px margin-top:60px border-bottom:1px_solid_lightgrey">
|
|
172
172
|
|
|
173
173
|
<!-- SandBox -->
|
|
174
|
-
<div id="api-demo" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-
|
|
175
|
-
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-
|
|
174
|
+
<div id="api-demo" class="border-bottom:1px_solid_lightgrey" scroll scroll-intersect="color:dodgerblue" scroll-selector="#api-demo-section">
|
|
175
|
+
<span class="display:flex align-items:center width:fit-content" hover="display:block!important" hover-selector="[href='#api-demo']">
|
|
176
176
|
<h2 class="padding:5px_0px">Demo</h2>
|
|
177
177
|
<a class="margin-left:10px display:none" href="#api-demo"><i class="height:20px fill:#505050" src="/assets/svg/link.svg"></i></a>
|
|
178
178
|
</span>
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
<div class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px" id="playground">
|
|
184
184
|
|
|
185
185
|
<div id="demo-code" resizable class="position:relative height:50%">
|
|
186
|
-
<textarea type="code" lang="html"
|
|
186
|
+
<textarea type="code" lang="html" array="demos" object="" key="demo" save="false" id="demo" class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
|
|
187
187
|
<div resize="bottom" class="background:lightgrey"></div>
|
|
188
188
|
</div>
|
|
189
189
|
|
|
@@ -192,11 +192,11 @@
|
|
|
192
192
|
</div>
|
|
193
193
|
|
|
194
194
|
<div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
|
195
|
-
<a class="margin-right:10px" id="eye" show="#eye-slash" hide="#eye, #demo-preview" toggle="code-height" toggle-
|
|
196
|
-
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" toggle="code-height" toggle-
|
|
195
|
+
<a class="margin-right:10px" id="eye" show="#eye-slash" hide="#eye, #demo-preview" toggle="code-height" toggle-selector="#demo-code"><i class="height:18px fill:#505050" src="/assets/svg/eye.svg"></i></a>
|
|
196
|
+
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" toggle="code-height" toggle-selector="#demo-code"><i class="height:20px fill:#505050" src="/assets/svg/eye-slash.svg"></i></a>
|
|
197
197
|
<a class="margin-right:10px" id="code" show="#code-slash" hide="#code, #demo-code"><i class="height:20px fill:#505050" src="/assets/svg/code.svg"></i></a>
|
|
198
198
|
<a class="margin-right:10px" hidden id="code-slash" show="#code, #demo-code" hide="#code-slash"><i class="display:flex height:18px fill:#505050" src="/assets/svg/code.svg"></i></a>
|
|
199
|
-
<a class="margin-right:5px" fullscreen fullscreen-
|
|
199
|
+
<a class="margin-right:5px" fullscreen fullscreen-selector="#playground"></a>
|
|
200
200
|
</div>
|
|
201
201
|
|
|
202
202
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "A simple api helper component in vanilla javascript used by JavaScript developers to create thirdparty api intergrations. CoCreate-api includes the client component and server side for api processing. Thirdparty apis can be accessible using HTML5 attributes and/or JavaScript API. ",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thirdparty-api-intergration",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"start": "npx webpack --config webpack.config.js",
|
|
29
|
-
"build": "
|
|
29
|
+
"build": "npx webpack --mode=production --config webpack.config.js",
|
|
30
30
|
"dev": "npx webpack --config webpack.config.js --watch",
|
|
31
31
|
"postinstall": "node -e \"const { execSync } = require('child_process'); try { execSync('coc --version', { stdio: 'ignore' }); } catch (error) { try { execSync('npm install -g @cocreate/cli', { stdio: 'inherit' }); console.log('Installed \"@cocreate/cli\" globally.'); } catch (error) { console.error('Failed to install \"@cocreate/cli\" globally:', error); } }\""
|
|
32
32
|
},
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"webpack-log": "^3.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cocreate/actions": "^1.
|
|
63
|
-
"@cocreate/crud-client": "^1.
|
|
64
|
-
"@cocreate/element-prototype": "^1.
|
|
65
|
-
"@cocreate/render": "^1.
|
|
66
|
-
"@cocreate/socket-client": "^1.
|
|
67
|
-
"@cocreate/utils": "^1.
|
|
62
|
+
"@cocreate/actions": "^1.9.0",
|
|
63
|
+
"@cocreate/crud-client": "^1.22.0",
|
|
64
|
+
"@cocreate/element-prototype": "^1.9.0",
|
|
65
|
+
"@cocreate/render": "^1.25.0",
|
|
66
|
+
"@cocreate/socket-client": "^1.24.0",
|
|
67
|
+
"@cocreate/utils": "^1.22.0"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/client.js
CHANGED
|
@@ -1,190 +1,192 @@
|
|
|
1
1
|
/*globals CustomEvent, config*/
|
|
2
|
-
import {getAttributes, getValueFromObject, dotNotationToObject} from "@cocreate/utils";
|
|
2
|
+
import { getAttributes, getValueFromObject, dotNotationToObject } from "@cocreate/utils";
|
|
3
3
|
import observer from "@cocreate/observer";
|
|
4
4
|
import socket from "@cocreate/socket-client";
|
|
5
5
|
import action from '@cocreate/actions';
|
|
6
6
|
import render from '@cocreate/render';
|
|
7
7
|
import '@cocreate/element-prototype';
|
|
8
8
|
|
|
9
|
-
const CoCreateApi = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
9
|
+
const CoCreateApi = {
|
|
10
|
+
components: {},
|
|
11
|
+
|
|
12
|
+
init: function ({ name, endPoints, options }) {
|
|
13
|
+
this.register({ name, endPoints, options });
|
|
14
|
+
if (options.socket !== false && !socket.sockets.size)
|
|
15
|
+
socket.create({ prefix: 'api' });
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
register: function ({ name, endPoints, options }) {
|
|
19
|
+
const self = this;
|
|
20
|
+
if (typeof this.components[name] === 'undefined') {
|
|
21
|
+
this.components[name] = { name, endPoints, options };
|
|
22
|
+
|
|
23
|
+
socket.listen(name, (data) => {
|
|
24
|
+
self.__response(name, data);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
for (const endPoint of Object.keys(endPoints)) {
|
|
28
|
+
let functions = endPoints[endPoint]
|
|
29
|
+
if (typeof functions.request !== 'function') {
|
|
30
|
+
functions.request = self.__request;
|
|
31
|
+
}
|
|
32
|
+
action.init({
|
|
33
|
+
name: endPoint,
|
|
34
|
+
endEvent: endPoint,
|
|
35
|
+
callback: (data) => {
|
|
36
|
+
let params
|
|
37
|
+
const element = data.element
|
|
38
|
+
let form = element.closest('form') || document
|
|
39
|
+
const selector = `[${name}^="${endPoint}."]`
|
|
40
|
+
let el = form.querySelector(selector)
|
|
41
|
+
if (!el) return
|
|
42
|
+
params = self.parseParams({ name, element: el })
|
|
43
|
+
if (params) {
|
|
44
|
+
functions.request({ name, ...params, element, form, type: 'action' })
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const inputEvent = (element) => {
|
|
51
|
+
const self = this
|
|
52
|
+
element.addEventListener('input', (e) => {
|
|
53
|
+
if (element.hasAttribute(name)) {
|
|
54
|
+
let params = self.parseParams({ name, element })
|
|
55
|
+
if (params) {
|
|
56
|
+
if (!e.detail || e.detail && e.detail.skip != true) {
|
|
57
|
+
endPoints[params.endPoint].request({ name, ...params, element, type: 'input' })
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let elements = document.querySelectorAll(`[${name}]`)
|
|
65
|
+
for (let element of elements) {
|
|
66
|
+
let params = this.parseParams({ name, element })
|
|
67
|
+
if (params) {
|
|
68
|
+
endPoints[params.endPoint].request({ name, ...params, element, type: 'onload' })
|
|
69
|
+
inputEvent(element)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
observer.init({
|
|
74
|
+
name: `${name}NodeObserver`,
|
|
75
|
+
observe: ['addedNodes'],
|
|
76
|
+
target: `[${name}]`,
|
|
77
|
+
callback: function (mutation) {
|
|
78
|
+
let params = self.parseParams({ name, element: mutation.target })
|
|
79
|
+
if (params) {
|
|
80
|
+
endPoints[params.endPoint].request({ name, ...params, element: mutation.target, type: 'nodeObserver' });
|
|
81
|
+
inputEvent(mutation.target)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
observer.init({
|
|
87
|
+
name: `${name}AttributeObserver`,
|
|
88
|
+
observe: ['attributes'],
|
|
89
|
+
attributeName: [name],
|
|
90
|
+
callback: function (mutation) {
|
|
91
|
+
let params = self.parseParams({ name, element: mutation.target })
|
|
92
|
+
if (params) {
|
|
93
|
+
endPoints[params.endPoint].request({ name, ...params, element: mutation.target, type: 'attributeObserver' });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
__request: function ({ name, endPoint, element }) {
|
|
101
|
+
let form = element.closest('form');
|
|
102
|
+
let data = this.getData({ name, endPoint, form });
|
|
103
|
+
this.send(name, endPoint, data[endPoint]);
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
__response: function (name, data) {
|
|
107
|
+
const { endPoint, response } = data;
|
|
108
|
+
const component = this.components[name];
|
|
109
|
+
const functions = component.endPoints[endPoint]
|
|
110
|
+
if (functions.listen !== false) {
|
|
111
|
+
if (typeof functions.response === 'function') {
|
|
112
|
+
functions.response(response);
|
|
113
|
+
} else
|
|
114
|
+
this.setData({ name, endPoint, data })
|
|
115
|
+
|
|
116
|
+
document.dispatchEvent(new CustomEvent(endPoint, {
|
|
117
|
+
detail: {
|
|
118
|
+
data: response
|
|
119
|
+
}
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
send: function (name, endPoint, data) {
|
|
125
|
+
let method = name + '.' + endPoint
|
|
126
|
+
socket.send({ method, endPoint, data, broadcastBrowser: false });
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
parseParams: function ({ name, endPoint, element }) {
|
|
130
|
+
let attribute = element.getAttribute(name)
|
|
131
|
+
if (!attribute)
|
|
132
|
+
return false
|
|
133
|
+
|
|
134
|
+
let dotNotation = attribute
|
|
135
|
+
let params = attribute.split('.')
|
|
136
|
+
endPoint = params[0]
|
|
137
|
+
let key = params[1]
|
|
138
|
+
return { endPoint, key, dotNotation, params }
|
|
139
|
+
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
getData: function ({ name, endPoint, element, form }) {
|
|
144
|
+
const data = {}
|
|
145
|
+
const selector = `[${name}^="${endPoint}."]`
|
|
146
|
+
let elements
|
|
147
|
+
if (form)
|
|
148
|
+
elements = form.querySelectorAll(selector);
|
|
149
|
+
if (!elements || elements.length == 0)
|
|
150
|
+
elements = [element]
|
|
151
|
+
for (let el of elements) {
|
|
152
|
+
if (!el || el.closest('[template]')) continue
|
|
153
|
+
let attribute = el.getAttribute(name)
|
|
154
|
+
if (attribute)
|
|
155
|
+
data[attribute] = el.getValue()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return dotNotationToObject(data);
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
setData: function ({ name, endPoint, data, form }) {
|
|
162
|
+
const selector = `[${name}^="${endPoint}."]`
|
|
163
|
+
if (!form)
|
|
164
|
+
form = document;
|
|
165
|
+
let elements = form.querySelectorAll(selector);
|
|
166
|
+
if (!elements || elements.length == 0) return
|
|
167
|
+
|
|
168
|
+
for (let el of elements) {
|
|
169
|
+
let attribute = el.getAttribute(name)
|
|
170
|
+
if (attribute) {
|
|
171
|
+
if (el.hasAttribute('actions')) continue;
|
|
172
|
+
let templateid = el.getAttribute('template_id')
|
|
173
|
+
if (templateid) {
|
|
174
|
+
let items = document.querySelectorAll(`[templateid="${templateid}"]`)
|
|
175
|
+
for (let item of items)
|
|
176
|
+
item.remove()
|
|
177
|
+
render.data({
|
|
178
|
+
selector: `[template="${templateid}"]`,
|
|
179
|
+
data
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
let value = getValueFromObject(data, attribute);
|
|
183
|
+
el.setValue(value);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
188
190
|
};
|
|
189
|
-
|
|
191
|
+
|
|
190
192
|
export default CoCreateApi;
|
package/src/server.js
CHANGED
|
@@ -26,22 +26,23 @@ var api = (() => {
|
|
|
26
26
|
host: config["host"]
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
let org = await crud.
|
|
30
|
-
|
|
29
|
+
let org = await crud.send({
|
|
30
|
+
method: 'read.object',
|
|
31
|
+
array: "organizations",
|
|
31
32
|
key: config["key"],
|
|
32
33
|
organization_id: config["organization_id"],
|
|
33
|
-
|
|
34
|
+
object: {
|
|
34
35
|
_id: config["organization_id"]
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
});
|
|
38
39
|
|
|
39
|
-
if (!org || !org.
|
|
40
|
+
if (!org || !org.object && !org.object[0]) {
|
|
40
41
|
console.log(component, " Error GET ORG in : ", e);
|
|
41
42
|
return false;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
return org.
|
|
45
|
+
return org.object[0];
|
|
45
46
|
},
|
|
46
47
|
|
|
47
48
|
getOrgInRoutesbyHostname: async (config, hostname) => {
|
|
@@ -60,11 +61,12 @@ var api = (() => {
|
|
|
60
61
|
host: socket_config.host
|
|
61
62
|
})
|
|
62
63
|
|
|
63
|
-
let data2 = await crud.
|
|
64
|
-
|
|
64
|
+
let data2 = await crud.send({
|
|
65
|
+
method: 'read.object',
|
|
66
|
+
array: "organizations",
|
|
65
67
|
filter: {
|
|
66
68
|
query: [{
|
|
67
|
-
|
|
69
|
+
key: 'host',
|
|
68
70
|
operator: "$in",
|
|
69
71
|
value: [hostname]
|
|
70
72
|
}],
|
|
@@ -73,7 +75,7 @@ var api = (() => {
|
|
|
73
75
|
organization_id: config["config"]["organization_id"]
|
|
74
76
|
});
|
|
75
77
|
|
|
76
|
-
var org = data2.
|
|
78
|
+
var org = data2.object[0]
|
|
77
79
|
|
|
78
80
|
var socket_config = {
|
|
79
81
|
"config": {
|
|
@@ -91,11 +93,12 @@ var api = (() => {
|
|
|
91
93
|
host: socket_config.host
|
|
92
94
|
})
|
|
93
95
|
|
|
94
|
-
let myOrg = await crud.
|
|
95
|
-
|
|
96
|
+
let myOrg = await crud.send({
|
|
97
|
+
method: 'read.object',
|
|
98
|
+
array: "organizations",
|
|
96
99
|
key: org["key"],
|
|
97
100
|
organization_id: org["_id"],
|
|
98
|
-
|
|
101
|
+
object: {
|
|
99
102
|
_id: org["_id"]
|
|
100
103
|
}
|
|
101
104
|
});
|
package/webpack.config.js
CHANGED
|
@@ -1,84 +1,90 @@
|
|
|
1
1
|
const path = require("path")
|
|
2
2
|
const TerserPlugin = require("terser-webpack-plugin")
|
|
3
3
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
|
4
|
-
let isProduction = process.env.NODE_ENV === "production"
|
|
5
4
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
|
|
6
5
|
|
|
7
|
-
module.exports = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
output: {
|
|
12
|
-
path: path.resolve(__dirname, "dist"),
|
|
13
|
-
filename: isProduction ? "[name].min.js" : "[name].js",
|
|
14
|
-
libraryTarget: "umd",
|
|
15
|
-
libraryExport: "default",
|
|
16
|
-
library: ["CoCreate", "api"],
|
|
17
|
-
globalObject: "this",
|
|
18
|
-
},
|
|
6
|
+
module.exports = (env, argv) => {
|
|
7
|
+
let isProduction = false
|
|
8
|
+
if (argv.mode === 'production')
|
|
9
|
+
isProduction = true
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
filename: "[name].css",
|
|
24
|
-
}),
|
|
25
|
-
],
|
|
26
|
-
// Default mode for Webpack is production.
|
|
27
|
-
// Depending on mode Webpack will apply different things
|
|
28
|
-
// on final bundle. For now we don't need production's JavaScript
|
|
29
|
-
// minifying and other thing so let's set mode to development
|
|
30
|
-
mode: isProduction ? "production" : "development",
|
|
31
|
-
module: {
|
|
32
|
-
rules: [
|
|
33
|
-
{
|
|
34
|
-
test: /.js$/,
|
|
35
|
-
exclude: /(node_modules)/,
|
|
36
|
-
use: {
|
|
37
|
-
loader: "babel-loader",
|
|
38
|
-
options: {
|
|
39
|
-
plugins: ["@babel/plugin-transform-modules-commonjs"],
|
|
40
|
-
},
|
|
11
|
+
const config = {
|
|
12
|
+
entry: {
|
|
13
|
+
"CoCreate-api": "./src/index.js",
|
|
41
14
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
15
|
+
output: {
|
|
16
|
+
path: path.resolve(__dirname, "dist"),
|
|
17
|
+
filename: isProduction ? "[name].min.js" : "[name].js",
|
|
18
|
+
libraryTarget: "umd",
|
|
19
|
+
libraryExport: "default",
|
|
20
|
+
library: ["CoCreate", "api"],
|
|
21
|
+
globalObject: "this",
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
plugins: [
|
|
25
|
+
new CleanWebpackPlugin(),
|
|
26
|
+
new MiniCssExtractPlugin({
|
|
27
|
+
filename: "[name].css",
|
|
28
|
+
}),
|
|
48
29
|
],
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
30
|
+
// Default mode for Webpack is production.
|
|
31
|
+
// Depending on mode Webpack will apply different things
|
|
32
|
+
// on final bundle. For now we don't need production's JavaScript
|
|
33
|
+
// minifying and other thing so let's set mode to development
|
|
34
|
+
mode: isProduction ? "production" : "development",
|
|
35
|
+
module: {
|
|
36
|
+
rules: [
|
|
37
|
+
{
|
|
38
|
+
test: /.js$/,
|
|
39
|
+
exclude: /(node_modules)/,
|
|
40
|
+
use: {
|
|
41
|
+
loader: "babel-loader",
|
|
42
|
+
options: {
|
|
43
|
+
plugins: ["@babel/plugin-transform-modules-commonjs"],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
test: /.css$/i,
|
|
49
|
+
use: [
|
|
50
|
+
{ loader: "style-loader", options: { injectType: "linkTag" } },
|
|
51
|
+
"file-loader",
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
// add source map
|
|
58
|
+
...(isProduction ? {} : { devtool: "eval-source-map" }),
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
optimization: {
|
|
61
|
+
minimize: true,
|
|
62
|
+
minimizer: [
|
|
63
|
+
new TerserPlugin({
|
|
64
|
+
extractComments: true,
|
|
65
|
+
// cache: true,
|
|
66
|
+
parallel: true,
|
|
67
|
+
// sourceMap: true, // Must be set to true if using source-maps in production
|
|
68
|
+
terserOptions: {
|
|
69
|
+
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
|
|
70
|
+
// extractComments: 'all',
|
|
71
|
+
compress: {
|
|
72
|
+
drop_console: true,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
],
|
|
77
|
+
splitChunks: {
|
|
78
|
+
chunks: "all",
|
|
79
|
+
minSize: 200,
|
|
80
|
+
// maxSize: 99999,
|
|
81
|
+
//minChunks: 1,
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
83
|
+
cacheGroups: {
|
|
84
|
+
defaultVendors: false,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
return config
|
|
90
|
+
}
|