@tamagui/core 1.0.1-beta.60 → 1.0.1-beta.61

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.
@@ -9,13 +9,13 @@ function createTamaguiProvider({
9
9
  ...themeProps
10
10
  }) {
11
11
  return /* @__PURE__ */ __name(function TamaguiProvider({
12
- injectCSS,
12
+ disableInjectCSS,
13
13
  children,
14
14
  ...themePropsProvider
15
15
  }) {
16
16
  if (typeof document !== "undefined") {
17
17
  React.useLayoutEffect(() => {
18
- if (!injectCSS)
18
+ if (disableInjectCSS)
19
19
  return;
20
20
  const style = document.createElement("style");
21
21
  style.appendChild(document.createTextNode(getCSS()));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/createTamaguiProvider.tsx"],
4
- "sourcesContent": ["import * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TamaguiProviderProps } from '../types'\nimport { TextAncestorProvider } from '../views/TextAncestorContext'\nimport { ThemeProvider, ThemeProviderProps } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider({\n getCSS,\n ...themeProps\n}: ThemeProviderProps & {\n getCSS: () => string\n}) {\n return function TamaguiProvider({\n injectCSS,\n children,\n ...themePropsProvider\n }: TamaguiProviderProps) {\n // inject CSS if asked to (not SSR compliant)\n if (typeof document !== 'undefined') {\n React.useLayoutEffect(() => {\n if (!injectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider {...themeProps} {...themePropsProvider}>\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n }\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AAEA;AACA;AAEO,+BAA+B;AAAA,EACpC;AAAA,KACG;AAAA,GAGF;AACD,SAAO,gDAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,OACG;AAAA,KACoB;AAEvB,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,gBAAgB,MAAM;AAC1B,YAAI,CAAC;AAAW;AAChB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,cAAM,YAAY,SAAS,eAAe,OAAO,CAAC,CAAC;AACnD,iBAAS,KAAK,YAAY,KAAK;AAC/B,eAAO,MAAM;AACX,mBAAS,KAAK,YAAY,KAAK;AAAA,QACjC;AAAA,MACF,GAAG,CAAC,CAAC;AAAA,IACP;AAEA,WACE,oCAAC,0BAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,4BACC,oCAAC;AAAA,MAAe,GAAG;AAAA,MAAa,GAAG;AAAA,OAChC,QACH,CACF,CACF;AAAA,EAEJ,GA3BO;AA4BT;AAlCgB;",
4
+ "sourcesContent": ["import * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TamaguiProviderProps } from '../types'\nimport { TextAncestorProvider } from '../views/TextAncestorContext'\nimport { ThemeProvider, ThemeProviderProps } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider({\n getCSS,\n ...themeProps\n}: ThemeProviderProps & {\n getCSS: () => string\n}) {\n return function TamaguiProvider({\n disableInjectCSS,\n children,\n ...themePropsProvider\n }: TamaguiProviderProps) {\n // inject CSS if asked to (not SSR compliant)\n if (typeof document !== 'undefined') {\n React.useLayoutEffect(() => {\n if (disableInjectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider {...themeProps} {...themePropsProvider}>\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n }\n}\n"],
5
+ "mappings": ";;AAAA;AAEA;AAEA;AACA;AAEO,+BAA+B;AAAA,EACpC;AAAA,KACG;AAAA,GAGF;AACD,SAAO,gDAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,OACG;AAAA,KACoB;AAEvB,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,gBAAgB,MAAM;AAC1B,YAAI;AAAkB;AACtB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,cAAM,YAAY,SAAS,eAAe,OAAO,CAAC,CAAC;AACnD,iBAAS,KAAK,YAAY,KAAK;AAC/B,eAAO,MAAM;AACX,mBAAS,KAAK,YAAY,KAAK;AAAA,QACjC;AAAA,MACF,GAAG,CAAC,CAAC;AAAA,IACP;AAEA,WACE,oCAAC,0BAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,4BACC,oCAAC;AAAA,MAAe,GAAG;AAAA,MAAa,GAAG;AAAA,OAChC,QACH,CACF,CACF;AAAA,EAEJ,GA3BO;AA4BT;AAlCgB;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,6 @@ import { simpleHash } from "@tamagui/helpers";
4
4
  import hyphenateStyleName from "hyphenate-style-name";
5
5
  import normalizeCSSColor from "normalize-css-color";
6
6
  import { isWeb } from "../constants/platform";
7
- import { prefixInlineStyles, prefixStyles } from "./prefixStyles";
8
7
  function expandStyles(style) {
9
8
  const res = {};
10
9
  for (const key in style) {
@@ -13,31 +12,16 @@ function expandStyles(style) {
13
12
  return res;
14
13
  }
15
14
  __name(expandStyles, "expandStyles");
16
- function inline(style) {
17
- return prefixInlineStyles(expandStyles(style));
18
- }
19
- __name(inline, "inline");
20
- const STYLE_SHORT_FORM_EXPANSIONS = {
21
- borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
22
- borderRadius: [
23
- "borderTopLeftRadius",
24
- "borderTopRightRadius",
25
- "borderBottomRightRadius",
26
- "borderBottomLeftRadius"
27
- ],
28
- borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
29
- borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
30
- margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
31
- marginHorizontal: ["marginRight", "marginLeft"],
32
- marginVertical: ["marginTop", "marginBottom"],
33
- overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
34
- padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
35
- paddingHorizontal: ["paddingRight", "paddingLeft"],
36
- paddingVertical: ["paddingTop", "paddingBottom"],
37
- ...isWeb && {
38
- overflow: ["overflowX", "overflowY"]
15
+ function updateReactDOMStyle(style, key, value) {
16
+ value = normalizeValueWithProperty(value, key);
17
+ const out = expandStyle(key, value);
18
+ if (out) {
19
+ Object.assign(style, Object.fromEntries(out));
20
+ } else {
21
+ style[key] = value;
39
22
  }
40
- };
23
+ }
24
+ __name(updateReactDOMStyle, "updateReactDOMStyle");
41
25
  const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
42
26
  const res = expandStyles(style);
43
27
  if (style.shadowColor != null || style.shadowOffset != null || style.shadowOpacity != null || style.shadowRadius != null) {
@@ -63,11 +47,11 @@ const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
63
47
  const { identifier } = cachedResult;
64
48
  out[identifier] = cachedResult;
65
49
  } else {
66
- const identifier = createIdentifier("r", key, value);
50
+ const identifier = simpleHash(key + value);
67
51
  const rules = createAtomicRules(identifier, key, value);
68
52
  const cachedResult2 = cache.set(key, valueString, {
69
53
  property: key,
70
- value: stringifyValueWithProperty(value, key),
54
+ value: valueString,
71
55
  identifier,
72
56
  rules
73
57
  });
@@ -77,16 +61,6 @@ const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
77
61
  }
78
62
  return out;
79
63
  }, "generateAtomicStyles");
80
- function updateReactDOMStyle(style, key, value) {
81
- value = normalizeValueWithProperty(value, key);
82
- const out = expandStyle(key, value);
83
- if (out) {
84
- Object.assign(style, Object.fromEntries(out));
85
- } else {
86
- style[key] = value;
87
- }
88
- }
89
- __name(updateReactDOMStyle, "updateReactDOMStyle");
90
64
  function expandStyle(key, value) {
91
65
  if (key === "flex") {
92
66
  if (value <= -1) {
@@ -155,15 +129,9 @@ function createAtomicRules(identifier, property, value) {
155
129
  const rules = [];
156
130
  const selector = `.${identifier}`;
157
131
  switch (property) {
158
- case "animationKeyframes": {
159
- const { animationNames, rules: keyframesRules } = processKeyframesValue(value);
160
- const block = createDeclarationBlock({ animationName: animationNames.join(",") });
161
- rules.push(`${selector}${block}`, ...keyframesRules);
162
- break;
163
- }
164
132
  case "placeholderTextColor": {
165
133
  const block = createDeclarationBlock({ color: value, opacity: 1 });
166
- rules.push(`${selector}::-webkit-input-placeholder${block}`, `${selector}::-moz-placeholder${block}`, `${selector}:-ms-input-placeholder${block}`, `${selector}::placeholder${block}`);
134
+ rules.push(`${selector}::placeholder${block}`);
167
135
  break;
168
136
  }
169
137
  case "pointerEvents": {
@@ -202,58 +170,16 @@ function createAtomicRules(identifier, property, value) {
202
170
  return rules;
203
171
  }
204
172
  __name(createAtomicRules, "createAtomicRules");
205
- function processKeyframesValue(keyframesValue) {
206
- if (typeof keyframesValue === "number") {
207
- throw new Error(`Invalid CSS keyframes type: ${typeof keyframesValue}`);
208
- }
209
- const animationNames = [];
210
- const rules = [];
211
- const value = Array.isArray(keyframesValue) ? keyframesValue : [keyframesValue];
212
- for (const keyframes of value) {
213
- if (typeof keyframes === "string") {
214
- animationNames.push(keyframes);
215
- } else {
216
- const { identifier, rules: keyframesRules } = createKeyframes(keyframes);
217
- animationNames.push(identifier);
218
- rules.push(...keyframesRules);
219
- }
220
- }
221
- return { animationNames, rules };
222
- }
223
- __name(processKeyframesValue, "processKeyframesValue");
224
- function createKeyframes(keyframes) {
225
- const prefixes2 = ["-webkit-", ""];
226
- const identifier = createIdentifier("r", "animation", keyframes);
227
- const steps = "{" + Object.keys(keyframes).map((stepName) => {
228
- const rule = keyframes[stepName];
229
- const block = createDeclarationBlock(rule);
230
- return `${stepName}${block}`;
231
- }).join("") + "}";
232
- const rules = prefixes2.map((prefix) => {
233
- return `@${prefix}keyframes ${identifier}${steps}`;
234
- });
235
- return { identifier, rules };
236
- }
237
- __name(createKeyframes, "createKeyframes");
238
173
  function createDeclarationBlock(style) {
239
- const domStyle = prefixStyles(expandStyles(style));
174
+ const domStyle = expandStyles(style);
240
175
  const declarationsString = Object.keys(domStyle).map((property) => {
241
176
  const value = domStyle[property];
242
177
  const prop = hyphenateStyleName(property);
243
- if (Array.isArray(value)) {
244
- return value.map((v) => `${prop}:${v}`).join(";");
245
- } else {
246
- return `${prop}:${value}`;
247
- }
178
+ return `${prop}:${value}`;
248
179
  }).sort().join(";");
249
180
  return `{${declarationsString};}`;
250
181
  }
251
182
  __name(createDeclarationBlock, "createDeclarationBlock");
252
- function createIdentifier(prefix, name, value) {
253
- const hashedString = simpleHash(name + stringifyValueWithProperty(value, name));
254
- return `${prefix}-${hashedString}`;
255
- }
256
- __name(createIdentifier, "createIdentifier");
257
183
  const cache = {
258
184
  get(property, value) {
259
185
  if (cache[property] != null && cache[property].hasOwnProperty(value) && cache[property][value] != null) {
@@ -383,15 +309,6 @@ const unitlessNumbers = {
383
309
  scaleZ: true,
384
310
  shadowOpacity: true
385
311
  };
386
- const prefixes = ["ms", "Moz", "O", "Webkit"];
387
- const prefixKey = /* @__PURE__ */ __name((prefix, key) => {
388
- return prefix + key.charAt(0).toUpperCase() + key.substring(1);
389
- }, "prefixKey");
390
- Object.keys(unitlessNumbers).forEach((prop) => {
391
- prefixes.forEach((prefix) => {
392
- unitlessNumbers[prefixKey(prefix, prop)] = unitlessNumbers[prop];
393
- });
394
- });
395
312
  const resolveShadowValue = /* @__PURE__ */ __name((style) => {
396
313
  const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style;
397
314
  const { height, width } = shadowOffset || defaultOffset;
@@ -425,10 +342,30 @@ function textShadowReducer(resolvedStyle, style) {
425
342
  }
426
343
  }
427
344
  __name(textShadowReducer, "textShadowReducer");
345
+ const STYLE_SHORT_FORM_EXPANSIONS = {
346
+ borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
347
+ borderRadius: [
348
+ "borderTopLeftRadius",
349
+ "borderTopRightRadius",
350
+ "borderBottomRightRadius",
351
+ "borderBottomLeftRadius"
352
+ ],
353
+ borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
354
+ borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
355
+ margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
356
+ marginHorizontal: ["marginRight", "marginLeft"],
357
+ marginVertical: ["marginTop", "marginBottom"],
358
+ overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
359
+ padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
360
+ paddingHorizontal: ["paddingRight", "paddingLeft"],
361
+ paddingVertical: ["paddingTop", "paddingBottom"],
362
+ ...isWeb && {
363
+ overflow: ["overflowX", "overflowY"]
364
+ }
365
+ };
428
366
  export {
429
367
  expandStyle,
430
368
  expandStyles,
431
- generateAtomicStyles,
432
- inline
369
+ generateAtomicStyles
433
370
  };
434
371
  //# sourceMappingURL=generateAtomicStyles.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { simpleHash } from '@tamagui/helpers'\nimport hyphenateStyleName from 'hyphenate-style-name'\nimport normalizeCSSColor from 'normalize-css-color'\nimport { TextStyle, ViewStyle } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { prefixInlineStyles, prefixStyles } from './prefixStyles'\n\nexport function expandStyles(style: any) {\n const res = {}\n for (const key in style) {\n updateReactDOMStyle(res, key, style[key])\n }\n return res\n}\n\n// TODO can use for inline styles...\n/**\n * Compile simple style object to inline DOM styles.\n * No support for 'animationKeyframes', 'placeholderTextColor', 'scrollbarWidth', or 'pointerEvents'.\n */\nexport function inline(style: Style): Object {\n return prefixInlineStyles(expandStyles(style))\n}\n\ntype Rule = string\ntype Rules = Array<Rule>\nexport type RulesData = {\n property?: string\n value?: string\n identifier: string\n rules: Rules\n}\ntype CompilerOutput = { [key: string]: RulesData }\ntype Value = Object | Array<any> | string | number\nexport type Style = { [key: string]: Value }\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\nexport const generateAtomicStyles = (style: ViewStyle & TextStyle): CompilerOutput => {\n const res = expandStyles(style)\n\n if (\n style.shadowColor != null ||\n style.shadowOffset != null ||\n style.shadowOpacity != null ||\n style.shadowRadius != null\n ) {\n boxShadowReducer(res, style)\n delete res['shadowColor']\n delete res['shadowOffset']\n delete res['shadowOpacity']\n delete res['shadowRadius']\n }\n\n if (\n style.textShadowColor != null ||\n style.textShadowOffset != null ||\n style.textShadowRadius != null\n ) {\n textShadowReducer(res, style)\n delete res['textShadowColor']\n delete res['textShadowOffset']\n delete res['textShadowRadius']\n }\n\n const out = {}\n for (const key in res) {\n const value = res[key]\n if (value != null) {\n const valueString = stringifyValueWithProperty(value, key)\n const cachedResult = cache.get(key, valueString)\n if (cachedResult != null) {\n const { identifier } = cachedResult\n out[identifier] = cachedResult\n } else {\n const identifier = createIdentifier('r', key, value)\n const rules = createAtomicRules(identifier, key, value)\n const cachedResult = cache.set(key, valueString, {\n property: key,\n value: stringifyValueWithProperty(value, key),\n identifier,\n rules,\n })\n out[identifier] = cachedResult\n }\n }\n }\n\n return out\n}\n\nfunction updateReactDOMStyle(style: Object, key: string, value: any) {\n value = normalizeValueWithProperty(value, key)\n const out = expandStyle(key, value)\n if (out) {\n Object.assign(style, Object.fromEntries(out))\n } else {\n style[key] = value\n }\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\nfunction createAtomicRules(identifier: string, property, value): Rules {\n const rules: string[] = []\n const selector = `.${identifier}`\n\n // Handle non-standard properties and object values that require multiple\n // CSS rules to be created.\n switch (property) {\n case 'animationKeyframes': {\n const { animationNames, rules: keyframesRules } = processKeyframesValue(value)\n const block = createDeclarationBlock({ animationName: animationNames.join(',') })\n rules.push(`${selector}${block}`, ...keyframesRules)\n break\n }\n\n // Equivalent to using '::placeholder'\n case 'placeholderTextColor': {\n const block = createDeclarationBlock({ color: value, opacity: 1 })\n rules.push(\n `${selector}::-webkit-input-placeholder${block}`,\n `${selector}::-moz-placeholder${block}`,\n `${selector}:-ms-input-placeholder${block}`,\n `${selector}::placeholder${block}`\n )\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' })\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' })\n rules.push(`${selector}>*${block}`)\n }\n }\n const block = createDeclarationBlock({ pointerEvents: finalValue })\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 })\n rules.push(`${selector}${block}`)\n break\n }\n\n default: {\n const block = createDeclarationBlock({ [property]: value })\n rules.push(`${selector}${block}`)\n break\n }\n }\n\n return rules\n}\n\n/**\n * Create CSS keyframes rules and names from a StyleSheet keyframes object.\n */\nfunction processKeyframesValue(keyframesValue: number | string[]) {\n if (typeof keyframesValue === 'number') {\n throw new Error(`Invalid CSS keyframes type: ${typeof keyframesValue}`)\n }\n\n const animationNames: string[] = []\n const rules: string[] = []\n const value = Array.isArray(keyframesValue) ? keyframesValue : [keyframesValue]\n\n for (const keyframes of value) {\n if (typeof keyframes === 'string') {\n // Support external animation libraries (identifiers only)\n animationNames.push(keyframes)\n } else {\n // Create rules for each of the keyframes\n const { identifier, rules: keyframesRules } = createKeyframes(keyframes)\n animationNames.push(identifier)\n rules.push(...keyframesRules)\n }\n }\n\n return { animationNames, rules }\n}\n\n/**\n * Create individual CSS keyframes rules.\n */\nfunction createKeyframes(keyframes) {\n const prefixes = ['-webkit-', '']\n const identifier = createIdentifier('r', 'animation', keyframes)\n\n const steps =\n '{' +\n Object.keys(keyframes)\n .map((stepName) => {\n const rule = keyframes[stepName]\n const block = createDeclarationBlock(rule)\n return `${stepName}${block}`\n })\n .join('') +\n '}'\n\n const rules = prefixes.map((prefix) => {\n return `@${prefix}keyframes ${identifier}${steps}`\n })\n return { identifier, rules }\n}\n\n/**\n * Creates a CSS declaration block from a StyleSheet object.\n */\nfunction createDeclarationBlock(style: Style) {\n const domStyle = prefixStyles(expandStyles(style))\n const declarationsString = Object.keys(domStyle)\n .map((property) => {\n const value = domStyle[property]\n const prop = hyphenateStyleName(property)\n // The prefixer may return an array of values:\n // { display: [ '-webkit-flex', 'flex' ] }\n // to represent \"fallback\" declarations\n // { display: -webkit-flex; display: flex; }\n if (Array.isArray(value)) {\n return value.map((v) => `${prop}:${v}`).join(';')\n } else {\n return `${prop}:${value}`\n }\n })\n // Once properties are hyphenated, this will put the vendor\n // prefixed and short-form properties first in the list.\n .sort()\n .join(';')\n\n return `{${declarationsString};}`\n}\n\nfunction createIdentifier(prefix: string, name: string, value): string {\n const hashedString = simpleHash(name + stringifyValueWithProperty(value, name))\n return `${prefix}-${hashedString}`\n}\n\nconst cache = {\n get(property, value) {\n if (\n cache[property] != null &&\n cache[property].hasOwnProperty(value) &&\n cache[property][value] != null\n ) {\n return cache[property][value]\n }\n },\n set(property, value, object) {\n if (cache[property] == null) {\n cache[property] = {}\n }\n return (cache[property][value] = object)\n },\n}\n\nfunction stringifyValueWithProperty(value: Value, property?: string): string {\n // e.g., 0 => '0px', 'black' => 'rgba(0,0,0,1)'\n const normalizedValue = normalizeValueWithProperty(value, property)\n return typeof normalizedValue !== 'string'\n ? JSON.stringify(normalizedValue || '')\n : normalizedValue\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 if (\n (property === undefined || property === null || !unitlessNumbers[property]) &&\n typeof value === 'number'\n ) {\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}\n\nconst isWebColor = (color: string): boolean =>\n color === 'currentcolor' ||\n color === 'currentColor' ||\n color === 'inherit' ||\n 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\n/**\n * Support style names that may come passed in prefixed by adding permutations\n * of vendor prefixes.\n */\nconst prefixes = ['ms', 'Moz', 'O', 'Webkit']\nconst prefixKey = (prefix: string, key: string) => {\n return prefix + key.charAt(0).toUpperCase() + key.substring(1)\n}\nObject.keys(unitlessNumbers).forEach((prop) => {\n prefixes.forEach((prefix) => {\n unitlessNumbers[prefixKey(prefix, prop)] = unitlessNumbers[prop]\n })\n})\n\nconst resolveShadowValue = (style: ViewStyle): void | string => {\n const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style\n const { height, width } = shadowOffset || defaultOffset\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n const blurRadius = normalizeValueWithProperty(shadowRadius || 0)\n // @ts-ignore\n const color = normalizeColor(shadowColor || 'black', shadowOpacity)\n if (color != null && offsetX != null && offsetY != null && blurRadius != null) {\n return `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n}\n\nfunction boxShadowReducer(resolvedStyle, style) {\n const { boxShadow } = style\n const shadow = resolveShadowValue(style)\n if (shadow != null) {\n resolvedStyle.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow\n }\n}\n\nconst defaultOffset = { height: 0, width: 0 }\nfunction textShadowReducer(resolvedStyle, style) {\n const { textShadowColor, textShadowOffset, textShadowRadius } = style\n const { height, width } = textShadowOffset || defaultOffset\n const radius = textShadowRadius || 0\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n const blurRadius = normalizeValueWithProperty(radius)\n const color = normalizeValueWithProperty(textShadowColor, 'textShadowColor')\n\n if (\n color &&\n (height !== 0 || width !== 0 || radius !== 0) &&\n offsetX != null &&\n offsetY != null &&\n blurRadius != null\n ) {\n resolvedStyle.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n}\n"],
5
- "mappings": ";;AAKA;AACA;AACA;AAGA;AACA;AAEO,sBAAsB,OAAY;AACvC,QAAM,MAAM,CAAC;AACb,aAAW,OAAO,OAAO;AACvB,wBAAoB,KAAK,KAAK,MAAM,IAAI;AAAA,EAC1C;AACA,SAAO;AACT;AANgB;AAaT,gBAAgB,OAAsB;AAC3C,SAAO,mBAAmB,aAAa,KAAK,CAAC;AAC/C;AAFgB;AAgBhB,MAAM,8BAA8B;AAAA,EAClC,aAAa,CAAC,kBAAkB,oBAAoB,qBAAqB,iBAAiB;AAAA,EAC1F,cAAc;AAAA,IACZ;AAAA,IACA;AAAA,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Q,GAAG,OAAO,EAAE;AAC5C,2BAA2B,eAAe,OAAO;AAC/C,QAAM,EAAE,iBAAiB,kBAAkB,qBAAqB;AAChE,QAAM,EAAE,QAAQ,UAAU,oBAAoB;AAC9C,QAAM,SAAS,oBAAoB;AACnC,QAAM,UAAU,2BAA2B,KAAK;AAChD,QAAM,UAAU,2BAA2B,MAAM;AACjD,QAAM,aAAa,2BAA2B,MAAM;AACpD,QAAM,QAAQ,2BAA2B,iBAAiB,iBAAiB;AAE3E,MACE,SACC,YAAW,KAAK,UAAU,KAAK,WAAW,MAC3C,WAAW,QACX,WAAW,QACX,cAAc,MACd;AACA,kBAAc,aAAa,GAAG,WAAW,WAAW,cAAc;AAAA,EACpE;AACF;AAlBS;",
4
+ "sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { simpleHash } from '@tamagui/helpers'\nimport hyphenateStyleName from 'hyphenate-style-name'\nimport normalizeCSSColor from 'normalize-css-color'\nimport { TextStyle, ViewStyle } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\n\ntype Value = Object | Array<any> | string | number\nexport type Style = { [key: string]: Value }\n\ntype Rule = string\ntype Rules = Array<Rule>\n\nexport type RulesData = {\n property?: string\n value?: string\n identifier: string\n rules: Rules\n}\n\ntype CompilerOutput = { [key: string]: RulesData }\n\nexport function expandStyles(style: any) {\n const res = {}\n for (const key in style) {\n updateReactDOMStyle(res, key, style[key])\n }\n return res\n}\n\nfunction updateReactDOMStyle(style: Object, key: string, value: any) {\n value = normalizeValueWithProperty(value, key)\n const out = expandStyle(key, value)\n if (out) {\n Object.assign(style, Object.fromEntries(out))\n } else {\n style[key] = value\n }\n}\n\nexport const generateAtomicStyles = (style: ViewStyle & TextStyle): CompilerOutput => {\n const res = expandStyles(style)\n\n if (\n style.shadowColor != null ||\n style.shadowOffset != null ||\n style.shadowOpacity != null ||\n style.shadowRadius != null\n ) {\n boxShadowReducer(res, style)\n delete res['shadowColor']\n delete res['shadowOffset']\n delete res['shadowOpacity']\n delete res['shadowRadius']\n }\n\n if (\n style.textShadowColor != null ||\n style.textShadowOffset != null ||\n style.textShadowRadius != null\n ) {\n textShadowReducer(res, style)\n delete res['textShadowColor']\n delete res['textShadowOffset']\n delete res['textShadowRadius']\n }\n\n const out = {}\n for (const key in res) {\n const value = res[key]\n if (value != null) {\n const valueString = stringifyValueWithProperty(value, key)\n const cachedResult = cache.get(key, valueString)\n if (cachedResult != null) {\n const { identifier } = cachedResult\n out[identifier] = cachedResult\n } else {\n const identifier = simpleHash(key + value)\n const rules = createAtomicRules(identifier, key, value)\n const cachedResult = cache.set(key, valueString, {\n property: key,\n value: valueString,\n identifier,\n rules,\n })\n out[identifier] = cachedResult\n }\n }\n }\n\n return out\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\nfunction createAtomicRules(identifier: string, property, value): Rules {\n const rules: string[] = []\n const selector = `.${identifier}`\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 })\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' })\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' })\n rules.push(`${selector}>*${block}`)\n }\n }\n const block = createDeclarationBlock({ pointerEvents: finalValue })\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 })\n rules.push(`${selector}${block}`)\n break\n }\n\n default: {\n const block = createDeclarationBlock({ [property]: value })\n rules.push(`${selector}${block}`)\n break\n }\n }\n\n return rules\n}\n\n/**\n * Creates a CSS declaration block from a StyleSheet object.\n */\nfunction createDeclarationBlock(style: Style) {\n const domStyle = expandStyles(style)\n const declarationsString = Object.keys(domStyle)\n .map((property) => {\n const value = domStyle[property]\n const prop = hyphenateStyleName(property)\n return `${prop}:${value}`\n })\n // Once properties are hyphenated, this will put the vendor\n // prefixed and short-form properties first in the list.\n .sort()\n .join(';')\n\n return `{${declarationsString};}`\n}\n\nconst cache = {\n get(property, value) {\n if (\n cache[property] != null &&\n cache[property].hasOwnProperty(value) &&\n cache[property][value] != null\n ) {\n return cache[property][value]\n }\n },\n set(property, value, object) {\n if (cache[property] == null) {\n cache[property] = {}\n }\n return (cache[property][value] = object)\n },\n}\n\nfunction stringifyValueWithProperty(value: Value, property?: string): string {\n // e.g., 0 => '0px', 'black' => 'rgba(0,0,0,1)'\n const normalizedValue = normalizeValueWithProperty(value, property)\n return typeof normalizedValue !== 'string'\n ? JSON.stringify(normalizedValue || '')\n : normalizedValue\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 if (\n (property === undefined || property === null || !unitlessNumbers[property]) &&\n typeof value === 'number'\n ) {\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}\n\nconst isWebColor = (color: string): boolean =>\n color === 'currentcolor' ||\n color === 'currentColor' ||\n color === 'inherit' ||\n 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\n/**\n * Support style names that may come passed in prefixed by adding permutations\n * of vendor prefixes.\n */\n\nconst resolveShadowValue = (style: ViewStyle): void | string => {\n const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style\n const { height, width } = shadowOffset || defaultOffset\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n const blurRadius = normalizeValueWithProperty(shadowRadius || 0)\n // @ts-ignore\n const color = normalizeColor(shadowColor || 'black', shadowOpacity)\n if (color != null && offsetX != null && offsetY != null && blurRadius != null) {\n return `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n}\n\nfunction boxShadowReducer(resolvedStyle, style) {\n const { boxShadow } = style\n const shadow = resolveShadowValue(style)\n if (shadow != null) {\n resolvedStyle.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow\n }\n}\n\nconst defaultOffset = { height: 0, width: 0 }\nfunction textShadowReducer(resolvedStyle, style) {\n const { textShadowColor, textShadowOffset, textShadowRadius } = style\n const { height, width } = textShadowOffset || defaultOffset\n const radius = textShadowRadius || 0\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n const blurRadius = normalizeValueWithProperty(radius)\n const color = normalizeValueWithProperty(textShadowColor, 'textShadowColor')\n\n if (\n color &&\n (height !== 0 || width !== 0 || radius !== 0) &&\n offsetX != null &&\n offsetY != null &&\n blurRadius != null\n ) {\n resolvedStyle.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n}\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', '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AA,EACtE,mBAAmB,CAAC,gBAAgB,aAAa;AAAA,EACjD,iBAAiB,CAAC,cAAc,eAAe;AAAA,EAC/C,GAAI,SAAS;AAAA,IAEX,UAAU,CAAC,aAAa,WAAW;AAAA,EACrC;AACF;",
6
6
  "names": []
7
7
  }
@@ -77,7 +77,7 @@ function getAtomicStyle(style, pseudo, options) {
77
77
  }
78
78
  return Object.keys(atomicStyles).map((key) => {
79
79
  const val = atomicStyles[key];
80
- const [_, hash] = val.identifier.split("-");
80
+ const hash = val.identifier;
81
81
  const psuedoPrefix = pseudo ? `0${pseudo.name}-` : "";
82
82
  if (!val.property) {
83
83
  throw new Error(`no prop`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/getStylesAtomic.ts"],
4
- "sourcesContent": ["import { StyleObject, stylePropsTransform } from '@tamagui/helpers'\nimport { ViewStyle } from 'react-native'\n\nimport { reversedShorthands } from '../createTamagui'\nimport { isVariable } from '../createVariable'\nimport { RulesData, generateAtomicStyles } from './generateAtomicStyles'\nimport { invertMapTransformKeys, mergeTransform } from './mergeTransform'\n\nexport type ViewStyleWithPseudos = ViewStyle & {\n hoverStyle?: ViewStyle\n pressStyle?: ViewStyle\n focusStyle?: ViewStyle\n}\n\ntype AtomicStyleOptions = {\n splitTransforms?: boolean\n}\n\n// *0 order matches to *1\nexport const pseudos = {\n hoverStyle: {\n name: 'hover',\n priority: 1,\n },\n pressStyle: {\n name: 'active',\n priority: 2,\n },\n focusStyle: {\n name: 'focus',\n priority: 3,\n },\n} as const\n\ntype PseudoDescriptor = typeof pseudos[keyof typeof pseudos]\n\nconst pseudosOrdered = Object.values(pseudos)\n\n// this is how compiler outputs psueodo identifier\n// TODO remove in next refactor\nexport const psuedoCNInverse = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n\nexport function getStylesAtomic(stylesIn: ViewStyleWithPseudos, options: AtomicStyleOptions = {}) {\n const { hoverStyle, pressStyle, focusStyle, ...base } = stylesIn\n let res: StyleObject[] = []\n\n // *1 order matched to *0\n for (const [index, style] of [hoverStyle, pressStyle, focusStyle, base].entries()) {\n if (!style || !Object.keys(style).length) {\n continue\n }\n const pseudo = pseudosOrdered[index]\n for (const skey in style) {\n const val = style[skey]\n if (isVariable(val)) {\n style[skey] = val.toString()\n }\n if (stylePropsTransform[skey]) {\n delete style[skey]\n mergeTransform(style, skey, val)\n }\n }\n res = [...res, ...getAtomicStyle(style, pseudo, options)]\n }\n\n return res\n}\n\nfunction getAtomicStyle(\n style: ViewStyle,\n pseudo: PseudoDescriptor | undefined,\n options: AtomicStyleOptions\n): StyleObject[] {\n if (style == null || typeof style !== 'object') {\n throw new Error(`Wrong style type: \"${typeof style}\": ${style}`)\n }\n\n // why is this diff from react-native-web!? need to figure out\n for (const key in borderDefaults) {\n if (key in style) {\n style[borderDefaults[key]] = style[borderDefaults[key]] ?? 'solid'\n }\n }\n\n let atomicStyles: { [key: string]: RulesData & { transformProperty?: string } } = {}\n\n if (options.splitTransforms && style.transform) {\n let { transform, ...rest } = style\n Object.assign(atomicStyles, generateAtomicStyles(rest))\n for (const t of transform) {\n const tKey = Object.keys(t)[0]\n const transformProperty = invertMapTransformKeys[tKey] || tKey\n const out = generateAtomicStyles({ transform: [t] })\n const key = Object.keys(out)[0]\n atomicStyles[key] = {\n ...out[key],\n transformProperty,\n }\n }\n } else {\n // TODO we can do this all in one loop likely inside getSplitStyles in existing loop and avoid O(n^3)...\n atomicStyles = generateAtomicStyles(style)\n }\n\n // TODO ... and then also avoid this loop! n^4\n return Object.keys(atomicStyles).map((key) => {\n const val = atomicStyles[key]\n // r-transform-1ns13n\n const [_, hash] = val.identifier.split('-')\n // pseudos have a `--` to be easier to find with concatClassNames\n const psuedoPrefix = pseudo ? `0${pseudo.name}-` : ''\n if (!val.property) {\n throw new Error(`no prop`)\n }\n const shortProp = reversedShorthands[val.property] || val.property\n const identifier = `_${shortProp}-${psuedoPrefix}${hash}`\n const className = `.${identifier}`\n const rules = val.rules.map((rule) => {\n if (pseudo) {\n const psuedoPrefixSelect = [...Array(pseudo.priority)].map(() => ':root').join('') + ' '\n let res = rule\n .replace(`.${val.identifier}`, `${psuedoPrefixSelect} ${className}`)\n .replace('{', `:${pseudo.name}{`)\n // important to override inline styles\n .replace(';', ' !important;')\n\n if (pseudo.name === 'hover') {\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 res = `@media not all and (hover: none) { ${res} }`\n }\n return res\n }\n return rule.replace(`.${val.identifier}`, className).replace(importantRegex, '')\n })\n\n const result: StyleObject = {\n property: val.transformProperty || val.property,\n pseudo: pseudo?.name,\n value: val.value || '',\n identifier,\n className,\n rules,\n }\n\n return result\n })\n}\n\nconst importantRegex = /\\!important*/g\n\nconst borderDefaults = {\n borderWidth: 'borderStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderTopWidth: 'borderTopStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n}\n"],
5
- "mappings": ";;AAAA;AAGA;AACA;AACA;AACA;AAaO,MAAM,UAAU;AAAA,EACrB,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;AAIA,MAAM,iBAAiB,OAAO,OAAO,OAAO;AAIrC,MAAM,kBAAkB;AAAA,EAC7B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;AAEO,yBAAyB,UAAgC,UAA8B,CAAC,GAAG;AAChG,QAAM,EAAE,YAAY,YAAY,eAAe,SAAS;AACxD,MAAI,MAAqB,CAAC;AAG1B,aAAW,CAAC,OAAO,UAAU,CAAC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} from '@tamagui/helpers'\nimport { ViewStyle } from 'react-native'\n\nimport { reversedShorthands } from '../createTamagui'\nimport { isVariable } from '../createVariable'\nimport { RulesData, generateAtomicStyles } from './generateAtomicStyles'\nimport { invertMapTransformKeys, mergeTransform } from './mergeTransform'\n\nexport type ViewStyleWithPseudos = ViewStyle & {\n hoverStyle?: ViewStyle\n pressStyle?: ViewStyle\n focusStyle?: ViewStyle\n}\n\ntype AtomicStyleOptions = {\n splitTransforms?: boolean\n}\n\n// *0 order matches to *1\nexport const pseudos = {\n hoverStyle: {\n name: 'hover',\n priority: 1,\n },\n pressStyle: {\n name: 'active',\n priority: 2,\n },\n focusStyle: {\n name: 'focus',\n priority: 3,\n },\n} as const\n\ntype PseudoDescriptor = typeof pseudos[keyof typeof pseudos]\n\nconst pseudosOrdered = Object.values(pseudos)\n\n// this is how compiler outputs psueodo identifier\n// TODO remove in next refactor\nexport const psuedoCNInverse = {\n hover: 'hoverStyle',\n focus: 'focusStyle',\n press: 'pressStyle',\n}\n\nexport function getStylesAtomic(stylesIn: ViewStyleWithPseudos, options: AtomicStyleOptions = {}) {\n const { hoverStyle, pressStyle, focusStyle, ...base } = stylesIn\n let res: StyleObject[] = []\n\n // *1 order matched to *0\n for (const [index, style] of [hoverStyle, pressStyle, focusStyle, base].entries()) {\n if (!style || !Object.keys(style).length) {\n continue\n }\n const pseudo = pseudosOrdered[index]\n for (const skey in style) {\n const val = style[skey]\n if (isVariable(val)) {\n style[skey] = val.toString()\n }\n if (stylePropsTransform[skey]) {\n delete style[skey]\n mergeTransform(style, skey, val)\n }\n }\n res = [...res, ...getAtomicStyle(style, pseudo, options)]\n }\n\n return res\n}\n\nfunction getAtomicStyle(\n style: ViewStyle,\n pseudo: PseudoDescriptor | undefined,\n options: AtomicStyleOptions\n): StyleObject[] {\n if (style == null || typeof style !== 'object') {\n throw new Error(`Wrong style type: \"${typeof style}\": ${style}`)\n }\n\n // why is this diff from react-native-web!? need to figure out\n for (const key in borderDefaults) {\n if (key in style) {\n style[borderDefaults[key]] = style[borderDefaults[key]] ?? 'solid'\n }\n }\n\n let atomicStyles: { [key: string]: RulesData & { transformProperty?: string } } = {}\n\n if (options.splitTransforms && style.transform) {\n let { transform, ...rest } = style\n Object.assign(atomicStyles, generateAtomicStyles(rest))\n for (const t of transform) {\n const tKey = Object.keys(t)[0]\n const transformProperty = invertMapTransformKeys[tKey] || tKey\n const out = generateAtomicStyles({ transform: [t] })\n const key = Object.keys(out)[0]\n atomicStyles[key] = {\n ...out[key],\n transformProperty,\n }\n }\n } else {\n // TODO we can do this all in one loop likely inside getSplitStyles in existing loop and avoid O(n^3)...\n atomicStyles = generateAtomicStyles(style)\n }\n\n // TODO ... and then also avoid this loop! n^4\n return Object.keys(atomicStyles).map((key) => {\n const val = atomicStyles[key]\n const hash = val.identifier\n // pseudos have a `--` to be easier to find with concatClassNames\n const psuedoPrefix = pseudo ? `0${pseudo.name}-` : ''\n if (!val.property) {\n throw new Error(`no prop`)\n }\n const shortProp = reversedShorthands[val.property] || val.property\n const identifier = `_${shortProp}-${psuedoPrefix}${hash}`\n const className = `.${identifier}`\n const rules = val.rules.map((rule) => {\n if (pseudo) {\n const psuedoPrefixSelect = [...Array(pseudo.priority)].map(() => ':root').join('') + ' '\n let res = rule\n .replace(`.${val.identifier}`, `${psuedoPrefixSelect} ${className}`)\n .replace('{', `:${pseudo.name}{`)\n // important to override inline styles\n .replace(';', ' !important;')\n\n if (pseudo.name === 'hover') {\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 res = `@media not all and (hover: none) { ${res} }`\n }\n return res\n }\n return rule.replace(`.${val.identifier}`, className).replace(importantRegex, '')\n })\n\n const result: StyleObject = {\n property: val.transformProperty || val.property,\n pseudo: pseudo?.name,\n value: val.value || '',\n identifier,\n className,\n rules,\n }\n\n return result\n })\n}\n\nconst importantRegex = /\\!important*/g\n\nconst borderDefaults = {\n borderWidth: 'borderStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderTopWidth: 'borderTopStyle',\n borderLeftWidth: 'borderLeftStyle',\n borderRightWidth: 'borderRightStyle',\n}\n"],
5
+ "mappings": ";;AAAA;AAGA;AACA;AACA;AACA;AAaO,MAAM,UAAU;AAAA,EACrB,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;AAIA,MAAM,iBAAiB,OAAO,OAAO,OAAO;AAIrC,MAAM,kBAAkB;AAAA,EAC7B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;AAEO,yBAAyB,UAAgC,UAA8B,CAAC,GAAG;AAChG,QAAM,EAAE,YAAY,YAAY,eAAe,SAAS;AACxD,MAAI,MAAqB,CAAC;AAG1B,aAAW,CAAC,OAAO,UAAU,CAAC,YAAY,YAAY,YAAY,IAAI,EAAE,QAAQ,GAAG;AACjF,QAAI,CAAC,SAAS,CAAC,OAAO,KAAK,KAAK,EAAE,QAAQ;AACxC;AAAA,IACF;AACA,UAAM,SAAS,eAAe;AAC9B,eAAW,QAAQ,OAAO;AACxB,YAAM,MAAM,MAAM;AAClB,UAAI,WAAW,GAAG,GAAG;AACnB,cAAM,QAAQ,IAAI,SAAS;AAAA,MAC7B;AACA,UAAI,oBAAoB,OAAO;AAC7B,eAAO,MAAM;AACb,uBAAe,OAAO,MAAM,GAAG;AAAA,MACjC;AAAA,IACF;AACA,UAAM,CAAC,GAAG,KAAK,GAAG,eAAe,OAAO,QAAQ,OAAO,CAAC;AAAA,EAC1D;AAEA,SAAO;AACT;AAxBgB;AA0BhB,wBACE,OACA,QACA,SACe;AA5EjB;AA6EE,MAAI,SAAS,QAAQ,OAAO,UAAU,UAAU;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AsB,WAAW,EAClE,QAAQ,KAAK,IAAI,OAAO,OAAO,EAE/B,QAAQ,KAAK,cAAc;AAE9B,YAAI,OAAO,SAAS,SAAS;AAM3B,gBAAM,sCAAsC;AAAA,QAC9C;AACA,eAAO;AAAA,MACT;AACA,aAAO,KAAK,QAAQ,IAAI,IAAI,cAAc,SAAS,EAAE,QAAQ,gBAAgB,EAAE;AAAA,IACjF,CAAC;AAED,UAAM,SAAsB;AAAA,MAC1B,UAAU,IAAI,qBAAqB,IAAI;AAAA,MACvC,QAAQ,iCAAQ;AAAA,MAChB,OAAO,IAAI,SAAS;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAjFS;AAmFT,MAAM,iBAAiB;AAEvB,MAAM,iBAAiB;AAAA,EACrB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,kBAAkB;AACpB;",
6
6
  "names": []
7
7
  }
@@ -9,13 +9,13 @@ function createTamaguiProvider({
9
9
  ...themeProps
10
10
  }) {
11
11
  return /* @__PURE__ */ __name(function TamaguiProvider({
12
- injectCSS,
12
+ disableInjectCSS,
13
13
  children,
14
14
  ...themePropsProvider
15
15
  }) {
16
16
  if (typeof document !== "undefined") {
17
17
  React.useLayoutEffect(() => {
18
- if (!injectCSS)
18
+ if (disableInjectCSS)
19
19
  return;
20
20
  const style = document.createElement("style");
21
21
  style.appendChild(document.createTextNode(getCSS()));
@@ -4,7 +4,6 @@ import { simpleHash } from "@tamagui/helpers";
4
4
  import hyphenateStyleName from "hyphenate-style-name";
5
5
  import normalizeCSSColor from "normalize-css-color";
6
6
  import { isWeb } from "../constants/platform";
7
- import { prefixInlineStyles, prefixStyles } from "./prefixStyles";
8
7
  function expandStyles(style) {
9
8
  const res = {};
10
9
  for (const key in style) {
@@ -13,31 +12,16 @@ function expandStyles(style) {
13
12
  return res;
14
13
  }
15
14
  __name(expandStyles, "expandStyles");
16
- function inline(style) {
17
- return prefixInlineStyles(expandStyles(style));
18
- }
19
- __name(inline, "inline");
20
- const STYLE_SHORT_FORM_EXPANSIONS = {
21
- borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
22
- borderRadius: [
23
- "borderTopLeftRadius",
24
- "borderTopRightRadius",
25
- "borderBottomRightRadius",
26
- "borderBottomLeftRadius"
27
- ],
28
- borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
29
- borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
30
- margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
31
- marginHorizontal: ["marginRight", "marginLeft"],
32
- marginVertical: ["marginTop", "marginBottom"],
33
- overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
34
- padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
35
- paddingHorizontal: ["paddingRight", "paddingLeft"],
36
- paddingVertical: ["paddingTop", "paddingBottom"],
37
- ...isWeb && {
38
- overflow: ["overflowX", "overflowY"]
15
+ function updateReactDOMStyle(style, key, value) {
16
+ value = normalizeValueWithProperty(value, key);
17
+ const out = expandStyle(key, value);
18
+ if (out) {
19
+ Object.assign(style, Object.fromEntries(out));
20
+ } else {
21
+ style[key] = value;
39
22
  }
40
- };
23
+ }
24
+ __name(updateReactDOMStyle, "updateReactDOMStyle");
41
25
  const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
42
26
  const res = expandStyles(style);
43
27
  if (style.shadowColor != null || style.shadowOffset != null || style.shadowOpacity != null || style.shadowRadius != null) {
@@ -63,11 +47,11 @@ const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
63
47
  const { identifier } = cachedResult;
64
48
  out[identifier] = cachedResult;
65
49
  } else {
66
- const identifier = createIdentifier("r", key, value);
50
+ const identifier = simpleHash(key + value);
67
51
  const rules = createAtomicRules(identifier, key, value);
68
52
  const cachedResult2 = cache.set(key, valueString, {
69
53
  property: key,
70
- value: stringifyValueWithProperty(value, key),
54
+ value: valueString,
71
55
  identifier,
72
56
  rules
73
57
  });
@@ -77,16 +61,6 @@ const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
77
61
  }
78
62
  return out;
79
63
  }, "generateAtomicStyles");
80
- function updateReactDOMStyle(style, key, value) {
81
- value = normalizeValueWithProperty(value, key);
82
- const out = expandStyle(key, value);
83
- if (out) {
84
- Object.assign(style, Object.fromEntries(out));
85
- } else {
86
- style[key] = value;
87
- }
88
- }
89
- __name(updateReactDOMStyle, "updateReactDOMStyle");
90
64
  function expandStyle(key, value) {
91
65
  if (key === "flex") {
92
66
  if (value <= -1) {
@@ -155,15 +129,9 @@ function createAtomicRules(identifier, property, value) {
155
129
  const rules = [];
156
130
  const selector = `.${identifier}`;
157
131
  switch (property) {
158
- case "animationKeyframes": {
159
- const { animationNames, rules: keyframesRules } = processKeyframesValue(value);
160
- const block = createDeclarationBlock({ animationName: animationNames.join(",") });
161
- rules.push(`${selector}${block}`, ...keyframesRules);
162
- break;
163
- }
164
132
  case "placeholderTextColor": {
165
133
  const block = createDeclarationBlock({ color: value, opacity: 1 });
166
- rules.push(`${selector}::-webkit-input-placeholder${block}`, `${selector}::-moz-placeholder${block}`, `${selector}:-ms-input-placeholder${block}`, `${selector}::placeholder${block}`);
134
+ rules.push(`${selector}::placeholder${block}`);
167
135
  break;
168
136
  }
169
137
  case "pointerEvents": {
@@ -202,58 +170,16 @@ function createAtomicRules(identifier, property, value) {
202
170
  return rules;
203
171
  }
204
172
  __name(createAtomicRules, "createAtomicRules");
205
- function processKeyframesValue(keyframesValue) {
206
- if (typeof keyframesValue === "number") {
207
- throw new Error(`Invalid CSS keyframes type: ${typeof keyframesValue}`);
208
- }
209
- const animationNames = [];
210
- const rules = [];
211
- const value = Array.isArray(keyframesValue) ? keyframesValue : [keyframesValue];
212
- for (const keyframes of value) {
213
- if (typeof keyframes === "string") {
214
- animationNames.push(keyframes);
215
- } else {
216
- const { identifier, rules: keyframesRules } = createKeyframes(keyframes);
217
- animationNames.push(identifier);
218
- rules.push(...keyframesRules);
219
- }
220
- }
221
- return { animationNames, rules };
222
- }
223
- __name(processKeyframesValue, "processKeyframesValue");
224
- function createKeyframes(keyframes) {
225
- const prefixes2 = ["-webkit-", ""];
226
- const identifier = createIdentifier("r", "animation", keyframes);
227
- const steps = "{" + Object.keys(keyframes).map((stepName) => {
228
- const rule = keyframes[stepName];
229
- const block = createDeclarationBlock(rule);
230
- return `${stepName}${block}`;
231
- }).join("") + "}";
232
- const rules = prefixes2.map((prefix) => {
233
- return `@${prefix}keyframes ${identifier}${steps}`;
234
- });
235
- return { identifier, rules };
236
- }
237
- __name(createKeyframes, "createKeyframes");
238
173
  function createDeclarationBlock(style) {
239
- const domStyle = prefixStyles(expandStyles(style));
174
+ const domStyle = expandStyles(style);
240
175
  const declarationsString = Object.keys(domStyle).map((property) => {
241
176
  const value = domStyle[property];
242
177
  const prop = hyphenateStyleName(property);
243
- if (Array.isArray(value)) {
244
- return value.map((v) => `${prop}:${v}`).join(";");
245
- } else {
246
- return `${prop}:${value}`;
247
- }
178
+ return `${prop}:${value}`;
248
179
  }).sort().join(";");
249
180
  return `{${declarationsString};}`;
250
181
  }
251
182
  __name(createDeclarationBlock, "createDeclarationBlock");
252
- function createIdentifier(prefix, name, value) {
253
- const hashedString = simpleHash(name + stringifyValueWithProperty(value, name));
254
- return `${prefix}-${hashedString}`;
255
- }
256
- __name(createIdentifier, "createIdentifier");
257
183
  const cache = {
258
184
  get(property, value) {
259
185
  if (cache[property] != null && cache[property].hasOwnProperty(value) && cache[property][value] != null) {
@@ -383,15 +309,6 @@ const unitlessNumbers = {
383
309
  scaleZ: true,
384
310
  shadowOpacity: true
385
311
  };
386
- const prefixes = ["ms", "Moz", "O", "Webkit"];
387
- const prefixKey = /* @__PURE__ */ __name((prefix, key) => {
388
- return prefix + key.charAt(0).toUpperCase() + key.substring(1);
389
- }, "prefixKey");
390
- Object.keys(unitlessNumbers).forEach((prop) => {
391
- prefixes.forEach((prefix) => {
392
- unitlessNumbers[prefixKey(prefix, prop)] = unitlessNumbers[prop];
393
- });
394
- });
395
312
  const resolveShadowValue = /* @__PURE__ */ __name((style) => {
396
313
  const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style;
397
314
  const { height, width } = shadowOffset || defaultOffset;
@@ -425,9 +342,29 @@ function textShadowReducer(resolvedStyle, style) {
425
342
  }
426
343
  }
427
344
  __name(textShadowReducer, "textShadowReducer");
345
+ const STYLE_SHORT_FORM_EXPANSIONS = {
346
+ borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
347
+ borderRadius: [
348
+ "borderTopLeftRadius",
349
+ "borderTopRightRadius",
350
+ "borderBottomRightRadius",
351
+ "borderBottomLeftRadius"
352
+ ],
353
+ borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
354
+ borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
355
+ margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
356
+ marginHorizontal: ["marginRight", "marginLeft"],
357
+ marginVertical: ["marginTop", "marginBottom"],
358
+ overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
359
+ padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
360
+ paddingHorizontal: ["paddingRight", "paddingLeft"],
361
+ paddingVertical: ["paddingTop", "paddingBottom"],
362
+ ...isWeb && {
363
+ overflow: ["overflowX", "overflowY"]
364
+ }
365
+ };
428
366
  export {
429
367
  expandStyle,
430
368
  expandStyles,
431
- generateAtomicStyles,
432
- inline
369
+ generateAtomicStyles
433
370
  };