@f-ewald/components 1.43.0 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,296 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, css, html } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { tokens } from "./tokens.js";
10
+ /**
11
+ * The classic 8-bit fire ramp, from cold (index 0, drawn transparent) to the
12
+ * white-hot base. Literal colors by design: the retro palette is the effect
13
+ * and stays independent of the theme.
14
+ */
15
+ const PALETTE = [
16
+ [0x07, 0x07, 0x07], [0x1f, 0x07, 0x07], [0x2f, 0x0f, 0x07], [0x47, 0x0f, 0x07],
17
+ [0x57, 0x17, 0x07], [0x67, 0x1f, 0x07], [0x77, 0x1f, 0x07], [0x8f, 0x27, 0x07],
18
+ [0x9f, 0x2f, 0x07], [0xaf, 0x3f, 0x07], [0xbf, 0x47, 0x07], [0xc7, 0x47, 0x07],
19
+ [0xdf, 0x4f, 0x07], [0xdf, 0x57, 0x07], [0xdf, 0x57, 0x07], [0xd7, 0x5f, 0x07],
20
+ [0xd7, 0x5f, 0x07], [0xd7, 0x67, 0x0f], [0xcf, 0x6f, 0x0f], [0xcf, 0x77, 0x0f],
21
+ [0xcf, 0x7f, 0x0f], [0xcf, 0x87, 0x17], [0xc7, 0x87, 0x17], [0xc7, 0x8f, 0x17],
22
+ [0xc7, 0x97, 0x1f], [0xbf, 0x9f, 0x1f], [0xbf, 0x9f, 0x1f], [0xbf, 0xa7, 0x27],
23
+ [0xbf, 0xa7, 0x27], [0xbf, 0xaf, 0x2f], [0xb7, 0xaf, 0x2f], [0xb7, 0xb7, 0x2f],
24
+ [0xb7, 0xb7, 0x37], [0xcf, 0xcf, 0x6f], [0xdf, 0xdf, 0x9f], [0xef, 0xef, 0xc7],
25
+ [0xff, 0xff, 0xff],
26
+ ];
27
+ const MAX_HEAT = PALETTE.length - 1;
28
+ /** Fraction of the strip's height the tallest flames reach at full intensity. */
29
+ const FLAME_REACH = 0.8;
30
+ /** Simulation steps per second; the low rate is part of the retro look. */
31
+ const STEPS_PER_SECOND = 30;
32
+ const STEP_MS = 1000 / STEPS_PER_SECOND;
33
+ /** Share of cooling that follows the rising cooling map rather than per-cell noise. */
34
+ const MAP_WEIGHT = 0.7;
35
+ /** Coldest palette steps, which fade in from transparent so flame tips read as smoke. */
36
+ const SMOKE_STEPS = 6;
37
+ /**
38
+ * Builds a smooth, high-contrast noise field with a mean of `0.5`. It wraps
39
+ * vertically so it can scroll upward with the flames, carving them into
40
+ * rising tongues.
41
+ */
42
+ function coolingMap(cols, rows) {
43
+ let map = new Float32Array(cols * rows);
44
+ for (let i = 0; i < map.length; i++)
45
+ map[i] = Math.random();
46
+ for (let pass = 0; pass < 4; pass++)
47
+ map = blur(map, cols, rows);
48
+ let min = Infinity;
49
+ let max = -Infinity;
50
+ for (const value of map) {
51
+ min = Math.min(min, value);
52
+ max = Math.max(max, value);
53
+ }
54
+ const range = max - min || 1;
55
+ let sum = 0;
56
+ for (let i = 0; i < map.length; i++) {
57
+ map[i] = ((map[i] - min) / range) ** 2;
58
+ sum += map[i];
59
+ }
60
+ const scale = (0.5 * map.length) / (sum || 1);
61
+ for (let i = 0; i < map.length; i++)
62
+ map[i] *= scale;
63
+ return map;
64
+ }
65
+ /** 3×3 box blur that clamps horizontally and wraps vertically. */
66
+ function blur(source, cols, rows) {
67
+ const out = new Float32Array(source.length);
68
+ for (let y = 0; y < rows; y++) {
69
+ for (let x = 0; x < cols; x++) {
70
+ let sum = 0;
71
+ for (let dy = -1; dy <= 1; dy++) {
72
+ const row = ((y + dy + rows) % rows) * cols;
73
+ for (let dx = -1; dx <= 1; dx++) {
74
+ sum += source[row + Math.min(cols - 1, Math.max(0, x + dx))];
75
+ }
76
+ }
77
+ out[y * cols + x] = sum / 9;
78
+ }
79
+ }
80
+ return out;
81
+ }
82
+ /**
83
+ * Pixelated, 8-bit style fire in the manner of old computer games. By default
84
+ * it is pinned full width to the bottom of the viewport as a decorative,
85
+ * click-through overlay; `contained` pins it to the bottom of the nearest
86
+ * positioned ancestor instead.
87
+ *
88
+ * The strip's height is set with `--pixel-fire-height` (default `8rem`). It
89
+ * paints at `z-index: 30`, above ordinary page content but below `app-shell`'s
90
+ * chrome and every dialog or popover. Under `prefers-reduced-motion: reduce`
91
+ * it draws one still frame instead of animating. The canvas is hidden from
92
+ * assistive technology.
93
+ *
94
+ * @element pixel-fire
95
+ */
96
+ let PixelFire = class PixelFire extends LitElement {
97
+ constructor() {
98
+ super(...arguments);
99
+ /** Size of one fire pixel in CSS pixels; larger values look chunkier. */
100
+ this.pixelSize = 4;
101
+ /**
102
+ * Heat of the fire's source, from `0` to `1`. Lowering it shortens the
103
+ * flames; `0` lets the fire burn out.
104
+ */
105
+ this.intensity = 1;
106
+ /**
107
+ * Pins the fire to the bottom of the nearest positioned ancestor instead of
108
+ * the viewport.
109
+ */
110
+ this.contained = false;
111
+ this._cols = 0;
112
+ this._rows = 0;
113
+ this._heat = new Float32Array(0);
114
+ this._cooling = new Float32Array(0);
115
+ this._time = 0;
116
+ this._lastStep = 0;
117
+ /** Rebuilds the fire grid to cover the host's current box, then restarts it. */
118
+ this._resize = () => {
119
+ const canvas = this._canvas;
120
+ if (!canvas)
121
+ return;
122
+ const size = this._cellSize;
123
+ const cols = Math.ceil(this.clientWidth / size);
124
+ const rows = Math.ceil(this.clientHeight / size);
125
+ this._cols = cols;
126
+ this._rows = rows;
127
+ this._heat = new Float32Array(cols * rows);
128
+ this._cooling = coolingMap(cols, rows);
129
+ canvas.width = cols;
130
+ canvas.height = rows;
131
+ canvas.style.width = `${cols * size}px`;
132
+ canvas.style.height = `${rows * size}px`;
133
+ this._image = cols > 0 && rows > 0 ? new ImageData(cols, rows) : undefined;
134
+ this._restart();
135
+ };
136
+ /** Animates the fire, or draws one settled frame under reduced motion. */
137
+ this._restart = () => {
138
+ this._stop();
139
+ if (!this._image)
140
+ return;
141
+ if (this._motionQuery?.matches) {
142
+ for (let i = 0; i < this._rows * 2; i++)
143
+ this._step();
144
+ this._draw();
145
+ return;
146
+ }
147
+ this._frame = window.requestAnimationFrame(this._tick);
148
+ };
149
+ this._tick = (time) => {
150
+ this._frame = undefined;
151
+ if (time - this._lastStep >= STEP_MS) {
152
+ this._lastStep = time;
153
+ const burning = this._step();
154
+ this._draw();
155
+ if (!burning)
156
+ return;
157
+ }
158
+ this._frame = window.requestAnimationFrame(this._tick);
159
+ };
160
+ }
161
+ static { this.styles = [
162
+ tokens,
163
+ css `
164
+ :host {
165
+ display: block;
166
+ position: fixed;
167
+ inset: auto 0 0 0;
168
+ z-index: 30;
169
+ height: var(--pixel-fire-height, 8rem);
170
+ overflow: hidden;
171
+ pointer-events: none;
172
+ }
173
+
174
+ :host([contained]) {
175
+ position: absolute;
176
+ }
177
+
178
+ :host([hidden]) {
179
+ display: none;
180
+ }
181
+
182
+ canvas {
183
+ position: absolute;
184
+ left: 0;
185
+ bottom: 0;
186
+ display: block;
187
+ image-rendering: pixelated;
188
+ }
189
+ `,
190
+ ]; }
191
+ connectedCallback() {
192
+ super.connectedCallback();
193
+ this._motionQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
194
+ this._motionQuery.addEventListener("change", this._restart);
195
+ this._resizeObserver = new ResizeObserver(this._resize);
196
+ this._resizeObserver.observe(this);
197
+ }
198
+ disconnectedCallback() {
199
+ super.disconnectedCallback();
200
+ this._motionQuery?.removeEventListener("change", this._restart);
201
+ this._motionQuery = undefined;
202
+ this._resizeObserver?.disconnect();
203
+ this._resizeObserver = undefined;
204
+ this._stop();
205
+ }
206
+ firstUpdated() {
207
+ this._resize();
208
+ }
209
+ updated(changed) {
210
+ if (changed.has("pixelSize") && changed.get("pixelSize") !== undefined) {
211
+ this._resize();
212
+ return;
213
+ }
214
+ if (changed.has("intensity") && changed.get("intensity") !== undefined) {
215
+ this._restart();
216
+ }
217
+ }
218
+ render() {
219
+ return html `<canvas aria-hidden="true"></canvas>`;
220
+ }
221
+ get _canvas() {
222
+ return this.renderRoot.querySelector("canvas");
223
+ }
224
+ get _cellSize() {
225
+ return Math.max(1, Math.round(this.pixelSize) || 1);
226
+ }
227
+ get _sourceHeat() {
228
+ const intensity = Number.isFinite(this.intensity) ? this.intensity : 1;
229
+ return Math.min(1, Math.max(0, intensity)) * MAX_HEAT;
230
+ }
231
+ _stop() {
232
+ if (this._frame === undefined)
233
+ return;
234
+ window.cancelAnimationFrame(this._frame);
235
+ this._frame = undefined;
236
+ }
237
+ /**
238
+ * Advances the fire one step: the bottom row is fed with heat and every cell
239
+ * rises one row, drifting sideways and cooling at random.
240
+ *
241
+ * @returns Whether any cell is still burning.
242
+ */
243
+ _step() {
244
+ const cols = this._cols;
245
+ const rows = this._rows;
246
+ const heat = this._heat;
247
+ const cooling = this._cooling;
248
+ const meanCooling = MAX_HEAT / Math.max(1, (rows - 1) * FLAME_REACH);
249
+ this._time = (this._time + 1) % rows;
250
+ heat.fill(this._sourceHeat, (rows - 1) * cols);
251
+ for (let y = 0; y < rows - 1; y++) {
252
+ const mapRow = ((y + this._time) % rows) * cols;
253
+ for (let x = 0; x < cols; x++) {
254
+ const below = heat[(y + 1) * cols + x];
255
+ const drift = Math.min(cols - 1, Math.max(0, x + Math.round(Math.random() * 2 - 1)));
256
+ const local = MAP_WEIGHT * cooling[mapRow + x] + (1 - MAP_WEIGHT) * Math.random();
257
+ heat[y * cols + drift] = Math.max(0, below - 2 * meanCooling * local);
258
+ }
259
+ }
260
+ // Cells no drift landed on keep their old heat, so scan the whole grid.
261
+ return heat.some((value) => value > 0);
262
+ }
263
+ /** Paints the heat grid to the canvas through the palette. */
264
+ _draw() {
265
+ const image = this._image;
266
+ const context = this._canvas?.getContext("2d");
267
+ if (!image || !context)
268
+ return;
269
+ const data = image.data;
270
+ const heat = this._heat;
271
+ for (let i = 0; i < heat.length; i++) {
272
+ const index = Math.min(MAX_HEAT, Math.floor(heat[i]));
273
+ const [r, g, b] = PALETTE[index];
274
+ const offset = i * 4;
275
+ data[offset] = r;
276
+ data[offset + 1] = g;
277
+ data[offset + 2] = b;
278
+ data[offset + 3] = Math.min(255, Math.round((255 * index) / SMOKE_STEPS));
279
+ }
280
+ context.putImageData(image, 0, 0);
281
+ }
282
+ };
283
+ __decorate([
284
+ property({ type: Number, attribute: "pixel-size" })
285
+ ], PixelFire.prototype, "pixelSize", void 0);
286
+ __decorate([
287
+ property({ type: Number })
288
+ ], PixelFire.prototype, "intensity", void 0);
289
+ __decorate([
290
+ property({ type: Boolean, reflect: true })
291
+ ], PixelFire.prototype, "contained", void 0);
292
+ PixelFire = __decorate([
293
+ customElement("pixel-fire")
294
+ ], PixelFire);
295
+ export { PixelFire };
296
+ //# sourceMappingURL=pixel-fire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixel-fire.js","sourceRoot":"","sources":["../src/pixel-fire.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;GAIG;AACH,MAAM,OAAO,GAAqD;IAChE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EA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;YACjC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACrB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACrB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAxMC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;4CAC9B;AAOtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACL;AAOtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAChB;AAjBhB,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA2MrB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * The classic 8-bit fire ramp, from cold (index 0, drawn transparent) to the\n * white-hot base. Literal colors by design: the retro palette is the effect\n * and stays independent of the theme.\n */\nconst PALETTE: ReadonlyArray<readonly [number, number, number]> = [\n [0x07, 0x07, 0x07], [0x1f, 0x07, 0x07], [0x2f, 0x0f, 0x07], [0x47, 0x0f, 0x07],\n [0x57, 0x17, 0x07], [0x67, 0x1f, 0x07], [0x77, 0x1f, 0x07], [0x8f, 0x27, 0x07],\n [0x9f, 0x2f, 0x07], [0xaf, 0x3f, 0x07], [0xbf, 0x47, 0x07], [0xc7, 0x47, 0x07],\n [0xdf, 0x4f, 0x07], [0xdf, 0x57, 0x07], [0xdf, 0x57, 0x07], [0xd7, 0x5f, 0x07],\n [0xd7, 0x5f, 0x07], [0xd7, 0x67, 0x0f], [0xcf, 0x6f, 0x0f], [0xcf, 0x77, 0x0f],\n [0xcf, 0x7f, 0x0f], [0xcf, 0x87, 0x17], [0xc7, 0x87, 0x17], [0xc7, 0x8f, 0x17],\n [0xc7, 0x97, 0x1f], [0xbf, 0x9f, 0x1f], [0xbf, 0x9f, 0x1f], [0xbf, 0xa7, 0x27],\n [0xbf, 0xa7, 0x27], [0xbf, 0xaf, 0x2f], [0xb7, 0xaf, 0x2f], [0xb7, 0xb7, 0x2f],\n [0xb7, 0xb7, 0x37], [0xcf, 0xcf, 0x6f], [0xdf, 0xdf, 0x9f], [0xef, 0xef, 0xc7],\n [0xff, 0xff, 0xff],\n];\nconst MAX_HEAT = PALETTE.length - 1;\n/** Fraction of the strip's height the tallest flames reach at full intensity. */\nconst FLAME_REACH = 0.8;\n/** Simulation steps per second; the low rate is part of the retro look. */\nconst STEPS_PER_SECOND = 30;\nconst STEP_MS = 1000 / STEPS_PER_SECOND;\n/** Share of cooling that follows the rising cooling map rather than per-cell noise. */\nconst MAP_WEIGHT = 0.7;\n/** Coldest palette steps, which fade in from transparent so flame tips read as smoke. */\nconst SMOKE_STEPS = 6;\n\n/**\n * Builds a smooth, high-contrast noise field with a mean of `0.5`. It wraps\n * vertically so it can scroll upward with the flames, carving them into\n * rising tongues.\n */\nfunction coolingMap(cols: number, rows: number): Float32Array {\n let map: Float32Array = new Float32Array(cols * rows);\n for (let i = 0; i < map.length; i++) map[i] = Math.random();\n for (let pass = 0; pass < 4; pass++) map = blur(map, cols, rows);\n let min = Infinity;\n let max = -Infinity;\n for (const value of map) {\n min = Math.min(min, value);\n max = Math.max(max, value);\n }\n const range = max - min || 1;\n let sum = 0;\n for (let i = 0; i < map.length; i++) {\n map[i] = ((map[i] - min) / range) ** 2;\n sum += map[i];\n }\n const scale = (0.5 * map.length) / (sum || 1);\n for (let i = 0; i < map.length; i++) map[i] *= scale;\n return map;\n}\n\n/** 3×3 box blur that clamps horizontally and wraps vertically. */\nfunction blur(source: Float32Array, cols: number, rows: number): Float32Array {\n const out = new Float32Array(source.length);\n for (let y = 0; y < rows; y++) {\n for (let x = 0; x < cols; x++) {\n let sum = 0;\n for (let dy = -1; dy <= 1; dy++) {\n const row = ((y + dy + rows) % rows) * cols;\n for (let dx = -1; dx <= 1; dx++) {\n sum += source[row + Math.min(cols - 1, Math.max(0, x + dx))];\n }\n }\n out[y * cols + x] = sum / 9;\n }\n }\n return out;\n}\n\n/**\n * Pixelated, 8-bit style fire in the manner of old computer games. By default\n * it is pinned full width to the bottom of the viewport as a decorative,\n * click-through overlay; `contained` pins it to the bottom of the nearest\n * positioned ancestor instead.\n *\n * The strip's height is set with `--pixel-fire-height` (default `8rem`). It\n * paints at `z-index: 30`, above ordinary page content but below `app-shell`'s\n * chrome and every dialog or popover. Under `prefers-reduced-motion: reduce`\n * it draws one still frame instead of animating. The canvas is hidden from\n * assistive technology.\n *\n * @element pixel-fire\n */\n@customElement(\"pixel-fire\")\nexport class PixelFire extends LitElement {\n /** Size of one fire pixel in CSS pixels; larger values look chunkier. */\n @property({ type: Number, attribute: \"pixel-size\" })\n pixelSize: number = 4;\n\n /**\n * Heat of the fire's source, from `0` to `1`. Lowering it shortens the\n * flames; `0` lets the fire burn out.\n */\n @property({ type: Number })\n intensity: number = 1;\n\n /**\n * Pins the fire to the bottom of the nearest positioned ancestor instead of\n * the viewport.\n */\n @property({ type: Boolean, reflect: true })\n contained: boolean = false;\n\n private _cols = 0;\n private _rows = 0;\n private _heat = new Float32Array(0);\n private _cooling: Float32Array = new Float32Array(0);\n private _time = 0;\n private _image?: ImageData;\n private _frame?: number;\n private _lastStep = 0;\n private _resizeObserver?: ResizeObserver;\n private _motionQuery?: MediaQueryList;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n position: fixed;\n inset: auto 0 0 0;\n z-index: 30;\n height: var(--pixel-fire-height, 8rem);\n overflow: hidden;\n pointer-events: none;\n }\n\n :host([contained]) {\n position: absolute;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n canvas {\n position: absolute;\n left: 0;\n bottom: 0;\n display: block;\n image-rendering: pixelated;\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._motionQuery = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n this._motionQuery.addEventListener(\"change\", this._restart);\n this._resizeObserver = new ResizeObserver(this._resize);\n this._resizeObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._motionQuery?.removeEventListener(\"change\", this._restart);\n this._motionQuery = undefined;\n this._resizeObserver?.disconnect();\n this._resizeObserver = undefined;\n this._stop();\n }\n\n protected override firstUpdated(): void {\n this._resize();\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n if (changed.has(\"pixelSize\") && changed.get(\"pixelSize\") !== undefined) {\n this._resize();\n return;\n }\n if (changed.has(\"intensity\") && changed.get(\"intensity\") !== undefined) {\n this._restart();\n }\n }\n\n override render() {\n return html`<canvas aria-hidden=\"true\"></canvas>`;\n }\n\n private get _canvas(): HTMLCanvasElement | null {\n return this.renderRoot.querySelector(\"canvas\");\n }\n\n private get _cellSize(): number {\n return Math.max(1, Math.round(this.pixelSize) || 1);\n }\n\n private get _sourceHeat(): number {\n const intensity = Number.isFinite(this.intensity) ? this.intensity : 1;\n return Math.min(1, Math.max(0, intensity)) * MAX_HEAT;\n }\n\n /** Rebuilds the fire grid to cover the host's current box, then restarts it. */\n private readonly _resize = (): void => {\n const canvas = this._canvas;\n if (!canvas) return;\n const size = this._cellSize;\n const cols = Math.ceil(this.clientWidth / size);\n const rows = Math.ceil(this.clientHeight / size);\n this._cols = cols;\n this._rows = rows;\n this._heat = new Float32Array(cols * rows);\n this._cooling = coolingMap(cols, rows);\n canvas.width = cols;\n canvas.height = rows;\n canvas.style.width = `${cols * size}px`;\n canvas.style.height = `${rows * size}px`;\n this._image = cols > 0 && rows > 0 ? new ImageData(cols, rows) : undefined;\n this._restart();\n };\n\n /** Animates the fire, or draws one settled frame under reduced motion. */\n private readonly _restart = (): void => {\n this._stop();\n if (!this._image) return;\n if (this._motionQuery?.matches) {\n for (let i = 0; i < this._rows * 2; i++) this._step();\n this._draw();\n return;\n }\n this._frame = window.requestAnimationFrame(this._tick);\n };\n\n private _stop(): void {\n if (this._frame === undefined) return;\n window.cancelAnimationFrame(this._frame);\n this._frame = undefined;\n }\n\n private readonly _tick = (time: number): void => {\n this._frame = undefined;\n if (time - this._lastStep >= STEP_MS) {\n this._lastStep = time;\n const burning = this._step();\n this._draw();\n if (!burning) return;\n }\n this._frame = window.requestAnimationFrame(this._tick);\n };\n\n /**\n * Advances the fire one step: the bottom row is fed with heat and every cell\n * rises one row, drifting sideways and cooling at random.\n *\n * @returns Whether any cell is still burning.\n */\n private _step(): boolean {\n const cols = this._cols;\n const rows = this._rows;\n const heat = this._heat;\n const cooling = this._cooling;\n const meanCooling = MAX_HEAT / Math.max(1, (rows - 1) * FLAME_REACH);\n this._time = (this._time + 1) % rows;\n\n heat.fill(this._sourceHeat, (rows - 1) * cols);\n for (let y = 0; y < rows - 1; y++) {\n const mapRow = ((y + this._time) % rows) * cols;\n for (let x = 0; x < cols; x++) {\n const below = heat[(y + 1) * cols + x];\n const drift = Math.min(cols - 1, Math.max(0, x + Math.round(Math.random() * 2 - 1)));\n const local = MAP_WEIGHT * cooling[mapRow + x] + (1 - MAP_WEIGHT) * Math.random();\n heat[y * cols + drift] = Math.max(0, below - 2 * meanCooling * local);\n }\n }\n // Cells no drift landed on keep their old heat, so scan the whole grid.\n return heat.some((value) => value > 0);\n }\n\n /** Paints the heat grid to the canvas through the palette. */\n private _draw(): void {\n const image = this._image;\n const context = this._canvas?.getContext(\"2d\");\n if (!image || !context) return;\n const data = image.data;\n const heat = this._heat;\n for (let i = 0; i < heat.length; i++) {\n const index = Math.min(MAX_HEAT, Math.floor(heat[i]));\n const [r, g, b] = PALETTE[index];\n const offset = i * 4;\n data[offset] = r;\n data[offset + 1] = g;\n data[offset + 2] = b;\n data[offset + 3] = Math.min(255, Math.round((255 * index) / SMOKE_STEPS));\n }\n context.putImageData(image, 0, 0);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pixel-fire\": PixelFire;\n }\n}\n"]}
@@ -20,7 +20,10 @@ Supports two suggestion sources:
20
20
 
