@progress/kendo-angular-conversational-ui 21.0.0-develop.16 → 21.0.0-develop.17

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.
package/codemods/utils.js CHANGED
@@ -7,9 +7,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.tsComponentPropertyRemoval = exports.templateAttributeRemoval = exports.htmlAttributeRemoval = exports.htmlAttributeValueTransformer = exports.tsPropertyValueTransformer = exports.templateAttributeValueTransformer = exports.htmlAttributeTransformer = exports.htmlBoundAttributeTransformer = exports.htmlStaticAttributeTransformer = exports.tsPropertyTransformer = exports.templateAttributeTransformer = exports.templateBoundAttributeTransformer = exports.templateStaticAttributeTransformer = void 0;
10
+ exports.tsInterfaceTransformer = exports.tsComponentPropertyRemoval = exports.templateAttributeRemoval = exports.htmlAttributeRemoval = exports.htmlAttributeValueTransformer = exports.tsPropertyValueTransformer = exports.templateAttributeValueTransformer = exports.htmlEventTransformer = exports.htmlAttributeTransformer = exports.htmlBoundAttributeTransformer = exports.htmlStaticAttributeTransformer = exports.tsPropertyTransformer = exports.templateAttributeTransformer = exports.templateBoundAttributeTransformer = exports.templateStaticAttributeTransformer = exports.templateEventTransformer = exports.blockTextElements = void 0;
11
+ exports.hasKendoInTemplate = hasKendoInTemplate;
11
12
  exports.tsPropertyRemoval = tsPropertyRemoval;
12
13
  const node_html_parser_1 = __importDefault(require("node-html-parser"));
