From 55708acf8daac5bf33630b5ab02d7cb891654802 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 13 Feb 2018 14:50:12 +0100 Subject: [PATCH 1/2] Fix issue with not genering the Templatizer docs --- lib/utils/templatize.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/utils/templatize.html b/lib/utils/templatize.html index 9d72b4547e..1b6dd044b0 100644 --- a/lib/utils/templatize.html +++ b/lib/utils/templatize.html @@ -416,8 +416,7 @@ * @summary Module for preparing and stamping instances of templates * utilizing Polymer templating features. */ - - const Templatize = { + Polymer.Templatize = { /** * Returns an anonymous `Polymer.PropertyEffects` class bound to the @@ -571,7 +570,6 @@ } }; - Polymer.Templatize = Templatize; Polymer.TemplateInstanceBase = TemplateInstanceBase; })(); From 63e7bbc7e1322de5687a92ce8c269b2cc7290204 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Thu, 15 Feb 2018 11:51:11 +0100 Subject: [PATCH 2/2] Update types --- types/lib/utils/templatize.d.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/types/lib/utils/templatize.d.ts b/types/lib/utils/templatize.d.ts index 617c14ec2f..370ff7b4d2 100644 --- a/types/lib/utils/templatize.d.ts +++ b/types/lib/utils/templatize.d.ts @@ -83,6 +83,39 @@ declare namespace templateInfo { declare namespace Polymer { + /** + * Module for preparing and stamping instances of templates that utilize + * Polymer's data-binding and declarative event listener features. + * + * Example: + * + * // Get a template from somewhere, e.g. light DOM + * let template = this.querySelector('template'); + * // Prepare the template + * let TemplateClass = Polymer.Templatize.templatize(template); + * // Instance the template with an initial data model + * let instance = new TemplateClass({myProp: 'initial'}); + * // Insert the instance's DOM somewhere, e.g. element's shadow DOM + * this.shadowRoot.appendChild(instance.root); + * // Changing a property on the instance will propagate to bindings + * // in the template + * instance.myProp = 'new value'; + * + * The `options` dictionary passed to `templatize` allows for customizing + * features of the generated template class, including how outer-scope host + * properties should be forwarded into template instances, how any instance + * properties added into the template's scope should be notified out to + * the host, and whether the instance should be decorated as a "parent model" + * of any event handlers. + * + * // Customize property forwarding and event model decoration + * let TemplateClass = Polymer.Templatize.templatize(template, this, { + * parentModel: true, + * forwardHostProp(property, value) {...}, + * instanceProps: {...}, + * notifyInstanceProp(instance, property, value) {...}, + * }); + */ namespace Templatize {