ShtukbaseStandard

Explore kit

explore-kit · version 0.1.2
Other

The control panel for exploration pages and lenses: a right side panel with foldable sections, presets, every control kind of the design control schema (select, segment, toggle, slider, colour dots, text), state kept in localStorage and the URL, reset and copy link. Plain JS and CSS on the token contract; the lens build copies it next to the lenses.

About the package

An exploration page tries a design in many variants: a card form, a cover, a radius, a glow colour. The explore kit gives such a page one standard panel for its settings, so every exploration looks and works the same, and a person can take the page and use it.

What it puts in the project:

  • /design/explore-kit/explore.js and /design/explore-kit/explore.css: the kit (plain JS and CSS, no dependencies);
  • /design/explore-kit/demo.html: the package map settings rebuilt with the panel, opened with a double click;
  • /base/explore.md: how to write an exploration page with the kit, with a minimal example.

The lenses build (0.3.4 and later) copies explore.js and explore.css into lib/ next to kit.js when the project has this package, so a lens links ../lib/explore.js the same way it links the lens kit.

The API

Explore.panel({
  title: 'Package map',
  target: document.documentElement,      // where values land: data-<name> and --x-<name> on this element
  storageKey: 'pkg-map',                 // localStorage; also read from and written to the URL (?<name>=<value>)
  sections: [{title: 'Cards', controls: {preset: {kind: 'select', options: [...]}}}],
  presets: {editorial: {preset: 'editorial', size: 'l'}},   // named bundles, shown as a first select
  onChange: (values) => {}
})

Controls follow the control schema of the design build contract: {kind, label?, options?, default?, min?, max?, step?, unit?, section?, colors?} with kind one of select, segment, bool, range, swatch, text. The details are in the page /base/explore.md (in the package: pages/base/explore.md).

Tests: bun test in the package (the schema, the state, the URL, storage and presets). The package has no norms or checks.

Pages 4

They go into the project at these paths.

Package files 2

They go into .shtukbase/packages/explore-kit/; actions run from there.