model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	CapabilityRead        = "read"
	CapabilityWrite       = "write"
	CapabilityPlan        = "plan"
	CapabilityApply       = "apply"
	CapabilityCreate      = "create"
	CapabilityTransitions = "transitions"
	CapabilityAudio       = "audio"
	CapabilitySections    = "sections"
)

Standard capability strings.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio struct {
	Source   AudioSource   `json:"source"`
	Path     string        `json:"path,omitempty"`     // Local file path
	URL      string        `json:"url,omitempty"`      // Remote URL
	Script   string        `json:"script,omitempty"`   // Text for TTS generation
	Duration time.Duration `json:"duration,omitempty"` // Explicit or computed duration
	Voice    string        `json:"voice,omitempty"`    // TTS voice ID
}

Audio represents audio attachment for LMS/video generation.

func NewFileAudio

func NewFileAudio(path string, duration time.Duration) *Audio

NewFileAudio creates an audio reference from a local file.

func NewNotesAudio

func NewNotesAudio(voice string) *Audio

NewNotesAudio creates an audio reference for TTS generation from speaker notes.

func NewTTSAudio

func NewTTSAudio(script, voice string) *Audio

NewTTSAudio creates an audio reference for TTS generation from a script.

func NewURLAudio

func NewURLAudio(url string, duration time.Duration) *Audio

NewURLAudio creates an audio reference from a remote URL.

func (*Audio) HasContent

func (a *Audio) HasContent() bool

HasContent returns true if the audio has a valid source reference.

type AudioSource

type AudioSource string

AudioSource identifies audio origin.

const (
	AudioSourceFile  AudioSource = "file"  // Pre-recorded audio file
	AudioSourceURL   AudioSource = "url"   // Remote audio URL
	AudioSourceTTS   AudioSource = "tts"   // Generate via TTS from script
	AudioSourceNotes AudioSource = "notes" // Generate via TTS from speaker notes
)

func AudioSources

func AudioSources() []AudioSource

AudioSources returns all valid audio source values.

func (AudioSource) IsValid

func (s AudioSource) IsValid() bool

IsValid returns true if the audio source is a recognized value.

func (AudioSource) NeedsTTS

func (s AudioSource) NeedsTTS() bool

NeedsTTS returns true if this audio source requires TTS generation.

type Backend

type Backend interface {
	// Info returns backend metadata.
	Info() BackendInfo

	// Read loads a presentation from the backend.
	Read(ctx context.Context, ref Ref) (*Deck, error)

	// Plan computes changes needed to reach desired state.
	Plan(ctx context.Context, ref Ref, desired *Deck) (*Diff, error)

	// Apply executes a diff against the backend.
	Apply(ctx context.Context, ref Ref, diff *Diff) error

	// Create creates a new presentation.
	Create(ctx context.Context, deck *Deck) (Ref, error)
}

Backend defines the interface for presentation backends.

type BackendInfo

type BackendInfo struct {
	Name         string   `json:"name"`
	Version      string   `json:"version"`
	Capabilities []string `json:"capabilities"`
}

BackendInfo describes backend capabilities.

func (BackendInfo) HasCapability

func (b BackendInfo) HasCapability(cap string) bool

HasCapability returns true if the backend has the specified capability.

type Block

type Block struct {
	Kind  BlockKind `json:"kind"`
	Text  string    `json:"text,omitempty"`
	Level int       `json:"level,omitempty"` // Bullet nesting level (0 = top level)
	Lang  string    `json:"lang,omitempty"`  // Code language
	URL   string    `json:"url,omitempty"`   // Image/link URL
	Alt   string    `json:"alt,omitempty"`   // Image alt text
}

Block represents content within a slide.

func NewBullet

func NewBullet(text string, level int) Block

NewBullet creates a bullet block at the specified nesting level.

func NewCode

func NewCode(code, lang string) Block

NewCode creates a code block with the specified language.

func NewHeading

func NewHeading(text string, level int) Block

NewHeading creates a heading block.

func NewImage

func NewImage(url, alt string) Block

NewImage creates an image block.

func NewNumbered

func NewNumbered(text string, level int) Block

NewNumbered creates a numbered list item block.

func NewParagraph

func NewParagraph(text string) Block

NewParagraph creates a paragraph block.

func NewQuote

func NewQuote(text string) Block

NewQuote creates a quote block.

type BlockKind

type BlockKind string

BlockKind identifies content type.

