dirk-cfx-react 1.0.5 → 1.0.6

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.cjs CHANGED
@@ -1,1255 +1,4 @@
1
1
  'use strict';
2
2
 
3
- var reactFontawesome = require('@fortawesome/react-fontawesome');
4
- var core = require('@mantine/core');
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var framerMotion = require('framer-motion');
7
- var react = require('react');
8
- var zustand = require('zustand');
9
- var clickSoundUrl = require('./click_sound-PNCRRTM4.mp3');
10
- var hoverSoundUrl = require('./hover_sound-NBUA222C.mp3');
11
- require('@mantine/core/styles.css');
12
- require('@mantine/notifications/styles.css');
13
- require('./styles/niceFont.css');
14
- require('./styles/scrollBar.css');
15
- var fontawesomeSvgCore = require('@fortawesome/fontawesome-svg-core');
16
- var freeBrandsSvgIcons = require('@fortawesome/free-brands-svg-icons');
17
- var freeRegularSvgIcons = require('@fortawesome/free-regular-svg-icons');
18
- var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
19
-
20
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
21
-
22
- var clickSoundUrl__default = /*#__PURE__*/_interopDefault(clickSoundUrl);
23
- var hoverSoundUrl__default = /*#__PURE__*/_interopDefault(hoverSoundUrl);
24
-
25
- // src/components/BorderedIcon.tsx
26
-
27
- // src/utils/colorWithAlpha.ts
28
- var colorNames = {
29
- AliceBlue: { r: 240, g: 248, b: 255 },
30
- AntiqueWhite: { r: 250, g: 235, b: 215 },
31
- Aqua: { r: 0, g: 255, b: 255 },
32
- Aquamarine: { r: 127, g: 255, b: 212 },
33
- Azure: { r: 240, g: 255, b: 255 },
34
- Beige: { r: 245, g: 245, b: 220 },
35
- Bisque: { r: 255, g: 228, b: 196 },
36
- Black: { r: 0, g: 0, b: 0 },
37
- BlanchedAlmond: { r: 255, g: 235, b: 205 },
38
- Blue: { r: 0, g: 0, b: 255 },
39
- BlueViolet: { r: 138, g: 43, b: 226 },
40
- Brown: { r: 165, g: 42, b: 42 },
41
- BurlyWood: { r: 222, g: 184, b: 135 },
42
- CadetBlue: { r: 95, g: 158, b: 160 },
43
- Chartreuse: { r: 127, g: 255, b: 0 },
44
- Chocolate: { r: 210, g: 105, b: 30 },
45
- Coral: { r: 255, g: 127, b: 80 },
46
- CornflowerBlue: { r: 100, g: 149, b: 237 },
47
- Cornsilk: { r: 255, g: 248, b: 220 },
48
- Crimson: { r: 220, g: 20, b: 60 },
49
- Cyan: { r: 0, g: 255, b: 255 },
50
- DarkBlue: { r: 0, g: 0, b: 139 },
51
- DarkCyan: { r: 0, g: 139, b: 139 },
52
- DarkGoldenRod: { r: 184, g: 134, b: 11 },
53
- DarkGray: { r: 169, g: 169, b: 169 },
54
- DarkGreen: { r: 0, g: 100, b: 0 },
55
- DarkKhaki: { r: 189, g: 183, b: 107 },
56
- DarkMagenta: { r: 139, g: 0, b: 139 },
57
- DarkOliveGreen: { r: 85, g: 107, b: 47 },
58
- DarkOrange: { r: 255, g: 140, b: 0 },
59
- DarkOrchid: { r: 153, g: 50, b: 204 },
60
- DarkRed: { r: 139, g: 0, b: 0 },
61
- DarkSalmon: { r: 233, g: 150, b: 122 },
62
- DarkSeaGreen: { r: 143, g: 188, b: 143 },
63
- DarkSlateBlue: { r: 72, g: 61, b: 139 },
64
- DarkSlateGray: { r: 47, g: 79, b: 79 },
65
- DarkTurquoise: { r: 0, g: 206, b: 209 },
66
- DarkViolet: { r: 148, g: 0, b: 211 },
67
- DeepPink: { r: 255, g: 20, b: 147 },
68
- DeepSkyBlue: { r: 0, g: 191, b: 255 },
69
- DimGray: { r: 105, g: 105, b: 105 },
70
- DodgerBlue: { r: 30, g: 144, b: 255 },
71
- FireBrick: { r: 178, g: 34, b: 34 },
72
- FloralWhite: { r: 255, g: 250, b: 240 },
73
- ForestGreen: { r: 34, g: 139, b: 34 },
74
- Fuchsia: { r: 255, g: 0, b: 255 },
75
- Gainsboro: { r: 220, g: 220, b: 220 },
76
- GhostWhite: { r: 248, g: 248, b: 255 },
77
- Gold: { r: 255, g: 215, b: 0 },
78
- GoldenRod: { r: 218, g: 165, b: 32 },
79
- Gray: { r: 128, g: 128, b: 128 },
80
- Green: { r: 0, g: 128, b: 0 },
81
- GreenYellow: { r: 173, g: 255, b: 47 },
82
- HoneyDew: { r: 240, g: 255, b: 240 },
83
- HotPink: { r: 255, g: 105, b: 180 },
84
- IndianRed: { r: 205, g: 92, b: 92 },
85
- Indigo: { r: 75, g: 0, b: 130 },
86
- Ivory: { r: 255, g: 255, b: 240 },
87
- Khaki: { r: 240, g: 230, b: 140 },
88
- Lavender: { r: 230, g: 230, b: 250 },
89
- LavenderBlush: { r: 255, g: 240, b: 245 },
90
- LawnGreen: { r: 124, g: 252, b: 0 },
91
- LemonChiffon: { r: 255, g: 250, b: 205 },
92
- LightBlue: { r: 173, g: 216, b: 230 },
93
- LightCoral: { r: 240, g: 128, b: 128 },
94
- LightCyan: { r: 224, g: 255, b: 255 },
95
- LightGoldenRodYellow: { r: 250, g: 250, b: 210 },
96
- LightGray: { r: 211, g: 211, b: 211 },
97
- LightGreen: { r: 144, g: 238, b: 144 },
98
- LightPink: { r: 255, g: 182, b: 193 },
99
- LightSalmon: { r: 255, g: 160, b: 122 },
100
- LightSeaGreen: { r: 32, g: 178, b: 170 },
101
- LightSkyBlue: { r: 135, g: 206, b: 250 },
102
- LightSlateGray: { r: 119, g: 136, b: 153 },
103
- LightSteelBlue: { r: 176, g: 196, b: 222 },
104
- LightYellow: { r: 255, g: 255, b: 224 },
105
- Lime: { r: 0, g: 255, b: 0 },
106
- LimeGreen: { r: 50, g: 205, b: 50 },
107
- Linen: { r: 250, g: 240, b: 230 },
108
- Magenta: { r: 255, g: 0, b: 255 },
109
- Maroon: { r: 128, g: 0, b: 0 },
110
- // Maroon
111
- MediumAquaMarine: { r: 102, g: 205, b: 170 },
112
- MediumBlue: { r: 0, g: 0, b: 205 },
113
- MediumOrchid: { r: 186, g: 85, b: 211 },
114
- MediumPurple: { r: 147, g: 112, b: 219 },
115
- MediumSeaGreen: { r: 60, g: 179, b: 113 },
116
- MediumSlateBlue: { r: 123, g: 104, b: 238 },
117
- MediumSpringGreen: { r: 0, g: 250, b: 154 },
118
- MediumTurquoise: { r: 72, g: 209, b: 204 },
119
- MediumVioletRed: { r: 199, g: 21, b: 133 },
120
- MidnightBlue: { r: 25, g: 25, b: 112 },
121
- MintCream: { r: 245, g: 255, b: 250 },
122
- MistyRose: { r: 255, g: 228, b: 225 },
123
- Moccasin: { r: 255, g: 228, b: 181 },
124
- NavajoWhite: { r: 255, g: 222, b: 173 },
125
- Navy: { r: 0, g: 0, b: 128 },
126
- OldLace: { r: 253, g: 245, b: 230 },
127
- Olive: { r: 128, g: 128, b: 0 },
128
- OliveDrab: { r: 107, g: 142, b: 35 },
129
- Orange: { r: 255, g: 165, b: 0 },
130
- OrangeRed: { r: 255, g: 69, b: 0 },
131
- Orchid: { r: 218, g: 112, b: 214 },
132
- PaleGoldenRod: { r: 238, g: 232, b: 170 },
133
- PaleGreen: { r: 152, g: 251, b: 152 },
134
- PaleTurquoise: { r: 175, g: 238, b: 238 },
135
- PaleVioletRed: { r: 219, g: 112, b: 147 },
136
- PapayaWhip: { r: 255, g: 239, b: 213 },
137
- PeachPuff: { r: 255, g: 218, b: 185 },
138
- Peru: { r: 205, g: 133, b: 63 },
139
- Pink: { r: 255, g: 192, b: 203 },
140
- Plum: { r: 221, g: 160, b: 221 },
141
- PowderBlue: { r: 176, g: 224, b: 230 },
142
- Purple: { r: 128, g: 0, b: 128 },
143
- RebeccaPurple: { r: 102, g: 51, b: 153 },
144
- Red: { r: 255, g: 0, b: 0 },
145
- RosyBrown: { r: 188, g: 143, b: 143 },
146
- RoyalBlue: { r: 65, g: 105, b: 225 },
147
- SaddleBrown: { r: 139, g: 69, b: 19 },
148
- Salmon: { r: 250, g: 128, b: 114 },
149
- SandyBrown: { r: 244, g: 164, b: 96 },
150
- SeaGreen: { r: 46, g: 139, b: 87 },
151
- SeaShell: { r: 255, g: 245, b: 238 },
152
- Sienna: { r: 160, g: 82, b: 45 },
153
- Silver: { r: 192, g: 192, b: 192 },
154
- SkyBlue: { r: 135, g: 206, b: 235 },
155
- SlateBlue: { r: 106, g: 90, b: 205 },
156
- SlateGray: { r: 112, g: 128, b: 144 },
157
- Snow: { r: 255, g: 250, b: 250 },
158
- SpringGreen: { r: 0, g: 255, b: 127 },
159
- SteelBlue: { r: 70, g: 130, b: 180 },
160
- Tan: { r: 210, g: 180, b: 140 },
161
- Teal: { r: 0, g: 128, b: 128 },
162
- Thistle: { r: 216, g: 191, b: 216 },
163
- Tomato: { r: 255, g: 99, b: 71 },
164
- Turquoise: { r: 64, g: 224, b: 208 },
165
- Violet: { r: 238, g: 130, b: 238 },
166
- Wheat: { r: 245, g: 222, b: 179 },
167
- White: { r: 255, g: 255, b: 255 },
168
- WhiteSmoke: { r: 245, g: 245, b: 245 },
169
- Yellow: { r: 255, g: 255, b: 0 },
170
- YellowGreen: { r: 154, g: 205, b: 50 }
171
- };
172
- function colorWithAlpha(color, alpha) {
173
- const lowerCasedColor = color.toLowerCase();
174
- if (colorNames[lowerCasedColor]) {
175
- const rgb = colorNames[lowerCasedColor];
176
- return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha})`;
177
- }
178
- if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
179
- const hex = color.slice(1);
180
- const bigint = parseInt(hex, 16);
181
- const r = bigint >> 16 & 255;
182
- const g = bigint >> 8 & 255;
183
- const b = bigint & 255;
184
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
185
- }
186
- if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
187
- const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
188
- if (result) {
189
- return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha})`;
190
- }
191
- }
192
- return color;
193
- }
194
- function BorderedIcon(props) {
195
- const theme2 = core.useMantineTheme();
196
- return /* @__PURE__ */ jsxRuntime.jsx(
197
- reactFontawesome.FontAwesomeIcon,
198
- {
199
- icon: props.icon,
200
- color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
201
- style: {
202
- // backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
203
- backgroundColor: "rgba(0, 0, 0, 0.5)",
204
- padding: props.p || theme2.spacing.xs,
205
- transition: "all 0.2s ease-in-out",
206
- aspectRatio: "1/1",
207
- fontSize: props.fontSize ? props.fontSize : "2.5vh",
208
- borderRadius: theme2.radius.xs,
209
- // border: `2px solid var(--mantine-primary-color-9)`,
210
- outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][9], 0.8)}`,
211
- boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][7], 0.5)}`
212
- }
213
- }
214
- );
215
- }
216
- var MotionFlex = framerMotion.motion(core.Flex);
217
- var MotionText = framerMotion.motion(core.Text);
218
- var MotionIcon = framerMotion.motion(reactFontawesome.FontAwesomeIcon);
219
- var MotionImage = framerMotion.motion(core.Image);
220
- function Counter(props) {
221
- return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsxRuntime.jsx(
222
- MotionFlex,
223
- {
224
- initial: { opacity: 0 },
225
- animate: { opacity: 1 },
226
- exit: { opacity: 0 },
227
- fz: "1.25vh",
228
- h: "1.75vh",
229
- justify: "center",
230
- align: "center",
231
- bg: props.color || "rgba(0, 0, 0, 0.51)",
232
- style: {
233
- borderRadius: "50%",
234
- aspectRatio: "1/1",
235
- marginBottom: "0.3vh",
236
- fontFamily: "Akrobat Bold",
237
- boxShadow: "0 0 5px rgba(0, 0, 0, 0.3)"
238
- },
239
- children: props.count
240
- },
241
- "counter"
242
- ) });
243
- }
244
- var FloatingParticles = ({
245
- icons = [],
246
- particleCount = 55,
247
- color = "#00a552ff",
248
- size = 32,
249
- speed = "slow",
250
- opacity = 0.3,
251
- style = {},
252
- mouseRepelDistance = 150,
253
- mouseRepelStrength = 50,
254
- backgroundColor = "transparent"
255
- }) => {
256
- const containerRef = react.useRef(null);
257
- const [particles, setParticles] = react.useState([]);
258
- const mouseX = framerMotion.useMotionValue(0);
259
- const mouseY = framerMotion.useMotionValue(0);
260
- const durationMap = {
261
- slow: { base: 10, variance: 10 },
262
- medium: { base: 2, variance: 2 },
263
- fast: { base: 4, variance: 2 }
264
- };
265
- const duration = durationMap[speed];
266
- const seededRandom = (seed) => {
267
- const x = Math.sin(seed) * 1e4;
268
- return x - Math.floor(x);
269
- };
270
- react.useEffect(() => {
271
- if (!containerRef.current) return;
272
- const bounds = containerRef.current.getBoundingClientRect();
273
- const newParticles = [...Array(particleCount)].map((_, i) => {
274
- const seedX = i * 123.456;
275
- const seedY = i * 789.012;
276
- const seedDuration = i * 345.678;
277
- const baseX = seededRandom(seedX) * bounds.width;
278
- const baseY = seededRandom(seedY) * bounds.height;
279
- return {
280
- id: i,
281
- baseX,
282
- baseY,
283
- currentX: baseX,
284
- currentY: baseY,
285
- icon: icons.length > 0 ? icons[i % icons.length] : null,
286
- animationDuration: duration.base + seededRandom(seedDuration) * duration.variance
287
- };
288
- });
289
- setParticles(newParticles);
290
- }, [particleCount, icons.length, duration.base, duration.variance]);
291
- react.useEffect(() => {
292
- if (!containerRef.current) return;
293
- const handleMouseMove = (e) => {
294
- const bounds = containerRef.current.getBoundingClientRect();
295
- const x = e.clientX - bounds.left;
296
- const y = e.clientY - bounds.top;
297
- mouseX.set(x);
298
- mouseY.set(y);
299
- setParticles(
300
- (prevParticles) => prevParticles.map((particle) => {
301
- const dx = x - particle.baseX;
302
- const dy = y - particle.baseY;
303
- const distance = Math.sqrt(dx * dx + dy * dy);
304
- if (distance < mouseRepelDistance && distance > 0) {
305
- const force = (mouseRepelDistance - distance) / mouseRepelDistance;
306
- const repelX = dx / distance * force * mouseRepelStrength * -1;
307
- const repelY = dy / distance * force * mouseRepelStrength * -1;
308
- return {
309
- ...particle,
310
- currentX: particle.baseX + repelX,
311
- currentY: particle.baseY + repelY
312
- };
313
- } else {
314
- return {
315
- ...particle,
316
- currentX: particle.baseX,
317
- currentY: particle.baseY
318
- };
319
- }
320
- })
321
- );
322
- };
323
- const handleMouseLeave = () => {
324
- setParticles(
325
- (prevParticles) => prevParticles.map((particle) => ({
326
- ...particle,
327
- currentX: particle.baseX,
328
- currentY: particle.baseY
329
- }))
330
- );
331
- };
332
- const container = containerRef.current;
333
- container.addEventListener("mousemove", handleMouseMove);
334
- container.addEventListener("mouseleave", handleMouseLeave);
335
- return () => {
336
- container.removeEventListener("mousemove", handleMouseMove);
337
- container.removeEventListener("mouseleave", handleMouseLeave);
338
- };
339
- }, [mouseX, mouseY, mouseRepelDistance, mouseRepelStrength]);
340
- react.useEffect(() => {
341
- const handleResize = () => {
342
- if (!containerRef.current) return;
343
- const bounds = containerRef.current.getBoundingClientRect();
344
- setParticles(
345
- (prevParticles) => prevParticles.map((particle, i) => {
346
- const seedX = i * 123.456 + bounds.width;
347
- const seedY = i * 789.012 + bounds.height;
348
- const newBaseX = seededRandom(seedX) * bounds.width;
349
- const newBaseY = seededRandom(seedY) * bounds.height;
350
- return {
351
- ...particle,
352
- baseX: newBaseX,
353
- baseY: newBaseY,
354
- currentX: newBaseX,
355
- currentY: newBaseY
356
- };
357
- })
358
- );
359
- };
360
- window.addEventListener("resize", handleResize);
361
- return () => window.removeEventListener("resize", handleResize);
362
- }, []);
363
- return /* @__PURE__ */ jsxRuntime.jsx(
364
- "div",
365
- {
366
- ref: containerRef,
367
- style: {
368
- position: "absolute",
369
- overflow: "hidden",
370
- width: "100%",
371
- height: "100%",
372
- zIndex: -1,
373
- backgroundColor,
374
- ...style
375
- },
376
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: particles.map((particle) => /* @__PURE__ */ jsxRuntime.jsx(
377
- framerMotion.motion.div,
378
- {
379
- style: {
380
- position: "absolute",
381
- width: size,
382
- height: size,
383
- color,
384
- opacity,
385
- left: 0,
386
- top: 0
387
- },
388
- animate: {
389
- x: particle.currentX,
390
- y: particle.currentY,
391
- scale: [0.8, 1.1, 0.8],
392
- opacity: [opacity * 0.5, opacity, opacity * 0.5],
393
- // random rotate between 0 and 360 so that not all particles rotate the same
394
- rotate: particle.id % 2 === 0 ? [0, 360] : [360, 0]
395
- },
396
- transition: {
397
- x: { type: "spring", stiffness: 150, damping: 20 },
398
- y: { type: "spring", stiffness: 150, damping: 20 },
399
- rotate: {
400
- duration: particle.animationDuration,
401
- repeat: Infinity,
402
- ease: "linear"
403
- },
404
- scale: {
405
- duration: particle.animationDuration,
406
- repeat: Infinity,
407
- delay: seededRandom(particle.id * 111.222) * 5,
408
- ease: "easeInOut"
409
- },
410
- opacity: {
411
- duration: particle.animationDuration,
412
- repeat: Infinity,
413
- delay: seededRandom(particle.id * 333.444) * 5,
414
- ease: "easeInOut"
415
- }
416
- },
417
- children: particle.icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: particle.icon, style: { width: "70%", height: "70%" } }) }) : /* @__PURE__ */ jsxRuntime.jsx(
418
- "div",
419
- {
420
- style: {
421
- width: "100%",
422
- height: "100%",
423
- borderRadius: "50%",
424
- backgroundColor: color
425
- }
426
- }
427
- )
428
- },
429
- particle.id
430
- )) })
431
- }
432
- );
433
- };
434
- function Icon(props) {
435
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
436
- }
437
- function InfoBox(props) {
438
- const theme2 = core.useMantineTheme();
439
- return /* @__PURE__ */ jsxRuntime.jsxs(
440
- core.Flex,
441
- {
442
- w: "fit-content",
443
- h: "fit-content",
444
- style: {
445
- borderRadius: theme2.radius.xs,
446
- overflow: "hidden",
447
- border: `0.2vh solid rgba(77,77,77,0.3)`
448
- },
449
- align: "center",
450
- children: [
451
- /* @__PURE__ */ jsxRuntime.jsx(
452
- core.Flex,
453
- {
454
- miw: "4vh",
455
- p: "xxs",
456
- bg: "rgba(77,77,77,0.2)",
457
- direction: "column",
458
- justify: "center",
459
- align: "center",
460
- children: /* @__PURE__ */ jsxRuntime.jsx(
461
- core.Text,
462
- {
463
- c: "lightgrey",
464
- size: "xxs",
465
- style: {
466
- fontFamily: "Akrobat Bold",
467
- letterSpacing: "0.05em",
468
- textTransform: "uppercase"
469
- },
470
- children: props.leftSide
471
- }
472
- )
473
- }
474
- ),
475
- /* @__PURE__ */ jsxRuntime.jsx(
476
- core.Flex,
477
- {
478
- p: "xxs",
479
- flex: 1,
480
- miw: "4vh",
481
- bg: "rgba(77,77,77,0.5)",
482
- direction: "column",
483
- align: "center",
484
- justify: "center",
485
- children: /* @__PURE__ */ jsxRuntime.jsx(
486
- core.Text,
487
- {
488
- c: "lightgrey",
489
- size: "xxs",
490
- style: {
491
- fontFamily: "Akrobat Bold",
492
- letterSpacing: "0.05em",
493
- textTransform: "uppercase"
494
- },
495
- children: props.rightSide
496
- }
497
- )
498
- }
499
- )
500
- ]
501
- }
502
- );
503
- }
504
- function InputContainer(props) {
505
- const theme2 = core.useMantineTheme();
506
- return /* @__PURE__ */ jsxRuntime.jsxs(
507
- MotionFlex,
508
- {
509
- w: props.w || "100%",
510
- flex: props.flex,
511
- direction: "column",
512
- h: props.h,
513
- gap: props.title ? "xs" : 0,
514
- bg: props.bg || "rgba(69, 69, 69, 0.42)",
515
- p: "sm",
516
- style: {
517
- borderRadius: theme2.radius.xs,
518
- boxShadow: theme2.shadows.sm,
519
- overflow: "hidden",
520
- outline: props.error ? `1px solid rgba(255, 100, 100, 0.8)` : "none"
521
- },
522
- variants: props.variants,
523
- children: [
524
- /* @__PURE__ */ jsxRuntime.jsxs(
525
- core.Flex,
526
- {
527
- align: "center",
528
- gap: "xs",
529
- children: [
530
- /* @__PURE__ */ jsxRuntime.jsxs(
531
- core.Flex,
532
- {
533
- direction: "column",
534
- gap: "xxs",
535
- children: [
536
- props.title && /* @__PURE__ */ jsxRuntime.jsx(
537
- core.Text,
538
- {
539
- size: "sm",
540
- style: {
541
- lineHeight: "1.25vh",
542
- fontFamily: "Akrobat Bold",
543
- letterSpacing: "0.05em",
544
- textTransform: "uppercase"
545
- },
546
- children: props.title
547
- }
548
- ),
549
- props.description && /* @__PURE__ */ jsxRuntime.jsx(
550
- core.Text,
551
- {
552
- size: "xs",
553
- c: "rgba(255, 255, 255, 0.8)",
554
- fw: 400,
555
- children: props.description
556
- }
557
- )
558
- ]
559
- }
560
- ),
561
- props.error && /* @__PURE__ */ jsxRuntime.jsx(
562
- core.Text,
563
- {
564
- size: "xs",
565
- c: theme2.colors.red[9],
566
- fw: 600,
567
- mb: "auto",
568
- lh: "0.8",
569
- children: props.error
570
- }
571
- ),
572
- /* @__PURE__ */ jsxRuntime.jsx(
573
- core.Flex,
574
- {
575
- ml: "auto",
576
- children: props.rightSection
577
- }
578
- )
579
- ]
580
- }
581
- ),
582
- props.children
583
- ]
584
- }
585
- );
586
- }
587
- var useAudio = zustand.create(() => {
588
- const audioRefs = {};
589
- const sounds = {
590
- click: clickSoundUrl__default.default,
591
- hover: hoverSoundUrl__default.default
592
- };
593
- for (const [key, src] of Object.entries(sounds)) {
594
- audioRefs[key] = new Audio(src);
595
- }
596
- return {
597
- play: (sound) => {
598
- const audio = audioRefs[sound];
599
- if (!audio) return console.warn(`Sound '${sound}' not found.`);
600
- audio.currentTime = 0;
601
- audio.volume = 0.1;
602
- audio.play();
603
- },
604
- stop: (sound) => {
605
- const audio = audioRefs[sound];
606
- if (!audio) return console.warn(`Sound '${sound}' not found.`);
607
- audio.pause();
608
- audio.currentTime = 0;
609
- }
610
- };
611
- });
612
-
613
- // src/utils/misc.ts
614
- var isEnvBrowser = () => !window.invokeNative;
615
- var noop = () => {
616
- };
617
- var splitFAString = (faString) => {
618
- const [prefix, newIcon] = faString.split("-");
619
- if (!prefix || !newIcon) return { prefix: "fas", newIcon: "question" };
620
- return { prefix, newIcon };
621
- };
622
- var numberToRoman = (num) => {
623
- const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX"];
624
- return romanNumerals[num];
625
- };
626
- var copyToClipboard = (text) => {
627
- const el = document.createElement("textarea");
628
- el.value = text;
629
- document.body.appendChild(el);
630
- el.select();
631
- document.execCommand("copy");
632
- document.body.removeChild(el);
633
- };
634
- var openLink = (url) => {
635
- if (isEnvBrowser()) {
636
- window.open(url, "_blank");
637
- } else {
638
- window.invokeNative("openLink", url);
639
- }
640
- };
641
-
642
- // src/utils/fetchNui.ts
643
- async function fetchNui(eventName, data, mockData) {
644
- const options = {
645
- method: "post",
646
- headers: {
647
- "Content-Type": "application/json; charset=UTF-8"
648
- },
649
- body: JSON.stringify(data)
650
- };
651
- console.log("Mock Data:", mockData);
652
- console.log("Is Env Browser:", isEnvBrowser());
653
- if (isEnvBrowser() && mockData !== void 0) return mockData;
654
- const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
655
- const resp = await fetch(`https://${resourceName}/${eventName}`, options);
656
- const respFormatted = await resp.json();
657
- return respFormatted;
658
- }
659
- function fetchOnLoad(eventName, data, mockData) {
660
- return fetchNui(eventName, data, mockData).catch((err) => {
661
- console.error(`[fetchOnLoad] Failed for ${eventName}:`, err);
662
- throw err;
663
- });
664
- }
665
- var fetchLuaTable = (tableName) => () => {
666
- if (isEnvBrowser()) {
667
- return Promise.resolve({});
668
- }
669
- return fetchNui("GET_LUA_TABLE", { tableName });
670
- };
671
-
672
- // src/utils/internalEvent.ts
673
- var internalEvent = (events, timer = 1e3) => {
674
- if (isEnvBrowser()) {
675
- for (const event of events) {
676
- setTimeout(() => {
677
- window.dispatchEvent(
678
- new MessageEvent("message", {
679
- data: {
680
- action: event.action,
681
- data: event.data
682
- }
683
- })
684
- );
685
- }, timer);
686
- }
687
- }
688
- };
689
- var localeStore = zustand.create((set, get) => {
690
- return {
691
- locales: {
692
- "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant."
693
- },
694
- locale: (key, ...args) => {
695
- const exists = get().locales[key];
696
- let translation = exists || key;
697
- if (args.length) {
698
- translation = translation.replace(/%s/g, () => String(args.shift() || ""));
699
- }
700
- return translation;
701
- }
702
- };
703
- });
704
- var locale = localeStore.getState().locale;
705
- fetchOnLoad("GET_LOCALES").then((data) => {
706
- localeStore.setState({ locales: data });
707
- });
708
- function SegmentedControl(props) {
709
- const theme2 = core.useMantineTheme();
710
- const play = useAudio((state) => state.play);
711
- const handleChange = (newValue) => {
712
- if (props.sounds) play("click");
713
- if (props.onChange) {
714
- props.onChange(newValue);
715
- }
716
- };
717
- return /* @__PURE__ */ jsxRuntime.jsx(
718
- core.Flex,
719
- {
720
- bg: "rgba(33, 33, 33, 0.6)",
721
- w: props.w || "fit-content",
722
- style: {
723
- borderRadius: theme2.radius.xs,
724
- overflow: "hidden"
725
- },
726
- ...props,
727
- children: props.items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
728
- framerMotion.motion.div,
729
- {
730
- initial: { x: -100, opacity: 0 },
731
- animate: { x: 0, opacity: 1 },
732
- transition: { duration: 0.3, delay: index * 0.1, ease: "easeInOut" },
733
- style: {
734
- display: "flex",
735
- flexDirection: "row",
736
- alignItems: "center",
737
- flex: 1
738
- },
739
- children: /* @__PURE__ */ jsxRuntime.jsx(
740
- Segment,
741
- {
742
- label: item.label,
743
- value: item.value,
744
- icon: item.icon,
745
- rightSection: item.rightSection,
746
- fz: props.fz,
747
- selected: !props.multi ? props.value === item.value : Array.isArray(props.value) && props.value.includes(item.value),
748
- onClick: () => {
749
- if (props.multi) {
750
- const newValue = Array.isArray(props.value) ? props.value.includes(item.value) ? props.value.filter((v) => v !== item.value) : [...props.value, item.value] : [item.value];
751
- handleChange(newValue);
752
- } else {
753
- handleChange(item.value);
754
- }
755
- }
756
- },
757
- item.value
758
- )
759
- },
760
- index
761
- ))
762
- }
763
- );
764
- }
765
- function Segment(props) {
766
- const theme2 = core.useMantineTheme();
767
- return /* @__PURE__ */ jsxRuntime.jsxs(
768
- MotionFlex,
769
- {
770
- onClick: props.onClick,
771
- w: "100%",
772
- direction: "column",
773
- align: "center",
774
- h: "100%",
775
- bg: props.selected ? colorWithAlpha(theme2.colors[theme2.primaryColor][theme2.primaryShade], 0.2) : "transparent",
776
- pos: "relative",
777
- style: {
778
- // position: "relative",
779
- cursor: "pointer"
780
- },
781
- justify: "center",
782
- whileHover: { scale: 1.05 },
783
- whileTap: { scale: 0.95 },
784
- children: [
785
- /* @__PURE__ */ jsxRuntime.jsxs(
786
- core.Flex,
787
- {
788
- align: "center",
789
- gap: "xs",
790
- p: "xs",
791
- children: [
792
- props.icon && /* @__PURE__ */ jsxRuntime.jsx(
793
- MotionIcon,
794
- {
795
- icon: props.icon,
796
- initial: {
797
- color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
798
- },
799
- animate: {
800
- color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
801
- },
802
- exit: {
803
- color: "inherit"
804
- },
805
- style: {
806
- fontSize: theme2.fontSizes.xs,
807
- marginBottom: "0.2vh"
808
- }
809
- }
810
- ),
811
- /* @__PURE__ */ jsxRuntime.jsx(
812
- MotionText,
813
- {
814
- size: props.fz || "xs",
815
- initial: {
816
- color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
817
- },
818
- animate: {
819
- color: props.selected ? theme2.colors[theme2.primaryColor][5] : "inherit"
820
- },
821
- exit: {
822
- color: "inherit"
823
- },
824
- style: {
825
- fontFamily: "Akrobat Bold",
826
- letterSpacing: "0.1em",
827
- textTransform: "uppercase"
828
- },
829
- children: props.label.toUpperCase()
830
- }
831
- ),
832
- props.rightSection
833
- ]
834
- }
835
- ),
836
- /* @__PURE__ */ jsxRuntime.jsx(
837
- framerMotion.motion.div,
838
- {
839
- initial: false,
840
- animate: {
841
- scaleX: props.selected ? 1 : 0,
842
- opacity: props.selected ? 1 : 0
843
- },
844
- transition: {
845
- duration: 0.3,
846
- ease: [0.4, 0, 0.2, 1]
847
- // Custom easing curve for smooth feel
848
- },
849
- style: {
850
- position: "absolute",
851
- bottom: 0,
852
- left: 0,
853
- right: 0,
854
- height: "0.2vh",
855
- backgroundColor: theme2.colors[theme2.primaryColor][5],
856
- transformOrigin: "center"
857
- }
858
- }
859
- )
860
- ]
861
- }
862
- );
863
- }
864
- var NavigationContext = react.createContext(null);
865
- function useNavigation(selector) {
866
- const navigation = react.useContext(NavigationContext);
867
- if (!navigation) {
868
- throw new Error("useNavigation must be used within a NavigationProvider");
869
- }
870
- return zustand.useStore(navigation, selector);
871
- }
872
- function useNavigationStore() {
873
- const navigation = react.useContext(NavigationContext);
874
- if (!navigation) {
875
- throw new Error("useNavigationStore must be used within a NavigationProvider");
876
- }
877
- return navigation;
878
- }
879
- function NavigationProvider({ children, defaultPage }) {
880
- const storeRef = react.useRef(
881
- zustand.create(() => ({
882
- pageId: defaultPage || "home"
883
- }))
884
- );
885
- return /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value: storeRef.current, children });
886
- }
887
- function NavBar(props) {
888
- const pageId = useNavigation((state) => state.pageId);
889
- const store = useNavigationStore();
890
- return /* @__PURE__ */ jsxRuntime.jsx(
891
- SegmentedControl,
892
- {
893
- sounds: true,
894
- w: "100%",
895
- value: pageId,
896
- items: props.items,
897
- onChange: (value) => {
898
- store.setState({ pageId: value });
899
- }
900
- }
901
- );
902
- }
903
- var containerVariants = {
904
- hidden: { opacity: 0 },
905
- visible: {
906
- opacity: 1,
907
- transition: {
908
- staggerChildren: 0.1,
909
- delayChildren: 0.05
910
- }
911
- },
912
- exit: {
913
- opacity: 0,
914
- transition: {
915
- staggerChildren: 0.05,
916
- staggerDirection: -1
917
- }
918
- }
919
- };
920
- var itemVariants = {
921
- hidden: {
922
- opacity: 0,
923
- x: 20,
924
- scale: 0.95
925
- },
926
- visible: {
927
- opacity: 1,
928
- x: 0,
929
- scale: 1,
930
- transition: {
931
- type: "spring",
932
- stiffness: 300,
933
- damping: 24
934
- }
935
- },
936
- exit: {
937
- opacity: 0,
938
- x: -10,
939
- scale: 0.95,
940
- transition: {
941
- duration: 0.2
942
- }
943
- }
944
- };
945
- function SegmentedProgress(props) {
946
- const progressPerSegment = 100 / props.segments;
947
- const filledSegments = Math.floor(props.progress / progressPerSegment);
948
- const partialFill = props.progress % progressPerSegment / progressPerSegment;
949
- return /* @__PURE__ */ jsxRuntime.jsx(
950
- MotionFlex,
951
- {
952
- w: "100%",
953
- h: props.size || "1vh",
954
- gap: "xs",
955
- initial: "hidden",
956
- animate: "visible",
957
- variants: containerVariants,
958
- children: [...Array(props.segments)].map((_, index) => {
959
- const isFilled = index < filledSegments;
960
- const isPartial = index === filledSegments;
961
- return /* @__PURE__ */ jsxRuntime.jsx(
962
- framerMotion.motion.div,
963
- {
964
- variants: itemVariants,
965
- style: {
966
- width: `${100 / props.segments}%`,
967
- // Ensures equal width distribution
968
- height: "100%",
969
- background: isFilled ? "rgba(255, 255, 255, 0.8)" : isPartial ? `linear-gradient(to right, rgba(255, 255, 255, 0.8) ${partialFill * 100}%, rgba(255, 255, 255, 0.2) ${partialFill * 100}%)` : "rgba(255, 255, 255, 0.2)",
970
- transition: "background 0.3s ease"
971
- }
972
- },
973
- index
974
- );
975
- })
976
- }
977
- );
978
- }
979
- function Title(props) {
980
- const theme2 = core.useMantineTheme();
981
- return /* @__PURE__ */ jsxRuntime.jsx(
982
- core.Flex,
983
- {
984
- mt: props.mt,
985
- direction: "column",
986
- bg: props.bg || "transparent",
987
- gap: "xs",
988
- w: props.w || "100%",
989
- p: props.p || "0",
990
- style: {
991
- userSelect: "none",
992
- borderBottom: props.removeBorder ? "none" : `0.2vh solid ${props.borderColor || colorWithAlpha(theme2.colors[theme2.primaryColor][9], 0.5)}`
993
- },
994
- children: /* @__PURE__ */ jsxRuntime.jsxs(
995
- core.Flex,
996
- {
997
- align: "center",
998
- justify: "center",
999
- children: [
1000
- /* @__PURE__ */ jsxRuntime.jsxs(
1001
- core.Flex,
1002
- {
1003
- align: "center",
1004
- gap: "sm",
1005
- pr: "xs",
1006
- children: [
1007
- /* @__PURE__ */ jsxRuntime.jsx(
1008
- BorderedIcon,
1009
- {
1010
- icon: props.icon,
1011
- fontSize: theme2.fontSizes.md,
1012
- color: props.iconColor
1013
- }
1014
- ),
1015
- /* @__PURE__ */ jsxRuntime.jsxs(
1016
- core.Flex,
1017
- {
1018
- direction: "column",
1019
- gap: "0.25vh",
1020
- children: [
1021
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { p: "0", size: "sm", style: {
1022
- lineHeight: theme2.fontSizes.md,
1023
- fontFamily: "Akrobat Bold",
1024
- letterSpacing: "0.05em",
1025
- textTransform: "uppercase"
1026
- }, children: props.title }),
1027
- /* @__PURE__ */ jsxRuntime.jsx(
1028
- core.Text,
1029
- {
1030
- size: "xs",
1031
- c: "grey",
1032
- style: { whiteSpace: "normal", wordWrap: "break-word" },
1033
- children: props.description
1034
- }
1035
- )
1036
- ]
1037
- }
1038
- )
1039
- ]
1040
- }
1041
- ),
1042
- /* @__PURE__ */ jsxRuntime.jsx(
1043
- core.Flex,
1044
- {
1045
- ml: "auto",
1046
- align: "center",
1047
- gap: "xs",
1048
- children: props.rightSection
1049
- }
1050
- )
1051
- ]
1052
- }
1053
- )
1054
- }
1055
- );
1056
- }
1057
- var useNuiEvent = (action, handler) => {
1058
- const savedHandler = react.useRef(noop);
1059
- react.useEffect(() => {
1060
- savedHandler.current = handler;
1061
- }, [handler]);
1062
- react.useEffect(() => {
1063
- const eventListener = (event) => {
1064
- const { action: eventAction, data } = event.data;
1065
- if (savedHandler.current) {
1066
- if (eventAction === action) {
1067
- savedHandler.current(data);
1068
- }
1069
- }
1070
- };
1071
- window.addEventListener("message", eventListener);
1072
- return () => window.removeEventListener("message", eventListener);
1073
- }, [action]);
1074
- };
1075
- var theme = core.createTheme({
1076
- primaryColor: "dirk",
1077
- primaryShade: 9,
1078
- defaultRadius: "xxs",
1079
- fontFamily: "Akrobat Regular, sans-serif",
1080
- radius: {
1081
- xxs: "0.2vh",
1082
- xs: "0.4vh",
1083
- sm: "0.75vh",
1084
- md: "1vh",
1085
- lg: "1.5vh",
1086
- xl: "2vh",
1087
- xxl: "3vh"
1088
- },
1089
- fontSizes: {
1090
- xxs: "1.2vh",
1091
- xs: "1.5vh",
1092
- sm: "1.8vh",
1093
- md: "2.2vh",
1094
- lg: "2.8vh",
1095
- xl: "3.3vh",
1096
- xxl: "3.8vh"
1097
- },
1098
- spacing: {
1099
- xxs: "0.5vh",
1100
- xs: "0.75vh",
1101
- sm: "1.5vh",
1102
- md: "2vh",
1103
- lg: "3vh",
1104
- xl: "4vh",
1105
- xxl: "5vh"
1106
- },
1107
- components: {
1108
- Progress: {
1109
- styles: {
1110
- root: {
1111
- backgroundColor: "rgba(77, 77, 77, 0.4)"
1112
- }
1113
- }
1114
- },
1115
- Select: {
1116
- styles: {
1117
- dropdown: {
1118
- borderRadius: "var(--mantine-radius-xxs)"
1119
- },
1120
- input: {
1121
- padding: "var(--mantine-spacing-sm)"
1122
- },
1123
- item: {
1124
- borderRadius: "var(--mantine-radius-xxs)"
1125
- },
1126
- wrapper: {
1127
- borderRadius: "var(--mantine-radius-xxs)"
1128
- },
1129
- option: {
1130
- borderRadius: "var(--mantine-radius-xxs)"
1131
- }
1132
- }
1133
- },
1134
- MultiSelect: {
1135
- styles: {
1136
- dropdown: {
1137
- borderRadius: "var(--mantine-radius-xxs)"
1138
- },
1139
- pill: {
1140
- borderRadius: "var(--mantine-radius-xxs)"
1141
- },
1142
- item: {
1143
- borderRadius: "var(--mantine-radius-xxs)"
1144
- },
1145
- wrapper: {
1146
- borderRadius: "var(--mantine-radius-xxs)"
1147
- },
1148
- option: {
1149
- borderRadius: "var(--mantine-radius-xxs)"
1150
- }
1151
- }
1152
- },
1153
- TextInput: {
1154
- styles: {
1155
- section: {
1156
- marginRight: "0.2vh"
1157
- },
1158
- input: {
1159
- padding: "var(--mantine-spacing-sm)"
1160
- }
1161
- }
1162
- }
1163
- },
1164
- colors: {
1165
- dark: [
1166
- "#ffffff",
1167
- "#e2e2e2",
1168
- "#c6c6c6",
1169
- "#aaaaaa",
1170
- "#8d8d8d",
1171
- "#717171",
1172
- "#555555",
1173
- "#393939",
1174
- "#1c1c1c",
1175
- "#000000"
1176
- ],
1177
- dirk: [
1178
- "#ffffff",
1179
- "#f3fce9",
1180
- "#dbf5bd",
1181
- "#c3ee91",
1182
- "#ace765",
1183
- "#94e039",
1184
- "#7ac61f",
1185
- "#5f9a18",
1186
- "#29420a",
1187
- "#446e11"
1188
- ]
1189
- }
1190
- });
1191
- var theme_default = theme;
1192
- fontawesomeSvgCore.library.add(freeSolidSvgIcons.fas, freeRegularSvgIcons.far, freeBrandsSvgIcons.fab);
1193
- var useSettings = zustand.create((set) => ({
1194
- game: "rdr3",
1195
- primaryColor: "teal",
1196
- primaryShade: 6,
1197
- customTheme: {}
1198
- }));
1199
- function DirkProvider(props) {
1200
- useSettings((data) => data.primaryColor);
1201
- useSettings((data) => data.primaryShade);
1202
- useSettings((data) => data.customTheme);
1203
- return /* @__PURE__ */ jsxRuntime.jsx(core.MantineProvider, { theme: theme_default, defaultColorScheme: "dark", children: /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: props.children }) });
1204
- }
1205
- function Wrapper({ children }) {
1206
- const game = useSettings((data) => data.game);
1207
- return isEnvBrowser() ? /* @__PURE__ */ jsxRuntime.jsx(
1208
- core.BackgroundImage,
1209
- {
1210
- w: "100vw",
1211
- h: "100vh",
1212
- style: { overflow: "hidden" },
1213
- src: game === "fivem" ? "https://i.ytimg.com/vi/TOxuNbXrO28/maxresdefault.jpg" : "https://raw.githubusercontent.com/Jump-On-Studios/RedM-jo_libs/refs/heads/main/source-repositories/Menu/public/assets/images/background_dev.jpg",
1214
- children
1215
- }
1216
- ) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
1217
- }
1218
-
1219
- exports.BorderedIcon = BorderedIcon;
1220
- exports.Counter = Counter;
1221
- exports.DirkProvider = DirkProvider;
1222
- exports.FloatingParticles = FloatingParticles;
1223
- exports.Icon = Icon;
1224
- exports.InfoBox = InfoBox;
1225
- exports.InputContainer = InputContainer;
1226
- exports.MotionFlex = MotionFlex;
1227
- exports.MotionIcon = MotionIcon;
1228
- exports.MotionImage = MotionImage;
1229
- exports.MotionText = MotionText;
1230
- exports.NavBar = NavBar;
1231
- exports.NavigationContext = NavigationContext;
1232
- exports.NavigationProvider = NavigationProvider;
1233
- exports.Segment = Segment;
1234
- exports.SegmentedControl = SegmentedControl;
1235
- exports.SegmentedProgress = SegmentedProgress;
1236
- exports.Title = Title;
1237
- exports.colorWithAlpha = colorWithAlpha;
1238
- exports.copyToClipboard = copyToClipboard;
1239
- exports.fetchLuaTable = fetchLuaTable;
1240
- exports.fetchNui = fetchNui;
1241
- exports.fetchOnLoad = fetchOnLoad;
1242
- exports.internalEvent = internalEvent;
1243
- exports.isEnvBrowser = isEnvBrowser;
1244
- exports.locale = locale;
1245
- exports.localeStore = localeStore;
1246
- exports.noop = noop;
1247
- exports.numberToRoman = numberToRoman;
1248
- exports.openLink = openLink;
1249
- exports.splitFAString = splitFAString;
1250
- exports.useNavigation = useNavigation;
1251
- exports.useNavigationStore = useNavigationStore;
1252
- exports.useNuiEvent = useNuiEvent;
1253
- exports.useSettings = useSettings;
1254
3
  //# sourceMappingURL=index.cjs.map
1255
4
  //# sourceMappingURL=index.cjs.map