Skip to content

Commit

Permalink
Merge pull request WebReflection#332 from WebReflection/hyperhtml-wire
Browse files Browse the repository at this point in the history
Using external hyperhtml-wire module
  • Loading branch information
WebReflection authored Jan 10, 2019
2 parents b11094d + 1c7012d commit 08e6c9a
Show file tree
Hide file tree
Showing 27 changed files with 230 additions and 706 deletions.
2 changes: 1 addition & 1 deletion cjs/classes/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function setup(content) {
event.component = this;
return (_wire$.dispatchEvent ?
_wire$ :
_wire$.childNodes[0]
_wire$.n[0]
).dispatchEvent(event);
}
return false;
Expand Down
38 changes: 0 additions & 38 deletions cjs/classes/Wire.js

This file was deleted.

7 changes: 3 additions & 4 deletions cjs/hyper/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ function render() {
// parse it once, if unknown, to map all interpolations
// as single DOM callbacks, relate such template
// to the current context, and render it after cleaning the context up
function upgrade() {
const args = reArguments.apply(null, arguments);
function upgrade(template) {
const type = OWNER_SVG_ELEMENT in this ? 'svg' : 'html';
const tagger = new Tagger(type);
bewitched.set(this, {tagger, template: args[0]});
bewitched.set(this, {tagger, template: template});
this.textContent = '';
this.appendChild(tagger.apply(null, args));
this.appendChild(tagger.apply(null, arguments));
}

Object.defineProperty(exports, '__esModule', {value: true}).default = render;
9 changes: 5 additions & 4 deletions cjs/hyper/wire.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';
const WeakMap = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('@ungap/weakmap'));

const Wire = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('../classes/Wire.js'));
const Wire = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('hyperhtml-wire'));

const {Tagger} = require('../objects/Updates.js');
const {reArguments, slice} = require('../shared/utils.js');
const {reArguments} = require('../shared/utils.js');

// all wires used per each context
const wires = new WeakMap;
Expand Down Expand Up @@ -73,9 +73,10 @@ const weakly = (obj, type) => {
// array of nodes or to this single referenced node.
const wireContent = node => {
const childNodes = node.childNodes;
return childNodes.length === 1 ?
const {length} = childNodes;
return length === 1 ?
childNodes[0] :
new Wire(slice.call(childNodes, 0));
(length ? new Wire(childNodes) : node);
};

exports.content = content;
Expand Down
1 change: 0 additions & 1 deletion cjs/objects/Basic.js

This file was deleted.

46 changes: 0 additions & 46 deletions cjs/objects/Engine.js

This file was deleted.

58 changes: 0 additions & 58 deletions cjs/objects/Path.js

This file was deleted.

82 changes: 0 additions & 82 deletions cjs/objects/Style.js

This file was deleted.

4 changes: 2 additions & 2 deletions cjs/objects/Updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
} = require('../shared/constants.js');

const Component = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('../classes/Component.js'));
const Wire = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('../classes/Wire.js'));
const Wire = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('hyperhtml-wire'));
const Intent = (m => m.__esModule ? /* istanbul ignore next */ m.default : /* istanbul ignore next */ m)(require('./Intent.js'));
const { slice, text } = require('../shared/utils.js');

Expand All @@ -36,7 +36,7 @@ const asNode = (item, i) => {
// all these cases are handled by domdiff already
/* istanbul ignore next */
((1 / i) < 0 ?
(i ? item.remove() : item.last) :
(i ? item.remove(true) : item.last) :
(i ? item.valueOf(true) : item.first)) :
asNode(item.render(), i));
}
Expand Down
79 changes: 0 additions & 79 deletions cjs/objects/hyperstyle.js

This file was deleted.

8 changes: 0 additions & 8 deletions cjs/shared/easy-dom.js

This file was deleted.

6 changes: 0 additions & 6 deletions cjs/shared/features-detection.js

This file was deleted.

Loading

0 comments on commit 08e6c9a

Please sign in to comment.