-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2198 from Polymer/style-sharing
Refines how element styles are marshaled for custom elements
- Loading branch information
Showing
13 changed files
with
199 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
|
||
<title></title> | ||
|
||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<script src="../../../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<link rel="import" href="../../../polymer.html"> | ||
<link rel="import" href="shared-styles.html"> | ||
<link rel="import" href="x-foo.html"> | ||
</head> | ||
<body unresolved> | ||
|
||
<style is="custom-style" module="shared-styles"></style> | ||
|
||
<style is="custom-style"> | ||
.zot { | ||
background-color: var(--zot); | ||
} | ||
</style> | ||
|
||
<div class="bar">.bar from custom-style with module shared-styles</div> | ||
<div class="foo">.foo should not be colored</div> | ||
<div class="zot">.zot from custom-style using var in custom-style with module shared-styles</div> | ||
|
||
<hr> | ||
|
||
<x-foo></x-foo> | ||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<dom-module id="shared-styles"> | ||
<style type="polymer"> | ||
.bar { | ||
background-color: steelblue; | ||
} | ||
|
||
:root { | ||
--zot: seagreen; | ||
} | ||
</style> | ||
</dom-module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<link rel="import" href="shared-styles.html"> | ||
|
||
<dom-module id="x-foo"> | ||
<template> | ||
<style module="shared-styles"></style> | ||
<style> | ||
.foo { | ||
background-color: tomato; | ||
} | ||
|
||
:host { | ||
display: block; | ||
border: 1px dashed orange; | ||
padding: 4px; | ||
} | ||
|
||
.zot { | ||
background-color: var(--zot); | ||
} | ||
</style> | ||
<h4>x-foo</h4> | ||
<div class="bar">.bar from shared-styles.html</div> | ||
<div class="foo">.foo from local stylesheet</div> | ||
<div class="zot">.zot from var in shared-styles.html</div> | ||
</template> | ||
<script> | ||
Polymer({ | ||
|
||
}); | ||
</script> | ||
</dom-module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
<style is="custom-style"> | ||
:root { | ||
<dom-module id="shared-style"> | ||
<template> | ||
<style> | ||
:root { | ||
--import-var: 3px solid orange; | ||
} | ||
</style> | ||
</template> | ||
</dom-module> | ||
|
||
<link rel="import" href="sub/style-import.html"> | ||
|
||
--import-var: 3px solid orange; | ||
<style is="custom-style" include="shared-style style-import"> | ||
:root { | ||
|
||
--import-mixin: { | ||
border: 4px solid blue; | ||
}; | ||
|
||
padding: 10px; | ||
} | ||
</style> | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<dom-module id="style-import"> | ||
<template> | ||
<style> | ||
.foo { | ||
height: 2px; | ||
border: 1px solid orange; | ||
background: url(google.png); | ||
} | ||
</style> | ||
</template> | ||
</dom-module> |