Skip to content

Releases: josbeir/sugar

0.6.6

11 Mar 18:53
afa41b0

Choose a tag to compare

What's Changed

  • feat(vite): add namespace support for multi-build setups in #41

Full Changelog: 0.6.5...0.6.6

0.6.5

11 Mar 13:31
0fc5a0f

Choose a tag to compare

What's Changed

  • Fix s:foreach/s:if + s:include combination on fragments in #39
  • Fix: Allow PHP alternative syntax control structures in debug mode in #40

Full Changelog: 0.6.4...0.6.5

0.6.4

04 Mar 17:44
e2ad952

Choose a tag to compare

What's Changed

  • Fix PHP block lexing with close tags in comments/strings in #38
  • Fix switch directive compilation for case/default pipeline traversal in #37

Full Changelog: 0.6.3...0.6.4

0.6.3

03 Mar 20:09
2f79980

Choose a tag to compare

What's Changed

  • Fix s:trim propagation across include/block boundaries in #36

Full Changelog: 0.6.2...0.6.3

0.6.2

02 Mar 19:01

Choose a tag to compare

Highlights

  • Added new pass-through directive: s:trim

    • Compile-time whitespace trimming for elements where indentation/newline-only text nodes should be removed.
    • Ideal for compact inline output such as <title>...</title>.
    • Includes validation and deterministic errors for unsupported usage:
      • presence-only attribute (no value allowed)
      • supported on HTML elements only (not <s-template> / component tags).
  • Fixed component boolean attribute rendering (from PR #34)

    • Preserves presence-only attributes (e.g. x-cloak) instead of rendering x-cloak="".
    • Ensures boolean attributes are correctly propagated and merged for component root elements.

Commits included

  • f8d40d7 — fix: preserve boolean attributes (e.g. x-cloak) on component root elements (#34)
  • 736a887 — feat: add s:trim whitespace pass with docs and tests
  • 546c57a — fix: validate and constrain s:trim usage

0.6.1

27 Feb 09:20

Choose a tag to compare

What's Changed

This release adds the ability to use s:block, s:append and s:prepend directives on s:includes effectively assigning partial content to blocks.

Simple example combining s:include with s:append and a control flow expression s:if:

<s-template s:include="partials/optional_nav" s:append="header" s:if="$expression" />

It also fixes defining blocks from partials which was partially implemented but never finished.


  • fix: allow s:block in partials to define blocks for parent layout by @josbeir in #32
  • feat: include block combo by @josbeir in #33

Full Changelog: 0.6.0...0.6.1

0.6.0

26 Feb 10:41
4ad05a1

Choose a tag to compare

v0.6.0 — Slot Outlet Tag Swapping & Attribute Merging

Named slot outlets now support tag swapping and attribute merging. When a caller fills a named slot, the caller's tag replaces the outlet's tag and attributes are merged — class values concatenate, other attributes override.

<!-- Component: <h2 s:slot="title" class="card-title">Default</h2> -->
<!-- Caller:    <h3 s:slot="title" class="text-lg">My Title</h3>   -->
<!-- Result:    <h3 class="card-title text-lg">My Title</h3>       -->

Fragment outlets (<s-template s:slot="name">) inject content without a wrapper. Slot variables are still supported.

Breaking Changes

  • SlotOutletResolver removed (was dead code)
  • ComponentRenderer::$slotAttributeName no longer has a default — always derived from DirectivePrefixHelper

0.5.2

25 Feb 12:55

Choose a tag to compare

What's Changed

This release introduces a Vite extension and an s:block directive which can be used to check if a block from a child template has been defined on an higher inherited parent.

  • feat: add Vite extension for Sugar templates by @josbeir in #29
  • feat(inheritance): add s:ifblock for conditional block-aware rendering by @josbeir in #30

Read the docs for more information.

Full Changelog: 0.5.1...0.5.2

0.5.1

24 Feb 20:47

Choose a tag to compare

What's Changed

  • Add element-claiming directives via ElementClaimingDirectiveInterface by @josbeir in #27
  • Add element syntax support to built-in control-flow directives by @josbeir in #28
  • Fix regression with escaping during inheritance

Full Changelog: 0.5.0...0.5.1

0.5.0

22 Feb 15:05
bb26c1d

Choose a tag to compare

Breaking Changes

  • DirectiveType::CONTENT renamed to DirectiveType::OUTPUT — affects any custom directive that returns this type from getType(). Update accordingly. (#26)
  • SugarException constructor signature changed — now follows the standard PHP Exception constructor (string $message, int $code, ?Throwable $previous). Template location is no longer set via constructor arguments; use ->withLocation(path, line, column) instead. Custom exception subclasses may need updating.
  • DependencyTracker::addComponent() removed — replaced by addDependency(). (#25)
  • Template inheritance is now runtime-driven — the inheritance compilation and runtime pipeline was significantly restructured. (#24)

New Features

  • use statement hoisting (#23) — PHP use imports in template blocks are now extracted, deduplicated, and hoisted to the top of compiled output. Supports grouped, aliased, and comma-separated forms.

    • New AST node: PhpImportNode
    • New compiler components: PhpImportExtractor, PhpImportRegistry
  • Inheritance runtime pipeline (#24) — s:extends, s:block, s:append, s:prepend, s:parent, and s:include are now fully runtime-driven with dedicated block management services. Compiled output is more readable with normalized/aliased runtime helper references.


Improvements

  • Unified dependency tracking (#25) — components metadata removed from cache. All template and component file dependencies now tracked through a single dependencies list, simplifying cache invalidation logic.
  • Self-closing component fix — components using self-closing syntax are now handled correctly.

Internal / Refactors

  • DirectiveType::OUTPUT variable naming propagated throughout DirectiveExtractionPass ($outputDirective, $outputCount, error messages), removing the content/output terminology mismatch.
  • SugarException now adheres to the standard PHP exception pattern, making Rector's ThrowWithPreviousExceptionRector compatible.
  • UnknownDirectiveException uses a create() static factory.