Back to home page

EIC code displayed by LXR

 
 

    


Warning, /firebird/packages/firebird-example-extension/src/index.ts is written in an unsupported language. File is not indexed.

0001 /**
0002  * @dexvis/firebird-example-extension: the whole public surface is one
0003  * function.
0004  *
0005  * This package is the template for experiment extensions: a custom event
0006  * piece (model, worker-safe) and its painter (lazily loaded, three.js) with
0007  * a configurable ring color, all registered through the public
0008  * `provideFirebird()` API, with zero Firebird-internal imports.
0009  *
0010  * An app installs it with one line:
0011  *
0012  * ```ts
0013  * provideFirebird(withExampleCherenkov())
0014  * ```
0015  *
0016  * Try it: /display?dex=asset://data/example-cherenkov.firebird.json&event=2
0017  *
0018  * Settings belong to the painter: the ring color is a knob in the painter's
0019  * `static meta.configs`. Firebird turns it into the config key
0020  * `painters.byPiece.<pieceName>.ringColor` (for the sample:
0021  * `painters.byPiece.ExampleRings.ringColor`), shows it in the painter
0022  * panel, applies the normal config precedence (pack defaults < server
0023  * config.jsonc < saved choice < `?config.` URL value < runtime), and calls
0024  * the painter's `onConfigChanged()` on every change.
0025  */
0026 
0027 import {
0028   FirebirdFeature,
0029   firebirdPack,
0030   withEventPiece,
0031   withLazyPainter,
0032 } from '@dexvis/firebird-ng';
0033 import { CherenkovRingPiece, CherenkovRingPieceFactory } from './cherenkov-ring.piece';
0034 
0035 export { CherenkovRingPiece, CherenkovRingPieceFactory } from './cherenkov-ring.piece';
0036 
0037 export function withExampleCherenkov(): FirebirdFeature {
0038   return firebirdPack('example-cherenkov',
0039     // Model: teach DEX parsing the 'example.CherenkovRing' type
0040     withEventPiece(CherenkovRingPieceFactory),
0041 
0042     // Painter: lazily loaded, so three.js material code stays out of the initial bundle
0043     withLazyPainter(CherenkovRingPiece.type, () => import('./cherenkov-ring.painter').then(m => m.CherenkovRingPainter)),
0044   );
0045 }