@fusion.dev/helix-core 0.237.0 → 0.237.2

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.
@@ -55,6 +55,14 @@ export interface IndicatorOptions {
55
55
  * `clientTop` are the border widths, already resolved, which is why they are
56
56
  * used here rather than parsing `borderLeftWidth`.
57
57
  *
58
+ * **The measurement is in screen pixels and the mark is placed in layout
59
+ * pixels.** `getBoundingClientRect` includes every transform above the
60
+ * component, so under a zoomed preview, a CSS-scaled embed or a tilted card the
61
+ * two differ, and writing screen pixels made the mark too wide and too far
62
+ * along: at a 1.2 scale the last segment's mark ran past the track. Dividing by
63
+ * the surface's own scale puts it back in layout pixels, and a value in layout
64
+ * pixels stays right when the transform changes, which no observer reports.
65
+ *
58
66
  * **Nothing is written until there is something to measure.** A zero-width box
59
67
  * is a component whose children have not upgraded yet, and writing zeroes would
60
68
  * park the mark at the origin and leave it there. The `data-placed` attribute is
@@ -1,4 +1,8 @@
1
1
  import { isRtl } from '../../utils/is-rtl/is-rtl.js';
2
+ const scaleOf = (surface, own) => {
3
+ const along = (drawn, laid) => laid > 0 && Math.abs(drawn - laid) > 1 ? drawn / laid : 1;
4
+ return { sx: along(own.width, surface.offsetWidth), sy: along(own.height, surface.offsetHeight) };
5
+ };
2
6
  export class IndicatorController {
3
7
  constructor(host, options) {
4
8
  this.host = host;
@@ -40,18 +44,19 @@ export class IndicatorController {
40
44
  if (box.width === 0 && box.height === 0) {
41
45
  return;
42
46
  }
47
+ const { sx, sy } = scaleOf(surface, own);
43
48
  const rtl = isRtl(surface);
44
49
  const inline = rtl
45
- ? own.right - box.right - surface.clientLeft
46
- : box.left - own.left - surface.clientLeft;
50
+ ? (own.right - box.right) / sx - surface.clientLeft
51
+ : (box.left - own.left) / sx - surface.clientLeft;
47
52
  const x = `${rtl ? -inline : inline}px`;
48
- const y = `${box.top - own.top - surface.clientTop}px`;
53
+ const y = `${(box.top - own.top) / sy - surface.clientTop}px`;
49
54
  const moved = this.last !== undefined && (this.last.x !== x || this.last.y !== y);
50
55
  this.last = { x, y };
51
56
  indicator.style.setProperty('--indicator-x', x);
52
57
  indicator.style.setProperty('--indicator-y', y);
53
- indicator.style.setProperty('--indicator-inline-size', `${box.width}px`);
54
- indicator.style.setProperty('--indicator-block-size', `${box.height}px`);
58
+ indicator.style.setProperty('--indicator-inline-size', `${box.width / sx}px`);
59
+ indicator.style.setProperty('--indicator-block-size', `${box.height / sy}px`);
55
60
  indicator.toggleAttribute('data-placed', true);
56
61
  if (!moved) {
57
62
  return;
package/dist/version.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  * `package.json`, so the two always agree. Nothing else in the running code
6
6
  * knows which release it is.
7
7
  */
8
- export declare const VERSION = "0.237.0";
8
+ export declare const VERSION = "0.237.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.237.0';
1
+ export const VERSION = '0.237.2';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-core",
3
3
  "description": "Helix element primitives: base classes, mixins, decorators, utilities.",
4
- "version": "0.237.0",
4
+ "version": "0.237.2",
5
5
  "license": "MIT",
6
6
  "author": "Fusion Development Group",
7
7
  "repository": {
@@ -87,12 +87,12 @@
87
87
  "bugs": "https://github.com/project-fusion/fusion/issues",
88
88
  "dependencies": {
89
89
  "@floating-ui/dom": "^1.8.0",
90
- "@fusion.dev/helix-icons": "0.237.0",
90
+ "@fusion.dev/helix-icons": "0.237.2",
91
91
  "tslib": "^2.8.1"
92
92
  },
93
93
  "devDependencies": {
94
- "@fusion.dev/helix-cem": "0.237.0",
95
- "@fusion.dev/helix-testing": "0.237.0",
94
+ "@fusion.dev/helix-cem": "0.237.2",
95
+ "@fusion.dev/helix-testing": "0.237.2",
96
96
  "@lit-labs/ssr": "^4.1.0",
97
97
  "lit": "^3.2.1"
98
98
  },