Publishing a library

A package written on cssints ships JavaScript that still has the attribute, and its .d.ts. The app that installs it evaluates the package with its own engine: one sheet, the app's browserslist and themes, and a token, a kernel or an @property of the package is made once however many modules use it. Nothing is declared: the engine recognises a file by with { type: "cssints" }, the same marker as in app code.

// src/index.ts of the library
import { bg, cn, cv, hover, p } from "cssints" with { type: "cssints" };

import { t } from "./tokens.ts" with { type: "cssints" };

export { t };
export const card = cn(p(4), bg(t.color.brand));
export const button = cv({ base: cn(p(2), hover(bg("#1d4ed8"))) });
// in the app: the style is a class string, the token is imported with the attribute to be used or themed
import { createGlobalTheme } from "cssints" with { type: "cssints" };
import { button, card } from "my-ui";
import { t } from "my-ui" with { type: "cssints" };

createGlobalTheme(t, ".dark", { color: { brand: "#ef4444" } });