Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: import inline styles #843

Merged
merged 11 commits into from
Nov 19, 2018
Merged

fix: import inline styles #843

merged 11 commits into from
Nov 19, 2018

Conversation

diervo
Copy link
Contributor

@diervo diervo commented Nov 16, 2018

Details

Allow import for inline styles.

buffer += ` };\n`;
buffer += `}`;
buffer += 'if (_implicitStylesheets) {\n';
buffer += ` tmpl.stylesheets ? tmpl.stylesheets.push(_implicitStylesheets) : tmpl.stylesheets = [_implicitStylesheets]\n`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding that here, what about always adding the stylesheet property in the produced template to avoid the branching here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea

buffer += ` tmpl.stylesheets ? tmpl.stylesheets.push(_implicitStylesheets) : tmpl.stylesheets = [_implicitStylesheets]\n`;
buffer += `}\n`;

buffer += `tmpl.stylesheetTokens = {\n`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't the template compiler in charge of attaching those properties? Why should it be the compiler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't change the attaching on the properties...
A it can' because the implicit css we already had.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok no problem.

@@ -101,28 +82,24 @@ export function resetStyleAttributes(vm: VM): void {
/**
* Apply/Update the styling token applied to the host element.
*/
export function applyStyleAttributes(vm: VM, stylesheet: Stylesheet): void {
export function applyStyleAttributes(vm: VM, hostAttribute, shadowAttribute): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing types

Diego Ferreiro Val and others added 2 commits November 17, 2018 20:14
before the output didnt include:

  tmpl.stylesheets = [];
  tmpl.stylesheetTokens = {
    hostAttribute: "x-foo_foo-host",
    shadowAttribute: "x-foo_foo"
  };
@jodarove
Copy link
Contributor

@diervo fixed the sourcemap test, was failing cause of a shift (5 lines).

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a16b399 | Target commit: 50d7819

lwc-engine-benchmark

table-append-1k metric base(a16b399) target(50d7819) trend
benchmark-table/append/1k duration 150.10 (±4.35 ms) 153.65 (±4.45 ms) +3.6ms (2.4%) 👌
table-clear-1k metric base(a16b399) target(50d7819) trend
benchmark-table/clear/1k duration 5.90 (±0.30 ms) 6.50 (±0.30 ms) +0.6ms (10.2%) 👎
table-create-10k metric base(a16b399) target(50d7819) trend
benchmark-table/create/10k duration 867.30 (±6.70 ms) 875.80 (±6.30 ms) +8.5ms (1.0%) 👎
table-create-1k metric base(a16b399) target(50d7819) trend
benchmark-table/create/1k duration 117.00 (±2.10 ms) 119.40 (±2.85 ms) +2.4ms (2.1%) 👎
table-update-10th-1k metric base(a16b399) target(50d7819) trend
benchmark-table/update-10th/1k duration 87.30 (±3.00 ms) 77.65 (±3.35 ms) -9.7ms (11.1%) 👍
tablecmp-append-1k metric base(a16b399) target(50d7819) trend
benchmark-table-component/append/1k duration 252.25 (±6.00 ms) 261.15 (±5.70 ms) +8.9ms (3.5%) 👎
tablecmp-clear-1k metric base(a16b399) target(50d7819) trend
benchmark-table-component/clear/1k duration 12.00 (±1.65 ms) 12.90 (±2.15 ms) +0.9ms (7.5%) 👌
tablecmp-create-10k metric base(a16b399) target(50d7819) trend
benchmark-table-component/create/10k duration 1740.05 (±9.95 ms) 1757.75 (±10.70 ms) +17.7ms (1.0%) 👎
tablecmp-create-1k metric base(a16b399) target(50d7819) trend
benchmark-table-component/create/1k duration 206.25 (±5.20 ms) 209.85 (±6.25 ms) +3.6ms (1.7%) 👎
tablecmp-update-10th-1k metric base(a16b399) target(50d7819) trend
benchmark-table-component/update-10th/1k duration 72.30 (±6.45 ms) 69.20 (±5.35 ms) -3.1ms (4.3%) 👍
wc-append-1k metric base(a16b399) target(50d7819) trend
benchmark-table-wc/append/1k duration 249.95 (±14.80 ms) 249.65 (±14.65 ms) -0.3ms (0.1%) 👌
wc-clear-1k metric base(a16b399) target(50d7819) trend
benchmark-table-wc/clear/1k duration 22.20 (±2.40 ms) 22.45 (±2.15 ms) +0.3ms (1.1%) 👌
wc-create-10k metric base(a16b399) target(50d7819) trend
benchmark-table-wc/create/10k duration 1788.30 (±26.55 ms) 1835.30 (±29.90 ms) +47.0ms (2.6%) 👎
wc-create-1k metric base(a16b399) target(50d7819) trend
benchmark-table-wc/create/1k duration 220.20 (±4.25 ms) 226.70 (±4.05 ms) +6.5ms (3.0%) 👎
wc-update-10th-1k metric base(a16b399) target(50d7819) trend
benchmark-table-wc/update-10th/1k duration 72.30 (±5.55 ms) 75.40 (±5.65 ms) +3.1ms (4.3%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a16b399 | Target commit: cb0faa1

lwc-engine-benchmark

table-append-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table/append/1k duration 150.10 (±4.35 ms) 152.75 (±3.90 ms) +2.7ms (1.8%) 👎
table-clear-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table/clear/1k duration 5.90 (±0.30 ms) 6.60 (±0.40 ms) +0.7ms (11.9%) 👎
table-create-10k metric base(a16b399) target(cb0faa1) trend
benchmark-table/create/10k duration 867.30 (±6.70 ms) 889.60 (±6.10 ms) +22.3ms (2.6%) 👎
table-create-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table/create/1k duration 117.00 (±2.10 ms) 118.70 (±2.80 ms) +1.7ms (1.5%) 👎
table-update-10th-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table/update-10th/1k duration 87.30 (±3.00 ms) 77.25 (±2.75 ms) -10.1ms (11.5%) 👍
tablecmp-append-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table-component/append/1k duration 252.25 (±6.00 ms) 258.15 (±7.55 ms) +5.9ms (2.3%) 👎
tablecmp-clear-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table-component/clear/1k duration 12.00 (±1.65 ms) 13.70 (±2.00 ms) +1.7ms (14.2%) 👎
tablecmp-create-10k metric base(a16b399) target(cb0faa1) trend
benchmark-table-component/create/10k duration 1740.05 (±9.95 ms) 1735.90 (±12.10 ms) -4.1ms (0.2%) 👌
tablecmp-create-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table-component/create/1k duration 206.25 (±5.20 ms) 209.20 (±6.20 ms) +2.9ms (1.4%) 👌
tablecmp-update-10th-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table-component/update-10th/1k duration 72.30 (±6.45 ms) 72.75 (±5.30 ms) +0.5ms (0.6%) 👌
wc-append-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table-wc/append/1k duration 249.95 (±14.80 ms) 250.90 (±12.75 ms) +1.0ms (0.4%) 👌
wc-clear-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table-wc/clear/1k duration 22.20 (±2.40 ms) 23.20 (±2.25 ms) +1.0ms (4.5%) 👌
wc-create-10k metric base(a16b399) target(cb0faa1) trend
benchmark-table-wc/create/10k duration 1788.30 (±26.55 ms) 1828.15 (±42.60 ms) +39.9ms (2.2%) 👎
wc-create-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table-wc/create/1k duration 220.20 (±4.25 ms) 223.50 (±5.95 ms) +3.3ms (1.5%) 👎
wc-update-10th-1k metric base(a16b399) target(cb0faa1) trend
benchmark-table-wc/update-10th/1k duration 72.30 (±5.55 ms) 75.60 (±4.65 ms) +3.3ms (4.6%) 👌

@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: 2906ed8 | Target commit: 8482194

lwc-engine-benchmark

table-append-1k metric base(2906ed8) target(8482194) trend
benchmark-table/append/1k duration 150.60 (±5.20 ms) 155.80 (±4.90 ms) +5.2ms (3.5%) 👎
table-clear-1k metric base(2906ed8) target(8482194) trend
benchmark-table/clear/1k duration 6.45 (±0.55 ms) 6.70 (±0.30 ms) +0.3ms (3.9%) 👎
table-create-10k metric base(2906ed8) target(8482194) trend
benchmark-table/create/10k duration 881.80 (±7.35 ms) 880.20 (±5.20 ms) -1.6ms (0.2%) 👌
table-create-1k metric base(2906ed8) target(8482194) trend
benchmark-table/create/1k duration 118.70 (±2.85 ms) 118.60 (±3.15 ms) -0.1ms (0.1%) 👌
table-update-10th-1k metric base(2906ed8) target(8482194) trend
benchmark-table/update-10th/1k duration 79.80 (±3.45 ms) 77.05 (±2.40 ms) -2.7ms (3.4%) 👍
tablecmp-append-1k metric base(2906ed8) target(8482194) trend
benchmark-table-component/append/1k duration 254.65 (±6.55 ms) 260.15 (±6.20 ms) +5.5ms (2.2%) 👎
tablecmp-clear-1k metric base(2906ed8) target(8482194) trend
benchmark-table-component/clear/1k duration 12.55 (±1.20 ms) 13.20 (±1.45 ms) +0.6ms (5.2%) 👌
tablecmp-create-10k metric base(2906ed8) target(8482194) trend
benchmark-table-component/create/10k duration 1732.25 (±12.55 ms) 1715.10 (±16.45 ms) -17.2ms (1.0%) 👍
tablecmp-create-1k metric base(2906ed8) target(8482194) trend
benchmark-table-component/create/1k duration 210.40 (±6.15 ms) 208.65 (±5.40 ms) -1.8ms (0.8%) 👌
tablecmp-update-10th-1k metric base(2906ed8) target(8482194) trend
benchmark-table-component/update-10th/1k duration 73.85 (±7.10 ms) 74.45 (±5.65 ms) +0.6ms (0.8%) 👌
wc-append-1k metric base(2906ed8) target(8482194) trend
benchmark-table-wc/append/1k duration 257.95 (±7.75 ms) 264.35 (±6.35 ms) +6.4ms (2.5%) 👎
wc-clear-1k metric base(2906ed8) target(8482194) trend
benchmark-table-wc/clear/1k duration 23.05 (±2.85 ms) 23.40 (±1.80 ms) +0.3ms (1.5%) 👌
wc-create-10k metric base(2906ed8) target(8482194) trend
benchmark-table-wc/create/10k duration 1822.45 (±51.05 ms) 1841.60 (±40.60 ms) +19.1ms (1.1%) 👌
wc-create-1k metric base(2906ed8) target(8482194) trend
benchmark-table-wc/create/1k duration 223.45 (±5.25 ms) 225.05 (±5.35 ms) +1.6ms (0.7%) 👌
wc-update-10th-1k metric base(2906ed8) target(8482194) trend
benchmark-table-wc/update-10th/1k duration 76.05 (±6.00 ms) 73.45 (±6.75 ms) -2.6ms (3.4%) 👌

@diervo
Copy link
Contributor Author

diervo commented Nov 19, 2018

Merging since all compat failures are flappers...

@diervo diervo merged commit c9d1809 into master Nov 19, 2018
@diervo diervo deleted the dval/fixInlineStyles branch November 19, 2018 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants