Coralite v0.31.3 Released

Coralite v0.31.3 is now available. This release focuses on improving client-side reactivity for computed slots and imperative web components, ensuring dynamic logic is preserved during runtime updates. Additionally, we have introduced explicit TypeScript type definitions for module token and slot options to improve developer ergonomics.

Client-Side Reactivity for Computed Slots #

With this release, Coralite Web Components support client-side reactivity inside computed slots. Previously, slot functions defined on components were not fully dynamic after initial compilation. We updated the compiler to bundle original slot functions at results.__script__.slots and serialize them on the component manifest. At runtime, the client-side renderer dynamically re-evaluates these slot functions during component updates, using the projected light DOM nodes and reactive state (this._values) to generate updated node arrays.

javascript
Code copied!
  defineComponent({
    name: 'my-reactive-card',
    slots: {
      header: (slotNodes, values) => {
        return `<h3>Card Title: &#x24;{values.title}</h3>`;
      }
    }
  });

Reactive Imperative Component Tokens #

We resolved an issue where computed tokens in imperative web components were evaluated into static strings on the server. By modifying defineComponent to populate the __script__.defaultValues object directly with token functions, the framework preserves them as executable client-side logic. This ensures that dynamically attached components correctly re-evaluate tokens on client-side attribute alterations.

Furthermore, computed tokens are now successfully passed to dynamically loaded components even when the client configuration lacks a script property. Component element generation has also been updated to support primitive values in the default properties array, preventing token data loss across component lifecycles.

Typed Module Options #

To replace generic function type annotations, we introduced explicit TypeScript interfaces in types/module.js and exported them through the main entry point:

How to Upgrade #

To upgrade to the latest version, update your project dependencies:

bash
Code copied!
  npm install coralite@0.31.3
bash
Code copied!
  npm install coralite-scripts@0.31.3

Related posts

More blog posts

Start Building with Coralite!

Use the scaffolding script to get jump started into your next project with Coralite

Copied commandline!