components

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Copyright (c) 2025 Reliant Labs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatComponentList

func FormatComponentList(entries []Entry) string

FormatComponentList formats a list of entries into a human-readable string grouped by category.

Types

type Category

type Category string

Category groups components by type.

const (
	CategoryLayouts  Category = "layouts"
	CategoryCharts   Category = "charts"
	CategoryDiagrams Category = "diagrams"
	CategoryDeck     Category = "deck"
	CategoryUI       Category = "ui"
)

Category enum values. Each value tags a component template with the kind of artifact it produces (HTML layout, SVG chart, diagram, deck slide, or generic UI primitive).

type Entry

type Entry struct {
	Name        string   `json:"name"`
	Category    Category `json:"category"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
	FilePath    string   `json:"-"` // internal embed path
}

Entry describes a single component in the library.

type Library

type Library struct{}

Library provides access to the component library.

func NewLibrary

func NewLibrary() *Library

NewLibrary creates a new component library instance.

func (*Library) ByName

func (l *Library) ByName() map[string]*Entry

ByName returns the name-to-entry lookup map.

func (*Library) FindSimilar

func (l *Library) FindSimilar(name string) []string

FindSimilar returns up to 5 component names similar to the given name.

func (*Library) Get

func (l *Library) Get(name string) (string, error)

Get retrieves the source code for a component by name.

func (*Library) GetEntry

func (l *Library) GetEntry(name string) (*Entry, bool)

GetEntry retrieves the metadata entry for a component by name.

func (*Library) List

func (l *Library) List(tag, category string) []Entry

List returns all components, optionally filtered by tag and/or category.

func (*Library) Registry

func (l *Library) Registry() []Entry

Registry returns all component entries.

func (*Library) Search

func (l *Library) Search(query string) []Entry

Search finds components using unified keyword search. The query string is split into words and each word is matched against the component's name, tags, category, and description. A component matches if ALL words match (each word can match in any field — bag-of-words AND semantics). An empty query returns all components.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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