const (
	BlockParagraph BlockKind = "paragraph"
	BlockBullet    BlockKind = "bullet"
	BlockNumbered  BlockKind = "numbered"
	BlockCode      BlockKind = "code"
	BlockImage     BlockKind = "image"
	BlockQuote     BlockKind = "quote"
	BlockHeading   BlockKind = "heading"
)

func BlockKinds

func BlockKinds() []BlockKind

BlockKinds returns all valid block kind values.

func (BlockKind) IsValid

func (k BlockKind) IsValid() bool

IsValid returns true if the block kind is a recognized value.

type Change

type Change struct {
	Op        ChangeOp `json:"op"`
	Path      string   `json:"path"`                 // e.g., "sections/0/slides/2/title"
	SlideID   string   `json:"slide_id,omitempty"`   // Target slide ID
	SectionID string   `json:"section_id,omitempty"` // Target section ID
	OldValue  any      `json:"old_value,omitempty"`
	NewValue  any      `json:"new_value,omitempty"`
}

Change represents a single modification.

func NewAddChange

func NewAddChange(path string, value any) Change

NewAddChange creates an add operation.

func NewMoveChange

func NewMoveChange(fromPath, toPath string) Change

NewMoveChange creates a move operation.

func NewRemoveChange

func NewRemoveChange(path string, value any) Change

NewRemoveChange creates a remove operation.

func NewUpdateChange

func NewUpdateChange(path string, oldValue, newValue any) Change

NewUpdateChange creates an update operation.

type ChangeOp

type ChangeOp string

ChangeOp identifies the type of change.

const (
	ChangeAdd    ChangeOp = "add"
	ChangeRemove ChangeOp = "remove"
	ChangeUpdate ChangeOp = "update"
	ChangeMove   ChangeOp = "move"
)

func ChangeOps

func ChangeOps() []ChangeOp

ChangeOps returns all valid change operation values.

func (ChangeOp) IsValid

func (op ChangeOp) IsValid() bool

IsValid returns true if the change op is a recognized value.

type Deck

type Deck struct {
	ID       string    `json:"id"`
	Title    string    `json:"title"`
	Meta     Meta      `json:"meta"`
	Sections []Section `json:"sections"`
	Theme    *Theme    `json:"theme,omitempty"`
}

Deck represents a complete presentation.

func (*Deck) AllSlides

func (d *Deck) AllSlides() []Slide

AllSlides returns a flat list of all slides in order.

func (*Deck) FindSection

func (d *Deck) FindSection(id string) *Section

FindSection finds a section by ID.

func (*Deck) FindSlide

func (d *Deck) FindSlide(id string) *Slide

FindSlide finds a slide by ID across all sections.

func (*Deck) SlideCount

func (d *Deck) SlideCount() int

SlideCount returns the total number of slides across all sections.

func (*Deck) TotalDuration

func (d *Deck) TotalDuration() time.Duration

TotalDuration returns the total audio duration of the deck.

type Diff

type Diff struct {
	DeckID  string   `json:"deck_id"`
	Changes []Change `json:"changes"`
}

Diff represents changes between two deck states.

func NewDiff

func NewDiff(deckID string) *Diff

NewDiff creates a new empty diff for the given deck ID.

func (*Diff) AddChange

func (d *Diff) AddChange(c Change)

AddChange adds a change to the diff.

func (*Diff) AddChanges

func (d *Diff) AddChanges() []Change

AddChanges returns only add operations.

func (*Diff) ChangeCount

func (d *Diff) ChangeCount() int

ChangeCount returns the number of changes.

func (*Diff) CountByOp

func (d *Diff) CountByOp() map[ChangeOp]int

CountByOp returns the count of changes by operation type.

func (*Diff) IsEmpty

func (d *Diff) IsEmpty() bool

IsEmpty returns true if the diff has no changes.

func (*Diff) MoveChanges

func (d *Diff) MoveChanges() []Change

MoveChanges returns only move operations.

func (*Diff) RemoveChanges

func (d *Diff) RemoveChanges() []Change

RemoveChanges returns only remove operations.

func (*Diff) UpdateChanges

func (d *Diff) UpdateChanges() []Change

UpdateChanges returns only update operations.

type Layout

type Layout string

Layout identifies slide layout type.

