@workday/canvas-kit-codemod 15.0.0-alpha.1303-next.0 → 15.0.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 (173) hide show
  1. package/dist/es6/v11/renameHasErrorPreview.d.ts.map +1 -1
  2. package/dist/es6/v11/replaceStylesIconProp.d.ts.map +1 -1
  3. package/dist/es6/v11/utils/getImportRenameMap.d.ts.map +1 -1
  4. package/dist/es6/v12/index.js +1 -1
  5. package/dist/es6/v12/promoteFormField.d.ts.map +1 -1
  6. package/dist/es6/v12/renameFormFieldHorizontal.d.ts.map +1 -1
  7. package/dist/es6/v12/utils/getImportRenameMap.d.ts.map +1 -1
  8. package/dist/es6/v13/addPillLabel.d.ts.map +1 -1
  9. package/dist/es6/v13/addPillLabel.js +1 -1
  10. package/dist/es6/v13/index.d.ts.map +1 -1
  11. package/dist/es6/v13/index.js +1 -1
  12. package/dist/es6/v13/promoteExpandable.d.ts.map +1 -1
  13. package/dist/es6/v13/renameDubLogosImports.d.ts.map +1 -1
  14. package/dist/es6/v13/renameDubLogosReferences.d.ts.map +1 -1
  15. package/dist/es6/v13/utils/getImportRenameMap.d.ts.map +1 -1
  16. package/dist/es6/v13.2/index.d.ts.map +1 -1
  17. package/dist/es6/v13.2/mapping/index.d.ts +59 -1
  18. package/dist/es6/v13.2/mapping/index.d.ts.map +1 -1
  19. package/dist/es6/v13.2/mapping/index.js +88 -1
  20. package/dist/es6/v13.2/migrateColorTokens.d.ts.map +1 -1
  21. package/dist/es6/v13.2/migrateColorTokens.js +64 -13
  22. package/dist/es6/v13.2/migrateDepthTokens.d.ts.map +1 -1
  23. package/dist/es6/v13.2/migrateDepthTokens.js +42 -26
  24. package/dist/es6/v13.2/migrateOtherTokens.d.ts.map +1 -1
  25. package/dist/es6/v13.2/migrateOtherTokens.js +37 -67
  26. package/dist/es6/v13.2/migrateTypeTokens.d.ts.map +1 -1
  27. package/dist/es6/v13.2/migrateTypeTokens.js +44 -20
  28. package/dist/es6/v13.2/utils/filterOutImports.d.ts +6 -1
  29. package/dist/es6/v13.2/utils/filterOutImports.d.ts.map +1 -1
  30. package/dist/es6/v13.2/utils/filterOutImports.js +22 -4
  31. package/dist/es6/v13.2/utils/getImports.d.ts +3 -0
  32. package/dist/es6/v13.2/utils/getImports.d.ts.map +1 -0
  33. package/dist/es6/v13.2/utils/getImports.js +12 -0
  34. package/dist/es6/v13.2/utils/index.d.ts +1 -0
  35. package/dist/es6/v13.2/utils/index.d.ts.map +1 -1
  36. package/dist/es6/v13.2/utils/index.js +1 -0
  37. package/dist/es6/v13.2/utils/transformObjectPropertyRecursively.d.ts +1 -1
  38. package/dist/es6/v13.2/utils/transformObjectPropertyRecursively.d.ts.map +1 -1
  39. package/dist/es6/v13.2/utils/transformObjectPropertyRecursively.js +151 -33
  40. package/dist/es6/v13.2/utils/varToMemberExpression.d.ts.map +1 -1
  41. package/dist/es6/v13.2/utils/varToMemberExpression.js +1 -1
  42. package/dist/es6/v14/index.js +4 -4
  43. package/dist/es6/v14/renameErrorTypeAlert.d.ts.map +1 -1
  44. package/dist/es6/v14/renameErrorTypeAlertOnInputs.d.ts.map +1 -1
  45. package/dist/es6/v14/updateExpandableAvatarProp.d.ts.map +1 -1
  46. package/dist/es6/v14/updateExpandableAvatarProp.js +1 -1
  47. package/dist/es6/v14/updateFormFieldAlert.d.ts.map +1 -1
  48. package/dist/es6/v14/updatePillAvatarProp.d.ts.map +1 -1
  49. package/dist/es6/v14/updatePillAvatarProp.js +1 -1
  50. package/dist/es6/v14/updateStatusIndicatorPreview.d.ts.map +1 -1
  51. package/dist/es6/v14/utils/getImportRenameMap.d.ts.map +1 -1
  52. package/dist/es6/v14-tokens/index.d.ts.map +1 -1
  53. package/dist/es6/v14-tokens/index.js +9 -2
  54. package/dist/es6/v14-tokens/migrateColorTokens.d.ts.map +1 -1
  55. package/dist/es6/v14-tokens/migrateColorTokens.js +11 -24
  56. package/dist/es6/v14-tokens/utils/transformObjectPropertyRecursively.d.ts.map +1 -1
  57. package/dist/es6/v14-tokens/utils/transformObjectPropertyRecursively.js +31 -28
  58. package/dist/es6/v14.1/index.d.ts.map +1 -1
  59. package/dist/es6/v14.1/replaceDeprecatedStyleProps.d.ts.map +1 -1
  60. package/dist/es6/v14.1/replaceDeprecatedStyleProps.js +2 -2
  61. package/dist/es6/v14.1/utils/getImportRenameMap.d.ts.map +1 -1
  62. package/dist/es6/v14.1/utils/getToken.js +2 -2
  63. package/dist/es6/v15/index.d.ts +4 -0
  64. package/dist/es6/v15/index.d.ts.map +1 -0
  65. package/dist/es6/v15/index.js +25 -0
  66. package/dist/es6/v15/promoteAvatar.d.ts +4 -0
  67. package/dist/es6/v15/promoteAvatar.d.ts.map +1 -0
  68. package/dist/es6/v15/promoteAvatar.js +72 -0
  69. package/dist/es6/v15/promoteInformationHighlight.d.ts +4 -0
  70. package/dist/es6/v15/promoteInformationHighlight.d.ts.map +1 -0
  71. package/dist/es6/v15/promoteInformationHighlight.js +56 -0
  72. package/dist/es6/v15/promotePill.d.ts +4 -0
  73. package/dist/es6/v15/promotePill.d.ts.map +1 -0
  74. package/dist/es6/v15/promotePill.js +56 -0
  75. package/dist/es6/v15/promoteSegmentedControl.d.ts +4 -0
  76. package/dist/es6/v15/promoteSegmentedControl.d.ts.map +1 -0
  77. package/dist/es6/v15/promoteSegmentedControl.js +56 -0
  78. package/dist/es6/v15/promoteSidePanel.d.ts +4 -0
  79. package/dist/es6/v15/promoteSidePanel.d.ts.map +1 -0
  80. package/dist/es6/v15/promoteSidePanel.js +56 -0
  81. package/dist/es6/v15/removeStatusIndicatorAIVariant.d.ts +3 -0
  82. package/dist/es6/v15/removeStatusIndicatorAIVariant.d.ts.map +1 -0
  83. package/dist/es6/v15/removeStatusIndicatorAIVariant.js +44 -0
  84. package/dist/es6/v15/replaceFormFieldContainer.d.ts +3 -0
  85. package/dist/es6/v15/replaceFormFieldContainer.d.ts.map +1 -0
  86. package/dist/es6/v15/replaceFormFieldContainer.js +45 -0
  87. package/dist/es6/v15/updateCardVariant.d.ts +3 -0
  88. package/dist/es6/v15/updateCardVariant.d.ts.map +1 -0
  89. package/dist/es6/v15/updateCardVariant.js +41 -0
  90. package/dist/es6/v15/updateSwitchToPreview.d.ts +4 -0
  91. package/dist/es6/v15/updateSwitchToPreview.d.ts.map +1 -0
  92. package/dist/es6/v15/updateSwitchToPreview.js +56 -0
  93. package/dist/es6/v15/utils/getImportRenameMap.d.ts +7 -0
  94. package/dist/es6/v15/utils/getImportRenameMap.d.ts.map +1 -0
  95. package/dist/es6/v15/utils/getImportRenameMap.js +44 -0
  96. package/dist/es6/v15-icons/index.d.ts +4 -0
  97. package/dist/es6/v15-icons/index.d.ts.map +1 -0
  98. package/dist/es6/v15-icons/index.js +8 -0
  99. package/dist/es6/v15-icons/migrateAccentIcons.d.ts +3 -0
  100. package/dist/es6/v15-icons/migrateAccentIcons.d.ts.map +1 -0
  101. package/dist/es6/v15-icons/migrateAccentIcons.js +75 -0
  102. package/dist/es6/v15-icons/migrateAppletIcons.d.ts +3 -0
  103. package/dist/es6/v15-icons/migrateAppletIcons.d.ts.map +1 -0
  104. package/dist/es6/v15-icons/migrateAppletIcons.js +75 -0
  105. package/dist/es6/v15-icons/migrateExpressiveIcons.d.ts +3 -0
  106. package/dist/es6/v15-icons/migrateExpressiveIcons.d.ts.map +1 -0
  107. package/dist/es6/v15-icons/migrateExpressiveIcons.js +140 -0
  108. package/dist/es6/v15-icons/migrateSystemIcons.d.ts +3 -0
  109. package/dist/es6/v15-icons/migrateSystemIcons.d.ts.map +1 -0
  110. package/dist/es6/v15-icons/migrateSystemIcons.js +101 -0
  111. package/dist/es6/v15-icons/utils/getImportRenameMap.d.ts +7 -0
  112. package/dist/es6/v15-icons/utils/getImportRenameMap.d.ts.map +1 -0
  113. package/dist/es6/v15-icons/utils/getImportRenameMap.js +44 -0
  114. package/dist/es6/v15-icons/utils/migration.d.ts +14 -0
  115. package/dist/es6/v15-icons/utils/migration.d.ts.map +1 -0
  116. package/dist/es6/v15-icons/utils/migration.js +5997 -0
  117. package/dist/es6/v5/compoundCard.d.ts.map +1 -1
  118. package/dist/es6/v5/getImportRenameMap.d.ts.map +1 -1
  119. package/dist/es6/v5/index.d.ts.map +1 -1
  120. package/dist/es6/v5/index.js +11 -11
  121. package/dist/es6/v5/recategorizeButtons.d.ts.map +1 -1
  122. package/dist/es6/v5/removeButtonEnums.d.ts.map +1 -1
  123. package/dist/es6/v5/removeDefaultImports.d.ts.map +1 -1
  124. package/dist/es6/v5/renameButtonRefs.d.ts.map +1 -1
  125. package/dist/es6/v5/renameInputRefs.d.ts.map +1 -1
  126. package/dist/es6/v5/slashImports.d.ts.map +1 -1
  127. package/dist/es6/v6/deprecateCookieBanner.d.ts.map +1 -1
  128. package/dist/es6/v6/deprecateHeader.d.ts.map +1 -1
  129. package/dist/es6/v6/deprecatePageHeader.d.ts.map +1 -1
  130. package/dist/es6/v6/index.d.ts.map +1 -1
  131. package/dist/es6/v6/index.js +4 -4
  132. package/dist/es6/v6/moveAndRenameSearchBar.d.ts.map +1 -1
  133. package/dist/es6/v6/moveAndRenameSearchBar.js +1 -1
  134. package/dist/es6/v6/renameCanvasDepthValue.d.ts.map +1 -1
  135. package/dist/es6/v6/utils/index.d.ts +1 -1
  136. package/dist/es6/v6/utils/index.d.ts.map +1 -1
  137. package/dist/es6/v7/compoundActionBar.d.ts.map +1 -1
  138. package/dist/es6/v7/compoundActionBar.js +1 -1
  139. package/dist/es6/v7/compoundBanner.d.ts.map +1 -1
  140. package/dist/es6/v7/compoundBanner.js +4 -2
  141. package/dist/es6/v7/index.js +4 -4
  142. package/dist/es6/v7/recategorizeIconButtons.d.ts.map +1 -1
  143. package/dist/es6/v7/recategorizeIconButtons.js +1 -1
  144. package/dist/es6/v7/removePropFromPopper.d.ts.map +1 -1
  145. package/dist/es6/v7/removePropFromPopper.js +1 -1
  146. package/dist/es6/v7/renameIconPosition.d.ts.map +1 -1
  147. package/dist/es6/v7/renameIconRef.d.ts.map +1 -1
  148. package/dist/es6/v7/renameLayoutImports.d.ts.map +1 -1
  149. package/dist/es6/v7/updateDisclosureShowHide.d.ts.map +1 -1
  150. package/dist/es6/v7/updateModelSignatures.d.ts.map +1 -1
  151. package/dist/es6/v7/updateSegmentedControl.d.ts.map +1 -1
  152. package/dist/es6/v7/updateTabs.d.ts.map +1 -1
  153. package/dist/es6/v7/utils/getImportRenameMap.d.ts.map +1 -1
  154. package/dist/es6/v7/utils/hasImportSpecifiers.d.ts +1 -1
  155. package/dist/es6/v7/utils/hasImportSpecifiers.d.ts.map +1 -1
  156. package/dist/es6/v7/utils/hasImportSpecifiers.js +1 -4
  157. package/dist/es6/v8/index.js +6 -6
  158. package/dist/es6/v8/promoteBreadcrumbs.d.ts.map +1 -1
  159. package/dist/es6/v8/promoteComponentsToTesting.d.ts.map +1 -1
  160. package/dist/es6/v8/refactorActionBarOverflowButton.d.ts.map +1 -1
  161. package/dist/es6/v8/refactorActionBarOverflowButton.js +1 -1
  162. package/dist/es6/v8/removeDefaultImports.d.ts.map +1 -1
  163. package/dist/es6/v8/renameLoadingAnimation.d.ts.map +1 -1
  164. package/dist/es6/v8/renameLoadingAnimation.js +1 -1
  165. package/dist/es6/v8/restructureBreadcrumbs.d.ts.map +1 -1
  166. package/dist/es6/v8/restructureBreadcrumbs.js +1 -1
  167. package/dist/es6/v9/compoundToast.d.ts.map +1 -1
  168. package/dist/es6/v9/compoundToast.js +1 -1
  169. package/dist/es6/v9/index.js +1 -1
  170. package/dist/es6/v9/promoteToast.d.ts.map +1 -1
  171. package/dist/es6/v9/promoteUseThemedRing.d.ts.map +1 -1
  172. package/index.js +18 -0
  173. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"renameHasErrorPreview.d.ts","sourceRoot":"","sources":["../../../lib/v11/renameHasErrorPreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAmC,MAAM,aAAa,CAAC;AASrF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAwD7E"}
