docs(specs): add codegen RFC
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
f21562c555
commit
33d9e0c516
1 changed files with 34 additions and 0 deletions
34
specs/codegen/RFC.md
Normal file
34
specs/codegen/RFC.md
Normal file
|
|
@ -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")
|
||||||
Loading…
Add table
Reference in a new issue