view

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 12 Imported by: 0

README

View Component Helpers

This directory contains quicktemplate component functions for rendering various data types and UI elements.

Function Reference

Any.html
  • {% func Any(x any, ps *cutil.PageState) %} - Renders any value by type-switching to appropriate handlers
AnyByType.html
  • {% func AnyByType(x any, t *types.Wrapped, ps *cutil.PageState) %} - Renders any value based on explicit type information
  • {% func Default(x any, t string, ps *cutil.PageState) %} - Default handler for unhandled types
  • {% func Type(v types.Type) %} - Renders type information
  • {% func Option(x any, t *types.Option, ps *cutil.PageState) %} - Renders optional values with null toggle
Bool.html
  • {% func Bool(b bool) %} - Renders boolean as "true"/"false" text
  • {% func BoolIcon(b bool, size int, cls string, ps *cutil.PageState, titles ...string) %} - Renders boolean as check/times icon
Color.html
  • {% func Color(clr string, cls string, ps *cutil.PageState) %} - Renders color value with background preview
Diff.html
  • {% func Diffs(value util.Diffs) %} - Renders diff table showing path/old/new changes
  • {% func DiffsSet(key string, value util.DiffsSet, limit int, ps *cutil.PageState) %} - Renders grouped diffs as accordion
Float.html
  • {% func Float(f any) %} - Renders float value
  • {% func FloatArray(value []any) %} - Renders array of floats
Int.html
  • {% func Int(i any) %} - Renders integer value
  • {% func IntArray(value []any) %} - Renders array of integers
Map.html
  • {% func Map(preserveWhitespace bool, m util.ValueMap, ps *cutil.PageState) %} - Renders key-value map as table
  • {% func MapKeys(m util.ValueMap) %} - Renders map keys as tags
  • {% func MapArray(preserveWhitespace bool, ps *cutil.PageState, maps ...util.ValueMap) %} - Renders array of maps as table
  • {% func OrderedMap(preserveWhitespace bool, m *util.OrderedMap[any], ps *cutil.PageState) %} - Renders ordered map as table
  • {% func OrderedMapArray(preserveWhitespace bool, ps *cutil.PageState, maps ...*util.OrderedMap[any]) %} - Renders array of ordered maps as table
Package.html
  • {% func Package(v util.Pkg) %} - Renders package path segments
String.html
  • {% func String(value string, classes ...string) %} - Renders string with optional CSS classes
  • {% func StringRich(value string, code bool, maxLength int, classes ...string) %} - Renders string with code formatting and length limit
  • {% func StringArray(value []string) %} - Renders string array with overflow handling
  • {% func FormatLang(v string, ext string) %} - Renders formatted code with syntax highlighting
Tags.html
  • {% func Tags(values []string, titles []string, url ...string) %} - Renders string array as tag elements with optional links
Timestamp.html
  • {% func Timestamp(value *time.Time) %} - Renders timestamp with verbose tooltip
  • {% func TimestampMillis(value *time.Time) %} - Renders timestamp with millisecond precision
  • {% func TimestampRelative(value *time.Time, static bool) %} - Renders relative time ("2 hours ago")
  • {% func TimestampDay(value *time.Time) %} - Renders date only (YYYY-MM-DD)
  • {% func DurationSeconds(seconds float64) %} - Renders duration from seconds value
URL.html
  • {% func URL(u any, content string, includeExternalIcon bool, ps *cutil.PageState) %} - Renders clickable URL link
  • {% func CodeLink(path string, title string, ps *cutil.PageState) %} - Renders link to source code
UUID.html
  • {% func UUID(value *uuid.UUID) %} - Renders UUID as string

Usage Notes

  • Most functions accept ps *cutil.PageState for context and theme information
  • Functions starting with capital letters are exported quicktemplate functions
  • preserveWhitespace parameter controls whether content should maintain spacing/formatting
  • Array functions typically include overflow handling for large datasets
  • Icon functions use the SVG icon system via components.SVGRef()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any(x any, ps *cutil.PageState) string

func AnyByType added in v1.2.17

func AnyByType(x any, t *types.Wrapped, ps *cutil.PageState) string

func AnyTable added in v1.9.0

func AnyTable(title string, value any, indent int, ps *cutil.PageState) string

func Bool

