Documentation
¶
Index ¶
- Variables
- func AddListener(listener any)
- func Average(cb, cs float64) float64
- func Bind(renderFactoryFunc func(string, ...any) any, context ContextInterface, ...) func(string, ...any) any
- func Chunker(input string, fail func(msg string, pos int)) []string
- func ClearInternTable()
- func Clone(obj map[string]any) map[string]any
- func ColorARGB(color any) any
- func ColorAlpha(color any) any
- func ColorBlue(color any) any
- func ColorContrast(color, dark, light, threshold any) any
- func ColorDarken(color, amount any, method ...any) any
- func ColorDesaturate(color, amount any, method ...any) any
- func ColorFade(color, amount any) any
- func ColorFadeIn(color, amount any, method ...any) any
- func ColorFadeOut(color, amount any, method ...any) any
- func ColorFunction(colorStr any) any
- func ColorGrayscale(color any) any
- func ColorGreen(color any) any
- func ColorGreyscale(color any) any
- func ColorHSL(h, s, l any) any
- func ColorHSLA(h, s, l, a any) any
- func ColorHSV(h, s, v any) any
- func ColorHSVA(h, s, v, a any) any
- func ColorHSVHue(color any) any
- func ColorHSVSaturation(color any) any
- func ColorHSVValue(color any) any
- func ColorHue(color any) any
- func ColorLighten(color, amount any, method ...any) any
- func ColorLightness(color any) any
- func ColorLuma(color any) any
- func ColorLuminance(color any) any
- func ColorMix(color1, color2, weight any) any
- func ColorRGB(r, g, b any) any
- func ColorRGBA(r, g, b, a any) any
- func ColorRed(color any) any
- func ColorSaturate(color, amount any, method ...any) any
- func ColorSaturation(color any) any
- func ColorShade(color, amount any) any
- func ColorSpin(color, amount any) any
- func ColorTint(color, amount any) any
- func Compare(a, b *Node) int
- func CopyArray(arr []any) []any
- func CopyOptions(obj1, obj2 map[string]any) map[string]any
- func CreateLessContextWithPlugins(options map[string]any) (*LessContext, *NodeJSPluginBridge, error)
- func CreateParseWithContext(environment any, parseTree any, ...) func(*LessContext, string, map[string]any, ParseCallbackFunc) any
- func CreateRender(environment any, parseTreeConstructor func(any, any) any) func(string, ...any) any
- func DataURI(context map[string]any, mimetypeNode, filePathNode any) any
- func Debug(msg any)
- func DebugInfo(context map[string]any, node any, separator string) string
- func DefaultStylize(str string, style string) string
- func DefaultValue[T any]() T
- func Defaults(obj1, obj2 map[string]any) map[string]any
- func Difference(cb, cs float64) float64
- func Each(list any, rs any) any
- func EachWithContext(list any, rs any, ctx *Context) any
- func Error(msg any)
- func Exclusion(cb, cs float64) float64
- func Extract(values any, indexNode any) any
- func Factory(environment map[string]any, fileManagers []any) map[string]any
- func FlattenArray(arr []any, result ...[]any) []any
- func GetBooleanFunctions() map[string]any
- func GetColorBlendingFunctions() map[string]any
- func GetColorFunctions() map[string]any
- func GetContextMapFromPool() map[string]any
- func GetDataURIFunctions() map[string]any
- func GetDebugInfo(context map[string]any, ruleset *Ruleset, separator string) string
- func GetFrameSliceFromPool() []any
- func GetItemsFromNode(node any) []any
- func GetListFunctions() map[string]any
- func GetTypeIndexForNodeType(nodeType string) int
- func GetWrappedBooleanFunctions() map[string]interface{}
- func GetWrappedColorBlendingFunctions() map[string]interface{}
- func GetWrappedColorFunctions() map[string]interface{}
- func GetWrappedDataURIFunctions() map[string]interface{}
- func GetWrappedListFunctions() map[string]interface{}
- func GetWrappedMathFunctions() map[string]interface{}
- func GetWrappedNumberFunctions() map[string]interface{}
- func GetWrappedStringFunctions() map[string]interface{}
- func GetWrappedStyleFunctions() map[string]interface{}
- func GetWrappedSvgFunctions() map[string]interface{}
- func GetWrappedTypesFunctions() map[string]interface{}
- func Hardlight(cb, cs float64) float64
- func If(context *Context, condition any, trueValue any, falseValue any) any
- func ImageHeight(context map[string]any, filePathNode any) any
- func ImageSize(context map[string]any, filePathNode any) any
- func ImageWidth(context map[string]any, filePathNode any) any
- func Info(msg any)
- func Intern(s string) string
- func InternBytes(b []byte) string
- func InternedCount() int
- func IsMathParensDivision(context any) bool
- func IsNullOrUndefined(val any) bool
- func Max(args ...interface{}) (interface{}, error)
- func Merge(obj1, obj2 map[string]any) map[string]any
- func Min(args ...interface{}) (interface{}, error)
- func Multiply(cb, cs float64) float64
- func Negation(cb, cs float64) float64
- func NewImportManager(environment ImportManagerEnvironment) func(less any, context map[string]any, rootFileInfo *FileInfo) *ImportManager
- func NumericCompare(a, b float64) int
- func NumericCompareStrings(a, b string) int
- func Overlay(cb, cs float64) float64
- func PutEvalToPool(e *Eval)
- func PutFrameSliceToPool(s []any)
- func PutVariableResultMap(m map[string]any)
- func RecoverableOperation[T any](operation func() T) (result T, err error)
- func RegisterColorFunctions(registry *Registry)
- func RegisterSvgFunctions(registry *Registry)
- func RegisterTestFunctions(registry *Registry)
- func ReleaseCSSVisitorUtils(u *CSSVisitorUtils)
- func ReleaseContextMap(m map[string]any)
- func ReleaseDeclaration(d *Declaration)
- func ReleaseElement(e *Element)
- func ReleaseExpression(e *Expression)
- func ReleaseExtendFinderVisitor(v *ExtendFinderVisitor)
- func ReleaseJoinSelectorVisitor(v *JoinSelectorVisitor)
- func ReleaseNode(n *Node)
- func ReleaseProcessExtendsVisitor(v *ProcessExtendsVisitor)
- func ReleaseRuleset(r *Ruleset)
- func ReleaseSelector(s *Selector)
- func ReleaseSetTreeVisibilityVisitor(v *SetTreeVisibilityVisitor)
- func ReleaseToCSSVisitor(v *ToCSSVisitor)
- func ReleaseTree(root any)
- func ReleaseUnit(u *Unit)
- func RemoveListener(listener any)
- func ResetExtendID()
- func SafeArrayAccess(arr any, index int) (any, bool)
- func SafeEval(value any, context any) any
- func SafeFramesAccess(context any) ([]any, bool)
- func SafeGenCSS(value any, context any, output *CSSOutput)
- func SafeMapAccess[K comparable, V any](m map[K]V, key K) (V, bool)
- func SafeNilCheck(value any) bool
- func SafeParseFloat(s string) (float64, bool)
- func SafeSliceAccess[T any](slice []T, index int) (T, bool)
- func SafeSliceIndex(slice []any, index int) (any, bool)
- func SafeStringAccess(value any) string
- func SafeStringConcat(values ...any) string
- func SafeStringIndex(s string, index int) (byte, bool)
- func SafeStringSlice(s string, start, end int) (string, bool)
- func SafeToCSS(value any, context any) string
- func SafeTypeAssertion[T any](value any) (T, bool)
- func Screen(cb, cs float64) float64
- func Self(n any) any
- func SerializeVars(vars map[string]any) string
- func SetParserLogger(l ParserLogger)
- func Softlight(cb, cs float64) float64
- func SpaceSeparatedValues(expr ...any) any
- func TransformTree(root any, options map[string]any) any
- func TryParseDimensionString(str string) any
- func WarmPluginCache(root any, bridge *NodeJSPluginBridge, evalContext any) (int, error)
- func WarmPluginCacheFromLazyBridge(root any, lazyBridge *LazyNodeJSPluginBridge, evalContext any) (int, error)
- func Warn(msg any)
- type APIContext
- type AbstractFileManager
- func (afm *AbstractFileManager) AlwaysMakePathsAbsolute() bool
- func (afm *AbstractFileManager) ExtractURLParts(url, baseURL string) (*URLParts, error)
- func (afm *AbstractFileManager) GetPath(filename string) string
- func (afm *AbstractFileManager) IsPathAbsolute(filename string) bool
- func (afm *AbstractFileManager) Join(basePath, laterPath string) string
- func (afm *AbstractFileManager) PathDiff(url, baseURL string) string
- func (afm *AbstractFileManager) SupportsSync() bool
- func (afm *AbstractFileManager) TryAppendExtension(path, ext string) string
- func (afm *AbstractFileManager) TryAppendLessExtension(path string) string
- type AcceptableNode
- type AcceptorNode
- type AdditionalData
- type Anonymous
- func (a *Anonymous) Compare(other any) any
- func (a *Anonymous) CopyVisibilityInfo(info map[string]any)
- func (a *Anonymous) Eval(context any) (any, error)
- func (a *Anonymous) GenCSS(context any, output *CSSOutput)
- func (a *Anonymous) GetType() string
- func (a *Anonymous) GetTypeIndex() int
- func (a *Anonymous) GetValue() any
- func (a *Anonymous) IsRulesetLike() bool
- func (a *Anonymous) IsVisible() bool
- func (a *Anonymous) Operate(context any, op string, other any) any
- func (a *Anonymous) ToCSS(context any) string
- type ArrayLikeNode
- type Assignment
- type AtRule
- func (a *AtRule) Accept(visitor any)
- func (a *AtRule) BubbleSelectors(selectors any)
- func (a *AtRule) Eval(context any) (any, error)
- func (a *AtRule) EvalNested(context any) any
- func (a *AtRule) EvalTop(context any) any
- func (a *AtRule) Find(selector any, self any, filter func(any) bool) []any
- func (a *AtRule) GenCSS(context any, output *CSSOutput)
- func (a *AtRule) GetAllExtends() []*Extend
- func (a *AtRule) GetDebugInfo() any
- func (a *AtRule) GetIsRooted() bool
- func (a *AtRule) GetName() string
- func (a *AtRule) GetRules() []any
- func (a *AtRule) GetType() string
- func (a *AtRule) IsCharset() bool
- func (a *AtRule) IsRulesetLike() any
- func (a *AtRule) OutputRuleset(context any, output *CSSOutput, rules []any)
- func (a *AtRule) Permute(arr []any) any
- func (a *AtRule) Rulesets() []any
- func (a *AtRule) SetAllExtends(extends []*Extend)
- func (a *AtRule) SetRules(rules []any)
- func (a *AtRule) ToCSS(context any) string
- func (a *AtRule) Type() string
- func (a *AtRule) Variable(name string) any
- type AtRuleRule
- type Attribute
- type BaseURLParseError
- type BlendMode
- type CSSGenerator
- type CSSOutput
- type CSSVisitorUtils
- func (u *CSSVisitorUtils) ContainsSilentNonBlockedChild(bodyRules []any) bool
- func (u *CSSVisitorUtils) HasVisibleSelector(rulesetNode any) bool
- func (u *CSSVisitorUtils) IsEmpty(owner any) bool
- func (u *CSSVisitorUtils) IsVisibleRuleset(rulesetNode any) bool
- func (u *CSSVisitorUtils) KeepOnlyVisibleChilds(owner any)
- func (u *CSSVisitorUtils) Reset(context any)
- func (u *CSSVisitorUtils) ResolveVisibility(node any) any
- func (u *CSSVisitorUtils) ResolveVisibilityMedia(node any) any
- type CSSable
- type Call
- type CallbackFunc
- type Color
- func ColorBlend(mode BlendMode, color1, color2 *Color) *Color
- func ColorBlendAverage(color1, color2 *Color) *Color
- func ColorBlendDifference(color1, color2 *Color) *Color
- func ColorBlendExclusion(color1, color2 *Color) *Color
- func ColorBlendHardlight(color1, color2 *Color) *Color
- func ColorBlendMultiply(color1, color2 *Color) *Color
- func ColorBlendNegation(color1, color2 *Color) *Color
- func ColorBlendOverlay(color1, color2 *Color) *Color
- func ColorBlendScreen(color1, color2 *Color) *Color
- func ColorBlendSoftlight(color1, color2 *Color) *Color
- func FromKeyword(keyword string) *Color
- func NewColor(rgb any, alpha float64, originalForm string) *Color
- func (c *Color) Compare(other *Color) int
- func (c *Color) Eval(context any) any
- func (c *Color) GenCSS(context any, output *CSSOutput)
- func (c *Color) GetAllowRoot() bool
- func (c *Color) GetAlpha() float64
- func (c *Color) GetColorValue() string
- func (c *Color) GetRGB() []float64
- func (c *Color) GetType() string
- func (c *Color) Luma() float64
- func (c *Color) OperateColor(context any, op string, other *Color) *Color
- func (c *Color) ToARGB() string
- func (c *Color) ToCSS(context any) string
- func (c *Color) ToHSL() HSL
- func (c *Color) ToHSV() HSV
- func (c *Color) ToRGB() string
- type ColorFunctionDefinition
- type ColorFunctionWrapper
- type Combinator
- type Comment
- func (c *Comment) Accept(visitor any)
- func (c *Comment) Eval(context any) any
- func (c *Comment) GenCSS(context any, output *CSSOutput)
- func (c *Comment) GetDebugInfo() map[string]any
- func (c *Comment) GetType() string
- func (c *Comment) IsSilent(context any) bool
- func (c *Comment) IsVisible() bool
- func (c *Comment) SetParent(node any, parent *Node)
- type Compareable
- type CompileOptions
- type CompileResult
- type ConcretePromise
- type Condition
- type Container
- func (c *Container) Accept(visitor any)
- func (c *Container) BubbleSelectors(selectors any)
- func (c *Container) Eval(context any) (any, error)
- func (c *Container) EvalNested(context any) any
- func (c *Container) EvalTop(context any) any
- func (c *Container) GenCSS(context any, output *CSSOutput)
- func (c *Container) GetRules() []any
- func (c *Container) GetType() string
- func (c *Container) GetTypeIndex() int
- func (c *Container) Permute(arr []any) any
- func (c *Container) Type() string
- type ContainerSyntaxOptions
- type ContainerSyntaxOptionsType
- type Context
- type ContextInterface
- type DataURIFunctionWrapper
- type Declaration
- func (d *Declaration) Accept(visitor any)
- func (d *Declaration) Eval(context any) (any, error)
- func (d *Declaration) GenCSS(context any, output *CSSOutput)
- func (d *Declaration) GenCSSSourceMap(context map[string]any, output *SourceMapOutput)
- func (d *Declaration) GetImportant() bool
- func (d *Declaration) GetMerge() any
- func (d *Declaration) GetName() string
- func (d *Declaration) GetType() string
- func (d *Declaration) GetTypeIndex() int
- func (d *Declaration) GetValue() any
- func (d *Declaration) GetVariable() bool
- func (d *Declaration) MakeImportant() any
- func (d *Declaration) MergeType() string
- func (d *Declaration) Release()
- func (d *Declaration) SetImportant(important bool)
- func (d *Declaration) SetValue(value any)
- func (d *Declaration) ToCSS(context any) string
- type DefaultFunc
- type DefaultFunctionCallerFactory
- type DefaultFunctionDefinition
- type DefaultFunctions
- type DefaultParserFunctionCaller
- type DefaultPluginLoader
- func (d *DefaultPluginLoader) EvalPlugin(contents string, newEnv *Parse, importManager any, pluginArgs map[string]any, ...) any
- func (d *DefaultPluginLoader) LoadPlugin(path, currentDirectory string, context map[string]any, environment any, ...) any
- func (d *DefaultPluginLoader) LoadPluginSync(path, currentDirectory string, context map[string]any, environment any, ...) any
- type DeferredPluginInfo
- type DetachedRuleset
- func (dr *DetachedRuleset) Accept(visitor any)
- func (dr *DetachedRuleset) CallEval(context any) any
- func (dr *DetachedRuleset) Eval(context any) any
- func (dr *DetachedRuleset) EvalFirst() bool
- func (dr *DetachedRuleset) GetRuleset() any
- func (dr *DetachedRuleset) GetType() string
- func (dr *DetachedRuleset) GetTypeIndex() int
- func (dr *DetachedRuleset) HasRuleset() bool
- func (dr *DetachedRuleset) Type() string
- type Dimension
- func Abs(n *Dimension) (*Dimension, error)
- func Acos(n *Dimension) (*Dimension, error)
- func Asin(n *Dimension) (*Dimension, error)
- func Atan(n *Dimension) (*Dimension, error)
- func Ceil(n *Dimension) (*Dimension, error)
- func Convert(val *Dimension, unit *Dimension) (*Dimension, error)
- func Cos(n *Dimension) (*Dimension, error)
- func Floor(n *Dimension) (*Dimension, error)
- func Length(values any) *Dimension
- func MathHelper(fn func(float64) float64, unit *Unit, n any) (*Dimension, error)
- func Mod(a *Dimension, b *Dimension) (*Dimension, error)
- func NewDimension(value any, unit any) (*Dimension, error)
- func NewDimensionFrom(value float64, unit *Unit) *Dimension
- func Percentage(n *Dimension) (*Dimension, error)
- func Pi() (*Dimension, error)
- func Pow(x interface{}, y interface{}) (*Dimension, error)
- func Round(n *Dimension, f *Dimension) (*Dimension, error)
- func Sin(n *Dimension) (*Dimension, error)
- func Sqrt(n *Dimension) (*Dimension, error)
- func Tan(n *Dimension) (*Dimension, error)
- func (d *Dimension) Accept(visitor any)
- func (d *Dimension) Compare(other any) *int
- func (d *Dimension) ConvertTo(conversions any) *Dimension
- func (d *Dimension) Eval(context any) (any, error)
- func (d *Dimension) GenCSS(context any, output *CSSOutput)
- func (d *Dimension) GetType() string
- func (d *Dimension) GetUnit() any
- func (d *Dimension) GetValue() float64
- func (d *Dimension) Operate(context any, op string, other *Dimension) *Dimension
- func (d *Dimension) OperateArithmetic(context any, op string, a, b float64) float64
- func (d *Dimension) ToCSS(context any) string
- func (d *Dimension) ToColor() *Color
- func (d *Dimension) Unify() *Dimension
- type DirectDispatchVisitor
- type EachFunctionDef
- type Element
- func (e *Element) Accept(visitor any)
- func (e *Element) Clone() *Element
- func (e *Element) Eval(context any) (any, error)
- func (e *Element) GenCSS(context any, output *CSSOutput)
- func (e *Element) GetType() string
- func (e *Element) Release()
- func (e *Element) ToCSS(context any) string
- func (e *Element) Type() string
- type EndState
- type EntityParsers
- func (e *EntityParsers) Arguments(prevArgs []any) []any
- func (e *EntityParsers) Assignment() any
- func (e *EntityParsers) Call() any
- func (e *EntityParsers) Color() any
- func (e *EntityParsers) ColorKeyword() any
- func (e *EntityParsers) CustomFuncCall(name string) map[string]any
- func (e *EntityParsers) DeclarationCall() any
- func (e *EntityParsers) Dimension() any
- func (e *EntityParsers) JavaScript() any
- func (e *EntityParsers) Keyword() any
- func (e *EntityParsers) Literal() any
- func (e *EntityParsers) MixinLookup() any
- func (e *EntityParsers) Property() any
- func (e *EntityParsers) PropertyCurly() any
- func (e *EntityParsers) Quoted(forceEscaped bool) any
- func (e *EntityParsers) URL() any
- func (e *EntityParsers) UnicodeDescriptor() any
- func (e *EntityParsers) Variable() any
- func (e *EntityParsers) VariableCurly() any
- type EnvironmentEnvironment
- type EnvironmentFileManager
- type EnvironmentPluginManager
- type ErrorDetails
- type Eval
- func (e *Eval) CallPluginFunction(name string, args ...any) (any, error)
- func (e *Eval) CopyEvalToMap(target map[string]any, includeMediaContext bool)
- func (e *Eval) CopyWithFrames(frames []any) *Eval
- func (e *Eval) EnterCalc()
- func (e *Eval) EnterPluginScope() any
- func (e *Eval) ExitCalc()
- func (e *Eval) ExitPluginScope()
- func (e *Eval) GetDefaultFunc() *DefaultFunc
- func (e *Eval) GetFrames() []ParserFrame
- func (e *Eval) GetFramesAny() []any
- func (e *Eval) GetImportantFromCurrentScope() string
- func (e *Eval) GetImportantScope() []map[string]bool
- func (e *Eval) GetImportantScopeAny() []map[string]any
- func (e *Eval) HasPluginFunction(name string) bool
- func (e *Eval) InParenthesis()
- func (e *Eval) IsInCalc() bool
- func (e *Eval) IsMathOn() bool
- func (e *Eval) IsMathOnWithOp(op string) bool
- func (e *Eval) LookupPluginFunction(name string) (any, bool)
- func (e *Eval) NewMixinEvalContext(frames []any) *Eval
- func (e *Eval) NormalizePath(path string) string
- func (e *Eval) OutOfParenthesis()
- func (e *Eval) PathRequiresRewrite(path string) bool
- func (e *Eval) PopImportantScope() ImportantScopeEntry
- func (e *Eval) PushImportantScope()
- func (e *Eval) RewritePath(path, rootpath string) string
- func (e *Eval) RewritePathForImport(path, rootpath string) string
- func (e *Eval) SetImportantInCurrentScope(important string)
- func (e *Eval) SetMathOn(mathOn bool)
- func (e *Eval) ToMap() map[string]any
- type EvalContext
- type Evaluator
- type ExamplePlugin
- type ExamplePluginEvaluator
- type ExamplePostProcessor
- type ExamplePreProcessor
- type Expression
- func (e *Expression) Accept(visitor any)
- func (e *Expression) Eval(context any) (any, error)
- func (e *Expression) GenCSS(context any, output *CSSOutput)
- func (e *Expression) GetParens() bool
- func (e *Expression) GetParensInOp() bool
- func (e *Expression) GetType() string
- func (e *Expression) GetValue() []any
- func (e *Expression) Release()
- func (e *Expression) ThrowAwayComments()
- func (e *Expression) ToCSS(context any) string
- type Extend
- func (e *Extend) Accept(visitor any)
- func (e *Extend) Clone(context any) *Extend
- func (e *Extend) Eval(context any) (*Extend, error)
- func (e *Extend) FindSelfSelectors(selectors []any)
- func (e *Extend) GenCSS(context any, output *CSSOutput)
- func (e *Extend) GetType() string
- func (e *Extend) IsVisible() bool
- func (e *Extend) Type() string
- type ExtendFinderVisitor
- func (efv *ExtendFinderVisitor) IsReplacing() bool
- func (efv *ExtendFinderVisitor) Reset()
- func (efv *ExtendFinderVisitor) Run(root any) any
- func (efv *ExtendFinderVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs)
- func (efv *ExtendFinderVisitor) VisitAtRuleOut(atRuleNode any)
- func (efv *ExtendFinderVisitor) VisitDeclaration(declNode any, visitArgs *VisitArgs)
- func (efv *ExtendFinderVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs)
- func (efv *ExtendFinderVisitor) VisitMediaOut(mediaNode any)
- func (efv *ExtendFinderVisitor) VisitMixinDefinition(mixinDefinitionNode any, visitArgs *VisitArgs)
- func (efv *ExtendFinderVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
- func (efv *ExtendFinderVisitor) VisitNodeOut(node any) bool
- func (efv *ExtendFinderVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs)
- func (efv *ExtendFinderVisitor) VisitRulesetOut(rulesetNode any)
- type FileCache
- type FileInfo
- type FileManager
- type FileSystemFileManager
- func (fm *FileSystemFileManager) AlwaysMakePathsAbsolute() bool
- func (fm *FileSystemFileManager) CanonicalizeFilename(filename string) string
- func (fm *FileSystemFileManager) ConvertToFileUrl(filename string, url string, options map[string]any) string
- func (fm *FileSystemFileManager) GetPath(filename string) string
- func (fm *FileSystemFileManager) IsPathAbsolute(filename string) bool
- func (fm *FileSystemFileManager) Join(basePath, relativePath string) string
- func (fm *FileSystemFileManager) LoadFile(filename, currentDirectory string, context map[string]any, ...) any
- func (fm *FileSystemFileManager) LoadFileSync(filename, currentDirectory string, context map[string]any, ...) *LoadedFile
- func (fm *FileSystemFileManager) PathDiff(url, baseUrl string) string
- func (fm *FileSystemFileManager) Supports(filename, currentDirectory string, options map[string]any, ...) bool
- func (fm *FileSystemFileManager) SupportsSync(filename, currentDirectory string, options map[string]any, ...) bool
- type FlexibleFunctionDef
- type Frame
- type FunctionCallerFactory
- type FunctionDefinition
- type FunctionRegistry
- type Functions
- type HSL
- type HSV
- type IfFunctionDef
- type ImageHeightFunctionWrapper
- type ImageSizeFunctionWrapper
- type ImageWidthFunctionWrapper
- type Implementation
- type Import
- func (i *Import) Accept(visitor any)
- func (i *Import) DoEval(context any) (any, error)
- func (i *Import) Eval(context any) (any, error)
- func (i *Import) EvalForImport(context any) *Import
- func (i *Import) EvalPath(context any) any
- func (i *Import) FileInfo() map[string]any
- func (i *Import) GenCSS(context any, output *CSSOutput)
- func (i *Import) GetIndex() int
- func (i *Import) GetPath() any
- func (i *Import) GetRoot() interface{ ... }
- func (i *Import) GetType() string
- func (i *Import) GetTypeIndex() int
- func (i *Import) IsVariableImport() bool
- func (i *Import) IsVisible() bool
- type ImportItem
- type ImportManager
- func (im *ImportManager) Contents() map[string]string
- func (im *ImportManager) ContentsIgnoredChars() map[string]int
- func (im *ImportManager) Files() map[string]*FileCache
- func (im *ImportManager) Push(path string, tryAppendExtension bool, currentFileInfo *FileInfo, ...)
- func (im *ImportManager) RootFilename() string
- type ImportManagerEnvironment
- type ImportOptions
- type ImportSequencer
- type ImportVisitor
- func (iv *ImportVisitor) IsReplacing() bool
- func (iv *ImportVisitor) Run(root any)
- func (iv *ImportVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs)
- func (iv *ImportVisitor) VisitAtRuleOut(atRuleNode any)
- func (iv *ImportVisitor) VisitDeclaration(declNode any, visitArgs *VisitArgs)
- func (iv *ImportVisitor) VisitDeclarationOut(declNode any)
- func (iv *ImportVisitor) VisitImport(importNode any, visitArgs *VisitArgs)
- func (iv *ImportVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs)
- func (iv *ImportVisitor) VisitMediaOut(mediaNode any)
- func (iv *ImportVisitor) VisitMixinDefinition(mixinDefinitionNode any, visitArgs *VisitArgs)
- func (iv *ImportVisitor) VisitMixinDefinitionOut(mixinDefinitionNode any)
- func (iv *ImportVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
- func (iv *ImportVisitor) VisitNodeOut(node any) bool
- func (iv *ImportVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs)
- func (iv *ImportVisitor) VisitRulesetOut(rulesetNode any)
- type ImportantScopeEntry
- type Imports
- type IsDefinedFunctionDef
- type JSArrayResult
- type JSEmptyResult
- type JSVisitorAdapter
- type JSVisitorRegistry
- func (r *JSVisitorRegistry) GetAdapters() []*JSVisitorAdapter
- func (r *JSVisitorRegistry) GetPostEvalAdapters() []*JSVisitorAdapter
- func (r *JSVisitorRegistry) GetPreEvalAdapters() []*JSVisitorAdapter
- func (r *JSVisitorRegistry) RefreshFromNodeJS() error
- func (r *JSVisitorRegistry) RegisterWithPluginManager(pm *PluginManager)
- type JavaScript
- type JoinSelectorVisitor
- func (jsv *JoinSelectorVisitor) IsReplacing() bool
- func (jsv *JoinSelectorVisitor) Reset()
- func (jsv *JoinSelectorVisitor) Run(root any) any
- func (jsv *JoinSelectorVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs) any
- func (jsv *JoinSelectorVisitor) VisitContainer(containerNode any, visitArgs *VisitArgs) any
- func (jsv *JoinSelectorVisitor) VisitDeclaration(declNode any, visitArgs *VisitArgs) any
- func (jsv *JoinSelectorVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs) any
- func (jsv *JoinSelectorVisitor) VisitMixinDefinition(mixinDefinitionNode any, visitArgs *VisitArgs) any
- func (jsv *JoinSelectorVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
- func (jsv *JoinSelectorVisitor) VisitNodeOut(node any) bool
- func (jsv *JoinSelectorVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs) any
- func (jsv *JoinSelectorVisitor) VisitRulesetOut(rulesetNode any)
- type JsEvalNode
- type Keyword
- type LazyNodeJSPluginBridge
- func (lb *LazyNodeJSPluginBridge) CallFunction(name string, args ...any) (any, error)
- func (lb *LazyNodeJSPluginBridge) CallFunctionWithContext(name string, evalContext runtime.EvalContextProvider, args ...any) (any, error)
- func (lb *LazyNodeJSPluginBridge) Close() error
- func (lb *LazyNodeJSPluginBridge) EnterScope() *runtime.PluginScope
- func (lb *LazyNodeJSPluginBridge) EvalPlugin(contents string, newEnv *Parse, importManager any, pluginArgs map[string]any, ...) any
- func (lb *LazyNodeJSPluginBridge) ExitScope() *runtime.PluginScope
- func (lb *LazyNodeJSPluginBridge) GetBridge() (*NodeJSPluginBridge, error)
- func (lb *LazyNodeJSPluginBridge) GetPostEvalVisitors() []*runtime.JSVisitor
- func (lb *LazyNodeJSPluginBridge) GetPostProcessors() []*runtime.JSPostProcessor
- func (lb *LazyNodeJSPluginBridge) GetPreEvalVisitors() []*runtime.JSVisitor
- func (lb *LazyNodeJSPluginBridge) GetPreProcessors() []*runtime.JSPreProcessor
- func (lb *LazyNodeJSPluginBridge) GetProcessorManager() *runtime.ProcessorManager
- func (lb *LazyNodeJSPluginBridge) GetRuntime() *runtime.NodeJSRuntime
- func (lb *LazyNodeJSPluginBridge) GetScope() *runtime.PluginScope
- func (lb *LazyNodeJSPluginBridge) GetVisitors() []*runtime.JSVisitor
- func (lb *LazyNodeJSPluginBridge) HasFunction(name string) bool
- func (lb *LazyNodeJSPluginBridge) IsInitialized() bool
- func (lb *LazyNodeJSPluginBridge) LoadPlugin(path, currentDirectory string, context map[string]any, environment any, ...) any
- func (lb *LazyNodeJSPluginBridge) LoadPluginSync(path, currentDirectory string, context map[string]any, environment any, ...) any
- func (lb *LazyNodeJSPluginBridge) LookupFunction(name string) (*runtime.JSFunctionDefinition, bool)
- func (lb *LazyNodeJSPluginBridge) RunPostProcessors(css string, options map[string]any) (string, error)
- func (lb *LazyNodeJSPluginBridge) RunPreProcessors(input string, options map[string]any) (string, error)
- func (lb *LazyNodeJSPluginBridge) WasUsed() bool
- type LessContext
- type LessError
- func (le *LessError) ColumnNumber() int
- func (le *LessError) Error() string
- func (le *LessError) ErrorType() string
- func (le *LessError) GetErrorType() string
- func (le *LessError) HasLineColumn() bool
- func (le *LessError) LineNumber() int
- func (le *LessError) ToString(options *ToStringOptions) string
- type LessInterface
- type LoadedFile
- type Location
- type LogListener
- type LogListenerPartial
- type Logger
- type MapEvalContext
- func (m *MapEvalContext) EnterCalc()
- func (m *MapEvalContext) ExitCalc()
- func (m *MapEvalContext) GetDefaultFunc() *DefaultFunc
- func (m *MapEvalContext) GetFrames() []ParserFrame
- func (m *MapEvalContext) GetImportantScope() []map[string]bool
- func (m *MapEvalContext) IsInCalc() bool
- func (m *MapEvalContext) IsMathOn() bool
- func (m *MapEvalContext) SetMathOn(enabled bool)
- type MathFunctionWrapper
- type MathHelperError
- type MathType
- type Media
- func (m *Media) Accept(visitor any)
- func (m *Media) BubbleSelectors(selectors any)
- func (m *Media) Eval(context any) (any, error)
- func (m *Media) EvalNested(context any) any
- func (m *Media) EvalTop(context any) any
- func (m *Media) GenCSS(context any, output *CSSOutput)
- func (m *Media) GetRules() []any
- func (m *Media) GetType() string
- func (m *Media) GetTypeIndex() int
- func (m *Media) IsRulesetLike() bool
- func (m *Media) Permute(arr []any) any
- func (m *Media) Type() string
- type MediaRule
- type MediaSyntaxOptions
- type MediaSyntaxOptionsType
- type MixinCall
- type MixinCallError
- type MixinDefinition
- func (md *MixinDefinition) Accept(visitor any)
- func (md *MixinDefinition) Eval(context any) (*MixinDefinition, error)
- func (md *MixinDefinition) EvalCall(context any, args []any, important bool) (*Ruleset, error)
- func (md *MixinDefinition) EvalFirst() bool
- func (md *MixinDefinition) EvalParams(context any, mixinEnv any, args []any, evaldArguments []any) (*Ruleset, error)
- func (md *MixinDefinition) GenCSS(context any, output *CSSOutput)
- func (md *MixinDefinition) GetType() string
- func (md *MixinDefinition) IsRuleset() bool
- func (md *MixinDefinition) MakeImportant() any
- func (md *MixinDefinition) MatchArgs(args []any, context any) bool
- func (md *MixinDefinition) MatchCondition(args []any, context any) bool
- func (md *MixinDefinition) Type() string
- type MixinParsers
- type NamespaceValue
- type Negative
- type NestableAtRulePrototype
- func (n *NestableAtRulePrototype) Accept(visitor any)
- func (n *NestableAtRulePrototype) BubbleSelectors(selectors []*Selector)
- func (n *NestableAtRulePrototype) EvalNested(context any) any
- func (n *NestableAtRulePrototype) EvalTop(context any) any
- func (n *NestableAtRulePrototype) IsRulesetLike() bool
- func (n *NestableAtRulePrototype) Permute(arr []any) any
- type Node
- func (n *Node) Accept(visitor any)
- func (n *Node) AddVisibilityBlock()
- func (n *Node) BlocksVisibility() bool
- func (n *Node) ClearVisibilityBlocks()
- func (n *Node) CopyVisibilityInfo(info map[string]any)
- func (n *Node) CurrentFileInfo() map[string]any
- func (n *Node) EnsureInvisibility()
- func (n *Node) EnsureVisibility()
- func (n *Node) Eval(context any) any
- func (n *Node) FileInfo() map[string]any
- func (n *Node) Fround(context any, value float64) float64
- func (n *Node) GenCSS(context any, output *CSSOutput)
- func (n *Node) GenCSSSourceMap(context map[string]any, output *SourceMapOutput)
- func (n *Node) GetIndex() int
- func (n *Node) GetNode() *Node
- func (n *Node) GetTypeIndex() int
- func (n *Node) IsRulesetLike() bool
- func (n *Node) IsVisible() *bool
- func (n *Node) Operate(context any, op string, a, b float64) float64
- func (n *Node) RemoveVisibilityBlock()
- func (n *Node) SetFileInfo(info map[string]any)
- func (n *Node) SetParent(nodes any, parent *Node)
- func (n *Node) ToCSS(context any) string
- func (n *Node) VisibilityInfo() map[string]any
- type NodeJSPluginBridge
- func (b *NodeJSPluginBridge) AddFunctionToCurrentScope(name string)
- func (b *NodeJSPluginBridge) CallFunction(name string, args ...any) (any, error)
- func (b *NodeJSPluginBridge) CallFunctionWithContext(name string, evalContext runtime.EvalContextProvider, args ...any) (any, error)
- func (b *NodeJSPluginBridge) CheckVariableReplacements(variables []VariableInfo) (map[string]map[string]any, error)
- func (b *NodeJSPluginBridge) Close() error
- func (b *NodeJSPluginBridge) CreateScopedPluginManager() *runtime.ScopedPluginManager
- func (b *NodeJSPluginBridge) EnterScope() *runtime.PluginScope
- func (b *NodeJSPluginBridge) EvalPlugin(contents string, newEnv *Parse, importManager any, pluginArgs map[string]any, ...) any
- func (b *NodeJSPluginBridge) ExitScope() *runtime.PluginScope
- func (b *NodeJSPluginBridge) GetFunctionRegistry() *runtime.PluginFunctionRegistry
- func (b *NodeJSPluginBridge) GetLoader() *runtime.JSPluginLoader
- func (b *NodeJSPluginBridge) GetPostEvalVisitors() []*runtime.JSVisitor
- func (b *NodeJSPluginBridge) GetPostProcessors() []*runtime.JSPostProcessor
- func (b *NodeJSPluginBridge) GetPreEvalVisitors() []*runtime.JSVisitor
- func (b *NodeJSPluginBridge) GetPreProcessors() []*runtime.JSPreProcessor
- func (b *NodeJSPluginBridge) GetProcessorManager() *runtime.ProcessorManager
- func (b *NodeJSPluginBridge) GetRuntime() *runtime.NodeJSRuntime
- func (b *NodeJSPluginBridge) GetScope() *runtime.PluginScope
- func (b *NodeJSPluginBridge) GetVisitorManager() *runtime.VisitorManager
- func (b *NodeJSPluginBridge) GetVisitors() []*runtime.JSVisitor
- func (b *NodeJSPluginBridge) HasFunction(name string) bool
- func (b *NodeJSPluginBridge) HasPreEvalVisitors() bool
- func (b *NodeJSPluginBridge) InitSHMProtocol() error
- func (b *NodeJSPluginBridge) LoadPlugin(path, currentDirectory string, context map[string]any, environment any, ...) any
- func (b *NodeJSPluginBridge) LoadPluginSync(path, currentDirectory string, context map[string]any, environment any, ...) any
- func (b *NodeJSPluginBridge) LookupFunction(name string) (*runtime.JSFunctionDefinition, bool)
- func (b *NodeJSPluginBridge) RunPostProcessors(css string, options map[string]any) (string, error)
- func (b *NodeJSPluginBridge) RunPreEvalVisitorsJSON(ast map[string]any) (map[string]any, bool, error)
- func (b *NodeJSPluginBridge) RunPreProcessors(input string, options map[string]any) (string, error)
- func (b *NodeJSPluginBridge) SetScope(scope *runtime.PluginScope)
- func (b *NodeJSPluginBridge) UseSHMProtocol() bool
- type NodePrototype
- type NodeVisitor
- type NodeWithOp
- type NodeWithParens
- type NodeWithType
- type NodeWithTypeIndex
- type NodeWithValue
- type NumberFunctionWrapper
- type Operation
- type Paren
- type Parse
- type ParseCallback
- type ParseCallbackFunc
- type ParseFunc
- type ParseNodeCallback
- type ParseNodeResult
- type ParsePromise
- type ParseResult
- type ParseTree
- type ParseTreeClass
- type ParseTreeFactory
- type Parser
- type ParserEvaluable
- type ParserFrame
- type ParserFunctionCaller
- type ParserInput
- func (p *ParserInput) Char(tok byte) any
- func (p *ParserInput) CommentsReset()
- func (p *ParserInput) ConsumeComment() *inputComment
- func (p *ParserInput) CurrentChar() byte
- func (p *ParserInput) End() EndState
- func (p *ParserInput) Finished() bool
- func (p *ParserInput) Forget()
- func (p *ParserInput) GetAutoCommentAbsorb() bool
- func (p *ParserInput) GetComments() []inputComment
- func (p *ParserInput) GetIndex() int
- func (p *ParserInput) GetInput() string
- func (p *ParserInput) IsWhitespace(offset int) bool
- func (p *ParserInput) ParseUntil(tok any) any
- func (p *ParserInput) Peek(tok any) bool
- func (p *ParserInput) PeekChar(tok byte) any
- func (p *ParserInput) PeekNotNumeric() bool
- func (p *ParserInput) PrevChar() byte
- func (p *ParserInput) Quoted(loc int) any
- func (p *ParserInput) Re(tok *regexp.Regexp) any
- func (p *ParserInput) Remaining() string
- func (p *ParserInput) Restore(possibleErrorMessage string)
- func (p *ParserInput) Save()
- func (p *ParserInput) SetAutoCommentAbsorb(value bool)
- func (p *ParserInput) SetIndex(index int)
- func (p *ParserInput) Start(str string, chunkInput bool, failFunction func(string, int))
- func (p *ParserInput) Str(tok string) any
- type ParserInterface
- type ParserLogger
- type ParserTracer
- func (t *ParserTracer) GetCallStackString() string
- func (t *ParserTracer) IsEnabled() bool
- func (t *ParserTracer) ShouldTrace(funcName string) bool
- func (t *ParserTracer) TraceCallStackAt(label string, p *Parser)
- func (t *ParserTracer) TraceChar(funcName string, char byte, matched bool)
- func (t *ParserTracer) TraceCheckpoint(checkpointName string, p *Parser)
- func (t *ParserTracer) TraceEnter(funcName string, p *Parser) func()
- func (t *ParserTracer) TraceError(funcName string, errMsg string, p *Parser)
- func (t *ParserTracer) TraceMode(modeName string, details string, p *Parser)
- func (t *ParserTracer) TraceRegex(funcName string, pattern string, matched bool, result any)
- func (t *ParserTracer) TraceResult(funcName string, result any, msg string)
- func (t *ParserTracer) TraceSaveRestore(operation string, funcName string, p *Parser)
- type Parsers
- func (p *Parsers) Addition() any
- func (p *Parsers) AnonymousValue() any
- func (p *Parsers) AtRule() any
- func (p *Parsers) AtomicCondition(needsParens bool, preparsedCond any) any
- func (p *Parsers) Attribute() any
- func (p *Parsers) Block() any
- func (p *Parsers) BlockRuleset() any
- func (p *Parsers) ColorOperand() any
- func (p *Parsers) Combinator() *Combinator
- func (p *Parsers) Comment() any
- func (p *Parsers) Condition(needsParens bool) any
- func (p *Parsers) ConditionAnd(needsParens bool) any
- func (p *Parsers) Conditions() any
- func (p *Parsers) Declaration() any
- func (p *Parsers) DetachedRuleset() any
- func (p *Parsers) Element() any
- func (p *Parsers) End() bool
- func (p *Parsers) Entity() any
- func (p *Parsers) Expression() any
- func (p *Parsers) Extend() []any
- func (p *Parsers) ExtendRule() any
- func (p *Parsers) IeAlpha() []any
- func (p *Parsers) Import() any
- func (p *Parsers) ImportOptions() map[string]any
- func (p *Parsers) Important() any
- func (p *Parsers) MediaFeature(syntaxOptions map[string]any) any
- func (p *Parsers) MediaFeatures(syntaxOptions map[string]any) any
- func (p *Parsers) Multiplication() any
- func (p *Parsers) NegatedCondition(needsParens bool) any
- func (p *Parsers) NestableAtRule() any
- func (p *Parsers) Operand() any
- func (p *Parsers) ParenthesisCondition(needsParens bool) any
- func (p *Parsers) PermissiveValue(untilTokens *regexp.Regexp, allowComments bool) any
- func (p *Parsers) Plugin() any
- func (p *Parsers) PluginArgs() string
- func (p *Parsers) PrepareAndGetNestableAtRule(atRuleType string, index int, debugInfo map[string]any) any
- func (p *Parsers) Primary() []any
- func (p *Parsers) Property() any
- func (p *Parsers) RuleProperty() any
- func (p *Parsers) Ruleset() any
- func (p *Parsers) Selector(isLess bool) any
- func (p *Parsers) Selectors() []any
- func (p *Parsers) Sub() any
- func (p *Parsers) Value() any
- func (p *Parsers) Variable() any
- func (p *Parsers) VariableCall(parsedName ...string) any
- type Plugin
- type PluginCallCollector
- type PluginCallInfo
- type PluginFunctionCaller
- type PluginFunctionProvider
- type PluginLoader
- type PluginLoaderFactory
- type PluginManager
- func (pm *PluginManager) AddFileManager(manager any)
- func (pm *PluginManager) AddPlugin(plugin any, filename string, functionRegistry any)
- func (pm *PluginManager) AddPlugins(plugins []any)
- func (pm *PluginManager) AddPostProcessor(postProcessor any, priority int)
- func (pm *PluginManager) AddPreProcessor(preProcessor any, priority int)
- func (pm *PluginManager) AddVisitor(visitor any)
- func (pm *PluginManager) Get(filename string) any
- func (pm *PluginManager) GetFileManagers() []any
- func (pm *PluginManager) GetFunctions() any
- func (pm *PluginManager) GetPostProcessors() []any
- func (pm *PluginManager) GetPreProcessors() []any
- func (pm *PluginManager) GetVisitors() []any
- func (pm *PluginManager) Visitor() *VisitorIterator
- type PluginSpec
- type PotentialMatch
- type ProcessExtendsVisitor
- func (pev *ProcessExtendsVisitor) IsReplacing() bool
- func (pev *ProcessExtendsVisitor) Reset()
- func (pev *ProcessExtendsVisitor) Run(root any) any
- func (pev *ProcessExtendsVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs)
- func (pev *ProcessExtendsVisitor) VisitAtRuleOut(atRuleNode any)
- func (pev *ProcessExtendsVisitor) VisitDeclaration(ruleNode any, visitArgs *VisitArgs)
- func (pev *ProcessExtendsVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs)
- func (pev *ProcessExtendsVisitor) VisitMediaOut(mediaNode any)
- func (pev *ProcessExtendsVisitor) VisitMixinDefinition(mixinDefinitionNode any, visitArgs *VisitArgs)
- func (pev *ProcessExtendsVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
- func (pev *ProcessExtendsVisitor) VisitNodeOut(node any) bool
- func (pev *ProcessExtendsVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs)
- func (pev *ProcessExtendsVisitor) VisitSelector(selectorNode any, visitArgs *VisitArgs)
- type ProcessorEntry
- type Promise
- type PromiseResult
- type Property
- type QueryInParens
- type Quoted
- func (q *Quoted) Compare(other any) *int
- func (q *Quoted) ContainsVariables() bool
- func (q *Quoted) Eval(context any) (any, error)
- func (q *Quoted) FileInfo() map[string]any
- func (q *Quoted) GenCSS(context any, output *CSSOutput)
- func (q *Quoted) GetEscaped() bool
- func (q *Quoted) GetIndex() int
- func (q *Quoted) GetQuote() string
- func (q *Quoted) GetType() string
- func (q *Quoted) GetValue() string
- func (q *Quoted) ToCSS(context any) string
- func (q *Quoted) Type() string
- type Registry
- type RegistryAdapter
- type RegistryFunctionAdapter
- type Releasable
- type RenderContext
- type RenderPromise
- type RewriteUrlsType
- type Ruleset
- func (r *Ruleset) Accept(visitor any)
- func (r *Ruleset) Eval(context any) (any, error)
- func (r *Ruleset) EvalImports(context any) error
- func (r *Ruleset) Find(selector any, self any, filter func(any) bool) []any
- func (r *Ruleset) GenCSS(context any, output *CSSOutput)
- func (r *Ruleset) GenCSSSourceMap(context map[string]any, output *SourceMapOutput)
- func (r *Ruleset) GetAllExtends() []*Extend
- func (r *Ruleset) GetAllowImports() bool
- func (r *Ruleset) GetFirstRoot() bool
- func (r *Ruleset) GetPaths() []any
- func (r *Ruleset) GetRoot() bool
- func (r *Ruleset) GetRules() []any
- func (r *Ruleset) GetSelectors() []any
- func (r *Ruleset) GetType() string
- func (r *Ruleset) GetTypeIndex() int
- func (r *Ruleset) HasProperties() bool
- func (r *Ruleset) HasVariable(name string) bool
- func (r *Ruleset) HasVariables() bool
- func (r *Ruleset) IsRuleset() bool
- func (r *Ruleset) IsRulesetLike() bool
- func (r *Ruleset) JoinSelector(paths *[][]any, context [][]any, selector any)
- func (r *Ruleset) JoinSelectors(paths *[][]any, context [][]any, selectors []any)
- func (r *Ruleset) LastDeclaration() any
- func (r *Ruleset) MakeImportant() any
- func (r *Ruleset) MatchArgs(args []any) bool
- func (r *Ruleset) MatchCondition(args []any, context any) bool
- func (r *Ruleset) ParseValue(toParse any) any
- func (r *Ruleset) PrependRule(rule any)
- func (r *Ruleset) Properties() map[string][]any
- func (r *Ruleset) Property(name string) []any
- func (r *Ruleset) Release()
- func (r *Ruleset) ResetCache()
- func (r *Ruleset) Rulesets() []any
- func (r *Ruleset) SetAllExtends(extends []*Extend)
- func (r *Ruleset) SetPaths(paths []any)
- func (r *Ruleset) SetRoot(value any)
- func (r *Ruleset) SetRules(rules []any)
- func (r *Ruleset) SetSelectors(selectors []any)
- func (r *Ruleset) ToCSS(options map[string]any) (string, error)
- func (r *Ruleset) ToCSSString(context any) string
- func (r *Ruleset) Type() string
- func (r *Ruleset) Variable(name string) map[string]any
- func (r *Ruleset) Variables() map[string]any
- type SafeIndexError
- type Selector
- func (s *Selector) Accept(visitor any)
- func (s *Selector) CreateDerived(elementsInput any, extendList []any, evaldCondition any) (*Selector, error)
- func (s *Selector) CreateEmptySelectors() ([]*Selector, error)
- func (s *Selector) Eval(context any) (any, error)
- func (s *Selector) GenCSS(context any, output *CSSOutput)
- func (s *Selector) GetExtendList() []*Extend
- func (s *Selector) GetIsOutput() bool
- func (s *Selector) GetType() string
- func (s *Selector) IsJustParentSelector() bool
- func (s *Selector) IsVisible() *bool
- func (s *Selector) Match(other *Selector) int
- func (s *Selector) MixinElements() ([]string, error)
- func (s *Selector) Release()
- func (s *Selector) SetExtendList(extends []*Extend)
- func (s *Selector) ToCSS(context any) string
- func (s *Selector) Type() string
- type SelectorList
- type SelectorParseFunc
- type SelectorsParseFunc
- type SetTreeVisibilityVisitor
- type SimpleFileManager
- func (s *SimpleFileManager) AlwaysMakePathsAbsolute() bool
- func (s *SimpleFileManager) GetPath(filename string) string
- func (s *SimpleFileManager) IsPathAbsolute(path string) bool
- func (s *SimpleFileManager) Join(path1, path2 string) string
- func (s *SimpleFileManager) LoadFile(path, currentDirectory string, context map[string]any, ...) any
- func (s *SimpleFileManager) LoadFileSync(path, currentDirectory string, context map[string]any, ...) *LoadedFile
- type SimpleFunctionDef
- type SimpleImportManagerEnvironment
- type SourceMapBuilder
- func (smb *SourceMapBuilder) GetExternalSourceMap() string
- func (smb *SourceMapBuilder) GetInputFilename() string
- func (smb *SourceMapBuilder) GetOutputFilename() string
- func (smb *SourceMapBuilder) GetSourceMapURL() string
- func (smb *SourceMapBuilder) IsInline() bool
- func (smb *SourceMapBuilder) SetExternalSourceMap(sourceMap string)
- func (smb *SourceMapBuilder) ToCSS(rootNode SourceMapNode, options map[string]any, imports *Imports, ...) string
- type SourceMapBuilderOptions
- type SourceMapEnvironment
- type SourceMapGenerator
- type SourceMapMapping
- type SourceMapNode
- type SourceMapOptions
- type SourceMapOutput
- func (smo *SourceMapOutput) Add(chunk string, fileInfo *FileInfo, index int, mapLines bool)
- func (smo *SourceMapOutput) IsEmpty() bool
- func (smo *SourceMapOutput) NormalizeFilename(filename string) string
- func (smo *SourceMapOutput) RemoveBasepath(path string) string
- func (smo *SourceMapOutput) ToCSS(context map[string]any) string
- type SourceMapOutputOptions
- type SourceMapPosition
- type StringFunctionWrapper
- type StyleContext
- type StylizeFunc
- type SvgContext
- type SvgFunctionWrapper
- type ToCSSOptions
- type ToCSSResult
- type ToCSSVisitor
- func (v *ToCSSVisitor) CheckValidNodes(rules []any, isRoot bool) error
- func (v *ToCSSVisitor) IsReplacing() bool
- func (v *ToCSSVisitor) Reset(context any)
- func (v *ToCSSVisitor) Run(root any) any
- func (v *ToCSSVisitor) VisitAnonymous(anonymousNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitAtRuleWithBody(atRuleNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitAtRuleWithoutBody(atRuleNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitComment(commentNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitContainer(containerNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitDeclaration(declNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitExtend(extendNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitImport(importNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitMixinDefinition(mixinNode any, visitArgs *VisitArgs) any
- func (v *ToCSSVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
- func (v *ToCSSVisitor) VisitNodeOut(node any) bool
- func (v *ToCSSVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs) any
- type ToStringOptions
- type TreeRegistry
- type TypeFunctionDef
- type TypesFunctions
- func (tf *TypesFunctions) GetFunctions() map[string]any
- func (tf *TypesFunctions) GetUnit(n any) (*Anonymous, error)
- func (tf *TypesFunctions) IsColor(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsEm(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsKeyword(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsNumber(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsPercentage(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsPx(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsRuleset(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsString(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsURL(n any) (*Keyword, error)
- func (tf *TypesFunctions) IsUnit(n any, unit any) (*Keyword, error)
- func (tf *TypesFunctions) Unit(val any, unit any) (*Dimension, error)
- type URL
- type URLParseError
- type URLParts
- type UnicodeDescriptor
- func (u *UnicodeDescriptor) Accept(visitor any)
- func (u *UnicodeDescriptor) AddVisibilityBlock()
- func (u *UnicodeDescriptor) BlocksVisibility() bool
- func (u *UnicodeDescriptor) CopyVisibilityInfo(info map[string]any)
- func (u *UnicodeDescriptor) EnsureInvisibility()
- func (u *UnicodeDescriptor) EnsureVisibility()
- func (u *UnicodeDescriptor) Eval() *UnicodeDescriptor
- func (u *UnicodeDescriptor) FileInfo() map[string]any
- func (u *UnicodeDescriptor) Fround(context any, value float64) float64
- func (u *UnicodeDescriptor) GenCSS(context any, output *CSSOutput)
- func (u *UnicodeDescriptor) GetIndex() int
- func (u *UnicodeDescriptor) GetValue() any
- func (u *UnicodeDescriptor) IsRulesetLike() bool
- func (u *UnicodeDescriptor) IsVisible() *bool
- func (u *UnicodeDescriptor) Operate(context any, op string, a, b float64) float64
- func (u *UnicodeDescriptor) RemoveVisibilityBlock()
- func (u *UnicodeDescriptor) SetParent(nodes any, parent *Node)
- func (u *UnicodeDescriptor) SetValue(value any)
- func (u *UnicodeDescriptor) ToCSS(context any) string
- func (u *UnicodeDescriptor) Type() string
- func (u *UnicodeDescriptor) VisibilityInfo() map[string]any
- type Unit
- func (u *Unit) Cancel()
- func (u *Unit) Clone() *Unit
- func (u *Unit) Compare(other *Unit) int
- func (u *Unit) GenCSS(context any, output *CSSOutput)
- func (u *Unit) Is(unitString string) bool
- func (u *Unit) IsEmpty() bool
- func (u *Unit) IsLength() bool
- func (u *Unit) IsSingular() bool
- func (u *Unit) Map(callback func(string, bool) string)
- func (u *Unit) Release()
- func (u *Unit) ToCSS(context any) string
- func (u *Unit) ToString() string
- func (u *Unit) Type() string
- func (u *Unit) UsedUnits() map[string]string
- type Value
- func (v *Value) Accept(visitor any)
- func (v *Value) Eval(context any) (any, error)
- func (v *Value) GenCSS(context any, output *CSSOutput)
- func (v *Value) GetType() string
- func (v *Value) GetTypeIndex() int
- func (v *Value) GetValue() []any
- func (v *Value) ToCSS(context any) string
- func (v *Value) Type() string
- type ValueError
- type ValueParseFunc
- type Variable
- func (v *Variable) Eval(context any) (any, error)
- func (v *Variable) FileInfo() map[string]any
- func (v *Variable) GenCSS(context any, output *CSSOutput)
- func (v *Variable) GetIndex() int
- func (v *Variable) GetName() string
- func (v *Variable) GetType() string
- func (v *Variable) ToCSS(context any) string
- func (v *Variable) Type() string
- type VariableCall
- type VariableInfo
- type VariableReplacement
- type VersionInfo
- type VisibilityNode
- type VisitArgs
- type VisitFunc
- type VisitOutFunc
- type Visitor
- type VisitorIterator
Constants ¶
This section is empty.
Variables ¶
var ( MediaSyntax = MediaSyntaxOptions{QueryInParens: true} ContainerSyntax = ContainerSyntaxOptions{QueryInParens: true} )
var ( Math = struct{ Always, ParensDivision, Parens MathType }{MathAlways, MathParensDivision, MathParens} RewriteUrls = struct{ Off, Local, All RewriteUrlsType }{RewriteUrlsOff, RewriteUrlsLocal, RewriteUrlsAll} )
var ( KeywordTrue = NewKeyword("true") KeywordFalse = NewKeyword("false") )
var AtRuleSyntaxContainerSyntaxOptions = ContainerSyntaxOptionsType{ QueryInParens: true, }
var AtRuleSyntaxMediaSyntaxOptions = MediaSyntaxOptionsType{ QueryInParens: true, }
var Colors = map[string]string{}/* 148 elements not displayed */
var Default = NewProcessExtendsVisitor
Default export equivalent
var DefaultLogger = NewLogger()
var DefaultRegistry = makeRegistry(nil)
var MathFunctions = map[string]any{ "ceil": Ceil, "floor": Floor, "sqrt": Sqrt, "abs": Abs, "tan": Tan, "sin": Sin, "cos": Cos, "atan": Atan, "asin": Asin, "acos": Acos, "round": Round, }
MathFunctions provides all the mathematical functions that were in math.js
var NumberFunctions = map[string]interface{}{ "min": Min, "max": Max, "convert": Convert, "pi": Pi, "mod": Mod, "pow": Pow, "percentage": Percentage, }
NumberFunctions provides all the number-related functions
var StringFunctions = map[string]interface{}{ "e": E, "escape": Escape, "replace": Replace, "%": Format, }
StringFunctions provides all the string-related functions
var StyleFunctions = map[string]interface{}{ "style": Style, }
StyleFunctions provides all the style-related functions
var SvgFunctions = map[string]interface{}{ "svg-gradient": SvgGradient, }
SvgFunctions provides all the svg-related functions
var UnitConversionsAngle = map[string]float64{ "rad": 1 / (2 * math.Pi), "deg": 1 / 360.0, "grad": 1 / 400.0, "turn": 1, }
var UnitConversionsDuration = map[string]float64{
"s": 1,
"ms": 0.001,
}
var UnitConversionsLength = map[string]float64{
"m": 1,
"cm": 0.01,
"mm": 0.001,
"in": 0.0254,
"px": 0.0254 / 96,
"pt": 0.0254 / 72,
"pc": 0.0254 / 72 * 12,
}
Functions ¶
func AddListener ¶
func AddListener(listener any)
func Bind ¶
func Bind(renderFactoryFunc func(string, ...any) any, context ContextInterface, environment any, parseTreeConstructor func(any, any) any) func(string, ...any) any
Bind creates a bound render function that matches JavaScript's render.bind(context) behavior
func ClearInternTable ¶
func ClearInternTable()
ClearInternTable clears the intern table. This should only be used in testing or when you want to release all interned strings.
func ColorContrast ¶
ColorContrast chooses a contrasting color
func ColorDarken ¶
ColorDarken decreases lightness
func ColorDesaturate ¶
ColorDesaturate decreases saturation
func ColorFadeIn ¶
ColorFadeIn increases opacity
func ColorFadeOut ¶
ColorFadeOut decreases opacity
func ColorFunction ¶
ColorFunction parses a color from a hex string or keyword
func ColorHSVSaturation ¶
ColorHSVSaturation extracts the saturation (HSV)
func ColorLighten ¶
ColorLighten increases lightness
func ColorLightness ¶
ColorLightness extracts the lightness (HSL)
func ColorLuminance ¶
ColorLuminance calculates the luminance value using the standard formula
func ColorSaturate ¶
ColorSaturate increases saturation
func ColorSaturation ¶
ColorSaturation extracts the saturation (HSL)
func CopyOptions ¶
CopyOptions processes and copies options with special handling for math and rewriteUrls
func CreateLessContextWithPlugins ¶
func CreateLessContextWithPlugins(options map[string]any) (*LessContext, *NodeJSPluginBridge, error)
CreateLessContextWithPlugins creates a LessContext configured to use Node.js plugins. This is a convenience function for enabling plugin support in the parsing pipeline.
func CreateParseWithContext ¶
func CreateParseWithContext(environment any, parseTree any, importManagerFactory func(any, *Parse, map[string]any) *ImportManager) func(*LessContext, string, map[string]any, ParseCallbackFunc) any
CreateParseWithContext creates a parse function that can be called with a specific context This is closer to how the JavaScript version works with 'this' context
func CreateRender ¶
func CreateRender(environment any, parseTreeConstructor func(any, any) any) func(string, ...any) any
CreateRender creates a render function that matches JavaScript's export default function(environment, ParseTree)
func DefaultStylize ¶
func DefaultValue ¶
func DefaultValue[T any]() T
DefaultValue returns a default value for common types when operations would fail
func Difference ¶
func FlattenArray ¶
func GetBooleanFunctions ¶
func GetColorFunctions ¶
GetColorFunctions returns the color function registry
func GetContextMapFromPool ¶ added in v0.4.0
GetContextMapFromPool gets a map from the pool and clears it for reuse. The returned map has capacity 16 but length 0.
func GetDataURIFunctions ¶
func GetDebugInfo ¶
func GetFrameSliceFromPool ¶
func GetFrameSliceFromPool() []any
GetFrameSliceFromPool gets a slice from the pool and prepares it for use. The returned slice has length 0 but may have capacity from previous use.
func GetItemsFromNode ¶
func GetListFunctions ¶
func GetTypeIndexForNodeType ¶
GetTypeIndexForNodeType returns the TypeIndex for a given node type string. Used by node constructors to set the TypeIndex field.
func GetWrappedBooleanFunctions ¶
func GetWrappedBooleanFunctions() map[string]interface{}
GetWrappedBooleanFunctions returns boolean functions wrapped for registry. The map is pre-computed at init time and cached for efficiency.
func GetWrappedColorBlendingFunctions ¶
func GetWrappedColorBlendingFunctions() map[string]interface{}
GetWrappedColorBlendingFunctions returns color blending functions wrapped for registry. The map is pre-computed at init time and cached for efficiency.
func GetWrappedColorFunctions ¶
func GetWrappedColorFunctions() map[string]interface{}
GetWrappedColorFunctions returns color functions wrapped for registry. The map is pre-computed at init time and cached for efficiency.
func GetWrappedDataURIFunctions ¶
func GetWrappedDataURIFunctions() map[string]interface{}
GetWrappedDataURIFunctions returns data-uri functions wrapped for registry. The map is pre-computed at init time and cached for efficiency.
func GetWrappedListFunctions ¶
func GetWrappedListFunctions() map[string]interface{}
func GetWrappedMathFunctions ¶
func GetWrappedMathFunctions() map[string]interface{}
GetWrappedMathFunctions returns math functions wrapped for registry. The map is pre-computed at init time and cached for efficiency.
func GetWrappedNumberFunctions ¶
func GetWrappedNumberFunctions() map[string]interface{}
GetWrappedNumberFunctions returns number functions wrapped for registry. The map is pre-computed at init time and cached for efficiency.
func GetWrappedStringFunctions ¶
func GetWrappedStringFunctions() map[string]interface{}
GetWrappedStringFunctions returns string functions wrapped with FunctionDefinition interface. The map is pre-computed at init time and cached for efficiency.
func GetWrappedStyleFunctions ¶
func GetWrappedStyleFunctions() map[string]interface{}
GetWrappedStyleFunctions returns style functions for registry
func GetWrappedSvgFunctions ¶
func GetWrappedSvgFunctions() map[string]interface{}
GetWrappedSvgFunctions returns svg functions wrapped with FunctionDefinition interface. The map is pre-computed at init time and cached for efficiency.
func GetWrappedTypesFunctions ¶
func GetWrappedTypesFunctions() map[string]interface{}
GetWrappedTypesFunctions returns type functions wrapped in FunctionDefinition adapters. The map is pre-computed at init time and cached for efficiency.
func Intern ¶
Intern returns a canonical version of the string. If the string has been interned before, the previously interned version is returned. This ensures that all occurrences of the same string value share the same memory.
This function is thread-safe and uses a read-write lock for optimal concurrent read performance.
func InternBytes ¶
InternBytes interns a string created from a byte slice. This is useful when parsing to avoid creating multiple string copies from the same byte slice content.
func InternedCount ¶
func InternedCount() int
InternedCount returns the number of interned strings. Useful for debugging and monitoring memory usage.
func IsMathParensDivision ¶
func IsNullOrUndefined ¶
func NewImportManager ¶
func NewImportManager(environment ImportManagerEnvironment) func(less any, context map[string]any, rootFileInfo *FileInfo) *ImportManager
func NumericCompareStrings ¶
NumericCompareStrings compares two string values numerically if possible, otherwise lexically
func PutEvalToPool ¶
func PutEvalToPool(e *Eval)
PutEvalToPool returns an *Eval to the pool. The context should not be used after calling this function.
func PutFrameSliceToPool ¶
func PutFrameSliceToPool(s []any)
PutFrameSliceToPool returns a slice to the pool. The slice should not be used after calling this function.
func PutVariableResultMap ¶
PutVariableResultMap returns a variable result map to the pool. Callers of Ruleset.Variable() should call this when done with the result.
func RecoverableOperation ¶
RecoverableOperation runs an operation with panic recovery Returns the result and any error that occurred (including recovered panics)
func RegisterColorFunctions ¶
func RegisterColorFunctions(registry *Registry)
RegisterColorFunctions registers all color functions with the given registry
func RegisterSvgFunctions ¶
func RegisterSvgFunctions(registry *Registry)
RegisterSvgFunctions registers svg functions with the given registry
func RegisterTestFunctions ¶
func RegisterTestFunctions(registry *Registry)
RegisterTestFunctions adds the custom test functions used in integration tests These functions are defined in the JavaScript test setup in less-test.js
func ReleaseCSSVisitorUtils ¶
func ReleaseCSSVisitorUtils(u *CSSVisitorUtils)
ReleaseCSSVisitorUtils returns a CSSVisitorUtils to the pool
func ReleaseContextMap ¶ added in v0.4.0
ReleaseContextMap returns a map to the pool. The map should not be used after calling this function. Pass nil safely - it will be ignored.
func ReleaseDeclaration ¶
func ReleaseDeclaration(d *Declaration)
func ReleaseElement ¶
func ReleaseElement(e *Element)
func ReleaseExpression ¶
func ReleaseExpression(e *Expression)
func ReleaseExtendFinderVisitor ¶
func ReleaseExtendFinderVisitor(v *ExtendFinderVisitor)
ReleaseExtendFinderVisitor returns an ExtendFinderVisitor to the pool
func ReleaseJoinSelectorVisitor ¶
func ReleaseJoinSelectorVisitor(v *JoinSelectorVisitor)
ReleaseJoinSelectorVisitor returns a JoinSelectorVisitor to the pool
func ReleaseNode ¶
func ReleaseNode(n *Node)
func ReleaseProcessExtendsVisitor ¶
func ReleaseProcessExtendsVisitor(v *ProcessExtendsVisitor)
ReleaseProcessExtendsVisitor returns a ProcessExtendsVisitor to the pool
func ReleaseRuleset ¶
func ReleaseRuleset(r *Ruleset)
func ReleaseSelector ¶
func ReleaseSelector(s *Selector)
func ReleaseSetTreeVisibilityVisitor ¶
func ReleaseSetTreeVisibilityVisitor(v *SetTreeVisibilityVisitor)
ReleaseSetTreeVisibilityVisitor returns a SetTreeVisibilityVisitor to the pool
func ReleaseToCSSVisitor ¶
func ReleaseToCSSVisitor(v *ToCSSVisitor)
ReleaseToCSSVisitor returns a ToCSSVisitor to the pool
func ReleaseTree ¶ added in v0.4.0
func ReleaseTree(root any)
ReleaseTree recursively releases all pooled nodes in an AST tree. This should be called after ToCSS is complete and the tree is no longer needed. It uses a seen map to avoid double-releasing shared nodes.
func ReleaseUnit ¶
func ReleaseUnit(u *Unit)
func RemoveListener ¶
func RemoveListener(listener any)
func ResetExtendID ¶
func ResetExtendID()
func SafeArrayAccess ¶
SafeArrayAccess safely accesses an array-like interface{}
func SafeFramesAccess ¶
SafeFramesAccess safely accesses frames from context
func SafeGenCSS ¶
SafeGenCSS safely calls GenCSS on a value, doing nothing if it fails
func SafeMapAccess ¶
func SafeMapAccess[K comparable, V any](m map[K]V, key K) (V, bool)
SafeMapAccess safely accesses a map value Returns the value and true if successful, or zero value and false if key doesn't exist
func SafeNilCheck ¶
SafeNilCheck checks if a value is nil using reflection for interface types
func SafeParseFloat ¶
SafeParseFloat safely parses a string to float64, returning 0 if parsing fails
func SafeSliceAccess ¶
SafeSliceAccess safely accesses a slice with generic type
func SafeSliceIndex ¶
SafeSliceIndex safely accesses a slice at the given index Returns the value and true if successful, or nil and false if out of bounds
func SafeStringAccess ¶
SafeStringAccess safely accesses a string that might be from different sources
func SafeStringConcat ¶
SafeStringConcat safely concatenates strings, handling nil values
func SafeStringIndex ¶
SafeStringIndex safely accesses a string at the given index Returns the character and true if successful, or 0 and false if out of bounds
func SafeStringSlice ¶
SafeStringSlice safely slices a string with bounds checking Returns the slice and true if successful, or empty string and false if out of bounds
func SafeTypeAssertion ¶
SafeTypeAssertion safely performs a type assertion Returns the value and true if successful, or zero value and false if assertion fails
func SerializeVars ¶
SerializeVars serializes variables from a map to Less format Go 1.21+ preserves insertion order for string keys like JavaScript objects
func SetParserLogger ¶
func SetParserLogger(l ParserLogger)
SetParserLogger sets the global parser logger instance
func SpaceSeparatedValues ¶
func TransformTree ¶
TransformTree transforms the root AST node using various visitors This is a direct port of the JavaScript transform-tree.js default export function
func TryParseDimensionString ¶
TryParseDimensionString attempts to parse a string like "10px" into a *Dimension Returns nil if parsing fails
func WarmPluginCache ¶
func WarmPluginCache(root any, bridge *NodeJSPluginBridge, evalContext any) (int, error)
WarmPluginCache collects plugin function calls from the AST and pre-warms the result cache with a batch IPC call.
Parameters:
- root: The root AST node (typically a *Ruleset)
- bridge: The NodeJSPluginBridge with the runtime and registered functions
- evalContext: The evaluation context (required for variable lookup)
Returns the number of cache entries warmed and any error.
func WarmPluginCacheFromLazyBridge ¶
func WarmPluginCacheFromLazyBridge(root any, lazyBridge *LazyNodeJSPluginBridge, evalContext any) (int, error)
WarmPluginCacheFromLazyBridge is like WarmPluginCache but takes a LazyNodeJSPluginBridge. It only warms the cache if the bridge is already initialized (i.e., plugins have been loaded).
Types ¶
type APIContext ¶
type APIContext struct {
// contains filtered or unexported fields
}
func (*APIContext) GetOptions ¶
func (ac *APIContext) GetOptions() map[string]any
type AbstractFileManager ¶
type AbstractFileManager struct{}
func NewAbstractFileManager ¶
func NewAbstractFileManager() *AbstractFileManager
func (*AbstractFileManager) AlwaysMakePathsAbsolute ¶
func (afm *AbstractFileManager) AlwaysMakePathsAbsolute() bool
func (*AbstractFileManager) ExtractURLParts ¶
func (afm *AbstractFileManager) ExtractURLParts(url, baseURL string) (*URLParts, error)
func (*AbstractFileManager) GetPath ¶
func (afm *AbstractFileManager) GetPath(filename string) string
func (*AbstractFileManager) IsPathAbsolute ¶
func (afm *AbstractFileManager) IsPathAbsolute(filename string) bool
func (*AbstractFileManager) Join ¶
func (afm *AbstractFileManager) Join(basePath, laterPath string) string
func (*AbstractFileManager) PathDiff ¶
func (afm *AbstractFileManager) PathDiff(url, baseURL string) string
func (*AbstractFileManager) SupportsSync ¶
func (afm *AbstractFileManager) SupportsSync() bool
func (*AbstractFileManager) TryAppendExtension ¶
func (afm *AbstractFileManager) TryAppendExtension(path, ext string) string
func (*AbstractFileManager) TryAppendLessExtension ¶
func (afm *AbstractFileManager) TryAppendLessExtension(path string) string
type AcceptableNode ¶
type AcceptableNode interface {
Accept(visitor any)
}
AcceptableNode interface for nodes that accept visitors
type AcceptorNode ¶
type AcceptorNode interface {
Accept(visitor any)
}
type AdditionalData ¶
type AdditionalData struct {
GlobalVars map[string]any
ModifyVars map[string]any
DisablePluginRule bool
Banner string
}
AdditionalData represents additional data that can be passed to the parser
func NewAdditionalData ¶
func NewAdditionalData() *AdditionalData
NewAdditionalData creates a new AdditionalData with initialized maps
type Anonymous ¶
type Anonymous struct {
*Node
Value any
Index int
FileInfo map[string]any
MapLines bool
RulesetLike bool
AllowRoot bool
}
func Escape ¶
Escape URI-encodes a string and replaces specific characters (matches JS encodeURI + specific replacements)
func NewAnonymous ¶
func (*Anonymous) CopyVisibilityInfo ¶
func (*Anonymous) GetTypeIndex ¶
func (*Anonymous) IsRulesetLike ¶
type ArrayLikeNode ¶
ArrayLikeNode represents nodes that behave like arrays (have splice method)
type Assignment ¶
func NewAssignment ¶
func NewAssignment(key, value any) *Assignment
func (*Assignment) Accept ¶
func (a *Assignment) Accept(visitor any)
func (*Assignment) GenCSS ¶
func (a *Assignment) GenCSS(context any, output *CSSOutput)
func (*Assignment) GetType ¶
func (a *Assignment) GetType() string
func (*Assignment) Type ¶
func (a *Assignment) Type() string
type AtRule ¶
type AtRule struct {
*Node
Name string
Value any
Rules []any
Declarations []any // Used for simple blocks (like @starting-style with only declarations)
SimpleBlock bool // True when at-rule contains only declarations (CSS native nesting)
IsRooted bool
AllowRoot bool
DebugInfo any
AllExtends []*Extend // For storing extends found by ExtendFinderVisitor
}
func (*AtRule) BubbleSelectors ¶
func (*AtRule) EvalNested ¶
func (*AtRule) GetAllExtends ¶
func (*AtRule) GetDebugInfo ¶
func (*AtRule) GetIsRooted ¶
func (*AtRule) IsRulesetLike ¶
func (*AtRule) OutputRuleset ¶
func (*AtRule) SetAllExtends ¶
type AtRuleRule ¶
type AtRuleRule interface {
SetRoot(value any)
}
type BaseURLParseError ¶
type BaseURLParseError struct {
BaseURL string
}
func (*BaseURLParseError) Error ¶
func (e *BaseURLParseError) Error() string
type CSSGenerator ¶
CSSGenerator interface for nodes that can generate CSS
type CSSVisitorUtils ¶
type CSSVisitorUtils struct {
// contains filtered or unexported fields
}
CSSVisitorUtils provides utility functions for CSS visitor
func GetCSSVisitorUtils ¶
func GetCSSVisitorUtils(context any) *CSSVisitorUtils
GetCSSVisitorUtils retrieves a CSSVisitorUtils from the pool
func NewCSSVisitorUtils ¶
func NewCSSVisitorUtils(context any) *CSSVisitorUtils
NewCSSVisitorUtils creates a new CSSVisitorUtils instance
func (*CSSVisitorUtils) ContainsSilentNonBlockedChild ¶
func (u *CSSVisitorUtils) ContainsSilentNonBlockedChild(bodyRules []any) bool
ContainsSilentNonBlockedChild checks if body rules contain silent non-blocked children
func (*CSSVisitorUtils) HasVisibleSelector ¶
func (u *CSSVisitorUtils) HasVisibleSelector(rulesetNode any) bool
HasVisibleSelector checks if ruleset node has visible selectors
func (*CSSVisitorUtils) IsEmpty ¶
func (u *CSSVisitorUtils) IsEmpty(owner any) bool
IsEmpty checks if owner is empty
func (*CSSVisitorUtils) IsVisibleRuleset ¶
func (u *CSSVisitorUtils) IsVisibleRuleset(rulesetNode any) bool
IsVisibleRuleset checks if a ruleset is visible
func (*CSSVisitorUtils) KeepOnlyVisibleChilds ¶
func (u *CSSVisitorUtils) KeepOnlyVisibleChilds(owner any)
KeepOnlyVisibleChilds filters out invisible children from owner
func (*CSSVisitorUtils) Reset ¶
func (u *CSSVisitorUtils) Reset(context any)
Reset resets the CSSVisitorUtils for reuse from the pool. The visitor's methodLookup map is preserved (it's expensive to rebuild).
func (*CSSVisitorUtils) ResolveVisibility ¶
func (u *CSSVisitorUtils) ResolveVisibility(node any) any
ResolveVisibility resolves visibility for a node
func (*CSSVisitorUtils) ResolveVisibilityMedia ¶
func (u *CSSVisitorUtils) ResolveVisibilityMedia(node any) any
ResolveVisibilityMedia resolves visibility for Media nodes. Media nodes are special because VisitRuleset extracts nested rulesets and places them as direct children of Media (m.Rules[1...]), not as grandchildren through the wrapper ruleset (m.Rules[0]). This function filters all direct children of Media, not just m.Rules[0].Rules.
type Call ¶
type Call struct {
*Node
Name string
Args []any
Calc bool
CallerFactory FunctionCallerFactory // Factory for creating FunctionCaller instances
// contains filtered or unexported fields
}
type CallbackFunc ¶
CallbackFunc represents a callback function that receives an error and result
type Color ¶
func ColorBlend ¶
func ColorBlendAverage ¶
func ColorBlendDifference ¶
func ColorBlendExclusion ¶
func ColorBlendHardlight ¶
func ColorBlendMultiply ¶
func ColorBlendNegation ¶
func ColorBlendOverlay ¶
func ColorBlendScreen ¶
func ColorBlendSoftlight ¶
func FromKeyword ¶
func (*Color) GetAllowRoot ¶
func (*Color) GetColorValue ¶
func (*Color) OperateColor ¶
type ColorFunctionDefinition ¶
type ColorFunctionDefinition struct {
// contains filtered or unexported fields
}
ColorFunctionDefinition wraps a color function to implement FunctionDefinition
func (*ColorFunctionDefinition) Call ¶
func (c *ColorFunctionDefinition) Call(args ...any) (any, error)
func (*ColorFunctionDefinition) CallCtx ¶
func (c *ColorFunctionDefinition) CallCtx(ctx *Context, args ...any) (any, error)
func (*ColorFunctionDefinition) NeedsEvalArgs ¶
func (c *ColorFunctionDefinition) NeedsEvalArgs() bool
type ColorFunctionWrapper ¶
type ColorFunctionWrapper struct {
// contains filtered or unexported fields
}
ColorFunctionWrapper wraps color functions to implement FunctionDefinition
func (*ColorFunctionWrapper) CallCtx ¶
func (w *ColorFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*ColorFunctionWrapper) NeedsEvalArgs ¶
func (w *ColorFunctionWrapper) NeedsEvalArgs() bool
type Combinator ¶
func NewCombinator ¶
func NewCombinator(value string) *Combinator
func (*Combinator) GenCSS ¶
func (c *Combinator) GenCSS(context any, output *CSSOutput)
func (*Combinator) GetType ¶
func (c *Combinator) GetType() string
func (*Combinator) Type ¶
func (c *Combinator) Type() string
type Comment ¶
type Comment struct {
*Node
Value string
IsLineComment bool
AllowRoot bool
DebugInfo map[string]any
}
func NewComment ¶
func (*Comment) GetDebugInfo ¶
type Compareable ¶
Compareable interface defines the Compare method
type CompileOptions ¶
type CompileOptions struct {
// Paths are additional include paths for @import resolution
Paths []string
// Filename is the name of the file being compiled (used for error messages and source maps)
Filename string
// Compress enables CSS minification
Compress bool
// StrictUnits controls unit checking for math operations
StrictUnits bool
// Math controls how math operations are evaluated
// Use Math.Always, Math.ParensDivision, or Math.Parens
Math MathType
// RewriteUrls controls URL rewriting behavior
RewriteUrls RewriteUrlsType
// Rootpath is the base path for URL rewriting
Rootpath string
// UrlArgs is a query string to append to URLs
UrlArgs string
// EnableJavaScriptPlugins enables support for JavaScript plugins via Node.js
// When true, the compiler will start a Node.js runtime to handle @plugin directives
EnableJavaScriptPlugins bool
// JavascriptEnabled enables inline JavaScript evaluation in LESS files
// When true, `expression` syntax can be used for JavaScript expressions
// Note: This also requires EnableJavaScriptPlugins to be true for the runtime
JavascriptEnabled bool
// Plugins specifies plugins to load before compilation
// When plugins are specified, EnableJavaScriptPlugins is automatically enabled
Plugins []PluginSpec
// GlobalVars are variables to inject before compilation
GlobalVars map[string]any
// ModifyVars are variables to inject after compilation (override existing variables)
ModifyVars map[string]any
// SourceMap enables source map generation
SourceMap bool
// SourceMapOptions contains detailed source map configuration
SourceMapOptions *SourceMapOptions
}
type CompileResult ¶
type CompileResult struct {
CSS string `json:"css"`
Map string `json:"map,omitempty"`
Imports []string `json:"imports,omitempty"`
}
func Compile ¶
func Compile(input string, options *CompileOptions) (*CompileResult, error)
Compile compiles LESS source code to CSS. This is the main entry point for the less.go compiler.
When EnableJavaScriptPlugins is true, the function will: - Create a lazy Node.js runtime that only starts if @plugin directives are encountered - Properly shut down the Node.js process when compilation completes
Example usage:
result, err := less_go.Compile(lessSource, &less_go.CompileOptions{
Filename: "styles.less",
Compress: true,
EnableJavaScriptPlugins: true,
})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.CSS)
func CompileFile ¶
func CompileFile(filename string, options *CompileOptions) (*CompileResult, error)
CompileFile compiles a LESS file to CSS. This reads the file and compiles it with appropriate options set for file-based compilation.
Example usage:
result, err := less_go.CompileFile("styles.less", &less_go.CompileOptions{
Compress: true,
EnableJavaScriptPlugins: true,
})
type ConcretePromise ¶
type ConcretePromise struct {
// contains filtered or unexported fields
}
func NewPromise ¶
func NewPromise() *ConcretePromise
func (*ConcretePromise) Reject ¶
func (p *ConcretePromise) Reject(err error)
func (*ConcretePromise) Resolve ¶
func (p *ConcretePromise) Resolve(file *LoadedFile)
func (*ConcretePromise) Then ¶
func (p *ConcretePromise) Then(onSuccess func(*LoadedFile), onError func(error))
type Container ¶
func NewContainer ¶
func (*Container) BubbleSelectors ¶
func (*Container) EvalNested ¶
func (*Container) GetTypeIndex ¶
type ContainerSyntaxOptions ¶
type ContainerSyntaxOptions struct {
QueryInParens bool
}
type ContainerSyntaxOptionsType ¶
type ContainerSyntaxOptionsType struct {
QueryInParens bool
}
type Context ¶
type Context struct {
Frames []*Frame
}
Context represents the evaluation context. This is a simplified representation; more fields might be needed.
func (*Context) GetFrames ¶
func (c *Context) GetFrames() []ParserFrame
GetFrames implements the interface expected by Variable.Eval It delegates to the underlying EvalContext if available
type ContextInterface ¶
type ContextInterface interface {
Parse(string, map[string]any, func(error, any, any, map[string]any))
GetOptions() map[string]any
}
ContextInterface represents the context that the render function operates on This matches JavaScript's 'this' object that has parse method and options property
type DataURIFunctionWrapper ¶
type DataURIFunctionWrapper struct{}
func (*DataURIFunctionWrapper) Call ¶
func (w *DataURIFunctionWrapper) Call(args ...any) (any, error)
func (*DataURIFunctionWrapper) CallCtx ¶
func (w *DataURIFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*DataURIFunctionWrapper) NeedsEvalArgs ¶
func (w *DataURIFunctionWrapper) NeedsEvalArgs() bool
type Declaration ¶
func GetDeclarationFromPool ¶
func GetDeclarationFromPool() *Declaration
func NewDeclaration ¶
func NewDeclaration(name any, value any, important any, merge any, index int, fileInfo map[string]any, inline bool, variable any) (*Declaration, error)
Uses sync.Pool to reuse Declaration objects.
func (*Declaration) Accept ¶
func (d *Declaration) Accept(visitor any)
func (*Declaration) GenCSS ¶
func (d *Declaration) GenCSS(context any, output *CSSOutput)
func (*Declaration) GenCSSSourceMap ¶ added in v0.1.4
func (d *Declaration) GenCSSSourceMap(context map[string]any, output *SourceMapOutput)
GenCSSSourceMap implements the SourceMapNode interface
func (*Declaration) GetImportant ¶
func (d *Declaration) GetImportant() bool
func (*Declaration) GetMerge ¶
func (d *Declaration) GetMerge() any
func (*Declaration) GetName ¶
func (d *Declaration) GetName() string
func (*Declaration) GetType ¶
func (d *Declaration) GetType() string
func (*Declaration) GetTypeIndex ¶
func (d *Declaration) GetTypeIndex() int
func (*Declaration) GetValue ¶
func (d *Declaration) GetValue() any
func (*Declaration) GetVariable ¶
func (d *Declaration) GetVariable() bool
func (*Declaration) MakeImportant ¶
func (d *Declaration) MakeImportant() any
func (*Declaration) MergeType ¶
func (d *Declaration) MergeType() string
func (*Declaration) Release ¶
func (d *Declaration) Release()
func (*Declaration) SetImportant ¶
func (d *Declaration) SetImportant(important bool)
func (*Declaration) SetValue ¶
func (d *Declaration) SetValue(value any)
func (*Declaration) ToCSS ¶
func (d *Declaration) ToCSS(context any) string
type DefaultFunc ¶
type DefaultFunc struct {
// contains filtered or unexported fields
}
func NewDefaultFunc ¶
func NewDefaultFunc() *DefaultFunc
func (*DefaultFunc) Error ¶
func (d *DefaultFunc) Error(e any)
func (*DefaultFunc) Eval ¶
func (d *DefaultFunc) Eval() any
func (*DefaultFunc) Reset ¶
func (d *DefaultFunc) Reset()
func (*DefaultFunc) Value ¶
func (d *DefaultFunc) Value(v any)
type DefaultFunctionCallerFactory ¶
type DefaultFunctionCallerFactory struct {
// contains filtered or unexported fields
}
func NewDefaultFunctionCallerFactory ¶
func NewDefaultFunctionCallerFactory(registry *Registry) *DefaultFunctionCallerFactory
func (*DefaultFunctionCallerFactory) NewFunctionCaller ¶
func (f *DefaultFunctionCallerFactory) NewFunctionCaller(name string, context EvalContext, index int, fileInfo map[string]any) (ParserFunctionCaller, error)
type DefaultFunctionDefinition ¶
type DefaultFunctionDefinition struct {
}
DefaultFunctionDefinition implements the default() function for mixin guards
func (*DefaultFunctionDefinition) Call ¶
func (d *DefaultFunctionDefinition) Call(args ...any) (any, error)
Call implements the default() function
func (*DefaultFunctionDefinition) CallCtx ¶
func (d *DefaultFunctionDefinition) CallCtx(ctx *Context, args ...any) (any, error)
CallCtx implements the default() function with context
func (*DefaultFunctionDefinition) NeedsEvalArgs ¶
func (d *DefaultFunctionDefinition) NeedsEvalArgs() bool
NeedsEvalArgs returns false since default() takes no arguments
type DefaultFunctions ¶
type DefaultFunctions struct {
// contains filtered or unexported fields
}
DefaultFunctions provides a basic implementation of Functions
func (*DefaultFunctions) GetFunctionRegistry ¶
func (d *DefaultFunctions) GetFunctionRegistry() any
type DefaultParserFunctionCaller ¶
type DefaultParserFunctionCaller struct {
// contains filtered or unexported fields
}
func (*DefaultParserFunctionCaller) Call ¶
func (c *DefaultParserFunctionCaller) Call(args []any) (any, error)
func (*DefaultParserFunctionCaller) IsValid ¶
func (c *DefaultParserFunctionCaller) IsValid() bool
type DefaultPluginLoader ¶
type DefaultPluginLoader struct{}
DefaultPluginLoader provides a basic implementation of PluginLoader
func (*DefaultPluginLoader) EvalPlugin ¶
func (*DefaultPluginLoader) LoadPlugin ¶
func (*DefaultPluginLoader) LoadPluginSync ¶
type DeferredPluginInfo ¶
type DeferredPluginInfo struct {
Path string
CurrentDirectory string
PluginArgs map[string]any
FullPath string
}
DeferredPluginInfo holds information for loading plugins at the correct scope depth during evaluation rather than globally during import.
type DetachedRuleset ¶
type DetachedRuleset struct {
*Node
// contains filtered or unexported fields
}
func NewDetachedRuleset ¶
func NewDetachedRuleset(ruleset any, frames []any) *DetachedRuleset
func (*DetachedRuleset) Accept ¶
func (dr *DetachedRuleset) Accept(visitor any)
func (*DetachedRuleset) CallEval ¶
func (dr *DetachedRuleset) CallEval(context any) any
func (*DetachedRuleset) Eval ¶
func (dr *DetachedRuleset) Eval(context any) any
func (*DetachedRuleset) EvalFirst ¶
func (dr *DetachedRuleset) EvalFirst() bool
func (*DetachedRuleset) GetRuleset ¶
func (dr *DetachedRuleset) GetRuleset() any
func (*DetachedRuleset) GetType ¶
func (dr *DetachedRuleset) GetType() string
func (*DetachedRuleset) GetTypeIndex ¶
func (dr *DetachedRuleset) GetTypeIndex() int
func (*DetachedRuleset) HasRuleset ¶
func (dr *DetachedRuleset) HasRuleset() bool
func (*DetachedRuleset) Type ¶
func (dr *DetachedRuleset) Type() string
type Dimension ¶
func MathHelper ¶
MathHelper applies a mathematical function to a dimension value. If unit is nil, uses the dimension's unit; otherwise unifies and uses the provided unit.
func NewDimensionFrom ¶
Returns nil if the value is NaN.
func Percentage ¶
func (*Dimension) OperateArithmetic ¶
type DirectDispatchVisitor ¶
type DirectDispatchVisitor interface {
VisitNode(node any, visitArgs *VisitArgs) (result any, handled bool)
VisitNodeOut(node any) bool
}
DirectDispatchVisitor interface for direct dispatch without reflection Implementations can optionally implement this for better performance
type EachFunctionDef ¶
type EachFunctionDef struct {
// contains filtered or unexported fields
}
func (*EachFunctionDef) CallCtx ¶
func (e *EachFunctionDef) CallCtx(ctx *Context, args ...any) (any, error)
func (*EachFunctionDef) NeedsEvalArgs ¶
func (e *EachFunctionDef) NeedsEvalArgs() bool
type Element ¶
type Element struct {
*Node
Combinator *Combinator
Value any
IsVariable bool
}
func GetElementFromPool ¶
func GetElementFromPool() *Element
func NewElement ¶
type EntityParsers ¶
type EntityParsers struct {
// contains filtered or unexported fields
}
EntityParsers contains entity-related parsing methods
func (*EntityParsers) Arguments ¶
func (e *EntityParsers) Arguments(prevArgs []any) []any
Arguments parses function arguments
func (*EntityParsers) Assignment ¶
func (e *EntityParsers) Assignment() any
Assignment parses assignments
func (*EntityParsers) Call ¶
func (e *EntityParsers) Call() any
Call parses function calls - rgb(255, 0, 255)
func (*EntityParsers) Color ¶
func (e *EntityParsers) Color() any
Color parses hexadecimal colors - #4F3C2F
func (*EntityParsers) ColorKeyword ¶
func (e *EntityParsers) ColorKeyword() any
ColorKeyword parses color keywords
func (*EntityParsers) CustomFuncCall ¶
func (e *EntityParsers) CustomFuncCall(name string) map[string]any
CustomFuncCall handles custom function calls
func (*EntityParsers) DeclarationCall ¶
func (e *EntityParsers) DeclarationCall() any
DeclarationCall parses declaration-like function calls This is used in media features where we can have syntax like: supports(display: grid)
func (*EntityParsers) Dimension ¶
func (e *EntityParsers) Dimension() any
Dimension parses dimensions (numbers with units) - 0.5em 95%
func (*EntityParsers) JavaScript ¶
func (e *EntityParsers) JavaScript() any
JavaScript parses JavaScript evaluation - `window.location.href`
func (*EntityParsers) Keyword ¶
func (e *EntityParsers) Keyword() any
Keyword parses keywords - black border-collapse
func (*EntityParsers) Literal ¶
func (e *EntityParsers) Literal() any
Literal parses literal entities
func (*EntityParsers) MixinLookup ¶
func (e *EntityParsers) MixinLookup() any
MixinLookup parses mixin lookups
func (*EntityParsers) Property ¶
func (e *EntityParsers) Property() any
Property parses property accessors - $color
func (*EntityParsers) PropertyCurly ¶
func (e *EntityParsers) PropertyCurly() any
PropertyCurly parses property entity using protective {} e.g. ${prop}
func (*EntityParsers) Quoted ¶
func (e *EntityParsers) Quoted(forceEscaped bool) any
Quoted parses quoted strings - "milky way" 'he\'s the one!'
func (*EntityParsers) UnicodeDescriptor ¶
func (e *EntityParsers) UnicodeDescriptor() any
UnicodeDescriptor parses unicode descriptors - U+0?? or U+00A1-00A9
func (*EntityParsers) Variable ¶
func (e *EntityParsers) Variable() any
Variable parses variable entities - @fink
func (*EntityParsers) VariableCurly ¶
func (e *EntityParsers) VariableCurly() any
VariableCurly parses variable entity using protective {} e.g. @{var}
type EnvironmentEnvironment ¶
type EnvironmentEnvironment struct {
FileManagers []EnvironmentFileManager
EncodeBase64 func() string
MimeLookup func() string
CharsetLookup func() string
GetSourceMapGenerator func() any
// contains filtered or unexported fields
}
func NewEnvironment ¶
func NewEnvironment(externalEnvironment map[string]any, fileManagers []EnvironmentFileManager) *EnvironmentEnvironment
func (*EnvironmentEnvironment) AddFileManager ¶
func (e *EnvironmentEnvironment) AddFileManager(fileManager EnvironmentFileManager)
func (*EnvironmentEnvironment) ClearFileManagers ¶
func (e *EnvironmentEnvironment) ClearFileManagers()
func (*EnvironmentEnvironment) GetFileManager ¶
func (e *EnvironmentEnvironment) GetFileManager(filename string, currentDirectory *string, options map[string]any, environment map[string]any, isSync bool) EnvironmentFileManager
type EnvironmentFileManager ¶
type EnvironmentPluginManager ¶
type EnvironmentPluginManager interface {
GetFileManagers() []EnvironmentFileManager
}
type ErrorDetails ¶
type Eval ¶
type Eval struct {
Paths []string
Compress bool
Math MathType
StrictUnits bool
SourceMap bool
ImportMultiple bool
UrlArgs string
JavascriptEnabled bool
PluginManager any
ImportantScope []ImportantScopeEntry // Typed struct replaces []map[string]any
RewriteUrls RewriteUrlsType
NumPrecision int
Frames []any
CalcStack []bool
ParensStack []bool
InCalc bool
MathOn bool
DefaultFunc *DefaultFunc
FunctionRegistry *Registry
MediaBlocks []any
MediaPath []any
PluginBridge *NodeJSPluginBridge
LazyPluginBridge *LazyNodeJSPluginBridge // Lazy bridge for deferred initialization
// contains filtered or unexported fields
}
Eval is the primary evaluation context for Less compilation. OPTIMIZATION: Uses typed fields instead of map[string]any to eliminate reflection overhead.
func GetEvalFromPool ¶
GetEvalFromPool gets an *Eval from the pool and initializes it from a source context. The returned context should be returned via PutEvalToPool when done.
func NewEvalFromEval ¶
func (*Eval) CallPluginFunction ¶
func (*Eval) CopyEvalToMap ¶
func (*Eval) CopyWithFrames ¶
CopyWithFrames creates a shallow copy of the Eval context with new frames. OPTIMIZATION: This is more efficient than CopyEvalToMap for internal use.
func (*Eval) EnterPluginScope ¶
func (*Eval) ExitPluginScope ¶
func (e *Eval) ExitPluginScope()
func (*Eval) GetDefaultFunc ¶
func (e *Eval) GetDefaultFunc() *DefaultFunc
func (*Eval) GetFrames ¶
func (e *Eval) GetFrames() []ParserFrame
func (*Eval) GetFramesAny ¶
func (*Eval) GetImportantFromCurrentScope ¶
GetImportantFromCurrentScope gets the important value from the current scope.
func (*Eval) GetImportantScope ¶
func (*Eval) GetImportantScopeAny ¶
GetImportantScopeAny converts ImportantScope to []map[string]any for backward compatibility. OPTIMIZATION: This is only called when converting to map contexts; direct struct access is preferred.
func (*Eval) HasPluginFunction ¶
func (*Eval) InParenthesis ¶
func (e *Eval) InParenthesis()
func (*Eval) IsMathOnWithOp ¶
func (*Eval) NewMixinEvalContext ¶
NewMixinEvalContext creates a new *Eval context for mixin evaluation. OPTIMIZATION: Directly creates *Eval instead of map[string]any, avoiding reflection. The new context shares the parent's configuration but has new frames and fresh media context.
func (*Eval) NormalizePath ¶
func (*Eval) OutOfParenthesis ¶
func (e *Eval) OutOfParenthesis()
func (*Eval) PathRequiresRewrite ¶
func (*Eval) PopImportantScope ¶
func (e *Eval) PopImportantScope() ImportantScopeEntry
PopImportantScope removes the top scope entry from the important scope stack.
func (*Eval) PushImportantScope ¶
func (e *Eval) PushImportantScope()
PushImportantScope adds a new empty scope entry to the important scope stack. OPTIMIZATION: Direct struct manipulation instead of map allocation.
func (*Eval) RewritePath ¶
func (*Eval) RewritePathForImport ¶
func (*Eval) SetImportantInCurrentScope ¶
SetImportantInCurrentScope sets the important value in the current scope.
type EvalContext ¶
type EvalContext interface {
IsMathOn() bool
SetMathOn(bool)
IsInCalc() bool
EnterCalc()
ExitCalc()
GetFrames() []ParserFrame
GetImportantScope() []map[string]bool
GetDefaultFunc() *DefaultFunc
}
type ExamplePlugin ¶
type ExamplePlugin struct {
// contains filtered or unexported fields
}
ExamplePlugin demonstrates a Go-based Less plugin
func NewExamplePlugin ¶
func NewExamplePlugin() *ExamplePlugin
NewExamplePlugin creates a new example plugin
func (*ExamplePlugin) EvalPlugin ¶
func (p *ExamplePlugin) EvalPlugin() interface{}
EvalPlugin returns the plugin evaluator
func (*ExamplePlugin) GetMinVersion ¶
func (p *ExamplePlugin) GetMinVersion() string
GetMinVersion returns the minimum Less version required
type ExamplePluginEvaluator ¶
type ExamplePluginEvaluator struct {
// contains filtered or unexported fields
}
ExamplePluginEvaluator handles plugin evaluation
type ExamplePostProcessor ¶
type ExamplePostProcessor struct{}
ExamplePostProcessor demonstrates a post-processor plugin
type ExamplePreProcessor ¶
type ExamplePreProcessor struct{}
ExamplePreProcessor demonstrates a pre-processor plugin
type Expression ¶
func GetExpressionFromPool ¶
func GetExpressionFromPool() *Expression
func NewExpression ¶
func NewExpression(value []any, noSpacing bool) (*Expression, error)
func Range ¶
func Range(start, end, step any) *Expression
func (*Expression) Accept ¶
func (e *Expression) Accept(visitor any)
func (*Expression) GenCSS ¶
func (e *Expression) GenCSS(context any, output *CSSOutput)
func (*Expression) GetParens ¶
func (e *Expression) GetParens() bool
func (*Expression) GetParensInOp ¶
func (e *Expression) GetParensInOp() bool
func (*Expression) GetType ¶
func (e *Expression) GetType() string
func (*Expression) GetValue ¶
func (e *Expression) GetValue() []any
func (*Expression) Release ¶
func (e *Expression) Release()
func (*Expression) ThrowAwayComments ¶
func (e *Expression) ThrowAwayComments()
func (*Expression) ToCSS ¶
func (e *Expression) ToCSS(context any) string
type Extend ¶
type Extend struct {
*Node
Selector any
Option string
ObjectId int
ParentIds []int
AllowRoot bool
AllowBefore bool
AllowAfter bool
SelfSelectors []any
// Fields added for visitor support
Ruleset *Ruleset
FirstExtendOnThisSelectorPath bool
HasFoundMatches bool
}
func (*Extend) FindSelfSelectors ¶
type ExtendFinderVisitor ¶
type ExtendFinderVisitor struct {
// contains filtered or unexported fields
}
func GetExtendFinderVisitor ¶
func GetExtendFinderVisitor() *ExtendFinderVisitor
GetExtendFinderVisitor retrieves an ExtendFinderVisitor from the pool
func NewExtendFinderVisitor ¶
func NewExtendFinderVisitor() *ExtendFinderVisitor
func (*ExtendFinderVisitor) IsReplacing ¶
func (efv *ExtendFinderVisitor) IsReplacing() bool
IsReplacing returns false as ExtendFinderVisitor is not a replacing visitor
func (*ExtendFinderVisitor) Reset ¶
func (efv *ExtendFinderVisitor) Reset()
Reset resets the ExtendFinderVisitor for reuse from the pool. The visitor's methodLookup map is preserved (it's expensive to rebuild).
func (*ExtendFinderVisitor) Run ¶
func (efv *ExtendFinderVisitor) Run(root any) any
func (*ExtendFinderVisitor) VisitAtRule ¶
func (efv *ExtendFinderVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs)
func (*ExtendFinderVisitor) VisitAtRuleOut ¶
func (efv *ExtendFinderVisitor) VisitAtRuleOut(atRuleNode any)
func (*ExtendFinderVisitor) VisitDeclaration ¶
func (efv *ExtendFinderVisitor) VisitDeclaration(declNode any, visitArgs *VisitArgs)
func (*ExtendFinderVisitor) VisitMedia ¶
func (efv *ExtendFinderVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs)
func (*ExtendFinderVisitor) VisitMediaOut ¶
func (efv *ExtendFinderVisitor) VisitMediaOut(mediaNode any)
func (*ExtendFinderVisitor) VisitMixinDefinition ¶
func (efv *ExtendFinderVisitor) VisitMixinDefinition(mixinDefinitionNode any, visitArgs *VisitArgs)
func (*ExtendFinderVisitor) VisitNode ¶
func (efv *ExtendFinderVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
VisitNode implements direct dispatch without reflection for better performance
func (*ExtendFinderVisitor) VisitNodeOut ¶
func (efv *ExtendFinderVisitor) VisitNodeOut(node any) bool
VisitNodeOut implements direct dispatch for visitOut methods
func (*ExtendFinderVisitor) VisitRuleset ¶
func (efv *ExtendFinderVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs)
func (*ExtendFinderVisitor) VisitRulesetOut ¶
func (efv *ExtendFinderVisitor) VisitRulesetOut(rulesetNode any)
type FileInfo ¶
type FileInfo struct {
RewriteUrls bool `json:"rewriteUrls"`
Filename string `json:"filename"`
Rootpath string `json:"rootpath"`
CurrentDirectory string `json:"currentDirectory"`
RootFilename string `json:"rootFilename"`
EntryPath string `json:"entryPath"`
Reference bool `json:"reference"`
}
FileInfo contains information about a file being processed Mirrors the JavaScript FileInfo structure:
'rewriteUrls' - option - whether to adjust URL's to be relative 'filename' - full resolved filename of current file 'rootpath' - path to append to normal URLs for this node 'currentDirectory' - path to the current file, absolute 'rootFilename' - filename of the base file 'entryPath' - absolute path to the entry file 'reference' - whether the file should not be output and only output parts that are referenced
type FileManager ¶
type FileManager interface {
LoadFileSync(path, currentDirectory string, context map[string]any, environment ImportManagerEnvironment) *LoadedFile
LoadFile(path, currentDirectory string, context map[string]any, environment ImportManagerEnvironment, callback func(error, *LoadedFile)) any
GetPath(filename string) string
Join(path1, path2 string) string
PathDiff(currentDirectory, entryPath string) string
IsPathAbsolute(path string) bool
AlwaysMakePathsAbsolute() bool
}
type FileSystemFileManager ¶
type FileSystemFileManager struct {
AbstractFileManager
}
FileSystemFileManager implements a real file manager that loads files from disk
func NewFileSystemFileManager ¶
func NewFileSystemFileManager() *FileSystemFileManager
NewFileSystemFileManager creates a new FileSystemFileManager
func (*FileSystemFileManager) AlwaysMakePathsAbsolute ¶
func (fm *FileSystemFileManager) AlwaysMakePathsAbsolute() bool
AlwaysMakePathsAbsolute returns false (we don't always make paths absolute)
func (*FileSystemFileManager) CanonicalizeFilename ¶
func (fm *FileSystemFileManager) CanonicalizeFilename(filename string) string
CanonicalizeFilename canonicalizes a filename
func (*FileSystemFileManager) ConvertToFileUrl ¶
func (fm *FileSystemFileManager) ConvertToFileUrl(filename string, url string, options map[string]any) string
ConvertToFileUrl converts a filename to a file URL
func (*FileSystemFileManager) GetPath ¶
func (fm *FileSystemFileManager) GetPath(filename string) string
GetPath returns the directory of a filename
func (*FileSystemFileManager) IsPathAbsolute ¶
func (fm *FileSystemFileManager) IsPathAbsolute(filename string) bool
IsPathAbsolute checks if a path is absolute
func (*FileSystemFileManager) Join ¶
func (fm *FileSystemFileManager) Join(basePath, relativePath string) string
Join joins two paths
func (*FileSystemFileManager) LoadFile ¶
func (fm *FileSystemFileManager) LoadFile(filename, currentDirectory string, context map[string]any, environment ImportManagerEnvironment, callback func(error, *LoadedFile)) any
LoadFile loads a file asynchronously (but we implement it synchronously for now)
func (*FileSystemFileManager) LoadFileSync ¶
func (fm *FileSystemFileManager) LoadFileSync(filename, currentDirectory string, context map[string]any, environment ImportManagerEnvironment) *LoadedFile
LoadFileSync loads a file synchronously
func (*FileSystemFileManager) PathDiff ¶
func (fm *FileSystemFileManager) PathDiff(url, baseUrl string) string
PathDiff returns the relative path between two directories This matches the JavaScript AbstractFileManager.pathDiff behavior: - Always uses forward slashes (/) - Adds trailing slash for directories - Input paths should be directories ending with /
func (*FileSystemFileManager) Supports ¶
func (fm *FileSystemFileManager) Supports(filename, currentDirectory string, options map[string]any, environment map[string]any) bool
Supports returns true for all files (this manager handles any file)
func (*FileSystemFileManager) SupportsSync ¶
func (fm *FileSystemFileManager) SupportsSync(filename, currentDirectory string, options map[string]any, environment map[string]any) bool
SupportsSync returns true (we support synchronous loading)
type FlexibleFunctionDef ¶
type FlexibleFunctionDef struct {
// contains filtered or unexported fields
}
func (*FlexibleFunctionDef) CallCtx ¶
func (f *FlexibleFunctionDef) CallCtx(ctx *Context, args ...any) (any, error)
func (*FlexibleFunctionDef) NeedsEvalArgs ¶
func (f *FlexibleFunctionDef) NeedsEvalArgs() bool
type Frame ¶
type Frame struct {
FunctionRegistry FunctionRegistry
EvalContext EvalContext // Reference to the evaluation context
CurrentFileInfo map[string]any // Current file information for this frame
// contains filtered or unexported fields
}
Frame represents a scope frame.
func (*Frame) SetVariable ¶
SetVariable sets a variable in the frame
type FunctionCallerFactory ¶
type FunctionCallerFactory interface {
NewFunctionCaller(name string, context EvalContext, index int, fileInfo map[string]any) (ParserFunctionCaller, error)
}
type FunctionDefinition ¶
type FunctionDefinition interface {
// Call handles functions where args are evaluated (evalArgs=true, default)
Call(args ...any) (any, error)
// CallCtx handles functions where args are not evaluated (evalArgs=false)
CallCtx(ctx *Context, args ...any) (any, error)
// NeedsEvalArgs returns true if arguments should be evaluated before calling.
NeedsEvalArgs() bool
}
FunctionDefinition defines a Less function.
type FunctionRegistry ¶
type FunctionRegistry interface {
Get(name string) FunctionDefinition
}
FunctionRegistry provides access to registered functions.
type Functions ¶
type Functions interface {
GetFunctionRegistry() any
}
Functions interface represents the functions registry
type IfFunctionDef ¶
type IfFunctionDef struct{}
func (*IfFunctionDef) CallCtx ¶
func (f *IfFunctionDef) CallCtx(ctx *Context, args ...any) (any, error)
func (*IfFunctionDef) NeedsEvalArgs ¶
func (f *IfFunctionDef) NeedsEvalArgs() bool
type ImageHeightFunctionWrapper ¶
type ImageHeightFunctionWrapper struct{}
func (*ImageHeightFunctionWrapper) Call ¶
func (w *ImageHeightFunctionWrapper) Call(args ...any) (any, error)
func (*ImageHeightFunctionWrapper) CallCtx ¶
func (w *ImageHeightFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*ImageHeightFunctionWrapper) NeedsEvalArgs ¶
func (w *ImageHeightFunctionWrapper) NeedsEvalArgs() bool
type ImageSizeFunctionWrapper ¶
type ImageSizeFunctionWrapper struct{}
func (*ImageSizeFunctionWrapper) Call ¶
func (w *ImageSizeFunctionWrapper) Call(args ...any) (any, error)
func (*ImageSizeFunctionWrapper) CallCtx ¶
func (w *ImageSizeFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*ImageSizeFunctionWrapper) NeedsEvalArgs ¶
func (w *ImageSizeFunctionWrapper) NeedsEvalArgs() bool
type ImageWidthFunctionWrapper ¶
type ImageWidthFunctionWrapper struct{}
func (*ImageWidthFunctionWrapper) Call ¶
func (w *ImageWidthFunctionWrapper) Call(args ...any) (any, error)
func (*ImageWidthFunctionWrapper) CallCtx ¶
func (w *ImageWidthFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*ImageWidthFunctionWrapper) NeedsEvalArgs ¶
func (w *ImageWidthFunctionWrapper) NeedsEvalArgs() bool
type Implementation ¶
type Implementation interface {
IsReplacing() bool
}
type Import ¶
type Import struct {
*Node
// contains filtered or unexported fields
}
Import represents a CSS @import node. Files are pushed to an import queue on creation with a callback that fires when the file has been fetched and parsed.
func (*Import) EvalForImport ¶
func (*Import) GetRoot ¶ added in v0.4.0
GetRoot returns the root ruleset of this import for variable hoisting. This is needed for variable lookup to traverse into imported files.
func (*Import) GetTypeIndex ¶
GetTypeIndex returns the type index for visitor pattern
func (*Import) IsVariableImport ¶
type ImportItem ¶
type ImportItem struct {
// contains filtered or unexported fields
}
type ImportManager ¶
type ImportManager struct {
// contains filtered or unexported fields
}
func (*ImportManager) Contents ¶
func (im *ImportManager) Contents() map[string]string
func (*ImportManager) ContentsIgnoredChars ¶ added in v0.1.4
func (im *ImportManager) ContentsIgnoredChars() map[string]int
ContentsIgnoredChars returns the number of characters to ignore at the start of each file This is used for source maps when global vars or banners are injected
func (*ImportManager) Files ¶
func (im *ImportManager) Files() map[string]*FileCache
func (*ImportManager) Push ¶
func (im *ImportManager) Push(path string, tryAppendExtension bool, currentFileInfo *FileInfo, importOptions *ImportOptions, callback ParseCallback)
func (*ImportManager) RootFilename ¶
func (im *ImportManager) RootFilename() string
type ImportManagerEnvironment ¶
type ImportManagerEnvironment interface {
GetFileManager(path, currentDirectory string, context map[string]any, environment ImportManagerEnvironment) FileManager
}
type ImportOptions ¶
type ImportSequencer ¶
type ImportSequencer struct {
// contains filtered or unexported fields
}
func NewImportSequencer ¶
func NewImportSequencer(onSequencerEmpty func()) *ImportSequencer
func (*ImportSequencer) AddImport ¶
func (is *ImportSequencer) AddImport(callback func(...any)) func(...any)
func (*ImportSequencer) AddVariableImport ¶
func (is *ImportSequencer) AddVariableImport(callback func())
func (*ImportSequencer) TryRun ¶
func (is *ImportSequencer) TryRun()
type ImportVisitor ¶
type ImportVisitor struct {
// contains filtered or unexported fields
}
func NewImportVisitor ¶
func NewImportVisitor(importer any, finish func(error)) *ImportVisitor
func (*ImportVisitor) IsReplacing ¶
func (iv *ImportVisitor) IsReplacing() bool
func (*ImportVisitor) Run ¶
func (iv *ImportVisitor) Run(root any)
func (*ImportVisitor) VisitAtRule ¶
func (iv *ImportVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs)
func (*ImportVisitor) VisitAtRuleOut ¶
func (iv *ImportVisitor) VisitAtRuleOut(atRuleNode any)
func (*ImportVisitor) VisitDeclaration ¶
func (iv *ImportVisitor) VisitDeclaration(declNode any, visitArgs *VisitArgs)
func (*ImportVisitor) VisitDeclarationOut ¶
func (iv *ImportVisitor) VisitDeclarationOut(declNode any)
func (*ImportVisitor) VisitImport ¶
func (iv *ImportVisitor) VisitImport(importNode any, visitArgs *VisitArgs)
func (*ImportVisitor) VisitMedia ¶
func (iv *ImportVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs)
func (*ImportVisitor) VisitMediaOut ¶
func (iv *ImportVisitor) VisitMediaOut(mediaNode any)
func (*ImportVisitor) VisitMixinDefinition ¶
func (iv *ImportVisitor) VisitMixinDefinition(mixinDefinitionNode any, visitArgs *VisitArgs)
func (*ImportVisitor) VisitMixinDefinitionOut ¶
func (iv *ImportVisitor) VisitMixinDefinitionOut(mixinDefinitionNode any)
func (*ImportVisitor) VisitNode ¶
func (iv *ImportVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
func (*ImportVisitor) VisitNodeOut ¶
func (iv *ImportVisitor) VisitNodeOut(node any) bool
func (*ImportVisitor) VisitRuleset ¶
func (iv *ImportVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs)
func (*ImportVisitor) VisitRulesetOut ¶
func (iv *ImportVisitor) VisitRulesetOut(rulesetNode any)
type ImportantScopeEntry ¶
type ImportantScopeEntry struct {
Important string // The " !important" suffix value when set
}
ImportantScopeEntry represents a single entry in the !important scope stack. This replaces map[string]any with a typed struct to eliminate reflection overhead.
type IsDefinedFunctionDef ¶
type IsDefinedFunctionDef struct{}
func (*IsDefinedFunctionDef) CallCtx ¶
func (f *IsDefinedFunctionDef) CallCtx(ctx *Context, args ...any) (any, error)
func (*IsDefinedFunctionDef) NeedsEvalArgs ¶
func (f *IsDefinedFunctionDef) NeedsEvalArgs() bool
type JSArrayResult ¶
type JSArrayResult struct {
Value string
}
type JSEmptyResult ¶
type JSEmptyResult struct{}
type JSVisitorAdapter ¶
type JSVisitorAdapter struct {
// contains filtered or unexported fields
}
JSVisitorAdapter adapts a runtime.JSVisitor to work with the PluginManager's visitor system. It implements the interfaces expected by transform_tree.go.
NOTE: This is part of an EXPERIMENTAL binary buffer visitor approach that is NOT currently used in production. The actual visitor execution uses the JSON pathway via NodeJSPluginBridge.RunPreEvalVisitorsJSON(). See the comment on applyReplacements() for more details.
func NewJSVisitorAdapter ¶
func NewJSVisitorAdapter(visitor *runtime.JSVisitor, rt *runtime.NodeJSRuntime) *JSVisitorAdapter
NewJSVisitorAdapter creates a new adapter for a JavaScript visitor.
func (*JSVisitorAdapter) IsPreEvalVisitor ¶
func (a *JSVisitorAdapter) IsPreEvalVisitor() bool
IsPreEvalVisitor returns true if this is a pre-evaluation visitor. This matches the interface expected by transform_tree.go.
func (*JSVisitorAdapter) IsPreVisitor ¶
func (a *JSVisitorAdapter) IsPreVisitor() bool
IsPreVisitor returns false - JS visitors are not "pre" visitors in the sense of going before built-in visitors. They follow the pre-eval/post-eval pattern.
func (*JSVisitorAdapter) IsReplacing ¶
func (a *JSVisitorAdapter) IsReplacing() bool
IsReplacing returns true if this visitor can replace nodes.
func (*JSVisitorAdapter) Run ¶
func (a *JSVisitorAdapter) Run(root any) any
Run executes the JavaScript visitor on the AST root. It serializes the AST, sends it to Node.js, runs the visitor, and applies any replacements to the Go AST.
type JSVisitorRegistry ¶
type JSVisitorRegistry struct {
// contains filtered or unexported fields
}
JSVisitorRegistry manages JavaScript visitors registered by plugins. It integrates with the PluginManager to provide visitors to transform_tree.
NOTE: This is part of an EXPERIMENTAL binary buffer visitor approach that is NOT currently used in production. See JSVisitorAdapter for details.
func NewJSVisitorRegistry ¶
func NewJSVisitorRegistry(rt *runtime.NodeJSRuntime) *JSVisitorRegistry
NewJSVisitorRegistry creates a new registry for JavaScript visitors.
func (*JSVisitorRegistry) GetAdapters ¶
func (r *JSVisitorRegistry) GetAdapters() []*JSVisitorAdapter
GetAdapters returns all visitor adapters.
func (*JSVisitorRegistry) GetPostEvalAdapters ¶
func (r *JSVisitorRegistry) GetPostEvalAdapters() []*JSVisitorAdapter
GetPostEvalAdapters returns only post-evaluation visitor adapters.
func (*JSVisitorRegistry) GetPreEvalAdapters ¶
func (r *JSVisitorRegistry) GetPreEvalAdapters() []*JSVisitorAdapter
GetPreEvalAdapters returns only pre-evaluation visitor adapters.
func (*JSVisitorRegistry) RefreshFromNodeJS ¶
func (r *JSVisitorRegistry) RefreshFromNodeJS() error
RefreshFromNodeJS fetches the current list of registered visitors from Node.js and creates adapters for them.
func (*JSVisitorRegistry) RegisterWithPluginManager ¶
func (r *JSVisitorRegistry) RegisterWithPluginManager(pm *PluginManager)
RegisterWithPluginManager adds all visitor adapters to the PluginManager. This allows them to be picked up by transform_tree.go's visitor loop.
type JavaScript ¶
type JavaScript struct {
*JsEvalNode
// contains filtered or unexported fields
}
func NewJavaScript ¶
func (*JavaScript) FileInfo ¶
func (j *JavaScript) FileInfo() map[string]any
func (*JavaScript) GetIndex ¶
func (j *JavaScript) GetIndex() int
func (*JavaScript) GetType ¶
func (j *JavaScript) GetType() string
func (*JavaScript) Type ¶
func (j *JavaScript) Type() string
type JoinSelectorVisitor ¶
type JoinSelectorVisitor struct {
// contains filtered or unexported fields
}
func GetJoinSelectorVisitor ¶
func GetJoinSelectorVisitor() *JoinSelectorVisitor
GetJoinSelectorVisitor retrieves a JoinSelectorVisitor from the pool
func NewJoinSelectorVisitor ¶
func NewJoinSelectorVisitor() *JoinSelectorVisitor
func (*JoinSelectorVisitor) IsReplacing ¶
func (jsv *JoinSelectorVisitor) IsReplacing() bool
func (*JoinSelectorVisitor) Reset ¶
func (jsv *JoinSelectorVisitor) Reset()
Reset resets the JoinSelectorVisitor for reuse from the pool. The visitor's methodLookup map is preserved (it's expensive to rebuild).
func (*JoinSelectorVisitor) Run ¶
func (jsv *JoinSelectorVisitor) Run(root any) any
func (*JoinSelectorVisitor) VisitAtRule ¶
func (jsv *JoinSelectorVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs) any
Matches JavaScript join-selector-visitor.js visitAtRule: atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null);
func (*JoinSelectorVisitor) VisitContainer ¶
func (jsv *JoinSelectorVisitor) VisitContainer(containerNode any, visitArgs *VisitArgs) any
func (*JoinSelectorVisitor) VisitDeclaration ¶
func (jsv *JoinSelectorVisitor) VisitDeclaration(declNode any, visitArgs *VisitArgs) any
func (*JoinSelectorVisitor) VisitMedia ¶
func (jsv *JoinSelectorVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs) any
func (*JoinSelectorVisitor) VisitMixinDefinition ¶
func (jsv *JoinSelectorVisitor) VisitMixinDefinition(mixinDefinitionNode any, visitArgs *VisitArgs) any
func (*JoinSelectorVisitor) VisitNode ¶
func (jsv *JoinSelectorVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
func (*JoinSelectorVisitor) VisitNodeOut ¶
func (jsv *JoinSelectorVisitor) VisitNodeOut(node any) bool
func (*JoinSelectorVisitor) VisitRuleset ¶
func (jsv *JoinSelectorVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs) any
func (*JoinSelectorVisitor) VisitRulesetOut ¶
func (jsv *JoinSelectorVisitor) VisitRulesetOut(rulesetNode any)
type JsEvalNode ¶
type JsEvalNode struct {
*Node
}
func NewJsEvalNode ¶
func NewJsEvalNode() *JsEvalNode
func (*JsEvalNode) EvaluateJavaScript ¶
func (j *JsEvalNode) EvaluateJavaScript(expression string, context any) (any, error)
func (*JsEvalNode) GetType ¶
func (j *JsEvalNode) GetType() string
func (*JsEvalNode) Type ¶
func (j *JsEvalNode) Type() string
type Keyword ¶
type Keyword struct {
*Node
// contains filtered or unexported fields
}
func NewKeyword ¶
type LazyNodeJSPluginBridge ¶
type LazyNodeJSPluginBridge struct {
// contains filtered or unexported fields
}
LazyNodeJSPluginBridge provides lazy initialization of the NodeJS plugin bridge, avoiding the overhead of spawning Node.js for compilations that don't use plugins.
func NewLazyNodeJSPluginBridge ¶
func NewLazyNodeJSPluginBridge() *LazyNodeJSPluginBridge
func (*LazyNodeJSPluginBridge) CallFunction ¶
func (lb *LazyNodeJSPluginBridge) CallFunction(name string, args ...any) (any, error)
func (*LazyNodeJSPluginBridge) CallFunctionWithContext ¶
func (lb *LazyNodeJSPluginBridge) CallFunctionWithContext(name string, evalContext runtime.EvalContextProvider, args ...any) (any, error)
func (*LazyNodeJSPluginBridge) Close ¶
func (lb *LazyNodeJSPluginBridge) Close() error
func (*LazyNodeJSPluginBridge) EnterScope ¶
func (lb *LazyNodeJSPluginBridge) EnterScope() *runtime.PluginScope
func (*LazyNodeJSPluginBridge) EvalPlugin ¶
func (*LazyNodeJSPluginBridge) ExitScope ¶
func (lb *LazyNodeJSPluginBridge) ExitScope() *runtime.PluginScope
func (*LazyNodeJSPluginBridge) GetBridge ¶
func (lb *LazyNodeJSPluginBridge) GetBridge() (*NodeJSPluginBridge, error)
func (*LazyNodeJSPluginBridge) GetPostEvalVisitors ¶
func (lb *LazyNodeJSPluginBridge) GetPostEvalVisitors() []*runtime.JSVisitor
func (*LazyNodeJSPluginBridge) GetPostProcessors ¶
func (lb *LazyNodeJSPluginBridge) GetPostProcessors() []*runtime.JSPostProcessor
func (*LazyNodeJSPluginBridge) GetPreEvalVisitors ¶
func (lb *LazyNodeJSPluginBridge) GetPreEvalVisitors() []*runtime.JSVisitor
func (*LazyNodeJSPluginBridge) GetPreProcessors ¶
func (lb *LazyNodeJSPluginBridge) GetPreProcessors() []*runtime.JSPreProcessor
func (*LazyNodeJSPluginBridge) GetProcessorManager ¶
func (lb *LazyNodeJSPluginBridge) GetProcessorManager() *runtime.ProcessorManager
func (*LazyNodeJSPluginBridge) GetRuntime ¶
func (lb *LazyNodeJSPluginBridge) GetRuntime() *runtime.NodeJSRuntime
func (*LazyNodeJSPluginBridge) GetScope ¶
func (lb *LazyNodeJSPluginBridge) GetScope() *runtime.PluginScope
func (*LazyNodeJSPluginBridge) GetVisitors ¶
func (lb *LazyNodeJSPluginBridge) GetVisitors() []*runtime.JSVisitor
func (*LazyNodeJSPluginBridge) HasFunction ¶
func (lb *LazyNodeJSPluginBridge) HasFunction(name string) bool
func (*LazyNodeJSPluginBridge) IsInitialized ¶
func (lb *LazyNodeJSPluginBridge) IsInitialized() bool
func (*LazyNodeJSPluginBridge) LoadPlugin ¶
func (*LazyNodeJSPluginBridge) LoadPluginSync ¶
func (*LazyNodeJSPluginBridge) LookupFunction ¶
func (lb *LazyNodeJSPluginBridge) LookupFunction(name string) (*runtime.JSFunctionDefinition, bool)
func (*LazyNodeJSPluginBridge) RunPostProcessors ¶
func (*LazyNodeJSPluginBridge) RunPreProcessors ¶
func (*LazyNodeJSPluginBridge) WasUsed ¶
func (lb *LazyNodeJSPluginBridge) WasUsed() bool
type LessContext ¶
type LessContext struct {
Options map[string]any
ImportManager *ImportManager
PluginLoader PluginLoaderFactory
Functions Functions
// PluginBridge provides lazy access to the Node.js plugin system.
// It is initialized on first use and should be closed after compilation.
PluginBridge *LazyNodeJSPluginBridge
}
LessContext represents the "this" context that contains options and importManager
func NewLessContext ¶
func NewLessContext(options map[string]any) *LessContext
NewLessContext creates a new LessContext
func NewLessContextWithPlugins ¶
func NewLessContextWithPlugins(options map[string]any) (*LessContext, func() error)
NewLessContextWithPlugins creates a LessContext with JavaScript plugin support. The context includes a lazy plugin bridge that only starts Node.js when plugins are used. The returned cleanup function should be called after compilation to shut down Node.js.
func (*LessContext) GetFunctions ¶
func (lc *LessContext) GetFunctions() Functions
GetFunctions implements LessInterface
func (*LessContext) GetPluginLoader ¶
func (lc *LessContext) GetPluginLoader() PluginLoaderFactory
GetPluginLoader implements LessInterface
type LessError ¶
type LessError struct {
Type string
Message string
Stack string
Filename string
Index any
Line *int
Column int
CallLine *int
CallExtract string
Extract []string
// contains filtered or unexported fields
}
func NewLessError ¶
func NewLessError(e ErrorDetails, fileContentMap map[string]string, currentFilename string) *LessError
func (*LessError) ColumnNumber ¶
func (*LessError) GetErrorType ¶
func (*LessError) HasLineColumn ¶
func (*LessError) LineNumber ¶
func (*LessError) ToString ¶
func (le *LessError) ToString(options *ToStringOptions) string
type LessInterface ¶
type LessInterface interface {
GetPluginLoader() PluginLoaderFactory
GetFunctions() Functions
}
LessInterface represents the minimal interface needed by PluginManager
type LoadedFile ¶
type Location ¶
Location represents a position in the input stream
func GetLocation ¶
GetLocation returns the line and column for a given index in the input stream
type LogListener ¶
type LogListenerPartial ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) AddListener ¶
func (*Logger) GetListeners ¶
func (*Logger) RemoveListener ¶
type MapEvalContext ¶
type MapEvalContext struct {
// contains filtered or unexported fields
}
func (*MapEvalContext) EnterCalc ¶
func (m *MapEvalContext) EnterCalc()
func (*MapEvalContext) ExitCalc ¶
func (m *MapEvalContext) ExitCalc()
func (*MapEvalContext) GetDefaultFunc ¶
func (m *MapEvalContext) GetDefaultFunc() *DefaultFunc
func (*MapEvalContext) GetFrames ¶
func (m *MapEvalContext) GetFrames() []ParserFrame
func (*MapEvalContext) GetImportantScope ¶
func (m *MapEvalContext) GetImportantScope() []map[string]bool
func (*MapEvalContext) IsInCalc ¶
func (m *MapEvalContext) IsInCalc() bool
func (*MapEvalContext) IsMathOn ¶
func (m *MapEvalContext) IsMathOn() bool
func (*MapEvalContext) SetMathOn ¶
func (m *MapEvalContext) SetMathOn(enabled bool)
type MathFunctionWrapper ¶
type MathFunctionWrapper struct {
// contains filtered or unexported fields
}
MathFunctionWrapper wraps math functions to implement FunctionDefinition interface
func (*MathFunctionWrapper) CallCtx ¶
func (w *MathFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*MathFunctionWrapper) NeedsEvalArgs ¶
func (w *MathFunctionWrapper) NeedsEvalArgs() bool
type MathHelperError ¶
MathHelperError represents an argument error
func (*MathHelperError) Error ¶
func (e *MathHelperError) Error() string
type Media ¶
Media represents a media query node in the Less AST
func NewMedia ¶
func NewMedia(value any, features any, index int, currentFileInfo map[string]any, visibilityInfo map[string]any) *Media
NewMedia creates a new Media instance
func (*Media) BubbleSelectors ¶
BubbleSelectors bubbles selectors up the tree (implementing NestableAtRulePrototype) This function wraps the media's inner ruleset with the parent selectors. It can be called multiple times from different parent rulesets, each adding another layer of wrapping to build up the full selector path. For example, with .first { .second { .third { @media {...} } } }: - First call wraps with .third selectors - Second call wraps with .second selectors (around the .third wrapper) - Third call wraps with .first selectors (around the .second wrapper) This builds up to .first .second .third when selectors are joined.
func (*Media) EvalNested ¶
EvalNested evaluates the media rule in a nested context (implementing NestableAtRulePrototype)
func (*Media) EvalTop ¶
EvalTop evaluates the media rule at the top level (implementing NestableAtRulePrototype)
func (*Media) GetTypeIndex ¶
GetTypeIndex returns the type index for visitor pattern
func (*Media) IsRulesetLike ¶
IsRulesetLike returns true (implementing NestableAtRulePrototype)
type MediaSyntaxOptions ¶
type MediaSyntaxOptions struct {
QueryInParens bool
}
type MediaSyntaxOptionsType ¶
type MediaSyntaxOptionsType struct {
QueryInParens bool
}
type MixinCall ¶
MixinCall represents a mixin call node in the Less AST
func NewMixinCall ¶
func NewMixinCall(elements any, args []any, index int, currentFileInfo map[string]any, important bool) (*MixinCall, error)
NewMixinCall creates a new MixinCall instance
type MixinCallError ¶
MixinCallError represents a Less error for mixin calls
func (*MixinCallError) Error ¶
func (e *MixinCallError) Error() string
type MixinDefinition ¶
type MixinDefinition struct {
*Ruleset
Name string
Params []any
Condition any
Variadic bool
Arity int
Lookups map[string][]any
Required int
OptionalParameters []string
Frames []any
}
MixinDefinition represents a mixin definition node in the Less AST
func NewMixinDefinition ¶
func NewMixinDefinition(name string, params []any, rules []any, condition any, variadic bool, frames []any, visibilityInfo map[string]any) (*MixinDefinition, error)
NewMixinDefinition creates a new MixinDefinition instance
func (*MixinDefinition) Accept ¶
func (md *MixinDefinition) Accept(visitor any)
Accept visits the mixin definition with a visitor
func (*MixinDefinition) Eval ¶
func (md *MixinDefinition) Eval(context any) (*MixinDefinition, error)
Eval evaluates the mixin definition
func (*MixinDefinition) EvalFirst ¶
func (md *MixinDefinition) EvalFirst() bool
EvalFirst indicates this node should be evaluated first
func (*MixinDefinition) EvalParams ¶
func (md *MixinDefinition) EvalParams(context any, mixinEnv any, args []any, evaldArguments []any) (*Ruleset, error)
EvalParams evaluates mixin parameters and creates parameter frame
func (*MixinDefinition) GenCSS ¶
func (md *MixinDefinition) GenCSS(context any, output *CSSOutput)
GenCSS for MixinDefinition - mixin definitions should not output any CSS
func (*MixinDefinition) GetType ¶
func (md *MixinDefinition) GetType() string
GetType returns the type of the node
func (*MixinDefinition) IsRuleset ¶
func (md *MixinDefinition) IsRuleset() bool
IsRuleset returns true (MixinDefinition inherits from Ruleset in JavaScript)
func (*MixinDefinition) MakeImportant ¶
func (md *MixinDefinition) MakeImportant() any
MakeImportant creates a new MixinDefinition with important rules
func (*MixinDefinition) MatchArgs ¶
func (md *MixinDefinition) MatchArgs(args []any, context any) bool
MatchArgs checks if the mixin arguments match
func (*MixinDefinition) MatchCondition ¶
func (md *MixinDefinition) MatchCondition(args []any, context any) bool
MatchCondition checks if the mixin condition matches
func (*MixinDefinition) Type ¶
func (md *MixinDefinition) Type() string
Type returns the type of the node (for compatibility)
type MixinParsers ¶
type MixinParsers struct {
// contains filtered or unexported fields
}
MixinParsers contains mixin-related parsing methods
func (*MixinParsers) Args ¶
func (m *MixinParsers) Args(isCall bool) map[string]any
Args parses mixin arguments
func (*MixinParsers) Call ¶
func (m *MixinParsers) Call(inValue bool, getLookup bool) any
Call parses mixin calls
func (*MixinParsers) Definition ¶
func (m *MixinParsers) Definition() any
Definition parses mixin definitions
func (*MixinParsers) Elements ¶
func (m *MixinParsers) Elements() []*Element
Elements parses mixin elements
func (*MixinParsers) LookupValue ¶
func (m *MixinParsers) LookupValue() *string
LookupValue parses lookup values like [ruleProperty] Returns nil if parsing fails, or a pointer to the matched string if successful
func (*MixinParsers) RuleLookups ¶
func (m *MixinParsers) RuleLookups() []string
RuleLookups parses rule lookups like [ruleProperty]
type NamespaceValue ¶
type NamespaceValue struct {
*Node
// contains filtered or unexported fields
}
NamespaceValue represents a namespace value node in the Less AST
func NewNamespaceValue ¶
func NewNamespaceValue(ruleCall any, lookups []string, index int, fileInfo map[string]any) *NamespaceValue
NewNamespaceValue creates a new NamespaceValue instance
func (*NamespaceValue) Eval ¶
func (nv *NamespaceValue) Eval(context any) (any, error)
Eval evaluates the namespace value
func (*NamespaceValue) FileInfo ¶
func (nv *NamespaceValue) FileInfo() map[string]any
FileInfo returns the node's file information
func (*NamespaceValue) GenCSS ¶
func (nv *NamespaceValue) GenCSS(context any, output *CSSOutput)
Note: LessError is now defined in less_error.go with full implementation GenCSS generates CSS by first evaluating the namespace value This ensures errors are properly propagated during CSS generation
func (*NamespaceValue) GetIndex ¶
func (nv *NamespaceValue) GetIndex() int
GetIndex returns the node's index
func (*NamespaceValue) GetType ¶
func (nv *NamespaceValue) GetType() string
GetType returns the node type
func (*NamespaceValue) Type ¶
func (nv *NamespaceValue) Type() string
Type returns the node type (for compatibility)
type Negative ¶
Negative represents a negative node in the Less AST
type NestableAtRulePrototype ¶
NestableAtRulePrototype represents the prototype functionality for nestable at-rules
func NewNestableAtRulePrototype ¶
func NewNestableAtRulePrototype() *NestableAtRulePrototype
NewNestableAtRulePrototype creates a new NestableAtRulePrototype instance
func (*NestableAtRulePrototype) Accept ¶
func (n *NestableAtRulePrototype) Accept(visitor any)
Accept visits the node with a visitor
func (*NestableAtRulePrototype) BubbleSelectors ¶
func (n *NestableAtRulePrototype) BubbleSelectors(selectors []*Selector)
BubbleSelectors bubbles selectors up the tree
func (*NestableAtRulePrototype) EvalNested ¶
func (n *NestableAtRulePrototype) EvalNested(context any) any
EvalNested evaluates the at-rule in a nested context
func (*NestableAtRulePrototype) EvalTop ¶
func (n *NestableAtRulePrototype) EvalTop(context any) any
EvalTop evaluates the at-rule at the top level
func (*NestableAtRulePrototype) IsRulesetLike ¶
func (n *NestableAtRulePrototype) IsRulesetLike() bool
IsRulesetLike returns true indicating this behaves like a ruleset
func (*NestableAtRulePrototype) Permute ¶
func (n *NestableAtRulePrototype) Permute(arr []any) any
Permute creates permutations of the given array
type Node ¶
type Node struct {
Parent *Node
VisibilityBlocks *int
NodeVisible *bool
RootNode *Node
Parsed any
Value any
Index int
Parens bool
ParensInOp bool
TypeIndex int // Index for visitor pattern lookup
// contains filtered or unexported fields
}
Node represents a base node in the Less AST
func GetNodeFromPool ¶
func GetNodeFromPool() *Node
func NewNode ¶
func NewNode() *Node
NewNode creates a new Node instance. OPTIMIZATION: Uses sync.Pool to reuse Node objects and reduce GC pressure. Call ReleaseNode when the Node is no longer needed to return it to the pool.
func (*Node) AddVisibilityBlock ¶
func (n *Node) AddVisibilityBlock()
AddVisibilityBlock increments visibility blocks
func (*Node) BlocksVisibility ¶
BlocksVisibility returns true if the node blocks visibility
func (*Node) ClearVisibilityBlocks ¶
func (n *Node) ClearVisibilityBlocks()
ClearVisibilityBlocks sets visibility blocks to 0
func (*Node) CopyVisibilityInfo ¶
CopyVisibilityInfo copies visibility information from another node
func (*Node) CurrentFileInfo ¶
CurrentFileInfo returns the node's file information (getter equivalent)
func (*Node) EnsureInvisibility ¶
func (n *Node) EnsureInvisibility()
EnsureInvisibility sets node visibility to false
func (*Node) EnsureVisibility ¶
func (n *Node) EnsureVisibility()
EnsureVisibility sets node visibility to true
func (*Node) GenCSSSourceMap ¶
func (n *Node) GenCSSSourceMap(context map[string]any, output *SourceMapOutput)
GenCSSSourceMap implements SourceMapNode interface for Node
func (*Node) GetNode ¶ added in v0.4.0
GetNode returns the Node itself (used for interface compliance in types that embed *Node)
func (*Node) GetTypeIndex ¶
GetTypeIndex returns the node's type index for visitor pattern
func (*Node) IsRulesetLike ¶
IsRulesetLike returns false for base Node
func (*Node) RemoveVisibilityBlock ¶
func (n *Node) RemoveVisibilityBlock()
RemoveVisibilityBlock decrements visibility blocks
func (*Node) SetFileInfo ¶
SetFileInfo sets the node's file information
func (*Node) VisibilityInfo ¶
VisibilityInfo returns the node's visibility information
type NodeJSPluginBridge ¶
type NodeJSPluginBridge struct {
// contains filtered or unexported fields
}
NodeJSPluginBridge bridges the runtime.JSPluginLoader with the less_go.PluginLoader interface. It enables the parsing and evaluation pipeline to use JavaScript plugins loaded via Node.js.
func NewNodeJSPluginBridge ¶
func NewNodeJSPluginBridge() (*NodeJSPluginBridge, error)
NewNodeJSPluginBridge creates a new bridge with a fresh Node.js runtime. This should be called once per compilation to spawn a new Node.js process.
func NewNodeJSPluginBridgeWithRuntime ¶
func NewNodeJSPluginBridgeWithRuntime(rt *runtime.NodeJSRuntime) *NodeJSPluginBridge
NewNodeJSPluginBridgeWithRuntime creates a bridge using an existing runtime. This allows sharing the Node.js process across multiple compilations.
func (*NodeJSPluginBridge) AddFunctionToCurrentScope ¶
func (b *NodeJSPluginBridge) AddFunctionToCurrentScope(name string)
AddFunctionToCurrentScope registers a function name at the current scope depth. This is used when re-registering plugin functions inherited from ancestor frames (e.g., when a mixin defined inside a namespace with @plugin is called). The function must already exist in the Node.js runtime - this just makes it visible at the current scope level in BOTH Go and Node.js.
OPTIMIZATION: Only syncs with Node.js when needsScopeSync is true.
func (*NodeJSPluginBridge) CallFunction ¶
func (b *NodeJSPluginBridge) CallFunction(name string, args ...any) (any, error)
CallFunction calls a JavaScript function by name. Only functions visible in the current scope hierarchy can be called.
func (*NodeJSPluginBridge) CallFunctionWithContext ¶
func (b *NodeJSPluginBridge) CallFunctionWithContext(name string, evalContext runtime.EvalContextProvider, args ...any) (any, error)
CallFunctionWithContext calls a JavaScript function by name with evaluation context. This is used by plugin functions that need to access Less variables. The context provides frames and importantScope for variable lookup.
func (*NodeJSPluginBridge) CheckVariableReplacements ¶
func (b *NodeJSPluginBridge) CheckVariableReplacements(variables []VariableInfo) (map[string]map[string]any, error)
CheckVariableReplacements checks which variables should be replaced by pre-eval visitors. Returns a map of variable ID to replacement info.
func (*NodeJSPluginBridge) Close ¶
func (b *NodeJSPluginBridge) Close() error
Close shuts down the Node.js runtime. This should be called when the compilation is complete.
func (*NodeJSPluginBridge) CreateScopedPluginManager ¶
func (b *NodeJSPluginBridge) CreateScopedPluginManager() *runtime.ScopedPluginManager
CreateScopedPluginManager creates a ScopedPluginManager for the current scope. This provides compatibility with the existing PluginManager interface.
func (*NodeJSPluginBridge) EnterScope ¶
func (b *NodeJSPluginBridge) EnterScope() *runtime.PluginScope
EnterScope creates and enters a new child scope. This is used when entering a ruleset or mixin that might have local plugins.
OPTIMIZATION: Only syncs with Node.js when needsScopeSync is true (i.e., when a local plugin was loaded that needs scoping). For global plugins only, we skip IPC entirely for massive performance improvement (~8x faster).
func (*NodeJSPluginBridge) EvalPlugin ¶
func (b *NodeJSPluginBridge) EvalPlugin(contents string, newEnv *Parse, importManager any, pluginArgs map[string]any, newFileInfo any) any
EvalPlugin evaluates plugin contents directly (inline plugin code). This is used when a plugin's JavaScript code is provided inline rather than as a file path.
func (*NodeJSPluginBridge) ExitScope ¶
func (b *NodeJSPluginBridge) ExitScope() *runtime.PluginScope
ExitScope exits the current scope and returns to the parent. Returns the parent scope, or nil if already at root.
OPTIMIZATION: Only syncs with Node.js when needsScopeSync is true.
func (*NodeJSPluginBridge) GetFunctionRegistry ¶
func (b *NodeJSPluginBridge) GetFunctionRegistry() *runtime.PluginFunctionRegistry
GetFunctionRegistry returns the function registry.
func (*NodeJSPluginBridge) GetLoader ¶
func (b *NodeJSPluginBridge) GetLoader() *runtime.JSPluginLoader
GetLoader returns the underlying plugin loader.
func (*NodeJSPluginBridge) GetPostEvalVisitors ¶
func (b *NodeJSPluginBridge) GetPostEvalVisitors() []*runtime.JSVisitor
GetPostEvalVisitors returns post-evaluation visitors from the current scope.
func (*NodeJSPluginBridge) GetPostProcessors ¶
func (b *NodeJSPluginBridge) GetPostProcessors() []*runtime.JSPostProcessor
GetPostProcessors returns all registered post-processors.
func (*NodeJSPluginBridge) GetPreEvalVisitors ¶
func (b *NodeJSPluginBridge) GetPreEvalVisitors() []*runtime.JSVisitor
GetPreEvalVisitors returns pre-evaluation visitors from the current scope.
func (*NodeJSPluginBridge) GetPreProcessors ¶
func (b *NodeJSPluginBridge) GetPreProcessors() []*runtime.JSPreProcessor
GetPreProcessors returns all registered pre-processors.
func (*NodeJSPluginBridge) GetProcessorManager ¶
func (b *NodeJSPluginBridge) GetProcessorManager() *runtime.ProcessorManager
GetProcessorManager returns the processor manager for pre/post processing.
func (*NodeJSPluginBridge) GetRuntime ¶
func (b *NodeJSPluginBridge) GetRuntime() *runtime.NodeJSRuntime
GetRuntime returns the underlying Node.js runtime.
func (*NodeJSPluginBridge) GetScope ¶
func (b *NodeJSPluginBridge) GetScope() *runtime.PluginScope
GetScope returns the current plugin scope.
func (*NodeJSPluginBridge) GetVisitorManager ¶
func (b *NodeJSPluginBridge) GetVisitorManager() *runtime.VisitorManager
GetVisitorManager returns the visitor manager.
func (*NodeJSPluginBridge) GetVisitors ¶
func (b *NodeJSPluginBridge) GetVisitors() []*runtime.JSVisitor
GetVisitors returns all visitors from the current scope. This is used by transform_tree.go to get plugin visitors.
func (*NodeJSPluginBridge) HasFunction ¶
func (b *NodeJSPluginBridge) HasFunction(name string) bool
HasFunction checks if a function exists in the current scope hierarchy. This respects plugin scoping - local plugins are only visible in their scope.
func (*NodeJSPluginBridge) HasPreEvalVisitors ¶
func (b *NodeJSPluginBridge) HasPreEvalVisitors() bool
HasPreEvalVisitors returns true if there are any pre-eval visitors registered.
func (*NodeJSPluginBridge) InitSHMProtocol ¶
func (b *NodeJSPluginBridge) InitSHMProtocol() error
InitSHMProtocol initializes the high-performance shared memory protocol. This should be called once at the start of compilation for best performance. After initialization, plugin function calls will use binary IPC instead of JSON.
func (*NodeJSPluginBridge) LoadPlugin ¶
func (b *NodeJSPluginBridge) LoadPlugin(path, currentDirectory string, context map[string]any, environment any, fileManager any) any
LoadPlugin loads a plugin asynchronously. For now, this just calls LoadPluginSync since we're in a synchronous Go context.
func (*NodeJSPluginBridge) LoadPluginSync ¶
func (b *NodeJSPluginBridge) LoadPluginSync(path, currentDirectory string, context map[string]any, environment any, fileManager any) any
LoadPluginSync synchronously loads a plugin from the specified path. This wraps the runtime.JSPluginLoader and integrates the results with the scope.
func (*NodeJSPluginBridge) LookupFunction ¶
func (b *NodeJSPluginBridge) LookupFunction(name string) (*runtime.JSFunctionDefinition, bool)
LookupFunction looks up a function by name in the current scope. This is used by the function caller during evaluation.
func (*NodeJSPluginBridge) RunPostProcessors ¶
RunPostProcessors runs all post-processors on the CSS output.
func (*NodeJSPluginBridge) RunPreEvalVisitorsJSON ¶
func (b *NodeJSPluginBridge) RunPreEvalVisitorsJSON(ast map[string]any) (map[string]any, bool, error)
RunPreEvalVisitorsJSON runs pre-eval visitors on a JSON-serialized AST. Returns the modified AST as a map.
func (*NodeJSPluginBridge) RunPreProcessors ¶
RunPreProcessors runs all pre-processors on the input source.
func (*NodeJSPluginBridge) SetScope ¶
func (b *NodeJSPluginBridge) SetScope(scope *runtime.PluginScope)
SetScope sets the current scope directly. This allows restoring a previous scope state.
func (*NodeJSPluginBridge) UseSHMProtocol ¶
func (b *NodeJSPluginBridge) UseSHMProtocol() bool
UseSHMProtocol returns whether the binary SHM protocol is enabled.
type NodePrototype ¶
func (*NodePrototype) GetPrototype ¶
func (np *NodePrototype) GetPrototype() any
func (*NodePrototype) SetTypeIndex ¶
func (np *NodePrototype) SetTypeIndex(index int)
type NodeVisitor ¶
NodeVisitor interface defines the Visit method
type NodeWithOp ¶
type NodeWithOp interface {
GetOp() string
}
NodeWithOp defines types that have an GetOp method.
type NodeWithParens ¶
type NodeWithParens interface {
GetParens() bool
}
NodeWithParens defines types that have a GetParens method.
type NodeWithType ¶
type NodeWithType interface {
GetType() string
}
NodeWithType defines types that have a GetType method.
type NodeWithTypeIndex ¶
type NodeWithTypeIndex interface {
GetTypeIndex() int
}
type NodeWithValue ¶
type NodeWithValue interface {
GetValue() any
}
NodeWithValue represents a node that has a value field (like MixinCall args)
type NumberFunctionWrapper ¶
type NumberFunctionWrapper struct {
// contains filtered or unexported fields
}
NumberFunctionWrapper wraps number functions to implement FunctionDefinition interface
func (*NumberFunctionWrapper) CallCtx ¶
func (w *NumberFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*NumberFunctionWrapper) NeedsEvalArgs ¶
func (w *NumberFunctionWrapper) NeedsEvalArgs() bool
type Operation ¶
Operation represents an operation node in the Less AST
func NewOperation ¶
NewOperation creates a new Operation instance
type Paren ¶
type Paren struct {
*Node
Value any // This will store the node value
NoSpacing bool // If true, no space should be added before this paren in output
}
Paren represents a parenthesized value in the Less AST
func NewParenWithSpacing ¶ added in v0.3.0
NewParenWithSpacing creates a new Paren instance with explicit spacing control
type Parse ¶
type ParseCallbackFunc ¶
type ParseCallbackFunc func(error, any, *ImportManager, map[string]any)
ParseCallbackFunc represents the callback function signature for parse operations
type ParseFunc ¶
type ParseFunc func(string, map[string]any, ParseCallbackFunc) any
ParseFunc represents the parse function signature returned by the factory
func CreateParse ¶
func CreateParse(environment any, parseTree any, importManagerFactory func(any, *Parse, map[string]any) *ImportManager) ParseFunc
CreateParse creates a parse function with the given dependencies This mirrors the JavaScript export default function(environment, ParseTree, ImportManager)
type ParseNodeCallback ¶
type ParseNodeCallback func(*ParseNodeResult)
ParseNodeCallback is the callback function for parseNode
type ParseNodeResult ¶
type ParseNodeResult struct {
Error any // Can be error or boolean true
Nodes []any // Parsed nodes
}
ParseNodeResult represents the result of a parseNode operation
type ParsePromise ¶
type ParsePromise struct {
// contains filtered or unexported fields
}
ParsePromise represents a basic promise-like structure
func (*ParsePromise) Await ¶
func (p *ParsePromise) Await() (any, error)
Await waits for the promise to complete and returns result and error
func (*ParsePromise) Then ¶
func (p *ParsePromise) Then(onSuccess func(any), onError func(error))
Then provides promise-like then functionality
type ParseResult ¶
ParseResult represents the result of a parse operation
type ParseTree ¶
type ParseTree struct {
Root any
Imports *ImportManager
// contains filtered or unexported fields
}
ParseTree represents a Less parse tree that can be converted to CSS
func (*ParseTree) Release ¶ added in v0.4.0
func (pt *ParseTree) Release()
Release releases all AST nodes in the parse tree back to their pools. Call this method when you're completely done with the parse tree and won't use it again. This helps reduce memory allocations for subsequent compilations. Note: After calling Release, the ParseTree should not be used again.
func (*ParseTree) ToCSS ¶
func (pt *ParseTree) ToCSS(options *ToCSSOptions) (*ToCSSResult, error)
ToCSS converts the parse tree to CSS
type ParseTreeClass ¶
type ParseTreeClass struct {
SourceMapBuilder any
}
ParseTreeClass represents the ParseTree class constructor
func DefaultParseTreeFactory ¶
func DefaultParseTreeFactory(sourceMapBuilder any) *ParseTreeClass
DefaultParseTreeFactory creates a default ParseTree factory
func (*ParseTreeClass) NewParseTree ¶
func (ptc *ParseTreeClass) NewParseTree(root any, imports *ImportManager) *ParseTree
NewParseTree creates a new ParseTree instance
type ParseTreeFactory ¶
type ParseTreeFactory func(sourceMapBuilder any) *ParseTreeClass
ParseTreeFactory represents the factory function type that creates ParseTree classes
func NewParseTreeFactory ¶
func NewParseTreeFactory(sourceMapBuilder any) ParseTreeFactory
NewParseTreeFactory creates a factory function for ParseTree
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a Less parser instance
func NewParser ¶
func NewParser(context map[string]any, imports map[string]any, fileInfo map[string]any, currentIndex int) *Parser
NewParser creates a new Parser instance
func (*Parser) CreateSelectorParseFunc ¶
func (p *Parser) CreateSelectorParseFunc() SelectorParseFunc
CreateSelectorParseFunc creates a SelectorParseFunc that can be used by selector nodes
func (*Parser) CreateSelectorsParseFunc ¶
func (p *Parser) CreateSelectorsParseFunc() SelectorsParseFunc
CreateSelectorsParseFunc creates a SelectorsParseFunc that can be used by ruleset nodes
func (*Parser) CreateValueParseFunc ¶
func (p *Parser) CreateValueParseFunc() ValueParseFunc
CreateValueParseFunc creates a ValueParseFunc that can be used by ruleset nodes
type ParserEvaluable ¶
type ParserFrame ¶
ParserFrame represents a scope frame that can look up variables and properties
type ParserFunctionCaller ¶
type ParserInput ¶
type ParserInput struct {
// contains filtered or unexported fields
}
ParserInput represents the parser input state
func NewParserInput ¶
func NewParserInput() *ParserInput
NewParserInput creates a new ParserInput instance
func (*ParserInput) Char ¶
func (p *ParserInput) Char(tok byte) any
func (*ParserInput) CommentsReset ¶
func (p *ParserInput) CommentsReset()
CommentsReset clears the comment store (equivalent to commentStore.length = 0 in JS)
func (*ParserInput) ConsumeComment ¶
func (p *ParserInput) ConsumeComment() *inputComment
ConsumeComment removes and returns the first comment from the store
func (*ParserInput) CurrentChar ¶
func (p *ParserInput) CurrentChar() byte
func (*ParserInput) End ¶
func (p *ParserInput) End() EndState
func (*ParserInput) Finished ¶
func (p *ParserInput) Finished() bool
Finished returns whether parsing has finished
func (*ParserInput) Forget ¶
func (p *ParserInput) Forget()
func (*ParserInput) GetAutoCommentAbsorb ¶
func (p *ParserInput) GetAutoCommentAbsorb() bool
GetAutoCommentAbsorb returns the current autoCommentAbsorb setting
func (*ParserInput) GetComments ¶
func (p *ParserInput) GetComments() []inputComment
GetComments returns the stored comments
func (*ParserInput) GetIndex ¶
func (p *ParserInput) GetIndex() int
func (*ParserInput) GetInput ¶
func (p *ParserInput) GetInput() string
func (*ParserInput) IsWhitespace ¶
func (p *ParserInput) IsWhitespace(offset int) bool
func (*ParserInput) ParseUntil ¶
func (p *ParserInput) ParseUntil(tok any) any
func (*ParserInput) Peek ¶
func (p *ParserInput) Peek(tok any) bool
func (*ParserInput) PeekChar ¶
func (p *ParserInput) PeekChar(tok byte) any
func (*ParserInput) PeekNotNumeric ¶
func (p *ParserInput) PeekNotNumeric() bool
func (*ParserInput) PrevChar ¶
func (p *ParserInput) PrevChar() byte
func (*ParserInput) Quoted ¶
func (p *ParserInput) Quoted(loc int) any
func (*ParserInput) Remaining ¶ added in v0.4.0
func (p *ParserInput) Remaining() string
Remaining returns the remaining unparsed input
func (*ParserInput) Restore ¶
func (p *ParserInput) Restore(possibleErrorMessage string)
func (*ParserInput) Save ¶
func (p *ParserInput) Save()
func (*ParserInput) SetAutoCommentAbsorb ¶
func (p *ParserInput) SetAutoCommentAbsorb(value bool)
SetAutoCommentAbsorb sets the autoCommentAbsorb setting
func (*ParserInput) SetIndex ¶
func (p *ParserInput) SetIndex(index int)
SetIndex sets the current index position
func (*ParserInput) Start ¶
func (p *ParserInput) Start(str string, chunkInput bool, failFunction func(string, int))
func (*ParserInput) Str ¶
func (p *ParserInput) Str(tok string) any
type ParserInterface ¶
type ParserInterface interface {
Parse(str string, callback func(*LessError, *Ruleset), additionalData *AdditionalData)
}
type ParserLogger ¶
type ParserLogger interface {
Warn(msg string)
Error(msg string)
Info(msg string)
Debug(msg string)
}
ParserLogger interface for parser logging functionality
type ParserTracer ¶
type ParserTracer struct {
// contains filtered or unexported fields
}
ParserTracer provides runtime debugging and execution tracing for the parser
func GetParserTracer ¶
func GetParserTracer() *ParserTracer
GetParserTracer returns the global tracer instance
func InitParserTracer ¶
func InitParserTracer() *ParserTracer
InitParserTracer initializes the global parser tracer based on environment variables
func (*ParserTracer) GetCallStackString ¶
func (t *ParserTracer) GetCallStackString() string
GetCallStackString returns the current call stack as a string
func (*ParserTracer) IsEnabled ¶
func (t *ParserTracer) IsEnabled() bool
IsEnabled returns whether tracing is enabled
func (*ParserTracer) ShouldTrace ¶
func (t *ParserTracer) ShouldTrace(funcName string) bool
ShouldTrace returns whether a specific function should be traced
func (*ParserTracer) TraceCallStackAt ¶
func (t *ParserTracer) TraceCallStackAt(label string, p *Parser)
TraceCallStackAt logs the call stack at a specific point Use this when you encounter unexpected behavior
func (*ParserTracer) TraceChar ¶
func (t *ParserTracer) TraceChar(funcName string, char byte, matched bool)
TraceChar logs a character match attempt
func (*ParserTracer) TraceCheckpoint ¶
func (t *ParserTracer) TraceCheckpoint(checkpointName string, p *Parser)
TraceCheckpoint logs a checkpoint with the current call stack Use this after successfully parsing major constructs
func (*ParserTracer) TraceEnter ¶
func (t *ParserTracer) TraceEnter(funcName string, p *Parser) func()
TraceEnter logs function entry and returns a cleanup function Usage: defer tracer.TraceEnter("FunctionName", parser)()
func (*ParserTracer) TraceError ¶
func (t *ParserTracer) TraceError(funcName string, errMsg string, p *Parser)
TraceError logs a parser error with stack trace
func (*ParserTracer) TraceMode ¶
func (t *ParserTracer) TraceMode(modeName string, details string, p *Parser)
TraceMode logs parser mode/state information
func (*ParserTracer) TraceRegex ¶
func (t *ParserTracer) TraceRegex(funcName string, pattern string, matched bool, result any)
TraceRegex logs a regex match attempt
func (*ParserTracer) TraceResult ¶
func (t *ParserTracer) TraceResult(funcName string, result any, msg string)
TraceResult logs a parse result (success or nil)
func (*ParserTracer) TraceSaveRestore ¶
func (t *ParserTracer) TraceSaveRestore(operation string, funcName string, p *Parser)
TraceSaveRestore logs parser state operations
type Parsers ¶
type Parsers struct {
// contains filtered or unexported fields
}
Parsers contains all the parsing methods
func NewParsers ¶
NewParsers creates a new Parsers instance
func (*Parsers) AnonymousValue ¶
AnonymousValue parses anonymous values for performance
func (*Parsers) AtomicCondition ¶
AtomicCondition parses atomic conditions
func (*Parsers) BlockRuleset ¶
BlockRuleset parses a block and wraps it in a ruleset
func (*Parsers) ColorOperand ¶ added in v0.3.1
ColorOperand parses color channel identifiers (l, c, h, r, g, b, s) Used for CSS relative color syntax like oklch(from #0000FF calc(l - 0.1) c h)
func (*Parsers) Combinator ¶
func (p *Parsers) Combinator() *Combinator
Combinator parses selector combinators
func (*Parsers) ConditionAnd ¶
ConditionAnd parses AND conditions
func (*Parsers) Declaration ¶
Declaration parses property declarations
func (*Parsers) DetachedRuleset ¶
DetachedRuleset parses detached rulesets
func (*Parsers) ImportOptions ¶
ImportOptions parses import options
func (*Parsers) MediaFeature ¶
MediaFeature parses media features
func (*Parsers) MediaFeatures ¶
MediaFeatures parses media features
func (*Parsers) Multiplication ¶
Multiplication parses multiplication and division operations
func (*Parsers) NegatedCondition ¶
NegatedCondition parses negated conditions
func (*Parsers) NestableAtRule ¶
NestableAtRule parses nestable at-rules like @media
func (*Parsers) ParenthesisCondition ¶
ParenthesisCondition parses conditions in parentheses
func (*Parsers) PermissiveValue ¶
PermissiveValue parses permissive values
func (*Parsers) PluginArgs ¶
PluginArgs parses plugin arguments
func (*Parsers) PrepareAndGetNestableAtRule ¶
func (p *Parsers) PrepareAndGetNestableAtRule(atRuleType string, index int, debugInfo map[string]any) any
PrepareAndGetNestableAtRule handles @media, @container rules
func (*Parsers) RuleProperty ¶
RuleProperty parses rule properties
func (*Parsers) Sub ¶
Sub parses parenthetical expressions Matches Less.js behavior: parses (addition) only, no multi-entity fallback
func (*Parsers) VariableCall ¶
VariableCall parses variable calls parsedName: if provided, indicates we're parsing in a value context (inValue=true)
type Plugin ¶
type Plugin interface {
Install(less LessInterface, pluginManager *PluginManager, functionRegistry any) error
}
Plugin interface represents the minimal interface a plugin must implement
type PluginCallCollector ¶
type PluginCallCollector struct {
// contains filtered or unexported fields
}
PluginCallCollector walks the AST and collects all Call nodes that reference JavaScript plugin functions.
func NewPluginCallCollector ¶
func NewPluginCallCollector(pluginFunctionNames []string) *PluginCallCollector
NewPluginCallCollector creates a new collector with the given plugin function names.
func (*PluginCallCollector) Collect ¶
func (c *PluginCallCollector) Collect(root any) []*PluginCallInfo
Collect walks the AST starting from root and collects all plugin function calls.
type PluginCallInfo ¶
type PluginCallInfo struct {
// FunctionName is the name of the plugin function being called
FunctionName string
// Args are the arguments to the function (not yet evaluated)
Args []any
// CacheKey is the pre-computed cache key for this call
CacheKey string
}
PluginCallInfo represents information about a plugin function call collected during AST traversal for cache pre-warming.
type PluginFunctionCaller ¶
type PluginFunctionCaller struct {
// contains filtered or unexported fields
}
func (*PluginFunctionCaller) IsValid ¶
func (c *PluginFunctionCaller) IsValid() bool
type PluginFunctionProvider ¶
type PluginLoader ¶
type PluginLoader interface {
EvalPlugin(contents string, newEnv *Parse, importManager any, pluginArgs map[string]any, newFileInfo any) any
LoadPluginSync(path, currentDirectory string, context map[string]any, environment any, fileManager any) any
LoadPlugin(path, currentDirectory string, context map[string]any, environment any, fileManager any) any
}
PluginLoader interface represents the minimal interface needed for plugin loading
type PluginLoaderFactory ¶
type PluginLoaderFactory func(less LessInterface) PluginLoader
PluginLoaderFactory represents a factory function for creating PluginLoader instances
func LazyPluginLoaderFactory ¶
func LazyPluginLoaderFactory(bridge *LazyNodeJSPluginBridge) PluginLoaderFactory
func NodeJSPluginLoaderFactory ¶
func NodeJSPluginLoaderFactory(runtime *runtime.NodeJSRuntime) PluginLoaderFactory
NodeJSPluginLoaderFactory creates a PluginLoaderFactory that returns NodeJSPluginBridge. This can be passed to LessContext to enable JavaScript plugin support.
type PluginManager ¶
type PluginManager struct {
Loader PluginLoader
// contains filtered or unexported fields
}
PluginManager manages plugins for the Less system
func NewPluginManager ¶
func NewPluginManager(less LessInterface) *PluginManager
NewPluginManager creates a new PluginManager instance
func PluginManagerFactory ¶
func PluginManagerFactory(less LessInterface, newFactory bool) *PluginManager
PluginManagerFactory creates or returns the global PluginManager instance
func (*PluginManager) AddFileManager ¶
func (pm *PluginManager) AddFileManager(manager any)
AddFileManager adds a file manager
func (*PluginManager) AddPlugin ¶
func (pm *PluginManager) AddPlugin(plugin any, filename string, functionRegistry any)
AddPlugin adds a single plugin
func (*PluginManager) AddPlugins ¶
func (pm *PluginManager) AddPlugins(plugins []any)
AddPlugins adds all the plugins in the slice
func (*PluginManager) AddPostProcessor ¶
func (pm *PluginManager) AddPostProcessor(postProcessor any, priority int)
AddPostProcessor adds a post processor object with priority
func (*PluginManager) AddPreProcessor ¶
func (pm *PluginManager) AddPreProcessor(preProcessor any, priority int)
AddPreProcessor adds a pre processor object with priority
func (*PluginManager) AddVisitor ¶
func (pm *PluginManager) AddVisitor(visitor any)
AddVisitor adds a visitor
func (*PluginManager) Get ¶
func (pm *PluginManager) Get(filename string) any
Get retrieves a cached plugin by filename
func (*PluginManager) GetFileManagers ¶
func (pm *PluginManager) GetFileManagers() []any
GetFileManagers returns the file managers array
func (*PluginManager) GetFunctions ¶
func (pm *PluginManager) GetFunctions() any
GetFunctions returns the functions registry
func (*PluginManager) GetPostProcessors ¶
func (pm *PluginManager) GetPostProcessors() []any
GetPostProcessors returns the array of post processors only
func (*PluginManager) GetPreProcessors ¶
func (pm *PluginManager) GetPreProcessors() []any
GetPreProcessors returns the array of pre processors only
func (*PluginManager) GetVisitors ¶
func (pm *PluginManager) GetVisitors() []any
GetVisitors returns the visitors array
func (*PluginManager) Visitor ¶
func (pm *PluginManager) Visitor() *VisitorIterator
Visitor returns a visitor iterator
type PluginSpec ¶ added in v0.1.5
type PluginSpec struct {
// Name is the plugin name or path
// Can be: relative path, absolute path, or npm module name
// NPM modules are resolved with "less-plugin-" prefix first
Name string
// Options is an optional string of options to pass to the plugin
// Passed to the plugin's setOptions() method
Options string
}
PluginSpec specifies a plugin to load before compilation
type PotentialMatch ¶
type PotentialMatch struct {
// contains filtered or unexported fields
}
PotentialMatch represents a potential match during extend processing. This struct replaces map[string]any to reduce allocations.
func (*PotentialMatch) Reset ¶
func (pm *PotentialMatch) Reset()
Reset resets a PotentialMatch for reuse from the pool
type ProcessExtendsVisitor ¶
type ProcessExtendsVisitor struct {
// contains filtered or unexported fields
}
func GetProcessExtendsVisitor ¶
func GetProcessExtendsVisitor() *ProcessExtendsVisitor
GetProcessExtendsVisitor retrieves a ProcessExtendsVisitor from the pool
func NewExtendVisitor ¶
func NewExtendVisitor() *ProcessExtendsVisitor
NewExtendVisitor creates a new extend visitor (alias for NewProcessExtendsVisitor)
func NewProcessExtendsVisitor ¶
func NewProcessExtendsVisitor() *ProcessExtendsVisitor
func (*ProcessExtendsVisitor) IsReplacing ¶
func (pev *ProcessExtendsVisitor) IsReplacing() bool
IsReplacing returns true as ProcessExtendsVisitor is a replacing visitor
func (*ProcessExtendsVisitor) Reset ¶
func (pev *ProcessExtendsVisitor) Reset()
Reset resets the ProcessExtendsVisitor for reuse from the pool. The visitor's methodLookup map is preserved (it's expensive to rebuild).
func (*ProcessExtendsVisitor) Run ¶
func (pev *ProcessExtendsVisitor) Run(root any) any
func (*ProcessExtendsVisitor) VisitAtRule ¶
func (pev *ProcessExtendsVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs)
func (*ProcessExtendsVisitor) VisitAtRuleOut ¶
func (pev *ProcessExtendsVisitor) VisitAtRuleOut(atRuleNode any)
func (*ProcessExtendsVisitor) VisitDeclaration ¶
func (pev *ProcessExtendsVisitor) VisitDeclaration(ruleNode any, visitArgs *VisitArgs)
func (*ProcessExtendsVisitor) VisitMedia ¶
func (pev *ProcessExtendsVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs)
func (*ProcessExtendsVisitor) VisitMediaOut ¶
func (pev *ProcessExtendsVisitor) VisitMediaOut(mediaNode any)
func (*ProcessExtendsVisitor) VisitMixinDefinition ¶
func (pev *ProcessExtendsVisitor) VisitMixinDefinition(mixinDefinitionNode any, visitArgs *VisitArgs)
func (*ProcessExtendsVisitor) VisitNode ¶
func (pev *ProcessExtendsVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
VisitNode implements direct dispatch without reflection for better performance
func (*ProcessExtendsVisitor) VisitNodeOut ¶
func (pev *ProcessExtendsVisitor) VisitNodeOut(node any) bool
VisitNodeOut implements direct dispatch for visitOut methods
func (*ProcessExtendsVisitor) VisitRuleset ¶
func (pev *ProcessExtendsVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs)
func (*ProcessExtendsVisitor) VisitSelector ¶
func (pev *ProcessExtendsVisitor) VisitSelector(selectorNode any, visitArgs *VisitArgs)
type ProcessorEntry ¶
ProcessorEntry represents a processor with its priority
type Promise ¶
type Promise interface {
Then(onSuccess func(*LoadedFile), onError func(error))
}
type PromiseResult ¶
type PromiseResult struct {
File *LoadedFile
Error error
}
type Property ¶
type Property struct {
*Node
// contains filtered or unexported fields
}
Property represents a property node in the Less AST
func NewProperty ¶
NewProperty creates a new Property instance
type QueryInParens ¶
type QueryInParens struct {
*Node
// contains filtered or unexported fields
}
QueryInParens represents a query in parentheses node in the Less AST
func NewQueryInParens ¶
NewQueryInParens creates a new QueryInParens instance
func (*QueryInParens) Accept ¶
func (q *QueryInParens) Accept(visitor any)
Accept visits the node with a visitor
func (*QueryInParens) Eval ¶
func (q *QueryInParens) Eval(context any) (any, error)
Eval evaluates the query IMPORTANT: This method returns a NEW QueryInParens instance with evaluated values rather than mutating the original. This is critical for mixin expansion where the same QueryInParens node may be evaluated multiple times with different contexts.
func (*QueryInParens) GenCSS ¶
func (q *QueryInParens) GenCSS(context any, output *CSSOutput)
GenCSS generates CSS representation
func (*QueryInParens) GetType ¶
func (q *QueryInParens) GetType() string
GetType returns the type of the node
func (*QueryInParens) Type ¶
func (q *QueryInParens) Type() string
Type returns the type of the node
type Quoted ¶
type Quoted struct {
*Node
// contains filtered or unexported fields
}
Quoted represents a quoted string in the Less AST
func NewQuoted ¶
func NewQuoted(str string, content string, escaped bool, index int, currentFileInfo map[string]any) *Quoted
NewQuoted creates a new Quoted instance
func (*Quoted) ContainsVariables ¶
ContainsVariables checks if the quoted string contains variable interpolations
func (*Quoted) GetEscaped ¶
GetEscaped returns whether the quoted string is escaped
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) AddMultiple ¶
func (*Registry) GetLocalFunctions ¶
type RegistryAdapter ¶
type RegistryAdapter struct {
// contains filtered or unexported fields
}
func (*RegistryAdapter) Get ¶
func (r *RegistryAdapter) Get(name string) FunctionDefinition
type RegistryFunctionAdapter ¶
type RegistryFunctionAdapter struct {
// contains filtered or unexported fields
}
func NewRegistryFunctionAdapter ¶
func NewRegistryFunctionAdapter(registry *Registry) *RegistryFunctionAdapter
func (*RegistryFunctionAdapter) Get ¶
func (r *RegistryFunctionAdapter) Get(name string) FunctionDefinition
type Releasable ¶ added in v0.4.0
type Releasable interface {
Release()
}
Releasable is an interface for nodes that can be released back to pools
type RenderContext ¶
type RenderContext struct {
// contains filtered or unexported fields
}
RenderContext represents the bound context for render function
type RenderPromise ¶
type RenderPromise struct {
// contains filtered or unexported fields
}
RenderPromise represents a Promise-like interface that matches JavaScript Promise behavior Unlike the previous implementation, this is synchronous (deferred) like JavaScript, not async
func (*RenderPromise) Await ¶
func (rp *RenderPromise) Await() (any, error)
Await blocks until the promise resolves or rejects (Go-specific helper)
func (*RenderPromise) Catch ¶
func (rp *RenderPromise) Catch(onReject func(error) error) *RenderPromise
Catch simulates JavaScript Promise.catch() behavior
func (*RenderPromise) Then ¶
func (rp *RenderPromise) Then(onResolve func(any) any, onReject func(error) error) *RenderPromise
Then simulates JavaScript Promise.then() behavior
type RewriteUrlsType ¶
type RewriteUrlsType int
const ( RewriteUrlsOff RewriteUrlsType = iota RewriteUrlsLocal RewriteUrlsAll )
type Ruleset ¶
type Ruleset struct {
*Node
Selectors []any
Rules []any
StrictImports bool
AllowRoot bool
// NOTE: rulesets and variableCache were removed - caching these caused stale data
// issues when Rules are modified during evaluation (mixin expansion, visitors, etc.)
// Original ruleset reference for eval
OriginalRuleset *Ruleset
Root bool
// Extend support
ExtendOnEveryPath bool
Paths [][]any
FirstRoot bool
AllowImports bool
AllExtends []*Extend // For storing extends found by ExtendFinderVisitor
FunctionRegistry any // Changed from *functions.Registry to avoid import cycle
// Parser functions for handling dynamic content
SelectorsParseFunc SelectorsParseFunc
ValueParseFunc ValueParseFunc
ParseContext map[string]any
ParseImports map[string]any
// Parse object matching JavaScript structure
Parse map[string]any // Contains context and importManager
// Debug info
DebugInfo any
// Multi-media flag for nested media queries
MultiMedia bool
// InsideMixinDefinition marks rulesets that are nested inside mixin definitions
// These should not be output directly, only when the mixin is called
InsideMixinDefinition bool
// LoadedPluginFunctions stores function names loaded via @plugin in this ruleset's scope
// This is used for function lookup when this ruleset is in the frames of a mixin call
LoadedPluginFunctions map[string]bool
// contains filtered or unexported fields
}
Ruleset represents a ruleset node in the Less AST
func GetRulesetFromPool ¶
func GetRulesetFromPool() *Ruleset
func NewRuleset ¶
func NewRuleset(selectors []any, rules []any, strictImports bool, visibilityInfo map[string]any, parseFuncs ...any) *Ruleset
OPTIMIZATION: Uses sync.Pool to reuse Ruleset objects and reduce GC pressure. Call Release() when the Ruleset is no longer needed to return it to the pool.
func (*Ruleset) EvalImports ¶
EvalImports evaluates import rules like JavaScript version
func (*Ruleset) GenCSSSourceMap ¶ added in v0.1.4
func (r *Ruleset) GenCSSSourceMap(context map[string]any, output *SourceMapOutput)
GenCSSSourceMap generates CSS with source map information This implements the SourceMapNode interface for source map generation
func (*Ruleset) GetAllExtends ¶
Used by ProcessExtendsVisitor
func (*Ruleset) GetAllowImports ¶
func (*Ruleset) GetFirstRoot ¶
func (*Ruleset) GetSelectors ¶
func (*Ruleset) GetTypeIndex ¶
func (*Ruleset) HasProperties ¶
Matches JavaScript rules.properties
func (*Ruleset) HasVariable ¶
func (*Ruleset) HasVariables ¶
Matches JavaScript rules.variables
func (*Ruleset) IsRulesetLike ¶
func (*Ruleset) JoinSelector ¶
JoinSelector joins a single selector with the current context This is a complex method that implements the JavaScript selector joining logic
func (*Ruleset) JoinSelectors ¶
func (*Ruleset) LastDeclaration ¶
func (*Ruleset) MakeImportant ¶
func (*Ruleset) ParseValue ¶
func (*Ruleset) PrependRule ¶
func (*Ruleset) Properties ¶
func (*Ruleset) ResetCache ¶
func (r *Ruleset) ResetCache()
func (*Ruleset) SetAllExtends ¶
Used by ExtendFinderVisitor
func (*Ruleset) SetSelectors ¶
Required by JoinSelectorVisitor
func (*Ruleset) ToCSSString ¶
ToCSSString converts the ruleset to CSS output (Node interface version)
type SafeIndexError ¶
SafeIndexError represents an error when accessing an invalid index
func (*SafeIndexError) Error ¶
func (e *SafeIndexError) Error() string
type Selector ¶
type Selector struct {
*Node
Elements []*Element
ExtendList []any // Placeholder for actual type e.g., []*Extend
Condition any // Placeholder for actual type e.g., ConditionNode
EvaldCondition bool
MixinElements_ []string // Cached result of MixinElements()
MediaEmpty bool
ParseFunc SelectorParseFunc // Function for parsing selector strings
ParseContext map[string]any // Context for parser
ParseImports map[string]any // Imports for parser
}
Selector represents a CSS selector.
func GetSelectorFromPool ¶
func GetSelectorFromPool() *Selector
func NewSelector ¶
func NewSelector(elementsInput any, extendList []any, condition any, index int, currentFileInfo map[string]any, visibilityInfo map[string]any, parseFunc ...any) (*Selector, error)
NewSelector creates a new Selector instance. elementsInput can be []*Element, *Element, or string. For backward compatibility, parseFunc, parseContext, and parseImports are optional. OPTIMIZATION: Uses sync.Pool to reuse Selector objects and reduce GC pressure. Call Release() when the Selector is no longer needed to return it to the pool.
func (*Selector) CreateDerived ¶
func (s *Selector) CreateDerived(elementsInput any, extendList []any, evaldCondition any) (*Selector, error)
CreateDerived creates a new selector derived from the current one. evaldCondition is the evaluated condition node (not a boolean).
func (*Selector) CreateEmptySelectors ¶
CreateEmptySelectors creates a default empty selector.
func (*Selector) GetExtendList ¶
GetExtendList returns the ExtendList of the selector
func (*Selector) GetIsOutput ¶
GetIsOutput determines if the selector should be part of the output.
func (*Selector) IsJustParentSelector ¶
IsJustParentSelector checks if the selector is solely a parent reference (&).
func (*Selector) MixinElements ¶
MixinElements gets the string parts of the selector for mixin matching.
func (*Selector) SetExtendList ¶
SetExtendList sets the extend list for this selector
type SelectorList ¶
type SelectorList struct {
*Node
Selectors []any // Contains Selector nodes and Anonymous nodes (for commas)
}
SelectorList represents a list of selectors separated by commas This is used for parenthesized selector lists like :is(.a, .b, .c) where the list contains Selector nodes and Anonymous comma nodes
func NewSelectorList ¶
func NewSelectorList(selectors []any) *SelectorList
NewSelectorList creates a new SelectorList instance
func (*SelectorList) Eval ¶
func (sl *SelectorList) Eval(context any) any
Eval evaluates the selector list and returns a new list with evaluated selectors
func (*SelectorList) GenCSS ¶
func (sl *SelectorList) GenCSS(context any, output *CSSOutput)
GenCSS generates CSS representation
func (*SelectorList) GetType ¶
func (sl *SelectorList) GetType() string
GetType returns the type of the node for visitor pattern consistency
func (*SelectorList) ToCSS ¶
func (sl *SelectorList) ToCSS(context any) string
ToCSS generates a CSS string representation
type SelectorParseFunc ¶
type SelectorParseFunc func(input string, context map[string]any, imports map[string]any, fileInfo map[string]any, index int) ([]*Element, error)
SelectorParseFunc is a function type for parsing selector strings This allows dependency injection of parser functionality without circular imports
type SelectorsParseFunc ¶
type SelectorsParseFunc func(input string, context map[string]any, imports map[string]any, fileInfo map[string]any, index int) ([]any, error)
SelectorsParseFunc is a function type for parsing selector strings into selectors
type SetTreeVisibilityVisitor ¶
type SetTreeVisibilityVisitor struct {
// contains filtered or unexported fields
}
SetTreeVisibilityVisitor implements the visitor pattern to set tree visibility
func GetSetTreeVisibilityVisitor ¶
func GetSetTreeVisibilityVisitor(visible any) *SetTreeVisibilityVisitor
GetSetTreeVisibilityVisitor retrieves a SetTreeVisibilityVisitor from the pool
func NewSetTreeVisibilityVisitor ¶
func NewSetTreeVisibilityVisitor(visible any) *SetTreeVisibilityVisitor
NewSetTreeVisibilityVisitor creates a new SetTreeVisibilityVisitor instance
func (*SetTreeVisibilityVisitor) Reset ¶
func (v *SetTreeVisibilityVisitor) Reset(visible any)
Reset resets the SetTreeVisibilityVisitor for reuse from the pool.
func (*SetTreeVisibilityVisitor) Run ¶
func (v *SetTreeVisibilityVisitor) Run(root any)
Run starts the visitor on the root node
func (*SetTreeVisibilityVisitor) Visit ¶
func (v *SetTreeVisibilityVisitor) Visit(node any) any
Visit visits a single node using type assertions for fast dispatch
func (*SetTreeVisibilityVisitor) VisitArray ¶
func (v *SetTreeVisibilityVisitor) VisitArray(nodes []any) []any
VisitArray visits an array of nodes using type assertions. This method matches the interface expected by Ruleset.Accept: VisitArray([]any) []any
type SimpleFileManager ¶
type SimpleFileManager struct {
*AbstractFileManager
}
func NewSimpleFileManager ¶
func NewSimpleFileManager() *SimpleFileManager
func (*SimpleFileManager) AlwaysMakePathsAbsolute ¶
func (s *SimpleFileManager) AlwaysMakePathsAbsolute() bool
func (*SimpleFileManager) GetPath ¶
func (s *SimpleFileManager) GetPath(filename string) string
func (*SimpleFileManager) IsPathAbsolute ¶
func (s *SimpleFileManager) IsPathAbsolute(path string) bool
func (*SimpleFileManager) Join ¶
func (s *SimpleFileManager) Join(path1, path2 string) string
func (*SimpleFileManager) LoadFile ¶
func (s *SimpleFileManager) LoadFile(path, currentDirectory string, context map[string]any, environment ImportManagerEnvironment, callback func(error, *LoadedFile)) any
func (*SimpleFileManager) LoadFileSync ¶
func (s *SimpleFileManager) LoadFileSync(path, currentDirectory string, context map[string]any, environment ImportManagerEnvironment) *LoadedFile
type SimpleFunctionDef ¶
type SimpleFunctionDef struct {
// contains filtered or unexported fields
}
func (*SimpleFunctionDef) CallCtx ¶
func (s *SimpleFunctionDef) CallCtx(ctx *Context, args ...any) (any, error)
func (*SimpleFunctionDef) NeedsEvalArgs ¶
func (s *SimpleFunctionDef) NeedsEvalArgs() bool
type SimpleImportManagerEnvironment ¶
type SimpleImportManagerEnvironment struct{}
func (*SimpleImportManagerEnvironment) GetFileManager ¶
func (s *SimpleImportManagerEnvironment) GetFileManager(path, currentDirectory string, context map[string]any, environment ImportManagerEnvironment) FileManager
type SourceMapBuilder ¶
type SourceMapBuilder struct {
// contains filtered or unexported fields
}
func NewSourceMapBuilder ¶
func NewSourceMapBuilder(options SourceMapBuilderOptions) *SourceMapBuilder
func (*SourceMapBuilder) GetExternalSourceMap ¶
func (smb *SourceMapBuilder) GetExternalSourceMap() string
func (*SourceMapBuilder) GetInputFilename ¶
func (smb *SourceMapBuilder) GetInputFilename() string
func (*SourceMapBuilder) GetOutputFilename ¶
func (smb *SourceMapBuilder) GetOutputFilename() string
func (*SourceMapBuilder) GetSourceMapURL ¶
func (smb *SourceMapBuilder) GetSourceMapURL() string
func (*SourceMapBuilder) IsInline ¶
func (smb *SourceMapBuilder) IsInline() bool
func (*SourceMapBuilder) SetExternalSourceMap ¶
func (smb *SourceMapBuilder) SetExternalSourceMap(sourceMap string)
func (*SourceMapBuilder) ToCSS ¶
func (smb *SourceMapBuilder) ToCSS(rootNode SourceMapNode, options map[string]any, imports *Imports, environment SourceMapEnvironment) string
type SourceMapBuilderOptions ¶
type SourceMapEnvironment ¶
type SourceMapGenerator ¶
type SourceMapGenerator interface {
AddMapping(mapping SourceMapMapping)
SetSourceContent(source, content string)
ToJSON() map[string]any
}
type SourceMapMapping ¶
type SourceMapMapping struct {
Generated SourceMapPosition `json:"generated"`
Original SourceMapPosition `json:"original"`
Source string `json:"source"`
}
type SourceMapNode ¶
type SourceMapNode interface {
GenCSSSourceMap(context map[string]any, output *SourceMapOutput)
}
type SourceMapOptions ¶ added in v0.1.4
type SourceMapOptions struct {
// SourceMapFilename is the name of the source map file
SourceMapFilename string
// SourceMapURL overrides the source map URL in the CSS output
SourceMapURL string
// SourceMapBasepath is the base path to remove from source paths
SourceMapBasepath string
// SourceMapRootpath is the root path to prepend to source paths
SourceMapRootpath string
// SourceMapOutputFilename is the output filename for path calculation
SourceMapOutputFilename string
// OutputSourceFiles embeds the source content in the source map
OutputSourceFiles bool
// SourceMapFileInline embeds the source map as a data URI in the CSS
SourceMapFileInline bool
// DisableSourcemapAnnotation disables adding the sourceMappingURL comment
DisableSourcemapAnnotation bool
}
SourceMapOptions contains source map generation settings
type SourceMapOutput ¶
type SourceMapOutput struct {
SourceMap string
// contains filtered or unexported fields
}
func NewSourceMapOutput ¶
func NewSourceMapOutput(options SourceMapOutputOptions) *SourceMapOutput
func (*SourceMapOutput) Add ¶
func (smo *SourceMapOutput) Add(chunk string, fileInfo *FileInfo, index int, mapLines bool)
func (*SourceMapOutput) IsEmpty ¶
func (smo *SourceMapOutput) IsEmpty() bool
func (*SourceMapOutput) NormalizeFilename ¶
func (smo *SourceMapOutput) NormalizeFilename(filename string) string
func (*SourceMapOutput) RemoveBasepath ¶
func (smo *SourceMapOutput) RemoveBasepath(path string) string
type SourceMapOutputOptions ¶
type SourceMapOutputOptions struct {
RootNode SourceMapNode
ContentsMap map[string]string
ContentsIgnoredCharsMap map[string]int
SourceMapFilename string
OutputFilename string
SourceMapURL string
SourceMapBasepath string
SourceMapRootpath string
OutputSourceFiles bool
SourceMapGeneratorConstructor func() SourceMapGenerator
}
type SourceMapPosition ¶
type StringFunctionWrapper ¶
type StringFunctionWrapper struct {
// contains filtered or unexported fields
}
StringFunctionWrapper wraps string functions to implement FunctionDefinition interface
func (*StringFunctionWrapper) CallCtx ¶
func (w *StringFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*StringFunctionWrapper) NeedsEvalArgs ¶
func (w *StringFunctionWrapper) NeedsEvalArgs() bool
type StyleContext ¶
type StyleContext struct {
Index int
CurrentFileInfo map[string]any
Context EvalContext
}
StyleContext represents the context needed for style function execution
type StylizeFunc ¶
type SvgContext ¶
type SvgContext struct {
Index int
CurrentFileInfo map[string]any
Context EvalContext
}
SvgContext represents the context needed for svg function execution
type SvgFunctionWrapper ¶
type SvgFunctionWrapper struct {
// contains filtered or unexported fields
}
SvgFunctionWrapper wraps svg functions to implement FunctionDefinition interface
func (*SvgFunctionWrapper) CallCtx ¶
func (w *SvgFunctionWrapper) CallCtx(ctx *Context, args ...any) (any, error)
func (*SvgFunctionWrapper) NeedsEvalArgs ¶
func (w *SvgFunctionWrapper) NeedsEvalArgs() bool
type ToCSSOptions ¶
type ToCSSOptions struct {
Compress bool
DumpLineNumbers any
StrictUnits bool
NumPrecision int
SourceMap any
PluginManager any
PluginBridge any // *LazyNodeJSPluginBridge or *NodeJSPluginBridge for JS plugin function lookup
Functions any
ProcessImports bool
ImportManager any
RewriteUrls any // Can be string ("all", "local", "off") or RewriteUrlsType
Rootpath string // Root path for URL rewriting
Math MathType // Math mode for operations (ALWAYS, PARENS_DIVISION, PARENS)
Paths []string // Include paths for resolving imports and file references
UrlArgs string // Query string to append to URLs (e.g., "424242")
JavascriptEnabled bool // Enable inline JavaScript evaluation
}
ToCSSOptions represents options for CSS conversion
type ToCSSResult ¶
type ToCSSResult struct {
CSS string `json:"css"`
Map string `json:"map,omitempty"`
Imports []string `json:"imports"`
}
ToCSSResult represents the result of converting a parse tree to CSS
type ToCSSVisitor ¶
type ToCSSVisitor struct {
// contains filtered or unexported fields
}
ToCSSVisitor implements CSS output visitor
func GetToCSSVisitor ¶
func GetToCSSVisitor(context any) *ToCSSVisitor
GetToCSSVisitor retrieves a ToCSSVisitor from the pool and configures it with the given context
func NewToCSSVisitor ¶
func NewToCSSVisitor(context any) *ToCSSVisitor
NewToCSSVisitor creates a new ToCSSVisitor
func (*ToCSSVisitor) CheckValidNodes ¶
func (v *ToCSSVisitor) CheckValidNodes(rules []any, isRoot bool) error
CheckValidNodes checks if nodes are valid for their context
func (*ToCSSVisitor) IsReplacing ¶
func (v *ToCSSVisitor) IsReplacing() bool
IsReplacing returns true as ToCSSVisitor is a replacing visitor
func (*ToCSSVisitor) Reset ¶
func (v *ToCSSVisitor) Reset(context any)
Reset resets the ToCSSVisitor for reuse from the pool. The visitor's methodLookup map is preserved (it's expensive to rebuild).
func (*ToCSSVisitor) Run ¶
func (v *ToCSSVisitor) Run(root any) any
Run runs the visitor on the root node
func (*ToCSSVisitor) VisitAnonymous ¶
func (v *ToCSSVisitor) VisitAnonymous(anonymousNode any, visitArgs *VisitArgs) any
VisitAnonymous visits an anonymous node
func (*ToCSSVisitor) VisitAtRule ¶
func (v *ToCSSVisitor) VisitAtRule(atRuleNode any, visitArgs *VisitArgs) any
VisitAtRule visits an at-rule node
func (*ToCSSVisitor) VisitAtRuleWithBody ¶
func (v *ToCSSVisitor) VisitAtRuleWithBody(atRuleNode any, visitArgs *VisitArgs) any
VisitAtRuleWithBody visits an at-rule with body
func (*ToCSSVisitor) VisitAtRuleWithoutBody ¶
func (v *ToCSSVisitor) VisitAtRuleWithoutBody(atRuleNode any, visitArgs *VisitArgs) any
VisitAtRuleWithoutBody visits an at-rule without body
func (*ToCSSVisitor) VisitComment ¶
func (v *ToCSSVisitor) VisitComment(commentNode any, visitArgs *VisitArgs) any
VisitComment visits a comment node
func (*ToCSSVisitor) VisitContainer ¶
func (v *ToCSSVisitor) VisitContainer(containerNode any, visitArgs *VisitArgs) any
VisitContainer visits a container node (same logic as media)
func (*ToCSSVisitor) VisitDeclaration ¶
func (v *ToCSSVisitor) VisitDeclaration(declNode any, visitArgs *VisitArgs) any
VisitDeclaration visits a declaration node
func (*ToCSSVisitor) VisitExtend ¶
func (v *ToCSSVisitor) VisitExtend(extendNode any, visitArgs *VisitArgs) any
VisitExtend visits an extend node
func (*ToCSSVisitor) VisitImport ¶
func (v *ToCSSVisitor) VisitImport(importNode any, visitArgs *VisitArgs) any
VisitImport visits an import node
func (*ToCSSVisitor) VisitMedia ¶
func (v *ToCSSVisitor) VisitMedia(mediaNode any, visitArgs *VisitArgs) any
VisitMedia visits a media node
func (*ToCSSVisitor) VisitMixinDefinition ¶
func (v *ToCSSVisitor) VisitMixinDefinition(mixinNode any, visitArgs *VisitArgs) any
VisitMixinDefinition visits a mixin definition node
func (*ToCSSVisitor) VisitNode ¶
func (v *ToCSSVisitor) VisitNode(node any, visitArgs *VisitArgs) (any, bool)
VisitNode implements direct dispatch without reflection for better performance
func (*ToCSSVisitor) VisitNodeOut ¶
func (v *ToCSSVisitor) VisitNodeOut(node any) bool
VisitNodeOut implements direct dispatch for visitOut methods
func (*ToCSSVisitor) VisitRuleset ¶
func (v *ToCSSVisitor) VisitRuleset(rulesetNode any, visitArgs *VisitArgs) any
VisitRuleset visits a ruleset node
type ToStringOptions ¶
type ToStringOptions struct {
Stylize StylizeFunc
}
type TreeRegistry ¶
type TypeFunctionDef ¶
type TypeFunctionDef struct {
// contains filtered or unexported fields
}
TypeFunctionDef wraps type functions to implement FunctionDefinition
func (*TypeFunctionDef) CallCtx ¶
func (t *TypeFunctionDef) CallCtx(ctx *Context, args ...any) (any, error)
func (*TypeFunctionDef) NeedsEvalArgs ¶
func (t *TypeFunctionDef) NeedsEvalArgs() bool
type TypesFunctions ¶
type TypesFunctions struct{}
TypesFunctions implements type checking and unit manipulation functions for Less
func NewTypesFunctions ¶
func NewTypesFunctions() *TypesFunctions
func (*TypesFunctions) GetFunctions ¶
func (tf *TypesFunctions) GetFunctions() map[string]any
func (*TypesFunctions) IsPercentage ¶
func (tf *TypesFunctions) IsPercentage(n any) (*Keyword, error)
type URL ¶
type URL struct {
*Node
Value any // Exported for external access
IsEvald bool // Exported for external access
// contains filtered or unexported fields
}
URL represents a URL node in the Less AST
func SvgGradient ¶
func SvgGradient(ctx SvgContext, args ...interface{}) (*URL, error)
SvgGradient implements the svg-gradient() function which creates SVG gradient data URIs
func SvgGradientWithCatch ¶
func SvgGradientWithCatch(ctx SvgContext, args ...interface{}) *URL
SvgGradientWithCatch implements svg-gradient with error handling like the JavaScript version
type URLParseError ¶
type URLParseError struct {
URL string
}
func (*URLParseError) Error ¶
func (e *URLParseError) Error() string
type UnicodeDescriptor ¶
type UnicodeDescriptor struct {
*Node
// contains filtered or unexported fields
}
UnicodeDescriptor represents a unicode descriptor node in the Less AST
func NewUnicodeDescriptor ¶
func NewUnicodeDescriptor(value any) *UnicodeDescriptor
func (*UnicodeDescriptor) Accept ¶
func (u *UnicodeDescriptor) Accept(visitor any)
Accept implements the Visitor pattern
func (*UnicodeDescriptor) AddVisibilityBlock ¶
func (u *UnicodeDescriptor) AddVisibilityBlock()
func (*UnicodeDescriptor) BlocksVisibility ¶
func (u *UnicodeDescriptor) BlocksVisibility() bool
func (*UnicodeDescriptor) CopyVisibilityInfo ¶
func (u *UnicodeDescriptor) CopyVisibilityInfo(info map[string]any)
func (*UnicodeDescriptor) EnsureInvisibility ¶
func (u *UnicodeDescriptor) EnsureInvisibility()
func (*UnicodeDescriptor) EnsureVisibility ¶
func (u *UnicodeDescriptor) EnsureVisibility()
func (*UnicodeDescriptor) Eval ¶
func (u *UnicodeDescriptor) Eval() *UnicodeDescriptor
Eval returns the UnicodeDescriptor itself (matches JavaScript behavior)
func (*UnicodeDescriptor) FileInfo ¶
func (u *UnicodeDescriptor) FileInfo() map[string]any
func (*UnicodeDescriptor) Fround ¶
func (u *UnicodeDescriptor) Fround(context any, value float64) float64
Fround rounds numbers based on precision (inherited from Node)
func (*UnicodeDescriptor) GenCSS ¶
func (u *UnicodeDescriptor) GenCSS(context any, output *CSSOutput)
func (*UnicodeDescriptor) GetIndex ¶
func (u *UnicodeDescriptor) GetIndex() int
func (*UnicodeDescriptor) GetValue ¶
func (u *UnicodeDescriptor) GetValue() any
func (*UnicodeDescriptor) IsRulesetLike ¶
func (u *UnicodeDescriptor) IsRulesetLike() bool
func (*UnicodeDescriptor) IsVisible ¶
func (u *UnicodeDescriptor) IsVisible() *bool
func (*UnicodeDescriptor) Operate ¶
func (u *UnicodeDescriptor) Operate(context any, op string, a, b float64) float64
Operate performs basic arithmetic operations (inherited from Node)
func (*UnicodeDescriptor) RemoveVisibilityBlock ¶
func (u *UnicodeDescriptor) RemoveVisibilityBlock()
func (*UnicodeDescriptor) SetParent ¶
func (u *UnicodeDescriptor) SetParent(nodes any, parent *Node)
func (*UnicodeDescriptor) SetValue ¶
func (u *UnicodeDescriptor) SetValue(value any)
func (*UnicodeDescriptor) ToCSS ¶
func (u *UnicodeDescriptor) ToCSS(context any) string
func (*UnicodeDescriptor) Type ¶
func (u *UnicodeDescriptor) Type() string
func (*UnicodeDescriptor) VisibilityInfo ¶
func (u *UnicodeDescriptor) VisibilityInfo() map[string]any
type Value ¶
Value represents a value node in the Less AST
func (*Value) GetTypeIndex ¶
type ValueError ¶
type ValueError struct {
Message string
}
ValueError represents a Less value error
func (*ValueError) Error ¶
func (e *ValueError) Error() string
type ValueParseFunc ¶
type ValueParseFunc func(input string, context map[string]any, imports map[string]any, fileInfo map[string]any, index int) ([]any, error)
ValueParseFunc is a function type for parsing value strings into values
type Variable ¶
type Variable struct {
*Node
// contains filtered or unexported fields
}
Variable represents a variable node in the Less AST
func NewVariable ¶
func Style ¶
func Style(ctx StyleContext, args ...interface{}) (*Variable, error)
Style implements the style() function which creates a Variable from the argument's value and evaluates it
func StyleWithCatch ¶
func StyleWithCatch(ctx StyleContext, args ...interface{}) *Variable
StyleWithCatch implements the style function with error handling like the JavaScript version
type VariableCall ¶
type VariableCall struct {
*Node
// contains filtered or unexported fields
}
VariableCall represents a variable call node in the Less AST
func NewVariableCall ¶
func NewVariableCall(variable string, index int, currentFileInfo map[string]any) *VariableCall
func (*VariableCall) Eval ¶
func (vc *VariableCall) Eval(context any) (result any, err error)
Eval evaluates the variable call - match JavaScript implementation
func (*VariableCall) FileInfo ¶
func (vc *VariableCall) FileInfo() map[string]any
func (*VariableCall) GetIndex ¶
func (vc *VariableCall) GetIndex() int
func (*VariableCall) GetType ¶
func (vc *VariableCall) GetType() string
func (*VariableCall) Type ¶
func (vc *VariableCall) Type() string
type VariableInfo ¶
VariableInfo represents a variable to check for replacement.
type VariableReplacement ¶
type VariableReplacement struct {
Type string `json:"_type"`
Value string `json:"value,omitempty"`
Quote string `json:"quote,omitempty"`
RGB []float64 `json:"rgb,omitempty"`
Alpha float64 `json:"alpha,omitempty"`
Unit string `json:"unit,omitempty"`
Props map[string]any `json:"-"`
}
VariableReplacement represents a replacement for a variable.
type VersionInfo ¶
type VisibilityNode ¶
type VisibilityNode interface {
BlocksVisibility() bool
EnsureVisibility()
EnsureInvisibility()
}
VisibilityNode interface for nodes that support visibility operations
type VisitOutFunc ¶
type VisitOutFunc func(node any)
type VisitorIterator ¶
type VisitorIterator struct {
// contains filtered or unexported fields
}
VisitorIterator represents an iterator for visitors
func (*VisitorIterator) First ¶
func (vi *VisitorIterator) First() any
func (*VisitorIterator) Get ¶
func (vi *VisitorIterator) Get() any
Get returns the next visitor in the iteration
Source Files
¶
- abstract_file_manager.go
- anonymous.go
- assignment.go
- atrule-syntax.go
- atrule.go
- atrule_syntax.go
- attribute.go
- boolean.go
- cache_prewarm.go
- call.go
- chunker.go
- color.go
- color_blending.go
- color_functions.go
- colors.go
- combinator.go
- comment.go
- compile.go
- condition.go
- constants.go
- container.go
- contexts.go
- data_uri.go
- declaration.go
- default.go
- detached_ruleset.go
- dimension.go
- element.go
- environment.go
- expression.go
- extend.go
- extend_visitor.go
- file_system_file_manager.go
- function_caller.go
- function_registry.go
- functions_default.go
- import.go
- import_manager.go
- import_sequencer.go
- import_visitor.go
- index.go
- javascript.go
- join_selector_visitor.go
- js_eval_node.go
- js_visitor_adapter.go
- keyword.go
- lazy_plugin_bridge.go
- less_error.go
- list.go
- logger.go
- math.go
- math_helper.go
- media.go
- mixin_call.go
- mixin_definition.go
- namespace_value.go
- negative.go
- nested_at_rule.go
- node.go
- node_pools.go
- nodejs_plugin_bridge.go
- number.go
- operation.go
- paren.go
- parse.go
- parse_tree.go
- parser.go
- parser_input.go
- parser_regexes.go
- parser_trace.go
- parser_trace_examples.go
- plugin_example.go
- plugin_manager.go
- property.go
- query_in_parens.go
- quoted.go
- render.go
- ruleset.go
- safety.go
- selector.go
- selector_list.go
- set_tree_visibility_visitor.go
- source_map_builder.go
- source_map_output.go
- string.go
- string_intern.go
- style.go
- svg.go
- test_functions.go
- test_utils.go
- to_css_visitor.go
- transform_tree.go
- types.go
- unicode_descriptor.go
- unit.go
- unit_conversions.go
- url.go
- utils.go
- value.go
- variable.go
- variable_call.go
- visitor.go
- visitor_pools.go