@eui/core 22.0.0-alpha.46 → 22.0.0-alpha.47
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 +9 -0
- package/docs/changelog.html +22 -0
- package/docs/js/search/search_index.js +2 -2
- package/docs/json/documentation.json +30 -30
- package/docs/llms.txt +1 -1
- package/docs/properties.html +1 -1
- package/package.json +2 -2
|
@@ -2289,12 +2289,12 @@
|
|
|
2289
2289
|
},
|
|
2290
2290
|
{
|
|
2291
2291
|
"name": "Schema",
|
|
2292
|
-
"id": "interface-Schema-
|
|
2293
|
-
"file": "packages/core/schematics/migrate/
|
|
2292
|
+
"id": "interface-Schema-e96d29c1785a16147de773cebe7ab5d4ed82aa23c6b1f7737113252a14d156e236f46f7a16340432dec900b664c8005be0aef5d0a628c2f5b8dd2ec7e41edf56-3",
|
|
2293
|
+
"file": "packages/core/schematics/migrate-eui-accent/index.ts",
|
|
2294
2294
|
"deprecated": false,
|
|
2295
2295
|
"deprecationMessage": "",
|
|
2296
2296
|
"type": "interface",
|
|
2297
|
-
"sourceCode": "
|
|
2297
|
+
"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",
|
|
2298
2298
|
"displayName": "Schema",
|
|
2299
2299
|
"properties": [
|
|
2300
2300
|
{
|
|
@@ -2305,21 +2305,9 @@
|
|
|
2305
2305
|
"type": "boolean",
|
|
2306
2306
|
"indexKey": "",
|
|
2307
2307
|
"optional": true,
|
|
2308
|
-
"description": "
|
|
2309
|
-
"line":
|
|
2310
|
-
"rawdescription": "\
|
|
2311
|
-
},
|
|
2312
|
-
{
|
|
2313
|
-
"name": "mwp",
|
|
2314
|
-
"coverageIgnore": false,
|
|
2315
|
-
"deprecated": false,
|
|
2316
|
-
"deprecationMessage": "",
|
|
2317
|
-
"type": "boolean",
|
|
2318
|
-
"indexKey": "",
|
|
2319
|
-
"optional": true,
|
|
2320
|
-
"description": "<p>Whether to apply MyWorkplace-specific replacements</p>\n",
|
|
2321
|
-
"line": 5,
|
|
2322
|
-
"rawdescription": "\nWhether to apply MyWorkplace-specific replacements"
|
|
2308
|
+
"description": "",
|
|
2309
|
+
"line": 8,
|
|
2310
|
+
"rawdescription": "\n"
|
|
2323
2311
|
},
|
|
2324
2312
|
{
|
|
2325
2313
|
"name": "path",
|
|
@@ -2329,9 +2317,9 @@
|
|
|
2329
2317
|
"type": "string",
|
|
2330
2318
|
"indexKey": "",
|
|
2331
2319
|
"optional": true,
|
|
2332
|
-
"description": "
|
|
2333
|
-
"line":
|
|
2334
|
-
"rawdescription": "\
|
|
2320
|
+
"description": "",
|
|
2321
|
+
"line": 7,
|
|
2322
|
+
"rawdescription": "\n"
|
|
2335
2323
|
}
|
|
2336
2324
|
],
|
|
2337
2325
|
"indexSignatures": [],
|
|
@@ -2348,12 +2336,12 @@
|
|
|
2348
2336
|
},
|
|
2349
2337
|
{
|
|
2350
2338
|
"name": "Schema",
|
|
2351
|
-
"id": "interface-Schema-
|
|
2352
|
-
"file": "packages/core/schematics/migrate
|
|
2339
|
+
"id": "interface-Schema-56b9fe60701ca349dc90e152829b0a18bb7a8a9bb303c4bac05f9764cd2e933cce0879775ca17168b4c881e202d0258af3668a2a3a1b940e561f7e4b2349b5cc-4",
|
|
2340
|
+
"file": "packages/core/schematics/migrate/schema.ts",
|
|
2353
2341
|
"deprecated": false,
|
|
2354
2342
|
"deprecationMessage": "",
|
|
2355
2343
|
"type": "interface",
|
|
2356
|
-
"sourceCode": "
|
|
2344
|
+
"sourceCode": "export interface Schema {\n /** The path to scan for files to migrate */\n path?: string;\n /** Whether to apply MyWorkplace-specific replacements */\n mwp?: boolean;\n /** Whether to perform a dry run without making changes */\n dryRun?: boolean;\n}\n",
|
|
2357
2345
|
"displayName": "Schema",
|
|
2358
2346
|
"properties": [
|
|
2359
2347
|
{
|
|
@@ -2364,9 +2352,21 @@
|
|
|
2364
2352
|
"type": "boolean",
|
|
2365
2353
|
"indexKey": "",
|
|
2366
2354
|
"optional": true,
|
|
2367
|
-
"description": "",
|
|
2368
|
-
"line":
|
|
2369
|
-
"rawdescription": "\
|
|
2355
|
+
"description": "<p>Whether to perform a dry run without making changes</p>\n",
|
|
2356
|
+
"line": 7,
|
|
2357
|
+
"rawdescription": "\nWhether to perform a dry run without making changes"
|
|
2358
|
+
},
|
|
2359
|
+
{
|
|
2360
|
+
"name": "mwp",
|
|
2361
|
+
"coverageIgnore": false,
|
|
2362
|
+
"deprecated": false,
|
|
2363
|
+
"deprecationMessage": "",
|
|
2364
|
+
"type": "boolean",
|
|
2365
|
+
"indexKey": "",
|
|
2366
|
+
"optional": true,
|
|
2367
|
+
"description": "<p>Whether to apply MyWorkplace-specific replacements</p>\n",
|
|
2368
|
+
"line": 5,
|
|
2369
|
+
"rawdescription": "\nWhether to apply MyWorkplace-specific replacements"
|
|
2370
2370
|
},
|
|
2371
2371
|
{
|
|
2372
2372
|
"name": "path",
|
|
@@ -2376,9 +2376,9 @@
|
|
|
2376
2376
|
"type": "string",
|
|
2377
2377
|
"indexKey": "",
|
|
2378
2378
|
"optional": true,
|
|
2379
|
-
"description": "",
|
|
2380
|
-
"line":
|
|
2381
|
-
"rawdescription": "\
|
|
2379
|
+
"description": "<p>The path to scan for files to migrate</p>\n",
|
|
2380
|
+
"line": 3,
|
|
2381
|
+
"rawdescription": "\nThe path to scan for files to migrate"
|
|
2382
2382
|
}
|
|
2383
2383
|
],
|
|
2384
2384
|
"indexSignatures": [],
|
package/docs/llms.txt
CHANGED
package/docs/properties.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eui/core",
|
|
3
|
-
"version": "22.0.0-alpha.
|
|
3
|
+
"version": "22.0.0-alpha.47",
|
|
4
4
|
"tag": "next",
|
|
5
5
|
"description": "eUI core package - holding UI components for Desktop applications",
|
|
6
6
|
"homepage": "https://eui.ecdevops.eu",
|
|
@@ -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": "22.0.0-alpha.
|
|
13
|
+
"@eui/base": "22.0.0-alpha.47",
|
|
14
14
|
"rxjs": "^7.8.0",
|
|
15
15
|
"extend": "^3.0.2",
|
|
16
16
|
"localforage": "^1.10.0",
|