npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@texuli/blocks

v0.18.0

Published

Content blocks: closed vocabulary, untrusted guard, formula AST and catalog metadata for pages, documents and slides.

Readme

@texuli/blocks

Content blocks for pages, documents and slides: a closed vocabulary of typed JSON blocks (headings, rich text, columns, tabs, images, tables, KPIs, charts, maps, polls, code and more), an untrusted-input guard that validates them, framework-free engines and Svelte 5 renderers. It is built for content that comes from people or AI agents: anything that fails validation becomes an inert notice instead of reaching the page. It is part of Texuli, "Small pieces. Infinite possibilities.": an MIT Svelte 5 component library by Dailybot, Inc.

In the stack: layer L5, on the @texuli/core texels, the @texuli/tokens token engine, the texuli components and the @texuli/charts, @texuli/data and @texuli/media domain packages. The agent catalog, the player, @texuli/pages, @texuli/slides, @texuli/astro and @texuli/tools build on it.

Status: 0.x release. @texuli/blocks is published on npm as 0.18.0, a pre-1.0 release (1.0.0 will be the first stable release). Under 0.x, a new minor (0.14.0) may contain breaking changes, so pin the exact version or use ^0.18.0, which accepts only 0.18.x.

Install

npm install @texuli/blocks @texuli/tokens svelte
  • svelte (^5.57.2) is a peer dependency.
  • The renderers style themselves with the Texuli --tx-* design tokens. Import the token stylesheet once in your app (installing @texuli/tokens directly lets your bundler resolve it); each renderer imports its own CSS.
@import '@texuli/tokens/base.css';

Quick start

Validate untrusted JSON, then render the text family with its lazily loaded renderer:

<script lang="ts">
  import { isTextFamilyBlock, loadTextFamily, parseUntrustedBlocks } from '@texuli/blocks';

  // For example, JSON produced by an agent.
  let { input }: { input: string } = $props();

  const result = $derived(parseUntrustedBlocks(input));
</script>