21
21
  Each option may also carry a pre-rendered `icon` (shown before the value)
22
22
  and a `description` (a smaller, muted line under the value); options
23
- without them render as a plain value.
23
+ without them render as a plain value. The selected option's icon also
24
+ shows inside the field until the text is edited. Picking an option sets
25
+ `selectedKey`; set `selectedKey` and `value` together to show a selection
26
+ made elsewhere.
24
27
 
25
28
  Set `clearable` to show an in-field clear action whenever a value is
26
29
  present.
@@ -66,7 +69,8 @@ import "@f-ewald/components/autocomplete-input.js";
66
69
  | `debounce` | `debounce` | `number` | `300` | Debounce delay (ms) before firing a request/filter after typing. |
67
70
  | `minLength` | `min-length` | `number` | `3` | Minimum query length before suggestions are shown. |
68
71
  | `options` | _(JS property only)_ | `AutocompleteOption[] | null` | `null` | Fixed candidate list to filter locally instead of fetching from `endpoint`. When set (non-null), no network request is ever made — this takes priority over the API mode. |
69
- | `selectedOption` | _(JS property only)_ | `AutocompleteOption | null` | `—` | Last-picked option, or null once the input diverges from it. _(read-only)_ |
72
+ | `selectedKey` | `selected-key` | `string | null` | `null` | Key of the selected option: set by picking one, or by the caller together with `value`. |
73
+ | `selectedOption` | _(JS property only)_ | `AutocompleteOption | null` | `—` | Selected option (picked, or matching `selectedKey`), or null once the input diverges from it. _(read-only)_ |
70
74
 
