Add ignore of PolymerElement super class node on custom-element analysis #238
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.
Analysis of Polymer custom components reports Polymer super class related properties and functions.
The pull request adds ignore of this super class to get only component defined properties and function like with Polymer provided tooling.
Example of analyzed source
Markdown result with pull request code
polymer-test2
Properties
testPloptest-plopstringtestPlopptest-ploppnumberEvents
test-eventMarkdown result without pull request code
polymer-test2
Mixins: ElementMixin
Properties
${ [key: string]: Element; }PROPERTY_EFFECT_TYPESimportPathstringrootHTMLElement | StampedTemplate | ShadowRoot | nullrootPathstringtestPloptest-plopstringtestPlopptest-ploppnumberMethods
addPropertyEffect(property: string, type: string, effect?: object | null | undefined): voidto a list of "property effects" that will run when the accessor for
the specified property is set. Effects are grouped by "type", which
roughly corresponds to a phase in effect processing. The effect
metadata should be in the following form:
{
fn: effectFunction, // Reference to function to call to perform effect
info: { ... } // Effect metadata passed to function
trigger: { // Optional triggering metadata; if not provided
name: string // the property is treated as a wildcard
structured: boolean
wildcard: boolean
}
}
Effects are called from
_propertiesChangedin the following order bytype:
1. COMPUTE
2. PROPAGATE
3. REFLECT
4. OBSERVE
5. NOTIFY
Effect functions are called with the following signature:
effectFunction(inst, path, props, oldProps, info, hasPaths)
property: Property that should trigger the effect
type: Effect type, from this.PROPERTY_EFFECT_TYPES
effect: Effect metadata object
attributeNameForProperty(property: string): stringBy default, converts camel to dash case, e.g.
fooBartofoo-bar.property: Property to convert
bindTemplate(template: HTMLTemplateElement): TemplateInfofor them, and then ensures property accessors are created for any
dependent properties in the template. Binding effects for bound
templates are stored in a linked list on the instance so that
templates can be efficiently stamped and unstamped.
template: Template containing binding
bindings
createComputedProperty(property: string, expression: string, dynamicFn?: boolean | object | null | undefined): voidmethod described by the given
expressioneach time one or morearguments to the method changes. The expression should be a string
in the form of a normal JavaScript function signature:
'methodName(arg1, [..., argn])'property: Name of computed property to set
expression: Method expression
dynamicFn: Boolean or object map indicating whether
method names should be included as a dependency to the effect.
createMethodObserver(expression: string, dynamicFn?: boolean | object | null | undefined): voidexpression, which should be a string in the form of a normal JavaScript
function signature:
'methodName(arg1, [..., argn])'. Each argumentshould correspond to a property or path in the context of this
prototype (or instance), or may be a literal string or number.
expression: Method expression
dynamicFn: Boolean or object map indicating
createNotifyingProperty(property: string): void<property>-changedevents to notify of changes to the property.
property: Property name
createObservers(observers: object | null, dynamicFns: object | null): voidobserversarray.Leverages
PropertyEffectsto create observers.observers: Array of observer descriptors for
this class
dynamicFns: Object containing keys for any properties
that are functions and should trigger the effect when the function
reference is changed
createProperties(props: object): voidand property effects for all of the properties.
props: .
createPropertiesForAttributes(): voidstatic
observedAttributesarray.Attribute names are mapped to property names using the
dash-casetocamelCaseconventioncreatePropertyObserver(property: string, method: string | ((p0: any, p1: any): any), dynamicFn?: boolean | undefined) => voidproperty: Property name
method: Function or name of observer method to call
dynamicFn: Whether the method name should be included as
a dependency to the effect.
createReadOnlyProperty(property: string, protectedSetter?: boolean | undefined): voidTo set the property, use the protected
_setPropertyAPI.To create a custom protected setter (e.g.
_setMyProp()forproperty
myProp), passtrueforprotectedSetter.Note, if the property will have other property effects, this method
should be called first, before adding other effects.
property: Property name
protectedSetter: Creates a custom protected setter
when
true.createReflectedProperty(property: string): voidto a (dash-cased) attribute of the same name.
property: Property name
finalize(): voidare also finalized. This includes ensuring property
accessors exist on the element prototype. This method calls
_finalizeClassto finalize each constructor in the prototype chain.get(path: string | (string | number)[], root?: object | null | undefined): anyNote, if any part in the path is undefined, this method returns
undefined(this method does not throw when dereferencing undefinedpaths).
path: Path to the value
to read. The path may be specified as a string (e.g.
foo.bar.baz)or an array of path parts (e.g.
['foo.bar', 'baz']). Note thatbracketed expressions are not supported; string-based path parts
must be separated by dots. Note that when dereferencing array
indices, the index may be used as a dotted part directly
(e.g.
users.12.nameor['users', 12, 'name']).root: Root object from which the path is evaluated.
linkPaths(to: string | (string | number)[], from: string | (string | number)[]): voidare routed to the other.
to: Target path to link.
from: Source path to link.
notifyPath(path: string, value?: any): voidExample:
this.item.user.name = 'Bob';
this.notifyPath('item.user.name');
path: Path that should be notified.
value: Value at the path (optional).
notifySplices(path: string, splices: any[] | null): voidExample:
this.items = [ {name: 'Jim'}, {name: 'Todd'}, {name: 'Bill'} ];
...
this.items.splice(1, 1, {name: 'Sam'});
this.items.push({name: 'Bob'});
this.notifySplices('items', [
{ index: 1, removed: [{name: 'Todd'}], addedCount: 1,
object: this.items, type: 'splice' },
{ index: 3, removed: [], addedCount: 1,
object: this.items, type: 'splice'}
]);
path: Path that should be notified.
splices: Array of splice records indicating ordered
changes that occurred to the array. Each record should have the
following fields:
* index: index at which the change occurred
* removed: array of items that were removed from this index
* addedCount: number of new items added at this index
* object: a reference to the array in question
* type: the string literal 'splice'
Note that splice records must be normalized such that they are
reported in index order (raw results from
Object.observeare notordered and must be normalized/merged before notifying).
pop(path: string | (string | number)[]): anyThe arguments after
pathand return value match that ofArray.prototype.pop.This method notifies other paths to the same array that a
splice occurred to the array.
path: Path to array.
push(path: string | (string | number)[], ...items: any[]): numberThe arguments after
pathand return value match that ofArray.prototype.push.This method notifies other paths to the same array that a
splice occurred to the array.
path: Path to array.
items: Items to push onto array
ready(): voidresolveUrl(url: string, base?: string | undefined): stringthe original location of the document containing the
dom-moduleforthis element. This method will return the same URL before and after
bundling.
Note that this function performs no resolution for URLs that start
with
/(absolute URLs) or#(hash identifiers). For general purposeURL resolution, use
window.URL.url: URL to resolve.
base: Optional base URL to resolve against, defaults
to the element's
importPathset(path: string | (string | number)[], value: any, root?: object | null | undefined): voidelements bound to the same path.
Note, if any part in the path except for the last is undefined,
this method does nothing (this method does not throw when
dereferencing undefined paths).
path: Path to the value
to write. The path may be specified as a string (e.g.
'foo.bar.baz')or an array of path parts (e.g.
['foo.bar', 'baz']). Note thatbracketed expressions are not supported; string-based path parts
must be separated by dots. Note that when dereferencing array
indices, the index may be used as a dotted part directly
(e.g.
'users.12.name'or['users', 12, 'name']).value: Value to set at the specified path.
root: Root object from which the path is evaluated.
When specified, no notification will occur.
setProperties(props: object | null, setReadOnly?: boolean | undefined): voidsynchronously processes all effects of the properties as a batch.
Property names must be simple properties, not paths. Batched
path propagation is not supported.
props: Bag of one or more key-value pairs whose key is
a property and value is the new value to set for that property.
setReadOnly: When true, any private values set in
propswill be set. By default,setPropertieswill not setreadOnly: trueroot properties.shift(path: string | (string | number)[]): anyThe arguments after
pathand return value match that ofArray.prototype.pop.This method notifies other paths to the same array that a
splice occurred to the array.
path: Path to array.
splice(path: string | (string | number)[], start: number, deleteCount?: number | undefined, ...items: any[]): any[]from the array and inserts 0 or more new items in their place.
The arguments after
pathand return value match that ofArray.prototype.splice.This method notifies other paths to the same array that a
splice occurred to the array.
path: Path to array.
start: Index from which to start removing/inserting.
deleteCount: Number of items to remove.
items: Items to insert into array.
typeForProperty(name: string): voida given property.
name: Name of property
unlinkPaths(path: string | (string | number)[]): void_linkPaths.Note, the path to unlink should be the target (
to) used whenlinking the paths.
path: Target path to unlink.
unshift(path: string | (string | number)[], ...items: any[]): numberThe arguments after
pathand return value match that ofArray.prototype.push.This method notifies other paths to the same array that a
splice occurred to the array.
path: Path to array.
items: Items to insert info array
updateStyles(properties?: object | null | undefined): voidshimmed styles in this element (and its subtree) to be updated
based on current custom property values.
The optional parameter overrides inline custom property styles with an
object of properties where the keys are CSS properties, and the values
are strings.
Example:
this.updateStyles({'--color': 'blue'})These properties are retained unless a value of
nullis set.Note: This function does not support updating CSS mixins.
You can not dynamically change the value of an
@apply.properties: Bag of custom property key/values to
apply to this element.
Events
test-event