@taiga-ui/cdk 3.52.0-canary.104df92 → 3.52.0-canary.ca866a4
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/package.json +1 -1
- package/schematics/ng-update/interfaces/html-comment.d.ts +5 -0
- package/schematics/ng-update/interfaces/html-comment.js +2 -0
- package/schematics/ng-update/interfaces/index.d.ts +1 -0
- package/schematics/ng-update/interfaces/index.js +1 -0
- package/schematics/ng-update/utils/templates/index.d.ts +6 -0
- package/schematics/ng-update/utils/templates/index.js +9 -0
- package/schematics/ng-update/utils/templates/template-comments.d.ts +10 -0
- package/schematics/ng-update/utils/templates/template-comments.js +20 -0
- package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +14 -0
- package/schematics/ng-update/v4/steps/constants/html-comments.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/html-comments.js +10 -0
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +12 -0
- package/schematics/ng-update/v4/steps/constants/index.d.ts +5 -0
- package/schematics/ng-update/v4/steps/constants/index.js +8 -0
- package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +2 -0
- package/schematics/ng-update/v4/steps/migrate-templates.js +11 -11
- package/schematics/ng-update/v4/steps/templates/index.d.ts +2 -0
- package/schematics/ng-update/v4/steps/templates/index.js +5 -0
- package/schematics/ng-update/v4/steps/templates/toggles/common.d.ts +10 -0
- package/schematics/ng-update/v4/steps/templates/toggles/common.js +40 -0
- package/schematics/ng-update/v4/steps/templates/toggles/index.d.ts +3 -0
- package/schematics/ng-update/v4/steps/templates/toggles/index.js +6 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.js +25 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-radio.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-radio.js +25 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-toggle.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-toggle.js +25 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@taiga-ui/cdk",
|
3
|
-
"version": "3.52.0-canary.
|
3
|
+
"version": "3.52.0-canary.ca866a4",
|
4
4
|
"description": "Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance",
|
5
5
|
"keywords": [
|
6
6
|
"angular",
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
tslib_1.__exportStar(require("./asset"), exports);
|
5
|
+
tslib_1.__exportStar(require("./html-comment"), exports);
|
5
6
|
tslib_1.__exportStar(require("./migration-warning"), exports);
|
6
7
|
tslib_1.__exportStar(require("./removable-input"), exports);
|
7
8
|
tslib_1.__exportStar(require("./removed-module"), exports);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./remove-inputs"), exports);
|
5
|
+
tslib_1.__exportStar(require("./replace-attr-values"), exports);
|
6
|
+
tslib_1.__exportStar(require("./replace-attrs"), exports);
|
7
|
+
tslib_1.__exportStar(require("./replace-tag"), exports);
|
8
|
+
tslib_1.__exportStar(require("./replace-tags"), exports);
|
9
|
+
tslib_1.__exportStar(require("./template-comments"), exports);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../interfaces';
|
4
|
+
import { HtmlComment } from '../../interfaces';
|
5
|
+
export declare function addHTMLCommentTags({ resource, recorder, fileSystem, data, }: {
|
6
|
+
fileSystem: DevkitFileSystem;
|
7
|
+
recorder: UpdateRecorder;
|
8
|
+
data: readonly HtmlComment[];
|
9
|
+
resource: TemplateResource;
|
10
|
+
}): void;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.addHTMLCommentTags = void 0;
|
4
|
+
const insert_todo_1 = require("../../../utils/insert-todo");
|
5
|
+
const elements_1 = require("../../../utils/templates/elements");
|
6
|
+
const template_resource_1 = require("../../../utils/templates/template-resource");
|
7
|
+
function addHTMLCommentTags({ resource, recorder, fileSystem, data, }) {
|
8
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
9
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
10
|
+
data.forEach(({ comment, tag, withAttrs }) => {
|
11
|
+
const elementStartOffsets = [
|
12
|
+
...elements_1.findElementsWithAttributeOnTag(template, withAttrs, [tag]),
|
13
|
+
...elements_1.findElementsWithAttributeOnTag(template, withAttrs.map(attr => `[${attr}]`), [tag]),
|
14
|
+
].map(({ sourceCodeLocation }) => ((sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.startOffset) || 0) + templateOffset);
|
15
|
+
elementStartOffsets.forEach(offset => {
|
16
|
+
recorder.insertRight(offset, `<!-- ${insert_todo_1.TODO_MARK} ${comment} -->\n`);
|
17
|
+
});
|
18
|
+
});
|
19
|
+
}
|
20
|
+
exports.addHTMLCommentTags = addHTMLCommentTags;
|
@@ -30,4 +30,18 @@ exports.ATTRS_TO_REPLACE = [
|
|
30
30
|
},
|
31
31
|
to: { attrName: `appearance` },
|
32
32
|
},
|
33
|
+
{
|
34
|
+
from: {
|
35
|
+
attrName: `item`,
|
36
|
+
withTagNames: [`tui-radio`],
|
37
|
+
},
|
38
|
+
to: { attrName: `value` },
|
39
|
+
},
|
40
|
+
{
|
41
|
+
from: {
|
42
|
+
attrName: `[item]`,
|
43
|
+
withTagNames: [`tui-radio`],
|
44
|
+
},
|
45
|
+
to: { attrName: `[value]` },
|
46
|
+
},
|
33
47
|
];
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.HTML_COMMENTS = void 0;
|
4
|
+
exports.HTML_COMMENTS = [
|
5
|
+
{
|
6
|
+
tag: `tui-toggle`,
|
7
|
+
withAttrs: [`singleColor`, `showLoader`],
|
8
|
+
comment: `toggle [singleColor] and [showLoader] inputs have been removed due to design changes`,
|
9
|
+
},
|
10
|
+
];
|
@@ -17,6 +17,18 @@ exports.IDENTIFIERS_TO_REPLACE = [
|
|
17
17
|
from: { name: `TuiBadgeModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
18
18
|
to: { name: `TuiBadgeModule`, moduleSpecifier: `@taiga-ui/kit` },
|
19
19
|
},
|
20
|
+
{
|
21
|
+
from: { name: `TuiCheckboxModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
22
|
+
to: { name: `TuiCheckboxModule`, moduleSpecifier: `@taiga-ui/kit` },
|
23
|
+
},
|
24
|
+
{
|
25
|
+
from: { name: `TuiRadioModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
26
|
+
to: { name: `TuiRadioModule`, moduleSpecifier: `@taiga-ui/kit` },
|
27
|
+
},
|
28
|
+
{
|
29
|
+
from: { name: `TuiToggleModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
30
|
+
to: { name: `TuiToggleModule`, moduleSpecifier: `@taiga-ui/kit` },
|
31
|
+
},
|
20
32
|
{
|
21
33
|
from: { name: `TuiTextAreaModule`, moduleSpecifier: `@taiga-ui/kit` },
|
22
34
|
to: { name: `TuiTextareaModule`, moduleSpecifier: `@taiga-ui/kit` },
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./attrs-to-replace"), exports);
|
5
|
+
tslib_1.__exportStar(require("./html-comments"), exports);
|
6
|
+
tslib_1.__exportStar(require("./identifiers-to-replace"), exports);
|
7
|
+
tslib_1.__exportStar(require("./inputs-to-remove"), exports);
|
8
|
+
tslib_1.__exportStar(require("./tags-to-replace"), exports);
|
@@ -3,4 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.INPUTS_TO_REMOVE = void 0;
|
4
4
|
exports.INPUTS_TO_REMOVE = [
|
5
5
|
{ inputName: `active`, tags: [`tui-card`, `tui-thumbnail-card`] },
|
6
|
+
{ inputName: `showLoader`, tags: [`tui-toggle`] },
|
7
|
+
{ inputName: `singleColor`, tags: [`tui-toggle`] },
|
6
8
|
];
|
@@ -6,22 +6,22 @@ const colored_log_1 = require("../../../utils/colored-log");
|
|
6
6
|
const progress_1 = require("../../../utils/progress");
|
7
7
|
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
8
8
|
const template_resource_1 = require("../../../utils/templates/template-resource");
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const attrs_to_replace_1 = require("./constants/attrs-to-replace");
|
13
|
-
const inputs_to_remove_1 = require("./constants/inputs-to-remove");
|
14
|
-
const tags_to_replace_1 = require("./constants/tags-to-replace");
|
15
|
-
const migrate_badge_1 = require("./templates/migrate-badge");
|
9
|
+
const templates_1 = require("../../utils/templates");
|
10
|
+
const constants_2 = require("./constants");
|
11
|
+
const templates_2 = require("./templates");
|
16
12
|
function migrateTemplates(fileSystem, options) {
|
17
13
|
!options[`skip-logs`] &&
|
18
14
|
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
|
19
15
|
const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
20
16
|
const actions = [
|
21
|
-
getAction({ action:
|
22
|
-
getAction({ action:
|
23
|
-
getAction({ action:
|
24
|
-
|
17
|
+
getAction({ action: templates_1.addHTMLCommentTags, requiredData: constants_2.HTML_COMMENTS }),
|
18
|
+
getAction({ action: templates_1.replaceTags, requiredData: constants_2.TAGS_TO_REPLACE }),
|
19
|
+
getAction({ action: templates_1.replaceAttrs, requiredData: constants_2.ATTRS_TO_REPLACE }),
|
20
|
+
getAction({ action: templates_1.removeInputs, requiredData: constants_2.INPUTS_TO_REMOVE }),
|
21
|
+
templates_2.migrateBadgeValue,
|
22
|
+
templates_2.migrateCheckbox,
|
23
|
+
templates_2.migrateRadio,
|
24
|
+
templates_2.migrateToggle,
|
25
25
|
];
|
26
26
|
const progressLog = progress_1.setupProgressLogger({
|
27
27
|
total: componentWithTemplatesPaths.length,
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { Attribute, ElementLocation } from 'parse5';
|
3
|
+
export declare function replaceOpenTag(sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number, { tag, directive, type }: {
|
4
|
+
tag: string;
|
5
|
+
directive: string;
|
6
|
+
type: string;
|
7
|
+
}): void;
|
8
|
+
export declare function replaceSizeAttr(attrs: Attribute[], sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
|
9
|
+
export declare function removeClosingTag(sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
|
10
|
+
export declare function closeStartTag({ startTag }: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.closeStartTag = exports.removeClosingTag = exports.replaceSizeAttr = exports.replaceOpenTag = void 0;
|
4
|
+
const sizeMap = {
|
5
|
+
l: `m`,
|
6
|
+
m: `s`,
|
7
|
+
};
|
8
|
+
function replaceOpenTag(sourceCodeLocation, recorder, templateOffset, { tag, directive, type }) {
|
9
|
+
const { startTag } = sourceCodeLocation;
|
10
|
+
const { startOffset, startCol } = startTag;
|
11
|
+
const spaces = ` `.repeat(startCol + 3);
|
12
|
+
recorder.remove(templateOffset + startOffset, `<${tag}`.length);
|
13
|
+
recorder.insertRight(templateOffset + startOffset, `<input\n${spaces}${directive}\n${spaces}type="${type}"`);
|
14
|
+
}
|
15
|
+
exports.replaceOpenTag = replaceOpenTag;
|
16
|
+
function replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset) {
|
17
|
+
var _a;
|
18
|
+
const sizeAttr = attrs.find(attr => attr.name === `size`);
|
19
|
+
if (sizeAttr) {
|
20
|
+
const { startOffset, endOffset } = ((_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[sizeAttr.name]) || {
|
21
|
+
startOffset: 0,
|
22
|
+
endOffset: 0,
|
23
|
+
};
|
24
|
+
recorder.remove(templateOffset + startOffset, endOffset - startOffset);
|
25
|
+
recorder.insertRight(templateOffset + startOffset, `size="${sizeMap[sizeAttr.value] || sizeAttr.value}"`);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
exports.replaceSizeAttr = replaceSizeAttr;
|
29
|
+
function removeClosingTag(sourceCodeLocation, recorder, templateOffset) {
|
30
|
+
const { endTag } = sourceCodeLocation;
|
31
|
+
const { startOffset, endOffset } = endTag;
|
32
|
+
const from = templateOffset + startOffset;
|
33
|
+
const to = endOffset - startOffset;
|
34
|
+
recorder.remove(from, to);
|
35
|
+
}
|
36
|
+
exports.removeClosingTag = removeClosingTag;
|
37
|
+
function closeStartTag({ startTag }, recorder, templateOffset) {
|
38
|
+
recorder.insertRight(templateOffset + startTag.endOffset - 1, `/`);
|
39
|
+
}
|
40
|
+
exports.closeStartTag = closeStartTag;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./migrate-checkbox"), exports);
|
5
|
+
tslib_1.__exportStar(require("./migrate-radio"), exports);
|
6
|
+
tslib_1.__exportStar(require("./migrate-toggle"), exports);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../../../interfaces';
|
4
|
+
export declare function migrateCheckbox({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateCheckbox = void 0;
|
4
|
+
const elements_1 = require("../../../../../utils/templates/elements");
|
5
|
+
const template_resource_1 = require("../../../../../utils/templates/template-resource");
|
6
|
+
const common_1 = require("./common");
|
7
|
+
function migrateCheckbox({ resource, recorder, fileSystem, }) {
|
8
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
9
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
10
|
+
const elements = elements_1.findElementsByTagName(template, `tui-checkbox`);
|
11
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
+
if (!sourceCodeLocation) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
common_1.replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset);
|
16
|
+
common_1.replaceOpenTag(sourceCodeLocation, recorder, templateOffset, {
|
17
|
+
tag: `tui-checkbox`,
|
18
|
+
directive: `tuiCheckbox`,
|
19
|
+
type: `checkbox`,
|
20
|
+
});
|
21
|
+
common_1.closeStartTag(sourceCodeLocation, recorder, templateOffset);
|
22
|
+
common_1.removeClosingTag(sourceCodeLocation, recorder, templateOffset);
|
23
|
+
});
|
24
|
+
}
|
25
|
+
exports.migrateCheckbox = migrateCheckbox;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../../../interfaces';
|
4
|
+
export declare function migrateRadio({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateRadio = void 0;
|
4
|
+
const elements_1 = require("../../../../../utils/templates/elements");
|
5
|
+
const template_resource_1 = require("../../../../../utils/templates/template-resource");
|
6
|
+
const common_1 = require("./common");
|
7
|
+
function migrateRadio({ resource, recorder, fileSystem, }) {
|
8
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
9
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
10
|
+
const elements = elements_1.findElementsByTagName(template, `tui-radio`);
|
11
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
+
if (!sourceCodeLocation) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
common_1.replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset);
|
16
|
+
common_1.replaceOpenTag(sourceCodeLocation, recorder, templateOffset, {
|
17
|
+
tag: `tui-radio`,
|
18
|
+
directive: `tuiRadio`,
|
19
|
+
type: `radio`,
|
20
|
+
});
|
21
|
+
common_1.closeStartTag(sourceCodeLocation, recorder, templateOffset);
|
22
|
+
common_1.removeClosingTag(sourceCodeLocation, recorder, templateOffset);
|
23
|
+
});
|
24
|
+
}
|
25
|
+
exports.migrateRadio = migrateRadio;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../../../interfaces';
|
4
|
+
export declare function migrateToggle({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateToggle = void 0;
|
4
|
+
const elements_1 = require("../../../../../utils/templates/elements");
|
5
|
+
const template_resource_1 = require("../../../../../utils/templates/template-resource");
|
6
|
+
const common_1 = require("./common");
|
7
|
+
function migrateToggle({ resource, recorder, fileSystem, }) {
|
8
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
9
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
10
|
+
const elements = elements_1.findElementsByTagName(template, `tui-toggle`);
|
11
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
+
if (!sourceCodeLocation) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
common_1.replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset);
|
16
|
+
common_1.replaceOpenTag(sourceCodeLocation, recorder, templateOffset, {
|
17
|
+
tag: `tui-toggle`,
|
18
|
+
directive: `tuiToggle`,
|
19
|
+
type: `checkbox`,
|
20
|
+
});
|
21
|
+
common_1.closeStartTag(sourceCodeLocation, recorder, templateOffset);
|
22
|
+
common_1.removeClosingTag(sourceCodeLocation, recorder, templateOffset);
|
23
|
+
});
|
24
|
+
}
|
25
|
+
exports.migrateToggle = migrateToggle;
|