@ornikar/kitt-universal 29.4.1-canary.ee3a5de11ca14467578621a40a921148838ee329.0 → 29.4.2-canary.0e4f130cb45a177a7fdd9a15817918e986eb8cd4.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 (42) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/dist/definitions/BaseMessage/BaseMessage.d.ts +1 -1
  3. package/dist/definitions/BaseMessage/BaseMessage.d.ts.map +1 -1
  4. package/dist/definitions/CardModal/CardModalAnimation/CardModalAnimation.web.d.ts +1 -1
  5. package/dist/definitions/CardModal/CardModalAnimation/CardModalAnimation.web.d.ts.map +1 -1
  6. package/dist/definitions/CardModal/CardModalAnimation/CardModalRotationContainer.d.ts +2 -2
  7. package/dist/definitions/CardModal/CardModalAnimation/CardModalRotationContainer.d.ts.map +1 -1
  8. package/dist/definitions/DialogModal/DialogModalAnimation/DialogModalAnimation.web.d.ts +1 -1
  9. package/dist/definitions/DialogModal/DialogModalAnimation/DialogModalAnimation.web.d.ts.map +1 -1
  10. package/dist/definitions/FullscreenModal/FullscreenModalAnimation.web.d.ts +1 -1
  11. package/dist/definitions/FullscreenModal/FullscreenModalAnimation.web.d.ts.map +1 -1
  12. package/dist/definitions/Notification/Notification.d.ts +2 -2
  13. package/dist/definitions/Notification/Notification.d.ts.map +1 -1
  14. package/dist/definitions/Overlay/Overlay.d.ts +2 -2
  15. package/dist/definitions/Overlay/Overlay.d.ts.map +1 -1
  16. package/dist/definitions/Picker/Picker.web.d.ts.map +1 -1
  17. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +2 -0
  18. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  19. package/dist/definitions/typography/Typography.d.ts +1 -0
  20. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  21. package/dist/index-metro.es.android.js +52 -29
  22. package/dist/index-metro.es.android.js.map +1 -1
  23. package/dist/index-metro.es.ios.js +52 -29
  24. package/dist/index-metro.es.ios.js.map +1 -1
  25. package/dist/index-node-22.17.cjs.js +45 -23
  26. package/dist/index-node-22.17.cjs.js.map +1 -1
  27. package/dist/index-node-22.17.cjs.web.js +77 -24
  28. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  29. package/dist/index-node-22.17.es.mjs +45 -23
  30. package/dist/index-node-22.17.es.mjs.map +1 -1
  31. package/dist/index-node-22.17.es.web.mjs +77 -24
  32. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  33. package/dist/index.es.js +44 -21
  34. package/dist/index.es.js.map +1 -1
  35. package/dist/index.es.web.js +76 -22
  36. package/dist/index.es.web.js.map +1 -1
  37. package/dist/tsbuildinfo +1 -1
  38. package/package.json +1 -1
  39. package/scripts/codemods/__testfixtures__/illustration-imports/illustration-imports.input.tsx +11 -0
  40. package/scripts/codemods/__testfixtures__/illustration-imports/illustration-imports.output.tsx +13 -0
  41. package/scripts/codemods/__tests__/illustration-imports.test.js +12 -0
  42. package/scripts/codemods/illustration-imports.js +184 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/kitt-universal",