71
75
  ## Events
72
76
 
@@ -70,9 +70,9 @@ defines the details used when creating or reviewing components.
70
70
  - Plain SVG presentation attributes may use literal token fallback values when
71
71
  CSS variables are not practical. User-provided marker/chart colors are an
72
72
  explicit exception.
73
- - White map rings, image-overlay controls, avatar foregrounds, and celebratory
74
- confetti may remain literal when their contrast is intentionally independent
75
- of the surrounding theme.
73
+ - White map rings, image-overlay controls, avatar foregrounds, celebratory
74
+ confetti, and `pixel-fire`'s retro fire palette may remain literal when their
75
+ contrast is intentionally independent of the surrounding theme.
76
76
  - There is no dedicated secondary accent color. `tab-bar`'s inactive-tab
77
77
  indicator reuses `--ui-border` (a shared line beneath the whole strip, with
78
78
  the active tab's `--ui-primary` line drawn on top of it) rather than
@@ -0,0 +1,51 @@
1
+ # `<pixel-fire>`
2
+
3
+ Pixelated, 8-bit style fire in the manner of old computer games. By default
4
+ it is pinned full width to the bottom of the viewport as a decorative,
5
+ click-through overlay; `contained` pins it to the bottom of the nearest
6
+ positioned ancestor instead.
7
+
8
+ The strip's height is set with `--pixel-fire-height` (default `8rem`). It
9
+ paints at `z-index: 30`, above ordinary page content but below `app-shell`'s
10
+ chrome and every dialog or popover. Under `prefers-reduced-motion: reduce`
11
+ it draws one still frame instead of animating. The canvas is hidden from
12
+ assistive technology.
13
+
14
+ ## Install
15
+
16
+ ```js
17
+ import "@f-ewald/components/pixel-fire.js";
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```html
23
+ <!-- Full width along the bottom of the viewport -->
24
+ <pixel-fire></pixel-fire>
25
+
26
+ <!-- Along the bottom of a positioned container, chunkier and lower -->
27
+ <div style="position: relative; height: 12rem">
28
+ <pixel-fire contained pixel-size="8" intensity="0.6"
29
+ style="--pixel-fire-height: 6rem"></pixel-fire>
30
+ </div>
31
+ ```
32
+
33
+ ## Attributes / properties
34
+
35
+ | Property | Attribute | Type | Default | Description |
36
+ | --- | --- | --- | --- | --- |
37
+ | `pixelSize` | `pixel-size` | `number` | `4` | Size of one fire pixel in CSS pixels; larger values look chunkier. |
38
+ | `intensity` | `intensity` | `number` | `1` | Heat of the fire's source, from `0` to `1`. Lowering it shortens the flames; `0` lets the fire burn out. |
39
+ | `contained` | `contained` | `boolean` | `false` | Pins the fire to the bottom of the nearest positioned ancestor instead of the viewport. |
40
+
41
+ ## Events
42
+
43
+ _None._
44
+
45
+ ## Slots
46
+
47
+ _None._
48
+
49
+ ## CSS custom properties
50
+
51
+ _None._
package/llms.txt CHANGED
@@ -371,14 +371,17 @@ Supports two suggestion sources:
371
371
 
372
372
  Each option may also carry a pre-rendered `icon` (shown before the value)
373
373
  and a `description` (a smaller, muted line under the value); options
374
- without them render as a plain value.
374
+ without them render as a plain value. The selected option's icon also
375
+ shows inside the field until the text is edited. Picking an option sets
376
+ `selectedKey`; set `selectedKey` and `value` together to show a selection
377
+ made elsewhere.
375
378
 
376
379
  Set `clearable` to show an in-field clear action whenever a value is
377
380
  present.
378
381
 
379
382
  Import: `import "@f-ewald/components/autocomplete-input.js";`
380
383
 
381
- Properties: `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `clearable` (attribute `clearable`) : boolean, default false; `endpoint` (attribute `endpoint`) : string, default ""; `queryParam` (attribute `query-param`) : string, default "q"; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3; `options` (JS property only) : AutocompleteOption[] | null, default null; `selectedOption` (JS property only) : AutocompleteOption | null, default —
384
+ Properties: `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `clearable` (attribute `clearable`) : boolean, default false; `endpoint` (attribute `endpoint`) : string, default ""; `queryParam` (attribute `query-param`) : string, default "q"; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3; `options` (JS property only) : AutocompleteOption[] | null, default null; `selectedKey` (attribute `selected-key`) : string | null, default null; `selectedOption` (JS property only) : AutocompleteOption | null, default —
382
385
  Events: `option-select`, `input`
383
386
  CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-danger`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-regular`, `--ui-line-height-tight`, `--ui-primary`, `--ui-radius-sm`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
384
387
 
@@ -2064,6 +2067,37 @@ Example:
2064
2067
  </script>
2065
2068
  ```
2066
2069
 
2070
+ ## <pixel-fire>
2071
+
2072
+ Pixelated, 8-bit style fire in the manner of old computer games. By default
2073
+ it is pinned full width to the bottom of the viewport as a decorative,
2074
+ click-through overlay; `contained` pins it to the bottom of the nearest
2075
+ positioned ancestor instead.
2076
+
2077
+ The strip's height is set with `--pixel-fire-height` (default `8rem`). It
2078
+ paints at `z-index: 30`, above ordinary page content but below `app-shell`'s
2079
+ chrome and every dialog or popover. Under `prefers-reduced-motion: reduce`
2080
+ it draws one still frame instead of animating. The canvas is hidden from
2081
+ assistive technology.
2082
+
2083
+ Import: `import "@f-ewald/components/pixel-fire.js";`
2084
+
2085
+ Properties: `pixelSize` (attribute `pixel-size`) : number, default 4; `intensity` (attribute `intensity`) : number, default 1; `contained` (attribute `contained`) : boolean, default false
2086
+ Events: none
2087
+ CSS custom properties: none
2088
+
2089
+ Example:
2090
+ ```html
2091
+ <!-- Full width along the bottom of the viewport -->
2092
+ <pixel-fire></pixel-fire>
2093
+
2094
+ <!-- Along the bottom of a positioned container, chunkier and lower -->
2095
+ <div style="position: relative; height: 12rem">
2096
+ <pixel-fire contained pixel-size="8" intensity="0.6"
2097
+ style="--pixel-fire-height: 6rem"></pixel-fire>
2098
+ </div>
2099
+ ```
2100
+
2067
2101
  ## <popover-panel>
2068
2102
 
2069
2103
  Generic anchored popover shell: a floating card positioned relative to its
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@f-ewald/components",
3
3
  "private": false,
4
- "version": "1.43.0",
4
+ "version": "1.45.0",
5
5
  "description": "A collection of universally usable web components for various tasks.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",