@tamagui/core 1.0.0-alpha.1 → 1.0.0-alpha.6
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 +21 -0
- package/dist/createComponent.js +43 -29
- package/dist/createComponent.js.map +2 -2
- package/dist/createVariable.js +3 -0
- package/dist/createVariable.js.map +2 -2
- package/dist/helpers/getSplitStyles.js +1 -13
- package/dist/helpers/getSplitStyles.js.map +2 -2
- package/dist/helpers/isComponent.js +10 -0
- package/dist/helpers/isComponent.js.map +7 -0
- package/dist/helpers/isTamaguiComponent.js +10 -0
- package/dist/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/helpers/isTamaguiElement.js +10 -0
- package/dist/helpers/isTamaguiElement.js.map +7 -0
- package/dist/hooks/useMedia.js +1 -1
- package/dist/hooks/useMedia.js.map +2 -2
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTheme.js.map +2 -2
- package/dist/index.cjs +145 -133
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +1 -2
- package/dist/index.js.map +2 -2
- package/dist/views/Theme.js +11 -4
- package/dist/views/Theme.js.map +2 -2
- package/dist/views/ThemeInverse.js +0 -1
- package/dist/views/ThemeInverse.js.map +2 -2
- package/package.json +13 -6
- package/src/createComponent.tsx +50 -38
- package/src/createVariable.ts +4 -0
- package/src/helpers/getSplitStyles.tsx +3 -16
- package/src/helpers/isTamaguiElement.tsx +5 -0
- package/src/hooks/useMedia.tsx +1 -1
- package/src/hooks/useTheme.tsx +1 -1
- package/src/index.ts +1 -2
- package/src/views/Theme.tsx +12 -5
- package/src/views/ThemeInverse.tsx +0 -1
- package/types.d.ts +2 -5
- package/.ultra.cache.json +0 -1
- package/_/constants/constants.js +0 -14
- package/_/constants/constants.js.map +0 -7
- package/_/constants/platform.js +0 -20
- package/_/constants/platform.js.map +0 -7
- package/_/constants/pseudos.js +0 -18
- package/_/constants/pseudos.js.map +0 -7
- package/_/constants/rnw.js +0 -22
- package/_/constants/rnw.js.map +0 -7
- package/_/createComponent.js +0 -427
- package/_/createComponent.js.map +0 -7
- package/_/createShorthands.js +0 -10
- package/_/createShorthands.js.map +0 -7
- package/_/createTamagui.js +0 -122
- package/_/createTamagui.js.map +0 -7
- package/_/createTheme.js +0 -20
- package/_/createTheme.js.map +0 -7
- package/_/createTokens.js +0 -29
- package/_/createTokens.js.map +0 -7
- package/_/createVariable.js +0 -22
- package/_/createVariable.js.map +0 -7
- package/_/helpers/addStylesUsingClassname.js +0 -32
- package/_/helpers/addStylesUsingClassname.js.map +0 -7
- package/_/helpers/createMediaStyle.js +0 -34
- package/_/helpers/createMediaStyle.js.map +0 -7
- package/_/helpers/createTamaguiProvider.js +0 -42
- package/_/helpers/createTamaguiProvider.js.map +0 -7
- package/_/helpers/extendStaticConfig.js +0 -176
- package/_/helpers/extendStaticConfig.js.map +0 -7
- package/_/helpers/fixNativeShadow.js +0 -8
- package/_/helpers/fixNativeShadow.js.map +0 -7
- package/_/helpers/fixNativeShadow.native.js +0 -30
- package/_/helpers/fixNativeShadow.native.js.map +0 -7
- package/_/helpers/getSplitStyles.js +0 -160
- package/_/helpers/getSplitStyles.js.map +0 -7
- package/_/helpers/getStylesAtomic.js +0 -84
- package/_/helpers/getStylesAtomic.js.map +0 -7
- package/_/helpers/getStylesAtomic.native.js +0 -10
- package/_/helpers/getStylesAtomic.native.js.map +0 -7
- package/_/helpers/insertStyleRule.js +0 -24
- package/_/helpers/insertStyleRule.js.map +0 -7
- package/_/helpers/matchMedia.js +0 -15
- package/_/helpers/matchMedia.js.map +0 -7
- package/_/helpers/matchMedia.native.js +0 -8
- package/_/helpers/matchMedia.native.js.map +0 -7
- package/_/helpers/themeable.js +0 -26
- package/_/helpers/themeable.js.map +0 -7
- package/_/hooks/useConstant.js +0 -15
- package/_/hooks/useConstant.js.map +0 -7
- package/_/hooks/useFeatures.js +0 -75
- package/_/hooks/useFeatures.js.map +0 -7
- package/_/hooks/useForceUpdate.js +0 -28
- package/_/hooks/useForceUpdate.js.map +0 -7
- package/_/hooks/useMedia.js +0 -173
- package/_/hooks/useMedia.js.map +0 -7
- package/_/hooks/usePressable.js +0 -14
- package/_/hooks/usePressable.js.map +0 -7
- package/_/hooks/useTheme.js +0 -94
- package/_/hooks/useTheme.js.map +0 -7
- package/_/index.js +0 -30
- package/_/index.js.map +0 -7
- package/_/static/postProcessStyles.js +0 -18
- package/_/static/postProcessStyles.js.map +0 -7
- package/_/static.js +0 -12
- package/_/static.js.map +0 -7
- package/_/styled.js +0 -21
- package/_/styled.js.map +0 -7
- package/_/types.js +0 -1
- package/_/types.js.map +0 -7
- package/_/views/Animated.js +0 -79
- package/_/views/Animated.js.map +0 -7
- package/_/views/Stack.js +0 -12
- package/_/views/Stack.js.map +0 -7
- package/_/views/Text.js +0 -60
- package/_/views/Text.js.map +0 -7
- package/_/views/TextAncestorContext.js +0 -19
- package/_/views/TextAncestorContext.js.map +0 -7
- package/_/views/Theme.js +0 -57
- package/_/views/Theme.js.map +0 -7
- package/_/views/ThemeContext.js +0 -6
- package/_/views/ThemeContext.js.map +0 -7
- package/_/views/ThemeInverse.js +0 -27
- package/_/views/ThemeInverse.js.map +0 -7
- package/_/views/ThemeManagerContext.js +0 -56
- package/_/views/ThemeManagerContext.js.map +0 -7
- package/_/views/ThemeProvider.js +0 -45
- package/_/views/ThemeProvider.js.map +0 -7
- package/src/hooks/useForceUpdate.tsx +0 -26
- package/src/views/SafeAreaProvider.tsx +0 -33
- package/tsconfig.json +0 -8
package/dist/index.cjs
CHANGED
|
@@ -56,7 +56,6 @@ var __toModule = (module2) => {
|
|
|
56
56
|
__export(exports, {
|
|
57
57
|
AnimatedStack: () => AnimatedStack,
|
|
58
58
|
GET_DEFAULT_THEME: () => GET_DEFAULT_THEME,
|
|
59
|
-
SafeAreaProvider: () => SafeAreaProvider,
|
|
60
59
|
Spacer: () => Spacer,
|
|
61
60
|
Stack: () => Stack,
|
|
62
61
|
Text: () => Text2,
|
|
@@ -83,6 +82,7 @@ __export(exports, {
|
|
|
83
82
|
isChrome: () => isChrome,
|
|
84
83
|
isObj: () => isObj,
|
|
85
84
|
isSSR: () => isSSR,
|
|
85
|
+
isTamaguiElement: () => isTamaguiElement,
|
|
86
86
|
isTouchDevice: () => isTouchDevice,
|
|
87
87
|
isVariable: () => isVariable,
|
|
88
88
|
isWeb: () => isWeb,
|
|
@@ -104,7 +104,6 @@ __export(exports, {
|
|
|
104
104
|
themeable: () => themeable,
|
|
105
105
|
useConstant: () => useConstant,
|
|
106
106
|
useDefaultThemeName: () => useDefaultThemeName,
|
|
107
|
-
useForceUpdate: () => useForceUpdate,
|
|
108
107
|
useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect,
|
|
109
108
|
useMedia: () => useMedia,
|
|
110
109
|
useTheme: () => useTheme,
|
|
@@ -113,7 +112,8 @@ __export(exports, {
|
|
|
113
112
|
|
|
114
113
|
// src/createComponent.tsx
|
|
115
114
|
var import_helpers4 = __toModule(require("@tamagui/helpers"));
|
|
116
|
-
var
|
|
115
|
+
var import_use_force_update2 = __toModule(require("@tamagui/use-force-update"));
|
|
116
|
+
var import_react11 = __toModule(require("react"));
|
|
117
117
|
var import_react_native3 = __toModule(require("react-native"));
|
|
118
118
|
|
|
119
119
|
// src/constants/platform.ts
|
|
@@ -166,6 +166,9 @@ var Variable = class {
|
|
|
166
166
|
this.name = name;
|
|
167
167
|
this.variable = isWeb ? `var(--${name})` : this.val;
|
|
168
168
|
}
|
|
169
|
+
toString() {
|
|
170
|
+
return isWeb ? this.variable : this.val;
|
|
171
|
+
}
|
|
169
172
|
};
|
|
170
173
|
__name(Variable, "Variable");
|
|
171
174
|
var createVariable = /* @__PURE__ */ __name((props) => new Variable(props), "createVariable");
|
|
@@ -273,8 +276,12 @@ var Theme = /* @__PURE__ */ __name((props) => {
|
|
|
273
276
|
return props.children;
|
|
274
277
|
}
|
|
275
278
|
const name = props.name;
|
|
276
|
-
const
|
|
279
|
+
const activeName = !name ? null : name in themes ? name : `${name}-${parentName}`;
|
|
280
|
+
const theme = activeName ? themes[activeName] : null;
|
|
277
281
|
const themeManager = useConstant(() => {
|
|
282
|
+
if (!theme) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
278
285
|
const manager = new ThemeManager();
|
|
279
286
|
if (name) {
|
|
280
287
|
manager.setActiveTheme(name, themes[name]);
|
|
@@ -282,15 +289,18 @@ var Theme = /* @__PURE__ */ __name((props) => {
|
|
|
282
289
|
return manager;
|
|
283
290
|
});
|
|
284
291
|
useIsomorphicLayoutEffect(() => {
|
|
285
|
-
themeManager
|
|
292
|
+
if (!themeManager) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
themeManager.setActiveTheme(activeName, theme);
|
|
286
296
|
return parent.onChangeTheme((next) => {
|
|
287
297
|
if (next) {
|
|
288
298
|
themeManager.setActiveTheme(next, themes[next]);
|
|
289
299
|
setParentName(next);
|
|
290
300
|
}
|
|
291
301
|
});
|
|
292
|
-
}, [themes,
|
|
293
|
-
if (!name) {
|
|
302
|
+
}, [themes, activeName]);
|
|
303
|
+
if (!name || !theme) {
|
|
294
304
|
return props.children;
|
|
295
305
|
}
|
|
296
306
|
const contents = themeManager ? /* @__PURE__ */ import_react6.default.createElement(ThemeManagerContext.Provider, {
|
|
@@ -364,7 +374,8 @@ function createTamaguiProvider(themeProps) {
|
|
|
364
374
|
__name(createTamaguiProvider, "createTamaguiProvider");
|
|
365
375
|
|
|
366
376
|
// src/hooks/useMedia.tsx
|
|
367
|
-
var
|
|
377
|
+
var import_use_force_update = __toModule(require("@tamagui/use-force-update"));
|
|
378
|
+
var import_react8 = __toModule(require("react"));
|
|
368
379
|
|
|
369
380
|
// src/helpers/matchMedia.ts
|
|
370
381
|
var matchMedia = typeof window !== "undefined" && window.matchMedia || /* @__PURE__ */ __name(function matchMediaFallback(query) {
|
|
@@ -377,30 +388,6 @@ var matchMedia = typeof window !== "undefined" && window.matchMedia || /* @__PUR
|
|
|
377
388
|
};
|
|
378
389
|
}, "matchMediaFallback");
|
|
379
390
|
|
|
380
|
-
// src/hooks/useForceUpdate.tsx
|
|
381
|
-
var import_react8 = __toModule(require("react"));
|
|
382
|
-
function useForceUpdate() {
|
|
383
|
-
const setState = (0, import_react8.useState)(0)[1];
|
|
384
|
-
const internal = (0, import_react8.useRef)();
|
|
385
|
-
if (!internal.current) {
|
|
386
|
-
internal.current = {
|
|
387
|
-
isMounted: true,
|
|
388
|
-
update: () => {
|
|
389
|
-
if (internal.current.isMounted) {
|
|
390
|
-
setState(Math.random());
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
(0, import_react8.useEffect)(() => {
|
|
396
|
-
return () => {
|
|
397
|
-
internal.current.isMounted = false;
|
|
398
|
-
};
|
|
399
|
-
}, []);
|
|
400
|
-
return internal.current.update;
|
|
401
|
-
}
|
|
402
|
-
__name(useForceUpdate, "useForceUpdate");
|
|
403
|
-
|
|
404
391
|
// src/hooks/useMedia.tsx
|
|
405
392
|
var mediaState = {};
|
|
406
393
|
var mediaQueryListeners = {};
|
|
@@ -477,8 +464,8 @@ var configureMedia = /* @__PURE__ */ __name(({
|
|
|
477
464
|
}
|
|
478
465
|
}, "configureMedia");
|
|
479
466
|
var useMedia = /* @__PURE__ */ __name(() => {
|
|
480
|
-
const forceUpdate = useForceUpdate();
|
|
481
|
-
const state = (0,
|
|
467
|
+
const forceUpdate = (0, import_use_force_update.useForceUpdate)();
|
|
468
|
+
const state = (0, import_react8.useRef)();
|
|
482
469
|
if (!state.current) {
|
|
483
470
|
state.current = {
|
|
484
471
|
selections: {},
|
|
@@ -700,7 +687,7 @@ var parseTokens = /* @__PURE__ */ __name((tokens) => {
|
|
|
700
687
|
}, "parseTokens");
|
|
701
688
|
|
|
702
689
|
// src/helpers/addStylesUsingClassname.tsx
|
|
703
|
-
var
|
|
690
|
+
var import_react9 = __toModule(require("react"));
|
|
704
691
|
|
|
705
692
|
// src/helpers/getStylesAtomic.ts
|
|
706
693
|
var import_helpers2 = __toModule(require("@tamagui/helpers"));
|
|
@@ -817,7 +804,7 @@ __name(insertStyleRule, "insertStyleRule");
|
|
|
817
804
|
// src/helpers/addStylesUsingClassname.tsx
|
|
818
805
|
var added = new Set();
|
|
819
806
|
function useStylesAsClassname(styles) {
|
|
820
|
-
if (!
|
|
807
|
+
if (!import_react9.useInsertionEffect) {
|
|
821
808
|
return addStylesUsingClassname(styles);
|
|
822
809
|
} else {
|
|
823
810
|
const insertions = [];
|
|
@@ -826,7 +813,7 @@ function useStylesAsClassname(styles) {
|
|
|
826
813
|
insertions.push(rule);
|
|
827
814
|
}
|
|
828
815
|
});
|
|
829
|
-
(0,
|
|
816
|
+
(0, import_react9.useInsertionEffect)(() => {
|
|
830
817
|
for (const ruleset of insertions) {
|
|
831
818
|
insertStyleRule(ruleset);
|
|
832
819
|
}
|
|
@@ -1090,7 +1077,6 @@ var getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, isSplit
|
|
|
1090
1077
|
const validStyleProps = staticConfig.isText ? import_helpers3.stylePropsText : import_helpers3.validStyles;
|
|
1091
1078
|
const viewProps = {};
|
|
1092
1079
|
const style = [];
|
|
1093
|
-
const blacklistProps = isSplittingDefaultProps ? blacklistDefaultProps : blacklistFinalProps;
|
|
1094
1080
|
let pseudos2 = null;
|
|
1095
1081
|
let cur = null;
|
|
1096
1082
|
let classNames = null;
|
|
@@ -1169,7 +1155,7 @@ var getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, isSplit
|
|
|
1169
1155
|
cur[key] = val;
|
|
1170
1156
|
continue;
|
|
1171
1157
|
}
|
|
1172
|
-
if (!
|
|
1158
|
+
if (!staticConfig.variants || !(key in staticConfig.variants)) {
|
|
1173
1159
|
viewProps[key] = val;
|
|
1174
1160
|
}
|
|
1175
1161
|
}
|
|
@@ -1207,13 +1193,6 @@ var getSubStyle = /* @__PURE__ */ __name((styleIn, staticConfig, theme, props) =
|
|
|
1207
1193
|
fixNativeShadow(styleOut);
|
|
1208
1194
|
return styleOut;
|
|
1209
1195
|
}, "getSubStyle");
|
|
1210
|
-
var blacklistDefaultProps = __spreadValues(__spreadValues({}, import_helpers3.validStyles), import_helpers3.stylePropsText);
|
|
1211
|
-
var blacklistFinalProps = __spreadProps(__spreadValues({}, blacklistDefaultProps), {
|
|
1212
|
-
tag: true,
|
|
1213
|
-
debug: true,
|
|
1214
|
-
space: true,
|
|
1215
|
-
hitSlop: true
|
|
1216
|
-
});
|
|
1217
1196
|
var mapTransformKeys = {
|
|
1218
1197
|
x: "translateX",
|
|
1219
1198
|
y: "translateY"
|
|
@@ -1225,7 +1204,7 @@ var mergeTransform = /* @__PURE__ */ __name((obj, key, val) => {
|
|
|
1225
1204
|
}, "mergeTransform");
|
|
1226
1205
|
|
|
1227
1206
|
// src/hooks/useFeatures.tsx
|
|
1228
|
-
var
|
|
1207
|
+
var import_react10 = __toModule(require("react"));
|
|
1229
1208
|
var createDefinition = /* @__PURE__ */ __name(({ Component, propNames }) => ({
|
|
1230
1209
|
isEnabled: (props) => propNames.some((name) => !!props[name]),
|
|
1231
1210
|
Component
|
|
@@ -1283,7 +1262,7 @@ var useFeatures = /* @__PURE__ */ __name((props, utils) => {
|
|
|
1283
1262
|
const name = featureNames[i];
|
|
1284
1263
|
const { isEnabled, Component } = featureDefinitions[name];
|
|
1285
1264
|
if (isEnabled(props) && Component) {
|
|
1286
|
-
features.push(/* @__PURE__ */
|
|
1265
|
+
features.push(/* @__PURE__ */ import_react10.default.createElement(Component, __spreadProps(__spreadValues({
|
|
1287
1266
|
key: name
|
|
1288
1267
|
}, props), {
|
|
1289
1268
|
_utils: utils
|
|
@@ -1325,9 +1304,41 @@ function createComponent(configIn) {
|
|
|
1325
1304
|
let defaultsStyle;
|
|
1326
1305
|
let defaultsClassName = "";
|
|
1327
1306
|
let initialTheme;
|
|
1328
|
-
const component = (0,
|
|
1329
|
-
var
|
|
1307
|
+
const component = (0, import_react11.forwardRef)((props, forwardedRef) => {
|
|
1308
|
+
var _b2;
|
|
1309
|
+
const forceUpdate = (0, import_use_force_update2.useForceUpdate)();
|
|
1310
|
+
const features = useFeatures(props, { forceUpdate });
|
|
1311
|
+
const manager = (0, import_react11.useContext)(ThemeManagerContext);
|
|
1312
|
+
const [state, set_] = (0, import_react11.useState)(() => ({
|
|
1313
|
+
hover: false,
|
|
1314
|
+
press: false,
|
|
1315
|
+
pressIn: false,
|
|
1316
|
+
theme: manager.name
|
|
1317
|
+
}));
|
|
1318
|
+
const set = /* @__PURE__ */ __name((next) => set_((prev) => {
|
|
1319
|
+
for (const key in next) {
|
|
1320
|
+
if (prev[key] !== next[key]) {
|
|
1321
|
+
return __spreadValues(__spreadValues({}, prev), next);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return prev;
|
|
1325
|
+
}), "set");
|
|
1326
|
+
if (process.env.NODE_ENV === "development" && !isText && isWeb) {
|
|
1327
|
+
import_react11.Children.toArray(props.children).forEach((item) => {
|
|
1328
|
+
if (typeof item === "string") {
|
|
1329
|
+
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
1330
|
+
}
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
const hasTextAncestor = isWeb ? (0, import_react11.useContext)(TextAncestorContext) : false;
|
|
1334
|
+
const hostRef = (0, import_react11.useRef)(null);
|
|
1330
1335
|
const {
|
|
1336
|
+
viewProps: viewPropsIn,
|
|
1337
|
+
pseudos: pseudos2,
|
|
1338
|
+
style,
|
|
1339
|
+
classNames
|
|
1340
|
+
} = getSplitStyles(props, staticConfig, manager.theme || initialTheme);
|
|
1341
|
+
const _a4 = viewPropsIn, {
|
|
1331
1342
|
tag,
|
|
1332
1343
|
hitSlop,
|
|
1333
1344
|
children,
|
|
@@ -1360,34 +1371,52 @@ function createComponent(configIn) {
|
|
|
1360
1371
|
onStartShouldSetResponderCapture,
|
|
1361
1372
|
onMouseDown,
|
|
1362
1373
|
onClick,
|
|
1374
|
+
accessible,
|
|
1375
|
+
accessibilityRole,
|
|
1363
1376
|
onLayout
|
|
1364
|
-
} =
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1377
|
+
} = _a4, viewProps = __objRest(_a4, [
|
|
1378
|
+
"tag",
|
|
1379
|
+
"hitSlop",
|
|
1380
|
+
"children",
|
|
1381
|
+
"pointerEvents",
|
|
1382
|
+
"onPress",
|
|
1383
|
+
"onPressIn",
|
|
1384
|
+
"onPressOut",
|
|
1385
|
+
"onHoverIn",
|
|
1386
|
+
"onHoverOut",
|
|
1387
|
+
"space",
|
|
1388
|
+
"disabled",
|
|
1389
|
+
"onMouseEnter",
|
|
1390
|
+
"onMouseLeave",
|
|
1391
|
+
"hrefAttrs",
|
|
1392
|
+
"onMoveShouldSetResponder",
|
|
1393
|
+
"onMoveShouldSetResponderCapture",
|
|
1394
|
+
"onResponderEnd",
|
|
1395
|
+
"onResponderGrant",
|
|
1396
|
+
"onResponderMove",
|
|
1397
|
+
"onResponderReject",
|
|
1398
|
+
"onResponderRelease",
|
|
1399
|
+
"onResponderStart",
|
|
1400
|
+
"onResponderTerminate",
|
|
1401
|
+
"onResponderTerminationRequest",
|
|
1402
|
+
"onScrollShouldSetResponder",
|
|
1403
|
+
"onScrollShouldSetResponderCapture",
|
|
1404
|
+
"onSelectionChangeShouldSetResponder",
|
|
1405
|
+
"onSelectionChangeShouldSetResponderCapture",
|
|
1406
|
+
"onStartShouldSetResponder",
|
|
1407
|
+
"onStartShouldSetResponderCapture",
|
|
1408
|
+
"onMouseDown",
|
|
1409
|
+
"onClick",
|
|
1410
|
+
"accessible",
|
|
1411
|
+
"accessibilityRole",
|
|
1412
|
+
"onLayout"
|
|
1413
|
+
]);
|
|
1414
|
+
if (!isWeb) {
|
|
1415
|
+
if (accessible)
|
|
1416
|
+
viewProps.accessible = accessible;
|
|
1417
|
+
if (accessibilityRole)
|
|
1418
|
+
viewProps.accessibilityRole = accessibilityRole;
|
|
1388
1419
|
}
|
|
1389
|
-
const hasTextAncestor = isWeb ? (0, import_react12.useContext)(TextAncestorContext) : false;
|
|
1390
|
-
const hostRef = (0, import_react12.useRef)(null);
|
|
1391
1420
|
if (isWeb) {
|
|
1392
1421
|
rnw.useResponderEvents(hostRef, {
|
|
1393
1422
|
onMoveShouldSetResponder,
|
|
@@ -1408,15 +1437,14 @@ function createComponent(configIn) {
|
|
|
1408
1437
|
onStartShouldSetResponderCapture
|
|
1409
1438
|
});
|
|
1410
1439
|
}
|
|
1411
|
-
const isTracking = (0,
|
|
1412
|
-
const
|
|
1413
|
-
const internal = (0, import_react12.useRef)();
|
|
1440
|
+
const isTracking = (0, import_react11.useRef)(false);
|
|
1441
|
+
const internal = (0, import_react11.useRef)();
|
|
1414
1442
|
if (!internal.current) {
|
|
1415
1443
|
internal.current = {
|
|
1416
1444
|
isMounted: true
|
|
1417
1445
|
};
|
|
1418
1446
|
}
|
|
1419
|
-
(0,
|
|
1447
|
+
(0, import_react11.useEffect)(() => {
|
|
1420
1448
|
internal.current.isMounted = true;
|
|
1421
1449
|
const dispose = manager == null ? void 0 : manager.onChangeTheme((name) => {
|
|
1422
1450
|
if (isTracking.current) {
|
|
@@ -1489,7 +1517,7 @@ function createComponent(configIn) {
|
|
|
1489
1517
|
if (shouldAttach) {
|
|
1490
1518
|
internal.current.hasEverHadEvents = true;
|
|
1491
1519
|
}
|
|
1492
|
-
const unPress = (0,
|
|
1520
|
+
const unPress = (0, import_react11.useCallback)(() => {
|
|
1493
1521
|
if (!internal.current.isMounted)
|
|
1494
1522
|
return;
|
|
1495
1523
|
set({
|
|
@@ -1575,27 +1603,27 @@ function createComponent(configIn) {
|
|
|
1575
1603
|
const className = domProps.className && domProps.className !== viewProps.className ? `${domProps.className} ${viewProps.className}` : viewProps.className;
|
|
1576
1604
|
Object.assign(viewProps, domProps);
|
|
1577
1605
|
viewProps.className = className;
|
|
1578
|
-
content = (0,
|
|
1606
|
+
content = (0, import_react11.createElement)(ViewComponent, viewProps, childEls);
|
|
1579
1607
|
} else {
|
|
1580
|
-
content = (0,
|
|
1608
|
+
content = (0, import_react11.createElement)(ViewComponent, viewProps, childEls);
|
|
1581
1609
|
}
|
|
1582
1610
|
const shouldWrapTextAncestor = isWeb && isText && !hasTextAncestor;
|
|
1583
1611
|
if (shouldWrapTextAncestor) {
|
|
1584
|
-
content = (0,
|
|
1612
|
+
content = (0, import_react11.createElement)(TextAncestorContext.Provider, { value: true }, content);
|
|
1585
1613
|
}
|
|
1586
1614
|
if (process.env.NODE_ENV === "development") {
|
|
1587
1615
|
if (props["debug"]) {
|
|
1588
1616
|
viewProps["debug"] = true;
|
|
1589
1617
|
console.log("\u{1F95A} props in:", props);
|
|
1590
1618
|
console.log("\u{1F95A} props out:", viewProps);
|
|
1591
|
-
console.log((
|
|
1619
|
+
console.log((_b2 = props.onClick) == null ? void 0 : _b2.toString());
|
|
1592
1620
|
console.log("\u{1F95A} etc:", { shouldAttach, ViewComponent, viewProps, styles, pseudos: pseudos2, content, childEls });
|
|
1593
1621
|
if (isWeb) {
|
|
1594
1622
|
console.log("\u{1F95A} component info", { staticConfig, tamaguiConfig });
|
|
1595
1623
|
}
|
|
1596
1624
|
}
|
|
1597
1625
|
}
|
|
1598
|
-
return /* @__PURE__ */
|
|
1626
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, features, content);
|
|
1599
1627
|
});
|
|
1600
1628
|
onConfiguredOnce((conf3) => {
|
|
1601
1629
|
var _a4;
|
|
@@ -1669,7 +1697,7 @@ function spacedChildren({
|
|
|
1669
1697
|
if (!space && !isZStack) {
|
|
1670
1698
|
return children;
|
|
1671
1699
|
}
|
|
1672
|
-
const childrenList =
|
|
1700
|
+
const childrenList = import_react11.Children.toArray(children);
|
|
1673
1701
|
const len = childrenList.length;
|
|
1674
1702
|
if (len === 1) {
|
|
1675
1703
|
return children;
|
|
@@ -1680,15 +1708,15 @@ function spacedChildren({
|
|
|
1680
1708
|
continue;
|
|
1681
1709
|
}
|
|
1682
1710
|
const key = `${(child == null ? void 0 : child["key"]) ?? index}`;
|
|
1683
|
-
next.push(/* @__PURE__ */
|
|
1711
|
+
next.push(/* @__PURE__ */ import_react11.default.createElement(import_react11.Fragment, {
|
|
1684
1712
|
key
|
|
1685
|
-
}, isZStack ? /* @__PURE__ */
|
|
1713
|
+
}, isZStack ? /* @__PURE__ */ import_react11.default.createElement(Absolute, null, child) : child));
|
|
1686
1714
|
if ((_a4 = child == null ? void 0 : child["type"]) == null ? void 0 : _a4["isVisuallyHidden"]) {
|
|
1687
1715
|
continue;
|
|
1688
1716
|
}
|
|
1689
1717
|
if (index !== len - 1) {
|
|
1690
1718
|
if (space) {
|
|
1691
|
-
next.push(/* @__PURE__ */
|
|
1719
|
+
next.push(/* @__PURE__ */ import_react11.default.createElement(Spacer, {
|
|
1692
1720
|
key: `${key}_spacer`,
|
|
1693
1721
|
direction: flexDirection === "row" || flexDirection === "row-reverse" ? "horizontal" : "vertical",
|
|
1694
1722
|
size: space
|
|
@@ -1699,7 +1727,7 @@ function spacedChildren({
|
|
|
1699
1727
|
return next;
|
|
1700
1728
|
}
|
|
1701
1729
|
__name(spacedChildren, "spacedChildren");
|
|
1702
|
-
var Absolute = /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */
|
|
1730
|
+
var Absolute = /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ import_react11.default.createElement(import_react_native3.View, {
|
|
1703
1731
|
style: sheet.fullscreen
|
|
1704
1732
|
}, children), "Absolute");
|
|
1705
1733
|
var sheet = import_react_native3.StyleSheet.create({
|
|
@@ -1792,13 +1820,14 @@ function styled(Component, options, staticExtractionOptions) {
|
|
|
1792
1820
|
__name(styled, "styled");
|
|
1793
1821
|
|
|
1794
1822
|
// src/helpers/themeable.tsx
|
|
1795
|
-
var
|
|
1823
|
+
var import_react14 = __toModule(require("react"));
|
|
1796
1824
|
|
|
1797
1825
|
// src/views/ThemeInverse.tsx
|
|
1798
|
-
var
|
|
1826
|
+
var import_react13 = __toModule(require("react"));
|
|
1799
1827
|
|
|
1800
1828
|
// src/hooks/useTheme.tsx
|
|
1801
|
-
var
|
|
1829
|
+
var import_use_force_update3 = __toModule(require("@tamagui/use-force-update"));
|
|
1830
|
+
var import_react12 = __toModule(require("react"));
|
|
1802
1831
|
var areEqualSets = /* @__PURE__ */ __name((a, b) => {
|
|
1803
1832
|
if (a.size !== b.size)
|
|
1804
1833
|
return false;
|
|
@@ -1810,9 +1839,9 @@ var areEqualSets = /* @__PURE__ */ __name((a, b) => {
|
|
|
1810
1839
|
return true;
|
|
1811
1840
|
}, "areEqualSets");
|
|
1812
1841
|
var useThemeName = /* @__PURE__ */ __name(() => {
|
|
1813
|
-
const parent = (0,
|
|
1814
|
-
const [name, setName] = (0,
|
|
1815
|
-
(0,
|
|
1842
|
+
const parent = (0, import_react12.useContext)(ThemeManagerContext);
|
|
1843
|
+
const [name, setName] = (0, import_react12.useState)(parent.name);
|
|
1844
|
+
(0, import_react12.useEffect)(() => {
|
|
1816
1845
|
return parent.onChangeTheme((next) => {
|
|
1817
1846
|
setName((prev) => {
|
|
1818
1847
|
if (prev === next)
|
|
@@ -1824,13 +1853,13 @@ var useThemeName = /* @__PURE__ */ __name(() => {
|
|
|
1824
1853
|
return name || "light";
|
|
1825
1854
|
}, "useThemeName");
|
|
1826
1855
|
var useDefaultThemeName = /* @__PURE__ */ __name(() => {
|
|
1827
|
-
return (0,
|
|
1856
|
+
return (0, import_react12.useContext)(ThemeContext)[GET_DEFAULT_THEME];
|
|
1828
1857
|
}, "useDefaultThemeName");
|
|
1829
1858
|
var useTheme = /* @__PURE__ */ __name(() => {
|
|
1830
|
-
const forceUpdate = useForceUpdate();
|
|
1831
|
-
const manager = (0,
|
|
1832
|
-
const themes = (0,
|
|
1833
|
-
const state = (0,
|
|
1859
|
+
const forceUpdate = (0, import_use_force_update3.useForceUpdate)();
|
|
1860
|
+
const manager = (0, import_react12.useContext)(ThemeManagerContext);
|
|
1861
|
+
const themes = (0, import_react12.useContext)(ThemeContext);
|
|
1862
|
+
const state = (0, import_react12.useRef)();
|
|
1834
1863
|
if (!state.current) {
|
|
1835
1864
|
state.current = {
|
|
1836
1865
|
uuid: {},
|
|
@@ -1847,11 +1876,11 @@ var useTheme = /* @__PURE__ */ __name(() => {
|
|
|
1847
1876
|
manager.track(st.uuid, st.keys);
|
|
1848
1877
|
}
|
|
1849
1878
|
});
|
|
1850
|
-
(0,
|
|
1879
|
+
(0, import_react12.useEffect)(() => {
|
|
1851
1880
|
return manager.onUpdate(state.current.uuid, forceUpdate);
|
|
1852
1881
|
}, []);
|
|
1853
1882
|
const theme = (manager.name ? themes[manager.name] : themes.light) ?? themes.light;
|
|
1854
|
-
return (0,
|
|
1883
|
+
return (0, import_react12.useMemo)(() => {
|
|
1855
1884
|
return new Proxy(theme, {
|
|
1856
1885
|
get(_, key) {
|
|
1857
1886
|
const name = manager.name;
|
|
@@ -1891,22 +1920,21 @@ var ThemeInverse = /* @__PURE__ */ __name((props) => {
|
|
|
1891
1920
|
const themeName = useThemeName();
|
|
1892
1921
|
const defaultTheme = useDefaultThemeName();
|
|
1893
1922
|
const name = inversions[themeName] || inversions[defaultTheme] || null;
|
|
1894
|
-
|
|
1895
|
-
return /* @__PURE__ */ import_react14.default.createElement(Theme, {
|
|
1923
|
+
return /* @__PURE__ */ import_react13.default.createElement(Theme, {
|
|
1896
1924
|
name
|
|
1897
1925
|
}, props.children);
|
|
1898
1926
|
}, "ThemeInverse");
|
|
1899
1927
|
|
|
1900
1928
|
// src/helpers/themeable.tsx
|
|
1901
1929
|
var themeable = /* @__PURE__ */ __name(function graphql(component) {
|
|
1902
|
-
const withThemeComponent = (0,
|
|
1930
|
+
const withThemeComponent = (0, import_react14.forwardRef)(/* @__PURE__ */ __name(function WithTheme(_a4, ref) {
|
|
1903
1931
|
var _b2 = _a4, { themeInverse } = _b2, rest = __objRest(_b2, ["themeInverse"]);
|
|
1904
|
-
const el =
|
|
1932
|
+
const el = import_react14.default.createElement(component, __spreadProps(__spreadValues({}, rest), { ref }));
|
|
1905
1933
|
if (themeInverse) {
|
|
1906
|
-
return /* @__PURE__ */
|
|
1934
|
+
return /* @__PURE__ */ import_react14.default.createElement(ThemeInverse, null, el);
|
|
1907
1935
|
}
|
|
1908
1936
|
if (rest.theme) {
|
|
1909
|
-
return /* @__PURE__ */
|
|
1937
|
+
return /* @__PURE__ */ import_react14.default.createElement(Theme, {
|
|
1910
1938
|
name: rest.theme || null
|
|
1911
1939
|
}, el);
|
|
1912
1940
|
}
|
|
@@ -1917,6 +1945,13 @@ var themeable = /* @__PURE__ */ __name(function graphql(component) {
|
|
|
1917
1945
|
return withTheme;
|
|
1918
1946
|
}, "graphql");
|
|
1919
1947
|
|
|
1948
|
+
// src/helpers/isTamaguiElement.tsx
|
|
1949
|
+
var import_react15 = __toModule(require("react"));
|
|
1950
|
+
var isTamaguiElement = /* @__PURE__ */ __name((child) => {
|
|
1951
|
+
var _a4;
|
|
1952
|
+
return (0, import_react15.isValidElement)(child) && !!((_a4 = child.type["staticConfig"]) == null ? void 0 : _a4.parsed);
|
|
1953
|
+
}, "isTamaguiElement");
|
|
1954
|
+
|
|
1920
1955
|
// src/views/Animated.tsx
|
|
1921
1956
|
var import_react16 = __toModule(require("react"));
|
|
1922
1957
|
var import_react_native4 = __toModule(require("react-native"));
|
|
@@ -2099,27 +2134,4 @@ var Text2 = createComponent({
|
|
|
2099
2134
|
cursor: true
|
|
2100
2135
|
})
|
|
2101
2136
|
});
|
|
2102
|
-
|
|
2103
|
-
// src/views/SafeAreaProvider.tsx
|
|
2104
|
-
var import_react17 = __toModule(require("react"));
|
|
2105
|
-
var import_react_native5 = __toModule(require("react-native"));
|
|
2106
|
-
var import_react_native_safe_area_context = __toModule(require("react-native-safe-area-context"));
|
|
2107
|
-
var defaultMetrics = null;
|
|
2108
|
-
var SafeAreaProvider = /* @__PURE__ */ __name(({
|
|
2109
|
-
initialWindowMetrics,
|
|
2110
|
-
children
|
|
2111
|
-
}) => {
|
|
2112
|
-
if (!initialWindowMetrics && !defaultMetrics) {
|
|
2113
|
-
defaultMetrics = import_react_native5.Platform.select({
|
|
2114
|
-
web: {
|
|
2115
|
-
frame: { x: 0, y: 0, width: 0, height: 0 },
|
|
2116
|
-
insets: { top: 0, left: 0, right: 0, bottom: 0 }
|
|
2117
|
-
},
|
|
2118
|
-
default: import_react_native_safe_area_context.initialWindowMetrics
|
|
2119
|
-
});
|
|
2120
|
-
}
|
|
2121
|
-
return /* @__PURE__ */ import_react17.default.createElement(import_react_native_safe_area_context.SafeAreaProvider, {
|
|
2122
|
-
initialMetrics: initialWindowMetrics ?? defaultMetrics
|
|
2123
|
-
}, children);
|
|
2124
|
-
}, "SafeAreaProvider");
|
|
2125
2137
|
//# sourceMappingURL=index.cjs.map
|