Reference › Project
clarusjs 0.13.0
All releases · [email protected] on npm
Minor Changes
- Class forms:
[class.active]="on"toggles one class, and a bound[class]takes a string, an object (its truthy keys) or an array (falsy entries dropped, nested allowed), like clsx. All of an element's class sources merge, each class once, with the scope class, on the server and in islands;clarusjs checktypes them.classValue()is exported from the runtime. They used to compile toclass.activeand[object Object]. #408 - Built-in icons:
<icon name="lucide:rocket" />renders an inline SVG at build time from any Iconify set the project installs (pnpm add -D @iconify-json/lucide), with no JavaScript. It's 1em high with its width in proportion, takes the text colour, and isaria-hiddenunless labelled. The name must be static; a missing set or icon is an error atfile:line:colwith the closest names, in the build,clarusjs checkand the editor. The editor completes sets and icon names and previews an icon on hover; the MCPcompiletool resolves icons too. Newclarusjs/icons(Node only) reads the sets;CompileOptions.iconpasses them to the compiler. #387 - The sitemap lists each page's translations: its head's
<link rel="alternate" hreflang="…" href="…">tags become<xhtml:link>alternates with absolute URLs (and stay in the page). #401 - The sitemap lists each page's images with Google's image extension: every
<img>resolved to an absolute URL, except decorative ones (alt="") anddata:URLs.sitemap: { images: false }leaves them out. #397 sitemap: { include }adds URLs the build can't list (server and client routes): a list of paths, or a function returning one (async, to read them from a database at build time). #398- Past 50,000 URLs, the build splits the sitemap into
sitemap-1.xml,sitemap-2.xml… withsitemap.xmlas their index, so its address doesn't change. #400 - A page sets its own sitemap date:
<cl-head><meta name="sitemap:lastmod" content="2026-11-01"></cl-head>(orlastmod:in Markdown frontmatter) wins over the git date and is removed from the built page; a value that isn't a date fails the build, naming the page. #396 - Spread props onto a component with
[...]="props": every key is a prop, and props written on the tag win.clarusjs checktypes it against the child's inputs: the spread must provide the required inputs the tag doesn't write, with the right types. #412 - Spread attributes onto an element with
[...]="attrs". Attributes written on the element win (whatever the order or case), andclassandstylemerge, the spread's first. Each value is escaped and URL-checked like[attr]. Event handlers,srcdoc, invalid names, JSX names (className,htmlFor) and object values are dropped, with a warning naming the place. A spread is refused on elements that load things (iframe,frame,embed,object,base,link,meta). In islands it follows state, removing keys that disappear.{...x}and dotted names other thanclass./style.are now build errors instead of being written out. An emptyclassorstylevalue removes the attribute rather than writingclass="". #411 - Style forms:
[style.color]="c"(and custom properties,[style.--accent], or camelCase,[style.fontSize]) sets one property, removed when the value isnull,undefinedorfalse; a bound[style]takes an object (camelCase keys to kebab-case, no units added). They merge with a writtenstyle="…", on the server and in islands;clarusjs checktypes them.styleValue()is exported from the runtime. They used to compile tostyle.color="…"and[object Object]. #409
Patch Changes
vite previewserves the precompressed copies thatcompresswrites: the.brcopy, else the.gzone, that the browser'sAccept-Encodingaccepts (notq=0), withContent-Encoding, the original's type andVary: Accept-Encoding. A byte range, or a browser that accepts neither, gets the original. What preview sends now matches nginxgzip_static/ Caddyprecompressedwith the same build. #422- The README says how to pronounce clarusjs: KLAIR-us, from the Latin _clarus_, "clear, bright". #416
- A component's
<style scoped>reaches the content it passes to another component, such as a page's content inside its layout (<docs>…</docs>): when the component has a<style scoped>, the top-level elements of slot content (default and@slot('name')) get its scope class, as its own top-level elements do (without one, no class is added). Child components' roots keep their own class only. #420 .clarusjs/views.d.tswrites a type import from the built-in~/alias as a path from.clarusjs/(../src/…), so it resolves without apathsentry in tsconfig. #414