Normalizers

Sample documentation (demo only)
This is an incomplete, outdated docs snapshot shipped with the playground — screenshots were removed on purpose.
For the full, current manuals go to voodflow.com/docs.

Voodflow\Voodbuilder\Support\Editor\EditorBackgroundPublishNormalizer

  • File: Support/Editor/EditorBackgroundPublishNormalizer.php
  • Kind: class
  • Responsibility: Drop redundant inline background-image url() when the same asset is already painted by the published page CSS (Style Manager / #id rules).

Methods

  • public static function preferCssBackgrounds(string $html, string $css): string
    • Prefer Css Backgrounds.

Voodflow\Voodbuilder\Support\Editor\EditorBrandingNormalizer

  • File: Support/Editor/EditorBrandingNormalizer.php
  • Kind: class
  • Responsibility: Replaces third-party section-catalog branding when building section-blocks.json. Not used at page render or editor runtime — run voodbuilder:build-sections after source changes.

Methods

  • public static function normalizeHtml(string $html): string
    • Normalize HTML into the canonical storage / render form.
  • protected static function isCustomizedBrandLogoSvg(string $attributes): bool
    • Boolean predicate isCustomizedBrandLogoSvg.
  • public static function brandMarkHtml(): string
    • Brand Mark Html.

Voodflow\Voodbuilder\Support\Editor\EditorCodeBlockNormalizer

  • File: Support/Editor/EditorCodeBlockNormalizer.php
  • Kind: class
  • Responsibility: Ensures Editor code snippets use the shared vp-code-block shell (vdocs / vtuts).

Methods

  • public static function normalize(string $html): string
    • Normalize markup or attributes into the canonical storage form.
  • protected static function stripStretchHeightClasses(string $html): string
    • Remove Style Manager / flex stretch classes (h-full, min-h-*) from code shells.
  • protected static function highlightVpCodeBlocks(string $html): string
    • Highlight Vp Code Blocks.
  • protected static function dedupeNestedVpCodeBlocks(string $html): string
    • Dedupe Nested Vp Code Blocks.
  • protected static function wrapLegacyCustomCode(string $html): string
    • Wrap Legacy Custom Code.
  • protected static function guessLanguage(string $code): string
    • Guess Language.

Voodflow\Voodbuilder\Support\Editor\EditorComponentCategoryNormalizer

  • File: Support/Editor/EditorComponentCategoryNormalizer.php
  • Kind: class
  • Responsibility: Editor Component Category Normalizer.

Methods

  • public static function categories(): array
    • Categories.
  • public static function normalize(?string $category, ?string $fallback = null): ?string
    • Normalize markup or attributes into the canonical storage form.

Voodflow\Voodbuilder\Support\Editor\EditorDynamicBlockAttributeNormalizer

  • File: Support/Editor/EditorDynamicBlockAttributeNormalizer.php
  • Kind: class
  • Responsibility: Editor Dynamic Block Attribute Normalizer.

Methods

  • public static function normalize(string $html): string
    • Normalize markup or attributes into the canonical storage form.
  • public static function decodeConfig(string $raw): array
    • Decode Config.
  • public static function encodeConfig(array $config): string
    • Encode Config.
  • protected static function defaultConfigFor(string $blockId): array
    • Default Config For.
  • protected static function loadDocument(string $html): DOMDocument
    • Load Document.
  • protected static function dynamicNodes(DOMDocument $document): array
    • Dynamic Nodes.
  • protected static function salvageCorruptedConfig(DOMElement $node): array
    • Editor can split JSON config into stray attributes (menu="", limit="", …).
  • protected static function repairCorruptedDynamicBlockMarkup(string $html): string
    • Repair Corrupted Dynamic Block Markup.
  • protected static function pruneForeignAttributes(DOMElement $node): void
    • Editor corrupts JSON config into stray attributes (e.g. limit="", menu="").
  • protected static function extractBodyHtml(DOMDocument $document): ?string
    • Extract Body Html.

Voodflow\Voodbuilder\Support\Editor\EditorFormNormalizer

  • File: Support/Editor/EditorFormNormalizer.php
  • Kind: class
  • Responsibility: Ensures Editor form blocks use the shared vb-gjs-form styles on published pages.

Methods

  • public static function normalize(string $html): string
    • Normalize markup or attributes into the canonical storage form.
  • public static function normalizeForPage(string $html, SitePage $page): string
    • Normalize For Page.
  • protected static function isManagedForm(string $attributes): bool
    • Boolean predicate isManagedForm.
  • protected static function isNewsletterForm(string $attributes): bool
    • Boolean predicate isNewsletterForm.
  • protected static function ensureNewsletterListField(string $attributes, string $inner): string
    • Ensure Newsletter List Field.
  • protected static function ensureHiddenInput(string $inner, string $name, string $value): string
    • Ensure Hidden Input.
  • protected static function setAttribute(string $attributes, string $name, string $value): string
    • Set Attribute.
  • protected static function removeAttribute(string $attributes, string $name): string
    • Remove Attribute.

Voodflow\Voodbuilder\Support\Editor\EditorHeroBackgroundNormalizer

  • File: Support/Editor/EditorHeroBackgroundNormalizer.php
  • Kind: class
  • Responsibility: Publish-time cleanup for full-bleed YouTube/Vimeo hero backgrounds.

Methods

  • public static function normalize(string $html): string
    • Normalize markup or attributes into the canonical storage form.
  • public static function hardenEmbedSrc(string $src): string
    • Harden Embed Src.

Voodflow\Voodbuilder\Support\Editor\EditorLibraryLayoutNormalizer

  • File: Support/Editor/EditorLibraryLayoutNormalizer.php
  • Kind: class
  • Responsibility: Ensures library structural hooks carry the Tailwind utilities the page JIT must compile for editor ≈ public parity.

Methods

  • public static function normalize(string $html): string
    • Normalize markup or attributes into the canonical storage form.

Voodflow\Voodbuilder\Support\Editor\EditorPastedComponentNormalizer

  • File: Support/Editor/EditorPastedComponentNormalizer.php
  • Kind: class
  • Responsibility: Editor Pasted Component Normalizer.

Methods

  • public static function normalize(string $input): array
    • Normalize markup or attributes into the canonical storage form.
  • public static function compileTailwindCss(string $html, bool $migrateLegacyPaletteUtilities = false): string
    • Compile Tailwind Css.
  • public static function compilePageTailwindCss(string $html): string
    • Compile Page Tailwind Css.
  • public static function mergeCss(?string $manualCss, ?string $autoCss): ?string
    • Merge Css.
  • public static function dedupeCssRules(string $css): string
    • Collapse identical CSS rules (common after repeated chrome-layout saves).
  • public static function resolvedCssForStoredHtml( string $html, ?string $storedCss, ?string $storedChecksum = null, ): string
    • Resolved Css For Stored Html.
  • public static function publishedCssForStoredHtml(string $html, ?string $storedCss): string
    • CSS for public page render — never invokes Tailwind compilation.
  • public static function resolvePublishedPageCss(string $html, ?string $storedCss): string
    • CSS for page-level Editor styles (non-component utilities).
  • public static function resolvePublishedPageCssForSave( string $html, ?string $storedCss, ?string $previousFullCss = null, ?string $previousClassFingerprint = null, ?string $liveUtilitiesCss = null, ): string
    • Save path: compile utilities from HTML and merge with author/manual rules.
  • public static function pageUtilityClassFingerprint(string $html): string
    • Stable hash of Tailwind class tokens on the page (ignores text / structure).
  • public static function utilitiesCssFromPublishedPageCss(string $fullCss): string
    • Compiled utility / theme rules from a published sheet (drops author #id / BEM).
  • public static function stripPublishedPageCssRuntimeStyles(string $css): string
    • Strip Published Page Css Runtime Styles.
  • public static function pageCssIncludesTailwindPreflight(string $css): bool
    • Page Css Includes Tailwind Preflight.
  • public static function pageCssMissingThemeVariables(string $css): bool
    • JIT page CSS references --spacing and other theme tokens stripped with @layer theme. Also catches orphan animation: var(--animate-*) utilities without the matching
  • public static function pageCssHasOrphanAnimateVariables(string $css): bool
    • Page CSS that redefines .animate-* with var(--animate-*) but omits the token beats theme.css and disables motion on the published frontend.
  • public static function stripTailwindPreflightFromPageCss(string $css): string
    • Strip Tailwind Preflight From Page Css.
  • public static function manualPageCssFromStoredCss(?string $storedCss): string
    • Non-Tailwind rules from Editor getCss(): #id composer styles, custom class rules, and @keyframes (Library embeds / pasted components). Strips utility
  • public static function isTailwindUtilityClassName(string $className): bool
    • Boolean predicate isTailwindUtilityClassName.
  • public static function grapesComposerRulesFromStoredCss(?string $storedCss): string
    • Editor Style Manager rules (#element-id) — excludes Tailwind utility bundles from getCss().
  • public static function compileCssForComponentInstanceHtml(string $html): ?string
    • Compile Tailwind utilities for markup saved inside a component instance on a page. Instance HTML is not theme-migrated (same as public render inside components).
  • public static function cssForDatabaseStorage(?string $css): ?string
    • Css For Database Storage.
  • public static function cssForExport(?string $css, string $html = ''): ?string
    • Css For Export.
  • public static function stripComponentRuntimeBaseStyles(string $css, string $html): string
    • Strip Component Runtime Base Styles.
  • public static function persistCssFromCatalogResolution( array $resolved, ?string $incomingCss, ?string $normalizedAutoCss = null, ): ?string
    • Persist Css From Catalog Resolution.
  • public static function htmlChecksum(string $html): string
    • Html Checksum.
  • public static function storedCssIsCurrent( string $html, string $storedCss, ?string $storedChecksum, ?string $currentChecksum = null, ): bool
    • Stored Css Is Current.
  • public static function storedCssIsCorrupted(string $storedCss): bool
    • Stored Css Is Corrupted.
  • public static function storedCssRequiresRecompile(string $html, string $storedCss): bool
    • Stored Css Requires Recompile.
  • public static function htmlHasTailwindUtilitiesMissingFromCss(string $html, string $storedCss): bool
    • Html Has Tailwind Utilities Missing From Css.
  • public static function cssDefinesUtilityClass(string $css, string $className): bool
    • True when $css contains a selector for $className, including Tailwind's escaped form (e.g. sm:px-10 → .sm:px-10, max-w-[80rem] → .max-w-[80rem]).
  • public static function resolveCatalogCss(string $html, ?string $storedCss, ?string $storedChecksum = null): array
    • CSS for catalog listing: uses stored CSS when present; compiles Tailwind only for components that have no stored CSS yet (new imports / legacy rows).
  • public static function catalogCssForStoredComponent(string $html, ?string $storedCss): string
    • Catalog Css For Stored Component.
  • public static function manualCssFromStoredComponentCss(string $storedCss): string
    • Manual Css From Stored Component Css.
  • public static function componentThemeTokenBridgeCss(): string
    • Component Theme Token Bridge Css.
  • public static function cssReferencesLegacyBrandUtilities(string $css): bool
    • Css References Legacy Brand Utilities.
  • public static function htmlReferencesLegacyBrandUtilities(string $html): bool
    • Html References Legacy Brand Utilities.
  • public static function cssReferencesLegacyPaletteVariables(string $css): bool
    • Css References Legacy Palette Variables.
  • public static function htmlReferencesPrelineSemanticUtilities(string $html): bool
    • Html References Preline Semantic Utilities.
  • public static function cssIncludesPrelineSemanticUtilities(string $css): bool
    • Css Includes Preline Semantic Utilities.
  • protected static function extractStyleTags(string $html, array &$cssParts): string
    • Extract Style Tags.
  • protected static function stripScripts(string $html): string
    • Strip Scripts.
  • protected static function extractDocumentBody(string $html): string
    • Extract Document Body.
  • protected static function stripDocumentShell(string $html): string
    • Strip Document Shell.
  • protected static function wrapMultipleRoots(string $html): string
    • Wrap Multiple Roots.
  • protected static function uniquifySvgIds(string $html): string
    • Uniquify Svg Ids.
  • protected static function stripEmbeddableMedia(string $html): string
    • Strip Embeddable Media.
  • protected static function isVideoEmbedSrc(string $src): bool
    • Boolean predicate isVideoEmbedSrc.
  • protected static function replaceWithMediaSlot(DOMDocument $document, DOMElement $element): void
    • Performs replaceWithMediaSlot side effects.
  • protected static function loadDocument(string $html): DOMDocument
    • Load Document.
  • protected static function extractBodyHtml(DOMDocument $document): ?string
    • Extract Body Html.

Voodflow\Voodbuilder\Support\Editor\EditorPlaceholderNormalizer

  • File: Support/Editor/EditorPlaceholderNormalizer.php
  • Kind: class
  • Responsibility: Third-party section templates may ship dummyimage.com placeholders that often resolve to random stock photos. Replace them with a neutral local placeholder so editors start from a clean slate.

Methods

  • public static function neutralImageDataUri(): string
    • Neutral Image Data Uri.
  • public static function normalizeHtml(string $html): string
    • Normalize HTML into the canonical storage / render form.
  • public static function normalizeDataImageSrc(string $html): string
    • Chrome rejects data:image/svg+xml URIs that contain literal spaces.

Voodflow\Voodbuilder\Support\Editor\EditorStepTabsNormalizer

  • File: Support/Editor/EditorStepTabsNormalizer.php
  • Kind: class
  • Responsibility: Upgrades step-nav blocks (STEP 1…N anchors + single content) to accessible tabs.

Methods

  • public static function normalize(string $html): string
    • Normalize markup or attributes into the canonical storage form.
  • protected static function collectStepLinks(DOMElement $navContainer): array
    • Collect Step Links.
  • protected static function collectContentSiblings(DOMElement $navContainer): array
    • Collect Content Siblings.
Demo resets in 00:29:42