htmlelements

package
v0.0.0-...-4160af8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package htmlelements contain code to help generate code for implementing the different subclasses of HTMLElement, in the browser/html package.

This includes - IDL attributes

Index

Constants

This section is empty.

Variables

View Source
var HTMLAnchorElementSpecs = HTMLGeneratorReq{
	InterfaceName:      "HTMLAnchorElement",
	SpecName:           "html",
	GenerateInterface:  true,
	GenerateAttributes: true,
}
View Source
var URLSpec = HTMLGeneratorReq{
	InterfaceName:     "URL",
	SpecName:          "url",
	GenerateInterface: true,
}

Functions

func CreateGenerator

func CreateGenerator(req HTMLGeneratorReq) (baseGenerator, error)

func CreateHTMLElementGenerator

func CreateHTMLElementGenerator(req HTMLGeneratorReq) (htmlElementGenerator, error)

CreateHTMLElementGenerator creates a generator for the element with

func GenerateDOMTypes

func GenerateDOMTypes() error

func GenerateHTMLElements

func GenerateHTMLElements() error

Types

type FileGeneratorSpec

type FileGeneratorSpec struct {
	Name      string
	Package   string
	Generator g.Generator
}

func CreateDOMGenerators

func CreateDOMGenerators() ([]FileGeneratorSpec, error)

func CreateHTMLElementGenerators

func CreateHTMLElementGenerators() ([]FileGeneratorSpec, error)

type HTMLGeneratorReq

type HTMLGeneratorReq struct {
	InterfaceName       string
	SpecName            string
	GenerateStruct      bool
	GenerateConstructor bool
	GenerateInterface   bool
	GenerateAttributes  bool
}

HTMLGeneratorReq specifies what to generate for a specific Web IDL spec. The name of the spec is in the SpecName field, and the interface to generate is in the Interface field. The Generate... fields specify what to generate.

Note: As more needs for customisation arises, so will the Generate... fields also more likely become more complex.

E.g., the URL type is loaded from url.json, and has the interface name URL in the idl, so this is specified by:

HTMLGeneratorReq {
	InterfaceName: "URL",
	SpecName:      "url",
}

type IDLAttribute

type IDLAttribute struct {
	AttributeName string
	Receiver      Receiver
	ReadOnly      bool
}

func (IDLAttribute) Generate

func (a IDLAttribute) Generate() *jen.Statement

type IdlInterface

type IdlInterface struct {
	Name       string
	Inherits   string
	Attributes []IdlInterfaceAttribute
	Operations []IdlInterfaceOperation
}

func (IdlInterface) Generate

func (i IdlInterface) Generate() *jen.Statement

type IdlInterfaceAttribute

type IdlInterfaceAttribute struct {
	Name     string
	ReadOnly bool
}

func NewStringAttribute

func NewStringAttribute(name string) IdlInterfaceAttribute

type IdlInterfaceOperation

type IdlInterfaceOperation struct {
	idl.Operation
}

type Receiver

type Receiver struct {
	Name g.Generator
	Type g.Generator
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL