@udixio/ui-react 2.10.12 → 2.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udixio/ui-react",
3
- "version": "2.10.12",
3
+ "version": "2.10.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -12,7 +12,6 @@ import type {
12
12
  WorkerInboundMessage,
13
13
  WorkerOutboundMessage,
14
14
  } from './theme.worker';
15
- import ThemeWorker from './theme.worker?worker&inline';
16
15
 
17
16
  function isValidHexColor(hexColorString: string) {
18
17
  const regex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
@@ -54,7 +53,10 @@ export const ThemeProvider = ({
54
53
  themeApiRef.current = api;
55
54
  setThemeApi(api);
56
55
 
57
- const worker = new ThemeWorker() as Worker;
56
+ const worker = new Worker(
57
+ new URL('./theme.worker.ts', import.meta.url),
58
+ { type: 'module' },
59
+ );
58
60
  workerRef.current = worker;
59
61
 
60
62
  worker.onmessage = (e: MessageEvent<WorkerOutboundMessage>) => {
package/vite.config.ts CHANGED
@@ -17,6 +17,7 @@ const getUdixioVite = async () => {
17
17
 
18
18
  export default defineConfig(async () => ({
19
19
  root: __dirname,
20
+ base: './',
20
21
  cacheDir: '../../node_modules/.vite/packages/ui-react',
21
22
  plugins: [
22
23
  await getUdixioVite(),
@@ -32,6 +33,14 @@ export default defineConfig(async () => ({
32
33
  brotliSize: true,
33
34
  }),
34
35
  ],
36
+ worker: {
37
+ format: 'es' as const,
38
+ rollupOptions: {
39
+ output: {
40
+ entryFileNames: '[name].js',
41
+ },
42
+ },
43
+ },
35
44
  // Configuration for building your library.
36
45
  // See: https://vitejs.dev/guide/build.html#library-mode
37
46
  build: {
@@ -52,6 +61,11 @@ export default defineConfig(async () => ({
52
61
  formats: ['es' as const, 'cjs' as const],
53
62
  },
54
63
  rollupOptions: {
64
+ output: {
65
+ // Worker JS emis sans hash pour que la référence dans dist/index.js soit stable
66
+ assetFileNames: '[name][extname]',
67
+ chunkFileNames: '[name].js',
68
+ },
55
69
  // External packages that should not be bundled into your library.
56
70
  external: [
57
71
  'react',
@@ -1,121 +0,0 @@
1
- let y = !1, h = null;
2
- function C() {
3
- if (typeof window > "u") return !1;
4
- try {
5
- if (window.CSS && typeof window.CSS.supports == "function")
6
- return CSS.supports("animation-timeline: view()") || CSS.supports("animation-timeline: scroll()") || CSS.supports("view-timeline-name: --a");
7
- } catch {
8
- }
9
- return !1;
10
- }
11
- function F() {
12
- return typeof window > "u" || !("matchMedia" in window) ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
13
- }
14
- function V(n, t) {
15
- return getComputedStyle(n).getPropertyValue(t).trim() || null;
16
- }
17
- function b(n) {
18
- if (!n) return null;
19
- const t = n.split(/\s+/), e = t[t.length - 1];
20
- if (!e) return null;
21
- if (e.endsWith("%")) {
22
- const r = parseFloat(e);
23
- if (!isNaN(r)) return Math.max(0, Math.min(100, r)) / 100;
24
- }
25
- return null;
26
- }
27
- function L(n) {
28
- const t = V(n, "--udx-range-start"), e = V(n, "--udx-range-end"), r = b(t) ?? 0.2, a = b(e) ?? 0.5, o = Math.max(0, Math.min(1, r)), l = Math.max(o + 1e-3, Math.min(1, a));
29
- return { start: o, end: l };
30
- }
31
- function i(n, t) {
32
- if (!n) return null;
33
- const e = n.trim(), r = parseFloat(e);
34
- return isNaN(r) ? null : r;
35
- }
36
- function p(n, t, e) {
37
- return n + (t - n) * e;
38
- }
39
- function N(n, t, e, r) {
40
- const a = t.opacity != null ? Number(t.opacity) : 1, o = e.opacity != null ? Number(e.opacity) : 1, l = p(a, o, r);
41
- n.style.opacity = String(l);
42
- const v = i(t["--tw-enter-translate-x"]) ?? i(t["--tw-exit-translate-x"]) ?? 0, g = i(t["--tw-enter-translate-y"]) ?? i(t["--tw-exit-translate-y"]) ?? 0, c = i(e["--tw-enter-translate-x"]) ?? i(e["--tw-exit-translate-x"]) ?? 0, u = i(e["--tw-enter-translate-y"]) ?? i(e["--tw-exit-translate-y"]) ?? 0, S = i(t["--tw-enter-scale"]) ?? i(t["--tw-exit-scale"]) ?? 1, M = i(e["--tw-enter-scale"]) ?? i(e["--tw-exit-scale"]) ?? 1, P = i(t["--tw-enter-rotate"]) ?? i(t["--tw-exit-rotate"]) ?? 0, f = i(e["--tw-enter-rotate"]) ?? i(e["--tw-exit-rotate"]) ?? 0, x = p(v, c, r), s = p(g, u, r), d = p(S, M, r), m = p(P, f, r), w = [];
43
- (x !== 0 || s !== 0) && w.push(`translate3d(${x}px, ${s}px, 0)`), d !== 1 && w.push(`scale(${d})`), m !== 0 && w.push(`rotate(${m}deg)`), n.style.transform = w.length ? w.join(" ") : "none";
44
- }
45
- function T(n) {
46
- const t = n.classList, e = t.contains("animate-in"), r = t.contains("animate-out");
47
- if (!e && !r) return null;
48
- const a = getComputedStyle(n), o = {
49
- opacity: i(a.getPropertyValue("--tw-enter-opacity")) ?? void 0,
50
- "--tw-enter-translate-x": a.getPropertyValue("--tw-enter-translate-x") || void 0,
51
- "--tw-enter-translate-y": a.getPropertyValue("--tw-enter-translate-y") || void 0,
52
- "--tw-enter-scale": a.getPropertyValue("--tw-enter-scale") || void 0,
53
- "--tw-enter-rotate": a.getPropertyValue("--tw-enter-rotate") || void 0
54
- }, l = {
55
- opacity: i(a.getPropertyValue("--tw-exit-opacity")) ?? void 0,
56
- "--tw-exit-translate-x": a.getPropertyValue("--tw-exit-translate-x") || void 0,
57
- "--tw-exit-translate-y": a.getPropertyValue("--tw-exit-translate-y") || void 0,
58
- "--tw-exit-scale": a.getPropertyValue("--tw-exit-scale") || void 0,
59
- "--tw-exit-rotate": a.getPropertyValue("--tw-exit-rotate") || void 0
60
- };
61
- return e ? {
62
- from: o,
63
- to: { opacity: 1, "--tw-enter-translate-x": "0", "--tw-enter-translate-y": "0", "--tw-enter-scale": "1", "--tw-enter-rotate": "0" }
64
- } : r ? {
65
- from: { opacity: 1, "--tw-exit-translate-x": "0", "--tw-exit-translate-y": "0", "--tw-exit-scale": "1", "--tw-exit-rotate": "0" },
66
- to: l
67
- } : null;
68
- }
69
- function $() {
70
- const n = [
71
- ".udx-view",
72
- ".udx-view-x",
73
- ".udx-view-y",
74
- ".udx-view-inline",
75
- ".udx-view-block",
76
- "[data-udx-view]"
77
- ].map((t) => `${t}.animate-in, ${t}.animate-out`).join(", ");
78
- return Array.from(document.querySelectorAll(n));
79
- }
80
- function k(n = {}) {
81
- if (y) return h || (() => {
82
- });
83
- if (typeof window > "u") return () => {
84
- };
85
- if (C() || F())
86
- return y = !0, () => {
87
- };
88
- y = !0;
89
- const t = n.once ?? !0, e = /* @__PURE__ */ new WeakSet();
90
- let r = null;
91
- const a = () => {
92
- const v = $(), g = window.innerHeight || 0;
93
- for (const c of v) {
94
- const u = c.getBoundingClientRect(), S = Math.min(u.bottom, g) - Math.max(u.top, 0), M = Math.max(0, Math.min(S, u.height)), P = u.height > 0 ? M / u.height : 0, { start: f, end: x } = L(c);
95
- let s = (P - f) / (x - f);
96
- s = Math.max(0, Math.min(1, s)), t && e.has(c) && s < 1 && (s = 1);
97
- const d = T(c);
98
- if (!d) continue;
99
- const { from: m, to: w } = d;
100
- N(c, m, w, s), s >= 1 && t && e.add(c);
101
- }
102
- }, o = () => {
103
- r == null && (r = window.requestAnimationFrame(() => {
104
- r = null, a();
105
- }));
106
- };
107
- a(), window.addEventListener("scroll", o, { passive: !0 }), window.addEventListener("resize", o);
108
- const l = new MutationObserver(() => {
109
- o();
110
- });
111
- return l.observe(document.documentElement, {
112
- childList: !0,
113
- subtree: !0,
114
- attributes: !0
115
- }), h = () => {
116
- window.removeEventListener("scroll", o), window.removeEventListener("resize", o), r != null && cancelAnimationFrame(r), l.disconnect(), y = !1, h = null;
117
- }, h;
118
- }
119
- export {
120
- k as initScrollViewFallback
121
- };