@planningcenter/tapestry-migration-cli 2.4.0-rc.0 → 2.4.0-rc.10

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 (26) hide show
  1. package/package.json +2 -2
  2. package/src/components/button/transforms/childrenToLabel.test.ts +5 -4
  3. package/src/components/button/transforms/childrenToLabel.ts +9 -39
  4. package/src/components/button/transforms/unsupportedProps.ts +7 -31
  5. package/src/components/link/index.ts +14 -2
  6. package/src/components/link/transforms/childrenToLabel.test.ts +331 -0
  7. package/src/components/link/transforms/childrenToLabel.ts +54 -0
  8. package/src/components/link/transforms/convertStyleProps.test.ts +391 -0
  9. package/src/components/link/transforms/convertStyleProps.ts +10 -0
  10. package/src/components/link/transforms/{inlineToKind.test.ts → inlineMemberToKind.test.ts} +2 -2
  11. package/src/components/link/transforms/{inlineToKind.ts → inlineMemberToKind.ts} +0 -2
  12. package/src/components/link/transforms/inlinePropToKind.test.ts +312 -0
  13. package/src/components/link/transforms/inlinePropToKind.ts +24 -0
  14. package/src/components/link/transforms/removeAs.test.ts +192 -0
  15. package/src/components/link/transforms/removeAs.ts +17 -0
  16. package/src/components/link/transforms/reviewStyles.test.ts +172 -0
  17. package/src/components/link/transforms/reviewStyles.ts +17 -0
  18. package/src/components/link/transforms/targetBlankToExternal.test.ts +14 -0
  19. package/src/components/link/transforms/unsupportedProps.test.ts +265 -0
  20. package/src/components/link/transforms/unsupportedProps.ts +58 -0
  21. package/src/components/shared/conditions/hasAttributeValue.test.ts +22 -1
  22. package/src/components/shared/conditions/hasAttributeValue.ts +24 -6
  23. package/src/components/shared/helpers/childrenToLabelHelpers.ts +43 -0
  24. package/src/components/shared/helpers/unsupportedPropsHelpers.ts +35 -0
  25. package/src/components/shared/transformFactories/stylePropTransformFactory.ts +5 -1
  26. package/src/stubs/textPlugin.ts +45 -0
@@ -251,6 +251,7 @@ export function stylePropTransformFactory(config: {
251
251
  const name = attr.name?.name as string
252
252
  return (
253
253
  name &&
254
+ name !== "css" &&
254
255
  (stylePropNames.includes(name) ||
255
256
  name in stylePropMapping ||
256
257
  stylesToKeep.includes(name) ||
@@ -319,7 +320,10 @@ export function stylePropTransformFactory(config: {
319
320
  styles = { ...styles, ...directStyleProps }
320
321
  if (options.verbose) console.log("Final generated styles:", styles)
321
322
 
322
- applyStylesToComponent({ element, j, styles })
323
+ // Only apply styles if there are actual CSS properties to add
324
+ if (Object.keys(styles).length > 0) {
325
+ applyStylesToComponent({ element, j, styles })
326
+ }
323
327
  } catch (error) {
324
328
  console.log("Error processing style props:", error)
325
329
  console.log("Style props that caused error:", allStyleProps)
@@ -0,0 +1,45 @@
1
+ // copied from packages/tapestry-react/src/Text/Text.tsx in tapestry-react
2
+ // size prop is not included since it is a supported prop in tapestry link
3
+
4
+ export const textPlugin = {
5
+ getStyles({
6
+ align,
7
+ italic,
8
+ truncate,
9
+ underline,
10
+ weight,
11
+ wrap = true,
12
+ ...styles
13
+ }: Record<string, unknown>) {
14
+ if (align) {
15
+ styles.textAlign = align
16
+ }
17
+
18
+ if (italic) {
19
+ styles.fontStyle = "italic"
20
+ }
21
+
22
+ if (truncate) {
23
+ if (styles.display !== "block" && styles.display !== "flex") {
24
+ styles.display = "block"
25
+ }
26
+ styles.overflow = "hidden"
27
+ styles.textOverflow = "ellipsis"
28
+ }
29
+
30
+ if (truncate || wrap === false) {
31
+ styles.whiteSpace = "nowrap"
32
+ }
33
+
34
+ if (underline) {
35
+ styles.textDecoration = underline
36
+ }
37
+
38
+ if (weight) {
39
+ styles.fontWeight = weight
40
+ }
41
+
42
+ return styles
43
+ },
44
+ styleProps: ["align", "italic", "truncate", "underline", "weight", "wrap"],
45
+ }