@eui/core 21.3.2-snapshot-1782201285458 → 21.3.2
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/CHANGELOG.md +21 -0
- package/docs/js/search/search_index.js +2 -2
- package/docs/json/documentation.json +18 -18
- package/docs/properties.html +1 -1
- package/package.json +3 -3
|
@@ -1748,12 +1748,12 @@
|
|
|
1748
1748
|
},
|
|
1749
1749
|
{
|
|
1750
1750
|
"name": "Schema",
|
|
1751
|
-
"id": "interface-Schema-
|
|
1752
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
1751
|
+
"id": "interface-Schema-585b211d989563bbec5bd67bcdb58d5f264396adbe0ed2e51d0b4a0ecaf8b3ec36d821647c170d616bb409fc603c5a4c0e699eb7511e02c6add8d8670fc9cb9f-4",
|
|
1752
|
+
"file": "packages/core/schematics/migrate-eui-alert/index.ts",
|
|
1753
1753
|
"deprecated": false,
|
|
1754
1754
|
"deprecationMessage": "",
|
|
1755
1755
|
"type": "interface",
|
|
1756
|
-
"sourceCode": "import { parseTemplate, TmplAstElement, TmplAstNode } from '@angular/compiler';\nimport { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nconst
|
|
1756
|
+
"sourceCode": "import { parseTemplate, TmplAstBoundAttribute, TmplAstElement, TmplAstNode, TmplAstTextAttribute } from '@angular/compiler';\nimport { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nconst REMOVED_INPUTS = new Set(['alertIconType', 'alertIconFillColor', 'isMuted', 'isBordered']);\n\nexport function migrateEuiAlert(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let count = 0;\n\n const dir = tree.getDir(scanPath || '/');\n visitDir(dir, (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes('eui-alert') && !original.includes('euiAlert')) return;\n\n const result = path.endsWith('.html')\n ? migrateTemplate(original)\n : migrateInlineTemplates(original);\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would remove deprecated inputs in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n count++;\n }\n\n // Warn about TS property access usages\n if (path.endsWith('.ts') && !path.endsWith('.spec.ts')) {\n if (![...REMOVED_INPUTS].some((input) => original.includes(input))) return;\n\n const sourceFile = ts.createSourceFile(path, original, ts.ScriptTarget.Latest, true);\n\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && REMOVED_INPUTS.has(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${path}:${line + 1} - Manual action needed: \"${node.name.text}\" is no longer a valid input on eui-alert. Remove this assignment.`,\n );\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n }\n });\n\n context.logger.info(`Removed deprecated eui-alert inputs from ${count} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.html') && !file.endsWith('.ts')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n\nfunction migrateTemplate(source: string): string {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const removals: { start: number; end: number }[] = [];\n\n visitNodes(parsed.nodes, removals);\n\n // Apply removals in reverse order\n let result = source;\n for (const { start, end } of removals.sort((a, b) => b.start - a.start)) {\n result = result.slice(0, start) + result.slice(end);\n }\n\n return result;\n}\n\nfunction migrateInlineTemplates(source: string): string {\n // Simple approach: find template strings containing eui-alert and process them\n const templateRegex = /template\\s*:\\s*`([^`]*)`/gs;\n return source.replace(templateRegex, (match, templateContent: string) => {\n if (!templateContent.includes('eui-alert') && !templateContent.includes('euiAlert')) return match;\n const migrated = migrateTemplate(templateContent);\n if (migrated === templateContent) return match;\n return match.replace(templateContent, migrated);\n });\n}\n\nfunction visitNodes(nodes: TmplAstNode[], removals: { start: number; end: number }[]): void {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (node.name === 'eui-alert' || hasAttribute(node, 'euiAlert')) {\n collectRemovals(node, removals);\n }\n visitNodes(node.children, removals);\n }\n }\n}\n\nfunction hasAttribute(element: TmplAstElement, name: string): boolean {\n return element.attributes.some((a) => a.name === name);\n}\n\nfunction collectRemovals(element: TmplAstElement, removals: { start: number; end: number }[]): void {\n for (const attr of element.attributes) {\n if (REMOVED_INPUTS.has(attr.name)) {\n removals.push(getAttributeSpan(attr));\n }\n }\n for (const input of element.inputs) {\n if (REMOVED_INPUTS.has(input.name)) {\n removals.push(getAttributeSpan(input));\n }\n }\n}\n\nfunction getAttributeSpan(attr: TmplAstTextAttribute | TmplAstBoundAttribute): { start: number; end: number } {\n return { start: attr.sourceSpan.start.offset, end: attr.sourceSpan.end.offset };\n}\n",
|
|
1757
1757
|
"properties": [
|
|
1758
1758
|
{
|
|
1759
1759
|
"name": "dryRun",
|
|
@@ -1786,12 +1786,12 @@
|
|
|
1786
1786
|
},
|
|
1787
1787
|
{
|
|
1788
1788
|
"name": "Schema",
|
|
1789
|
-
"id": "interface-Schema-
|
|
1790
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
1789
|
+
"id": "interface-Schema-e96d29c1785a16147de773cebe7ab5d4ed82aa23c6b1f7737113252a14d156e236f46f7a16340432dec900b664c8005be0aef5d0a628c2f5b8dd2ec7e41edf56-5",
|
|
1790
|
+
"file": "packages/core/schematics/migrate-eui-accent/index.ts",
|
|
1791
1791
|
"deprecated": false,
|
|
1792
1792
|
"deprecationMessage": "",
|
|
1793
1793
|
"type": "interface",
|
|
1794
|
-
"sourceCode": "import { parseTemplate,
|
|
1794
|
+
"sourceCode": "import { parseTemplate, TmplAstElement, TmplAstNode } from '@angular/compiler';\nimport { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nconst OLD_NAME = 'euiAccent';\nconst NEW_NAME = 'euiPrimary';\nconst EUI_DIRECTIVES = ['euiButton', 'euiList', 'euiListItem'];\n\nexport function migrateEuiAccent(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let count = 0;\n\n const dir = tree.getDir(scanPath || '/');\n visitDir(dir, (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_NAME)) return;\n\n let result: string;\n\n if (path.endsWith('.html')) {\n result = migrateTemplate(original);\n } else {\n result = migrateInlineTemplates(original);\n result = renameTsPropertyAccesses(result);\n }\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would replace '${OLD_NAME}' → '${NEW_NAME}' in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n count++;\n }\n });\n\n context.logger.info(`Renamed '${OLD_NAME}' → '${NEW_NAME}' on EUI components in ${count} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.html') && !file.endsWith('.ts')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n\nfunction isEuiElement(element: TmplAstElement): boolean {\n if (element.name.startsWith('eui-')) return true;\n return element.attributes.some((a) => EUI_DIRECTIVES.includes(a.name)) ||\n element.inputs.some((i) => EUI_DIRECTIVES.includes(i.name));\n}\n\nfunction migrateTemplate(source: string): string {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const edits: { start: number; end: number; replacement: string }[] = [];\n\n visitNodes(parsed.nodes, edits);\n\n return applyEdits(source, edits);\n}\n\nfunction migrateInlineTemplates(source: string): string {\n const sourceFile = ts.createSourceFile('', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const changes: { start: number; end: number; text: string }[] = [];\n\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAssignment(node) && isTemplateProperty(node) && isComponentMetadataProperty(node)) {\n const init = unwrapExpression(node.initializer);\n if (ts.isStringLiteral(init) || ts.isNoSubstitutionTemplateLiteral(init)) {\n const start = init.getStart(sourceFile) + 1;\n const end = init.getEnd() - 1;\n const rawTemplate = source.slice(start, end);\n if (!rawTemplate.includes(OLD_NAME)) {\n ts.forEachChild(node, visit); return; \n}\n const migrated = migrateTemplate(rawTemplate);\n if (migrated !== rawTemplate) changes.push({ start, end, text: migrated });\n }\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n let result = source;\n for (const change of changes.sort((a, b) => b.start - a.start)) {\n result = result.slice(0, change.start) + change.text + result.slice(change.end);\n }\n return result;\n}\n\nfunction renameTsPropertyAccesses(source: string): string {\n const sourceFile = ts.createSourceFile('', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: { start: number; end: number; replacement: string }[] = [];\n\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && node.name.text === OLD_NAME) {\n edits.push({ start: node.name.getStart(sourceFile), end: node.name.getEnd(), replacement: NEW_NAME });\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n return applyEdits(source, edits);\n}\n\nfunction isTemplateProperty(node: ts.PropertyAssignment): boolean {\n const name = node.name;\n return (ts.isIdentifier(name) && name.text === 'template') || (ts.isStringLiteral(name) && name.text === 'template');\n}\n\nfunction isComponentMetadataProperty(node: ts.PropertyAssignment): boolean {\n const objectLiteral = node.parent;\n if (!ts.isObjectLiteralExpression(objectLiteral)) return false;\n const callExpression = objectLiteral.parent;\n if (!ts.isCallExpression(callExpression) || callExpression.arguments[0] !== objectLiteral) return false;\n return ts.isDecorator(callExpression.parent) && ts.isIdentifier(callExpression.expression) && callExpression.expression.text === 'Component';\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression;\n while (ts.isParenthesizedExpression(current)) current = current.expression;\n return current;\n}\n\nfunction visitNodes(nodes: TmplAstNode[], edits: { start: number; end: number; replacement: string }[]): void {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (isEuiElement(node)) collectRenames(node, edits);\n visitNodes(node.children, edits);\n }\n }\n}\n\nfunction collectRenames(element: TmplAstElement, edits: { start: number; end: number; replacement: string }[]): void {\n for (const attr of element.attributes) {\n if (attr.name === OLD_NAME) {\n edits.push({ start: attr.keySpan!.start.offset, end: attr.keySpan!.end.offset, replacement: NEW_NAME });\n }\n }\n for (const input of element.inputs) {\n if (input.name === OLD_NAME) {\n edits.push({ start: input.keySpan!.start.offset, end: input.keySpan!.end.offset, replacement: NEW_NAME });\n }\n }\n}\n\nfunction applyEdits(source: string, edits: { start: number; end: number; replacement: string }[]): string {\n let result = source;\n for (const edit of edits.sort((a, b) => b.start - a.start)) {\n result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);\n }\n return result;\n}\n",
|
|
1795
1795
|
"properties": [
|
|
1796
1796
|
{
|
|
1797
1797
|
"name": "dryRun",
|
|
@@ -28100,7 +28100,7 @@
|
|
|
28100
28100
|
},
|
|
28101
28101
|
{
|
|
28102
28102
|
"name": "migrateInlineTemplates",
|
|
28103
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
28103
|
+
"file": "packages/core/schematics/migrate-eui-alert/index.ts",
|
|
28104
28104
|
"ctype": "miscellaneous",
|
|
28105
28105
|
"subtype": "function",
|
|
28106
28106
|
"deprecated": false,
|
|
@@ -28129,7 +28129,7 @@
|
|
|
28129
28129
|
},
|
|
28130
28130
|
{
|
|
28131
28131
|
"name": "migrateInlineTemplates",
|
|
28132
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
28132
|
+
"file": "packages/core/schematics/migrate-eui-accent/index.ts",
|
|
28133
28133
|
"ctype": "miscellaneous",
|
|
28134
28134
|
"subtype": "function",
|
|
28135
28135
|
"deprecated": false,
|
|
@@ -28595,7 +28595,7 @@
|
|
|
28595
28595
|
},
|
|
28596
28596
|
{
|
|
28597
28597
|
"name": "migrateTemplate",
|
|
28598
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
28598
|
+
"file": "packages/core/schematics/migrate-eui-alert/index.ts",
|
|
28599
28599
|
"ctype": "miscellaneous",
|
|
28600
28600
|
"subtype": "function",
|
|
28601
28601
|
"deprecated": false,
|
|
@@ -28624,7 +28624,7 @@
|
|
|
28624
28624
|
},
|
|
28625
28625
|
{
|
|
28626
28626
|
"name": "migrateTemplate",
|
|
28627
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
28627
|
+
"file": "packages/core/schematics/migrate-eui-accent/index.ts",
|
|
28628
28628
|
"ctype": "miscellaneous",
|
|
28629
28629
|
"subtype": "function",
|
|
28630
28630
|
"deprecated": false,
|
|
@@ -31074,7 +31074,7 @@
|
|
|
31074
31074
|
},
|
|
31075
31075
|
{
|
|
31076
31076
|
"name": "visitDir",
|
|
31077
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
31077
|
+
"file": "packages/core/schematics/migrate-eui-alert/index.ts",
|
|
31078
31078
|
"ctype": "miscellaneous",
|
|
31079
31079
|
"subtype": "function",
|
|
31080
31080
|
"deprecated": false,
|
|
@@ -31116,7 +31116,7 @@
|
|
|
31116
31116
|
},
|
|
31117
31117
|
{
|
|
31118
31118
|
"name": "visitDir",
|
|
31119
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
31119
|
+
"file": "packages/core/schematics/migrate-eui-accent/index.ts",
|
|
31120
31120
|
"ctype": "miscellaneous",
|
|
31121
31121
|
"subtype": "function",
|
|
31122
31122
|
"deprecated": false,
|
|
@@ -31830,7 +31830,7 @@
|
|
|
31830
31830
|
},
|
|
31831
31831
|
{
|
|
31832
31832
|
"name": "visitNodes",
|
|
31833
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
31833
|
+
"file": "packages/core/schematics/migrate-eui-alert/index.ts",
|
|
31834
31834
|
"ctype": "miscellaneous",
|
|
31835
31835
|
"subtype": "function",
|
|
31836
31836
|
"deprecated": false,
|
|
@@ -31843,7 +31843,7 @@
|
|
|
31843
31843
|
"deprecationMessage": ""
|
|
31844
31844
|
},
|
|
31845
31845
|
{
|
|
31846
|
-
"name": "
|
|
31846
|
+
"name": "removals",
|
|
31847
31847
|
"deprecated": false,
|
|
31848
31848
|
"deprecationMessage": ""
|
|
31849
31849
|
}
|
|
@@ -31859,7 +31859,7 @@
|
|
|
31859
31859
|
}
|
|
31860
31860
|
},
|
|
31861
31861
|
{
|
|
31862
|
-
"name": "
|
|
31862
|
+
"name": "removals",
|
|
31863
31863
|
"deprecated": false,
|
|
31864
31864
|
"deprecationMessage": "",
|
|
31865
31865
|
"tagName": {
|
|
@@ -31870,7 +31870,7 @@
|
|
|
31870
31870
|
},
|
|
31871
31871
|
{
|
|
31872
31872
|
"name": "visitNodes",
|
|
31873
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
31873
|
+
"file": "packages/core/schematics/migrate-eui-accent/index.ts",
|
|
31874
31874
|
"ctype": "miscellaneous",
|
|
31875
31875
|
"subtype": "function",
|
|
31876
31876
|
"deprecated": false,
|
|
@@ -31883,7 +31883,7 @@
|
|
|
31883
31883
|
"deprecationMessage": ""
|
|
31884
31884
|
},
|
|
31885
31885
|
{
|
|
31886
|
-
"name": "
|
|
31886
|
+
"name": "edits",
|
|
31887
31887
|
"deprecated": false,
|
|
31888
31888
|
"deprecationMessage": ""
|
|
31889
31889
|
}
|
|
@@ -31899,7 +31899,7 @@
|
|
|
31899
31899
|
}
|
|
31900
31900
|
},
|
|
31901
31901
|
{
|
|
31902
|
-
"name": "
|
|
31902
|
+
"name": "edits",
|
|
31903
31903
|
"deprecated": false,
|
|
31904
31904
|
"deprecationMessage": "",
|
|
31905
31905
|
"tagName": {
|
package/docs/properties.html
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eui/core",
|
|
3
|
-
"version": "21.3.2
|
|
4
|
-
"tag": "
|
|
3
|
+
"version": "21.3.2",
|
|
4
|
+
"tag": "latest",
|
|
5
5
|
"description": "eUI core package - holding UI components for Desktop applications",
|
|
6
6
|
"homepage": "https://eui.ecdevops.eu",
|
|
7
7
|
"author": "ec.europa.eui@gmail.com",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://sdlc.webcloud.ec.europa.eu/csdr/eui/eui.git"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@eui/base": "21.3.2
|
|
13
|
+
"@eui/base": "21.3.2",
|
|
14
14
|
"rxjs": "^7.8.0",
|
|
15
15
|
"extend": "^3.0.2",
|
|
16
16
|
"localforage": "^1.10.0",
|