react-native-divkit 0.1.0-alpha.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/LICENSE +176 -0
- package/README.md +340 -0
- package/dist/DivKit.d.ts +68 -0
- package/dist/DivKit.d.ts.map +1 -0
- package/dist/DivKit.js +400 -0
- package/dist/DivKit.js.map +1 -0
- package/dist/actions/array.d.ts +8 -0
- package/dist/actions/array.d.ts.map +1 -0
- package/dist/actions/array.js +139 -0
- package/dist/actions/array.js.map +1 -0
- package/dist/actions/copyToClipboard.d.ts +22 -0
- package/dist/actions/copyToClipboard.d.ts.map +1 -0
- package/dist/actions/copyToClipboard.js +63 -0
- package/dist/actions/copyToClipboard.js.map +1 -0
- package/dist/actions/dict.d.ts +6 -0
- package/dist/actions/dict.d.ts.map +1 -0
- package/dist/actions/dict.js +58 -0
- package/dist/actions/dict.js.map +1 -0
- package/dist/actions/index.d.ts +11 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +11 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/updateStructure.d.ts +6 -0
- package/dist/actions/updateStructure.d.ts.map +1 -0
- package/dist/actions/updateStructure.js +116 -0
- package/dist/actions/updateStructure.js.map +1 -0
- package/dist/components/DivComponent.d.ts +29 -0
- package/dist/components/DivComponent.d.ts.map +1 -0
- package/dist/components/DivComponent.js +62 -0
- package/dist/components/DivComponent.js.map +1 -0
- package/dist/components/container/DivContainer.d.ts +26 -0
- package/dist/components/container/DivContainer.d.ts.map +1 -0
- package/dist/components/container/DivContainer.js +172 -0
- package/dist/components/container/DivContainer.js.map +1 -0
- package/dist/components/container/index.d.ts +3 -0
- package/dist/components/container/index.d.ts.map +1 -0
- package/dist/components/container/index.js +2 -0
- package/dist/components/container/index.js.map +1 -0
- package/dist/components/image/DivImage.d.ts +29 -0
- package/dist/components/image/DivImage.d.ts.map +1 -0
- package/dist/components/image/DivImage.js +122 -0
- package/dist/components/image/DivImage.js.map +1 -0
- package/dist/components/image/index.d.ts +3 -0
- package/dist/components/image/index.d.ts.map +1 -0
- package/dist/components/image/index.js +2 -0
- package/dist/components/image/index.js.map +1 -0
- package/dist/components/index.d.ts +14 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +11 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/state/DivState.d.ts +26 -0
- package/dist/components/state/DivState.d.ts.map +1 -0
- package/dist/components/state/DivState.js +121 -0
- package/dist/components/state/DivState.js.map +1 -0
- package/dist/components/state/index.d.ts +3 -0
- package/dist/components/state/index.d.ts.map +1 -0
- package/dist/components/state/index.js +2 -0
- package/dist/components/state/index.js.map +1 -0
- package/dist/components/text/DivText.d.ts +28 -0
- package/dist/components/text/DivText.d.ts.map +1 -0
- package/dist/components/text/DivText.js +143 -0
- package/dist/components/text/DivText.js.map +1 -0
- package/dist/components/text/index.d.ts +3 -0
- package/dist/components/text/index.d.ts.map +1 -0
- package/dist/components/text/index.js +2 -0
- package/dist/components/text/index.js.map +1 -0
- package/dist/components/utilities/Outer.d.ts +17 -0
- package/dist/components/utilities/Outer.d.ts.map +1 -0
- package/dist/components/utilities/Outer.js +210 -0
- package/dist/components/utilities/Outer.js.map +1 -0
- package/dist/components/utilities/Unknown.d.ts +11 -0
- package/dist/components/utilities/Unknown.d.ts.map +1 -0
- package/dist/components/utilities/Unknown.js +50 -0
- package/dist/components/utilities/Unknown.js.map +1 -0
- package/dist/components/utilities/index.d.ts +5 -0
- package/dist/components/utilities/index.d.ts.map +1 -0
- package/dist/components/utilities/index.js +3 -0
- package/dist/components/utilities/index.js.map +1 -0
- package/dist/context/ActionContext.d.ts +25 -0
- package/dist/context/ActionContext.d.ts.map +1 -0
- package/dist/context/ActionContext.js +20 -0
- package/dist/context/ActionContext.js.map +1 -0
- package/dist/context/DivKitContext.d.ts +33 -0
- package/dist/context/DivKitContext.d.ts.map +1 -0
- package/dist/context/DivKitContext.js +14 -0
- package/dist/context/DivKitContext.js.map +1 -0
- package/dist/context/EnabledContext.d.ts +31 -0
- package/dist/context/EnabledContext.d.ts.map +1 -0
- package/dist/context/EnabledContext.js +31 -0
- package/dist/context/EnabledContext.js.map +1 -0
- package/dist/context/StateContext.d.ts +57 -0
- package/dist/context/StateContext.d.ts.map +1 -0
- package/dist/context/StateContext.js +20 -0
- package/dist/context/StateContext.js.map +1 -0
- package/dist/context/index.d.ts +9 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +9 -0
- package/dist/context/index.js.map +1 -0
- package/dist/expressions/bigint.d.ts +8 -0
- package/dist/expressions/bigint.d.ts.map +1 -0
- package/dist/expressions/bigint.js +31 -0
- package/dist/expressions/bigint.js.map +1 -0
- package/dist/expressions/const.d.ts +15 -0
- package/dist/expressions/const.d.ts.map +1 -0
- package/dist/expressions/const.js +15 -0
- package/dist/expressions/const.js.map +1 -0
- package/dist/expressions/eval.d.ts +77 -0
- package/dist/expressions/eval.d.ts.map +1 -0
- package/dist/expressions/eval.js +459 -0
- package/dist/expressions/eval.js.map +1 -0
- package/dist/expressions/expressions.d.ts +7 -0
- package/dist/expressions/expressions.d.ts.map +1 -0
- package/dist/expressions/expressions.js +3191 -0
- package/dist/expressions/expressions.js.map +1 -0
- package/dist/expressions/funcs/array.d.ts +2 -0
- package/dist/expressions/funcs/array.d.ts.map +1 -0
- package/dist/expressions/funcs/array.js +381 -0
- package/dist/expressions/funcs/array.js.map +1 -0
- package/dist/expressions/funcs/colors.d.ts +2 -0
- package/dist/expressions/funcs/colors.d.ts.map +1 -0
- package/dist/expressions/funcs/colors.js +75 -0
- package/dist/expressions/funcs/colors.js.map +1 -0
- package/dist/expressions/funcs/customFuncs.d.ts +8 -0
- package/dist/expressions/funcs/customFuncs.d.ts.map +1 -0
- package/dist/expressions/funcs/customFuncs.js +114 -0
- package/dist/expressions/funcs/customFuncs.js.map +1 -0
- package/dist/expressions/funcs/datetime.d.ts +2 -0
- package/dist/expressions/funcs/datetime.d.ts.map +1 -0
- package/dist/expressions/funcs/datetime.js +182 -0
- package/dist/expressions/funcs/datetime.js.map +1 -0
- package/dist/expressions/funcs/dict.d.ts +2 -0
- package/dist/expressions/funcs/dict.d.ts.map +1 -0
- package/dist/expressions/funcs/dict.js +170 -0
- package/dist/expressions/funcs/dict.js.map +1 -0
- package/dist/expressions/funcs/funcs.d.ts +80 -0
- package/dist/expressions/funcs/funcs.d.ts.map +1 -0
- package/dist/expressions/funcs/funcs.js +146 -0
- package/dist/expressions/funcs/funcs.js.map +1 -0
- package/dist/expressions/funcs/index.d.ts +2 -0
- package/dist/expressions/funcs/index.d.ts.map +1 -0
- package/dist/expressions/funcs/index.js +23 -0
- package/dist/expressions/funcs/index.js.map +1 -0
- package/dist/expressions/funcs/interval.d.ts +2 -0
- package/dist/expressions/funcs/interval.d.ts.map +1 -0
- package/dist/expressions/funcs/interval.js +61 -0
- package/dist/expressions/funcs/interval.js.map +1 -0
- package/dist/expressions/funcs/math.d.ts +2 -0
- package/dist/expressions/funcs/math.d.ts.map +1 -0
- package/dist/expressions/funcs/math.js +324 -0
- package/dist/expressions/funcs/math.js.map +1 -0
- package/dist/expressions/funcs/std.d.ts +2 -0
- package/dist/expressions/funcs/std.d.ts.map +1 -0
- package/dist/expressions/funcs/std.js +293 -0
- package/dist/expressions/funcs/std.js.map +1 -0
- package/dist/expressions/funcs/stored.d.ts +4 -0
- package/dist/expressions/funcs/stored.d.ts.map +1 -0
- package/dist/expressions/funcs/stored.js +62 -0
- package/dist/expressions/funcs/stored.js.map +1 -0
- package/dist/expressions/funcs/strings.d.ts +2 -0
- package/dist/expressions/funcs/strings.d.ts.map +1 -0
- package/dist/expressions/funcs/strings.js +158 -0
- package/dist/expressions/funcs/strings.js.map +1 -0
- package/dist/expressions/funcs/trigonometry.d.ts +2 -0
- package/dist/expressions/funcs/trigonometry.d.ts.map +1 -0
- package/dist/expressions/funcs/trigonometry.js +92 -0
- package/dist/expressions/funcs/trigonometry.js.map +1 -0
- package/dist/expressions/json.d.ts +18 -0
- package/dist/expressions/json.d.ts.map +1 -0
- package/dist/expressions/json.js +271 -0
- package/dist/expressions/json.js.map +1 -0
- package/dist/expressions/parserCache.d.ts +4 -0
- package/dist/expressions/parserCache.d.ts.map +1 -0
- package/dist/expressions/parserCache.js +23 -0
- package/dist/expressions/parserCache.js.map +1 -0
- package/dist/expressions/simpleUnescapeString.d.ts +2 -0
- package/dist/expressions/simpleUnescapeString.d.ts.map +1 -0
- package/dist/expressions/simpleUnescapeString.js +61 -0
- package/dist/expressions/simpleUnescapeString.js.map +1 -0
- package/dist/expressions/utils.d.ts +29 -0
- package/dist/expressions/utils.d.ts.map +1 -0
- package/dist/expressions/utils.js +236 -0
- package/dist/expressions/utils.js.map +1 -0
- package/dist/expressions/variable.d.ts +82 -0
- package/dist/expressions/variable.d.ts.map +1 -0
- package/dist/expressions/variable.js +337 -0
- package/dist/expressions/variable.js.map +1 -0
- package/dist/expressions/walk.d.ts +7 -0
- package/dist/expressions/walk.d.ts.map +1 -0
- package/dist/expressions/walk.js +39 -0
- package/dist/expressions/walk.js.map +1 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +11 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAction.d.ts +102 -0
- package/dist/hooks/useAction.d.ts.map +1 -0
- package/dist/hooks/useAction.js +116 -0
- package/dist/hooks/useAction.js.map +1 -0
- package/dist/hooks/useDerivedFromVars.d.ts +72 -0
- package/dist/hooks/useDerivedFromVars.d.ts.map +1 -0
- package/dist/hooks/useDerivedFromVars.js +100 -0
- package/dist/hooks/useDerivedFromVars.js.map +1 -0
- package/dist/hooks/useVariable.d.ts +86 -0
- package/dist/hooks/useVariable.d.ts.map +1 -0
- package/dist/hooks/useVariable.js +130 -0
- package/dist/hooks/useVariable.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/stores/createObservable.d.ts +38 -0
- package/dist/stores/createObservable.d.ts.map +1 -0
- package/dist/stores/createObservable.js +49 -0
- package/dist/stores/createObservable.js.map +1 -0
- package/dist/utils/applyTemplate.d.ts +8 -0
- package/dist/utils/applyTemplate.d.ts.map +1 -0
- package/dist/utils/applyTemplate.js +94 -0
- package/dist/utils/applyTemplate.js.map +1 -0
- package/dist/utils/correctColor.d.ts +18 -0
- package/dist/utils/correctColor.d.ts.map +1 -0
- package/dist/utils/correctColor.js +79 -0
- package/dist/utils/correctColor.js.map +1 -0
- package/dist/utils/escapeRegExp.d.ts +2 -0
- package/dist/utils/escapeRegExp.d.ts.map +1 -0
- package/dist/utils/escapeRegExp.js +4 -0
- package/dist/utils/escapeRegExp.js.map +1 -0
- package/dist/utils/formatDate.d.ts +6 -0
- package/dist/utils/formatDate.d.ts.map +1 -0
- package/dist/utils/formatDate.js +325 -0
- package/dist/utils/formatDate.js.map +1 -0
- package/dist/utils/padLeft.d.ts +2 -0
- package/dist/utils/padLeft.d.ts.map +1 -0
- package/dist/utils/padLeft.js +7 -0
- package/dist/utils/padLeft.js.map +1 -0
- package/dist/utils/uniq.d.ts +2 -0
- package/dist/utils/uniq.d.ts.map +1 -0
- package/dist/utils/uniq.js +4 -0
- package/dist/utils/uniq.js.map +1 -0
- package/dist/utils/wrapError.d.ts +10 -0
- package/dist/utils/wrapError.d.ts.map +1 -0
- package/dist/utils/wrapError.js +9 -0
- package/dist/utils/wrapError.js.map +1 -0
- package/package.json +58 -0
- package/src/DivKit.tsx +542 -0
- package/src/actions/array.ts +170 -0
- package/src/actions/copyToClipboard.ts +82 -0
- package/src/actions/dict.ts +71 -0
- package/src/actions/index.ts +11 -0
- package/src/actions/updateStructure.ts +134 -0
- package/src/components/DivComponent.tsx +75 -0
- package/src/components/README.md +230 -0
- package/src/components/container/DivContainer.tsx +222 -0
- package/src/components/container/index.ts +2 -0
- package/src/components/image/DivImage.tsx +172 -0
- package/src/components/image/index.ts +2 -0
- package/src/components/index.ts +20 -0
- package/src/components/state/DivState.tsx +146 -0
- package/src/components/state/index.ts +2 -0
- package/src/components/text/DivText.tsx +186 -0
- package/src/components/text/index.ts +2 -0
- package/src/components/utilities/Outer.tsx +239 -0
- package/src/components/utilities/README.md +175 -0
- package/src/components/utilities/Unknown.tsx +60 -0
- package/src/components/utilities/index.ts +4 -0
- package/src/context/ActionContext.tsx +37 -0
- package/src/context/DivKitContext.tsx +54 -0
- package/src/context/EnabledContext.tsx +50 -0
- package/src/context/StateContext.tsx +75 -0
- package/src/context/index.ts +33 -0
- package/src/expressions/ast.d.ts +101 -0
- package/src/expressions/bigint.ts +38 -0
- package/src/expressions/const.ts +16 -0
- package/src/expressions/eval.ts +669 -0
- package/src/expressions/expressions.peggy +235 -0
- package/src/expressions/expressions.ts +2854 -0
- package/src/expressions/funcs/array.ts +412 -0
- package/src/expressions/funcs/colors.ts +100 -0
- package/src/expressions/funcs/customFuncs.ts +139 -0
- package/src/expressions/funcs/datetime.ts +232 -0
- package/src/expressions/funcs/dict.ts +207 -0
- package/src/expressions/funcs/funcs.ts +323 -0
- package/src/expressions/funcs/index.ts +23 -0
- package/src/expressions/funcs/interval.ts +76 -0
- package/src/expressions/funcs/math.ts +395 -0
- package/src/expressions/funcs/std.ts +392 -0
- package/src/expressions/funcs/stored.ts +62 -0
- package/src/expressions/funcs/strings.ts +200 -0
- package/src/expressions/funcs/trigonometry.ts +108 -0
- package/src/expressions/json.ts +367 -0
- package/src/expressions/parserCache.ts +32 -0
- package/src/expressions/simpleUnescapeString.ts +57 -0
- package/src/expressions/utils.ts +271 -0
- package/src/expressions/variable.ts +429 -0
- package/src/expressions/walk.ts +43 -0
- package/src/hooks/README.md +265 -0
- package/src/hooks/index.ts +28 -0
- package/src/hooks/useAction.ts +152 -0
- package/src/hooks/useDerivedFromVars.ts +187 -0
- package/src/hooks/useVariable.ts +157 -0
- package/src/index.ts +97 -0
- package/src/stores/createObservable.ts +64 -0
- package/src/types/alignment.d.ts +13 -0
- package/src/types/background.d.ts +71 -0
- package/src/types/base.d.ts +224 -0
- package/src/types/border.d.ts +46 -0
- package/src/types/componentContext.d.ts +98 -0
- package/src/types/container.d.ts +40 -0
- package/src/types/edgeInserts.d.ts +9 -0
- package/src/types/general.d.ts +3 -0
- package/src/types/image.d.ts +33 -0
- package/src/types/imageScale.d.ts +1 -0
- package/src/types/layoutParams.d.ts +27 -0
- package/src/types/sizes.d.ts +37 -0
- package/src/types/state.d.ts +19 -0
- package/src/types/text.d.ts +126 -0
- package/src/utils/applyTemplate.ts +145 -0
- package/src/utils/correctColor.ts +102 -0
- package/src/utils/escapeRegExp.ts +3 -0
- package/src/utils/formatDate.ts +385 -0
- package/src/utils/padLeft.ts +6 -0
- package/src/utils/uniq.ts +3 -0
- package/src/utils/wrapError.ts +21 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { View, Pressable, StyleSheet } from 'react-native';
|
|
3
|
+
import { useDerivedFromVarsSimple } from '../../hooks/useDerivedFromVars';
|
|
4
|
+
import { useActionHandler, useHasActions } from '../../hooks/useAction';
|
|
5
|
+
import { useDivKitContext } from '../../context/DivKitContext';
|
|
6
|
+
/**
|
|
7
|
+
* Outer component - base wrapper for all DivKit components
|
|
8
|
+
* Handles visibility, sizing, padding, margins, background, borders, and actions
|
|
9
|
+
*
|
|
10
|
+
* Based on Web Outer.svelte but simplified for React Native MVP
|
|
11
|
+
*/
|
|
12
|
+
export function Outer({ componentContext, children, style: customStyle }) {
|
|
13
|
+
const { direction } = useDivKitContext();
|
|
14
|
+
const { json, variables } = componentContext;
|
|
15
|
+
// Only use reactive hooks for truly dynamic properties (visibility, alpha)
|
|
16
|
+
// For MVP, other properties are read directly from JSON (can be enhanced later)
|
|
17
|
+
const visibility = useDerivedFromVarsSimple(json.visibility || 'visible', variables || new Map());
|
|
18
|
+
const alpha = useDerivedFromVarsSimple(json.alpha !== undefined ? json.alpha : 1, variables || new Map());
|
|
19
|
+
// Extract properties directly from JSON for MVP (non-reactive)
|
|
20
|
+
const paddings = json.paddings;
|
|
21
|
+
const margins = json.margins;
|
|
22
|
+
const background = json.background;
|
|
23
|
+
const border = json.border;
|
|
24
|
+
const width = json.width;
|
|
25
|
+
const height = json.height;
|
|
26
|
+
// Actions - use type assertion for now (will be refined in component implementations)
|
|
27
|
+
const jsonAny = json;
|
|
28
|
+
const actions = jsonAny.actions || (jsonAny.action ? [jsonAny.action] : []);
|
|
29
|
+
const hasActions = useHasActions(actions);
|
|
30
|
+
const handlePress = useActionHandler(actions, { componentContext });
|
|
31
|
+
// Early return for gone visibility
|
|
32
|
+
if (visibility === 'gone') {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
// Build styles
|
|
36
|
+
const containerStyle = useMemo(() => {
|
|
37
|
+
const styles = {};
|
|
38
|
+
// Visibility (invisible = opacity 0, but still takes space)
|
|
39
|
+
if (visibility === 'invisible') {
|
|
40
|
+
styles.opacity = 0;
|
|
41
|
+
}
|
|
42
|
+
else if (typeof alpha === 'number' && alpha !== 1) {
|
|
43
|
+
styles.opacity = Math.max(0, Math.min(1, alpha));
|
|
44
|
+
}
|
|
45
|
+
// Width
|
|
46
|
+
if (width) {
|
|
47
|
+
const widthVal = width;
|
|
48
|
+
if (widthVal.type === 'fixed') {
|
|
49
|
+
styles.width = widthVal.value;
|
|
50
|
+
}
|
|
51
|
+
else if (widthVal.type === 'match_parent') {
|
|
52
|
+
styles.width = '100%';
|
|
53
|
+
styles.flexGrow = widthVal.weight || 1;
|
|
54
|
+
}
|
|
55
|
+
else if (widthVal.type === 'wrap_content') {
|
|
56
|
+
styles.alignSelf = 'flex-start';
|
|
57
|
+
// React Native default is wrap_content-like for View
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Default: match_parent
|
|
62
|
+
styles.width = '100%';
|
|
63
|
+
styles.flexGrow = 1;
|
|
64
|
+
}
|
|
65
|
+
// Height
|
|
66
|
+
if (height) {
|
|
67
|
+
const heightVal = height;
|
|
68
|
+
if (heightVal.type === 'fixed') {
|
|
69
|
+
styles.height = heightVal.value;
|
|
70
|
+
}
|
|
71
|
+
else if (heightVal.type === 'match_parent') {
|
|
72
|
+
styles.height = '100%';
|
|
73
|
+
styles.flexGrow = heightVal.weight || 1;
|
|
74
|
+
}
|
|
75
|
+
// wrap_content is default in React Native
|
|
76
|
+
}
|
|
77
|
+
// Paddings
|
|
78
|
+
if (paddings) {
|
|
79
|
+
const p = paddings;
|
|
80
|
+
if (p.top !== undefined)
|
|
81
|
+
styles.paddingTop = p.top;
|
|
82
|
+
if (p.bottom !== undefined)
|
|
83
|
+
styles.paddingBottom = p.bottom;
|
|
84
|
+
// Handle RTL for start/end
|
|
85
|
+
if (direction === 'rtl') {
|
|
86
|
+
if (p.start !== undefined)
|
|
87
|
+
styles.paddingRight = p.start;
|
|
88
|
+
if (p.end !== undefined)
|
|
89
|
+
styles.paddingLeft = p.end;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
if (p.start !== undefined)
|
|
93
|
+
styles.paddingLeft = p.start;
|
|
94
|
+
if (p.end !== undefined)
|
|
95
|
+
styles.paddingRight = p.end;
|
|
96
|
+
}
|
|
97
|
+
// Fallback to left/right if start/end not provided
|
|
98
|
+
if (p.left !== undefined && p.start === undefined) {
|
|
99
|
+
styles.paddingLeft = p.left;
|
|
100
|
+
}
|
|
101
|
+
if (p.right !== undefined && p.end === undefined) {
|
|
102
|
+
styles.paddingRight = p.right;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Margins
|
|
106
|
+
if (margins) {
|
|
107
|
+
const m = margins;
|
|
108
|
+
if (m.top !== undefined)
|
|
109
|
+
styles.marginTop = m.top;
|
|
110
|
+
if (m.bottom !== undefined)
|
|
111
|
+
styles.marginBottom = m.bottom;
|
|
112
|
+
// Handle RTL for start/end
|
|
113
|
+
if (direction === 'rtl') {
|
|
114
|
+
if (m.start !== undefined)
|
|
115
|
+
styles.marginRight = m.start;
|
|
116
|
+
if (m.end !== undefined)
|
|
117
|
+
styles.marginLeft = m.end;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
if (m.start !== undefined)
|
|
121
|
+
styles.marginLeft = m.start;
|
|
122
|
+
if (m.end !== undefined)
|
|
123
|
+
styles.marginRight = m.end;
|
|
124
|
+
}
|
|
125
|
+
// Fallback to left/right
|
|
126
|
+
if (m.left !== undefined && m.start === undefined) {
|
|
127
|
+
styles.marginLeft = m.left;
|
|
128
|
+
}
|
|
129
|
+
if (m.right !== undefined && m.end === undefined) {
|
|
130
|
+
styles.marginRight = m.right;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Background (MVP: only solid colors)
|
|
134
|
+
if (background && Array.isArray(background)) {
|
|
135
|
+
const bg = background;
|
|
136
|
+
const solidBg = bg.find((b) => b?.type === 'solid');
|
|
137
|
+
if (solidBg && solidBg.color) {
|
|
138
|
+
styles.backgroundColor = solidBg.color;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Border
|
|
142
|
+
if (border) {
|
|
143
|
+
const b = border;
|
|
144
|
+
if (b.stroke) {
|
|
145
|
+
const strokeWidth = b.stroke.width || 1;
|
|
146
|
+
const strokeColor = b.stroke.color || '#000000';
|
|
147
|
+
styles.borderWidth = strokeWidth;
|
|
148
|
+
styles.borderColor = strokeColor;
|
|
149
|
+
styles.borderStyle = b.stroke.style?.type === 'dashed' ? 'dashed' : 'solid';
|
|
150
|
+
}
|
|
151
|
+
// Border radius
|
|
152
|
+
if (b.corner_radius !== undefined) {
|
|
153
|
+
styles.borderRadius = b.corner_radius;
|
|
154
|
+
}
|
|
155
|
+
else if (b.corners_radius) {
|
|
156
|
+
// React Native supports individual corners
|
|
157
|
+
const corners = b.corners_radius;
|
|
158
|
+
if (corners['top-left'] !== undefined) {
|
|
159
|
+
styles.borderTopLeftRadius = corners['top-left'];
|
|
160
|
+
}
|
|
161
|
+
if (corners['top-right'] !== undefined) {
|
|
162
|
+
styles.borderTopRightRadius = corners['top-right'];
|
|
163
|
+
}
|
|
164
|
+
if (corners['bottom-left'] !== undefined) {
|
|
165
|
+
styles.borderBottomLeftRadius = corners['bottom-left'];
|
|
166
|
+
}
|
|
167
|
+
if (corners['bottom-right'] !== undefined) {
|
|
168
|
+
styles.borderBottomRightRadius = corners['bottom-right'];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Shadow (box-shadow equivalent)
|
|
172
|
+
if (b.has_shadow) {
|
|
173
|
+
const shadow = b.shadow;
|
|
174
|
+
if (shadow) {
|
|
175
|
+
styles.shadowColor = shadow.color || '#000000';
|
|
176
|
+
styles.shadowOffset = {
|
|
177
|
+
width: shadow.offset?.x?.value || 0,
|
|
178
|
+
height: shadow.offset?.y?.value || 2
|
|
179
|
+
};
|
|
180
|
+
styles.shadowOpacity = shadow.alpha !== undefined ? shadow.alpha : 0.18;
|
|
181
|
+
styles.shadowRadius = shadow.blur || 2;
|
|
182
|
+
// Android elevation
|
|
183
|
+
styles.elevation = 3;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
// Default shadow
|
|
187
|
+
styles.shadowColor = '#000000';
|
|
188
|
+
styles.shadowOffset = { width: 0, height: 1 };
|
|
189
|
+
styles.shadowOpacity = 0.18;
|
|
190
|
+
styles.shadowRadius = 2;
|
|
191
|
+
styles.elevation = 2;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return styles;
|
|
196
|
+
}, [visibility, alpha, width, height, paddings, margins, background, border, direction]);
|
|
197
|
+
const finalStyle = useMemo(() => {
|
|
198
|
+
return StyleSheet.flatten([containerStyle, customStyle]);
|
|
199
|
+
}, [containerStyle, customStyle]);
|
|
200
|
+
// Render with or without Pressable based on actions
|
|
201
|
+
if (hasActions) {
|
|
202
|
+
return (<Pressable onPress={handlePress} style={finalStyle}>
|
|
203
|
+
{children}
|
|
204
|
+
</Pressable>);
|
|
205
|
+
}
|
|
206
|
+
return (<View style={finalStyle}>
|
|
207
|
+
{children}
|
|
208
|
+
</View>);
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=Outer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Outer.js","sourceRoot":"","sources":["../../../src/components/utilities/Outer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,OAAO,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AAMtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAQ/D;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAsC,EACvD,gBAAgB,EAChB,QAAQ,EACR,KAAK,EAAE,WAAW,EACN;IACZ,MAAM,EAAE,SAAS,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACzC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,gBAAgB,CAAC;IAE7C,2EAA2E;IAC3E,gFAAgF;IAChF,MAAM,UAAU,GAAG,wBAAwB,CACvC,IAAI,CAAC,UAAU,IAAI,SAAS,EAC5B,SAAS,IAAI,IAAI,GAAG,EAAE,CACzB,CAAC;IACF,MAAM,KAAK,GAAG,wBAAwB,CAClC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACzC,SAAS,IAAI,IAAI,GAAG,EAAE,CACzB,CAAC;IAEF,+DAA+D;IAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,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AAC,CAAC,WAAW,CAAC,CACrB,KAAK,CAAC,CAAC,UAAU,CAAC,CAElB;gBAAA,CAAC,QAAQ,CACb;YAAA,EAAE,SAAS,CAAC,CACf,CAAC;IACN,CAAC;IAED,OAAO,CACH,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CACpB;YAAA,CAAC,QAAQ,CACb;QAAA,EAAE,IAAI,CAAC,CACV,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface UnknownProps {
|
|
3
|
+
type: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Unknown component - fallback for unsupported component types
|
|
8
|
+
* Renders a placeholder with error message
|
|
9
|
+
*/
|
|
10
|
+
export declare function Unknown({ type, message }: UnknownProps): React.JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=Unknown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Unknown.d.ts","sourceRoot":"","sources":["../../../src/components/utilities/Unknown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,YAAY,4BAkBtD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* Unknown component - fallback for unsupported component types
|
|
5
|
+
* Renders a placeholder with error message
|
|
6
|
+
*/
|
|
7
|
+
export function Unknown({ type, message }) {
|
|
8
|
+
if (__DEV__) {
|
|
9
|
+
console.warn(`[DivKit] Unknown component type: "${type}"${message ? ` - ${message}` : ''}`);
|
|
10
|
+
}
|
|
11
|
+
// Only show visual error in DEV mode
|
|
12
|
+
if (__DEV__) {
|
|
13
|
+
return (<View style={styles.container}>
|
|
14
|
+
<Text style={styles.title}>Unknown Component</Text>
|
|
15
|
+
<Text style={styles.type}>Type: {type}</Text>
|
|
16
|
+
{message && <Text style={styles.message}>{message}</Text>}
|
|
17
|
+
</View>);
|
|
18
|
+
}
|
|
19
|
+
// In production, render nothing
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const styles = StyleSheet.create({
|
|
23
|
+
container: {
|
|
24
|
+
padding: 16,
|
|
25
|
+
margin: 8,
|
|
26
|
+
backgroundColor: '#fff3cd',
|
|
27
|
+
borderWidth: 1,
|
|
28
|
+
borderColor: '#ffc107',
|
|
29
|
+
borderRadius: 4,
|
|
30
|
+
borderStyle: 'dashed'
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
fontSize: 14,
|
|
34
|
+
fontWeight: 'bold',
|
|
35
|
+
color: '#856404',
|
|
36
|
+
marginBottom: 4
|
|
37
|
+
},
|
|
38
|
+
type: {
|
|
39
|
+
fontSize: 12,
|
|
40
|
+
color: '#856404',
|
|
41
|
+
fontFamily: 'monospace'
|
|
42
|
+
},
|
|
43
|
+
message: {
|
|
44
|
+
fontSize: 11,
|
|
45
|
+
color: '#856404',
|
|
46
|
+
marginTop: 4,
|
|
47
|
+
fontStyle: 'italic'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=Unknown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Unknown.js","sourceRoot":"","sources":["../../../src/components/utilities/Unknown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAOtD;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAgB;IACnD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AAE;QACZ,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,QAAQ;KACtB;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action context interface
|
|
3
|
+
* Based on ActionCtxValue from Web implementation
|
|
4
|
+
*
|
|
5
|
+
* This context is used to track whether a component or its parent has actions.
|
|
6
|
+
* It's useful for optimizing rendering and event handling.
|
|
7
|
+
*/
|
|
8
|
+
export interface ActionContextValue {
|
|
9
|
+
/**
|
|
10
|
+
* Check if the current component or any parent has actions
|
|
11
|
+
* @returns true if actions are present
|
|
12
|
+
*/
|
|
13
|
+
hasAction(): boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const ActionContext: import("react").Context<ActionContextValue | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Hook to access ActionContext
|
|
18
|
+
* Throws an error if used outside of ActionContext.Provider
|
|
19
|
+
*/
|
|
20
|
+
export declare function useActionContext(): ActionContextValue;
|
|
21
|
+
/**
|
|
22
|
+
* Hook to safely access ActionContext (returns null if not available)
|
|
23
|
+
*/
|
|
24
|
+
export declare function useActionContextOptional(): ActionContextValue | null;
|
|
25
|
+
//# sourceMappingURL=ActionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionContext.d.ts","sourceRoot":"","sources":["../../src/context/ActionContext.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,oDAAiD,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAMrD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,kBAAkB,GAAG,IAAI,CAEpE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const ActionContext = createContext(null);
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access ActionContext
|
|
5
|
+
* Throws an error if used outside of ActionContext.Provider
|
|
6
|
+
*/
|
|
7
|
+
export function useActionContext() {
|
|
8
|
+
const context = useContext(ActionContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error('useActionContext must be used within ActionContext.Provider');
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook to safely access ActionContext (returns null if not available)
|
|
16
|
+
*/
|
|
17
|
+
export function useActionContextOptional() {
|
|
18
|
+
return useContext(ActionContext);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ActionContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionContext.js","sourceRoot":"","sources":["../../src/context/ActionContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAiBlD,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAE5E;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB;IACpC,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Action, Direction } from '../../typings/common';
|
|
2
|
+
import type { MaybeMissing } from '../expressions/json';
|
|
3
|
+
import type { Variable } from '../expressions/variable';
|
|
4
|
+
import type { ComponentContext } from '../types/componentContext';
|
|
5
|
+
/**
|
|
6
|
+
* Main DivKit context interface
|
|
7
|
+
* Based on RootCtxValue from Web implementation with simplifications for MVP
|
|
8
|
+
*/
|
|
9
|
+
export interface DivKitContextValue {
|
|
10
|
+
logStat(type: string, action: MaybeMissing<Action>): void;
|
|
11
|
+
execCustomAction(action: Action & {
|
|
12
|
+
url: string;
|
|
13
|
+
}): void;
|
|
14
|
+
direction: Direction;
|
|
15
|
+
platform: 'desktop' | 'touch';
|
|
16
|
+
variables: Map<string, Variable>;
|
|
17
|
+
getVariable(name: string): Variable | undefined;
|
|
18
|
+
setVariable(name: string, value: unknown): void;
|
|
19
|
+
registerComponent(id: string, context: ComponentContext): void;
|
|
20
|
+
unregisterComponent(id: string): void;
|
|
21
|
+
execAnyActions(actions: MaybeMissing<Action[]> | undefined, opts?: {
|
|
22
|
+
componentContext?: ComponentContext;
|
|
23
|
+
processUrls?: boolean;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
genId(key: string): string;
|
|
26
|
+
}
|
|
27
|
+
export declare const DivKitContext: import("react").Context<DivKitContextValue | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Hook to access DivKitContext
|
|
30
|
+
* Throws an error if used outside of DivKitContext.Provider
|
|
31
|
+
*/
|
|
32
|
+
export declare function useDivKitContext(): DivKitContextValue;
|
|
33
|
+
//# sourceMappingURL=DivKitContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DivKitContext.d.ts","sourceRoot":"","sources":["../../src/context/DivKitContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAE/B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC1D,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAGzD,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC;IAG9B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACjC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IAChD,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAGhD,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC/D,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtC,cAAc,CACV,OAAO,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,SAAS,EAC3C,IAAI,CAAC,EAAE;QACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,WAAW,CAAC,EAAE,OAAO,CAAC;KACzB,GACF,OAAO,CAAC,IAAI,CAAC,CAAC;IAGjB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,oDAAiD,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAMrD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const DivKitContext = createContext(null);
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access DivKitContext
|
|
5
|
+
* Throws an error if used outside of DivKitContext.Provider
|
|
6
|
+
*/
|
|
7
|
+
export function useDivKitContext() {
|
|
8
|
+
const context = useContext(DivKitContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error('useDivKitContext must be used within DivKitContext.Provider');
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=DivKitContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DivKitContext.js","sourceRoot":"","sources":["../../src/context/DivKitContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAyClD,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAE5E;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Observable } from '../stores/createObservable';
|
|
2
|
+
/**
|
|
3
|
+
* Enabled context interface
|
|
4
|
+
* Based on EnabledCtxValue from Web implementation
|
|
5
|
+
*
|
|
6
|
+
* This context tracks whether the current component is enabled.
|
|
7
|
+
* Used for cascading enabled/disabled state down the component tree.
|
|
8
|
+
*/
|
|
9
|
+
export interface EnabledContextValue {
|
|
10
|
+
/**
|
|
11
|
+
* Observable that tracks whether the component is enabled
|
|
12
|
+
* Subscribers will be notified when the enabled state changes
|
|
13
|
+
*/
|
|
14
|
+
isEnabled: Observable<boolean>;
|
|
15
|
+
}
|
|
16
|
+
export declare const EnabledContext: import("react").Context<EnabledContextValue | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Hook to access EnabledContext
|
|
19
|
+
* Throws an error if used outside of EnabledContext.Provider
|
|
20
|
+
*/
|
|
21
|
+
export declare function useEnabledContext(): EnabledContextValue;
|
|
22
|
+
/**
|
|
23
|
+
* Hook to safely access EnabledContext (returns null if not available)
|
|
24
|
+
*/
|
|
25
|
+
export declare function useEnabledContextOptional(): EnabledContextValue | null;
|
|
26
|
+
/**
|
|
27
|
+
* Hook to get the current enabled state value
|
|
28
|
+
* Returns true if no EnabledContext is available (enabled by default)
|
|
29
|
+
*/
|
|
30
|
+
export declare function useIsEnabled(): boolean;
|
|
31
|
+
//# sourceMappingURL=EnabledContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnabledContext.d.ts","sourceRoot":"","sources":["../../src/context/EnabledContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAClC;AAED,eAAO,MAAM,cAAc,qDAAkD,CAAC;AAE9E;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,mBAAmB,CAMvD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,mBAAmB,GAAG,IAAI,CAEtE;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAMtC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const EnabledContext = createContext(null);
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access EnabledContext
|
|
5
|
+
* Throws an error if used outside of EnabledContext.Provider
|
|
6
|
+
*/
|
|
7
|
+
export function useEnabledContext() {
|
|
8
|
+
const context = useContext(EnabledContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error('useEnabledContext must be used within EnabledContext.Provider');
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook to safely access EnabledContext (returns null if not available)
|
|
16
|
+
*/
|
|
17
|
+
export function useEnabledContextOptional() {
|
|
18
|
+
return useContext(EnabledContext);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Hook to get the current enabled state value
|
|
22
|
+
* Returns true if no EnabledContext is available (enabled by default)
|
|
23
|
+
*/
|
|
24
|
+
export function useIsEnabled() {
|
|
25
|
+
const context = useEnabledContextOptional();
|
|
26
|
+
if (!context) {
|
|
27
|
+
return true; // Enabled by default if no context
|
|
28
|
+
}
|
|
29
|
+
return context.isEnabled.get();
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=EnabledContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnabledContext.js","sourceRoot":"","sources":["../../src/context/EnabledContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAkBlD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAA6B,IAAI,CAAC,CAAC;AAE9E;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB;IACrC,OAAO,UAAU,CAAC,cAAc,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IACxB,MAAM,OAAO,GAAG,yBAAyB,EAAE,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,IAAI,CAAC,CAAC,mCAAmC;IACpD,CAAC;IACD,OAAO,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State setter function type
|
|
3
|
+
* Takes a state ID and returns a promise that resolves when the state is changed
|
|
4
|
+
*/
|
|
5
|
+
export type StateSetter = (stateId: string) => Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* State context interface
|
|
8
|
+
* Based on StateCtxValue from Web implementation, simplified for MVP
|
|
9
|
+
*
|
|
10
|
+
* This context manages state transitions for div-state components.
|
|
11
|
+
* In the MVP version, complex transitions are deferred.
|
|
12
|
+
*/
|
|
13
|
+
export interface StateContextValue {
|
|
14
|
+
/**
|
|
15
|
+
* Register a state component
|
|
16
|
+
* @param id - Component ID
|
|
17
|
+
* @param setState - Function to change the state
|
|
18
|
+
* @returns Unregister function
|
|
19
|
+
*/
|
|
20
|
+
registerState(id: string, setState: StateSetter): () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Switch to a specific state by ID
|
|
23
|
+
* @param stateId - The state ID to switch to
|
|
24
|
+
*/
|
|
25
|
+
switchState(stateId: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Get state setter by component ID
|
|
28
|
+
* @param id - Component ID
|
|
29
|
+
* @returns State setter function or undefined
|
|
30
|
+
*/
|
|
31
|
+
getStateSetter(id: string): StateSetter | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Register a child component (for tracking purposes)
|
|
34
|
+
* Simplified for MVP - full transition support deferred
|
|
35
|
+
*/
|
|
36
|
+
registerChild(id: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Unregister a child component
|
|
39
|
+
*/
|
|
40
|
+
unregisterChild(id: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Check if there's a transition change for a component
|
|
43
|
+
* MVP: Always returns false (transitions deferred)
|
|
44
|
+
*/
|
|
45
|
+
hasTransitionChange(id?: string): boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare const StateContext: import("react").Context<StateContextValue | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Hook to access StateContext
|
|
50
|
+
* Throws an error if used outside of StateContext.Provider
|
|
51
|
+
*/
|
|
52
|
+
export declare function useStateContext(): StateContextValue;
|
|
53
|
+
/**
|
|
54
|
+
* Hook to safely access StateContext (returns null if not available)
|
|
55
|
+
*/
|
|
56
|
+
export declare function useStateContextOptional(): StateContextValue | null;
|
|
57
|
+
//# sourceMappingURL=StateContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateContext.d.ts","sourceRoot":"","sources":["../../src/context/StateContext.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC;IAE7D;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C;;;;OAIG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IAEpD;;;OAGG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;OAEG;IACH,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7C;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAC;AAE1E;;;GAGG;AACH,wBAAgB,eAAe,IAAI,iBAAiB,CAMnD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,iBAAiB,GAAG,IAAI,CAElE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const StateContext = createContext(null);
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access StateContext
|
|
5
|
+
* Throws an error if used outside of StateContext.Provider
|
|
6
|
+
*/
|
|
7
|
+
export function useStateContext() {
|
|
8
|
+
const context = useContext(StateContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error('useStateContext must be used within StateContext.Provider');
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook to safely access StateContext (returns null if not available)
|
|
16
|
+
*/
|
|
17
|
+
export function useStateContextOptional() {
|
|
18
|
+
return useContext(StateContext);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=StateContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateContext.js","sourceRoot":"","sources":["../../src/context/StateContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAuDlD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC3B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACnC,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context exports for React Native DivKit
|
|
3
|
+
* Phase 2: Context System
|
|
4
|
+
*/
|
|
5
|
+
export { DivKitContext, useDivKitContext, type DivKitContextValue } from './DivKitContext';
|
|
6
|
+
export { ActionContext, useActionContext, useActionContextOptional, type ActionContextValue } from './ActionContext';
|
|
7
|
+
export { StateContext, useStateContext, useStateContextOptional, type StateContextValue, type StateSetter } from './StateContext';
|
|
8
|
+
export { EnabledContext, useEnabledContext, useEnabledContextOptional, useIsEnabled, type EnabledContextValue } from './EnabledContext';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,KAAK,kBAAkB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,YAAY,EACZ,KAAK,mBAAmB,EAC3B,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context exports for React Native DivKit
|
|
3
|
+
* Phase 2: Context System
|
|
4
|
+
*/
|
|
5
|
+
export { DivKitContext, useDivKitContext } from './DivKitContext';
|
|
6
|
+
export { ActionContext, useActionContext, useActionContextOptional } from './ActionContext';
|
|
7
|
+
export { StateContext, useStateContext, useStateContextOptional } from './StateContext';
|
|
8
|
+
export { EnabledContext, useEnabledContext, useEnabledContextOptional, useIsEnabled } from './EnabledContext';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,aAAa,EACb,gBAAgB,EAEnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EAE3B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,YAAY,EACZ,eAAe,EACf,uBAAuB,EAG1B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,YAAY,EAEf,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function toBigIntNoCheck(val: number | bigint | string): bigint;
|
|
2
|
+
export declare const MAX_INT: bigint;
|
|
3
|
+
export declare const MIN_INT: bigint;
|
|
4
|
+
export declare function toBigInt(val: number | bigint | string): bigint;
|
|
5
|
+
export declare const bigIntZero: bigint;
|
|
6
|
+
export declare function absBigInt(val: bigint): bigint;
|
|
7
|
+
export declare function signBigInt(val: bigint): bigint;
|
|
8
|
+
//# sourceMappingURL=bigint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../src/expressions/bigint.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAErE;AAED,eAAO,MAAM,OAAO,QAAyC,CAAC;AAC9D,eAAO,MAAM,OAAO,QAA0C,CAAC;AAE/D,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAM9D;AAED,eAAO,MAAM,UAAU,QAAc,CAAC;AAEtC,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ7C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU9C"}
|