14
+ exports.blockTextElements = {
15
+ script: true,
16
+ noscript: true,
17
+ style: true,
18
+ pre: true,
19
+ };
20
+ function hasKendoInTemplate(source) {
21
+ const kendoPattern = /(<kendo-[^>\s]+|<[^>]*\s+kendo[A-Z][^>\s]*)/g;
22
+ return kendoPattern.test(source);
23
+ }
24
+ const templateEventTransformer = (root, tagName, eventName, newEventName) => {
25
+ const elements = Array.from(root.getElementsByTagName(tagName)) || [];
26
+ for (const element of elements) {
27
+ // Handle event bindings like (actionClick)="handler($event)"
28
+ const eventAttr = element.getAttribute(`(${eventName})`);
29
+ if (eventAttr) {
30
+ element.setAttribute(`(${newEventName})`, eventAttr);
31
+ element.removeAttribute(`(${eventName})`);
32
+ }
33
+ }
34
+ };
35
+ exports.templateEventTransformer = templateEventTransformer;
13
36
  const templateStaticAttributeTransformer = (root, tagName, attributeName, newAttributeName) => {
14
37
  const elements = Array.from(root.getElementsByTagName(tagName)) || [];
15
38
  for (const element of elements) {
@@ -40,150 +63,141 @@ const templateAttributeTransformer = (root, tagName, attributeName, newAttribute
40
63
  (0, exports.templateStaticAttributeTransformer)(root, tagName, attributeName, newAttributeName);
41
64
  };
42
65
  exports.templateAttributeTransformer = templateAttributeTransformer;
43
- const tsPropertyTransformer = (root, j, componentType, propertyName, newPropertyName, valueProperty) => {
44
- // Find all class properties that are of type DropDownListComponent
45
- const properties = new Set();
46
- // Find properties with type annotations
47
- root
48
- .find(j.ClassProperty, {
49
- typeAnnotation: {
66
+ const tsPropertyTransformer = (source, root, j, componentType, propertyName, newPropertyName, valueProperty) => {
67
+ if (source.includes(componentType)) {
68
+ // Find all class properties that are of type DropDownListComponent
69
+ const properties = new Set();
70
+ // Find properties with type annotations
71
+ root.find(j.ClassProperty, {
50
72
  typeAnnotation: {
51
- typeName: {
52
- name: componentType
53
- }
73
+ typeAnnotation: {
74
+ typeName: {
75
+ name: componentType,
76
+ },
77
+ },
78
+ },
79
+ }).forEach((path) => {
80
+ if (path.node.key.type === 'Identifier') {
81
+ properties.add(path.node.key.name);
54
82
  }
55
- }
56
- })
57
- .forEach(path => {
58
- if (path.node.key.type === 'Identifier') {
59
- properties.add(path.node.key.name);
60
- }
61
- });
62
- // Find function parameters of type componentType
63
- const parameters = new Set();
64
- root
65
- .find(j.FunctionDeclaration)
66
- .forEach(path => {
67
- if (path.node.params) {
68
- path.node.params.forEach(param => {
69
- if (param.type === 'Identifier' &&
70
- param.typeAnnotation &&
71
- param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
72
- param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
73
- param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
74
- parameters.add(param.name);
75
- }
76
- });
77
- }
78
- });
79
- // Also check method declarations in classes
80
- root
81
- .find(j.ClassMethod)
82
- .forEach(path => {
83
- if (path.node.params) {
84
- path.node.params.forEach(param => {
85
- if (param.type === 'Identifier' &&
86
- param.typeAnnotation &&
87
- param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
88
- param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
89
- param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
90
- parameters.add(param.name);
91
- }
92
- });
93
- }
94
- });
95
- // Also check arrow functions
96
- root
97
- .find(j.ArrowFunctionExpression)
98
- .forEach(path => {
99
- if (path.node.params) {
100
- path.node.params.forEach(param => {
101
- if (param.type === 'Identifier' &&
102
- param.typeAnnotation &&
103
- param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
104
- param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
105
- param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
106
- parameters.add(param.name);
107
- }
108
- });
109
- }
110
- });
111
- // Find local variable declarations of type componentType
112
- const localVariables = new Set();
113
- root
114
- .find(j.VariableDeclarator)
115
- .forEach(path => {
116
- if (path.node.id.type === 'Identifier' &&
117
- path.node.id.typeAnnotation &&
118
- path.node.id.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
119
- path.node.id.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
120
- path.node.id.typeAnnotation.typeAnnotation.typeName.name === componentType) {
121
- localVariables.add(path.node.id.name);
122
- }
123
- });
124
- // Find all member expressions where title property is accessed on any componentType instance
125
- root
126
- .find(j.MemberExpression, {
127
- property: {
128
- type: 'Identifier',
129
- name: propertyName
130
- }
131
- })
132
- .filter(path => {
133
- // Filter to only include accesses on properties that are componentType instances
134
- if (path.node.object.type === 'MemberExpression' &&
135
- path.node.object.property.type === 'Identifier') {
136
- // handle properties of this
137
- if (path.node.object.object.type === 'ThisExpression' &&
138
- properties.has(path.node.object.property.name)) {
139
- return true;
83
+ });
84
+ // Find function parameters of type componentType
85
+ const parameters = new Set();
86
+ root.find(j.FunctionDeclaration).forEach((path) => {
87
+ if (path.node.params) {
88
+ path.node.params.forEach((param) => {
89
+ if (param.type === 'Identifier' &&
90
+ param.typeAnnotation &&
91
+ param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
92
+ param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
93
+ param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
94
+ parameters.add(param.name);
95
+ }
96
+ });
140
97
  }
141
- }
142
- // Handle function parameters and local variables
143
- if (path.node.object.type === 'Identifier') {
144
- return parameters.has(path.node.object.name) || localVariables.has(path.node.object.name);
145
- }
146
- return false;
147
- })
148
- .forEach(path => {
149
- // Replace old property name with new property name
150
- if (path.node.property.type === 'Identifier') {
151
- path.node.property.name = newPropertyName;
152
- }
153
- // If valueProperty is specified and this is part of an assignment,
154
- // we need to also modify the right-hand side of the assignment
155
- if (valueProperty) {
156
- const assignmentExpression = path.parent;
157
- if (assignmentExpression && assignmentExpression.value &&
158
- assignmentExpression.value.type === 'AssignmentExpression' &&
159
- assignmentExpression.value.left === path.node) {
160
- const rightSide = assignmentExpression.value.right;
161
- // Case 1: Right side is a member expression (e.g., this.user, obj.user) -> transform to this.user.id, obj.user.id
162
- // Case 2: Right side is an identifier (e.g., user, foo) -> transform to user.id, foo.id
163
- if (rightSide.type === 'MemberExpression' || rightSide.type === 'Identifier') {
164
- const newRightSide = j.memberExpression(rightSide, j.identifier(valueProperty));
165
- assignmentExpression.value.right = newRightSide;
98
+ });
99
+ // Also check method declarations in classes
100
+ root.find(j.ClassMethod).forEach((path) => {
101
+ if (path.node.params) {
102
+ path.node.params.forEach((param) => {
103
+ if (param.type === 'Identifier' &&
104
+ param.typeAnnotation &&
105
+ param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
106
+ param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
107
+ param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
108
+ parameters.add(param.name);
109
+ }
110
+ });
111
+ }
112
+ });
113
+ // Also check arrow functions
114
+ root.find(j.ArrowFunctionExpression).forEach((path) => {
115
+ if (path.node.params) {
116
+ path.node.params.forEach((param) => {
117
+ if (param.type === 'Identifier' &&
118
+ param.typeAnnotation &&
119
+ param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
120
+ param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
121
+ param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
122
+ parameters.add(param.name);
123
+ }
124
+ });
125
+ }
126
+ });
127
+ // Find local variable declarations of type componentType
128
+ const localVariables = new Set();
129
+ root.find(j.VariableDeclarator).forEach((path) => {
130
+ if (path.node.id.type === 'Identifier' &&
131
+ path.node.id.typeAnnotation &&
132
+ path.node.id.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
133
+ path.node.id.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
134
+ path.node.id.typeAnnotation.typeAnnotation.typeName.name === componentType) {
135
+ localVariables.add(path.node.id.name);
136
+ }
137
+ });
138
+ // Find all member expressions where title property is accessed on any componentType instance
139
+ root.find(j.MemberExpression, {
140
+ property: {
141
+ type: 'Identifier',
142
+ name: propertyName,
143
+ },
144
+ })
145
+ .filter((path) => {
146
+ // Filter to only include accesses on properties that are componentType instances
147
+ if (path.node.object.type === 'MemberExpression' && path.node.object.property.type === 'Identifier') {
148
+ // handle properties of this
149
+ if (path.node.object.object.type === 'ThisExpression' &&
150
+ properties.has(path.node.object.property.name)) {
151
+ return true;
166
152
  }
167
- // Case 3: Right side is object literal -> extract the valueProperty value
168
- else if (rightSide.type === 'ObjectExpression') {
169
- // Find the property that matches valueProperty
170
- const targetProperty = rightSide.properties.find((prop) => prop.type === 'ObjectProperty' &&
171
- prop.key &&
172
- prop.key.type === 'Identifier' &&
173
- prop.key.name === valueProperty);
174
- if (targetProperty) {
175
- // Replace the entire object literal with just the value of the target property
176
- assignmentExpression.value.right = targetProperty.value;
153
+ }
154
+ // Handle function parameters and local variables
155
+ if (path.node.object.type === 'Identifier') {
156
+ return parameters.has(path.node.object.name) || localVariables.has(path.node.object.name);
157
+ }
158
+ return false;
159
+ })
160
+ .forEach((path) => {
161
+ // Replace old property name with new property name
162
+ if (path.node.property.type === 'Identifier') {
163
+ path.node.property.name = newPropertyName;
164
+ }
165
+ // If valueProperty is specified and this is part of an assignment,
166
+ // we need to also modify the right-hand side of the assignment
167
+ if (valueProperty) {
168
+ const assignmentExpression = path.parent;
169
+ if (assignmentExpression &&
170
+ assignmentExpression.value &&
171
+ assignmentExpression.value.type === 'AssignmentExpression' &&
172
+ assignmentExpression.value.left === path.node) {
173
+ const rightSide = assignmentExpression.value.right;
174
+ // Case 1: Right side is a member expression (e.g., this.user, obj.user) -> transform to this.user.id, obj.user.id
175
+ // Case 2: Right side is an identifier (e.g., user, foo) -> transform to user.id, foo.id
176
+ if (rightSide.type === 'MemberExpression' || rightSide.type === 'Identifier') {
177
+ const newRightSide = j.memberExpression(rightSide, j.identifier(valueProperty));
178
+ assignmentExpression.value.right = newRightSide;
179
+ }
180
+ // Case 3: Right side is object literal -> extract the valueProperty value
181
+ else if (rightSide.type === 'ObjectExpression') {
182
+ // Find the property that matches valueProperty
183
+ const targetProperty = rightSide.properties.find((prop) => prop.type === 'ObjectProperty' &&
184
+ prop.key &&
185
+ prop.key.type === 'Identifier' &&
186
+ prop.key.name === valueProperty);
187
+ if (targetProperty) {
188
+ // Replace the entire object literal with just the value of the target property
189
+ assignmentExpression.value.right = targetProperty.value;
190
+ }
177
191
  }
178
192
  }
179
193
  }
180
- }
181
- });
194
+ });
195
+ }
182
196
  };
183
197
  exports.tsPropertyTransformer = tsPropertyTransformer;
184
198
  const htmlStaticAttributeTransformer = (fileInfo, tagName, oldName, newName) => {
185
199
  const fileContent = fileInfo.source;
186
- const root = (0, node_html_parser_1.default)(fileContent);
200
+ const root = (0, node_html_parser_1.default)(fileContent, { comment: true, blockTextElements: exports.blockTextElements });
187
201
  let modified = false;
188
202
  const elements = Array.from(root.querySelectorAll(tagName));
189
203
  for (const element of elements) {
@@ -202,7 +216,7 @@ const htmlStaticAttributeTransformer = (fileInfo, tagName, oldName, newName) =>
202
216
  exports.htmlStaticAttributeTransformer = htmlStaticAttributeTransformer;
203
217
  const htmlBoundAttributeTransformer = (fileInfo, tagName, oldName, newName, valueProperty) => {
204
218
  const fileContent = fileInfo.source;
205
- const root = (0, node_html_parser_1.default)(fileContent);
219
+ const root = (0, node_html_parser_1.default)(fileContent, { comment: true, blockTextElements: exports.blockTextElements });
206
220
  let modified = false;
207
221
  const elements = Array.from(root.querySelectorAll(tagName));
208
222
  for (const element of elements) {
@@ -227,6 +241,26 @@ const htmlAttributeTransformer = (fileInfo, tagName, oldName, newName) => {
227
241
  return content;
228
242
  };
229
243
  exports.htmlAttributeTransformer = htmlAttributeTransformer;
244
+ const htmlEventTransformer = (fileInfo, tagName, oldEventName, newEventName) => {
245
+ const fileContent = fileInfo.source;
246
+ const root = (0, node_html_parser_1.default)(fileContent, { comment: true, blockTextElements: exports.blockTextElements });
247
+ let modified = false;
248
+ const elements = Array.from(root.querySelectorAll(tagName));
249
+ for (const element of elements) {
250
+ // Handle event bindings like (actionClick)="handler($event)"
251
+ const eventAttr = element.getAttribute(`(${oldEventName})`);
252
+ if (eventAttr) {
253
+ element.removeAttribute(`(${oldEventName})`);
254
+ element.setAttribute(`(${newEventName})`, eventAttr);
255
+ modified = true;
256
+ }
257
+ }
258
+ if (modified) {
259
+ return root.toString();
260
+ }
261
+ return fileContent;
262
+ };
263
+ exports.htmlEventTransformer = htmlEventTransformer;
230
264
  const templateAttributeValueTransformer = (root, tagName, attributeName, oldAttributeValue, newAttributeValue) => {
231
265
  const elements = Array.from(root.getElementsByTagName(tagName)) || [];
232
266
  for (const element of elements) {
@@ -244,88 +278,67 @@ const templateAttributeValueTransformer = (root, tagName, attributeName, oldAttr
244
278
  }
245
279
  };
246
280
  exports.templateAttributeValueTransformer = templateAttributeValueTransformer;
247
- const tsPropertyValueTransformer = (root, j, typeName, oldValue, newValue) => {
248
- // 1. Find all class properties with the specified type
249
- root
250
- .find(j.ClassProperty)
251
- .filter(path => {
252
- // Check if the property has a type annotation matching the specified type
253
- if (path.node.typeAnnotation?.typeAnnotation &&
254
- path.node.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
255
- path.node.typeAnnotation.typeAnnotation.typeName &&
256
- path.node.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
257
- path.node.typeAnnotation.typeAnnotation.typeName.name === typeName) {
258
- return true;
259
- }
260
- return false;
261
- })
262
- .forEach(path => {
263
- // Update the value if it matches the old value
264
- if (path.node.value &&
265
- path.node.value.type === 'StringLiteral' &&
266
- path.node.value.value === oldValue) {
267
- path.node.value.value = newValue;
268
- }
269
- });
270
- // First, collect all variables with the specified type
271
- root
272
- .find(j.VariableDeclarator)
273
- .filter(path => {
274
- if (path.node.id.type === 'Identifier' &&
275
- path.node.id.typeAnnotation?.typeAnnotation &&
276
- path.node.id.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
277
- path.node.id.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
278
- path.node.id.typeAnnotation.typeAnnotation.typeName.name === typeName) {
279
- return true;
280
- }
281
- return false;
282
- })
283
- .forEach(path => {
284
- if (path.node.id.type === 'Identifier') {
285
- // Also update the initial value if it matches
286
- if (path.node.init &&
287
- path.node.init.type === 'StringLiteral' &&
288
- path.node.init.value === oldValue) {
289
- path.node.init.value = newValue;
281
+ const tsPropertyValueTransformer = (source, root, j, typeName, oldValue, newValue) => {
282
+ if (source.includes(typeName)) {
283
+ root.find(j.ClassProperty)
284
+ .filter((path) => {
285
+ if (path.node.typeAnnotation?.typeAnnotation &&
286
+ path.node.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
287
+ path.node.typeAnnotation.typeAnnotation.typeName &&
288
+ path.node.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
289
+ path.node.typeAnnotation.typeAnnotation.typeName.name === typeName) {
290
+ return true;
290
291
  }
291
- }
292
- });
293
- // 3. Update literals in assignment expressions
294
- root
295
- .find(j.AssignmentExpression)
296
- .filter(path => {
297
- // Only process string literals with the old value
298
- return path.node.right.type === 'StringLiteral' &&
299
- path.node.right.value === oldValue;
300
- })
301
- .forEach(path => {
302
- // Update the value
303
- path.node.right.value = newValue;
304
- });
305
- // 4. Also look for string literals in attributes within JSX elements
306
- root
307
- .find(j.JSXAttribute, {
308
- value: {
309
- type: 'StringLiteral',
310
- value: oldValue
311
- }
312
- })
313
- .forEach(path => {
314
- if (path.node.value?.type === 'StringLiteral') {
315
- path.node.value.value = newValue;
316
- }
317
- });
292
+ return false;
293
+ })
294
+ .forEach((path) => {
295
+ if (path.node.value && path.node.value.type === 'StringLiteral' && path.node.value.value === oldValue) {
296
+ path.node.value.value = newValue;
297
+ }
298
+ });
299
+ root.find(j.VariableDeclarator)
300
+ .filter((path) => {
301
+ if (path.node.id.type === 'Identifier' &&
302
+ path.node.id.typeAnnotation?.typeAnnotation &&
303
+ path.node.id.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
304
+ path.node.id.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
305
+ path.node.id.typeAnnotation.typeAnnotation.typeName.name === typeName) {
306
+ return true;
307
+ }
308
+ return false;
309
+ })
310
+ .forEach((path) => {
311
+ if (path.node.id.type === 'Identifier') {
312
+ if (path.node.init && path.node.init.type === 'StringLiteral' && path.node.init.value === oldValue) {
313
+ path.node.init.value = newValue;
314
+ }
315
+ }
316
+ });
317
+ root.find(j.AssignmentExpression)
318
+ .filter((path) => {
319
+ return path.node.right.type === 'StringLiteral' && path.node.right.value === oldValue;
320
+ })
321
+ .forEach((path) => {
322
+ path.node.right.value = newValue;
323
+ });
324
+ root.find(j.JSXAttribute, {
325
+ value: {
326
+ type: 'StringLiteral',
327
+ value: oldValue,
328
+ },
329
+ }).forEach((path) => {
330
+ if (path.node.value?.type === 'StringLiteral') {
331
+ path.node.value.value = newValue;
332
+ }
333
+ });
334
+ }
318
335
  };
319
336
  exports.tsPropertyValueTransformer = tsPropertyValueTransformer;
320
337
  const htmlAttributeValueTransformer = (fileInfo, tagName, attributeName, oldValue, newValue) => {
321
- // Read file content from fileInfo
322
338
  const fileContent = fileInfo.source;
323
- // Parse the HTML content
324
- const root = (0, node_html_parser_1.default)(fileContent);
325
- // Find all elements matching the tagName
339
+ const root = (0, node_html_parser_1.default)(fileContent, { comment: true, blockTextElements: exports.blockTextElements });
326
340
  const elements = root.querySelectorAll(tagName);
327
341
  let modified = false;
328
- // Process each element
329
342
  for (const element of elements) {
330
343
  // Handle static attributes (e.g., showText="overflow")
331
344
  const staticAttr = element.getAttribute(attributeName);
@@ -346,37 +359,35 @@ const htmlAttributeValueTransformer = (fileInfo, tagName, attributeName, oldValu
346
359
  }
347
360
  }
348
361
  }
349
- // Return modified content if changes were made
350
362
  if (modified) {
351
363
  const updatedContent = root.toString();
352
364
  return updatedContent;
353
365
  }
354
- // Return original content if no changes were made or if there was an error
355
366
  return fileContent;
356
367
  };
357
368
  exports.htmlAttributeValueTransformer = htmlAttributeValueTransformer;
358
369
  const htmlAttributeRemoval = (fileInfo, tagName, attributeName, propertyToRemove) => {
359
370
  const filePath = fileInfo.path;
360
371
  const fileContent = fileInfo.source;
361
- const root = (0, node_html_parser_1.default)(fileContent);
372
+ const root = (0, node_html_parser_1.default)(fileContent, { comment: true, blockTextElements: exports.blockTextElements });
362
373
  // Use the same logic as templateAttributeRemoval
363
374
  const elements = root.querySelectorAll(tagName);
364
375
  for (const element of elements) {
376
+ // If no propertyToRemove is specified, remove the entire attribute
377
+ if (!propertyToRemove) {
378
+ // Remove both bound and static attributes
379
+ element.removeAttribute(`[${attributeName}]`);
380
+ element.removeAttribute(attributeName);
381
+ continue;
382
+ }
365
383
  // Look for bound attribute (e.g., [scrollable]="...")
366
384
  const boundAttr = element.getAttribute(`[${attributeName}]`);
367
385
  if (boundAttr) {
368
- // Check if it's an object literal
369
386
  if (boundAttr.trim().startsWith('{') && boundAttr.trim().endsWith('}')) {
370
- // Process object literal like {mouseScrollSpeed: 10000}
371
387
  const objectLiteral = boundAttr.trim();
372
- // Build a regex that matches the property and its value
373
- // This handles various formats like {prop: value}, { prop: value }, etc.
374
388
  const propRegex = new RegExp(`\\s*${propertyToRemove}\\s*:\\s*[^,}]+\\s*(,\\s*)?`, 'g');
375
- // Remove the property and any trailing comma
376
389
  let newObjectLiteral = objectLiteral.replace(propRegex, '');
377
- // Fix syntax if we removed the last property with trailing comma
378
390
  newObjectLiteral = newObjectLiteral.replace(/,\s*}$/, '}');
379
- // If the object is now empty, remove the attribute completely
380
391
  if (newObjectLiteral === '{}') {
381
392
  element.removeAttribute(`[${attributeName}]`);
382
393
  }
@@ -384,44 +395,29 @@ const htmlAttributeRemoval = (fileInfo, tagName, attributeName, propertyToRemove
384
395
  element.setAttribute(`[${attributeName}]`, newObjectLiteral);
385
396
  }
386
397
  }
387
- // Check if it's a variable reference to an object
388
398
  else {
389
- // For variable references, we can't modify them in the template
390
- // We should warn the user or handle this case specially
391
399
  console.warn(`Cannot remove property from variable reference: ${boundAttr} in file ${filePath}`);
392
400
  }
393
401
  }
394
402
  }
395
- // Return the modified HTML content
396
403
  return root.toString();
397
404
  };
398
405
  exports.htmlAttributeRemoval = htmlAttributeRemoval;
399
- /**
400
- * Removes a specified property from an object binding in HTML templates
401
- *
402
- * @param root - The HTML root element
403
- * @param tagName - The tag to search for (e.g., 'kendo-tabstrip')
404
- * @param attributeName - The attribute containing the object binding (e.g., 'scrollable')
405
- * @param propertyToRemove - The property to remove from the object (e.g., 'mouseScrollSpeed')
406
- */
407
406
  const templateAttributeRemoval = (root, tagName, attributeName, propertyToRemove) => {
408
407
  const elements = root.querySelectorAll(tagName);
409
408
  for (const element of elements) {
410
- // Look for bound attribute (e.g., [scrollable]="...")
409
+ if (!propertyToRemove) {
410
+ element.removeAttribute(`[${attributeName}]`);
411
+ element.removeAttribute(attributeName);
412
+ continue;
413
+ }
411
414
  const boundAttr = element.getAttribute(`[${attributeName}]`);
412
415
  if (boundAttr) {
413
- // Check if it's an object literal
414
416
  if (boundAttr.trim().startsWith('{') && boundAttr.trim().endsWith('}')) {
415
- // Process object literal like {mouseScrollSpeed: 10000}
416
417
  const objectLiteral = boundAttr.trim();
417
- // Build a regex that matches the property and its value
418
- // This handles various formats like {prop: value}, { prop: value }, etc.
419
418
  const propRegex = new RegExp(`\\s*${propertyToRemove}\\s*:\\s*[^,}]+\\s*(,\\s*)?`, 'g');
420
- // Remove the property and any trailing comma
421
419
  let newObjectLiteral = objectLiteral.replace(propRegex, '');
422
- // Fix syntax if we removed the last property with trailing comma
423
420
  newObjectLiteral = newObjectLiteral.replace(/,\s*}$/, '}');
424
- // If the object is now empty, remove the attribute completely
425
421
  if (newObjectLiteral === '{}') {
426
422
  element.removeAttribute(`[${attributeName}]`);
427
423
  }
@@ -429,181 +425,287 @@ const templateAttributeRemoval = (root, tagName, attributeName, propertyToRemove
429
425
  element.setAttribute(`[${attributeName}]`, newObjectLiteral);
430
426
  }
431
427
  }
432
- // Check if it's a variable reference to an object
433
428
  else {
434
- // For variable references, we can't modify them in the template
435
- // We should warn the user or handle this case specially
436
429
  console.warn(`Cannot remove property from variable reference: ${boundAttr}`);
437
430
  }
438
431
  }
439
432
  }
440
433
  };
441
434
  exports.templateAttributeRemoval = templateAttributeRemoval;
442
- /**
443
- * Removes a property from object literals of a specified type
444
- *
445
- * @param root - The AST root
446
- * @param j - The JSCodeshift instance
447
- * @param typeName - The type to target (e.g., 'TabStripScrollableSettings')
448
- * @param propertyToRemove - The property to remove (e.g., 'mouseScrollSpeed')
449
- */
450
- function tsPropertyRemoval(rootSource, j, typeName, propertyName) {
451
- // Find class properties that have the specified type
452
- rootSource
453
- .find(j.ClassProperty, {
454
- typeAnnotation: {
435
+ function tsPropertyRemoval(source, rootSource, j, typeName, propertyName) {
436
+ if (source.includes(typeName)) {
437
+ rootSource
438
+ .find(j.ClassProperty, {
455
439
  typeAnnotation: {
456
- typeName: {
457
- name: typeName
440
+ typeAnnotation: {
441
+ typeName: {
442
+ name: typeName,
443
+ },
444
+ },
445
+ },
446
+ })
447
+ .forEach((path) => {
448
+ if (path.node.value && path.node.value.type === 'ObjectExpression') {
449
+ const properties = path.node.value.properties;
450
+ const propIndex = properties.findIndex((p) => p.type === 'ObjectProperty' &&
451
+ p.key &&
452
+ p.key.type === 'Identifier' &&
453
+ p.key.name === propertyName);
454
+ if (propIndex !== -1) {
455
+ if (properties.length === 1) {
456
+ j(path).remove();
457
+ }
458
+ else {
459
+ properties.splice(propIndex, 1);
460
+ }
458
461
  }
459
462
  }
460
- }
461
- })
462
- .forEach(path => {
463
- // Check if there's an object literal initializer
464
- if (path.node.value && path.node.value.type === 'ObjectExpression') {
465
- const properties = path.node.value.properties;
466
- // Find the property we want to remove - safely handle different property types
467
- const propIndex = properties.findIndex((p) => p.type === 'ObjectProperty' &&
463
+ });
464
+ rootSource
465
+ .find(j.AssignmentExpression, {
466
+ left: {
467
+ type: 'MemberExpression',
468
+ object: {
469
+ type: 'MemberExpression',
470
+ },
471
+ property: {
472
+ name: propertyName,
473
+ },
474
+ },
475
+ })
476
+ .forEach((path) => {
477
+ j(path).remove();
478
+ });
479
+ return rootSource;
480
+ }
481
+ }
482
+ const tsComponentPropertyRemoval = (source, root, j, componentType, componentProperty, propertyToRemove) => {
483
+ if (source.includes(componentType)) {
484
+ // If no propertyToRemove is specified, remove the entire componentProperty
485
+ if (!propertyToRemove) {
486
+ // Handle direct property assignments like: foo.scrollable = value;
487
+ root.find(j.AssignmentExpression)
488
+ .filter((path) => {
489
+ const { left } = path.value;
490
+ // Check if this assigns to component.componentProperty
491
+ if (left &&
492
+ left.type === 'MemberExpression' &&
493
+ left.property &&
494
+ left.property.name === componentProperty) {
495
+ // Check if the base object is our component type
496
+ return isComponentTypeMatch(root, j, left.object, componentType);
497
+ }
498
+ return false;
499
+ })
500
+ .forEach((path) => {
501
+ // Remove the entire statement
502
+ j(path).closest(j.ExpressionStatement).remove();
503
+ });
504
+ return root;
505
+ }
506
+ // CASE 1: Handle direct property assignments like: foo.scrollable.mouseScrollSpeed = 3000;
507
+ root.find(j.AssignmentExpression)
508
+ .filter((path) => {
509
+ const { left } = path.value;
510
+ // Check if this is a member expression assignment
511
+ if (left && left.type === 'MemberExpression') {
512
+ // Check if we're accessing the property to remove
513
+ if (left.property && left.property.name === propertyToRemove) {
514
+ // Check if we're accessing it from component.componentProperty
515
+ const obj = left.object;
516
+ if (obj &&
517
+ obj.type === 'MemberExpression' &&
518
+ obj.property &&
519
+ obj.property.name === componentProperty) {
520
+ // Now check if the base object is our component type
521
+ return isComponentTypeMatch(root, j, obj.object, componentType);
522
+ }
523
+ }
524
+ }
525
+ return false;
526
+ })
527
+ .forEach((path) => {
528
+ // Remove the entire statement
529
+ j(path).closest(j.ExpressionStatement).remove();
530
+ });
531
+ // CASE 2 & 3: Handle object assignments like: foo.scrollable = { mouseScrollSpeed: 3000, ... };
532
+ root.find(j.AssignmentExpression)
533
+ .filter((path) => {
534
+ const { left, right } = path.value;
535
+ // Check if this assigns to component.componentProperty
536
+ if (left &&
537
+ left.type === 'MemberExpression' &&
538
+ left.property &&
539
+ left.property.name === componentProperty &&
540
+ right &&
541
+ right.type === 'ObjectExpression') {
542
+ // Check if the base object is our component type
543
+ return isComponentTypeMatch(root, j, left.object, componentType);
544
+ }
545
+ return false;
546
+ })
547
+ .forEach((path) => {
548
+ const properties = path.value.right.properties;
549
+ // Find the property we want to remove
550
+ const propIndex = properties.findIndex((p) => p &&
551
+ p.type === 'ObjectProperty' &&
468
552
  p.key &&
469
553
  p.key.type === 'Identifier' &&
470
- p.key.name === propertyName);
554
+ p.key.name === propertyToRemove);
471
555
  if (propIndex !== -1) {
472
- // If property exists, remove it
473
- // Case 1: If it's the only property, remove the entire class property
556
+ // Case 2: If it's the only property, remove the entire statement
474
557
  if (properties.length === 1) {
475
- j(path).remove();
558
+ j(path).closest(j.ExpressionStatement).remove();
476
559
  }
477
- // Case 2: If there are other properties, just remove this one property
560
+ // Case 3: If there are other properties, just remove this one property
478
561
  else {
479
562
  properties.splice(propIndex, 1);
480
563
  }
481
564
  }
482
- }
483
- });
484
- // Also handle property assignments (e.g., in methods like ngOnInit)
485
- rootSource
486
- .find(j.AssignmentExpression, {
487
- left: {
488
- type: 'MemberExpression',
489
- object: {
490
- type: 'MemberExpression'
491
- },
492
- property: {
493
- name: propertyName
494
- }
495
- }
496
- })
497
- .forEach(path => {
498
- j(path).remove();
499
- });
500
- return rootSource;
501
- }
502
- /**
503
- * Removes assignments to a specific nested property of a component
504
- *
505
- * @param root - The AST root
506
- * @param j - The JSCodeshift instance
507
- * @param componentType - The component type to target (e.g., 'TabStripComponent')
508
- * @param componentProperty - The component property (e.g., 'scrollable')
509
- * @param propertyToRemove - The nested property to remove assignments to (e.g., 'mouseScrollSpeed')
510
- */
511
- const tsComponentPropertyRemoval = (root, j, componentType, componentProperty, propertyToRemove) => {
512
- // CASE 1: Handle direct property assignments like: foo.scrollable.mouseScrollSpeed = 3000;
513
- root
514
- .find(j.AssignmentExpression)
515
- .filter((path) => {
516
- const { left } = path.value;
517
- // Check if this is a member expression assignment
518
- if (left && left.type === 'MemberExpression') {
519
- // Check if we're accessing the property to remove
520
- if (left.property && left.property.name === propertyToRemove) {
521
- // Check if we're accessing it from component.componentProperty
522
- const obj = left.object;
523
- if (obj && obj.type === 'MemberExpression' &&
524
- obj.property && obj.property.name === componentProperty) {
525
- // Now check if the base object is our component type
526
- return isComponentTypeMatch(root, j, obj.object, componentType);
527
- }
528
- }
529
- }
530
- return false;
531
- })
532
- .forEach((path) => {
533
- // Remove the entire statement
534
- j(path).closest(j.ExpressionStatement).remove();
535
- });
536
- // CASE 2 & 3: Handle object assignments like: foo.scrollable = { mouseScrollSpeed: 3000, ... };
537
- root
538
- .find(j.AssignmentExpression)
539
- .filter((path) => {
540
- const { left, right } = path.value;
541
- // Check if this assigns to component.componentProperty
542
- if (left && left.type === 'MemberExpression' &&
543
- left.property && left.property.name === componentProperty &&
544
- right && right.type === 'ObjectExpression') {
545
- // Check if the base object is our component type
546
- return isComponentTypeMatch(root, j, left.object, componentType);
547
- }
548
- return false;
549
- })
550
- .forEach((path) => {
551
- const properties = path.value.right.properties;
552
- // Find the property we want to remove
553
- const propIndex = properties.findIndex((p) => p && p.type === 'ObjectProperty' &&
554
- p.key && p.key.type === 'Identifier' &&
555
- p.key.name === propertyToRemove);
556
- if (propIndex !== -1) {
557
- // Case 2: If it's the only property, remove the entire statement
558
- if (properties.length === 1) {
559
- j(path).closest(j.ExpressionStatement).remove();
560
- }
561
- // Case 3: If there are other properties, just remove this one property
562
- else {
563
- properties.splice(propIndex, 1);
564
- }
565
- }
566
- });
567
- return root;
565
+ });
566
+ return root;
567
+ }
568
568
  };
569
569
  exports.tsComponentPropertyRemoval = tsComponentPropertyRemoval;
570
570
  // Helper function to check if a node is a component of the specified type
571
571
  function isComponentTypeMatch(root, j, node, componentType) {
572
572
  if (!node)
573
573
  return false;
574
- // Case 1: Direct match for 'this.propertyName'
575
574
  if (node.type === 'ThisExpression') {
576
- return true; // Assuming 'this' refers to the component class
575
+ return true;
577
576
  }
578
- // Case 2: Function parameter
579
577
  if (node.type === 'Identifier') {
580
578
  const paramName = node.name;
581
- // Check function parameters
582
- return root
583
- .find(j.Function)
584
- .some(path => {
585
- return path.node.params && path.node.params.some((param) => param.type === 'Identifier' &&
586
- param.name === paramName &&
587
- param.typeAnnotation?.typeAnnotation?.typeName?.name === componentType);
579
+ return root.find(j.Function).some((path) => {
580
+ return (path.node.params &&
581
+ path.node.params.some((param) => param.type === 'Identifier' &&
582
+ param.name === paramName &&
583
+ param.typeAnnotation?.typeAnnotation?.typeName?.name === componentType));
588
584
  });
589
585
  }
590
- // Case 3: Member expression (obj.prop)
591
586
  if (node.type === 'MemberExpression') {
592
- // This would need more complex logic to determine if the object is of the right type
593
- // For now, we can check if it's a property that has been declared with the right type
594
587
  if (node.object.type === 'ThisExpression' && node.property.type === 'Identifier') {
595
588
  const propName = node.property.name;
596
- return root
589
+ return (root
597
590
  .find(j.ClassProperty, {
598
591
  key: { name: propName },
599
592
  typeAnnotation: {
600
593
  typeAnnotation: {
601
- typeName: { name: componentType }
602
- }
603
- }
594
+ typeName: { name: componentType },
595
+ },
596
+ },
604
597
  })
605
- .size() > 0;
598
+ .size() > 0);
606
599
  }
607
600
  }
608
601
  return false;
609
602
  }
603
+ const tsInterfaceTransformer = (fileInfo, rootSource, j, packageName, interfaceName, newName) => {
604
+ const source = fileInfo.source;
605
+ if (source.includes(interfaceName)) {
606
+ let isImportedFromKendoListbox = false;
607
+ rootSource.find(j.ImportDeclaration).forEach((path) => {
608
+ if (path.node.source &&
609
+ path.node.source.value === packageName &&
610
+ path.node.specifiers) {
611
+ path.node.specifiers.forEach((specifier) => {
612
+ if (specifier.type === 'ImportSpecifier' &&
613
+ specifier.imported.type === 'Identifier' &&
614
+ specifier.imported.name === interfaceName) {
615
+ isImportedFromKendoListbox = true;
616
+ specifier.imported.name = newName;
617
+ }
618
+ });
619
+ }
620
+ });
621
+ if (!isImportedFromKendoListbox) {
622
+ return;
623
+ }
624
+ rootSource.find(j.ClassProperty).forEach((path) => {
625
+ if (path.node.typeAnnotation &&
626
+ path.node.typeAnnotation.typeAnnotation &&
627
+ path.node.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
628
+ path.node.typeAnnotation.typeAnnotation.typeName &&
629
+ path.node.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
630
+ path.node.typeAnnotation.typeAnnotation.typeName.name === interfaceName) {
631
+ path.node.typeAnnotation.typeAnnotation.typeName.name = newName;
632
+ }
633
+ });
634
+ rootSource.find(j.VariableDeclarator).forEach((path) => {
635
+ if (path.node.id.type === 'Identifier' &&
636
+ path.node.id.typeAnnotation &&
637
+ path.node.id.typeAnnotation.typeAnnotation &&
638
+ path.node.id.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
639
+ path.node.id.typeAnnotation.typeAnnotation.typeName &&
640
+ path.node.id.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
641
+ path.node.id.typeAnnotation.typeAnnotation.typeName.name === interfaceName) {
642
+ path.node.id.typeAnnotation.typeAnnotation.typeName.name = newName;
643
+ }
644
+ });
645
+ rootSource.find(j.FunctionDeclaration).forEach((path) => {
646
+ if (path.node.params) {
647
+ path.node.params.forEach((param) => {
648
+ if (param.type === 'Identifier' &&
649
+ param.typeAnnotation &&
650
+ param.typeAnnotation.typeAnnotation &&
651
+ param.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
652
+ param.typeAnnotation.typeAnnotation.typeName &&
653
+ param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
654
+ param.typeAnnotation.typeAnnotation.typeName.name === interfaceName) {
655
+ param.typeAnnotation.typeAnnotation.typeName.name = newName;
656
+ }
657
+ });
658
+ }
659
+ });
660
+ rootSource.find(j.ArrowFunctionExpression).forEach((path) => {
661
+ if (path.node.params) {
662
+ path.node.params.forEach((param) => {
663
+ if (param.type === 'Identifier' &&
664
+ param.typeAnnotation &&
665
+ param.typeAnnotation.typeAnnotation &&
666
+ param.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
667
+ param.typeAnnotation.typeAnnotation.typeName &&
668
+ param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
669
+ param.typeAnnotation.typeAnnotation.typeName.name === interfaceName) {
670
+ param.typeAnnotation.typeAnnotation.typeName.name = newName;
671
+ }
672
+ });
673
+ }
674
+ });
675
+ rootSource.find(j.ClassMethod).forEach((path) => {
676
+ if (path.node.params) {
677
+ path.node.params.forEach((param) => {
678
+ if (param.type === 'Identifier' &&
679
+ param.typeAnnotation &&
680
+ param.typeAnnotation.typeAnnotation &&
681
+ param.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
682
+ param.typeAnnotation.typeAnnotation.typeName &&
683
+ param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
684
+ param.typeAnnotation.typeAnnotation.typeName.name === interfaceName) {
685
+ param.typeAnnotation.typeAnnotation.typeName.name = newName;
686
+ }
687
+ });
688
+ }
689
+ });
690
+ rootSource.find(j.Function).forEach((path) => {
691
+ if (path.node.returnType &&
692
+ path.node.returnType.typeAnnotation &&
693
+ path.node.returnType.typeAnnotation.type === 'TSTypeReference' &&
694
+ path.node.returnType.typeAnnotation.typeName &&
695
+ path.node.returnType.typeAnnotation.typeName.type === 'Identifier' &&
696
+ path.node.returnType.typeAnnotation.typeName.name === interfaceName) {
697
+ path.node.returnType.typeAnnotation.typeName.name = newName;
698
+ }
699
+ });
700
+ rootSource.find(j.TSAsExpression).forEach((path) => {
701
+ if (path.node.typeAnnotation &&
702
+ path.node.typeAnnotation.type === 'TSTypeReference' &&
703
+ path.node.typeAnnotation.typeName &&
704
+ path.node.typeAnnotation.typeName.type === 'Identifier' &&
705
+ path.node.typeAnnotation.typeName.name === interfaceName) {
706
+ path.node.typeAnnotation.typeName.name = newName;
707
+ }
708
+ });
709
+ }
710
+ };
711
+ exports.tsInterfaceTransformer = tsInterfaceTransformer;
@@ -34,10 +34,12 @@ const utils_1 = require("../utils");
34
34
  function default_1(fileInfo, api) {
35
35
  const filePath = fileInfo.path;
36
36
  if (filePath.endsWith('.html')) {
37
- let updatedContent = fileInfo.source;
38
- updatedContent = (0, utils_1.htmlBoundAttributeTransformer)({ ...fileInfo, source: updatedContent }, 'kendo-chat', 'user', 'authorId', 'id');
39
- // Only write to file once after all transformations
40
- fs.writeFileSync(filePath, updatedContent, 'utf-8');
37
+ if ((0, utils_1.hasKendoInTemplate)(fileInfo.source)) {
38
+ let updatedContent = fileInfo.source;
39
+ updatedContent = (0, utils_1.htmlBoundAttributeTransformer)({ ...fileInfo, source: updatedContent }, 'kendo-chat', 'user', 'authorId', 'id');
40
+ // Only write to file once after all transformations
41
+ fs.writeFileSync(filePath, updatedContent, 'utf-8');
42
+ }
41
43
  return;
42
44
  }
43
45
  const j = api.jscodeshift;
@@ -45,6 +47,6 @@ function default_1(fileInfo, api) {
45
47
  (0, index_1.templateTransformer)(rootSource, j, (root) => {
46
48
  (0, utils_1.templateBoundAttributeTransformer)(root, 'kendo-chat', 'user', 'authorId', 'id');
47
49
  });
48
- (0, utils_1.tsPropertyTransformer)(rootSource, j, 'ChatComponent', 'user', 'authorId', 'id');
50
+ (0, utils_1.tsPropertyTransformer)(fileInfo.source, rootSource, j, 'ChatComponent', 'user', 'authorId', 'id');
49
51
  return rootSource.toSource();
50
52
  }
@@ -0,0 +1,53 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.default = default_1;
31
+ const fs = __importStar(require("fs"));
32
+ const index_1 = require("../template-transformer/index");
33
+ const utils_1 = require("../utils");
34
+ function default_1(fileInfo, api) {
35
+ const filePath = fileInfo.path;
36
+ if (filePath.endsWith('.html')) {
37
+ if ((0, utils_1.hasKendoInTemplate)(fileInfo.source)) {
38
+ let updatedContent = fileInfo.source;
39
+ updatedContent = (0, utils_1.htmlAttributeRemoval)({ ...fileInfo, source: updatedContent }, 'kendo-chat', 'messageToolbarVisibility');
40
+ // Only write to file once after all transformations
41
+ fs.writeFileSync(filePath, updatedContent, 'utf-8');
42
+ }
43
+ return;
44
+ }
45
+ const j = api.jscodeshift;
46
+ const rootSource = j(fileInfo.source);
47
+ (0, index_1.templateTransformer)(rootSource, j, (root) => {
48
+ (0, utils_1.templateAttributeRemoval)(root, 'kendo-chat', 'messageToolbarVisibility');
49
+ });
50
+ (0, utils_1.tsPropertyRemoval)(fileInfo.source, rootSource, j, 'ChatComponent', 'messageToolbarVisibility');
51
+ (0, utils_1.tsComponentPropertyRemoval)(fileInfo.source, rootSource, j, 'ChatComponent', 'messageToolbarVisibility');
52
+ return rootSource.toSource();
53
+ }
@@ -0,0 +1,19 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.default = default_1;
8
+ const utils_1 = require("../utils");
9
+ function default_1(fileInfo, api) {
10
+ const filePath = fileInfo.path;
11
+ if (filePath.endsWith('.html')) {
12
+ return;
13
+ }
14
+ const j = api.jscodeshift;
15
+ const rootSource = j(fileInfo.source);
16
+ (0, utils_1.tsPropertyRemoval)(fileInfo.source, rootSource, j, 'ConversationalUIModelFields', 'pinnedByField');
17
+ (0, utils_1.tsComponentPropertyRemoval)(fileInfo.source, rootSource, j, 'ConversationalUIModelFields', 'pinnedByField');
18
+ return rootSource.toSource();
19
+ }
@@ -10,7 +10,7 @@ export const packageMetadata = {
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCode: 'KENDOUIANGULAR',
12
12
  productCodes: ['KENDOUIANGULAR'],
13
- publishDate: 1762162445,
14
- version: '21.0.0-develop.16',
13
+ publishDate: 1762256450,
14
+ version: '21.0.0-develop.17',
15
15
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
16
16
  };
@@ -216,8 +216,8 @@ const packageMetadata = {
216
216
  productName: 'Kendo UI for Angular',
217
217
  productCode: 'KENDOUIANGULAR',
218
218
  productCodes: ['KENDOUIANGULAR'],
219
- publishDate: 1762162445,
220
- version: '21.0.0-develop.16',
219
+ publishDate: 1762256450,
220
+ version: '21.0.0-develop.17',
221
221
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
222
222
  };
223
223
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-conversational-ui",
3
- "version": "21.0.0-develop.16",
3
+ "version": "21.0.0-develop.17",
4
4
  "description": "Kendo UI for Angular Conversational UI components",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -29,13 +29,25 @@
29
29
  "file": "codemods/v20/chat-user.js",
30
30
  "prompt": "true"
31
31
  }
32
+ ],
33
+ "21": [
34
+ {
35
+ "description": "The Chat's messageToolbarVisibility input property is deprecated.",
36
+ "file": "codemods/v21/chat-messagetoolbarvisibility.js",
37
+ "prompt": "true"
38
+ },
39
+ {
40
+ "description": "The pinnedByField property of the Chat's ConversationalUIModelFields is deprecated.",
41
+ "file": "codemods/v21/chat-pinnedbyfield.js",
42
+ "prompt": "true"
43
+ }
32
44
  ]
33
45
  }
34
46
  },
35
47
  "package": {
36
48
  "productName": "Kendo UI for Angular",
37
49
  "productCode": "KENDOUIANGULAR",
38
- "publishDate": 1762162445,
50
+ "publishDate": 1762256450,
39
51
  "licensingDocsUrl": "https://www.telerik.com/kendo-angular-ui/my-license/"
40
52
  }
41
53
  },
@@ -45,22 +57,22 @@
45
57
  "@angular/core": "18 - 20",
46
58
  "@angular/platform-browser": "18 - 20",
47
59
  "@progress/kendo-licensing": "^1.7.0",
48
- "@progress/kendo-angular-buttons": "21.0.0-develop.16",
49
- "@progress/kendo-angular-inputs": "21.0.0-develop.16",
50
- "@progress/kendo-angular-layout": "21.0.0-develop.16",
51
- "@progress/kendo-angular-icons": "21.0.0-develop.16",
52
- "@progress/kendo-angular-common": "21.0.0-develop.16",
53
- "@progress/kendo-angular-intl": "21.0.0-develop.16",
54
- "@progress/kendo-angular-l10n": "21.0.0-develop.16",
55
- "@progress/kendo-angular-menu": "21.0.0-develop.16",
56
- "@progress/kendo-angular-popup": "21.0.0-develop.16",
57
- "@progress/kendo-angular-toolbar": "21.0.0-develop.16",
58
- "@progress/kendo-angular-upload": "21.0.0-develop.16",
60
+ "@progress/kendo-angular-buttons": "21.0.0-develop.17",
61
+ "@progress/kendo-angular-inputs": "21.0.0-develop.17",
62
+ "@progress/kendo-angular-layout": "21.0.0-develop.17",
63
+ "@progress/kendo-angular-icons": "21.0.0-develop.17",
64
+ "@progress/kendo-angular-common": "21.0.0-develop.17",
65
+ "@progress/kendo-angular-intl": "21.0.0-develop.17",
66
+ "@progress/kendo-angular-l10n": "21.0.0-develop.17",
67
+ "@progress/kendo-angular-menu": "21.0.0-develop.17",
68
+ "@progress/kendo-angular-popup": "21.0.0-develop.17",
69
+ "@progress/kendo-angular-toolbar": "21.0.0-develop.17",
70
+ "@progress/kendo-angular-upload": "21.0.0-develop.17",
59
71
  "rxjs": "^6.5.3 || ^7.0.0"
60
72
  },
61
73
  "dependencies": {
62
74
  "tslib": "^2.3.1",
63
- "@progress/kendo-angular-schematics": "21.0.0-develop.16"
75
+ "@progress/kendo-angular-schematics": "21.0.0-develop.17"
64
76
  },
65
77
  "schematics": "./schematics/collection.json",
66
78
  "module": "fesm2022/progress-kendo-angular-conversational-ui.mjs",