d2wasm

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const DEFAULT_INPUT_PATH = "index"

Variables

This section is empty.

Functions

func Compile

func Compile(args []js.Value) (interface{}, error)

func Decode

func Decode(args []js.Value) (interface{}, error)

func Encode

func Encode(args []js.Value) (interface{}, error)

func GetBoardAtPosition

func GetBoardAtPosition(args []js.Value) (interface{}, error)

func GetCompletions

func GetCompletions(args []js.Value) (interface{}, error)

func GetELKGraph

func GetELKGraph(args []js.Value) (interface{}, error)

func GetJSVersion added in v0.7.1

func GetJSVersion(args []js.Value) (interface{}, error)

func GetObjOrder

func GetObjOrder(args []js.Value) (interface{}, error)

func GetParentID

func GetParentID(args []js.Value) (interface{}, error)

func GetRefRanges

func GetRefRanges(args []js.Value) (interface{}, error)

func GetVersion

func GetVersion(args []js.Value) (interface{}, error)

func Render

func Render(args []js.Value) (interface{}, error)

Types

type BoardPositionResponse

type BoardPositionResponse struct {
	BoardPath []string `json:"boardPath"`
	Err       string   `json:"err"`
}

type CompileOptions added in v0.7.0

type CompileOptions struct {
	RenderOptions
	Layout       *string `json:"layout"`
	FontRegular  *[]byte `json:"FontRegular"`
	FontItalic   *[]byte `json:"FontItalic"`
	FontBold     *[]byte `json:"FontBold"`
	FontSemibold *[]byte `json:"FontSemibold"`
}

type CompileRequest

type CompileRequest struct {
	FS        map[string]string `json:"fs"`
	InputPath *string           `json:"inputPath"`
	Opts      *CompileOptions   `json:"options"`
}

type CompileResponse

type CompileResponse struct {
	FS            map[string]string `json:"fs"`
	InputPath     string            `json:"inputPath"`
	Diagram       d2target.Diagram  `json:"diagram"`
	Graph         d2graph.Graph     `json:"graph"`
	RenderOptions RenderOptions     `json:"renderOptions"`
}

type CompletionResponse

type CompletionResponse struct {
	Items []map[string]interface{} `json:"items"`
}

type D2API

type D2API struct {
	// contains filtered or unexported fields
}

func NewD2API

func NewD2API() *D2API

func (*D2API) ExportTo

func (api *D2API) ExportTo(target js.Value)

func (*D2API) Register

func (api *D2API) Register(name string, fn func(args []js.Value) (interface{}, error))

type RefRangesResponse

type RefRangesResponse struct {
	Ranges       []d2ast.Range `json:"ranges"`
	ImportRanges []d2ast.Range `json:"importRanges"`
}

type RenderOptions

type RenderOptions struct {
	Pad                *int64                   `json:"pad"`
	Sketch             *bool                    `json:"sketch"`
	Center             *bool                    `json:"center"`
	ThemeID            *int64                   `json:"themeID"`
	DarkThemeID        *int64                   `json:"darkThemeID"`
	ThemeOverrides     *d2target.ThemeOverrides `json:"themeOverrides"`
	DarkThemeOverrides *d2target.ThemeOverrides `json:"darkThemeOverrides"`
	Scale              *float64                 `json:"scale"`
	ForceAppendix      *bool                    `json:"forceAppendix"`
	Target             *string                  `json:"target"`
	AnimateInterval    *int64                   `json:"animateInterval"`
	Salt               *string                  `json:"salt"`
	NoXMLTag           *bool                    `json:"noXMLTag"`
	ASCII              *bool                    `json:"ascii"`
	ASCIIMode          *string                  `json:"asciiMode"`
}

type RenderRequest

type RenderRequest struct {
	Diagram *d2target.Diagram `json:"diagram"`
	Opts    *RenderOptions    `json:"options"`
}

type WASMError

type WASMError struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

func (*WASMError) Error

func (e *WASMError) Error() string

type WASMResponse

type WASMResponse struct {
	Data  interface{} `json:"data,omitempty"`
	Error *WASMError  `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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