Skip to content

Commit

Permalink
chore: rebuild the dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Feb 13, 2021
1 parent 9c1fe45 commit 626cb72
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
22 changes: 11 additions & 11 deletions dist/vue-wc-wrapper.global.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ function convertAttributeValue (value, name, { type } = {}) {
if (value === 'true' || value === 'false') {
return value === 'true'
}
if (value === '' || value === name) {
if (value === '' || value === name || value != null) {
return true
}
return value != null
return value
} else if (isNumber(type)) {
const parsed = parseFloat(value, 10);
return isNaN(parsed) ? value : parsed
Expand Down Expand Up @@ -169,13 +169,13 @@ function wrap (Vue, Component) {

class CustomElement extends HTMLElement {
constructor () {
super();
this.attachShadow({ mode: 'open' });
const self = super();
self.attachShadow({ mode: 'open' });

const wrapper = this._wrapper = new Vue({
const wrapper = self._wrapper = new Vue({
name: 'shadow-root',
customElement: this,
shadowRoot: this.shadowRoot,
customElement: self,
shadowRoot: self.shadowRoot,
data () {
return {
props: {},
Expand All @@ -195,20 +195,20 @@ function wrap (Vue, Component) {
let hasChildrenChange = false;
for (let i = 0; i < mutations.length; i++) {
const m = mutations[i];
if (isInitialized && m.type === 'attributes' && m.target === this) {
syncAttribute(this, m.attributeName);
if (isInitialized && m.type === 'attributes' && m.target === self) {
syncAttribute(self, m.attributeName);
} else {
hasChildrenChange = true;
}
}
if (hasChildrenChange) {
wrapper.slotChildren = Object.freeze(toVNodes(
wrapper.$createElement,
this.childNodes
self.childNodes
));
}
});
observer.observe(this, {
observer.observe(self, {
childList: true,
subtree: true,
characterData: true,
Expand Down
22 changes: 11 additions & 11 deletions dist/vue-wc-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ function convertAttributeValue (value, name, { type } = {}) {
if (value === 'true' || value === 'false') {
return value === 'true'
}
if (value === '' || value === name) {
if (value === '' || value === name || value != null) {
return true
}
return value != null
return value
} else if (isNumber(type)) {
const parsed = parseFloat(value, 10);
return isNaN(parsed) ? value : parsed
Expand Down Expand Up @@ -166,13 +166,13 @@ function wrap (Vue, Component) {

class CustomElement extends HTMLElement {
constructor () {
super();
this.attachShadow({ mode: 'open' });
const self = super();
self.attachShadow({ mode: 'open' });

const wrapper = this._wrapper = new Vue({
const wrapper = self._wrapper = new Vue({
name: 'shadow-root',
customElement: this,
shadowRoot: this.shadowRoot,
customElement: self,
shadowRoot: self.shadowRoot,
data () {
return {
props: {},
Expand All @@ -192,20 +192,20 @@ function wrap (Vue, Component) {
let hasChildrenChange = false;
for (let i = 0; i < mutations.length; i++) {
const m = mutations[i];
if (isInitialized && m.type === 'attributes' && m.target === this) {
syncAttribute(this, m.attributeName);
if (isInitialized && m.type === 'attributes' && m.target === self) {
syncAttribute(self, m.attributeName);
} else {
hasChildrenChange = true;
}
}
if (hasChildrenChange) {
wrapper.slotChildren = Object.freeze(toVNodes(
wrapper.$createElement,
this.childNodes
self.childNodes
));
}
});
observer.observe(this, {
observer.observe(self, {
childList: true,
subtree: true,
characterData: true,
Expand Down

0 comments on commit 626cb72

Please sign in to comment.