@lumiastream/ui 0.2.2 → 0.2.4-beta.1
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 +42 -9
- package/dist/index.js +729 -140
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -55,9 +55,9 @@ declare const LSInput: React.ForwardRefExoticComponent<Omit<LSInputProps$1, "ref
|
|
|
55
55
|
|
|
56
56
|
interface LSInputPropsChild {
|
|
57
57
|
name?: string;
|
|
58
|
-
value?: number;
|
|
58
|
+
value?: number | string | null;
|
|
59
59
|
autoFocus?: boolean;
|
|
60
|
-
defaultValue?: number;
|
|
60
|
+
defaultValue?: number | string | null;
|
|
61
61
|
label?: React.ReactNode;
|
|
62
62
|
inline?: boolean;
|
|
63
63
|
hasInfo?: boolean;
|
|
@@ -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
|
@@ -21,7 +21,7 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
// src/tailwind.css
|
|
24
|
-
styleInject('/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */\n@layer properties;\n:root,\n:host {\n --color-white: #fff;\n --spacing: 0.25rem;\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --radius-md: 0.375rem;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n}\n.visible {\n visibility: visible;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.static {\n position: static;\n}\n.start {\n inset-inline-start: var(--spacing);\n}\n.end {\n inset-inline-end: var(--spacing);\n}\n.mb-1 {\n margin-bottom: calc(var(--spacing) * 1);\n}\n.mb-4 {\n margin-bottom: calc(var(--spacing) * 4);\n}\n.ml-2 {\n margin-left: calc(var(--spacing) * 2);\n}\n.block {\n display: block;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.grid {\n display: grid;\n}\n.inline-flex {\n display: inline-flex;\n}\n.h-6 {\n height: calc(var(--spacing) * 6);\n}\n.h-full {\n height: 100%;\n}\n.max-h-\\[55vh\\] {\n max-height: 55vh;\n}\n.min-h-\\[50vh\\] {\n min-height: 50vh;\n}\n.min-h-screen {\n min-height: 100vh;\n}\n.w-6 {\n width: calc(var(--spacing) * 6);\n}\n.w-\\[92vw\\] {\n width: 92vw;\n}\n.w-full {\n width: 100%;\n}\n.max-w-\\[600px\\] {\n max-width: 600px;\n}\n.max-w-\\[1100px\\] {\n max-width: 1100px;\n}\n.min-w-0 {\n min-width: calc(var(--spacing) * 0);\n}\n.flex-1 {\n flex: 1;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.transform {\n transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-\\[minmax\\(300px\\,1\\.5fr\\)_2fr\\] {\n grid-template-columns: minmax(300px, 1.5fr) 2fr;\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-nowrap {\n flex-wrap: nowrap;\n}\n.items-center {\n align-items: center;\n}\n.items-start {\n align-items: flex-start;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-2 {\n gap: calc(var(--spacing) * 2);\n}\n.gap-8 {\n gap: calc(var(--spacing) * 8);\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-md {\n border-radius: var(--radius-md);\n}\n.border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n}\n.border-b {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n}\n.border-current {\n border-color: currentcolor;\n}\n.border-white\\/10 {\n border-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n}\n.border-white\\/25 {\n border-color: color-mix(in srgb, #fff 25%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 25%, transparent);\n }\n}\n.bg-\\[\\#1b1a28\\] {\n background-color: #1b1a28;\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.bg-no-repeat {\n background-repeat: no-repeat;\n}\n.p-0 {\n padding: calc(var(--spacing) * 0);\n}\n.p-6 {\n padding: calc(var(--spacing) * 6);\n}\n.px-1 {\n padding-inline: calc(var(--spacing) * 1);\n}\n.px-3 {\n padding-inline: calc(var(--spacing) * 3);\n}\n.px-4 {\n padding-inline: calc(var(--spacing) * 4);\n}\n.px-6 {\n padding-inline: calc(var(--spacing) * 6);\n}\n.py-0 {\n padding-block: calc(var(--spacing) * 0);\n}\n.py-1 {\n padding-block: calc(var(--spacing) * 1);\n}\n.py-2 {\n padding-block: calc(var(--spacing) * 2);\n}\n.py-3 {\n padding-block: calc(var(--spacing) * 3);\n}\n.py-4 {\n padding-block: calc(var(--spacing) * 4);\n}\n.pr-4 {\n padding-right: calc(var(--spacing) * 4);\n}\n.text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n}\n.text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n}\n.text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n}\n.text-\\[10px\\] {\n font-size: 10px;\n}\n.leading-\\[1\\.25\\] {\n --tw-leading: 1.25;\n line-height: 1.25;\n}\n.leading-none {\n --tw-leading: 1;\n line-height: 1;\n}\n.font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n}\n.font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n}\n.break-words {\n overflow-wrap: break-word;\n}\n.break-all {\n word-break: break-all;\n}\n.text-ellipsis {\n text-overflow: ellipsis;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-\\[\\#f4f3ff\\] {\n color: #f4f3ff;\n}\n.text-\\[var\\(--customVariables\\,\\#69ffd2\\)\\] {\n color: var(--customVariables,#69ffd2);\n}\n.text-\\[var\\(--functionVariables\\,var\\(--semanticPurple\\,\\#b489ff\\)\\)\\] {\n color: var(--functionVariables,var(--semanticPurple,#b489ff));\n}\n.text-\\[var\\(--neutralLight1\\,\\#f4f3ff\\)\\] {\n color: var(--neutralLight1,#f4f3ff);\n}\n.text-\\[var\\(--neutralLight2\\,\\#cac9d5\\)\\] {\n color: var(--neutralLight2,#cac9d5);\n}\n.text-\\[var\\(--neutralLight3\\,\\#9392a1\\)\\] {\n color: var(--neutralLight3,#9392a1);\n}\n.text-\\[var\\(--normalVariables\\,var\\(--semanticBlue\\,\\#65b8ff\\)\\)\\] {\n color: var(--normalVariables,var(--semanticBlue,#65b8ff));\n}\n.uppercase {\n text-transform: uppercase;\n}\n.shadow-\\[0_0_0_1px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\] {\n --tw-shadow: 0 0 0 1px var(--tw-shadow-color, rgba(0,0,0,0.25));\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n}\n.shadow-\\[0_8px_18px_rgba\\(0\\,0\\,0\\,0\\.18\\)\\] {\n --tw-shadow: 0 8px 18px var(--tw-shadow-color, rgba(0,0,0,0.18));\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n}\n.filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.transition {\n transition-property:\n color,\n background-color,\n border-color,\n outline-color,\n text-decoration-color,\n fill,\n stroke,\n --tw-gradient-from,\n --tw-gradient-via,\n --tw-gradient-to,\n opacity,\n box-shadow,\n transform,\n translate,\n scale,\n rotate,\n filter,\n -webkit-backdrop-filter,\n backdrop-filter,\n display,\n content-visibility,\n overlay,\n pointer-events;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n}\n.\\[--neutralDark1\\:\\#1b1a28\\] {\n --neutralDark1: #1b1a28;\n}\n.\\[--neutralDark2\\:\\#252338\\] {\n --neutralDark2: #252338;\n}\n.\\[--neutralDark3\\:\\#312f47\\] {\n --neutralDark3: #312f47;\n}\n.\\[--neutralDark4\\:\\#46435f\\] {\n --neutralDark4: #46435f;\n}\n.\\[--neutralLight1\\:\\#f4f3ff\\] {\n --neutralLight1: #f4f3ff;\n}\n.\\[--neutralLight2\\:\\#cac9d5\\] {\n --neutralLight2: #cac9d5;\n}\n.\\[--neutralLight3\\:\\#9f9eb2\\] {\n --neutralLight3: #9f9eb2;\n}\n.\\[--primary\\:\\#ff4076\\] {\n --primary: #ff4076;\n}\n.\\[--radiusContainer\\:12px\\] {\n --radiusContainer: 12px;\n}\n.\\[--radiusContainerSm\\:10px\\] {\n --radiusContainerSm: 10px;\n}\n.\\[--secondary\\:\\#5f5dff\\] {\n --secondary: #5f5dff;\n}\n.\\[--variable-custom-color\\:var\\(--customVariables\\,\\#69ffd2\\)\\] {\n --variable-custom-color: var(--customVariables,#69ffd2);\n}\n.\\[--variable-function-color\\:var\\(--functionVariables\\,var\\(--semanticPurple\\,\\#b489ff\\)\\)\\] {\n --variable-function-color: var(--functionVariables,var(--semanticPurple,#b489ff));\n}\n.\\[--variable-normal-color\\:var\\(--normalVariables\\,var\\(--semanticBlue\\,\\#65b8ff\\)\\)\\] {\n --variable-normal-color: var(--normalVariables,var(--semanticBlue,#65b8ff));\n}\n.hover\\:brightness-110 {\n &:hover {\n @media (hover: hover) {\n --tw-brightness: brightness(110%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n }\n}\n.focus\\:ring-2 {\n &:focus {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n }\n}\n.focus\\:ring-\\[var\\(--primary\\,\\#ff4076\\)\\] {\n &:focus {\n --tw-ring-color: var(--primary,#ff4076);\n }\n}\n.focus\\:ring-offset-2 {\n &:focus {\n --tw-ring-offset-width: 2px;\n --tw-ring-offset-shadow: var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n }\n}\n.focus\\:ring-offset-\\[var\\(--neutralDark1\\,\\#1b1a28\\)\\] {\n &:focus {\n --tw-ring-offset-color: var(--neutralDark1,#1b1a28);\n }\n}\n.focus\\:outline-none {\n &:focus {\n --tw-outline-style: none;\n outline-style: none;\n }\n}\n.active\\:opacity-80 {\n &:active {\n opacity: 80%;\n }\n}\n.active\\:brightness-95 {\n &:active {\n --tw-brightness: brightness(95%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n}\n.disabled\\:cursor-not-allowed {\n &:disabled {\n cursor: not-allowed;\n }\n}\n.disabled\\:opacity-50 {\n &:disabled {\n opacity: 50%;\n }\n}\n.\\[\\&_circle\\]\\:stroke-white {\n & circle {\n stroke: var(--color-white);\n }\n}\n.\\[\\&_polyline\\]\\:stroke-white {\n & polyline {\n stroke: var(--color-white);\n }\n}\n@property --tw-rotate-x { syntax: "*"; inherits: false; }\n@property --tw-rotate-y { syntax: "*"; inherits: false; }\n@property --tw-rotate-z { syntax: "*"; inherits: false; }\n@property --tw-skew-x { syntax: "*"; inherits: false; }\n@property --tw-skew-y { syntax: "*"; inherits: false; }\n@property --tw-border-style { syntax: "*"; inherits: false; initial-value: solid; }\n@property --tw-leading { syntax: "*"; inherits: false; }\n@property --tw-font-weight { syntax: "*"; inherits: false; }\n@property --tw-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-inset-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-inset-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-inset-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-ring-color { syntax: "*"; inherits: false; }\n@property --tw-ring-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-inset-ring-color { syntax: "*"; inherits: false; }\n@property --tw-inset-ring-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-ring-inset { syntax: "*"; inherits: false; }\n@property --tw-ring-offset-width { syntax: "<length>"; inherits: false; initial-value: 0px; }\n@property --tw-ring-offset-color { syntax: "*"; inherits: false; initial-value: #fff; }\n@property --tw-ring-offset-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-blur { syntax: "*"; inherits: false; }\n@property --tw-brightness { syntax: "*"; inherits: false; }\n@property --tw-contrast { syntax: "*"; inherits: false; }\n@property --tw-grayscale { syntax: "*"; inherits: false; }\n@property --tw-hue-rotate { syntax: "*"; inherits: false; }\n@property --tw-invert { syntax: "*"; inherits: false; }\n@property --tw-opacity { syntax: "*"; inherits: false; }\n@property --tw-saturate { syntax: "*"; inherits: false; }\n@property --tw-sepia { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-drop-shadow-size { syntax: "*"; inherits: false; }\n@layer properties {\n @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n *,\n ::before,\n ::after,\n ::backdrop {\n --tw-rotate-x: initial;\n --tw-rotate-y: initial;\n --tw-rotate-z: initial;\n --tw-skew-x: initial;\n --tw-skew-y: initial;\n --tw-border-style: solid;\n --tw-leading: initial;\n --tw-font-weight: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-blur: initial;\n --tw-brightness: initial;\n --tw-contrast: initial;\n --tw-grayscale: initial;\n --tw-hue-rotate: initial;\n --tw-invert: initial;\n --tw-opacity: initial;\n --tw-saturate: initial;\n --tw-sepia: initial;\n --tw-drop-shadow: initial;\n --tw-drop-shadow-color: initial;\n --tw-drop-shadow-alpha: 100%;\n --tw-drop-shadow-size: initial;\n }\n }\n}\n');
|
|
24
|
+
styleInject('/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */\n@layer properties;\n:root,\n:host {\n --color-white: #fff;\n --spacing: 0.25rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n}\n.visible {\n visibility: visible;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.static {\n position: static;\n}\n.start {\n inset-inline-start: var(--spacing);\n}\n.end {\n inset-inline-end: var(--spacing);\n}\n.m-0 {\n margin: calc(var(--spacing) * 0);\n}\n.mb-1 {\n margin-bottom: calc(var(--spacing) * 1);\n}\n.mb-2 {\n margin-bottom: calc(var(--spacing) * 2);\n}\n.ml-2 {\n margin-left: calc(var(--spacing) * 2);\n}\n.block {\n display: block;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.grid {\n display: grid;\n}\n.hidden {\n display: none;\n}\n.inline-block {\n display: inline-block;\n}\n.inline-flex {\n display: inline-flex;\n}\n.h-5 {\n height: calc(var(--spacing) * 5);\n}\n.h-6 {\n height: calc(var(--spacing) * 6);\n}\n.h-8 {\n height: calc(var(--spacing) * 8);\n}\n.h-full {\n height: 100%;\n}\n.max-h-\\[55vh\\] {\n max-height: 55vh;\n}\n.min-h-\\[50vh\\] {\n min-height: 50vh;\n}\n.min-h-screen {\n min-height: 100vh;\n}\n.w-5 {\n width: calc(var(--spacing) * 5);\n}\n.w-6 {\n width: calc(var(--spacing) * 6);\n}\n.w-8 {\n width: calc(var(--spacing) * 8);\n}\n.w-\\[92vw\\] {\n width: 92vw;\n}\n.w-full {\n width: 100%;\n}\n.max-w-\\[600px\\] {\n max-width: 600px;\n}\n.max-w-\\[1100px\\] {\n max-width: 1100px;\n}\n.min-w-0 {\n min-width: calc(var(--spacing) * 0);\n}\n.flex-1 {\n flex: 1;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.transform {\n transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-\\[minmax\\(260px\\,1\\.5fr\\)_2fr_minmax\\(140px\\,1fr\\)\\] {\n grid-template-columns: minmax(260px, 1.5fr) 2fr minmax(140px, 1fr);\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-nowrap {\n flex-wrap: nowrap;\n}\n.items-center {\n align-items: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.justify-center {\n justify-content: center;\n}\n.gap-1 {\n gap: calc(var(--spacing) * 1);\n}\n.gap-2 {\n gap: calc(var(--spacing) * 2);\n}\n.gap-4 {\n gap: calc(var(--spacing) * 4);\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-md {\n border-radius: var(--radius-md);\n}\n.rounded-sm {\n border-radius: var(--radius-sm);\n}\n.border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n}\n.border-0 {\n border-style: var(--tw-border-style);\n border-width: 0px;\n}\n.border-2 {\n border-style: var(--tw-border-style);\n border-width: 2px;\n}\n.border-b {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n}\n.border-b-0 {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 0px;\n}\n.border-solid {\n --tw-border-style: solid;\n border-style: solid;\n}\n.border-\\[var\\(--neutralDark4\\,\\#393853\\)\\] {\n border-color: var(--neutralDark4,#393853);\n}\n.border-current {\n border-color: currentcolor;\n}\n.border-white\\/10 {\n border-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n}\n.border-white\\/25 {\n border-color: color-mix(in srgb, #fff 25%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 25%, transparent);\n }\n}\n.border-b-\\[var\\(--neutralDark4\\,\\#393853\\)\\] {\n border-bottom-color: var(--neutralDark4,#393853);\n}\n.bg-\\[\\#1b1a28\\] {\n background-color: #1b1a28;\n}\n.bg-\\[var\\(--primary\\)\\]\\/10 {\n background-color: var(--primary);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--primary) 10%, transparent);\n }\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.bg-no-repeat {\n background-repeat: no-repeat;\n}\n.object-cover {\n object-fit: cover;\n}\n.p-0 {\n padding: calc(var(--spacing) * 0);\n}\n.p-2 {\n padding: calc(var(--spacing) * 2);\n}\n.p-6 {\n padding: calc(var(--spacing) * 6);\n}\n.px-1 {\n padding-inline: calc(var(--spacing) * 1);\n}\n.px-2 {\n padding-inline: calc(var(--spacing) * 2);\n}\n.px-3 {\n padding-inline: calc(var(--spacing) * 3);\n}\n.px-4 {\n padding-inline: calc(var(--spacing) * 4);\n}\n.px-6 {\n padding-inline: calc(var(--spacing) * 6);\n}\n.py-1 {\n padding-block: calc(var(--spacing) * 1);\n}\n.py-2 {\n padding-block: calc(var(--spacing) * 2);\n}\n.py-3 {\n padding-block: calc(var(--spacing) * 3);\n}\n.py-\\[1px\\] {\n padding-block: 1px;\n}\n.pt-0 {\n padding-top: calc(var(--spacing) * 0);\n}\n.pt-2 {\n padding-top: calc(var(--spacing) * 2);\n}\n.pr-4 {\n padding-right: calc(var(--spacing) * 4);\n}\n.pb-0 {\n padding-bottom: calc(var(--spacing) * 0);\n}\n.pb-2 {\n padding-bottom: calc(var(--spacing) * 2);\n}\n.text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n}\n.text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n}\n.text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n}\n.text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n}\n.text-\\[10px\\] {\n font-size: 10px;\n}\n.leading-none {\n --tw-leading: 1;\n line-height: 1;\n}\n.font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n}\n.font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n}\n.font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n}\n.break-words {\n overflow-wrap: break-word;\n}\n.break-all {\n word-break: break-all;\n}\n.text-ellipsis {\n text-overflow: ellipsis;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-\\[\\#f4f3ff\\] {\n color: #f4f3ff;\n}\n.text-\\[var\\(--childVariables\\,\\#ffa66e\\)\\] {\n color: var(--childVariables,#ffa66e);\n}\n.text-\\[var\\(--customVariables\\,\\#69ffd2\\)\\] {\n color: var(--customVariables,#69ffd2);\n}\n.text-\\[var\\(--functionVariables\\,\\#b47eea\\)\\] {\n color: var(--functionVariables,#b47eea);\n}\n.text-\\[var\\(--neutralLight1\\,\\#f4f3ff\\)\\] {\n color: var(--neutralLight1,#f4f3ff);\n}\n.text-\\[var\\(--neutralLight2\\,\\#cac9d5\\)\\] {\n color: var(--neutralLight2,#cac9d5);\n}\n.text-\\[var\\(--neutralLight3\\,\\#9392a1\\)\\] {\n color: var(--neutralLight3,#9392a1);\n}\n.text-\\[var\\(--normalVariables\\,\\#69a5ff\\)\\] {\n color: var(--normalVariables,#69a5ff);\n}\n.uppercase {\n text-transform: uppercase;\n}\n.shadow-\\[0_0_0_1px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\] {\n --tw-shadow: 0 0 0 1px var(--tw-shadow-color, rgba(0,0,0,0.25));\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n}\n.shadow-\\[0_8px_18px_rgba\\(0\\,0\\,0\\,0\\.18\\)\\] {\n --tw-shadow: 0 8px 18px var(--tw-shadow-color, rgba(0,0,0,0.18));\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n}\n.filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.transition {\n transition-property:\n color,\n background-color,\n border-color,\n outline-color,\n text-decoration-color,\n fill,\n stroke,\n --tw-gradient-from,\n --tw-gradient-via,\n --tw-gradient-to,\n opacity,\n box-shadow,\n transform,\n translate,\n scale,\n rotate,\n filter,\n -webkit-backdrop-filter,\n backdrop-filter,\n display,\n content-visibility,\n overlay,\n pointer-events;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n}\n.\\[--neutralDark1\\:\\#1b1a28\\] {\n --neutralDark1: #1b1a28;\n}\n.\\[--neutralDark2\\:\\#252338\\] {\n --neutralDark2: #252338;\n}\n.\\[--neutralDark3\\:\\#312f47\\] {\n --neutralDark3: #312f47;\n}\n.\\[--neutralDark4\\:\\#46435f\\] {\n --neutralDark4: #46435f;\n}\n.\\[--neutralLight1\\:\\#f4f3ff\\] {\n --neutralLight1: #f4f3ff;\n}\n.\\[--neutralLight2\\:\\#cac9d5\\] {\n --neutralLight2: #cac9d5;\n}\n.\\[--neutralLight3\\:\\#9f9eb2\\] {\n --neutralLight3: #9f9eb2;\n}\n.\\[--primary\\:\\#ff4076\\] {\n --primary: #ff4076;\n}\n.\\[--radiusContainer\\:12px\\] {\n --radiusContainer: 12px;\n}\n.\\[--radiusContainerSm\\:10px\\] {\n --radiusContainerSm: 10px;\n}\n.\\[--secondary\\:\\#5f5dff\\] {\n --secondary: #5f5dff;\n}\n.last-of-type\\:border-b-0 {\n &:last-of-type {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 0px;\n }\n}\n.hover\\:bg-\\[var\\(--neutralDark2\\,\\#1f1d36\\)\\]\\/40 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--neutralDark2,#1f1d36);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--neutralDark2,#1f1d36) 40%, transparent);\n }\n }\n }\n}\n.hover\\:bg-\\[var\\(--neutralDark4\\,\\#393853\\)\\]\\/50 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--neutralDark4,#393853);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--neutralDark4,#393853) 50%, transparent);\n }\n }\n }\n}\n.hover\\:bg-\\[var\\(--primary\\)\\]\\/20 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--primary);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--primary) 20%, transparent);\n }\n }\n }\n}\n.hover\\:brightness-110 {\n &:hover {\n @media (hover: hover) {\n --tw-brightness: brightness(110%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n }\n}\n.focus\\:ring-2 {\n &:focus {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow:\n var(--tw-inset-shadow),\n var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow),\n var(--tw-ring-shadow),\n var(--tw-shadow);\n }\n}\n.focus\\:ring-\\[var\\(--primary\\,\\#ff4076\\)\\] {\n &:focus {\n --tw-ring-color: var(--primary,#ff4076);\n }\n}\n.focus\\:ring-offset-2 {\n &:focus {\n --tw-ring-offset-width: 2px;\n --tw-ring-offset-shadow: var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n }\n}\n.focus\\:ring-offset-\\[var\\(--neutralDark1\\,\\#1b1a28\\)\\] {\n &:focus {\n --tw-ring-offset-color: var(--neutralDark1,#1b1a28);\n }\n}\n.focus\\:outline-none {\n &:focus {\n --tw-outline-style: none;\n outline-style: none;\n }\n}\n.active\\:opacity-80 {\n &:active {\n opacity: 80%;\n }\n}\n.active\\:brightness-95 {\n &:active {\n --tw-brightness: brightness(95%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n}\n.disabled\\:cursor-not-allowed {\n &:disabled {\n cursor: not-allowed;\n }\n}\n.disabled\\:opacity-50 {\n &:disabled {\n opacity: 50%;\n }\n}\n.\\[\\&_circle\\]\\:stroke-white {\n & circle {\n stroke: var(--color-white);\n }\n}\n.\\[\\&_polyline\\]\\:stroke-white {\n & polyline {\n stroke: var(--color-white);\n }\n}\n@property --tw-rotate-x { syntax: "*"; inherits: false; }\n@property --tw-rotate-y { syntax: "*"; inherits: false; }\n@property --tw-rotate-z { syntax: "*"; inherits: false; }\n@property --tw-skew-x { syntax: "*"; inherits: false; }\n@property --tw-skew-y { syntax: "*"; inherits: false; }\n@property --tw-border-style { syntax: "*"; inherits: false; initial-value: solid; }\n@property --tw-leading { syntax: "*"; inherits: false; }\n@property --tw-font-weight { syntax: "*"; inherits: false; }\n@property --tw-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-inset-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-inset-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-inset-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-ring-color { syntax: "*"; inherits: false; }\n@property --tw-ring-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-inset-ring-color { syntax: "*"; inherits: false; }\n@property --tw-inset-ring-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-ring-inset { syntax: "*"; inherits: false; }\n@property --tw-ring-offset-width { syntax: "<length>"; inherits: false; initial-value: 0px; }\n@property --tw-ring-offset-color { syntax: "*"; inherits: false; initial-value: #fff; }\n@property --tw-ring-offset-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }\n@property --tw-blur { syntax: "*"; inherits: false; }\n@property --tw-brightness { syntax: "*"; inherits: false; }\n@property --tw-contrast { syntax: "*"; inherits: false; }\n@property --tw-grayscale { syntax: "*"; inherits: false; }\n@property --tw-hue-rotate { syntax: "*"; inherits: false; }\n@property --tw-invert { syntax: "*"; inherits: false; }\n@property --tw-opacity { syntax: "*"; inherits: false; }\n@property --tw-saturate { syntax: "*"; inherits: false; }\n@property --tw-sepia { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow-color { syntax: "*"; inherits: false; }\n@property --tw-drop-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }\n@property --tw-drop-shadow-size { syntax: "*"; inherits: false; }\n@layer properties {\n @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n *,\n ::before,\n ::after,\n ::backdrop {\n --tw-rotate-x: initial;\n --tw-rotate-y: initial;\n --tw-rotate-z: initial;\n --tw-skew-x: initial;\n --tw-skew-y: initial;\n --tw-border-style: solid;\n --tw-leading: initial;\n --tw-font-weight: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-blur: initial;\n --tw-brightness: initial;\n --tw-contrast: initial;\n --tw-grayscale: initial;\n --tw-hue-rotate: initial;\n --tw-invert: initial;\n --tw-opacity: initial;\n --tw-saturate: initial;\n --tw-sepia: initial;\n --tw-drop-shadow: initial;\n --tw-drop-shadow-color: initial;\n --tw-drop-shadow-alpha: 100%;\n --tw-drop-shadow-size: initial;\n }\n }\n}\n');
|
|
25
25
|
|
|
26
26
|
// src/components/LSButton/LSButton.tsx
|
|
27
27
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -185,6 +185,20 @@ import Slider from "@mui/material/Slider";
|
|
|
185
185
|
import classNames2 from "classnames";
|
|
186
186
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
187
187
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
188
|
+
var normalizeSliderValue = (rawValue) => {
|
|
189
|
+
if (typeof rawValue === "number") {
|
|
190
|
+
return Number.isFinite(rawValue) ? rawValue : 0;
|
|
191
|
+
}
|
|
192
|
+
if (typeof rawValue === "string") {
|
|
193
|
+
const trimmedValue = rawValue.trim();
|
|
194
|
+
if (!trimmedValue) {
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
const numericValue = Number(trimmedValue);
|
|
198
|
+
return Number.isFinite(numericValue) ? numericValue : 0;
|
|
199
|
+
}
|
|
200
|
+
return 0;
|
|
201
|
+
};
|
|
188
202
|
var LSSliderInput = ({
|
|
189
203
|
name,
|
|
190
204
|
value,
|
|
@@ -214,13 +228,7 @@ var LSSliderInput = ({
|
|
|
214
228
|
const isValueFloat = Boolean(isFloat || isFloatMiliseconds || isMiliseconds);
|
|
215
229
|
const actualToDisplay = useCallback(
|
|
216
230
|
(input) => {
|
|
217
|
-
|
|
218
|
-
return input;
|
|
219
|
-
}
|
|
220
|
-
const numericValue = Number(input);
|
|
221
|
-
if (Number.isNaN(numericValue)) {
|
|
222
|
-
return 0;
|
|
223
|
-
}
|
|
231
|
+
const numericValue = normalizeSliderValue(input);
|
|
224
232
|
if (!isValueFloat) {
|
|
225
233
|
return numericValue;
|
|
226
234
|
}
|
|
@@ -241,7 +249,7 @@ var LSSliderInput = ({
|
|
|
241
249
|
return decimalIndex === -1 ? 0 : stepString.length - decimalIndex - 1;
|
|
242
250
|
}, [displayStep]);
|
|
243
251
|
useEffect(() => {
|
|
244
|
-
if (
|
|
252
|
+
if (value !== void 0) {
|
|
245
253
|
setDisplayValue(actualToDisplay(value));
|
|
246
254
|
}
|
|
247
255
|
}, [actualToDisplay, value]);
|
|
@@ -939,10 +947,13 @@ LSTextField.displayName = "LSTextField";
|
|
|
939
947
|
// src/components/LSVariableInputField/LSVariableInputField.tsx
|
|
940
948
|
import Autocomplete2, { createFilterOptions } from "@mui/material/Autocomplete";
|
|
941
949
|
import InputAdornment2 from "@mui/material/InputAdornment";
|
|
942
|
-
import Search from "@mui/icons-material/Search";
|
|
943
950
|
import Popover from "@mui/material/Popover";
|
|
944
|
-
import
|
|
945
|
-
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";
|
|
946
957
|
var LSVariableInputContext = createContext({});
|
|
947
958
|
var LSVariableInputProvider = ({ children, value }) => {
|
|
948
959
|
return /* @__PURE__ */ jsx11(LSVariableInputContext.Provider, { value, children });
|
|
@@ -963,8 +974,8 @@ var DEFAULT_FUNCTION_VARIABLES = [
|
|
|
963
974
|
"screenshot",
|
|
964
975
|
"overlay_screenshot",
|
|
965
976
|
"obs_screenshot",
|
|
966
|
-
"obs_replay",
|
|
967
977
|
"obs_vertical_replay",
|
|
978
|
+
"obs_replay",
|
|
968
979
|
"get_queue_count",
|
|
969
980
|
"lumia_uptime",
|
|
970
981
|
"twitch_uptime",
|
|
@@ -979,15 +990,100 @@ var DEFAULT_FUNCTION_VARIABLES = [
|
|
|
979
990
|
"ai_prompt",
|
|
980
991
|
"viewer_profile_summary"
|
|
981
992
|
];
|
|
982
|
-
var
|
|
983
|
-
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
|
+
};
|
|
984
1077
|
var defaultTranslate = (key, fallback, options) => {
|
|
985
1078
|
if (fallback && fallback !== "-") return fallback;
|
|
986
1079
|
if (key === "overlay-variables.variables-description") return "Use variables that will automatically be replaced before sending out the text";
|
|
987
|
-
if (key === "overlay-variables.variable") return "Variable";
|
|
988
|
-
if (key === "overlay-variables.description") return "Description";
|
|
989
|
-
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";
|
|
990
1085
|
if (key === "variables.functionvariables") return "Function variables";
|
|
1086
|
+
if (key === "chatbot.allowed-variables") return "Allowed Variables";
|
|
991
1087
|
if (key.startsWith("variables.")) {
|
|
992
1088
|
const variableName = key.replace("variables.", "");
|
|
993
1089
|
const example = options?.example;
|
|
@@ -1002,6 +1098,8 @@ var normalizeAllowedDefinitions = (allowedVariables) => {
|
|
|
1002
1098
|
allowedVariables.forEach((variable) => {
|
|
1003
1099
|
let variableName = "";
|
|
1004
1100
|
let description;
|
|
1101
|
+
let origin;
|
|
1102
|
+
let example;
|
|
1005
1103
|
if (typeof variable === "string") {
|
|
1006
1104
|
variableName = variable.trim();
|
|
1007
1105
|
} else if (variable && typeof variable === "object") {
|
|
@@ -1009,13 +1107,57 @@ var normalizeAllowedDefinitions = (allowedVariables) => {
|
|
|
1009
1107
|
const candidateName = [typedVariable.name, typedVariable.key, typedVariable.variable].find((value) => typeof value === "string");
|
|
1010
1108
|
variableName = typeof candidateName === "string" ? candidateName.trim() : "";
|
|
1011
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;
|
|
1012
1112
|
}
|
|
1013
1113
|
if (!variableName || unique.has(variableName)) return;
|
|
1014
1114
|
unique.add(variableName);
|
|
1015
|
-
definitions.push({ name: variableName, description });
|
|
1115
|
+
definitions.push({ name: variableName, description, origin, example });
|
|
1016
1116
|
});
|
|
1017
1117
|
return definitions;
|
|
1018
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 "text-[var(--customVariables,#69ffd2)]";
|
|
1156
|
+
if (variableType === "func") return "text-[var(--functionVariables,#b47eea)]";
|
|
1157
|
+
if (variableType === "system") return "text-[var(--normalVariables,#69a5ff)]";
|
|
1158
|
+
return "text-[var(--customVariables,#69ffd2)]";
|
|
1159
|
+
};
|
|
1160
|
+
var CHILD_VARIABLE_COLOR_CLASS = "text-[var(--childVariables,#ffa66e)]";
|
|
1019
1161
|
var LSVariableInputField = forwardRef4((props, ref) => {
|
|
1020
1162
|
const context = useContext(LSVariableInputContext);
|
|
1021
1163
|
const {
|
|
@@ -1024,6 +1166,7 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1024
1166
|
type,
|
|
1025
1167
|
isAutoComplete,
|
|
1026
1168
|
autoCompleteOptions,
|
|
1169
|
+
autoCompleteGroupBy,
|
|
1027
1170
|
renderOption,
|
|
1028
1171
|
hideVariables,
|
|
1029
1172
|
allowedVariables,
|
|
@@ -1043,15 +1186,30 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1043
1186
|
onPopupOpen,
|
|
1044
1187
|
afterFilter,
|
|
1045
1188
|
onChange,
|
|
1189
|
+
loading,
|
|
1190
|
+
getOptionLabel,
|
|
1191
|
+
isOptionEqualToValue,
|
|
1192
|
+
$disableInputChange,
|
|
1193
|
+
$getFullValueObject,
|
|
1194
|
+
$multiple,
|
|
1195
|
+
$disableCloseOnSelect,
|
|
1196
|
+
$freeSolo,
|
|
1197
|
+
$renderOption,
|
|
1198
|
+
allowedVariableOrigin,
|
|
1046
1199
|
systemVariables: systemVariablesProp,
|
|
1047
1200
|
functionVariables: functionVariablesProp,
|
|
1048
1201
|
translate,
|
|
1049
|
-
onVariableTranslationsNeeded
|
|
1202
|
+
onVariableTranslationsNeeded,
|
|
1203
|
+
isOriginConnected: isOriginConnectedProp,
|
|
1204
|
+
translationKeyExists: translationKeyExistsProp
|
|
1050
1205
|
} = props;
|
|
1051
1206
|
const t = translate ?? context.translate ?? defaultTranslate;
|
|
1052
|
-
const
|
|
1207
|
+
const rawSystemVariables = systemVariablesProp ?? context.systemVariables ?? {};
|
|
1208
|
+
const variableRecords = useMemo3(() => normalizeVariableRecords(rawSystemVariables), [rawSystemVariables]);
|
|
1053
1209
|
const functionVariables = useMemo3(() => functionVariablesProp ?? context.functionVariables ?? DEFAULT_FUNCTION_VARIABLES, [context.functionVariables, functionVariablesProp]);
|
|
1054
1210
|
const requestTranslations = onVariableTranslationsNeeded ?? context.onVariableTranslationsNeeded;
|
|
1211
|
+
const isOriginConnected = isOriginConnectedProp ?? context.isOriginConnected;
|
|
1212
|
+
const translationKeyExists = translationKeyExistsProp ?? context.translationKeyExists;
|
|
1055
1213
|
const containerRef = useRef3(null);
|
|
1056
1214
|
const variableId = useRef3(`variable-input-${name ?? "field"}`);
|
|
1057
1215
|
const [showVariables, setShowVariables] = useState4(false);
|
|
@@ -1064,93 +1222,300 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1064
1222
|
return lookup;
|
|
1065
1223
|
}, [allowedVariableDefinitions]);
|
|
1066
1224
|
const allowedVariableNames = useMemo3(() => allowedVariableDefinitions.map((definition) => definition.name), [allowedVariableDefinitions]);
|
|
1067
|
-
const [filteredAllowedVariables, setFilteredAllowedVariables] = useState4(
|
|
1225
|
+
const [filteredAllowedVariables, setFilteredAllowedVariables] = useState4(allowedVariableDefinitions);
|
|
1068
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]);
|
|
1069
1247
|
useEffect4(() => {
|
|
1070
1248
|
requestTranslations?.();
|
|
1071
1249
|
}, [requestTranslations]);
|
|
1072
|
-
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(
|
|
1073
1315
|
(variableName) => {
|
|
1074
|
-
|
|
1075
|
-
|
|
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;
|
|
1076
1344
|
},
|
|
1077
|
-
[
|
|
1345
|
+
[allowedVariableDefinitionLookup, allowedVariableOrigin, knownOrigins, namespaceHas, variableRecords]
|
|
1078
1346
|
);
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
grouped[getVariableVisualType(variableName)].push(variableName);
|
|
1089
|
-
});
|
|
1090
|
-
return [...grouped.custom, ...grouped.func, ...grouped.system];
|
|
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);
|
|
1091
1356
|
},
|
|
1092
|
-
[
|
|
1357
|
+
[resolveTranslationFromNamespace, t]
|
|
1093
1358
|
);
|
|
1094
|
-
const
|
|
1095
|
-
(
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
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);
|
|
1365
|
+
},
|
|
1366
|
+
[resolveVariableDescription, t]
|
|
1367
|
+
);
|
|
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]
|
|
1100
1378
|
);
|
|
1101
1379
|
const getAllowedVariableDescription = useCallback2(
|
|
1102
1380
|
(variableName) => {
|
|
1103
|
-
const
|
|
1104
|
-
if (
|
|
1105
|
-
const
|
|
1106
|
-
const
|
|
1107
|
-
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);
|
|
1108
1386
|
},
|
|
1109
|
-
[allowedVariableDefinitionLookup,
|
|
1387
|
+
[allowedVariableDefinitionLookup, getSystemVariableDescription, resolveAllowedVariableOrigin, resolveVariableDescription, variableRecords]
|
|
1110
1388
|
);
|
|
1111
|
-
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(() => {
|
|
1112
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
|
+
};
|
|
1113
1441
|
if (allowedVariableNames.length > 0) {
|
|
1114
1442
|
if (!query) {
|
|
1115
|
-
setFilteredAllowedVariables(
|
|
1443
|
+
setFilteredAllowedVariables(orderItemsByVariableType(allowedVariableDefinitions, (definition) => getAllowedVariableVisualType(definition.name)));
|
|
1116
1444
|
} else {
|
|
1117
1445
|
const nameMatches = [];
|
|
1118
1446
|
const descMatches = [];
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1123
|
-
|
|
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
|
+
}
|
|
1124
1463
|
});
|
|
1125
|
-
|
|
1464
|
+
const sortByDef = (items) => sortItemsByVariableTypeThenName(items, (definition) => getAllowedVariableVisualType(definition.name), (definition) => definition.name);
|
|
1465
|
+
setFilteredAllowedVariables([...sortByDef(nameMatches), ...sortByDef(descMatches), ...sortByDef(nestedMatches)]);
|
|
1126
1466
|
}
|
|
1127
1467
|
} else {
|
|
1128
1468
|
setFilteredAllowedVariables([]);
|
|
1129
1469
|
}
|
|
1130
|
-
const
|
|
1131
|
-
const
|
|
1132
|
-
|
|
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);
|
|
1133
1478
|
if (!query) {
|
|
1134
|
-
|
|
1479
|
+
const visible = allRecords.filter(shouldKeep);
|
|
1480
|
+
setFilteredSystemVariables(orderItemsByVariableType(visible, (variable) => visualTypeFromRecord(variable)));
|
|
1135
1481
|
} else {
|
|
1136
1482
|
const nameMatches = [];
|
|
1137
1483
|
const descMatches = [];
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
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
|
+
}
|
|
1147
1502
|
});
|
|
1148
|
-
|
|
1503
|
+
const sortSys = (items) => sortItemsByVariableTypeThenName(items, (variable) => visualTypeFromRecord(variable), (variable) => variable?.name ?? "");
|
|
1504
|
+
setFilteredSystemVariables([...sortSys(nameMatches), ...sortSys(descMatches), ...sortSys(nestedMatches)]);
|
|
1149
1505
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
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
|
+
]);
|
|
1154
1519
|
const clickedVariableIcon = () => {
|
|
1155
1520
|
if (!hideVariables) setShowVariables((current) => !current);
|
|
1156
1521
|
};
|
|
@@ -1160,25 +1525,218 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1160
1525
|
};
|
|
1161
1526
|
const insertVariable = (variable) => {
|
|
1162
1527
|
appendValue(`{{${variable}}}`);
|
|
1528
|
+
setShowVariables(false);
|
|
1163
1529
|
};
|
|
1164
|
-
const getVariableColorClass = (variableType, isSuggested = false) => {
|
|
1165
|
-
if (isSuggested && variableType !== "func") return "text-[var(--customVariables,#69ffd2)]";
|
|
1166
|
-
if (variableType === "func") return "text-[var(--functionVariables,var(--semanticPurple,#b489ff))]";
|
|
1167
|
-
if (variableType === "system") return "text-[var(--normalVariables,var(--semanticBlue,#65b8ff))]";
|
|
1168
|
-
return "text-[var(--customVariables,#69ffd2)]";
|
|
1169
|
-
};
|
|
1170
|
-
const renderVariableToken = (variableName, variableType, isSuggested = false) => /* @__PURE__ */ jsxs5("div", { className: `flex min-w-0 items-center ${getVariableColorClass(variableType, isSuggested)}`, children: [
|
|
1171
|
-
/* @__PURE__ */ jsx11("span", { className: "min-w-0 break-all", children: `{{${variableName}}}` }),
|
|
1172
|
-
variableType === "func" && /* @__PURE__ */ jsx11("span", { className: "ml-2 inline-flex shrink-0 items-center rounded border border-current px-1 py-0 text-[10px] font-semibold uppercase leading-none", title: t("variables.functionvariables", "Function variables"), children: "fx" })
|
|
1173
|
-
] });
|
|
1174
1530
|
const handleFilterOptions = (options, params) => {
|
|
1175
1531
|
const filtered = filter(options, params);
|
|
1176
1532
|
afterFilter?.(filtered);
|
|
1177
1533
|
return filtered;
|
|
1178
1534
|
};
|
|
1535
|
+
const renderVariableToken = (variableName, variableType, isSuggested = false) => /* @__PURE__ */ jsxs5("div", { className: `flex min-w-0 items-center ${getVariableColorClass(variableType, isSuggested)}`, children: [
|
|
1536
|
+
/* @__PURE__ */ jsx11("span", { className: "min-w-0 break-all", children: `{{${variableName}}}` }),
|
|
1537
|
+
variableType === "func" && /* @__PURE__ */ jsx11(
|
|
1538
|
+
"span",
|
|
1539
|
+
{
|
|
1540
|
+
className: "ml-2 inline-flex shrink-0 items-center rounded border border-current px-1 py-[1px] text-[10px] font-semibold leading-none uppercase",
|
|
1541
|
+
title: t("variables.functionvariables", "Function variables"),
|
|
1542
|
+
children: "fx"
|
|
1543
|
+
}
|
|
1544
|
+
)
|
|
1545
|
+
] });
|
|
1546
|
+
const renderExpandToggle = (path, expanded) => /* @__PURE__ */ jsx11(
|
|
1547
|
+
"button",
|
|
1548
|
+
{
|
|
1549
|
+
type: "button",
|
|
1550
|
+
onClick: (e) => {
|
|
1551
|
+
e.stopPropagation();
|
|
1552
|
+
toggleExpand(path);
|
|
1553
|
+
},
|
|
1554
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded border-0 bg-transparent p-0 text-[var(--neutralLight2,#cac9d5)] hover:bg-[var(--neutralDark4,#393853)]/50",
|
|
1555
|
+
"aria-label": expanded ? "Collapse" : "Expand",
|
|
1556
|
+
"aria-expanded": expanded,
|
|
1557
|
+
children: /* @__PURE__ */ jsx11(
|
|
1558
|
+
ArrowRight,
|
|
1559
|
+
{
|
|
1560
|
+
style: {
|
|
1561
|
+
width: 14,
|
|
1562
|
+
height: 14,
|
|
1563
|
+
transform: expanded ? "rotate(90deg)" : "none",
|
|
1564
|
+
transition: "transform 0.15s ease"
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
)
|
|
1568
|
+
}
|
|
1569
|
+
);
|
|
1570
|
+
const renderExpandSpacer = () => /* @__PURE__ */ jsx11("span", { className: "inline-block h-5 w-5 shrink-0", "aria-hidden": true });
|
|
1571
|
+
const getVariableValuePreview = (variableValue) => {
|
|
1572
|
+
const { displayValue, fullValue } = getVariableValueDisplay(variableValue);
|
|
1573
|
+
return { displayValue, fullValue };
|
|
1574
|
+
};
|
|
1575
|
+
const renderValueChildRows = (rootToken, nodes) => nodes.map((node) => {
|
|
1576
|
+
const fullToken = `${rootToken}.${node.relativePath}`;
|
|
1577
|
+
const expanded = node.isExpandable && isPathExpanded(fullToken);
|
|
1578
|
+
const { displayValue, fullValue } = getVariableValuePreview(node.value);
|
|
1579
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1580
|
+
/* @__PURE__ */ jsxs5(
|
|
1581
|
+
"div",
|
|
1582
|
+
{
|
|
1583
|
+
className: "grid min-w-0 cursor-pointer grid-cols-[minmax(260px,1.5fr)_2fr_minmax(140px,1fr)] gap-4 border-b border-[var(--neutralDark4,#393853)] pb-2 pt-2 last-of-type:border-b-0 active:opacity-80",
|
|
1584
|
+
onClick: () => {
|
|
1585
|
+
if (node.isExpandable && !expanded) toggleExpand(fullToken);
|
|
1586
|
+
else insertVariable(fullToken);
|
|
1587
|
+
},
|
|
1588
|
+
children: [
|
|
1589
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 items-center gap-1", style: { paddingLeft: `${node.depth * 1.25}rem` }, children: [
|
|
1590
|
+
node.isExpandable ? renderExpandToggle(fullToken, expanded) : renderExpandSpacer(),
|
|
1591
|
+
/* @__PURE__ */ jsx11("div", { className: `flex min-w-0 items-center ${CHILD_VARIABLE_COLOR_CLASS}`, children: /* @__PURE__ */ jsx11("span", { className: "min-w-0 break-all", children: `{{${fullToken}}}` }) })
|
|
1592
|
+
] }),
|
|
1593
|
+
/* @__PURE__ */ jsx11("div", { className: "max-w-[600px] min-w-0 break-words", children: node.displayKey }),
|
|
1594
|
+
/* @__PURE__ */ jsx11("div", { className: "ellipse-1 min-w-0 text-[var(--neutralLight2,#cac9d5)]", title: fullValue, children: displayValue })
|
|
1595
|
+
]
|
|
1596
|
+
}
|
|
1597
|
+
),
|
|
1598
|
+
expanded && renderValueChildRows(rootToken, node.children)
|
|
1599
|
+
] }, fullToken);
|
|
1600
|
+
});
|
|
1601
|
+
const toOptionLabelString = (input) => {
|
|
1602
|
+
if (typeof input === "string") return input;
|
|
1603
|
+
if (typeof input === "number" || typeof input === "boolean" || typeof input === "bigint") return String(input);
|
|
1604
|
+
if (input === null || input === void 0) return "";
|
|
1605
|
+
if (typeof input === "object") {
|
|
1606
|
+
const labelCandidate = input.label;
|
|
1607
|
+
if (typeof labelCandidate === "string") return labelCandidate;
|
|
1608
|
+
if (typeof labelCandidate === "number" || typeof labelCandidate === "boolean" || typeof labelCandidate === "bigint") return String(labelCandidate);
|
|
1609
|
+
const valueCandidate = input.value;
|
|
1610
|
+
if (typeof valueCandidate === "string") return valueCandidate;
|
|
1611
|
+
if (typeof valueCandidate === "number" || typeof valueCandidate === "boolean" || typeof valueCandidate === "bigint") return String(valueCandidate);
|
|
1612
|
+
try {
|
|
1613
|
+
return JSON.stringify(input);
|
|
1614
|
+
} catch {
|
|
1615
|
+
return "[object Object]";
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
return String(input);
|
|
1619
|
+
};
|
|
1620
|
+
const resolveOptionLabel = (option) => {
|
|
1621
|
+
if (typeof getOptionLabel === "function") {
|
|
1622
|
+
try {
|
|
1623
|
+
const customLabel = getOptionLabel(option);
|
|
1624
|
+
return toOptionLabelString(customLabel === void 0 ? option : customLabel);
|
|
1625
|
+
} catch {
|
|
1626
|
+
return toOptionLabelString(option);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
return toOptionLabelString(option);
|
|
1630
|
+
};
|
|
1631
|
+
const defaultRenderOption = (optionProps, option) => {
|
|
1632
|
+
const opt = option;
|
|
1633
|
+
const thumb = opt?.imageUrl ?? opt?.thumb ?? opt?.iconUrl ?? opt?.previewImageUrl;
|
|
1634
|
+
const helperText = typeof opt?.helperText === "string" ? opt.helperText : "";
|
|
1635
|
+
const isSelected = opt?.value === value;
|
|
1636
|
+
return /* @__PURE__ */ createElement(
|
|
1637
|
+
"li",
|
|
1638
|
+
{
|
|
1639
|
+
...optionProps,
|
|
1640
|
+
key: String(opt?.label ?? opt?.value ?? ""),
|
|
1641
|
+
className: `flex items-center gap-2 px-3 py-2 cursor-pointer ${isSelected ? "bg-[var(--primary)]/10 hover:bg-[var(--primary)]/20" : "hover:bg-[var(--neutralDark2,#1f1d36)]/40"}`
|
|
1642
|
+
},
|
|
1643
|
+
thumb ? /* @__PURE__ */ jsx11("img", { src: thumb, className: "h-8 w-8 rounded object-cover shrink-0", alt: "" }) : /* @__PURE__ */ jsx11("span", { className: "inline-block h-8 w-8 shrink-0" }),
|
|
1644
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1", children: [
|
|
1645
|
+
/* @__PURE__ */ jsx11("div", { className: "ellipse-1", children: resolveOptionLabel(opt) }),
|
|
1646
|
+
helperText ? /* @__PURE__ */ jsx11("div", { className: "ellipse-1 text-xs text-[var(--neutralLight3,#9392a1)]", children: helperText }) : null
|
|
1647
|
+
] })
|
|
1648
|
+
);
|
|
1649
|
+
};
|
|
1650
|
+
const showSuggestedSection = allowedVariableNames.length > 0 && filteredAllowedVariables.length > 0;
|
|
1651
|
+
const pickerBody = /* @__PURE__ */ jsxs5("div", { className: "flex max-h-[55vh] min-h-[50vh] w-[92vw] max-w-[1100px] flex-col overflow-hidden p-2", children: [
|
|
1652
|
+
/* @__PURE__ */ jsxs5("div", { className: "mb-2 text-[var(--neutralLight2,#cac9d5)]", children: [
|
|
1653
|
+
/* @__PURE__ */ jsx11("div", { className: "text-sm", children: t("overlay-variables.variables-description", "Use variables that will automatically be replaced before sending out the text") }),
|
|
1654
|
+
/* @__PURE__ */ jsx11(
|
|
1655
|
+
LSInput,
|
|
1656
|
+
{
|
|
1657
|
+
autoFocus: true,
|
|
1658
|
+
startAdornment: /* @__PURE__ */ jsx11(Search, { style: { width: 18, height: 18 } }),
|
|
1659
|
+
placeholder: t("common.search", "Search"),
|
|
1660
|
+
value: searchQuery,
|
|
1661
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
1662
|
+
type: "text",
|
|
1663
|
+
style: { padding: "1rem 0 0" }
|
|
1664
|
+
}
|
|
1665
|
+
)
|
|
1666
|
+
] }),
|
|
1667
|
+
/* @__PURE__ */ jsxs5("div", { className: "mb-1 grid grid-cols-[minmax(260px,1.5fr)_2fr_minmax(140px,1fr)] text-sm text-[var(--neutralLight3,#9392a1)]", children: [
|
|
1668
|
+
/* @__PURE__ */ jsx11("div", { children: t("commands.variable", "Variable") }),
|
|
1669
|
+
/* @__PURE__ */ jsx11("div", { children: t("commands.description", "Description") }),
|
|
1670
|
+
/* @__PURE__ */ jsx11("div", { children: t("common.value", "Value") })
|
|
1671
|
+
] }),
|
|
1672
|
+
/* @__PURE__ */ jsxs5("div", { className: "h-full overflow-auto pr-4", children: [
|
|
1673
|
+
showSuggestedSection && /* @__PURE__ */ jsxs5("fieldset", { className: "m-0 mb-2 w-full rounded-sm border-2 border-solid border-[var(--neutralDark4,#393853)] px-2 pb-0 pt-0", children: [
|
|
1674
|
+
/* @__PURE__ */ jsx11("legend", { className: "flex items-center justify-center gap-2 px-2 text-sm text-[var(--neutralLight2,#cac9d5)]", children: t("commands.suggested-variables", "Suggested Variables") }),
|
|
1675
|
+
filteredAllowedVariables.map((definition, idx) => {
|
|
1676
|
+
const variableType = getAllowedVariableVisualType(definition.name);
|
|
1677
|
+
const tree = getAllowedVariableTree(definition);
|
|
1678
|
+
const { displayValue, fullValue } = getVariableValuePreview(getAllowedVariableValue(definition.name) ?? definition.example);
|
|
1679
|
+
const expandable = !!tree && tree.length > 0;
|
|
1680
|
+
const expanded = expandable && isPathExpanded(definition.name);
|
|
1681
|
+
const isLast = idx === filteredAllowedVariables.length - 1;
|
|
1682
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1683
|
+
/* @__PURE__ */ jsxs5(
|
|
1684
|
+
"div",
|
|
1685
|
+
{
|
|
1686
|
+
className: `grid min-w-0 cursor-pointer grid-cols-[minmax(260px,1.5fr)_2fr_minmax(140px,1fr)] gap-4 border-b ${isLast && !expanded ? "border-b-0" : "border-b-[var(--neutralDark4,#393853)]"} pb-2 pt-2 active:opacity-80`,
|
|
1687
|
+
onClick: () => {
|
|
1688
|
+
if (expandable && !expanded) toggleExpand(definition.name);
|
|
1689
|
+
else insertVariable(definition.name);
|
|
1690
|
+
},
|
|
1691
|
+
children: [
|
|
1692
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 items-center gap-1", children: [
|
|
1693
|
+
expandable ? renderExpandToggle(definition.name, expanded) : renderExpandSpacer(),
|
|
1694
|
+
renderVariableToken(definition.name, variableType, true)
|
|
1695
|
+
] }),
|
|
1696
|
+
/* @__PURE__ */ jsx11("div", { className: "max-w-[600px] min-w-0 break-words", children: getAllowedVariableDescription(definition.name) }),
|
|
1697
|
+
/* @__PURE__ */ jsx11("div", { className: "ellipse-1 min-w-0 text-[var(--neutralLight2,#cac9d5)]", title: fullValue, children: displayValue })
|
|
1698
|
+
]
|
|
1699
|
+
}
|
|
1700
|
+
),
|
|
1701
|
+
expanded && tree && renderValueChildRows(definition.name, tree)
|
|
1702
|
+
] }, definition.name);
|
|
1703
|
+
})
|
|
1704
|
+
] }),
|
|
1705
|
+
filteredSystemVariables?.map((variable) => {
|
|
1706
|
+
const variableType = visualTypeFromRecord(variable);
|
|
1707
|
+
const { displayValue, fullValue } = getVariableValuePreview(variable.value);
|
|
1708
|
+
const rootToken = variable.example ?? variable.name;
|
|
1709
|
+
const tree = systemVariableValueTrees.get(variable.name);
|
|
1710
|
+
const expandable = !!tree && tree.length > 0;
|
|
1711
|
+
const expanded = expandable && isPathExpanded(rootToken);
|
|
1712
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1713
|
+
/* @__PURE__ */ jsxs5(
|
|
1714
|
+
"div",
|
|
1715
|
+
{
|
|
1716
|
+
className: "grid min-w-0 cursor-pointer grid-cols-[minmax(260px,1.5fr)_2fr_minmax(140px,1fr)] gap-4 border-b border-[var(--neutralDark4,#393853)] pb-2 pt-2 last-of-type:border-b-0 active:opacity-80",
|
|
1717
|
+
onClick: () => {
|
|
1718
|
+
if (expandable && !expanded) toggleExpand(rootToken);
|
|
1719
|
+
else insertVariable(rootToken);
|
|
1720
|
+
},
|
|
1721
|
+
children: [
|
|
1722
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 items-center gap-1", children: [
|
|
1723
|
+
expandable ? renderExpandToggle(rootToken, expanded) : renderExpandSpacer(),
|
|
1724
|
+
renderVariableToken(variable.name, variableType)
|
|
1725
|
+
] }),
|
|
1726
|
+
/* @__PURE__ */ jsx11("div", { className: "max-w-[600px] min-w-0 break-words", children: getSystemVariableDescription(variable) }),
|
|
1727
|
+
/* @__PURE__ */ jsx11("div", { className: "ellipse-1 min-w-0 text-[var(--neutralLight2,#cac9d5)]", title: fullValue, children: displayValue })
|
|
1728
|
+
]
|
|
1729
|
+
}
|
|
1730
|
+
),
|
|
1731
|
+
expanded && tree && renderValueChildRows(rootToken, tree)
|
|
1732
|
+
] }, variable.name);
|
|
1733
|
+
})
|
|
1734
|
+
] })
|
|
1735
|
+
] });
|
|
1179
1736
|
const textField = (params = {}) => /* @__PURE__ */ jsx11(
|
|
1180
1737
|
VariableInputTextField,
|
|
1181
1738
|
{
|
|
1739
|
+
t,
|
|
1182
1740
|
params,
|
|
1183
1741
|
id: variableId.current,
|
|
1184
1742
|
containerRef,
|
|
@@ -1193,19 +1751,21 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1193
1751
|
rows,
|
|
1194
1752
|
maxRows,
|
|
1195
1753
|
value,
|
|
1196
|
-
onChange,
|
|
1754
|
+
onChange: $disableInputChange ? void 0 : onChange,
|
|
1197
1755
|
clickedVariableIcon,
|
|
1198
1756
|
inputProps,
|
|
1757
|
+
allowedVariables,
|
|
1758
|
+
showVariableIcon: !hideVariables,
|
|
1199
1759
|
ref
|
|
1200
1760
|
}
|
|
1201
1761
|
);
|
|
1202
|
-
return /* @__PURE__ */ jsxs5(
|
|
1762
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1203
1763
|
/* @__PURE__ */ jsx11(
|
|
1204
1764
|
Popover,
|
|
1205
1765
|
{
|
|
1206
1766
|
anchorEl: containerRef.current,
|
|
1207
|
-
anchorOrigin: { vertical: "bottom", horizontal: "
|
|
1208
|
-
transformOrigin: { vertical: "top", horizontal: "
|
|
1767
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1768
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
1209
1769
|
open: !hideVariables && showVariables,
|
|
1210
1770
|
onClose: clickedVariableIcon,
|
|
1211
1771
|
slotProps: {
|
|
@@ -1213,58 +1773,59 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1213
1773
|
sx: {
|
|
1214
1774
|
color: "var(--neutralLight2, #cac9d5)",
|
|
1215
1775
|
backgroundColor: "var(--neutralDark1, #171628)",
|
|
1216
|
-
padding
|
|
1776
|
+
// Paper has no padding of its own — the picker body's `p-2` is the
|
|
1777
|
+
// single source of internal spacing. Adding paper padding on top of
|
|
1778
|
+
// that compounds the inset and forces premature horizontal scroll.
|
|
1779
|
+
padding: 0,
|
|
1217
1780
|
border: "1px solid var(--neutralDark4, #393853)"
|
|
1218
1781
|
}
|
|
1219
1782
|
}
|
|
1220
1783
|
},
|
|
1221
|
-
children:
|
|
1222
|
-
/* @__PURE__ */ jsxs5("div", { className: "mb-4 text-[var(--neutralLight2,#cac9d5)]", children: [
|
|
1223
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.variables-description", "Use variables that will automatically be replaced before sending out the text") }),
|
|
1224
|
-
/* @__PURE__ */ jsx11(
|
|
1225
|
-
LSInput,
|
|
1226
|
-
{
|
|
1227
|
-
autoFocus: true,
|
|
1228
|
-
startAdornment: /* @__PURE__ */ jsx11(Search, { style: { width: 18, height: 18 } }),
|
|
1229
|
-
placeholder: t("assets.search", "Search"),
|
|
1230
|
-
value: searchQuery,
|
|
1231
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
1232
|
-
type: "text",
|
|
1233
|
-
style: { padding: "1rem 0 0" }
|
|
1234
|
-
}
|
|
1235
|
-
)
|
|
1236
|
-
] }),
|
|
1237
|
-
/* @__PURE__ */ jsxs5("div", { className: "mb-1 grid grid-cols-[minmax(300px,1.5fr)_2fr] gap-8 px-1 text-[var(--neutralLight3,#9392a1)]", children: [
|
|
1238
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.variable", "Variable") }),
|
|
1239
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.description", "Description") })
|
|
1240
|
-
] }),
|
|
1241
|
-
/* @__PURE__ */ jsxs5("div", { className: "h-full overflow-auto pr-4", children: [
|
|
1242
|
-
allowedVariableNames.length > 0 && filteredAllowedVariables?.map((variableName) => /* @__PURE__ */ jsxs5("div", { className: "grid cursor-pointer grid-cols-[minmax(300px,1.5fr)_2fr] items-start gap-8 border-b border-white/10 px-1 py-4 active:opacity-80", onClick: () => insertVariable(variableName), children: [
|
|
1243
|
-
renderVariableToken(variableName, getVariableVisualType(variableName), true),
|
|
1244
|
-
/* @__PURE__ */ jsx11("div", { className: "max-w-[600px] break-words leading-[1.25]", children: getAllowedVariableDescription(variableName) })
|
|
1245
|
-
] }, variableName)),
|
|
1246
|
-
filteredSystemVariables?.map((variableKey) => /* @__PURE__ */ jsxs5("div", { className: "grid cursor-pointer grid-cols-[minmax(300px,1.5fr)_2fr] items-start gap-8 border-b border-white/10 px-1 py-4 active:opacity-80", onClick: () => insertVariable(variableKey), children: [
|
|
1247
|
-
renderVariableToken(variableKey, getVariableVisualType(variableKey)),
|
|
1248
|
-
/* @__PURE__ */ jsx11("div", { className: "max-w-[600px] break-words leading-[1.25]", children: t(`variables.${variableKey}`, "-", { example: systemVariables?.[variableKey], interpolation: { escapeValue: false, prefix: "{{{", suffix: "}}}" } }) })
|
|
1249
|
-
] }, variableKey))
|
|
1250
|
-
] })
|
|
1251
|
-
] })
|
|
1784
|
+
children: pickerBody
|
|
1252
1785
|
}
|
|
1253
1786
|
),
|
|
1254
1787
|
isAutoComplete ? /* @__PURE__ */ jsx11(
|
|
1255
1788
|
Autocomplete2,
|
|
1256
1789
|
{
|
|
1257
1790
|
disableClearable: true,
|
|
1258
|
-
|
|
1791
|
+
openOnFocus: true,
|
|
1259
1792
|
includeInputInList: true,
|
|
1260
|
-
|
|
1261
|
-
|
|
1793
|
+
multiple: $multiple,
|
|
1794
|
+
freeSolo: $freeSolo,
|
|
1795
|
+
disableCloseOnSelect: $disableCloseOnSelect,
|
|
1796
|
+
groupBy: autoCompleteGroupBy,
|
|
1262
1797
|
options: autoCompleteOptions ?? [],
|
|
1798
|
+
isOptionEqualToValue,
|
|
1263
1799
|
value,
|
|
1264
|
-
|
|
1265
|
-
|
|
1800
|
+
disabled,
|
|
1801
|
+
loading,
|
|
1802
|
+
getOptionLabel: resolveOptionLabel,
|
|
1803
|
+
onChange: (_e, nextValue) => {
|
|
1804
|
+
if ($getFullValueObject) {
|
|
1805
|
+
onChange?.(nextValue);
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
if ($multiple) {
|
|
1809
|
+
const list = Array.isArray(nextValue) ? nextValue : nextValue ? [nextValue] : [];
|
|
1810
|
+
const mapped = list.map((entry) => {
|
|
1811
|
+
if (entry && typeof entry === "object" && "value" in entry) {
|
|
1812
|
+
return entry.value;
|
|
1813
|
+
}
|
|
1814
|
+
return entry;
|
|
1815
|
+
});
|
|
1816
|
+
onChange?.(mapped);
|
|
1817
|
+
return;
|
|
1818
|
+
}
|
|
1819
|
+
if (nextValue && typeof nextValue === "object" && "value" in nextValue) {
|
|
1820
|
+
onChange?.(nextValue.value);
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
onChange?.(nextValue);
|
|
1824
|
+
},
|
|
1825
|
+
onInputChange: $disableInputChange ? void 0 : (_e, nextValue) => onChange?.(nextValue),
|
|
1266
1826
|
filterOptions: handleFilterOptions,
|
|
1267
|
-
|
|
1827
|
+
renderOption: $renderOption ?? renderOption ?? defaultRenderOption,
|
|
1828
|
+
slots: ListboxComponent ? { listbox: ListboxComponent } : void 0,
|
|
1268
1829
|
slotProps: { listbox: { onScroll: onScrollListBox } },
|
|
1269
1830
|
onHighlightChange,
|
|
1270
1831
|
onOpen: onPopupOpen,
|
|
@@ -1276,7 +1837,33 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1276
1837
|
});
|
|
1277
1838
|
LSVariableInputField.displayName = "LSVariableInputField";
|
|
1278
1839
|
var VariableInputTextField = forwardRef4(
|
|
1279
|
-
({
|
|
1840
|
+
({
|
|
1841
|
+
t,
|
|
1842
|
+
id,
|
|
1843
|
+
name,
|
|
1844
|
+
label,
|
|
1845
|
+
type,
|
|
1846
|
+
variant,
|
|
1847
|
+
disabled,
|
|
1848
|
+
autoFocus,
|
|
1849
|
+
multiline,
|
|
1850
|
+
placeholder,
|
|
1851
|
+
rows,
|
|
1852
|
+
maxRows,
|
|
1853
|
+
value,
|
|
1854
|
+
onChange,
|
|
1855
|
+
inputProps,
|
|
1856
|
+
clickedVariableIcon,
|
|
1857
|
+
params = {},
|
|
1858
|
+
containerRef,
|
|
1859
|
+
showVariableIcon
|
|
1860
|
+
}, ref) => {
|
|
1861
|
+
const inputPropsInputProps = inputProps?.InputProps ?? {};
|
|
1862
|
+
const paramsInputProps = params?.InputProps ?? {};
|
|
1863
|
+
const inputPropsSlotInputProps = inputProps?.slotProps?.input ?? {};
|
|
1864
|
+
const paramsSlotInputProps = params?.slotProps?.input ?? {};
|
|
1865
|
+
const startAdornment = paramsInputProps.startAdornment ?? paramsSlotInputProps.startAdornment ?? inputPropsInputProps.startAdornment ?? inputPropsSlotInputProps.startAdornment;
|
|
1866
|
+
const endAdornment = paramsInputProps.endAdornment ?? paramsSlotInputProps.endAdornment ?? inputPropsInputProps.endAdornment ?? inputPropsSlotInputProps.endAdornment;
|
|
1280
1867
|
return /* @__PURE__ */ jsx11(
|
|
1281
1868
|
LSTextField,
|
|
1282
1869
|
{
|
|
@@ -1295,21 +1882,23 @@ var VariableInputTextField = forwardRef4(
|
|
|
1295
1882
|
value,
|
|
1296
1883
|
fullWidth: true,
|
|
1297
1884
|
className: `mui-ls-input noMinHeight ${params?.className ?? ""} ${inputProps?.className ?? ""}`.trim(),
|
|
1298
|
-
onChange: (e) => onChange
|
|
1885
|
+
onChange: onChange ? ((e) => onChange(e.target.value)) : void 0,
|
|
1299
1886
|
...inputProps,
|
|
1300
1887
|
...params,
|
|
1301
1888
|
InputProps: {
|
|
1302
|
-
...
|
|
1303
|
-
...
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1889
|
+
...inputPropsSlotInputProps,
|
|
1890
|
+
...inputPropsInputProps,
|
|
1891
|
+
...paramsSlotInputProps,
|
|
1892
|
+
...paramsInputProps,
|
|
1893
|
+
startAdornment,
|
|
1894
|
+
endAdornment: /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1895
|
+
endAdornment ?? null,
|
|
1896
|
+
showVariableIcon ? /* @__PURE__ */ jsx11(Tooltip, { title: t("chatbot.allowed-variables", "Allowed Variables"), children: /* @__PURE__ */ jsx11(
|
|
1307
1897
|
InputAdornment2,
|
|
1308
1898
|
{
|
|
1309
1899
|
position: "end",
|
|
1310
1900
|
onClick: clickedVariableIcon,
|
|
1311
1901
|
ref: containerRef,
|
|
1312
|
-
className: "cursor-pointer",
|
|
1313
1902
|
sx: {
|
|
1314
1903
|
cursor: "pointer",
|
|
1315
1904
|
background: "var(--primary)",
|
|
@@ -1328,12 +1917,12 @@ var VariableInputTextField = forwardRef4(
|
|
|
1328
1917
|
color: "var(--neutralDark1)"
|
|
1329
1918
|
}
|
|
1330
1919
|
},
|
|
1331
|
-
children: "{}"
|
|
1920
|
+
children: /* @__PURE__ */ jsx11("span", { className: "font-bold", children: "{}" })
|
|
1332
1921
|
}
|
|
1333
|
-
)
|
|
1922
|
+
) }) : null
|
|
1334
1923
|
] })
|
|
1335
1924
|
},
|
|
1336
|
-
ref
|
|
1925
|
+
inputRef: ref
|
|
1337
1926
|
}
|
|
1338
1927
|
);
|
|
1339
1928
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumiastream/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4-beta.1",
|
|
4
4
|
"author": "Lumia Stream",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Lumia UI Kit",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@emotion/react": "^11.14.0",
|
|
54
54
|
"@emotion/styled": "^11.14.1",
|
|
55
|
-
"@lumiastream/lumia-translations": "1.15.
|
|
55
|
+
"@lumiastream/lumia-translations": "1.15.4",
|
|
56
56
|
"@lumiastream/lumia-types": "^3.2.7",
|
|
57
57
|
"@mui/icons-material": "^9.0.0",
|
|
58
58
|
"@mui/material": "^9.0.0",
|