Skip to content

@svebcomponents/utils Changelog

0.3.0

Minor Changes

  • 86e6596: Remove defineElement.

    It was once mandatory: every component entry point hand-wrote a guarded customElements.define(), and defineElement existed to own that arcana. Two changes took its purpose away. @svebcomponents/build now makes Svelte’s own generated registration call idempotent, so a component that declares its tag needs no registration code at all; and element types and the custom elements manifest are generated by reading that declaration, so a tag registered only through defineElement is invisible to both.

    That left it as the escape hatch for tags that cannot be a literal in <svelte:options> — a case svebcomponents no longer supports, because such a tag cannot be typed, cannot enter HTMLElementTagNameMap, and cannot be self-registered by the SSR renderer.

    Migration

    Declare the tag in the component and delete the registration call:

    import { defineElement } from "@svebcomponents/utils";
    import MyComponent from "./MyComponent.svelte";
    export default MyComponent;
    defineElement("my-component", MyComponent);
    <svelte:options customElement="my-component" />

    The entry point becomes the component itself — see the direct Svelte entries migration in @svebcomponents/build.

    If you register elements outside the svebcomponents pipeline and still want the guards, the implementation was small enough to keep locally:

    const defineElement = (tagName: string, component: unknown): void => {
    if (typeof customElements === "undefined") return;
    const ctor = (component as { element?: CustomElementConstructor } | null)
    ?.element;
    if (!ctor || customElements.get(tagName)) return;
    customElements.define(tagName, ctor);
    };

Patch Changes

  • e7267f8: Documentation pass across the package READMEs ahead of the beta launch.

    • @svebcomponents/ssr, ssr-vue, ssr-react and ssr-astro gained the install command they were missing.
    • @svebcomponents/build’s options table was missing hydratable, ssrEntryFileName and svelteConfig, and did not show how a package with several components composes defineConfig calls.
    • @svebcomponents/ssr’s package-author example used import without types where every other example in the docs uses default with them, and the enable-async opt-in for non-Svelte hosts was undocumented.
    • The three integration READMEs each restated the shared SSR layer’s behaviour — the Lit renderer registry, the server-side svelte requirement, the declarative shadow DOM contract, the definition of an asynchronous component. Each now links to the canonical explanation and keeps only what is specific to its framework.
    • Removed references to internal e2e/* directories, which readers cannot run, and normalised the product name to lowercase svebcomponents.
  • 86e6596: Declare license, description and homepage, and ship the license text in the published tarball.

    Every package was published without a license field and without a license file of its own. npm only includes LICENSE* from the package directory, so the repository’s MIT license never reached consumers and automated license scanners had nothing to read. Each package now carries its own copy of LICENSE.md alongside "license": "MIT".

    description is what npm shows on the package page and in search results, and homepage now points at each package’s reference page on the documentation site.

  • 86e6596: Stop publishing the compiled test file.

    files listed dist without the !dist/**/*.test.* exclusion the other packages carry, so dist/index.test.js and its declarations shipped in the tarball.

0.2.0

Minor Changes

  • 567aef3: Add @svebcomponents/ssr-vue, a Vue host integration for server-rendering Svelte-built custom elements.

    A Vite plugin rewrites custom element tags in SFC templates to a wrapper component, which drives the element’s registered ElementRenderer on the server and emits declarative shadow DOM. Vue’s renderToString awaits async setup(), so async element renderers work through the same wrapper as synchronous ones — no sync/async split.

    Documented on the site under Core Concepts → Framework Integrations, with a package reference page for the new integration.

    Supporting changes:

    • @svebcomponents/ssr gains shadowContent on RenderedCustomElement, for hosts that build the <template> element themselves rather than emitting raw markup.
    • The custom-element tag-name predicates move to @svebcomponents/utils so host integrations can share the detection without importing the Svelte-bound SSR runtime. @svebcomponents/ssr re-exports them from their previous path.

0.1.0

Minor Changes

  • c2f1b6c: Add defineElement(tagName, component) — a safe registration helper for component entry points.

    Every component package previously hand-wrote the same guarded customElements.define boilerplate, with subtle variations (some checked "element" in Component, some Component.element truthiness, some forgot the already-registered guard). defineElement owns the arcana:

    • no-ops when the component has no custom element constructor (the server compile)
    • no-ops when there is no customElements registry at all
    • no-ops when the tag is already registered — svelte auto-defines when <svelte:options customElement={{ tag }}> declares a tag, and a page can load two bundles containing the same component; first registration wins instead of throwing

    Entry points shrink to:

    import { defineElement } from "@svebcomponents/utils";
    import MyComponent from "./MyComponent.svelte";
    export default MyComponent;
    defineElement("my-component", MyComponent);

0.0.3

Patch Changes

  • 9be6326: Allow digits in isKebabCase so attribute names like col-2 or heading2 are correctly detected as attributes, fixing SSR/client markup divergence.
  • 724f00a: Declare supported Node versions (engines.node: ">=20.19.0") so consumers get a clear error instead of an opaque runtime failure on unsupported Node versions.
  • e7e4adf: Fix publint compliance: put the types export condition first so TypeScript resolves declarations as published, add files fields so tarballs only ship dist (and bin.js for the build package), and run publint as part of every publishable package’s build.
  • d2094d2: Remove the unused TODO() helper export and its README documentation. Nothing in the repo (or any published svebcomponents package) called it — it was dead code that only logged to the console. Strictly speaking, dropping an export is a breaking change, but the package is 0.x and the helper was documented as internal/experimental, so this ships as a patch.

0.0.2

Patch Changes

  • 8aa8512: fix: publish private utils dependency