Documentation
¶
Index ¶
- Constants
- func AIReview(ctx context.Context, cfg *config.Config) error
- func CSSDiff(ctx context.Context, cfg *config.Config) error
- func Capture(ctx context.Context, cfg *config.Config) error
- func Compare(ctx context.Context, settings CompareSettings) error
- func HTMLReport(ctx context.Context, cfg *config.Config) error
- func MatchedStyles(ctx context.Context, cfg *config.Config) error
- func PixelDiff(ctx context.Context, cfg *config.Config, threshold int) error
- func RunAIReview(ctx context.Context, cfg *config.Config) error
- func RunAIReviewWithClient(ctx context.Context, cfg *config.Config, client ai.Client) error
- func RunCapture(ctx context.Context, cfg *config.Config) error
- func RunMatchedStyles(ctx context.Context, cfg *config.Config) error
- func RunPixelDiff(ctx context.Context, cfgDir string, threshold int) error
- func StoryDiscovery(ctx context.Context, cfg *config.Config) error
- func WriteCompareArtifacts(result CompareResult, writeJSONFile bool, writeMarkdownFile bool) error
- type AIResponse
- type AIReviewResult
- type AISectionReview
- type Bounds
- type CSSDiffResult
- type Candidate
- type CaptureResult
- type CascadeOrigin
- type CompareInputs
- type CompareResult
- type CompareSettings
- type CompareSideResult
- type CoverageSummary
- type InspectArtifactResult
- type InspectMetadata
- type InspectOptions
- type InspectRequest
- type InspectResult
- type MatchedRule
- type MatchedSnapshot
- type MatchedStyleEntry
- type MatchedStylesResult
- type PNGStats
- type PageResult
- type PixelDiffEntry
- type PixelDiffResult
- type PixelDiffStats
- type RuleProperty
- type SectionResult
- type Specificity
- type StoryDiscoveryResult
- type StoryEntry
- type StyleDiff
- type StyleResult
- type StyleSnapshot
- type ValidationResult
- type Winner
- type WinnerDiff
Constants ¶
View Source
const ( InspectFormatBundle = service.InspectFormatBundle InspectFormatPNG = service.InspectFormatPNG InspectFormatHTML = service.InspectFormatHTML InspectFormatCSSJSON = service.InspectFormatCSSJSON InspectFormatCSSMarkdown = service.InspectFormatCSSMarkdown InspectFormatInspectJSON = service.InspectFormatInspectJSON InspectFormatMetadataJSON = service.InspectFormatMetadataJSON )
Variables ¶
This section is empty.
Functions ¶
func RunAIReviewWithClient ¶
func WriteCompareArtifacts ¶
func WriteCompareArtifacts(result CompareResult, writeJSONFile bool, writeMarkdownFile bool) error
Types ¶
type AIResponse ¶
type AIReviewResult ¶
type AIReviewResult struct {
Sections []AISectionReview `json:"sections"`
}
type AISectionReview ¶
type AISectionReview struct {
Name string `json:"name"`
Selector string `json:"selector"`
Question string `json:"question"`
Original AIResponse `json:"original"`
React AIResponse `json:"react"`
}
type CSSDiffResult ¶
type CSSDiffResult struct {
Styles []StyleResult `json:"styles"`
}
type Candidate ¶
type Candidate struct {
Property string
Value string
Selector string
Important bool
Specificity Specificity
Origin CascadeOrigin
Order int
}
type CaptureResult ¶
type CaptureResult struct {
Original PageResult `json:"original"`
React PageResult `json:"react"`
Coverage CoverageSummary `json:"coverage"`
Validation []ValidationResult `json:"validation,omitempty"`
}
type CascadeOrigin ¶
type CascadeOrigin string
const ( OriginInline CascadeOrigin = "inline" OriginAuthor CascadeOrigin = "author" OriginUserAgent CascadeOrigin = "user-agent" )
type CompareInputs ¶
type CompareInputs struct {
URL1 string `json:"url1"`
Selector1 string `json:"selector1"`
WaitMS1 int `json:"wait_ms1"`
URL2 string `json:"url2"`
Selector2 string `json:"selector2"`
WaitMS2 int `json:"wait_ms2"`
ViewportW int `json:"viewport_w"`
ViewportH int `json:"viewport_h"`
Props []string `json:"props"`
Attrs []string `json:"attrs"`
OutDir string `json:"out_dir"`
}
type CompareResult ¶
type CompareResult struct {
Inputs CompareInputs `json:"inputs"`
URL1 CompareSideResult `json:"url1"`
URL2 CompareSideResult `json:"url2"`
ComputedDiffs []StyleDiff `json:"computed_diffs"`
WinnerDiffs []WinnerDiff `json:"winner_diffs"`
PixelDiff PixelDiffStats `json:"pixel_diff"`
}
func GenerateCompareResult ¶
func GenerateCompareResult(ctx context.Context, settings CompareSettings) (CompareResult, error)
type CompareSettings ¶
type CompareSideResult ¶
type CompareSideResult struct {
URL string `json:"url"`
Selector string `json:"selector"`
FullScreenshot string `json:"full_screenshot"`
ElementScreenshot string `json:"element_screenshot"`
Computed StyleSnapshot `json:"computed"`
Matched MatchedSnapshot `json:"matched"`
}
type CoverageSummary ¶
type InspectArtifactResult ¶
type InspectArtifactResult = service.InspectArtifactResult
type InspectMetadata ¶
type InspectMetadata = service.InspectMetadata
type InspectOptions ¶
type InspectOptions struct {
Side string
Root bool
Section string
Style string
Selector string
AllSections bool
AllStyles bool
Props []string
Attributes []string
OutDir string
Format string
OutputFile string
}
InspectOptions describes a single-side inspection run against an existing css-visual-diff config. It intentionally uses the current low-level config schema: sections are screenshot regions and styles are computed-CSS probes.
type InspectRequest ¶
type InspectRequest = service.InspectRequest
func BuildInspectRequests ¶
func BuildInspectRequests(cfg *config.Config, opts InspectOptions) ([]InspectRequest, error)
type InspectResult ¶
type InspectResult = service.InspectResult
func Inspect ¶
func Inspect(ctx context.Context, cfg *config.Config, opts InspectOptions) (InspectResult, error)
type MatchedRule ¶
type MatchedRule struct {
Selector string `json:"selector"`
Origin CascadeOrigin `json:"origin"`
Specificity Specificity `json:"specificity"`
Properties []RuleProperty `json:"properties"`
}
type MatchedSnapshot ¶
type MatchedSnapshot struct {
Exists bool `json:"exists"`
Rules []MatchedRule `json:"rules"`
Computed map[string]string `json:"computed"`
Bounds *Bounds `json:"bounds,omitempty"`
}
type MatchedStyleEntry ¶
type MatchedStyleEntry struct {
Name string `json:"name"`
Selector string `json:"selector,omitempty"`
OriginalSelector string `json:"original_selector,omitempty"`
ReactSelector string `json:"react_selector,omitempty"`
Original MatchedSnapshot `json:"original"`
React MatchedSnapshot `json:"react"`
Winners []WinnerDiff `json:"winners"`
}
type MatchedStylesResult ¶
type MatchedStylesResult struct {
Styles []MatchedStyleEntry `json:"styles"`
}
type PageResult ¶
type PixelDiffEntry ¶
type PixelDiffEntry struct {
Section string `json:"section"`
OriginalScreenshot string `json:"original_screenshot"`
ReactScreenshot string `json:"react_screenshot"`
DiffComparisonPath string `json:"diff_comparison_path,omitempty"`
DiffOnlyPath string `json:"diff_only_path,omitempty"`
Threshold int `json:"threshold"`
TotalPixels int `json:"total_pixels"`
ChangedPixels int `json:"changed_pixels"`
ChangedPercent float64 `json:"changed_percent"`
NormalizedWidth int `json:"normalized_width"`
NormalizedHeight int `json:"normalized_height"`
Skipped bool `json:"skipped"`
SkipReason string `json:"skip_reason,omitempty"`
}
type PixelDiffResult ¶
type PixelDiffResult struct {
Threshold int `json:"threshold"`
Entries []PixelDiffEntry `json:"entries"`
}
type PixelDiffStats ¶
type PixelDiffStats struct {
Threshold int `json:"threshold"`
TotalPixels int `json:"total_pixels"`
ChangedPixels int `json:"changed_pixels"`
ChangedPercent float64 `json:"changed_percent"`
NormalizedWidth int `json:"normalized_width"`
NormalizedHeight int `json:"normalized_height"`
DiffComparisonPath string `json:"diff_comparison_path"`
DiffOnlyPath string `json:"diff_only_path"`
}
type RuleProperty ¶
type SectionResult ¶
type SectionResult struct {
Name string `json:"name"`
Selector string `json:"selector"`
Exists bool `json:"exists"`
Visible bool `json:"visible"`
Bounds *Bounds `json:"bounds,omitempty"`
TextStart string `json:"text_start,omitempty"`
Screenshot string `json:"screenshot"`
PNG *PNGStats `json:"png,omitempty"`
ValidationIssues []string `json:"validation_issues,omitempty"`
}
type Specificity ¶
func (Specificity) Add ¶
func (s Specificity) Add(other Specificity) Specificity
func (Specificity) Compare ¶
func (s Specificity) Compare(other Specificity) int
func (Specificity) String ¶
func (s Specificity) String() string
type StoryDiscoveryResult ¶
type StoryDiscoveryResult struct {
Entries []StoryEntry `json:"entries"`
}
type StoryEntry ¶
type StyleResult ¶
type StyleResult struct {
Name string `json:"name"`
Selector string `json:"selector,omitempty"`
OriginalSelector string `json:"original_selector,omitempty"`
ReactSelector string `json:"react_selector,omitempty"`
Original StyleSnapshot `json:"original"`
React StyleSnapshot `json:"react"`
Diffs []StyleDiff `json:"diffs"`
}
type StyleSnapshot ¶
type StyleSnapshot = service.StyleSnapshot
type ValidationResult ¶
type Winner ¶
type Winner struct {
Selector string `json:"selector"`
Value string `json:"value"`
Important bool `json:"important"`
Origin CascadeOrigin `json:"origin"`
Specificity Specificity `json:"specificity"`
}
type WinnerDiff ¶
Click to show internal directories.
Click to hide internal directories.