@tamagui/core 1.0.1-beta.91 → 1.0.1-beta.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants/rnw.native.js +0 -0
- package/dist/cjs/constants/rnw.native.js.map +0 -0
- package/dist/cjs/createComponent.js +39 -49
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +24 -17
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/expandStyle.js +120 -0
- package/dist/cjs/helpers/expandStyle.js.map +7 -0
- package/dist/cjs/helpers/expandStyles.js +126 -0
- package/dist/cjs/helpers/expandStyles.js.map +7 -0
- package/dist/cjs/helpers/extendStaticConfig.js +5 -3
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/{getTextSize.js → getFont.js} +14 -8
- package/dist/cjs/helpers/getFont.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +113 -108
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +165 -4
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/normalizeColor.js +76 -0
- package/dist/cjs/helpers/normalizeColor.js.map +7 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js +90 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/cjs/hooks/useFeatures.js +5 -2
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +1 -1
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/static.js +1 -1
- package/dist/cjs/static.js.map +2 -2
- package/dist/esm/constants/rnw.native.js +0 -0
- package/dist/esm/constants/rnw.native.js.map +0 -0
- package/dist/esm/createComponent.js +39 -49
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +22 -15
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/expandStyle.js +99 -0
- package/dist/esm/helpers/expandStyle.js.map +7 -0
- package/dist/esm/helpers/expandStyles.js +103 -0
- package/dist/esm/helpers/expandStyles.js.map +7 -0
- package/dist/esm/helpers/extendStaticConfig.js +5 -3
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/{getTextSize.js → getFont.js} +10 -4
- package/dist/esm/helpers/getFont.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +114 -108
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +158 -2
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/normalizeColor.js +49 -0
- package/dist/esm/helpers/normalizeColor.js.map +7 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js +67 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/esm/hooks/useFeatures.js +5 -2
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +1 -1
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +2 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/static.js +1 -1
- package/dist/esm/static.js.map +1 -1
- package/package.json +8 -8
- package/reset.css +2 -2
- package/types/constants/rnw.native.d.ts +0 -0
- package/types/constants/rnw.native.d.ts.map +0 -0
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +2 -2
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/createTamaguiProvider.d.ts +1 -0
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
- package/types/helpers/expandStyle.d.ts +2 -0
- package/types/helpers/expandStyle.d.ts.map +1 -0
- package/types/helpers/expandStyles.d.ts +7 -0
- package/types/helpers/expandStyles.d.ts.map +1 -0
- package/types/helpers/extendStaticConfig.d.ts.map +1 -1
- package/types/helpers/getFont.d.ts +3 -0
- package/types/helpers/getFont.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +2 -3
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts +6 -0
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/normalizeColor.d.ts +3 -0
- package/types/helpers/normalizeColor.d.ts.map +1 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +2 -0
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -0
- package/types/hooks/useFeatures.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
- package/types/static.d.ts +1 -1
- package/types/static.d.ts.map +1 -1
- package/dist/cjs/assignNativePropsToWeb.js +0 -187
- package/dist/cjs/assignNativePropsToWeb.js.map +0 -7
- package/dist/cjs/helpers/fixNativeShadow.native.js +0 -51
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/cjs/helpers/generateAtomicStyles.js +0 -437
- package/dist/cjs/helpers/generateAtomicStyles.js.map +0 -7
- package/dist/cjs/helpers/getTextSize.js.map +0 -7
- package/dist/esm/assignNativePropsToWeb.js +0 -164
- package/dist/esm/assignNativePropsToWeb.js.map +0 -7
- package/dist/esm/helpers/fixNativeShadow.native.js +0 -28
- package/dist/esm/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/esm/helpers/generateAtomicStyles.js +0 -410
- package/dist/esm/helpers/generateAtomicStyles.js.map +0 -7
- package/dist/esm/helpers/getTextSize.js.map +0 -7
- package/types/assignNativePropsToWeb.d.ts +0 -2
- package/types/assignNativePropsToWeb.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.native.d.ts +0 -3
- package/types/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/types/helpers/generateAtomicStyles.d.ts +0 -12
- package/types/helpers/generateAtomicStyles.d.ts.map +0 -1
- package/types/helpers/getTextSize.d.ts +0 -3
- package/types/helpers/getTextSize.d.ts.map +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/assignNativePropsToWeb.tsx"],
|
|
4
|
-
"sourcesContent": ["import { accessibilityRoleToWebRole, processIDRefList } from './createComponent'\n\n// adapted from react-native-web\n\nexport function assignNativePropsToWeb(elementType: string, viewProps: any, nativeProps: any) {\n if (!viewProps.role && nativeProps.accessibilityRole) {\n if (nativeProps.accessibilityRole === 'none') {\n viewProps.role = 'presentation'\n } else {\n const webRole = accessibilityRoleToWebRole[nativeProps.accessibilityRole]\n if (webRole != null) {\n viewProps.role = webRole || nativeProps.accessibilityRole\n }\n }\n }\n\n if (nativeProps.accessibilityActiveDescendant != null) {\n viewProps['aria-activedescendant'] = nativeProps.accessibilityActiveDescendant\n }\n if (nativeProps.accessibilityAtomic != null) {\n viewProps['aria-atomic'] = nativeProps.accessibilityAtomic\n }\n if (nativeProps.accessibilityAutoComplete != null) {\n viewProps['aria-autocomplete'] = nativeProps.accessibilityAutoComplete\n }\n if (nativeProps.accessibilityBusy != null) {\n viewProps['aria-busy'] = nativeProps.accessibilityBusy\n }\n if (nativeProps.accessibilityChecked != null) {\n viewProps['aria-checked'] = nativeProps.accessibilityChecked\n }\n if (nativeProps.accessibilityColumnCount != null) {\n viewProps['aria-colcount'] = nativeProps.accessibilityColumnCount\n }\n if (nativeProps.accessibilityColumnIndex != null) {\n viewProps['aria-colindex'] = nativeProps.accessibilityColumnIndex\n }\n if (nativeProps.accessibilityColumnSpan != null) {\n viewProps['aria-colspan'] = nativeProps.accessibilityColumnSpan\n }\n if (nativeProps.accessibilityControls != null) {\n viewProps['aria-controls'] = processIDRefList(nativeProps.accessibilityControls)\n }\n if (nativeProps.accessibilityCurrent != null) {\n viewProps['aria-current'] = nativeProps.accessibilityCurrent\n }\n if (nativeProps.accessibilityDescribedBy != null) {\n viewProps['aria-describedby'] = processIDRefList(nativeProps.accessibilityDescribedBy)\n }\n if (nativeProps.accessibilityDetails != null) {\n viewProps['aria-details'] = nativeProps.accessibilityDetails\n }\n if (nativeProps.disabled === true) {\n viewProps['aria-disabled'] = true\n // Enhance with native semantics\n if (\n elementType === 'button' ||\n elementType === 'form' ||\n elementType === 'input' ||\n elementType === 'select' ||\n elementType === 'textarea'\n ) {\n viewProps.disabled = true\n }\n }\n if (nativeProps.accessibilityErrorMessage != null) {\n viewProps['aria-errormessage'] = nativeProps.accessibilityErrorMessage\n }\n if (nativeProps.accessibilityExpanded != null) {\n viewProps['aria-expanded'] = nativeProps.accessibilityExpanded\n }\n if (nativeProps.accessibilityFlowTo != null) {\n viewProps['aria-flowto'] = processIDRefList(nativeProps.accessibilityFlowTo)\n }\n if (nativeProps.accessibilityHasPopup != null) {\n viewProps['aria-haspopup'] = nativeProps.accessibilityHasPopup\n }\n if (nativeProps.accessibilityHidden === true) {\n viewProps['aria-hidden'] = nativeProps.accessibilityHidden\n }\n if (nativeProps.accessibilityInvalid != null) {\n viewProps['aria-invalid'] = nativeProps.accessibilityInvalid\n }\n if (\n nativeProps.accessibilityKeyShortcuts != null &&\n Array.isArray(nativeProps.accessibilityKeyShortcuts)\n ) {\n viewProps['aria-keyshortcuts'] = nativeProps.accessibilityKeyShortcuts.join(' ')\n }\n if (nativeProps.accessibilityLabel != null) {\n viewProps['aria-label'] = nativeProps.accessibilityLabel\n }\n if (nativeProps.accessibilityLabelledBy != null) {\n viewProps['aria-labelledby'] = processIDRefList(nativeProps.accessibilityLabelledBy)\n }\n if (nativeProps.accessibilityLevel != null) {\n viewProps['aria-level'] = nativeProps.accessibilityLevel\n }\n if (nativeProps.accessibilityLiveRegion != null) {\n viewProps['aria-live'] =\n nativeProps.accessibilityLiveRegion === 'none' ? 'off' : nativeProps.accessibilityLiveRegion\n }\n if (nativeProps.accessibilityModal != null) {\n viewProps['aria-modal'] = nativeProps.accessibilityModal\n }\n if (nativeProps.accessibilityMultiline != null) {\n viewProps['aria-multiline'] = nativeProps.accessibilityMultiline\n }\n if (nativeProps.accessibilityMultiSelectable != null) {\n viewProps['aria-multiselectable'] = nativeProps.accessibilityMultiSelectable\n }\n if (nativeProps.accessibilityOrientation != null) {\n viewProps['aria-orientation'] = nativeProps.accessibilityOrientation\n }\n if (nativeProps.accessibilityOwns != null) {\n viewProps['aria-owns'] = processIDRefList(nativeProps.accessibilityOwns)\n }\n if (nativeProps.accessibilityPlaceholder != null) {\n viewProps['aria-placeholder'] = nativeProps.accessibilityPlaceholder\n }\n if (nativeProps.accessibilityPosInSet != null) {\n viewProps['aria-posinset'] = nativeProps.accessibilityPosInSet\n }\n if (nativeProps.accessibilityPressed != null) {\n viewProps['aria-pressed'] = nativeProps.accessibilityPressed\n }\n if (nativeProps.accessibilityReadOnly != null) {\n viewProps['aria-readonly'] = nativeProps.accessibilityReadOnly\n // Enhance with native semantics\n if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {\n viewProps.readOnly = true\n }\n }\n if (nativeProps.accessibilityRequired != null) {\n viewProps['aria-required'] = nativeProps.accessibilityRequired\n // Enhance with native semantics\n if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {\n viewProps.required = true\n }\n }\n if (nativeProps.accessibilityRoleDescription != null) {\n viewProps['aria-roledescription'] = nativeProps.accessibilityRoleDescription\n }\n if (nativeProps.accessibilityRowCount != null) {\n viewProps['aria-rowcount'] = nativeProps.accessibilityRowCount\n }\n if (nativeProps.accessibilityRowIndex != null) {\n viewProps['aria-rowindex'] = nativeProps.accessibilityRowIndex\n }\n if (nativeProps.accessibilityRowSpan != null) {\n viewProps['aria-rowspan'] = nativeProps.accessibilityRowSpan\n }\n if (nativeProps.accessibilitySelected != null) {\n viewProps['aria-selected'] = nativeProps.accessibilitySelected\n }\n if (nativeProps.accessibilitySetSize != null) {\n viewProps['aria-setsize'] = nativeProps.accessibilitySetSize\n }\n if (nativeProps.accessibilitySort != null) {\n viewProps['aria-sort'] = nativeProps.accessibilitySort\n }\n if (nativeProps.accessibilityValueMax != null) {\n viewProps['aria-valuemax'] = nativeProps.accessibilityValueMax\n }\n if (nativeProps.accessibilityValueMin != null) {\n viewProps['aria-valuemin'] = nativeProps.accessibilityValueMin\n }\n if (nativeProps.accessibilityValueNow != null) {\n viewProps['aria-valuenow'] = nativeProps.accessibilityValueNow\n }\n if (nativeProps.accessibilityValueText != null) {\n viewProps['aria-valuetext'] = nativeProps.accessibilityValueText\n }\n\n if (nativeProps.nativeID) {\n viewProps.id = nativeProps.nativeID\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAIO,gCAAgC,aAAqB,WAAgB,aAAkB;AAC5F,MAAI,CAAC,UAAU,QAAQ,YAAY,mBAAmB;AACpD,QAAI,YAAY,sBAAsB,QAAQ;AAC5C,gBAAU,OAAO;AAAA,IACnB,OAAO;AACL,YAAM,UAAU,2BAA2B,YAAY;AACvD,UAAI,WAAW,MAAM;AACnB,kBAAU,OAAO,WAAW,YAAY;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AAEA,MAAI,YAAY,iCAAiC,MAAM;AACrD,cAAU,2BAA2B,YAAY;AAAA,EACnD;AACA,MAAI,YAAY,uBAAuB,MAAM;AAC3C,cAAU,iBAAiB,YAAY;AAAA,EACzC;AACA,MAAI,YAAY,6BAA6B,MAAM;AACjD,cAAU,uBAAuB,YAAY;AAAA,EAC/C;AACA,MAAI,YAAY,qBAAqB,MAAM;AACzC,cAAU,eAAe,YAAY;AAAA,EACvC;AACA,MAAI,YAAY,wBAAwB,MAAM;AAC5C,cAAU,kBAAkB,YAAY;AAAA,EAC1C;AACA,MAAI,YAAY,4BAA4B,MAAM;AAChD,cAAU,mBAAmB,YAAY;AAAA,EAC3C;AACA,MAAI,YAAY,4BAA4B,MAAM;AAChD,cAAU,mBAAmB,YAAY;AAAA,EAC3C;AACA,MAAI,YAAY,2BAA2B,MAAM;AAC/C,cAAU,kBAAkB,YAAY;AAAA,E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;AAC7C,cAAU,mBAAmB,YAAY;AAAA,EAC3C;AACA,MAAI,YAAY,wBAAwB,MAAM;AAC5C,cAAU,kBAAkB,YAAY;AAAA,EAC1C;AACA,MAAI,YAAY,yBAAyB,MAAM;AAC7C,cAAU,mBAAmB,YAAY;AAAA,EAC3C;AACA,MAAI,YAAY,wBAAwB,MAAM;AAC5C,cAAU,kBAAkB,YAAY;AAAA,EAC1C;AACA,MAAI,YAAY,qBAAqB,MAAM;AACzC,cAAU,eAAe,YAAY;AAAA,EACvC;AACA,MAAI,YAAY,yBAAyB,MAAM;AAC7C,cAAU,mBAAmB,YAAY;AAAA,EAC3C;AACA,MAAI,YAAY,yBAAyB,MAAM;AAC7C,cAAU,mBAAmB,YAAY;AAAA,EAC3C;AACA,MAAI,YAAY,yBAAyB,MAAM;AAC7C,cAAU,mBAAmB,YAAY;AAAA,EAC3C;AACA,MAAI,YAAY,0BAA0B,MAAM;AAC9C,cAAU,oBAAoB,YAAY;AAAA,EAC5C;AAEA,MAAI,YAAY,UAAU;AACxB,cAAU,KAAK,YAAY;AAAA,EAC7B;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const matchRgbaHsla = /(rgba|hsla)\(\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,})\s*\)$/;
|
|
2
|
-
function fixNativeShadow(props) {
|
|
3
|
-
if (!props.shadowColor || props.shadowColor === "transparent") {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
if (!props.shadowOffset) {
|
|
7
|
-
props.shadowOffset = {
|
|
8
|
-
width: 0,
|
|
9
|
-
height: 0
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
const c = String(props.shadowColor);
|
|
13
|
-
if ((c[0] === "r" || c[0] === "h") && c[3] === "a") {
|
|
14
|
-
const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || [];
|
|
15
|
-
if (typeof a !== "string") {
|
|
16
|
-
console.trace("invalid", c, type);
|
|
17
|
-
throw new Error(`invalid style`);
|
|
18
|
-
}
|
|
19
|
-
props.shadowColor = `${type.replace("a", "")}(${_1},${_2},${_3})`;
|
|
20
|
-
props.shadowOpacity = props.shadowOpacity ?? +a;
|
|
21
|
-
} else {
|
|
22
|
-
props.shadowOpacity = props.shadowOpacity ?? 1;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
fixNativeShadow
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=fixNativeShadow.native.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/fixNativeShadow.native.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ViewStyle } from 'react-native'\n\nconst matchRgbaHsla =\n /(rgba|hsla)\\(\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,})\\s*\\)$/\n\nexport function fixNativeShadow(props: ViewStyle) {\n if (!props.shadowColor || props.shadowColor === 'transparent') {\n return\n }\n if (!props.shadowOffset) {\n // fixes some broken shadows\n props.shadowOffset = {\n width: 0,\n height: 0,\n }\n }\n const c = String(props.shadowColor)\n // react native has issues sometimes with rgba/hsla() convert to color + opacity\n if ((c[0] === 'r' || c[0] === 'h') && c[3] === 'a') {\n const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || []\n if (typeof a !== 'string') {\n console.trace('invalid', c, type)\n throw new Error(`invalid style`)\n }\n props.shadowColor = `${type.replace('a', '')}(${_1},${_2},${_3})`\n props.shadowOpacity = props.shadowOpacity ?? +a\n } else {\n props.shadowOpacity = props.shadowOpacity ?? 1\n }\n}\n"],
|
|
5
|
-
"mappings": "AAEA,MAAM,gBACJ;AAEK,yBAAyB,OAAkB;AAChD,MAAI,CAAC,MAAM,eAAe,MAAM,gBAAgB,eAAe;AAC7D;AAAA,EACF;AACA,MAAI,CAAC,MAAM,cAAc;AAEvB,UAAM,eAAe;AAAA,MACnB,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AACA,QAAM,IAAI,OAAO,MAAM,WAAW;AAElC,MAAK,GAAE,OAAO,OAAO,EAAE,OAAO,QAAQ,EAAE,OAAO,KAAK;AAClD,UAAM,CAAC,GAAG,MAAM,IAAI,IAAI,IAAI,KAAK,EAAE,MAAM,aAAa,KAAK,CAAC;AAC5D,QAAI,OAAO,MAAM,UAAU;AACzB,cAAQ,MAAM,WAAW,GAAG,IAAI;AAChC,YAAM,IAAI,MAAM,eAAe;AAAA,IACjC;AACA,UAAM,cAAc,GAAG,KAAK,QAAQ,KAAK,EAAE,KAAK,MAAM,MAAM;AAC5D,UAAM,gBAAgB,MAAM,iBAAiB,CAAC;AAAA,EAChD,OAAO;AACL,UAAM,gBAAgB,MAAM,iBAAiB;AAAA,EAC/C;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { simpleHash } from "@tamagui/helpers";
|
|
18
|
-
import hyphenateStyleName from "hyphenate-style-name";
|
|
19
|
-
import normalizeCSSColor from "normalize-css-color";
|
|
20
|
-
import { getConfig } from "../conf";
|
|
21
|
-
import { isWeb } from "../constants/platform";
|
|
22
|
-
import { reversedShorthands } from "../createTamagui";
|
|
23
|
-
import { pseudoDescriptors } from "./pseudoDescriptors";
|
|
24
|
-
class Cache {
|
|
25
|
-
constructor() {
|
|
26
|
-
this.values = {};
|
|
27
|
-
}
|
|
28
|
-
get(key, valStr) {
|
|
29
|
-
var _a;
|
|
30
|
-
return (_a = this.values[key]) == null ? void 0 : _a[valStr];
|
|
31
|
-
}
|
|
32
|
-
set(key, valStr, object) {
|
|
33
|
-
this.values[key] ??= {};
|
|
34
|
-
this.values[key][valStr] = object;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const cache = new Cache();
|
|
38
|
-
const generateAtomicStyles = (style, pseudo) => {
|
|
39
|
-
const res = expandStyles(style);
|
|
40
|
-
const out = [];
|
|
41
|
-
for (const key in res) {
|
|
42
|
-
const value = res[key];
|
|
43
|
-
if (value != null && value != void 0) {
|
|
44
|
-
const valueString = normalizeValueWithProperty(value, key);
|
|
45
|
-
const uid = key + ((pseudo == null ? void 0 : pseudo.name) || "");
|
|
46
|
-
const cachedResult = cache.get(uid, valueString);
|
|
47
|
-
if (cachedResult != void 0) {
|
|
48
|
-
out.push(cachedResult);
|
|
49
|
-
} else {
|
|
50
|
-
const hash = simpleHash(uid + valueString);
|
|
51
|
-
const pseudoPrefix = pseudo ? `0${pseudo.name}-` : "";
|
|
52
|
-
const shortProp = reversedShorthands[key] || key;
|
|
53
|
-
const identifier = `_${shortProp}-${pseudoPrefix}${hash}`;
|
|
54
|
-
const rules = createAtomicRules(identifier, key, valueString, pseudo);
|
|
55
|
-
const styleObject = {
|
|
56
|
-
property: key,
|
|
57
|
-
pseudo: pseudo == null ? void 0 : pseudo.name,
|
|
58
|
-
value,
|
|
59
|
-
identifier,
|
|
60
|
-
rules
|
|
61
|
-
};
|
|
62
|
-
cache.set(uid, valueString, styleObject);
|
|
63
|
-
out.push(styleObject);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return out;
|
|
68
|
-
};
|
|
69
|
-
const reducedStyleKeys = {
|
|
70
|
-
shadowColor: true,
|
|
71
|
-
shadowOffset: true,
|
|
72
|
-
shadowOpacity: true,
|
|
73
|
-
shadowRadius: true,
|
|
74
|
-
textShadowColor: true,
|
|
75
|
-
textShadowOffset: true,
|
|
76
|
-
textShadowRadius: true
|
|
77
|
-
};
|
|
78
|
-
let shorthands = null;
|
|
79
|
-
function expandStyles(style) {
|
|
80
|
-
const res = {};
|
|
81
|
-
const { boxShadow, shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style;
|
|
82
|
-
if (shadowRadius !== void 0) {
|
|
83
|
-
const { height, width } = shadowOffset || defaultOffset;
|
|
84
|
-
const offsetX = normalizeValueWithProperty(width || 0);
|
|
85
|
-
const offsetY = normalizeValueWithProperty(height || 0);
|
|
86
|
-
const blurRadius = normalizeValueWithProperty(shadowRadius || 0);
|
|
87
|
-
const color = normalizeColor(String(shadowColor || "black"), shadowOpacity);
|
|
88
|
-
const shadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`;
|
|
89
|
-
res.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow;
|
|
90
|
-
} else if (boxShadow) {
|
|
91
|
-
res.boxShadow = boxShadow;
|
|
92
|
-
}
|
|
93
|
-
const { textShadowColor, textShadowOffset, textShadowRadius } = style;
|
|
94
|
-
if (textShadowColor || textShadowOffset || textShadowRadius) {
|
|
95
|
-
const { height, width } = textShadowOffset || defaultOffset;
|
|
96
|
-
const radius = textShadowRadius || 0;
|
|
97
|
-
const color = normalizeValueWithProperty(textShadowColor, "textShadowColor");
|
|
98
|
-
if (color && (height !== 0 || width !== 0 || radius !== 0)) {
|
|
99
|
-
const blurRadius = normalizeValueWithProperty(radius);
|
|
100
|
-
const offsetX = normalizeValueWithProperty(width);
|
|
101
|
-
const offsetY = normalizeValueWithProperty(height);
|
|
102
|
-
res.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
for (const key in borderDefaults) {
|
|
106
|
-
if (key in style) {
|
|
107
|
-
res[borderDefaults[key]] = style[borderDefaults[key]] || "solid";
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
for (let key in style) {
|
|
111
|
-
shorthands = shorthands || getConfig().shorthands;
|
|
112
|
-
if (shorthands) {
|
|
113
|
-
key = shorthands[key] || key;
|
|
114
|
-
}
|
|
115
|
-
if (reducedStyleKeys[key])
|
|
116
|
-
continue;
|
|
117
|
-
if (key in pseudoDescriptors) {
|
|
118
|
-
res[key] = expandStyles(style[key]);
|
|
119
|
-
} else {
|
|
120
|
-
const val = normalizeValueWithProperty(style[key], key);
|
|
121
|
-
const out = expandStyle(key, val);
|
|
122
|
-
if (out) {
|
|
123
|
-
Object.assign(res, Object.fromEntries(out));
|
|
124
|
-
} else {
|
|
125
|
-
res[key] = val;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return res;
|
|
130
|
-
}
|
|
131
|
-
const borderDefaults = {
|
|
132
|
-
borderWidth: "borderStyle",
|
|
133
|
-
borderBottomWidth: "borderBottomStyle",
|
|
134
|
-
borderTopWidth: "borderTopStyle",
|
|
135
|
-
borderLeftWidth: "borderLeftStyle",
|
|
136
|
-
borderRightWidth: "borderRightStyle"
|
|
137
|
-
};
|
|
138
|
-
function createDeclarationBlock(style, important = false) {
|
|
139
|
-
let declarations = "";
|
|
140
|
-
for (const key in style) {
|
|
141
|
-
const prop = hyphenateStyleName(key);
|
|
142
|
-
const value = style[key];
|
|
143
|
-
declarations += `${prop}:${value}`;
|
|
144
|
-
}
|
|
145
|
-
return `{${declarations}${important ? ` !important` : ""};}`;
|
|
146
|
-
}
|
|
147
|
-
const pseudoSelectorPrefixes = (() => {
|
|
148
|
-
const res = {};
|
|
149
|
-
for (const key in pseudoDescriptors) {
|
|
150
|
-
const pseudo = pseudoDescriptors[key];
|
|
151
|
-
res[pseudo.name] = [...Array(pseudo.priority)].map(() => ":root").join("") + " ";
|
|
152
|
-
}
|
|
153
|
-
return res;
|
|
154
|
-
})();
|
|
155
|
-
function createAtomicRules(identifier, property, value, pseudo) {
|
|
156
|
-
const selector = pseudo ? `${pseudoSelectorPrefixes[pseudo.name]} .${identifier}:${pseudo.name}` : `.${identifier}`;
|
|
157
|
-
const important = !!pseudo;
|
|
158
|
-
let rules = [];
|
|
159
|
-
switch (property) {
|
|
160
|
-
case "placeholderTextColor": {
|
|
161
|
-
const block = createDeclarationBlock({ color: value, opacity: 1 }, important);
|
|
162
|
-
rules.push(`${selector}::placeholder${block}`);
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
case "pointerEvents": {
|
|
166
|
-
let finalValue = value;
|
|
167
|
-
if (value === "auto" || value === "box-only") {
|
|
168
|
-
finalValue = "auto!important";
|
|
169
|
-
if (value === "box-only") {
|
|
170
|
-
const block2 = createDeclarationBlock({ pointerEvents: "none" }, important);
|
|
171
|
-
rules.push(`${selector}>*${block2}`);
|
|
172
|
-
}
|
|
173
|
-
} else if (value === "none" || value === "box-none") {
|
|
174
|
-
finalValue = "none!important";
|
|
175
|
-
if (value === "box-none") {
|
|
176
|
-
const block2 = createDeclarationBlock({ pointerEvents: "auto" }, important);
|
|
177
|
-
rules.push(`${selector}>*${block2}`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
const block = createDeclarationBlock({ pointerEvents: finalValue }, important);
|
|
181
|
-
rules.push(`${selector}${block}`);
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
case "scrollbarWidth": {
|
|
185
|
-
if (value === "none") {
|
|
186
|
-
rules.push(`${selector}::-webkit-scrollbar{display:none}`);
|
|
187
|
-
}
|
|
188
|
-
const block = createDeclarationBlock({ scrollbarWidth: value }, important);
|
|
189
|
-
rules.push(`${selector}${block}`);
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
default: {
|
|
193
|
-
const block = createDeclarationBlock({ [property]: value }, important);
|
|
194
|
-
rules.push(`${selector}${block}`);
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
if ((pseudo == null ? void 0 : pseudo.name) === "hover") {
|
|
199
|
-
rules = rules.map((r) => `@media not all and (hover: none) { ${r} }`);
|
|
200
|
-
}
|
|
201
|
-
return rules;
|
|
202
|
-
}
|
|
203
|
-
function expandStyle(key, value) {
|
|
204
|
-
if (key === "flex") {
|
|
205
|
-
if (value <= -1) {
|
|
206
|
-
return [
|
|
207
|
-
["flexGrow", 0],
|
|
208
|
-
["flexShrink", 1],
|
|
209
|
-
["flexBasis", "auto"]
|
|
210
|
-
];
|
|
211
|
-
}
|
|
212
|
-
if (value >= 0) {
|
|
213
|
-
return [
|
|
214
|
-
["flexGrow", value],
|
|
215
|
-
["flexShrink", 1]
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
switch (key) {
|
|
221
|
-
case "elevation":
|
|
222
|
-
case "overlayColor":
|
|
223
|
-
case "resizeMode":
|
|
224
|
-
case "tintColor": {
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
case "aspectRatio": {
|
|
228
|
-
return [[key, value.toString()]];
|
|
229
|
-
}
|
|
230
|
-
case "backgroundClip": {
|
|
231
|
-
if (value === "text") {
|
|
232
|
-
return [
|
|
233
|
-
["backgroundClip", value],
|
|
234
|
-
["WebkitBackgroundClip", value]
|
|
235
|
-
];
|
|
236
|
-
}
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
case "textAlignVertical": {
|
|
240
|
-
return [["verticalAlign", value === "center" ? "middle" : value]];
|
|
241
|
-
}
|
|
242
|
-
case "textDecorationLine": {
|
|
243
|
-
return [["textDecorationLine", value]];
|
|
244
|
-
}
|
|
245
|
-
case "transform": {
|
|
246
|
-
if (Array.isArray(value)) {
|
|
247
|
-
return [[key, value.map(mapTransform).join(" ")]];
|
|
248
|
-
}
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
case "writingDirection": {
|
|
252
|
-
return [["direction", value]];
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
const longKey = STYLE_SHORT_FORM_EXPANSIONS[key];
|
|
256
|
-
if (longKey) {
|
|
257
|
-
return longKey.map((key2) => {
|
|
258
|
-
return [key2, value];
|
|
259
|
-
});
|
|
260
|
-
} else {
|
|
261
|
-
if (isWeb && Array.isArray(value)) {
|
|
262
|
-
return [[key, value.join(",")]];
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
const mapTransform = (transform) => {
|
|
267
|
-
const type = Object.keys(transform)[0];
|
|
268
|
-
const value = transform[type];
|
|
269
|
-
if (type === "matrix" || type === "matrix3d") {
|
|
270
|
-
return `${type}(${value.join(",")})`;
|
|
271
|
-
} else {
|
|
272
|
-
const normalizedValue = normalizeValueWithProperty(value, type);
|
|
273
|
-
return `${type}(${normalizedValue})`;
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
const colorProps = {
|
|
277
|
-
backgroundColor: true,
|
|
278
|
-
borderColor: true,
|
|
279
|
-
borderTopColor: true,
|
|
280
|
-
borderRightColor: true,
|
|
281
|
-
borderBottomColor: true,
|
|
282
|
-
borderLeftColor: true,
|
|
283
|
-
color: true,
|
|
284
|
-
shadowColor: true,
|
|
285
|
-
textDecorationColor: true,
|
|
286
|
-
textShadowColor: true
|
|
287
|
-
};
|
|
288
|
-
function normalizeValueWithProperty(value, property) {
|
|
289
|
-
if (process.env.TAMAGUI_TARGET === "web") {
|
|
290
|
-
const shouldCoerceToPx = typeof value === "number" && (property === void 0 || property === null || !unitlessNumbers[property]);
|
|
291
|
-
if (shouldCoerceToPx) {
|
|
292
|
-
return `${value}px`;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (property && colorProps[property]) {
|
|
296
|
-
return normalizeColor(value);
|
|
297
|
-
}
|
|
298
|
-
return value;
|
|
299
|
-
}
|
|
300
|
-
const normalizeColor = (color, opacity = 1) => {
|
|
301
|
-
if (color == null || color == void 0) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
if (process.env.TAMAGUI_TARGET === "web") {
|
|
305
|
-
if (typeof color === "string" && isWebColor(color)) {
|
|
306
|
-
return color;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
const colorInt = processColor(color);
|
|
310
|
-
if (colorInt != null) {
|
|
311
|
-
const r = colorInt >> 16 & 255;
|
|
312
|
-
const g = colorInt >> 8 & 255;
|
|
313
|
-
const b = colorInt & 255;
|
|
314
|
-
const a = (colorInt >> 24 & 255) / 255;
|
|
315
|
-
const alpha = (a * opacity).toFixed(2);
|
|
316
|
-
return `rgba(${r},${g},${b},${alpha})`;
|
|
317
|
-
}
|
|
318
|
-
return `${color}`;
|
|
319
|
-
};
|
|
320
|
-
const webColors = {
|
|
321
|
-
currentColor: true,
|
|
322
|
-
currentcolor: true,
|
|
323
|
-
transparent: true,
|
|
324
|
-
inherit: true
|
|
325
|
-
};
|
|
326
|
-
const isWebColor = (color) => webColors[color] || color.indexOf("var(") === 0;
|
|
327
|
-
const processColor = (color) => {
|
|
328
|
-
if (color === void 0 || color === null) {
|
|
329
|
-
return color;
|
|
330
|
-
}
|
|
331
|
-
let intColor = normalizeCSSColor(color);
|
|
332
|
-
if (intColor === void 0 || intColor === null) {
|
|
333
|
-
return void 0;
|
|
334
|
-
}
|
|
335
|
-
return (+intColor << 24 | +intColor >>> 8) >>> 0;
|
|
336
|
-
};
|
|
337
|
-
const unitlessNumbers = {
|
|
338
|
-
animationIterationCount: true,
|
|
339
|
-
aspectRatio: true,
|
|
340
|
-
borderImageOutset: true,
|
|
341
|
-
borderImageSlice: true,
|
|
342
|
-
borderImageWidth: true,
|
|
343
|
-
boxFlex: true,
|
|
344
|
-
boxFleGroup: true,
|
|
345
|
-
boxOrdinalGroup: true,
|
|
346
|
-
columnCount: true,
|
|
347
|
-
flex: true,
|
|
348
|
-
flexGrow: true,
|
|
349
|
-
flexOrder: true,
|
|
350
|
-
flexPositive: true,
|
|
351
|
-
flexShrink: true,
|
|
352
|
-
flexNegative: true,
|
|
353
|
-
fontWeight: true,
|
|
354
|
-
gridRow: true,
|
|
355
|
-
gridRowEnd: true,
|
|
356
|
-
gridRowGap: true,
|
|
357
|
-
gridRowStart: true,
|
|
358
|
-
gridColumn: true,
|
|
359
|
-
gridColumnEnd: true,
|
|
360
|
-
gridColumnGap: true,
|
|
361
|
-
gridColumnStart: true,
|
|
362
|
-
lineClamp: true,
|
|
363
|
-
opacity: true,
|
|
364
|
-
order: true,
|
|
365
|
-
orphans: true,
|
|
366
|
-
tabSize: true,
|
|
367
|
-
widows: true,
|
|
368
|
-
zIndex: true,
|
|
369
|
-
zoom: true,
|
|
370
|
-
fillOpacity: true,
|
|
371
|
-
floodOpacity: true,
|
|
372
|
-
stopOpacity: true,
|
|
373
|
-
strokeDasharray: true,
|
|
374
|
-
strokeDashoffset: true,
|
|
375
|
-
strokeMiterlimit: true,
|
|
376
|
-
strokeOpacity: true,
|
|
377
|
-
strokeWidth: true,
|
|
378
|
-
scale: true,
|
|
379
|
-
scaleX: true,
|
|
380
|
-
scaleY: true,
|
|
381
|
-
scaleZ: true,
|
|
382
|
-
shadowOpacity: true
|
|
383
|
-
};
|
|
384
|
-
const defaultOffset = { height: 0, width: 0 };
|
|
385
|
-
const STYLE_SHORT_FORM_EXPANSIONS = __spreadValues({
|
|
386
|
-
borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
|
|
387
|
-
borderRadius: [
|
|
388
|
-
"borderTopLeftRadius",
|
|
389
|
-
"borderTopRightRadius",
|
|
390
|
-
"borderBottomRightRadius",
|
|
391
|
-
"borderBottomLeftRadius"
|
|
392
|
-
],
|
|
393
|
-
borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
|
|
394
|
-
borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
|
|
395
|
-
margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
|
|
396
|
-
marginHorizontal: ["marginRight", "marginLeft"],
|
|
397
|
-
marginVertical: ["marginTop", "marginBottom"],
|
|
398
|
-
overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
|
|
399
|
-
padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
|
|
400
|
-
paddingHorizontal: ["paddingRight", "paddingLeft"],
|
|
401
|
-
paddingVertical: ["paddingTop", "paddingBottom"]
|
|
402
|
-
}, isWeb && {
|
|
403
|
-
overflow: ["overflowX", "overflowY"]
|
|
404
|
-
});
|
|
405
|
-
export {
|
|
406
|
-
expandStyle,
|
|
407
|
-
expandStyles,
|
|
408
|
-
generateAtomicStyles
|
|
409
|
-
};
|
|
410
|
-
//# sourceMappingURL=generateAtomicStyles.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/generateAtomicStyles.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { StyleObject, simpleHash } from '@tamagui/helpers'\nimport hyphenateStyleName from 'hyphenate-style-name'\nimport normalizeCSSColor from 'normalize-css-color'\nimport { TextStyle, ViewStyle } from 'react-native'\n\nimport { getConfig } from '../conf'\nimport { isWeb } from '../constants/platform'\nimport { reversedShorthands } from '../createTamagui'\nimport { PseudoDescriptor, pseudoDescriptors } from './pseudoDescriptors'\n\ntype Value = Object | Array<any> | string | number\nexport type Style = { [key: string]: Value }\n\nclass Cache {\n values: Record<string, any> = {}\n\n get(key: string, valStr: string) {\n return this.values[key]?.[valStr]\n }\n\n set(key: string, valStr: string, object: any) {\n this.values[key] ??= {}\n this.values[key][valStr] = object\n }\n}\n\nconst cache = new Cache()\n\nexport const generateAtomicStyles = (\n style: ViewStyle & TextStyle,\n pseudo?: PseudoDescriptor\n): StyleObject[] => {\n const res = expandStyles(style)\n const out: StyleObject[] = []\n for (const key in res) {\n const value = res[key]\n if (value != null && value != undefined) {\n const valueString = normalizeValueWithProperty(value, key)\n const uid = key + (pseudo?.name || '')\n const cachedResult = cache.get(uid, valueString)\n if (cachedResult != undefined) {\n out.push(cachedResult)\n } else {\n const hash = simpleHash(uid + valueString)\n const pseudoPrefix = pseudo ? `0${pseudo.name}-` : ''\n const shortProp = reversedShorthands[key] || key\n const identifier = `_${shortProp}-${pseudoPrefix}${hash}`\n const rules = createAtomicRules(identifier, key, valueString, pseudo)\n const styleObject: StyleObject = {\n property: key,\n pseudo: pseudo?.name,\n value,\n identifier,\n rules,\n }\n cache.set(uid, valueString, styleObject)\n out.push(styleObject)\n }\n }\n }\n return out\n}\n\nconst reducedStyleKeys = {\n shadowColor: true,\n shadowOffset: true,\n shadowOpacity: true,\n shadowRadius: true,\n textShadowColor: true,\n textShadowOffset: true,\n textShadowRadius: true,\n}\n\nlet shorthands: Record<string, string> | null = null\n\n// can likely remove this and include in other loops\nexport function expandStyles(style: any) {\n const res: Record<string, any> = {}\n\n // box-shadow\n const { boxShadow, shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style\n if (shadowRadius !== undefined) {\n const { height, width } = shadowOffset || defaultOffset\n const offsetX = normalizeValueWithProperty(width || 0)\n const offsetY = normalizeValueWithProperty(height || 0)\n const blurRadius = normalizeValueWithProperty(shadowRadius || 0)\n const color = normalizeColor(String(shadowColor || 'black'), shadowOpacity)\n const shadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`\n res.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow\n } else if (boxShadow) {\n res.boxShadow = boxShadow\n }\n\n // text-shadow\n const { textShadowColor, textShadowOffset, textShadowRadius } = style\n if (textShadowColor || textShadowOffset || textShadowRadius) {\n const { height, width } = textShadowOffset || defaultOffset\n const radius = textShadowRadius || 0\n const color = normalizeValueWithProperty(textShadowColor, 'textShadowColor')\n if (color && (height !== 0 || width !== 0 || radius !== 0)) {\n const blurRadius = normalizeValueWithProperty(radius)\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n res.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n }\n\n // ensure border style set by default to solid\n for (const key in borderDefaults) {\n if (key in style) {\n res[borderDefaults[key]] = style[borderDefaults[key]] || 'solid'\n }\n }\n\n for (let key in style) {\n shorthands = shorthands || getConfig().shorthands\n if (shorthands) {\n key = shorthands[key] || key\n }\n if (reducedStyleKeys[key]) continue\n if (key in pseudoDescriptors) {\n res[key] = expandStyles(style[key])\n } else {\n const val = normalizeValueWithProperty(style[key], key)\n const out = expandStyle(key, val)\n if (out) {\n Object.assign(res, Object.fromEntries(out))\n } else {\n res[key] = val\n }\n }\n }\n return res\n}\n\nconst borderDefaults = {\n borderWidth: 'borderStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderTopWidth: 'borderTopStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n}\n\nfunction createDeclarationBlock(style: Style, important = false) {\n let declarations = ''\n for (const key in style) {\n const prop = hyphenateStyleName(key)\n const value = style[key]\n declarations += `${prop}:${value}`\n }\n return `{${declarations}${important ? ` !important` : ''};}`\n}\n\nconst pseudoSelectorPrefixes = (() => {\n const res: Record<string, string> = {}\n for (const key in pseudoDescriptors) {\n const pseudo = pseudoDescriptors[key]\n res[pseudo.name] = [...Array(pseudo.priority)].map(() => ':root').join('') + ' '\n }\n return res\n})()\n\nfunction createAtomicRules(\n identifier: string,\n property: string,\n value: any,\n pseudo?: PseudoDescriptor\n): string[] {\n const selector = pseudo\n ? `${pseudoSelectorPrefixes[pseudo.name]} .${identifier}:${pseudo.name}`\n : `.${identifier}`\n const important = !!pseudo\n\n let rules: string[] = []\n\n // Handle non-standard properties and object values that require multiple\n // CSS rules to be created.\n switch (property) {\n // Equivalent to using '::placeholder'\n case 'placeholderTextColor': {\n const block = createDeclarationBlock({ color: value, opacity: 1 }, important)\n rules.push(`${selector}::placeholder${block}`)\n break\n }\n\n // Polyfill for additional 'pointer-events' values\n // See d13f78622b233a0afc0c7a200c0a0792c8ca9e58\n case 'pointerEvents': {\n let finalValue = value\n if (value === 'auto' || value === 'box-only') {\n finalValue = 'auto!important'\n if (value === 'box-only') {\n const block = createDeclarationBlock({ pointerEvents: 'none' }, important)\n rules.push(`${selector}>*${block}`)\n }\n } else if (value === 'none' || value === 'box-none') {\n finalValue = 'none!important'\n if (value === 'box-none') {\n const block = createDeclarationBlock({ pointerEvents: 'auto' }, important)\n rules.push(`${selector}>*${block}`)\n }\n }\n const block = createDeclarationBlock({ pointerEvents: finalValue }, important)\n rules.push(`${selector}${block}`)\n break\n }\n\n // Polyfill for draft spec\n // https://drafts.csswg.org/css-scrollbars-1/\n case 'scrollbarWidth': {\n if (value === 'none') {\n rules.push(`${selector}::-webkit-scrollbar{display:none}`)\n }\n const block = createDeclarationBlock({ scrollbarWidth: value }, important)\n rules.push(`${selector}${block}`)\n break\n }\n\n default: {\n const block = createDeclarationBlock({ [property]: value }, important)\n rules.push(`${selector}${block}`)\n break\n }\n }\n\n // hover styles need to be conditional\n // perhaps this can be generalized but for now lets just shortcut\n // and hardcode for hover styles, if we need to later we can\n // WEIRD SYNTAX, SEE:\n // https://stackoverflow.com/questions/40532204/media-query-for-devices-supporting-hover\n if (pseudo?.name === 'hover') {\n rules = rules.map((r) => `@media not all and (hover: none) { ${r} }`)\n }\n\n return rules\n}\n\nexport function expandStyle(key: string, value: any) {\n if (key === 'flex') {\n // The 'flex' property value in React Native must be a positive integer,\n // 0, or -1.\n if (value <= -1) {\n return [\n ['flexGrow', 0],\n ['flexShrink', 1],\n ['flexBasis', 'auto'],\n ]\n }\n // normalizing to better align with native\n // see spec for flex shorthand https://developer.mozilla.org/en-US/docs/Web/CSS/flex\n if (value >= 0) {\n return [\n ['flexGrow', value],\n ['flexShrink', 1],\n ]\n }\n return\n }\n\n // web only\n switch (key) {\n // Ignore some React Native styles\n case 'elevation':\n case 'overlayColor':\n case 'resizeMode':\n case 'tintColor': {\n break\n }\n\n case 'aspectRatio': {\n return [[key, value.toString()]]\n }\n\n // TODO: remove once this issue is fixed\n // https://github.com/rofrischmann/inline-style-prefixer/issues/159\n case 'backgroundClip': {\n if (value === 'text') {\n return [\n ['backgroundClip', value],\n ['WebkitBackgroundClip', value],\n ]\n }\n break\n }\n\n case 'textAlignVertical': {\n return [['verticalAlign', value === 'center' ? 'middle' : value]]\n }\n\n case 'textDecorationLine': {\n return [['textDecorationLine', value]]\n }\n\n case 'transform': {\n if (Array.isArray(value)) {\n return [[key, value.map(mapTransform).join(' ')]]\n }\n break\n }\n\n case 'writingDirection': {\n return [['direction', value]]\n }\n }\n\n const longKey = STYLE_SHORT_FORM_EXPANSIONS[key]\n if (longKey) {\n return longKey.map((key) => {\n return [key, value]\n })\n } else {\n if (isWeb && Array.isArray(value)) {\n return [[key, value.join(',')]]\n }\n }\n}\n\n// { scale: 2 } => 'scale(2)'\n// { translateX: 20 } => 'translateX(20px)'\n// { matrix: [1,2,3,4,5,6] } => 'matrix(1,2,3,4,5,6)'\nconst mapTransform = (transform) => {\n const type = Object.keys(transform)[0]\n const value = transform[type]\n if (type === 'matrix' || type === 'matrix3d') {\n return `${type}(${value.join(',')})`\n } else {\n const normalizedValue = normalizeValueWithProperty(value, type)\n return `${type}(${normalizedValue})`\n }\n}\n\nconst colorProps = {\n backgroundColor: true,\n borderColor: true,\n borderTopColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderLeftColor: true,\n color: true,\n shadowColor: true,\n textDecorationColor: true,\n textShadowColor: true,\n}\n\nfunction normalizeValueWithProperty(value: any, property?: string): any {\n if (process.env.TAMAGUI_TARGET === 'web') {\n const shouldCoerceToPx =\n typeof value === 'number' &&\n (property === undefined || property === null || !unitlessNumbers[property])\n if (shouldCoerceToPx) {\n return `${value}px`\n }\n }\n if (property && colorProps[property]) {\n return normalizeColor(value)\n }\n return value\n}\n\nconst normalizeColor = (color?: number | string, opacity = 1): void | string => {\n if (color == null || color == undefined) {\n return\n }\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (typeof color === 'string' && isWebColor(color)) {\n return color\n }\n }\n const colorInt = processColor(color)\n if (colorInt != null) {\n const r = (colorInt >> 16) & 255\n const g = (colorInt >> 8) & 255\n const b = colorInt & 255\n const a = ((colorInt >> 24) & 255) / 255\n const alpha = (a * opacity).toFixed(2)\n return `rgba(${r},${g},${b},${alpha})`\n }\n return `${color}`\n}\n\nconst webColors = {\n currentColor: true,\n currentcolor: true,\n transparent: true,\n inherit: true,\n}\n\nconst isWebColor = (color: string): boolean => webColors[color] || color.indexOf('var(') === 0\n\nconst processColor = (color?: number | string): number | undefined | null => {\n if (color === undefined || color === null) {\n return color\n }\n let intColor = normalizeCSSColor(color)\n if (intColor === undefined || intColor === null) {\n return undefined\n }\n return ((+intColor << 24) | (+intColor >>> 8)) >>> 0\n}\n\nconst unitlessNumbers = {\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n boxFlex: true,\n boxFleGroup: true,\n boxOrdinalGroup: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n fillOpacity: true,\n floodOpacity: true,\n stopOpacity: true,\n strokeDasharray: true,\n strokeDashoffset: true,\n strokeMiterlimit: true,\n strokeOpacity: true,\n strokeWidth: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n\nconst defaultOffset = { height: 0, width: 0 }\n\nconst STYLE_SHORT_FORM_EXPANSIONS = {\n borderColor: ['borderTopColor', 'borderRightColor', 'borderBottomColor', 'borderLeftColor'],\n borderRadius: [\n 'borderTopLeftRadius',\n 'borderTopRightRadius',\n 'borderBottomRightRadius',\n 'borderBottomLeftRadius',\n ],\n borderStyle: ['borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle'],\n borderWidth: ['borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth'],\n margin: ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'],\n marginHorizontal: ['marginRight', 'marginLeft'],\n marginVertical: ['marginTop', 'marginBottom'],\n overscrollBehavior: ['overscrollBehaviorX', 'overscrollBehaviorY'],\n padding: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],\n paddingHorizontal: ['paddingRight', 'paddingLeft'],\n paddingVertical: ['paddingTop', 'paddingBottom'],\n ...(isWeb && {\n // react-native doesn't support X / Y\n overflow: ['overflowX', 'overflowY'],\n }),\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAKA;AACA;AACA;AAGA;AACA;AACA;AACA;AAKA,MAAM,MAAM;AAAA,EAAZ;AACE,kBAA8B,CAAC;AAAA;AAAA,EAE/B,IAAI,KAAa,QAAgB;AArBnC;AAsBI,WAAO,WAAK,OAAO,SAAZ,mBAAmB;AAAA,EAC5B;AAAA,EAEA,IAAI,KAAa,QAAgB,QAAa;AAC5C,SAAK,OAAO,SAAS,CAAC;AACtB,SAAK,OAAO,KAAK,UAAU;AAAA,EAC7B;AACF;AAEA,MAAM,QAAQ,IAAI,MAAM;AAEjB,MAAM,uBAAuB,CAClC,OACA,WACkB;AAClB,QAA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AAC,uBAAuB,qBAAqB;AAAA,EACjE,SAAS,CAAC,cAAc,gBAAgB,iBAAiB,aAAa;AAAA,EACtE,mBAAmB,CAAC,gBAAgB,aAAa;AAAA,EACjD,iBAAiB,CAAC,cAAc,eAAe;AAAA,GAC3C,SAAS;AAAA,EAEX,UAAU,CAAC,aAAa,WAAW;AACrC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/getTextSize.tsx"],
|
|
4
|
-
"sourcesContent": ["import { getVariableValue } from '../createVariable'\nimport { FontSizeTokens, TextProps, VariantSpreadFunction } from '../types'\n\nexport const getTextSize: VariantSpreadFunction<TextProps, FontSizeTokens> = (\n val = '$4',\n { fonts, theme, props }\n) => {\n const family = getVariableValue(props.fontFamily) || '$body'\n const font = fonts[family] || fonts['$body']\n if (!font) {\n console.warn('\u26A0\uFE0F no font found', { family, fontTokens: Object.keys(fonts), val })\n return {} as any\n }\n const fontFamily = font.family\n const fontSize = props.fontSize || font.size[val]\n const lineHeight = props.lineHeight || font.lineHeight[val]\n const fontWeight = props.fontWeight || font.weight[val]\n const letterSpacing = props.letterSpacing || font.letterSpacing[val]\n const fontStyle = props.fontStyle || font.style?.[val]\n const textTransform = props.textTransform || font.transform?.[val]\n const color = props.color || font.color?.[val] || theme.color\n return {\n color,\n fontStyle,\n textTransform,\n fontFamily,\n fontWeight,\n letterSpacing,\n fontSize,\n lineHeight,\n } as any\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAGO,MAAM,cAAgE,CAC3E,MAAM,MACN,EAAE,OAAO,OAAO,YACb;AANL;AAOE,QAAM,SAAS,iBAAiB,MAAM,UAAU,KAAK;AACrD,QAAM,OAAO,MAAM,WAAW,MAAM;AACpC,MAAI,CAAC,MAAM;AACT,YAAQ,KAAK,8BAAoB,EAAE,QAAQ,YAAY,OAAO,KAAK,KAAK,GAAG,IAAI,CAAC;AAChF,WAAO,CAAC;AAAA,EACV;AACA,QAAM,aAAa,KAAK;AACxB,QAAM,WAAW,MAAM,YAAY,KAAK,KAAK;AAC7C,QAAM,aAAa,MAAM,cAAc,KAAK,WAAW;AACvD,QAAM,aAAa,MAAM,cAAc,KAAK,OAAO;AACnD,QAAM,gBAAgB,MAAM,iBAAiB,KAAK,cAAc;AAChE,QAAM,YAAY,MAAM,aAAa,YAAK,UAAL,mBAAa;AAClD,QAAM,gBAAgB,MAAM,iBAAiB,YAAK,cAAL,mBAAiB;AAC9D,QAAM,QAAQ,MAAM,SAAS,YAAK,UAAL,mBAAa,SAAQ,MAAM;AACxD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assignNativePropsToWeb.d.ts","sourceRoot":"","sources":["../src/assignNativePropsToWeb.tsx"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,QA6K3F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixNativeShadow.native.d.ts","sourceRoot":"","sources":["../../src/helpers/fixNativeShadow.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,QAwB/C"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StyleObject } from '@tamagui/helpers';
|
|
2
|
-
import { TextStyle, ViewStyle } from 'react-native';
|
|
3
|
-
import { PseudoDescriptor } from './pseudoDescriptors';
|
|
4
|
-
declare type Value = Object | Array<any> | string | number;
|
|
5
|
-
export declare type Style = {
|
|
6
|
-
[key: string]: Value;
|
|
7
|
-
};
|
|
8
|
-
export declare const generateAtomicStyles: (style: ViewStyle & TextStyle, pseudo?: PseudoDescriptor) => StyleObject[];
|
|
9
|
-
export declare function expandStyles(style: any): Record<string, any>;
|
|
10
|
-
export declare function expandStyle(key: string, value: any): any;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=generateAtomicStyles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateAtomicStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/generateAtomicStyles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKnD,OAAO,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAA;AAEzE,aAAK,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;AAClD,oBAAY,KAAK,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAAA;AAiB5C,eAAO,MAAM,oBAAoB,UACxB,SAAS,GAAG,SAAS,WACnB,gBAAgB,KACxB,WAAW,EA8Bb,CAAA;AAeD,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,uBAyDtC;AAwGD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OA8ElD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getTextSize.d.ts","sourceRoot":"","sources":["../../src/helpers/getTextSize.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAE3E,eAAO,MAAM,WAAW,EAAE,qBAAqB,CAAC,SAAS,EAAE,cAAc,CA4BxE,CAAA"}
|