@nexxtmove/ui 1.2.3 → 1.2.4

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "1.2.3",
4
+ "version": "1.2.4",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -23,21 +23,39 @@ const px = computed(() => (typeof props.size === 'number' ? props.size : sizeMap
23
23
 
24
24
  const id = Math.random().toString(36).slice(2, 9)
25
25
  const clipPathId = `squircle-clip-${id}`
26
+
27
+ // Squircle outline normalised to a 0-1 box so a single path works at any size.
28
+ // Safari renders foreignObject content unreliably, so the slot lives in a plain
29
+ // element that is clipped with an objectBoundingBox clipPath instead.
30
+ const squirclePath =
31
+ 'M0.5,1 c0.219,0 0.341,0 0.4205,-0.0795 C1,0.841 1,0.719 1,0.5 s0,-0.341 -0.0795,-0.4205 ' +
32
+ 'C0.841,0 0.719,0 0.5,0 S0.159,0 0.0795,0.0795 C0,0.159 0,0.281 0,0.5 ' +
33
+ 's0,0.341 0.0795,0.4205 C0.159,1 0.281,1 0.5,1 Z'
34
+
35
+ const style = computed(() => ({
36
+ width: `${px.value}px`,
37
+ height: `${px.value}px`,
38
+ clipPath: `url(#${clipPathId})`,
39
+ WebkitClipPath: `url(#${clipPathId})`,
40
+ }))
26
41
  </script>
27
42
 
28
43
  <template>
29
- <svg :viewBox="`0 0 ${px} ${px}`" :width="px" :height="px">
30
- <defs>
31
- <clipPath :id="clipPathId">
32
- <path
33
- :transform="`scale(${px / 200})`"
34
- d="M100,200c43.8,0,68.2,0,84.1-15.9C200,168.2,200,143.8,200,100s0-68.2-15.9-84.1C168.2,0,143.8,0,100,0S31.8,0,15.9,15.9C0,31.8,0,56.2,0,100s0,68.2,15.9,84.1C31.8,200,56.2,200,100,200z"
35
- />
36
- </clipPath>
37
- </defs>
38
-
39
- <foreignObject x="0" y="0" width="100%" height="100%" :clip-path="`url(#${clipPathId})`">
40
- <slot />
41
- </foreignObject>
42
- </svg>
44
+ <div class="relative block shrink-0 overflow-hidden" :style="style">
45
+ <svg
46
+ class="absolute h-0 w-0 overflow-hidden"
47
+ aria-hidden="true"
48
+ focusable="false"
49
+ width="0"
50
+ height="0"
51
+ >
52
+ <defs>
53
+ <clipPath :id="clipPathId" clipPathUnits="objectBoundingBox">
54
+ <path :d="squirclePath" />
55
+ </clipPath>
56
+ </defs>
57
+ </svg>
58
+
59
+ <slot />
60
+ </div>
43
61
  </template>
@@ -0,0 +1,9 @@
1
+ // jsdom ships no media playback, so components driving a <video> element make it
2
+ // log "Not implemented: HTMLMediaElement's play() method" on every test run.
3
+ // The stubs stay configurable and writable so individual tests can still spy on
4
+ // or override them per element.
5
+ Object.defineProperties(HTMLMediaElement.prototype, {
6
+ play: { configurable: true, writable: true, value: () => Promise.resolve() },
7
+ pause: { configurable: true, writable: true, value: () => {} },
8
+ load: { configurable: true, writable: true, value: () => {} },
9
+ })