{#if result.success}
  {#await loadTextFamily() then { default: TextBlockView }}
    {#each result.blocks.filter(isTextFamilyBlock) as block, index (index)}
      <TextBlockView {block} />
    {/each}
  {/await}
{:else}
  <p>This content could not be displayed.</p>
{/if}

With input set to [{"type":"heading","level":2,"text":"Release notes"},{"type":"text","markdown":"A **safe** paragraph."}], this renders an h2 and a paragraph. parseUntrustedBlocks accepts JSON text or objects, enforces size, depth and count limits, strips invisible and bidirectional control characters, and returns either the typed blocks or a list of issues. It never throws.

The package root exports a load*Family() renderer loader and a *_BLOCK_TYPES list for every family, plus check*Block guards and is*FamilyBlock narrowers for most of them.

What's inside

| Family | Block types | Imports | | --- | --- | --- | | Core | Schemas, limits, safety checks, the untrusted guard, text helpers and catalog metadata | @texuli/blocks, @texuli/blocks/core | | Formula | A closed calculator language: parser, AST, evaluator and formatter | @texuli/blocks/formula | | Text | heading, text, list, quote, callout | @texuli/blocks/text, @texuli/blocks/text/engine, @texuli/blocks/text/markdown, @texuli/blocks/text/renderers | | Structure | columns, grid, tabs, accordion, cards, divider, cta | @texuli/blocks/structure, @texuli/blocks/structure/engine, @texuli/blocks/structure/renderers | | Media | image, figure, video, gallery | @texuli/blocks/media, @texuli/blocks/media/engine, @texuli/blocks/media/renderers | | Embed | embed-app, link-preview | @texuli/blocks/embed, @texuli/blocks/embed/engine, @texuli/blocks/embed/renderers | | Interactive | poll, quiz, calculator, checklist | @texuli/blocks/interactive, @texuli/blocks/interactive/engine, @texuli/blocks/interactive/renderers | | Data | table, stat, kpi, chart (line, area, bar, stacked bar, combo, heatmap, scatter) | @texuli/blocks/data, @texuli/blocks/data/engine, @texuli/blocks/data/renderers | | Map | map: places and an optional route on an offline basemap | @texuli/blocks/map, @texuli/blocks/map/engine, @texuli/blocks/map/renderers | | Diagram | flow, tree, board and terminal diagrams | @texuli/blocks/diagram, @texuli/blocks/diagram/engine, @texuli/blocks/diagram/renderers | | Code | code, with syntax colors from an owned tokenizer | @texuli/blocks/code, @texuli/blocks/code/engine, @texuli/blocks/code/tokenizer, @texuli/blocks/code/renderers | | Code field | CodeField: an editable, syntax-highlighted textarea for forms (<CodeField bind:value language="ts" />; new in 0.13.1) | @texuli/blocks/code-field | | Labels | BLOCKS_MESSAGES_EN (every block label id and its English default) and the BlocksMessageId union, for one dictionary set near the root with setTexuliLabels or <LabelsProvider> from texuli (ADR-026) | @texuli/blocks/i18n | | Spanish labels | BLOCKS_LABELS_ES: every block label id in Spanish, opt-in, for <LabelsProvider> from texuli/i18n (from 0.14.3; no native-speaker review yet; see the texuli i18n guide) | @texuli/blocks/i18n/es |

In each family, the plain subpath is the light API (guards, labels, the lazy loader), /engine is framework-free logic, and /renderers gives you the Svelte views eagerly. @texuli/blocks/text/markdown is the owned Markdown subset parser.

The core vocabulary includes safeParseBlocks and safeParseBlock, parseUntrustedBlocks, BLOCK_LIMITS, BLOCK_CATALOG with validateBlocksForAuthoring (metadata for builders and agents), and the text helpers walkBlocks, blockText and headingOutline.

New in 0.13.1

  • CodeField (@texuli/blocks/code-field): an editable, syntax-highlighted code field, <CodeField bind:value language="ts" />. A real textarea (caret, selection, undo, form value) sits over the owned tokenizer's output, printed as elements. Tab indents; Escape, then Tab, leaves the field. It renders highlighted on the server, and turns highlighting off past 20,000 characters (code).

New in 0.9.0

  • tree diagrams take variant, not style (variant: 'file-tree' | 'org'). The untrusted draft scan refuses every style key, so a tree block could never pass blueprint validation for an agent. The parser accepts style as an alias through 0.9.x and returns variant; sending both with different values is refused. From 0.10.0 style is refused with "style was removed in 0.10.0; send variant". The list block's optional style has the same limit (agents can send lists without it) and is not renamed yet.
  • Design-system tokens: the block stylesheets read the token contract v2 system tokens (--tx-space-*, --tx-shape-radius-*, --tx-type-*) with the visual-baseline pixels unchanged; code and structure keep their literals because they also render inside deck themes (see scripts/check-token-usage.ts).

New in 0.6.0

Ships in 0.6.0; the 0.5.0 release predates it: the packed declarations of the diagram and interactive block components type-check for consumers (no self-named imports, TS2440), and the structure renderers carry the styled components' API contract and motion. No API change.

New in 0.5.0

Ships in 0.5.0; the 0.4.0 release predates it:

  • Text family: heading align; text align and size; list style (bullet, number, check with per-item done, icon with per-item icon); quote role and avatar; callout icon (text).
  • Structure family: card icon; divider label and variant: "space". The text and structure family views take the host resolvers resolveIcon?(name) and resolveAvatar?(id) (quote avatars pass safeImageSrc), and the structure view passes them to nested blocks (structure).
  • Data family: stat title and source, and a per-item trend sparkline on stat and kpi (data).
  • Code: header and toolbar snippets on the code block bar (code).
  • Linear-time Markdown. @texuli/blocks/text/markdown reads heading, fence and rule lines and inline markers without backtracking, so hostile agent text parses in linear time; U+2028 and U+2029 end a line.

Key guarantees

  • Untrusted by design. Every block passes an owned runtime validator before anything renders; a rejected block becomes an inert, translatable notice.
  • No HTML sinks. Markdown, code and every other block render as Svelte text and elements, never through {@html}. Raw tags in Markdown stay literal text.
  • URL policy on every link. Links, calls to action and link previews pass safeHref at the untrusted tier. Block media accepts only avatar ids, small inline data: images and videos, and relative paths; remote URLs are refused at parse time.
  • No code execution. Formulas are closed JSON ASTs that are parsed, evaluated and formatted, never run as code. Embed apps start only after the user activates them, inside a host-provided mount, and link previews never fetch.
  • No network from maps. The map block draws on an offline, fictional basemap; it never loads tiles or geocodes.
  • Trojan Source safe. Bidirectional overrides and invisible control characters are stripped or refused.

Documentation

Contributing

Contributions are welcome; start at the GitHub repository.

License

MIT © Dailybot, Inc. Powered by Dailybot.