Skip to content
Alpha

Hololink UI is under active development. Components, APIs and these docs may change without notice.

Contributing

This page covers working on Hololink UI itself. To use it in your app, see Installation.

You need Node.js ^22.18 || ^24.11 || >=26 (the Vite+ requirement; the repo pins Node 24, the current LTS, in .node-version) and pnpm 12.9.1 (set by packageManager in the root package.json). This applies to developing in this repo only; the published @philbob/hololink-ui library declares no engines and its runtime contract is unchanged.

Terminal window
git clone git@github.com:Philbob-SideProjects/holocron.git
cd holocron
nvm use # or any other way of getting Node 24
corepack enable # provides the pinned pnpm
pnpm install --frozen-lockfile
pnpm build:ui # the docs and Storybook need the built components

The workspace has two packages. packages/ui holds the components, and apps/docs holds this site.

Script What it does
pnpm dev:docs Starts the docs site with hot reload
pnpm storybook Starts Storybook on port 6006
pnpm build:ui Builds the components and regenerates custom-elements.json
pnpm build:docs Builds the docs site
pnpm build:site Builds the components, docs and Storybook into apps/docs/dist
pnpm test Runs the unit and browser component tests (Vitest)
pnpm typecheck Type-checks every package that has a typecheck script
pnpm check Runs format check and lint in one go via vp check; run pnpm build:ui first
pnpm format Formats everything with Oxfmt via vp fmt (pnpm format:check only checks)
pnpm lint Lints the code with Oxlint via vp lint
pnpm lint:probes Checks that every Stencil lint rule still fires (see below)
pnpm lint:design Lints DESIGN.md
pnpm changeset Writes a changeset

The docs site imports the built output in packages/ui/dist. Re-run pnpm build:ui after you change a component, then reload the docs.

The browser tests need Playwright’s Chromium. If pnpm test reports a missing browser, run pnpm --filter @philbob/hololink-ui exec playwright install chromium.

Vitest writes failure screenshots and attachments to .vitest/, which is gitignored, so a failing run leaves nothing to commit. __screenshots__/ is gitignored too. If you add visual baselines with toMatchScreenshot, add an explicit ! exception to packages/ui/.gitignore for the baseline directory and commit only the reference images, not failure output.

pnpm lint also runs the rules of @stencil/eslint-plugin (its configs.oxlint preset) on packages/ui/src/components/**/*.tsx, excluding tests and stories. All of them run at error severity. The rules are loaded as an Oxlint JS plugin, and Oxlint JS plugins are alpha, so the plugin version is pinned exactly.

  • Enabled: ban-default-true, ban-exported-const-enums, ban-prefix, ban-side-effects, decorators-context, decorators-style, dependency-suggestions, element-type, enforce-slot-jsdoc, host-data-deprecated, methods-must-be-public, no-unused-watch, own-methods-must-be-private, own-props-must-be-private, prefer-vdom-listener, props-must-be-public, required-jsdoc, reserved-member-names, single-export and strict-mutable.
  • Not enforced: async-methods, strict-boolean-conditions and render-returns-host need type information, which Oxlint JS plugins do not have, so they never report. Review these by hand: @Method() functions must be async, conditions should be explicit booleans, and render() should return a single <Host>.
  • Use @Element() host!: HTMLHoloThingElement (the tag-specific type), not HTMLElement.
  • Do not suppress a rule without a reason. If you must, add // oxlint-disable-line stencil/<rule> -- <reason> on the line. Existing suppressions on ban-default-true mark boolean props that default to true, which cannot change without a breaking release.
  • pnpm lint:probes lints one intentionally-invalid file per rule in scripts/lint-fixtures and fails if a rule stops firing. When you add a rule, add a fixture named after it.

Install the oxc VS Code extension for format-on-save and inline lint diagnostics. It reads the fmt and lint settings in the root vite.config.mts. Disable the Prettier extension for this repo, because it would format files differently from Oxfmt.

