genui

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package genui writes the screens of a specification for the web in plain JavaScript: the logic of the specarch-gen-ui plug-in. Each list page becomes an HTML page and an ES module, the events of every page are declared once in events.js, and the theme becomes theme.css. Nothing needs a package, a bundler or a build step.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSSValue added in v0.6.0

func CSSValue(typ string, v any) string

CSSValue writes a token's value in CSS, as cssValue does, for another generator of the web.

Types

type Diagnostic

type Diagnostic struct {
	File     string `json:"file"`
	Line     int    `json:"line"`
	Severity string `json:"severity"`
	Path     string `json:"path"`
	Rule     string `json:"rule"`
	Message  string `json:"message"`
}

Diagnostic is one problem the plug-in reports, in the validator's fields.

type File

type File struct {
	Path    string `json:"path"`
	Content string `json:"content"`
	// Comparison is "object-literal" for a file that is one object
	// literal of data, which generate --check compares by value (ADR-093).
	Comparison string `json:"comparison,omitempty"`
}

File is one file the plug-in answers with.

type Idiom

type Idiom struct {
	Name     string         `json:"name"`
	As       string         `json:"as"`
	Content  map[string]any `json:"content,omitempty"`
	Override map[string]any `json:"override,omitempty"`
}

Idiom is one idiom an implementation file uses.

type Implementation

type Implementation struct {
	File     string         `json:"file"`
	Content  map[string]any `json:"content"`
	Settings map[string]any `json:"settings,omitempty"`
	Idioms   []Idiom        `json:"idioms"`
}

Implementation is one implementation file in the request.

type Request

type Request struct {
	Specarch        string           `json:"specarch"`
	Target          string           `json:"target"`
	Root            string           `json:"root"`
	Specification   map[string]any   `json:"specification"`
	Implementations []Implementation `json:"implementations"`
	Output          string           `json:"output"`
	// Draft is the notice a draft carries, or "" for the approved output.
	Draft string `json:"draft"`
	// Problems are the problems to mark, in the order of the problems file.
	Problems []mark.Problem `json:"problems"`
}

Request is what specarch writes on a plug-in's standard input.

func Decode

func Decode(data []byte) (*Request, error)

Decode reads a request, keeping numbers as their text.

type Response

type Response struct {
	Files       []File       `json:"files"`
	Diagnostics []Diagnostic `json:"diagnostics"`
}

Response is what the plug-in writes on its standard output.

func Generate

func Generate(r *Request) Response

Generate writes the screens of a request.

Jump to

Keyboard shortcuts

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