webki

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: BSD-3-Clause Imports: 21 Imported by: 0

README

webki

Webki is a framework designed for easily building content-focused sites

Documentation

Overview

Package webki provides a framework designed for easily building content-focused sites

Index

Constants

View Source
const (
	// Version is the version of this package being used
	Version = "v0.0.13"
	// GitCommit is the commit just before the latest version commit
	GitCommit = "1951413"
	// VersionDate is the date-time of the latest version commit in UTC (in the format 'YYYY-MM-DD HH:MM', which is the Go format '2006-01-02 15:04')
	VersionDate = "2023-12-26 23:41"
)

Variables

View Source
var PageType = gti.AddType(&gti.Type{
	Name:       "goki.dev/webki.Page",
	ShortName:  "webki.Page",
	IDName:     "page",
	Doc:        "Page represents one site page",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Source", &gti.Field{Name: "Source", Type: "io/fs.FS", LocalType: "fs.FS", Doc: "Source is the filesystem in which the content is located.", Directives: gti.Directives{}, Tag: ""}},
		{"History", &gti.Field{Name: "History", Type: "[]string", LocalType: "[]string", Doc: "The history of URLs that have been visited. The oldest page is first.", Directives: gti.Directives{}, Tag: ""}},
		{"PageURL", &gti.Field{Name: "PageURL", Type: "string", LocalType: "string", Doc: "PageURL is the current page URL", Directives: gti.Directives{}, Tag: ""}},
		{"PagePath", &gti.Field{Name: "PagePath", Type: "string", LocalType: "string", Doc: "PagePath is the fs path of the current page in [Page.Source]", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Frame", &gti.Field{Name: "Frame", Type: "goki.dev/gi/v2/gi.Frame", LocalType: "gi.Frame", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &Page{},
})

PageType is the gti.Type for Page

Functions

This section is empty.

Types

type Context

type Context struct {
	gidom.ContextBase
	// Page is the page associated with the context
	Page *Page
}

Context implements gidom.Context

func (*Context) OpenURL

func (c *Context) OpenURL(url string)

func (*Context) PageURL

func (c *Context) PageURL() string

type Page

type Page struct {
	gi.Frame

	// Source is the filesystem in which the content is located.
	Source fs.FS

	// The history of URLs that have been visited. The oldest page is first.
	History []string

	// HistoryIndex is the current place we are at in the History
	HistoryIndex int

	// PageURL is the current page URL
	PageURL string

	// PagePath is the fs path of the current page in [Page.Source]
	PagePath string
}

Page represents one site page

func NewPage

func NewPage(par ki.Ki, name ...string) *Page

NewPage adds a new Page with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*Page) AppBar added in v0.0.6

func (pg *Page) AppBar(tb *gi.Toolbar)

AppBar is the default app bar for a Page

func (*Page) ConfigWidget

func (pg *Page) ConfigWidget()

func (*Page) Context

func (pg *Page) Context() *Context

Context returns the Context for the page.

func (*Page) KiType

func (t *Page) KiType() *gti.Type

KiType returns the *gti.Type of Page

func (*Page) New

func (t *Page) New() ki.Ki

New returns a new *Page value

func (*Page) OpenURL

func (pg *Page) OpenURL(rawURL string, addToHistory bool) error

OpenURL sets the content of the page from the given url. If the given URL has no scheme (eg: "/about"), then it sets the content of the page to the file specified by the URL. This is either the "index.md" file in the corresponding directory (eg: "/about/index.md") or the corresponding md file (eg: "/about.md"). If it has a scheme, (eg: "https://example.com"), then it opens it in the user's default browser.

func (*Page) SetClass

func (t *Page) SetClass(v string) *Page

SetClass sets the [Page.Class]

func (*Page) SetCustomContextMenu

func (t *Page) SetCustomContextMenu(v func(m *gi.Scene)) *Page

SetCustomContextMenu sets the [Page.CustomContextMenu]

func (*Page) SetHistory

func (t *Page) SetHistory(v []string) *Page

SetHistory sets the [Page.History]: The history of URLs that have been visited. The oldest page is first.

func (*Page) SetPagePath

func (t *Page) SetPagePath(v string) *Page

SetPagePath sets the [Page.PagePath]: PagePath is the fs path of the current page in [Page.Source]

func (*Page) SetPageUrl

func (t *Page) SetPageUrl(v string) *Page

SetPageUrl sets the [Page.PageURL]: PageURL is the current page URL

func (*Page) SetPriorityEvents

func (t *Page) SetPriorityEvents(v []events.Types) *Page

SetPriorityEvents sets the [Page.PriorityEvents]

func (*Page) SetSource

func (t *Page) SetSource(v fs.FS) *Page

SetSource sets the [Page.Source]: Source is the filesystem in which the content is located.

func (*Page) SetStackTop

func (t *Page) SetStackTop(v int) *Page

SetStackTop sets the [Page.StackTop]

func (*Page) SetStripes

func (t *Page) SetStripes(v gi.Stripes) *Page

SetStripes sets the [Page.Stripes]

func (*Page) SetTooltip

func (t *Page) SetTooltip(v string) *Page

SetTooltip sets the [Page.Tooltip]

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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