@scbt-ecom/ui 0.166.0 → 0.167.0
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/lib/exports/utils.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/SliderAlgorithmic.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/hooks/useSliderAlgorithmic.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/hooks/useSliderAlgorithmic.js.map +1 -1
- package/dist/lib/shared/utils/index.js +1 -1
- package/dist/lib/shared/utils/variableHolder/variableContextHolder.js.map +1 -1
- package/dist/lib/shared/utils/variables/variableResolver.js.map +1 -1
- package/dist/lib/shared/utils/variablesFork/VariablesFork.js.map +1 -0
- package/dist/lib/widgets/calculator/CalculatorView.js +1 -1
- package/dist/lib/widgets/calculator/CalculatorView.js.map +1 -1
- package/dist/lib/widgets/calculator/model/helpers.js +1 -1
- package/dist/lib/widgets/calculator/model/helpers.js.map +1 -1
- package/dist/lib/widgets/calculator/model/index.js +1 -1
- package/dist/lib/widgets/calculator/model/utils.js +1 -1
- package/dist/lib/widgets/calculator/model/utils.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorFields/CalculatorFields.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/CalculatorInfo.js +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/CalculatorInfo.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/CalculatedBlock.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoBody.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/InfoListItem.js.map +1 -1
- package/dist/lib/widgets/model/helpers.js +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/defineProperty.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/iterableToArray.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/objectSpread2.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/slicedToArray.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/typeof.js.map +1 -1
- package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js.map +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/Handles/Handle.js +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/Handles/index.js +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/Marks/Mark.js +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/Slider.js +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/Steps/Dot.js +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/Tracks/Track.js +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/Tracks/index.js +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/hooks/useDrag.js +1 -1
- package/dist/node_modules/.pnpm/rc-slider@11.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-slider/es/hooks/useOffset.js +1 -1
- package/dist/node_modules/.pnpm/rc-util@5.44.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-util/es/hooks/useMergedState.js +1 -1
- package/dist/node_modules/.pnpm/rc-util@5.44.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-util/es/hooks/useState.js +1 -1
- package/dist/node_modules/.pnpm/rc-util@5.44.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-util/es/isEqual.js +1 -1
- package/dist/stats.html +1 -1
- package/dist/types/lib/shared/utils/index.d.ts +1 -0
- package/dist/types/lib/shared/utils/variableHolder/variableContextHolder.d.ts +3 -0
- package/dist/types/lib/shared/utils/variables/variableResolver.d.ts +4 -3
- package/dist/types/lib/shared/utils/{variablesByNikita → variablesFork}/VariablesFork.d.ts +4 -4
- package/dist/types/lib/shared/utils/variablesFork/index.d.ts +1 -0
- package/dist/types/lib/widgets/calculator/model/helpers.d.ts +2 -2
- package/dist/types/lib/widgets/calculator/model/types.d.ts +1 -4
- package/dist/types/lib/widgets/calculator/model/utils.d.ts +1 -2
- package/dist/types/lib/widgets/calculator/ui/calculatorInfo/CalculatorInfo.d.ts +1 -1
- package/dist/types/lib/widgets/calculator/ui/calculatorInfo/ui/CalculatedBlock.d.ts +3 -2
- package/dist/types/lib/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoBody.d.ts +2 -2
- package/dist/types/lib/widgets/calculator/ui/calculatorInfo/ui/InfoListItem.d.ts +5 -9
- package/package.json +1 -1
- package/dist/lib/shared/utils/variablesByNikita/VariablesFork.js.map +0 -1
- package/dist/types/lib/shared/utils/variablesByNikita/index.d.ts +0 -1
- /package/dist/lib/shared/utils/{variablesByNikita → variablesFork}/VariablesFork.js +0 -0
- /package/dist/lib/shared/utils/{variablesByNikita → variablesFork}/index.js +0 -0
- /package/dist/lib/shared/utils/{variablesByNikita → variablesFork}/index.js.map +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/extends.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -0
- /package/dist/node_modules/.pnpm/{@babel_runtime@7.28.4 → @babel_runtime@7.28.6}/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -0
|
@@ -152,6 +152,9 @@ export interface VariableStore {
|
|
|
152
152
|
* const processedString = transformVariable(stringWithVariables)
|
|
153
153
|
* ```
|
|
154
154
|
*/
|
|
155
|
+
/**
|
|
156
|
+
* @deprecated dont use
|
|
157
|
+
*/
|
|
155
158
|
export declare class VariableContextHolder<Key extends string = string, Value = string> implements IVariableContextHolder<Key, Value> {
|
|
156
159
|
private _store;
|
|
157
160
|
private _variables;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AllowedVariablePrefix, Resolved, VariablePattern, VariableType } from './types';
|
|
2
2
|
export declare const defaultAllowedPrefixes: AllowedVariablePrefix[];
|
|
3
|
-
export
|
|
4
|
-
addPattern: (start: VariablePattern[
|
|
5
|
-
addVariables: (vars: Variable[]) =>
|
|
3
|
+
export type VariableResolver<Variable extends VariableType> = {
|
|
4
|
+
addPattern: (start: VariablePattern['start'], end: VariablePattern['end']) => VariableResolver<Variable>;
|
|
5
|
+
addVariables: (vars: Variable[]) => VariableResolver<Variable>;
|
|
6
6
|
unwrapVariable: (string: string, allowedPrefixes?: AllowedVariablePrefix[]) => string;
|
|
7
7
|
wrapVariable: (string: string, allowedPrefixes?: AllowedVariablePrefix[]) => string;
|
|
8
8
|
escapeVariable: (string: string) => string;
|
|
9
9
|
resolve: <T>(data: T) => Resolved<T>;
|
|
10
10
|
};
|
|
11
|
+
export declare const variableResolver: <Variable extends VariableType>() => VariableResolver<Variable>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface Var {
|
|
2
2
|
key: string;
|
|
3
3
|
value: string;
|
|
4
4
|
description: string;
|
|
@@ -22,7 +22,7 @@ export declare class VariablesFork {
|
|
|
22
22
|
static matchVariables(string: string): string[];
|
|
23
23
|
static wrap(string: string, prefix: (typeof this.allowedPrefixes)[number] | string): string;
|
|
24
24
|
static unwrap(string: (typeof this.allowedPrefixes)[number] | string): string;
|
|
25
|
-
static mapKeysToVariables(keys: string[] | null, variables:
|
|
26
|
-
static interpolate(string: string, variables:
|
|
27
|
-
static structureInterpolate<T>(data: T, variables:
|
|
25
|
+
static mapKeysToVariables(keys: string[] | null, variables: Var[]): Var[];
|
|
26
|
+
static interpolate(string: string, variables: Var[]): string;
|
|
27
|
+
static structureInterpolate<T>(data: T, variables: Var[]): T;
|
|
28
28
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VariablesFork, type Var } from './VariablesFork';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InfoListItemProps } from '../ui';
|
|
2
2
|
import { CalculatorVariables } from './types';
|
|
3
3
|
export declare const evaluateFormula: (formula: string, variables: CalculatorVariables) => string;
|
|
4
|
-
export declare const formatInfoList: (list:
|
|
4
|
+
export declare const formatInfoList: (list: InfoListItemProps[], variables: CalculatorVariables) => InfoListItemProps[];
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { getCalculatorSchema } from './utils';
|
|
2
2
|
export type CalculatorVariables = Record<string, any>;
|
|
3
3
|
export type CalculatorSuffix = 'percent' | 'currency';
|
|
4
|
-
export type
|
|
5
|
-
formula: string;
|
|
6
|
-
};
|
|
7
|
-
export type CalculatorValue = ValueWithFormula | string;
|
|
4
|
+
export type CalculatorRootValue = string;
|
|
8
5
|
export type ModalContentVariant = 'content1' | 'content2';
|
|
9
6
|
export type CalculatorSchema = ReturnType<typeof getCalculatorSchema>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FieldValues } from 'react-hook-form';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { CalculatorViewProps } from '../..';
|
|
4
|
-
import { CalculatorSuffix
|
|
4
|
+
import { CalculatorSuffix } from './types';
|
|
5
5
|
import { InfoListItemMode } from '../ui';
|
|
6
|
-
export declare const isFormula: (value: ValueWithFormula | string) => value is ValueWithFormula;
|
|
7
6
|
export declare const formatWithIntl: (suffix: CalculatorSuffix, value: number) => string | null;
|
|
8
7
|
export declare const formatValueToRenderInfoItem: (renderMode: InfoListItemMode, value: string) => string | null;
|
|
9
8
|
export declare const getCalculatorSchema: <T extends FieldValues>(props: CalculatorViewProps<T>["calculatorFieldsConfig"]["fieldsGroup"]) => z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
@@ -10,4 +10,4 @@ export interface CalculatorInfoProps extends Omit<CalculatedBlockProps, 'classes
|
|
|
10
10
|
classes?: CalculatorInfoClasses;
|
|
11
11
|
headline?: string;
|
|
12
12
|
}
|
|
13
|
-
export declare const CalculatorInfo: ({ rootDescription, bottomDescription, rootValue, title, subtitle, buttonsConfig, infoList, suffix, assistHint, headline, classes }: CalculatorInfoProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const CalculatorInfo: ({ rootDescription, bottomDescription, rootValue, title, subtitle, buttonsConfig, infoList, suffix, assistHint, headline, isFormula, classes }: CalculatorInfoProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CalculatorRootValue, CalculatorSuffix } from '../../../model';
|
|
2
2
|
export type CalculatedBlockClasses = {
|
|
3
3
|
wrapper?: string;
|
|
4
4
|
description?: string;
|
|
@@ -6,7 +6,8 @@ export type CalculatedBlockClasses = {
|
|
|
6
6
|
};
|
|
7
7
|
export interface CalculatedBlockProps {
|
|
8
8
|
rootDescription: string;
|
|
9
|
-
rootValue:
|
|
9
|
+
rootValue: CalculatorRootValue;
|
|
10
|
+
isFormula: boolean;
|
|
10
11
|
suffix: CalculatorSuffix;
|
|
11
12
|
classes?: CalculatedBlockClasses;
|
|
12
13
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InfoListItemProps } from '../..';
|
|
2
2
|
export type CalculatorInfoBodyClasses = {
|
|
3
3
|
wrapper?: string;
|
|
4
4
|
};
|
|
5
5
|
export interface CalculatedInfoBodyProps {
|
|
6
|
-
infoList:
|
|
6
|
+
infoList: InfoListItemProps[];
|
|
7
7
|
classes?: CalculatorInfoBodyClasses;
|
|
8
8
|
withoutDivider?: boolean;
|
|
9
9
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { CalculatorSuffix
|
|
1
|
+
import { CalculatorSuffix } from '../../../model';
|
|
2
2
|
export type InfoListItemMode = CalculatorSuffix | 'text';
|
|
3
3
|
export type InfoListItemColor = 'dark' | 'blue';
|
|
4
|
-
export
|
|
4
|
+
export type InfoListItemValue = string;
|
|
5
|
+
export interface InfoListItemProps {
|
|
5
6
|
label: string;
|
|
6
7
|
mode: InfoListItemMode;
|
|
7
8
|
hint?: string;
|
|
8
9
|
accent?: boolean;
|
|
9
10
|
color?: InfoListItemColor;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export interface InfoListItemDTO extends InfoListItemCommon {
|
|
13
|
-
value: CalculatorValue;
|
|
14
|
-
}
|
|
15
|
-
export interface InfoListItemProps extends InfoListItemCommon {
|
|
16
|
-
value: string;
|
|
11
|
+
isFormula: boolean;
|
|
12
|
+
value: InfoListItemValue;
|
|
17
13
|
}
|
|
18
14
|
export declare const InfoListItem: ({ hint, value, label, mode, color, accent }: InfoListItemProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VariablesFork.js","sources":["../../../../../lib/shared/utils/variablesByNikita/VariablesFork.ts"],"sourcesContent":["import { TypeGuards } from '../typeGuards'\n\nexport interface Variable {\n key: string\n value: string\n description: string\n}\n\n/** Что нам для этого нужно\n * 1. Реализация CRUD для переменных в админке\n * 2.\n * - Нужно реализовать функцию traverseToData чтобы бежать по всей структуре данных\n * - Нужно реализовать функцию, которая ищет в строке переменную matchVarsFromString, и возвращает массив ключей переменных\n * - Для match нужно описать регулярку, которая матчит переменную, а так же добавить возможно прокидывать регулярку в конструктор\n * - Нужно реализовать функцию, которая массив ключей транформирует в entries [[${var}, 'boba'], [${var2}, 'biba']], чтобы трансформировать нужно написать метод entriesOf\n * - entriesOf метод, который сравнивает айтемы с бэка с текущим ключом и возвратает entries [[${var}, 'boba'], [${var2}, 'biba']]\n * - Потом нужно в текущей строке подменить ключ на value, делаем мы это через перебор всех переменных, которые мы нашли в строке\n * - Нужно ещё раз пробежатся по итовой строке, и проверить её на переменные с помощью функции matchVarsFromString\n * - Нужно добавить функции wrap и unwrap\n */\n\nexport class VariablesFork {\n private static regexes = [/\\$\\{([^}]+)}/g, /@\\{([^}]+)}/g]\n private static allowedPrefixes = ['$', '@', '#'] as const\n\n private constructor() {}\n\n static matchVariables(string: string) {\n const result = []\n for (const regex of this.regexes) {\n const matched = string.match(regex)\n\n if (matched) {\n result.push(...matched)\n }\n }\n\n return result\n }\n\n static wrap(string: string, prefix: (typeof this.allowedPrefixes)[number] | string) {\n return `${prefix}{${string}}`\n }\n\n static unwrap(string: (typeof this.allowedPrefixes)[number] | string): string {\n if (!(string.length > 1)) return string\n\n const firstChar = string[0]\n const secondChar = string[1]\n const isWrapped =\n this.allowedPrefixes.includes(firstChar as (typeof this.allowedPrefixes)[number]) &&\n secondChar === '{' &&\n string.endsWith('}')\n\n if (isWrapped) {\n return string.slice(2, -1)\n }\n\n return string\n }\n\n static mapKeysToVariables(keys: string[] | null, variables: Variable[]) {\n const entries = []\n\n for (const variable of variables) {\n if (keys?.includes(variable.key)) {\n entries.push(variable)\n }\n }\n\n return entries\n }\n\n static interpolate(string: string, variables: Variable[]) {\n let str = string\n\n let matches = this.matchVariables(string)\n let detectedVariables = this.mapKeysToVariables(matches ?? [], variables)\n\n while (!TypeGuards.isArrayEmpty(detectedVariables)) {\n detectedVariables.forEach(({ key, value }) => {\n str = str.replace(key, value)\n })\n\n matches = this.matchVariables(str)\n detectedVariables = this.mapKeysToVariables(matches ?? [], detectedVariables)\n }\n\n return str\n }\n\n static structureInterpolate<T>(data: T, variables: Variable[]): T {\n if (typeof data === 'string') {\n return this.interpolate(data, variables) as T\n }\n\n if (TypeGuards.isArray(data)) {\n return data.map((item) => this.structureInterpolate(item, variables)) as T\n }\n\n if (typeof data === 'object' && data !== null) {\n const processed = {} as Record<keyof T, unknown>\n const keys = Object.keys(data) as (keyof T)[]\n\n for (const key of keys) {\n processed[key] = this.structureInterpolate(data[key], variables)\n }\n\n return processed as T\n }\n\n return data\n }\n}\n"],"names":["VariablesFork","string","result","regex","matched","prefix","firstChar","secondChar","keys","variables","entries","variable","str","matches","detectedVariables","TypeGuards","key","value","data","item","processed"],"mappings":"8CAqBO,MAAMA,CAAc,CACzB,OAAe,QAAU,CAAC,gBAAiB,cAAc,EACzD,OAAe,gBAAkB,CAAC,IAAK,IAAK,GAAG,EAEvC,aAAc,CAAC,CAEvB,OAAO,eAAeC,EAAgB,CACpC,MAAMC,EAAS,CAAA,EACf,UAAWC,KAAS,KAAK,QAAS,CAChC,MAAMC,EAAUH,EAAO,MAAME,CAAK,EAE9BC,GACFF,EAAO,KAAK,GAAGE,CAAO,CAE1B,CAEA,OAAOF,CACT,CAEA,OAAO,KAAKD,EAAgBI,EAAwD,CAClF,MAAO,GAAGA,CAAM,IAAIJ,CAAM,GAC5B,CAEA,OAAO,OAAOA,EAAgE,CAC5E,GAAI,EAAEA,EAAO,OAAS,GAAI,OAAOA,EAEjC,MAAMK,EAAYL,EAAO,CAAC,EACpBM,EAAaN,EAAO,CAAC,EAM3B,OAJE,KAAK,gBAAgB,SAASK,CAAkD,GAChFC,IAAe,KACfN,EAAO,SAAS,GAAG,EAGZA,EAAO,MAAM,EAAG,EAAE,EAGpBA,CACT,CAEA,OAAO,mBAAmBO,EAAuBC,EAAuB,CACtE,MAAMC,EAAU,CAAA,EAEhB,UAAWC,KAAYF,EACjBD,GAAM,SAASG,EAAS,GAAG,GAC7BD,EAAQ,KAAKC,CAAQ,EAIzB,OAAOD,CACT,CAEA,OAAO,YAAYT,EAAgBQ,EAAuB,CACxD,IAAIG,EAAMX,EAENY,EAAU,KAAK,eAAeZ,CAAM,EACpCa,EAAoB,KAAK,mBAAmBD,GAAW,CAAA,EAAIJ,CAAS,EAExE,KAAO,CAACM,EAAW,aAAaD,CAAiB,GAC/CA,EAAkB,QAAQ,CAAC,CAAE,IAAAE,EAAK,MAAAC,KAAY,CAC5CL,EAAMA,EAAI,QAAQI,EAAKC,CAAK,CAC9B,CAAC,EAEDJ,EAAU,KAAK,eAAeD,CAAG,EACjCE,EAAoB,KAAK,mBAAmBD,GAAW,CAAA,EAAIC,CAAiB,EAG9E,OAAOF,CACT,CAEA,OAAO,qBAAwBM,EAAST,EAA0B,CAChE,GAAI,OAAOS,GAAS,SAClB,OAAO,KAAK,YAAYA,EAAMT,CAAS,EAGzC,GAAIM,EAAW,QAAQG,CAAI,EACzB,OAAOA,EAAK,IAAKC,GAAS,KAAK,qBAAqBA,EAAMV,CAAS,CAAC,EAGtE,GAAI,OAAOS,GAAS,UAAYA,IAAS,KAAM,CAC7C,MAAME,EAAY,CAAA,EACZZ,EAAO,OAAO,KAAKU,CAAI,EAE7B,UAAWF,KAAOR,EAChBY,EAAUJ,CAAG,EAAI,KAAK,qBAAqBE,EAAKF,CAAG,EAAGP,CAAS,EAGjE,OAAOW,CACT,CAEA,OAAOF,CACT,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { VariablesFork, type Variable } from './VariablesFork';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|