@hanzo/ui 8.27.8 → 8.27.10
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/README.md +2 -1
- package/dist/backends/gui/3d-card.cjs +100 -0
- package/dist/backends/gui/3d-card.d.ts +59 -0
- package/dist/backends/gui/3d-card.d.ts.map +1 -0
- package/dist/backends/gui/3d-card.js +92 -0
- package/dist/backends/gui/3d-card.js.map +1 -0
- package/dist/backends/gui/3d-marquee.cjs +225 -0
- package/dist/backends/gui/3d-marquee.d.ts +114 -0
- package/dist/backends/gui/3d-marquee.d.ts.map +1 -0
- package/dist/backends/gui/3d-marquee.js +190 -0
- package/dist/backends/gui/3d-marquee.js.map +1 -0
- package/dist/backends/gui/3d-pin.cjs +51 -0
- package/dist/backends/gui/3d-pin.d.ts +14 -0
- package/dist/backends/gui/3d-pin.d.ts.map +1 -0
- package/dist/backends/gui/3d-pin.js +49 -0
- package/dist/backends/gui/3d-pin.js.map +1 -0
- package/dist/backends/gui/advanced-chart.cjs +61 -0
- package/dist/backends/gui/advanced-chart.d.ts +38 -0
- package/dist/backends/gui/advanced-chart.d.ts.map +1 -0
- package/dist/backends/gui/advanced-chart.js +59 -0
- package/dist/backends/gui/advanced-chart.js.map +1 -0
- package/dist/backends/gui/alert.cjs +106 -0
- package/dist/backends/gui/alert.d.ts +39 -0
- package/dist/backends/gui/alert.d.ts.map +1 -0
- package/dist/backends/gui/alert.js +102 -0
- package/dist/backends/gui/alert.js.map +1 -0
- package/dist/backends/gui/android.cjs +52 -0
- package/dist/backends/gui/android.d.ts +16 -0
- package/dist/backends/gui/android.d.ts.map +1 -0
- package/dist/backends/gui/android.js +50 -0
- package/dist/backends/gui/android.js.map +1 -0
- package/dist/backends/gui/animated-beam.cjs +97 -0
- package/dist/backends/gui/animated-beam.d.ts +57 -0
- package/dist/backends/gui/animated-beam.d.ts.map +1 -0
- package/dist/backends/gui/animated-beam.js +62 -0
- package/dist/backends/gui/animated-beam.js.map +1 -0
- package/dist/backends/gui/animated-cursor.cjs +183 -0
- package/dist/backends/gui/animated-cursor.d.ts +42 -0
- package/dist/backends/gui/animated-cursor.d.ts.map +1 -0
- package/dist/backends/gui/animated-cursor.js +181 -0
- package/dist/backends/gui/animated-cursor.js.map +1 -0
- package/dist/backends/gui/animated-testimonials.cjs +109 -0
- package/dist/backends/gui/animated-testimonials.d.ts +23 -0
- package/dist/backends/gui/animated-testimonials.d.ts.map +1 -0
- package/dist/backends/gui/animated-testimonials.js +74 -0
- package/dist/backends/gui/animated-testimonials.js.map +1 -0
- package/dist/backends/gui/animated-tooltip.cjs +100 -0
- package/dist/backends/gui/animated-tooltip.d.ts +15 -0
- package/dist/backends/gui/animated-tooltip.d.ts.map +1 -0
- package/dist/backends/gui/animated-tooltip.js +65 -0
- package/dist/backends/gui/animated-tooltip.js.map +1 -0
- package/dist/backends/gui/announcement.cjs +54 -0
- package/dist/backends/gui/announcement.d.ts +26 -0
- package/dist/backends/gui/announcement.d.ts.map +1 -0
- package/dist/backends/gui/announcement.js +52 -0
- package/dist/backends/gui/announcement.js.map +1 -0
- package/dist/backends/gui/apple-cards-carousel.cjs +198 -0
- package/dist/backends/gui/apple-cards-carousel.d.ts +45 -0
- package/dist/backends/gui/apple-cards-carousel.d.ts.map +1 -0
- package/dist/backends/gui/apple-cards-carousel.js +162 -0
- package/dist/backends/gui/apple-cards-carousel.js.map +1 -0
- package/dist/backends/gui/apple-hello-effect.cjs +38 -0
- package/dist/backends/gui/apple-hello-effect.d.ts +9 -0
- package/dist/backends/gui/apple-hello-effect.d.ts.map +1 -0
- package/dist/backends/gui/apple-hello-effect.js +36 -0
- package/dist/backends/gui/apple-hello-effect.js.map +1 -0
- package/dist/backends/gui/banner.cjs +108 -0
- package/dist/backends/gui/banner.d.ts +33 -0
- package/dist/backends/gui/banner.d.ts.map +1 -0
- package/dist/backends/gui/banner.js +106 -0
- package/dist/backends/gui/banner.js.map +1 -0
- package/dist/backends/gui/calendar.cjs +152 -0
- package/dist/backends/gui/calendar.d.ts +41 -0
- package/dist/backends/gui/calendar.d.ts.map +1 -0
- package/dist/backends/gui/calendar.js +151 -0
- package/dist/backends/gui/calendar.js.map +1 -0
- package/dist/backends/gui/choicebox.cjs +50 -0
- package/dist/backends/gui/choicebox.d.ts +33 -0
- package/dist/backends/gui/choicebox.d.ts.map +1 -0
- package/dist/backends/gui/choicebox.js +49 -0
- package/dist/backends/gui/choicebox.js.map +1 -0
- package/dist/backends/gui/code-block.cjs +120 -0
- package/dist/backends/gui/code-block.d.ts +22 -0
- package/dist/backends/gui/code-block.d.ts.map +1 -0
- package/dist/backends/gui/code-block.js +118 -0
- package/dist/backends/gui/code-block.js.map +1 -0
- package/dist/backends/gui/code-editor.cjs +195 -0
- package/dist/backends/gui/code-editor.d.ts +43 -0
- package/dist/backends/gui/code-editor.d.ts.map +1 -0
- package/dist/backends/gui/code-editor.js +160 -0
- package/dist/backends/gui/code-editor.js.map +1 -0
- package/dist/backends/gui/code-tabs.cjs +21 -0
- package/dist/backends/gui/code-tabs.d.ts +22 -0
- package/dist/backends/gui/code-tabs.d.ts.map +1 -0
- package/dist/backends/gui/code-tabs.js +19 -0
- package/dist/backends/gui/code-tabs.js.map +1 -0
- package/dist/backends/gui/color-picker.cjs +141 -0
- package/dist/backends/gui/color-picker.d.ts +25 -0
- package/dist/backends/gui/color-picker.d.ts.map +1 -0
- package/dist/backends/gui/color-picker.js +139 -0
- package/dist/backends/gui/color-picker.js.map +1 -0
- package/dist/backends/gui/combobox.cjs +42 -0
- package/dist/backends/gui/combobox.d.ts +39 -0
- package/dist/backends/gui/combobox.d.ts.map +1 -0
- package/dist/backends/gui/combobox.js +40 -0
- package/dist/backends/gui/combobox.js.map +1 -0
- package/dist/backends/gui/company-profile.cjs +43 -0
- package/dist/backends/gui/company-profile.d.ts +33 -0
- package/dist/backends/gui/company-profile.d.ts.map +1 -0
- package/dist/backends/gui/company-profile.js +41 -0
- package/dist/backends/gui/company-profile.js.map +1 -0
- package/dist/backends/gui/comparison.cjs +43 -0
- package/dist/backends/gui/comparison.d.ts +16 -0
- package/dist/backends/gui/comparison.d.ts.map +1 -0
- package/dist/backends/gui/comparison.js +41 -0
- package/dist/backends/gui/comparison.js.map +1 -0
- package/dist/backends/gui/credit-card.cjs +80 -0
- package/dist/backends/gui/credit-card.d.ts +21 -0
- package/dist/backends/gui/credit-card.d.ts.map +1 -0
- package/dist/backends/gui/credit-card.js +78 -0
- package/dist/backends/gui/credit-card.js.map +1 -0
- package/dist/backends/gui/crypto-market.cjs +128 -0
- package/dist/backends/gui/crypto-market.d.ts +52 -0
- package/dist/backends/gui/crypto-market.d.ts.map +1 -0
- package/dist/backends/gui/crypto-market.js +126 -0
- package/dist/backends/gui/crypto-market.js.map +1 -0
- package/dist/backends/gui/crypto-screener.cjs +55 -0
- package/dist/backends/gui/crypto-screener.d.ts +42 -0
- package/dist/backends/gui/crypto-screener.d.ts.map +1 -0
- package/dist/backends/gui/crypto-screener.js +53 -0
- package/dist/backends/gui/crypto-screener.js.map +1 -0
- package/dist/backends/gui/cursor.cjs +40 -0
- package/dist/backends/gui/cursor.d.ts +16 -0
- package/dist/backends/gui/cursor.d.ts.map +1 -0
- package/dist/backends/gui/cursor.js +38 -0
- package/dist/backends/gui/cursor.js.map +1 -0
- package/dist/backends/gui/data-table.cjs +211 -0
- package/dist/backends/gui/data-table.d.ts +71 -0
- package/dist/backends/gui/data-table.d.ts.map +1 -0
- package/dist/backends/gui/data-table.js +175 -0
- package/dist/backends/gui/data-table.js.map +1 -0
- package/dist/backends/gui/date-picker.cjs +66 -0
- package/dist/backends/gui/date-picker.d.ts +29 -0
- package/dist/backends/gui/date-picker.d.ts.map +1 -0
- package/dist/backends/gui/date-picker.js +64 -0
- package/dist/backends/gui/date-picker.js.map +1 -0
- package/dist/backends/gui/desktop-spotlight.cjs +46 -0
- package/dist/backends/gui/desktop-spotlight.d.ts +34 -0
- package/dist/backends/gui/desktop-spotlight.d.ts.map +1 -0
- package/dist/backends/gui/desktop-spotlight.js +44 -0
- package/dist/backends/gui/desktop-spotlight.js.map +1 -0
- package/dist/backends/gui/desktop-window.cjs +180 -0
- package/dist/backends/gui/desktop-window.d.ts +51 -0
- package/dist/backends/gui/desktop-window.d.ts.map +1 -0
- package/dist/backends/gui/desktop-window.js +177 -0
- package/dist/backends/gui/desktop-window.js.map +1 -0
- package/dist/backends/gui/desktop.cjs +238 -0
- package/dist/backends/gui/desktop.d.ts +109 -0
- package/dist/backends/gui/desktop.d.ts.map +1 -0
- package/dist/backends/gui/desktop.js +199 -0
- package/dist/backends/gui/desktop.js.map +1 -0
- package/dist/backends/gui/dialog-stack.cjs +26 -0
- package/dist/backends/gui/dialog-stack.d.ts +23 -0
- package/dist/backends/gui/dialog-stack.d.ts.map +1 -0
- package/dist/backends/gui/dialog-stack.js +24 -0
- package/dist/backends/gui/dialog-stack.js.map +1 -0
- package/dist/backends/gui/dock.cjs +99 -0
- package/dist/backends/gui/dock.d.ts +41 -0
- package/dist/backends/gui/dock.d.ts.map +1 -0
- package/dist/backends/gui/dock.js +96 -0
- package/dist/backends/gui/dock.js.map +1 -0
- package/dist/backends/gui/dropzone.cjs +142 -0
- package/dist/backends/gui/dropzone.d.ts +12 -0
- package/dist/backends/gui/dropzone.d.ts.map +1 -0
- package/dist/backends/gui/dropzone.js +140 -0
- package/dist/backends/gui/dropzone.js.map +1 -0
- package/dist/backends/gui/editor.cjs +80 -0
- package/dist/backends/gui/editor.d.ts +23 -0
- package/dist/backends/gui/editor.d.ts.map +1 -0
- package/dist/backends/gui/editor.js +45 -0
- package/dist/backends/gui/editor.js.map +1 -0
- package/dist/backends/gui/empty.cjs +71 -0
- package/dist/backends/gui/empty.d.ts +43 -0
- package/dist/backends/gui/empty.d.ts.map +1 -0
- package/dist/backends/gui/empty.js +63 -0
- package/dist/backends/gui/empty.js.map +1 -0
- package/dist/backends/gui/financials.cjs +45 -0
- package/dist/backends/gui/financials.d.ts +36 -0
- package/dist/backends/gui/financials.d.ts.map +1 -0
- package/dist/backends/gui/financials.js +43 -0
- package/dist/backends/gui/financials.js.map +1 -0
- package/dist/backends/gui/forex-market.cjs +21 -0
- package/dist/backends/gui/forex-market.d.ts +17 -0
- package/dist/backends/gui/forex-market.d.ts.map +1 -0
- package/dist/backends/gui/forex-market.js +19 -0
- package/dist/backends/gui/forex-market.js.map +1 -0
- package/dist/backends/gui/forex-screener.cjs +57 -0
- package/dist/backends/gui/forex-screener.d.ts +45 -0
- package/dist/backends/gui/forex-screener.d.ts.map +1 -0
- package/dist/backends/gui/forex-screener.js +55 -0
- package/dist/backends/gui/forex-screener.js.map +1 -0
- package/dist/backends/gui/gantt.cjs +50 -0
- package/dist/backends/gui/gantt.d.ts +19 -0
- package/dist/backends/gui/gantt.d.ts.map +1 -0
- package/dist/backends/gui/gantt.js +49 -0
- package/dist/backends/gui/gantt.js.map +1 -0
- package/dist/backends/gui/index.cjs +108 -1
- package/dist/backends/gui/index.d.ts +41 -0
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +41 -0
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/canvas.cjs +3 -3
- package/dist/canvas.js +3 -3
- package/dist/canvas.js.map +1 -1
- package/dist/gallery.html +2 -2
- package/dist/grid.cjs +19 -43
- package/dist/grid.d.ts +36 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +19 -43
- package/dist/grid.js.map +1 -1
- package/dist/index.cjs +70 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +70 -1
- package/dist/index.node.js +3 -0
- package/dist/product/ChunkGuard.cjs +58 -0
- package/dist/product/ChunkGuard.d.ts +7 -0
- package/dist/product/ChunkGuard.d.ts.map +1 -0
- package/dist/product/ChunkGuard.js +56 -0
- package/dist/product/ChunkGuard.js.map +1 -0
- package/dist/product/DetailPane.cjs +46 -0
- package/dist/product/DetailPane.d.ts +47 -0
- package/dist/product/DetailPane.d.ts.map +1 -0
- package/dist/product/DetailPane.js +43 -0
- package/dist/product/DetailPane.js.map +1 -0
- package/dist/product/Fact.cjs +19 -0
- package/dist/product/Fact.d.ts +23 -0
- package/dist/product/Fact.d.ts.map +1 -0
- package/dist/product/Fact.js +17 -0
- package/dist/product/Fact.js.map +1 -0
- package/dist/product/chunkGuard.logic.cjs +54 -0
- package/dist/product/chunkGuard.logic.d.ts +26 -0
- package/dist/product/chunkGuard.logic.d.ts.map +1 -0
- package/dist/product/chunkGuard.logic.js +49 -0
- package/dist/product/chunkGuard.logic.js.map +1 -0
- package/dist/product/index.cjs +10 -0
- package/dist/product/index.d.ts +3 -0
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +10 -0
- package/dist/product/index.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -215,4 +215,5 @@ emit({ component: 'PlanCard', action: 'select', id: 'pro' })
|
|
|
215
215
|
- **Clean-room** — original implementation, no GPL / Twenty code. Airtable/Twenty-*class* polish, our own code.
|
|
216
216
|
- **Cross-platform** — web + native + desktop, because it's only `@hanzo/gui`.
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
Hanzo AI, Inc — licensed [Apache-2.0](./LICENSE-APACHE) OR [MIT](./LICENSE-MIT), at your
|
|
219
|
+
option. HIP-0137 (`hanzoai/hips`).
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Card3DFooter = exports.Card3DContent = exports.Card3DDescription = exports.Card3DTitle = exports.Card3DHeader = void 0;
|
|
5
|
+
exports.Card3D = Card3D;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* Card3D — a card that tilts toward the pointer.
|
|
9
|
+
*
|
|
10
|
+
* The frame turns about its centre by up to `maxTilt` degrees in proportion to
|
|
11
|
+
* where the pointer sits, grows by `scale` while the pointer is on it, and eases
|
|
12
|
+
* flat again over `speed` ms once it leaves. A radial glare follows the pointer
|
|
13
|
+
* across the surface. Header, title, description, content and footer each stand
|
|
14
|
+
* at their own `depth` along z, so the layers part as the card turns.
|
|
15
|
+
*
|
|
16
|
+
* The live transform is an inline style rather than a style prop: gui compiles
|
|
17
|
+
* a style prop to one class per distinct value, and a tilt takes a new value on
|
|
18
|
+
* every pixel of travel. A layer's depth is fixed and goes inline only to stay
|
|
19
|
+
* in the same vocabulary.
|
|
20
|
+
*/
|
|
21
|
+
const gui_1 = require("@hanzo/gui");
|
|
22
|
+
const react_1 = require("react");
|
|
23
|
+
const ink_1 = require("./ink.cjs");
|
|
24
|
+
const slot_1 = require("./slot.cjs");
|
|
25
|
+
const PAD = 24;
|
|
26
|
+
/** Where each layer stands along z, in px. The glare rides above the deepest. */
|
|
27
|
+
const DEPTH = { header: 20, title: 30, description: 10, content: 25, footer: 15, glare: 40 };
|
|
28
|
+
const EASE = 'cubic-bezier(0.03, 0.98, 0.52, 0.99)';
|
|
29
|
+
const Frame = (0, gui_1.styled)(gui_1.YStack, {
|
|
30
|
+
name: 'Card3D',
|
|
31
|
+
position: 'relative',
|
|
32
|
+
bg: '$background',
|
|
33
|
+
borderWidth: 1,
|
|
34
|
+
borderColor: '$borderColor',
|
|
35
|
+
rounded: '$6',
|
|
36
|
+
py: PAD,
|
|
37
|
+
gap: PAD,
|
|
38
|
+
shadowColor: '$shadowColor',
|
|
39
|
+
shadowRadius: 24,
|
|
40
|
+
shadowOffset: { width: 0, height: 8 },
|
|
41
|
+
cursor: 'pointer',
|
|
42
|
+
});
|
|
43
|
+
const Glare = (0, gui_1.styled)(gui_1.YStack, {
|
|
44
|
+
name: 'Card3DGlare',
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
inset: 0,
|
|
47
|
+
rounded: '$6',
|
|
48
|
+
pointerEvents: 'none',
|
|
49
|
+
});
|
|
50
|
+
const HeaderFrame = (0, gui_1.styled)(gui_1.YStack, { name: 'Card3DHeader', px: PAD, gap: '$1.5' });
|
|
51
|
+
const TitleFrame = (0, gui_1.styled)(gui_1.SizableText, { name: 'Card3DTitle', size: '$7', fontWeight: '600' });
|
|
52
|
+
const DescriptionFrame = (0, gui_1.styled)(gui_1.SizableText, { name: 'Card3DDescription', size: '$2', color: '$quiet' });
|
|
53
|
+
const ContentFrame = (0, gui_1.styled)(gui_1.YStack, { name: 'Card3DContent', px: PAD });
|
|
54
|
+
const FooterFrame = (0, gui_1.styled)(gui_1.XStack, { name: 'Card3DFooter', px: PAD, items: 'center' });
|
|
55
|
+
/** The pointer as fractions of the card, 0..1 from its top-left corner. */
|
|
56
|
+
const CENTRE = { x: 0.5, y: 0.5, live: false };
|
|
57
|
+
function Card3D({ maxTilt = 15, perspective = 1000, scale = 1.05, speed = 400, glare = true, glareMaxOpacity = 0.7, children, ...p }) {
|
|
58
|
+
const [at, setAt] = (0, react_1.useState)(CENTRE);
|
|
59
|
+
// Settles when the pointer leaves: by moving off or, for one that cannot
|
|
60
|
+
// hover, by lifting — a touch's pointerup or cancel is followed by pointerleave.
|
|
61
|
+
// The last position is kept so the glare fades where it was, not at the centre.
|
|
62
|
+
const rest = () => setAt((a) => ({ ...a, live: false }));
|
|
63
|
+
const move = (e) => {
|
|
64
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
65
|
+
setAt({ x: (e.clientX - r.left) / r.width, y: (e.clientY - r.top) / r.height, live: true });
|
|
66
|
+
};
|
|
67
|
+
const rx = at.live ? (1 - 2 * at.y) * maxTilt : 0;
|
|
68
|
+
const ry = at.live ? (2 * at.x - 1) * maxTilt : 0;
|
|
69
|
+
return ((0, jsx_runtime_1.jsxs)(Frame, { ...(0, slot_1.slot)('3d-card'), "data-state": at.live ? 'hover' : 'idle', style: {
|
|
70
|
+
transform: `perspective(${perspective}px) rotateX(${rx}deg) rotateY(${ry}deg) scale(${at.live ? scale : 1})`,
|
|
71
|
+
transition: at.live ? 'none' : `transform ${speed}ms ${EASE}`,
|
|
72
|
+
transformStyle: 'preserve-3d',
|
|
73
|
+
willChange: 'transform',
|
|
74
|
+
touchAction: 'none',
|
|
75
|
+
}, onPointerMove: move, onPointerLeave: rest, ...p, children: [children, glare && ((0, jsx_runtime_1.jsx)(Glare, { ...(0, slot_1.slot)('3d-card-glare'), style: {
|
|
76
|
+
opacity: at.live ? 1 : 0,
|
|
77
|
+
background: `radial-gradient(circle at ${at.x * 100}% ${at.y * 100}%, rgba(255,255,255,${glareMaxOpacity}) 0%, transparent 50%)`,
|
|
78
|
+
transition: at.live ? 'none' : `opacity ${speed}ms ease-out`,
|
|
79
|
+
// Above every layer, shrunk by what the perspective would grow it,
|
|
80
|
+
// so it meets the card's edge instead of overhanging it.
|
|
81
|
+
transform: `translateZ(${DEPTH.glare}px) scale(${(perspective - DEPTH.glare) / perspective})`,
|
|
82
|
+
} }))] }));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A layer's own transform: its depth along z, under whatever inline style the
|
|
86
|
+
* caller adds — so a colour on a title keeps the title standing off the card.
|
|
87
|
+
*/
|
|
88
|
+
const layer = (depth, style) => ({
|
|
89
|
+
style: { transform: `translateZ(${depth}px)`, ...style },
|
|
90
|
+
});
|
|
91
|
+
const Card3DHeader = ({ depth = DEPTH.header, style, ...p }) => ((0, jsx_runtime_1.jsx)(HeaderFrame, { ...(0, slot_1.slot)('3d-card-header'), ...layer(depth, style), ...p }));
|
|
92
|
+
exports.Card3DHeader = Card3DHeader;
|
|
93
|
+
const Card3DTitle = ({ depth = DEPTH.title, style, ...p }) => ((0, jsx_runtime_1.jsx)(TitleFrame, { ...(0, slot_1.slot)('3d-card-title'), ...layer(depth, style), ...p }));
|
|
94
|
+
exports.Card3DTitle = Card3DTitle;
|
|
95
|
+
const Card3DDescription = ({ depth = DEPTH.description, style, ...p }) => ((0, jsx_runtime_1.jsx)(DescriptionFrame, { ...(0, slot_1.slot)('3d-card-description'), ...layer(depth, style), ...p }));
|
|
96
|
+
exports.Card3DDescription = Card3DDescription;
|
|
97
|
+
const Card3DContent = ({ depth = DEPTH.content, style, children, ...p }) => ((0, jsx_runtime_1.jsx)(ContentFrame, { ...(0, slot_1.slot)('3d-card-content'), ...layer(depth, style), ...p, children: (0, ink_1.ink)(children) }));
|
|
98
|
+
exports.Card3DContent = Card3DContent;
|
|
99
|
+
const Card3DFooter = ({ depth = DEPTH.footer, style, children, ...p }) => ((0, jsx_runtime_1.jsx)(FooterFrame, { ...(0, slot_1.slot)('3d-card-footer'), ...layer(depth, style), ...p, children: (0, ink_1.ink)(children) }));
|
|
100
|
+
exports.Card3DFooter = Card3DFooter;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type CSSProperties, type ComponentProps, type ElementType } from 'react';
|
|
2
|
+
declare const Frame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
3
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
4
|
+
fullscreen?: boolean | undefined;
|
|
5
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
6
|
+
declare const HeaderFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
7
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
8
|
+
fullscreen?: boolean | undefined;
|
|
9
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
10
|
+
declare const TitleFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
|
|
11
|
+
unstyled?: boolean | undefined;
|
|
12
|
+
size?: import("@hanzogui/web").FontSizeTokens | undefined;
|
|
13
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
14
|
+
declare const DescriptionFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
|
|
15
|
+
unstyled?: boolean | undefined;
|
|
16
|
+
size?: import("@hanzogui/web").FontSizeTokens | undefined;
|
|
17
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
18
|
+
declare const ContentFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
19
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
20
|
+
fullscreen?: boolean | undefined;
|
|
21
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
22
|
+
declare const FooterFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
23
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
24
|
+
fullscreen?: boolean | undefined;
|
|
25
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
26
|
+
export type Card3DProps = ComponentProps<typeof Frame> & {
|
|
27
|
+
/** Largest turn about either axis, in degrees, reached at the card's edge. */
|
|
28
|
+
maxTilt?: number;
|
|
29
|
+
/** Viewer distance in px; shorter is a more dramatic turn. */
|
|
30
|
+
perspective?: number;
|
|
31
|
+
/** Growth while the pointer is on the card. */
|
|
32
|
+
scale?: number;
|
|
33
|
+
/** How long the card takes to settle flat, in ms. */
|
|
34
|
+
speed?: number;
|
|
35
|
+
/** Whether the radial highlight follows the pointer. */
|
|
36
|
+
glare?: boolean;
|
|
37
|
+
/** Peak alpha of that highlight. */
|
|
38
|
+
glareMaxOpacity?: number;
|
|
39
|
+
};
|
|
40
|
+
type Layer = {
|
|
41
|
+
/** Distance the layer stands off the surface, in px. */
|
|
42
|
+
depth?: number;
|
|
43
|
+
/** Inline style, laid over the depth transform. */
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
};
|
|
46
|
+
type Layered<T extends ElementType> = Omit<ComponentProps<T>, 'style'> & Layer;
|
|
47
|
+
export type Card3DHeaderProps = Layered<typeof HeaderFrame>;
|
|
48
|
+
export type Card3DTitleProps = Layered<typeof TitleFrame>;
|
|
49
|
+
export type Card3DDescriptionProps = Layered<typeof DescriptionFrame>;
|
|
50
|
+
export type Card3DContentProps = Layered<typeof ContentFrame>;
|
|
51
|
+
export type Card3DFooterProps = Layered<typeof FooterFrame>;
|
|
52
|
+
export declare function Card3D({ maxTilt, perspective, scale, speed, glare, glareMaxOpacity, children, ...p }: Card3DProps): import("react").JSX.Element;
|
|
53
|
+
export declare const Card3DHeader: ({ depth, style, ...p }: Card3DHeaderProps) => import("react").JSX.Element;
|
|
54
|
+
export declare const Card3DTitle: ({ depth, style, ...p }: Card3DTitleProps) => import("react").JSX.Element;
|
|
55
|
+
export declare const Card3DDescription: ({ depth, style, ...p }: Card3DDescriptionProps) => import("react").JSX.Element;
|
|
56
|
+
export declare const Card3DContent: ({ depth, style, children, ...p }: Card3DContentProps) => import("react").JSX.Element;
|
|
57
|
+
export declare const Card3DFooter: ({ depth, style, children, ...p }: Card3DFooterProps) => import("react").JSX.Element;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=3d-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"3d-card.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/3d-card.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAqB,MAAM,OAAO,CAAA;AAW9G,QAAA,MAAM,KAAK;;;8CAaT,CAAA;AAUF,QAA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kB,EAClB,KAAY,EACZ,KAAW,EACX,KAAY,EACZ,eAAqB,EACrB,QAAQ,EACR,GAAG,CAAC,EACL,EAAE,WAAW,+BA2Cb;AAUD,eAAO,MAAM,YAAY,2BAA2C,iBAAiB,gCAEpF,CAAA;AACD,eAAO,MAAM,WAAW,2BAA0C,gBAAgB,gCAEjF,CAAA;AACD,eAAO,MAAM,iBAAiB,2BAAgD,sBAAsB,gCAEnG,CAAA;AACD,eAAO,MAAM,aAAa,qCAAsD,kBAAkB,gCAIjG,CAAA;AACD,eAAO,MAAM,YAAY,qCAAqD,iBAAiB,gCAI9F,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Card3D — a card that tilts toward the pointer.
|
|
5
|
+
*
|
|
6
|
+
* The frame turns about its centre by up to `maxTilt` degrees in proportion to
|
|
7
|
+
* where the pointer sits, grows by `scale` while the pointer is on it, and eases
|
|
8
|
+
* flat again over `speed` ms once it leaves. A radial glare follows the pointer
|
|
9
|
+
* across the surface. Header, title, description, content and footer each stand
|
|
10
|
+
* at their own `depth` along z, so the layers part as the card turns.
|
|
11
|
+
*
|
|
12
|
+
* The live transform is an inline style rather than a style prop: gui compiles
|
|
13
|
+
* a style prop to one class per distinct value, and a tilt takes a new value on
|
|
14
|
+
* every pixel of travel. A layer's depth is fixed and goes inline only to stay
|
|
15
|
+
* in the same vocabulary.
|
|
16
|
+
*/
|
|
17
|
+
import { SizableText, XStack, YStack, styled } from '@hanzo/gui';
|
|
18
|
+
import { useState } from 'react';
|
|
19
|
+
import { ink } from './ink.js';
|
|
20
|
+
import { slot } from './slot.js';
|
|
21
|
+
const PAD = 24;
|
|
22
|
+
/** Where each layer stands along z, in px. The glare rides above the deepest. */
|
|
23
|
+
const DEPTH = { header: 20, title: 30, description: 10, content: 25, footer: 15, glare: 40 };
|
|
24
|
+
const EASE = 'cubic-bezier(0.03, 0.98, 0.52, 0.99)';
|
|
25
|
+
const Frame = styled(YStack, {
|
|
26
|
+
name: 'Card3D',
|
|
27
|
+
position: 'relative',
|
|
28
|
+
bg: '$background',
|
|
29
|
+
borderWidth: 1,
|
|
30
|
+
borderColor: '$borderColor',
|
|
31
|
+
rounded: '$6',
|
|
32
|
+
py: PAD,
|
|
33
|
+
gap: PAD,
|
|
34
|
+
shadowColor: '$shadowColor',
|
|
35
|
+
shadowRadius: 24,
|
|
36
|
+
shadowOffset: { width: 0, height: 8 },
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
});
|
|
39
|
+
const Glare = styled(YStack, {
|
|
40
|
+
name: 'Card3DGlare',
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
inset: 0,
|
|
43
|
+
rounded: '$6',
|
|
44
|
+
pointerEvents: 'none',
|
|
45
|
+
});
|
|
46
|
+
const HeaderFrame = styled(YStack, { name: 'Card3DHeader', px: PAD, gap: '$1.5' });
|
|
47
|
+
const TitleFrame = styled(SizableText, { name: 'Card3DTitle', size: '$7', fontWeight: '600' });
|
|
48
|
+
const DescriptionFrame = styled(SizableText, { name: 'Card3DDescription', size: '$2', color: '$quiet' });
|
|
49
|
+
const ContentFrame = styled(YStack, { name: 'Card3DContent', px: PAD });
|
|
50
|
+
const FooterFrame = styled(XStack, { name: 'Card3DFooter', px: PAD, items: 'center' });
|
|
51
|
+
/** The pointer as fractions of the card, 0..1 from its top-left corner. */
|
|
52
|
+
const CENTRE = { x: 0.5, y: 0.5, live: false };
|
|
53
|
+
export function Card3D({ maxTilt = 15, perspective = 1000, scale = 1.05, speed = 400, glare = true, glareMaxOpacity = 0.7, children, ...p }) {
|
|
54
|
+
const [at, setAt] = useState(CENTRE);
|
|
55
|
+
// Settles when the pointer leaves: by moving off or, for one that cannot
|
|
56
|
+
// hover, by lifting — a touch's pointerup or cancel is followed by pointerleave.
|
|
57
|
+
// The last position is kept so the glare fades where it was, not at the centre.
|
|
58
|
+
const rest = () => setAt((a) => ({ ...a, live: false }));
|
|
59
|
+
const move = (e) => {
|
|
60
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
61
|
+
setAt({ x: (e.clientX - r.left) / r.width, y: (e.clientY - r.top) / r.height, live: true });
|
|
62
|
+
};
|
|
63
|
+
const rx = at.live ? (1 - 2 * at.y) * maxTilt : 0;
|
|
64
|
+
const ry = at.live ? (2 * at.x - 1) * maxTilt : 0;
|
|
65
|
+
return (_jsxs(Frame, { ...slot('3d-card'), "data-state": at.live ? 'hover' : 'idle', style: {
|
|
66
|
+
transform: `perspective(${perspective}px) rotateX(${rx}deg) rotateY(${ry}deg) scale(${at.live ? scale : 1})`,
|
|
67
|
+
transition: at.live ? 'none' : `transform ${speed}ms ${EASE}`,
|
|
68
|
+
transformStyle: 'preserve-3d',
|
|
69
|
+
willChange: 'transform',
|
|
70
|
+
touchAction: 'none',
|
|
71
|
+
}, onPointerMove: move, onPointerLeave: rest, ...p, children: [children, glare && (_jsx(Glare, { ...slot('3d-card-glare'), style: {
|
|
72
|
+
opacity: at.live ? 1 : 0,
|
|
73
|
+
background: `radial-gradient(circle at ${at.x * 100}% ${at.y * 100}%, rgba(255,255,255,${glareMaxOpacity}) 0%, transparent 50%)`,
|
|
74
|
+
transition: at.live ? 'none' : `opacity ${speed}ms ease-out`,
|
|
75
|
+
// Above every layer, shrunk by what the perspective would grow it,
|
|
76
|
+
// so it meets the card's edge instead of overhanging it.
|
|
77
|
+
transform: `translateZ(${DEPTH.glare}px) scale(${(perspective - DEPTH.glare) / perspective})`,
|
|
78
|
+
} }))] }));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A layer's own transform: its depth along z, under whatever inline style the
|
|
82
|
+
* caller adds — so a colour on a title keeps the title standing off the card.
|
|
83
|
+
*/
|
|
84
|
+
const layer = (depth, style) => ({
|
|
85
|
+
style: { transform: `translateZ(${depth}px)`, ...style },
|
|
86
|
+
});
|
|
87
|
+
export const Card3DHeader = ({ depth = DEPTH.header, style, ...p }) => (_jsx(HeaderFrame, { ...slot('3d-card-header'), ...layer(depth, style), ...p }));
|
|
88
|
+
export const Card3DTitle = ({ depth = DEPTH.title, style, ...p }) => (_jsx(TitleFrame, { ...slot('3d-card-title'), ...layer(depth, style), ...p }));
|
|
89
|
+
export const Card3DDescription = ({ depth = DEPTH.description, style, ...p }) => (_jsx(DescriptionFrame, { ...slot('3d-card-description'), ...layer(depth, style), ...p }));
|
|
90
|
+
export const Card3DContent = ({ depth = DEPTH.content, style, children, ...p }) => (_jsx(ContentFrame, { ...slot('3d-card-content'), ...layer(depth, style), ...p, children: ink(children) }));
|
|
91
|
+
export const Card3DFooter = ({ depth = DEPTH.footer, style, children, ...p }) => (_jsx(FooterFrame, { ...slot('3d-card-footer'), ...layer(depth, style), ...p, children: ink(children) }));
|
|
92
|
+
//# sourceMappingURL=3d-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"3d-card.js","sourceRoot":"","sources":["../../../src/backends/gui/3d-card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAgF,MAAM,OAAO,CAAA;AAC9G,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,GAAG,GAAG,EAAE,CAAA;AAEd,iFAAiF;AACjF,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AAE5F,MAAM,IAAI,GAAG,sCAAsC,CAAA;AAEnD,MAAM,KAAK,GAAG,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AAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAqB,EAAE,EAAE,CAAC,CAClG,KAAC,WAAW,OAAK,IAAI,CAAC,gBAAgB,CAAC,KAAM,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAM,CAAC,YACpE,GAAG,CAAC,QAAQ,CAAC,GACF,CACf,CAAA"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.Marquee3DFloating = exports.Marquee3DPreset = exports.Marquee3D = void 0;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
/**
|
|
40
|
+
* Marquee3D — an endless ticker seen through a CSS perspective.
|
|
41
|
+
*
|
|
42
|
+
* A stage holds the tilt (`perspective` and `rotateX`/`rotateY`/`rotateZ`) and
|
|
43
|
+
* a track inside it carries the items past, so a tilted row reads as a plane
|
|
44
|
+
* receding into the page rather than a flat crawl. The loop is one keyframe:
|
|
45
|
+
* `children` is laid out `repeat` times as a group, the group is rendered
|
|
46
|
+
* twice back to back, and the animation slides the pair by exactly half its own
|
|
47
|
+
* length, so the second copy lands where the first began and the seam never
|
|
48
|
+
* shows. A reader hears the first copy once: every other is `aria-hidden`.
|
|
49
|
+
* Duration is that length over `speed` (px/s), read off the rendered track,
|
|
50
|
+
* so a long set of items moves at the same pace as a short one.
|
|
51
|
+
*
|
|
52
|
+
* Six looks (`variant`) fix their own surface and ink on every theme, except
|
|
53
|
+
* `default`, which takes the host's. `size` sets height and type size together.
|
|
54
|
+
* `Marquee3DPreset` bundles the five named looks; `Marquee3DFloating` bobs each
|
|
55
|
+
* glyph of a text child on top of the scroll.
|
|
56
|
+
*
|
|
57
|
+
* The keyframes ride along as a hoisted `<style>`: React keys it by `href`, so
|
|
58
|
+
* any number of marquees on a page emit it once, and a consumer that mounts none
|
|
59
|
+
* of this package's stylesheets still gets a marquee that moves.
|
|
60
|
+
*/
|
|
61
|
+
const glass_1 = require("../../glass.cjs");
|
|
62
|
+
const gui_1 = require("@hanzo/gui");
|
|
63
|
+
const React = __importStar(require("react"));
|
|
64
|
+
const ink_1 = require("./ink.cjs");
|
|
65
|
+
const slot_1 = require("./slot.cjs");
|
|
66
|
+
/** Frame height and type size per `size`, px. */
|
|
67
|
+
const HEIGHT = { sm: 32, default: 48, lg: 64, xl: 80, '2xl': 96, '3xl': 128 };
|
|
68
|
+
const FONT = { sm: 14, default: 16, lg: 18, xl: 20, '2xl': 24, '3xl': 30 };
|
|
69
|
+
/** Viewing distance per `perspective`, px; 0 draws flat. */
|
|
70
|
+
const DEPTH = { none: 0, sm: 500, default: 1000, lg: 1500, xl: 2000 };
|
|
71
|
+
/** A gradient painted through the glyphs. */
|
|
72
|
+
const clip = (backgroundImage) => ({
|
|
73
|
+
backgroundImage,
|
|
74
|
+
WebkitBackgroundClip: 'text',
|
|
75
|
+
backgroundClip: 'text',
|
|
76
|
+
color: 'transparent',
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* The ink per variant. It sits on the item, the nearest stack to the glyphs,
|
|
80
|
+
* and every child inherits it — a caller's own elements included — which is
|
|
81
|
+
* why it is an inline style and not a property of the text primitive. Nearest,
|
|
82
|
+
* because gui's stylesheet gives every stack the theme's weight, line height
|
|
83
|
+
* and letter spacing; a stack between the ink and the glyph would reset them.
|
|
84
|
+
*/
|
|
85
|
+
const INK = {
|
|
86
|
+
default: {},
|
|
87
|
+
neon: {
|
|
88
|
+
color: '#22d3ee',
|
|
89
|
+
filter: 'drop-shadow(0 0 10px currentColor)',
|
|
90
|
+
animation: 'marquee-3d-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
|
91
|
+
},
|
|
92
|
+
rainbow: clip('linear-gradient(90deg, #ef4444, #eab308, #22c55e, #3b82f6, #a855f7)'),
|
|
93
|
+
metallic: clip('linear-gradient(180deg, #e5e7eb, #9ca3af, #4b5563)'),
|
|
94
|
+
fire: {
|
|
95
|
+
...clip('linear-gradient(0deg, #dc2626, #f97316, #facc15)'),
|
|
96
|
+
filter: 'drop-shadow(0 0 20px #ff6600)',
|
|
97
|
+
},
|
|
98
|
+
glass: { color: 'rgba(255,255,255,0.9)', filter: 'drop-shadow(0 0 10px rgba(255,255,255,0.3))' },
|
|
99
|
+
};
|
|
100
|
+
const Frame = (0, gui_1.styled)(gui_1.XStack, {
|
|
101
|
+
name: 'Marquee3D',
|
|
102
|
+
position: 'relative',
|
|
103
|
+
overflow: 'hidden',
|
|
104
|
+
width: '100%',
|
|
105
|
+
items: 'center',
|
|
106
|
+
variants: {
|
|
107
|
+
variant: {
|
|
108
|
+
default: { bg: '$background', color: '$color' },
|
|
109
|
+
neon: { bg: '#000000' },
|
|
110
|
+
rainbow: { bg: '#000000' },
|
|
111
|
+
metallic: { bg: '#0f172a' },
|
|
112
|
+
fire: { bg: '#000000' },
|
|
113
|
+
glass: {},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
defaultVariants: { variant: 'default' },
|
|
117
|
+
});
|
|
118
|
+
/** The host for a bare text child. Ink and size come down from the item. */
|
|
119
|
+
const Label = (0, gui_1.styled)(gui_1.Text, { name: 'Marquee3DText', color: 'inherit' });
|
|
120
|
+
/**
|
|
121
|
+
* The pair of loops slides the doubled track by half of itself; `direction`
|
|
122
|
+
* only ever flips their play direction. The hover rule and the reduced-motion
|
|
123
|
+
* rule select on the slot markers, so nothing here needs a class.
|
|
124
|
+
*/
|
|
125
|
+
const KEYFRAMES = `
|
|
126
|
+
@keyframes marquee-3d-x { to { transform: translateX(-50%) } }
|
|
127
|
+
@keyframes marquee-3d-y { to { transform: translateY(-50%) } }
|
|
128
|
+
@keyframes marquee-3d-pulse { 50% { opacity: 0.5 } }
|
|
129
|
+
@keyframes marquee-3d-float { 50% { transform: translateY(var(--float)) rotateX(5deg) rotateY(2deg) } }
|
|
130
|
+
[data-slot="marquee-3d"][data-pause-hover]:hover [data-slot="marquee-3d-track"] { animation-play-state: paused }
|
|
131
|
+
@media (prefers-reduced-motion: reduce) {
|
|
132
|
+
[data-slot="marquee-3d-track"], [data-slot="marquee-3d-group"], [data-slot="marquee-3d-char"] { animation: none !important }
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
135
|
+
const UNMEASURED = { stage: 0, track: 0, item: 0 };
|
|
136
|
+
/** The DOM box behind a ref, if there is one; a native view has none. */
|
|
137
|
+
const box = (el) => typeof HTMLElement !== 'undefined' && el instanceof HTMLElement ? el : null;
|
|
138
|
+
exports.Marquee3D = React.forwardRef(({ variant = 'default', size = 'default', direction = 'left', perspective = 'default', children, speed = 50, pauseOnHover = false, reverse = false, repeat = 5, autoFill = false, gap = 0, rotateX = 0, rotateY = 0, rotateZ = 0, gradient = false, gradientColor = '#ffffff', gradientWidth = 200, style, ...props }, ref) => {
|
|
139
|
+
const vertical = direction === 'up' || direction === 'down';
|
|
140
|
+
const flipped = direction === 'right' || direction === 'down';
|
|
141
|
+
const Axis = vertical ? gui_1.YStack : gui_1.XStack;
|
|
142
|
+
const stageRef = React.useRef(null);
|
|
143
|
+
const trackRef = React.useRef(null);
|
|
144
|
+
const itemRef = React.useRef(null);
|
|
145
|
+
const [span, setSpan] = React.useState(UNMEASURED);
|
|
146
|
+
// Half the track must cover the stage or the loop shows bare ground; one
|
|
147
|
+
// more copy keeps that true while the last one is still partly in view.
|
|
148
|
+
const count = autoFill && span.item > 0 ? Math.ceil(span.stage / (span.item + gap)) + 1 : repeat;
|
|
149
|
+
// Layout sizes, not bounding boxes: the stage is tilted, and a bounding box
|
|
150
|
+
// reports the projection. Re-read whenever the track's length can change:
|
|
151
|
+
// `count` and `size` move it from inside, the observer catches the rest.
|
|
152
|
+
React.useEffect(() => {
|
|
153
|
+
const along = (el) => {
|
|
154
|
+
const b = box(el);
|
|
155
|
+
return b ? (vertical ? b.offsetHeight : b.offsetWidth) : 0;
|
|
156
|
+
};
|
|
157
|
+
const measure = () => {
|
|
158
|
+
const next = { stage: along(stageRef.current), track: along(trackRef.current), item: along(itemRef.current) };
|
|
159
|
+
setSpan((s) => (s.stage === next.stage && s.track === next.track && s.item === next.item ? s : next));
|
|
160
|
+
};
|
|
161
|
+
measure();
|
|
162
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
163
|
+
window.addEventListener('resize', measure);
|
|
164
|
+
return () => window.removeEventListener('resize', measure);
|
|
165
|
+
}
|
|
166
|
+
const observer = new ResizeObserver(measure);
|
|
167
|
+
for (const el of [stageRef.current, trackRef.current]) {
|
|
168
|
+
const b = box(el);
|
|
169
|
+
if (b)
|
|
170
|
+
observer.observe(b);
|
|
171
|
+
}
|
|
172
|
+
return () => observer.disconnect();
|
|
173
|
+
}, [vertical, children, count, size, gap]);
|
|
174
|
+
const duration = span.track > 0 ? span.track / 2 / speed : 20;
|
|
175
|
+
const play = flipped !== reverse ? 'reverse' : 'normal';
|
|
176
|
+
const tilt = `${DEPTH[perspective] ? `perspective(${DEPTH[perspective]}px) ` : ''}rotateX(${rotateX}deg) rotateY(${rotateY}deg) rotateZ(${rotateZ}deg)`;
|
|
177
|
+
const mask = gradient &&
|
|
178
|
+
`linear-gradient(${vertical ? 'to bottom' : 'to right'}, transparent, ${gradientColor} ${gradientWidth}px, ${gradientColor} calc(100% - ${gradientWidth}px), transparent)`;
|
|
179
|
+
// The trailing pad is the gap between the last item of one copy and the
|
|
180
|
+
// first of the next, so the period is exactly half the track.
|
|
181
|
+
const group = (hidden) => ((0, jsx_runtime_1.jsx)(Axis, { ...(0, slot_1.slot)('marquee-3d-group'), shrink: 0, items: "center", gap: gap, ...(vertical ? { pb: gap } : { pr: gap }), children: Array.from({ length: count }, (_, i) => ((0, jsx_runtime_1.jsx)(Axis, { ref: i === 0 && !hidden ? itemRef : undefined, "aria-hidden": hidden || i > 0 || undefined, ...(0, slot_1.slot)('marquee-3d-item'), shrink: 0, items: "center", gap: gap,
|
|
182
|
+
// The keyword, not a ratio: gui reads a bare number as px, and a
|
|
183
|
+
// 1.2px line box stacks every glyph on one line.
|
|
184
|
+
style: { fontSize: FONT[size], fontWeight: 700, lineHeight: 'normal', whiteSpace: 'nowrap', ...INK[variant] }, children: (0, ink_1.ink)(children, Label, { ...(0, slot_1.slot)('marquee-3d-text') }) }, i))) }));
|
|
185
|
+
return ((0, jsx_runtime_1.jsxs)(Frame, { ref: ref, ...(0, slot_1.slot)('marquee-3d'), "data-variant": variant, "data-direction": direction, "data-pause-hover": pauseOnHover || undefined, variant: variant, ...(variant === 'glass' ? (0, glass_1.glass)(2) : null), height: HEIGHT[size], style: { ...(mask && { maskImage: mask, WebkitMaskImage: mask }), ...style }, ...props, children: [(0, jsx_runtime_1.jsx)("style", { href: "marquee-3d", precedence: "default", children: KEYFRAMES }), (0, jsx_runtime_1.jsx)(Axis, { ref: stageRef, ...(0, slot_1.slot)('marquee-3d-stage'), width: "100%", height: "100%", items: "center", style: { transform: tilt }, children: (0, jsx_runtime_1.jsxs)(Axis, { ref: trackRef, ...(0, slot_1.slot)('marquee-3d-track'), shrink: 0,
|
|
186
|
+
// Longhands, so the play state is left to the hover rule: an
|
|
187
|
+
// inline `animation` shorthand would set it too and outrank the sheet.
|
|
188
|
+
style: {
|
|
189
|
+
willChange: 'transform',
|
|
190
|
+
animationName: `marquee-3d-${vertical ? 'y' : 'x'}`,
|
|
191
|
+
animationDuration: `${duration}s`,
|
|
192
|
+
animationTimingFunction: 'linear',
|
|
193
|
+
animationIterationCount: 'infinite',
|
|
194
|
+
animationDirection: play,
|
|
195
|
+
}, children: [group(false), group(true)] }) })] }));
|
|
196
|
+
});
|
|
197
|
+
exports.Marquee3D.displayName = 'Marquee3D';
|
|
198
|
+
/** The five named looks, each a `Marquee3D` pinned to a variant and size; every other prop stays open. */
|
|
199
|
+
exports.Marquee3DPreset = {
|
|
200
|
+
Hero: React.forwardRef((props, ref) => ((0, jsx_runtime_1.jsx)(exports.Marquee3D, { ref: ref, variant: "rainbow", size: "3xl", speed: 30, rotateX: -10, gradient: true, ...props }))),
|
|
201
|
+
Neon: React.forwardRef((props, ref) => ((0, jsx_runtime_1.jsx)(exports.Marquee3D, { ref: ref, variant: "neon", size: "xl", speed: 40, rotateY: 5, pauseOnHover: true, ...props }))),
|
|
202
|
+
Metallic: React.forwardRef((props, ref) => ((0, jsx_runtime_1.jsx)(exports.Marquee3D, { ref: ref, variant: "metallic", size: "lg", speed: 35, rotateX: -5, rotateY: 2, gradient: true, gradientColor: "#c4c4c4", ...props }))),
|
|
203
|
+
Fire: React.forwardRef((props, ref) => ((0, jsx_runtime_1.jsx)(exports.Marquee3D, { ref: ref, variant: "fire", size: "2xl", speed: 60, rotateZ: 1, gradient: true, gradientColor: "#ff6600", ...props }))),
|
|
204
|
+
Glass: React.forwardRef((props, ref) => ((0, jsx_runtime_1.jsx)(exports.Marquee3D, { ref: ref, variant: "glass", size: "lg", speed: 25, rotateX: -8, pauseOnHover: true, gradient: true, gradientColor: "rgba(255,255,255,0.9)", ...props }))),
|
|
205
|
+
};
|
|
206
|
+
exports.Marquee3DPreset.Hero.displayName = 'Marquee3DPreset.Hero';
|
|
207
|
+
exports.Marquee3DPreset.Neon.displayName = 'Marquee3DPreset.Neon';
|
|
208
|
+
exports.Marquee3DPreset.Metallic.displayName = 'Marquee3DPreset.Metallic';
|
|
209
|
+
exports.Marquee3DPreset.Fire.displayName = 'Marquee3DPreset.Fire';
|
|
210
|
+
exports.Marquee3DPreset.Glass.displayName = 'Marquee3DPreset.Glass';
|
|
211
|
+
/**
|
|
212
|
+
* A `Marquee3D` whose text child floats glyph by glyph: each runs the same bob,
|
|
213
|
+
* offset by a tenth of a second per position, on top of the scroll. Any other
|
|
214
|
+
* child passes through untouched.
|
|
215
|
+
*/
|
|
216
|
+
exports.Marquee3DFloating = React.forwardRef(({ children, floatIntensity = 10, floatSpeed = 3, ...props }, ref) => {
|
|
217
|
+
const text = typeof children === 'string' ? children : '';
|
|
218
|
+
return ((0, jsx_runtime_1.jsx)(exports.Marquee3D, { ref: ref, ...props, children: text ? ((0, jsx_runtime_1.jsx)(Label, { ...(0, slot_1.slot)('marquee-3d-text'), style: { display: 'inline-flex', gap: 4 }, children: [...text].map((char, i) => ((0, jsx_runtime_1.jsx)(Label, { ...(0, slot_1.slot)('marquee-3d-char'), style: {
|
|
219
|
+
display: 'inline-block',
|
|
220
|
+
['--float']: `${-floatIntensity}px`,
|
|
221
|
+
animation: `marquee-3d-float ${floatSpeed}s ease-in-out infinite`,
|
|
222
|
+
animationDelay: `${i * 0.1}s`,
|
|
223
|
+
}, children: char === ' ' ? '\u00A0' : char }, i))) })) : (children) }));
|
|
224
|
+
});
|
|
225
|
+
exports.Marquee3DFloating.displayName = 'Marquee3DFloating';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type GuiElement } from '@hanzo/gui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type Marquee3DVariant = 'default' | 'neon' | 'rainbow' | 'metallic' | 'fire' | 'glass';
|
|
4
|
+
export type Marquee3DSize = 'sm' | 'default' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
5
|
+
export type Marquee3DDirection = 'left' | 'right' | 'up' | 'down';
|
|
6
|
+
export type Marquee3DPerspective = 'none' | 'sm' | 'default' | 'lg' | 'xl';
|
|
7
|
+
export type Marquee3DProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children' | 'style'> & {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
variant?: Marquee3DVariant;
|
|
10
|
+
size?: Marquee3DSize;
|
|
11
|
+
direction?: Marquee3DDirection;
|
|
12
|
+
perspective?: Marquee3DPerspective;
|
|
13
|
+
/** Track travel, px/s. */
|
|
14
|
+
speed?: number;
|
|
15
|
+
pauseOnHover?: boolean;
|
|
16
|
+
/** Run against `direction`. */
|
|
17
|
+
reverse?: boolean;
|
|
18
|
+
/** How many times `children` is laid out per loop. */
|
|
19
|
+
repeat?: number;
|
|
20
|
+
/** Lay `children` out as many times as it takes to cover the frame, whatever `repeat` says. */
|
|
21
|
+
autoFill?: boolean;
|
|
22
|
+
/** Space between items, px — across the loop's seam too. */
|
|
23
|
+
gap?: number;
|
|
24
|
+
rotateX?: number;
|
|
25
|
+
rotateY?: number;
|
|
26
|
+
rotateZ?: number;
|
|
27
|
+
/** Fade both ends of the frame. */
|
|
28
|
+
gradient?: boolean;
|
|
29
|
+
gradientColor?: string;
|
|
30
|
+
/** Length of each fade, px. */
|
|
31
|
+
gradientWidth?: number;
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
};
|
|
34
|
+
export declare const Marquee3D: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "style"> & {
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
variant?: Marquee3DVariant;
|
|
37
|
+
size?: Marquee3DSize;
|
|
38
|
+
direction?: Marquee3DDirection;
|
|
39
|
+
perspective?: Marquee3DPerspective;
|
|
40
|
+
/** Track travel, px/s. */
|
|
41
|
+
speed?: number;
|
|
42
|
+
pauseOnHover?: boolean;
|
|
43
|
+
/** Run against `direction`. */
|
|
44
|
+
reverse?: boolean;
|
|
45
|
+
/** How many times `children` is laid out per loop. */
|
|
46
|
+
repeat?: number;
|
|
47
|
+
/** Lay `children` out as many times as it takes to cover the frame, whatever `repeat` says. */
|
|
48
|
+
autoFill?: boolean;
|
|
49
|
+
/** Space between items, px — across the loop's seam too. */
|
|
50
|
+
gap?: number;
|
|
51
|
+
rotateX?: number;
|
|
52
|
+
rotateY?: number;
|
|
53
|
+
rotateZ?: number;
|
|
54
|
+
/** Fade both ends of the frame. */
|
|
55
|
+
gradient?: boolean;
|
|
56
|
+
gradientColor?: string;
|
|
57
|
+
/** Length of each fade, px. */
|
|
58
|
+
gradientWidth?: number;
|
|
59
|
+
style?: React.CSSProperties;
|
|
60
|
+
} & React.RefAttributes<GuiElement>>;
|
|
61
|
+
type PresetProps = Omit<Marquee3DProps, 'variant' | 'size'>;
|
|
62
|
+
/** The five named looks, each a `Marquee3D` pinned to a variant and size; every other prop stays open. */
|
|
63
|
+
export declare const Marquee3DPreset: {
|
|
64
|
+
Hero: React.ForwardRefExoticComponent<PresetProps & React.RefAttributes<GuiElement>>;
|
|
65
|
+
Neon: React.ForwardRefExoticComponent<PresetProps & React.RefAttributes<GuiElement>>;
|
|
66
|
+
Metallic: React.ForwardRefExoticComponent<PresetProps & React.RefAttributes<GuiElement>>;
|
|
67
|
+
Fire: React.ForwardRefExoticComponent<PresetProps & React.RefAttributes<GuiElement>>;
|
|
68
|
+
Glass: React.ForwardRefExoticComponent<PresetProps & React.RefAttributes<GuiElement>>;
|
|
69
|
+
};
|
|
70
|
+
export type Marquee3DFloatingProps = Marquee3DProps & {
|
|
71
|
+
/** Peak lift of each glyph, px. */
|
|
72
|
+
floatIntensity?: number;
|
|
73
|
+
/** Seconds per bob. */
|
|
74
|
+
floatSpeed?: number;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* A `Marquee3D` whose text child floats glyph by glyph: each runs the same bob,
|
|
78
|
+
* offset by a tenth of a second per position, on top of the scroll. Any other
|
|
79
|
+
* child passes through untouched.
|
|
80
|
+
*/
|
|
81
|
+
export declare const Marquee3DFloating: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "style"> & {
|
|
82
|
+
children: React.ReactNode;
|
|
83
|
+
variant?: Marquee3DVariant;
|
|
84
|
+
size?: Marquee3DSize;
|
|
85
|
+
direction?: Marquee3DDirection;
|
|
86
|
+
perspective?: Marquee3DPerspective;
|
|
87
|
+
/** Track travel, px/s. */
|
|
88
|
+
speed?: number;
|
|
89
|
+
pauseOnHover?: boolean;
|
|
90
|
+
/** Run against `direction`. */
|
|
91
|
+
reverse?: boolean;
|
|
92
|
+
/** How many times `children` is laid out per loop. */
|
|
93
|
+
repeat?: number;
|
|
94
|
+
/** Lay `children` out as many times as it takes to cover the frame, whatever `repeat` says. */
|
|
95
|
+
autoFill?: boolean;
|
|
96
|
+
/** Space between items, px — across the loop's seam too. */
|
|
97
|
+
gap?: number;
|
|
98
|
+
rotateX?: number;
|
|
99
|
+
rotateY?: number;
|
|
100
|
+
rotateZ?: number;
|
|
101
|
+
/** Fade both ends of the frame. */
|
|
102
|
+
gradient?: boolean;
|
|
103
|
+
gradientColor?: string;
|
|
104
|
+
/** Length of each fade, px. */
|
|
105
|
+
gradientWidth?: number;
|
|
106
|
+
style?: React.CSSProperties;
|
|
107
|
+
} & {
|
|
108
|
+
/** Peak lift of each glyph, px. */
|
|
109
|
+
floatIntensity?: number;
|
|
110
|
+
/** Seconds per bob. */
|
|
111
|
+
floatSpeed?: number;
|
|
112
|
+
} & React.RefAttributes<GuiElement>>;
|
|
113
|
+
export {};
|
|
114
|
+
//# sourceMappingURL=3d-marquee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"3d-marquee.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/3d-marquee.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAC1E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7F,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAA;AAC1E,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAA;AACjE,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAA;AAgF1E,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IAC/F,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,OAAO,CAAC,EAAE,gBAA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