Fixes #591 - [v4] "widgets" to "components" (breaking change)

This commit is contained in:
Patrick Steele-Idem 2017-02-21 16:21:21 -07:00
parent acb3aa05e5
commit a2e67c91f8
191 changed files with 472 additions and 783 deletions

View File

@ -9,7 +9,7 @@ function onInitComponent(listener) {
exports.onInitComponent = onInitComponent;
exports.Component = Component;
exports.getComponentForEl = componentsUtil.$__getComponentForEl;
exports.initComponents = require('./init-components').$__initServerRendered;
exports.init = require('./init-components').$__initServerRendered;
exports.c = require('./defineComponent'); // Referenced by compiled templates
exports.r = require('./renderer'); // Referenced by compiled templates

View File

@ -5,7 +5,7 @@
* @return {Component} The resulting Component with renderer
*/
var defineRenderer;
var defineComponent;
var defineWidget;
module.exports = function defineComponent(def) {
if (def.$__isComponent) {
@ -20,9 +20,9 @@ module.exports = function defineComponent(def) {
throw new Error('Expected "template" or "renderer"');
}
return defineComponent(def, renderer);
return defineWidget(def, renderer);
};
defineRenderer = require('./defineRenderer-legacy');
defineComponent = require('./defineComponent-legacy');
defineWidget = require('./defineWidget-legacy');

View File

@ -7,7 +7,7 @@
module.exports = function defineWidget(def, renderer) {
def = def.Component || def;
def = def.Widget || def;
if (def.$__isComponent) {
return def;
@ -64,6 +64,9 @@ module.exports = function defineWidget(def, renderer) {
delete proto.onBeforeDestroy;
delete proto.onDestroy;
proto.getWidget = proto.getComponent;
proto.getWidgets = proto.getComponents;
// convert legacy to modern
if (init || onRender) {

View File

@ -8,21 +8,26 @@ exports.makeRenderable = exports.renderable = require('../../runtime/renderable'
// referenced by compiled templates
exports.w = require('./defineWidget-legacy');
exports.rw = modern.rw;
exports.rc = modern.rc;
exports.r = require('./renderer-legacy');
// server only
exports.writeInitWidgetsCode = modern.writeInitWidgetsCode;
exports.getRenderedWidgets = modern.getRenderedWidgets;
exports.writeInitWidgetsCode = modern.writeInitComponentsCode;
exports.getRenderedWidgets = modern.getRenderedComponents;
// browser only
var Widget = exports.Widget = modern.Widget;
exports.onInitWidget = modern.onInitWidget;
exports.getWidgetForEl = modern.getWidgetForEl;
exports.initWidgets = modern.initWidgets;
var Widget = exports.Widget = modern.Component;
exports.onInitWidget = modern.onInitComponent;
exports.getWidgetForEl = modern.getComponentForEl;
exports.initWidgets = modern.init;
// monkey patch Widget
if (Widget) {
var WidgetProto = Widget.prototype;
WidgetProto.setProps = WidgetProto.$__setInput;
}
}
var RenderResult = require('../../runtime/RenderResult');
RenderResult.prototype.getWidget = RenderResult.prototype.getComponent;
RenderResult.prototype.getWidgets = RenderResult.prototype.getComponents;

View File

@ -24,18 +24,18 @@ function createRendererFunc(templateRenderFunc, componentProps) {
var getInitialProps;
var getTemplateData;
var getInitialState;
var getComponentConfig;
var getWidgetConfig;
var getInitialBody;
if (renderingLogic) {
getInitialProps = renderingLogic.getInitialProps;
getTemplateData = renderingLogic.getTemplateData;
getInitialState = renderingLogic.getInitialState;
getComponentConfig = renderingLogic.getComponentConfig;
getWidgetConfig = renderingLogic.getWidgetConfig;
getInitialBody = renderingLogic.getInitialBody;
}
var componentConfig;
var widgetConfig;
var componentBody;
var componentState;
@ -99,19 +99,19 @@ function createRendererFunc(templateRenderFunc, componentProps) {
}
if (input) {
if (getComponentConfig) {
// If getComponentConfig() was implemented then use that to
if (getWidgetConfig) {
// If getWidgetConfig() was implemented then use that to
// get the component config. The component config will be passed
// to the component constructor. If rendered on the server the
// component config will be serialized to a JSON-like data
// structure and stored in a "data-w-config" attribute.
componentConfig = getComponentConfig(input, out);
widgetConfig = getWidgetConfig(input, out);
} else {
componentConfig = input.componentConfig;
widgetConfig = input.widgetConfig;
}
if (componentConfig) {
component.$c = componentConfig;
if (widgetConfig) {
component.$c = widgetConfig;
}
if (getInitialBody) {
@ -166,8 +166,8 @@ function createRendererFunc(templateRenderFunc, componentProps) {
componentDef.$__component = fakeComponent ? null : component;
componentDef.$__isExisting = isExisting;
componentDef.b = componentBody;
componentDef.c = function(componentConfig) {
component.$c = componentConfig;
componentDef.c = function(widgetConfig) {
component.$c = widgetConfig;
};
componentDef.t = function(typeName) {
if (typeName) {
@ -181,7 +181,7 @@ function createRendererFunc(templateRenderFunc, componentProps) {
// Render the template associated with the component using the final template
// data that we constructed
templateRenderFunc(templateInput, out, componentDef);
templateRenderFunc(templateInput, out, componentDef, componentDef);
componentDef.$__end();
};

View File

@ -2,7 +2,7 @@
"browser": {
"./index.js": "./index-browser.js",
"./init-components.js": "./init-components-browser.js",
"./legacy/defineComponent-legacy.js": "./legacy/defineComponent-legacy-browser.js",
"./legacy/defineWidget-legacy.js": "./legacy/defineWidget-legacy-browser.js",
"./registry.js": "./registry-browser.js",
"./util.js": "./util-browser.js"
}

View File

@ -1,26 +1,28 @@
'use strict';
const resolveFrom = require('resolve-from');
const tryRequire = require('try-require');
const lassoModulesClientTransport = tryRequire('lasso-modules-client/transport', require);
const ok = require('assert').ok;
const generateRegisterComponentCode = require('../util/generateRegisterComponentCode');
function legacyGetDefaultComponentModule(dirname) {
var filename;
var legacy = true;
if ((filename = resolveFrom(dirname, './widget'))) {
return {
filename,
requirePath: './widget'
requirePath: './widget',
legacy
};
} else if ((filename = resolveFrom(dirname, './component'))) {
return {
filename,
requirePath: './component'
requirePath: './component',
legacy
};
} else if ((filename = resolveFrom(dirname, './'))) {
return {
filename,
requirePath: './'
requirePath: './',
legacy
};
} else {
return null;
@ -45,57 +47,6 @@ function checkIsInnerBind(el) {
return false;
}
function buildComponentTypeNode(componentModule, transformHelper, isSplit) {
ok(componentModule, '"componentModule" is required');
ok(transformHelper, '"transformHelper" is required');
ok(typeof componentModule.filename === 'string', '"componentModule.filename" should be a string');
ok(typeof transformHelper.dirname === 'string', '"transformHelper.dirname" should be a string');
let context = transformHelper.context;
let builder = context.builder;
let registerComponent = context.addStaticVar('marko_registerComponent',
builder.memberExpression(transformHelper.markoComponentsVar, builder.identifier('rc')));
let typeName;
if (lassoModulesClientTransport) {
typeName = lassoModulesClientTransport.getClientPath(componentModule.filename);
} else {
typeName = componentModule.filename;
}
let def;
if (isSplit) {
let returnValue = builder.require(builder.literal(componentModule.requirePath));
if (transformHelper.isLegacyComponent) {
let defineComponent = context.addStaticVar('marko_defineComponent',
builder.memberExpression(transformHelper.markoComponentsVar, builder.identifier('c')));
returnValue = builder.functionCall(defineComponent, [returnValue]);
}
def = builder.functionDeclaration(null, [] /* params */, [
builder.returnStatement(returnValue)
]);
} else {
def = builder.functionDeclaration(null, [], [
builder.returnStatement(
builder.memberExpression(
builder.identifier('module'),
builder.identifier('exports')))
]);
}
return builder.functionCall(registerComponent, [
builder.literal(typeName),
def
]);
}
module.exports = function handleComponentBind() {
let el = this.el;
let context = this.context;
@ -105,16 +56,14 @@ module.exports = function handleComponentBind() {
let componentModule;
let rendererModulePath;
let isComponentMain = true;
let rendererModule = this.getRendererModule();
let isLegacyComponent = false;
if (el.hasAttribute('w-bind')) {
isComponentMain = false;
let bindAttr = el.getAttribute('w-bind');
context.deprecate('Legacy components using w-bind and defineRenderer/defineComponent or defineComponent are deprecated. See: https://github.com/marko-js/marko/issues/421');
this.isLegacyComponent = true;
this.isLegacyComponent = isLegacyComponent = true;
// Remove the w-bind attribute since we don't want it showing up in the output DOM
el.removeAttribute('w-bind');
@ -122,33 +71,41 @@ module.exports = function handleComponentBind() {
// Read the value for the w-bind attribute. This will be an AST node for the parsed JavaScript
let bindAttrValue = bindAttr.value;
if (bindAttrValue == null) {
componentModule = legacyGetDefaultComponentModule(this.dirname);
if (!componentModule) {
this.addError('No corresponding JavaScript module found in the same directory (either "component.js" or "index.js"). Actual: ' + componentModule);
return;
}
}
const hasWidgetTypes = context.isFlagSet('hasWidgetTypes');
if (hasWidgetTypes) {
context.deprecate('The <component-types> tag is deprecated. Please remove it. See: https://github.com/marko-js/marko/issues/514');
context.deprecate('The <widget-types> tag is deprecated. Please remove it. See: https://github.com/marko-js/marko/issues/514');
}
else if (bindAttr.isLiteralValue()) {
if (bindAttrValue == null) {
componentModule = legacyGetDefaultComponentModule(this.dirname);
if (!componentModule) {
this.addError('No corresponding JavaScript module found in the same directory (either "component.js" or "index.js").');
return;
}
} else if (bindAttr.isLiteralValue()) {
if (typeof bindAttr.literalValue !== 'string') {
this.addError('The value for the "w-bind" attribute should be a string. Actual: ' + componentModule);
return;
}
let requirePath = bindAttr.literalValue;
let filename = resolveFrom(this.dirname, requirePath);
if (!filename) {
this.addError('Target file not found: ' + requirePath + ' (from: ' + this.dirname + ')');
return;
}
componentModule = {
requirePath: bindAttr.literalValue
legacy: true,
filename,
requirePath
};
} else {
// This is a dynamic expression. The <component-types> should have been found.
// This is a dynamic expression. The <widget-types> should have been found.
if (!hasWidgetTypes) {
this.addError('The <component-types> tag must be used to declare components when the value of the "w-bind" attribute is a dynamic expression.');
this.addError('The <widget-types> tag must be used to declare components when the value of the "w-bind" attribute is a dynamic expression.');
return;
}
@ -170,7 +127,7 @@ module.exports = function handleComponentBind() {
if (context.isFlagSet('hasWidgetTypes')) {
context.addError('The <component-types> tag is no longer supported. See: https://github.com/marko-js/marko/issues/514');
context.addError('The <widget-types> tag is no longer supported. See: https://github.com/marko-js/marko/issues/514');
}
} else {
return;
@ -189,7 +146,8 @@ module.exports = function handleComponentBind() {
var isSplit = false;
if (rendererModule && rendererModule !== componentModule) {
if ((rendererModule && rendererModule !== componentModule) ||
(!rendererModule && componentModule)) {
componentProps.split = isSplit = true;
}
@ -204,7 +162,7 @@ module.exports = function handleComponentBind() {
componentTypeNode = context.addStaticVar(
'marko_componentType',
buildComponentTypeNode(componentModule, this, isSplit));
generateRegisterComponentCode(componentModule, this, isSplit));
componentProps.type = componentTypeNode;
}
@ -253,7 +211,13 @@ module.exports = function handleComponentBind() {
if (this.firstBind) {
this.context.on('beforeGenerateCode:TemplateRoot', function(eventArgs) {
eventArgs.node.addRenderFunctionParam(builder.identifier('__component'));
eventArgs.node.addRenderFunctionParam(builder.identifier('state'));
if (isLegacyComponent) {
eventArgs.node.addRenderFunctionParam(builder.identifier('widget'));
} else {
eventArgs.node.addRenderFunctionParam(builder.identifier('state'));
}
eventArgs.node.generateAssignRenderCode = function(eventArgs) {
let nodes = [];
let templateVar = eventArgs.templateVar;
@ -275,7 +239,7 @@ module.exports = function handleComponentBind() {
builder.memberExpression(transformHelper.markoComponentsVar, builder.identifier('r')),
createRendererArgs)));
if (!isSplit) {
if (!isSplit && !isLegacyComponent) {
nodes.push(builder.assignment(
builder.memberExpression(templateVar, builder.identifier('Component')),
builder.functionCall(

View File

@ -171,7 +171,7 @@ module.exports = function handleRootNodes() {
var fileMatch = '('+filename.replace(/\./g, '\\.') + '\\.' + (isEntry ? '|' : '') + ')';
var styleMatch = new RegExp('^'+fileMatch+'style\\.\\w+$');
var componentMatch = new RegExp('^'+fileMatch+'component\\.\\w+$');
var splitComponentMatch = new RegExp('^'+fileMatch+'component\\.browser\\.\\w+$');
var splitComponentMatch = new RegExp('^'+fileMatch+'component-browser\\.\\w+$');
var templateRoot = this.el;

View File

@ -0,0 +1,65 @@
const tryRequire = require('try-require');
const lassoModulesClientTransport = tryRequire('lasso-modules-client/transport', require);
const ok = require('assert').ok;
function generateRegisterComponentCode(componentModule, transformHelper, isSplit) {
ok(componentModule, '"componentModule" is required');
ok(transformHelper, '"transformHelper" is required');
ok(typeof componentModule.filename === 'string', '"componentModule.filename" should be a string');
ok(typeof transformHelper.dirname === 'string', '"transformHelper.dirname" should be a string');
let context = transformHelper.context;
let builder = context.builder;
let registerComponent = context.addStaticVar('marko_registerComponent',
builder.memberExpression(transformHelper.markoComponentsVar, builder.identifier('rc')));
let typeName = componentModule.filename;
var isLegacy = componentModule.legacy;
if (!isLegacy && !isSplit) {
typeName = transformHelper.filename;
}
if (lassoModulesClientTransport) {
typeName = lassoModulesClientTransport.getClientPath(typeName);
}
let def;
if (componentModule.legacy) {
// This if condition block should be deleted in Marko v5
let returnValue = builder.require(builder.literal(componentModule.requirePath));
let defineComponent = context.addStaticVar('marko_defineWidget',
builder.memberExpression(transformHelper.markoComponentsVar, builder.identifier('w')));
returnValue = builder.functionCall(defineComponent, [returnValue]);
def = builder.functionDeclaration(null, [] /* params */, [
builder.returnStatement(returnValue)
]);
} else if (isSplit) {
let returnValue = builder.require(builder.literal(componentModule.requirePath));
def = builder.functionDeclaration(null, [] /* params */, [
builder.returnStatement(returnValue)
]);
} else {
def = builder.functionDeclaration(null, [], [
builder.returnStatement(
builder.memberExpression(
builder.identifier('module'),
builder.identifier('exports')))
]);
}
return builder.functionCall(registerComponent, [
builder.literal(typeName),
def
]);
}
module.exports = generateRegisterComponentCode;

View File

@ -1,4 +1,6 @@
var getTransformHelper = require('./util/getTransformHelper');
const getTransformHelper = require('./util/getTransformHelper');
const generateRegisterComponentCode = require('./util/generateRegisterComponentCode');
const resolveFrom = require('resolve-from');
module.exports = function codeGenerator(el, codegen) {
var context = codegen.context;
@ -18,7 +20,22 @@ module.exports = function codeGenerator(el, codegen) {
return;
}
typesObject[attr.name] = transformHelper.buildComponentTypeNode(attr.literalValue);
let requirePath = attr.literalValue;
let filename = resolveFrom(transformHelper.dirname, requirePath);
if (!filename) {
transformHelper.addError('Target file not found: ' + requirePath + ' (from: ' + transformHelper.dirname + ')');
return;
}
let componentModule = {
legacy: true,
filename: filename,
requirePath: requirePath
};
typesObject[attr.name] = generateRegisterComponentCode(componentModule, transformHelper, false);
});
codegen.addStaticVar('marko_componentTypes', builder.literal(typesObject));

View File

@ -1,4 +1,5 @@
var domInsert = require('./dom-insert');
var EMPTY_ARRAY = [];
function checkAddedToDOM(result, method) {
if (!result.$__components) {
@ -17,7 +18,7 @@ function getComponentDefs(result) {
function RenderResult(out) {
this.out = this.$__out = out;
this.$__components = null;
this.$__components = undefined;
}
module.exports = RenderResult;
@ -58,6 +59,8 @@ var proto = RenderResult.prototype = {
if (componentsContext) {
this.$__components = componentsContext.$__components;
componentsContext.$__initComponents(doc);
} else {
this.$__components = EMPTY_ARRAY;
}
return this;

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
handleColorClick: function(event, el) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
handleColorMouseOver: function(event, el) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getWidgetConfig: function(input) {

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko')
});

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,6 +1,6 @@
var expect = require('chai').expect;
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialProps: function(input, out) {
var name = input.name;

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function(widgetConfig) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
<div class="bar" w-bind="./component">
<div class="bar" w-bind="./widget">
${data.label}
</div>

View File

@ -1,6 +1,6 @@
var barRenderer = require('./components/app-bar/renderer').render;
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getTemplateData: function(input, out) {
return {

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,6 +1,6 @@
var barRenderer = require('./components/app-bar/renderer').render;
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getTemplateData: function(input, out) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,3 +1,3 @@
// Export a render(input, callback) method that can be used
// to render this UI component on the client or server
require('marko/widgets/legacy').renderable(exports, require('./renderer'));
require('marko/components/legacy').renderable(exports, require('./renderer'));

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getInitialState:function(input){

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getInitialState:function(input){

View File

@ -1,6 +1,6 @@
var expect = require('chai').expect;
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {
},

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getInitialState:function(input){

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getTemplateData: function(state, input) {
return {

View File

@ -18,7 +18,7 @@ module.exports = function(helpers) {
preserveClassBody: widget.el.querySelector('.preserve').innerHTML,
preserveBodyClass: widget.el.querySelector('.preserve-body').getAttribute('data-renderId'),
preserveBodyClassBody: widget.el.querySelector('.preserve-body').innerHTML,
widgetClass: require('marko/widgets').getWidgetForEl(widget.el.querySelector('.widget-no-id')).state.name
widgetClass: require('marko/components/legacy').getWidgetForEl(widget.el.querySelector('.widget-no-id')).state.name
};
}

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {
}

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {

View File

@ -1,3 +1,3 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko')
});

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getValue: function() {

View File

@ -1,6 +1,6 @@
var iframeContentComponent = require('./components/app-iframe-content');
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
renderIntoIframe: function() {

View File

@ -1,6 +1,6 @@
var template = require('marko').load(require.resolve('./template.marko'));
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
createOut: template.createOut,
renderer: function(input, out) {

View File

@ -1,4 +1,6 @@
module.exports = require('marko/widgets/legacy').defineComponent({
require('marko/runtime/vdom');
module.exports = require('marko/components/legacy').defineComponent({
renderer: function(input, out) {
out.text('Hello ' + input.name + '!');
}

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,7 +1,7 @@
var widgetLessRenderer = require('./components/app-widgetless/renderer');
var simpleRenderer = require('./components/app-simple').renderer;
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getTemplateData: function(state, input) {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require('./template.marko'),
init: function() {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

View File

@ -1,4 +1,4 @@
module.exports = require('marko/widgets/legacy').defineComponent({
module.exports = require('marko/components/legacy').defineComponent({
template: require.resolve('./template.marko'),
getInitialState: function(input) {
return {

Some files were not shown because too many files have changed in this diff Show More