@applicaster/zapp-react-native-utils 13.0.0-alpha.1212224153 → 13.0.0-alpha.1320049970

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.
Files changed (29) hide show
  1. package/appUtils/HooksManager/Hook.ts +2 -2
  2. package/appUtils/HooksManager/types.ts +2 -2
  3. package/appUtils/contextKeysManager/contextResolver.ts +6 -2
  4. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +1 -0
  5. package/appUtils/focusManager/index.ts +11 -3
  6. package/appUtils/platform/platformUtils.ts +24 -3
  7. package/appUtils/playerManager/player.ts +2 -2
  8. package/idleUtils/__tests__/withTimeout$.test.ts +37 -0
  9. package/idleUtils/index.ts +1 -1
  10. package/idleUtils/withTimeout.ts +15 -2
  11. package/manifestUtils/__tests__/createConfig.test.js +0 -2
  12. package/navigationUtils/index.ts +3 -3
  13. package/numberUtils/index.ts +7 -5
  14. package/package.json +2 -2
  15. package/reactHooks/layout/useDimensions/helpers/__tests__/getInitialDimensions.test.js +1 -1
  16. package/reactHooks/layout/useDimensions/useDimensions.ts +8 -0
  17. package/reactHooks/navigation/useGetTabBarHeight.ts +1 -3
  18. package/reactHooks/state/useRefWithInitialValue.ts +14 -0
  19. package/reactHooks/state/useStateFromSubscribe.ts +23 -0
  20. package/reactHooks/usePluginConfiguration.ts +1 -1
  21. package/reactHooks/useSubscriberFor.ts +4 -3
  22. package/screenState/index.ts +24 -10
  23. package/theme/index.ts +1 -1
  24. package/time/Timer.ts +4 -1
  25. package/types.ts +1 -0
  26. package/zappFrameworkUtils/presentPluginOneTime.ts +2 -3
  27. package/manifestUtils/sharedConfiguration/screenPicker/__tests__/utils.test.js +0 -304
  28. package/manifestUtils/sharedConfiguration/screenPicker/stylesFields.js +0 -875
  29. package/manifestUtils/sharedConfiguration/screenPicker/utils.js +0 -130
@@ -1,130 +0,0 @@
1
- const defaultPlatforms = {
2
- tvos: "tvOS",
3
- android_tv: "Android TV",
4
- lg_tv: "LG TV",
5
- samsung_tv: "Samsung TV",
6
- };
7
-
8
- const global_defaults = {
9
- fontSize: 20,
10
- lineHeight: 40,
11
- letterSpacing: 0.4,
12
- };
13
-
14
- const generateFontConfiguration = (platforms = defaultPlatforms) => {
15
- const platformEntries = Object.entries(platforms);
16
- const defaultsEntries = Object.entries(global_defaults);
17
- const splitCamelCase = (str) => str.replace(/([a-z](?=[A-Z]))/g, "$1_");
18
-
19
- return platformEntries.reduce((acc, [platformKey, platformValue]) => {
20
- acc.push(
21
- ...defaultsEntries.reduce((acc2, [valueKey, defaultValue]) => {
22
- acc2.push({
23
- type: "number_input",
24
- label: `${platformValue} ${splitCamelCase(valueKey).replace(
25
- "_",
26
- " "
27
- )}`,
28
- key: `${platformKey}_${splitCamelCase(valueKey)}`.toLowerCase(),
29
- initial_value: defaultValue,
30
- });
31
-
32
- return acc2;
33
- }, [])
34
- );
35
-
36
- return acc;
37
- }, []);
38
- };
39
-
40
- const conditional_rule = (key, condition_value) => ({
41
- key,
42
- condition_value,
43
- });
44
-
45
- const createConditionalConfig = (rules, matchAll = false) => ({
46
- rules: matchAll ? "all_conditions" : "conditional",
47
- conditional_fields: rules.map((field) => conditional_rule(...field)),
48
- });
49
-
50
- const conditional_horizontal_type = createConditionalConfig([
51
- ["styles/screen_picker_type", "horizontal"],
52
- ]);
53
-
54
- const conditional_vertical_type = createConditionalConfig([
55
- ["styles/screen_picker_type", "vertical"],
56
- ]);
57
-
58
- const conditional_horizontal_type_item_fixed = createConditionalConfig(
59
- [
60
- ["styles/screen_picker_type", "horizontal"],
61
- ["styles/screen_picker_item_size", "fixed"],
62
- ],
63
- true
64
- );
65
-
66
- const conditional_horizontal_type_item_dynamic = createConditionalConfig(
67
- [
68
- ["styles/screen_picker_type", "horizontal"],
69
- ["screen_picker_horizontal_display_type", "dynamic"],
70
- ],
71
- true
72
- );
73
-
74
- const conditional_horizontal_display_type_fixed = createConditionalConfig(
75
- [
76
- ["styles/screen_picker_type", "horizontal"],
77
- ["styles/screen_picker_horizontal_display_type", "fixed"],
78
- ],
79
- true
80
- );
81
-
82
- const conditional_horizontal_asset_on = createConditionalConfig(
83
- [
84
- ["styles/screen_picker_type", "horizontal"],
85
- ["styles/screen_picker_asset_switch", true],
86
- ],
87
- true
88
- );
89
-
90
- const createVariationFields = ({
91
- prefix = "screen_picker",
92
- key,
93
- type = "number_input",
94
- label = "",
95
- variants: [a, b],
96
- }) => {
97
- return [
98
- {
99
- type,
100
- key: `${prefix}${prefix.length > 0 ? "_" : ""}${
101
- a?.key ?? "vertical"
102
- }_${key}`,
103
- label: a?.label ?? label,
104
- initial_value: a.initial_value,
105
- ...conditional_vertical_type,
106
- },
107
- {
108
- type,
109
- key: `${prefix}${prefix.length > 0 ? "_" : ""}${
110
- b.key ?? "horizontal"
111
- }_${key}`,
112
- label: b?.label ?? label,
113
- initial_value: b.initial_value,
114
- ...conditional_horizontal_type,
115
- },
116
- ];
117
- };
118
-
119
- module.exports = {
120
- generateFontConfiguration,
121
- createVariationFields,
122
- createConditionalConfig,
123
- conditional_rule,
124
- conditional_horizontal_type,
125
- conditional_vertical_type,
126
- conditional_horizontal_type_item_fixed,
127
- conditional_horizontal_type_item_dynamic,
128
- conditional_horizontal_display_type_fixed,
129
- conditional_horizontal_asset_on,
130
- };