@cocreate/render 1.34.0 → 1.36.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 +25 -0
- package/README.md +14 -8
- package/docs/index.html +12 -14
- package/package.json +6 -6
- package/src/index.js +35 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
# [1.36.0](https://github.com/CoCreate-app/CoCreate-render/compare/v1.35.0...v1.36.0) (2023-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update licensing details ([07ae1a1](https://github.com/CoCreate-app/CoCreate-render/commit/07ae1a1a18b0dfe938135991a0c2ed79cd50570b))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* upgrade dependencies for latest features and fixes ([3c1ef85](https://github.com/CoCreate-app/CoCreate-render/commit/3c1ef852a6179e0472d820b8424070bd6c2ae0e2))
|
|
12
|
+
|
|
13
|
+
# [1.35.0](https://github.com/CoCreate-app/CoCreate-render/compare/v1.34.0...v1.35.0) (2023-11-25)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* pass attributes renamed to state ([c3c96d7](https://github.com/CoCreate-app/CoCreate-render/commit/c3c96d795b405054a8669b4d05cd69b89d103cc6))
|
|
19
|
+
* update nav, edit button and css path ([5b6cad4](https://github.com/CoCreate-app/CoCreate-render/commit/5b6cad4d112d736b1fec04a7bc897f22b961e086))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* upgrade dependencies for latest features and fixes ([18468c3](https://github.com/CoCreate-app/CoCreate-render/commit/18468c3992d47414e1ffa9ae27a60abed0cf9a8e))
|
|
25
|
+
|
|
1
26
|
# [1.34.0](https://github.com/CoCreate-app/CoCreate-render/compare/v1.33.0...v1.34.0) (2023-11-22)
|
|
2
27
|
|
|
3
28
|
|
package/README.md
CHANGED
|
@@ -39,12 +39,12 @@ $ yarn install @cocreate/render
|
|
|
39
39
|
|
|
40
40
|
# Table of Contents
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
42
|
+
- [Table of Contents](#table-of-contents)
|
|
43
|
+
- [Announcements](#announcements)
|
|
44
|
+
- [Roadmap](#roadmap)
|
|
45
|
+
- [How to Contribute](#how-to-contribute)
|
|
46
|
+
- [About](#about)
|
|
47
|
+
- [License](#license)
|
|
48
48
|
|
|
49
49
|
<a name="announcements"></a>
|
|
50
50
|
|
|
@@ -78,8 +78,14 @@ We want this library to be community-driven, and CoCreate led. We need your help
|
|
|
78
78
|
|
|
79
79
|
We appreciate your continued support, thank you!
|
|
80
80
|
|
|
81
|
-
|
|
82
81
|
<a name="license"></a>
|
|
82
|
+
|
|
83
83
|
# License
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
This software is dual-licensed under the GNU Affero General Public License version 3 (AGPLv3) and a commercial license.
|
|
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/CoCreate-app/CoCreate-render/blob/master/LICENSE).
|
|
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://cocreate.app). 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
|
+
|
|
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.
|
package/docs/index.html
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
type="text/css" />
|
|
29
29
|
<link
|
|
30
30
|
rel="stylesheet"
|
|
31
|
-
href="
|
|
31
|
+
href="../index.css"
|
|
32
32
|
array="files"
|
|
33
33
|
object="60888216117c640e7596303f"
|
|
34
34
|
key="src"
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
</head>
|
|
39
39
|
|
|
40
40
|
<body>
|
|
41
|
+
<!-- Navbar -->
|
|
41
42
|
<nav
|
|
42
|
-
class="
|
|
43
|
+
class="width:100% display:flex align-items:center background:transparent padding-top:10px padding-bottom:10px"
|
|
43
44
|
content_id="content"
|
|
44
|
-
scroll="sticky-nav,
|
|
45
|
-
scroll-up="
|
|
46
|
-
scroll-down="
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
key="src"></nav>
|
|
45
|
+
scroll="sticky-nav,"
|
|
46
|
+
scroll-up="5"
|
|
47
|
+
scroll-down="5"
|
|
48
|
+
path="../"
|
|
49
|
+
src="../components/navbar.html"></nav>
|
|
50
50
|
<sidenav
|
|
51
51
|
id="menuL"
|
|
52
52
|
class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
<li
|
|
334
334
|
class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
335
335
|
<h4>
|
|
336
|
-
<span>setValue(elements, data, [
|
|
336
|
+
<span>setValue(elements, data, [stateTo])</span>
|
|
337
337
|
</h4>
|
|
338
338
|
<p>This is main function.</p>
|
|
339
339
|
<div>
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
</div>
|
|
361
361
|
<div>
|
|
362
362
|
<p>
|
|
363
|
-
<strong>
|
|
363
|
+
<strong>stateTo</strong
|
|
364
364
|
><span class="cocreate-badge warning"
|
|
365
365
|
>Type:string</span
|
|
366
366
|
><span class="cocreate-badge warning"
|
|
@@ -566,10 +566,8 @@
|
|
|
566
566
|
<button
|
|
567
567
|
href="https://github.com/CoCreate-app/CoCreate-render/tree/master/docs/index.html?message=docs%3A%20describe%20your%20change..."
|
|
568
568
|
target="_blank"
|
|
569
|
-
class="position:fixed bottom:15px right:15px
|
|
570
|
-
<i
|
|
571
|
-
class="height:20px fill:#505050"
|
|
572
|
-
src="/assets/svg/pencil-alt.svg"></i>
|
|
569
|
+
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)">
|
|
570
|
+
<i class="height:20px" src="../assets/svg/pencil-alt.svg"></i>
|
|
573
571
|
</button>
|
|
574
572
|
</main>
|
|
575
573
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/render",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.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",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"webpack-log": "^3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cocreate/actions": "^1.
|
|
62
|
-
"@cocreate/api": "^1.
|
|
63
|
-
"@cocreate/element-prototype": "^1.
|
|
64
|
-
"@cocreate/observer": "^1.
|
|
65
|
-
"@cocreate/utils": "^1.
|
|
61
|
+
"@cocreate/actions": "^1.14.0",
|
|
62
|
+
"@cocreate/api": "^1.17.0",
|
|
63
|
+
"@cocreate/element-prototype": "^1.15.0",
|
|
64
|
+
"@cocreate/observer": "^1.14.0",
|
|
65
|
+
"@cocreate/utils": "^1.29.0"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/index.js
CHANGED
|
@@ -32,6 +32,23 @@ const sources = new Map()
|
|
|
32
32
|
const renderedNodes = new Map()
|
|
33
33
|
const elementSelector = '[render-selector], [render-closest], [render-parent], [render-next], [render-previous]'
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Initializes elements based on specified rendering attributes. If a specific element is provided, it initializes that element.
|
|
38
|
+
* If no element is provided, it queries and initializes all elements matching the defined selector criteria for rendering attributes.
|
|
39
|
+
*
|
|
40
|
+
* Supported rendering attributes:
|
|
41
|
+
* - render-selector: [Describe what this attribute does]
|
|
42
|
+
* - render-closest: [Describe what this attribute does]
|
|
43
|
+
* - render-parent: [Describe what this attribute does]
|
|
44
|
+
* - render-next: [Describe what this attribute does]
|
|
45
|
+
* - render-previous: [Describe what this attribute does]
|
|
46
|
+
*
|
|
47
|
+
* @param {(Element|Element[]|HTMLCollection|null)} [element] - Optional. A single element, an array of elements, an HTMLCollection, or null.
|
|
48
|
+
* - If an HTMLCollection or an array of elements is provided, each element in the collection/array is initialized.
|
|
49
|
+
* - If a single element is provided, only that element is initialized.
|
|
50
|
+
* - If null or omitted, the function queries and initializes all elements matching the 'elementSelector'.
|
|
51
|
+
*/
|
|
35
52
|
function init(element) {
|
|
36
53
|
if (element && !(element instanceof HTMLCollection) && !Array.isArray(element))
|
|
37
54
|
element = [element]
|
|
@@ -48,6 +65,21 @@ function init(element) {
|
|
|
48
65
|
}
|
|
49
66
|
}
|
|
50
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Asynchronously renders content based on the provided parameters. This function handles the rendering logic for elements
|
|
70
|
+
* based on data sources, selectors, and other options.
|
|
71
|
+
*
|
|
72
|
+
* @param {Object} options - An object containing the parameters for rendering.
|
|
73
|
+
* @param {Object} options.source - The data source used for rendering.
|
|
74
|
+
* @param {Element} options.element - The DOM element where content will be rendered.
|
|
75
|
+
* @param {string} options.selector - CSS selector to specify target elements for rendering.
|
|
76
|
+
* @param {Object} options.data - Data to be used in rendering.
|
|
77
|
+
* @param {string} [options.key] - Optional key to reference specific parts of the data.
|
|
78
|
+
* @param {number} [options.index] - Optional index, typically used when rendering lists or arrays.
|
|
79
|
+
* @param {number} [options.currentIndex] - The current index in a list or array rendering process.
|
|
80
|
+
* @param {boolean} [options.update] - Flag to indicate if the rendering should update existing content.
|
|
81
|
+
* @param {boolean} [options.remove] - Flag to indicate if the rendering should remove elements instead of updating or appending.
|
|
82
|
+
*/
|
|
51
83
|
async function render({ source, element, selector, data, key, index, currentIndex, update, remove }) {
|
|
52
84
|
if (!element) {
|
|
53
85
|
if (source) {
|
|
@@ -453,9 +485,9 @@ async function renderValues(node, data, key, renderAs, keyPath, parent) {
|
|
|
453
485
|
}
|
|
454
486
|
// });
|
|
455
487
|
|
|
456
|
-
if (CoCreate.
|
|
457
|
-
if (node.hasAttribute('[
|
|
458
|
-
CoCreate.
|
|
488
|
+
if (CoCreate.state) {
|
|
489
|
+
if (node.hasAttribute('[state_id]'))
|
|
490
|
+
CoCreate.state.initElement(node)
|
|
459
491
|
}
|
|
460
492
|
|
|
461
493
|
if (node.tagName === 'SCRIPT' && node.src) {
|