@cocreate/elements 1.20.1 → 1.20.2

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,10 @@
1
+ ## [1.20.2](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.20.1...v1.20.2) (2023-09-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * get type from method ([274751e](https://github.com/CoCreate-app/CoCreate-elements/commit/274751e8ef66e8ef19cf8d323297599e78c82ef9))
7
+
1
8
  ## [1.20.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.20.0...v1.20.1) (2023-08-21)
2
9
 
3
10
 
@@ -1,25 +1,25 @@
1
- module.exports = {
2
- "organization_id": "",
3
- "key": "",
4
- "host": "",
5
- "sources": [
6
- {
7
- "array": "files",
8
- "object": {
9
- "_id": "601f4b1c6b402c72efc07e0b",
10
- "name": "index.html",
11
- "path": "/docs/elements/index.html",
12
- "src": "{{./docs/index.html}}",
13
- "host": [
14
- "*",
15
- "general.cocreate.app"
16
- ],
17
- "directory": "/docs/elements",
18
- "parentDirectory": "{{parentDirectory}}",
19
- "content-type": "{{content-type}}",
20
- "public": "true",
21
- "website_id": "644d4bff8036fb9d1d1fd69c"
22
- }
23
- }
24
- ]
25
- }
1
+ module.exports = {
2
+ "organization_id": "",
3
+ "key": "",
4
+ "host": "",
5
+ "sources": [
6
+ {
7
+ "entry": "./docs",
8
+ "exclude": [
9
+ "demo"
10
+ ],
11
+ "array": "files",
12
+ "object": {
13
+ "name": "{{name}}",
14
+ "src": "{{source}}",
15
+ "host": [
16
+ "*"
17
+ ],
18
+ "directory": "/docs/{{directory}}",
19
+ "path": "{{path}}",
20
+ "content-type": "{{content-type}}",
21
+ "public": "true"
22
+ }
23
+ }
24
+ ]
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.20.1",
3
+ "version": "1.20.2",
4
4
  "description": "Fetch content into any html element by using html5 attributes to query data stored in CoCreate headless CMS. If data is changed it will instantly reflect in html tags as changes are broadcasted in realtime",
5
5
  "keywords": [
6
6
  "elements",
package/src/index.js CHANGED
@@ -240,7 +240,7 @@ async function read(element, data, dataKey) {
240
240
  debounce.set(dataKey.string, delayTimer)
241
241
  }
242
242
 
243
- function setData(element, data, action) {
243
+ function setData(element, data) {
244
244
  if (!element) {
245
245
  element = getDataElements(data)
246
246
  if (!element.length) return
@@ -250,8 +250,8 @@ function setData(element, data, action) {
250
250
  element = [element]
251
251
 
252
252
  let type = data.type
253
- if (!type && action) {
254
- type = action.split('.')[0]
253
+ if (!type && data.method) {
254
+ type = data.method.split('.')[1]
255
255
  } else if (type == 'key')
256
256
  type = 'object'
257
257
 
@@ -263,7 +263,7 @@ function setData(element, data, action) {
263
263
  if (!data[type])
264
264
  continue;
265
265
 
266
- action = el.getAttribute('actions')
266
+ let action = el.getAttribute('actions')
267
267
  if (action && ['database', 'array', 'object', 'key'].includes(action)) continue;
268
268
 
269
269
  const { key, isRead, isListen, isCrdt } = getAttributes(el);
@@ -751,13 +751,13 @@ function initSocket() {
751
751
  const action = array[i] + '.' + attributes[j];
752
752
 
753
753
  CRUD.listen(action, function (data) {
754
- setData(null, data, action);
754
+ setData(null, data);
755
755
  });
756
756
  }
757
757
  }
758
758
 
759
759
  CRUD.listen('sync', function (data) {
760
- setData(null, data, action);
760
+ setData(null, data);
761
761
  });
762
762
 
763
763
  }
@@ -838,6 +838,8 @@ function dndCrudData(element, parent, operator) {
838
838
  newData[newData.type].push({ ...previousData, ...Data })
839
839
  }
840
840
  }
841
+
842
+
841
843
  } else {
842
844
  newData[newData.type] = [{ ...data[data.type][index], ...Data }]
843
845
  }
@@ -870,6 +872,7 @@ function dndNewData(element, data) {
870
872
  }
871
873
  }
872
874
 
875
+
873
876
  let keyPath, clonesMap, clones, index
874
877
 
875
878
  let renderedNode = CoCreate.render.renderedNodes.get(element)