1
+ {"version":3,"file":"renameHasErrorPreview.d.ts","sourceRoot":"","sources":["../../../lib/v11/renameHasErrorPreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAoC,OAAO,EAAC,MAAM,aAAa,CAAC;AAWrF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAwD7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"replaceStylesIconProp.d.ts","sourceRoot":"","sources":["../../../lib/v11/replaceStylesIconProp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAmC,MAAM,aAAa,CAAC;AAOrF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UA4C7E"}
1
+ {"version":3,"file":"replaceStylesIconProp.d.ts","sourceRoot":"","sources":["../../../lib/v11/replaceStylesIconProp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAoC,OAAO,EAAC,MAAM,aAAa,CAAC;AAQrF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UA4C7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"getImportRenameMap.d.ts","sourceRoot":"","sources":["../../../../lib/v11/utils/getImportRenameMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAC;AAEpE,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,WAAW,EACd,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EACrB,WAAW,SAA8B,EACzC,WAAW,SAAK;;;;EA0DjB"}
1
+ {"version":3,"file":"getImportRenameMap.d.ts","sourceRoot":"","sources":["../../../../lib/v11/utils/getImportRenameMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAEpE,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,WAAW,EACd,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EACrB,WAAW,SAA8B,EACzC,WAAW,SAAK;;;;EA0DjB"}
@@ -1,5 +1,5 @@
1
- import renameFormFieldHorizontal from './renameFormFieldHorizontal';
2
1
  import promoteFormField from './promoteFormField';
2
+ import renameFormFieldHorizontal from './renameFormFieldHorizontal';
3
3
  const transform = (file, api, options) => {
4
4
  // These will run in order. If your transform depends on others, place yours after dependent transforms
5
5
  const fixes = [
@@ -1 +1 @@
1
- {"version":3,"file":"promoteFormField.d.ts","sourceRoot":"","sources":["../../../lib/v12/promoteFormField.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAA6B,MAAM,aAAa,CAAC;AAIlE,QAAA,MAAM,SAAS,EAAE,SAyEhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"promoteFormField.d.ts","sourceRoot":"","sources":["../../../lib/v12/promoteFormField.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAC,MAAM,aAAa,CAAC;AAIlE,QAAA,MAAM,SAAS,EAAE,SAyEhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"renameFormFieldHorizontal.d.ts","sourceRoot":"","sources":["../../../lib/v12/renameFormFieldHorizontal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAmC,MAAM,aAAa,CAAC;AAQrF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAyC7E"}
1
+ {"version":3,"file":"renameFormFieldHorizontal.d.ts","sourceRoot":"","sources":["../../../lib/v12/renameFormFieldHorizontal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAoC,OAAO,EAAC,MAAM,aAAa,CAAC;AASrF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAyC7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"getImportRenameMap.d.ts","sourceRoot":"","sources":["../../../../lib/v12/utils/getImportRenameMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAC;AAEpE,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,WAAW,EACd,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EACrB,WAAW,SAA8B,EACzC,WAAW,SAAK;;;;EAwDjB"}
1
+ {"version":3,"file":"getImportRenameMap.d.ts","sourceRoot":"","sources":["../../../../lib/v12/utils/getImportRenameMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAEpE,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,WAAW,EACd,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EACrB,WAAW,SAA8B,EACzC,WAAW,SAAK;;;;EAwDjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"addPillLabel.d.ts","sourceRoot":"","sources":["../../../lib/v13/addPillLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAA6B,OAAO,EAAC,MAAM,aAAa,CAAC;AAM9E,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UA4E7E"}
1
+ {"version":3,"file":"addPillLabel.d.ts","sourceRoot":"","sources":["../../../lib/v13/addPillLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAA6B,OAAO,EAAC,MAAM,aAAa,CAAC;AAO9E,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UA4E7E"}
@@ -1,5 +1,5 @@
1
- import { getImportRenameMap } from './utils/getImportRenameMap';
2
1
  import { hasImportSpecifiers } from '../v6/utils';
2
+ import { getImportRenameMap } from './utils/getImportRenameMap';
3
3
  const pillPackage = '@workday/canvas-kit-preview-react/pill';
4
4
  export default function transformer(file, api, options) {
5
5
  const j = api.jscodeshift;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v13/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAMtC,QAAA,MAAM,SAAS,EAAE,SAUhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v13/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAOtC,QAAA,MAAM,SAAS,EAAE,SAUhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import addPillLabel from './addPillLabel';
2
+ import promoteExpandable from './promoteExpandable';
2
3
  import renameDubLogosImports from './renameDubLogosImports';
3
4
  import renameDubLogosReferences from './renameDubLogosReferences';
4
- import promoteExpandable from './promoteExpandable';
5
5
  const transform = (file, api, options) => {
6
6
  // These will run in order. If your transform depends on others, place yours after dependent transforms
7
7
  const fixes = [
@@ -1 +1 @@
1
- {"version":3,"file":"promoteExpandable.d.ts","sourceRoot":"","sources":["../../../lib/v13/promoteExpandable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAA6B,MAAM,aAAa,CAAC;AAIlE,QAAA,MAAM,SAAS,EAAE,SAyEhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"promoteExpandable.d.ts","sourceRoot":"","sources":["../../../lib/v13/promoteExpandable.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAC,MAAM,aAAa,CAAC;AAIlE,QAAA,MAAM,SAAS,EAAE,SAyEhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"renameDubLogosImports.d.ts","sourceRoot":"","sources":["../../../lib/v13/renameDubLogosImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAOnD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAsC7E"}
1
+ {"version":3,"file":"renameDubLogosImports.d.ts","sourceRoot":"","sources":["../../../lib/v13/renameDubLogosImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAQnD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAsC7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"renameDubLogosReferences.d.ts","sourceRoot":"","sources":["../../../lib/v13/renameDubLogosReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAc,OAAO,EAAC,MAAM,aAAa,CAAC;AAQ/D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAyC7E"}
1
+ {"version":3,"file":"renameDubLogosReferences.d.ts","sourceRoot":"","sources":["../../../lib/v13/renameDubLogosReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAc,OAAO,EAAC,MAAM,aAAa,CAAC;AAS/D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAyC7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"getImportRenameMap.d.ts","sourceRoot":"","sources":["../../../../lib/v13/utils/getImportRenameMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAC;AAEpE,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,WAAW,EACd,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EACrB,WAAW,SAA8B,EACzC,WAAW,SAAK;;;;EAwDjB"}
1
+ {"version":3,"file":"getImportRenameMap.d.ts","sourceRoot":"","sources":["../../../../lib/v13/utils/getImportRenameMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAEpE,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,WAAW,EACd,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EACrB,WAAW,SAA8B,EACzC,WAAW,SAAK;;;;EAwDjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAMtC,QAAA,MAAM,SAAS,EAAE,SAGhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAOtC,QAAA,MAAM,SAAS,EAAE,SAGhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,8 +1,66 @@
1
+ export declare const paletteNames: string[];
1
2
  export declare const mapping: {
2
3
  readonly colors: {
3
4
  readonly type: "base";
4
5
  readonly name: "colors";
5
6
  };
7
+ readonly commonColors: {
8
+ readonly type: "system";
9
+ readonly name: "commonColors";
10
+ readonly keys: {
11
+ readonly background: "system.color.bg.default";
12
+ readonly backgroundAlt: "system.color.bg.alt.default";
13
+ readonly focusOutline: "system.color.border.primary.default";
14
+ readonly focusBackground: "system.color.bg.primary.default";
15
+ readonly hoverBackground: "system.color.bg.alt.strong";
16
+ readonly divider: "system.color.border.divider";
17
+ };
18
+ };
19
+ readonly inputColors: {
20
+ readonly type: "system";
21
+ readonly name: "inputColors";
22
+ readonly keys: {
23
+ readonly background: "system.color.bg.default";
24
+ readonly border: "system.color.border.input.default";
25
+ readonly placeholder: "system.color.fg.muted.default";
26
+ readonly text: "system.color.fg.default";
27
+ readonly icon: "system.color.fg.muted.soft";
28
+ readonly iconHover: "system.color.fg.muted.stronger";
29
+ readonly selectionControlFill: "system.color.bg.primary.default";
30
+ readonly hoverBorder: "system.color.border.input.strong";
31
+ readonly focusBorder: "system.color.border.primary.default";
32
+ readonly disabled: {
33
+ readonly background: "system.color.bg.alt.softer";
34
+ readonly border: "system.color.border.input.strong";
35
+ readonly text: "system.color.fg.disabled";
36
+ readonly icon: "system.color.fg.disabled";
37
+ };
38
+ readonly error: {
39
+ readonly border: "system.color.border.critical.default";
40
+ readonly message: "system.color.fg.critical.default";
41
+ readonly icon: "system.color.fg.critical.default";
42
+ };
43
+ readonly alert: {
44
+ readonly border: "system.color.border.caution.default";
45
+ readonly message: "system.color.fg.caution.default";
46
+ readonly icon: "system.color.fg.caution.default";
47
+ };
48
+ };
49
+ };
50
+ readonly typeColors: {
51
+ readonly type: "system";
52
+ readonly name: "typeColors";
53
+ readonly keys: {
54
+ readonly body: "system.color.fg.default";
55
+ readonly heading: "system.color.fg.strong";
56
+ readonly hint: "system.color.fg.muted.soft";
57
+ readonly inverse: "system.color.fg.inverse";
58
+ readonly label: "system.color.fg.default";
59
+ readonly link: "system.color.fg.primary.default";
60
+ readonly selectHighlight: "system.color.fg.primary.default";
61
+ readonly selectHighlightInverse: "system.color.fg.inverse";
62
+ };
63
+ };
6
64
  readonly borderRadius: {
7
65
  readonly name: "shape";
8
66
  readonly type: "system";
@@ -215,7 +273,7 @@ export declare const systemColors: {
215
273
  licorice400: string;
216
274
  licorice500: string;
217
275
  };
218
- 'border,borderColor,borderTopColor,borderRightColor,borderBottomColor,borderLeftColor,borderInline,borderInlineStart,borderInlineEnd,borderBlock,borderBlockStart,borderBlockEnd,borderInlineColor,borderBlockColor,borderInlineStartColor,borderInlineEndColor,borderBlockStartColor,borderBlockEndColor,borderColorFocus,borderColorHover,borderColorActive': {
276
+ 'border,borderColor,borderTop,borderTopColor,borderRight,borderRightColor,borderBottom,borderBottomColor,borderLeft,borderLeftColor,borderInlineColor,borderBlockColor,borderInline,borderInlineStart,borderInlineStartColor,borderInlineEnd,borderInlineEndColor,borderBlockStart,borderBlockStartColor,borderBlockEnd,borderBlockEndColor,borderColorFocus,borderColorHover,borderColorActive': {
219
277
  blackPepper400: string;
220
278
  blackPepper500: string;
221
279
  blueberry400: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/v13.2/mapping/index.ts"],"names":[],"mappings":"AAqFA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBV,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/v13.2/mapping/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UA6BxB,CAAC;AAqFF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFV,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DxB,CAAC"}
@@ -1,4 +1,34 @@
1
1
  import { generateLevelTokens } from '../utils/generateLevelTokens';
2
+ export const paletteNames = [
3
+ 'cinnamon',
4
+ 'peach',
5
+ 'chiliMango',
6
+ 'cantaloupe',
7
+ 'sourLemon',
8
+ 'juicyPear',
9
+ 'kiwi',
10
+ 'greenApple',
11
+ 'watermelon',
12
+ 'jewel',
13
+ 'toothpaste',
14
+ 'blueberry',
15
+ 'plum',
16
+ 'berrySmoothie',
17
+ 'blackberry',
18
+ 'islandPunch',
19
+ 'grapeSoda',
20
+ 'pomegranate',
21
+ 'fruitPunch',
22
+ 'rootBeer',
23
+ 'toastedMarshmallow',
24
+ 'licorice',
25
+ 'soap',
26
+ 'frenchVanilla',
27
+ 'blackPepper',
28
+ 'coconut',
29
+ 'cappuccino',
30
+ 'dragonFruit',
31
+ ];
2
32
  const typeLevelsMap = {
3
33
  subtext: {
4
34
  small: generateLevelTokens(['subtext', 'small']),
@@ -83,6 +113,63 @@ export const mapping = {
83
113
  type: 'base',
84
114
  name: 'colors',
85
115
  },
116
+ commonColors: {
117
+ type: 'system',
118
+ name: 'commonColors',
119
+ keys: {
120
+ background: 'system.color.bg.default',
121
+ backgroundAlt: 'system.color.bg.alt.default',
122
+ focusOutline: 'system.color.border.primary.default',
123
+ focusBackground: 'system.color.bg.primary.default',
124
+ hoverBackground: 'system.color.bg.alt.strong',
125
+ divider: 'system.color.border.divider',
126
+ },
127
+ },
128
+ inputColors: {
129
+ type: 'system',
130
+ name: 'inputColors',
131
+ keys: {
132
+ background: 'system.color.bg.default',
133
+ border: 'system.color.border.input.default',
134
+ placeholder: 'system.color.fg.muted.default',
135
+ text: 'system.color.fg.default',
136
+ icon: 'system.color.fg.muted.soft',
137
+ iconHover: 'system.color.fg.muted.stronger',
138
+ selectionControlFill: 'system.color.bg.primary.default',
139
+ hoverBorder: 'system.color.border.input.strong',
140
+ focusBorder: 'system.color.border.primary.default',
141
+ disabled: {
142
+ background: 'system.color.bg.alt.softer',
143
+ border: 'system.color.border.input.strong',
144
+ text: 'system.color.fg.disabled',
145
+ icon: 'system.color.fg.disabled',
146
+ },
147
+ error: {
148
+ border: 'system.color.border.critical.default',
149
+ message: 'system.color.fg.critical.default',
150
+ icon: 'system.color.fg.critical.default',
151
+ },
152
+ alert: {
153
+ border: 'system.color.border.caution.default',
154
+ message: 'system.color.fg.caution.default',
155
+ icon: 'system.color.fg.caution.default',
156
+ },
157
+ },
158
+ },
159
+ typeColors: {
160
+ type: 'system',
161
+ name: 'typeColors',
162
+ keys: {
163
+ body: 'system.color.fg.default',
164
+ heading: 'system.color.fg.strong',
165
+ hint: 'system.color.fg.muted.soft',
166
+ inverse: 'system.color.fg.inverse',
167
+ label: 'system.color.fg.default',
168
+ link: 'system.color.fg.primary.default',
169
+ selectHighlight: 'system.color.fg.primary.default',
170
+ selectHighlightInverse: 'system.color.fg.inverse',
171
+ },
172
+ },
86
173
  borderRadius: {
87
174
  name: 'shape',
88
175
  type: 'system',
@@ -148,7 +235,7 @@ export const systemColors = {
148
235
  licorice400: 'system.color.fg.muted.strong',
149
236
  licorice500: 'system.color.fg.muted.stronger',
150
237
  },
151
- 'border,borderColor,borderTopColor,borderRightColor,borderBottomColor,borderLeftColor,borderInline,borderInlineStart,borderInlineEnd,borderBlock,borderBlockStart,borderBlockEnd,borderInlineColor,borderBlockColor,borderInlineStartColor,borderInlineEndColor,borderBlockStartColor,borderBlockEndColor,borderColorFocus,borderColorHover,borderColorActive': {
238
+ 'border,borderColor,borderTop,borderTopColor,borderRight,borderRightColor,borderBottom,borderBottomColor,borderLeft,borderLeftColor,borderInlineColor,borderBlockColor,borderInline,borderInlineStart,borderInlineStartColor,borderInlineEnd,borderInlineEndColor,borderBlockStart,borderBlockStartColor,borderBlockEnd,borderBlockEndColor,borderColorFocus,borderColorHover,borderColorActive': {
152
239
  blackPepper400: 'system.color.border.contrast.default',
153
240
  blackPepper500: 'system.color.border.contrast.strong',
154
241
  blueberry400: 'system.color.border.primary.default',
@@ -1 +1 @@
1
- {"version":3,"file":"migrateColorTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateColorTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;AAQlD,QAAA,MAAM,SAAS,EAAE,SAuFhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"migrateColorTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateColorTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;AAmBlD,QAAA,MAAM,SAAS,EAAE,SAsKhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,6 +1,10 @@
1
- import { addMissingImports, filterOutImports, transformObjectPropertyRecursively } from './utils';
2
- import { mapping } from './mapping';
3
- const canvasImportSources = ['@workday/canvas-kit-styling', '@workday/canvas-kit-react/tokens'];
1
+ import { mapping, paletteNames } from './mapping';
2
+ import { addMissingImports, filterOutImports, getImports, transformObjectPropertyRecursively, varToMemberExpression, } from './utils';
3
+ const canvasImportSources = [
4
+ '@workday/canvas-kit-styling',
5
+ '@workday/canvas-kit-react/tokens',
6
+ '@workday/canvas-colors-web',
7
+ ];
4
8
  const transform = (file, api) => {
5
9
  const j = api.jscodeshift;
6
10
  const root = j(file.source);
@@ -11,7 +15,7 @@ const transform = (file, api) => {
11
15
  source: { value: (value) => canvasImportSources.includes(value) },
12
16
  })
13
17
  .forEach(nodePath => {
14
- importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
18
+ importDeclaration = { ...importDeclaration, ...getImports(nodePath) };
15
19
  });
16
20
  if (!Object.values(importDeclaration).includes('colors')) {
17
21
  return root.toSource();
@@ -26,7 +30,7 @@ const transform = (file, api) => {
26
30
  const name = nodePath.value.callee.name;
27
31
  const stylesDeclaration = nodePath.value.arguments[0];
28
32
  const isCanvasKitStyling = importDeclaration[name] === 'createStyles' || importDeclaration[name] === 'createStencil';
29
- if (stylesDeclaration.type === 'ObjectExpression') {
33
+ if ((stylesDeclaration === null || stylesDeclaration === void 0 ? void 0 : stylesDeclaration.type) === 'ObjectExpression') {
30
34
  stylesDeclaration.properties = stylesDeclaration.properties.map((prop) => transformObjectPropertyRecursively({ j, root }, prop, importDeclaration, isCanvasKitStyling));
31
35
  }
32
36
  });
@@ -35,21 +39,61 @@ const transform = (file, api) => {
35
39
  });
36
40
  root
37
41
  .find(j.MemberExpression, (value) => {
38
- return (value.type === 'MemberExpression' &&
39
- ((value.object.type === 'MemberExpression' &&
40
- value.object.object.type === 'MemberExpression' &&
41
- checkImport(value.object.object.object.name)) ||
42
- checkImport(value.object.name)));
42
+ // Matches: commonColors.background
43
+ const isTwoParts = value.type === 'MemberExpression' &&
44
+ value.object.type === 'Identifier' &&
45
+ checkImport(value.object.name);
46
+ // Matches: inputColors.disabled.border
47
+ const isThreeParts = value.type === 'MemberExpression' &&
48
+ value.object.type === 'MemberExpression' &&
49
+ value.object.object.type === 'Identifier' &&
50
+ checkImport(value.object.object.name);
51
+ return isTwoParts || isThreeParts;
43
52
  })
44
53
  .replaceWith(nodePath => {
54
+ var _a;
45
55
  const mainWrapper = nodePath.value.object;
46
- if (mainWrapper.type === 'Identifier' && importDeclaration[mainWrapper.name] !== 'type') {
56
+ if (mainWrapper.type === 'MemberExpression') {
57
+ const mainObject = mainWrapper.object;
58
+ const mainName = mainObject.type === 'Identifier' ? mainObject.name : '';
59
+ const mainProperty = mainWrapper.property;
60
+ const lowestProperty = nodePath.value.property;
61
+ const importedName = importDeclaration[mainName];
62
+ const map = mapping[importedName];
63
+ if ((map === null || map === void 0 ? void 0 : map.type) === 'system' &&
64
+ importedName &&
65
+ importedName.toLowerCase().includes('colors') &&
66
+ mainProperty.type === 'Identifier' &&
67
+ lowestProperty.type === 'Identifier') {
68
+ const innerGroup = map.keys[mainProperty.name] || {};
69
+ const token = innerGroup[lowestProperty.name];
70
+ if (token) {
71
+ addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['system'] });
72
+ addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
73
+ return j.callExpression(j.identifier('cssVar'), [varToMemberExpression(j, token)]);
74
+ }
75
+ }
76
+ }
77
+ if (mainWrapper.type === 'Identifier' &&
78
+ ((_a = importDeclaration[mainWrapper.name]) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('colors'))) {
47
79
  const mainObject = mainWrapper;
48
80
  const mainName = mainObject.name;
49
81
  const lowestProperty = nodePath.value.property;
50
82
  const importedName = importDeclaration[mainName];
51
83
  const map = mapping[importedName];
52
- if (map.type === 'base' && lowestProperty.type === 'Identifier') {
84
+ if ((map === null || map === void 0 ? void 0 : map.type) === 'system' &&
85
+ lowestProperty.type === 'Identifier' &&
86
+ importedName !== 'inputColors') {
87
+ const token = map.keys[lowestProperty.name];
88
+ if (token && typeof token === 'string') {
89
+ addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['system'] });
90
+ addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
91
+ return j.callExpression(j.identifier('cssVar'), [varToMemberExpression(j, token)]);
92
+ }
93
+ }
94
+ if ((map === null || map === void 0 ? void 0 : map.type) === 'base' &&
95
+ lowestProperty.type === 'Identifier' &&
96
+ paletteNames.some(name => lowestProperty.name.includes(name))) {
53
97
  addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['base'] });
54
98
  addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
55
99
  return j.callExpression(j.identifier('cssVar'), [
@@ -57,7 +101,14 @@ const transform = (file, api) => {
57
101
  ]);
58
102
  }
59
103
  }
60
- return nodePath;
104
+ return nodePath.value;
105
+ });
106
+ root
107
+ .find(j.ImportDeclaration, {
108
+ source: { value: (value) => canvasImportSources.includes(value) },
109
+ })
110
+ .forEach(nodePath => {
111
+ filterOutImports({ root, j }, nodePath, 'colors');
61
112
  });
62
113
  return root.toSource();
63
114
  };
@@ -1 +1 @@
1
- {"version":3,"file":"migrateDepthTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateDepthTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAOtC,QAAA,MAAM,SAAS,EAAE,SAoKhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"migrateDepthTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateDepthTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AActC,QAAA,MAAM,SAAS,EAAE,SAqLhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,5 +1,10 @@
1
- import { addMissingImports, filterOutImports } from './utils';
2
- const canvasImportSources = ['@workday/canvas-kit-styling', '@workday/canvas-kit-react/tokens'];
1
+ import { addMissingImports, filterOutImports, getImports } from './utils';
2
+ const canvasImportSources = [
3
+ '@workday/canvas-kit-styling',
4
+ '@workday/canvas-kit-react/tokens',
5
+ '@workday/canvas-depth-web',
6
+ ];
7
+ const depthValues = ['0', '1', '2', '3', '4', '5', '6'];
3
8
  const transform = (file, api) => {
4
9
  const j = api.jscodeshift;
5
10
  const root = j(file.source);
@@ -10,7 +15,7 @@ const transform = (file, api) => {
10
15
  source: { value: (value) => canvasImportSources.includes(value) },
11
16
  })
12
17
  .forEach(nodePath => {
13
- importDeclaration = { ...importDeclaration, ...filterOutImports(nodePath) };
18
+ importDeclaration = { ...importDeclaration, ...getImports(nodePath) };
14
19
  });
15
20
  if (!Object.values(importDeclaration).includes('depth')) {
16
21
  return root.toSource();
@@ -21,28 +26,31 @@ const transform = (file, api) => {
21
26
  type: 'MemberExpression',
22
27
  object: {
23
28
  type: 'Identifier',
24
- name: 'depth',
29
+ name: (name) => importDeclaration[name] === 'depth',
25
30
  },
26
31
  property: {
27
- type: 'NumericLiteral',
32
+ type: (type) => type === 'NumericLiteral' || type === 'StringLiteral',
33
+ value: (value) => ['0', '1', '2', '3', '4', '5', '6'].includes(`${value}`),
28
34
  },
29
35
  },
30
36
  })
31
37
  .replaceWith(nodePath => {
32
38
  const argument = nodePath.value.argument;
33
- if (argument.type === 'MemberExpression' && argument.property.type === 'NumericLiteral') {
39
+ if (argument.type === 'MemberExpression' &&
40
+ (argument.property.type === 'NumericLiteral' || argument.property.type === 'StringLiteral')) {
34
41
  const depthValue = argument.property.value;
42
+ const isDepthNotZero = `${depthValue}` !== '0';
35
43
  addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['system'] });
36
- if (depthValue > 0) {
44
+ if (isDepthNotZero) {
37
45
  addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
38
46
  }
39
- return depthValue > 0
40
- ? j.objectProperty(j.identifier('boxShadow'), j.callExpression(j.identifier('cssVar'), [
41
- j.memberExpression(j.memberExpression(j.identifier('system'), j.identifier('depth')), j.numericLiteral(depthValue), true),
42
- ]))
43
- : j.objectProperty(j.identifier('boxShadow'), j.literal('none'));
47
+ return j.objectProperty(j.identifier('boxShadow'), isDepthNotZero
48
+ ? j.callExpression(j.identifier('cssVar'), [
49
+ j.memberExpression(j.memberExpression(j.identifier('system'), j.identifier('depth')), j.numericLiteral(parseInt(`${depthValue}`, 10)), true),
50
+ ])
51
+ : j.literal('none'));
44
52
  }
45
- return nodePath;
53
+ return nodePath.value;
46
54
  });
47
55
  root
48
56
  .find(j.MemberExpression, (value) => {
@@ -53,19 +61,22 @@ const transform = (file, api) => {
53
61
  .replaceWith(nodePath => {
54
62
  if (nodePath.value.object.type === 'MemberExpression' &&
55
63
  nodePath.value.object.object.type === 'Identifier' &&
56
- nodePath.value.object.property.type === 'NumericLiteral') {
64
+ (nodePath.value.object.property.type === 'NumericLiteral' ||
65
+ (nodePath.value.object.property.type === 'StringLiteral' &&
66
+ depthValues.includes(nodePath.value.object.property.value)))) {
57
67
  const value = nodePath.value.object.property.value;
58
- if (value.toString() !== '0') {
68
+ const isNotZero = `${value}` !== '0';
69
+ if (isNotZero) {
59
70
  addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
60
71
  addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['system'] });
61
72
  }
62
- return value.toString() === '0'
73
+ return !isNotZero
63
74
  ? j.literal('none')
64
75
  : j.callExpression(j.identifier('cssVar'), [
65
- j.memberExpression(j.memberExpression(j.identifier('system'), j.identifier('depth')), j.numericLiteral(value), true),
76
+ j.memberExpression(j.memberExpression(j.identifier('system'), j.identifier('depth')), j.numericLiteral(parseInt(`${value}`, 10)), true),
66
77
  ]);
67
78
  }
68
- return nodePath;
79
+ return nodePath.value;
69
80
  });
70
81
  root
71
82
  .find(j.MemberExpression, (value) => {
@@ -77,13 +88,11 @@ const transform = (file, api) => {
77
88
  })
78
89
  .replaceWith(nodePath => {
79
90
  const mainWrapper = nodePath.value.object;
80
- if (mainWrapper.type === 'Identifier' && importDeclaration[mainWrapper.name] !== 'type') {
81
- const mainObject = mainWrapper;
82
- const mainName = mainObject.name;
91
+ if (mainWrapper.type === 'Identifier' && importDeclaration[mainWrapper.name] === 'depth') {
83
92
  const lowestProperty = nodePath.value.property;
84
- const importedName = importDeclaration[mainName];
85
- if (importedName === 'depth' && lowestProperty.type === 'NumericLiteral') {
86
- const isZero = lowestProperty.value.toString() === '0';
93
+ if (lowestProperty.type === 'NumericLiteral' ||
94
+ (lowestProperty.type === 'StringLiteral' && depthValues.includes(lowestProperty.value))) {
95
+ const isZero = `${lowestProperty.value}` === '0';
87
96
  if (!isZero) {
88
97
  addMissingImports({ j, root }, { importPath: '@workday/canvas-kit-styling', specifiers: ['cssVar'] });
89
98
  addMissingImports({ j, root }, { importPath: '@workday/canvas-tokens-web', specifiers: ['system'] });
@@ -92,12 +101,19 @@ const transform = (file, api) => {
92
101
  j.property('init', j.identifier('boxShadow'), isZero
93
102
  ? j.literal('none')
94
103
  : j.callExpression(j.identifier('cssVar'), [
95
- j.memberExpression(j.memberExpression(j.identifier('system'), j.identifier('depth')), j.numericLiteral(lowestProperty.value), true),
104
+ j.memberExpression(j.memberExpression(j.identifier('system'), j.identifier('depth')), j.numericLiteral(parseInt(`${lowestProperty.value}`, 10)), true),
96
105
  ])),
97
106
  ]);
98
107
  }
99
108
  }
100
- return nodePath;
109
+ return nodePath.value;
110
+ });
111
+ root
112
+ .find(j.ImportDeclaration, {
113
+ source: { value: (value) => canvasImportSources.includes(value) },
114
+ })
115
+ .forEach(nodePath => {
116
+ filterOutImports({ root, j }, nodePath, 'depth');
101
117
  });
102
118
  return root.toSource();
103
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"migrateOtherTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateOtherTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAC,MAAM,aAAa,CAAC;AAQpE,QAAA,MAAM,SAAS,EAAE,SA4KhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"migrateOtherTokens.d.ts","sourceRoot":"","sources":["../../../lib/v13.2/migrateOtherTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAC,MAAM,aAAa,CAAC;AAoBlD,QAAA,MAAM,SAAS,EAAE,SAgHhB,CAAC;AAEF,eAAe,SAAS,CAAC"}