@hanzo/ui 5.3.30 → 5.3.32
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/dist/index.js +1 -20
- package/dist/index.mjs +1 -19
- package/dist/primitives/index.js +1 -20
- package/dist/primitives/index.mjs +1 -19
- package/dist/primitives-export.js +1 -20
- package/dist/primitives-export.mjs +1 -19
- package/dist/spline/index.js +211 -0
- package/dist/spline/index.mjs +202 -0
- package/dist/spline/media-stack.js +193 -0
- package/dist/spline/media-stack.mjs +185 -0
- package/dist/spline/player.js +37 -0
- package/dist/spline/player.mjs +31 -0
- package/package.json +12 -2
package/dist/index.js
CHANGED
|
@@ -44,7 +44,6 @@ var TogglePrimitive = require('@radix-ui/react-toggle');
|
|
|
44
44
|
var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
|
|
45
45
|
var NextImage = require('next/image');
|
|
46
46
|
var Link2 = require('next/link');
|
|
47
|
-
var Spline = require('@splinetool/react-spline');
|
|
48
47
|
|
|
49
48
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
49
|
|
|
@@ -96,7 +95,6 @@ var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive)
|
|
|
96
95
|
var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
|
|
97
96
|
var NextImage__default = /*#__PURE__*/_interopDefault(NextImage);
|
|
98
97
|
var Link2__default = /*#__PURE__*/_interopDefault(Link2);
|
|
99
|
-
var Spline__default = /*#__PURE__*/_interopDefault(Spline);
|
|
100
98
|
|
|
101
99
|
var __defProp = Object.defineProperty;
|
|
102
100
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -3715,24 +3713,8 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3715
3713
|
constrainTo: cnst = { w: 250, h: 250 },
|
|
3716
3714
|
clx = ""
|
|
3717
3715
|
}) => {
|
|
3718
|
-
const { img, video,
|
|
3716
|
+
const { img, video, mediaTransform } = media;
|
|
3719
3717
|
const transform = mediaTransform ?? {};
|
|
3720
|
-
if (animation) {
|
|
3721
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3722
|
-
Spline__default.default,
|
|
3723
|
-
{
|
|
3724
|
-
scene: animation,
|
|
3725
|
-
className: cn(clx, "pointer-events-none"),
|
|
3726
|
-
"data-vaul-no-drag": true,
|
|
3727
|
-
style: {
|
|
3728
|
-
// // !aspect-[12/10]
|
|
3729
|
-
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
3730
|
-
height: cnst.h,
|
|
3731
|
-
...spread_to_transform_default(transform)
|
|
3732
|
-
}
|
|
3733
|
-
}
|
|
3734
|
-
);
|
|
3735
|
-
}
|
|
3736
3718
|
if (video) {
|
|
3737
3719
|
const dim = constrain(video.dim.md, cnst);
|
|
3738
3720
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3744,7 +3726,6 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3744
3726
|
height: dim.h,
|
|
3745
3727
|
style: {
|
|
3746
3728
|
minHeight: dim.h,
|
|
3747
|
-
// prevents layout jumps
|
|
3748
3729
|
...spread_to_transform_default(transform)
|
|
3749
3730
|
},
|
|
3750
3731
|
...video.videoProps
|
package/dist/index.mjs
CHANGED
|
@@ -44,7 +44,6 @@ import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
|
44
44
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
45
45
|
import NextImage from 'next/image';
|
|
46
46
|
import Link2 from 'next/link';
|
|
47
|
-
import Spline from '@splinetool/react-spline';
|
|
48
47
|
|
|
49
48
|
var __defProp = Object.defineProperty;
|
|
50
49
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -3663,24 +3662,8 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3663
3662
|
constrainTo: cnst = { w: 250, h: 250 },
|
|
3664
3663
|
clx = ""
|
|
3665
3664
|
}) => {
|
|
3666
|
-
const { img, video,
|
|
3665
|
+
const { img, video, mediaTransform } = media;
|
|
3667
3666
|
const transform = mediaTransform ?? {};
|
|
3668
|
-
if (animation) {
|
|
3669
|
-
return /* @__PURE__ */ jsx(
|
|
3670
|
-
Spline,
|
|
3671
|
-
{
|
|
3672
|
-
scene: animation,
|
|
3673
|
-
className: cn(clx, "pointer-events-none"),
|
|
3674
|
-
"data-vaul-no-drag": true,
|
|
3675
|
-
style: {
|
|
3676
|
-
// // !aspect-[12/10]
|
|
3677
|
-
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
3678
|
-
height: cnst.h,
|
|
3679
|
-
...spread_to_transform_default(transform)
|
|
3680
|
-
}
|
|
3681
|
-
}
|
|
3682
|
-
);
|
|
3683
|
-
}
|
|
3684
3667
|
if (video) {
|
|
3685
3668
|
const dim = constrain(video.dim.md, cnst);
|
|
3686
3669
|
return /* @__PURE__ */ jsx(
|
|
@@ -3692,7 +3675,6 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3692
3675
|
height: dim.h,
|
|
3693
3676
|
style: {
|
|
3694
3677
|
minHeight: dim.h,
|
|
3695
|
-
// prevents layout jumps
|
|
3696
3678
|
...spread_to_transform_default(transform)
|
|
3697
3679
|
},
|
|
3698
3680
|
...video.videoProps
|
package/dist/primitives/index.js
CHANGED
|
@@ -44,7 +44,6 @@ var TogglePrimitive = require('@radix-ui/react-toggle');
|
|
|
44
44
|
var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
|
|
45
45
|
var NextImage = require('next/image');
|
|
46
46
|
var Link2 = require('next/link');
|
|
47
|
-
var Spline = require('@splinetool/react-spline');
|
|
48
47
|
|
|
49
48
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
49
|
|
|
@@ -96,7 +95,6 @@ var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive)
|
|
|
96
95
|
var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
|
|
97
96
|
var NextImage__default = /*#__PURE__*/_interopDefault(NextImage);
|
|
98
97
|
var Link2__default = /*#__PURE__*/_interopDefault(Link2);
|
|
99
|
-
var Spline__default = /*#__PURE__*/_interopDefault(Spline);
|
|
100
98
|
|
|
101
99
|
var __defProp = Object.defineProperty;
|
|
102
100
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -3715,24 +3713,8 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3715
3713
|
constrainTo: cnst = { w: 250, h: 250 },
|
|
3716
3714
|
clx = ""
|
|
3717
3715
|
}) => {
|
|
3718
|
-
const { img, video,
|
|
3716
|
+
const { img, video, mediaTransform } = media;
|
|
3719
3717
|
const transform = mediaTransform ?? {};
|
|
3720
|
-
if (animation) {
|
|
3721
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3722
|
-
Spline__default.default,
|
|
3723
|
-
{
|
|
3724
|
-
scene: animation,
|
|
3725
|
-
className: cn(clx, "pointer-events-none"),
|
|
3726
|
-
"data-vaul-no-drag": true,
|
|
3727
|
-
style: {
|
|
3728
|
-
// // !aspect-[12/10]
|
|
3729
|
-
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
3730
|
-
height: cnst.h,
|
|
3731
|
-
...spread_to_transform_default(transform)
|
|
3732
|
-
}
|
|
3733
|
-
}
|
|
3734
|
-
);
|
|
3735
|
-
}
|
|
3736
3718
|
if (video) {
|
|
3737
3719
|
const dim = constrain(video.dim.md, cnst);
|
|
3738
3720
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3744,7 +3726,6 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3744
3726
|
height: dim.h,
|
|
3745
3727
|
style: {
|
|
3746
3728
|
minHeight: dim.h,
|
|
3747
|
-
// prevents layout jumps
|
|
3748
3729
|
...spread_to_transform_default(transform)
|
|
3749
3730
|
},
|
|
3750
3731
|
...video.videoProps
|
|
@@ -44,7 +44,6 @@ import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
|
44
44
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
45
45
|
import NextImage from 'next/image';
|
|
46
46
|
import Link2 from 'next/link';
|
|
47
|
-
import Spline from '@splinetool/react-spline';
|
|
48
47
|
|
|
49
48
|
var __defProp = Object.defineProperty;
|
|
50
49
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -3663,24 +3662,8 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3663
3662
|
constrainTo: cnst = { w: 250, h: 250 },
|
|
3664
3663
|
clx = ""
|
|
3665
3664
|
}) => {
|
|
3666
|
-
const { img, video,
|
|
3665
|
+
const { img, video, mediaTransform } = media;
|
|
3667
3666
|
const transform = mediaTransform ?? {};
|
|
3668
|
-
if (animation) {
|
|
3669
|
-
return /* @__PURE__ */ jsx(
|
|
3670
|
-
Spline,
|
|
3671
|
-
{
|
|
3672
|
-
scene: animation,
|
|
3673
|
-
className: cn(clx, "pointer-events-none"),
|
|
3674
|
-
"data-vaul-no-drag": true,
|
|
3675
|
-
style: {
|
|
3676
|
-
// // !aspect-[12/10]
|
|
3677
|
-
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
3678
|
-
height: cnst.h,
|
|
3679
|
-
...spread_to_transform_default(transform)
|
|
3680
|
-
}
|
|
3681
|
-
}
|
|
3682
|
-
);
|
|
3683
|
-
}
|
|
3684
3667
|
if (video) {
|
|
3685
3668
|
const dim = constrain(video.dim.md, cnst);
|
|
3686
3669
|
return /* @__PURE__ */ jsx(
|
|
@@ -3692,7 +3675,6 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3692
3675
|
height: dim.h,
|
|
3693
3676
|
style: {
|
|
3694
3677
|
minHeight: dim.h,
|
|
3695
|
-
// prevents layout jumps
|
|
3696
3678
|
...spread_to_transform_default(transform)
|
|
3697
3679
|
},
|
|
3698
3680
|
...video.videoProps
|
|
@@ -44,7 +44,6 @@ var TogglePrimitive = require('@radix-ui/react-toggle');
|
|
|
44
44
|
var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
|
|
45
45
|
var NextImage = require('next/image');
|
|
46
46
|
var Link2 = require('next/link');
|
|
47
|
-
var Spline = require('@splinetool/react-spline');
|
|
48
47
|
|
|
49
48
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
49
|
|
|
@@ -96,7 +95,6 @@ var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive)
|
|
|
96
95
|
var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
|
|
97
96
|
var NextImage__default = /*#__PURE__*/_interopDefault(NextImage);
|
|
98
97
|
var Link2__default = /*#__PURE__*/_interopDefault(Link2);
|
|
99
|
-
var Spline__default = /*#__PURE__*/_interopDefault(Spline);
|
|
100
98
|
|
|
101
99
|
var __defProp = Object.defineProperty;
|
|
102
100
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -3715,24 +3713,8 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3715
3713
|
constrainTo: cnst = { w: 250, h: 250 },
|
|
3716
3714
|
clx = ""
|
|
3717
3715
|
}) => {
|
|
3718
|
-
const { img, video,
|
|
3716
|
+
const { img, video, mediaTransform } = media;
|
|
3719
3717
|
const transform = mediaTransform ?? {};
|
|
3720
|
-
if (animation) {
|
|
3721
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3722
|
-
Spline__default.default,
|
|
3723
|
-
{
|
|
3724
|
-
scene: animation,
|
|
3725
|
-
className: cn(clx, "pointer-events-none"),
|
|
3726
|
-
"data-vaul-no-drag": true,
|
|
3727
|
-
style: {
|
|
3728
|
-
// // !aspect-[12/10]
|
|
3729
|
-
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
3730
|
-
height: cnst.h,
|
|
3731
|
-
...spread_to_transform_default(transform)
|
|
3732
|
-
}
|
|
3733
|
-
}
|
|
3734
|
-
);
|
|
3735
|
-
}
|
|
3736
3718
|
if (video) {
|
|
3737
3719
|
const dim = constrain(video.dim.md, cnst);
|
|
3738
3720
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3744,7 +3726,6 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3744
3726
|
height: dim.h,
|
|
3745
3727
|
style: {
|
|
3746
3728
|
minHeight: dim.h,
|
|
3747
|
-
// prevents layout jumps
|
|
3748
3729
|
...spread_to_transform_default(transform)
|
|
3749
3730
|
},
|
|
3750
3731
|
...video.videoProps
|
|
@@ -44,7 +44,6 @@ import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
|
44
44
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
45
45
|
import NextImage from 'next/image';
|
|
46
46
|
import Link2 from 'next/link';
|
|
47
|
-
import Spline from '@splinetool/react-spline';
|
|
48
47
|
|
|
49
48
|
var __defProp = Object.defineProperty;
|
|
50
49
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -3663,24 +3662,8 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3663
3662
|
constrainTo: cnst = { w: 250, h: 250 },
|
|
3664
3663
|
clx = ""
|
|
3665
3664
|
}) => {
|
|
3666
|
-
const { img, video,
|
|
3665
|
+
const { img, video, mediaTransform } = media;
|
|
3667
3666
|
const transform = mediaTransform ?? {};
|
|
3668
|
-
if (animation) {
|
|
3669
|
-
return /* @__PURE__ */ jsx(
|
|
3670
|
-
Spline,
|
|
3671
|
-
{
|
|
3672
|
-
scene: animation,
|
|
3673
|
-
className: cn(clx, "pointer-events-none"),
|
|
3674
|
-
"data-vaul-no-drag": true,
|
|
3675
|
-
style: {
|
|
3676
|
-
// // !aspect-[12/10]
|
|
3677
|
-
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
3678
|
-
height: cnst.h,
|
|
3679
|
-
...spread_to_transform_default(transform)
|
|
3680
|
-
}
|
|
3681
|
-
}
|
|
3682
|
-
);
|
|
3683
|
-
}
|
|
3684
3667
|
if (video) {
|
|
3685
3668
|
const dim = constrain(video.dim.md, cnst);
|
|
3686
3669
|
return /* @__PURE__ */ jsx(
|
|
@@ -3692,7 +3675,6 @@ var MediaStack = /* @__PURE__ */ __name(({
|
|
|
3692
3675
|
height: dim.h,
|
|
3693
3676
|
style: {
|
|
3694
3677
|
minHeight: dim.h,
|
|
3695
|
-
// prevents layout jumps
|
|
3696
3678
|
...spread_to_transform_default(transform)
|
|
3697
3679
|
},
|
|
3698
3680
|
...video.videoProps
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var Spline = require('@splinetool/react-spline');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var tailwindMerge = require('tailwind-merge');
|
|
7
|
+
var NextImage = require('next/image');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var Spline__default = /*#__PURE__*/_interopDefault(Spline);
|
|
14
|
+
var NextImage__default = /*#__PURE__*/_interopDefault(NextImage);
|
|
15
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
16
|
+
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
19
|
+
|
|
20
|
+
// util/spread-to-transform.ts
|
|
21
|
+
function spreadToTransform(t) {
|
|
22
|
+
let transformStrings = [];
|
|
23
|
+
const scaleVal = "scale" in t ? t.scale : void 0;
|
|
24
|
+
if (scaleVal) {
|
|
25
|
+
if (typeof scaleVal === "number") {
|
|
26
|
+
transformStrings.push(`scale(${scaleVal})`);
|
|
27
|
+
} else if (Array.isArray(scaleVal) && scaleVal.length == 2 && typeof scaleVal[0] === "number") {
|
|
28
|
+
transformStrings.push(`scale(${scaleVal[0]}, ${scaleVal[1]})`);
|
|
29
|
+
} else {
|
|
30
|
+
throw new Error("parsing MediaTransform: Unrecognized value for 'scale'!");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return transformStrings.length > 0 ? { transform: transformStrings.join(" ") } : {};
|
|
34
|
+
}
|
|
35
|
+
__name(spreadToTransform, "spreadToTransform");
|
|
36
|
+
var spread_to_transform_default = spreadToTransform;
|
|
37
|
+
function cn(...inputs) {
|
|
38
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
39
|
+
}
|
|
40
|
+
__name(cn, "cn");
|
|
41
|
+
|
|
42
|
+
// util/index.ts
|
|
43
|
+
function constrain(value, minOrConstrainTo, max) {
|
|
44
|
+
if (typeof value === "number" && typeof minOrConstrainTo === "number" && typeof max === "number") {
|
|
45
|
+
return Math.min(Math.max(value, minOrConstrainTo), max);
|
|
46
|
+
}
|
|
47
|
+
if (typeof value === "object" && typeof minOrConstrainTo === "object") {
|
|
48
|
+
const dim = value;
|
|
49
|
+
const constrainTo = minOrConstrainTo;
|
|
50
|
+
const aspectRatio = dim.w / dim.h;
|
|
51
|
+
const constrainAspectRatio = constrainTo.w / constrainTo.h;
|
|
52
|
+
if (aspectRatio > constrainAspectRatio) {
|
|
53
|
+
return {
|
|
54
|
+
w: constrainTo.w,
|
|
55
|
+
h: constrainTo.w / aspectRatio
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
return {
|
|
59
|
+
w: constrainTo.h * aspectRatio,
|
|
60
|
+
h: constrainTo.h
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
throw new Error("Invalid parameters for constrain function");
|
|
65
|
+
}
|
|
66
|
+
__name(constrain, "constrain");
|
|
67
|
+
var Image = /* @__PURE__ */ __name(({
|
|
68
|
+
def,
|
|
69
|
+
constrainTo,
|
|
70
|
+
transform = {},
|
|
71
|
+
fullWidth = false,
|
|
72
|
+
className = "",
|
|
73
|
+
preload = false
|
|
74
|
+
}) => {
|
|
75
|
+
const {
|
|
76
|
+
src,
|
|
77
|
+
alt: _alt,
|
|
78
|
+
dim,
|
|
79
|
+
sizes,
|
|
80
|
+
svgFillClass: _svgFillClass
|
|
81
|
+
} = def;
|
|
82
|
+
const toSpread = {};
|
|
83
|
+
if (fullWidth) {
|
|
84
|
+
toSpread.style = {
|
|
85
|
+
width: "100%",
|
|
86
|
+
height: "auto",
|
|
87
|
+
...spread_to_transform_default(transform)
|
|
88
|
+
};
|
|
89
|
+
if (constrainTo) {
|
|
90
|
+
toSpread.style.maxWidth = constrainTo.w;
|
|
91
|
+
toSpread.style.maxHeight = constrainTo.h;
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
const resolved = constrainTo ? constrain(dim, constrainTo) : dim;
|
|
95
|
+
toSpread.width = resolved.w;
|
|
96
|
+
toSpread.height = resolved.h;
|
|
97
|
+
toSpread.style = { ...spread_to_transform_default(transform) };
|
|
98
|
+
}
|
|
99
|
+
if (sizes) {
|
|
100
|
+
toSpread.sizes = sizes;
|
|
101
|
+
}
|
|
102
|
+
let alt;
|
|
103
|
+
if (_alt) {
|
|
104
|
+
alt = _alt;
|
|
105
|
+
} else {
|
|
106
|
+
const tokens = src.split("/");
|
|
107
|
+
alt = tokens.length > 0 ? tokens[tokens.length - 1] : src;
|
|
108
|
+
}
|
|
109
|
+
const svgFillClass = _svgFillClass ?? "";
|
|
110
|
+
return fullWidth ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex flex-col items-center justify-center w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
111
|
+
NextImage__default.default,
|
|
112
|
+
{
|
|
113
|
+
src,
|
|
114
|
+
alt,
|
|
115
|
+
...toSpread,
|
|
116
|
+
priority: preload,
|
|
117
|
+
loading: preload ? "eager" : "lazy",
|
|
118
|
+
className: cn(svgFillClass, className)
|
|
119
|
+
}
|
|
120
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
+
NextImage__default.default,
|
|
122
|
+
{
|
|
123
|
+
src,
|
|
124
|
+
alt,
|
|
125
|
+
...toSpread,
|
|
126
|
+
priority: preload,
|
|
127
|
+
loading: preload ? "eager" : "lazy",
|
|
128
|
+
className: cn(svgFillClass, className)
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}, "Image");
|
|
132
|
+
var image_default = Image;
|
|
133
|
+
var VideoPlayer = React__default.default.forwardRef(
|
|
134
|
+
({
|
|
135
|
+
sources,
|
|
136
|
+
...rest
|
|
137
|
+
}, ref) => {
|
|
138
|
+
return /* @__PURE__ */ jsxRuntime.jsx("video", { ref, ...rest, children: sources.map((source, index) => /* @__PURE__ */ jsxRuntime.jsx("source", { src: source }, index)) });
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
var video_player_default = VideoPlayer;
|
|
142
|
+
var MediaStack = /* @__PURE__ */ __name(({
|
|
143
|
+
media,
|
|
144
|
+
constrainTo: cnst = { w: 250, h: 250 },
|
|
145
|
+
clx = ""
|
|
146
|
+
}) => {
|
|
147
|
+
const { img, video, animation, mediaTransform } = media;
|
|
148
|
+
const transform = mediaTransform ?? {};
|
|
149
|
+
if (animation) {
|
|
150
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
151
|
+
Spline__default.default,
|
|
152
|
+
{
|
|
153
|
+
scene: animation,
|
|
154
|
+
className: cn(clx, "pointer-events-none"),
|
|
155
|
+
"data-vaul-no-drag": true,
|
|
156
|
+
style: {
|
|
157
|
+
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
158
|
+
height: cnst.h,
|
|
159
|
+
...spread_to_transform_default(transform)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
if (video) {
|
|
165
|
+
const dim = constrain(video.dim.md, cnst);
|
|
166
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
167
|
+
video_player_default,
|
|
168
|
+
{
|
|
169
|
+
className: clx,
|
|
170
|
+
sources: video.sources,
|
|
171
|
+
width: dim.w,
|
|
172
|
+
height: dim.h,
|
|
173
|
+
style: {
|
|
174
|
+
minHeight: dim.h,
|
|
175
|
+
...spread_to_transform_default(transform)
|
|
176
|
+
},
|
|
177
|
+
...video.videoProps
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
return img ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
182
|
+
image_default,
|
|
183
|
+
{
|
|
184
|
+
def: img,
|
|
185
|
+
constrainTo: cnst,
|
|
186
|
+
className: clx,
|
|
187
|
+
transform
|
|
188
|
+
}
|
|
189
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: cnst.w, height: cnst.h }, className: cn("bg-level-2", clx) });
|
|
190
|
+
}, "MediaStack");
|
|
191
|
+
var media_stack_default = MediaStack;
|
|
192
|
+
var SplinePlayer = /* @__PURE__ */ __name(({
|
|
193
|
+
scene,
|
|
194
|
+
className,
|
|
195
|
+
style,
|
|
196
|
+
onLoad
|
|
197
|
+
}) => {
|
|
198
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
199
|
+
Spline__default.default,
|
|
200
|
+
{
|
|
201
|
+
scene,
|
|
202
|
+
className: cn("pointer-events-none", className),
|
|
203
|
+
style,
|
|
204
|
+
onLoad
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}, "SplinePlayer");
|
|
208
|
+
var player_default = SplinePlayer;
|
|
209
|
+
|
|
210
|
+
exports.MediaStack = media_stack_default;
|
|
211
|
+
exports.SplinePlayer = player_default;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Spline from '@splinetool/react-spline';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import NextImage from 'next/image';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
+
|
|
12
|
+
// util/spread-to-transform.ts
|
|
13
|
+
function spreadToTransform(t) {
|
|
14
|
+
let transformStrings = [];
|
|
15
|
+
const scaleVal = "scale" in t ? t.scale : void 0;
|
|
16
|
+
if (scaleVal) {
|
|
17
|
+
if (typeof scaleVal === "number") {
|
|
18
|
+
transformStrings.push(`scale(${scaleVal})`);
|
|
19
|
+
} else if (Array.isArray(scaleVal) && scaleVal.length == 2 && typeof scaleVal[0] === "number") {
|
|
20
|
+
transformStrings.push(`scale(${scaleVal[0]}, ${scaleVal[1]})`);
|
|
21
|
+
} else {
|
|
22
|
+
throw new Error("parsing MediaTransform: Unrecognized value for 'scale'!");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return transformStrings.length > 0 ? { transform: transformStrings.join(" ") } : {};
|
|
26
|
+
}
|
|
27
|
+
__name(spreadToTransform, "spreadToTransform");
|
|
28
|
+
var spread_to_transform_default = spreadToTransform;
|
|
29
|
+
function cn(...inputs) {
|
|
30
|
+
return twMerge(clsx(inputs));
|
|
31
|
+
}
|
|
32
|
+
__name(cn, "cn");
|
|
33
|
+
|
|
34
|
+
// util/index.ts
|
|
35
|
+
function constrain(value, minOrConstrainTo, max) {
|
|
36
|
+
if (typeof value === "number" && typeof minOrConstrainTo === "number" && typeof max === "number") {
|
|
37
|
+
return Math.min(Math.max(value, minOrConstrainTo), max);
|
|
38
|
+
}
|
|
39
|
+
if (typeof value === "object" && typeof minOrConstrainTo === "object") {
|
|
40
|
+
const dim = value;
|
|
41
|
+
const constrainTo = minOrConstrainTo;
|
|
42
|
+
const aspectRatio = dim.w / dim.h;
|
|
43
|
+
const constrainAspectRatio = constrainTo.w / constrainTo.h;
|
|
44
|
+
if (aspectRatio > constrainAspectRatio) {
|
|
45
|
+
return {
|
|
46
|
+
w: constrainTo.w,
|
|
47
|
+
h: constrainTo.w / aspectRatio
|
|
48
|
+
};
|
|
49
|
+
} else {
|
|
50
|
+
return {
|
|
51
|
+
w: constrainTo.h * aspectRatio,
|
|
52
|
+
h: constrainTo.h
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
throw new Error("Invalid parameters for constrain function");
|
|
57
|
+
}
|
|
58
|
+
__name(constrain, "constrain");
|
|
59
|
+
var Image = /* @__PURE__ */ __name(({
|
|
60
|
+
def,
|
|
61
|
+
constrainTo,
|
|
62
|
+
transform = {},
|
|
63
|
+
fullWidth = false,
|
|
64
|
+
className = "",
|
|
65
|
+
preload = false
|
|
66
|
+
}) => {
|
|
67
|
+
const {
|
|
68
|
+
src,
|
|
69
|
+
alt: _alt,
|
|
70
|
+
dim,
|
|
71
|
+
sizes,
|
|
72
|
+
svgFillClass: _svgFillClass
|
|
73
|
+
} = def;
|
|
74
|
+
const toSpread = {};
|
|
75
|
+
if (fullWidth) {
|
|
76
|
+
toSpread.style = {
|
|
77
|
+
width: "100%",
|
|
78
|
+
height: "auto",
|
|
79
|
+
...spread_to_transform_default(transform)
|
|
80
|
+
};
|
|
81
|
+
if (constrainTo) {
|
|
82
|
+
toSpread.style.maxWidth = constrainTo.w;
|
|
83
|
+
toSpread.style.maxHeight = constrainTo.h;
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
const resolved = constrainTo ? constrain(dim, constrainTo) : dim;
|
|
87
|
+
toSpread.width = resolved.w;
|
|
88
|
+
toSpread.height = resolved.h;
|
|
89
|
+
toSpread.style = { ...spread_to_transform_default(transform) };
|
|
90
|
+
}
|
|
91
|
+
if (sizes) {
|
|
92
|
+
toSpread.sizes = sizes;
|
|
93
|
+
}
|
|
94
|
+
let alt;
|
|
95
|
+
if (_alt) {
|
|
96
|
+
alt = _alt;
|
|
97
|
+
} else {
|
|
98
|
+
const tokens = src.split("/");
|
|
99
|
+
alt = tokens.length > 0 ? tokens[tokens.length - 1] : src;
|
|
100
|
+
}
|
|
101
|
+
const svgFillClass = _svgFillClass ?? "";
|
|
102
|
+
return fullWidth ? /* @__PURE__ */ jsx("div", { className: "relative flex flex-col items-center justify-center w-full", children: /* @__PURE__ */ jsx(
|
|
103
|
+
NextImage,
|
|
104
|
+
{
|
|
105
|
+
src,
|
|
106
|
+
alt,
|
|
107
|
+
...toSpread,
|
|
108
|
+
priority: preload,
|
|
109
|
+
loading: preload ? "eager" : "lazy",
|
|
110
|
+
className: cn(svgFillClass, className)
|
|
111
|
+
}
|
|
112
|
+
) }) : /* @__PURE__ */ jsx(
|
|
113
|
+
NextImage,
|
|
114
|
+
{
|
|
115
|
+
src,
|
|
116
|
+
alt,
|
|
117
|
+
...toSpread,
|
|
118
|
+
priority: preload,
|
|
119
|
+
loading: preload ? "eager" : "lazy",
|
|
120
|
+
className: cn(svgFillClass, className)
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}, "Image");
|
|
124
|
+
var image_default = Image;
|
|
125
|
+
var VideoPlayer = React.forwardRef(
|
|
126
|
+
({
|
|
127
|
+
sources,
|
|
128
|
+
...rest
|
|
129
|
+
}, ref) => {
|
|
130
|
+
return /* @__PURE__ */ jsx("video", { ref, ...rest, children: sources.map((source, index) => /* @__PURE__ */ jsx("source", { src: source }, index)) });
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
var video_player_default = VideoPlayer;
|
|
134
|
+
var MediaStack = /* @__PURE__ */ __name(({
|
|
135
|
+
media,
|
|
136
|
+
constrainTo: cnst = { w: 250, h: 250 },
|
|
137
|
+
clx = ""
|
|
138
|
+
}) => {
|
|
139
|
+
const { img, video, animation, mediaTransform } = media;
|
|
140
|
+
const transform = mediaTransform ?? {};
|
|
141
|
+
if (animation) {
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
Spline,
|
|
144
|
+
{
|
|
145
|
+
scene: animation,
|
|
146
|
+
className: cn(clx, "pointer-events-none"),
|
|
147
|
+
"data-vaul-no-drag": true,
|
|
148
|
+
style: {
|
|
149
|
+
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
150
|
+
height: cnst.h,
|
|
151
|
+
...spread_to_transform_default(transform)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
if (video) {
|
|
157
|
+
const dim = constrain(video.dim.md, cnst);
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
video_player_default,
|
|
160
|
+
{
|
|
161
|
+
className: clx,
|
|
162
|
+
sources: video.sources,
|
|
163
|
+
width: dim.w,
|
|
164
|
+
height: dim.h,
|
|
165
|
+
style: {
|
|
166
|
+
minHeight: dim.h,
|
|
167
|
+
...spread_to_transform_default(transform)
|
|
168
|
+
},
|
|
169
|
+
...video.videoProps
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return img ? /* @__PURE__ */ jsx(
|
|
174
|
+
image_default,
|
|
175
|
+
{
|
|
176
|
+
def: img,
|
|
177
|
+
constrainTo: cnst,
|
|
178
|
+
className: clx,
|
|
179
|
+
transform
|
|
180
|
+
}
|
|
181
|
+
) : /* @__PURE__ */ jsx("div", { style: { width: cnst.w, height: cnst.h }, className: cn("bg-level-2", clx) });
|
|
182
|
+
}, "MediaStack");
|
|
183
|
+
var media_stack_default = MediaStack;
|
|
184
|
+
var SplinePlayer = /* @__PURE__ */ __name(({
|
|
185
|
+
scene,
|
|
186
|
+
className,
|
|
187
|
+
style,
|
|
188
|
+
onLoad
|
|
189
|
+
}) => {
|
|
190
|
+
return /* @__PURE__ */ jsx(
|
|
191
|
+
Spline,
|
|
192
|
+
{
|
|
193
|
+
scene,
|
|
194
|
+
className: cn("pointer-events-none", className),
|
|
195
|
+
style,
|
|
196
|
+
onLoad
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}, "SplinePlayer");
|
|
200
|
+
var player_default = SplinePlayer;
|
|
201
|
+
|
|
202
|
+
export { media_stack_default as MediaStack, player_default as SplinePlayer };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var Spline = require('@splinetool/react-spline');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var tailwindMerge = require('tailwind-merge');
|
|
7
|
+
var NextImage = require('next/image');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var Spline__default = /*#__PURE__*/_interopDefault(Spline);
|
|
14
|
+
var NextImage__default = /*#__PURE__*/_interopDefault(NextImage);
|
|
15
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
16
|
+
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
19
|
+
|
|
20
|
+
// util/spread-to-transform.ts
|
|
21
|
+
function spreadToTransform(t) {
|
|
22
|
+
let transformStrings = [];
|
|
23
|
+
const scaleVal = "scale" in t ? t.scale : void 0;
|
|
24
|
+
if (scaleVal) {
|
|
25
|
+
if (typeof scaleVal === "number") {
|
|
26
|
+
transformStrings.push(`scale(${scaleVal})`);
|
|
27
|
+
} else if (Array.isArray(scaleVal) && scaleVal.length == 2 && typeof scaleVal[0] === "number") {
|
|
28
|
+
transformStrings.push(`scale(${scaleVal[0]}, ${scaleVal[1]})`);
|
|
29
|
+
} else {
|
|
30
|
+
throw new Error("parsing MediaTransform: Unrecognized value for 'scale'!");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return transformStrings.length > 0 ? { transform: transformStrings.join(" ") } : {};
|
|
34
|
+
}
|
|
35
|
+
__name(spreadToTransform, "spreadToTransform");
|
|
36
|
+
var spread_to_transform_default = spreadToTransform;
|
|
37
|
+
function cn(...inputs) {
|
|
38
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
39
|
+
}
|
|
40
|
+
__name(cn, "cn");
|
|
41
|
+
|
|
42
|
+
// util/index.ts
|
|
43
|
+
function constrain(value, minOrConstrainTo, max) {
|
|
44
|
+
if (typeof value === "number" && typeof minOrConstrainTo === "number" && typeof max === "number") {
|
|
45
|
+
return Math.min(Math.max(value, minOrConstrainTo), max);
|
|
46
|
+
}
|
|
47
|
+
if (typeof value === "object" && typeof minOrConstrainTo === "object") {
|
|
48
|
+
const dim = value;
|
|
49
|
+
const constrainTo = minOrConstrainTo;
|
|
50
|
+
const aspectRatio = dim.w / dim.h;
|
|
51
|
+
const constrainAspectRatio = constrainTo.w / constrainTo.h;
|
|
52
|
+
if (aspectRatio > constrainAspectRatio) {
|
|
53
|
+
return {
|
|
54
|
+
w: constrainTo.w,
|
|
55
|
+
h: constrainTo.w / aspectRatio
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
return {
|
|
59
|
+
w: constrainTo.h * aspectRatio,
|
|
60
|
+
h: constrainTo.h
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
throw new Error("Invalid parameters for constrain function");
|
|
65
|
+
}
|
|
66
|
+
__name(constrain, "constrain");
|
|
67
|
+
var Image = /* @__PURE__ */ __name(({
|
|
68
|
+
def,
|
|
69
|
+
constrainTo,
|
|
70
|
+
transform = {},
|
|
71
|
+
fullWidth = false,
|
|
72
|
+
className = "",
|
|
73
|
+
preload = false
|
|
74
|
+
}) => {
|
|
75
|
+
const {
|
|
76
|
+
src,
|
|
77
|
+
alt: _alt,
|
|
78
|
+
dim,
|
|
79
|
+
sizes,
|
|
80
|
+
svgFillClass: _svgFillClass
|
|
81
|
+
} = def;
|
|
82
|
+
const toSpread = {};
|
|
83
|
+
if (fullWidth) {
|
|
84
|
+
toSpread.style = {
|
|
85
|
+
width: "100%",
|
|
86
|
+
height: "auto",
|
|
87
|
+
...spread_to_transform_default(transform)
|
|
88
|
+
};
|
|
89
|
+
if (constrainTo) {
|
|
90
|
+
toSpread.style.maxWidth = constrainTo.w;
|
|
91
|
+
toSpread.style.maxHeight = constrainTo.h;
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
const resolved = constrainTo ? constrain(dim, constrainTo) : dim;
|
|
95
|
+
toSpread.width = resolved.w;
|
|
96
|
+
toSpread.height = resolved.h;
|
|
97
|
+
toSpread.style = { ...spread_to_transform_default(transform) };
|
|
98
|
+
}
|
|
99
|
+
if (sizes) {
|
|
100
|
+
toSpread.sizes = sizes;
|
|
101
|
+
}
|
|
102
|
+
let alt;
|
|
103
|
+
if (_alt) {
|
|
104
|
+
alt = _alt;
|
|
105
|
+
} else {
|
|
106
|
+
const tokens = src.split("/");
|
|
107
|
+
alt = tokens.length > 0 ? tokens[tokens.length - 1] : src;
|
|
108
|
+
}
|
|
109
|
+
const svgFillClass = _svgFillClass ?? "";
|
|
110
|
+
return fullWidth ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex flex-col items-center justify-center w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
111
|
+
NextImage__default.default,
|
|
112
|
+
{
|
|
113
|
+
src,
|
|
114
|
+
alt,
|
|
115
|
+
...toSpread,
|
|
116
|
+
priority: preload,
|
|
117
|
+
loading: preload ? "eager" : "lazy",
|
|
118
|
+
className: cn(svgFillClass, className)
|
|
119
|
+
}
|
|
120
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
+
NextImage__default.default,
|
|
122
|
+
{
|
|
123
|
+
src,
|
|
124
|
+
alt,
|
|
125
|
+
...toSpread,
|
|
126
|
+
priority: preload,
|
|
127
|
+
loading: preload ? "eager" : "lazy",
|
|
128
|
+
className: cn(svgFillClass, className)
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}, "Image");
|
|
132
|
+
var image_default = Image;
|
|
133
|
+
var VideoPlayer = React__default.default.forwardRef(
|
|
134
|
+
({
|
|
135
|
+
sources,
|
|
136
|
+
...rest
|
|
137
|
+
}, ref) => {
|
|
138
|
+
return /* @__PURE__ */ jsxRuntime.jsx("video", { ref, ...rest, children: sources.map((source, index) => /* @__PURE__ */ jsxRuntime.jsx("source", { src: source }, index)) });
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
var video_player_default = VideoPlayer;
|
|
142
|
+
var MediaStack = /* @__PURE__ */ __name(({
|
|
143
|
+
media,
|
|
144
|
+
constrainTo: cnst = { w: 250, h: 250 },
|
|
145
|
+
clx = ""
|
|
146
|
+
}) => {
|
|
147
|
+
const { img, video, animation, mediaTransform } = media;
|
|
148
|
+
const transform = mediaTransform ?? {};
|
|
149
|
+
if (animation) {
|
|
150
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
151
|
+
Spline__default.default,
|
|
152
|
+
{
|
|
153
|
+
scene: animation,
|
|
154
|
+
className: cn(clx, "pointer-events-none"),
|
|
155
|
+
"data-vaul-no-drag": true,
|
|
156
|
+
style: {
|
|
157
|
+
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
158
|
+
height: cnst.h,
|
|
159
|
+
...spread_to_transform_default(transform)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
if (video) {
|
|
165
|
+
const dim = constrain(video.dim.md, cnst);
|
|
166
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
167
|
+
video_player_default,
|
|
168
|
+
{
|
|
169
|
+
className: clx,
|
|
170
|
+
sources: video.sources,
|
|
171
|
+
width: dim.w,
|
|
172
|
+
height: dim.h,
|
|
173
|
+
style: {
|
|
174
|
+
minHeight: dim.h,
|
|
175
|
+
...spread_to_transform_default(transform)
|
|
176
|
+
},
|
|
177
|
+
...video.videoProps
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
return img ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
182
|
+
image_default,
|
|
183
|
+
{
|
|
184
|
+
def: img,
|
|
185
|
+
constrainTo: cnst,
|
|
186
|
+
className: clx,
|
|
187
|
+
transform
|
|
188
|
+
}
|
|
189
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: cnst.w, height: cnst.h }, className: cn("bg-level-2", clx) });
|
|
190
|
+
}, "MediaStack");
|
|
191
|
+
var media_stack_default = MediaStack;
|
|
192
|
+
|
|
193
|
+
module.exports = media_stack_default;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Spline from '@splinetool/react-spline';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import NextImage from 'next/image';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
+
|
|
12
|
+
// util/spread-to-transform.ts
|
|
13
|
+
function spreadToTransform(t) {
|
|
14
|
+
let transformStrings = [];
|
|
15
|
+
const scaleVal = "scale" in t ? t.scale : void 0;
|
|
16
|
+
if (scaleVal) {
|
|
17
|
+
if (typeof scaleVal === "number") {
|
|
18
|
+
transformStrings.push(`scale(${scaleVal})`);
|
|
19
|
+
} else if (Array.isArray(scaleVal) && scaleVal.length == 2 && typeof scaleVal[0] === "number") {
|
|
20
|
+
transformStrings.push(`scale(${scaleVal[0]}, ${scaleVal[1]})`);
|
|
21
|
+
} else {
|
|
22
|
+
throw new Error("parsing MediaTransform: Unrecognized value for 'scale'!");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return transformStrings.length > 0 ? { transform: transformStrings.join(" ") } : {};
|
|
26
|
+
}
|
|
27
|
+
__name(spreadToTransform, "spreadToTransform");
|
|
28
|
+
var spread_to_transform_default = spreadToTransform;
|
|
29
|
+
function cn(...inputs) {
|
|
30
|
+
return twMerge(clsx(inputs));
|
|
31
|
+
}
|
|
32
|
+
__name(cn, "cn");
|
|
33
|
+
|
|
34
|
+
// util/index.ts
|
|
35
|
+
function constrain(value, minOrConstrainTo, max) {
|
|
36
|
+
if (typeof value === "number" && typeof minOrConstrainTo === "number" && typeof max === "number") {
|
|
37
|
+
return Math.min(Math.max(value, minOrConstrainTo), max);
|
|
38
|
+
}
|
|
39
|
+
if (typeof value === "object" && typeof minOrConstrainTo === "object") {
|
|
40
|
+
const dim = value;
|
|
41
|
+
const constrainTo = minOrConstrainTo;
|
|
42
|
+
const aspectRatio = dim.w / dim.h;
|
|
43
|
+
const constrainAspectRatio = constrainTo.w / constrainTo.h;
|
|
44
|
+
if (aspectRatio > constrainAspectRatio) {
|
|
45
|
+
return {
|
|
46
|
+
w: constrainTo.w,
|
|
47
|
+
h: constrainTo.w / aspectRatio
|
|
48
|
+
};
|
|
49
|
+
} else {
|
|
50
|
+
return {
|
|
51
|
+
w: constrainTo.h * aspectRatio,
|
|
52
|
+
h: constrainTo.h
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
throw new Error("Invalid parameters for constrain function");
|
|
57
|
+
}
|
|
58
|
+
__name(constrain, "constrain");
|
|
59
|
+
var Image = /* @__PURE__ */ __name(({
|
|
60
|
+
def,
|
|
61
|
+
constrainTo,
|
|
62
|
+
transform = {},
|
|
63
|
+
fullWidth = false,
|
|
64
|
+
className = "",
|
|
65
|
+
preload = false
|
|
66
|
+
}) => {
|
|
67
|
+
const {
|
|
68
|
+
src,
|
|
69
|
+
alt: _alt,
|
|
70
|
+
dim,
|
|
71
|
+
sizes,
|
|
72
|
+
svgFillClass: _svgFillClass
|
|
73
|
+
} = def;
|
|
74
|
+
const toSpread = {};
|
|
75
|
+
if (fullWidth) {
|
|
76
|
+
toSpread.style = {
|
|
77
|
+
width: "100%",
|
|
78
|
+
height: "auto",
|
|
79
|
+
...spread_to_transform_default(transform)
|
|
80
|
+
};
|
|
81
|
+
if (constrainTo) {
|
|
82
|
+
toSpread.style.maxWidth = constrainTo.w;
|
|
83
|
+
toSpread.style.maxHeight = constrainTo.h;
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
const resolved = constrainTo ? constrain(dim, constrainTo) : dim;
|
|
87
|
+
toSpread.width = resolved.w;
|
|
88
|
+
toSpread.height = resolved.h;
|
|
89
|
+
toSpread.style = { ...spread_to_transform_default(transform) };
|
|
90
|
+
}
|
|
91
|
+
if (sizes) {
|
|
92
|
+
toSpread.sizes = sizes;
|
|
93
|
+
}
|
|
94
|
+
let alt;
|
|
95
|
+
if (_alt) {
|
|
96
|
+
alt = _alt;
|
|
97
|
+
} else {
|
|
98
|
+
const tokens = src.split("/");
|
|
99
|
+
alt = tokens.length > 0 ? tokens[tokens.length - 1] : src;
|
|
100
|
+
}
|
|
101
|
+
const svgFillClass = _svgFillClass ?? "";
|
|
102
|
+
return fullWidth ? /* @__PURE__ */ jsx("div", { className: "relative flex flex-col items-center justify-center w-full", children: /* @__PURE__ */ jsx(
|
|
103
|
+
NextImage,
|
|
104
|
+
{
|
|
105
|
+
src,
|
|
106
|
+
alt,
|
|
107
|
+
...toSpread,
|
|
108
|
+
priority: preload,
|
|
109
|
+
loading: preload ? "eager" : "lazy",
|
|
110
|
+
className: cn(svgFillClass, className)
|
|
111
|
+
}
|
|
112
|
+
) }) : /* @__PURE__ */ jsx(
|
|
113
|
+
NextImage,
|
|
114
|
+
{
|
|
115
|
+
src,
|
|
116
|
+
alt,
|
|
117
|
+
...toSpread,
|
|
118
|
+
priority: preload,
|
|
119
|
+
loading: preload ? "eager" : "lazy",
|
|
120
|
+
className: cn(svgFillClass, className)
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}, "Image");
|
|
124
|
+
var image_default = Image;
|
|
125
|
+
var VideoPlayer = React.forwardRef(
|
|
126
|
+
({
|
|
127
|
+
sources,
|
|
128
|
+
...rest
|
|
129
|
+
}, ref) => {
|
|
130
|
+
return /* @__PURE__ */ jsx("video", { ref, ...rest, children: sources.map((source, index) => /* @__PURE__ */ jsx("source", { src: source }, index)) });
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
var video_player_default = VideoPlayer;
|
|
134
|
+
var MediaStack = /* @__PURE__ */ __name(({
|
|
135
|
+
media,
|
|
136
|
+
constrainTo: cnst = { w: 250, h: 250 },
|
|
137
|
+
clx = ""
|
|
138
|
+
}) => {
|
|
139
|
+
const { img, video, animation, mediaTransform } = media;
|
|
140
|
+
const transform = mediaTransform ?? {};
|
|
141
|
+
if (animation) {
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
Spline,
|
|
144
|
+
{
|
|
145
|
+
scene: animation,
|
|
146
|
+
className: cn(clx, "pointer-events-none"),
|
|
147
|
+
"data-vaul-no-drag": true,
|
|
148
|
+
style: {
|
|
149
|
+
width: 6 / 5 * (typeof cnst.h === "number" ? cnst.h : parseInt(cnst.h)),
|
|
150
|
+
height: cnst.h,
|
|
151
|
+
...spread_to_transform_default(transform)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
if (video) {
|
|
157
|
+
const dim = constrain(video.dim.md, cnst);
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
video_player_default,
|
|
160
|
+
{
|
|
161
|
+
className: clx,
|
|
162
|
+
sources: video.sources,
|
|
163
|
+
width: dim.w,
|
|
164
|
+
height: dim.h,
|
|
165
|
+
style: {
|
|
166
|
+
minHeight: dim.h,
|
|
167
|
+
...spread_to_transform_default(transform)
|
|
168
|
+
},
|
|
169
|
+
...video.videoProps
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return img ? /* @__PURE__ */ jsx(
|
|
174
|
+
image_default,
|
|
175
|
+
{
|
|
176
|
+
def: img,
|
|
177
|
+
constrainTo: cnst,
|
|
178
|
+
className: clx,
|
|
179
|
+
transform
|
|
180
|
+
}
|
|
181
|
+
) : /* @__PURE__ */ jsx("div", { style: { width: cnst.w, height: cnst.h }, className: cn("bg-level-2", clx) });
|
|
182
|
+
}, "MediaStack");
|
|
183
|
+
var media_stack_default = MediaStack;
|
|
184
|
+
|
|
185
|
+
export { media_stack_default as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var Spline = require('@splinetool/react-spline');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var tailwindMerge = require('tailwind-merge');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var Spline__default = /*#__PURE__*/_interopDefault(Spline);
|
|
12
|
+
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
+
function cn(...inputs) {
|
|
16
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
17
|
+
}
|
|
18
|
+
__name(cn, "cn");
|
|
19
|
+
var SplinePlayer = /* @__PURE__ */ __name(({
|
|
20
|
+
scene,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
onLoad
|
|
24
|
+
}) => {
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
Spline__default.default,
|
|
27
|
+
{
|
|
28
|
+
scene,
|
|
29
|
+
className: cn("pointer-events-none", className),
|
|
30
|
+
style,
|
|
31
|
+
onLoad
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}, "SplinePlayer");
|
|
35
|
+
var player_default = SplinePlayer;
|
|
36
|
+
|
|
37
|
+
module.exports = player_default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Spline from '@splinetool/react-spline';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
__name(cn, "cn");
|
|
13
|
+
var SplinePlayer = /* @__PURE__ */ __name(({
|
|
14
|
+
scene,
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
onLoad
|
|
18
|
+
}) => {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
Spline,
|
|
21
|
+
{
|
|
22
|
+
scene,
|
|
23
|
+
className: cn("pointer-events-none", className),
|
|
24
|
+
style,
|
|
25
|
+
onLoad
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}, "SplinePlayer");
|
|
29
|
+
var player_default = SplinePlayer;
|
|
30
|
+
|
|
31
|
+
export { player_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/ui",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.32",
|
|
4
4
|
"description": "Multi-framework UI library with React, Vue, Svelte, and React Native support. Based on shadcn/ui with comprehensive framework coverage.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -424,6 +424,16 @@
|
|
|
424
424
|
"import": "./dist/code/*.mjs",
|
|
425
425
|
"require": "./dist/code/*.js"
|
|
426
426
|
},
|
|
427
|
+
"./spline": {
|
|
428
|
+
"types": "./dist/spline/index.d.ts",
|
|
429
|
+
"import": "./dist/spline/index.mjs",
|
|
430
|
+
"require": "./dist/spline/index.js"
|
|
431
|
+
},
|
|
432
|
+
"./spline/*": {
|
|
433
|
+
"types": "./dist/spline/*.d.ts",
|
|
434
|
+
"import": "./dist/spline/*.mjs",
|
|
435
|
+
"require": "./dist/spline/*.js"
|
|
436
|
+
},
|
|
427
437
|
"./3d": {
|
|
428
438
|
"types": "./dist/3d/index.d.ts",
|
|
429
439
|
"import": "./dist/3d/index.mjs",
|
|
@@ -705,7 +715,7 @@
|
|
|
705
715
|
"@mdx-js/loader": "^3.0.0",
|
|
706
716
|
"@mdx-js/react": "^3.0.0",
|
|
707
717
|
"@radix-ui/react-primitive": "^2.1.3",
|
|
708
|
-
"@splinetool/react-spline": "^4.
|
|
718
|
+
"@splinetool/react-spline": "^4.0.0",
|
|
709
719
|
"@testing-library/jest-dom": "^6.9.1",
|
|
710
720
|
"@testing-library/react": "^16.3.0",
|
|
711
721
|
"@types/facebook-pixel": "^0.0.30",
|