This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run start— Vite dev server on port 8000 with--watchrebuild, opens/demo/.npm run build— Production library build (ES module) todist/.npm run watch— Build only, watch mode.npm run types— Regeneratesrc/definition-schema.d.tsfromsrc/definition-schema.jsonviajson2ts(run after editing the schema).npm run analyze— Custom Elements Manifest analysis (@custom-elements-manifest/analyzer --litelement).npm run release— Build, regen types,npm version patch, push commit + tag (CI publishes on tag).npm run link/npm run unlink— Link/unlink against sibling../RESWARM/frontendfor local integration.
No test framework or linter is configured. Node >=24.9.0, npm >=10.0.2.
Single-file Lit 3 web component (src/widget-table.ts) wrapping @vaadin/grid (peer dependency, externalized in the bundle). The component is registered as widget-table-versionplaceholder; the Vite build replaces versionplaceholder with the package version via @rollup/plugin-replace, so the live tag is e.g. widget-table-1.1.17. Consumers must use the version-suffixed tag matching the installed package — this lets multiple widget versions coexist on one page in the IronFlock dashboard.
Build pipeline (vite.config.ts):
- Library mode, ES-only output, entry
src/widget-table.ts→dist/widget-table.js. - Externalizes
lit*,@lit*,@vaadin*so consumers provide them. tslibaliased totslib/tslib.es6.js;process.env.NODE_ENVdefined to"production".
The widget exposes two reactive properties consumed by the host dashboard:
inputData: InputData— typed bysrc/definition-schema.d.ts, generated fromsrc/definition-schema.json. The JSON schema is the source of truth for both the runtime type and the dashboard's config UI (note the non-standardorder,dataDrivenDisabled,condition.showIfValueIn, andcolor: truekeys consumed by the IronFlock config editor).theme: { theme_name, theme_object }— ECharts-style theme object.registerTheme()resolves colors with this precedence: CSS custom properties (--re-text-color,--re-tile-background-color,--re-hover-color,--re-border-color) on the host element overridetheme_objectvalues.
inputData.columns is column-oriented (each column carries its own values[]). transformInputData() pivots columns into row records keyed col_<index> for Vaadin Grid, then reverses (newest-first). Vaadin sort paths use col_<index>.value.
Cell rendering dispatches on column.type in renderCell(): string, number (with precision), boolean, state (parses stateMap string "'ONLINE': 'green', ..." into a colored .statusbox), button, image, timestamp. Timestamps use a hand-rolled Unicode LDML subset (yyyy MM dd HH mm ss SSS) — see parseTimestamp / formatTimestamp. If timestampParseFormat is empty, values are treated as Unix epoch milliseconds.
Text alignment is column-type-driven (getTextAlign): numbers/timestamps end, booleans/state/image center, others start.
demo/index.html builds the tag dynamically from package.json version using lit/static-html, applies demo/themes/light.json, and randomizes select cell values every 1s via the external ObjectRandomizer.js script — useful for verifying reactivity but means the demo will not run fully offline.
CI (.github/workflows/build-publish.yml) publishes to npm on any pushed tag. The standard flow is npm run release (patch bump). Because the custom element name embeds the version, every release ships a new tag name; do not hand-edit the versionplaceholder literal.