dirk-cfx-react 1.1.73 → 1.1.75
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 +299 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +21 -1
- package/dist/components/index.d.ts +21 -1
- package/dist/components/index.js +301 -3
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +298 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +300 -3
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +6 -0
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +6 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ var clickSoundUrl = require('./click_sound-PNCRRTM4.mp3');
|
|
|
12
12
|
var hoverSoundUrl = require('./hover_sound-NBUA222C.mp3');
|
|
13
13
|
var notifications = require('@mantine/notifications');
|
|
14
14
|
var reactQuery = require('@tanstack/react-query');
|
|
15
|
+
var colorsGenerator = require('@mantine/colors-generator');
|
|
15
16
|
require('@mantine/core/styles.css');
|
|
16
17
|
require('@mantine/notifications/styles.css');
|
|
17
18
|
require('./styles/fonts.css');
|
|
@@ -4835,7 +4836,22 @@ function ConfigPanelInner({
|
|
|
4835
4836
|
if (result?.success) {
|
|
4836
4837
|
const { store } = getScriptConfigInstance();
|
|
4837
4838
|
form.reinitialize(cloneConfig(store.getState()));
|
|
4839
|
+
notifications.notifications.show({
|
|
4840
|
+
color: "green",
|
|
4841
|
+
title: locale("ConfigResetSuccessTitle"),
|
|
4842
|
+
message: locale("ConfigResetSuccessBody"),
|
|
4843
|
+
autoClose: 3e3
|
|
4844
|
+
});
|
|
4845
|
+
return;
|
|
4838
4846
|
}
|
|
4847
|
+
const err = result?._error || "Unknown";
|
|
4848
|
+
console.warn(`[ConfigPanel] config reset failed: ${err}`);
|
|
4849
|
+
notifications.notifications.show({
|
|
4850
|
+
color: "red",
|
|
4851
|
+
title: locale("ConfigResetFailedTitle"),
|
|
4852
|
+
message: locale("ConfigResetFailedBody", err),
|
|
4853
|
+
autoClose: 6e3
|
|
4854
|
+
});
|
|
4839
4855
|
},
|
|
4840
4856
|
onClose: () => setResetOpen(false),
|
|
4841
4857
|
zIndex: 300
|
|
@@ -6010,6 +6026,281 @@ function TestBed({
|
|
|
6010
6026
|
}
|
|
6011
6027
|
);
|
|
6012
6028
|
}
|
|
6029
|
+
var MANTINE_COLOR_OPTIONS = [
|
|
6030
|
+
"dirk",
|
|
6031
|
+
"red",
|
|
6032
|
+
"pink",
|
|
6033
|
+
"grape",
|
|
6034
|
+
"violet",
|
|
6035
|
+
"indigo",
|
|
6036
|
+
"blue",
|
|
6037
|
+
"cyan",
|
|
6038
|
+
"teal",
|
|
6039
|
+
"green",
|
|
6040
|
+
"lime",
|
|
6041
|
+
"yellow",
|
|
6042
|
+
"orange"
|
|
6043
|
+
].map((value) => ({ value, label: value }));
|
|
6044
|
+
var DEFAULT_PALETTE = [
|
|
6045
|
+
"#f0f4ff",
|
|
6046
|
+
"#d9e3ff",
|
|
6047
|
+
"#bfcfff",
|
|
6048
|
+
"#a6bbff",
|
|
6049
|
+
"#8ca7ff",
|
|
6050
|
+
"#7393ff",
|
|
6051
|
+
"#5a7fff",
|
|
6052
|
+
"#406bff",
|
|
6053
|
+
"#2547ff",
|
|
6054
|
+
"#0b33ff"
|
|
6055
|
+
];
|
|
6056
|
+
var DEFAULT_VALUE = {
|
|
6057
|
+
useOverride: false,
|
|
6058
|
+
primaryColor: "dirk",
|
|
6059
|
+
primaryShade: 5,
|
|
6060
|
+
customTheme: DEFAULT_PALETTE
|
|
6061
|
+
};
|
|
6062
|
+
function GroupLabel({ label: label2 }) {
|
|
6063
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", gap: "xs", mt: "xxs", children: [
|
|
6064
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.07em", c: "rgba(255,255,255,0.2)", children: label2 }),
|
|
6065
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, height: "0.05vh", background: "rgba(255,255,255,0.06)" } })
|
|
6066
|
+
] });
|
|
6067
|
+
}
|
|
6068
|
+
function ThemeOverrideSection({
|
|
6069
|
+
schemaKey = "theme",
|
|
6070
|
+
title
|
|
6071
|
+
}) {
|
|
6072
|
+
const mantineTheme = core.useMantineTheme();
|
|
6073
|
+
const color = mantineTheme.colors[mantineTheme.primaryColor][5];
|
|
6074
|
+
const raw = useFormField(schemaKey);
|
|
6075
|
+
const value = {
|
|
6076
|
+
useOverride: raw?.useOverride ?? DEFAULT_VALUE.useOverride,
|
|
6077
|
+
primaryColor: raw?.primaryColor ?? DEFAULT_VALUE.primaryColor,
|
|
6078
|
+
primaryShade: raw?.primaryShade ?? DEFAULT_VALUE.primaryShade,
|
|
6079
|
+
customTheme: Array.isArray(raw?.customTheme) && raw.customTheme.length === 10 ? raw.customTheme : DEFAULT_VALUE.customTheme
|
|
6080
|
+
};
|
|
6081
|
+
const { setValue } = useFormActions();
|
|
6082
|
+
const set = (key, val) => setValue(schemaKey, { ...value, [key]: val });
|
|
6083
|
+
const useCustom = value.primaryColor === "custom";
|
|
6084
|
+
const editable = value.useOverride;
|
|
6085
|
+
const setSwatch = (index, hex) => {
|
|
6086
|
+
const next = [...value.customTheme];
|
|
6087
|
+
next[index] = hex;
|
|
6088
|
+
set("customTheme", next);
|
|
6089
|
+
};
|
|
6090
|
+
const generateFromBase = (hex) => {
|
|
6091
|
+
try {
|
|
6092
|
+
const generated = colorsGenerator.generateColors(hex);
|
|
6093
|
+
set("customTheme", generated);
|
|
6094
|
+
} catch {
|
|
6095
|
+
}
|
|
6096
|
+
};
|
|
6097
|
+
const resetPalette = () => set("customTheme", DEFAULT_PALETTE);
|
|
6098
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6099
|
+
core.Flex,
|
|
6100
|
+
{
|
|
6101
|
+
direction: "column",
|
|
6102
|
+
gap: "xs",
|
|
6103
|
+
p: "sm",
|
|
6104
|
+
style: { flex: 1, minHeight: 0, overflowY: "auto" },
|
|
6105
|
+
children: [
|
|
6106
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6107
|
+
AdminPageTitle,
|
|
6108
|
+
{
|
|
6109
|
+
icon: lucideReact.Palette,
|
|
6110
|
+
title: title || locale("Theme") || "Theme",
|
|
6111
|
+
color
|
|
6112
|
+
}
|
|
6113
|
+
),
|
|
6114
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6115
|
+
core.Flex,
|
|
6116
|
+
{
|
|
6117
|
+
align: "center",
|
|
6118
|
+
justify: "space-between",
|
|
6119
|
+
p: "xs",
|
|
6120
|
+
style: {
|
|
6121
|
+
background: `rgba(255,255,255,${editable ? 0.04 : 0.02})`,
|
|
6122
|
+
border: `0.1vh solid ${editable ? color : "rgba(255,255,255,0.08)"}`,
|
|
6123
|
+
borderRadius: mantineTheme.radius.xs,
|
|
6124
|
+
transition: "background 0.15s, border-color 0.15s"
|
|
6125
|
+
},
|
|
6126
|
+
children: [
|
|
6127
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
|
|
6128
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.9)", children: locale("OverrideGlobalTheme") || "Override global theme" }),
|
|
6129
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", c: "rgba(255,255,255,0.4)", children: locale("OverrideGlobalThemeDesc") || "When on, this resource uses its own primary colour and palette instead of dirk_lib's. Turn off to fall back to the global theme \u2014 your custom palette is kept." })
|
|
6130
|
+
] }),
|
|
6131
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6132
|
+
core.Switch,
|
|
6133
|
+
{
|
|
6134
|
+
size: "md",
|
|
6135
|
+
checked: value.useOverride,
|
|
6136
|
+
onChange: (e) => set("useOverride", e.currentTarget.checked)
|
|
6137
|
+
}
|
|
6138
|
+
)
|
|
6139
|
+
]
|
|
6140
|
+
}
|
|
6141
|
+
),
|
|
6142
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6143
|
+
"div",
|
|
6144
|
+
{
|
|
6145
|
+
style: {
|
|
6146
|
+
opacity: editable ? 1 : 0.4,
|
|
6147
|
+
pointerEvents: editable ? "auto" : "none",
|
|
6148
|
+
transition: "opacity 0.15s"
|
|
6149
|
+
},
|
|
6150
|
+
children: [
|
|
6151
|
+
/* @__PURE__ */ jsxRuntime.jsx(GroupLabel, { label: locale("PrimaryColor") || "Primary Colour" }),
|
|
6152
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6153
|
+
core.Switch,
|
|
6154
|
+
{
|
|
6155
|
+
label: locale("UseCustomPalette") || "Use custom palette",
|
|
6156
|
+
size: "md",
|
|
6157
|
+
checked: useCustom,
|
|
6158
|
+
onChange: (e) => set("primaryColor", e.currentTarget.checked ? "custom" : "dirk"),
|
|
6159
|
+
styles: {
|
|
6160
|
+
label: {
|
|
6161
|
+
fontFamily: "Akrobat Bold",
|
|
6162
|
+
fontSize: "0.65em",
|
|
6163
|
+
letterSpacing: "0.06em",
|
|
6164
|
+
textTransform: "uppercase",
|
|
6165
|
+
color: "rgba(255,255,255,0.35)"
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
),
|
|
6170
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { gap: "xs", mt: "xs", children: [
|
|
6171
|
+
!useCustom && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6172
|
+
core.Select,
|
|
6173
|
+
{
|
|
6174
|
+
label: locale("MantinePalette") || "Mantine palette",
|
|
6175
|
+
size: "xs",
|
|
6176
|
+
style: { flex: 1 },
|
|
6177
|
+
value: value.primaryColor,
|
|
6178
|
+
data: MANTINE_COLOR_OPTIONS,
|
|
6179
|
+
allowDeselect: false,
|
|
6180
|
+
onChange: (v) => v && set("primaryColor", v)
|
|
6181
|
+
}
|
|
6182
|
+
),
|
|
6183
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6184
|
+
core.NumberInput,
|
|
6185
|
+
{
|
|
6186
|
+
label: locale("Shade") || "Shade",
|
|
6187
|
+
size: "xs",
|
|
6188
|
+
style: { flex: 1 },
|
|
6189
|
+
min: 0,
|
|
6190
|
+
max: 9,
|
|
6191
|
+
value: value.primaryShade,
|
|
6192
|
+
onChange: (v) => set("primaryShade", Number(v))
|
|
6193
|
+
}
|
|
6194
|
+
)
|
|
6195
|
+
] }),
|
|
6196
|
+
useCustom && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6197
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", justify: "space-between", mt: "sm", children: [
|
|
6198
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6199
|
+
core.Text,
|
|
6200
|
+
{
|
|
6201
|
+
ff: "Akrobat Bold",
|
|
6202
|
+
size: "xxs",
|
|
6203
|
+
tt: "uppercase",
|
|
6204
|
+
lts: "0.07em",
|
|
6205
|
+
c: "rgba(255,255,255,0.2)",
|
|
6206
|
+
children: locale("CustomPalette") || "Custom palette"
|
|
6207
|
+
}
|
|
6208
|
+
),
|
|
6209
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6210
|
+
core.ActionIcon,
|
|
6211
|
+
{
|
|
6212
|
+
size: "sm",
|
|
6213
|
+
variant: "subtle",
|
|
6214
|
+
onClick: resetPalette,
|
|
6215
|
+
title: locale("ResetPalette") || "Reset palette",
|
|
6216
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { size: "1.4vh" })
|
|
6217
|
+
}
|
|
6218
|
+
)
|
|
6219
|
+
] }),
|
|
6220
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6221
|
+
core.ColorInput,
|
|
6222
|
+
{
|
|
6223
|
+
label: locale("BaseColor") || "Base colour",
|
|
6224
|
+
size: "xs",
|
|
6225
|
+
value: value.customTheme[value.primaryShade] ?? value.customTheme[5] ?? "#000000",
|
|
6226
|
+
onChange: generateFromBase,
|
|
6227
|
+
eyeDropperIcon: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
|
6228
|
+
}
|
|
6229
|
+
),
|
|
6230
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Flex, { gap: "xxs", mt: "xxs", children: value.customTheme.map((swatch, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6231
|
+
SwatchTile,
|
|
6232
|
+
{
|
|
6233
|
+
index: i,
|
|
6234
|
+
value: swatch,
|
|
6235
|
+
isPrimary: i === value.primaryShade,
|
|
6236
|
+
onChange: (v) => setSwatch(i, v)
|
|
6237
|
+
},
|
|
6238
|
+
i
|
|
6239
|
+
)) })
|
|
6240
|
+
] })
|
|
6241
|
+
]
|
|
6242
|
+
}
|
|
6243
|
+
)
|
|
6244
|
+
]
|
|
6245
|
+
}
|
|
6246
|
+
);
|
|
6247
|
+
}
|
|
6248
|
+
function SwatchTile({
|
|
6249
|
+
index,
|
|
6250
|
+
value,
|
|
6251
|
+
isPrimary,
|
|
6252
|
+
onChange
|
|
6253
|
+
}) {
|
|
6254
|
+
const [opened, setOpened] = React6.useState(false);
|
|
6255
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Popover, { opened, onChange: setOpened, position: "bottom", withArrow: true, zIndex: 1e4, children: [
|
|
6256
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Popover.Target, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6257
|
+
"button",
|
|
6258
|
+
{
|
|
6259
|
+
onClick: () => setOpened((o) => !o),
|
|
6260
|
+
title: `${index} \xB7 ${value}`,
|
|
6261
|
+
style: {
|
|
6262
|
+
flex: 1,
|
|
6263
|
+
aspectRatio: "1 / 1",
|
|
6264
|
+
background: value,
|
|
6265
|
+
border: isPrimary ? "0.2vh solid rgba(255,255,255,0.85)" : "0.1vh solid rgba(255,255,255,0.15)",
|
|
6266
|
+
borderRadius: "0.4vh",
|
|
6267
|
+
cursor: "pointer",
|
|
6268
|
+
padding: 0,
|
|
6269
|
+
display: "flex",
|
|
6270
|
+
alignItems: "flex-end",
|
|
6271
|
+
justifyContent: "flex-end",
|
|
6272
|
+
position: "relative"
|
|
6273
|
+
},
|
|
6274
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6275
|
+
"span",
|
|
6276
|
+
{
|
|
6277
|
+
style: {
|
|
6278
|
+
fontFamily: "Akrobat Bold",
|
|
6279
|
+
fontSize: "0.9vh",
|
|
6280
|
+
lineHeight: 1,
|
|
6281
|
+
padding: "0.2vh 0.3vh",
|
|
6282
|
+
color: "rgba(0,0,0,0.55)",
|
|
6283
|
+
background: "rgba(255,255,255,0.55)",
|
|
6284
|
+
borderRadius: "0.25vh",
|
|
6285
|
+
margin: "0.2vh"
|
|
6286
|
+
},
|
|
6287
|
+
children: index
|
|
6288
|
+
}
|
|
6289
|
+
)
|
|
6290
|
+
}
|
|
6291
|
+
) }),
|
|
6292
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Popover.Dropdown, { p: "xs", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6293
|
+
core.ColorInput,
|
|
6294
|
+
{
|
|
6295
|
+
size: "xs",
|
|
6296
|
+
value,
|
|
6297
|
+
onChange,
|
|
6298
|
+
format: "hex",
|
|
6299
|
+
eyeDropperIcon: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
|
6300
|
+
}
|
|
6301
|
+
) })
|
|
6302
|
+
] });
|
|
6303
|
+
}
|
|
6013
6304
|
function useTornEdges() {
|
|
6014
6305
|
const game = useSettings((state) => state.game);
|
|
6015
6306
|
return game === "rdr3" ? "torn-edge-wrapper" : "";
|
|
@@ -6291,6 +6582,12 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
6291
6582
|
}, []);
|
|
6292
6583
|
useNuiEvent("UPDATE_DIRK_LIB_SETTINGS", (data) => {
|
|
6293
6584
|
if (!data || typeof data !== "object") return;
|
|
6585
|
+
const current = useSettings.getState();
|
|
6586
|
+
if (current.themeOverride) {
|
|
6587
|
+
const { primaryColor: _pc, primaryShade: _ps, customTheme: _ct, ...rest } = data;
|
|
6588
|
+
useSettings.setState(rest);
|
|
6589
|
+
return;
|
|
6590
|
+
}
|
|
6294
6591
|
useSettings.setState(data);
|
|
6295
6592
|
});
|
|
6296
6593
|
const mergedTheme = React6.useMemo(
|
|
@@ -6374,6 +6671,7 @@ exports.SegmentedControl = SegmentedControl;
|
|
|
6374
6671
|
exports.SegmentedProgress = SegmentedProgress;
|
|
6375
6672
|
exports.SelectItem = SelectItem;
|
|
6376
6673
|
exports.TestBed = TestBed;
|
|
6674
|
+
exports.ThemeOverrideSection = ThemeOverrideSection;
|
|
6377
6675
|
exports.Title = Title;
|
|
6378
6676
|
exports.TornEdgeSVGFilter = TornEdgeSVGFilter;
|
|
6379
6677
|
exports.Vector2Schema = Vector2Schema;
|