@planningcenter/tapestry-migration-cli 3.6.0 → 3.6.1-qa-1035.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/tapestry-react-shim.cjs +195 -11
  2. package/package.json +3 -3
  3. package/src/components/flex/index.test.ts +151 -0
  4. package/src/components/flex/index.ts +14 -0
  5. package/src/components/flex/transforms/auditSpreadProps.test.ts +93 -0
  6. package/src/components/flex/transforms/auditSpreadProps.ts +6 -0
  7. package/src/components/flex/transforms/axisToDirection.test.ts +15 -0
  8. package/src/components/flex/transforms/axisToDirection.ts +26 -0
  9. package/src/components/flex/transforms/convertStyleProps.test.ts +147 -0
  10. package/src/components/flex/transforms/convertStyleProps.ts +23 -0
  11. package/src/components/flex/transforms/cssFlexAliasesToProps.test.ts +202 -0
  12. package/src/components/flex/transforms/cssFlexAliasesToProps.ts +110 -0
  13. package/src/components/flex/transforms/flexPropToExpand.test.ts +156 -0
  14. package/src/components/flex/transforms/flexPropToExpand.ts +100 -0
  15. package/src/components/flex/transforms/mediaQueriesToResponsive.test.ts +714 -0
  16. package/src/components/flex/transforms/mediaQueriesToResponsive.ts +523 -0
  17. package/src/components/flex/transforms/paddingPropsToFlex.test.ts +252 -0
  18. package/src/components/flex/transforms/paddingPropsToFlex.ts +150 -0
  19. package/src/components/flex/transforms/setDefaultAxis.test.ts +12 -0
  20. package/src/components/flex/transforms/setDefaultAxis.ts +1 -0
  21. package/src/components/flex/transforms/unsupportedProps.test.ts +141 -0
  22. package/src/components/flex/transforms/unsupportedProps.ts +17 -0
  23. package/src/components/shared/helpers/unsupportedPropsHelpers.ts +41 -0
  24. package/src/components/shared/transformFactories/stylePropTransformFactory.test.ts +47 -0
  25. package/src/components/shared/transformFactories/stylePropTransformFactory.ts +16 -0
@@ -81,6 +81,19 @@ function extractPropValue(attr: JSXAttribute, j: JSCodeshift) {
81
81
  return expression.value
82
82
  } else if (expression.type === "NumericLiteral") {
83
83
  return expression.value
84
+ } else if (expression.type === "UnaryExpression") {
85
+ const unary = expression as unknown as {
86
+ argument?: { type?: string; value?: unknown }
87
+ operator: string
88
+ }
89
+ if (
90
+ unary.operator === "-" &&
91
+ unary.argument?.type === "NumericLiteral" &&
92
+ typeof unary.argument.value === "number"
93
+ ) {
94
+ return -unary.argument.value
95
+ }
96
+ return `{${j(expression).toSource()}}`
84
97
  } else if (expression.type === "BooleanLiteral") {
85
98
  return expression.value
86
99
  } else if (expression.type === "Identifier") {
@@ -363,6 +376,7 @@ export function stylePropTransformFactory(config: {
363
376
  styleProps: string[]
364
377
  }
365
378
  stylePropMapping?: StylePropMapping
379
+ stylesToExclude?: string[]
366
380
  stylesToKeep?: string[]
367
381
  stylesToRemove: string[]
368
382
  targetComponent: string
@@ -370,6 +384,7 @@ export function stylePropTransformFactory(config: {
370
384
  }): Transform {
371
385
  const {
372
386
  stylePropMapping = {} as StylePropMapping,
387
+ stylesToExclude = [],
373
388
  stylesToKeep = [],
374
389
  stylesToRemove,
375
390
  } = config
@@ -387,6 +402,7 @@ export function stylePropTransformFactory(config: {
387
402
  return (
388
403
  name &&
389
404
  name !== "css" &&
405
+ !stylesToExclude.includes(name) &&
390
406
  (stylePropNames.includes(name) ||
391
407
  name in stylePropMapping ||
392
408
  stylesToKeep.includes(name) ||