revert whitespace changes

pull/2958/head
James Garbutt 6 years ago
parent d22422ca2f
commit 9cc3928b02

@ -21,7 +21,7 @@
"prefer-const": [2, { "destructuring": "all" }], "prefer-const": [2, { "destructuring": "all" }],
"arrow-spacing": 2, "arrow-spacing": 2,
"no-inner-declarations": 0, "no-inner-declarations": 0,
"@typescript-eslint/indent": [2, "tab", { "SwitchCase": 1 }], "@typescript-eslint/indent": ["warn", "tab", { "SwitchCase": 1 }],
"@typescript-eslint/camelcase": "off", "@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/array-type": ["error", "array-simple"], "@typescript-eslint/array-type": ["error", "array-simple"],

@ -372,8 +372,8 @@ export default class Block {
${properties} ${properties}
}; };
`.replace(/(#+)(\w*)/g, (_match: string, sigil: string, name: string) => { `.replace(/(#+)(\w*)/g, (_match: string, sigil: string, name: string) => {
return sigil === '#' ? this.alias(name) : sigil.slice(1) + name; return sigil === '#' ? this.alias(name) : sigil.slice(1) + name;
}); });
} }
render_listeners(chunk: string = '') { render_listeners(chunk: string = '') {

@ -79,8 +79,8 @@ export default function dom(
${$$props} => { ${$$props} => {
${uses_props && component.invalidate('$$props', `$$props = @assign(@assign({}, $$props), $$new_props)`)} ${uses_props && component.invalidate('$$props', `$$props = @assign(@assign({}, $$props), $$new_props)`)}
${writable_props.map(prop => ${writable_props.map(prop =>
`if ('${prop.export_name}' in $$props) ${component.invalidate(prop.name, `${prop.name} = $$props.${prop.export_name}`)};` `if ('${prop.export_name}' in $$props) ${component.invalidate(prop.name, `${prop.name} = $$props.${prop.export_name}`)};`
)} )}
${component.slots.size > 0 && ${component.slots.size > 0 &&
`if ('$$scope' in ${$$props}) ${component.invalidate('$$scope', `$$scope = ${$$props}.$$scope`)};`} `if ('$$scope' in ${$$props}) ${component.invalidate('$$scope', `$$scope = ${$$props}.$$scope`)};`}
} }

@ -312,8 +312,8 @@ export default class EachBlockWrapper extends Wrapper {
block.builders.init.add_block(deindent` block.builders.init.add_block(deindent`
const ${get_key} = ctx => ${ const ${get_key} = ctx => ${
// @ts-ignore todo: probably error // @ts-ignore todo: probably error
this.node.key.render()}; this.node.key.render()};
for (var #i = 0; #i < ${this.vars.each_block_value}.${length}; #i += 1) { for (var #i = 0; #i < ${this.vars.each_block_value}.${length}; #i += 1) {
let child_ctx = ${this.vars.get_each_context}(ctx, ${this.vars.each_block_value}, #i); let child_ctx = ${this.vars.get_each_context}(ctx, ${this.vars.each_block_value}, #i);

@ -213,8 +213,8 @@ export default class IfBlockWrapper extends Wrapper {
block.builders.init.add_block(deindent` block.builders.init.add_block(deindent`
function ${select_block_type}(ctx) { function ${select_block_type}(ctx) {
${this.branches ${this.branches
.map(({ condition, block }) => `${condition ? `if (${condition}) ` : ''}return ${block.name};`) .map(({ condition, block }) => `${condition ? `if (${condition}) ` : ''}return ${block.name};`)
.join('\n')} .join('\n')}
} }
`); `);
@ -292,8 +292,8 @@ export default class IfBlockWrapper extends Wrapper {
function ${select_block_type}(ctx) { function ${select_block_type}(ctx) {
${this.branches ${this.branches
.map(({ condition }, i) => `${condition ? `if (${condition}) ` : ''}return ${i};`) .map(({ condition }, i) => `${condition ? `if (${condition}) ` : ''}return ${i};`)
.join('\n')} .join('\n')}
${!has_else && `return -1;`} ${!has_else && `return -1;`}
} }
`); `);

@ -234,8 +234,8 @@ export default class InlineComponentWrapper extends Wrapper {
if (attribute.dependencies.size > 0) { if (attribute.dependencies.size > 0) {
updates.push(deindent` updates.push(deindent`
if (${[...attribute.dependencies] if (${[...attribute.dependencies]
.map(dependency => `changed.${dependency}`) .map(dependency => `changed.${dependency}`)
.join(' || ')}) ${name_changes}${quote_prop_if_necessary(attribute.name)} = ${attribute.get_value(block)}; .join(' || ')}) ${name_changes}${quote_prop_if_necessary(attribute.name)} = ${attribute.get_value(block)};
`); `);
} }
}); });

@ -141,17 +141,17 @@ export default class WindowWrapper extends Wrapper {
if (bindings.scrollX || bindings.scrollY) { if (bindings.scrollX || bindings.scrollY) {
block.builders.update.add_block(deindent` block.builders.update.add_block(deindent`
if (${ if (${
[bindings.scrollX, bindings.scrollY].filter(Boolean).map( [bindings.scrollX, bindings.scrollY].filter(Boolean).map(
b => `changed.${b}` b => `changed.${b}`
).join(' || ') ).join(' || ')
} && !${scrolling}) { } && !${scrolling}) {
${scrolling} = true; ${scrolling} = true;
clearTimeout(${scrolling_timeout}); clearTimeout(${scrolling_timeout});
window.scrollTo(${ window.scrollTo(${
bindings.scrollX ? `ctx.${bindings.scrollX}` : `window.pageXOffset` bindings.scrollX ? `ctx.${bindings.scrollX}` : `window.pageXOffset`
}, ${ }, ${
bindings.scrollY ? `ctx.${bindings.scrollY}` : `window.pageYOffset` bindings.scrollY ? `ctx.${bindings.scrollY}` : `window.pageYOffset`
}); });
${scrolling_timeout} = setTimeout(${clear_scrolling}, 100); ${scrolling_timeout} = setTimeout(${clear_scrolling}, 100);
} }
`); `);

Loading…
Cancel
Save