3
- "version": "29.4.1-canary.ee3a5de11ca14467578621a40a921148838ee329.0",
3
+ "version": "29.4.2-canary.0e4f130cb45a177a7fdd9a15817918e986eb8cd4.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "directory": "@ornikar/kitt-universal",
@@ -0,0 +1,11 @@
1
+ import { Illustration, MeetingPoint } from '@ornikar/illustration-images';
2
+
3
+ export function Component() {
4
+ return (
5
+ <Illustration
6
+ image={<MeetingPoint />}
7
+ width="app.shop.page.discoverIntructorsActionCard.illustration.size"
8
+ height="app.shop.page.discoverIntructorsActionCard.illustration.size"
9
+ />
10
+ );
11
+ }
@@ -0,0 +1,13 @@
1
+ import { Illustration } from '@ornikar/illustration-images';
2
+
3
+ import MeetingPointIllustration from '@ornikar/illustration-images/assets/meeting-point.png';
4
+
5
+ export function Component() {
6
+ return (
7
+ <Illustration
8
+ source={MeetingPointIllustration}
9
+ width="app.shop.page.discoverIntructorsActionCard.illustration.size"
10
+ height="app.shop.page.discoverIntructorsActionCard.illustration.size"
11
+ />
12
+ );
13
+ }
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ jest.autoMockOff();
4
+ const { defineTest } = require('jscodeshift/dist/testUtils');
5
+
6
+ const tests = ['illustration-imports'];
7
+
8
+ describe('IllustrationImports', () => {
9
+ tests.forEach((test) =>
10
+ defineTest(__dirname, 'illustration-imports', null, `illustration-imports/${test}`, { parser: 'tsx' }),
11
+ );
12
+ });
@@ -0,0 +1,184 @@
1
+ // Codemod to migrate all illustration component imports to direct PNG asset imports and update JSX usage
2
+ 'use strict';
3
+
4
+ const jscodeshift = require('jscodeshift');
5
+ const prettier = require('prettier');
6
+
7
+ // List of all illustration names and their asset filenames
8
+ const illustrations = [
9
+ 'AppCode',
10
+ 'Calendar',
11
+ 'CalendarError',
12
+ 'CalendarSuccess',
13
+ 'CalendarWarning',
14
+ 'CarBackFoundations',
15
+ 'CarBackSchoolOrnikar',
16
+ 'CarSchool',
17
+ 'CarSchoolOrnikar',
18
+ 'CardCpf',
19
+ 'ChatDots',
20
+ 'ChatQuestion',
21
+ 'Earth',
22
+ 'ErrorImage',
23
+ 'Error404',
24
+ 'Fingerprint',
25
+ 'FingerprintDanger',
26
+ 'FingerprintSuccess',
27
+ 'FingerprintWarning',
28
+ 'Fire',
29
+ 'Flags',
30
+ 'Gaz',
31
+ 'InsuranceCar',
32
+ 'KeyCar',
33
+ 'KeyCarAac',
34
+ 'KeyCarApprentice',
35
+ 'LicenceCard',
36
+ 'LicenceCardSuccess',
37
+ 'LicenceDanger',
38
+ 'LicenceWarning',
39
+ 'Lightbulb',
40
+ 'Lock',
41
+ 'MeetingPoint',
42
+ 'MobileAppOrnikar',
43
+ 'MobileLive',
44
+ 'MobilePromo',
45
+ 'NumberPlate',
46
+ 'PaperDanger',
47
+ 'PaperInformation',
48
+ 'PaperSuccess',
49
+ 'PaperWarning',
50
+ 'PedestrianLight',
51
+ 'PiggyBank',
52
+ 'RCode',
53
+ 'RConduite',
54
+ 'Road',
55
+ 'RoadAbove',
56
+ 'RoadHorizon',
57
+ 'RoadSign',
58
+ 'SatisfiedOrRefilled',
59
+ 'SeatBelt',
60
+ 'Shield',
61
+ 'SignArrow',
62
+ 'SirenDanger',
63
+ 'SirenNotification',
64
+ 'SteeringWheelGreen',
65
+ 'SteeringWheelRed',
66
+ 'SteeringWheelWarning',
67
+ 'TokenAac',
68
+ 'TokenApprentice',
69
+ 'TokenCheckSuccess',
70
+ 'TokenCheckWarning',
71
+ 'TokenDanger',
72
+ 'TokenPause',
73
+ 'TokenPromo',
74
+ 'TokenQuestion',
75
+ 'TokenRedCross',
76
+ 'TokenWarning',
77
+ 'Trophy',
78
+ 'UserFrame',
79
+ 'UserInvitation',
80
+ 'UserPicture',
81
+ 'UserStars',
82
+ 'UserSupports',
83
+ 'WorkInProgress',
84
+ 'Wrench',
85
+ 'Zoom',
86
+ ];
87
+
88
+ function toAssetFilename(name) {
89
+ // Convert PascalCase to kebab-case and special cases
90
+ return (
91
+ name
92
+ .replace(/([a-z])([A-Z])/g, '$1-$2')
93
+ .replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
94
+ .toLowerCase() + '.png'
95
+ );
96
+ }
97
+
98
+ module.exports = async function transformer(fileInfo, api) {
99
+ const j = api.jscodeshift || jscodeshift;
100
+ const root = j(fileInfo.source);
101
+
102
+ // ----------- Start of transformer logic
103
+ // Find import { Illustration, ... } from '@ornikar/illustration-images';
104
+ const illustrationImport = root.find(j.ImportDeclaration, {
105
+ source: { value: '@ornikar/illustration-images' },
106
+ });
107
+
108
+ let importedIllustrations = [];
109
+
110
+ illustrationImport.forEach((path) => {
111
+ const specifiers = path.node.specifiers;
112
+ for (let i = specifiers.length - 1; i >= 0; i--) {
113
+ const s = specifiers[i];
114
+ if (s.type === 'ImportSpecifier' && illustrations.includes(s.imported.name)) {
115
+ importedIllustrations.push(s.imported.name);
116
+ // Remove from import
117
+ specifiers.splice(i, 1);
118
+ }
119
+ }
120
+ });
121
+
122
+ // Add asset imports for each illustration
123
+ if (importedIllustrations.length > 0) {
124
+ const newImports = importedIllustrations.map((name) =>
125
+ j.importDeclaration(
126
+ [j.importDefaultSpecifier(j.identifier(name + 'Illustration'))],
127
+ j.literal(`@ornikar/illustration-images/assets/${toAssetFilename(name)}`),
128
+ ),
129
+ );
130
+ let illustrationImportPath = null;
131
+ illustrationImport.forEach((path) => {
132
+ illustrationImportPath = path;
133
+ if (path.node.specifiers.length === 0) {
134
+ j(path).remove();
135
+ illustrationImportPath = null;
136
+ }
137
+ });
138
+ if (illustrationImportPath) {
139
+ j(illustrationImportPath).insertAfter(newImports);
140
+ } else {
141
+ // Insert asset imports at the top
142
+ const firstImport = root.find(j.ImportDeclaration).at(0);
143
+ if (firstImport.size() > 0) {
144
+ firstImport.insertBefore(newImports);
145
+ } else {
146
+ root.get().node.program.body.unshift(...newImports);
147
+ }
148
+ }
149
+ }
150
+
151
+ // Replace JSX <Illustration image={<Name />} ... /> with <Illustration source={NameIllustration} ... />
152
+ root
153
+ .find(j.JSXElement, {
154
+ openingElement: { name: { name: 'Illustration' } },
155
+ })
156
+ .forEach((path) => {
157
+ const attrs = path.node.openingElement.attributes;
158
+ for (let i = 0; i < attrs.length; i++) {
159
+ const attr = attrs[i];
160
+ if (
161
+ attr.type === 'JSXAttribute' &&
162
+ attr.name.name === 'image' &&
163
+ attr.value &&
164
+ attr.value.type === 'JSXExpressionContainer' &&
165
+ attr.value.expression.type === 'JSXElement' &&
166
+ illustrations.includes(attr.value.expression.openingElement.name.name)
167
+ ) {
168
+ const name = attr.value.expression.openingElement.name.name;
169
+ attrs[i] = j.jsxAttribute(
170
+ j.jsxIdentifier('source'),
171
+ j.jsxExpressionContainer(j.identifier(name + 'Illustration')),
172
+ );
173
+ }
174
+ }
175
+ });
176
+ // ----------- End of transformer logic
177
+
178
+ const output = root.toSource({ quote: 'single' });
179
+ const prettierConfig = await prettier.resolveConfig(fileInfo.path);
180
+ return prettier.format(output, {
181
+ ...prettierConfig,
182
+ filepath: fileInfo.path,
183
+ });
184
+ };