-
Notifications
You must be signed in to change notification settings - Fork 2k
0.8 property config #1256
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
Merged
Merged
0.8 property config #1256
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fa4ebf6
support `propertyConfig` object in lieu of `published`, `bind`, `comp…
8563c19
Merge branch '0.8-preview' into 0.8-property-config
kevinpschaaf 7005e75
Merge branch '0.8-preview' of github.com:Polymer/polymer into 0.8-pro…
kevinpschaaf bee4ee4
Add computed to propertyConfig, rename bind->observers. Remove publis…
kevinpschaaf ea0aa4a
Add propertyConfig:value support.
kevinpschaaf f3fef23
Don't re-deserialize reflected attributes. Add attribute tests.
kevinpschaaf ca0953c
Merge branch '0.8-preview' into 0.8-property-config
kevinpschaaf 0158c79
Rename propertyConfig -> properties.
kevinpschaaf f57cf69
Remove example file.
kevinpschaaf 9f58b18
Rename property-config.html -> properties.html
kevinpschaaf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
|
||
is: 'x-custom', | ||
|
||
published: { | ||
properties: { | ||
user: String | ||
}, | ||
|
||
|
This file contains hidden or 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 hidden or 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,159 @@ | ||
<script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete this file. |
||
|
||
Polymer({ | ||
|
||
is: 'core-image', | ||
|
||
properties: { | ||
|
||
// Public properties | ||
|
||
propertyName: { // Information about properties | ||
type: String, // Type to use when deserializing attribute | ||
notify: true, // Whether or not to send <propertyName>-changed event | ||
readOnly: true, // Setter is no op, must use private _setPropertyName setter | ||
value: 'foo', // Default value; may also be function that returns value | ||
computed: 'computeFn(dep1, dep2)', // Function that computes this value based on dependencies | ||
observer: 'propertyChanged' // Function to call upon changed | ||
}, | ||
|
||
src: { | ||
type: String, | ||
value: '', | ||
observer: 'srcChanged' | ||
}, | ||
|
||
preventLoad: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
|
||
sizing: { | ||
type: String, | ||
value: null | ||
}, | ||
|
||
position: { | ||
type: String, | ||
value: 'center' | ||
}, | ||
|
||
preload: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
|
||
placeholder: { | ||
type: String, | ||
value: null | ||
}, | ||
|
||
fade: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
|
||
loaded: { | ||
type: Boolean, | ||
notify: true, | ||
readOnly: true, | ||
value: false | ||
}, | ||
|
||
loading: { | ||
type: Boolean, | ||
notify: true, | ||
readOnly: true, | ||
value: false | ||
}, | ||
|
||
width: { | ||
type: Number, | ||
value: null, | ||
observer: 'widthChanged' | ||
}, | ||
|
||
height: { | ||
type: Number, | ||
value: null, | ||
observer: 'heightChanged' | ||
}, | ||
|
||
someObject: { | ||
type: Object, | ||
notify: true, | ||
value: function() { return {}; } | ||
}, | ||
|
||
// Private properties | ||
|
||
imageClassName: { | ||
computed: 'computeImageClassName(sizing)' | ||
}, | ||
|
||
placeholderClassName: { | ||
computed: 'computePlaceholderClassName(fade,loaded,preload)' | ||
}, | ||
|
||
placeholderBackgroundUrl: { | ||
computed: 'computePlaceholderBackgroundUrl(preload,placeholder)' | ||
}, | ||
|
||
requiresPreload: { | ||
computed: 'computeRequiresPreload(preload,loaded)' | ||
}, | ||
|
||
canLoad: { | ||
computed: 'computeCanLoad(preventLoad,src)' | ||
} | ||
|
||
}, | ||
|
||
observers: { | ||
'sizing position': 'transformChanged', | ||
'canLoad preload loaded': 'loadBehaviorChanged', | ||
'src preload loaded': 'loadStateChanged', | ||
'items.*': 'itemStuffChanged' | ||
} | ||
|
||
}); | ||
|
||
Polymer({ | ||
|
||
properties: { | ||
|
||
propertyName: { // Information about properties | ||
type: String, // Type to use when deserializing attribute | ||
notify: true, // Whether or not to send <propertyName>-changed event | ||
readOnly: true, // Setter is no op, must use private _setPropertyName setter | ||
|
||
value: 'foo', // Default value; may also be function that returns value | ||
// value: function(inputs) { return ... }, | ||
// noInitialObserver: true, | ||
computed: 'computeFn(dep1, dep2)', // Function that computes this value based on dependencies | ||
observer: 'propertyChanged' // Function to call upon changed | ||
} | ||
|
||
}, | ||
|
||
observers: { | ||
'dep1 dep2': 'dependenciesChanged', | ||
'object.path.*': 'pathChanged' | ||
}, | ||
|
||
listeners: { | ||
'click': 'clickHandler' | ||
}, | ||
|
||
configure: function(inputs) { | ||
return { | ||
propertyName: 'default1', | ||
propertyName2: 'default2' | ||
}; | ||
} | ||
|
||
}); | ||
|
||
|
||
</script> | ||
|
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's name this properties.html