Documentation ¶
Overview ¶
Package webki provides a framework designed for easily building content-focused sites
Index ¶
- Constants
- Variables
- type Context
- type Page
- func (pg *Page) AppBar(tb *gi.Toolbar)
- func (pg *Page) ConfigWidget()
- func (pg *Page) Context() *Context
- func (t *Page) KiType() *gti.Type
- func (t *Page) New() ki.Ki
- func (pg *Page) OpenURL(rawURL string, addToHistory bool) error
- func (t *Page) SetClass(v string) *Page
- func (t *Page) SetCustomContextMenu(v func(m *gi.Scene)) *Page
- func (t *Page) SetHistory(v []string) *Page
- func (t *Page) SetPagePath(v string) *Page
- func (t *Page) SetPageUrl(v string) *Page
- func (t *Page) SetPriorityEvents(v []events.Types) *Page
- func (t *Page) SetSource(v fs.FS) *Page
- func (t *Page) SetStackTop(v int) *Page
- func (t *Page) SetStripes(v gi.Stripes) *Page
- func (t *Page) SetTooltip(v string) *Page
Constants ¶
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 ¶
var PageType = gti.AddType(>i.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", >i.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", >i.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", >i.Field{Name: "PageURL", Type: "string", LocalType: "string", Doc: "PageURL is the current page URL", Directives: gti.Directives{}, Tag: ""}}, {"PagePath", >i.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", >i.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{}, })
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
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 ¶
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) ConfigWidget ¶
func (pg *Page) ConfigWidget()
func (*Page) OpenURL ¶
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) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Page.CustomContextMenu]
func (*Page) SetHistory ¶
SetHistory sets the [Page.History]: The history of URLs that have been visited. The oldest page is first.
func (*Page) SetPagePath ¶
SetPagePath sets the [Page.PagePath]: PagePath is the fs path of the current page in [Page.Source]
func (*Page) SetPageUrl ¶
SetPageUrl sets the [Page.PageURL]: PageURL is the current page URL
func (*Page) SetPriorityEvents ¶
SetPriorityEvents sets the [Page.PriorityEvents]
func (*Page) SetSource ¶
SetSource sets the [Page.Source]: Source is the filesystem in which the content is located.
func (*Page) SetStackTop ¶
SetStackTop sets the [Page.StackTop]
func (*Page) SetStripes ¶
SetStripes sets the [Page.Stripes]
func (*Page) SetTooltip ¶
SetTooltip sets the [Page.Tooltip]