Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
steveblue committed Jun 1, 2020
1 parent eff184a commit dae9a93
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "readymade",
"version": "1.1.0",
"version": "1.1.1",
"description": "JavaScript microlibrary for developing Web Components with Decorators",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions packages/@readymade/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 1.1.1

- FIX issue that caused array values to not correctly update in some use cases
- ADD check for `no-attr` attribute on Elements to forego expensive change detection on attributes where not applicable


## 1.1.0

### BREAKING CHANGES
Expand Down
20 changes: 16 additions & 4 deletions packages/@readymade/core/bundles/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,19 @@ class NodeTree {
}
}
changeNode(node, key, value) {
const bracketStartRegex = new RegExp(`\\[`, 'gi');
const bracketEndRegex = new RegExp('\\]', 'gi');
key = key.replace(bracketStartRegex, `\\[`);
key = key.replace(bracketEndRegex, `\\]`);
const regex = new RegExp(`\{\{(\s*)(${key})(\s*)\}\}`, 'gi');
const attrId = this.getElementByAttribute(node)[0].nodeName || this.getElementByAttribute(node)[0].name;
const protoNode = this.$flatMap[attrId].node;
if (protoNode.textContent.match(regex)) {
node.textContent = protoNode.textContent.replace(regex, value);
}
if (protoNode.hasAttribute('no-attr')) {
return;
}
let attr;
for (const attribute of protoNode.attributes) {
attr = attribute.nodeName || attribute.name;
Expand Down Expand Up @@ -193,15 +203,17 @@ class NodeTree {
node.removeAttribute(check);
}
}
if (protoNode.textContent.match(regex)) {
node.textContent = protoNode.textContent.replace(regex, value);
}
}
updateNode(node, key, value) {
if (this.getElementByAttribute(node).length === 0) {
return;
}
if (isObject(value)) {
if (Array.isArray(value)) {
for (let index = 0; index < value.length; index++) {
this.changeNode(node, `${key}[${index}]`, value[index]);
}
}
else if (isObject(value)) {
for (const prop in value) {
if (value.hasOwnProperty(prop)) {
this.changeNode(node, `${key}.${prop}`, value[prop]);
Expand Down
2 changes: 1 addition & 1 deletion packages/@readymade/core/bundles/core.min.js

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions packages/@readymade/core/fesm2015/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,19 @@ class NodeTree {
}
}
changeNode(node, key, value) {
const bracketStartRegex = new RegExp(`\\[`, 'gi');
const bracketEndRegex = new RegExp('\\]', 'gi');
key = key.replace(bracketStartRegex, `\\[`);
key = key.replace(bracketEndRegex, `\\]`);
const regex = new RegExp(`\{\{(\s*)(${key})(\s*)\}\}`, 'gi');
const attrId = this.getElementByAttribute(node)[0].nodeName || this.getElementByAttribute(node)[0].name;
const protoNode = this.$flatMap[attrId].node;
if (protoNode.textContent.match(regex)) {
node.textContent = protoNode.textContent.replace(regex, value);
}
if (protoNode.hasAttribute('no-attr')) {
return;
}
let attr;
for (const attribute of protoNode.attributes) {
attr = attribute.nodeName || attribute.name;
Expand Down Expand Up @@ -189,15 +199,17 @@ class NodeTree {
node.removeAttribute(check);
}
}
if (protoNode.textContent.match(regex)) {
node.textContent = protoNode.textContent.replace(regex, value);
}
}
updateNode(node, key, value) {
if (this.getElementByAttribute(node).length === 0) {
return;
}
if (isObject(value)) {
if (Array.isArray(value)) {
for (let index = 0; index < value.length; index++) {
this.changeNode(node, `${key}[${index}]`, value[index]);
}
}
else if (isObject(value)) {
for (const prop in value) {
if (value.hasOwnProperty(prop)) {
this.changeNode(node, `${key}.${prop}`, value[prop]);
Expand Down
2 changes: 1 addition & 1 deletion packages/@readymade/core/fesm2015/core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/@readymade/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@readymade/core",
"version": "1.1.0",
"version": "1.1.1",
"description": "JavaScript microlibrary for developing Web Components with TypeScript and Decorators",
"umd": "./bundles/core.js",
"main": "./fesm2015/core.js",
Expand Down

0 comments on commit dae9a93

Please sign in to comment.