const (
	LayoutTitle       Layout = "title"         // Title slide
	LayoutTitleBody   Layout = "title_body"    // Title + body content
	LayoutTitleTwoCol Layout = "title_two_col" // Title + two columns
	LayoutSection     Layout = "section"       // Section divider
	LayoutBlank       Layout = "blank"         // No predefined structure
	LayoutImage       Layout = "image"         // Full-bleed image
	LayoutComparison  Layout = "comparison"    // Side-by-side comparison
)

func Layouts

func Layouts() []Layout

Layouts returns all valid layout values.

func (Layout) IsValid

func (l Layout) IsValid() bool

IsValid returns true if the layout is a recognized value.

type Meta

type Meta struct {
	Author      string            `json:"author,omitempty"`
	Date        string            `json:"date,omitempty"`
	Description string            `json:"description,omitempty"`
	Keywords    []string          `json:"keywords,omitempty"`
	Custom      map[string]string `json:"custom,omitempty"`
}

Meta contains presentation metadata.

type Ref

type Ref struct {
	Backend string `json:"backend"` // "marp", "gslides", "reveal"
	ID      string `json:"id"`      // Backend-specific identifier
	Path    string `json:"path"`    // File path (for file-based backends)
}

Ref identifies a presentation in a backend.

func (Ref) IsFileRef

func (r Ref) IsFileRef() bool

IsFileRef returns true if this is a file-based reference.

func (Ref) String

func (r Ref) String() string

String returns a string representation of the reference.

type Section

type Section struct {
	ID     string  `json:"id"`
	Title  string  `json:"title"`
	Slides []Slide `json:"slides"`
	Audio  *Audio  `json:"audio,omitempty"` // Section-level audio for LMS
}

Section groups related slides (maps to LMS sections/chapters).

func (*Section) FindSlide

func (s *Section) FindSlide(id string) *Slide

FindSlide finds a slide by ID within this section.

func (*Section) HasAudio

func (s *Section) HasAudio() bool

HasAudio returns true if the section has audio (either section-level or slide-level).

func (*Section) SlideCount

func (s *Section) SlideCount() int

SlideCount returns the number of slides in this section.

func (*Section) TotalDuration

func (s *Section) TotalDuration() time.Duration

TotalDuration returns the total audio duration of the section. If section-level audio is set, returns its duration. Otherwise, sums slide-level audio durations.

type Slide

type Slide struct {
	ID         string  `json:"id"`
	Layout     Layout  `json:"layout"`
	Title      string  `json:"title,omitempty"`
	Subtitle   string  `json:"subtitle,omitempty"`
	Body       []Block `json:"body,omitempty"`
	Notes      []Block `json:"notes,omitempty"`      // Speaker notes
	Audio      *Audio  `json:"audio,omitempty"`      // Slide-level audio
	Transition *string `json:"transition,omitempty"` // Reveal.js transitions
	Background *string `json:"background,omitempty"`
}

Slide represents a single slide.

func (*Slide) BulletCount

func (s *Slide) BulletCount() int

BulletCount returns the number of bullet points in the body.

func (*Slide) HasBody

func (s *Slide) HasBody() bool

HasBody returns true if the slide has body content.

func (*Slide) HasNotes

func (s *Slide) HasNotes() bool

HasNotes returns true if the slide has speaker notes.

func (*Slide) HasTitle

func (s *Slide) HasTitle() bool

HasTitle returns true if the slide has a title.

func (*Slide) NotesText

func (s *Slide) NotesText() string

NotesText returns speaker notes as plain text.

type Theme

type Theme struct {
	Name       string            `json:"name,omitempty"`
	Primary    string            `json:"primary,omitempty"`    // Primary color (hex)
	Secondary  string            `json:"secondary,omitempty"`  // Secondary color (hex)
	Background string            `json:"background,omitempty"` // Background color (hex)
	Font       string            `json:"font,omitempty"`       // Font family
	Custom     map[string]string `json:"custom,omitempty"`     // Backend-specific settings
}

Theme represents presentation styling.

func DarkTheme

func DarkTheme() *Theme

DarkTheme returns a dark theme.

func DefaultTheme

func DefaultTheme() *Theme

DefaultTheme returns a default theme.

func (*Theme) GetCustom

func (t *Theme) GetCustom(key, defaultValue string) string

GetCustom returns a custom theme value with a default fallback.

func (*Theme) SetCustom

func (t *Theme) SetCustom(key, value string)

SetCustom sets a custom theme value.

Jump to

Keyboard shortcuts

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