func Bool(b bool) string

func BoolIcon added in v1.2.21

func BoolIcon(b bool, size int, cls string, ps *cutil.PageState, titles ...string) string

func BoolTable added in v1.9.0

func BoolTable(title string, value bool, indent int, ps *cutil.PageState) string
func CodeLink(path string, title string, ps *cutil.PageState) string

func Color added in v1.2.18

func Color(clr string, cls string, ps *cutil.PageState) string

func ColorTable added in v1.9.0

func ColorTable(title string, value string, cls string, indent int, ps *cutil.PageState) string

func Default

func Default(x any, t string, ps *cutil.PageState) string

func Diffs

func Diffs(value util.Diffs) string

func DiffsSet

func DiffsSet(key string, value util.DiffsSet, limit int, ps *cutil.PageState) string

func DiffsTable added in v1.9.0

func DiffsTable(title string, value util.Diffs, indent int) string

func DurationSeconds added in v1.2.19

func DurationSeconds(seconds float64) string

func Fields added in v1.9.0

func Fields(fields util.FieldDescs, values util.ValueMap, ps *cutil.PageState) string

func Float

func Float(f any) string

func FloatArray

func FloatArray(value []any) string

func FloatTable added in v1.9.0

func FloatTable(title string, value any, indent int) string

func FormatLang added in v1.6.0

func FormatLang(v string, ext string) string

func Int

func Int(i any) string

func IntArray

func IntArray(value []any) string

func IntTable added in v1.9.0

func IntTable(title string, value any, indent int) string

func Map added in v1.2.17

func Map(preserveWhitespace bool, m util.ValueMap, ps *cutil.PageState) string

func MapArray

func MapArray(preserveWhitespace bool, ps *cutil.PageState, maps ...util.ValueMap) string

func MapKeys added in v1.5.4

func MapKeys(m util.ValueMap) string

func MapTable added in v1.9.0

func MapTable(title string, preserveWhitespace bool, value util.ValueMap, indent int, ps *cutil.PageState) string

func Option

func Option(x any, t *types.Option, ps *cutil.PageState) string

func OrderedMap added in v1.5.31

func OrderedMap(preserveWhitespace bool, m *util.OrderedMap[any], ps *cutil.PageState) string

func OrderedMapArray added in v1.5.31

func OrderedMapArray(preserveWhitespace bool, ps *cutil.PageState, maps ...*util.OrderedMap[any]) string

func Package

func Package(v util.Pkg) string

func PackageTable added in v1.9.0

func PackageTable(title string, value util.Pkg, indent int) string

func Percent added in v1.7.20

func Percent(f float64) string

func StreamAny

func StreamAny(qw422016 *qt422016.Writer, x any, ps *cutil.PageState)

func StreamAnyByType added in v1.2.17

func StreamAnyByType(qw422016 *qt422016.Writer, x any, t *types.Wrapped, ps *cutil.PageState)

func StreamAnyTable added in v1.9.0

func StreamAnyTable(qw422016 *qt422016.Writer, title string, value any, indent int, ps *cutil.PageState)

func StreamBool

func StreamBool(qw422016 *qt422016.Writer, b bool)

func StreamBoolIcon added in v1.2.21

func StreamBoolIcon(qw422016 *qt422016.Writer, b bool, size int, cls string, ps *cutil.PageState, titles ...string)

func StreamBoolTable added in v1.9.0

func StreamBoolTable(qw422016 *qt422016.Writer, title string, value bool, indent int, ps *cutil.PageState)
func StreamCodeLink(qw422016 *qt422016.Writer, path string, title string, ps *cutil.PageState)

func StreamColor added in v1.2.18

func StreamColor(qw422016 *qt422016.Writer, clr string, cls string, ps *cutil.PageState)

func StreamColorTable added in v1.9.0

func StreamColorTable(qw422016 *qt422016.Writer, title string, value string, cls string, indent int, ps *cutil.PageState)

func StreamDefault

func StreamDefault(qw422016 *qt422016.Writer, x any, t string, ps *cutil.PageState)

func StreamDiffs

func StreamDiffs(qw422016 *qt422016.Writer, value util.Diffs)

func StreamDiffsSet

func StreamDiffsSet(qw422016 *qt422016.Writer, key string, value util.DiffsSet, limit int, ps *cutil.PageState)

