@wallarm-org/design-system 0.67.2 → 0.68.0
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/components/AnimatedBackground/AnimatedBackground.d.ts +8 -1
- package/dist/components/AnimatedBackground/AnimatedBackground.js +9 -118
- package/dist/components/AnimatedBackground/blur/BlurBackground.d.ts +6 -0
- package/dist/components/AnimatedBackground/blur/BlurBackground.js +129 -0
- package/dist/components/AnimatedBackground/blur/index.d.ts +1 -0
- package/dist/components/AnimatedBackground/blur/index.js +2 -0
- package/dist/components/AnimatedBackground/index.d.ts +3 -2
- package/dist/components/AnimatedBackground/index.js +3 -1
- package/dist/components/AnimatedBackground/{GameHud.js → pixel/GameHud.js} +1 -1
- package/dist/components/AnimatedBackground/pixel/PixelBackground.d.ts +11 -0
- package/dist/components/AnimatedBackground/pixel/PixelBackground.js +102 -0
- package/dist/components/AnimatedBackground/pixel/index.d.ts +1 -0
- package/dist/components/AnimatedBackground/pixel/index.js +2 -0
- package/dist/components/AnimatedBackground/{module → pixel/module}/game-logic.js +1 -1
- package/dist/components/AnimatedBackground/{module → pixel/module}/index.d.ts +1 -1
- package/dist/components/AnimatedBackground/pixel/module/lib.d.ts +2 -0
- package/dist/components/AnimatedBackground/pixel/module/lib.js +16 -0
- package/dist/components/AnimatedBackground/pixel/module/types.d.ts +38 -0
- package/dist/components/Calendar/CalendarInputHeader.js +31 -5
- package/dist/components/FilterInput/lib/constants.js +10 -10
- package/dist/components/InputGroup/InputGroup.js +1 -1
- package/dist/components/InputGroup/InputGroupAddon.d.ts +1 -1
- package/dist/components/InputGroup/InputGroupAddon.js +3 -2
- package/dist/components/NavPanel/NavPanelContext.d.ts +9 -1
- package/dist/components/NavPanel/NavPanelContext.js +14 -1
- package/dist/components/NavPanel/NavPanelGroup.d.ts +1 -3
- package/dist/components/NavPanel/NavPanelGroup.js +1 -5
- package/dist/components/NavPanel/NavPanelGroupContent.d.ts +1 -1
- package/dist/components/NavPanel/NavPanelGroupContent.js +21 -19
- package/dist/components/NavPanel/NavPanelGroupItem.js +3 -2
- package/dist/components/NavPanel/NavPanelGroupLabel.js +4 -2
- package/dist/components/Textarea/Textarea.d.ts +8 -8
- package/dist/components/Textarea/Textarea.js +24 -17
- package/dist/components/Textarea/classes.d.ts +6 -0
- package/dist/components/Textarea/classes.js +20 -0
- package/dist/components/Textarea/useAutoResize.d.ts +4 -0
- package/dist/components/Textarea/useAutoResize.js +34 -0
- package/dist/components/Tree/Tree.d.ts +9 -0
- package/dist/components/Tree/Tree.js +48 -0
- package/dist/components/Tree/TreeContext.d.ts +11 -0
- package/dist/components/Tree/TreeContext.js +19 -0
- package/dist/components/Tree/TreeItem.d.ts +10 -0
- package/dist/components/Tree/TreeItem.js +46 -0
- package/dist/components/Tree/TreeItemContent.d.ts +6 -0
- package/dist/components/Tree/TreeItemContent.js +26 -0
- package/dist/components/Tree/TreeItemContext.d.ts +8 -0
- package/dist/components/Tree/TreeItemContext.js +11 -0
- package/dist/components/Tree/TreeItemHeader.d.ts +8 -0
- package/dist/components/Tree/TreeItemHeader.js +57 -0
- package/dist/components/Tree/TreeItemIcon.d.ts +5 -0
- package/dist/components/Tree/TreeItemIcon.js +40 -0
- package/dist/components/Tree/index.d.ts +5 -0
- package/dist/components/Tree/index.js +6 -0
- package/dist/components/TreeBase/TreeBase.d.ts +31 -0
- package/dist/components/TreeBase/TreeBase.js +56 -0
- package/dist/components/TreeBase/classes.d.ts +7 -0
- package/dist/components/TreeBase/classes.js +10 -0
- package/dist/components/TreeBase/index.d.ts +1 -0
- package/dist/components/TreeBase/index.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/metadata/components.json +3561 -1486
- package/dist/theme/components/animated-background.css +117 -0
- package/dist/theme/index.css +1 -1
- package/package.json +1 -1
- package/dist/components/AnimatedBackground/module/lib.d.ts +0 -2
- package/dist/components/AnimatedBackground/module/lib.js +0 -32
- package/dist/components/AnimatedBackground/module/types.d.ts +0 -79
- package/dist/theme/components/login-background.css +0 -45
- /package/dist/components/AnimatedBackground/{GameHud.d.ts → pixel/GameHud.d.ts} +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/celebration-renderer.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/celebration-renderer.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/celebration.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/celebration.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/constants.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/constants.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/engine-colors.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/engine-colors.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/engine-grid.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/engine-grid.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/engine.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/engine.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/game-logic.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/game-plugins.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/game-plugins.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/game-renderer.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/game-renderer.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/index.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/math.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/math.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/sfx.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/sfx.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/types.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/useGame.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/useGame.js +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/useGameKeyboard.d.ts +0 -0
- /package/dist/components/AnimatedBackground/{module → pixel/module}/useGameKeyboard.js +0 -0
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type BlurBackgroundProps } from './blur';
|
|
3
|
+
import { type PixelBackgroundProps } from './pixel';
|
|
4
|
+
type AnimatedBackgroundProps = ({
|
|
5
|
+
variant?: 'pixel';
|
|
6
|
+
} & PixelBackgroundProps) | ({
|
|
7
|
+
variant?: 'blur';
|
|
8
|
+
} & BlurBackgroundProps);
|
|
9
|
+
export type { AnimatedBackgroundProps };
|
|
3
10
|
export declare const AnimatedBackground: FC<AnimatedBackgroundProps>;
|
|
@@ -1,121 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const options = resolveOptions(props);
|
|
11
|
-
const optionsRef = useRef(options);
|
|
12
|
-
const pausedRef = useRef(paused);
|
|
13
|
-
useEffect(()=>{
|
|
14
|
-
optionsRef.current = options;
|
|
15
|
-
pausedRef.current = paused;
|
|
16
|
-
});
|
|
17
|
-
const isHalftone = (texture ?? 'halftone') === 'halftone';
|
|
18
|
-
const { gameActive, onPointerDown, hudElement, onEngineCreated, onEngineDestroyed } = useGame({
|
|
19
|
-
game,
|
|
20
|
-
isHalftone,
|
|
21
|
-
excludeCardSize,
|
|
22
|
-
canvasRef
|
|
23
|
-
});
|
|
24
|
-
useEffect(()=>{
|
|
25
|
-
const canvas = canvasRef.current;
|
|
26
|
-
if (!canvas) return;
|
|
27
|
-
const engine = createSweepEngine(canvas, optionsRef.current);
|
|
28
|
-
engineRef.current = engine;
|
|
29
|
-
onEngineCreated(engine);
|
|
30
|
-
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
31
|
-
reducedMotionRef.current = reduced;
|
|
32
|
-
const apply = ()=>{
|
|
33
|
-
if (reduced.matches || pausedRef.current) {
|
|
34
|
-
engine.stop();
|
|
35
|
-
engine.renderStatic();
|
|
36
|
-
} else engine.start();
|
|
37
|
-
};
|
|
38
|
-
apply();
|
|
39
|
-
reduced.addEventListener('change', apply);
|
|
40
|
-
let frame = 0;
|
|
41
|
-
const ro = new ResizeObserver(()=>{
|
|
42
|
-
cancelAnimationFrame(frame);
|
|
43
|
-
frame = requestAnimationFrame(()=>engine.resize());
|
|
44
|
-
});
|
|
45
|
-
ro.observe(canvas);
|
|
46
|
-
const themeObserver = new MutationObserver(()=>engine.setOptions({}));
|
|
47
|
-
themeObserver.observe(document.documentElement, {
|
|
48
|
-
attributes: true,
|
|
49
|
-
attributeFilter: [
|
|
50
|
-
'data-theme',
|
|
51
|
-
'class'
|
|
52
|
-
]
|
|
53
|
-
});
|
|
54
|
-
return ()=>{
|
|
55
|
-
reduced.removeEventListener('change', apply);
|
|
56
|
-
reducedMotionRef.current = null;
|
|
57
|
-
ro.disconnect();
|
|
58
|
-
themeObserver.disconnect();
|
|
59
|
-
cancelAnimationFrame(frame);
|
|
60
|
-
engine.stop();
|
|
61
|
-
engineRef.current = null;
|
|
62
|
-
onEngineDestroyed();
|
|
63
|
-
};
|
|
64
|
-
}, [
|
|
65
|
-
onEngineCreated,
|
|
66
|
-
onEngineDestroyed
|
|
67
|
-
]);
|
|
68
|
-
const syncKey = `${JSON.stringify(options)}|${paused}`;
|
|
69
|
-
useEffect(()=>{
|
|
70
|
-
const engine = engineRef.current;
|
|
71
|
-
if (!engine) return;
|
|
72
|
-
engine.setOptions(optionsRef.current);
|
|
73
|
-
const reduced = reducedMotionRef.current;
|
|
74
|
-
if (reduced?.matches || pausedRef.current) {
|
|
75
|
-
engine.stop();
|
|
76
|
-
engine.renderStatic();
|
|
77
|
-
} else engine.start();
|
|
78
|
-
}, [
|
|
79
|
-
syncKey
|
|
80
|
-
]);
|
|
81
|
-
if (null == children) return /*#__PURE__*/ jsxs(Fragment, {
|
|
82
|
-
children: [
|
|
83
|
-
/*#__PURE__*/ jsx("canvas", {
|
|
84
|
-
"data-slot": "animated-background",
|
|
85
|
-
...rest,
|
|
86
|
-
ref: (node)=>{
|
|
87
|
-
canvasRef.current = node;
|
|
88
|
-
if ('function' == typeof ref) ref(node);
|
|
89
|
-
else if (ref) ref.current = node;
|
|
90
|
-
},
|
|
91
|
-
"aria-hidden": "true",
|
|
92
|
-
className: cn('h-full w-full pointer-events-none', gameActive && 'pointer-events-auto', className),
|
|
93
|
-
onPointerDown: onPointerDown
|
|
94
|
-
}),
|
|
95
|
-
hudElement
|
|
96
|
-
]
|
|
97
|
-
});
|
|
98
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
99
|
-
"data-slot": "animated-background",
|
|
100
|
-
...rest,
|
|
101
|
-
ref: ref,
|
|
102
|
-
className: cn('relative h-full w-full', className),
|
|
103
|
-
children: [
|
|
104
|
-
/*#__PURE__*/ jsx("canvas", {
|
|
105
|
-
ref: canvasRef,
|
|
106
|
-
"aria-hidden": "true",
|
|
107
|
-
className: cn('absolute inset-0 h-full w-full pointer-events-none', gameActive && 'pointer-events-auto'),
|
|
108
|
-
onPointerDown: onPointerDown
|
|
109
|
-
}),
|
|
110
|
-
hudElement,
|
|
111
|
-
/*#__PURE__*/ jsx("div", {
|
|
112
|
-
className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center",
|
|
113
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
114
|
-
className: "pointer-events-auto",
|
|
115
|
-
children: children
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
]
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BlurBackground } from "./blur/index.js";
|
|
3
|
+
import { PixelBackground } from "./pixel/index.js";
|
|
4
|
+
const AnimatedBackground = ({ variant = 'pixel', ...rest })=>{
|
|
5
|
+
if ('blur' === variant) return /*#__PURE__*/ jsx(BlurBackground, {
|
|
6
|
+
...rest
|
|
7
|
+
});
|
|
8
|
+
return /*#__PURE__*/ jsx(PixelBackground, {
|
|
9
|
+
...rest
|
|
119
10
|
});
|
|
120
11
|
};
|
|
121
12
|
AnimatedBackground.displayName = 'AnimatedBackground';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
const BLOBS = [
|
|
4
|
+
{
|
|
5
|
+
name: 'b1-lavender-top',
|
|
6
|
+
style: {
|
|
7
|
+
width: '66%',
|
|
8
|
+
height: '52%',
|
|
9
|
+
left: '-8%',
|
|
10
|
+
top: '-12%'
|
|
11
|
+
},
|
|
12
|
+
background: 'radial-gradient(circle at 50% 50%, #cdccda 0%, rgba(205,204,218,0) 68%)',
|
|
13
|
+
anim: 'lg-f1',
|
|
14
|
+
base: 37
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'b2-cream-right',
|
|
18
|
+
style: {
|
|
19
|
+
width: '56%',
|
|
20
|
+
height: '78%',
|
|
21
|
+
right: '-13%',
|
|
22
|
+
top: '6%'
|
|
23
|
+
},
|
|
24
|
+
background: 'radial-gradient(circle at 50% 50%, #f6dba6 0%, rgba(246,219,166,0) 66%)',
|
|
25
|
+
anim: 'lg-f2',
|
|
26
|
+
base: 29
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'b3-peach-halo',
|
|
30
|
+
style: {
|
|
31
|
+
width: '78%',
|
|
32
|
+
height: '64%',
|
|
33
|
+
left: '10%',
|
|
34
|
+
bottom: '-20%'
|
|
35
|
+
},
|
|
36
|
+
background: 'radial-gradient(circle at 50% 50%, #ffab70 0%, rgba(255,171,112,0) 68%)',
|
|
37
|
+
anim: 'lg-f4',
|
|
38
|
+
base: 31
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'b4-orange-core',
|
|
42
|
+
style: {
|
|
43
|
+
width: '60%',
|
|
44
|
+
height: '48%',
|
|
45
|
+
left: '22%',
|
|
46
|
+
bottom: '-10%'
|
|
47
|
+
},
|
|
48
|
+
background: 'radial-gradient(circle at 50% 50%, #ffb07e 0%, #ffc8a2 33%, rgba(255,200,162,0) 70%)',
|
|
49
|
+
anim: 'lg-f3',
|
|
50
|
+
base: 23
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'b5-cream-lower',
|
|
54
|
+
style: {
|
|
55
|
+
width: '60%',
|
|
56
|
+
height: '56%',
|
|
57
|
+
right: '-11%',
|
|
58
|
+
bottom: '0%'
|
|
59
|
+
},
|
|
60
|
+
background: 'radial-gradient(circle at 50% 50%, #f9e2b4 0%, rgba(249,226,180,0) 66%)',
|
|
61
|
+
anim: 'lg-f5',
|
|
62
|
+
base: 41
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'b6-offwhite-center',
|
|
66
|
+
style: {
|
|
67
|
+
width: '76%',
|
|
68
|
+
height: '62%',
|
|
69
|
+
left: '13%',
|
|
70
|
+
top: '24%'
|
|
71
|
+
},
|
|
72
|
+
background: 'radial-gradient(circle at 50% 50%, #f3eae0 0%, rgba(243,234,224,0) 70%)',
|
|
73
|
+
anim: 'lg-f6',
|
|
74
|
+
base: 43
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
const BLUR = 90;
|
|
78
|
+
const SPEED = 2;
|
|
79
|
+
const BlurBackground = ({ ref, className, style, children, ...rest })=>{
|
|
80
|
+
const meshContent = /*#__PURE__*/ jsx("div", {
|
|
81
|
+
className: "lg-mesh",
|
|
82
|
+
style: {
|
|
83
|
+
'--lg-blur': BLUR
|
|
84
|
+
},
|
|
85
|
+
children: BLOBS.map((b)=>/*#__PURE__*/ jsx("div", {
|
|
86
|
+
className: "lg-blob",
|
|
87
|
+
style: {
|
|
88
|
+
...b.style,
|
|
89
|
+
background: b.background,
|
|
90
|
+
animationName: b.anim,
|
|
91
|
+
animationDuration: `${b.base / SPEED}s`,
|
|
92
|
+
animationTimingFunction: 'ease-in-out',
|
|
93
|
+
animationIterationCount: 'infinite'
|
|
94
|
+
}
|
|
95
|
+
}, b.name))
|
|
96
|
+
});
|
|
97
|
+
if (null == children) return /*#__PURE__*/ jsx("div", {
|
|
98
|
+
"data-slot": "blur-background",
|
|
99
|
+
...rest,
|
|
100
|
+
ref: ref,
|
|
101
|
+
className: cn('lg-frame', className),
|
|
102
|
+
style: style,
|
|
103
|
+
"aria-hidden": "true",
|
|
104
|
+
children: meshContent
|
|
105
|
+
});
|
|
106
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
107
|
+
"data-slot": "blur-background",
|
|
108
|
+
...rest,
|
|
109
|
+
ref: ref,
|
|
110
|
+
className: cn('lg-frame relative', className),
|
|
111
|
+
style: style,
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ jsx("div", {
|
|
114
|
+
"aria-hidden": "true",
|
|
115
|
+
className: "absolute inset-0 pointer-events-none",
|
|
116
|
+
children: meshContent
|
|
117
|
+
}),
|
|
118
|
+
/*#__PURE__*/ jsx("div", {
|
|
119
|
+
className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center",
|
|
120
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
121
|
+
className: "pointer-events-auto",
|
|
122
|
+
children: children
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
BlurBackground.displayName = 'BlurBackground';
|
|
129
|
+
export { BlurBackground };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlurBackground, type BlurBackgroundProps } from './BlurBackground';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { AnimatedBackground } from './AnimatedBackground';
|
|
2
|
-
export type
|
|
1
|
+
export { AnimatedBackground, type AnimatedBackgroundProps } from './AnimatedBackground';
|
|
2
|
+
export { BlurBackground, type BlurBackgroundProps } from './blur/BlurBackground';
|
|
3
|
+
export { PixelBackground, type PixelBackgroundProps } from './pixel/PixelBackground';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { AnimatedBackground } from "./AnimatedBackground.js";
|
|
2
|
-
|
|
2
|
+
import { BlurBackground } from "./blur/BlurBackground.js";
|
|
3
|
+
import { PixelBackground } from "./pixel/PixelBackground.js";
|
|
4
|
+
export { AnimatedBackground, BlurBackground, PixelBackground };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
3
|
const GameHud = ({ caught, armed, roundOver, stats, accuracy, faced, catchKey, gateTarget, onTryAgain, soundOn })=>{
|
|
4
4
|
const showCounter = caught > 0;
|
|
5
5
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
export interface PixelBackgroundProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
ref?: Ref<HTMLDivElement>;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
game?: boolean;
|
|
6
|
+
excludeCardSize?: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const PixelBackground: FC<PixelBackgroundProps>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { cn } from "../../../utils/cn.js";
|
|
4
|
+
import { createSweepEngine, resolveOptions, useGame } from "./module/index.js";
|
|
5
|
+
const ENGINE_OPTIONS = resolveOptions();
|
|
6
|
+
const PixelBackground = (props)=>{
|
|
7
|
+
const { ref, game = false, excludeCardSize, className, children, ...rest } = props;
|
|
8
|
+
const canvasRef = useRef(null);
|
|
9
|
+
const engineRef = useRef(null);
|
|
10
|
+
const reducedMotionRef = useRef(null);
|
|
11
|
+
const { gameActive, onPointerDown, hudElement, onEngineCreated, onEngineDestroyed } = useGame({
|
|
12
|
+
game,
|
|
13
|
+
isHalftone: true,
|
|
14
|
+
excludeCardSize,
|
|
15
|
+
canvasRef
|
|
16
|
+
});
|
|
17
|
+
useEffect(()=>{
|
|
18
|
+
const canvas = canvasRef.current;
|
|
19
|
+
if (!canvas) return;
|
|
20
|
+
const engine = createSweepEngine(canvas, ENGINE_OPTIONS);
|
|
21
|
+
engineRef.current = engine;
|
|
22
|
+
onEngineCreated(engine);
|
|
23
|
+
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
24
|
+
reducedMotionRef.current = reduced;
|
|
25
|
+
const apply = ()=>{
|
|
26
|
+
if (reduced.matches) {
|
|
27
|
+
engine.stop();
|
|
28
|
+
engine.renderStatic();
|
|
29
|
+
} else engine.start();
|
|
30
|
+
};
|
|
31
|
+
apply();
|
|
32
|
+
reduced.addEventListener('change', apply);
|
|
33
|
+
let frame = 0;
|
|
34
|
+
const ro = new ResizeObserver(()=>{
|
|
35
|
+
cancelAnimationFrame(frame);
|
|
36
|
+
frame = requestAnimationFrame(()=>engine.resize());
|
|
37
|
+
});
|
|
38
|
+
ro.observe(canvas);
|
|
39
|
+
const themeObserver = new MutationObserver(()=>engine.setOptions({}));
|
|
40
|
+
themeObserver.observe(document.documentElement, {
|
|
41
|
+
attributes: true,
|
|
42
|
+
attributeFilter: [
|
|
43
|
+
'data-theme',
|
|
44
|
+
'class'
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
return ()=>{
|
|
48
|
+
reduced.removeEventListener('change', apply);
|
|
49
|
+
reducedMotionRef.current = null;
|
|
50
|
+
ro.disconnect();
|
|
51
|
+
themeObserver.disconnect();
|
|
52
|
+
cancelAnimationFrame(frame);
|
|
53
|
+
engine.stop();
|
|
54
|
+
engineRef.current = null;
|
|
55
|
+
onEngineDestroyed();
|
|
56
|
+
};
|
|
57
|
+
}, [
|
|
58
|
+
onEngineCreated,
|
|
59
|
+
onEngineDestroyed
|
|
60
|
+
]);
|
|
61
|
+
if (null == children) return /*#__PURE__*/ jsxs(Fragment, {
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ jsx("canvas", {
|
|
64
|
+
"data-slot": "pixel-background",
|
|
65
|
+
...rest,
|
|
66
|
+
ref: (node)=>{
|
|
67
|
+
canvasRef.current = node;
|
|
68
|
+
if ('function' == typeof ref) ref(node);
|
|
69
|
+
else if (ref) ref.current = node;
|
|
70
|
+
},
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
className: cn('h-full w-full pointer-events-none', gameActive && 'pointer-events-auto', className),
|
|
73
|
+
onPointerDown: onPointerDown
|
|
74
|
+
}),
|
|
75
|
+
hudElement
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
79
|
+
"data-slot": "pixel-background",
|
|
80
|
+
...rest,
|
|
81
|
+
ref: ref,
|
|
82
|
+
className: cn('relative h-full w-full', className),
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ jsx("canvas", {
|
|
85
|
+
ref: canvasRef,
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
className: cn('absolute inset-0 h-full w-full pointer-events-none', gameActive && 'pointer-events-auto'),
|
|
88
|
+
onPointerDown: onPointerDown
|
|
89
|
+
}),
|
|
90
|
+
hudElement,
|
|
91
|
+
/*#__PURE__*/ jsx("div", {
|
|
92
|
+
className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center",
|
|
93
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
94
|
+
className: "pointer-events-auto",
|
|
95
|
+
children: children
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
PixelBackground.displayName = 'PixelBackground';
|
|
102
|
+
export { PixelBackground };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PixelBackground, type PixelBackgroundProps } from './PixelBackground';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createSweepEngine, type SweepEngine } from './engine';
|
|
2
2
|
export { resolveOptions } from './lib';
|
|
3
|
-
export type {
|
|
3
|
+
export type { EngineOptions, GameStats } from './types';
|
|
4
4
|
export { useGame } from './useGame';
|
|
5
5
|
export { useGameKeyboard } from './useGameKeyboard';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const resolveOptions = ()=>({
|
|
2
|
+
texture: 'halftone',
|
|
3
|
+
spacing: 16,
|
|
4
|
+
sweepPeriod: 12.5,
|
|
5
|
+
bloomRadius: 80,
|
|
6
|
+
anomalyInterval: 1.4,
|
|
7
|
+
intensity: 0.9,
|
|
8
|
+
bloomAlpha: 0.2,
|
|
9
|
+
maxDotSize: 20,
|
|
10
|
+
tilt: 16,
|
|
11
|
+
dotColorVar: '--animated-bg-dot',
|
|
12
|
+
accentColorVar: '--animated-bg-accent-dot',
|
|
13
|
+
baseColorVar: '--color-component-app-shell-bg',
|
|
14
|
+
caughtColorVar: '--animated-bg-caught-dot'
|
|
15
|
+
});
|
|
16
|
+
export { resolveOptions };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type Texture = 'clean' | 'halftone';
|
|
2
|
+
export interface EngineOptions {
|
|
3
|
+
texture: Texture;
|
|
4
|
+
/** Grid cell size in px. */
|
|
5
|
+
spacing: number;
|
|
6
|
+
/** Seconds for one L→R sweep pass. */
|
|
7
|
+
sweepPeriod: number;
|
|
8
|
+
/** How far from the scan line (px) dots react. */
|
|
9
|
+
bloomRadius: number;
|
|
10
|
+
/** Minimum seconds between accent events. */
|
|
11
|
+
anomalyInterval: number;
|
|
12
|
+
/** Global opacity multiplier (0–1). */
|
|
13
|
+
intensity: number;
|
|
14
|
+
/** Peak alpha of bloomed dots before `intensity`. */
|
|
15
|
+
bloomAlpha: number;
|
|
16
|
+
/** Halftone only: cap on a bloomed pixel's edge length (px). */
|
|
17
|
+
maxDotSize: number;
|
|
18
|
+
/** Sweep-line tilt in degrees (0 = vertical). */
|
|
19
|
+
tilt: number;
|
|
20
|
+
/** CSS custom-property names resolved at runtime. */
|
|
21
|
+
dotColorVar: string;
|
|
22
|
+
accentColorVar: string;
|
|
23
|
+
baseColorVar: string;
|
|
24
|
+
/** CSS custom-property name for the "caught" (neutralised) color. */
|
|
25
|
+
caughtColorVar: string;
|
|
26
|
+
}
|
|
27
|
+
export interface GameStats {
|
|
28
|
+
/** Lifetime catches — drives the arming gate (≥ 5); reset only by exitGame. */
|
|
29
|
+
kills: number;
|
|
30
|
+
/** Threats stopped THIS round (HIT numerator). */
|
|
31
|
+
stopped: number;
|
|
32
|
+
/** Threats that timed out unshot THIS round. */
|
|
33
|
+
escaped: number;
|
|
34
|
+
/** Attacks spawned this round (caps at ROUND_ATTACKS). */
|
|
35
|
+
spawned: number;
|
|
36
|
+
/** Round complete — full wave spawned AND field cleared. */
|
|
37
|
+
done: boolean;
|
|
38
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
3
|
import { DatePicker } from "@ark-ui/react";
|
|
4
|
+
import { CalendarDateTime } from "@internationalized/date";
|
|
4
5
|
import { cn } from "../../utils/cn.js";
|
|
5
6
|
import { DateInput } from "../DateInput/index.js";
|
|
6
7
|
import { useCalendarContext } from "./CalendarContext.js";
|
|
@@ -12,7 +13,16 @@ const toArkDateValue = (date)=>{
|
|
|
12
13
|
if (!date) return;
|
|
13
14
|
return date;
|
|
14
15
|
};
|
|
15
|
-
const
|
|
16
|
+
const withTime = (value, time)=>{
|
|
17
|
+
if (!value) return null;
|
|
18
|
+
if ('hour' in value) return value;
|
|
19
|
+
return new CalendarDateTime(value.year, value.month, value.day, time.hour, time.minute);
|
|
20
|
+
};
|
|
21
|
+
const SingleDateInputInner = ({ api, readonly, showTime })=>{
|
|
22
|
+
const [time, setTime] = useState({
|
|
23
|
+
hour: 0,
|
|
24
|
+
minute: 0
|
|
25
|
+
});
|
|
16
26
|
const handleChange = useCallback((newValue)=>{
|
|
17
27
|
const arkValue = toArkDateValue(newValue);
|
|
18
28
|
if (arkValue) api.setValue([
|
|
@@ -22,11 +32,26 @@ const SingleDateInputInner = ({ api, readonly })=>{
|
|
|
22
32
|
}, [
|
|
23
33
|
api
|
|
24
34
|
]);
|
|
35
|
+
const handleDateTimeChange = useCallback((newValue)=>{
|
|
36
|
+
if (newValue && 'hour' in newValue) setTime({
|
|
37
|
+
hour: newValue.hour,
|
|
38
|
+
minute: newValue.minute
|
|
39
|
+
});
|
|
40
|
+
handleChange(newValue);
|
|
41
|
+
}, [
|
|
42
|
+
handleChange
|
|
43
|
+
]);
|
|
25
44
|
const inputValue = toReactAriaDateValue(api.value[0]);
|
|
26
45
|
return /*#__PURE__*/ jsx("div", {
|
|
27
46
|
className: "flex flex-1",
|
|
28
47
|
onKeyDown: (e)=>e.stopPropagation(),
|
|
29
|
-
children: /*#__PURE__*/ jsx(DateInput, {
|
|
48
|
+
children: showTime ? /*#__PURE__*/ jsx(DateInput, {
|
|
49
|
+
value: withTime(inputValue, time),
|
|
50
|
+
onChange: handleDateTimeChange,
|
|
51
|
+
readOnly: readonly,
|
|
52
|
+
granularity: "minute",
|
|
53
|
+
showTimeDropdown: true
|
|
54
|
+
}) : /*#__PURE__*/ jsx(DateInput, {
|
|
30
55
|
value: inputValue,
|
|
31
56
|
onChange: handleChange,
|
|
32
57
|
readOnly: readonly,
|
|
@@ -96,7 +121,7 @@ const RangeDateInputInner = ({ api, readonly })=>{
|
|
|
96
121
|
});
|
|
97
122
|
};
|
|
98
123
|
const CalendarInputHeader = ({ className })=>{
|
|
99
|
-
const { isRange, readonly } = useCalendarContext();
|
|
124
|
+
const { isRange, readonly, showTime } = useCalendarContext();
|
|
100
125
|
return /*#__PURE__*/ jsx("div", {
|
|
101
126
|
className: cn('flex flex-1 items-center', 'pt-20 pb-4 px-20', className),
|
|
102
127
|
children: /*#__PURE__*/ jsx(DatePicker.Context, {
|
|
@@ -105,7 +130,8 @@ const CalendarInputHeader = ({ className })=>{
|
|
|
105
130
|
readonly: readonly
|
|
106
131
|
}) : /*#__PURE__*/ jsx(SingleDateInputInner, {
|
|
107
132
|
api: api,
|
|
108
|
-
readonly: readonly
|
|
133
|
+
readonly: readonly,
|
|
134
|
+
showTime: showTime
|
|
109
135
|
})
|
|
110
136
|
})
|
|
111
137
|
});
|
|
@@ -28,8 +28,8 @@ const OPERATOR_SYMBOLS = {
|
|
|
28
28
|
not_like: '!~',
|
|
29
29
|
in: 'IN',
|
|
30
30
|
not_in: 'NOT IN',
|
|
31
|
-
is_null: '
|
|
32
|
-
is_not_null: '
|
|
31
|
+
is_null: '= null',
|
|
32
|
+
is_not_null: '!= null',
|
|
33
33
|
between: '<>'
|
|
34
34
|
};
|
|
35
35
|
const OPERATOR_LABELS = {
|
|
@@ -43,8 +43,8 @@ const OPERATOR_LABELS = {
|
|
|
43
43
|
not_like: 'not like',
|
|
44
44
|
in: 'is any of',
|
|
45
45
|
not_in: 'is not any of',
|
|
46
|
-
is_null: 'is set',
|
|
47
|
-
is_not_null: 'is
|
|
46
|
+
is_null: 'is not set',
|
|
47
|
+
is_not_null: 'is set',
|
|
48
48
|
between: 'between'
|
|
49
49
|
};
|
|
50
50
|
const OPERATOR_LABELS_BY_TYPE = {
|
|
@@ -54,8 +54,8 @@ const OPERATOR_LABELS_BY_TYPE = {
|
|
|
54
54
|
in: 'in',
|
|
55
55
|
like: 'like',
|
|
56
56
|
not_like: 'not like',
|
|
57
|
-
is_null: 'is set',
|
|
58
|
-
is_not_null: 'is
|
|
57
|
+
is_null: 'is not set',
|
|
58
|
+
is_not_null: 'is set'
|
|
59
59
|
},
|
|
60
60
|
integer: {
|
|
61
61
|
'=': 'is',
|
|
@@ -86,14 +86,14 @@ const OPERATOR_LABELS_BY_TYPE = {
|
|
|
86
86
|
boolean: {
|
|
87
87
|
'=': 'is true',
|
|
88
88
|
'!=': 'is false',
|
|
89
|
-
is_null: 'is set',
|
|
90
|
-
is_not_null: 'is
|
|
89
|
+
is_null: 'is not set',
|
|
90
|
+
is_not_null: 'is set'
|
|
91
91
|
},
|
|
92
92
|
enum: {
|
|
93
93
|
in: 'is any of',
|
|
94
94
|
not_in: 'is not any of',
|
|
95
|
-
is_null: 'is set',
|
|
96
|
-
is_not_null: 'is
|
|
95
|
+
is_null: 'is not set',
|
|
96
|
+
is_not_null: 'is set'
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
const OPERATORS_BY_TYPE = {
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { TestIdProvider } from "../../utils/testId.js";
|
|
5
|
-
const inputGroupVariants = cva(cn('group/input-group', 'w-full flex items-center border rounded-8 bg-component-input-bg relative', '
|
|
5
|
+
const inputGroupVariants = cva(cn('group/input-group', 'w-full flex items-center border rounded-8 bg-component-input-bg relative', '**:data-[slot=input]:flex-1', '**:data-[slot=input]:rounded-none', '**:data-[slot=input]:border-0', '**:data-[slot=input]:bg-transparent', '**:data-[slot=input]:shadow-none', '**:data-[slot=input]:focus-visible:ring-0', '**:data-[slot=input]:focus-within:ring-0', 'has-[textarea]:flex-col', 'has-[textarea]:h-auto', 'has-[textarea]:items-stretch', '[&_textarea]:border-0', '[&_textarea]:bg-transparent', '[&_textarea]:shadow-none', '[&_textarea]:rounded-none', '[&_textarea]:ring-0', '[&_textarea:focus-visible]:ring-0', '[&_textarea]:outline-none', '**:data-[slot=textarea]:flex-1', '**:data-[slot=textarea]:w-full', 'border border-border-primary outline-none shadow-xs transition-[color,border,box-shadow]', 'has-[[data-slot=input]:not(:disabled):not([aria-disabled=true]):not([data-readonly=true]):not(:focus-visible)]:hover:border-component-border-input-hover', 'focus-visible:ring-focus-primary', 'has-[[data-slot=input]:not([data-readonly=true]):focus-visible]:ring-3', 'has-[[data-slot=input]:not([data-readonly=true]):focus-visible]:ring-focus-primary', 'has-[[data-slot=input]:not([data-readonly=true]):focus-visible]:border-border-strong-primary', 'focus-within:ring-focus-primary', 'has-[[data-slot=input]:not([data-readonly=true]):focus-within]:ring-3', 'has-[[data-slot=input]:not([data-readonly=true]):focus-within]:ring-focus-primary', 'has-[[data-slot=input]:not([data-readonly=true]):focus-within]:border-border-strong-primary', 'has-[textarea:not(:disabled):focus-visible]:ring-3', 'has-[textarea:not(:disabled):focus-visible]:ring-focus-primary', 'has-[textarea:not(:disabled):focus-visible]:border-border-strong-primary', 'has-[[data-slot][aria-invalid=true]]:border-border-strong-danger', 'has-[[data-slot][aria-invalid=true]]:ring-focus-destructive', 'has-[[data-slot][aria-invalid=true]:not(:disabled):not([aria-disabled=true]):not([data-readonly=true])]:hover:border-border-strong-danger', 'has-[[data-slot][aria-invalid=true]:not(:disabled):not([aria-disabled=true]):not([data-readonly=true])]:hover:ring-3', 'has-[[data-slot][aria-invalid=true]:not(:disabled):not([aria-disabled=true]):not([data-readonly=true])]:hover:ring-focus-destructive-hover', 'has-[[data-slot][aria-invalid=true]:not(:disabled):not([aria-disabled=true]):not([data-readonly=true])]:*:data-[slot=input]:hover:ring-0', 'has-[textarea[aria-invalid=true]]:border-border-strong-danger', 'has-[textarea[aria-invalid=true]:not(:disabled)]:hover:ring-3', 'has-[textarea[aria-invalid=true]:not(:disabled)]:hover:ring-focus-destructive-hover', 'has-[textarea:not(:disabled):focus-visible]:has-[textarea[aria-invalid=true]]:ring-focus-destructive', 'has-[[data-slot=input]:disabled]:opacity-50', 'has-[[data-slot=input][aria-disabled=true]]:opacity-50', 'has-[[data-slot=input]:disabled]:cursor-not-allowed', 'has-[[data-slot=input][aria-disabled=true]]:cursor-not-allowed', 'has-[textarea:disabled]:opacity-50', 'has-[textarea:disabled]:cursor-not-allowed'), {
|
|
6
6
|
variants: {
|
|
7
7
|
size: {
|
|
8
8
|
default: 'h-36',
|