mirror of
https://github.com/divkit/divkit.git
synced 2026-05-07 20:02:32 +00:00
Tab delimiters
commit_hash:84edf03c0eeab3a2d62766e9b1ec4dced70ed065
This commit is contained in:
@@ -14404,6 +14404,7 @@
|
||||
"client/web/divkit/src/utils/correctNumber.ts":"divkit/public/client/web/divkit/src/utils/correctNumber.ts",
|
||||
"client/web/divkit/src/utils/correctPositiveNumber.ts":"divkit/public/client/web/divkit/src/utils/correctPositiveNumber.ts",
|
||||
"client/web/divkit/src/utils/correctSliderTextStyle.ts":"divkit/public/client/web/divkit/src/utils/correctSliderTextStyle.ts",
|
||||
"client/web/divkit/src/utils/correctTabDelimiterStyle.ts":"divkit/public/client/web/divkit/src/utils/correctTabDelimiterStyle.ts",
|
||||
"client/web/divkit/src/utils/correctTintMode.ts":"divkit/public/client/web/divkit/src/utils/correctTintMode.ts",
|
||||
"client/web/divkit/src/utils/correctVideoSource.ts":"divkit/public/client/web/divkit/src/utils/correctVideoSource.ts",
|
||||
"client/web/divkit/src/utils/correctVisibility.ts":"divkit/public/client/web/divkit/src/utils/correctVisibility.ts",
|
||||
@@ -15491,6 +15492,8 @@
|
||||
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/tabs-dynamic-height/firefoxMobile/tabs-dynamic-height.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/tabs-dynamic-height/firefoxMobile/tabs-dynamic-height.png",
|
||||
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/tabs-max-height/chromeMobile/tabs-max-height.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/tabs-max-height/chromeMobile/tabs-max-height.png",
|
||||
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/tabs-max-height/firefoxMobile/tabs-max-height.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/tabs-max-height/firefoxMobile/tabs-max-height.png",
|
||||
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/title-delimiters/chromeMobile/title-delimiters.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/title-delimiters/chromeMobile/title-delimiters.png",
|
||||
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/title-delimiters/firefoxMobile/title-delimiters.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/title-delimiters/firefoxMobile/title-delimiters.png",
|
||||
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/title-with-expression/chromeMobile/title-with-expression.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/title-with-expression/chromeMobile/title-with-expression.png",
|
||||
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/title-with-expression/firefoxMobile/title-with-expression.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/title-with-expression/firefoxMobile/title-with-expression.png",
|
||||
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/too-big-constrained-height-with-paddings/chromeMobile/too-big-constrained-height-with-paddings.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-tabs/too-big-constrained-height-with-paddings/chromeMobile/too-big-constrained-height-with-paddings.png",
|
||||
@@ -16776,6 +16779,7 @@
|
||||
"client/web/divkit/tests/utils/correctNumber.test.ts":"divkit/public/client/web/divkit/tests/utils/correctNumber.test.ts",
|
||||
"client/web/divkit/tests/utils/correctPositiveNumber.test.ts":"divkit/public/client/web/divkit/tests/utils/correctPositiveNumber.test.ts",
|
||||
"client/web/divkit/tests/utils/correctSliderTextStyle.test.ts":"divkit/public/client/web/divkit/tests/utils/correctSliderTextStyle.test.ts",
|
||||
"client/web/divkit/tests/utils/correctTabDelimiterStyle.test.ts":"divkit/public/client/web/divkit/tests/utils/correctTabDelimiterStyle.test.ts",
|
||||
"client/web/divkit/tests/utils/correctTintMode.test.ts":"divkit/public/client/web/divkit/tests/utils/correctTintMode.test.ts",
|
||||
"client/web/divkit/tests/utils/correctVideoSource.test.ts":"divkit/public/client/web/divkit/tests/utils/correctVideoSource.test.ts",
|
||||
"client/web/divkit/tests/utils/correctVisibility.test.ts":"divkit/public/client/web/divkit/tests/utils/correctVisibility.test.ts",
|
||||
|
||||
@@ -3,11 +3,11 @@ import type { Node } from './expressions/ast';
|
||||
import type { ComponentCallback, CustomActionCallback, Customization, DivExtensionClass, DivJson, ErrorCallback, FetchInit, Platform, StatCallback, Theme, TypefaceProvider, WrappedError } from '../typings/common';
|
||||
import type { GlobalVariablesController } from './expressions/globalVariablesController';
|
||||
import type { Store } from '../typings/store';
|
||||
import type { CustomComponentDescription } from '../typings/custom';
|
||||
import type { DivkitDebugInstance } from '../typings/client-devtool';
|
||||
import { parse } from './expressions/expressions';
|
||||
import { evalExpression as evalExpressionInner, EvalResult } from './expressions/eval';
|
||||
import { evalExpression as evalExpressionInner, type EvalResult } from './expressions/eval';
|
||||
import { funcs } from './expressions/funcs/funcs';
|
||||
import { CustomComponentDescription } from '../typings/custom';
|
||||
import { DivkitDebugInstance } from '../typings/client-devtool';
|
||||
import Root from './components/Root.svelte';
|
||||
|
||||
export function render(opts: {
|
||||
|
||||
@@ -55,15 +55,15 @@
|
||||
import type { Store, StoreTypes } from '../../typings/store';
|
||||
import Unknown from './utilities/Unknown.svelte';
|
||||
import RootSvgFilters from './utilities/RootSvgFilters.svelte';
|
||||
import { FocusableMethods, ParentMethods, ROOT_CTX, RootCtxValue, Running } from '../context/root';
|
||||
import { ROOT_CTX, type FocusableMethods, type ParentMethods, type RootCtxValue, type Running } from '../context/root';
|
||||
import { applyTemplate } from '../utils/applyTemplate';
|
||||
import { type LogError, wrapError, WrappedError } from '../utils/wrapError';
|
||||
import { type LogError, wrapError, type WrappedError } from '../utils/wrapError';
|
||||
import { simpleCheckInput } from '../utils/simpleCheckInput';
|
||||
import { ACTION_CTX, ActionCtxValue } from '../context/action';
|
||||
import { STATE_CTX, StateCtxValue, StateInterface } from '../context/state';
|
||||
import { ACTION_CTX, type ActionCtxValue } from '../context/action';
|
||||
import { STATE_CTX, type StateCtxValue, type StateInterface } from '../context/state';
|
||||
import { constStore } from '../utils/constStore';
|
||||
import {
|
||||
MaybeMissing,
|
||||
type MaybeMissing,
|
||||
prepareVars
|
||||
} from '../expressions/json';
|
||||
import { storesMap } from '../stores';
|
||||
@@ -71,7 +71,7 @@
|
||||
import { parse } from '../expressions/expressions';
|
||||
import { gatherVarsFromAst } from '../expressions/utils';
|
||||
import { Truthy } from '../utils/truthy';
|
||||
import { createConstVariable, createVariable, TYPE_TO_CLASS, Variable, VariableType } from '../expressions/variable';
|
||||
import { createConstVariable, createVariable, TYPE_TO_CLASS, Variable, type VariableType } from '../expressions/variable';
|
||||
import {
|
||||
cleanControllerStore,
|
||||
getControllerStore,
|
||||
@@ -1136,7 +1136,7 @@
|
||||
(mode === 'on_variable' || mode === 'on_condition' && prevConditionResult === false)
|
||||
) {
|
||||
prevConditionResult = Boolean(conditionResult.value);
|
||||
const actions = trigger.actions.map(action =>
|
||||
const actions = (trigger.actions as Action[]).map(action =>
|
||||
componentContext ?
|
||||
componentContext.getJsonWithVars(action) :
|
||||
getJsonWithVars(logError, action)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { getContext } from 'svelte';
|
||||
import { Readable, derived } from 'svelte/store';
|
||||
import { type Readable, derived } from 'svelte/store';
|
||||
|
||||
import css from './Container.module.css';
|
||||
|
||||
@@ -40,21 +40,21 @@
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import type { MaybeMissing } from '../../expressions/json';
|
||||
import { prepareMargins } from '../../utils/container';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { correctContainerOrientation } from '../../utils/correctContainerOrientation';
|
||||
import { correctDrawableStyle, DrawableStyle } from '../../utils/correctDrawableStyles';
|
||||
import { correctDrawableStyle, type DrawableStyle } from '../../utils/correctDrawableStyles';
|
||||
import { calcAdditionalPaddings, calcItemsGap, isHeightMatchParent, isWidthMatchParent } from '../../utils/container';
|
||||
import { hasGapSupport } from '../../utils/hasGapSupport';
|
||||
import { isPositiveNumber } from '../../utils/isPositiveNumber';
|
||||
import ContainerSeparators from './ContainerSeparators.svelte';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import { ContentAlignmentVerticalMapped, correctContentAlignmentVertical } from '../../utils/correctContentAlignmentVertical';
|
||||
import { ContentAlignmentHorizontalMapped, correctContentAlignmentHorizontal } from '../../utils/correctContentAlignmentHorizontal';
|
||||
import { type ContentAlignmentVerticalMapped, correctContentAlignmentVertical } from '../../utils/correctContentAlignmentVertical';
|
||||
import { type ContentAlignmentHorizontalMapped, correctContentAlignmentHorizontal } from '../../utils/correctContentAlignmentHorizontal';
|
||||
import { Truthy } from '../../utils/truthy';
|
||||
import { assignIfDifferent } from '../../utils/assignIfDifferent';
|
||||
import { constStore } from '../../utils/constStore';
|
||||
import ContainerSeparators from './ContainerSeparators.svelte';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
|
||||
export let componentContext: ComponentContext<DivContainerData>;
|
||||
export let layoutParams: LayoutParams | undefined = undefined;
|
||||
@@ -126,6 +126,7 @@
|
||||
Array.isArray(componentContext.json.item_builder.prototypes)
|
||||
) {
|
||||
const builder = componentContext.json.item_builder;
|
||||
const prototypes = componentContext.json.item_builder.prototypes;
|
||||
newItems = [];
|
||||
|
||||
$jsonItemBuilderData.forEach((it, index) => {
|
||||
@@ -136,8 +137,8 @@
|
||||
|
||||
let div: MaybeMissing<DivBaseData> | undefined;
|
||||
let id: string | undefined;
|
||||
for (let i = 0; i < builder.prototypes.length; ++i) {
|
||||
const prototype = builder.prototypes[i];
|
||||
for (let i = 0; i < prototypes.length; ++i) {
|
||||
const prototype = prototypes[i];
|
||||
if (!prototype.div) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
import type { DivCustomData } from '../../types/custom';
|
||||
import type { CustomComponentDescription } from '../../../typings/custom';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import DevtoolHolder from '../utilities/DevtoolHolder.svelte';
|
||||
|
||||
export let componentContext: ComponentContext<DivCustomData>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { getContext, onDestroy, onMount } from 'svelte';
|
||||
import { derived, Readable } from 'svelte/store';
|
||||
import { derived, type Readable } from 'svelte/store';
|
||||
|
||||
import css from './Gallery.module.css';
|
||||
import rootCss from '../Root.module.css';
|
||||
@@ -15,9 +15,7 @@
|
||||
import type { Size } from '../../types/sizes';
|
||||
import type { Style } from '../../types/general';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { pxToEm } from '../../utils/pxToEm';
|
||||
import { makeStyle } from '../../utils/makeStyle';
|
||||
@@ -31,6 +29,8 @@
|
||||
import { debounce } from '../../utils/debounce';
|
||||
import { Truthy } from '../../utils/truthy';
|
||||
import { nonNegativeModulo } from '../../utils/nonNegativeModulo';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
|
||||
export let componentContext: ComponentContext<DivGalleryData>;
|
||||
export let layoutParams: LayoutParams | undefined = undefined;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { getContext } from 'svelte';
|
||||
import { derived, Readable } from 'svelte/store';
|
||||
import { derived, type Readable } from 'svelte/store';
|
||||
|
||||
import css from './Grid.module.css';
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
import type { AlignmentHorizontal } from '../../types/alignment';
|
||||
import type { MaybeMissing } from '../../expressions/json';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { gridCalcTemplates } from '../../utils/gridCalcTemplates';
|
||||
import { correctPositiveNumber } from '../../utils/correctPositiveNumber';
|
||||
import { type AlignmentVerticalMapped, correctAlignmentVertical } from '../../utils/correctAlignmentVertical';
|
||||
import { correctAlignmentHorizontal } from '../../utils/correctAlignmentHorizontal';
|
||||
import { Truthy } from '../../utils/truthy';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
|
||||
export let componentContext: ComponentContext<DivGridData>;
|
||||
export let layoutParams: LayoutParams | undefined = undefined;
|
||||
@@ -81,10 +81,10 @@
|
||||
}
|
||||
|
||||
interface ChildInfo {
|
||||
rowSpan: number | undefined;
|
||||
columnSpan: number | undefined;
|
||||
width: MaybeMissing<Size> | undefined;
|
||||
height: MaybeMissing<Size> | undefined;
|
||||
rowSpan?: number;
|
||||
columnSpan?: number;
|
||||
width?: MaybeMissing<Size>;
|
||||
height?: MaybeMissing<Size>;
|
||||
}
|
||||
$: {
|
||||
let children: Readable<ChildInfo>[] = [];
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
import type { DivImageData, TintMode } from '../../types/image';
|
||||
import type { AlignmentHorizontal, AlignmentVertical } from '../../types/alignment';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import { makeStyle } from '../../utils/makeStyle';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import { imageSize } from '../../utils/background';
|
||||
import { correctImagePosition } from '../../utils/correctImagePosition';
|
||||
@@ -32,6 +31,7 @@
|
||||
import { correctTintMode } from '../../utils/correctTintMode';
|
||||
import { getCssFilter } from '../../utils/filters';
|
||||
import { prepareBase64 } from '../../utils/prepareBase64';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import DevtoolHolder from '../utilities/DevtoolHolder.svelte';
|
||||
|
||||
export let componentContext: ComponentContext<DivImageData>;
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { correctNonNegativeNumber } from '../../utils/correctNonNegativeNumber';
|
||||
import { pxToEm } from '../../utils/pxToEm';
|
||||
import { correctPositiveNumber } from '../../utils/correctPositiveNumber';
|
||||
import { ARROW_LEFT, ARROW_RIGHT, END, HOME } from '../../utils/keyboard/codes';
|
||||
import { correctDrawableStyle, DrawableStyle } from '../../utils/correctDrawableStyles';
|
||||
import { correctDrawableStyle, type DrawableStyle } from '../../utils/correctDrawableStyles';
|
||||
import { correctColor } from '../../utils/correctColor';
|
||||
|
||||
export let componentContext: ComponentContext<DivIndicatorData>;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
import type { InputMask } from '../../types/input';
|
||||
import type { AlignmentHorizontal } from '../../types/alignment';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { pxToEm, pxToEmWithUnits } from '../../utils/pxToEm';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
@@ -53,7 +53,6 @@
|
||||
import { correctFontWeight } from '../../utils/correctFontWeight';
|
||||
import { isPositiveNumber } from '../../utils/isPositiveNumber';
|
||||
import { isNumber } from '../../utils/isNumber';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import { createVariable } from '../../expressions/variable';
|
||||
import { correctNonNegativeNumber } from '../../utils/correctNonNegativeNumber';
|
||||
import { correctEdgeInsertsObject } from '../../utils/correctEdgeInsertsObject';
|
||||
@@ -64,9 +63,10 @@
|
||||
import { updateCurrencyMask } from '../../utils/updateCurrencyMask';
|
||||
import { CurrencyInputMask } from '../../utils/mask/currencyInputMask';
|
||||
import { correctAlignmentHorizontal } from '../../utils/correctAlignmentHorizontal';
|
||||
import { AlignmentVerticalMapped, correctAlignmentVertical } from '../../utils/correctAlignmentVertical';
|
||||
import { type AlignmentVerticalMapped, correctAlignmentVertical } from '../../utils/correctAlignmentVertical';
|
||||
import { calcSelectionOffset, setSelectionOffset } from '../../utils/contenteditable';
|
||||
import { correctBooleanInt } from '../../utils/correctBooleanInt';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import DevtoolHolder from '../utilities/DevtoolHolder.svelte';
|
||||
|
||||
export let componentContext: ComponentContext<DivInputData>;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import type { ActionMenuItem } from '../../../typings/common';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import Actionable from '../utilities/Actionable.svelte';
|
||||
|
||||
export let ownerNode: HTMLElement;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { pxToEm, pxToEmWithUnits } from '../../utils/pxToEm';
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { getContext, onDestroy, onMount } from 'svelte';
|
||||
import { getContext, onDestroy } from 'svelte';
|
||||
|
||||
import css from './Select.module.css';
|
||||
|
||||
import type { LayoutParams } from '../../types/layoutParams';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import type { DivSelectData } from '../../types/select';
|
||||
import type { EdgeInsets } from '../../types/edgeInserts';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { pxToEm } from '../../utils/pxToEm';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
@@ -15,8 +17,6 @@
|
||||
import { isPositiveNumber } from '../../utils/isPositiveNumber';
|
||||
import { isNumber } from '../../utils/isNumber';
|
||||
import { createVariable } from '../../expressions/variable';
|
||||
import { DivSelectData } from '../../types/select';
|
||||
import { EdgeInsets } from '../../types/edgeInserts';
|
||||
import { correctEdgeInsertsObject } from '../../utils/correctEdgeInsertsObject';
|
||||
import { edgeInsertsToCss } from '../../utils/edgeInsertsToCss';
|
||||
import { makeStyle } from '../../utils/makeStyle';
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
import type { LayoutParams } from '../../types/layoutParams';
|
||||
import type { DivSliderData } from '../../types/slider';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ACTION_CTX, ActionCtxValue } from '../../context/action';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { ACTION_CTX, type ActionCtxValue } from '../../context/action';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { correctDrawableStyle, DrawableStyle } from '../../utils/correctDrawableStyles';
|
||||
import { correctDrawableStyle, type DrawableStyle } from '../../utils/correctDrawableStyles';
|
||||
import { pxToEm, pxToEmWithUnits } from '../../utils/pxToEm';
|
||||
import { correctSliderTextStyle, TransformedSliderTextStyle } from '../../utils/correctSliderTextStyle';
|
||||
import { correctSliderTextStyle, type TransformedSliderTextStyle } from '../../utils/correctSliderTextStyle';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import { isNonNegativeNumber } from '../../utils/isNonNegativeNumber';
|
||||
import { clamp } from '../../utils/clamp';
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
import type { ChangeBoundsTransition } from '../../types/base';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import type { MaybeMissing } from '../../expressions/json';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import { STATE_CTX, StateCtxValue, StateInterface } from '../../context/state';
|
||||
import { STATE_CTX, type StateCtxValue, type StateInterface } from '../../context/state';
|
||||
import { calcMaxDuration, inOutTransition } from '../../utils/inOutTransition';
|
||||
import { changeBoundsTransition } from '../../utils/changeBoundsTransition';
|
||||
import { flattenTransition } from '../../utils/flattenTransition';
|
||||
|
||||
@@ -100,3 +100,8 @@
|
||||
margin: 0 1.2em;
|
||||
background: rgba(0, 0, 0, .08);
|
||||
}
|
||||
|
||||
.tabs__delimitier {
|
||||
align-self: center;
|
||||
margin-left: var(--divkit-tabs-items-spacing, 0);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
import type { MaybeMissing } from '../../expressions/json';
|
||||
import type { DivBaseData } from '../../types/base';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { correctTabDelimiterStyle, type TabsDelimiter } from '../../utils/correctTabDelimiterStyle';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { makeStyle } from '../../utils/makeStyle';
|
||||
@@ -29,7 +30,7 @@
|
||||
import { correctFontWeight } from '../../utils/correctFontWeight';
|
||||
import { isNonNegativeNumber } from '../../utils/isNonNegativeNumber';
|
||||
import { assignIfDifferent } from '../../utils/assignIfDifferent';
|
||||
import { Coords, getTouchCoords } from '../../utils/getTouchCoords';
|
||||
import { type Coords, getTouchCoords } from '../../utils/getTouchCoords';
|
||||
import { correctEdgeInsertsObject } from '../../utils/correctEdgeInsertsObject';
|
||||
import { correctNonNegativeNumber } from '../../utils/correctNonNegativeNumber';
|
||||
import { edgeInsertsToCss } from '../../utils/edgeInsertsToCss';
|
||||
@@ -95,6 +96,7 @@
|
||||
let isSwipeCanceled = false;
|
||||
let startTransform: number;
|
||||
let currentTransform: number;
|
||||
let delimitierStyle: TabsDelimiter | undefined;
|
||||
|
||||
$: origJson = componentContext.origJson;
|
||||
|
||||
@@ -114,6 +116,7 @@
|
||||
separatorBackground = '';
|
||||
separatorMargins = '';
|
||||
titlePadding = null;
|
||||
delimitierStyle = undefined;
|
||||
}
|
||||
|
||||
$: if (origJson) {
|
||||
@@ -140,6 +143,7 @@
|
||||
);
|
||||
$: jsonRestrictParentScroll = componentContext.getDerivedFromVars(componentContext.json.restrict_parent_scroll);
|
||||
$: jsonTitlePaddings = componentContext.getDerivedFromVars(componentContext.json.title_paddings);
|
||||
$: jsonDelimiterStyle = componentContext.getDerivedFromVars(componentContext.json.tab_title_delimiter);
|
||||
|
||||
$: selected = jsonSelectedTab && Number(jsonSelectedTab) || 0;
|
||||
|
||||
@@ -360,6 +364,10 @@
|
||||
titlePadding = correctEdgeInsertsObject($jsonTitlePaddings ? $jsonTitlePaddings : undefined, titlePadding);
|
||||
}
|
||||
|
||||
$: {
|
||||
delimitierStyle = correctTabDelimiterStyle($jsonDelimiterStyle, delimitierStyle);
|
||||
}
|
||||
|
||||
function updateItems(items: MaybeMissing<TabItem>[]): void {
|
||||
if (hasError) {
|
||||
return;
|
||||
@@ -448,8 +456,9 @@
|
||||
if (context) {
|
||||
return context;
|
||||
}
|
||||
if (index >= start && index <= end && items[index]?.div) {
|
||||
return componentContext.produceChildContext(items[index].div, {
|
||||
const div = items[index]?.div;
|
||||
if (index >= start && index <= end && div) {
|
||||
return componentContext.produceChildContext(div, {
|
||||
path: index
|
||||
});
|
||||
}
|
||||
@@ -707,6 +716,18 @@
|
||||
{@const index = item.index}
|
||||
{@const isSelected = index === selected}
|
||||
|
||||
{#if delimitierStyle && index > 0}
|
||||
<img
|
||||
class={css.tabs__delimitier}
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
src={delimitierStyle.url}
|
||||
style:width={delimitierStyle.width ? pxToEm(delimitierStyle.width) : undefined}
|
||||
style:height={delimitierStyle.height ? pxToEm(delimitierStyle.height) : undefined}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<Actionable
|
||||
{componentContext}
|
||||
cls={genClassName('tabs__item', css, {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import type { TintMode } from '../../types/image';
|
||||
import type { MaybeMissing } from '../../expressions/json';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import TextRangeView from './TextRange.svelte';
|
||||
import { makeStyle } from '../../utils/makeStyle';
|
||||
@@ -22,7 +22,7 @@
|
||||
import { correctPositiveNumber } from '../../utils/correctPositiveNumber';
|
||||
import { isPositiveNumber } from '../../utils/isPositiveNumber';
|
||||
import { correctAlignmentHorizontal } from '../../utils/correctAlignmentHorizontal';
|
||||
import { AlignmentVerticalMapped, correctAlignmentVertical } from '../../utils/correctAlignmentVertical';
|
||||
import { type AlignmentVerticalMapped, correctAlignmentVertical } from '../../utils/correctAlignmentVertical';
|
||||
import { correctColor } from '../../utils/correctColor';
|
||||
import { correctBooleanInt } from '../../utils/correctBooleanInt';
|
||||
import { propToString } from '../../utils/propToString';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import { correctColor, correctColorWithAlpha, parseColor } from '../../utils/correctColor';
|
||||
import { isNonNegativeNumber } from '../../utils/isNonNegativeNumber';
|
||||
import { getBackground } from '../../utils/background';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { shadowToCssFilter } from '../../utils/shadow';
|
||||
import { edgeInsertsToCss } from '../../utils/edgeInsertsToCss';
|
||||
import { edgeInsertsMultiply } from '../../utils/edgeInsetsMultiply';
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
import type { MaybeMissing } from '../../expressions/json';
|
||||
import Unknown from '../utilities/Unknown.svelte';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { inOutAnimation } from '../../utils/inOutAnimation';
|
||||
|
||||
export let ownerNode: HTMLElement;
|
||||
@@ -43,7 +43,7 @@
|
||||
let tooltipHeight = '';
|
||||
let resizeObserver: ResizeObserver | null = null;
|
||||
|
||||
$: componentContext = parentComponentContext.produceChildContext(data.div);
|
||||
$: componentContext = parentComponentContext.produceChildContext(data.div || {});
|
||||
|
||||
$: position = parentComponentContext.getDerivedFromVars(data.position);
|
||||
$: offsetX = parentComponentContext.getDerivedFromVars(data.offset?.x?.value);
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
import type { Action } from '../../../typings/common';
|
||||
import type { MaybeMissing } from '../../expressions/json';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { doNothing } from '../../utils/doNothing';
|
||||
import { ACTION_CTX, ActionCtxValue } from '../../context/action';
|
||||
import { ACTION_CTX, type ActionCtxValue } from '../../context/action';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import { getUrlSchema, isBuiltinSchema } from '../../utils/url';
|
||||
import { Coords, getTouchCoords } from '../../utils/getTouchCoords';
|
||||
import { type Coords, getTouchCoords } from '../../utils/getTouchCoords';
|
||||
|
||||
export let componentContext: ComponentContext;
|
||||
export let id = '';
|
||||
|
||||
@@ -46,11 +46,11 @@
|
||||
import { makeStyle } from '../../utils/makeStyle';
|
||||
import { pxToEm, pxToEmWithUnits } from '../../utils/pxToEm';
|
||||
import { getBackground } from '../../utils/background';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { visibilityAction } from '../../use/visibilityAction';
|
||||
import { genClassName } from '../../utils/genClassName';
|
||||
import { devtool, DevtoolResult } from '../../use/devtool';
|
||||
import { STATE_CTX, StateCtxValue } from '../../context/state';
|
||||
import { devtool, type DevtoolResult } from '../../use/devtool';
|
||||
import { STATE_CTX, type StateCtxValue } from '../../context/state';
|
||||
import { correctEdgeInserts } from '../../utils/correctEdgeInserts';
|
||||
import { correctNonNegativeNumber } from '../../utils/correctNonNegativeNumber';
|
||||
import { correctAlpha } from '../../utils/correctAlpha';
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
import type { LayoutParams } from '../../types/layoutParams';
|
||||
import type { DivVideoData, VideoElements } from '../../types/video';
|
||||
import type { ComponentContext } from '../../types/componentContext';
|
||||
import { ROOT_CTX, RootCtxValue } from '../../context/root';
|
||||
import { ROOT_CTX, type RootCtxValue } from '../../context/root';
|
||||
import { wrapError } from '../../utils/wrapError';
|
||||
import { createVariable } from '../../expressions/variable';
|
||||
import { PreparedVideoSource, correctVideoSource } from '../../utils/correctVideoSource';
|
||||
import { type PreparedVideoSource, correctVideoSource } from '../../utils/correctVideoSource';
|
||||
import { correctBooleanInt } from '../../utils/correctBooleanInt';
|
||||
import Outer from '../utilities/Outer.svelte';
|
||||
import { prepareBase64 } from '../../utils/prepareBase64';
|
||||
|
||||
@@ -12,7 +12,7 @@ import type {
|
||||
UnaryExpression, Variable
|
||||
} from './ast';
|
||||
import type { WrappedError } from '../utils/wrapError';
|
||||
import { convertArgs, findBestMatchedFunc, Func, funcByArgs, funcs, methodByArgs } from './funcs/funcs';
|
||||
import { convertArgs, findBestMatchedFunc, type Func, funcByArgs, funcs, methodByArgs } from './funcs/funcs';
|
||||
import {
|
||||
checkIntegerOverflow,
|
||||
evalError,
|
||||
|
||||
@@ -4,9 +4,9 @@ import type { VariableValue } from './variable';
|
||||
import type { Store } from '../../typings/store';
|
||||
import { uniq } from '../utils/uniq';
|
||||
import { parse } from './expressions';
|
||||
import { evalExpression, VariablesMap } from './eval';
|
||||
import { evalExpression, type VariablesMap } from './eval';
|
||||
import { dateToString, gatherVarsFromAst, stringifyColor } from './utils';
|
||||
import { LogError, wrapError } from '../utils/wrapError';
|
||||
import { type LogError, wrapError } from '../utils/wrapError';
|
||||
import { parseColor } from '../utils/correctColor';
|
||||
import { MAX_INT32, MIN_INT32 } from './const';
|
||||
import { simpleUnescapeString } from './simpleUnescapeString';
|
||||
@@ -120,7 +120,7 @@ export type MaybeMissing<T> = T | (
|
||||
(
|
||||
T extends object ?
|
||||
{
|
||||
[P in keyof T]: MaybeMissing<T[P]>;
|
||||
[P in keyof T]?: MaybeMissing<T[P]>;
|
||||
} :
|
||||
T | undefined
|
||||
)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import type { EvalContext, EvalTypesWithoutDatetime, EvalValue, EvalValueBase, IntegerValue, NumberValue } from './eval';
|
||||
import type { Node, Variable } from './ast';
|
||||
import type { EvalTypes } from './eval';
|
||||
import type { VariablesMap } from './eval';
|
||||
import { walk } from './walk';
|
||||
import { parseColor, ParsedColor } from '../utils/correctColor';
|
||||
import { parseColor, type ParsedColor } from '../utils/correctColor';
|
||||
import { padLeft } from '../utils/padLeft';
|
||||
import { hasBigInt, MAX_INT, MIN_INT, toBigInt } from './bigint';
|
||||
import { NUMBER } from './const';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Node } from './ast';
|
||||
import type { Node } from './ast';
|
||||
|
||||
export function walk(ast: Node, visitors: {
|
||||
[Type in Node['type']]?: (node: Extract<Node, { type: Type }>) => void;
|
||||
|
||||
+8
@@ -4,6 +4,7 @@ import type { FontWeight } from './text';
|
||||
import type { Action, BooleanInt } from '../../typings/common';
|
||||
import type { EdgeInsets } from './edgeInserts';
|
||||
import type { CornersRadius } from './border';
|
||||
import type { FixedSize } from './sizes';
|
||||
|
||||
export interface TabsTitleStyle {
|
||||
font_size?: number;
|
||||
@@ -30,6 +31,12 @@ export interface TabItem {
|
||||
div: DivBaseData;
|
||||
}
|
||||
|
||||
export interface TabDelimiterStyle {
|
||||
image_url: string;
|
||||
width: FixedSize;
|
||||
height: FixedSize;
|
||||
}
|
||||
|
||||
export interface DivTabsData extends DivBaseData, DivActionableData {
|
||||
type: 'tabs';
|
||||
title_paddings?: EdgeInsets;
|
||||
@@ -43,4 +50,5 @@ export interface DivTabsData extends DivBaseData, DivActionableData {
|
||||
// tabs_position
|
||||
// dynamic_height
|
||||
restrict_parent_scroll?: BooleanInt;
|
||||
tab_title_delimiter?: TabDelimiterStyle;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ export function visibilityAction(node: HTMLElement, {
|
||||
(it.action as DisappearAction).disappear_duration,
|
||||
log_limit: it.action.log_limit,
|
||||
is_enabled: it.action.is_enabled,
|
||||
});
|
||||
}) as Readable<CalcedAction>;
|
||||
});
|
||||
|
||||
let observer: IntersectionObserver | undefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { wrapError, WrappedError } from './wrapError';
|
||||
import { wrapError, type WrappedError } from './wrapError';
|
||||
import type { DivBase, TemplateContext } from '../../typings/common';
|
||||
import type { DivBaseData } from '../types/base';
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ export function calcItemsGap(
|
||||
}
|
||||
|
||||
export interface ContainerChildInfo {
|
||||
width: MaybeMissing<Size> | undefined;
|
||||
height: MaybeMissing<Size> | undefined;
|
||||
width?: MaybeMissing<Size>;
|
||||
height?: MaybeMissing<Size>;
|
||||
}
|
||||
|
||||
export function isWidthMatchParent(item: ContainerChildInfo) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { MaybeMissing } from '../expressions/json';
|
||||
import type { TabDelimiterStyle } from '../types/tabs';
|
||||
import { isPositiveNumber } from './isPositiveNumber';
|
||||
|
||||
export interface TabsDelimiter {
|
||||
url: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
|
||||
export function correctTabDelimiterStyle(
|
||||
style: MaybeMissing<TabDelimiterStyle> | undefined,
|
||||
defaultValue: TabsDelimiter | undefined
|
||||
): TabsDelimiter | undefined {
|
||||
if (!style || !style.image_url || typeof style.image_url !== 'string') {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
const res: TabsDelimiter = {
|
||||
url: style.image_url
|
||||
};
|
||||
|
||||
if (style.width?.type === 'fixed' && isPositiveNumber(style.width.value)) {
|
||||
res.width = style.width.value;
|
||||
}
|
||||
if (style.height?.type === 'fixed' && isPositiveNumber(style.height.value)) {
|
||||
res.height = style.height.value;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Visibility } from '../types/base';
|
||||
import type { Visibility } from '../types/base';
|
||||
|
||||
export function correctVisibility(visibility: string | undefined, defaultVal: Visibility): Visibility {
|
||||
if (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MaybeMissing } from '../expressions/json';
|
||||
import { EdgeInsets } from '../types/edgeInserts';
|
||||
import type { MaybeMissing } from '../expressions/json';
|
||||
import type { EdgeInsets } from '../types/edgeInserts';
|
||||
|
||||
export function edgeInsertsMultiply(
|
||||
edgeInsets: MaybeMissing<EdgeInsets>,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Filter } from '../types/filter';
|
||||
import type { MaybeMissing } from '../expressions/json';
|
||||
import { LogError, wrapError } from './wrapError';
|
||||
import { type LogError, wrapError } from './wrapError';
|
||||
import { isPositiveNumber } from './isPositiveNumber';
|
||||
import { pxToEmWithUnits } from './pxToEm';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AnyTransition, AppearanceTransition } from '../types/base';
|
||||
import type { AnyTransition, AppearanceTransition } from '../types/base';
|
||||
|
||||
export function flattenTransition(transition: AppearanceTransition): AnyTransition[] {
|
||||
const res: AnyTransition[] = [];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import type { WrappedError } from '../wrapError';
|
||||
import { wrapError } from '../wrapError';
|
||||
import { TextDiff, textDiff } from '../textDiff';
|
||||
import { type TextDiff, textDiff } from '../textDiff';
|
||||
|
||||
export interface MaskKey {
|
||||
key: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { LogError, WrappedError } from '../wrapError';
|
||||
import { BaseInputMask } from './baseInputMask';
|
||||
import { TextDiff, textDiff } from '../textDiff';
|
||||
import { type TextDiff, textDiff } from '../textDiff';
|
||||
import { wrapError } from '../wrapError';
|
||||
|
||||
export class CurrencyInputMask extends BaseInputMask {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { LogError, WrappedError } from '../wrapError';
|
||||
import { BaseInputMask, MaskData } from './baseInputMask';
|
||||
import { BaseInputMask, type MaskData } from './baseInputMask';
|
||||
|
||||
export class FixedLengthInputMask extends BaseInputMask {
|
||||
constructor(initialMaskData: MaskData, private readonly logError: LogError) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { VariableValue } from '../expressions/variable';
|
||||
import type { VariableValue } from '../expressions/variable';
|
||||
|
||||
export function propToString(val: VariableValue | undefined): string {
|
||||
const valToString = String(val ?? '');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DivJson } from '../../typings/common';
|
||||
import { wrapError, WrappedError } from './wrapError';
|
||||
import { wrapError, type WrappedError } from './wrapError';
|
||||
import { TYPE_MAP } from '../components/typeMap';
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Action, DivTimer } from '../../typings/common';
|
||||
import type { MaybeMissing } from '../expressions/json';
|
||||
import type { ComponentContext } from '../types/componentContext';
|
||||
import type { VariableType } from '../expressions/variable';
|
||||
import { LogError, wrapError } from './wrapError';
|
||||
import { type LogError, wrapError } from './wrapError';
|
||||
|
||||
interface TimerState {
|
||||
state: 'stopped' | 'running' | 'paused';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { MaybeMissing } from '../expressions/json';
|
||||
import type { CurrencyInputMask as CurrencyInputMaskType } from '../types/input';
|
||||
import { CurrencyInputMask } from './mask/currencyInputMask';
|
||||
import { CurrencyInputMask as CurrencyInputMaskType } from '../types/input';
|
||||
import type { LogError } from './wrapError';
|
||||
|
||||
export function updateCurrencyMask(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { LogError } from './wrapError';
|
||||
import type { MaskData } from './mask/baseInputMask';
|
||||
import type { MaybeMissing } from '../expressions/json';
|
||||
import type { FixedLengthInputMask as FixedLengthInputMaskType } from '../types/input';
|
||||
import { FixedLengthInputMask } from './mask/fixedLengthInputMask';
|
||||
import { MaybeMissing } from '../expressions/json';
|
||||
import { FixedLengthInputMask as FixedLengthInputMaskType } from '../types/input';
|
||||
|
||||
export function updateFixedMask(
|
||||
mask: MaybeMissing<FixedLengthInputMaskType>,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { evalExpression, EvalResult } from '../../src/expressions/eval';
|
||||
import { evalExpression, type EvalResult } from '../../src/expressions/eval';
|
||||
import { valToString } from '../../src/expressions/utils';
|
||||
import { parse } from '../../src/expressions/expressions';
|
||||
import { createVariable } from '../../src/expressions/variable';
|
||||
@@ -10,28 +10,6 @@ const dir = path.resolve(__filename, '../../../../../../test_data/expression_tes
|
||||
|
||||
const tests = fs.readdirSync(dir);
|
||||
|
||||
function convertVals(val: EvalResult) {
|
||||
if (val.type === 'boolean') {
|
||||
return {
|
||||
type: 'boolean',
|
||||
value: val.value ? 1 : 0
|
||||
};
|
||||
} else if (val.type === 'integer') {
|
||||
return {
|
||||
type: 'integer',
|
||||
// values in json is out of range already
|
||||
value: Number(val.value)
|
||||
};
|
||||
} else if (val.type === 'datetime' && val.value instanceof Date) {
|
||||
return {
|
||||
type: 'datetime',
|
||||
value: valToString(val)
|
||||
};
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function runCase(item: any) {
|
||||
const vars = new Map();
|
||||
if (item.variables) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { evalExpression, EvalResult } from '../../src/expressions/eval';
|
||||
import { evalExpression, type EvalResult } from '../../src/expressions/eval';
|
||||
import { valToString } from '../../src/expressions/utils';
|
||||
import { parse } from '../../src/expressions/expressions';
|
||||
import { createVariable } from '../../src/expressions/variable';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { evalExpression, EvalResult } from '../../src/expressions/eval';
|
||||
import { evalExpression, type EvalResult } from '../../src/expressions/eval';
|
||||
import { valToString } from '../../src/expressions/utils';
|
||||
import { parse } from '../../src/expressions/expressions';
|
||||
import { createVariable } from '../../src/expressions/variable';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Func, funcs } from '../../src/expressions/funcs/funcs';
|
||||
import { type Func, funcs } from '../../src/expressions/funcs/funcs';
|
||||
import { register } from '../../src/expressions/funcs';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@@ -396,7 +396,6 @@ describe('correctDrawableStyle', () => {
|
||||
|
||||
const types = ['rounded_rectangle', 'circle'];
|
||||
|
||||
// @ts-expect-error Incorrect data
|
||||
expect(correctDrawableStyle({}, types, defaultVal)).toEqual(defaultVal);
|
||||
|
||||
expect(correctDrawableStyle({
|
||||
@@ -410,7 +409,6 @@ describe('correctDrawableStyle', () => {
|
||||
color: 123
|
||||
}, types, defaultVal)).toEqual(defaultVal);
|
||||
|
||||
// @ts-expect-error Incorrect data
|
||||
expect(correctDrawableStyle({
|
||||
type: 'shape_drawable',
|
||||
color: '#fc0',
|
||||
|
||||
@@ -10,7 +10,6 @@ describe('correctSliderTextStyle', () => {
|
||||
|
||||
expect(correctSliderTextStyle(undefined, defaultVal)).toEqual(defaultVal);
|
||||
|
||||
// @ts-expect-error Incorrect data
|
||||
expect(correctSliderTextStyle({}, defaultVal)).toEqual(defaultVal);
|
||||
|
||||
expect(correctSliderTextStyle({
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { correctTabDelimiterStyle } from '../../src/utils/correctTabDelimiterStyle';
|
||||
|
||||
describe('correctTabDelimiterStyle', () => {
|
||||
test('simple', () => {
|
||||
expect(correctTabDelimiterStyle(undefined, {
|
||||
url: 'a'
|
||||
})).toEqual({
|
||||
url: 'a'
|
||||
});
|
||||
//@ts-expect-error Incorrect type
|
||||
expect(correctTabDelimiterStyle(123, {
|
||||
url: 'a'
|
||||
})).toEqual({
|
||||
url: 'a'
|
||||
});
|
||||
expect(correctTabDelimiterStyle({}, {
|
||||
url: 'a'
|
||||
})).toEqual({
|
||||
url: 'a'
|
||||
});
|
||||
|
||||
expect(correctTabDelimiterStyle({
|
||||
image_url: 'b'
|
||||
}, {
|
||||
url: 'a'
|
||||
})).toEqual({
|
||||
url: 'b'
|
||||
});
|
||||
|
||||
expect(correctTabDelimiterStyle({
|
||||
image_url: 'b',
|
||||
width: {
|
||||
type: 'fixed',
|
||||
value: 10
|
||||
}
|
||||
}, {
|
||||
url: 'a'
|
||||
})).toEqual({
|
||||
url: 'b',
|
||||
width: 10
|
||||
});
|
||||
|
||||
expect(correctTabDelimiterStyle({
|
||||
image_url: 'b',
|
||||
width: {
|
||||
type: 'fixed',
|
||||
value: 10
|
||||
},
|
||||
height: {
|
||||
type: 'fixed',
|
||||
value: 20
|
||||
}
|
||||
}, {
|
||||
url: 'a'
|
||||
})).toEqual({
|
||||
url: 'b',
|
||||
width: 10,
|
||||
height: 20
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -25,13 +25,11 @@ describe('correctVideoSource', () => {
|
||||
}]
|
||||
}, [])).toEqual([]);
|
||||
|
||||
//@ts-expect-error missing type
|
||||
expect(correctVideoSource([{
|
||||
url: 'abcde',
|
||||
mime_type: 'video/abc'
|
||||
}], [])).toEqual([]);
|
||||
|
||||
//@ts-expect-error missing url
|
||||
expect(correctVideoSource([{
|
||||
type: 'video_source'
|
||||
}], [])).toEqual([]);
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"sourceMap": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"skipLibCheck": false,
|
||||
"moduleResolution": "Node"
|
||||
"moduleResolution": "Node",
|
||||
"verbatimModuleSyntax": true
|
||||
},
|
||||
"exclude": [
|
||||
"src/dev.ts"
|
||||
|
||||
@@ -185,7 +185,8 @@
|
||||
"$ref": "#/definitions/delimiter_style",
|
||||
"$description": "translations.json#/div_tabs_tab_title_delimiter_delimiter_style",
|
||||
"platforms": [
|
||||
"android"
|
||||
"android",
|
||||
"web"
|
||||
]
|
||||
},
|
||||
"selected_tab": {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"description": "Tabs with delimiters (starts) between titles.",
|
||||
"platforms": [
|
||||
"android"
|
||||
"android",
|
||||
"web"
|
||||
],
|
||||
"templates": {
|
||||
"text_block": {
|
||||
|
||||
Reference in New Issue
Block a user