func StreamDiffsTable added in v1.9.0

func StreamDiffsTable(qw422016 *qt422016.Writer, title string, value util.Diffs, indent int)

func StreamDurationSeconds added in v1.2.19

func StreamDurationSeconds(qw422016 *qt422016.Writer, seconds float64)

func StreamFields added in v1.9.0

func StreamFields(qw422016 *qt422016.Writer, fields util.FieldDescs, values util.ValueMap, ps *cutil.PageState)

func StreamFloat

func StreamFloat(qw422016 *qt422016.Writer, f any)

func StreamFloatArray

func StreamFloatArray(qw422016 *qt422016.Writer, value []any)

func StreamFloatTable added in v1.9.0

func StreamFloatTable(qw422016 *qt422016.Writer, title string, value any, indent int)

func StreamFormatLang added in v1.6.0

func StreamFormatLang(qw422016 *qt422016.Writer, v string, ext string)

func StreamInt

func StreamInt(qw422016 *qt422016.Writer, i any)

func StreamIntArray

func StreamIntArray(qw422016 *qt422016.Writer, value []any)

func StreamIntTable added in v1.9.0

func StreamIntTable(qw422016 *qt422016.Writer, title string, value any, indent int)

func StreamMap added in v1.2.17

func StreamMap(qw422016 *qt422016.Writer, preserveWhitespace bool, m util.ValueMap, ps *cutil.PageState)

func StreamMapArray

func StreamMapArray(qw422016 *qt422016.Writer, preserveWhitespace bool, ps *cutil.PageState, maps ...util.ValueMap)

func StreamMapKeys added in v1.5.4

func StreamMapKeys(qw422016 *qt422016.Writer, m util.ValueMap)

func StreamMapTable added in v1.9.0

func StreamMapTable(qw422016 *qt422016.Writer, title string, preserveWhitespace bool, value util.ValueMap, indent int, ps *cutil.PageState)

func StreamOption

func StreamOption(qw422016 *qt422016.Writer, x any, t *types.Option, ps *cutil.PageState)

func StreamOrderedMap added in v1.5.31

func StreamOrderedMap(qw422016 *qt422016.Writer, preserveWhitespace bool, m *util.OrderedMap[any], ps *cutil.PageState)

func StreamOrderedMapArray added in v1.5.31

func StreamOrderedMapArray(qw422016 *qt422016.Writer, preserveWhitespace bool, ps *cutil.PageState, maps ...*util.OrderedMap[any])

func StreamPackage

func StreamPackage(qw422016 *qt422016.Writer, v util.Pkg)

func StreamPackageTable added in v1.9.0

func StreamPackageTable(qw422016 *qt422016.Writer, title string, value util.Pkg, indent int)

func StreamPercent added in v1.7.20

func StreamPercent(qw422016 *qt422016.Writer, f float64)

func StreamString

func StreamString(qw422016 *qt422016.Writer, value string, classes ...string)

func StreamStringArray

func StreamStringArray(qw422016 *qt422016.Writer, value []string)

func StreamStringRich

func StreamStringRich(qw422016 *qt422016.Writer, value string, code bool, maxLength int, classes ...string)

func StreamStringTable added in v1.9.0

func StreamStringTable(qw422016 *qt422016.Writer, title string, value string, indent int, classes ...string)

func StreamTags added in v1.5.4

func StreamTags(qw422016 *qt422016.Writer, values []string, titles []string, url ...string)

func StreamTagsTable added in v1.9.0

func StreamTagsTable(qw422016 *qt422016.Writer, title string, values []string, titles []string, indent int, url ...string)

func StreamTimestamp

func StreamTimestamp(qw422016 *qt422016.Writer, value *time.Time)

func StreamTimestampDay

func StreamTimestampDay(qw422016 *qt422016.Writer, value *time.Time)

func StreamTimestampMillis added in v1.1.1

func StreamTimestampMillis(qw422016 *qt422016.Writer, value *time.Time)

func StreamTimestampRelative

func StreamTimestampRelative(qw422016 *qt422016.Writer, value *time.Time, static bool)

func StreamTimestampTable added in v1.9.0

func StreamTimestampTable(qw422016 *qt422016.Writer, title string, value *time.Time, indent int)

func StreamType

