types

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DesignTokens

type DesignTokens interface {
	// Get returns the Token for the given name, prepending the prefix if it's not present
	Get(name string) (*token.Token, bool)
}

DesignTokens provides access to design tokens by name

type DesignTokensCache

type DesignTokensCache interface {
	// LoadOrReuse loads design tokens if not cached, or returns cached result
	LoadOrReuse(ctx WorkspaceContext) (DesignTokens, error)
	// Clear resets the cache
	Clear()
}

DesignTokensCache provides caching for design tokens to avoid redundant loading

type DesignTokensLoader

type DesignTokensLoader interface {
	// Load loads design tokens from the workspace context
	// Returns the loaded design tokens and any error encountered
	Load(ctx WorkspaceContext) (DesignTokens, error)
}

DesignTokensLoader provides an interface for loading design tokens This interface allows dependency injection without circular imports between designtokens and workspace packages

type WorkspaceContext

type WorkspaceContext interface {
	// Performs validation/discovery and caches results as needed.
	Init() error
	// ConfigFile Returns the path to the config file
	ConfigFile() string
	// Config returns the parsed and initialized config
	Config() (*C.CemConfig, error)
	// Returns the package's parsed PackageJSON.
	PackageJSON() (*M.PackageJSON, error)
	// Manifest returns the package's parsed custom elements manifest.
	Manifest() (*M.Package, error)
	// CustomElementsManifestPath returns the path to the manifest file.
	CustomElementsManifestPath() string
	// ReadFile returns an io.ReadCloser for a file within the package.
	ReadFile(path string) (io.ReadCloser, error)
	// Glob returns a list of file paths matching the given pattern (e.g., *.ts).
	Glob(pattern string) ([]string, error)
	// Writes outputs to paths
	OutputWriter(path string) (io.WriteCloser, error)
	// Root returns the canonical root path or name for the package.
	Root() string
	// Cleanup releases any resources (e.g., tempdirs) held by the context.
	Cleanup() error

	// Path resolution utilities for consistent module/filesystem path mapping
	// ModulePathToFS converts a module path to filesystem path for watching
	ModulePathToFS(modulePath string) string
	// FSPathToModule converts a filesystem path to module path for manifest lookup
	FSPathToModule(fsPath string) (string, error)
	// ResolveModuleDependency resolves a dependency path relative to a module
	ResolveModuleDependency(modulePath, dependencyPath string) (string, error)

	// DesignTokensCache returns the design tokens cache for this workspace
	DesignTokensCache() DesignTokensCache
}

WorkspaceContext abstracts access to package resources, regardless of source (local or remote).

Jump to

Keyboard shortcuts

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