@fusion.dev/helix 0.57.0 → 0.58.1

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.
@@ -79705,40 +79705,6 @@
79705
79705
  }
79706
79706
  ]
79707
79707
  },
79708
- {
79709
- "kind": "javascript-module",
79710
- "path": "src/orb/color.ts",
79711
- "declarations": [
79712
- {
79713
- "kind": "function",
79714
- "name": "readColor",
79715
- "return": {
79716
- "type": {
79717
- "text": "[number, number, number]"
79718
- }
79719
- },
79720
- "parameters": [
79721
- {
79722
- "name": "value",
79723
- "type": {
79724
- "text": "string"
79725
- }
79726
- }
79727
- ],
79728
- "description": "A computed color as three sRGB bytes, whatever space it was written in.\n\n**Painting it is the only way to read it.** A color-typed property is\nresolved before it is reported, but resolved is not the same as converted:\nChrome hands back `lab(100 0 0)` for a token built through `oklab`, and this\nused to scrape the first three numbers out of that and call them red, green\nand blue. White arrived as `rgb(100, 0, 0)`. In light mode the near dots were\n`lab(0 0 0)`, which scrapes to black and looks right, so only dark mode showed\nit: dark red mixed toward black, on a near-black ground.\n\nA 1x1 fill and `getImageData` is a readback, so the answer is cached against\nthe string it came from. There are two per orb and they change when the theme\ndoes."
79729
- }
79730
- ],
79731
- "exports": [
79732
- {
79733
- "kind": "js",
79734
- "name": "readColor",
79735
- "declaration": {
79736
- "name": "readColor",
79737
- "module": "src/orb/color.ts"
79738
- }
79739
- }
79740
- ]
79741
- },
79742
79708
  {
79743
79709
  "kind": "javascript-module",
79744
79710
  "path": "src/orb/index.ts",
@@ -4,10 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { customElement, HelixElement, hostAria } from '@fusion.dev/helix-core';
7
+ import { customElement, HelixElement, hostAria, readColor, } from '@fusion.dev/helix-core';
8
8
  import { html } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
- import { readColor } from '../color.js';
11
10
  import { blendStaged, evenSphere, fibonacci, meshFor, ORB_STATES, orbPoint, paramsFor, project, smoother, stateDistance, TRAIL, } from '../shapes.js';
12
11
  import { styles } from './orb-root.css.js';
13
12
  const MORPH_NEAR = 380;
@@ -23,6 +22,7 @@ const LABELS = {
23
22
  waiting: 'Waiting',
24
23
  working: 'Working',
25
24
  };
25
+ const GRAY = [128, 128, 128];
26
26
  let HelixOrb = class HelixOrb extends HelixElement {
27
27
  constructor() {
28
28
  super(...arguments);
@@ -226,8 +226,8 @@ let HelixOrb = class HelixOrb extends HelixElement {
226
226
  const params = still ? paramsFor(this.state) : this.paramsNow();
227
227
  this.phase += dt * params.rate;
228
228
  const painted = getComputedStyle(ctx.canvas);
229
- const ink = readColor(painted.color);
230
- const ground = readColor(painted.textDecorationColor);
229
+ const ink = readColor(painted.color) ?? GRAY;
230
+ const ground = readColor(painted.textDecorationColor) ?? GRAY;
231
231
  const mesh = meshFor(size);
232
232
  const even = evenSphere(mesh.lanes, mesh.segs);
233
233
  const spin = this.phase * 0.9;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix",
3
3
  "description": "Styled component tier. Extends the headless tier with token-driven presentation.",
4
- "version": "0.57.0",
4
+ "version": "0.58.1",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -47,14 +47,14 @@
47
47
  },
48
48
  "bugs": "https://github.com/project-fusion/fusion/issues",
49
49
  "dependencies": {
50
- "@fusion.dev/helix-core": "0.57.0",
51
- "@fusion.dev/helix-headless": "0.57.0",
52
- "@fusion.dev/helix-styles": "0.57.0"
50
+ "@fusion.dev/helix-core": "0.58.1",
51
+ "@fusion.dev/helix-headless": "0.58.1",
52
+ "@fusion.dev/helix-styles": "0.58.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@custom-elements-manifest/analyzer": "^0.11.0",
56
- "@fusion.dev/helix-cem": "0.57.0",
57
- "@fusion.dev/helix-testing": "0.57.0",
56
+ "@fusion.dev/helix-cem": "0.58.1",
57
+ "@fusion.dev/helix-testing": "0.58.1",
58
58
  "@fusion.dev/scripts": "0.0.0-dev",
59
59
  "@happy-dom/global-registrator": "^20.0.0",
60
60
  "@lit-labs/ssr": "^4.1.0",
@@ -1,19 +0,0 @@
1
- /**
2
- * Reading a computed color the engine has resolved but not converted.
3
- */
4
- /**
5
- * A computed color as three sRGB bytes, whatever space it was written in.
6
- *
7
- * **Painting it is the only way to read it.** A color-typed property is
8
- * resolved before it is reported, but resolved is not the same as converted:
9
- * Chrome hands back `lab(100 0 0)` for a token built through `oklab`, and this
10
- * used to scrape the first three numbers out of that and call them red, green
11
- * and blue. White arrived as `rgb(100, 0, 0)`. In light mode the near dots were
12
- * `lab(0 0 0)`, which scrapes to black and looks right, so only dark mode showed
13
- * it: dark red mixed toward black, on a near-black ground.
14
- *
15
- * A 1x1 fill and `getImageData` is a readback, so the answer is cached against
16
- * the string it came from. There are two per orb and they change when the theme
17
- * does.
18
- */
19
- export declare const readColor: (value: string) => [number, number, number];
package/dist/orb/color.js DELETED
@@ -1,25 +0,0 @@
1
- let swatch;
2
- const known = new Map();
3
- export const readColor = (value) => {
4
- const seen = known.get(value);
5
- if (seen) {
6
- return seen;
7
- }
8
- if (swatch === undefined) {
9
- swatch = document.createElement('canvas').getContext('2d', { willReadFrequently: true });
10
- }
11
- if (!swatch) {
12
- return [128, 128, 128];
13
- }
14
- swatch.clearRect(0, 0, 1, 1);
15
- swatch.fillStyle = '#808080';
16
- swatch.fillStyle = value;
17
- swatch.fillRect(0, 0, 1, 1);
18
- const [red, green, blue] = swatch.getImageData(0, 0, 1, 1).data;
19
- const rgb = [red ?? 128, green ?? 128, blue ?? 128];
20
- if (known.size > 64) {
21
- known.clear();
22
- }
23
- known.set(value, rgb);
24
- return rgb;
25
- };