@lumiastream/ui 0.2.4 → 0.2.5
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.d.ts +40 -7
- package/dist/index.js +694 -146
- package/package.json +59 -59
package/dist/index.d.ts
CHANGED
|
@@ -173,35 +173,56 @@ declare const LSTextField: React.ForwardRefExoticComponent<Omit<LSTextFieldProps
|
|
|
173
173
|
interface IVariables {
|
|
174
174
|
name: string;
|
|
175
175
|
system: boolean;
|
|
176
|
+
isFunction?: boolean;
|
|
176
177
|
locked?: boolean;
|
|
177
178
|
origin: string;
|
|
179
|
+
pluginId?: string;
|
|
178
180
|
allowedPlaces?: string[];
|
|
179
181
|
description: string;
|
|
180
182
|
counter?: boolean;
|
|
181
|
-
|
|
183
|
+
example?: string;
|
|
184
|
+
value: string | number | boolean | null | Record<string, unknown> | unknown[];
|
|
185
|
+
hidden?: boolean;
|
|
182
186
|
}
|
|
187
|
+
type LSVariableDefinition = {
|
|
188
|
+
name: string;
|
|
189
|
+
description?: string;
|
|
190
|
+
origin?: string;
|
|
191
|
+
example?: unknown;
|
|
192
|
+
};
|
|
183
193
|
type LSVariableInputTranslate = (key: string, fallback?: string, options?: Record<string, unknown>) => string;
|
|
184
194
|
type LSVariableInputContextValue = {
|
|
185
195
|
systemVariables?: Record<string, unknown>;
|
|
186
196
|
functionVariables?: string[];
|
|
187
197
|
translate?: LSVariableInputTranslate;
|
|
188
198
|
onVariableTranslationsNeeded?: () => void;
|
|
199
|
+
isOriginConnected?: (origin: string) => boolean;
|
|
200
|
+
translationKeyExists?: (key: string, namespace?: string) => boolean;
|
|
189
201
|
};
|
|
190
202
|
declare const LSVariableInputProvider: ({ children, value }: {
|
|
191
203
|
children: ReactNode;
|
|
192
204
|
value: LSVariableInputContextValue;
|
|
193
205
|
}) => react_jsx_runtime.JSX.Element;
|
|
206
|
+
type LSAutoCompleteOption = {
|
|
207
|
+
label?: string | number | boolean;
|
|
208
|
+
value?: unknown;
|
|
209
|
+
helperText?: string;
|
|
210
|
+
imageUrl?: string;
|
|
211
|
+
searchText?: string;
|
|
212
|
+
thumb?: string;
|
|
213
|
+
iconUrl?: string;
|
|
214
|
+
previewImageUrl?: string;
|
|
215
|
+
[key: string]: unknown;
|
|
216
|
+
};
|
|
194
217
|
type LSVariableInputFieldProps = {
|
|
195
218
|
name?: string;
|
|
196
219
|
label?: ReactNode;
|
|
197
220
|
type?: string;
|
|
198
221
|
isAutoComplete?: boolean;
|
|
199
|
-
autoCompleteOptions?:
|
|
200
|
-
|
|
201
|
-
value: any;
|
|
202
|
-
}>;
|
|
222
|
+
autoCompleteOptions?: LSAutoCompleteOption[];
|
|
223
|
+
autoCompleteGroupBy?: (option: any) => string;
|
|
203
224
|
hideVariables?: boolean;
|
|
204
|
-
allowedVariables?: IVariables[] | string[] |
|
|
225
|
+
allowedVariables?: IVariables[] | string[] | LSVariableDefinition[] | unknown[];
|
|
205
226
|
disabled?: boolean;
|
|
206
227
|
autoFocus?: boolean;
|
|
207
228
|
inputProps?: any;
|
|
@@ -219,11 +240,23 @@ type LSVariableInputFieldProps = {
|
|
|
219
240
|
onPopupOpen?: (e: any) => void;
|
|
220
241
|
onAutocompleteKeyUp?: (e: any, value: any) => void;
|
|
221
242
|
afterFilter?: (filtered: any[]) => void;
|
|
222
|
-
onChange?: (value:
|
|
243
|
+
onChange?: (value: any) => void;
|
|
244
|
+
loading?: boolean;
|
|
245
|
+
getOptionLabel?: (option: any) => string;
|
|
246
|
+
isOptionEqualToValue?: (option: any, value: any) => boolean;
|
|
247
|
+
$disableInputChange?: boolean;
|
|
248
|
+
$getFullValueObject?: boolean;
|
|
249
|
+
$multiple?: boolean;
|
|
250
|
+
$disableCloseOnSelect?: boolean;
|
|
251
|
+
$freeSolo?: boolean;
|
|
252
|
+
$renderOption?: any;
|
|
253
|
+
allowedVariableOrigin?: string;
|
|
223
254
|
systemVariables?: Record<string, unknown>;
|
|
224
255
|
functionVariables?: string[];
|
|
225
256
|
translate?: LSVariableInputTranslate;
|
|
226
257
|
onVariableTranslationsNeeded?: () => void;
|
|
258
|
+
isOriginConnected?: (origin: string) => boolean;
|
|
259
|
+
translationKeyExists?: (key: string, namespace?: string) => boolean;
|
|
227
260
|
};
|
|
228
261
|
declare const LSVariableInputField: React.ForwardRefExoticComponent<LSVariableInputFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
229
262
|
|
package/dist/index.js
CHANGED
|
@@ -947,10 +947,13 @@ LSTextField.displayName = "LSTextField";
|
|
|
947
947
|
// src/components/LSVariableInputField/LSVariableInputField.tsx
|
|
948
948
|
import Autocomplete2, { createFilterOptions } from "@mui/material/Autocomplete";
|
|
949
949
|
import InputAdornment2 from "@mui/material/InputAdornment";
|
|
950
|
-
import Search from "@mui/icons-material/Search";
|
|
951
950
|
import Popover from "@mui/material/Popover";
|
|
952
|
-
import
|
|
953
|
-
import
|
|
951
|
+
import Search from "@mui/icons-material/Search";
|
|
952
|
+
import ArrowRight from "@mui/icons-material/ArrowRight";
|
|
953
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
954
|
+
import { Fragment, createContext, forwardRef as forwardRef4, useCallback as useCallback2, useContext, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef3, useState as useState4 } from "react";
|
|
955
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
956
|
+
import { createElement } from "react";
|
|
954
957
|
var LSVariableInputContext = createContext({});
|
|
955
958
|
var LSVariableInputProvider = ({ children, value }) => {
|
|
956
959
|
return /* @__PURE__ */ jsx11(LSVariableInputContext.Provider, { value, children });
|
|
@@ -971,8 +974,8 @@ var DEFAULT_FUNCTION_VARIABLES = [
|
|
|
971
974
|
"screenshot",
|
|
972
975
|
"overlay_screenshot",
|
|
973
976
|
"obs_screenshot",
|
|
974
|
-
"obs_replay",
|
|
975
977
|
"obs_vertical_replay",
|
|
978
|
+
"obs_replay",
|
|
976
979
|
"get_queue_count",
|
|
977
980
|
"lumia_uptime",
|
|
978
981
|
"twitch_uptime",
|
|
@@ -987,15 +990,100 @@ var DEFAULT_FUNCTION_VARIABLES = [
|
|
|
987
990
|
"ai_prompt",
|
|
988
991
|
"viewer_profile_summary"
|
|
989
992
|
];
|
|
990
|
-
var
|
|
991
|
-
var
|
|
993
|
+
var MAX_OBJECT_DEPTH = 5;
|
|
994
|
+
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
995
|
+
var isExpandableValue = (value) => {
|
|
996
|
+
if (isPlainObject(value)) return Object.keys(value).length > 0;
|
|
997
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
998
|
+
return false;
|
|
999
|
+
};
|
|
1000
|
+
var isPrimitiveValue = (value) => value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
1001
|
+
var renderPrimitiveValue = (value) => {
|
|
1002
|
+
if (value === null || value === void 0) return "";
|
|
1003
|
+
if (typeof value === "boolean") return value.toString();
|
|
1004
|
+
if (typeof value === "number") return value.toString();
|
|
1005
|
+
if (typeof value === "string") return value;
|
|
1006
|
+
return String(value);
|
|
1007
|
+
};
|
|
1008
|
+
var renderComplexPreview = (value) => {
|
|
1009
|
+
if (Array.isArray(value)) {
|
|
1010
|
+
return `Array(${value.length}) [${value.slice(0, 3).map((item) => typeof item === "string" ? `"${item}"` : typeof item === "object" ? "{...}" : String(item)).join(", ")}${value.length > 3 ? "..." : ""}]`;
|
|
1011
|
+
}
|
|
1012
|
+
const keys = Object.keys(value);
|
|
1013
|
+
return `Object {${keys.slice(0, 2).join(", ")}${keys.length > 2 ? "..." : ""}}`;
|
|
1014
|
+
};
|
|
1015
|
+
var getVariableValueDisplay = (value) => {
|
|
1016
|
+
const isComplexValue = !isPrimitiveValue(value) && value !== null && typeof value === "object";
|
|
1017
|
+
const displayValue = isComplexValue ? renderComplexPreview(value) : renderPrimitiveValue(value);
|
|
1018
|
+
const fullValue = isComplexValue ? JSON.stringify(value, null, 2) : renderPrimitiveValue(value);
|
|
1019
|
+
return { displayValue, fullValue, isComplexValue };
|
|
1020
|
+
};
|
|
1021
|
+
var buildValueChildren = (value, parentPath, depth) => {
|
|
1022
|
+
if (depth >= MAX_OBJECT_DEPTH) return [];
|
|
1023
|
+
if (isPlainObject(value)) {
|
|
1024
|
+
return Object.keys(value).map((key) => {
|
|
1025
|
+
const childValue = value[key];
|
|
1026
|
+
const relativePath = parentPath ? `${parentPath}.${key}` : key;
|
|
1027
|
+
const expandable = depth + 1 < MAX_OBJECT_DEPTH && isExpandableValue(childValue);
|
|
1028
|
+
return {
|
|
1029
|
+
relativePath,
|
|
1030
|
+
key,
|
|
1031
|
+
displayKey: key,
|
|
1032
|
+
depth: depth + 1,
|
|
1033
|
+
value: childValue,
|
|
1034
|
+
isExpandable: expandable,
|
|
1035
|
+
children: expandable ? buildValueChildren(childValue, relativePath, depth + 1) : []
|
|
1036
|
+
};
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
if (Array.isArray(value)) {
|
|
1040
|
+
return value.map((item, idx) => {
|
|
1041
|
+
const relativePath = parentPath ? `${parentPath}.${idx}` : String(idx);
|
|
1042
|
+
const expandable = depth + 1 < MAX_OBJECT_DEPTH && isExpandableValue(item);
|
|
1043
|
+
return {
|
|
1044
|
+
relativePath,
|
|
1045
|
+
key: String(idx),
|
|
1046
|
+
displayKey: `[${idx}]`,
|
|
1047
|
+
depth: depth + 1,
|
|
1048
|
+
value: item,
|
|
1049
|
+
isExpandable: expandable,
|
|
1050
|
+
children: expandable ? buildValueChildren(item, relativePath, depth + 1) : []
|
|
1051
|
+
};
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
return [];
|
|
1055
|
+
};
|
|
1056
|
+
var isVariableRecord = (value) => {
|
|
1057
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
1058
|
+
const v = value;
|
|
1059
|
+
return typeof v.name === "string" && ("system" in v || "origin" in v || "value" in v);
|
|
1060
|
+
};
|
|
1061
|
+
var synthesizeRecord = (name, value) => ({
|
|
1062
|
+
name,
|
|
1063
|
+
system: false,
|
|
1064
|
+
origin: "",
|
|
1065
|
+
description: "",
|
|
1066
|
+
value: value ?? ""
|
|
1067
|
+
});
|
|
1068
|
+
var normalizeVariableRecords = (systemVariables) => {
|
|
1069
|
+
const out = {};
|
|
1070
|
+
if (!systemVariables) return out;
|
|
1071
|
+
for (const [key, raw] of Object.entries(systemVariables)) {
|
|
1072
|
+
if (raw === void 0 || raw === null) continue;
|
|
1073
|
+
out[key] = isVariableRecord(raw) ? raw : synthesizeRecord(key, raw);
|
|
1074
|
+
}
|
|
1075
|
+
return out;
|
|
1076
|
+
};
|
|
992
1077
|
var defaultTranslate = (key, fallback, options) => {
|
|
993
1078
|
if (fallback && fallback !== "-") return fallback;
|
|
994
1079
|
if (key === "overlay-variables.variables-description") return "Use variables that will automatically be replaced before sending out the text";
|
|
995
|
-
if (key === "overlay-variables.variable") return "Variable";
|
|
996
|
-
if (key === "overlay-variables.description") return "Description";
|
|
997
|
-
if (key === "
|
|
1080
|
+
if (key === "overlay-variables.variable" || key === "commands.variable") return "Variable";
|
|
1081
|
+
if (key === "overlay-variables.description" || key === "commands.description") return "Description";
|
|
1082
|
+
if (key === "commands.suggested-variables") return "Suggested Variables";
|
|
1083
|
+
if (key === "common.value") return "Value";
|
|
1084
|
+
if (key === "common.search" || key === "assets.search") return "Search";
|
|
998
1085
|
if (key === "variables.functionvariables") return "Function variables";
|
|
1086
|
+
if (key === "chatbot.allowed-variables") return "Allowed Variables";
|
|
999
1087
|
if (key.startsWith("variables.")) {
|
|
1000
1088
|
const variableName = key.replace("variables.", "");
|
|
1001
1089
|
const example = options?.example;
|
|
@@ -1010,6 +1098,8 @@ var normalizeAllowedDefinitions = (allowedVariables) => {
|
|
|
1010
1098
|
allowedVariables.forEach((variable) => {
|
|
1011
1099
|
let variableName = "";
|
|
1012
1100
|
let description;
|
|
1101
|
+
let origin;
|
|
1102
|
+
let example;
|
|
1013
1103
|
if (typeof variable === "string") {
|
|
1014
1104
|
variableName = variable.trim();
|
|
1015
1105
|
} else if (variable && typeof variable === "object") {
|
|
@@ -1017,13 +1107,57 @@ var normalizeAllowedDefinitions = (allowedVariables) => {
|
|
|
1017
1107
|
const candidateName = [typedVariable.name, typedVariable.key, typedVariable.variable].find((value) => typeof value === "string");
|
|
1018
1108
|
variableName = typeof candidateName === "string" ? candidateName.trim() : "";
|
|
1019
1109
|
description = typeof typedVariable.description === "string" ? typedVariable.description.trim() : void 0;
|
|
1110
|
+
origin = typeof typedVariable.origin === "string" ? typedVariable.origin.trim().toLowerCase() : void 0;
|
|
1111
|
+
example = typedVariable.example;
|
|
1020
1112
|
}
|
|
1021
1113
|
if (!variableName || unique.has(variableName)) return;
|
|
1022
1114
|
unique.add(variableName);
|
|
1023
|
-
definitions.push({ name: variableName, description });
|
|
1115
|
+
definitions.push({ name: variableName, description, origin, example });
|
|
1024
1116
|
});
|
|
1025
1117
|
return definitions;
|
|
1026
1118
|
};
|
|
1119
|
+
var filter = createFilterOptions({
|
|
1120
|
+
stringify: (option) => {
|
|
1121
|
+
if (typeof option === "string") return option;
|
|
1122
|
+
if (typeof option === "number" || typeof option === "boolean" || typeof option === "bigint") return String(option);
|
|
1123
|
+
if (!option || typeof option !== "object") return "";
|
|
1124
|
+
const typed = option;
|
|
1125
|
+
return [typed.label, typed.value, typed.helperText, typed.searchText].filter((value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean").map((value) => String(value)).join(" ");
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
var visualTypeFromRecord = (variable) => {
|
|
1129
|
+
if (variable?.isFunction) return "func";
|
|
1130
|
+
if (variable?.system || variable?.locked) return "system";
|
|
1131
|
+
return "custom";
|
|
1132
|
+
};
|
|
1133
|
+
var visualTypeRank = (variableType) => {
|
|
1134
|
+
if (variableType === "custom") return 0;
|
|
1135
|
+
if (variableType === "func") return 1;
|
|
1136
|
+
return 2;
|
|
1137
|
+
};
|
|
1138
|
+
var orderItemsByVariableType = (items, getType) => {
|
|
1139
|
+
const grouped = { custom: [], func: [], system: [] };
|
|
1140
|
+
items.forEach((item) => grouped[getType(item)].push(item));
|
|
1141
|
+
return [...grouped.custom, ...grouped.func, ...grouped.system];
|
|
1142
|
+
};
|
|
1143
|
+
var sortItemsByVariableTypeThenName = (items, getType, getName) => {
|
|
1144
|
+
return [...items].sort((a, b) => {
|
|
1145
|
+
const typeDiff = visualTypeRank(getType(a)) - visualTypeRank(getType(b));
|
|
1146
|
+
if (typeDiff !== 0) return typeDiff;
|
|
1147
|
+
return getName(a).localeCompare(getName(b));
|
|
1148
|
+
});
|
|
1149
|
+
};
|
|
1150
|
+
var humanizeVariableName = (rawName) => {
|
|
1151
|
+
if (!rawName) return "";
|
|
1152
|
+
return rawName.replace(/^_+|_+$/g, "").replace(/_/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (char) => char.toUpperCase());
|
|
1153
|
+
};
|
|
1154
|
+
var getVariableColorClass = (variableType, isSuggested) => {
|
|
1155
|
+
if (isSuggested && variableType !== "func") return "ls-variable-token--custom";
|
|
1156
|
+
if (variableType === "func") return "ls-variable-token--function";
|
|
1157
|
+
if (variableType === "system") return "ls-variable-token--system";
|
|
1158
|
+
return "ls-variable-token--custom";
|
|
1159
|
+
};
|
|
1160
|
+
var CHILD_VARIABLE_COLOR_CLASS = "ls-variable-token--child";
|
|
1027
1161
|
var LSVariableInputField = forwardRef4((props, ref) => {
|
|
1028
1162
|
const context = useContext(LSVariableInputContext);
|
|
1029
1163
|
const {
|
|
@@ -1032,6 +1166,7 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1032
1166
|
type,
|
|
1033
1167
|
isAutoComplete,
|
|
1034
1168
|
autoCompleteOptions,
|
|
1169
|
+
autoCompleteGroupBy,
|
|
1035
1170
|
renderOption,
|
|
1036
1171
|
hideVariables,
|
|
1037
1172
|
allowedVariables,
|
|
@@ -1051,15 +1186,30 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1051
1186
|
onPopupOpen,
|
|
1052
1187
|
afterFilter,
|
|
1053
1188
|
onChange,
|
|
1189
|
+
loading,
|
|
1190
|
+
getOptionLabel,
|
|
1191
|
+
isOptionEqualToValue,
|
|
1192
|
+
$disableInputChange,
|
|
1193
|
+
$getFullValueObject,
|
|
1194
|
+
$multiple,
|
|
1195
|
+
$disableCloseOnSelect,
|
|
1196
|
+
$freeSolo,
|
|
1197
|
+
$renderOption,
|
|
1198
|
+
allowedVariableOrigin,
|
|
1054
1199
|
systemVariables: systemVariablesProp,
|
|
1055
1200
|
functionVariables: functionVariablesProp,
|
|
1056
1201
|
translate,
|
|
1057
|
-
onVariableTranslationsNeeded
|
|
1202
|
+
onVariableTranslationsNeeded,
|
|
1203
|
+
isOriginConnected: isOriginConnectedProp,
|
|
1204
|
+
translationKeyExists: translationKeyExistsProp
|
|
1058
1205
|
} = props;
|
|
1059
1206
|
const t = translate ?? context.translate ?? defaultTranslate;
|
|
1060
|
-
const
|
|
1207
|
+
const rawSystemVariables = systemVariablesProp ?? context.systemVariables ?? {};
|
|
1208
|
+
const variableRecords = useMemo3(() => normalizeVariableRecords(rawSystemVariables), [rawSystemVariables]);
|
|
1061
1209
|
const functionVariables = useMemo3(() => functionVariablesProp ?? context.functionVariables ?? DEFAULT_FUNCTION_VARIABLES, [context.functionVariables, functionVariablesProp]);
|
|
1062
1210
|
const requestTranslations = onVariableTranslationsNeeded ?? context.onVariableTranslationsNeeded;
|
|
1211
|
+
const isOriginConnected = isOriginConnectedProp ?? context.isOriginConnected;
|
|
1212
|
+
const translationKeyExists = translationKeyExistsProp ?? context.translationKeyExists;
|
|
1063
1213
|
const containerRef = useRef3(null);
|
|
1064
1214
|
const variableId = useRef3(`variable-input-${name ?? "field"}`);
|
|
1065
1215
|
const [showVariables, setShowVariables] = useState4(false);
|
|
@@ -1072,93 +1222,300 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1072
1222
|
return lookup;
|
|
1073
1223
|
}, [allowedVariableDefinitions]);
|
|
1074
1224
|
const allowedVariableNames = useMemo3(() => allowedVariableDefinitions.map((definition) => definition.name), [allowedVariableDefinitions]);
|
|
1075
|
-
const [filteredAllowedVariables, setFilteredAllowedVariables] = useState4(
|
|
1225
|
+
const [filteredAllowedVariables, setFilteredAllowedVariables] = useState4(allowedVariableDefinitions);
|
|
1076
1226
|
const [filteredSystemVariables, setFilteredSystemVariables] = useState4([]);
|
|
1227
|
+
const [expandedPaths, setExpandedPaths] = useState4(() => /* @__PURE__ */ new Set());
|
|
1228
|
+
const [autoExpandPaths, setAutoExpandPaths] = useState4(() => /* @__PURE__ */ new Set());
|
|
1229
|
+
const systemVariableValueTrees = useMemo3(() => {
|
|
1230
|
+
const map = /* @__PURE__ */ new Map();
|
|
1231
|
+
Object.values(variableRecords).forEach((variable) => {
|
|
1232
|
+
if (variable && isExpandableValue(variable.value)) {
|
|
1233
|
+
map.set(variable.name, buildValueChildren(variable.value, "", 0));
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
return map;
|
|
1237
|
+
}, [variableRecords]);
|
|
1238
|
+
const allowedExampleTrees = useMemo3(() => {
|
|
1239
|
+
const map = /* @__PURE__ */ new Map();
|
|
1240
|
+
allowedVariableDefinitions.forEach((definition) => {
|
|
1241
|
+
if (isExpandableValue(definition.example)) {
|
|
1242
|
+
map.set(definition.name, buildValueChildren(definition.example, "", 0));
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
return map;
|
|
1246
|
+
}, [allowedVariableDefinitions]);
|
|
1077
1247
|
useEffect4(() => {
|
|
1078
1248
|
requestTranslations?.();
|
|
1079
1249
|
}, [requestTranslations]);
|
|
1080
|
-
const
|
|
1250
|
+
const isPathExpanded = useCallback2((path) => expandedPaths.has(path) || autoExpandPaths.has(path), [autoExpandPaths, expandedPaths]);
|
|
1251
|
+
const toggleExpand = useCallback2(
|
|
1252
|
+
(path) => {
|
|
1253
|
+
const expanded = expandedPaths.has(path) || autoExpandPaths.has(path);
|
|
1254
|
+
if (expanded) {
|
|
1255
|
+
if (expandedPaths.has(path)) {
|
|
1256
|
+
setExpandedPaths((prev) => {
|
|
1257
|
+
const next = new Set(prev);
|
|
1258
|
+
next.delete(path);
|
|
1259
|
+
return next;
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
if (autoExpandPaths.has(path)) {
|
|
1263
|
+
setAutoExpandPaths((prev) => {
|
|
1264
|
+
const next = new Set(prev);
|
|
1265
|
+
next.delete(path);
|
|
1266
|
+
return next;
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
} else {
|
|
1270
|
+
setExpandedPaths((prev) => {
|
|
1271
|
+
const next = new Set(prev);
|
|
1272
|
+
next.add(path);
|
|
1273
|
+
return next;
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
},
|
|
1277
|
+
[autoExpandPaths, expandedPaths]
|
|
1278
|
+
);
|
|
1279
|
+
const namespaceHas = useCallback2(
|
|
1280
|
+
(key, namespace) => {
|
|
1281
|
+
if (!translationKeyExists) return false;
|
|
1282
|
+
try {
|
|
1283
|
+
return translationKeyExists(key, namespace);
|
|
1284
|
+
} catch {
|
|
1285
|
+
return false;
|
|
1286
|
+
}
|
|
1287
|
+
},
|
|
1288
|
+
[translationKeyExists]
|
|
1289
|
+
);
|
|
1290
|
+
const resolveTranslationFromNamespace = useCallback2(
|
|
1291
|
+
(variableName, namespace) => {
|
|
1292
|
+
const normalizedNamespace = typeof namespace === "string" ? namespace.trim().toLowerCase() : "";
|
|
1293
|
+
if (!normalizedNamespace) return null;
|
|
1294
|
+
const normalizedName = variableName.trim().toLowerCase();
|
|
1295
|
+
if (!normalizedName) return null;
|
|
1296
|
+
const unprefixedName = normalizedName.startsWith(`${normalizedNamespace}_`) ? normalizedName.slice(normalizedNamespace.length + 1) : normalizedName;
|
|
1297
|
+
const prefixedName = normalizedName.startsWith(`${normalizedNamespace}_`) ? normalizedName : `${normalizedNamespace}_${normalizedName}`;
|
|
1298
|
+
const candidateKeys = [prefixedName, unprefixedName];
|
|
1299
|
+
for (const key of candidateKeys) {
|
|
1300
|
+
if (namespaceHas(key, normalizedNamespace)) return t(key, void 0, { ns: normalizedNamespace });
|
|
1301
|
+
if (namespaceHas(`variables.${key}`, normalizedNamespace)) return t(`variables.${key}`, void 0, { ns: normalizedNamespace });
|
|
1302
|
+
}
|
|
1303
|
+
return null;
|
|
1304
|
+
},
|
|
1305
|
+
[namespaceHas, t]
|
|
1306
|
+
);
|
|
1307
|
+
const knownOrigins = useMemo3(() => {
|
|
1308
|
+
return Array.from(
|
|
1309
|
+
new Set(
|
|
1310
|
+
Object.values(variableRecords).map((variable) => typeof variable?.origin === "string" ? variable.origin.trim().toLowerCase() : "").filter((origin) => origin.length > 0)
|
|
1311
|
+
)
|
|
1312
|
+
);
|
|
1313
|
+
}, [variableRecords]);
|
|
1314
|
+
const resolveAllowedVariableOrigin = useCallback2(
|
|
1081
1315
|
(variableName) => {
|
|
1082
|
-
|
|
1083
|
-
|
|
1316
|
+
const originFromProp = typeof allowedVariableOrigin === "string" ? allowedVariableOrigin.trim().toLowerCase() : "";
|
|
1317
|
+
if (originFromProp) return originFromProp;
|
|
1318
|
+
const fromDefinition = allowedVariableDefinitionLookup.get(variableName)?.origin;
|
|
1319
|
+
if (fromDefinition) return fromDefinition;
|
|
1320
|
+
const normalizedName = variableName.trim().toLowerCase();
|
|
1321
|
+
if (!normalizedName) return void 0;
|
|
1322
|
+
const prefixCandidate = normalizedName.split("_")[0];
|
|
1323
|
+
if (prefixCandidate) {
|
|
1324
|
+
const hasScopedTranslation = namespaceHas(normalizedName, prefixCandidate) || namespaceHas(`variables.${normalizedName}`, prefixCandidate) || namespaceHas(normalizedName.slice(prefixCandidate.length + 1), prefixCandidate) || namespaceHas(`variables.${normalizedName.slice(prefixCandidate.length + 1)}`, prefixCandidate);
|
|
1325
|
+
if (hasScopedTranslation) return prefixCandidate;
|
|
1326
|
+
}
|
|
1327
|
+
const prefixedMatch = knownOrigins.find((origin) => normalizedName.startsWith(`${origin}_`));
|
|
1328
|
+
if (prefixedMatch) return prefixedMatch;
|
|
1329
|
+
const matchingOrigins = knownOrigins.filter(
|
|
1330
|
+
(origin) => namespaceHas(normalizedName, origin) || namespaceHas(`variables.${normalizedName}`, origin) || namespaceHas(`${origin}_${normalizedName}`, origin)
|
|
1331
|
+
);
|
|
1332
|
+
if (matchingOrigins.length === 1) return matchingOrigins[0];
|
|
1333
|
+
const inferredOrigins = Array.from(
|
|
1334
|
+
new Set(
|
|
1335
|
+
Object.values(variableRecords).filter((variable) => {
|
|
1336
|
+
const variableNameLower = typeof variable?.name === "string" ? variable.name.trim().toLowerCase() : "";
|
|
1337
|
+
const variableOrigin = typeof variable?.origin === "string" ? variable.origin.trim().toLowerCase() : "";
|
|
1338
|
+
if (!variableNameLower || !variableOrigin) return false;
|
|
1339
|
+
return variableNameLower === normalizedName || variableNameLower === `${variableOrigin}_${normalizedName}`;
|
|
1340
|
+
}).map((variable) => String(variable.origin).trim().toLowerCase()).filter((origin) => origin.length > 0)
|
|
1341
|
+
)
|
|
1342
|
+
);
|
|
1343
|
+
return inferredOrigins.length === 1 ? inferredOrigins[0] : void 0;
|
|
1084
1344
|
},
|
|
1085
|
-
[
|
|
1345
|
+
[allowedVariableDefinitionLookup, allowedVariableOrigin, knownOrigins, namespaceHas, variableRecords]
|
|
1086
1346
|
);
|
|
1087
|
-
const
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1347
|
+
const resolveVariableDescription = useCallback2(
|
|
1348
|
+
(variableName, fallbackDescription, origin) => {
|
|
1349
|
+
const fromOrigin = resolveTranslationFromNamespace(variableName, origin);
|
|
1350
|
+
if (fromOrigin && fromOrigin.trim().length > 0) return fromOrigin;
|
|
1351
|
+
const defaultTranslationKey = `variables.${variableName}`;
|
|
1352
|
+
const defaultTranslated = t(defaultTranslationKey);
|
|
1353
|
+
if (typeof defaultTranslated === "string" && defaultTranslated !== defaultTranslationKey) return defaultTranslated;
|
|
1354
|
+
if (fallbackDescription && fallbackDescription.trim().length > 0) return fallbackDescription;
|
|
1355
|
+
return humanizeVariableName(variableName);
|
|
1356
|
+
},
|
|
1357
|
+
[resolveTranslationFromNamespace, t]
|
|
1358
|
+
);
|
|
1359
|
+
const getSystemVariableDescription = useCallback2(
|
|
1360
|
+
(variable) => {
|
|
1361
|
+
if (variable?.system && !variable?.pluginId) {
|
|
1362
|
+
return t(`variables.${variable.description}`, void 0, { example: variable.example, interpolation: { escapeValue: false, prefix: "{{{", suffix: "}}}" } });
|
|
1363
|
+
}
|
|
1364
|
+
return resolveVariableDescription(variable?.name ?? "", variable?.description, variable?.origin);
|
|
1099
1365
|
},
|
|
1100
|
-
[
|
|
1366
|
+
[resolveVariableDescription, t]
|
|
1101
1367
|
);
|
|
1102
|
-
const
|
|
1103
|
-
(
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1368
|
+
const getAllowedVariableRecord = useCallback2(
|
|
1369
|
+
(variableName) => {
|
|
1370
|
+
const direct = variableRecords[variableName];
|
|
1371
|
+
if (direct) return direct;
|
|
1372
|
+
const normalizedOrigin = resolveAllowedVariableOrigin(variableName);
|
|
1373
|
+
if (!normalizedOrigin) return void 0;
|
|
1374
|
+
const prefixedName = variableName.startsWith(`${normalizedOrigin}_`) ? variableName : `${normalizedOrigin}_${variableName}`;
|
|
1375
|
+
return variableRecords[prefixedName];
|
|
1376
|
+
},
|
|
1377
|
+
[resolveAllowedVariableOrigin, variableRecords]
|
|
1108
1378
|
);
|
|
1109
1379
|
const getAllowedVariableDescription = useCallback2(
|
|
1110
1380
|
(variableName) => {
|
|
1111
|
-
const
|
|
1112
|
-
if (
|
|
1113
|
-
const
|
|
1114
|
-
const
|
|
1115
|
-
return
|
|
1381
|
+
const variable = variableRecords[variableName];
|
|
1382
|
+
if (variable) return getSystemVariableDescription(variable);
|
|
1383
|
+
const fromDefinition = allowedVariableDefinitionLookup.get(variableName);
|
|
1384
|
+
const origin = resolveAllowedVariableOrigin(variableName);
|
|
1385
|
+
return resolveVariableDescription(variableName, fromDefinition?.description, origin);
|
|
1116
1386
|
},
|
|
1117
|
-
[allowedVariableDefinitionLookup,
|
|
1387
|
+
[allowedVariableDefinitionLookup, getSystemVariableDescription, resolveAllowedVariableOrigin, resolveVariableDescription, variableRecords]
|
|
1118
1388
|
);
|
|
1119
|
-
const
|
|
1389
|
+
const getAllowedVariableValue = useCallback2(
|
|
1390
|
+
(variableName) => {
|
|
1391
|
+
if (!variableName) return void 0;
|
|
1392
|
+
const direct = variableRecords[variableName]?.value;
|
|
1393
|
+
if (direct !== void 0) return direct;
|
|
1394
|
+
const normalizedOrigin = resolveAllowedVariableOrigin(variableName);
|
|
1395
|
+
if (!normalizedOrigin) return void 0;
|
|
1396
|
+
const prefixedName = variableName.startsWith(`${normalizedOrigin}_`) ? variableName : `${normalizedOrigin}_${variableName}`;
|
|
1397
|
+
return variableRecords[prefixedName]?.value;
|
|
1398
|
+
},
|
|
1399
|
+
[resolveAllowedVariableOrigin, variableRecords]
|
|
1400
|
+
);
|
|
1401
|
+
const getAllowedVariableVisualType = useCallback2(
|
|
1402
|
+
(variableName) => {
|
|
1403
|
+
const record = getAllowedVariableRecord(variableName);
|
|
1404
|
+
if (record) return visualTypeFromRecord(record);
|
|
1405
|
+
if (functionVariableSet.has(variableName)) return "func";
|
|
1406
|
+
return "custom";
|
|
1407
|
+
},
|
|
1408
|
+
[functionVariableSet, getAllowedVariableRecord]
|
|
1409
|
+
);
|
|
1410
|
+
const getAllowedVariableTree = useCallback2(
|
|
1411
|
+
(definition) => {
|
|
1412
|
+
const record = getAllowedVariableRecord(definition.name);
|
|
1413
|
+
const liveTree = record ? systemVariableValueTrees.get(record.name) : void 0;
|
|
1414
|
+
if (liveTree && liveTree.length > 0) return liveTree;
|
|
1415
|
+
return allowedExampleTrees.get(definition.name);
|
|
1416
|
+
},
|
|
1417
|
+
[allowedExampleTrees, getAllowedVariableRecord, systemVariableValueTrees]
|
|
1418
|
+
);
|
|
1419
|
+
useEffect4(() => {
|
|
1120
1420
|
const query = (searchQuery ?? "").toLowerCase().replace("{{", "").replace("}}", "").trim();
|
|
1421
|
+
const nextAutoExpand = /* @__PURE__ */ new Set();
|
|
1422
|
+
const collectNestedAutoExpand = (rootToken, tree) => {
|
|
1423
|
+
if (!query || !tree || tree.length === 0) return false;
|
|
1424
|
+
let hit = false;
|
|
1425
|
+
const walk = (nodes) => {
|
|
1426
|
+
nodes.forEach((node) => {
|
|
1427
|
+
if (node.relativePath.toLowerCase().includes(query) || node.key.toLowerCase().includes(query)) {
|
|
1428
|
+
hit = true;
|
|
1429
|
+
const segments = node.relativePath.split(".");
|
|
1430
|
+
for (let i = 0; i < segments.length; i++) {
|
|
1431
|
+
const rel = segments.slice(0, i).join(".");
|
|
1432
|
+
nextAutoExpand.add(rel ? `${rootToken}.${rel}` : rootToken);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
if (node.children.length) walk(node.children);
|
|
1436
|
+
});
|
|
1437
|
+
};
|
|
1438
|
+
walk(tree);
|
|
1439
|
+
return hit;
|
|
1440
|
+
};
|
|
1121
1441
|
if (allowedVariableNames.length > 0) {
|
|
1122
1442
|
if (!query) {
|
|
1123
|
-
setFilteredAllowedVariables(
|
|
1443
|
+
setFilteredAllowedVariables(orderItemsByVariableType(allowedVariableDefinitions, (definition) => getAllowedVariableVisualType(definition.name)));
|
|
1124
1444
|
} else {
|
|
1125
1445
|
const nameMatches = [];
|
|
1126
1446
|
const descMatches = [];
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
|
|
1447
|
+
const nestedMatches = [];
|
|
1448
|
+
allowedVariableDefinitions.forEach((definition) => {
|
|
1449
|
+
const nameLower = definition.name?.toLowerCase();
|
|
1450
|
+
const descLower = getAllowedVariableDescription(definition.name)?.toLowerCase();
|
|
1451
|
+
if (nameLower?.includes(query)) {
|
|
1452
|
+
nameMatches.push(definition);
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
if (descLower?.includes(query)) {
|
|
1456
|
+
descMatches.push(definition);
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
const tree = getAllowedVariableTree(definition);
|
|
1460
|
+
if (tree && collectNestedAutoExpand(definition.name, tree)) {
|
|
1461
|
+
nestedMatches.push(definition);
|
|
1462
|
+
}
|
|
1132
1463
|
});
|
|
1133
|
-
|
|
1464
|
+
const sortByDef = (items) => sortItemsByVariableTypeThenName(items, (definition) => getAllowedVariableVisualType(definition.name), (definition) => definition.name);
|
|
1465
|
+
setFilteredAllowedVariables([...sortByDef(nameMatches), ...sortByDef(descMatches), ...sortByDef(nestedMatches)]);
|
|
1134
1466
|
}
|
|
1135
1467
|
} else {
|
|
1136
1468
|
setFilteredAllowedVariables([]);
|
|
1137
1469
|
}
|
|
1138
|
-
const
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1470
|
+
const allowedSet = new Set(allowedVariableNames);
|
|
1471
|
+
const shouldKeep = (variable) => {
|
|
1472
|
+
if (allowedSet.has(variable.name)) return false;
|
|
1473
|
+
if (!variable.origin) return true;
|
|
1474
|
+
if (!isOriginConnected) return true;
|
|
1475
|
+
return isOriginConnected(variable.origin);
|
|
1476
|
+
};
|
|
1477
|
+
const allRecords = Object.values(variableRecords);
|
|
1141
1478
|
if (!query) {
|
|
1142
|
-
|
|
1479
|
+
const visible = allRecords.filter(shouldKeep);
|
|
1480
|
+
setFilteredSystemVariables(orderItemsByVariableType(visible, (variable) => visualTypeFromRecord(variable)));
|
|
1143
1481
|
} else {
|
|
1144
1482
|
const nameMatches = [];
|
|
1145
1483
|
const descMatches = [];
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1484
|
+
const nestedMatches = [];
|
|
1485
|
+
allRecords.forEach((variable) => {
|
|
1486
|
+
if (!shouldKeep(variable)) return;
|
|
1487
|
+
const description = getSystemVariableDescription(variable);
|
|
1488
|
+
const nameLower = variable.name?.toLowerCase();
|
|
1489
|
+
const descLower = description?.toLowerCase();
|
|
1490
|
+
if (nameLower?.includes(query)) {
|
|
1491
|
+
nameMatches.push(variable);
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
if (descLower?.includes(query)) {
|
|
1495
|
+
descMatches.push(variable);
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
const tree = systemVariableValueTrees.get(variable.name);
|
|
1499
|
+
if (tree && collectNestedAutoExpand(variable.example ?? variable.name, tree)) {
|
|
1500
|
+
nestedMatches.push(variable);
|
|
1501
|
+
}
|
|
1155
1502
|
});
|
|
1156
|
-
|
|
1503
|
+
const sortSys = (items) => sortItemsByVariableTypeThenName(items, (variable) => visualTypeFromRecord(variable), (variable) => variable?.name ?? "");
|
|
1504
|
+
setFilteredSystemVariables([...sortSys(nameMatches), ...sortSys(descMatches), ...sortSys(nestedMatches)]);
|
|
1157
1505
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1506
|
+
setAutoExpandPaths(nextAutoExpand);
|
|
1507
|
+
}, [
|
|
1508
|
+
searchQuery,
|
|
1509
|
+
allowedVariableDefinitions,
|
|
1510
|
+
allowedVariableNames,
|
|
1511
|
+
getAllowedVariableDescription,
|
|
1512
|
+
getAllowedVariableTree,
|
|
1513
|
+
getAllowedVariableVisualType,
|
|
1514
|
+
getSystemVariableDescription,
|
|
1515
|
+
isOriginConnected,
|
|
1516
|
+
systemVariableValueTrees,
|
|
1517
|
+
variableRecords
|
|
1518
|
+
]);
|
|
1162
1519
|
const clickedVariableIcon = () => {
|
|
1163
1520
|
if (!hideVariables) setShowVariables((current) => !current);
|
|
1164
1521
|
};
|
|
@@ -1168,25 +1525,202 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1168
1525
|
};
|
|
1169
1526
|
const insertVariable = (variable) => {
|
|
1170
1527
|
appendValue(`{{${variable}}}`);
|
|
1528
|
+
setShowVariables(false);
|
|
1171
1529
|
};
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
return "ls-variable-token--custom";
|
|
1530
|
+
const handleFilterOptions = (options, params) => {
|
|
1531
|
+
const filtered = filter(options, params);
|
|
1532
|
+
afterFilter?.(filtered);
|
|
1533
|
+
return filtered;
|
|
1177
1534
|
};
|
|
1178
1535
|
const renderVariableToken = (variableName, variableType, isSuggested = false) => /* @__PURE__ */ jsxs5("div", { className: `ls-variable-token ${getVariableColorClass(variableType, isSuggested)}`, children: [
|
|
1179
1536
|
/* @__PURE__ */ jsx11("span", { className: "ls-variable-token__name", children: `{{${variableName}}}` }),
|
|
1180
1537
|
variableType === "func" && /* @__PURE__ */ jsx11("span", { className: "ls-variable-token__badge", title: t("variables.functionvariables", "Function variables"), children: "fx" })
|
|
1181
1538
|
] });
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1539
|
+
const renderExpandToggle = (path, expanded) => /* @__PURE__ */ jsx11(
|
|
1540
|
+
"button",
|
|
1541
|
+
{
|
|
1542
|
+
type: "button",
|
|
1543
|
+
onClick: (e) => {
|
|
1544
|
+
e.stopPropagation();
|
|
1545
|
+
toggleExpand(path);
|
|
1546
|
+
},
|
|
1547
|
+
className: `ls-variable-picker__expand-toggle${expanded ? " ls-variable-picker__expand-toggle--expanded" : ""}`,
|
|
1548
|
+
"aria-label": expanded ? "Collapse" : "Expand",
|
|
1549
|
+
"aria-expanded": expanded,
|
|
1550
|
+
children: /* @__PURE__ */ jsx11(ArrowRight, { style: { width: 14, height: 14 } })
|
|
1551
|
+
}
|
|
1552
|
+
);
|
|
1553
|
+
const renderExpandSpacer = () => /* @__PURE__ */ jsx11("span", { className: "ls-variable-picker__expand-spacer", "aria-hidden": true });
|
|
1554
|
+
const getVariableValuePreview = (variableValue) => {
|
|
1555
|
+
const { displayValue, fullValue } = getVariableValueDisplay(variableValue);
|
|
1556
|
+
return { displayValue, fullValue };
|
|
1557
|
+
};
|
|
1558
|
+
const renderValueChildRows = (rootToken, nodes) => nodes.map((node) => {
|
|
1559
|
+
const fullToken = `${rootToken}.${node.relativePath}`;
|
|
1560
|
+
const expanded = node.isExpandable && isPathExpanded(fullToken);
|
|
1561
|
+
const { displayValue, fullValue } = getVariableValuePreview(node.value);
|
|
1562
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1563
|
+
/* @__PURE__ */ jsxs5(
|
|
1564
|
+
"div",
|
|
1565
|
+
{
|
|
1566
|
+
className: "ls-variable-picker__row ls-variable-picker__row--child",
|
|
1567
|
+
onClick: () => {
|
|
1568
|
+
if (node.isExpandable && !expanded) toggleExpand(fullToken);
|
|
1569
|
+
else insertVariable(fullToken);
|
|
1570
|
+
},
|
|
1571
|
+
children: [
|
|
1572
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__token-cell", style: { paddingLeft: `${node.depth * 1.25}rem` }, children: [
|
|
1573
|
+
node.isExpandable ? renderExpandToggle(fullToken, expanded) : renderExpandSpacer(),
|
|
1574
|
+
/* @__PURE__ */ jsx11("div", { className: `ls-variable-token ${CHILD_VARIABLE_COLOR_CLASS}`, children: /* @__PURE__ */ jsx11("span", { className: "ls-variable-token__name", children: `{{${fullToken}}}` }) })
|
|
1575
|
+
] }),
|
|
1576
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: node.displayKey }),
|
|
1577
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__value", title: fullValue, children: displayValue })
|
|
1578
|
+
]
|
|
1579
|
+
}
|
|
1580
|
+
),
|
|
1581
|
+
expanded && renderValueChildRows(rootToken, node.children)
|
|
1582
|
+
] }, fullToken);
|
|
1583
|
+
});
|
|
1584
|
+
const toOptionLabelString = (input) => {
|
|
1585
|
+
if (typeof input === "string") return input;
|
|
1586
|
+
if (typeof input === "number" || typeof input === "boolean" || typeof input === "bigint") return String(input);
|
|
1587
|
+
if (input === null || input === void 0) return "";
|
|
1588
|
+
if (typeof input === "object") {
|
|
1589
|
+
const labelCandidate = input.label;
|
|
1590
|
+
if (typeof labelCandidate === "string") return labelCandidate;
|
|
1591
|
+
if (typeof labelCandidate === "number" || typeof labelCandidate === "boolean" || typeof labelCandidate === "bigint") return String(labelCandidate);
|
|
1592
|
+
const valueCandidate = input.value;
|
|
1593
|
+
if (typeof valueCandidate === "string") return valueCandidate;
|
|
1594
|
+
if (typeof valueCandidate === "number" || typeof valueCandidate === "boolean" || typeof valueCandidate === "bigint") return String(valueCandidate);
|
|
1595
|
+
try {
|
|
1596
|
+
return JSON.stringify(input);
|
|
1597
|
+
} catch {
|
|
1598
|
+
return "[object Object]";
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
return String(input);
|
|
1602
|
+
};
|
|
1603
|
+
const resolveOptionLabel = (option) => {
|
|
1604
|
+
if (typeof getOptionLabel === "function") {
|
|
1605
|
+
try {
|
|
1606
|
+
const customLabel = getOptionLabel(option);
|
|
1607
|
+
return toOptionLabelString(customLabel === void 0 ? option : customLabel);
|
|
1608
|
+
} catch {
|
|
1609
|
+
return toOptionLabelString(option);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
return toOptionLabelString(option);
|
|
1186
1613
|
};
|
|
1614
|
+
const defaultRenderOption = (optionProps, option) => {
|
|
1615
|
+
const opt = option;
|
|
1616
|
+
const thumb = opt?.imageUrl ?? opt?.thumb ?? opt?.iconUrl ?? opt?.previewImageUrl;
|
|
1617
|
+
const helperText = typeof opt?.helperText === "string" ? opt.helperText : "";
|
|
1618
|
+
const isSelected = opt?.value === value;
|
|
1619
|
+
return /* @__PURE__ */ createElement(
|
|
1620
|
+
"li",
|
|
1621
|
+
{
|
|
1622
|
+
...optionProps,
|
|
1623
|
+
key: String(opt?.label ?? opt?.value ?? ""),
|
|
1624
|
+
className: `ls-variable-option${isSelected ? " ls-variable-option--selected" : ""}`
|
|
1625
|
+
},
|
|
1626
|
+
thumb ? /* @__PURE__ */ jsx11("img", { src: thumb, className: "ls-variable-option__thumb", alt: "" }) : /* @__PURE__ */ jsx11("span", { className: "ls-variable-option__thumb ls-variable-option__thumb--placeholder" }),
|
|
1627
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-option__body", children: [
|
|
1628
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-option__label", children: resolveOptionLabel(opt) }),
|
|
1629
|
+
helperText ? /* @__PURE__ */ jsx11("div", { className: "ls-variable-option__helper", children: helperText }) : null
|
|
1630
|
+
] })
|
|
1631
|
+
);
|
|
1632
|
+
};
|
|
1633
|
+
const showSuggestedSection = allowedVariableNames.length > 0 && filteredAllowedVariables.length > 0;
|
|
1634
|
+
const pickerBody = /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker ls-variable-picker--three-col", children: [
|
|
1635
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__intro", children: [
|
|
1636
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__intro-text", children: t("overlay-variables.variables-description", "Use variables that will automatically be replaced before sending out the text") }),
|
|
1637
|
+
/* @__PURE__ */ jsx11(
|
|
1638
|
+
LSInput,
|
|
1639
|
+
{
|
|
1640
|
+
autoFocus: true,
|
|
1641
|
+
startAdornment: /* @__PURE__ */ jsx11(Search, { style: { width: 18, height: 18 } }),
|
|
1642
|
+
placeholder: t("common.search", "Search"),
|
|
1643
|
+
value: searchQuery,
|
|
1644
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
1645
|
+
type: "text",
|
|
1646
|
+
style: { padding: "1rem 0 0" }
|
|
1647
|
+
}
|
|
1648
|
+
)
|
|
1649
|
+
] }),
|
|
1650
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__header", children: [
|
|
1651
|
+
/* @__PURE__ */ jsx11("div", { children: t("commands.variable", "Variable") }),
|
|
1652
|
+
/* @__PURE__ */ jsx11("div", { children: t("commands.description", "Description") }),
|
|
1653
|
+
/* @__PURE__ */ jsx11("div", { children: t("common.value", "Value") })
|
|
1654
|
+
] }),
|
|
1655
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__list", children: [
|
|
1656
|
+
showSuggestedSection && /* @__PURE__ */ jsxs5("fieldset", { className: "ls-variable-picker__field", children: [
|
|
1657
|
+
/* @__PURE__ */ jsx11("legend", { className: "ls-variable-picker__legend", children: t("commands.suggested-variables", "Suggested Variables") }),
|
|
1658
|
+
filteredAllowedVariables.map((definition, idx) => {
|
|
1659
|
+
const variableType = getAllowedVariableVisualType(definition.name);
|
|
1660
|
+
const tree = getAllowedVariableTree(definition);
|
|
1661
|
+
const { displayValue, fullValue } = getVariableValuePreview(getAllowedVariableValue(definition.name) ?? definition.example);
|
|
1662
|
+
const expandable = !!tree && tree.length > 0;
|
|
1663
|
+
const expanded = expandable && isPathExpanded(definition.name);
|
|
1664
|
+
const isLast = idx === filteredAllowedVariables.length - 1;
|
|
1665
|
+
const rowCls = `ls-variable-picker__row${isLast && !expanded ? " ls-variable-picker__row--no-border" : ""}`;
|
|
1666
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1667
|
+
/* @__PURE__ */ jsxs5(
|
|
1668
|
+
"div",
|
|
1669
|
+
{
|
|
1670
|
+
className: rowCls,
|
|
1671
|
+
onClick: () => {
|
|
1672
|
+
if (expandable && !expanded) toggleExpand(definition.name);
|
|
1673
|
+
else insertVariable(definition.name);
|
|
1674
|
+
},
|
|
1675
|
+
children: [
|
|
1676
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__token-cell", children: [
|
|
1677
|
+
expandable ? renderExpandToggle(definition.name, expanded) : renderExpandSpacer(),
|
|
1678
|
+
renderVariableToken(definition.name, variableType, true)
|
|
1679
|
+
] }),
|
|
1680
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: getAllowedVariableDescription(definition.name) }),
|
|
1681
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__value", title: fullValue, children: displayValue })
|
|
1682
|
+
]
|
|
1683
|
+
}
|
|
1684
|
+
),
|
|
1685
|
+
expanded && tree && renderValueChildRows(definition.name, tree)
|
|
1686
|
+
] }, definition.name);
|
|
1687
|
+
})
|
|
1688
|
+
] }),
|
|
1689
|
+
filteredSystemVariables?.map((variable) => {
|
|
1690
|
+
const variableType = visualTypeFromRecord(variable);
|
|
1691
|
+
const { displayValue, fullValue } = getVariableValuePreview(variable.value);
|
|
1692
|
+
const rootToken = variable.example ?? variable.name;
|
|
1693
|
+
const tree = systemVariableValueTrees.get(variable.name);
|
|
1694
|
+
const expandable = !!tree && tree.length > 0;
|
|
1695
|
+
const expanded = expandable && isPathExpanded(rootToken);
|
|
1696
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1697
|
+
/* @__PURE__ */ jsxs5(
|
|
1698
|
+
"div",
|
|
1699
|
+
{
|
|
1700
|
+
className: "ls-variable-picker__row",
|
|
1701
|
+
onClick: () => {
|
|
1702
|
+
if (expandable && !expanded) toggleExpand(rootToken);
|
|
1703
|
+
else insertVariable(rootToken);
|
|
1704
|
+
},
|
|
1705
|
+
children: [
|
|
1706
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__token-cell", children: [
|
|
1707
|
+
expandable ? renderExpandToggle(rootToken, expanded) : renderExpandSpacer(),
|
|
1708
|
+
renderVariableToken(variable.name, variableType)
|
|
1709
|
+
] }),
|
|
1710
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: getSystemVariableDescription(variable) }),
|
|
1711
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__value", title: fullValue, children: displayValue })
|
|
1712
|
+
]
|
|
1713
|
+
}
|
|
1714
|
+
),
|
|
1715
|
+
expanded && tree && renderValueChildRows(rootToken, tree)
|
|
1716
|
+
] }, variable.name);
|
|
1717
|
+
})
|
|
1718
|
+
] })
|
|
1719
|
+
] });
|
|
1187
1720
|
const textField = (params = {}) => /* @__PURE__ */ jsx11(
|
|
1188
1721
|
VariableInputTextField,
|
|
1189
1722
|
{
|
|
1723
|
+
t,
|
|
1190
1724
|
params,
|
|
1191
1725
|
id: variableId.current,
|
|
1192
1726
|
containerRef,
|
|
@@ -1201,19 +1735,21 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1201
1735
|
rows,
|
|
1202
1736
|
maxRows,
|
|
1203
1737
|
value,
|
|
1204
|
-
onChange,
|
|
1738
|
+
onChange: $disableInputChange ? void 0 : onChange,
|
|
1205
1739
|
clickedVariableIcon,
|
|
1206
1740
|
inputProps,
|
|
1741
|
+
allowedVariables,
|
|
1742
|
+
showVariableIcon: !hideVariables,
|
|
1207
1743
|
ref
|
|
1208
1744
|
}
|
|
1209
1745
|
);
|
|
1210
|
-
return /* @__PURE__ */ jsxs5(
|
|
1746
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1211
1747
|
/* @__PURE__ */ jsx11(
|
|
1212
1748
|
Popover,
|
|
1213
1749
|
{
|
|
1214
1750
|
anchorEl: containerRef.current,
|
|
1215
|
-
anchorOrigin: { vertical: "bottom", horizontal: "
|
|
1216
|
-
transformOrigin: { vertical: "top", horizontal: "
|
|
1751
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1752
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
1217
1753
|
open: !hideVariables && showVariables,
|
|
1218
1754
|
onClose: clickedVariableIcon,
|
|
1219
1755
|
slotProps: {
|
|
@@ -1221,58 +1757,59 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1221
1757
|
sx: {
|
|
1222
1758
|
color: "var(--neutralLight2, #cac9d5)",
|
|
1223
1759
|
backgroundColor: "var(--neutralDark1, #171628)",
|
|
1224
|
-
padding
|
|
1760
|
+
// Paper has no padding of its own — the picker body's `p-2` is the
|
|
1761
|
+
// single source of internal spacing. Adding paper padding on top of
|
|
1762
|
+
// that compounds the inset and forces premature horizontal scroll.
|
|
1763
|
+
padding: 0,
|
|
1225
1764
|
border: "1px solid var(--neutralDark4, #393853)"
|
|
1226
1765
|
}
|
|
1227
1766
|
}
|
|
1228
1767
|
},
|
|
1229
|
-
children:
|
|
1230
|
-
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__intro", children: [
|
|
1231
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.variables-description", "Use variables that will automatically be replaced before sending out the text") }),
|
|
1232
|
-
/* @__PURE__ */ jsx11(
|
|
1233
|
-
LSInput,
|
|
1234
|
-
{
|
|
1235
|
-
autoFocus: true,
|
|
1236
|
-
startAdornment: /* @__PURE__ */ jsx11(Search, { style: { width: 18, height: 18 } }),
|
|
1237
|
-
placeholder: t("assets.search", "Search"),
|
|
1238
|
-
value: searchQuery,
|
|
1239
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
1240
|
-
type: "text",
|
|
1241
|
-
style: { padding: "1rem 0 0" }
|
|
1242
|
-
}
|
|
1243
|
-
)
|
|
1244
|
-
] }),
|
|
1245
|
-
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__header", children: [
|
|
1246
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.variable", "Variable") }),
|
|
1247
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.description", "Description") })
|
|
1248
|
-
] }),
|
|
1249
|
-
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__list", children: [
|
|
1250
|
-
allowedVariableNames.length > 0 && filteredAllowedVariables?.map((variableName) => /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__row", onClick: () => insertVariable(variableName), children: [
|
|
1251
|
-
renderVariableToken(variableName, getVariableVisualType(variableName), true),
|
|
1252
|
-
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: getAllowedVariableDescription(variableName) })
|
|
1253
|
-
] }, variableName)),
|
|
1254
|
-
filteredSystemVariables?.map((variableKey) => /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__row", onClick: () => insertVariable(variableKey), children: [
|
|
1255
|
-
renderVariableToken(variableKey, getVariableVisualType(variableKey)),
|
|
1256
|
-
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: t(`variables.${variableKey}`, "-", { example: systemVariables?.[variableKey], interpolation: { escapeValue: false, prefix: "{{{", suffix: "}}}" } }) })
|
|
1257
|
-
] }, variableKey))
|
|
1258
|
-
] })
|
|
1259
|
-
] })
|
|
1768
|
+
children: pickerBody
|
|
1260
1769
|
}
|
|
1261
1770
|
),
|
|
1262
1771
|
isAutoComplete ? /* @__PURE__ */ jsx11(
|
|
1263
1772
|
Autocomplete2,
|
|
1264
1773
|
{
|
|
1265
1774
|
disableClearable: true,
|
|
1266
|
-
|
|
1775
|
+
openOnFocus: true,
|
|
1267
1776
|
includeInputInList: true,
|
|
1268
|
-
|
|
1269
|
-
|
|
1777
|
+
multiple: $multiple,
|
|
1778
|
+
freeSolo: $freeSolo,
|
|
1779
|
+
disableCloseOnSelect: $disableCloseOnSelect,
|
|
1780
|
+
groupBy: autoCompleteGroupBy,
|
|
1270
1781
|
options: autoCompleteOptions ?? [],
|
|
1782
|
+
isOptionEqualToValue,
|
|
1271
1783
|
value,
|
|
1272
|
-
|
|
1273
|
-
|
|
1784
|
+
disabled,
|
|
1785
|
+
loading,
|
|
1786
|
+
getOptionLabel: resolveOptionLabel,
|
|
1787
|
+
onChange: (_e, nextValue) => {
|
|
1788
|
+
if ($getFullValueObject) {
|
|
1789
|
+
onChange?.(nextValue);
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
if ($multiple) {
|
|
1793
|
+
const list = Array.isArray(nextValue) ? nextValue : nextValue ? [nextValue] : [];
|
|
1794
|
+
const mapped = list.map((entry) => {
|
|
1795
|
+
if (entry && typeof entry === "object" && "value" in entry) {
|
|
1796
|
+
return entry.value;
|
|
1797
|
+
}
|
|
1798
|
+
return entry;
|
|
1799
|
+
});
|
|
1800
|
+
onChange?.(mapped);
|
|
1801
|
+
return;
|
|
1802
|
+
}
|
|
1803
|
+
if (nextValue && typeof nextValue === "object" && "value" in nextValue) {
|
|
1804
|
+
onChange?.(nextValue.value);
|
|
1805
|
+
return;
|
|
1806
|
+
}
|
|
1807
|
+
onChange?.(nextValue);
|
|
1808
|
+
},
|
|
1809
|
+
onInputChange: $disableInputChange ? void 0 : (_e, nextValue) => onChange?.(nextValue),
|
|
1274
1810
|
filterOptions: handleFilterOptions,
|
|
1275
|
-
|
|
1811
|
+
renderOption: $renderOption ?? renderOption ?? defaultRenderOption,
|
|
1812
|
+
slots: ListboxComponent ? { listbox: ListboxComponent } : void 0,
|
|
1276
1813
|
slotProps: { listbox: { onScroll: onScrollListBox } },
|
|
1277
1814
|
onHighlightChange,
|
|
1278
1815
|
onOpen: onPopupOpen,
|
|
@@ -1284,7 +1821,33 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1284
1821
|
});
|
|
1285
1822
|
LSVariableInputField.displayName = "LSVariableInputField";
|
|
1286
1823
|
var VariableInputTextField = forwardRef4(
|
|
1287
|
-
({
|
|
1824
|
+
({
|
|
1825
|
+
t,
|
|
1826
|
+
id,
|
|
1827
|
+
name,
|
|
1828
|
+
label,
|
|
1829
|
+
type,
|
|
1830
|
+
variant,
|
|
1831
|
+
disabled,
|
|
1832
|
+
autoFocus,
|
|
1833
|
+
multiline,
|
|
1834
|
+
placeholder,
|
|
1835
|
+
rows,
|
|
1836
|
+
maxRows,
|
|
1837
|
+
value,
|
|
1838
|
+
onChange,
|
|
1839
|
+
inputProps,
|
|
1840
|
+
clickedVariableIcon,
|
|
1841
|
+
params = {},
|
|
1842
|
+
containerRef,
|
|
1843
|
+
showVariableIcon
|
|
1844
|
+
}, ref) => {
|
|
1845
|
+
const inputPropsInputProps = inputProps?.InputProps ?? {};
|
|
1846
|
+
const paramsInputProps = params?.InputProps ?? {};
|
|
1847
|
+
const inputPropsSlotInputProps = inputProps?.slotProps?.input ?? {};
|
|
1848
|
+
const paramsSlotInputProps = params?.slotProps?.input ?? {};
|
|
1849
|
+
const startAdornment = paramsInputProps.startAdornment ?? paramsSlotInputProps.startAdornment ?? inputPropsInputProps.startAdornment ?? inputPropsSlotInputProps.startAdornment;
|
|
1850
|
+
const endAdornment = paramsInputProps.endAdornment ?? paramsSlotInputProps.endAdornment ?? inputPropsInputProps.endAdornment ?? inputPropsSlotInputProps.endAdornment;
|
|
1288
1851
|
return /* @__PURE__ */ jsx11(
|
|
1289
1852
|
LSTextField,
|
|
1290
1853
|
{
|
|
@@ -1303,45 +1866,30 @@ var VariableInputTextField = forwardRef4(
|
|
|
1303
1866
|
value,
|
|
1304
1867
|
fullWidth: true,
|
|
1305
1868
|
className: `mui-ls-input noMinHeight ${params?.className ?? ""} ${inputProps?.className ?? ""}`.trim(),
|
|
1306
|
-
onChange: (e) => onChange
|
|
1869
|
+
onChange: onChange ? ((e) => onChange(e.target.value)) : void 0,
|
|
1307
1870
|
...inputProps,
|
|
1308
1871
|
...params,
|
|
1309
1872
|
InputProps: {
|
|
1310
|
-
...
|
|
1311
|
-
...
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1873
|
+
...inputPropsSlotInputProps,
|
|
1874
|
+
...inputPropsInputProps,
|
|
1875
|
+
...paramsSlotInputProps,
|
|
1876
|
+
...paramsInputProps,
|
|
1877
|
+
startAdornment,
|
|
1878
|
+
endAdornment: /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1879
|
+
endAdornment ?? null,
|
|
1880
|
+
showVariableIcon ? /* @__PURE__ */ jsx11(Tooltip, { title: t("chatbot.allowed-variables", "Allowed Variables"), children: /* @__PURE__ */ jsx11(
|
|
1315
1881
|
InputAdornment2,
|
|
1316
1882
|
{
|
|
1317
1883
|
position: "end",
|
|
1318
1884
|
onClick: clickedVariableIcon,
|
|
1319
1885
|
ref: containerRef,
|
|
1320
1886
|
className: "ls-variable-input-adornment",
|
|
1321
|
-
sx: {
|
|
1322
|
-
cursor: "pointer",
|
|
1323
|
-
background: "var(--primary)",
|
|
1324
|
-
borderRadius: "50%",
|
|
1325
|
-
display: "flex",
|
|
1326
|
-
alignItems: "center",
|
|
1327
|
-
justifyContent: "center",
|
|
1328
|
-
padding: "4px",
|
|
1329
|
-
minWidth: "22px",
|
|
1330
|
-
minHeight: "22px",
|
|
1331
|
-
width: "22px",
|
|
1332
|
-
height: "22px",
|
|
1333
|
-
color: "var(--neutralDark1)",
|
|
1334
|
-
"& *": {
|
|
1335
|
-
cursor: "pointer",
|
|
1336
|
-
color: "var(--neutralDark1)"
|
|
1337
|
-
}
|
|
1338
|
-
},
|
|
1339
1887
|
children: "{}"
|
|
1340
1888
|
}
|
|
1341
|
-
)
|
|
1889
|
+
) }) : null
|
|
1342
1890
|
] })
|
|
1343
1891
|
},
|
|
1344
|
-
ref
|
|
1892
|
+
inputRef: ref
|
|
1345
1893
|
}
|
|
1346
1894
|
);
|
|
1347
1895
|
}
|
package/package.json
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
2
|
+
"name": "@lumiastream/ui",
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"author": "Lumia Stream",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"description": "Lumia UI Kit",
|
|
7
|
+
"packageManager": "pnpm@10.32.1",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"module": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"start": "storybook dev -p 6006",
|
|
23
|
+
"build": "tsup src/index.ts",
|
|
24
|
+
"build-storybook": "storybook build",
|
|
25
|
+
"watch": "tsup src/index.ts --watch",
|
|
26
|
+
"release": "changeset && changeset tag && pnpm build && pnpm publish",
|
|
27
|
+
"prepublishOnly": "pnpm build",
|
|
28
|
+
"postpublish": "pnpm store prune && node ./scripts/postpublish-install.mjs"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@codemirror/autocomplete": "^6.0.0",
|
|
32
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
33
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@codemirror/autocomplete": "^6.20.1",
|
|
37
|
+
"@storybook/builder-vite": "^10.2.17",
|
|
38
|
+
"@storybook/react-vite": "^10.2.17",
|
|
39
|
+
"@types/node": "^25.5.0",
|
|
40
|
+
"@types/react": "^19.2.14",
|
|
41
|
+
"@types/react-dom": "19.2.3",
|
|
42
|
+
"postcss": "^8.5.8",
|
|
43
|
+
"sass-embedded": "^1.99.0",
|
|
44
|
+
"storybook": "^10.2.17",
|
|
45
|
+
"tsup": "^8.5.1",
|
|
46
|
+
"typescript": "^5.9.3",
|
|
47
|
+
"vite": "^8.0.8"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@emotion/react": "^11.14.0",
|
|
51
|
+
"@emotion/styled": "^11.14.1",
|
|
52
|
+
"@lumiastream/lumia-translations": "1.15.4",
|
|
53
|
+
"@lumiastream/lumia-types": "^3.2.7",
|
|
54
|
+
"@mui/icons-material": "^9.0.0",
|
|
55
|
+
"@mui/material": "^9.0.0",
|
|
56
|
+
"classnames": "^2.5.1",
|
|
57
|
+
"globals": "^17.4.0",
|
|
58
|
+
"react-best-gradient-color-picker": "^3.0.14",
|
|
59
|
+
"react-hook-form": "^7.73.1"
|
|
60
|
+
}
|
|
61
61
|
}
|