func StreamType(qw422016 *qt422016.Writer, v types.Type)

func StreamURL added in v1.2.17

func StreamURL(qw422016 *qt422016.Writer, u any, content string, includeExternalIcon bool, ps *cutil.PageState)

func StreamURLTable added in v1.9.0

func StreamURLTable(qw422016 *qt422016.Writer, title string, value *url.URL, indent int, ps *cutil.PageState)

func StreamUUID

func StreamUUID(qw422016 *qt422016.Writer, value *uuid.UUID)

func StreamUUIDTable added in v1.9.0

func StreamUUIDTable(qw422016 *qt422016.Writer, title string, value *uuid.UUID, indent int)

func String

func String(value string, classes ...string) string

func StringArray

func StringArray(value []string) string

func StringRich

func StringRich(value string, code bool, maxLength int, classes ...string) string

func StringTable added in v1.9.0

func StringTable(title string, value string, indent int, classes ...string) string

func Tags added in v1.5.4

func Tags(values []string, titles []string, url ...string) string

func TagsTable added in v1.9.0

func TagsTable(title string, values []string, titles []string, indent int, url ...string) string

func Timestamp

func Timestamp(value *time.Time) string

func TimestampDay

func TimestampDay(value *time.Time) string

func TimestampMillis added in v1.1.1

func TimestampMillis(value *time.Time) string

func TimestampRelative

func TimestampRelative(value *time.Time, static bool) string

func TimestampTable added in v1.9.0

func TimestampTable(title string, value *time.Time, indent int) string

func Type

func Type(v types.Type) string

func URL added in v1.2.17

func URL(u any, content string, includeExternalIcon bool, ps *cutil.PageState) string

func URLTable added in v1.9.0

func URLTable(title string, value *url.URL, indent int, ps *cutil.PageState) string

func UUID

func UUID(value *uuid.UUID) string

func UUIDTable added in v1.9.0

func UUIDTable(title string, value *uuid.UUID, indent int) string

func WriteAny

func WriteAny(qq422016 qtio422016.Writer, x any, ps *cutil.PageState)

func WriteAnyByType added in v1.2.17

func WriteAnyByType(qq422016 qtio422016.Writer, x any, t *types.Wrapped, ps *cutil.PageState)

func WriteAnyTable added in v1.9.0

func WriteAnyTable(qq422016 qtio422016.Writer, title string, value any, indent int, ps *cutil.PageState)

func WriteBool

func WriteBool(qq422016 qtio422016.Writer, b bool)

func WriteBoolIcon added in v1.2.21

func WriteBoolIcon(qq422016 qtio422016.Writer, b bool, size int, cls string, ps *cutil.PageState, titles ...string)

func WriteBoolTable added in v1.9.0

func WriteBoolTable(qq422016 qtio422016.Writer, title string, value bool, indent int, ps *cutil.PageState)
func WriteCodeLink(qq422016 qtio422016.Writer, path string, title string, ps *cutil.PageState)

func WriteColor added in v1.2.18

func WriteColor(qq422016 qtio422016.Writer, clr string, cls string, ps *cutil.PageState)

func WriteColorTable added in v1.9.0

func WriteColorTable(qq422016 qtio422016.Writer, title string, value string, cls string, indent int, ps *cutil.PageState)

func WriteDefault

func WriteDefault(qq422016 qtio422016.Writer, x any, t string, ps *cutil.PageState)

func WriteDiffs

func WriteDiffs(qq422016 qtio422016.Writer, value util.Diffs)

func WriteDiffsSet

func WriteDiffsSet(qq422016 qtio422016.Writer, key string, value util.DiffsSet, limit int, ps *cutil.PageState)

func WriteDiffsTable added in v1.9.0

func WriteDiffsTable(qq422016 qtio422016.Writer, title string, value util.Diffs, indent int)

func WriteDurationSeconds added in v1.2.19

func WriteDurationSeconds(qq422016 qtio422016.Writer, seconds float64)

func WriteFields added in v1.9.0

func WriteFields(qq422016 qtio422016.Writer, fields util.FieldDescs, values util.ValueMap, ps *cutil.PageState)

func WriteFloat

func WriteFloat(qq422016 qtio422016.Writer, f any)

func WriteFloatArray

func WriteFloatArray(qq422016 qtio422016.Writer, value []any)

