Universe

Read the manual Example PDF Example source code Changelog file Contribute with development

Brief Showcase

#import "@preview/nexus-tools:0.3.0": *

#let size = default(when: size == 11pt, value: 12pt, true)
#content2str[ *Foo* #emph[Bar] Baz ]

#storage.namespace("name")
#storage.add("three", 3)
#storage.remove("three")
#context storage.get("three")
#context storage.final()
#storage.reset((:))

#comp.url("https://example.com")
#comp.pkg("https://repo.com/pkg-name")
#comp.callout(title: "Title", lorem(50))

#get.null
#get.auto-val(auto, "Replace auto")
#get.date(2026, 8, 18)
#get.date-diff("2000-01-01", "2026-08-18")
#get.relative-luminance(blue)
#get.dynamic-color(red)

#has.field([A B], "text")
#has.key((foo: 1), "foo")
#has.item((0, 1), 1)

#its.none-val(none)
#its.null(get.null)
#its.empty("")
#its.context-val(context())
#its.sequence[*A* _B_]
#its.space[ ]
#its.func([*Strong*], strong)
#its.type("String", str)

Description

Gain development agility by using carefully curated, useful features, such as data storage or custom defaults. This library was created as part of the development of my other Typst projects; it contains functionality shared across multiple projects that would otherwise need to be maintained and updated individually, but is now centralized in a single place. This is not intended to be a full-fledged development toolset — although someday it might end up becoming that —, but rather a compartmentalization of shared resources and a repository of potentially useful development feature.

Feature List

  • Custom defaults that can be overridden by set rules
  • General data storage
    • Storage compartmentalization (namespaces)
    • Add, append, and remove data
    • Retrieve individual data or whole namespaces
    • Reset namespaces
  • Visual components
    • Paper-friendly links (attached to footnotes)
    • General package URLs
    • Customizable callout box
  • Get Typst values
    • Generate datetime using arguments, array, or dictionary
    • Calculate time between two dates
    • Null value
    • Replacement of auto values
    • Relative luminance of a color
    • Dynamic colors based on relative luminance
  • Attribute checks
    • Content fields
    • Dictionary keys
    • Dictionary values
    • Array items
  • Specific tests
    • None values
    • Null values
    • Empty values
    • Context values
    • Content sequences
    • Content spaces
    • Content functions
    • Any value types

Internal Structure

YAML module structure

This is a YAML representation of the package internal structure and all its features.