Documentation
¶
Overview ¶
Package renderplan defines the versioned, language-neutral rendering plan consumed by GoBeyond's production renderer.
Index ¶
- Constants
- func Validate(plan *Plan) error
- type Attribute
- type AttributeMode
- type Binary
- type ClientOnly
- type Conditional
- type Each
- type Element
- type Error
- type ErrorCode
- type Expression
- type Fragment
- type Helper
- type IndexExpr
- type Intrinsic
- type IntrinsicSpec
- type IntrinsicStability
- type Literal
- type Namespace
- type Node
- type Path
- type PathSegment
- type Plan
- type RawHTML
- type SafeHTML
- type Ternary
- type Text
- type Unary
Constants ¶
const ( IntrinsicDateGetFullYear = "ecmascript.Date.prototype.getFullYear" IntrinsicDateGetUTCFullYear = "ecmascript.Date.prototype.getUTCFullYear" IntrinsicDateGetMonth = "ecmascript.Date.prototype.getMonth" IntrinsicDateGetUTCMonth = "ecmascript.Date.prototype.getUTCMonth" IntrinsicDateGetDate = "ecmascript.Date.prototype.getDate" IntrinsicDateGetUTCDate = "ecmascript.Date.prototype.getUTCDate" IntrinsicDateGetHours = "ecmascript.Date.prototype.getHours" IntrinsicDateGetUTCHours = "ecmascript.Date.prototype.getUTCHours" IntrinsicDateGetMinutes = "ecmascript.Date.prototype.getMinutes" IntrinsicDateGetUTCMinutes = "ecmascript.Date.prototype.getUTCMinutes" IntrinsicDateGetSeconds = "ecmascript.Date.prototype.getSeconds" IntrinsicDateGetUTCSeconds = "ecmascript.Date.prototype.getUTCSeconds" )
Intrinsic names are stable protocol identifiers for JavaScript operations with explicitly implemented Go equivalents.
const APIVersionV1Alpha1 = "gobeyond.render/v1alpha1"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attribute ¶
type Attribute struct {
Name string `json:"name"`
Value Expression `json:"value"`
Mode AttributeMode `json:"mode,omitempty"`
}
type AttributeMode ¶
type AttributeMode string
const ( AttributeString AttributeMode = "string" AttributeBoolean AttributeMode = "boolean" AttributeURL AttributeMode = "url" AttributeStyle AttributeMode = "style" )
type Binary ¶
type Binary struct {
Kind string `json:"kind"`
Operator string `json:"operator"`
Left Expression `json:"left"`
Right Expression `json:"right"`
}
type ClientOnly ¶
type Conditional ¶
type Conditional struct {
Kind string `json:"kind"`
Test Expression `json:"test"`
Consequent Node `json:"consequent"`
Alternate Node `json:"alternate,omitempty"`
}
type Each ¶
type Each struct {
Kind string `json:"kind"`
Items Expression `json:"items"`
Item string `json:"item"`
Index string `json:"index,omitempty"`
Key Expression `json:"key"`
When Expression `json:"when,omitempty"`
Body Node `json:"body"`
}
type Expression ¶
type Expression interface {
// contains filtered or unexported methods
}
Expression is implemented by portable rendering-plan expressions.
type Helper ¶
type Helper struct {
Kind string `json:"kind"`
Name string `json:"name"`
Arguments []Expression `json:"arguments"`
}
type IndexExpr ¶
type IndexExpr struct {
Kind string `json:"kind"` // "index"
Object Expression `json:"object"`
Index Expression `json:"index"`
}
IndexExpr is a dynamic property or array-element lookup (object[index]). Named IndexExpr to avoid clashing with the PathSegment Index helper.
type Intrinsic ¶
type Intrinsic struct {
Kind string `json:"kind"`
Name string `json:"name"`
Arguments []Expression `json:"arguments"`
}
Intrinsic is a compiler-recognized platform operation with equivalent Go runtime semantics. Names are stable protocol identifiers, not Go function names, so the registry can grow without adding expression kinds.
type IntrinsicSpec ¶
type IntrinsicSpec struct {
Arity int
Stability IntrinsicStability
}
func IntrinsicDefinition ¶
func IntrinsicDefinition(name string) (IntrinsicSpec, bool)
IntrinsicDefinition reports the validation and evaluation contract for a compiler-recognized platform operation.
type IntrinsicStability ¶
type IntrinsicStability string
const ( // IntrinsicPure depends only on its explicit arguments. IntrinsicPure IntrinsicStability = "pure" // IntrinsicRenderSnapshot reads one value captured at the start of a render. // The same instant is embedded in hydration JSON as renderNow so the browser // Vite rewrite can return identical numeric Date projections on first paint. IntrinsicRenderSnapshot IntrinsicStability = "render-snapshot" )
type Node ¶
type Node interface {
// contains filtered or unexported methods
}
Node is implemented by every rendering-plan node.
type Path ¶
type Path struct {
Kind string `json:"kind"`
Path []PathSegment `json:"path"`
}
type PathSegment ¶
PathSegment is either a property name or a non-negative array index.
func Index ¶
func Index(index int) PathSegment
func Property ¶
func Property(name string) PathSegment
func (PathSegment) MarshalJSON ¶
func (s PathSegment) MarshalJSON() ([]byte, error)
func (*PathSegment) UnmarshalJSON ¶
func (s *PathSegment) UnmarshalJSON(data []byte) error
type Plan ¶
type Plan struct {
APIVersion string `json:"apiVersion"`
RouteID string `json:"routeId"`
Root Node `json:"root"`
}
Plan is a complete rendering plan for one route.
func (*Plan) UnmarshalJSON ¶
type RawHTML ¶
type RawHTML struct {
Kind string `json:"kind"`
Value Expression `json:"value"`
}
type SafeHTML ¶
type SafeHTML struct {
// contains filtered or unexported fields
}
SafeHTML marks HTML that was sanitized by the application before it crossed the rendering boundary. The unexported representation prevents plain strings from being used accidentally.
func TrustedHTML ¶
TrustedHTML establishes an explicit trust boundary. Callers should only pass output from their configured sanitizer.
func (SafeHTML) MarshalJSON ¶
MarshalJSON preserves the sanitized string in hydration props. SafeHTML deliberately has no UnmarshalJSON method: untrusted JSON cannot establish this trust marker.
type Ternary ¶
type Ternary struct {
Kind string `json:"kind"`
Test Expression `json:"test"`
Consequent Expression `json:"consequent"`
Alternate Expression `json:"alternate"`
}
Ternary is a scalar conditional expression (test ? consequent : alternate). Node-level branching remains Conditional.
type Text ¶
type Text struct {
Kind string `json:"kind"`
Value Expression `json:"value"`
}
type Unary ¶
type Unary struct {
Kind string `json:"kind"`
Operator string `json:"operator"`
Operand Expression `json:"operand"`
}