shtml

package module
v0.0.0-...-277be3d Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 2 Imported by: 1

README

Library for creating components and directives using HTML.


sHtml is part of the Syntax Framework

Javascript

Reactivity

docs/js-flows.png

Concepts

  • State The variables of a component
  • Event An external intervention, resulting from actions performed by the user, response to web requests or triggering performed by other parts of the application, such as queues and topics
  • Expression A block of executable code, a function
  • Action An expression executed as a reaction to an event, which can modify the component's state
  • Watcher Intercepts changes in the component state, being able to trigger new actions or schedule the execution of a DOM update
  • Writer Applies the result of executing expressions through template interpolation to the DOM. Can modify texts, attributes of html elements and invoke parameter change of internal components

Flow

  1. Events trigger the execution of an action
  2. An action can modify the component state
  3. State modification is captured and can trigger execution of new actions or schedule DOM updates
  4. In the next Tick (RAF - RequestAnimationFrame), if necessary, the DOM will be updated with the new component state

Documentation

Overview

Package shtml implements a template system that allows the creation of rich web interfaces using html components and directives

<!{H}tml/>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(directive *sht.Directive)

Register a global directive

Types

type TemplateSystem

type TemplateSystem interface {
	Load(filepath string) (string, error)
	Compile(filepath string) (*sht.Compiled, *sht.Context, error)
	NewScope() *sht.Scope
	Register(directives ...*sht.Directive)
}

TemplateSystem interface for configuration, loading and compilation of templates

func New

func New(loader func(filepath string) (string, error)) TemplateSystem

New create a new TemplateSystem

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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