Description
This would allow easier integration with FASTElement.
Solution
Using declarative templates
import { declarativeTemplate } from "@microsoft/fast-element/declarative.js";
class MyComponent extends FASTElement { }
MyComponent.define({
name: "my-component",
template: declarativeTemplate(), // returns a Promise<ViewTemplate>
});
Using declarative templates with Observer Maps
import { declarativeTemplate } from "@microsoft/fast-element/declarative.js";
import { observerMap } from "@microsoft/fast-element/augments/observer-map.js";
class MyComponent extends FASTElement { }
MyComponent.define({
name: "my-component",
template: declarativeTemplate(),
},
// code augmentations that are typically complex and have an opt-out style
// such as implicitly decorating a custom elements class for observation
// exist as a new additional argument to the .define call
[
observerMap() // with declarative templates this will auto generate the JSON schema
]);
Using html tag template with Observer Maps
import { observerMap } from "@microsoft/fast-element/augments/observer-map.js";
class MyComponent extends FASTElement { }
MyComponent.define({
name: "my-component",
template: html`<div>${(x) => x.a}</div>`,
},
[
observerMaps({ schemas: {
"a": {}
}}) // add JSON schemas manually since we cannot scan the html tag template
]);
Description
This would allow easier integration with
FASTElement.Solution
Using declarative templates
Using declarative templates with Observer Maps
Using html tag template with Observer Maps