@urbicon-ui/blocks 6.3.12 → 6.3.13

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.
@@ -48,9 +48,41 @@ function getBaseCoords(ref, floating, placement) {
48
48
  }
49
49
  return { x, y };
50
50
  }
51
+ /**
52
+ * Viewport offset of a `position: fixed` element's *actual* containing block,
53
+ * measured by momentarily pinning it to (0,0) and reading where that lands.
54
+ *
55
+ * It is (0,0) when the element is genuinely viewport-fixed (the common case, so
56
+ * compensation is a no-op there). It is non-zero when a transformed / filtered /
57
+ * contained ancestor establishes the containing block — notably a modal
58
+ * `<dialog>` nested inside an off-canvas sidebar on iOS/WebKit, which (unlike
59
+ * Chromium/Firefox) does NOT re-anchor the dialog's fixed descendants to the
60
+ * viewport (Codeberg #23). Measuring rather than assuming keeps positioning
61
+ * correct on every engine without UA sniffing. The probe is synchronous (set →
62
+ * read → restore in one frame), so it never paints an intermediate (0,0) state.
63
+ */
64
+ function fixedOriginOffset(floating) {
65
+ const prevLeft = floating.style.left;
66
+ const prevTop = floating.style.top;
67
+ floating.style.left = '0px';
68
+ floating.style.top = '0px';
69
+ const origin = floating.getBoundingClientRect();
70
+ floating.style.left = prevLeft;
71
+ floating.style.top = prevTop;
72
+ return { x: origin.left, y: origin.top };
73
+ }
51
74
  function viewportToLocal(floating, x, y, strategy) {
52
- if (strategy === 'fixed')
53
- return { x, y };
75
+ if (strategy === 'fixed') {
76
+ // A top-layer popover is positioned against the viewport regardless of any
77
+ // transformed ancestor, so its coordinates are used as-is. A non-top-layer
78
+ // fixed panel (the in-dialog mode) is positioned against its containing
79
+ // block, which can be a transformed ancestor on WebKit — compensate for its
80
+ // measured viewport offset so the same coordinates land correctly there too.
81
+ if (floating.matches(':popover-open'))
82
+ return { x, y };
83
+ const origin = fixedOriginOffset(floating);
84
+ return { x: x - origin.x, y: y - origin.y };
85
+ }
54
86
  const offsetParent = floating.offsetParent;
55
87
  if (!offsetParent)
56
88
  return { x, y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urbicon-ui/blocks",
3
- "version": "6.3.12",
3
+ "version": "6.3.13",
4
4
  "description": "Svelte 5 UI component library with Tailwind CSS 4, OKLCH design tokens and zero runtime dependencies",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -91,8 +91,8 @@
91
91
  "@sveltejs/package": "^2.5.8",
92
92
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
93
93
  "@tailwindcss/vite": "^4.3.1",
94
- "@urbicon-ui/i18n": "6.3.12",
95
- "@urbicon-ui/shared-types": "6.3.12",
94
+ "@urbicon-ui/i18n": "6.3.13",
95
+ "@urbicon-ui/shared-types": "6.3.13",
96
96
  "prettier": "^3.8.4",
97
97
  "prettier-plugin-svelte": "^4.1.1",
98
98
  "prettier-plugin-tailwindcss": "^0.8.0",