motion
Version:
motion - moving development forward
37 lines (28 loc) • 1.16 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
var _state = require('../state');
var _state2 = _interopRequireDefault(_state);
var _helpers = require('../lib/helpers');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
enter(node, parent, scope, file) {
const name = node.name.name;
const subName = node.subName && node.subName.name;
const fullName = name + (subName ? `.${ subName }` : '');
// start new view
(0, _state.resetViewState)();
_state2.default.currentView = fullName;
_state2.default.inView = fullName;
_state2.default.meta.views[fullName] = {
location: (0, _helpers.normalizeLocation)(node.loc),
file: file.opts.filename,
styles: {},
els: {}
};
node.block.motionView = true;
return _helpers.t.callExpression(_helpers.t.identifier('Motion.view'), [_helpers.t.literal(fullName), _helpers.t.functionExpression(null, [_helpers.t.identifier('view'), _helpers.t.identifier('on'), _helpers.t.identifier('$')], node.block)]);
}
};
//# sourceMappingURL=ViewStatement.js.map
;