func WriteFloatTable added in v1.9.0

func WriteFloatTable(qq422016 qtio422016.Writer, title string, value any, indent int)

func WriteFormatLang added in v1.6.0

func WriteFormatLang(qq422016 qtio422016.Writer, v string, ext string)

func WriteInt

func WriteInt(qq422016 qtio422016.Writer, i any)

func WriteIntArray

func WriteIntArray(qq422016 qtio422016.Writer, value []any)

func WriteIntTable added in v1.9.0

func WriteIntTable(qq422016 qtio422016.Writer, title string, value any, indent int)

func WriteMap added in v1.2.17

func WriteMap(qq422016 qtio422016.Writer, preserveWhitespace bool, m util.ValueMap, ps *cutil.PageState)

func WriteMapArray

func WriteMapArray(qq422016 qtio422016.Writer, preserveWhitespace bool, ps *cutil.PageState, maps ...util.ValueMap)

func WriteMapKeys added in v1.5.4

func WriteMapKeys(qq422016 qtio422016.Writer, m util.ValueMap)

func WriteMapTable added in v1.9.0

func WriteMapTable(qq422016 qtio422016.Writer, title string, preserveWhitespace bool, value util.ValueMap, indent int, ps *cutil.PageState)

func WriteOption

func WriteOption(qq422016 qtio422016.Writer, x any, t *types.Option, ps *cutil.PageState)

func WriteOrderedMap added in v1.5.31

func WriteOrderedMap(qq422016 qtio422016.Writer, preserveWhitespace bool, m *util.OrderedMap[any], ps *cutil.PageState)

func WriteOrderedMapArray added in v1.5.31

func WriteOrderedMapArray(qq422016 qtio422016.Writer, preserveWhitespace bool, ps *cutil.PageState, maps ...*util.OrderedMap[any])

func WritePackage

func WritePackage(qq422016 qtio422016.Writer, v util.Pkg)

func WritePackageTable added in v1.9.0

func WritePackageTable(qq422016 qtio422016.Writer, title string, value util.Pkg, indent int)

func WritePercent added in v1.7.20

func WritePercent(qq422016 qtio422016.Writer, f float64)

func WriteString

func WriteString(qq422016 qtio422016.Writer, value string, classes ...string)

func WriteStringArray

func WriteStringArray(qq422016 qtio422016.Writer, value []string)

func WriteStringRich

func WriteStringRich(qq422016 qtio422016.Writer, value string, code bool, maxLength int, classes ...string)

func WriteStringTable added in v1.9.0

func WriteStringTable(qq422016 qtio422016.Writer, title string, value string, indent int, classes ...string)

func WriteTags added in v1.5.4

func WriteTags(qq422016 qtio422016.Writer, values []string, titles []string, url ...string)

func WriteTagsTable added in v1.9.0

func WriteTagsTable(qq422016 qtio422016.Writer, title string, values []string, titles []string, indent int, url ...string)

func WriteTimestamp

func WriteTimestamp(qq422016 qtio422016.Writer, value *time.Time)

func WriteTimestampDay

func WriteTimestampDay(qq422016 qtio422016.Writer, value *time.Time)

func WriteTimestampMillis added in v1.1.1

func WriteTimestampMillis(qq422016 qtio422016.Writer, value *time.Time)

func WriteTimestampRelative

func WriteTimestampRelative(qq422016 qtio422016.Writer, value *time.Time, static bool)

func WriteTimestampTable added in v1.9.0

func WriteTimestampTable(qq422016 qtio422016.Writer, title string, value *time.Time, indent int)

func WriteType

func WriteType(qq422016 qtio422016.Writer, v types.Type)

func WriteURL added in v1.2.17

func WriteURL(qq422016 qtio422016.Writer, u any, content string, includeExternalIcon bool, ps *cutil.PageState)

func WriteURLTable added in v1.9.0

func WriteURLTable(qq422016 qtio422016.Writer, title string, value *url.URL, indent int, ps *cutil.PageState)

func WriteUUID

func WriteUUID(qq422016 qtio422016.Writer, value *uuid.UUID)

func WriteUUIDTable added in v1.9.0

func WriteUUIDTable(qq422016 qtio422016.Writer, title string, value *uuid.UUID, indent int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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