dirk-cfx-react 1.1.72 → 1.1.73
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/index.cjs +70 -60
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +12 -2
- package/dist/components/index.d.ts +12 -2
- package/dist/components/index.js +70 -60
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +5 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +89 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +87 -61
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +5 -1
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +5 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/utils/index.cjs +5 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +5 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var fontawesomeSvgCore = require('@fortawesome/fontawesome-svg-core');
|
|
|
22
22
|
var freeBrandsSvgIcons = require('@fortawesome/free-brands-svg-icons');
|
|
23
23
|
var freeRegularSvgIcons = require('@fortawesome/free-regular-svg-icons');
|
|
24
24
|
var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
25
|
+
var zod = require('zod');
|
|
25
26
|
|
|
26
27
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
28
|
|
|
@@ -1340,7 +1341,11 @@ async function fetchNui(eventName, data, mockData) {
|
|
|
1340
1341
|
return {};
|
|
1341
1342
|
}
|
|
1342
1343
|
const overrideResourceName = useSettings.getState().overideResourceName;
|
|
1343
|
-
const
|
|
1344
|
+
const hasResourceContext = typeof window.GetParentResourceName === "function" || !!overrideResourceName;
|
|
1345
|
+
if (!hasResourceContext) {
|
|
1346
|
+
return mockData ?? {};
|
|
1347
|
+
}
|
|
1348
|
+
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : overrideResourceName;
|
|
1344
1349
|
try {
|
|
1345
1350
|
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
1346
1351
|
return await resp.json();
|
|
@@ -3083,9 +3088,25 @@ function SegmentedProgress(props) {
|
|
|
3083
3088
|
}
|
|
3084
3089
|
);
|
|
3085
3090
|
}
|
|
3091
|
+
function getSizePreset(size, themeMdFontSize) {
|
|
3092
|
+
switch (size) {
|
|
3093
|
+
case "xs":
|
|
3094
|
+
return { iconFontSize: "1.2vh", iconPadding: "xxs", titleSize: "xxs", titleLineHeight: "1.2vh", descriptionSize: "xxs", innerGap: "xs", bottomPad: "xs" };
|
|
3095
|
+
case "sm":
|
|
3096
|
+
return { iconFontSize: "1.6vh", iconPadding: "xxs", titleSize: "xs", titleLineHeight: "1.6vh", descriptionSize: "xxs", innerGap: "xs", bottomPad: "xs" };
|
|
3097
|
+
case "lg":
|
|
3098
|
+
return { iconFontSize: "2.6vh", iconPadding: "sm", titleSize: "md", titleLineHeight: "2.6vh", descriptionSize: "sm", innerGap: "sm", bottomPad: "sm" };
|
|
3099
|
+
case "xl":
|
|
3100
|
+
return { iconFontSize: "3.2vh", iconPadding: "sm", titleSize: "lg", titleLineHeight: "3.2vh", descriptionSize: "md", innerGap: "md", bottomPad: "md" };
|
|
3101
|
+
case "md":
|
|
3102
|
+
default:
|
|
3103
|
+
return { iconFontSize: themeMdFontSize, iconPadding: "xs", titleSize: "sm", titleLineHeight: themeMdFontSize, descriptionSize: "xs", innerGap: "sm", bottomPad: "sm" };
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3086
3106
|
function Title(props) {
|
|
3087
3107
|
const game = useSettings((state) => state.game);
|
|
3088
3108
|
const theme2 = core.useMantineTheme();
|
|
3109
|
+
const preset = getSizePreset(props.size ?? "md", theme2.fontSizes.md);
|
|
3089
3110
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3090
3111
|
core.Flex,
|
|
3091
3112
|
{
|
|
@@ -3094,71 +3115,50 @@ function Title(props) {
|
|
|
3094
3115
|
gap: "xs",
|
|
3095
3116
|
w: props.w || "100%",
|
|
3096
3117
|
p: props.p || "unset",
|
|
3097
|
-
pb: !props.p ?
|
|
3118
|
+
pb: !props.p ? preset.bottomPad : props.p,
|
|
3098
3119
|
style: {
|
|
3099
3120
|
userSelect: "none",
|
|
3100
3121
|
borderBottom: props.removeBorder ? "none" : `0.3vh solid ${props.borderColor || colorWithAlpha(theme2.colors[theme2.primaryColor][9], 0.5)}`
|
|
3101
3122
|
},
|
|
3102
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3103
|
-
core.Flex,
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3123
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", justify: "center", children: [
|
|
3124
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", gap: preset.innerGap, pr: "xs", children: [
|
|
3125
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3126
|
+
BorderedIcon,
|
|
3127
|
+
{
|
|
3128
|
+
icon: props.icon,
|
|
3129
|
+
fontSize: preset.iconFontSize,
|
|
3130
|
+
color: props.iconColor,
|
|
3131
|
+
p: preset.iconPadding
|
|
3132
|
+
}
|
|
3133
|
+
),
|
|
3134
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "0.25vh", children: [
|
|
3135
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3136
|
+
core.Text,
|
|
3110
3137
|
{
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
color: props.iconColor
|
|
3121
|
-
}
|
|
3122
|
-
),
|
|
3123
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3124
|
-
core.Flex,
|
|
3125
|
-
{
|
|
3126
|
-
direction: "column",
|
|
3127
|
-
gap: "0.25vh",
|
|
3128
|
-
children: [
|
|
3129
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { p: "0", size: "sm", style: {
|
|
3130
|
-
lineHeight: theme2.fontSizes.md,
|
|
3131
|
-
fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
|
|
3132
|
-
letterSpacing: "0.05em",
|
|
3133
|
-
textTransform: "uppercase"
|
|
3134
|
-
}, children: props.title }),
|
|
3135
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3136
|
-
core.Text,
|
|
3137
|
-
{
|
|
3138
|
-
size: "xs",
|
|
3139
|
-
c: "grey",
|
|
3140
|
-
style: { whiteSpace: "normal", wordWrap: "break-word" },
|
|
3141
|
-
children: props.description
|
|
3142
|
-
}
|
|
3143
|
-
)
|
|
3144
|
-
]
|
|
3145
|
-
}
|
|
3146
|
-
)
|
|
3147
|
-
]
|
|
3138
|
+
p: "0",
|
|
3139
|
+
size: preset.titleSize,
|
|
3140
|
+
style: {
|
|
3141
|
+
lineHeight: preset.titleLineHeight,
|
|
3142
|
+
fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
|
|
3143
|
+
letterSpacing: "0.05em",
|
|
3144
|
+
textTransform: "uppercase"
|
|
3145
|
+
},
|
|
3146
|
+
children: props.title
|
|
3148
3147
|
}
|
|
3149
3148
|
),
|
|
3150
3149
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3151
|
-
core.
|
|
3150
|
+
core.Text,
|
|
3152
3151
|
{
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
children: props.
|
|
3152
|
+
size: preset.descriptionSize,
|
|
3153
|
+
c: "grey",
|
|
3154
|
+
style: { whiteSpace: "normal", wordWrap: "break-word" },
|
|
3155
|
+
children: props.description
|
|
3157
3156
|
}
|
|
3158
3157
|
)
|
|
3159
|
-
]
|
|
3160
|
-
}
|
|
3161
|
-
|
|
3158
|
+
] })
|
|
3159
|
+
] }),
|
|
3160
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Flex, { ml: "auto", align: "center", gap: "xs", children: props.rightSection })
|
|
3161
|
+
] })
|
|
3162
3162
|
}
|
|
3163
3163
|
);
|
|
3164
3164
|
}
|
|
@@ -4903,8 +4903,8 @@ function ConfigPanelInner({
|
|
|
4903
4903
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, { size: "1.4vh", color })
|
|
4904
4904
|
}
|
|
4905
4905
|
),
|
|
4906
|
-
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", style: { minWidth: 0, lineHeight: 1 }, children: [
|
|
4907
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "
|
|
4906
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", style: { minWidth: 0, flex: 1, lineHeight: 1, overflow: "hidden" }, children: [
|
|
4907
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "md", ff: "Akrobat Bold", tt: "uppercase", lts: "0.04em", truncate: true, children: title }),
|
|
4908
4908
|
subtitle && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.08em", c: color, truncate: true, children: subtitle })
|
|
4909
4909
|
] })
|
|
4910
4910
|
] }),
|
|
@@ -5845,6 +5845,17 @@ function AdminPageTitle(props) {
|
|
|
5845
5845
|
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", tt: "uppercase", lts: "0.1em", size: "sm", c: "rgba(255,255,255,0.6)", children: locale(props.title) })
|
|
5846
5846
|
] });
|
|
5847
5847
|
}
|
|
5848
|
+
var placementStyle = (placement) => {
|
|
5849
|
+
switch (placement) {
|
|
5850
|
+
case "top-center":
|
|
5851
|
+
return { top: "1vh", left: "50%", transform: "translateX(-50%)" };
|
|
5852
|
+
case "top-right":
|
|
5853
|
+
return { top: "1vh", right: "1vh" };
|
|
5854
|
+
case "top-left":
|
|
5855
|
+
default:
|
|
5856
|
+
return { top: "1vh", left: "1vh" };
|
|
5857
|
+
}
|
|
5858
|
+
};
|
|
5848
5859
|
var loadPersistedState = (storageKey) => {
|
|
5849
5860
|
try {
|
|
5850
5861
|
const raw = localStorage.getItem(storageKey);
|
|
@@ -5863,7 +5874,8 @@ function TestBed({
|
|
|
5863
5874
|
items,
|
|
5864
5875
|
storageKey = "testbed:open-state",
|
|
5865
5876
|
disablePersistence = false,
|
|
5866
|
-
title = "TestBed"
|
|
5877
|
+
title = "TestBed",
|
|
5878
|
+
placement = "top-left"
|
|
5867
5879
|
}) {
|
|
5868
5880
|
const [open, setOpen] = React6.useState(false);
|
|
5869
5881
|
const itemsRef = React6.useRef(items);
|
|
@@ -5893,8 +5905,7 @@ function TestBed({
|
|
|
5893
5905
|
{
|
|
5894
5906
|
style: {
|
|
5895
5907
|
position: "fixed",
|
|
5896
|
-
|
|
5897
|
-
left: "1vh",
|
|
5908
|
+
...placementStyle(placement),
|
|
5898
5909
|
zIndex: 2147483647,
|
|
5899
5910
|
pointerEvents: "auto",
|
|
5900
5911
|
fontSize: "1.4vh"
|
|
@@ -6304,6 +6315,21 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
6304
6315
|
) : children;
|
|
6305
6316
|
return /* @__PURE__ */ jsxRuntime.jsx(core.MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsxRuntime.jsx(DirkErrorBoundary, { children: content }) });
|
|
6306
6317
|
}
|
|
6318
|
+
var Vector2Schema = zod.z.object({
|
|
6319
|
+
x: zod.z.number(),
|
|
6320
|
+
y: zod.z.number()
|
|
6321
|
+
});
|
|
6322
|
+
var Vector3Schema = zod.z.object({
|
|
6323
|
+
x: zod.z.number(),
|
|
6324
|
+
y: zod.z.number(),
|
|
6325
|
+
z: zod.z.number()
|
|
6326
|
+
});
|
|
6327
|
+
var Vector4Schema = zod.z.object({
|
|
6328
|
+
x: zod.z.number(),
|
|
6329
|
+
y: zod.z.number(),
|
|
6330
|
+
z: zod.z.number(),
|
|
6331
|
+
w: zod.z.number()
|
|
6332
|
+
});
|
|
6307
6333
|
|
|
6308
6334
|
exports.AdminPageTitle = AdminPageTitle;
|
|
6309
6335
|
exports.AsyncSaveButton = AsyncSaveButton;
|
|
@@ -6350,8 +6376,11 @@ exports.SelectItem = SelectItem;
|
|
|
6350
6376
|
exports.TestBed = TestBed;
|
|
6351
6377
|
exports.Title = Title;
|
|
6352
6378
|
exports.TornEdgeSVGFilter = TornEdgeSVGFilter;
|
|
6379
|
+
exports.Vector2Schema = Vector2Schema;
|
|
6380
|
+
exports.Vector3Schema = Vector3Schema;
|
|
6353
6381
|
exports.Vector4DeleteButton = Vector4DeleteButton;
|
|
6354
6382
|
exports.Vector4Display = Vector4Display;
|
|
6383
|
+
exports.Vector4Schema = Vector4Schema;
|
|
6355
6384
|
exports.WorldPositionGotoButton = WorldPositionGotoButton;
|
|
6356
6385
|
exports.WorldPositionSetButton = WorldPositionSetButton;
|
|
6357
6386
|
exports.colorWithAlpha = colorWithAlpha;
|