@cocreate/render 1.51.0 → 2.0.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/.github/FUNDING.yml +1 -1
- package/.github/workflows/automated.yml +18 -7
- package/CHANGELOG.md +691 -652
- package/CONTRIBUTING.md +6 -6
- package/README.md +48 -18
- package/demo/fetch.string.html +2 -2
- package/demo/index.html +1 -1
- package/demo/render.array.html +1 -1
- package/demo/render.html +1 -1
- package/demo/render.object.html +1 -1
- package/demo/renderKey.html +1 -1
- package/docs/index.html +7 -7
- package/package.json +20 -26
- package/src/client/index.css +2 -0
- package/src/{index.js → client/index.js} +597 -321
- package/src/client/package.json +3 -0
- package/src/server/index.js +801 -0
- package/src/server/package.json +3 -0
- package/test/client/render-order.test.cjs +90 -0
- package/test/client/render-value-ast.test.cjs +58 -0
- package/test/server/deferred-file.test.js +14 -0
- package/test/server/file-access.test.js +9 -0
- package/test/server/package.json +3 -0
- package/test/server/stylesheet-links.test.js +103 -0
- package/test/server/theme.test.js +21 -0
- package/test/server/value-transformations.test.js +87 -0
- package/webpack.config.js +1 -1
- package/src/index.css +0 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# Contributing to CoCreate-render
|
|
2
2
|
|
|
3
|
-
This project is work of [many contributors](https://github.com/
|
|
4
|
-
You're encouraged to submit [pull requests](https://github.com/
|
|
5
|
-
[propose features and discuss issues](https://github.com/
|
|
3
|
+
This project is work of [many contributors](https://github.com/CoCreateJS/render/graphs/contributors).
|
|
4
|
+
You're encouraged to submit [pull requests](https://github.com/CoCreateJS/render/pulls),
|
|
5
|
+
[propose features and discuss issues](https://github.com/CoCreateJS/render/issues).
|
|
6
6
|
|
|
7
7
|
In the examples below, substitute your Github username for `contributor` in URLs.
|
|
8
8
|
|
|
9
9
|
## Fork the Project
|
|
10
10
|
|
|
11
|
-
Fork the [project on Github](https://github.com/
|
|
11
|
+
Fork the [project on Github](https://github.com/CoCreateJS/render) and check out your copy.
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
git render https://github.com/contributor/CoCreate-render.git
|
|
15
15
|
cd CoCreate-render
|
|
16
|
-
git remote add upstream https://github.com/
|
|
16
|
+
git remote add upstream https://github.com/CoCreateJS/render.git
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Create a Topic Branch
|
|
@@ -75,7 +75,7 @@ git push origin my-feature-branch
|
|
|
75
75
|
|
|
76
76
|
## Make a Pull Request
|
|
77
77
|
|
|
78
|
-
Go to [https://github.com/
|
|
78
|
+
Go to [https://github.com/CoCreateJS/render](https://github.com/CoCreateJS/render) and select your feature branch.
|
|
79
79
|
Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
|
80
80
|
|
|
81
81
|
## Rebase
|
package/README.md
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
# CoCreate-render
|
|
2
2
|
|
|
3
|
-
A simple render component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API. Take it for a spin in our [playground!](https://
|
|
3
|
+
A simple render component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API. Take it for a spin in our [playground!](https://CoCreateJS.com/docs/render)
|
|
4
4
|
|
|
5
|
-

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
10
|

|
|
11
11
|
|
|
12
|
-

|
|
13
13
|
|
|
14
|
-
## [Docs & Demo](https://
|
|
14
|
+
## [Docs & Demo](https://CoCreateJS.com/docs/render)
|
|
15
15
|
|
|
16
|
-
For a complete guide and working demo refer to the [doumentation](https://
|
|
16
|
+
For a complete guide and working demo refer to the [doumentation](https://CoCreateJS.com/docs/render)
|
|
17
17
|
|
|
18
18
|
## CDN
|
|
19
19
|
|
|
20
20
|
```html
|
|
21
|
-
<script src="https://cdn.
|
|
21
|
+
<script src="https://cdn.CoCreateJS.com/render/latest/CoCreate-render.min.js"></script>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
```html
|
|
25
|
-
<script src="https://cdn.
|
|
25
|
+
<script src="https://cdn.CoCreateJS.com/render/latest/CoCreate-render.min.css"></script>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## NPM
|
|
@@ -50,13 +50,13 @@ $ yarn install @cocreate/render
|
|
|
50
50
|
|
|
51
51
|
# Announcements
|
|
52
52
|
|
|
53
|
-
All updates to this library are documented in our [CHANGELOG](https://github.com/
|
|
53
|
+
All updates to this library are documented in our [CHANGELOG](https://github.com/CoCreateJS/render/blob/master/CHANGELOG.md) and [releases](https://github.com/CoCreateJS/render/releases). You may also subscribe to email for releases and breaking changes.
|
|
54
54
|
|
|
55
55
|
<a name="roadmap"></a>
|
|
56
56
|
|
|
57
57
|
# Roadmap
|
|
58
58
|
|
|
59
|
-
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/
|
|
59
|
+
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/CoCreateJS/render/issues) and [pull requests](https://github.com/CoCreateJS/render/pulls). We would love to hear your feedback.
|
|
60
60
|
|
|
61
61
|
<a name="about"></a>
|
|
62
62
|
|
|
@@ -64,7 +64,7 @@ If you are interested in the future direction of this project, please take a loo
|
|
|
64
64
|
|
|
65
65
|
CoCreate-render is guided and supported by the CoCreate Developer Experience Team.
|
|
66
66
|
|
|
67
|
-
Please Email the Developer Experience Team [here](mailto:develop@
|
|
67
|
+
Please Email the Developer Experience Team [here](mailto:develop@CoCreateJS.com) in case of any queries.
|
|
68
68
|
|
|
69
69
|
CoCreate-render is maintained and funded by CoCreate. The names and logos for CoCreate are trademarks of CoCreate, LLC.
|
|
70
70
|
|
|
@@ -72,9 +72,9 @@ CoCreate-render is maintained and funded by CoCreate. The names and logos for Co
|
|
|
72
72
|
|
|
73
73
|
# How to Contribute
|
|
74
74
|
|
|
75
|
-
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/
|
|
75
|
+
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/CoCreateJS/render/blob/master/CONTRIBUTING.md) guide for details.
|
|
76
76
|
|
|
77
|
-
We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/
|
|
77
|
+
We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/CoCreateJS/render/issues) and [pull requests](https://github.com/CoCreateJS/render/pulls) or merely upvote or comment on existing issues or pull requests.
|
|
78
78
|
|
|
79
79
|
We appreciate your continued support, thank you!
|
|
80
80
|
|
|
@@ -84,8 +84,38 @@ We appreciate your continued support, thank you!
|
|
|
84
84
|
|
|
85
85
|
This software is dual-licensed under the GNU Affero General Public License version 3 (AGPLv3) and a commercial license.
|
|
86
86
|
|
|
87
|
-
- **Open Source Use**: For open-source projects and non-commercial use, this software is available under the AGPLv3. The AGPLv3 allows you to freely use, modify, and distribute this software, provided that all modifications and derivative works are also licensed under the AGPLv3. For the full license text, see the [LICENSE file](https://github.com/
|
|
87
|
+
- **Open Source Use**: For open-source projects and non-commercial use, this software is available under the AGPLv3. The AGPLv3 allows you to freely use, modify, and distribute this software, provided that all modifications and derivative works are also licensed under the AGPLv3. For the full license text, see the [LICENSE file](https://github.com/CoCreateJS/render/blob/master/LICENSE).
|
|
88
88
|
|
|
89
|
-
- **Commercial Use**: For-profit companies and individuals intending to use this software for commercial purposes must obtain a commercial license. The commercial license is available when you sign up for an API key on our [website](https://
|
|
89
|
+
- **Commercial Use**: For-profit companies and individuals intending to use this software for commercial purposes must obtain a commercial license. The commercial license is available when you sign up for an API key on our [website](https://CoCreateJS.com). This license permits proprietary use and modification of the software without the copyleft requirements of the AGPLv3. It is ideal for integrating this software into proprietary commercial products and applications.
|
|
90
90
|
|
|
91
91
|
If you have not purchased a commercial license and intend to use this software for commercial purposes, you are required to sign up for an API key on our website.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Server
|
|
95
|
+
|
|
96
|
+
Render also provides a stateless server-side HTML renderer. Import it from `@cocreate/render/server`; the browser renderer remains available from `@cocreate/render`.
|
|
97
|
+
|
|
98
|
+
### Server rendering
|
|
99
|
+
|
|
100
|
+
The `HTML` function processes HTML strings, resolves nested file and database-backed content, applies state and metadata, and protects recursive includes from circular references.
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
import { HTML } from '@cocreate/render/server';
|
|
104
|
+
|
|
105
|
+
const html = await HTML({
|
|
106
|
+
file: {
|
|
107
|
+
src: `<html><body><h1 array="posts" object="post-id" key="title"></h1></body></html>`,
|
|
108
|
+
pathname: "/pages/dashboard.html",
|
|
109
|
+
organization_id: "organization-id"
|
|
110
|
+
},
|
|
111
|
+
organization: { languages: ["en"] },
|
|
112
|
+
urlObject: new URL("https://example.com/pages/dashboard.html"),
|
|
113
|
+
lang: "en",
|
|
114
|
+
theme: "dark",
|
|
115
|
+
crud: crudInstance
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Server HTML attributes
|
|
120
|
+
|
|
121
|
+
The server renderer evaluates `src` for nested file fragments, `array` and `object` to resolve records, and `key` to place a value. It also supports `filter`, `value-type="outerHTML"`, `render-error`, `state-id`, and `state-overwrite`. Server rendering marks inserted content with `rendered="true"` so the browser does not fetch the same fragment again.
|
package/demo/fetch.string.html
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
</pre>
|
|
45
45
|
|
|
46
46
|
<!-- CoCreate JS CDN -->
|
|
47
|
-
<script src="https://
|
|
48
|
-
<!-- <script src="https://
|
|
47
|
+
<script src="https://CoCreateJS.com/dist/CoCreate.js"></script>
|
|
48
|
+
<!-- <script src="https://CoCreateJS.com/dist/CoCreate.js"></script> -->
|
|
49
49
|
</body>
|
|
50
50
|
</html>
|
package/demo/index.html
CHANGED
package/demo/render.array.html
CHANGED
package/demo/render.html
CHANGED
package/demo/render.object.html
CHANGED
package/demo/renderKey.html
CHANGED
package/docs/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
rel="icon"
|
|
10
10
|
type="image/png"
|
|
11
11
|
sizes="32x32"
|
|
12
|
-
href="https://
|
|
12
|
+
href="https://CoCreateJS.com/images/favicon.ico" />
|
|
13
13
|
<meta
|
|
14
14
|
name="description"
|
|
15
15
|
content="A simple yet powerful drag-and-drop solution powered by javascript." />
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<meta name="robots" content="index,follow" />
|
|
20
20
|
<meta
|
|
21
21
|
property="og:image"
|
|
22
|
-
content="https://cdn.
|
|
22
|
+
content="https://cdn.CoCreateJS.com/docs/render.png" />
|
|
23
23
|
|
|
24
24
|
<link
|
|
25
25
|
rel="stylesheet"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
share-title="testing im a title"
|
|
74
74
|
share-height="600"
|
|
75
75
|
share-width="700"
|
|
76
|
-
share-media="https://cdn.
|
|
76
|
+
share-media="https://cdn.CoCreateJS.com/docs/render.png"
|
|
77
77
|
hover="display:block!important"
|
|
78
78
|
hover-query=".social-networks">
|
|
79
79
|
<div class="display:none social-networks">
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
></a>
|
|
105
105
|
</div>
|
|
106
106
|
<a
|
|
107
|
-
href="https://github.com/
|
|
107
|
+
href="https://github.com/CoCreateJS/CoCreate-dnd"
|
|
108
108
|
target="_blank"
|
|
109
109
|
class=""
|
|
110
110
|
><i src="/assets/svg/github.svg"></i
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
<p class="padding:10px_0px line-height:1.5">
|
|
142
142
|
Or you can use cdn link:
|
|
143
143
|
</p>
|
|
144
|
-
<pre><code class="language-html"><script>https://cdn.
|
|
144
|
+
<pre><code class="language-html"><script>https://cdn.CoCreateJS.com/render/latest/CoCreate-render.min.js</script></code></pre>
|
|
145
145
|
<p class="padding:10px_0px line-height:1.5">
|
|
146
146
|
for styling please refer to #id-style
|
|
147
147
|
</p>
|
|
@@ -537,13 +537,13 @@
|
|
|
537
537
|
</div>
|
|
538
538
|
</div>
|
|
539
539
|
<button
|
|
540
|
-
href="https://github.com/
|
|
540
|
+
href="https://github.com/CoCreateJS/render/tree/master/docs/index.html?message=docs%3A%20describe%20your%20change..."
|
|
541
541
|
target="_blank"
|
|
542
542
|
class="display:flex justify-content:center align-items:center position:fixed bottom:15px right:15px height:50px width:50px border-radius:50% box-shadow:0px_2px_10px_0px_rgba(0,_0,_0,_0.4)">
|
|
543
543
|
<i src="../assets/svg/pencil-alt.svg"></i>
|
|
544
544
|
</button>
|
|
545
545
|
</main>
|
|
546
546
|
|
|
547
|
-
<script src="https://
|
|
547
|
+
<script src="https://CoCreateJS.com/dist/CoCreate.js"></script>
|
|
548
548
|
</body>
|
|
549
549
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/render",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A simple render component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"render",
|
|
@@ -22,44 +22,38 @@
|
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/
|
|
25
|
+
"url": "git+https://github.com/CoCreateJS/render.git"
|
|
26
26
|
},
|
|
27
27
|
"author": "CoCreate LLC",
|
|
28
28
|
"license": "AGPL-3.0",
|
|
29
29
|
"bugs": {
|
|
30
|
-
"url": "https://github.com/
|
|
30
|
+
"url": "https://github.com/CoCreateJS/render/issues"
|
|
31
31
|
},
|
|
32
|
-
"homepage": "https://
|
|
32
|
+
"homepage": "https://CoCreateJS.com/docs/render",
|
|
33
33
|
"funding": {
|
|
34
34
|
"type": "GitHub Sponsors ❤",
|
|
35
|
-
"url": "https://github.com/sponsors/
|
|
35
|
+
"url": "https://github.com/sponsors/CoCreateJS"
|
|
36
36
|
},
|
|
37
|
-
"main": "./src/index.js",
|
|
37
|
+
"main": "./src/server/index.js",
|
|
38
|
+
"browser": "./src/client/index.js",
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"@cocreate/actions": "^1.24.0",
|
|
40
|
-
"@cocreate/api": "^1.
|
|
41
|
+
"@cocreate/api": "^1.31.0",
|
|
41
42
|
"@cocreate/element-prototype": "^1.35.0",
|
|
42
|
-
"@cocreate/observer": "^1.
|
|
43
|
-
"@cocreate/utils": "^1.
|
|
43
|
+
"@cocreate/observer": "^1.23.0",
|
|
44
|
+
"@cocreate/utils": "^1.54.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@cocreate/webpack": "^1.
|
|
47
|
+
"@cocreate/webpack": "^1.9.0"
|
|
47
48
|
},
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"@cocreate/local-storage@1.16.5": true,
|
|
58
|
-
"@cocreate/observer@1.19.0": true,
|
|
59
|
-
"@cocreate/organizations@1.30.1": true,
|
|
60
|
-
"@cocreate/render@1.46.1": true,
|
|
61
|
-
"@cocreate/socket-client@1.40.5": true,
|
|
62
|
-
"@cocreate/utils@1.42.2": true,
|
|
63
|
-
"@cocreate/webpack@1.4.3": true
|
|
49
|
+
"exports": {
|
|
50
|
+
".": {
|
|
51
|
+
"node": "./src/server/index.js",
|
|
52
|
+
"deno": "./src/server/index.js",
|
|
53
|
+
"browser": "./src/client/index.js",
|
|
54
|
+
"default": "./src/server/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./server": "./src/server/index.js",
|
|
57
|
+
"./client": "./src/client/index.js"
|
|
64
58
|
}
|
|
65
59
|
}
|