Read DESIGN.md first. It is the source of truth for tokens, accessibility and per-component styling.

  1. Generate the files from packages/ui:

    Terminal window
    cd packages/ui
    pnpm generate holo-thing

    Choose the stylesheet and spec/E2E options you want. Rename or delete any test file the generator creates so that it matches the conventions in step 2.

  2. Create these files in packages/ui/src/components/holo-thing/:

    File Purpose
    holo-thing.tsx The component. Tag prefix holo-, shadow: true.
    holo-thing.css Styles, scoped by Shadow DOM.
    holo-thing.stories.ts Storybook stories covering every variant and state.
    holo-thing.cmp.test.tsx Component tests (Vitest, @stencil/vitest).
    holo-thing.unit.test.ts Plain unit tests, if you have logic worth testing without the DOM.

    Look at holo-badge for a small, complete example.

  3. Follow the token rules in the CSS:

    • Consume --s-* semantic tokens only. Never use --p-* primitives or literal colours, pixel sizes, durations or shadows.
    • If no semantic token fits, add one to packages/ui/src/styles/settings/tokens.css and document it in DESIGN.md.
    • Expose styling hooks named --holo-<component>-<prop>, each with a semantic fallback: var(--holo-thing-bg, var(--s-color-bg-surface)).
    • Do not style by theme. Remap tokens instead of using [data-theme] or prefers-color-scheme.
  4. Document the API with JSDoc. Stencil reads the comments on @Prop(), @Event(), @Method() and the class, and writes them to custom-elements.json. Write each comment as a short sentence about what the member does and its allowed values.

    /** The visual style of the badge. */
    @Prop() variant: 'neutral' | 'success' = 'neutral';
  5. Add the package export in packages/ui/package.json, matching the tag name:

    "./holo-thing": {
    "types": "./dist/components/holo-thing.d.ts",
    "import": "./dist/components/holo-thing.js"
    }
  6. Add a docs page at apps/docs/src/content/docs/components/thing.mdx with live examples, a code block for each, and an API reference. Copy the structure of an existing page. Add the slug to the matching group in apps/docs/astro.config.mjs so it appears in the sidebar. The component status table picks up the new component automatically.

  7. Run pnpm build:ui, pnpm test, pnpm typecheck and pnpm build:docs.

Hololink UI targets WCAG 2.2 AA. Before you open a pull request:

  • Use native elements (<button>, <input>, <dialog>) and the Popover API where they fit, instead of rebuilding them from div and ARIA.
  • Forward labels and states through Shadow DOM: aria-invalid, aria-describedby, aria-disabled.
  • Keep focus visible with the focus ring from DESIGN.md. Never remove an outline without an equivalent replacement.
  • Open the component’s Storybook story and check the Accessibility panel (axe, WCAG 2.x A and AA rules) in both light and dark themes.
  • Do a keyboard-only pass: Tab, Shift+Tab, Enter, Space, Esc and arrow keys where relevant.
  • Respect prefers-reduced-motion.
  • If you add a colour pairing, add it to tokens.unit.test.ts so the contrast ratio is checked.

Any change that affects the published package needs a changeset. Docs-only changes do not.

Terminal window
pnpm changeset

Choose the bump type for @philbob/hololink-ui, then write the summary for a consumer: what changed, and what they must do. Commit the generated file in .changeset/ with your pull request. The package is below 1.0, so breaking changes go in a minor bump, and the summary must include migration steps.

The @hololink/docs app is private and is never versioned.

Pull requests to main run the checks workflow (.github/workflows/_checks.yml):

Job Checks
lint pnpm format:check (Oxfmt), pnpm lint:design, pnpm lint:probes, actionlint on the workflows, and changeset status against main (pull requests only)
typecheck pnpm build:ui, then pnpm check (vp check: Oxfmt format check and Oxlint, including the Stencil rules), then pnpm typecheck (tsc and astro check)
test pnpm test, with Playwright Chromium for the browser tests
build pnpm build:site, then confirms the package tarball contains the manifest, loader, bundles, types and styles

A pull request that touches the package without a changeset fails lint. Run pnpm format before you push; a format diff fails lint and typecheck, and a lint error fails typecheck (the job keeps its name so the required check name stays stable).

On pull requests, a preview job uploads a non-production Cloudflare Worker version and comments the preview URL. It is skipped for forks and Dependabot, and until the first production deploy exists.

  1. A pull request with a changeset merges to main.
  2. The on_merge workflow runs the same checks, deploys the docs and Storybook to Cloudflare Workers, and runs a smoke test against https://www.hololink-ui.co.uk.
  3. The release job opens or updates a pull request titled chore: version packages. It bumps the version and writes the entry in packages/ui/CHANGELOG.md, which feeds the changelog.
  4. Merging that pull request publishes @philbob/hololink-ui to the public npm registry, tags the release and creates a GitHub release.

If a docs deploy breaks production, run the rollback workflow from the Actions tab. It returns the Worker to the previous version, or to a version ID you give it. It does not unpublish packages.