diff --git a/specs/codegen/RFC.md b/specs/codegen/RFC.md new file mode 100644 index 0000000..dfd1114 --- /dev/null +++ b/specs/codegen/RFC.md @@ -0,0 +1,34 @@ +# codegen +**Import:** `dappco.re/go/core/html/codegen` +**Files:** 2 + +## Types + +None. + +## Functions + +### `GenerateBundle` +`func GenerateBundle(slots map[string]string) (string, error)` + +GenerateBundle produces all WC class definitions and registrations +for a set of HLCRF slot assignments. +Usage example: js, err := GenerateBundle(map[string]string{"H": "nav-bar"}) + +### `GenerateClass` +`func GenerateClass(tag, slot string) (string, error)` + +GenerateClass produces a JS class definition for a custom element. +Usage example: js, err := GenerateClass("nav-bar", "H") + +### `GenerateRegistration` +`func GenerateRegistration(tag, className string) string` + +GenerateRegistration produces the customElements.define() call. +Usage example: js := GenerateRegistration("nav-bar", "NavBar") + +### `TagToClassName` +`func TagToClassName(tag string) string` + +TagToClassName converts a kebab-case tag to PascalCase class name. +Usage example: className := TagToClassName("nav-bar")