@cocreate/render 1.29.0 → 1.30.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 CHANGED
@@ -1,3 +1,25 @@
1
+ # [1.30.0](https://github.com/CoCreate-app/CoCreate-render/compare/v1.29.1...v1.30.0) (2023-11-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * favicon.ico path ([e919043](https://github.com/CoCreate-app/CoCreate-render/commit/e919043165602bbd961c7a27ce2896bb1d474ebc))
7
+ * removed testing console.log ([ec4140b](https://github.com/CoCreate-app/CoCreate-render/commit/ec4140b82977c65cb2f1d321568b3a12706574a8))
8
+ * update dependencies to the lates versions ([0c6702a](https://github.com/CoCreate-app/CoCreate-render/commit/0c6702ac846fe0c00aabc89fe241b8eb5787de94))
9
+ * update method to use object.update etc ([cfd4a65](https://github.com/CoCreate-app/CoCreate-render/commit/cfd4a657c4b13c31755d79d90b623ce249dd25a8))
10
+
11
+
12
+ ### Features
13
+
14
+ * render supports key and render attribute ([c5b7317](https://github.com/CoCreate-app/CoCreate-render/commit/c5b73172474c8cdfbd1af1deafe10b8552851745))
15
+
16
+ ## [1.29.1](https://github.com/CoCreate-app/CoCreate-render/compare/v1.29.0...v1.29.1) (2023-10-25)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * bump dependencies ([d0576ab](https://github.com/CoCreate-app/CoCreate-render/commit/d0576ab94cb7be5c5788fc92e8c98454e64397e6))
22
+
1
23
  # [1.29.0](https://github.com/CoCreate-app/CoCreate-render/compare/v1.28.7...v1.29.0) (2023-10-22)
2
24
 
3
25
 
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <style>
package/demo/index.html CHANGED
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <body>
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <style>
package/demo/render.html CHANGED
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <style>
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <style>
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/render",
3
- "version": "1.29.0",
3
+ "version": "1.30.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.11.6",
62
- "@cocreate/api": "^1.15.4",
63
- "@cocreate/element-prototype": "^1.11.5",
64
- "@cocreate/observer": "^1.11.5",
65
- "@cocreate/utils": "^1.25.3"
61
+ "@cocreate/actions": "^1.12.1",
62
+ "@cocreate/api": "^1.15.9",
63
+ "@cocreate/element-prototype": "^1.11.8",
64
+ "@cocreate/observer": "^1.11.7",
65
+ "@cocreate/utils": "^1.26.2"
66
66
  }
67
67
  }
package/src/index.js CHANGED
@@ -71,6 +71,9 @@ async function render({ source, element, selector, data, key, index, currentInde
71
71
  }
72
72
 
73
73
  if (source) {
74
+ if (!key)
75
+ key = source.getAttribute('render') || source.getAttribute('key')
76
+
74
77
  let sourceData = sources.get(source)
75
78
  if (!sourceData) {
76
79
  sourceData = { element: source, data }
@@ -80,6 +83,7 @@ async function render({ source, element, selector, data, key, index, currentInde
80
83
  source = sourceData
81
84
  if (!source.data)
82
85
  source.data = data
86
+
83
87
  } else if (data)
84
88
  source = { data }
85
89
 
@@ -91,7 +95,7 @@ async function render({ source, element, selector, data, key, index, currentInde
91
95
 
92
96
  let type = data.type
93
97
  if (!type && data.method) {
94
- type = data.method.split('.')[1]
98
+ type = data.method.split('.')[0]
95
99
  } else if (type == 'key')
96
100
  type = 'object'
97
101
 
@@ -100,8 +104,7 @@ async function render({ source, element, selector, data, key, index, currentInde
100
104
  element = [element]
101
105
 
102
106
  for (let i = 0; i < element.length; i++) {
103
- if (!key)
104
- key = element[i].getAttribute('render') || type
107
+ key = element[i].getAttribute('render') || key || type
105
108
 
106
109
  let renderedNode = renderedNodes.get(element[i])
107
110
  if (source) {
@@ -530,17 +533,15 @@ async function renderValue(node, data, placeholder, renderAs, renderedNode) {
530
533
 
531
534
  let match
532
535
  do {
533
- // match = output.match(/{{([A-Za-z0-9_.,\[\]\- ]*)}}/); // works by getting inner matches first
536
+ match = output.match(/{{([A-Za-z0-9_.,\[\]\- ]*)}}/); // works by getting inner matches first
534
537
  // match = output.match(/{{([^}]*)}}/);
535
- match = output.match(/{{(.*?)}}/);
538
+ // match = output.match(/{{(.*?)}}/);
536
539
  if (match) {
537
540
  let value
538
- if (match[1].includes('status'))
539
- console.log('test')
540
541
  try {
541
542
  let Data = JSON.parse('{' + match[1].replace(/'/g, '"') + '}');
542
543
  if (Data.storage || Data.database || Data.array || Data.object || Data.index) {
543
- Data.method = 'read.object'
544
+ Data.method = 'object.read'
544
545
  value = await CoCreate.crud.send(Data)
545
546
  value = value.object[0][Data.key]
546
547
  }