@eui/core 23.0.0-alpha.6 → 23.0.0-alpha.7
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 +31 -0
- package/docs/changelog.html +41 -0
- package/docs/interfaces/Schema-1.html +13 -1
- package/docs/interfaces/Schema-16.html +1 -1
- package/docs/interfaces/Schema-17.html +1 -1
- package/docs/interfaces/Schema-2.html +52 -1
- package/docs/interfaces/Schema-20.html +1 -1
- package/docs/interfaces/Schema-21.html +1 -1
- package/docs/interfaces/Schema-3.html +15 -33
- package/docs/interfaces/Schema-4.html +1 -1
- package/docs/interfaces/Schema-5.html +1 -1
- package/docs/interfaces/Schema-6.html +1 -1
- package/docs/interfaces/Schema-7.html +1 -1
- package/docs/interfaces/Schema-8.html +1 -1
- package/docs/interfaces/Schema.html +1 -46
- package/docs/interfaces/UIState.html +45 -0
- package/docs/js/search/search_index.js +2 -2
- package/docs/json/documentation.json +624 -612
- package/docs/llms.txt +69 -68
- package/docs/miscellaneous/functions.html +563 -563
- package/docs/miscellaneous/variables.html +9 -8
- package/docs/properties.html +1 -1
- package/fesm2022/eui-core.mjs +7 -0
- package/fesm2022/eui-core.mjs.map +1 -1
- package/package.json +2 -2
- package/types/eui-core.d.ts +1 -0
- package/types/eui-core.d.ts.map +1 -1
|
@@ -909,12 +909,12 @@
|
|
|
909
909
|
},
|
|
910
910
|
{
|
|
911
911
|
"name": "Edit",
|
|
912
|
-
"id": "interface-Edit-
|
|
913
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
912
|
+
"id": "interface-Edit-d36032102ed30a7ada1e3d36bb9ca41b7234b855760cac9783a25818f7ffe2097e1ebd8e808b574ddec0760f827272f6cd561f45f3eb1578f87f39ee2633730a-2",
|
|
913
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
914
914
|
"deprecated": false,
|
|
915
915
|
"deprecationMessage": "",
|
|
916
916
|
"type": "interface",
|
|
917
|
-
"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\nconst OLD_TAG = 'eui-toolbar-menu';\nconst NEW_TAG = 'eui-toolbar-mega-menu';\nconst OLD_COMPONENT = 'EuiToolbarMenuComponent';\nconst NEW_COMPONENT = 'EuiToolbarMegaMenuComponent';\nconst OLD_INTERFACE = 'ToolbarItem';\nconst NEW_INTERFACE = 'EuiMenuItem';\nconst NEW_COMPONENT_PATH = '@eui/components/layout';\nconst NEW_INTERFACE_PATH = '@eui/core';\nconst REMOVED_OUTPUT = 'menuItemClick';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nexport function migrateEuiToolbarMenu(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_TAG) && !original.includes(OLD_COMPONENT) && !original.includes(OLD_INTERFACE)) return;\n\n let result: string;\n\n if (path.endsWith('.html')) {\n result = migrateTemplate(original, path, context);\n } else {\n result = migrateTypeScript(original, path, context);\n }\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would migrate eui-toolbar-menu → eui-toolbar-mega-menu in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n fileCount++;\n }\n });\n\n context.logger.info(`Migrated eui-toolbar-menu → eui-toolbar-mega-menu in ${fileCount} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction migrateTemplate(source: string, filePath: string, context: SchematicContext): string {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const edits: Edit[] = [];\n\n visitNodes(parsed.nodes, source, edits, filePath, context);\n\n return applyEdits(source, edits);\n}\n\nfunction migrateTypeScript(source: string, filePath: string, context: SchematicContext): string {\n let result = migrateInlineTemplates(source, filePath, context);\n result = migrateImportsAndTypes(result, filePath, context);\n return result;\n}\n\nfunction migrateInlineTemplates(source: string, filePath: string, context: SchematicContext): string {\n const sourceFile = ts.createSourceFile('', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const changes: Edit[] = [];\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_TAG)) {\n ts.forEachChild(node, visit); return; \n}\n const migrated = migrateTemplate(rawTemplate, filePath, context);\n if (migrated !== rawTemplate) changes.push({ start, end, replacement: migrated });\n }\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n return applyEdits(source, changes);\n}\n\nfunction migrateImportsAndTypes(source: string, filePath: string, context: SchematicContext): string {\n if (!source.includes(OLD_COMPONENT) && !source.includes(OLD_INTERFACE)) return source;\n\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n\n // Track if EuiMenuItem is already imported from @eui/core\n let hasEuiMenuItemImport = false;\n\n // First pass: analyze imports\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const moduleSpec = (stmt.moduleSpecifier as ts.StringLiteral).text;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n for (const specifier of namedBindings.elements) {\n if (specifier.name.text === NEW_INTERFACE && moduleSpec === NEW_INTERFACE_PATH) {\n hasEuiMenuItemImport = true;\n }\n }\n }\n\n // Second pass: collect edits for import declarations\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n const moduleSpec = stmt.moduleSpecifier as ts.StringLiteral;\n const specifiers = namedBindings.elements;\n const hasComponent = specifiers.some((s) => s.name.text === OLD_COMPONENT);\n const hasInterface = specifiers.some((s) => s.name.text === OLD_INTERFACE);\n\n if (hasComponent && hasInterface) {\n // Both are in the same import → must split into two different paths\n const others = specifiers.filter((s) => s.name.text !== OLD_COMPONENT && s.name.text !== OLD_INTERFACE);\n const lines: string[] = [];\n lines.push(`import { ${NEW_COMPONENT} } from '${NEW_COMPONENT_PATH}';`);\n if (!hasEuiMenuItemImport) {\n lines.push(`import { ${NEW_INTERFACE} } from '${NEW_INTERFACE_PATH}';`);\n }\n if (others.length > 0) {\n const otherNames = others.map((s) => s.name.text).join(', ');\n lines.push(`import { ${otherNames} } from '${moduleSpec.text}';`);\n }\n edits.push({\n start: stmt.getStart(sourceFile),\n end: stmt.getEnd(),\n replacement: lines.join('\\n'),\n });\n } else if (hasComponent) {\n edits.push({\n start: moduleSpec.getStart(sourceFile) + 1,\n end: moduleSpec.getEnd() - 1,\n replacement: NEW_COMPONENT_PATH,\n });\n for (const specifier of specifiers) {\n if (specifier.name.text === OLD_COMPONENT) {\n edits.push({\n start: specifier.name.getStart(sourceFile),\n end: specifier.name.getEnd(),\n replacement: NEW_COMPONENT,\n });\n }\n }\n } else if (hasInterface) {\n if (hasEuiMenuItemImport) {\n removeImportSpecifier(namedBindings, specifiers.find((s) => s.name.text === OLD_INTERFACE)!, sourceFile, edits);\n } else {\n edits.push({\n start: moduleSpec.getStart(sourceFile) + 1,\n end: moduleSpec.getEnd() - 1,\n replacement: NEW_INTERFACE_PATH,\n });\n for (const specifier of specifiers) {\n if (specifier.name.text === OLD_INTERFACE) {\n edits.push({\n start: specifier.name.getStart(sourceFile),\n end: specifier.name.getEnd(),\n replacement: NEW_INTERFACE,\n });\n }\n }\n }\n }\n }\n\n // Third pass: rename identifier references in non-import positions\n const visitRefs = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) return; // skip imports (already handled)\n if (ts.isIdentifier(node)) {\n if (node.text === OLD_COMPONENT) {\n edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: NEW_COMPONENT });\n }\n if (node.text === OLD_INTERFACE) {\n edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: NEW_INTERFACE });\n }\n }\n ts.forEachChild(node, visitRefs);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitRefs(stmt);\n }\n }\n\n // Warn about ToolbarItem-specific properties\n warnRemovedProperties(sourceFile, filePath, context);\n\n return applyEdits(source, edits);\n}\n\nfunction removeImportSpecifier(\n namedImports: ts.NamedImports,\n specifier: ts.ImportSpecifier,\n sourceFile: ts.SourceFile,\n edits: Edit[],\n): void {\n const elements = namedImports.elements;\n if (elements.length === 1) {\n // Remove the entire import declaration\n const importDecl = namedImports.parent.parent;\n edits.push({\n start: importDecl.getStart(sourceFile),\n end: importDecl.getEnd(),\n replacement: '',\n });\n } else {\n // Remove just this specifier with surrounding comma/whitespace\n const idx = elements.indexOf(specifier);\n let start: number;\n let end: number;\n if (idx < elements.length - 1) {\n start = specifier.getStart(sourceFile);\n end = elements[idx + 1].getStart(sourceFile);\n } else {\n start = elements[idx - 1].getEnd();\n end = specifier.getEnd();\n }\n edits.push({ start, end, replacement: '' });\n }\n}\n\nfunction warnRemovedProperties(sourceFile: ts.SourceFile, filePath: string, context: SchematicContext): void {\n const deprecated = ['isHome', 'isSeparator'];\n\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && deprecated.includes(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${filePath}:${line + 1} - \"${node.name.text}\" was part of ToolbarItem but does not exist on EuiMenuItem. Review manually.`,\n );\n }\n if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && deprecated.includes(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${filePath}:${line + 1} - \"${node.name.text}\" was part of ToolbarItem but does not exist on EuiMenuItem. Review manually.`,\n );\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n}\n\nfunction visitNodes(nodes: TmplAstNode[], source: string, edits: Edit[], filePath: string, context: SchematicContext): void {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (node.name === OLD_TAG) {\n collectTagRenames(node, source, edits);\n collectOutputRemovals(node, source, edits, filePath, context);\n }\n visitNodes(node.children, source, edits, filePath, context);\n }\n }\n}\n\nfunction collectTagRenames(element: TmplAstElement, source: string, edits: Edit[]): void {\n // Rename opening tag\n const openStart = element.startSourceSpan.start.offset + 1; // skip '<'\n edits.push({ start: openStart, end: openStart + OLD_TAG.length, replacement: NEW_TAG });\n\n // Rename closing tag\n if (element.endSourceSpan) {\n const closeStart = element.endSourceSpan.start.offset + 2; // skip '</'\n edits.push({ start: closeStart, end: closeStart + OLD_TAG.length, replacement: NEW_TAG });\n }\n}\n\nfunction collectOutputRemovals(\n element: TmplAstElement,\n source: string,\n edits: Edit[],\n filePath: string,\n context: SchematicContext,\n): void {\n for (const output of element.outputs) {\n if (output.name === REMOVED_OUTPUT) {\n let start = output.sourceSpan.start.offset;\n // Remove leading whitespace\n while (start > 0 && (source[start - 1] === ' ' || source[start - 1] === '\\t')) {\n start--;\n }\n edits.push({ start, end: output.sourceSpan.end.offset, replacement: '' });\n\n const { line } = element.startSourceSpan.start;\n context.logger.warn(\n `${filePath}:${line + 1} - \"(menuItemClick)\" has been removed. There is no equivalent on eui-toolbar-mega-menu.`,\n );\n }\n }\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 applyEdits(source: string, edits: Edit[]): string {\n // Deduplicate edits at same position (e.g. module path edits when both Component and ToolbarItem are from same source)\n const unique = deduplicateEdits(edits);\n let result = source;\n for (const edit of unique.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\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}`;\n // Last wins for same range\n seen.set(key, edit);\n }\n return Array.from(seen.values());\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",
|
|
917
|
+
"sourceCode": "import { 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\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nconst OLD_CLASS = 'EuiTooltipConfig';\nconst NEW_INTERFACE = 'EuiTooltipInterface';\n\nexport function migrateEuiTooltip(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n if (!path.endsWith('.ts')) return;\n\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_CLASS)) return;\n\n const result = migrateTypeScript(original, path, context);\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would migrate EuiTooltipConfig → EuiTooltipInterface in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n fileCount++;\n }\n });\n\n context.logger.info(`Migrated EuiTooltipConfig → EuiTooltipInterface in ${fileCount} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction migrateTypeScript(source: string, filePath: string, context: SchematicContext): string {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n\n // Track if EuiTooltipInterface is already imported\n let hasInterfaceImport = false;\n let classImportDecl: ts.ImportDeclaration | null = null;\n let classImportModuleSpecifier: string | null = null;\n\n // First pass: analyze imports\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n for (const specifier of namedBindings.elements) {\n if (specifier.name.text === NEW_INTERFACE) {\n hasInterfaceImport = true;\n }\n if (specifier.name.text === OLD_CLASS) {\n classImportDecl = stmt;\n classImportModuleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n }\n }\n }\n\n // Second pass: handle import declarations\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n const specifiers = namedBindings.elements;\n const classSpecifier = specifiers.find((s) => s.name.text === OLD_CLASS);\n if (!classSpecifier) continue;\n\n if (hasInterfaceImport) {\n // EuiTooltipInterface is already imported elsewhere → remove EuiTooltipConfig from this import\n removeImportSpecifier(namedBindings, classSpecifier, sourceFile, edits);\n } else {\n // Rename EuiTooltipConfig → EuiTooltipInterface in the import\n edits.push({\n start: classSpecifier.name.getStart(sourceFile),\n end: classSpecifier.name.getEnd(),\n replacement: NEW_INTERFACE,\n });\n hasInterfaceImport = true;\n }\n }\n\n // Third pass: replace `new EuiTooltipConfig(...)` → spread/cast to interface\n const visitNewExpressions = (node: ts.Node): void => {\n if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === OLD_CLASS) {\n const args = node.arguments;\n if (args && args.length === 1) {\n const arg = args[0];\n // `new EuiTooltipConfig({ ... })` → `{ ... } as EuiTooltipInterface`\n // But if the argument is just a variable, we keep it: `varName as EuiTooltipInterface`\n const argText = source.slice(arg.getStart(sourceFile), arg.getEnd());\n\n if (ts.isObjectLiteralExpression(arg)) {\n // Inline object: `new EuiTooltipConfig({ x: 1 })` → `{ x: 1 }`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: argText,\n });\n } else {\n // Variable or expression: `new EuiTooltipConfig(opts)` → `opts`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: argText,\n });\n }\n } else if (!args || args.length === 0) {\n // `new EuiTooltipConfig()` → `{} as EuiTooltipInterface`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: `{} as ${NEW_INTERFACE}`,\n });\n }\n return; // don't recurse into children we've already replaced\n }\n ts.forEachChild(node, visitNewExpressions);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitNewExpressions(stmt);\n }\n }\n\n // Fourth pass: rename all remaining identifier references (type annotations, etc.)\n const visitRefs = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) return;\n // Skip nodes we already covered in new expressions\n if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === OLD_CLASS) return;\n\n if (ts.isIdentifier(node) && node.text === OLD_CLASS) {\n // Ensure this is not part of an import declaration\n if (!isPartOfImport(node)) {\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: NEW_INTERFACE,\n });\n }\n }\n ts.forEachChild(node, visitRefs);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitRefs(stmt);\n }\n }\n\n return applyEdits(source, edits);\n}\n\nfunction isPartOfImport(node: ts.Node): boolean {\n let current: ts.Node | undefined = node.parent;\n while (current) {\n if (ts.isImportDeclaration(current)) return true;\n current = current.parent;\n }\n return false;\n}\n\nfunction removeImportSpecifier(\n namedImports: ts.NamedImports,\n specifier: ts.ImportSpecifier,\n sourceFile: ts.SourceFile,\n edits: Edit[],\n): void {\n const elements = namedImports.elements;\n if (elements.length === 1) {\n // Remove the entire import declaration\n const importDecl = namedImports.parent.parent;\n let end = importDecl.getEnd();\n // Also remove trailing newline if present\n const fullText = sourceFile.getFullText();\n if (fullText[end] === '\\n') end++;\n edits.push({\n start: importDecl.getStart(sourceFile),\n end,\n replacement: '',\n });\n } else {\n // Remove just this specifier with surrounding comma/whitespace\n const idx = elements.indexOf(specifier);\n let start: number;\n let end: number;\n if (idx < elements.length - 1) {\n // Not the last → remove from this specifier start to next specifier start\n start = specifier.getStart(sourceFile);\n end = elements[idx + 1].getStart(sourceFile);\n } else {\n // Last element → remove from previous element end to this end\n start = elements[idx - 1].getEnd();\n end = specifier.getEnd();\n }\n edits.push({ start, end, replacement: '' });\n }\n}\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n const unique = deduplicateEdits(edits);\n let result = source;\n for (const edit of unique.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\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}`;\n seen.set(key, edit);\n }\n return Array.from(seen.values());\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('.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",
|
|
918
918
|
"displayName": "Edit",
|
|
919
919
|
"properties": [
|
|
920
920
|
{
|
|
@@ -926,7 +926,7 @@
|
|
|
926
926
|
"indexKey": "",
|
|
927
927
|
"optional": false,
|
|
928
928
|
"description": "",
|
|
929
|
-
"line":
|
|
929
|
+
"line": 12,
|
|
930
930
|
"rawdescription": "\n"
|
|
931
931
|
},
|
|
932
932
|
{
|
|
@@ -938,7 +938,7 @@
|
|
|
938
938
|
"indexKey": "",
|
|
939
939
|
"optional": false,
|
|
940
940
|
"description": "",
|
|
941
|
-
"line":
|
|
941
|
+
"line": 13,
|
|
942
942
|
"rawdescription": "\n"
|
|
943
943
|
},
|
|
944
944
|
{
|
|
@@ -950,7 +950,7 @@
|
|
|
950
950
|
"indexKey": "",
|
|
951
951
|
"optional": false,
|
|
952
952
|
"description": "",
|
|
953
|
-
"line":
|
|
953
|
+
"line": 11,
|
|
954
954
|
"rawdescription": "\n"
|
|
955
955
|
}
|
|
956
956
|
],
|
|
@@ -968,12 +968,12 @@
|
|
|
968
968
|
},
|
|
969
969
|
{
|
|
970
970
|
"name": "Edit",
|
|
971
|
-
"id": "interface-Edit-
|
|
972
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
971
|
+
"id": "interface-Edit-e1cd02924eb82a618c71a0b26c081bdd020519d2699aa0e2dc98640c4e0f347c3649b967c5fc87543e41bbbfabd1304835850ccc38f40684d6521c242b2030ed-3",
|
|
972
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
973
973
|
"deprecated": false,
|
|
974
974
|
"deprecationMessage": "",
|
|
975
975
|
"type": "interface",
|
|
976
|
-
"sourceCode": "import { 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\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nconst OLD_CLASS = 'EuiTooltipConfig';\nconst NEW_INTERFACE = 'EuiTooltipInterface';\n\nexport function migrateEuiTooltip(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n if (!path.endsWith('.ts')) return;\n\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_CLASS)) return;\n\n const result = migrateTypeScript(original, path, context);\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would migrate EuiTooltipConfig → EuiTooltipInterface in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n fileCount++;\n }\n });\n\n context.logger.info(`Migrated EuiTooltipConfig → EuiTooltipInterface in ${fileCount} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction migrateTypeScript(source: string, filePath: string, context: SchematicContext): string {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n\n // Track if EuiTooltipInterface is already imported\n let hasInterfaceImport = false;\n let classImportDecl: ts.ImportDeclaration | null = null;\n let classImportModuleSpecifier: string | null = null;\n\n // First pass: analyze imports\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n for (const specifier of namedBindings.elements) {\n if (specifier.name.text === NEW_INTERFACE) {\n hasInterfaceImport = true;\n }\n if (specifier.name.text === OLD_CLASS) {\n classImportDecl = stmt;\n classImportModuleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n }\n }\n }\n\n // Second pass: handle import declarations\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n const specifiers = namedBindings.elements;\n const classSpecifier = specifiers.find((s) => s.name.text === OLD_CLASS);\n if (!classSpecifier) continue;\n\n if (hasInterfaceImport) {\n // EuiTooltipInterface is already imported elsewhere → remove EuiTooltipConfig from this import\n removeImportSpecifier(namedBindings, classSpecifier, sourceFile, edits);\n } else {\n // Rename EuiTooltipConfig → EuiTooltipInterface in the import\n edits.push({\n start: classSpecifier.name.getStart(sourceFile),\n end: classSpecifier.name.getEnd(),\n replacement: NEW_INTERFACE,\n });\n hasInterfaceImport = true;\n }\n }\n\n // Third pass: replace `new EuiTooltipConfig(...)` → spread/cast to interface\n const visitNewExpressions = (node: ts.Node): void => {\n if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === OLD_CLASS) {\n const args = node.arguments;\n if (args && args.length === 1) {\n const arg = args[0];\n // `new EuiTooltipConfig({ ... })` → `{ ... } as EuiTooltipInterface`\n // But if the argument is just a variable, we keep it: `varName as EuiTooltipInterface`\n const argText = source.slice(arg.getStart(sourceFile), arg.getEnd());\n\n if (ts.isObjectLiteralExpression(arg)) {\n // Inline object: `new EuiTooltipConfig({ x: 1 })` → `{ x: 1 }`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: argText,\n });\n } else {\n // Variable or expression: `new EuiTooltipConfig(opts)` → `opts`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: argText,\n });\n }\n } else if (!args || args.length === 0) {\n // `new EuiTooltipConfig()` → `{} as EuiTooltipInterface`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: `{} as ${NEW_INTERFACE}`,\n });\n }\n return; // don't recurse into children we've already replaced\n }\n ts.forEachChild(node, visitNewExpressions);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitNewExpressions(stmt);\n }\n }\n\n // Fourth pass: rename all remaining identifier references (type annotations, etc.)\n const visitRefs = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) return;\n // Skip nodes we already covered in new expressions\n if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === OLD_CLASS) return;\n\n if (ts.isIdentifier(node) && node.text === OLD_CLASS) {\n // Ensure this is not part of an import declaration\n if (!isPartOfImport(node)) {\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: NEW_INTERFACE,\n });\n }\n }\n ts.forEachChild(node, visitRefs);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitRefs(stmt);\n }\n }\n\n return applyEdits(source, edits);\n}\n\nfunction isPartOfImport(node: ts.Node): boolean {\n let current: ts.Node | undefined = node.parent;\n while (current) {\n if (ts.isImportDeclaration(current)) return true;\n current = current.parent;\n }\n return false;\n}\n\nfunction removeImportSpecifier(\n namedImports: ts.NamedImports,\n specifier: ts.ImportSpecifier,\n sourceFile: ts.SourceFile,\n edits: Edit[],\n): void {\n const elements = namedImports.elements;\n if (elements.length === 1) {\n // Remove the entire import declaration\n const importDecl = namedImports.parent.parent;\n let end = importDecl.getEnd();\n // Also remove trailing newline if present\n const fullText = sourceFile.getFullText();\n if (fullText[end] === '\\n') end++;\n edits.push({\n start: importDecl.getStart(sourceFile),\n end,\n replacement: '',\n });\n } else {\n // Remove just this specifier with surrounding comma/whitespace\n const idx = elements.indexOf(specifier);\n let start: number;\n let end: number;\n if (idx < elements.length - 1) {\n // Not the last → remove from this specifier start to next specifier start\n start = specifier.getStart(sourceFile);\n end = elements[idx + 1].getStart(sourceFile);\n } else {\n // Last element → remove from previous element end to this end\n start = elements[idx - 1].getEnd();\n end = specifier.getEnd();\n }\n edits.push({ start, end, replacement: '' });\n }\n}\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n const unique = deduplicateEdits(edits);\n let result = source;\n for (const edit of unique.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\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}`;\n seen.set(key, edit);\n }\n return Array.from(seen.values());\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('.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",
|
|
976
|
+
"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\nconst OLD_TAG = 'eui-toolbar-menu';\nconst NEW_TAG = 'eui-toolbar-mega-menu';\nconst OLD_COMPONENT = 'EuiToolbarMenuComponent';\nconst NEW_COMPONENT = 'EuiToolbarMegaMenuComponent';\nconst OLD_INTERFACE = 'ToolbarItem';\nconst NEW_INTERFACE = 'EuiMenuItem';\nconst NEW_COMPONENT_PATH = '@eui/components/layout';\nconst NEW_INTERFACE_PATH = '@eui/core';\nconst REMOVED_OUTPUT = 'menuItemClick';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nexport function migrateEuiToolbarMenu(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_TAG) && !original.includes(OLD_COMPONENT) && !original.includes(OLD_INTERFACE)) return;\n\n let result: string;\n\n if (path.endsWith('.html')) {\n result = migrateTemplate(original, path, context);\n } else {\n result = migrateTypeScript(original, path, context);\n }\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would migrate eui-toolbar-menu → eui-toolbar-mega-menu in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n fileCount++;\n }\n });\n\n context.logger.info(`Migrated eui-toolbar-menu → eui-toolbar-mega-menu in ${fileCount} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction migrateTemplate(source: string, filePath: string, context: SchematicContext): string {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const edits: Edit[] = [];\n\n visitNodes(parsed.nodes, source, edits, filePath, context);\n\n return applyEdits(source, edits);\n}\n\nfunction migrateTypeScript(source: string, filePath: string, context: SchematicContext): string {\n let result = migrateInlineTemplates(source, filePath, context);\n result = migrateImportsAndTypes(result, filePath, context);\n return result;\n}\n\nfunction migrateInlineTemplates(source: string, filePath: string, context: SchematicContext): string {\n const sourceFile = ts.createSourceFile('', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const changes: Edit[] = [];\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_TAG)) {\n ts.forEachChild(node, visit); return; \n}\n const migrated = migrateTemplate(rawTemplate, filePath, context);\n if (migrated !== rawTemplate) changes.push({ start, end, replacement: migrated });\n }\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n return applyEdits(source, changes);\n}\n\nfunction migrateImportsAndTypes(source: string, filePath: string, context: SchematicContext): string {\n if (!source.includes(OLD_COMPONENT) && !source.includes(OLD_INTERFACE)) return source;\n\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n\n // Track if EuiMenuItem is already imported from @eui/core\n let hasEuiMenuItemImport = false;\n\n // First pass: analyze imports\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const moduleSpec = (stmt.moduleSpecifier as ts.StringLiteral).text;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n for (const specifier of namedBindings.elements) {\n if (specifier.name.text === NEW_INTERFACE && moduleSpec === NEW_INTERFACE_PATH) {\n hasEuiMenuItemImport = true;\n }\n }\n }\n\n // Second pass: collect edits for import declarations\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n const moduleSpec = stmt.moduleSpecifier as ts.StringLiteral;\n const specifiers = namedBindings.elements;\n const hasComponent = specifiers.some((s) => s.name.text === OLD_COMPONENT);\n const hasInterface = specifiers.some((s) => s.name.text === OLD_INTERFACE);\n\n if (hasComponent && hasInterface) {\n // Both are in the same import → must split into two different paths\n const others = specifiers.filter((s) => s.name.text !== OLD_COMPONENT && s.name.text !== OLD_INTERFACE);\n const lines: string[] = [];\n lines.push(`import { ${NEW_COMPONENT} } from '${NEW_COMPONENT_PATH}';`);\n if (!hasEuiMenuItemImport) {\n lines.push(`import { ${NEW_INTERFACE} } from '${NEW_INTERFACE_PATH}';`);\n }\n if (others.length > 0) {\n const otherNames = others.map((s) => s.name.text).join(', ');\n lines.push(`import { ${otherNames} } from '${moduleSpec.text}';`);\n }\n edits.push({\n start: stmt.getStart(sourceFile),\n end: stmt.getEnd(),\n replacement: lines.join('\\n'),\n });\n } else if (hasComponent) {\n edits.push({\n start: moduleSpec.getStart(sourceFile) + 1,\n end: moduleSpec.getEnd() - 1,\n replacement: NEW_COMPONENT_PATH,\n });\n for (const specifier of specifiers) {\n if (specifier.name.text === OLD_COMPONENT) {\n edits.push({\n start: specifier.name.getStart(sourceFile),\n end: specifier.name.getEnd(),\n replacement: NEW_COMPONENT,\n });\n }\n }\n } else if (hasInterface) {\n if (hasEuiMenuItemImport) {\n removeImportSpecifier(namedBindings, specifiers.find((s) => s.name.text === OLD_INTERFACE)!, sourceFile, edits);\n } else {\n edits.push({\n start: moduleSpec.getStart(sourceFile) + 1,\n end: moduleSpec.getEnd() - 1,\n replacement: NEW_INTERFACE_PATH,\n });\n for (const specifier of specifiers) {\n if (specifier.name.text === OLD_INTERFACE) {\n edits.push({\n start: specifier.name.getStart(sourceFile),\n end: specifier.name.getEnd(),\n replacement: NEW_INTERFACE,\n });\n }\n }\n }\n }\n }\n\n // Third pass: rename identifier references in non-import positions\n const visitRefs = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) return; // skip imports (already handled)\n if (ts.isIdentifier(node)) {\n if (node.text === OLD_COMPONENT) {\n edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: NEW_COMPONENT });\n }\n if (node.text === OLD_INTERFACE) {\n edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: NEW_INTERFACE });\n }\n }\n ts.forEachChild(node, visitRefs);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitRefs(stmt);\n }\n }\n\n // Warn about ToolbarItem-specific properties\n warnRemovedProperties(sourceFile, filePath, context);\n\n return applyEdits(source, edits);\n}\n\nfunction removeImportSpecifier(\n namedImports: ts.NamedImports,\n specifier: ts.ImportSpecifier,\n sourceFile: ts.SourceFile,\n edits: Edit[],\n): void {\n const elements = namedImports.elements;\n if (elements.length === 1) {\n // Remove the entire import declaration\n const importDecl = namedImports.parent.parent;\n edits.push({\n start: importDecl.getStart(sourceFile),\n end: importDecl.getEnd(),\n replacement: '',\n });\n } else {\n // Remove just this specifier with surrounding comma/whitespace\n const idx = elements.indexOf(specifier);\n let start: number;\n let end: number;\n if (idx < elements.length - 1) {\n start = specifier.getStart(sourceFile);\n end = elements[idx + 1].getStart(sourceFile);\n } else {\n start = elements[idx - 1].getEnd();\n end = specifier.getEnd();\n }\n edits.push({ start, end, replacement: '' });\n }\n}\n\nfunction warnRemovedProperties(sourceFile: ts.SourceFile, filePath: string, context: SchematicContext): void {\n const deprecated = ['isHome', 'isSeparator'];\n\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && deprecated.includes(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${filePath}:${line + 1} - \"${node.name.text}\" was part of ToolbarItem but does not exist on EuiMenuItem. Review manually.`,\n );\n }\n if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && deprecated.includes(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${filePath}:${line + 1} - \"${node.name.text}\" was part of ToolbarItem but does not exist on EuiMenuItem. Review manually.`,\n );\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n}\n\nfunction visitNodes(nodes: TmplAstNode[], source: string, edits: Edit[], filePath: string, context: SchematicContext): void {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (node.name === OLD_TAG) {\n collectTagRenames(node, source, edits);\n collectOutputRemovals(node, source, edits, filePath, context);\n }\n visitNodes(node.children, source, edits, filePath, context);\n }\n }\n}\n\nfunction collectTagRenames(element: TmplAstElement, source: string, edits: Edit[]): void {\n // Rename opening tag\n const openStart = element.startSourceSpan.start.offset + 1; // skip '<'\n edits.push({ start: openStart, end: openStart + OLD_TAG.length, replacement: NEW_TAG });\n\n // Rename closing tag\n if (element.endSourceSpan) {\n const closeStart = element.endSourceSpan.start.offset + 2; // skip '</'\n edits.push({ start: closeStart, end: closeStart + OLD_TAG.length, replacement: NEW_TAG });\n }\n}\n\nfunction collectOutputRemovals(\n element: TmplAstElement,\n source: string,\n edits: Edit[],\n filePath: string,\n context: SchematicContext,\n): void {\n for (const output of element.outputs) {\n if (output.name === REMOVED_OUTPUT) {\n let start = output.sourceSpan.start.offset;\n // Remove leading whitespace\n while (start > 0 && (source[start - 1] === ' ' || source[start - 1] === '\\t')) {\n start--;\n }\n edits.push({ start, end: output.sourceSpan.end.offset, replacement: '' });\n\n const { line } = element.startSourceSpan.start;\n context.logger.warn(\n `${filePath}:${line + 1} - \"(menuItemClick)\" has been removed. There is no equivalent on eui-toolbar-mega-menu.`,\n );\n }\n }\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 applyEdits(source: string, edits: Edit[]): string {\n // Deduplicate edits at same position (e.g. module path edits when both Component and ToolbarItem are from same source)\n const unique = deduplicateEdits(edits);\n let result = source;\n for (const edit of unique.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\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}`;\n // Last wins for same range\n seen.set(key, edit);\n }\n return Array.from(seen.values());\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",
|
|
977
977
|
"displayName": "Edit",
|
|
978
978
|
"properties": [
|
|
979
979
|
{
|
|
@@ -985,7 +985,7 @@
|
|
|
985
985
|
"indexKey": "",
|
|
986
986
|
"optional": false,
|
|
987
987
|
"description": "",
|
|
988
|
-
"line":
|
|
988
|
+
"line": 23,
|
|
989
989
|
"rawdescription": "\n"
|
|
990
990
|
},
|
|
991
991
|
{
|
|
@@ -997,7 +997,7 @@
|
|
|
997
997
|
"indexKey": "",
|
|
998
998
|
"optional": false,
|
|
999
999
|
"description": "",
|
|
1000
|
-
"line":
|
|
1000
|
+
"line": 24,
|
|
1001
1001
|
"rawdescription": "\n"
|
|
1002
1002
|
},
|
|
1003
1003
|
{
|
|
@@ -1009,7 +1009,7 @@
|
|
|
1009
1009
|
"indexKey": "",
|
|
1010
1010
|
"optional": false,
|
|
1011
1011
|
"description": "",
|
|
1012
|
-
"line":
|
|
1012
|
+
"line": 22,
|
|
1013
1013
|
"rawdescription": "\n"
|
|
1014
1014
|
}
|
|
1015
1015
|
],
|
|
@@ -2092,12 +2092,12 @@
|
|
|
2092
2092
|
},
|
|
2093
2093
|
{
|
|
2094
2094
|
"name": "Schema",
|
|
2095
|
-
"id": "interface-Schema-
|
|
2096
|
-
"file": "packages/core/schematics/
|
|
2095
|
+
"id": "interface-Schema-4fe31ff3e9f1d34845a6b865d605e215f33552094b88c3d0eab0b180187fe64ce4d68d687516cb3d62c57d2678a103969b2dacbb18a49b26060f78096678fcce-1",
|
|
2096
|
+
"file": "packages/core/schematics/fix-no-multiple-empty-lines/index.ts",
|
|
2097
2097
|
"deprecated": false,
|
|
2098
2098
|
"deprecationMessage": "",
|
|
2099
2099
|
"type": "interface",
|
|
2100
|
-
"sourceCode": "
|
|
2100
|
+
"sourceCode": "import { 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 MULTIPLE_EMPTY_LINES = /\\n{3,}/g;\n\nexport function fixNoMultipleEmptyLines(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, (filePath) => {\n const buffer = tree.read(filePath);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n const result = original.replace(MULTIPLE_EMPTY_LINES, '\\n\\n');\n\n if (result !== original) {\n if (filePath.endsWith('.ts')) {\n const sourceFile = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((sourceFile as any).parseDiagnostics?.length) {\n context.logger.warn(`Skipping ${filePath}: file would not parse after transformation.`);\n return;\n }\n }\n if (options.dryRun) {\n logDryRun(context, `Would collapse multiple empty lines in ${filePath}`);\n } else {\n tree.overwrite(filePath, result);\n }\n count++;\n }\n });\n\n context.logger.info(`Fixed multiple empty lines 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('.ts') && !file.endsWith('.html') && !file.endsWith('.scss') && !file.endsWith('.css')) 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",
|
|
2101
2101
|
"displayName": "Schema",
|
|
2102
2102
|
"properties": [
|
|
2103
2103
|
{
|
|
@@ -2108,9 +2108,9 @@
|
|
|
2108
2108
|
"type": "boolean",
|
|
2109
2109
|
"indexKey": "",
|
|
2110
2110
|
"optional": true,
|
|
2111
|
-
"description": "
|
|
2112
|
-
"line":
|
|
2113
|
-
"rawdescription": "\
|
|
2111
|
+
"description": "",
|
|
2112
|
+
"line": 7,
|
|
2113
|
+
"rawdescription": "\n"
|
|
2114
2114
|
},
|
|
2115
2115
|
{
|
|
2116
2116
|
"name": "path",
|
|
@@ -2120,9 +2120,9 @@
|
|
|
2120
2120
|
"type": "string",
|
|
2121
2121
|
"indexKey": "",
|
|
2122
2122
|
"optional": true,
|
|
2123
|
-
"description": "
|
|
2124
|
-
"line":
|
|
2125
|
-
"rawdescription": "\
|
|
2123
|
+
"description": "",
|
|
2124
|
+
"line": 6,
|
|
2125
|
+
"rawdescription": "\n"
|
|
2126
2126
|
}
|
|
2127
2127
|
],
|
|
2128
2128
|
"indexSignatures": [],
|
|
@@ -2139,12 +2139,12 @@
|
|
|
2139
2139
|
},
|
|
2140
2140
|
{
|
|
2141
2141
|
"name": "Schema",
|
|
2142
|
-
"id": "interface-Schema-
|
|
2143
|
-
"file": "packages/core/schematics/migrate/schema.ts",
|
|
2142
|
+
"id": "interface-Schema-5cd6db1920bd5b70a44c0b8a7f7e30f600bfd16a9950f218e6d451a1755ced95b462ef9a62ee87e39bcb8c392981b8d2597895bf0a272fd8aea71f03429ed976-2",
|
|
2143
|
+
"file": "packages/core/schematics/icon-migrate/schema.ts",
|
|
2144
2144
|
"deprecated": false,
|
|
2145
2145
|
"deprecationMessage": "",
|
|
2146
2146
|
"type": "interface",
|
|
2147
|
-
"sourceCode": "export interface Schema {\n /** The path to scan for files to migrate */\n path?: string;\n /** Whether to
|
|
2147
|
+
"sourceCode": "export interface Schema {\n /** The path to scan for files to migrate */\n path?: string;\n /** Whether to perform a dry run without making changes */\n dryRun?: boolean;\n}\n",
|
|
2148
2148
|
"displayName": "Schema",
|
|
2149
2149
|
"properties": [
|
|
2150
2150
|
{
|
|
@@ -2156,20 +2156,8 @@
|
|
|
2156
2156
|
"indexKey": "",
|
|
2157
2157
|
"optional": true,
|
|
2158
2158
|
"description": "<p>Whether to perform a dry run without making changes</p>\n",
|
|
2159
|
-
"line": 7,
|
|
2160
|
-
"rawdescription": "\nWhether to perform a dry run without making changes"
|
|
2161
|
-
},
|
|
2162
|
-
{
|
|
2163
|
-
"name": "mwp",
|
|
2164
|
-
"coverageIgnore": false,
|
|
2165
|
-
"deprecated": false,
|
|
2166
|
-
"deprecationMessage": "",
|
|
2167
|
-
"type": "boolean",
|
|
2168
|
-
"indexKey": "",
|
|
2169
|
-
"optional": true,
|
|
2170
|
-
"description": "<p>Whether to apply MyWorkplace-specific replacements</p>\n",
|
|
2171
2159
|
"line": 5,
|
|
2172
|
-
"rawdescription": "\nWhether to
|
|
2160
|
+
"rawdescription": "\nWhether to perform a dry run without making changes"
|
|
2173
2161
|
},
|
|
2174
2162
|
{
|
|
2175
2163
|
"name": "path",
|
|
@@ -2198,12 +2186,12 @@
|
|
|
2198
2186
|
},
|
|
2199
2187
|
{
|
|
2200
2188
|
"name": "Schema",
|
|
2201
|
-
"id": "interface-Schema-
|
|
2202
|
-
"file": "packages/core/schematics/
|
|
2189
|
+
"id": "interface-Schema-56b9fe60701ca349dc90e152829b0a18bb7a8a9bb303c4bac05f9764cd2e933cce0879775ca17168b4c881e202d0258af3668a2a3a1b940e561f7e4b2349b5cc-3",
|
|
2190
|
+
"file": "packages/core/schematics/migrate/schema.ts",
|
|
2203
2191
|
"deprecated": false,
|
|
2204
2192
|
"deprecationMessage": "",
|
|
2205
2193
|
"type": "interface",
|
|
2206
|
-
"sourceCode": "
|
|
2194
|
+
"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",
|
|
2207
2195
|
"displayName": "Schema",
|
|
2208
2196
|
"properties": [
|
|
2209
2197
|
{
|
|
@@ -2214,9 +2202,21 @@
|
|
|
2214
2202
|
"type": "boolean",
|
|
2215
2203
|
"indexKey": "",
|
|
2216
2204
|
"optional": true,
|
|
2217
|
-
"description": "",
|
|
2205
|
+
"description": "<p>Whether to perform a dry run without making changes</p>\n",
|
|
2218
2206
|
"line": 7,
|
|
2219
|
-
"rawdescription": "\
|
|
2207
|
+
"rawdescription": "\nWhether to perform a dry run without making changes"
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
"name": "mwp",
|
|
2211
|
+
"coverageIgnore": false,
|
|
2212
|
+
"deprecated": false,
|
|
2213
|
+
"deprecationMessage": "",
|
|
2214
|
+
"type": "boolean",
|
|
2215
|
+
"indexKey": "",
|
|
2216
|
+
"optional": true,
|
|
2217
|
+
"description": "<p>Whether to apply MyWorkplace-specific replacements</p>\n",
|
|
2218
|
+
"line": 5,
|
|
2219
|
+
"rawdescription": "\nWhether to apply MyWorkplace-specific replacements"
|
|
2220
2220
|
},
|
|
2221
2221
|
{
|
|
2222
2222
|
"name": "path",
|
|
@@ -2226,9 +2226,9 @@
|
|
|
2226
2226
|
"type": "string",
|
|
2227
2227
|
"indexKey": "",
|
|
2228
2228
|
"optional": true,
|
|
2229
|
-
"description": "",
|
|
2230
|
-
"line":
|
|
2231
|
-
"rawdescription": "\
|
|
2229
|
+
"description": "<p>The path to scan for files to migrate</p>\n",
|
|
2230
|
+
"line": 3,
|
|
2231
|
+
"rawdescription": "\nThe path to scan for files to migrate"
|
|
2232
2232
|
}
|
|
2233
2233
|
],
|
|
2234
2234
|
"indexSignatures": [],
|
|
@@ -2527,12 +2527,12 @@
|
|
|
2527
2527
|
},
|
|
2528
2528
|
{
|
|
2529
2529
|
"name": "Schema",
|
|
2530
|
-
"id": "interface-Schema-
|
|
2531
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
2530
|
+
"id": "interface-Schema-375dc0924084a2acbafe4a6a32577d59f631c9a386d151180d8fb1c89e7e7cd23da9fd459e597592ed823692adb6ad2633c50baf16621f003246e8c9bb1c6ce0-10",
|
|
2531
|
+
"file": "packages/core/schematics/migrate-eui-editor/index.ts",
|
|
2532
2532
|
"deprecated": false,
|
|
2533
2533
|
"deprecationMessage": "",
|
|
2534
2534
|
"type": "interface",
|
|
2535
|
-
"sourceCode": "import { parseTemplate,
|
|
2535
|
+
"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\nconst COMPONENT_TAG = 'eui-editor';\nconst OLD_NAME = 'onEditorChanged';\nconst NEW_NAME = 'contentChange';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nexport function migrateEuiEditor(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\n if (path.endsWith('.html')) {\n if (!original.includes(COMPONENT_TAG)) return;\n const result = migrateTemplate(original);\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would rename '${OLD_NAME}' → '${NEW_NAME}' in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n count++;\n }\n return;\n }\n\n // .ts file — handle both migration and warnings in one pass\n const hasTag = original.includes(COMPONENT_TAG);\n const hasOldName = original.includes(OLD_NAME);\n if (!hasTag && !hasOldName) return;\n\n if (hasTag) {\n const result = migrateInlineTemplates(original);\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would rename '${OLD_NAME}' → '${NEW_NAME}' in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n count++;\n }\n }\n\n // Warn about TS property access usages (skip spec files)\n if (hasOldName && !path.endsWith('.spec.ts')) {\n warnPropertyAccesses(path, original, context);\n }\n });\n\n context.logger.info(`Renamed '(${OLD_NAME})' → '(${NEW_NAME})' on ${COMPONENT_TAG} 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 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(COMPONENT_TAG)) {\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 warnPropertyAccesses(path: string, source: string, context: SchematicContext): void {\n const sourceFile = ts.createSourceFile(path, source, ts.ScriptTarget.Latest, true);\n\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && node.name.text === OLD_NAME) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(`${path}:${line + 1} - \"${OLD_NAME}\" has been renamed to \"${NEW_NAME}\" on ${COMPONENT_TAG}. Update this reference manually.`);\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\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 (node.name === COMPONENT_TAG) 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 output of element.outputs) {\n if (output.name === OLD_NAME) {\n edits.push({ start: output.keySpan!.start.offset, end: output.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",
|
|
2536
2536
|
"displayName": "Schema",
|
|
2537
2537
|
"properties": [
|
|
2538
2538
|
{
|
|
@@ -2544,7 +2544,7 @@
|
|
|
2544
2544
|
"indexKey": "",
|
|
2545
2545
|
"optional": true,
|
|
2546
2546
|
"description": "",
|
|
2547
|
-
"line":
|
|
2547
|
+
"line": 12,
|
|
2548
2548
|
"rawdescription": "\n"
|
|
2549
2549
|
},
|
|
2550
2550
|
{
|
|
@@ -2556,7 +2556,7 @@
|
|
|
2556
2556
|
"indexKey": "",
|
|
2557
2557
|
"optional": true,
|
|
2558
2558
|
"description": "",
|
|
2559
|
-
"line":
|
|
2559
|
+
"line": 11,
|
|
2560
2560
|
"rawdescription": "\n"
|
|
2561
2561
|
}
|
|
2562
2562
|
],
|
|
@@ -2574,12 +2574,12 @@
|
|
|
2574
2574
|
},
|
|
2575
2575
|
{
|
|
2576
2576
|
"name": "Schema",
|
|
2577
|
-
"id": "interface-Schema-
|
|
2578
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
2577
|
+
"id": "interface-Schema-869dfc324e9111966817cbebb3553eabfe200acfe33bb77efa71a6c46e1cba0ff5852de7b9ade3060f87264035b99591361331a9e0622daaac22b8d59146c761-11",
|
|
2578
|
+
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
2579
2579
|
"deprecated": false,
|
|
2580
2580
|
"deprecationMessage": "",
|
|
2581
2581
|
"type": "interface",
|
|
2582
|
-
"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\
|
|
2582
|
+
"sourceCode": "import { parseTemplate, TmplAstBoundAttribute, 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 COMPONENT_TAG = 'eui-discussion-thread';\n\nexport function migrateEuiDiscussionThread(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(COMPONENT_TAG)) 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 [trackBy] binding in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n count++;\n }\n\n // Warn about TS usages inline\n if (path.endsWith('.ts') && !path.endsWith('.spec.ts') && original.includes('trackByFn')) {\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) && node.name.text === 'trackByFn') {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(`${path}:${line + 1} - \"trackByFn\" has been removed from ${COMPONENT_TAG}. Remove this reference manually.`);\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n }\n });\n\n context.logger.info(`Removed trackByFn-based [trackBy] bindings from ${COMPONENT_TAG} 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 migrateTemplate(source: string): string {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const removals: { start: number; end: number }[] = [];\n\n visitNodes(parsed.nodes, source, removals);\n\n let result = source;\n for (const { start, end } of removals.sort((a, b) => b.start - a.start)) {\n let adjustedStart = start;\n while (adjustedStart > 0 && (result[adjustedStart - 1] === ' ' || result[adjustedStart - 1] === '\\t')) {\n adjustedStart--;\n }\n result = result.slice(0, adjustedStart) + result.slice(end);\n }\n\n return result;\n}\n\nfunction migrateInlineTemplates(source: string): string {\n const templateRegex = /template\\s*:\\s*`([^`]*)`/gs;\n return source.replace(templateRegex, (match, templateContent: string) => {\n if (!templateContent.includes(COMPONENT_TAG)) 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[], source: string, removals: { start: number; end: number }[]): void {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (node.name === COMPONENT_TAG) collectRemovals(node, source, removals);\n visitNodes(node.children, source, removals);\n }\n }\n}\n\nfunction collectRemovals(element: TmplAstElement, source: string, removals: { start: number; end: number }[]): void {\n for (const input of element.inputs) {\n if (input.name === 'trackBy') {\n const valueSource = source.slice(input.sourceSpan.start.offset, input.sourceSpan.end.offset);\n if (valueSource.includes('trackByFn')) {\n removals.push({ start: input.sourceSpan.start.offset, end: input.sourceSpan.end.offset });\n }\n }\n }\n}\n",
|
|
2583
2583
|
"displayName": "Schema",
|
|
2584
2584
|
"properties": [
|
|
2585
2585
|
{
|
|
@@ -2591,7 +2591,7 @@
|
|
|
2591
2591
|
"indexKey": "",
|
|
2592
2592
|
"optional": true,
|
|
2593
2593
|
"description": "",
|
|
2594
|
-
"line":
|
|
2594
|
+
"line": 8,
|
|
2595
2595
|
"rawdescription": "\n"
|
|
2596
2596
|
},
|
|
2597
2597
|
{
|
|
@@ -2603,7 +2603,7 @@
|
|
|
2603
2603
|
"indexKey": "",
|
|
2604
2604
|
"optional": true,
|
|
2605
2605
|
"description": "",
|
|
2606
|
-
"line":
|
|
2606
|
+
"line": 7,
|
|
2607
2607
|
"rawdescription": "\n"
|
|
2608
2608
|
}
|
|
2609
2609
|
],
|
|
@@ -2950,12 +2950,12 @@
|
|
|
2950
2950
|
},
|
|
2951
2951
|
{
|
|
2952
2952
|
"name": "Schema",
|
|
2953
|
-
"id": "interface-Schema-
|
|
2954
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
2953
|
+
"id": "interface-Schema-d36032102ed30a7ada1e3d36bb9ca41b7234b855760cac9783a25818f7ffe2097e1ebd8e808b574ddec0760f827272f6cd561f45f3eb1578f87f39ee2633730a-19",
|
|
2954
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
2955
2955
|
"deprecated": false,
|
|
2956
2956
|
"deprecationMessage": "",
|
|
2957
2957
|
"type": "interface",
|
|
2958
|
-
"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\nconst OLD_TAG = 'eui-toolbar-menu';\nconst NEW_TAG = 'eui-toolbar-mega-menu';\nconst OLD_COMPONENT = 'EuiToolbarMenuComponent';\nconst NEW_COMPONENT = 'EuiToolbarMegaMenuComponent';\nconst OLD_INTERFACE = 'ToolbarItem';\nconst NEW_INTERFACE = 'EuiMenuItem';\nconst NEW_COMPONENT_PATH = '@eui/components/layout';\nconst NEW_INTERFACE_PATH = '@eui/core';\nconst REMOVED_OUTPUT = 'menuItemClick';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nexport function migrateEuiToolbarMenu(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_TAG) && !original.includes(OLD_COMPONENT) && !original.includes(OLD_INTERFACE)) return;\n\n let result: string;\n\n if (path.endsWith('.html')) {\n result = migrateTemplate(original, path, context);\n } else {\n result = migrateTypeScript(original, path, context);\n }\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would migrate eui-toolbar-menu → eui-toolbar-mega-menu in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n fileCount++;\n }\n });\n\n context.logger.info(`Migrated eui-toolbar-menu → eui-toolbar-mega-menu in ${fileCount} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction migrateTemplate(source: string, filePath: string, context: SchematicContext): string {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const edits: Edit[] = [];\n\n visitNodes(parsed.nodes, source, edits, filePath, context);\n\n return applyEdits(source, edits);\n}\n\nfunction migrateTypeScript(source: string, filePath: string, context: SchematicContext): string {\n let result = migrateInlineTemplates(source, filePath, context);\n result = migrateImportsAndTypes(result, filePath, context);\n return result;\n}\n\nfunction migrateInlineTemplates(source: string, filePath: string, context: SchematicContext): string {\n const sourceFile = ts.createSourceFile('', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const changes: Edit[] = [];\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_TAG)) {\n ts.forEachChild(node, visit); return; \n}\n const migrated = migrateTemplate(rawTemplate, filePath, context);\n if (migrated !== rawTemplate) changes.push({ start, end, replacement: migrated });\n }\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n return applyEdits(source, changes);\n}\n\nfunction migrateImportsAndTypes(source: string, filePath: string, context: SchematicContext): string {\n if (!source.includes(OLD_COMPONENT) && !source.includes(OLD_INTERFACE)) return source;\n\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n\n // Track if EuiMenuItem is already imported from @eui/core\n let hasEuiMenuItemImport = false;\n\n // First pass: analyze imports\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const moduleSpec = (stmt.moduleSpecifier as ts.StringLiteral).text;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n for (const specifier of namedBindings.elements) {\n if (specifier.name.text === NEW_INTERFACE && moduleSpec === NEW_INTERFACE_PATH) {\n hasEuiMenuItemImport = true;\n }\n }\n }\n\n // Second pass: collect edits for import declarations\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n const moduleSpec = stmt.moduleSpecifier as ts.StringLiteral;\n const specifiers = namedBindings.elements;\n const hasComponent = specifiers.some((s) => s.name.text === OLD_COMPONENT);\n const hasInterface = specifiers.some((s) => s.name.text === OLD_INTERFACE);\n\n if (hasComponent && hasInterface) {\n // Both are in the same import → must split into two different paths\n const others = specifiers.filter((s) => s.name.text !== OLD_COMPONENT && s.name.text !== OLD_INTERFACE);\n const lines: string[] = [];\n lines.push(`import { ${NEW_COMPONENT} } from '${NEW_COMPONENT_PATH}';`);\n if (!hasEuiMenuItemImport) {\n lines.push(`import { ${NEW_INTERFACE} } from '${NEW_INTERFACE_PATH}';`);\n }\n if (others.length > 0) {\n const otherNames = others.map((s) => s.name.text).join(', ');\n lines.push(`import { ${otherNames} } from '${moduleSpec.text}';`);\n }\n edits.push({\n start: stmt.getStart(sourceFile),\n end: stmt.getEnd(),\n replacement: lines.join('\\n'),\n });\n } else if (hasComponent) {\n edits.push({\n start: moduleSpec.getStart(sourceFile) + 1,\n end: moduleSpec.getEnd() - 1,\n replacement: NEW_COMPONENT_PATH,\n });\n for (const specifier of specifiers) {\n if (specifier.name.text === OLD_COMPONENT) {\n edits.push({\n start: specifier.name.getStart(sourceFile),\n end: specifier.name.getEnd(),\n replacement: NEW_COMPONENT,\n });\n }\n }\n } else if (hasInterface) {\n if (hasEuiMenuItemImport) {\n removeImportSpecifier(namedBindings, specifiers.find((s) => s.name.text === OLD_INTERFACE)!, sourceFile, edits);\n } else {\n edits.push({\n start: moduleSpec.getStart(sourceFile) + 1,\n end: moduleSpec.getEnd() - 1,\n replacement: NEW_INTERFACE_PATH,\n });\n for (const specifier of specifiers) {\n if (specifier.name.text === OLD_INTERFACE) {\n edits.push({\n start: specifier.name.getStart(sourceFile),\n end: specifier.name.getEnd(),\n replacement: NEW_INTERFACE,\n });\n }\n }\n }\n }\n }\n\n // Third pass: rename identifier references in non-import positions\n const visitRefs = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) return; // skip imports (already handled)\n if (ts.isIdentifier(node)) {\n if (node.text === OLD_COMPONENT) {\n edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: NEW_COMPONENT });\n }\n if (node.text === OLD_INTERFACE) {\n edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: NEW_INTERFACE });\n }\n }\n ts.forEachChild(node, visitRefs);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitRefs(stmt);\n }\n }\n\n // Warn about ToolbarItem-specific properties\n warnRemovedProperties(sourceFile, filePath, context);\n\n return applyEdits(source, edits);\n}\n\nfunction removeImportSpecifier(\n namedImports: ts.NamedImports,\n specifier: ts.ImportSpecifier,\n sourceFile: ts.SourceFile,\n edits: Edit[],\n): void {\n const elements = namedImports.elements;\n if (elements.length === 1) {\n // Remove the entire import declaration\n const importDecl = namedImports.parent.parent;\n edits.push({\n start: importDecl.getStart(sourceFile),\n end: importDecl.getEnd(),\n replacement: '',\n });\n } else {\n // Remove just this specifier with surrounding comma/whitespace\n const idx = elements.indexOf(specifier);\n let start: number;\n let end: number;\n if (idx < elements.length - 1) {\n start = specifier.getStart(sourceFile);\n end = elements[idx + 1].getStart(sourceFile);\n } else {\n start = elements[idx - 1].getEnd();\n end = specifier.getEnd();\n }\n edits.push({ start, end, replacement: '' });\n }\n}\n\nfunction warnRemovedProperties(sourceFile: ts.SourceFile, filePath: string, context: SchematicContext): void {\n const deprecated = ['isHome', 'isSeparator'];\n\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && deprecated.includes(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${filePath}:${line + 1} - \"${node.name.text}\" was part of ToolbarItem but does not exist on EuiMenuItem. Review manually.`,\n );\n }\n if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && deprecated.includes(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${filePath}:${line + 1} - \"${node.name.text}\" was part of ToolbarItem but does not exist on EuiMenuItem. Review manually.`,\n );\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n}\n\nfunction visitNodes(nodes: TmplAstNode[], source: string, edits: Edit[], filePath: string, context: SchematicContext): void {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (node.name === OLD_TAG) {\n collectTagRenames(node, source, edits);\n collectOutputRemovals(node, source, edits, filePath, context);\n }\n visitNodes(node.children, source, edits, filePath, context);\n }\n }\n}\n\nfunction collectTagRenames(element: TmplAstElement, source: string, edits: Edit[]): void {\n // Rename opening tag\n const openStart = element.startSourceSpan.start.offset + 1; // skip '<'\n edits.push({ start: openStart, end: openStart + OLD_TAG.length, replacement: NEW_TAG });\n\n // Rename closing tag\n if (element.endSourceSpan) {\n const closeStart = element.endSourceSpan.start.offset + 2; // skip '</'\n edits.push({ start: closeStart, end: closeStart + OLD_TAG.length, replacement: NEW_TAG });\n }\n}\n\nfunction collectOutputRemovals(\n element: TmplAstElement,\n source: string,\n edits: Edit[],\n filePath: string,\n context: SchematicContext,\n): void {\n for (const output of element.outputs) {\n if (output.name === REMOVED_OUTPUT) {\n let start = output.sourceSpan.start.offset;\n // Remove leading whitespace\n while (start > 0 && (source[start - 1] === ' ' || source[start - 1] === '\\t')) {\n start--;\n }\n edits.push({ start, end: output.sourceSpan.end.offset, replacement: '' });\n\n const { line } = element.startSourceSpan.start;\n context.logger.warn(\n `${filePath}:${line + 1} - \"(menuItemClick)\" has been removed. There is no equivalent on eui-toolbar-mega-menu.`,\n );\n }\n }\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 applyEdits(source: string, edits: Edit[]): string {\n // Deduplicate edits at same position (e.g. module path edits when both Component and ToolbarItem are from same source)\n const unique = deduplicateEdits(edits);\n let result = source;\n for (const edit of unique.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\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}`;\n // Last wins for same range\n seen.set(key, edit);\n }\n return Array.from(seen.values());\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",
|
|
2958
|
+
"sourceCode": "import { 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\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nconst OLD_CLASS = 'EuiTooltipConfig';\nconst NEW_INTERFACE = 'EuiTooltipInterface';\n\nexport function migrateEuiTooltip(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n if (!path.endsWith('.ts')) return;\n\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_CLASS)) return;\n\n const result = migrateTypeScript(original, path, context);\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would migrate EuiTooltipConfig → EuiTooltipInterface in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n fileCount++;\n }\n });\n\n context.logger.info(`Migrated EuiTooltipConfig → EuiTooltipInterface in ${fileCount} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction migrateTypeScript(source: string, filePath: string, context: SchematicContext): string {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n\n // Track if EuiTooltipInterface is already imported\n let hasInterfaceImport = false;\n let classImportDecl: ts.ImportDeclaration | null = null;\n let classImportModuleSpecifier: string | null = null;\n\n // First pass: analyze imports\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n for (const specifier of namedBindings.elements) {\n if (specifier.name.text === NEW_INTERFACE) {\n hasInterfaceImport = true;\n }\n if (specifier.name.text === OLD_CLASS) {\n classImportDecl = stmt;\n classImportModuleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n }\n }\n }\n\n // Second pass: handle import declarations\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n const specifiers = namedBindings.elements;\n const classSpecifier = specifiers.find((s) => s.name.text === OLD_CLASS);\n if (!classSpecifier) continue;\n\n if (hasInterfaceImport) {\n // EuiTooltipInterface is already imported elsewhere → remove EuiTooltipConfig from this import\n removeImportSpecifier(namedBindings, classSpecifier, sourceFile, edits);\n } else {\n // Rename EuiTooltipConfig → EuiTooltipInterface in the import\n edits.push({\n start: classSpecifier.name.getStart(sourceFile),\n end: classSpecifier.name.getEnd(),\n replacement: NEW_INTERFACE,\n });\n hasInterfaceImport = true;\n }\n }\n\n // Third pass: replace `new EuiTooltipConfig(...)` → spread/cast to interface\n const visitNewExpressions = (node: ts.Node): void => {\n if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === OLD_CLASS) {\n const args = node.arguments;\n if (args && args.length === 1) {\n const arg = args[0];\n // `new EuiTooltipConfig({ ... })` → `{ ... } as EuiTooltipInterface`\n // But if the argument is just a variable, we keep it: `varName as EuiTooltipInterface`\n const argText = source.slice(arg.getStart(sourceFile), arg.getEnd());\n\n if (ts.isObjectLiteralExpression(arg)) {\n // Inline object: `new EuiTooltipConfig({ x: 1 })` → `{ x: 1 }`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: argText,\n });\n } else {\n // Variable or expression: `new EuiTooltipConfig(opts)` → `opts`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: argText,\n });\n }\n } else if (!args || args.length === 0) {\n // `new EuiTooltipConfig()` → `{} as EuiTooltipInterface`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: `{} as ${NEW_INTERFACE}`,\n });\n }\n return; // don't recurse into children we've already replaced\n }\n ts.forEachChild(node, visitNewExpressions);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitNewExpressions(stmt);\n }\n }\n\n // Fourth pass: rename all remaining identifier references (type annotations, etc.)\n const visitRefs = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) return;\n // Skip nodes we already covered in new expressions\n if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === OLD_CLASS) return;\n\n if (ts.isIdentifier(node) && node.text === OLD_CLASS) {\n // Ensure this is not part of an import declaration\n if (!isPartOfImport(node)) {\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: NEW_INTERFACE,\n });\n }\n }\n ts.forEachChild(node, visitRefs);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitRefs(stmt);\n }\n }\n\n return applyEdits(source, edits);\n}\n\nfunction isPartOfImport(node: ts.Node): boolean {\n let current: ts.Node | undefined = node.parent;\n while (current) {\n if (ts.isImportDeclaration(current)) return true;\n current = current.parent;\n }\n return false;\n}\n\nfunction removeImportSpecifier(\n namedImports: ts.NamedImports,\n specifier: ts.ImportSpecifier,\n sourceFile: ts.SourceFile,\n edits: Edit[],\n): void {\n const elements = namedImports.elements;\n if (elements.length === 1) {\n // Remove the entire import declaration\n const importDecl = namedImports.parent.parent;\n let end = importDecl.getEnd();\n // Also remove trailing newline if present\n const fullText = sourceFile.getFullText();\n if (fullText[end] === '\\n') end++;\n edits.push({\n start: importDecl.getStart(sourceFile),\n end,\n replacement: '',\n });\n } else {\n // Remove just this specifier with surrounding comma/whitespace\n const idx = elements.indexOf(specifier);\n let start: number;\n let end: number;\n if (idx < elements.length - 1) {\n // Not the last → remove from this specifier start to next specifier start\n start = specifier.getStart(sourceFile);\n end = elements[idx + 1].getStart(sourceFile);\n } else {\n // Last element → remove from previous element end to this end\n start = elements[idx - 1].getEnd();\n end = specifier.getEnd();\n }\n edits.push({ start, end, replacement: '' });\n }\n}\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n const unique = deduplicateEdits(edits);\n let result = source;\n for (const edit of unique.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\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}`;\n seen.set(key, edit);\n }\n return Array.from(seen.values());\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('.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",
|
|
2959
2959
|
"displayName": "Schema",
|
|
2960
2960
|
"properties": [
|
|
2961
2961
|
{
|
|
@@ -2967,7 +2967,7 @@
|
|
|
2967
2967
|
"indexKey": "",
|
|
2968
2968
|
"optional": true,
|
|
2969
2969
|
"description": "",
|
|
2970
|
-
"line":
|
|
2970
|
+
"line": 7,
|
|
2971
2971
|
"rawdescription": "\n"
|
|
2972
2972
|
},
|
|
2973
2973
|
{
|
|
@@ -2979,7 +2979,7 @@
|
|
|
2979
2979
|
"indexKey": "",
|
|
2980
2980
|
"optional": true,
|
|
2981
2981
|
"description": "",
|
|
2982
|
-
"line":
|
|
2982
|
+
"line": 6,
|
|
2983
2983
|
"rawdescription": "\n"
|
|
2984
2984
|
}
|
|
2985
2985
|
],
|
|
@@ -2997,12 +2997,12 @@
|
|
|
2997
2997
|
},
|
|
2998
2998
|
{
|
|
2999
2999
|
"name": "Schema",
|
|
3000
|
-
"id": "interface-Schema-
|
|
3001
|
-
"file": "packages/core/schematics/migrate-
|
|
3000
|
+
"id": "interface-Schema-817c4b549cc3eab9fcf4936acab2e71182d90a4480369f5c003cbbda10792efa587ad99d65acf049f64e7030e32589e4fabc4a6d7a5621e4fe54725ef91dc9e8-20",
|
|
3001
|
+
"file": "packages/core/schematics/migrate-to-standalone/index.ts",
|
|
3002
3002
|
"deprecated": false,
|
|
3003
3003
|
"deprecationMessage": "",
|
|
3004
3004
|
"type": "interface",
|
|
3005
|
-
"sourceCode": "import { 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\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nconst OLD_CLASS = 'EuiTooltipConfig';\nconst NEW_INTERFACE = 'EuiTooltipInterface';\n\nexport function migrateEuiTooltip(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n if (!path.endsWith('.ts')) return;\n\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_CLASS)) return;\n\n const result = migrateTypeScript(original, path, context);\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would migrate EuiTooltipConfig → EuiTooltipInterface in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n fileCount++;\n }\n });\n\n context.logger.info(`Migrated EuiTooltipConfig → EuiTooltipInterface in ${fileCount} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction migrateTypeScript(source: string, filePath: string, context: SchematicContext): string {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n\n // Track if EuiTooltipInterface is already imported\n let hasInterfaceImport = false;\n let classImportDecl: ts.ImportDeclaration | null = null;\n let classImportModuleSpecifier: string | null = null;\n\n // First pass: analyze imports\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n for (const specifier of namedBindings.elements) {\n if (specifier.name.text === NEW_INTERFACE) {\n hasInterfaceImport = true;\n }\n if (specifier.name.text === OLD_CLASS) {\n classImportDecl = stmt;\n classImportModuleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n }\n }\n }\n\n // Second pass: handle import declarations\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n const specifiers = namedBindings.elements;\n const classSpecifier = specifiers.find((s) => s.name.text === OLD_CLASS);\n if (!classSpecifier) continue;\n\n if (hasInterfaceImport) {\n // EuiTooltipInterface is already imported elsewhere → remove EuiTooltipConfig from this import\n removeImportSpecifier(namedBindings, classSpecifier, sourceFile, edits);\n } else {\n // Rename EuiTooltipConfig → EuiTooltipInterface in the import\n edits.push({\n start: classSpecifier.name.getStart(sourceFile),\n end: classSpecifier.name.getEnd(),\n replacement: NEW_INTERFACE,\n });\n hasInterfaceImport = true;\n }\n }\n\n // Third pass: replace `new EuiTooltipConfig(...)` → spread/cast to interface\n const visitNewExpressions = (node: ts.Node): void => {\n if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === OLD_CLASS) {\n const args = node.arguments;\n if (args && args.length === 1) {\n const arg = args[0];\n // `new EuiTooltipConfig({ ... })` → `{ ... } as EuiTooltipInterface`\n // But if the argument is just a variable, we keep it: `varName as EuiTooltipInterface`\n const argText = source.slice(arg.getStart(sourceFile), arg.getEnd());\n\n if (ts.isObjectLiteralExpression(arg)) {\n // Inline object: `new EuiTooltipConfig({ x: 1 })` → `{ x: 1 }`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: argText,\n });\n } else {\n // Variable or expression: `new EuiTooltipConfig(opts)` → `opts`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: argText,\n });\n }\n } else if (!args || args.length === 0) {\n // `new EuiTooltipConfig()` → `{} as EuiTooltipInterface`\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: `{} as ${NEW_INTERFACE}`,\n });\n }\n return; // don't recurse into children we've already replaced\n }\n ts.forEachChild(node, visitNewExpressions);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitNewExpressions(stmt);\n }\n }\n\n // Fourth pass: rename all remaining identifier references (type annotations, etc.)\n const visitRefs = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) return;\n // Skip nodes we already covered in new expressions\n if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === OLD_CLASS) return;\n\n if (ts.isIdentifier(node) && node.text === OLD_CLASS) {\n // Ensure this is not part of an import declaration\n if (!isPartOfImport(node)) {\n edits.push({\n start: node.getStart(sourceFile),\n end: node.getEnd(),\n replacement: NEW_INTERFACE,\n });\n }\n }\n ts.forEachChild(node, visitRefs);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitRefs(stmt);\n }\n }\n\n return applyEdits(source, edits);\n}\n\nfunction isPartOfImport(node: ts.Node): boolean {\n let current: ts.Node | undefined = node.parent;\n while (current) {\n if (ts.isImportDeclaration(current)) return true;\n current = current.parent;\n }\n return false;\n}\n\nfunction removeImportSpecifier(\n namedImports: ts.NamedImports,\n specifier: ts.ImportSpecifier,\n sourceFile: ts.SourceFile,\n edits: Edit[],\n): void {\n const elements = namedImports.elements;\n if (elements.length === 1) {\n // Remove the entire import declaration\n const importDecl = namedImports.parent.parent;\n let end = importDecl.getEnd();\n // Also remove trailing newline if present\n const fullText = sourceFile.getFullText();\n if (fullText[end] === '\\n') end++;\n edits.push({\n start: importDecl.getStart(sourceFile),\n end,\n replacement: '',\n });\n } else {\n // Remove just this specifier with surrounding comma/whitespace\n const idx = elements.indexOf(specifier);\n let start: number;\n let end: number;\n if (idx < elements.length - 1) {\n // Not the last → remove from this specifier start to next specifier start\n start = specifier.getStart(sourceFile);\n end = elements[idx + 1].getStart(sourceFile);\n } else {\n // Last element → remove from previous element end to this end\n start = elements[idx - 1].getEnd();\n end = specifier.getEnd();\n }\n edits.push({ start, end, replacement: '' });\n }\n}\n\nfunction applyEdits(source: string, edits: Edit[]): string {\n const unique = deduplicateEdits(edits);\n let result = source;\n for (const edit of unique.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\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}`;\n seen.set(key, edit);\n }\n return Array.from(seen.values());\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('.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",
|
|
3005
|
+
"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 ModuleMapping {\n importPath: string;\n selectors: Record<string, string>;\n}\n\nconst MODULE_MAPPINGS: Record<string, ModuleMapping> = {\n EuiAccordionModule: {\n importPath: '@eui/components/eui-accordion',\n selectors: {\n 'eui-accordion': 'EuiAccordionComponent',\n 'eui-accordion-item': 'EuiAccordionItemComponent',\n euiAccordionItemHeader: 'EuiAccordionItemHeaderDirective',\n },\n },\n EuiAlertModule: {\n importPath: '@eui/components/eui-alert',\n selectors: {\n 'eui-alert': 'EuiAlertComponent',\n euiAlert: 'EuiAlertComponent',\n 'eui-alert-title': 'EuiAlertTitleComponent',\n },\n },\n EuiAutocompleteModule: {\n importPath: '@eui/components/eui-autocomplete',\n selectors: {\n 'eui-autocomplete': 'EuiAutocompleteComponent',\n euiAutocomplete: 'EuiAutocompleteComponent',\n 'eui-autocomplete-option': 'EuiAutocompleteOptionComponent',\n 'eui-autocomplete-option-group': 'EuiAutocompleteOptionGroupComponent',\n 'eui-autocomplete-panel': 'EuiAutocompletePanelComponent',\n },\n },\n EuiAvatarModule: {\n importPath: '@eui/components/eui-avatar',\n selectors: {\n 'eui-avatar': 'EuiAvatarComponent',\n euiAvatar: 'EuiAvatarComponent',\n },\n },\n EuiBadgeModule: {\n importPath: '@eui/components/eui-badge',\n selectors: {\n 'eui-badge': 'EuiBadgeComponent',\n euiBadge: 'EuiBadgeComponent',\n },\n },\n EuiBlockContentModule: {\n importPath: '@eui/components/eui-block-content',\n selectors: {\n 'eui-block-content': 'EuiBlockContentComponent',\n },\n },\n EuiBreadcrumbModule: {\n importPath: '@eui/components/eui-breadcrumb',\n selectors: {\n 'eui-breadcrumb': 'EuiBreadcrumbComponent',\n },\n },\n EuiButtonModule: {\n importPath: '@eui/components/eui-button',\n selectors: {\n euiButton: 'EuiButtonComponent',\n },\n },\n EuiButtonGroupModule: {\n importPath: '@eui/components/eui-button-group',\n selectors: {\n 'eui-button-group': 'EuiButtonGroupComponent',\n },\n },\n EuiCardModule: {\n importPath: '@eui/components/eui-card',\n selectors: {\n 'eui-card': 'EuiCardComponent',\n 'eui-card-header': 'EuiCardHeaderComponent',\n 'eui-card-header-title': 'EuiCardHeaderTitleComponent',\n 'eui-card-content': 'EuiCardContentComponent',\n 'eui-card-footer': 'EuiCardFooterComponent',\n 'eui-card-media': 'EuiCardMediaComponent',\n },\n },\n EuiChipModule: {\n importPath: '@eui/components/eui-chip',\n selectors: {\n 'eui-chip': 'EuiChipComponent',\n euiChip: 'EuiChipComponent',\n },\n },\n EuiChipListModule: {\n importPath: '@eui/components/eui-chip-list',\n selectors: {\n 'eui-chip-list': 'EuiChipListComponent',\n },\n },\n EuiChipGroupModule: {\n importPath: '@eui/components/eui-chip-group',\n selectors: {\n 'eui-chip-group': 'EuiChipGroupComponent',\n },\n },\n EuiDashboardCardModule: {\n importPath: '@eui/components/eui-dashboard-card',\n selectors: {\n 'eui-dashboard-card': 'EuiDashboardCardComponent',\n 'eui-dashboard-card-content': 'EuiDashboardCardContentComponent',\n 'eui-dashboard-card-content-header': 'EuiDashboardCardContentHeaderComponent',\n 'eui-dashboard-card-content-body': 'EuiDashboardCardContentBodyComponent',\n 'eui-dashboard-card-content-footer': 'EuiDashboardCardContentFooterComponent',\n },\n },\n EuiDashboardButtonModule: {\n importPath: '@eui/components/eui-dashboard-card',\n selectors: {\n 'eui-dashboard-card': 'EuiDashboardCardComponent',\n 'eui-dashboard-card-content': 'EuiDashboardCardContentComponent',\n 'eui-dashboard-card-content-header': 'EuiDashboardCardContentHeaderComponent',\n 'eui-dashboard-card-content-body': 'EuiDashboardCardContentBodyComponent',\n 'eui-dashboard-card-content-footer': 'EuiDashboardCardContentFooterComponent',\n },\n },\n EuiDatepickerModule: {\n importPath: '@eui/components/eui-datepicker',\n selectors: {\n 'eui-datepicker': 'EuiDatepickerComponent',\n },\n },\n EuiDateRangeSelectorModule: {\n importPath: '@eui/components/eui-date-range-selector',\n selectors: {\n 'eui-date-range-selector': 'EuiDateRangeSelectorComponent',\n },\n },\n EuiDialogModule: {\n importPath: '@eui/components/eui-dialog',\n selectors: {\n 'eui-dialog': 'EuiDialogComponent',\n 'eui-dialog-header': 'EuiDialogHeaderDirective',\n 'eui-dialog-footer': 'EuiDialogFooterDirective',\n 'eui-dialog-container': 'EuiDialogContainerComponent',\n },\n },\n EuiDisableContentModule: {\n importPath: '@eui/components/eui-disable-content',\n selectors: {\n 'eui-disable-content': 'EuiDisableContentComponent',\n },\n },\n EuiDiscussionThreadModule: {\n importPath: '@eui/components/eui-discussion-thread',\n selectors: {\n 'eui-discussion-thread': 'EuiDiscussionThreadComponent',\n 'eui-discussion-thread-item': 'EuiDiscussionThreadItemComponent',\n },\n },\n EuiDropdownModule: {\n importPath: '@eui/components/eui-dropdown',\n selectors: {\n 'eui-dropdown': 'EuiDropdownComponent',\n },\n },\n EuiFeedbackMessageModule: {\n importPath: '@eui/components/eui-feedback-message',\n selectors: {\n 'eui-feedback-message': 'EuiFeedbackMessageComponent',\n },\n },\n EuiFieldsetModule: {\n importPath: '@eui/components/eui-fieldset',\n selectors: {\n 'eui-fieldset': 'EuiFieldsetComponent',\n euiFieldsetLabelRightContent: 'EuiFieldsetLabelRightContentTagDirective',\n euiFieldsetLabelExtraContent: 'EuiFieldsetLabelExtraContentTagDirective',\n },\n },\n EuiFileUploadModule: {\n importPath: '@eui/components/eui-file-upload',\n selectors: {\n 'eui-file-upload': 'EuiFileUploadComponent',\n },\n },\n EuiGrowlModule: {\n importPath: '@eui/components/eui-growl',\n selectors: {\n 'eui-growl': 'EuiGrowlComponent',\n },\n },\n EuiIconModule: {\n importPath: '@eui/components/eui-icon',\n selectors: {\n 'eui-icon-svg': 'EuiIconSvgComponent',\n euiIconSvg: 'EuiIconSvgComponent',\n },\n },\n EuiIconButtonModule: {\n importPath: '@eui/components/eui-icon-button',\n selectors: {\n 'eui-icon-button': 'EuiIconButtonComponent',\n },\n },\n EuiIconToggleModule: {\n importPath: '@eui/components/eui-icon-toggle',\n selectors: {\n 'eui-icon-toggle': 'EuiIconToggleComponent',\n },\n },\n EuiInputCheckboxModule: {\n importPath: '@eui/components/eui-input-checkbox',\n selectors: {\n euiInputCheckBox: 'EuiInputCheckboxComponent',\n },\n },\n EuiInputGroupModule: {\n importPath: '@eui/components/eui-input-group',\n selectors: {\n euiInputGroup: 'EuiInputGroupComponent',\n 'eui-input-group-addon': 'EuiInputGroupAddOnComponent',\n euiInputGroupAddOn: 'EuiInputGroupAddOnComponent',\n 'eui-input-group-addon-item': 'EuiInputGroupAddOnItemComponent',\n euiInputGroupAddOnItem: 'EuiInputGroupAddOnItemComponent',\n },\n },\n EuiInputNumberModule: {\n importPath: '@eui/components/eui-input-number',\n selectors: {\n euiInputNumber: 'EuiInputNumberComponent',\n },\n },\n EuiInputRadioModule: {\n importPath: '@eui/components/eui-input-radio',\n selectors: {\n euiInputRadio: 'EuiInputRadioComponent',\n },\n },\n EuiInputTextModule: {\n importPath: '@eui/components/eui-input-text',\n selectors: {\n euiInputText: 'EuiInputTextComponent',\n },\n },\n EuiLabelModule: {\n importPath: '@eui/components/eui-label',\n selectors: {\n 'eui-label': 'EuiLabelComponent',\n euiLabel: 'EuiLabelComponent',\n },\n },\n EuiListModule: {\n importPath: '@eui/components/eui-list',\n selectors: {\n 'eui-list': 'EuiListComponent',\n euiList: 'EuiListComponent',\n 'eui-list-item': 'EuiListItemComponent',\n euiListItem: 'EuiListItemComponent',\n },\n },\n EuiMenuModule: {\n importPath: '@eui/components/eui-menu',\n selectors: {\n 'eui-menu': 'EuiMenuComponent',\n 'eui-menu-item': 'EuiMenuItemComponent',\n },\n },\n EuiMessageBoxModule: {\n importPath: '@eui/components/eui-message-box',\n selectors: {\n 'eui-message-box': 'EuiMessageBoxComponent',\n 'eui-message-box-footer': 'EuiMessageBoxFooterDirective',\n },\n },\n EuiOverlayModule: {\n importPath: '@eui/components/eui-overlay',\n selectors: {\n 'eui-overlay': 'EuiOverlayComponent',\n },\n },\n EuiPageModule: {\n importPath: '@eui/components/eui-page',\n selectors: {\n 'eui-page': 'EuiPageComponent',\n },\n },\n EuiPaginatorModule: {\n importPath: '@eui/components/eui-paginator',\n selectors: {\n 'eui-paginator': 'EuiPaginatorComponent',\n },\n },\n EuiPopoverModule: {\n importPath: '@eui/components/eui-popover',\n selectors: {\n 'eui-popover': 'EuiPopoverComponent',\n },\n },\n EuiProgressBarModule: {\n importPath: '@eui/components/eui-progress-bar',\n selectors: {\n 'eui-progress-bar': 'EuiProgressBarComponent',\n },\n },\n EuiProgressCircleModule: {\n importPath: '@eui/components/eui-progress-circle',\n selectors: {\n 'eui-progress-circle': 'EuiProgressCircleComponent',\n },\n },\n EuiSelectModule: {\n importPath: '@eui/components/eui-select',\n selectors: {\n euiSelect: 'EuiSelectComponent',\n },\n },\n EuiSidebarMenuModule: {\n importPath: '@eui/components/eui-sidebar-menu',\n selectors: {\n 'eui-sidebar-menu': 'EuiSidebarMenuComponent',\n },\n },\n EuiSkeletonModule: {\n importPath: '@eui/components/eui-skeleton',\n selectors: {\n 'eui-skeleton': 'EuiSkeletonComponent',\n },\n },\n EuiSlideToggleModule: {\n importPath: '@eui/components/eui-slide-toggle',\n selectors: {\n 'eui-slide-toggle': 'EuiSlideToggleComponent',\n },\n },\n EuiTableModule: {\n importPath: '@eui/components/eui-table',\n selectors: {\n 'eui-table': 'EuiTableComponent',\n euiTable: 'EuiTableComponent',\n 'eui-table-filter': 'EuiTableFilterComponent',\n isSortable: 'EuiTableSortableColComponent',\n isStickyCol: 'EuiTableStickyColDirective',\n isHeaderSelectable: 'EuiTableSelectableHeaderComponent',\n isDataSelectable: 'EuiTableSelectableRowComponent',\n isExpandableRow: 'EuiTableExpandableRowDirective',\n },\n },\n EuiTableV2Module: {\n importPath: '@eui/components/eui-table',\n selectors: {\n 'eui-table': 'EuiTableComponent',\n euiTable: 'EuiTableComponent',\n 'eui-table-filter': 'EuiTableFilterComponent',\n isSortable: 'EuiTableSortableColComponent',\n isStickyCol: 'EuiTableStickyColDirective',\n isHeaderSelectable: 'EuiTableSelectableHeaderComponent',\n isDataSelectable: 'EuiTableSelectableRowComponent',\n isExpandableRow: 'EuiTableExpandableRowDirective',\n },\n },\n EuiTabsModule: {\n importPath: '@eui/components/eui-tabs',\n selectors: {\n 'eui-tabs': 'EuiTabsComponent',\n 'eui-tab': 'EuiTabComponent',\n 'eui-tab-header': 'EuiTabHeaderComponent',\n 'eui-tab-body': 'EuiTabBodyComponent',\n },\n },\n EuiTextAreaModule: {\n importPath: '@eui/components/eui-textarea',\n selectors: {\n euiTextArea: 'EuiTextareaComponent',\n },\n },\n EuiTimelineModule: {\n importPath: '@eui/components/eui-timeline',\n selectors: {\n 'eui-timeline': 'EuiTimelineComponent',\n 'eui-timeline-item': 'EuiTimelineItemComponent',\n },\n },\n EuiTimepickerModule: {\n importPath: '@eui/components/eui-timepicker',\n selectors: {\n 'eui-timepicker': 'EuiTimepickerComponent',\n },\n },\n EuiTreeModule: {\n importPath: '@eui/components/eui-tree',\n selectors: {\n 'eui-tree': 'EuiTreeComponent',\n },\n },\n EuiTreeListModule: {\n importPath: '@eui/components/eui-tree-list',\n selectors: {\n 'eui-tree-list': 'EuiTreeListComponent',\n 'eui-tree-list-item': 'EuiTreeListItemComponent',\n },\n },\n EuiUserProfileModule: {\n importPath: '@eui/components/eui-user-profile',\n selectors: {\n 'eui-user-profile': 'EuiUserProfileComponent',\n },\n },\n EuiWizardModule: {\n importPath: '@eui/components/eui-wizard',\n selectors: {\n 'eui-wizard': 'EuiWizardComponent',\n 'eui-wizard-step': 'EuiWizardStepComponent',\n },\n },\n EuiTooltipDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiTooltip: 'EuiTooltipDirective',\n },\n },\n EuiTemplateDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiTemplate: 'EuiTemplateDirective',\n },\n },\n EuiResizableDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiResizable: 'EuiResizableDirective',\n 'eui-resizable': 'EuiResizableComponent',\n },\n },\n EuiMaxLengthDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiEditorMaxlength: 'EuiMaxLengthDirective',\n },\n },\n EuiTruncatePipeModule: {\n importPath: '@eui/components/pipes',\n selectors: {\n euiTruncate: 'EuiTruncatePipe',\n },\n },\n EuiLayoutModule: {\n importPath: '@eui/components/layout',\n selectors: {\n 'eui-app': 'EuiAppComponent',\n 'eui-header': 'EuiHeaderComponent',\n 'eui-footer': 'EuiFooterComponent',\n 'eui-toolbar': 'EuiToolbarComponent',\n 'eui-sidebar-toggle': 'EuiSidebarToggleComponent',\n },\n },\n};\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nexport function migrateToStandalone(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n const allModuleNames = Object.keys(MODULE_MAPPINGS);\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const source = buffer.toString('utf-8');\n if (!allModuleNames.some((m) => source.includes(m))) return;\n\n const sourceFile = ts.createSourceFile(path, source, ts.ScriptTarget.Latest, true);\n const componentDecorators = findComponentDecorators(sourceFile);\n\n for (const decorator of componentDecorators) {\n const importsNode = findImportsArrayNode(decorator);\n if (!importsNode) continue;\n\n const currentSource = tree.read(path)!.toString('utf-8');\n const modulesInArray = allModuleNames.filter((m) => hasModuleInArray(importsNode, m, source));\n if (modulesInArray.length === 0) continue;\n\n const templateSelectors = getTemplateSelectors(tree, path, decorator, source);\n const replacements = buildReplacements(modulesInArray, templateSelectors);\n if (replacements.size === 0) continue;\n\n const result = applyReplacements(currentSource, path, replacements);\n if (options.dryRun) {\n logDryRun(context, `Would replace module imports with standalone imports in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n }\n });\n\n context.logger.info('Migration to standalone imports complete.');\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('.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 buildReplacements(moduleNames: string[], templateSelectors: Set<string>): Map<string, { components: string[]; importPath: string }> {\n const map = new Map<string, { components: string[]; importPath: string }>();\n\n for (const moduleName of moduleNames) {\n const mapping = MODULE_MAPPINGS[moduleName];\n const components: string[] = [];\n\n for (const [selector, component] of Object.entries(mapping.selectors)) {\n if (templateSelectors.has(selector)) {\n components.push(component);\n }\n }\n\n if (components.length > 0) {\n map.set(moduleName, { components: [...new Set(components)].sort(), importPath: mapping.importPath });\n }\n }\n\n return map;\n}\n\nfunction findComponentDecorators(sourceFile: ts.SourceFile): ts.Decorator[] {\n const decorators: ts.Decorator[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node)) {\n const decs = ts.getDecorators(node);\n if (decs) {\n for (const dec of decs) {\n if (ts.isCallExpression(dec.expression) && ts.isIdentifier(dec.expression.expression) && dec.expression.expression.text === 'Component') {\n decorators.push(dec);\n }\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return decorators;\n}\n\nfunction findImportsArrayNode(decorator: ts.Decorator): ts.ArrayLiteralExpression | undefined {\n const call = decorator.expression as ts.CallExpression;\n const metadata = call.arguments[0];\n if (!ts.isObjectLiteralExpression(metadata)) return undefined;\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'imports') {\n if (ts.isArrayLiteralExpression(prop.initializer)) {\n return prop.initializer;\n }\n }\n }\n return undefined;\n}\n\nfunction hasModuleInArray(array: ts.ArrayLiteralExpression, moduleName: string, source: string): boolean {\n return array.elements.some((el) => source.slice(el.getStart(), el.getEnd()).trim() === moduleName);\n}\n\nfunction getTemplateSelectors(tree: Tree, tsPath: string, decorator: ts.Decorator, source: string): Set<string> {\n const call = decorator.expression as ts.CallExpression;\n const metadata = call.arguments[0] as ts.ObjectLiteralExpression;\n const allSelectors = Object.values(MODULE_MAPPINGS).flatMap((m) => Object.keys(m.selectors));\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'template') {\n const init = prop.initializer;\n if (ts.isStringLiteral(init) || ts.isNoSubstitutionTemplateLiteral(init)) {\n return findSelectorsInTemplate(init.text, allSelectors);\n }\n }\n }\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'templateUrl') {\n if (ts.isStringLiteral(prop.initializer)) {\n const dir = tsPath.substring(0, tsPath.lastIndexOf('/'));\n const templateBuffer = tree.read(`${dir}/${prop.initializer.text}`);\n if (templateBuffer) {\n return findSelectorsInTemplate(templateBuffer.toString('utf-8'), allSelectors);\n }\n }\n }\n }\n\n return new Set();\n}\n\nfunction findSelectorsInTemplate(html: string, knownSelectors: string[]): Set<string> {\n const selectors = new Set<string>();\n const parsed = parseTemplate(html, '', { preserveWhitespaces: true });\n\n const visit = (nodes: TmplAstNode[]): void => {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (knownSelectors.includes(node.name)) selectors.add(node.name);\n for (const attr of node.attributes) {\n if (knownSelectors.includes(attr.name)) selectors.add(attr.name);\n }\n visit(node.children);\n }\n }\n };\n visit(parsed.nodes);\n return selectors;\n}\n\nfunction applyReplacements(source: string, filePath: string, replacements: Map<string, { components: string[]; importPath: string }>): string {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n let result = replaceInImportsArray(source, sourceFile, replacements);\n result = updateEsImports(result, filePath, replacements);\n return result;\n}\n\nfunction replaceInImportsArray(source: string, sourceFile: ts.SourceFile, replacements: Map<string, { components: string[]; importPath: string }>): string {\n let result = source;\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node)) {\n const decs = ts.getDecorators(node);\n if (!decs) return;\n for (const dec of decs) {\n if (!ts.isCallExpression(dec.expression) || !ts.isIdentifier(dec.expression.expression) || dec.expression.expression.text !== 'Component') continue;\n const metadata = dec.expression.arguments[0];\n if (!ts.isObjectLiteralExpression(metadata)) continue;\n for (const prop of metadata.properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name) || prop.name.text !== 'imports') continue;\n if (!ts.isArrayLiteralExpression(prop.initializer)) continue;\n const newElements = prop.initializer.elements\n .map((el) => {\n const text = result.slice(el.getStart(sourceFile), el.getEnd()).trim();\n const replacement = replacements.get(text);\n return replacement ? replacement.components.join(', ') : text;\n })\n .join(', ');\n result = result.slice(0, prop.initializer.getStart(sourceFile) + 1) + newElements + result.slice(prop.initializer.getEnd() - 1);\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return result;\n}\n\nfunction updateEsImports(source: string, filePath: string, replacements: Map<string, { components: string[]; importPath: string }>): string {\n let result = source;\n\n for (const [moduleName, { components, importPath }] of replacements) {\n const sf = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n\n for (const stmt of sf.statements) {\n if (!ts.isImportDeclaration(stmt) || !stmt.importClause?.namedBindings || !ts.isNamedImports(stmt.importClause.namedBindings)) continue;\n const namedBindings = stmt.importClause.namedBindings;\n const importNames = namedBindings.elements.map((el) => el.name.text);\n if (!importNames.includes(moduleName)) continue;\n\n const moduleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n const remaining = importNames.filter((n) => n !== moduleName);\n const toAdd = components.filter((c) => !importNames.includes(c));\n\n if (moduleSpecifier === importPath) {\n const newNames = [...remaining, ...toAdd].sort();\n const newClause = `{ ${newNames.join(', ')} }`;\n result = result.slice(0, namedBindings.getStart(sf)) + newClause + result.slice(namedBindings.getEnd());\n } else {\n if (remaining.length > 0) {\n const newClause = `{ ${remaining.join(', ')} }`;\n result = result.slice(0, namedBindings.getStart(sf)) + newClause + result.slice(namedBindings.getEnd());\n } else {\n result = result.slice(0, stmt.getStart(sf)) + result.slice(stmt.getEnd()).replace(/^\\r?\\n/, '');\n }\n\n if (toAdd.length > 0) {\n const updatedSf = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n const existing = updatedSf.statements.find(\n (s) => ts.isImportDeclaration(s) && ts.isStringLiteral(s.moduleSpecifier) && s.moduleSpecifier.text === importPath,\n ) as ts.ImportDeclaration | undefined;\n\n if (existing?.importClause?.namedBindings && ts.isNamedImports(existing.importClause.namedBindings)) {\n const existingNames = existing.importClause.namedBindings.elements.map((el) => el.name.text);\n const allNames = [...new Set([...existingNames, ...toAdd])].sort();\n const newClause = `{ ${allNames.join(', ')} }`;\n result = result.slice(0, existing.importClause.namedBindings.getStart(updatedSf)) + newClause + result.slice(existing.importClause.namedBindings.getEnd());\n } else {\n const newImport = `import { ${toAdd.join(', ')} } from '${importPath}';\\n`;\n result = newImport + result;\n }\n }\n }\n break;\n }\n }\n\n return result;\n}\n",
|
|
3006
3006
|
"displayName": "Schema",
|
|
3007
3007
|
"properties": [
|
|
3008
3008
|
{
|
|
@@ -3014,7 +3014,7 @@
|
|
|
3014
3014
|
"indexKey": "",
|
|
3015
3015
|
"optional": true,
|
|
3016
3016
|
"description": "",
|
|
3017
|
-
"line":
|
|
3017
|
+
"line": 460,
|
|
3018
3018
|
"rawdescription": "\n"
|
|
3019
3019
|
},
|
|
3020
3020
|
{
|
|
@@ -3026,7 +3026,7 @@
|
|
|
3026
3026
|
"indexKey": "",
|
|
3027
3027
|
"optional": true,
|
|
3028
3028
|
"description": "",
|
|
3029
|
-
"line":
|
|
3029
|
+
"line": 459,
|
|
3030
3030
|
"rawdescription": "\n"
|
|
3031
3031
|
}
|
|
3032
3032
|
],
|
|
@@ -3044,12 +3044,12 @@
|
|
|
3044
3044
|
},
|
|
3045
3045
|
{
|
|
3046
3046
|
"name": "Schema",
|
|
3047
|
-
"id": "interface-Schema-
|
|
3048
|
-
"file": "packages/core/schematics/migrate-
|
|
3047
|
+
"id": "interface-Schema-e1cd02924eb82a618c71a0b26c081bdd020519d2699aa0e2dc98640c4e0f347c3649b967c5fc87543e41bbbfabd1304835850ccc38f40684d6521c242b2030ed-21",
|
|
3048
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
3049
3049
|
"deprecated": false,
|
|
3050
3050
|
"deprecationMessage": "",
|
|
3051
3051
|
"type": "interface",
|
|
3052
|
-
"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 ModuleMapping {\n importPath: string;\n selectors: Record<string, string>;\n}\n\nconst MODULE_MAPPINGS: Record<string, ModuleMapping> = {\n EuiAccordionModule: {\n importPath: '@eui/components/eui-accordion',\n selectors: {\n 'eui-accordion': 'EuiAccordionComponent',\n 'eui-accordion-item': 'EuiAccordionItemComponent',\n euiAccordionItemHeader: 'EuiAccordionItemHeaderDirective',\n },\n },\n EuiAlertModule: {\n importPath: '@eui/components/eui-alert',\n selectors: {\n 'eui-alert': 'EuiAlertComponent',\n euiAlert: 'EuiAlertComponent',\n 'eui-alert-title': 'EuiAlertTitleComponent',\n },\n },\n EuiAutocompleteModule: {\n importPath: '@eui/components/eui-autocomplete',\n selectors: {\n 'eui-autocomplete': 'EuiAutocompleteComponent',\n euiAutocomplete: 'EuiAutocompleteComponent',\n 'eui-autocomplete-option': 'EuiAutocompleteOptionComponent',\n 'eui-autocomplete-option-group': 'EuiAutocompleteOptionGroupComponent',\n 'eui-autocomplete-panel': 'EuiAutocompletePanelComponent',\n },\n },\n EuiAvatarModule: {\n importPath: '@eui/components/eui-avatar',\n selectors: {\n 'eui-avatar': 'EuiAvatarComponent',\n euiAvatar: 'EuiAvatarComponent',\n },\n },\n EuiBadgeModule: {\n importPath: '@eui/components/eui-badge',\n selectors: {\n 'eui-badge': 'EuiBadgeComponent',\n euiBadge: 'EuiBadgeComponent',\n },\n },\n EuiBlockContentModule: {\n importPath: '@eui/components/eui-block-content',\n selectors: {\n 'eui-block-content': 'EuiBlockContentComponent',\n },\n },\n EuiBreadcrumbModule: {\n importPath: '@eui/components/eui-breadcrumb',\n selectors: {\n 'eui-breadcrumb': 'EuiBreadcrumbComponent',\n },\n },\n EuiButtonModule: {\n importPath: '@eui/components/eui-button',\n selectors: {\n euiButton: 'EuiButtonComponent',\n },\n },\n EuiButtonGroupModule: {\n importPath: '@eui/components/eui-button-group',\n selectors: {\n 'eui-button-group': 'EuiButtonGroupComponent',\n },\n },\n EuiCardModule: {\n importPath: '@eui/components/eui-card',\n selectors: {\n 'eui-card': 'EuiCardComponent',\n 'eui-card-header': 'EuiCardHeaderComponent',\n 'eui-card-header-title': 'EuiCardHeaderTitleComponent',\n 'eui-card-content': 'EuiCardContentComponent',\n 'eui-card-footer': 'EuiCardFooterComponent',\n 'eui-card-media': 'EuiCardMediaComponent',\n },\n },\n EuiChipModule: {\n importPath: '@eui/components/eui-chip',\n selectors: {\n 'eui-chip': 'EuiChipComponent',\n euiChip: 'EuiChipComponent',\n },\n },\n EuiChipListModule: {\n importPath: '@eui/components/eui-chip-list',\n selectors: {\n 'eui-chip-list': 'EuiChipListComponent',\n },\n },\n EuiChipGroupModule: {\n importPath: '@eui/components/eui-chip-group',\n selectors: {\n 'eui-chip-group': 'EuiChipGroupComponent',\n },\n },\n EuiDashboardCardModule: {\n importPath: '@eui/components/eui-dashboard-card',\n selectors: {\n 'eui-dashboard-card': 'EuiDashboardCardComponent',\n 'eui-dashboard-card-content': 'EuiDashboardCardContentComponent',\n 'eui-dashboard-card-content-header': 'EuiDashboardCardContentHeaderComponent',\n 'eui-dashboard-card-content-body': 'EuiDashboardCardContentBodyComponent',\n 'eui-dashboard-card-content-footer': 'EuiDashboardCardContentFooterComponent',\n },\n },\n EuiDashboardButtonModule: {\n importPath: '@eui/components/eui-dashboard-card',\n selectors: {\n 'eui-dashboard-card': 'EuiDashboardCardComponent',\n 'eui-dashboard-card-content': 'EuiDashboardCardContentComponent',\n 'eui-dashboard-card-content-header': 'EuiDashboardCardContentHeaderComponent',\n 'eui-dashboard-card-content-body': 'EuiDashboardCardContentBodyComponent',\n 'eui-dashboard-card-content-footer': 'EuiDashboardCardContentFooterComponent',\n },\n },\n EuiDatepickerModule: {\n importPath: '@eui/components/eui-datepicker',\n selectors: {\n 'eui-datepicker': 'EuiDatepickerComponent',\n },\n },\n EuiDateRangeSelectorModule: {\n importPath: '@eui/components/eui-date-range-selector',\n selectors: {\n 'eui-date-range-selector': 'EuiDateRangeSelectorComponent',\n },\n },\n EuiDialogModule: {\n importPath: '@eui/components/eui-dialog',\n selectors: {\n 'eui-dialog': 'EuiDialogComponent',\n 'eui-dialog-header': 'EuiDialogHeaderDirective',\n 'eui-dialog-footer': 'EuiDialogFooterDirective',\n 'eui-dialog-container': 'EuiDialogContainerComponent',\n },\n },\n EuiDisableContentModule: {\n importPath: '@eui/components/eui-disable-content',\n selectors: {\n 'eui-disable-content': 'EuiDisableContentComponent',\n },\n },\n EuiDiscussionThreadModule: {\n importPath: '@eui/components/eui-discussion-thread',\n selectors: {\n 'eui-discussion-thread': 'EuiDiscussionThreadComponent',\n 'eui-discussion-thread-item': 'EuiDiscussionThreadItemComponent',\n },\n },\n EuiDropdownModule: {\n importPath: '@eui/components/eui-dropdown',\n selectors: {\n 'eui-dropdown': 'EuiDropdownComponent',\n },\n },\n EuiFeedbackMessageModule: {\n importPath: '@eui/components/eui-feedback-message',\n selectors: {\n 'eui-feedback-message': 'EuiFeedbackMessageComponent',\n },\n },\n EuiFieldsetModule: {\n importPath: '@eui/components/eui-fieldset',\n selectors: {\n 'eui-fieldset': 'EuiFieldsetComponent',\n euiFieldsetLabelRightContent: 'EuiFieldsetLabelRightContentTagDirective',\n euiFieldsetLabelExtraContent: 'EuiFieldsetLabelExtraContentTagDirective',\n },\n },\n EuiFileUploadModule: {\n importPath: '@eui/components/eui-file-upload',\n selectors: {\n 'eui-file-upload': 'EuiFileUploadComponent',\n },\n },\n EuiGrowlModule: {\n importPath: '@eui/components/eui-growl',\n selectors: {\n 'eui-growl': 'EuiGrowlComponent',\n },\n },\n EuiIconModule: {\n importPath: '@eui/components/eui-icon',\n selectors: {\n 'eui-icon-svg': 'EuiIconSvgComponent',\n euiIconSvg: 'EuiIconSvgComponent',\n },\n },\n EuiIconButtonModule: {\n importPath: '@eui/components/eui-icon-button',\n selectors: {\n 'eui-icon-button': 'EuiIconButtonComponent',\n },\n },\n EuiIconToggleModule: {\n importPath: '@eui/components/eui-icon-toggle',\n selectors: {\n 'eui-icon-toggle': 'EuiIconToggleComponent',\n },\n },\n EuiInputCheckboxModule: {\n importPath: '@eui/components/eui-input-checkbox',\n selectors: {\n euiInputCheckBox: 'EuiInputCheckboxComponent',\n },\n },\n EuiInputGroupModule: {\n importPath: '@eui/components/eui-input-group',\n selectors: {\n euiInputGroup: 'EuiInputGroupComponent',\n 'eui-input-group-addon': 'EuiInputGroupAddOnComponent',\n euiInputGroupAddOn: 'EuiInputGroupAddOnComponent',\n 'eui-input-group-addon-item': 'EuiInputGroupAddOnItemComponent',\n euiInputGroupAddOnItem: 'EuiInputGroupAddOnItemComponent',\n },\n },\n EuiInputNumberModule: {\n importPath: '@eui/components/eui-input-number',\n selectors: {\n euiInputNumber: 'EuiInputNumberComponent',\n },\n },\n EuiInputRadioModule: {\n importPath: '@eui/components/eui-input-radio',\n selectors: {\n euiInputRadio: 'EuiInputRadioComponent',\n },\n },\n EuiInputTextModule: {\n importPath: '@eui/components/eui-input-text',\n selectors: {\n euiInputText: 'EuiInputTextComponent',\n },\n },\n EuiLabelModule: {\n importPath: '@eui/components/eui-label',\n selectors: {\n 'eui-label': 'EuiLabelComponent',\n euiLabel: 'EuiLabelComponent',\n },\n },\n EuiListModule: {\n importPath: '@eui/components/eui-list',\n selectors: {\n 'eui-list': 'EuiListComponent',\n euiList: 'EuiListComponent',\n 'eui-list-item': 'EuiListItemComponent',\n euiListItem: 'EuiListItemComponent',\n },\n },\n EuiMenuModule: {\n importPath: '@eui/components/eui-menu',\n selectors: {\n 'eui-menu': 'EuiMenuComponent',\n 'eui-menu-item': 'EuiMenuItemComponent',\n },\n },\n EuiMessageBoxModule: {\n importPath: '@eui/components/eui-message-box',\n selectors: {\n 'eui-message-box': 'EuiMessageBoxComponent',\n 'eui-message-box-footer': 'EuiMessageBoxFooterDirective',\n },\n },\n EuiOverlayModule: {\n importPath: '@eui/components/eui-overlay',\n selectors: {\n 'eui-overlay': 'EuiOverlayComponent',\n },\n },\n EuiPageModule: {\n importPath: '@eui/components/eui-page',\n selectors: {\n 'eui-page': 'EuiPageComponent',\n },\n },\n EuiPaginatorModule: {\n importPath: '@eui/components/eui-paginator',\n selectors: {\n 'eui-paginator': 'EuiPaginatorComponent',\n },\n },\n EuiPopoverModule: {\n importPath: '@eui/components/eui-popover',\n selectors: {\n 'eui-popover': 'EuiPopoverComponent',\n },\n },\n EuiProgressBarModule: {\n importPath: '@eui/components/eui-progress-bar',\n selectors: {\n 'eui-progress-bar': 'EuiProgressBarComponent',\n },\n },\n EuiProgressCircleModule: {\n importPath: '@eui/components/eui-progress-circle',\n selectors: {\n 'eui-progress-circle': 'EuiProgressCircleComponent',\n },\n },\n EuiSelectModule: {\n importPath: '@eui/components/eui-select',\n selectors: {\n euiSelect: 'EuiSelectComponent',\n },\n },\n EuiSidebarMenuModule: {\n importPath: '@eui/components/eui-sidebar-menu',\n selectors: {\n 'eui-sidebar-menu': 'EuiSidebarMenuComponent',\n },\n },\n EuiSkeletonModule: {\n importPath: '@eui/components/eui-skeleton',\n selectors: {\n 'eui-skeleton': 'EuiSkeletonComponent',\n },\n },\n EuiSlideToggleModule: {\n importPath: '@eui/components/eui-slide-toggle',\n selectors: {\n 'eui-slide-toggle': 'EuiSlideToggleComponent',\n },\n },\n EuiTableModule: {\n importPath: '@eui/components/eui-table',\n selectors: {\n 'eui-table': 'EuiTableComponent',\n euiTable: 'EuiTableComponent',\n 'eui-table-filter': 'EuiTableFilterComponent',\n isSortable: 'EuiTableSortableColComponent',\n isStickyCol: 'EuiTableStickyColDirective',\n isHeaderSelectable: 'EuiTableSelectableHeaderComponent',\n isDataSelectable: 'EuiTableSelectableRowComponent',\n isExpandableRow: 'EuiTableExpandableRowDirective',\n },\n },\n EuiTableV2Module: {\n importPath: '@eui/components/eui-table',\n selectors: {\n 'eui-table': 'EuiTableComponent',\n euiTable: 'EuiTableComponent',\n 'eui-table-filter': 'EuiTableFilterComponent',\n isSortable: 'EuiTableSortableColComponent',\n isStickyCol: 'EuiTableStickyColDirective',\n isHeaderSelectable: 'EuiTableSelectableHeaderComponent',\n isDataSelectable: 'EuiTableSelectableRowComponent',\n isExpandableRow: 'EuiTableExpandableRowDirective',\n },\n },\n EuiTabsModule: {\n importPath: '@eui/components/eui-tabs',\n selectors: {\n 'eui-tabs': 'EuiTabsComponent',\n 'eui-tab': 'EuiTabComponent',\n 'eui-tab-header': 'EuiTabHeaderComponent',\n 'eui-tab-body': 'EuiTabBodyComponent',\n },\n },\n EuiTextAreaModule: {\n importPath: '@eui/components/eui-textarea',\n selectors: {\n euiTextArea: 'EuiTextareaComponent',\n },\n },\n EuiTimelineModule: {\n importPath: '@eui/components/eui-timeline',\n selectors: {\n 'eui-timeline': 'EuiTimelineComponent',\n 'eui-timeline-item': 'EuiTimelineItemComponent',\n },\n },\n EuiTimepickerModule: {\n importPath: '@eui/components/eui-timepicker',\n selectors: {\n 'eui-timepicker': 'EuiTimepickerComponent',\n },\n },\n EuiTreeModule: {\n importPath: '@eui/components/eui-tree',\n selectors: {\n 'eui-tree': 'EuiTreeComponent',\n },\n },\n EuiTreeListModule: {\n importPath: '@eui/components/eui-tree-list',\n selectors: {\n 'eui-tree-list': 'EuiTreeListComponent',\n 'eui-tree-list-item': 'EuiTreeListItemComponent',\n },\n },\n EuiUserProfileModule: {\n importPath: '@eui/components/eui-user-profile',\n selectors: {\n 'eui-user-profile': 'EuiUserProfileComponent',\n },\n },\n EuiWizardModule: {\n importPath: '@eui/components/eui-wizard',\n selectors: {\n 'eui-wizard': 'EuiWizardComponent',\n 'eui-wizard-step': 'EuiWizardStepComponent',\n },\n },\n EuiTooltipDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiTooltip: 'EuiTooltipDirective',\n },\n },\n EuiTemplateDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiTemplate: 'EuiTemplateDirective',\n },\n },\n EuiResizableDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiResizable: 'EuiResizableDirective',\n 'eui-resizable': 'EuiResizableComponent',\n },\n },\n EuiMaxLengthDirectiveModule: {\n importPath: '@eui/components/directives',\n selectors: {\n euiEditorMaxlength: 'EuiMaxLengthDirective',\n },\n },\n EuiTruncatePipeModule: {\n importPath: '@eui/components/pipes',\n selectors: {\n euiTruncate: 'EuiTruncatePipe',\n },\n },\n EuiLayoutModule: {\n importPath: '@eui/components/layout',\n selectors: {\n 'eui-app': 'EuiAppComponent',\n 'eui-header': 'EuiHeaderComponent',\n 'eui-footer': 'EuiFooterComponent',\n 'eui-toolbar': 'EuiToolbarComponent',\n 'eui-sidebar-toggle': 'EuiSidebarToggleComponent',\n },\n },\n};\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nexport function migrateToStandalone(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n const allModuleNames = Object.keys(MODULE_MAPPINGS);\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const source = buffer.toString('utf-8');\n if (!allModuleNames.some((m) => source.includes(m))) return;\n\n const sourceFile = ts.createSourceFile(path, source, ts.ScriptTarget.Latest, true);\n const componentDecorators = findComponentDecorators(sourceFile);\n\n for (const decorator of componentDecorators) {\n const importsNode = findImportsArrayNode(decorator);\n if (!importsNode) continue;\n\n const currentSource = tree.read(path)!.toString('utf-8');\n const modulesInArray = allModuleNames.filter((m) => hasModuleInArray(importsNode, m, source));\n if (modulesInArray.length === 0) continue;\n\n const templateSelectors = getTemplateSelectors(tree, path, decorator, source);\n const replacements = buildReplacements(modulesInArray, templateSelectors);\n if (replacements.size === 0) continue;\n\n const result = applyReplacements(currentSource, path, replacements);\n if (options.dryRun) {\n logDryRun(context, `Would replace module imports with standalone imports in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n }\n });\n\n context.logger.info('Migration to standalone imports complete.');\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('.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 buildReplacements(moduleNames: string[], templateSelectors: Set<string>): Map<string, { components: string[]; importPath: string }> {\n const map = new Map<string, { components: string[]; importPath: string }>();\n\n for (const moduleName of moduleNames) {\n const mapping = MODULE_MAPPINGS[moduleName];\n const components: string[] = [];\n\n for (const [selector, component] of Object.entries(mapping.selectors)) {\n if (templateSelectors.has(selector)) {\n components.push(component);\n }\n }\n\n if (components.length > 0) {\n map.set(moduleName, { components: [...new Set(components)].sort(), importPath: mapping.importPath });\n }\n }\n\n return map;\n}\n\nfunction findComponentDecorators(sourceFile: ts.SourceFile): ts.Decorator[] {\n const decorators: ts.Decorator[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node)) {\n const decs = ts.getDecorators(node);\n if (decs) {\n for (const dec of decs) {\n if (ts.isCallExpression(dec.expression) && ts.isIdentifier(dec.expression.expression) && dec.expression.expression.text === 'Component') {\n decorators.push(dec);\n }\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return decorators;\n}\n\nfunction findImportsArrayNode(decorator: ts.Decorator): ts.ArrayLiteralExpression | undefined {\n const call = decorator.expression as ts.CallExpression;\n const metadata = call.arguments[0];\n if (!ts.isObjectLiteralExpression(metadata)) return undefined;\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'imports') {\n if (ts.isArrayLiteralExpression(prop.initializer)) {\n return prop.initializer;\n }\n }\n }\n return undefined;\n}\n\nfunction hasModuleInArray(array: ts.ArrayLiteralExpression, moduleName: string, source: string): boolean {\n return array.elements.some((el) => source.slice(el.getStart(), el.getEnd()).trim() === moduleName);\n}\n\nfunction getTemplateSelectors(tree: Tree, tsPath: string, decorator: ts.Decorator, source: string): Set<string> {\n const call = decorator.expression as ts.CallExpression;\n const metadata = call.arguments[0] as ts.ObjectLiteralExpression;\n const allSelectors = Object.values(MODULE_MAPPINGS).flatMap((m) => Object.keys(m.selectors));\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'template') {\n const init = prop.initializer;\n if (ts.isStringLiteral(init) || ts.isNoSubstitutionTemplateLiteral(init)) {\n return findSelectorsInTemplate(init.text, allSelectors);\n }\n }\n }\n\n for (const prop of metadata.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === 'templateUrl') {\n if (ts.isStringLiteral(prop.initializer)) {\n const dir = tsPath.substring(0, tsPath.lastIndexOf('/'));\n const templateBuffer = tree.read(`${dir}/${prop.initializer.text}`);\n if (templateBuffer) {\n return findSelectorsInTemplate(templateBuffer.toString('utf-8'), allSelectors);\n }\n }\n }\n }\n\n return new Set();\n}\n\nfunction findSelectorsInTemplate(html: string, knownSelectors: string[]): Set<string> {\n const selectors = new Set<string>();\n const parsed = parseTemplate(html, '', { preserveWhitespaces: true });\n\n const visit = (nodes: TmplAstNode[]): void => {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (knownSelectors.includes(node.name)) selectors.add(node.name);\n for (const attr of node.attributes) {\n if (knownSelectors.includes(attr.name)) selectors.add(attr.name);\n }\n visit(node.children);\n }\n }\n };\n visit(parsed.nodes);\n return selectors;\n}\n\nfunction applyReplacements(source: string, filePath: string, replacements: Map<string, { components: string[]; importPath: string }>): string {\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n let result = replaceInImportsArray(source, sourceFile, replacements);\n result = updateEsImports(result, filePath, replacements);\n return result;\n}\n\nfunction replaceInImportsArray(source: string, sourceFile: ts.SourceFile, replacements: Map<string, { components: string[]; importPath: string }>): string {\n let result = source;\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node)) {\n const decs = ts.getDecorators(node);\n if (!decs) return;\n for (const dec of decs) {\n if (!ts.isCallExpression(dec.expression) || !ts.isIdentifier(dec.expression.expression) || dec.expression.expression.text !== 'Component') continue;\n const metadata = dec.expression.arguments[0];\n if (!ts.isObjectLiteralExpression(metadata)) continue;\n for (const prop of metadata.properties) {\n if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name) || prop.name.text !== 'imports') continue;\n if (!ts.isArrayLiteralExpression(prop.initializer)) continue;\n const newElements = prop.initializer.elements\n .map((el) => {\n const text = result.slice(el.getStart(sourceFile), el.getEnd()).trim();\n const replacement = replacements.get(text);\n return replacement ? replacement.components.join(', ') : text;\n })\n .join(', ');\n result = result.slice(0, prop.initializer.getStart(sourceFile) + 1) + newElements + result.slice(prop.initializer.getEnd() - 1);\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return result;\n}\n\nfunction updateEsImports(source: string, filePath: string, replacements: Map<string, { components: string[]; importPath: string }>): string {\n let result = source;\n\n for (const [moduleName, { components, importPath }] of replacements) {\n const sf = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n\n for (const stmt of sf.statements) {\n if (!ts.isImportDeclaration(stmt) || !stmt.importClause?.namedBindings || !ts.isNamedImports(stmt.importClause.namedBindings)) continue;\n const namedBindings = stmt.importClause.namedBindings;\n const importNames = namedBindings.elements.map((el) => el.name.text);\n if (!importNames.includes(moduleName)) continue;\n\n const moduleSpecifier = (stmt.moduleSpecifier as ts.StringLiteral).text;\n const remaining = importNames.filter((n) => n !== moduleName);\n const toAdd = components.filter((c) => !importNames.includes(c));\n\n if (moduleSpecifier === importPath) {\n const newNames = [...remaining, ...toAdd].sort();\n const newClause = `{ ${newNames.join(', ')} }`;\n result = result.slice(0, namedBindings.getStart(sf)) + newClause + result.slice(namedBindings.getEnd());\n } else {\n if (remaining.length > 0) {\n const newClause = `{ ${remaining.join(', ')} }`;\n result = result.slice(0, namedBindings.getStart(sf)) + newClause + result.slice(namedBindings.getEnd());\n } else {\n result = result.slice(0, stmt.getStart(sf)) + result.slice(stmt.getEnd()).replace(/^\\r?\\n/, '');\n }\n\n if (toAdd.length > 0) {\n const updatedSf = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n const existing = updatedSf.statements.find(\n (s) => ts.isImportDeclaration(s) && ts.isStringLiteral(s.moduleSpecifier) && s.moduleSpecifier.text === importPath,\n ) as ts.ImportDeclaration | undefined;\n\n if (existing?.importClause?.namedBindings && ts.isNamedImports(existing.importClause.namedBindings)) {\n const existingNames = existing.importClause.namedBindings.elements.map((el) => el.name.text);\n const allNames = [...new Set([...existingNames, ...toAdd])].sort();\n const newClause = `{ ${allNames.join(', ')} }`;\n result = result.slice(0, existing.importClause.namedBindings.getStart(updatedSf)) + newClause + result.slice(existing.importClause.namedBindings.getEnd());\n } else {\n const newImport = `import { ${toAdd.join(', ')} } from '${importPath}';\\n`;\n result = newImport + result;\n }\n }\n }\n break;\n }\n }\n\n return result;\n}\n",
|
|
3052
|
+
"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\nconst OLD_TAG = 'eui-toolbar-menu';\nconst NEW_TAG = 'eui-toolbar-mega-menu';\nconst OLD_COMPONENT = 'EuiToolbarMenuComponent';\nconst NEW_COMPONENT = 'EuiToolbarMegaMenuComponent';\nconst OLD_INTERFACE = 'ToolbarItem';\nconst NEW_INTERFACE = 'EuiMenuItem';\nconst NEW_COMPONENT_PATH = '@eui/components/layout';\nconst NEW_INTERFACE_PATH = '@eui/core';\nconst REMOVED_OUTPUT = 'menuItemClick';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\ninterface Edit {\n start: number;\n end: number;\n replacement: string;\n}\n\nexport function migrateEuiToolbarMenu(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let fileCount = 0;\n\n visitDir(tree.getDir(scanPath || '/'), (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n if (!original.includes(OLD_TAG) && !original.includes(OLD_COMPONENT) && !original.includes(OLD_INTERFACE)) return;\n\n let result: string;\n\n if (path.endsWith('.html')) {\n result = migrateTemplate(original, path, context);\n } else {\n result = migrateTypeScript(original, path, context);\n }\n\n if (result !== original) {\n if (options.dryRun) {\n logDryRun(context, `Would migrate eui-toolbar-menu → eui-toolbar-mega-menu in ${path}`);\n } else {\n tree.overwrite(path, result);\n }\n fileCount++;\n }\n });\n\n context.logger.info(`Migrated eui-toolbar-menu → eui-toolbar-mega-menu in ${fileCount} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction migrateTemplate(source: string, filePath: string, context: SchematicContext): string {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n const edits: Edit[] = [];\n\n visitNodes(parsed.nodes, source, edits, filePath, context);\n\n return applyEdits(source, edits);\n}\n\nfunction migrateTypeScript(source: string, filePath: string, context: SchematicContext): string {\n let result = migrateInlineTemplates(source, filePath, context);\n result = migrateImportsAndTypes(result, filePath, context);\n return result;\n}\n\nfunction migrateInlineTemplates(source: string, filePath: string, context: SchematicContext): string {\n const sourceFile = ts.createSourceFile('', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const changes: Edit[] = [];\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_TAG)) {\n ts.forEachChild(node, visit); return; \n}\n const migrated = migrateTemplate(rawTemplate, filePath, context);\n if (migrated !== rawTemplate) changes.push({ start, end, replacement: migrated });\n }\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n return applyEdits(source, changes);\n}\n\nfunction migrateImportsAndTypes(source: string, filePath: string, context: SchematicContext): string {\n if (!source.includes(OLD_COMPONENT) && !source.includes(OLD_INTERFACE)) return source;\n\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const edits: Edit[] = [];\n\n // Track if EuiMenuItem is already imported from @eui/core\n let hasEuiMenuItemImport = false;\n\n // First pass: analyze imports\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const moduleSpec = (stmt.moduleSpecifier as ts.StringLiteral).text;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n for (const specifier of namedBindings.elements) {\n if (specifier.name.text === NEW_INTERFACE && moduleSpec === NEW_INTERFACE_PATH) {\n hasEuiMenuItemImport = true;\n }\n }\n }\n\n // Second pass: collect edits for import declarations\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const namedBindings = stmt.importClause?.namedBindings;\n if (!namedBindings || !ts.isNamedImports(namedBindings)) continue;\n\n const moduleSpec = stmt.moduleSpecifier as ts.StringLiteral;\n const specifiers = namedBindings.elements;\n const hasComponent = specifiers.some((s) => s.name.text === OLD_COMPONENT);\n const hasInterface = specifiers.some((s) => s.name.text === OLD_INTERFACE);\n\n if (hasComponent && hasInterface) {\n // Both are in the same import → must split into two different paths\n const others = specifiers.filter((s) => s.name.text !== OLD_COMPONENT && s.name.text !== OLD_INTERFACE);\n const lines: string[] = [];\n lines.push(`import { ${NEW_COMPONENT} } from '${NEW_COMPONENT_PATH}';`);\n if (!hasEuiMenuItemImport) {\n lines.push(`import { ${NEW_INTERFACE} } from '${NEW_INTERFACE_PATH}';`);\n }\n if (others.length > 0) {\n const otherNames = others.map((s) => s.name.text).join(', ');\n lines.push(`import { ${otherNames} } from '${moduleSpec.text}';`);\n }\n edits.push({\n start: stmt.getStart(sourceFile),\n end: stmt.getEnd(),\n replacement: lines.join('\\n'),\n });\n } else if (hasComponent) {\n edits.push({\n start: moduleSpec.getStart(sourceFile) + 1,\n end: moduleSpec.getEnd() - 1,\n replacement: NEW_COMPONENT_PATH,\n });\n for (const specifier of specifiers) {\n if (specifier.name.text === OLD_COMPONENT) {\n edits.push({\n start: specifier.name.getStart(sourceFile),\n end: specifier.name.getEnd(),\n replacement: NEW_COMPONENT,\n });\n }\n }\n } else if (hasInterface) {\n if (hasEuiMenuItemImport) {\n removeImportSpecifier(namedBindings, specifiers.find((s) => s.name.text === OLD_INTERFACE)!, sourceFile, edits);\n } else {\n edits.push({\n start: moduleSpec.getStart(sourceFile) + 1,\n end: moduleSpec.getEnd() - 1,\n replacement: NEW_INTERFACE_PATH,\n });\n for (const specifier of specifiers) {\n if (specifier.name.text === OLD_INTERFACE) {\n edits.push({\n start: specifier.name.getStart(sourceFile),\n end: specifier.name.getEnd(),\n replacement: NEW_INTERFACE,\n });\n }\n }\n }\n }\n }\n\n // Third pass: rename identifier references in non-import positions\n const visitRefs = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) return; // skip imports (already handled)\n if (ts.isIdentifier(node)) {\n if (node.text === OLD_COMPONENT) {\n edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: NEW_COMPONENT });\n }\n if (node.text === OLD_INTERFACE) {\n edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: NEW_INTERFACE });\n }\n }\n ts.forEachChild(node, visitRefs);\n };\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) {\n visitRefs(stmt);\n }\n }\n\n // Warn about ToolbarItem-specific properties\n warnRemovedProperties(sourceFile, filePath, context);\n\n return applyEdits(source, edits);\n}\n\nfunction removeImportSpecifier(\n namedImports: ts.NamedImports,\n specifier: ts.ImportSpecifier,\n sourceFile: ts.SourceFile,\n edits: Edit[],\n): void {\n const elements = namedImports.elements;\n if (elements.length === 1) {\n // Remove the entire import declaration\n const importDecl = namedImports.parent.parent;\n edits.push({\n start: importDecl.getStart(sourceFile),\n end: importDecl.getEnd(),\n replacement: '',\n });\n } else {\n // Remove just this specifier with surrounding comma/whitespace\n const idx = elements.indexOf(specifier);\n let start: number;\n let end: number;\n if (idx < elements.length - 1) {\n start = specifier.getStart(sourceFile);\n end = elements[idx + 1].getStart(sourceFile);\n } else {\n start = elements[idx - 1].getEnd();\n end = specifier.getEnd();\n }\n edits.push({ start, end, replacement: '' });\n }\n}\n\nfunction warnRemovedProperties(sourceFile: ts.SourceFile, filePath: string, context: SchematicContext): void {\n const deprecated = ['isHome', 'isSeparator'];\n\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && deprecated.includes(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${filePath}:${line + 1} - \"${node.name.text}\" was part of ToolbarItem but does not exist on EuiMenuItem. Review manually.`,\n );\n }\n if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && deprecated.includes(node.name.text)) {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n context.logger.warn(\n `${filePath}:${line + 1} - \"${node.name.text}\" was part of ToolbarItem but does not exist on EuiMenuItem. Review manually.`,\n );\n }\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n}\n\nfunction visitNodes(nodes: TmplAstNode[], source: string, edits: Edit[], filePath: string, context: SchematicContext): void {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (node.name === OLD_TAG) {\n collectTagRenames(node, source, edits);\n collectOutputRemovals(node, source, edits, filePath, context);\n }\n visitNodes(node.children, source, edits, filePath, context);\n }\n }\n}\n\nfunction collectTagRenames(element: TmplAstElement, source: string, edits: Edit[]): void {\n // Rename opening tag\n const openStart = element.startSourceSpan.start.offset + 1; // skip '<'\n edits.push({ start: openStart, end: openStart + OLD_TAG.length, replacement: NEW_TAG });\n\n // Rename closing tag\n if (element.endSourceSpan) {\n const closeStart = element.endSourceSpan.start.offset + 2; // skip '</'\n edits.push({ start: closeStart, end: closeStart + OLD_TAG.length, replacement: NEW_TAG });\n }\n}\n\nfunction collectOutputRemovals(\n element: TmplAstElement,\n source: string,\n edits: Edit[],\n filePath: string,\n context: SchematicContext,\n): void {\n for (const output of element.outputs) {\n if (output.name === REMOVED_OUTPUT) {\n let start = output.sourceSpan.start.offset;\n // Remove leading whitespace\n while (start > 0 && (source[start - 1] === ' ' || source[start - 1] === '\\t')) {\n start--;\n }\n edits.push({ start, end: output.sourceSpan.end.offset, replacement: '' });\n\n const { line } = element.startSourceSpan.start;\n context.logger.warn(\n `${filePath}:${line + 1} - \"(menuItemClick)\" has been removed. There is no equivalent on eui-toolbar-mega-menu.`,\n );\n }\n }\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 applyEdits(source: string, edits: Edit[]): string {\n // Deduplicate edits at same position (e.g. module path edits when both Component and ToolbarItem are from same source)\n const unique = deduplicateEdits(edits);\n let result = source;\n for (const edit of unique.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\nfunction deduplicateEdits(edits: Edit[]): Edit[] {\n const seen = new Map<string, Edit>();\n for (const edit of edits) {\n const key = `${edit.start}:${edit.end}`;\n // Last wins for same range\n seen.set(key, edit);\n }\n return Array.from(seen.values());\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",
|
|
3053
3053
|
"displayName": "Schema",
|
|
3054
3054
|
"properties": [
|
|
3055
3055
|
{
|
|
@@ -3061,7 +3061,7 @@
|
|
|
3061
3061
|
"indexKey": "",
|
|
3062
3062
|
"optional": true,
|
|
3063
3063
|
"description": "",
|
|
3064
|
-
"line":
|
|
3064
|
+
"line": 18,
|
|
3065
3065
|
"rawdescription": "\n"
|
|
3066
3066
|
},
|
|
3067
3067
|
{
|
|
@@ -3073,7 +3073,7 @@
|
|
|
3073
3073
|
"indexKey": "",
|
|
3074
3074
|
"optional": true,
|
|
3075
3075
|
"description": "",
|
|
3076
|
-
"line":
|
|
3076
|
+
"line": 17,
|
|
3077
3077
|
"rawdescription": "\n"
|
|
3078
3078
|
}
|
|
3079
3079
|
],
|
|
@@ -3424,12 +3424,12 @@
|
|
|
3424
3424
|
},
|
|
3425
3425
|
{
|
|
3426
3426
|
"name": "UIState",
|
|
3427
|
-
"id": "interface-UIState-
|
|
3427
|
+
"id": "interface-UIState-2b10e519e4a4b60702c2f5da03d8ea5dc23dbec19cc7d660553b4aac90c5bdcd38a9eee6e4f6c9e5e9f468f5f00d106dcd82a7d9667028ef3f85483af3b8ffee",
|
|
3428
3428
|
"file": "packages/core/src/lib/services/eui-app-shell.service.ts",
|
|
3429
3429
|
"deprecated": false,
|
|
3430
3430
|
"deprecationMessage": "",
|
|
3431
3431
|
"type": "interface",
|
|
3432
|
-
"sourceCode": "import { Injectable, PLATFORM_ID, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { BehaviorSubject, defer, firstValueFrom, Observable } from 'rxjs';\nimport { EuiEuLanguages, GlobalConfig, getActiveLang, EuiLanguage, EuiMenuItem } from '@eui/base';\nimport { GLOBAL_CONFIG_TOKEN } from './config/tokens';\nimport { I18nService } from './i18n';\nimport { Router, NavigationEnd } from '@angular/router';\nimport { StoreService } from './store/store.service';\nimport { distinctUntilChanged, filter, map } from 'rxjs/operators';\nimport { isEqual, get } from 'lodash-es';\nimport { CssUtils } from '../helpers/css-utils';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface UIState<BP = any, DI = any, AMD =any, BPV = any> {\n // app state\n appName?: string;\n appShortName?: string;\n appSubTitle?: string;\n appBaseFontSize?: string;\n\n // Sidebar state\n isSidebarOpen?: boolean;\n isSidebarActive?: boolean;\n hasSidebar?: boolean;\n hasSideContainer?: boolean;\n hasBreadcrumb?: boolean;\n hasHeader?: boolean;\n hasHeaderLogo?: boolean;\n hasHeaderEnvironment?: boolean;\n hasToolbar?: boolean;\n hasToolbarMegaMenu?: boolean;\n hasToolbarMenu?: boolean;\n environmentValue?: string;\n isSidebarHidden?: boolean;\n isSidebarFocused?: boolean;\n hasSidebarCollapsedVariant?: boolean;\n hasTopMessage?: boolean;\n\n // window state\n windowWidth?: number;\n windowHeight?: number;\n mainContentHeight?: number;\n pageHeaderHeight?: number;\n breakpoint?: string;\n wrapperClasses?: string;\n breakpoints?: BP;\n breakpointValues?: BPV;\n\n // navigation state\n menuLinks?: EuiMenuItem[];\n sidebarLinks?: EuiMenuItem[];\n combinedLinks?: EuiMenuItem[];\n\n // other states\n isBlockDocumentActive?: boolean;\n\n // device info\n deviceInfo: DI;\n\n // language infos\n activeLanguage: string;\n languages: (string | EuiLanguage)[];\n\n // app metadata\n appMetadata: AMD;\n\n // various dynamic state\n hasModalActive?: boolean;\n isDimmerActive?: boolean; // Usage: map to eui base directive input coerce euiHighlighted\n}\n\nconst initialState: UIState = {\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EuiAppShellService {\n navigationStartCustomHandler: () => void;\n navigationEndCustomHandler: () => void;\n protected config = inject<GlobalConfig>(GLOBAL_CONFIG_TOKEN, { optional: true });\n private http = inject(HttpClient);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n private router = inject(Router);\n private storeService = inject(StoreService);\n private i18nService = inject(I18nService, { optional: true });\n\n // -------------------\n get state$(): Observable<UIState> {\n return this._state$.asObservable();\n }\n\n // -------------------\n // exposed observables\n\n get breakpoint$(): Observable<string> {\n return this._breakpoint$.asObservable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get breakpoints$(): Observable<any> {\n return this._breakpoints$.asObservable();\n }\n\n // ----------------\n // state operations\n // ----------------\n get state(): UIState {\n return this._state$.getValue();\n }\n\n // ----------------------------\n // public setters and functions\n // ----------------------------\n set isSidebarOpen(isOpen: boolean) {\n this.setState({\n ...this.state,\n isSidebarOpen: isOpen,\n });\n }\n\n get isSidebarOpen(): boolean {\n return this.state.isSidebarOpen;\n }\n\n set isSidebarActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isSidebarActive: isActive,\n });\n }\n\n set sidebarLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n sidebarLinks: links,\n });\n }\n\n set hasSidebarCollapsedVariant(isActive: boolean) {\n this.setState({\n ...this.state,\n hasSidebarCollapsedVariant: isActive,\n });\n CssUtils.activateSidebarCssVars(this.document, this.platformId, isActive);\n }\n\n set menuLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n menuLinks: links,\n });\n }\n\n set isBlockDocumentActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isBlockDocumentActive: isActive,\n });\n }\n\n get hasHeader(): boolean {\n return this.state.hasHeader;\n }\n\n // Edit mode\n get isDimmerActive(): boolean {\n return this.state.isDimmerActive;\n }\n\n set isDimmerActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isDimmerActive: isActive,\n });\n }\n\n private _state$: BehaviorSubject<UIState>;\n private _breakpoint$: BehaviorSubject<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _breakpoints$: BehaviorSubject<any>;\n\n constructor() {\n const config = this.config;\n\n let stateWithConfig = initialState;\n const languages = config?.i18n?.i18nService?.languages || initialState.languages;\n const defaultLanguage = config?.i18n?.i18nService?.defaultLanguage || initialState.activeLanguage;\n stateWithConfig = {\n ...stateWithConfig,\n ...{\n languages,\n activeLanguage: defaultLanguage,\n },\n };\n this._state$ = new BehaviorSubject(stateWithConfig);\n this._breakpoint$ = new BehaviorSubject('');\n this._breakpoints$ = new BehaviorSubject({});\n this.bindActiveLanguageToAppShellState();\n }\n\n setState(nextState: UIState, updateI18 = true): void {\n let breakpoint, breakpoints;\n let combinedLinks;\n\n const state = this.state;\n\n // check if window width has been updated from previous state\n if (this.state.windowWidth !== nextState.windowWidth) {\n breakpoint = this.getBreakpoint(nextState.windowWidth);\n breakpoints = this.getBreakpoints(breakpoint);\n\n this._breakpoint$.next(breakpoint);\n this._breakpoints$.next(breakpoints);\n\n // if not propagate the old ones without doing any calculations\n } else {\n breakpoint = state.breakpoint;\n breakpoints = state.breakpoints;\n }\n\n // finally get the wrapper classes when both the state and breakpoint are known\n const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);\n\n // check if the menuLinks or sidebarLinks have changed from previous state\n if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) {\n combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];\n } else {\n combinedLinks = this.state.combinedLinks;\n }\n\n const stateBeforeUpdate = { ...this.state };\n\n // we put it all together with the calculated properties\n this._state$.next({\n ...nextState,\n wrapperClasses,\n breakpoint,\n breakpoints,\n combinedLinks,\n });\n\n // update the Store Language\n if (updateI18 && nextState.activeLanguage !== stateBeforeUpdate.activeLanguage) {\n this.i18nService.updateState({ activeLang: nextState.activeLanguage });\n }\n }\n\n /**\n * Emits a slice from the state whether that changes\n *\n * @param key can be 'key' or 'key.sub.sub'\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getState<T = any>(key?: string): Observable<T> {\n return defer(() =>\n // check if key exists\n key\n ? this.state$.pipe(\n map((state) => get(state, key)),\n // filter((state) => state),\n distinctUntilChanged((x, y) => isEqual(x, y)),\n )\n : this.state$,\n );\n }\n\n public sidebarToggle(): void {\n this.isSidebarOpen = !this.state.isSidebarOpen;\n }\n\n // Edit mode\n public dimmerActiveToggle(): void {\n const isActive = this.isDimmerActive;\n this.setState({\n ...this.state,\n isDimmerActive: !isActive,\n });\n CssUtils.activateEditModeCssVars(!isActive, this.document);\n }\n\n public setDimmerActiveState(activeState: boolean): void {\n this.setState({\n ...this.state,\n isDimmerActive: activeState,\n });\n CssUtils.activateEditModeCssVars(activeState, this.document);\n }\n\n // --------------\n // public methods\n // --------------\n public fetchAppMetadata(metadataFilePath = 'assets/app-metadata.json'): void {\n this.getJson(metadataFilePath).then((data) => {\n this.setState({\n ...this.state,\n appMetadata: data,\n });\n });\n }\n\n public activateSidebar(): void {\n this.setState({\n ...this.state,\n hasSidebar: true,\n });\n\n if (!this.state.isSidebarHidden) {\n CssUtils.activateSidebarCssVars(this.document, this.platformId, this.state.hasSidebarCollapsedVariant);\n }\n }\n\n public activateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: true,\n });\n\n CssUtils.activateSideContainerCssVars(this.document, this.platformId);\n } \n\n public deactivateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: false,\n });\n\n CssUtils.deactivateSideContainerCssVars(this.document, this.platformId);\n } \n\n public activateSidebarHeader(): void {\n CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);\n }\n\n public activateSidebarFooter(): void {\n CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);\n }\n\n public activateHeader(): void {\n this.setState({\n ...this.state,\n hasHeader: true,\n });\n CssUtils.activateHeaderCssVars(this.document, this.platformId);\n }\n\n public activateBreadcrumb(): void {\n this.setState({\n ...this.state,\n hasBreadcrumb: true,\n });\n CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);\n }\n\n public activateTopMessage(height: number): void {\n this.setState({\n ...this.state,\n hasTopMessage: true,\n });\n CssUtils.activateTopMessageCssVars(height, this.document);\n }\n\n public activateToolbar(): void {\n this.setState({\n ...this.state,\n hasToolbar: true,\n });\n CssUtils.activateToolbarCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMegaMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMegaMenu: true,\n });\n CssUtils.activateToolbarMegaMenuCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMenu: true,\n });\n }\n\n /**\n * Returns the current value of --eui-f-size-base CSS variable\n */\n public getBaseFontSize(): string {\n return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);\n }\n\n /**\n * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n */\n public setBaseFontSize(newsize: string): void {\n this.setState(\n {\n ...this.state,\n appBaseFontSize: newsize,\n },\n false,\n );\n CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);\n }\n\n // ---------------\n // private getters\n // ---------------\n private getWrapperClasses(state: UIState, breakpoint: string): string {\n const classes: string[] = [];\n\n classes.push(breakpoint);\n\n if (state.hasSidebar) {\n if (state.isSidebarHidden) {\n classes.push('sidebar--hidden');\n }\n if (state.isSidebarOpen) {\n classes.push('sidebar--open');\n } else {\n classes.push('sidebar--close');\n }\n }\n if (state.deviceInfo?.isFF) {\n classes.push('ff');\n }\n if (state.deviceInfo?.isIE) {\n classes.push('ie');\n }\n if (state.deviceInfo?.isChrome) {\n classes.push('chrome');\n }\n return classes.join(' ');\n }\n\n private getBreakpoint(windowWidth: number): string {\n let bkp = '';\n\n if (this.state.breakpointValues.length === 0) {\n this.setState({\n ...this.state,\n breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),\n });\n }\n\n this.state.breakpointValues.forEach((b, i) => {\n if (i < this.state.breakpointValues.length) {\n if (windowWidth >= b.value && windowWidth < this.state.breakpointValues[i+1]?.value) {\n bkp = b.bkp;\n }\n } else if(windowWidth >= b.value) {\n bkp = b.bkp;\n }\n });\n\n return bkp;\n }\n\n private getBreakpoints(bkp: string): object {\n return {\n isMobile: bkp === 'xs' || bkp === 'sm',\n isTablet: bkp === 'md',\n isLtLargeTablet: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg',\n isLtDesktop: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg' || bkp === 'xl',\n isDesktop: bkp === 'xxl',\n isXL: bkp === 'xl',\n isXXL: bkp === 'xxl',\n isFHD: bkp === 'fhd',\n is2K: bkp === '2k',\n is4K: bkp === '4k',\n };\n }\n\n private getJson(url: string): Promise<object> {\n return firstValueFrom(this.http.get(url)).then(this.extractData).catch(this.handleError);\n }\n\n private extractData(res: Response): object {\n const body = res;\n return body || {};\n }\n\n private handleError<T extends Error>(error: T): Promise<T> {\n console.error('An error occurred', error);\n return Promise.reject(error.message || error);\n }\n\n private bindActiveLanguageToAppShellState(): void {\n this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {\n if (activeLang !== this.state.activeLanguage) {\n this.setState(\n {\n ...this.state,\n activeLanguage: activeLang,\n },\n false,\n );\n }\n });\n }\n}\n",
|
|
3432
|
+
"sourceCode": "import { Injectable, PLATFORM_ID, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { BehaviorSubject, defer, firstValueFrom, Observable } from 'rxjs';\nimport { EuiEuLanguages, GlobalConfig, getActiveLang, EuiLanguage, EuiMenuItem } from '@eui/base';\nimport { GLOBAL_CONFIG_TOKEN } from './config/tokens';\nimport { I18nService } from './i18n';\nimport { Router, NavigationEnd } from '@angular/router';\nimport { StoreService } from './store/store.service';\nimport { distinctUntilChanged, filter, map } from 'rxjs/operators';\nimport { isEqual, get } from 'lodash-es';\nimport { CssUtils } from '../helpers/css-utils';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface UIState<BP = any, DI = any, AMD =any, BPV = any> {\n // app state\n appName?: string;\n appShortName?: string;\n appSubTitle?: string;\n appBaseFontSize?: string;\n\n // Sidebar state\n isSidebarOpen?: boolean;\n isSidebarActive?: boolean;\n hasFixedPosition?: boolean;\n hasSidebar?: boolean;\n hasSideContainer?: boolean;\n hasBreadcrumb?: boolean;\n hasHeader?: boolean;\n hasHeaderLogo?: boolean;\n hasHeaderEnvironment?: boolean;\n hasToolbar?: boolean;\n hasToolbarMegaMenu?: boolean;\n hasToolbarMenu?: boolean;\n environmentValue?: string;\n isSidebarHidden?: boolean;\n isSidebarFocused?: boolean;\n hasSidebarCollapsedVariant?: boolean;\n hasTopMessage?: boolean;\n\n // window state\n windowWidth?: number;\n windowHeight?: number;\n mainContentHeight?: number;\n pageHeaderHeight?: number;\n breakpoint?: string;\n wrapperClasses?: string;\n breakpoints?: BP;\n breakpointValues?: BPV;\n\n // navigation state\n menuLinks?: EuiMenuItem[];\n sidebarLinks?: EuiMenuItem[];\n combinedLinks?: EuiMenuItem[];\n\n // other states\n isBlockDocumentActive?: boolean;\n\n // device info\n deviceInfo: DI;\n\n // language infos\n activeLanguage: string;\n languages: (string | EuiLanguage)[];\n\n // app metadata\n appMetadata: AMD;\n\n // various dynamic state\n hasModalActive?: boolean;\n isDimmerActive?: boolean; // Usage: map to eui base directive input coerce euiHighlighted\n}\n\nconst initialState: UIState = {\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasFixedPosition: true,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EuiAppShellService {\n navigationStartCustomHandler: () => void;\n navigationEndCustomHandler: () => void;\n protected config = inject<GlobalConfig>(GLOBAL_CONFIG_TOKEN, { optional: true });\n private http = inject(HttpClient);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n private router = inject(Router);\n private storeService = inject(StoreService);\n private i18nService = inject(I18nService, { optional: true });\n\n // -------------------\n get state$(): Observable<UIState> {\n return this._state$.asObservable();\n }\n\n // -------------------\n // exposed observables\n\n get breakpoint$(): Observable<string> {\n return this._breakpoint$.asObservable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get breakpoints$(): Observable<any> {\n return this._breakpoints$.asObservable();\n }\n\n // ----------------\n // state operations\n // ----------------\n get state(): UIState {\n return this._state$.getValue();\n }\n\n // ----------------------------\n // public setters and functions\n // ----------------------------\n set isSidebarOpen(isOpen: boolean) {\n this.setState({\n ...this.state,\n isSidebarOpen: isOpen,\n });\n }\n\n get isSidebarOpen(): boolean {\n return this.state.isSidebarOpen;\n }\n\n set isSidebarActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isSidebarActive: isActive,\n });\n }\n\n set sidebarLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n sidebarLinks: links,\n });\n }\n\n set hasSidebarCollapsedVariant(isActive: boolean) {\n this.setState({\n ...this.state,\n hasSidebarCollapsedVariant: isActive,\n });\n CssUtils.activateSidebarCssVars(this.document, this.platformId, isActive);\n }\n\n set menuLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n menuLinks: links,\n });\n }\n\n set isBlockDocumentActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isBlockDocumentActive: isActive,\n });\n }\n\n get hasHeader(): boolean {\n return this.state.hasHeader;\n }\n\n // Edit mode\n get isDimmerActive(): boolean {\n return this.state.isDimmerActive;\n }\n\n set isDimmerActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isDimmerActive: isActive,\n });\n }\n\n private _state$: BehaviorSubject<UIState>;\n private _breakpoint$: BehaviorSubject<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _breakpoints$: BehaviorSubject<any>;\n\n constructor() {\n const config = this.config;\n\n let stateWithConfig = initialState;\n const languages = config?.i18n?.i18nService?.languages || initialState.languages;\n const defaultLanguage = config?.i18n?.i18nService?.defaultLanguage || initialState.activeLanguage;\n stateWithConfig = {\n ...stateWithConfig,\n ...{\n languages,\n activeLanguage: defaultLanguage,\n },\n };\n this._state$ = new BehaviorSubject(stateWithConfig);\n this._breakpoint$ = new BehaviorSubject('');\n this._breakpoints$ = new BehaviorSubject({});\n this.bindActiveLanguageToAppShellState();\n }\n\n setState(nextState: UIState, updateI18 = true): void {\n let breakpoint, breakpoints;\n let combinedLinks;\n\n const state = this.state;\n\n // check if window width has been updated from previous state\n if (this.state.windowWidth !== nextState.windowWidth) {\n breakpoint = this.getBreakpoint(nextState.windowWidth);\n breakpoints = this.getBreakpoints(breakpoint);\n\n this._breakpoint$.next(breakpoint);\n this._breakpoints$.next(breakpoints);\n\n // if not propagate the old ones without doing any calculations\n } else {\n breakpoint = state.breakpoint;\n breakpoints = state.breakpoints;\n }\n\n // finally get the wrapper classes when both the state and breakpoint are known\n const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);\n\n // check if the menuLinks or sidebarLinks have changed from previous state\n if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) {\n combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];\n } else {\n combinedLinks = this.state.combinedLinks;\n }\n\n const stateBeforeUpdate = { ...this.state };\n\n // we put it all together with the calculated properties\n this._state$.next({\n ...nextState,\n wrapperClasses,\n breakpoint,\n breakpoints,\n combinedLinks,\n });\n\n // update the Store Language\n if (updateI18 && nextState.activeLanguage !== stateBeforeUpdate.activeLanguage) {\n this.i18nService.updateState({ activeLang: nextState.activeLanguage });\n }\n }\n\n /**\n * Emits a slice from the state whether that changes\n *\n * @param key can be 'key' or 'key.sub.sub'\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getState<T = any>(key?: string): Observable<T> {\n return defer(() =>\n // check if key exists\n key\n ? this.state$.pipe(\n map((state) => get(state, key)),\n // filter((state) => state),\n distinctUntilChanged((x, y) => isEqual(x, y)),\n )\n : this.state$,\n );\n }\n\n public sidebarToggle(): void {\n this.isSidebarOpen = !this.state.isSidebarOpen;\n }\n\n // Edit mode\n public dimmerActiveToggle(): void {\n const isActive = this.isDimmerActive;\n this.setState({\n ...this.state,\n isDimmerActive: !isActive,\n });\n CssUtils.activateEditModeCssVars(!isActive, this.document);\n }\n\n public setDimmerActiveState(activeState: boolean): void {\n this.setState({\n ...this.state,\n isDimmerActive: activeState,\n });\n CssUtils.activateEditModeCssVars(activeState, this.document);\n }\n\n // --------------\n // public methods\n // --------------\n public fetchAppMetadata(metadataFilePath = 'assets/app-metadata.json'): void {\n this.getJson(metadataFilePath).then((data) => {\n this.setState({\n ...this.state,\n appMetadata: data,\n });\n });\n }\n\n public activateSidebar(): void {\n this.setState({\n ...this.state,\n hasSidebar: true,\n });\n\n if (!this.state.isSidebarHidden) {\n CssUtils.activateSidebarCssVars(this.document, this.platformId, this.state.hasSidebarCollapsedVariant);\n }\n }\n\n public activateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: true,\n });\n\n CssUtils.activateSideContainerCssVars(this.document, this.platformId);\n } \n\n public deactivateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: false,\n });\n\n CssUtils.deactivateSideContainerCssVars(this.document, this.platformId);\n } \n\n public activateSidebarHeader(): void {\n CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);\n }\n\n public activateSidebarFooter(): void {\n CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);\n }\n\n public activateHeader(): void {\n this.setState({\n ...this.state,\n hasHeader: true,\n });\n CssUtils.activateHeaderCssVars(this.document, this.platformId);\n }\n\n public activateBreadcrumb(): void {\n this.setState({\n ...this.state,\n hasBreadcrumb: true,\n });\n CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);\n }\n\n public activateTopMessage(height: number): void {\n this.setState({\n ...this.state,\n hasTopMessage: true,\n });\n CssUtils.activateTopMessageCssVars(height, this.document);\n }\n\n public activateToolbar(): void {\n this.setState({\n ...this.state,\n hasToolbar: true,\n });\n CssUtils.activateToolbarCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMegaMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMegaMenu: true,\n });\n CssUtils.activateToolbarMegaMenuCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMenu: true,\n });\n }\n\n /**\n * Returns the current value of --eui-f-size-base CSS variable\n */\n public getBaseFontSize(): string {\n return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);\n }\n\n /**\n * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n */\n public setBaseFontSize(newsize: string): void {\n this.setState(\n {\n ...this.state,\n appBaseFontSize: newsize,\n },\n false,\n );\n CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);\n }\n\n // ---------------\n // private getters\n // ---------------\n private getWrapperClasses(state: UIState, breakpoint: string): string {\n const classes: string[] = [];\n\n classes.push(breakpoint);\n\n if (state.hasSidebar) {\n if (state.isSidebarHidden) {\n classes.push('sidebar--hidden');\n }\n if (state.isSidebarOpen) {\n classes.push('sidebar--open');\n } else {\n classes.push('sidebar--close');\n }\n }\n if (state.deviceInfo?.isFF) {\n classes.push('ff');\n }\n if (state.deviceInfo?.isIE) {\n classes.push('ie');\n }\n if (state.deviceInfo?.isChrome) {\n classes.push('chrome');\n }\n if (state.hasFixedPosition) {\n classes.push('fixed-position');\n } else {\n classes.push('relative-position');\n }\n return classes.join(' ');\n }\n\n private getBreakpoint(windowWidth: number): string {\n let bkp = '';\n\n if (this.state.breakpointValues.length === 0) {\n this.setState({\n ...this.state,\n breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),\n });\n }\n\n this.state.breakpointValues.forEach((b, i) => {\n if (i < this.state.breakpointValues.length) {\n if (windowWidth >= b.value && windowWidth < this.state.breakpointValues[i+1]?.value) {\n bkp = b.bkp;\n }\n } else if(windowWidth >= b.value) {\n bkp = b.bkp;\n }\n });\n\n return bkp;\n }\n\n private getBreakpoints(bkp: string): object {\n return {\n isMobile: bkp === 'xs' || bkp === 'sm',\n isTablet: bkp === 'md',\n isLtLargeTablet: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg',\n isLtDesktop: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg' || bkp === 'xl',\n isDesktop: bkp === 'xxl',\n isXL: bkp === 'xl',\n isXXL: bkp === 'xxl',\n isFHD: bkp === 'fhd',\n is2K: bkp === '2k',\n is4K: bkp === '4k',\n };\n }\n\n private getJson(url: string): Promise<object> {\n return firstValueFrom(this.http.get(url)).then(this.extractData).catch(this.handleError);\n }\n\n private extractData(res: Response): object {\n const body = res;\n return body || {};\n }\n\n private handleError<T extends Error>(error: T): Promise<T> {\n console.error('An error occurred', error);\n return Promise.reject(error.message || error);\n }\n\n private bindActiveLanguageToAppShellState(): void {\n this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {\n if (activeLang !== this.state.activeLanguage) {\n this.setState(\n {\n ...this.state,\n activeLanguage: activeLang,\n },\n false,\n );\n }\n });\n }\n}\n",
|
|
3433
3433
|
"displayName": "UIState<BP = any, DI = any, AMD =any, BPV = any>",
|
|
3434
3434
|
"typeParameters": [
|
|
3435
3435
|
"BP = any",
|
|
@@ -3447,7 +3447,7 @@
|
|
|
3447
3447
|
"indexKey": "",
|
|
3448
3448
|
"optional": false,
|
|
3449
3449
|
"description": "",
|
|
3450
|
-
"line":
|
|
3450
|
+
"line": 63,
|
|
3451
3451
|
"rawdescription": "\n"
|
|
3452
3452
|
},
|
|
3453
3453
|
{
|
|
@@ -3471,7 +3471,7 @@
|
|
|
3471
3471
|
"indexKey": "",
|
|
3472
3472
|
"optional": false,
|
|
3473
3473
|
"description": "",
|
|
3474
|
-
"line":
|
|
3474
|
+
"line": 67,
|
|
3475
3475
|
"rawdescription": "\n"
|
|
3476
3476
|
},
|
|
3477
3477
|
{
|
|
@@ -3519,7 +3519,7 @@
|
|
|
3519
3519
|
"indexKey": "",
|
|
3520
3520
|
"optional": true,
|
|
3521
3521
|
"description": "",
|
|
3522
|
-
"line":
|
|
3522
|
+
"line": 46,
|
|
3523
3523
|
"rawdescription": "\n"
|
|
3524
3524
|
},
|
|
3525
3525
|
{
|
|
@@ -3531,7 +3531,7 @@
|
|
|
3531
3531
|
"indexKey": "",
|
|
3532
3532
|
"optional": true,
|
|
3533
3533
|
"description": "",
|
|
3534
|
-
"line":
|
|
3534
|
+
"line": 48,
|
|
3535
3535
|
"rawdescription": "\n"
|
|
3536
3536
|
},
|
|
3537
3537
|
{
|
|
@@ -3543,7 +3543,7 @@
|
|
|
3543
3543
|
"indexKey": "",
|
|
3544
3544
|
"optional": true,
|
|
3545
3545
|
"description": "",
|
|
3546
|
-
"line":
|
|
3546
|
+
"line": 49,
|
|
3547
3547
|
"rawdescription": "\n"
|
|
3548
3548
|
},
|
|
3549
3549
|
{
|
|
@@ -3555,7 +3555,7 @@
|
|
|
3555
3555
|
"indexKey": "",
|
|
3556
3556
|
"optional": true,
|
|
3557
3557
|
"description": "",
|
|
3558
|
-
"line":
|
|
3558
|
+
"line": 54,
|
|
3559
3559
|
"rawdescription": "\n"
|
|
3560
3560
|
},
|
|
3561
3561
|
{
|
|
@@ -3567,7 +3567,7 @@
|
|
|
3567
3567
|
"indexKey": "",
|
|
3568
3568
|
"optional": false,
|
|
3569
3569
|
"description": "",
|
|
3570
|
-
"line":
|
|
3570
|
+
"line": 60,
|
|
3571
3571
|
"rawdescription": "\n"
|
|
3572
3572
|
},
|
|
3573
3573
|
{
|
|
@@ -3579,7 +3579,7 @@
|
|
|
3579
3579
|
"indexKey": "",
|
|
3580
3580
|
"optional": true,
|
|
3581
3581
|
"description": "",
|
|
3582
|
-
"line":
|
|
3582
|
+
"line": 35,
|
|
3583
3583
|
"rawdescription": "\n"
|
|
3584
3584
|
},
|
|
3585
3585
|
{
|
|
@@ -3591,7 +3591,19 @@
|
|
|
3591
3591
|
"indexKey": "",
|
|
3592
3592
|
"optional": true,
|
|
3593
3593
|
"description": "",
|
|
3594
|
-
"line":
|
|
3594
|
+
"line": 28,
|
|
3595
|
+
"rawdescription": "\n"
|
|
3596
|
+
},
|
|
3597
|
+
{
|
|
3598
|
+
"name": "hasFixedPosition",
|
|
3599
|
+
"coverageIgnore": false,
|
|
3600
|
+
"deprecated": false,
|
|
3601
|
+
"deprecationMessage": "",
|
|
3602
|
+
"type": "boolean",
|
|
3603
|
+
"indexKey": "",
|
|
3604
|
+
"optional": true,
|
|
3605
|
+
"description": "",
|
|
3606
|
+
"line": 25,
|
|
3595
3607
|
"rawdescription": "\n"
|
|
3596
3608
|
},
|
|
3597
3609
|
{
|
|
@@ -3603,7 +3615,7 @@
|
|
|
3603
3615
|
"indexKey": "",
|
|
3604
3616
|
"optional": true,
|
|
3605
3617
|
"description": "",
|
|
3606
|
-
"line":
|
|
3618
|
+
"line": 29,
|
|
3607
3619
|
"rawdescription": "\n"
|
|
3608
3620
|
},
|
|
3609
3621
|
{
|
|
@@ -3615,7 +3627,7 @@
|
|
|
3615
3627
|
"indexKey": "",
|
|
3616
3628
|
"optional": true,
|
|
3617
3629
|
"description": "",
|
|
3618
|
-
"line":
|
|
3630
|
+
"line": 31,
|
|
3619
3631
|
"rawdescription": "\n"
|
|
3620
3632
|
},
|
|
3621
3633
|
{
|
|
@@ -3627,7 +3639,7 @@
|
|
|
3627
3639
|
"indexKey": "",
|
|
3628
3640
|
"optional": true,
|
|
3629
3641
|
"description": "",
|
|
3630
|
-
"line":
|
|
3642
|
+
"line": 30,
|
|
3631
3643
|
"rawdescription": "\n"
|
|
3632
3644
|
},
|
|
3633
3645
|
{
|
|
@@ -3639,7 +3651,7 @@
|
|
|
3639
3651
|
"indexKey": "",
|
|
3640
3652
|
"optional": true,
|
|
3641
3653
|
"description": "",
|
|
3642
|
-
"line":
|
|
3654
|
+
"line": 70,
|
|
3643
3655
|
"rawdescription": "\n"
|
|
3644
3656
|
},
|
|
3645
3657
|
{
|
|
@@ -3651,7 +3663,7 @@
|
|
|
3651
3663
|
"indexKey": "",
|
|
3652
3664
|
"optional": true,
|
|
3653
3665
|
"description": "",
|
|
3654
|
-
"line":
|
|
3666
|
+
"line": 26,
|
|
3655
3667
|
"rawdescription": "\n"
|
|
3656
3668
|
},
|
|
3657
3669
|
{
|
|
@@ -3663,7 +3675,7 @@
|
|
|
3663
3675
|
"indexKey": "",
|
|
3664
3676
|
"optional": true,
|
|
3665
3677
|
"description": "",
|
|
3666
|
-
"line":
|
|
3678
|
+
"line": 38,
|
|
3667
3679
|
"rawdescription": "\n"
|
|
3668
3680
|
},
|
|
3669
3681
|
{
|
|
@@ -3675,7 +3687,7 @@
|
|
|
3675
3687
|
"indexKey": "",
|
|
3676
3688
|
"optional": true,
|
|
3677
3689
|
"description": "",
|
|
3678
|
-
"line":
|
|
3690
|
+
"line": 27,
|
|
3679
3691
|
"rawdescription": "\n"
|
|
3680
3692
|
},
|
|
3681
3693
|
{
|
|
@@ -3687,7 +3699,7 @@
|
|
|
3687
3699
|
"indexKey": "",
|
|
3688
3700
|
"optional": true,
|
|
3689
3701
|
"description": "",
|
|
3690
|
-
"line":
|
|
3702
|
+
"line": 32,
|
|
3691
3703
|
"rawdescription": "\n"
|
|
3692
3704
|
},
|
|
3693
3705
|
{
|
|
@@ -3699,7 +3711,7 @@
|
|
|
3699
3711
|
"indexKey": "",
|
|
3700
3712
|
"optional": true,
|
|
3701
3713
|
"description": "",
|
|
3702
|
-
"line":
|
|
3714
|
+
"line": 33,
|
|
3703
3715
|
"rawdescription": "\n"
|
|
3704
3716
|
},
|
|
3705
3717
|
{
|
|
@@ -3711,7 +3723,7 @@
|
|
|
3711
3723
|
"indexKey": "",
|
|
3712
3724
|
"optional": true,
|
|
3713
3725
|
"description": "",
|
|
3714
|
-
"line":
|
|
3726
|
+
"line": 34,
|
|
3715
3727
|
"rawdescription": "\n"
|
|
3716
3728
|
},
|
|
3717
3729
|
{
|
|
@@ -3723,7 +3735,7 @@
|
|
|
3723
3735
|
"indexKey": "",
|
|
3724
3736
|
"optional": true,
|
|
3725
3737
|
"description": "",
|
|
3726
|
-
"line":
|
|
3738
|
+
"line": 39,
|
|
3727
3739
|
"rawdescription": "\n"
|
|
3728
3740
|
},
|
|
3729
3741
|
{
|
|
@@ -3735,7 +3747,7 @@
|
|
|
3735
3747
|
"indexKey": "",
|
|
3736
3748
|
"optional": true,
|
|
3737
3749
|
"description": "",
|
|
3738
|
-
"line":
|
|
3750
|
+
"line": 57,
|
|
3739
3751
|
"rawdescription": "\n"
|
|
3740
3752
|
},
|
|
3741
3753
|
{
|
|
@@ -3747,7 +3759,7 @@
|
|
|
3747
3759
|
"indexKey": "",
|
|
3748
3760
|
"optional": true,
|
|
3749
3761
|
"description": "",
|
|
3750
|
-
"line":
|
|
3762
|
+
"line": 71,
|
|
3751
3763
|
"rawdescription": "\n"
|
|
3752
3764
|
},
|
|
3753
3765
|
{
|
|
@@ -3771,7 +3783,7 @@
|
|
|
3771
3783
|
"indexKey": "",
|
|
3772
3784
|
"optional": true,
|
|
3773
3785
|
"description": "",
|
|
3774
|
-
"line":
|
|
3786
|
+
"line": 37,
|
|
3775
3787
|
"rawdescription": "\n"
|
|
3776
3788
|
},
|
|
3777
3789
|
{
|
|
@@ -3783,7 +3795,7 @@
|
|
|
3783
3795
|
"indexKey": "",
|
|
3784
3796
|
"optional": true,
|
|
3785
3797
|
"description": "",
|
|
3786
|
-
"line":
|
|
3798
|
+
"line": 36,
|
|
3787
3799
|
"rawdescription": "\n"
|
|
3788
3800
|
},
|
|
3789
3801
|
{
|
|
@@ -3807,7 +3819,7 @@
|
|
|
3807
3819
|
"indexKey": "",
|
|
3808
3820
|
"optional": false,
|
|
3809
3821
|
"description": "",
|
|
3810
|
-
"line":
|
|
3822
|
+
"line": 64,
|
|
3811
3823
|
"rawdescription": "\n"
|
|
3812
3824
|
},
|
|
3813
3825
|
{
|
|
@@ -3819,7 +3831,7 @@
|
|
|
3819
3831
|
"indexKey": "",
|
|
3820
3832
|
"optional": true,
|
|
3821
3833
|
"description": "",
|
|
3822
|
-
"line":
|
|
3834
|
+
"line": 44,
|
|
3823
3835
|
"rawdescription": "\n"
|
|
3824
3836
|
},
|
|
3825
3837
|
{
|
|
@@ -3831,7 +3843,7 @@
|
|
|
3831
3843
|
"indexKey": "",
|
|
3832
3844
|
"optional": true,
|
|
3833
3845
|
"description": "",
|
|
3834
|
-
"line":
|
|
3846
|
+
"line": 52,
|
|
3835
3847
|
"rawdescription": "\n"
|
|
3836
3848
|
},
|
|
3837
3849
|
{
|
|
@@ -3843,7 +3855,7 @@
|
|
|
3843
3855
|
"indexKey": "",
|
|
3844
3856
|
"optional": true,
|
|
3845
3857
|
"description": "",
|
|
3846
|
-
"line":
|
|
3858
|
+
"line": 45,
|
|
3847
3859
|
"rawdescription": "\n"
|
|
3848
3860
|
},
|
|
3849
3861
|
{
|
|
@@ -3855,7 +3867,7 @@
|
|
|
3855
3867
|
"indexKey": "",
|
|
3856
3868
|
"optional": true,
|
|
3857
3869
|
"description": "",
|
|
3858
|
-
"line":
|
|
3870
|
+
"line": 53,
|
|
3859
3871
|
"rawdescription": "\n"
|
|
3860
3872
|
},
|
|
3861
3873
|
{
|
|
@@ -3867,7 +3879,7 @@
|
|
|
3867
3879
|
"indexKey": "",
|
|
3868
3880
|
"optional": true,
|
|
3869
3881
|
"description": "",
|
|
3870
|
-
"line":
|
|
3882
|
+
"line": 43,
|
|
3871
3883
|
"rawdescription": "\n"
|
|
3872
3884
|
},
|
|
3873
3885
|
{
|
|
@@ -3879,7 +3891,7 @@
|
|
|
3879
3891
|
"indexKey": "",
|
|
3880
3892
|
"optional": true,
|
|
3881
3893
|
"description": "",
|
|
3882
|
-
"line":
|
|
3894
|
+
"line": 42,
|
|
3883
3895
|
"rawdescription": "\n"
|
|
3884
3896
|
},
|
|
3885
3897
|
{
|
|
@@ -3891,7 +3903,7 @@
|
|
|
3891
3903
|
"indexKey": "",
|
|
3892
3904
|
"optional": true,
|
|
3893
3905
|
"description": "",
|
|
3894
|
-
"line":
|
|
3906
|
+
"line": 47,
|
|
3895
3907
|
"rawdescription": "\n"
|
|
3896
3908
|
}
|
|
3897
3909
|
],
|
|
@@ -4873,7 +4885,7 @@
|
|
|
4873
4885
|
},
|
|
4874
4886
|
{
|
|
4875
4887
|
"name": "EuiAppShellService",
|
|
4876
|
-
"id": "injectable-EuiAppShellService-
|
|
4888
|
+
"id": "injectable-EuiAppShellService-2b10e519e4a4b60702c2f5da03d8ea5dc23dbec19cc7d660553b4aac90c5bdcd38a9eee6e4f6c9e5e9f468f5f00d106dcd82a7d9667028ef3f85483af3b8ffee",
|
|
4877
4889
|
"file": "packages/core/src/lib/services/eui-app-shell.service.ts",
|
|
4878
4890
|
"coverageIgnore": false,
|
|
4879
4891
|
"properties": [
|
|
@@ -4887,7 +4899,7 @@
|
|
|
4887
4899
|
"indexKey": "",
|
|
4888
4900
|
"optional": false,
|
|
4889
4901
|
"description": "",
|
|
4890
|
-
"line":
|
|
4902
|
+
"line": 134,
|
|
4891
4903
|
"rawdescription": "\n",
|
|
4892
4904
|
"modifierKind": [
|
|
4893
4905
|
124
|
|
@@ -4902,7 +4914,7 @@
|
|
|
4902
4914
|
"indexKey": "",
|
|
4903
4915
|
"optional": false,
|
|
4904
4916
|
"description": "",
|
|
4905
|
-
"line":
|
|
4917
|
+
"line": 133,
|
|
4906
4918
|
"rawdescription": "\n"
|
|
4907
4919
|
},
|
|
4908
4920
|
{
|
|
@@ -4914,7 +4926,7 @@
|
|
|
4914
4926
|
"indexKey": "",
|
|
4915
4927
|
"optional": false,
|
|
4916
4928
|
"description": "",
|
|
4917
|
-
"line":
|
|
4929
|
+
"line": 132,
|
|
4918
4930
|
"rawdescription": "\n"
|
|
4919
4931
|
}
|
|
4920
4932
|
],
|
|
@@ -4926,7 +4938,7 @@
|
|
|
4926
4938
|
"optional": false,
|
|
4927
4939
|
"returnType": "void",
|
|
4928
4940
|
"typeParameters": [],
|
|
4929
|
-
"line":
|
|
4941
|
+
"line": 401,
|
|
4930
4942
|
"deprecated": false,
|
|
4931
4943
|
"deprecationMessage": "",
|
|
4932
4944
|
"rawdescription": "\n",
|
|
@@ -4942,7 +4954,7 @@
|
|
|
4942
4954
|
"optional": false,
|
|
4943
4955
|
"returnType": "void",
|
|
4944
4956
|
"typeParameters": [],
|
|
4945
|
-
"line":
|
|
4957
|
+
"line": 393,
|
|
4946
4958
|
"deprecated": false,
|
|
4947
4959
|
"deprecationMessage": "",
|
|
4948
4960
|
"rawdescription": "\n",
|
|
@@ -4958,7 +4970,7 @@
|
|
|
4958
4970
|
"optional": false,
|
|
4959
4971
|
"returnType": "void",
|
|
4960
4972
|
"typeParameters": [],
|
|
4961
|
-
"line":
|
|
4973
|
+
"line": 356,
|
|
4962
4974
|
"deprecated": false,
|
|
4963
4975
|
"deprecationMessage": "",
|
|
4964
4976
|
"rawdescription": "\n",
|
|
@@ -4974,7 +4986,7 @@
|
|
|
4974
4986
|
"optional": false,
|
|
4975
4987
|
"returnType": "void",
|
|
4976
4988
|
"typeParameters": [],
|
|
4977
|
-
"line":
|
|
4989
|
+
"line": 389,
|
|
4978
4990
|
"deprecated": false,
|
|
4979
4991
|
"deprecationMessage": "",
|
|
4980
4992
|
"rawdescription": "\n",
|
|
@@ -4990,7 +5002,7 @@
|
|
|
4990
5002
|
"optional": false,
|
|
4991
5003
|
"returnType": "void",
|
|
4992
5004
|
"typeParameters": [],
|
|
4993
|
-
"line":
|
|
5005
|
+
"line": 385,
|
|
4994
5006
|
"deprecated": false,
|
|
4995
5007
|
"deprecationMessage": "",
|
|
4996
5008
|
"rawdescription": "\n",
|
|
@@ -5006,7 +5018,7 @@
|
|
|
5006
5018
|
"optional": false,
|
|
5007
5019
|
"returnType": "void",
|
|
5008
5020
|
"typeParameters": [],
|
|
5009
|
-
"line":
|
|
5021
|
+
"line": 367,
|
|
5010
5022
|
"deprecated": false,
|
|
5011
5023
|
"deprecationMessage": "",
|
|
5012
5024
|
"rawdescription": "\n",
|
|
@@ -5022,7 +5034,7 @@
|
|
|
5022
5034
|
"optional": false,
|
|
5023
5035
|
"returnType": "void",
|
|
5024
5036
|
"typeParameters": [],
|
|
5025
|
-
"line":
|
|
5037
|
+
"line": 417,
|
|
5026
5038
|
"deprecated": false,
|
|
5027
5039
|
"deprecationMessage": "",
|
|
5028
5040
|
"rawdescription": "\n",
|
|
@@ -5038,7 +5050,7 @@
|
|
|
5038
5050
|
"optional": false,
|
|
5039
5051
|
"returnType": "void",
|
|
5040
5052
|
"typeParameters": [],
|
|
5041
|
-
"line":
|
|
5053
|
+
"line": 425,
|
|
5042
5054
|
"deprecated": false,
|
|
5043
5055
|
"deprecationMessage": "",
|
|
5044
5056
|
"rawdescription": "\n",
|
|
@@ -5054,7 +5066,7 @@
|
|
|
5054
5066
|
"optional": false,
|
|
5055
5067
|
"returnType": "void",
|
|
5056
5068
|
"typeParameters": [],
|
|
5057
|
-
"line":
|
|
5069
|
+
"line": 433,
|
|
5058
5070
|
"deprecated": false,
|
|
5059
5071
|
"deprecationMessage": "",
|
|
5060
5072
|
"rawdescription": "\n",
|
|
@@ -5079,7 +5091,7 @@
|
|
|
5079
5091
|
"optional": false,
|
|
5080
5092
|
"returnType": "void",
|
|
5081
5093
|
"typeParameters": [],
|
|
5082
|
-
"line":
|
|
5094
|
+
"line": 409,
|
|
5083
5095
|
"deprecated": false,
|
|
5084
5096
|
"deprecationMessage": "",
|
|
5085
5097
|
"rawdescription": "\n",
|
|
@@ -5108,7 +5120,7 @@
|
|
|
5108
5120
|
"optional": false,
|
|
5109
5121
|
"returnType": "void",
|
|
5110
5122
|
"typeParameters": [],
|
|
5111
|
-
"line":
|
|
5123
|
+
"line": 376,
|
|
5112
5124
|
"deprecated": false,
|
|
5113
5125
|
"deprecationMessage": "",
|
|
5114
5126
|
"rawdescription": "\n",
|
|
@@ -5124,7 +5136,7 @@
|
|
|
5124
5136
|
"optional": false,
|
|
5125
5137
|
"returnType": "void",
|
|
5126
5138
|
"typeParameters": [],
|
|
5127
|
-
"line":
|
|
5139
|
+
"line": 327,
|
|
5128
5140
|
"deprecated": false,
|
|
5129
5141
|
"deprecationMessage": "",
|
|
5130
5142
|
"rawdescription": "\n",
|
|
@@ -5150,7 +5162,7 @@
|
|
|
5150
5162
|
"optional": false,
|
|
5151
5163
|
"returnType": "void",
|
|
5152
5164
|
"typeParameters": [],
|
|
5153
|
-
"line":
|
|
5165
|
+
"line": 347,
|
|
5154
5166
|
"deprecated": false,
|
|
5155
5167
|
"deprecationMessage": "",
|
|
5156
5168
|
"rawdescription": "\n",
|
|
@@ -5180,7 +5192,7 @@
|
|
|
5180
5192
|
"optional": false,
|
|
5181
5193
|
"returnType": "string",
|
|
5182
5194
|
"typeParameters": [],
|
|
5183
|
-
"line":
|
|
5195
|
+
"line": 443,
|
|
5184
5196
|
"deprecated": false,
|
|
5185
5197
|
"deprecationMessage": "",
|
|
5186
5198
|
"rawdescription": "\n\nReturns the current value of --eui-f-size-base CSS variable\n",
|
|
@@ -5207,7 +5219,7 @@
|
|
|
5207
5219
|
"typeParameters": [
|
|
5208
5220
|
"T"
|
|
5209
5221
|
],
|
|
5210
|
-
"line":
|
|
5222
|
+
"line": 309,
|
|
5211
5223
|
"deprecated": false,
|
|
5212
5224
|
"deprecationMessage": "",
|
|
5213
5225
|
"rawdescription": "\n\nEmits a slice from the state whether that changes\n\n",
|
|
@@ -5215,8 +5227,8 @@
|
|
|
5215
5227
|
"jsdoctags": [
|
|
5216
5228
|
{
|
|
5217
5229
|
"name": {
|
|
5218
|
-
"pos":
|
|
5219
|
-
"end":
|
|
5230
|
+
"pos": 8984,
|
|
5231
|
+
"end": 8987,
|
|
5220
5232
|
"kind": 80,
|
|
5221
5233
|
"id": 0,
|
|
5222
5234
|
"flags": 16842752,
|
|
@@ -5229,8 +5241,8 @@
|
|
|
5229
5241
|
"deprecated": false,
|
|
5230
5242
|
"deprecationMessage": "",
|
|
5231
5243
|
"tagName": {
|
|
5232
|
-
"pos":
|
|
5233
|
-
"end":
|
|
5244
|
+
"pos": 8978,
|
|
5245
|
+
"end": 8983,
|
|
5234
5246
|
"kind": 80,
|
|
5235
5247
|
"id": 0,
|
|
5236
5248
|
"flags": 16842752,
|
|
@@ -5257,7 +5269,7 @@
|
|
|
5257
5269
|
"optional": false,
|
|
5258
5270
|
"returnType": "void",
|
|
5259
5271
|
"typeParameters": [],
|
|
5260
|
-
"line":
|
|
5272
|
+
"line": 450,
|
|
5261
5273
|
"deprecated": false,
|
|
5262
5274
|
"deprecationMessage": "",
|
|
5263
5275
|
"rawdescription": "\n\nUpdates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n",
|
|
@@ -5295,7 +5307,7 @@
|
|
|
5295
5307
|
"optional": false,
|
|
5296
5308
|
"returnType": "void",
|
|
5297
5309
|
"typeParameters": [],
|
|
5298
|
-
"line":
|
|
5310
|
+
"line": 336,
|
|
5299
5311
|
"deprecated": false,
|
|
5300
5312
|
"deprecationMessage": "",
|
|
5301
5313
|
"rawdescription": "\n",
|
|
@@ -5342,7 +5354,7 @@
|
|
|
5342
5354
|
"optional": false,
|
|
5343
5355
|
"returnType": "void",
|
|
5344
5356
|
"typeParameters": [],
|
|
5345
|
-
"line":
|
|
5357
|
+
"line": 256,
|
|
5346
5358
|
"deprecated": false,
|
|
5347
5359
|
"deprecationMessage": "",
|
|
5348
5360
|
"rawdescription": "\n",
|
|
@@ -5380,7 +5392,7 @@
|
|
|
5380
5392
|
"optional": false,
|
|
5381
5393
|
"returnType": "void",
|
|
5382
5394
|
"typeParameters": [],
|
|
5383
|
-
"line":
|
|
5395
|
+
"line": 322,
|
|
5384
5396
|
"deprecated": false,
|
|
5385
5397
|
"deprecationMessage": "",
|
|
5386
5398
|
"rawdescription": "\n",
|
|
@@ -5394,14 +5406,14 @@
|
|
|
5394
5406
|
"deprecationMessage": "",
|
|
5395
5407
|
"description": "",
|
|
5396
5408
|
"rawdescription": "\n",
|
|
5397
|
-
"sourceCode": "import { Injectable, PLATFORM_ID, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { BehaviorSubject, defer, firstValueFrom, Observable } from 'rxjs';\nimport { EuiEuLanguages, GlobalConfig, getActiveLang, EuiLanguage, EuiMenuItem } from '@eui/base';\nimport { GLOBAL_CONFIG_TOKEN } from './config/tokens';\nimport { I18nService } from './i18n';\nimport { Router, NavigationEnd } from '@angular/router';\nimport { StoreService } from './store/store.service';\nimport { distinctUntilChanged, filter, map } from 'rxjs/operators';\nimport { isEqual, get } from 'lodash-es';\nimport { CssUtils } from '../helpers/css-utils';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface UIState<BP = any, DI = any, AMD =any, BPV = any> {\n // app state\n appName?: string;\n appShortName?: string;\n appSubTitle?: string;\n appBaseFontSize?: string;\n\n // Sidebar state\n isSidebarOpen?: boolean;\n isSidebarActive?: boolean;\n hasSidebar?: boolean;\n hasSideContainer?: boolean;\n hasBreadcrumb?: boolean;\n hasHeader?: boolean;\n hasHeaderLogo?: boolean;\n hasHeaderEnvironment?: boolean;\n hasToolbar?: boolean;\n hasToolbarMegaMenu?: boolean;\n hasToolbarMenu?: boolean;\n environmentValue?: string;\n isSidebarHidden?: boolean;\n isSidebarFocused?: boolean;\n hasSidebarCollapsedVariant?: boolean;\n hasTopMessage?: boolean;\n\n // window state\n windowWidth?: number;\n windowHeight?: number;\n mainContentHeight?: number;\n pageHeaderHeight?: number;\n breakpoint?: string;\n wrapperClasses?: string;\n breakpoints?: BP;\n breakpointValues?: BPV;\n\n // navigation state\n menuLinks?: EuiMenuItem[];\n sidebarLinks?: EuiMenuItem[];\n combinedLinks?: EuiMenuItem[];\n\n // other states\n isBlockDocumentActive?: boolean;\n\n // device info\n deviceInfo: DI;\n\n // language infos\n activeLanguage: string;\n languages: (string | EuiLanguage)[];\n\n // app metadata\n appMetadata: AMD;\n\n // various dynamic state\n hasModalActive?: boolean;\n isDimmerActive?: boolean; // Usage: map to eui base directive input coerce euiHighlighted\n}\n\nconst initialState: UIState = {\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EuiAppShellService {\n navigationStartCustomHandler: () => void;\n navigationEndCustomHandler: () => void;\n protected config = inject<GlobalConfig>(GLOBAL_CONFIG_TOKEN, { optional: true });\n private http = inject(HttpClient);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n private router = inject(Router);\n private storeService = inject(StoreService);\n private i18nService = inject(I18nService, { optional: true });\n\n // -------------------\n get state$(): Observable<UIState> {\n return this._state$.asObservable();\n }\n\n // -------------------\n // exposed observables\n\n get breakpoint$(): Observable<string> {\n return this._breakpoint$.asObservable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get breakpoints$(): Observable<any> {\n return this._breakpoints$.asObservable();\n }\n\n // ----------------\n // state operations\n // ----------------\n get state(): UIState {\n return this._state$.getValue();\n }\n\n // ----------------------------\n // public setters and functions\n // ----------------------------\n set isSidebarOpen(isOpen: boolean) {\n this.setState({\n ...this.state,\n isSidebarOpen: isOpen,\n });\n }\n\n get isSidebarOpen(): boolean {\n return this.state.isSidebarOpen;\n }\n\n set isSidebarActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isSidebarActive: isActive,\n });\n }\n\n set sidebarLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n sidebarLinks: links,\n });\n }\n\n set hasSidebarCollapsedVariant(isActive: boolean) {\n this.setState({\n ...this.state,\n hasSidebarCollapsedVariant: isActive,\n });\n CssUtils.activateSidebarCssVars(this.document, this.platformId, isActive);\n }\n\n set menuLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n menuLinks: links,\n });\n }\n\n set isBlockDocumentActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isBlockDocumentActive: isActive,\n });\n }\n\n get hasHeader(): boolean {\n return this.state.hasHeader;\n }\n\n // Edit mode\n get isDimmerActive(): boolean {\n return this.state.isDimmerActive;\n }\n\n set isDimmerActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isDimmerActive: isActive,\n });\n }\n\n private _state$: BehaviorSubject<UIState>;\n private _breakpoint$: BehaviorSubject<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _breakpoints$: BehaviorSubject<any>;\n\n constructor() {\n const config = this.config;\n\n let stateWithConfig = initialState;\n const languages = config?.i18n?.i18nService?.languages || initialState.languages;\n const defaultLanguage = config?.i18n?.i18nService?.defaultLanguage || initialState.activeLanguage;\n stateWithConfig = {\n ...stateWithConfig,\n ...{\n languages,\n activeLanguage: defaultLanguage,\n },\n };\n this._state$ = new BehaviorSubject(stateWithConfig);\n this._breakpoint$ = new BehaviorSubject('');\n this._breakpoints$ = new BehaviorSubject({});\n this.bindActiveLanguageToAppShellState();\n }\n\n setState(nextState: UIState, updateI18 = true): void {\n let breakpoint, breakpoints;\n let combinedLinks;\n\n const state = this.state;\n\n // check if window width has been updated from previous state\n if (this.state.windowWidth !== nextState.windowWidth) {\n breakpoint = this.getBreakpoint(nextState.windowWidth);\n breakpoints = this.getBreakpoints(breakpoint);\n\n this._breakpoint$.next(breakpoint);\n this._breakpoints$.next(breakpoints);\n\n // if not propagate the old ones without doing any calculations\n } else {\n breakpoint = state.breakpoint;\n breakpoints = state.breakpoints;\n }\n\n // finally get the wrapper classes when both the state and breakpoint are known\n const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);\n\n // check if the menuLinks or sidebarLinks have changed from previous state\n if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) {\n combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];\n } else {\n combinedLinks = this.state.combinedLinks;\n }\n\n const stateBeforeUpdate = { ...this.state };\n\n // we put it all together with the calculated properties\n this._state$.next({\n ...nextState,\n wrapperClasses,\n breakpoint,\n breakpoints,\n combinedLinks,\n });\n\n // update the Store Language\n if (updateI18 && nextState.activeLanguage !== stateBeforeUpdate.activeLanguage) {\n this.i18nService.updateState({ activeLang: nextState.activeLanguage });\n }\n }\n\n /**\n * Emits a slice from the state whether that changes\n *\n * @param key can be 'key' or 'key.sub.sub'\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getState<T = any>(key?: string): Observable<T> {\n return defer(() =>\n // check if key exists\n key\n ? this.state$.pipe(\n map((state) => get(state, key)),\n // filter((state) => state),\n distinctUntilChanged((x, y) => isEqual(x, y)),\n )\n : this.state$,\n );\n }\n\n public sidebarToggle(): void {\n this.isSidebarOpen = !this.state.isSidebarOpen;\n }\n\n // Edit mode\n public dimmerActiveToggle(): void {\n const isActive = this.isDimmerActive;\n this.setState({\n ...this.state,\n isDimmerActive: !isActive,\n });\n CssUtils.activateEditModeCssVars(!isActive, this.document);\n }\n\n public setDimmerActiveState(activeState: boolean): void {\n this.setState({\n ...this.state,\n isDimmerActive: activeState,\n });\n CssUtils.activateEditModeCssVars(activeState, this.document);\n }\n\n // --------------\n // public methods\n // --------------\n public fetchAppMetadata(metadataFilePath = 'assets/app-metadata.json'): void {\n this.getJson(metadataFilePath).then((data) => {\n this.setState({\n ...this.state,\n appMetadata: data,\n });\n });\n }\n\n public activateSidebar(): void {\n this.setState({\n ...this.state,\n hasSidebar: true,\n });\n\n if (!this.state.isSidebarHidden) {\n CssUtils.activateSidebarCssVars(this.document, this.platformId, this.state.hasSidebarCollapsedVariant);\n }\n }\n\n public activateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: true,\n });\n\n CssUtils.activateSideContainerCssVars(this.document, this.platformId);\n } \n\n public deactivateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: false,\n });\n\n CssUtils.deactivateSideContainerCssVars(this.document, this.platformId);\n } \n\n public activateSidebarHeader(): void {\n CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);\n }\n\n public activateSidebarFooter(): void {\n CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);\n }\n\n public activateHeader(): void {\n this.setState({\n ...this.state,\n hasHeader: true,\n });\n CssUtils.activateHeaderCssVars(this.document, this.platformId);\n }\n\n public activateBreadcrumb(): void {\n this.setState({\n ...this.state,\n hasBreadcrumb: true,\n });\n CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);\n }\n\n public activateTopMessage(height: number): void {\n this.setState({\n ...this.state,\n hasTopMessage: true,\n });\n CssUtils.activateTopMessageCssVars(height, this.document);\n }\n\n public activateToolbar(): void {\n this.setState({\n ...this.state,\n hasToolbar: true,\n });\n CssUtils.activateToolbarCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMegaMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMegaMenu: true,\n });\n CssUtils.activateToolbarMegaMenuCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMenu: true,\n });\n }\n\n /**\n * Returns the current value of --eui-f-size-base CSS variable\n */\n public getBaseFontSize(): string {\n return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);\n }\n\n /**\n * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n */\n public setBaseFontSize(newsize: string): void {\n this.setState(\n {\n ...this.state,\n appBaseFontSize: newsize,\n },\n false,\n );\n CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);\n }\n\n // ---------------\n // private getters\n // ---------------\n private getWrapperClasses(state: UIState, breakpoint: string): string {\n const classes: string[] = [];\n\n classes.push(breakpoint);\n\n if (state.hasSidebar) {\n if (state.isSidebarHidden) {\n classes.push('sidebar--hidden');\n }\n if (state.isSidebarOpen) {\n classes.push('sidebar--open');\n } else {\n classes.push('sidebar--close');\n }\n }\n if (state.deviceInfo?.isFF) {\n classes.push('ff');\n }\n if (state.deviceInfo?.isIE) {\n classes.push('ie');\n }\n if (state.deviceInfo?.isChrome) {\n classes.push('chrome');\n }\n return classes.join(' ');\n }\n\n private getBreakpoint(windowWidth: number): string {\n let bkp = '';\n\n if (this.state.breakpointValues.length === 0) {\n this.setState({\n ...this.state,\n breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),\n });\n }\n\n this.state.breakpointValues.forEach((b, i) => {\n if (i < this.state.breakpointValues.length) {\n if (windowWidth >= b.value && windowWidth < this.state.breakpointValues[i+1]?.value) {\n bkp = b.bkp;\n }\n } else if(windowWidth >= b.value) {\n bkp = b.bkp;\n }\n });\n\n return bkp;\n }\n\n private getBreakpoints(bkp: string): object {\n return {\n isMobile: bkp === 'xs' || bkp === 'sm',\n isTablet: bkp === 'md',\n isLtLargeTablet: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg',\n isLtDesktop: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg' || bkp === 'xl',\n isDesktop: bkp === 'xxl',\n isXL: bkp === 'xl',\n isXXL: bkp === 'xxl',\n isFHD: bkp === 'fhd',\n is2K: bkp === '2k',\n is4K: bkp === '4k',\n };\n }\n\n private getJson(url: string): Promise<object> {\n return firstValueFrom(this.http.get(url)).then(this.extractData).catch(this.handleError);\n }\n\n private extractData(res: Response): object {\n const body = res;\n return body || {};\n }\n\n private handleError<T extends Error>(error: T): Promise<T> {\n console.error('An error occurred', error);\n return Promise.reject(error.message || error);\n }\n\n private bindActiveLanguageToAppShellState(): void {\n this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {\n if (activeLang !== this.state.activeLanguage) {\n this.setState(\n {\n ...this.state,\n activeLanguage: activeLang,\n },\n false,\n );\n }\n });\n }\n}\n",
|
|
5409
|
+
"sourceCode": "import { Injectable, PLATFORM_ID, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { BehaviorSubject, defer, firstValueFrom, Observable } from 'rxjs';\nimport { EuiEuLanguages, GlobalConfig, getActiveLang, EuiLanguage, EuiMenuItem } from '@eui/base';\nimport { GLOBAL_CONFIG_TOKEN } from './config/tokens';\nimport { I18nService } from './i18n';\nimport { Router, NavigationEnd } from '@angular/router';\nimport { StoreService } from './store/store.service';\nimport { distinctUntilChanged, filter, map } from 'rxjs/operators';\nimport { isEqual, get } from 'lodash-es';\nimport { CssUtils } from '../helpers/css-utils';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface UIState<BP = any, DI = any, AMD =any, BPV = any> {\n // app state\n appName?: string;\n appShortName?: string;\n appSubTitle?: string;\n appBaseFontSize?: string;\n\n // Sidebar state\n isSidebarOpen?: boolean;\n isSidebarActive?: boolean;\n hasFixedPosition?: boolean;\n hasSidebar?: boolean;\n hasSideContainer?: boolean;\n hasBreadcrumb?: boolean;\n hasHeader?: boolean;\n hasHeaderLogo?: boolean;\n hasHeaderEnvironment?: boolean;\n hasToolbar?: boolean;\n hasToolbarMegaMenu?: boolean;\n hasToolbarMenu?: boolean;\n environmentValue?: string;\n isSidebarHidden?: boolean;\n isSidebarFocused?: boolean;\n hasSidebarCollapsedVariant?: boolean;\n hasTopMessage?: boolean;\n\n // window state\n windowWidth?: number;\n windowHeight?: number;\n mainContentHeight?: number;\n pageHeaderHeight?: number;\n breakpoint?: string;\n wrapperClasses?: string;\n breakpoints?: BP;\n breakpointValues?: BPV;\n\n // navigation state\n menuLinks?: EuiMenuItem[];\n sidebarLinks?: EuiMenuItem[];\n combinedLinks?: EuiMenuItem[];\n\n // other states\n isBlockDocumentActive?: boolean;\n\n // device info\n deviceInfo: DI;\n\n // language infos\n activeLanguage: string;\n languages: (string | EuiLanguage)[];\n\n // app metadata\n appMetadata: AMD;\n\n // various dynamic state\n hasModalActive?: boolean;\n isDimmerActive?: boolean; // Usage: map to eui base directive input coerce euiHighlighted\n}\n\nconst initialState: UIState = {\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasFixedPosition: true,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EuiAppShellService {\n navigationStartCustomHandler: () => void;\n navigationEndCustomHandler: () => void;\n protected config = inject<GlobalConfig>(GLOBAL_CONFIG_TOKEN, { optional: true });\n private http = inject(HttpClient);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n private router = inject(Router);\n private storeService = inject(StoreService);\n private i18nService = inject(I18nService, { optional: true });\n\n // -------------------\n get state$(): Observable<UIState> {\n return this._state$.asObservable();\n }\n\n // -------------------\n // exposed observables\n\n get breakpoint$(): Observable<string> {\n return this._breakpoint$.asObservable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get breakpoints$(): Observable<any> {\n return this._breakpoints$.asObservable();\n }\n\n // ----------------\n // state operations\n // ----------------\n get state(): UIState {\n return this._state$.getValue();\n }\n\n // ----------------------------\n // public setters and functions\n // ----------------------------\n set isSidebarOpen(isOpen: boolean) {\n this.setState({\n ...this.state,\n isSidebarOpen: isOpen,\n });\n }\n\n get isSidebarOpen(): boolean {\n return this.state.isSidebarOpen;\n }\n\n set isSidebarActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isSidebarActive: isActive,\n });\n }\n\n set sidebarLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n sidebarLinks: links,\n });\n }\n\n set hasSidebarCollapsedVariant(isActive: boolean) {\n this.setState({\n ...this.state,\n hasSidebarCollapsedVariant: isActive,\n });\n CssUtils.activateSidebarCssVars(this.document, this.platformId, isActive);\n }\n\n set menuLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n menuLinks: links,\n });\n }\n\n set isBlockDocumentActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isBlockDocumentActive: isActive,\n });\n }\n\n get hasHeader(): boolean {\n return this.state.hasHeader;\n }\n\n // Edit mode\n get isDimmerActive(): boolean {\n return this.state.isDimmerActive;\n }\n\n set isDimmerActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isDimmerActive: isActive,\n });\n }\n\n private _state$: BehaviorSubject<UIState>;\n private _breakpoint$: BehaviorSubject<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _breakpoints$: BehaviorSubject<any>;\n\n constructor() {\n const config = this.config;\n\n let stateWithConfig = initialState;\n const languages = config?.i18n?.i18nService?.languages || initialState.languages;\n const defaultLanguage = config?.i18n?.i18nService?.defaultLanguage || initialState.activeLanguage;\n stateWithConfig = {\n ...stateWithConfig,\n ...{\n languages,\n activeLanguage: defaultLanguage,\n },\n };\n this._state$ = new BehaviorSubject(stateWithConfig);\n this._breakpoint$ = new BehaviorSubject('');\n this._breakpoints$ = new BehaviorSubject({});\n this.bindActiveLanguageToAppShellState();\n }\n\n setState(nextState: UIState, updateI18 = true): void {\n let breakpoint, breakpoints;\n let combinedLinks;\n\n const state = this.state;\n\n // check if window width has been updated from previous state\n if (this.state.windowWidth !== nextState.windowWidth) {\n breakpoint = this.getBreakpoint(nextState.windowWidth);\n breakpoints = this.getBreakpoints(breakpoint);\n\n this._breakpoint$.next(breakpoint);\n this._breakpoints$.next(breakpoints);\n\n // if not propagate the old ones without doing any calculations\n } else {\n breakpoint = state.breakpoint;\n breakpoints = state.breakpoints;\n }\n\n // finally get the wrapper classes when both the state and breakpoint are known\n const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);\n\n // check if the menuLinks or sidebarLinks have changed from previous state\n if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) {\n combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];\n } else {\n combinedLinks = this.state.combinedLinks;\n }\n\n const stateBeforeUpdate = { ...this.state };\n\n // we put it all together with the calculated properties\n this._state$.next({\n ...nextState,\n wrapperClasses,\n breakpoint,\n breakpoints,\n combinedLinks,\n });\n\n // update the Store Language\n if (updateI18 && nextState.activeLanguage !== stateBeforeUpdate.activeLanguage) {\n this.i18nService.updateState({ activeLang: nextState.activeLanguage });\n }\n }\n\n /**\n * Emits a slice from the state whether that changes\n *\n * @param key can be 'key' or 'key.sub.sub'\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getState<T = any>(key?: string): Observable<T> {\n return defer(() =>\n // check if key exists\n key\n ? this.state$.pipe(\n map((state) => get(state, key)),\n // filter((state) => state),\n distinctUntilChanged((x, y) => isEqual(x, y)),\n )\n : this.state$,\n );\n }\n\n public sidebarToggle(): void {\n this.isSidebarOpen = !this.state.isSidebarOpen;\n }\n\n // Edit mode\n public dimmerActiveToggle(): void {\n const isActive = this.isDimmerActive;\n this.setState({\n ...this.state,\n isDimmerActive: !isActive,\n });\n CssUtils.activateEditModeCssVars(!isActive, this.document);\n }\n\n public setDimmerActiveState(activeState: boolean): void {\n this.setState({\n ...this.state,\n isDimmerActive: activeState,\n });\n CssUtils.activateEditModeCssVars(activeState, this.document);\n }\n\n // --------------\n // public methods\n // --------------\n public fetchAppMetadata(metadataFilePath = 'assets/app-metadata.json'): void {\n this.getJson(metadataFilePath).then((data) => {\n this.setState({\n ...this.state,\n appMetadata: data,\n });\n });\n }\n\n public activateSidebar(): void {\n this.setState({\n ...this.state,\n hasSidebar: true,\n });\n\n if (!this.state.isSidebarHidden) {\n CssUtils.activateSidebarCssVars(this.document, this.platformId, this.state.hasSidebarCollapsedVariant);\n }\n }\n\n public activateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: true,\n });\n\n CssUtils.activateSideContainerCssVars(this.document, this.platformId);\n } \n\n public deactivateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: false,\n });\n\n CssUtils.deactivateSideContainerCssVars(this.document, this.platformId);\n } \n\n public activateSidebarHeader(): void {\n CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);\n }\n\n public activateSidebarFooter(): void {\n CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);\n }\n\n public activateHeader(): void {\n this.setState({\n ...this.state,\n hasHeader: true,\n });\n CssUtils.activateHeaderCssVars(this.document, this.platformId);\n }\n\n public activateBreadcrumb(): void {\n this.setState({\n ...this.state,\n hasBreadcrumb: true,\n });\n CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);\n }\n\n public activateTopMessage(height: number): void {\n this.setState({\n ...this.state,\n hasTopMessage: true,\n });\n CssUtils.activateTopMessageCssVars(height, this.document);\n }\n\n public activateToolbar(): void {\n this.setState({\n ...this.state,\n hasToolbar: true,\n });\n CssUtils.activateToolbarCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMegaMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMegaMenu: true,\n });\n CssUtils.activateToolbarMegaMenuCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMenu: true,\n });\n }\n\n /**\n * Returns the current value of --eui-f-size-base CSS variable\n */\n public getBaseFontSize(): string {\n return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);\n }\n\n /**\n * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n */\n public setBaseFontSize(newsize: string): void {\n this.setState(\n {\n ...this.state,\n appBaseFontSize: newsize,\n },\n false,\n );\n CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);\n }\n\n // ---------------\n // private getters\n // ---------------\n private getWrapperClasses(state: UIState, breakpoint: string): string {\n const classes: string[] = [];\n\n classes.push(breakpoint);\n\n if (state.hasSidebar) {\n if (state.isSidebarHidden) {\n classes.push('sidebar--hidden');\n }\n if (state.isSidebarOpen) {\n classes.push('sidebar--open');\n } else {\n classes.push('sidebar--close');\n }\n }\n if (state.deviceInfo?.isFF) {\n classes.push('ff');\n }\n if (state.deviceInfo?.isIE) {\n classes.push('ie');\n }\n if (state.deviceInfo?.isChrome) {\n classes.push('chrome');\n }\n if (state.hasFixedPosition) {\n classes.push('fixed-position');\n } else {\n classes.push('relative-position');\n }\n return classes.join(' ');\n }\n\n private getBreakpoint(windowWidth: number): string {\n let bkp = '';\n\n if (this.state.breakpointValues.length === 0) {\n this.setState({\n ...this.state,\n breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),\n });\n }\n\n this.state.breakpointValues.forEach((b, i) => {\n if (i < this.state.breakpointValues.length) {\n if (windowWidth >= b.value && windowWidth < this.state.breakpointValues[i+1]?.value) {\n bkp = b.bkp;\n }\n } else if(windowWidth >= b.value) {\n bkp = b.bkp;\n }\n });\n\n return bkp;\n }\n\n private getBreakpoints(bkp: string): object {\n return {\n isMobile: bkp === 'xs' || bkp === 'sm',\n isTablet: bkp === 'md',\n isLtLargeTablet: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg',\n isLtDesktop: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg' || bkp === 'xl',\n isDesktop: bkp === 'xxl',\n isXL: bkp === 'xl',\n isXXL: bkp === 'xxl',\n isFHD: bkp === 'fhd',\n is2K: bkp === '2k',\n is4K: bkp === '4k',\n };\n }\n\n private getJson(url: string): Promise<object> {\n return firstValueFrom(this.http.get(url)).then(this.extractData).catch(this.handleError);\n }\n\n private extractData(res: Response): object {\n const body = res;\n return body || {};\n }\n\n private handleError<T extends Error>(error: T): Promise<T> {\n console.error('An error occurred', error);\n return Promise.reject(error.message || error);\n }\n\n private bindActiveLanguageToAppShellState(): void {\n this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {\n if (activeLang !== this.state.activeLanguage) {\n this.setState(\n {\n ...this.state,\n activeLanguage: activeLang,\n },\n false,\n );\n }\n });\n }\n}\n",
|
|
5398
5410
|
"constructorObj": {
|
|
5399
5411
|
"name": "constructor",
|
|
5400
5412
|
"description": "",
|
|
5401
5413
|
"deprecated": false,
|
|
5402
5414
|
"deprecationMessage": "",
|
|
5403
5415
|
"args": [],
|
|
5404
|
-
"line":
|
|
5416
|
+
"line": 235,
|
|
5405
5417
|
"rawdescription": "\n"
|
|
5406
5418
|
},
|
|
5407
5419
|
"accessors": {
|
|
@@ -5411,7 +5423,7 @@
|
|
|
5411
5423
|
"name": "state$",
|
|
5412
5424
|
"type": "unknown",
|
|
5413
5425
|
"returnType": "Observable<UIState>",
|
|
5414
|
-
"line":
|
|
5426
|
+
"line": 143,
|
|
5415
5427
|
"rawdescription": "\n",
|
|
5416
5428
|
"description": ""
|
|
5417
5429
|
}
|
|
@@ -5422,7 +5434,7 @@
|
|
|
5422
5434
|
"name": "breakpoint$",
|
|
5423
5435
|
"type": "unknown",
|
|
5424
5436
|
"returnType": "Observable<string>",
|
|
5425
|
-
"line":
|
|
5437
|
+
"line": 150,
|
|
5426
5438
|
"rawdescription": "\n",
|
|
5427
5439
|
"description": ""
|
|
5428
5440
|
}
|
|
@@ -5433,7 +5445,7 @@
|
|
|
5433
5445
|
"name": "breakpoints$",
|
|
5434
5446
|
"type": "unknown",
|
|
5435
5447
|
"returnType": "Observable<any>",
|
|
5436
|
-
"line":
|
|
5448
|
+
"line": 155,
|
|
5437
5449
|
"rawdescription": "\n",
|
|
5438
5450
|
"description": ""
|
|
5439
5451
|
}
|
|
@@ -5444,7 +5456,7 @@
|
|
|
5444
5456
|
"name": "state",
|
|
5445
5457
|
"type": "unknown",
|
|
5446
5458
|
"returnType": "UIState",
|
|
5447
|
-
"line":
|
|
5459
|
+
"line": 162,
|
|
5448
5460
|
"rawdescription": "\n",
|
|
5449
5461
|
"description": ""
|
|
5450
5462
|
}
|
|
@@ -5467,7 +5479,7 @@
|
|
|
5467
5479
|
}
|
|
5468
5480
|
],
|
|
5469
5481
|
"returnType": "void",
|
|
5470
|
-
"line":
|
|
5482
|
+
"line": 169,
|
|
5471
5483
|
"rawdescription": "\n",
|
|
5472
5484
|
"description": "",
|
|
5473
5485
|
"jsdoctags": [
|
|
@@ -5488,7 +5500,7 @@
|
|
|
5488
5500
|
"name": "isSidebarOpen",
|
|
5489
5501
|
"type": "boolean",
|
|
5490
5502
|
"returnType": "boolean",
|
|
5491
|
-
"line":
|
|
5503
|
+
"line": 176,
|
|
5492
5504
|
"rawdescription": "\n",
|
|
5493
5505
|
"description": ""
|
|
5494
5506
|
}
|
|
@@ -5511,7 +5523,7 @@
|
|
|
5511
5523
|
}
|
|
5512
5524
|
],
|
|
5513
5525
|
"returnType": "void",
|
|
5514
|
-
"line":
|
|
5526
|
+
"line": 180,
|
|
5515
5527
|
"rawdescription": "\n",
|
|
5516
5528
|
"description": "",
|
|
5517
5529
|
"jsdoctags": [
|
|
@@ -5547,7 +5559,7 @@
|
|
|
5547
5559
|
}
|
|
5548
5560
|
],
|
|
5549
5561
|
"returnType": "void",
|
|
5550
|
-
"line":
|
|
5562
|
+
"line": 187,
|
|
5551
5563
|
"rawdescription": "\n",
|
|
5552
5564
|
"description": "",
|
|
5553
5565
|
"jsdoctags": [
|
|
@@ -5583,7 +5595,7 @@
|
|
|
5583
5595
|
}
|
|
5584
5596
|
],
|
|
5585
5597
|
"returnType": "void",
|
|
5586
|
-
"line":
|
|
5598
|
+
"line": 194,
|
|
5587
5599
|
"rawdescription": "\n",
|
|
5588
5600
|
"description": "",
|
|
5589
5601
|
"jsdoctags": [
|
|
@@ -5619,7 +5631,7 @@
|
|
|
5619
5631
|
}
|
|
5620
5632
|
],
|
|
5621
5633
|
"returnType": "void",
|
|
5622
|
-
"line":
|
|
5634
|
+
"line": 202,
|
|
5623
5635
|
"rawdescription": "\n",
|
|
5624
5636
|
"description": "",
|
|
5625
5637
|
"jsdoctags": [
|
|
@@ -5655,7 +5667,7 @@
|
|
|
5655
5667
|
}
|
|
5656
5668
|
],
|
|
5657
5669
|
"returnType": "void",
|
|
5658
|
-
"line":
|
|
5670
|
+
"line": 209,
|
|
5659
5671
|
"rawdescription": "\n",
|
|
5660
5672
|
"description": "",
|
|
5661
5673
|
"jsdoctags": [
|
|
@@ -5679,7 +5691,7 @@
|
|
|
5679
5691
|
"name": "hasHeader",
|
|
5680
5692
|
"type": "boolean",
|
|
5681
5693
|
"returnType": "boolean",
|
|
5682
|
-
"line":
|
|
5694
|
+
"line": 216,
|
|
5683
5695
|
"rawdescription": "\n",
|
|
5684
5696
|
"description": ""
|
|
5685
5697
|
}
|
|
@@ -5702,7 +5714,7 @@
|
|
|
5702
5714
|
}
|
|
5703
5715
|
],
|
|
5704
5716
|
"returnType": "void",
|
|
5705
|
-
"line":
|
|
5717
|
+
"line": 225,
|
|
5706
5718
|
"rawdescription": "\n",
|
|
5707
5719
|
"description": "",
|
|
5708
5720
|
"jsdoctags": [
|
|
@@ -5723,7 +5735,7 @@
|
|
|
5723
5735
|
"name": "isDimmerActive",
|
|
5724
5736
|
"type": "boolean",
|
|
5725
5737
|
"returnType": "boolean",
|
|
5726
|
-
"line":
|
|
5738
|
+
"line": 221,
|
|
5727
5739
|
"rawdescription": "\n",
|
|
5728
5740
|
"description": ""
|
|
5729
5741
|
}
|
|
@@ -22069,23 +22081,23 @@
|
|
|
22069
22081
|
"name": "COMPONENT_TAG",
|
|
22070
22082
|
"ctype": "miscellaneous",
|
|
22071
22083
|
"subtype": "variable",
|
|
22072
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
22084
|
+
"file": "packages/core/schematics/migrate-eui-editor/index.ts",
|
|
22073
22085
|
"coverageIgnore": false,
|
|
22074
22086
|
"deprecated": false,
|
|
22075
22087
|
"deprecationMessage": "",
|
|
22076
22088
|
"type": "string",
|
|
22077
|
-
"defaultValue": "'eui-
|
|
22089
|
+
"defaultValue": "'eui-editor'"
|
|
22078
22090
|
},
|
|
22079
22091
|
{
|
|
22080
22092
|
"name": "COMPONENT_TAG",
|
|
22081
22093
|
"ctype": "miscellaneous",
|
|
22082
22094
|
"subtype": "variable",
|
|
22083
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
22095
|
+
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
22084
22096
|
"coverageIgnore": false,
|
|
22085
22097
|
"deprecated": false,
|
|
22086
22098
|
"deprecationMessage": "",
|
|
22087
22099
|
"type": "string",
|
|
22088
|
-
"defaultValue": "'eui-
|
|
22100
|
+
"defaultValue": "'eui-discussion-thread'"
|
|
22089
22101
|
},
|
|
22090
22102
|
{
|
|
22091
22103
|
"name": "COMPONENT_TAG",
|
|
@@ -22648,7 +22660,7 @@
|
|
|
22648
22660
|
"deprecated": false,
|
|
22649
22661
|
"deprecationMessage": "",
|
|
22650
22662
|
"type": "UIState",
|
|
22651
|
-
"defaultValue": "{\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n}"
|
|
22663
|
+
"defaultValue": "{\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasFixedPosition: true,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n}"
|
|
22652
22664
|
},
|
|
22653
22665
|
{
|
|
22654
22666
|
"name": "initialState",
|
|
@@ -22964,23 +22976,23 @@
|
|
|
22964
22976
|
"name": "NEW_INTERFACE",
|
|
22965
22977
|
"ctype": "miscellaneous",
|
|
22966
22978
|
"subtype": "variable",
|
|
22967
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
22979
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
22968
22980
|
"coverageIgnore": false,
|
|
22969
22981
|
"deprecated": false,
|
|
22970
22982
|
"deprecationMessage": "",
|
|
22971
22983
|
"type": "string",
|
|
22972
|
-
"defaultValue": "'
|
|
22984
|
+
"defaultValue": "'EuiTooltipInterface'"
|
|
22973
22985
|
},
|
|
22974
22986
|
{
|
|
22975
22987
|
"name": "NEW_INTERFACE",
|
|
22976
22988
|
"ctype": "miscellaneous",
|
|
22977
22989
|
"subtype": "variable",
|
|
22978
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
22990
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
22979
22991
|
"coverageIgnore": false,
|
|
22980
22992
|
"deprecated": false,
|
|
22981
22993
|
"deprecationMessage": "",
|
|
22982
22994
|
"type": "string",
|
|
22983
|
-
"defaultValue": "'
|
|
22995
|
+
"defaultValue": "'EuiMenuItem'"
|
|
22984
22996
|
},
|
|
22985
22997
|
{
|
|
22986
22998
|
"name": "NEW_INTERFACE_PATH",
|
|
@@ -24539,7 +24551,7 @@
|
|
|
24539
24551
|
},
|
|
24540
24552
|
{
|
|
24541
24553
|
"name": "applyEdits",
|
|
24542
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
24554
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
24543
24555
|
"ctype": "miscellaneous",
|
|
24544
24556
|
"subtype": "function",
|
|
24545
24557
|
"coverageIgnore": false,
|
|
@@ -24584,7 +24596,7 @@
|
|
|
24584
24596
|
},
|
|
24585
24597
|
{
|
|
24586
24598
|
"name": "applyEdits",
|
|
24587
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
24599
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
24588
24600
|
"ctype": "miscellaneous",
|
|
24589
24601
|
"subtype": "function",
|
|
24590
24602
|
"coverageIgnore": false,
|
|
@@ -26564,7 +26576,7 @@
|
|
|
26564
26576
|
},
|
|
26565
26577
|
{
|
|
26566
26578
|
"name": "deduplicateEdits",
|
|
26567
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
26579
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
26568
26580
|
"ctype": "miscellaneous",
|
|
26569
26581
|
"subtype": "function",
|
|
26570
26582
|
"coverageIgnore": false,
|
|
@@ -26594,7 +26606,7 @@
|
|
|
26594
26606
|
},
|
|
26595
26607
|
{
|
|
26596
26608
|
"name": "deduplicateEdits",
|
|
26597
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
26609
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
26598
26610
|
"ctype": "miscellaneous",
|
|
26599
26611
|
"subtype": "function",
|
|
26600
26612
|
"coverageIgnore": false,
|
|
@@ -31714,38 +31726,6 @@
|
|
|
31714
31726
|
}
|
|
31715
31727
|
]
|
|
31716
31728
|
},
|
|
31717
|
-
{
|
|
31718
|
-
"name": "migrateInlineTemplates",
|
|
31719
|
-
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
31720
|
-
"ctype": "miscellaneous",
|
|
31721
|
-
"subtype": "function",
|
|
31722
|
-
"coverageIgnore": false,
|
|
31723
|
-
"deprecated": false,
|
|
31724
|
-
"deprecationMessage": "",
|
|
31725
|
-
"rawdescription": "",
|
|
31726
|
-
"description": "",
|
|
31727
|
-
"displayName": "migrateInlineTemplates",
|
|
31728
|
-
"args": [
|
|
31729
|
-
{
|
|
31730
|
-
"name": "source",
|
|
31731
|
-
"type": "string",
|
|
31732
|
-
"deprecated": false,
|
|
31733
|
-
"deprecationMessage": ""
|
|
31734
|
-
}
|
|
31735
|
-
],
|
|
31736
|
-
"returnType": "string",
|
|
31737
|
-
"jsdoctags": [
|
|
31738
|
-
{
|
|
31739
|
-
"name": "source",
|
|
31740
|
-
"type": "string",
|
|
31741
|
-
"deprecated": false,
|
|
31742
|
-
"deprecationMessage": "",
|
|
31743
|
-
"tagName": {
|
|
31744
|
-
"text": "param"
|
|
31745
|
-
}
|
|
31746
|
-
}
|
|
31747
|
-
]
|
|
31748
|
-
},
|
|
31749
31729
|
{
|
|
31750
31730
|
"name": "migrateInlineTemplates",
|
|
31751
31731
|
"file": "packages/core/schematics/migrate-eui-editor/index.ts",
|
|
@@ -31778,6 +31758,38 @@
|
|
|
31778
31758
|
}
|
|
31779
31759
|
]
|
|
31780
31760
|
},
|
|
31761
|
+
{
|
|
31762
|
+
"name": "migrateInlineTemplates",
|
|
31763
|
+
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
31764
|
+
"ctype": "miscellaneous",
|
|
31765
|
+
"subtype": "function",
|
|
31766
|
+
"coverageIgnore": false,
|
|
31767
|
+
"deprecated": false,
|
|
31768
|
+
"deprecationMessage": "",
|
|
31769
|
+
"rawdescription": "",
|
|
31770
|
+
"description": "",
|
|
31771
|
+
"displayName": "migrateInlineTemplates",
|
|
31772
|
+
"args": [
|
|
31773
|
+
{
|
|
31774
|
+
"name": "source",
|
|
31775
|
+
"type": "string",
|
|
31776
|
+
"deprecated": false,
|
|
31777
|
+
"deprecationMessage": ""
|
|
31778
|
+
}
|
|
31779
|
+
],
|
|
31780
|
+
"returnType": "string",
|
|
31781
|
+
"jsdoctags": [
|
|
31782
|
+
{
|
|
31783
|
+
"name": "source",
|
|
31784
|
+
"type": "string",
|
|
31785
|
+
"deprecated": false,
|
|
31786
|
+
"deprecationMessage": "",
|
|
31787
|
+
"tagName": {
|
|
31788
|
+
"text": "param"
|
|
31789
|
+
}
|
|
31790
|
+
}
|
|
31791
|
+
]
|
|
31792
|
+
},
|
|
31781
31793
|
{
|
|
31782
31794
|
"name": "migrateInlineTemplates",
|
|
31783
31795
|
"file": "packages/core/schematics/migrate-eui-fieldset/index.ts",
|
|
@@ -32256,7 +32268,7 @@
|
|
|
32256
32268
|
},
|
|
32257
32269
|
{
|
|
32258
32270
|
"name": "migrateTemplate",
|
|
32259
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
32271
|
+
"file": "packages/core/schematics/migrate-eui-editor/index.ts",
|
|
32260
32272
|
"ctype": "miscellaneous",
|
|
32261
32273
|
"subtype": "function",
|
|
32262
32274
|
"coverageIgnore": false,
|
|
@@ -32288,7 +32300,7 @@
|
|
|
32288
32300
|
},
|
|
32289
32301
|
{
|
|
32290
32302
|
"name": "migrateTemplate",
|
|
32291
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
32303
|
+
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
32292
32304
|
"ctype": "miscellaneous",
|
|
32293
32305
|
"subtype": "function",
|
|
32294
32306
|
"coverageIgnore": false,
|
|
@@ -32824,7 +32836,7 @@
|
|
|
32824
32836
|
},
|
|
32825
32837
|
{
|
|
32826
32838
|
"name": "migrateTypeScript",
|
|
32827
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
32839
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
32828
32840
|
"ctype": "miscellaneous",
|
|
32829
32841
|
"subtype": "function",
|
|
32830
32842
|
"coverageIgnore": false,
|
|
@@ -32886,7 +32898,7 @@
|
|
|
32886
32898
|
},
|
|
32887
32899
|
{
|
|
32888
32900
|
"name": "migrateTypeScript",
|
|
32889
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
32901
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
32890
32902
|
"ctype": "miscellaneous",
|
|
32891
32903
|
"subtype": "function",
|
|
32892
32904
|
"coverageIgnore": false,
|
|
@@ -33325,7 +33337,7 @@
|
|
|
33325
33337
|
},
|
|
33326
33338
|
{
|
|
33327
33339
|
"name": "removeImportSpecifier",
|
|
33328
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
33340
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
33329
33341
|
"ctype": "miscellaneous",
|
|
33330
33342
|
"subtype": "function",
|
|
33331
33343
|
"coverageIgnore": false,
|
|
@@ -33394,7 +33406,7 @@
|
|
|
33394
33406
|
},
|
|
33395
33407
|
{
|
|
33396
33408
|
"name": "removeImportSpecifier",
|
|
33397
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
33409
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
33398
33410
|
"ctype": "miscellaneous",
|
|
33399
33411
|
"subtype": "function",
|
|
33400
33412
|
"coverageIgnore": false,
|
|
@@ -35177,7 +35189,7 @@
|
|
|
35177
35189
|
},
|
|
35178
35190
|
{
|
|
35179
35191
|
"name": "visitDir",
|
|
35180
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
35192
|
+
"file": "packages/core/schematics/migrate-eui-editor/index.ts",
|
|
35181
35193
|
"ctype": "miscellaneous",
|
|
35182
35194
|
"subtype": "function",
|
|
35183
35195
|
"coverageIgnore": false,
|
|
@@ -35222,7 +35234,7 @@
|
|
|
35222
35234
|
},
|
|
35223
35235
|
{
|
|
35224
35236
|
"name": "visitDir",
|
|
35225
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
35237
|
+
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
35226
35238
|
"ctype": "miscellaneous",
|
|
35227
35239
|
"subtype": "function",
|
|
35228
35240
|
"coverageIgnore": false,
|
|
@@ -35582,7 +35594,7 @@
|
|
|
35582
35594
|
},
|
|
35583
35595
|
{
|
|
35584
35596
|
"name": "visitDir",
|
|
35585
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
35597
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
35586
35598
|
"ctype": "miscellaneous",
|
|
35587
35599
|
"subtype": "function",
|
|
35588
35600
|
"coverageIgnore": false,
|
|
@@ -35627,7 +35639,7 @@
|
|
|
35627
35639
|
},
|
|
35628
35640
|
{
|
|
35629
35641
|
"name": "visitDir",
|
|
35630
|
-
"file": "packages/core/schematics/migrate-
|
|
35642
|
+
"file": "packages/core/schematics/migrate-to-standalone/index.ts",
|
|
35631
35643
|
"ctype": "miscellaneous",
|
|
35632
35644
|
"subtype": "function",
|
|
35633
35645
|
"coverageIgnore": false,
|
|
@@ -35672,7 +35684,7 @@
|
|
|
35672
35684
|
},
|
|
35673
35685
|
{
|
|
35674
35686
|
"name": "visitDir",
|
|
35675
|
-
"file": "packages/core/schematics/migrate-
|
|
35687
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
35676
35688
|
"ctype": "miscellaneous",
|
|
35677
35689
|
"subtype": "function",
|
|
35678
35690
|
"coverageIgnore": false,
|
|
@@ -36035,7 +36047,7 @@
|
|
|
36035
36047
|
},
|
|
36036
36048
|
{
|
|
36037
36049
|
"name": "visitNodes",
|
|
36038
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
36050
|
+
"file": "packages/core/schematics/migrate-eui-editor/index.ts",
|
|
36039
36051
|
"ctype": "miscellaneous",
|
|
36040
36052
|
"subtype": "function",
|
|
36041
36053
|
"coverageIgnore": false,
|
|
@@ -36051,13 +36063,7 @@
|
|
|
36051
36063
|
"deprecationMessage": ""
|
|
36052
36064
|
},
|
|
36053
36065
|
{
|
|
36054
|
-
"name": "
|
|
36055
|
-
"type": "string",
|
|
36056
|
-
"deprecated": false,
|
|
36057
|
-
"deprecationMessage": ""
|
|
36058
|
-
},
|
|
36059
|
-
{
|
|
36060
|
-
"name": "removals",
|
|
36066
|
+
"name": "edits",
|
|
36061
36067
|
"deprecated": false,
|
|
36062
36068
|
"deprecationMessage": ""
|
|
36063
36069
|
}
|
|
@@ -36073,16 +36079,7 @@
|
|
|
36073
36079
|
}
|
|
36074
36080
|
},
|
|
36075
36081
|
{
|
|
36076
|
-
"name": "
|
|
36077
|
-
"type": "string",
|
|
36078
|
-
"deprecated": false,
|
|
36079
|
-
"deprecationMessage": "",
|
|
36080
|
-
"tagName": {
|
|
36081
|
-
"text": "param"
|
|
36082
|
-
}
|
|
36083
|
-
},
|
|
36084
|
-
{
|
|
36085
|
-
"name": "removals",
|
|
36082
|
+
"name": "edits",
|
|
36086
36083
|
"deprecated": false,
|
|
36087
36084
|
"deprecationMessage": "",
|
|
36088
36085
|
"tagName": {
|
|
@@ -36093,7 +36090,7 @@
|
|
|
36093
36090
|
},
|
|
36094
36091
|
{
|
|
36095
36092
|
"name": "visitNodes",
|
|
36096
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
36093
|
+
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
36097
36094
|
"ctype": "miscellaneous",
|
|
36098
36095
|
"subtype": "function",
|
|
36099
36096
|
"coverageIgnore": false,
|
|
@@ -36109,7 +36106,13 @@
|
|
|
36109
36106
|
"deprecationMessage": ""
|
|
36110
36107
|
},
|
|
36111
36108
|
{
|
|
36112
|
-
"name": "
|
|
36109
|
+
"name": "source",
|
|
36110
|
+
"type": "string",
|
|
36111
|
+
"deprecated": false,
|
|
36112
|
+
"deprecationMessage": ""
|
|
36113
|
+
},
|
|
36114
|
+
{
|
|
36115
|
+
"name": "removals",
|
|
36113
36116
|
"deprecated": false,
|
|
36114
36117
|
"deprecationMessage": ""
|
|
36115
36118
|
}
|
|
@@ -36125,7 +36128,16 @@
|
|
|
36125
36128
|
}
|
|
36126
36129
|
},
|
|
36127
36130
|
{
|
|
36128
|
-
"name": "
|
|
36131
|
+
"name": "source",
|
|
36132
|
+
"type": "string",
|
|
36133
|
+
"deprecated": false,
|
|
36134
|
+
"deprecationMessage": "",
|
|
36135
|
+
"tagName": {
|
|
36136
|
+
"text": "param"
|
|
36137
|
+
}
|
|
36138
|
+
},
|
|
36139
|
+
{
|
|
36140
|
+
"name": "removals",
|
|
36129
36141
|
"deprecated": false,
|
|
36130
36142
|
"deprecationMessage": "",
|
|
36131
36143
|
"tagName": {
|
|
@@ -37994,19 +38006,6 @@
|
|
|
37994
38006
|
"description": "<p>Provides read-only equivalent of jQuery's position function:\n<a href=\"http://api.jquery.com/position/\">http://api.jquery.com/position/</a></p>\n"
|
|
37995
38007
|
}
|
|
37996
38008
|
],
|
|
37997
|
-
"packages/core/schematics/migrate-eui-discussion-thread/index.ts": [
|
|
37998
|
-
{
|
|
37999
|
-
"name": "COMPONENT_TAG",
|
|
38000
|
-
"ctype": "miscellaneous",
|
|
38001
|
-
"subtype": "variable",
|
|
38002
|
-
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
38003
|
-
"coverageIgnore": false,
|
|
38004
|
-
"deprecated": false,
|
|
38005
|
-
"deprecationMessage": "",
|
|
38006
|
-
"type": "string",
|
|
38007
|
-
"defaultValue": "'eui-discussion-thread'"
|
|
38008
|
-
}
|
|
38009
|
-
],
|
|
38010
38009
|
"packages/core/schematics/migrate-eui-editor/index.ts": [
|
|
38011
38010
|
{
|
|
38012
38011
|
"name": "COMPONENT_TAG",
|
|
@@ -38042,6 +38041,19 @@
|
|
|
38042
38041
|
"defaultValue": "'onEditorChanged'"
|
|
38043
38042
|
}
|
|
38044
38043
|
],
|
|
38044
|
+
"packages/core/schematics/migrate-eui-discussion-thread/index.ts": [
|
|
38045
|
+
{
|
|
38046
|
+
"name": "COMPONENT_TAG",
|
|
38047
|
+
"ctype": "miscellaneous",
|
|
38048
|
+
"subtype": "variable",
|
|
38049
|
+
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
38050
|
+
"coverageIgnore": false,
|
|
38051
|
+
"deprecated": false,
|
|
38052
|
+
"deprecationMessage": "",
|
|
38053
|
+
"type": "string",
|
|
38054
|
+
"defaultValue": "'eui-discussion-thread'"
|
|
38055
|
+
}
|
|
38056
|
+
],
|
|
38045
38057
|
"packages/core/schematics/migrate-eui-fieldset/index.ts": [
|
|
38046
38058
|
{
|
|
38047
38059
|
"name": "COMPONENT_TAG",
|
|
@@ -38626,7 +38638,7 @@
|
|
|
38626
38638
|
"deprecated": false,
|
|
38627
38639
|
"deprecationMessage": "",
|
|
38628
38640
|
"type": "UIState",
|
|
38629
|
-
"defaultValue": "{\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n}"
|
|
38641
|
+
"defaultValue": "{\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasFixedPosition: true,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n}"
|
|
38630
38642
|
}
|
|
38631
38643
|
],
|
|
38632
38644
|
"packages/core/src/lib/services/eui-theme.service.ts": [
|
|
@@ -46419,10 +46431,10 @@
|
|
|
46419
46431
|
]
|
|
46420
46432
|
}
|
|
46421
46433
|
],
|
|
46422
|
-
"packages/core/schematics/migrate-eui-
|
|
46434
|
+
"packages/core/schematics/migrate-eui-tooltip/index.ts": [
|
|
46423
46435
|
{
|
|
46424
46436
|
"name": "applyEdits",
|
|
46425
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
46437
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
46426
46438
|
"ctype": "miscellaneous",
|
|
46427
46439
|
"subtype": "function",
|
|
46428
46440
|
"coverageIgnore": false,
|
|
@@ -46465,159 +46477,9 @@
|
|
|
46465
46477
|
}
|
|
46466
46478
|
]
|
|
46467
46479
|
},
|
|
46468
|
-
{
|
|
46469
|
-
"name": "collectOutputRemovals",
|
|
46470
|
-
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
46471
|
-
"ctype": "miscellaneous",
|
|
46472
|
-
"subtype": "function",
|
|
46473
|
-
"coverageIgnore": false,
|
|
46474
|
-
"deprecated": false,
|
|
46475
|
-
"deprecationMessage": "",
|
|
46476
|
-
"rawdescription": "",
|
|
46477
|
-
"description": "",
|
|
46478
|
-
"displayName": "collectOutputRemovals",
|
|
46479
|
-
"args": [
|
|
46480
|
-
{
|
|
46481
|
-
"name": "element",
|
|
46482
|
-
"type": "TmplAstElement",
|
|
46483
|
-
"deprecated": false,
|
|
46484
|
-
"deprecationMessage": ""
|
|
46485
|
-
},
|
|
46486
|
-
{
|
|
46487
|
-
"name": "source",
|
|
46488
|
-
"type": "string",
|
|
46489
|
-
"deprecated": false,
|
|
46490
|
-
"deprecationMessage": ""
|
|
46491
|
-
},
|
|
46492
|
-
{
|
|
46493
|
-
"name": "edits",
|
|
46494
|
-
"deprecated": false,
|
|
46495
|
-
"deprecationMessage": ""
|
|
46496
|
-
},
|
|
46497
|
-
{
|
|
46498
|
-
"name": "filePath",
|
|
46499
|
-
"type": "string",
|
|
46500
|
-
"deprecated": false,
|
|
46501
|
-
"deprecationMessage": ""
|
|
46502
|
-
},
|
|
46503
|
-
{
|
|
46504
|
-
"name": "context",
|
|
46505
|
-
"type": "SchematicContext",
|
|
46506
|
-
"deprecated": false,
|
|
46507
|
-
"deprecationMessage": ""
|
|
46508
|
-
}
|
|
46509
|
-
],
|
|
46510
|
-
"returnType": "void",
|
|
46511
|
-
"jsdoctags": [
|
|
46512
|
-
{
|
|
46513
|
-
"name": "element",
|
|
46514
|
-
"type": "TmplAstElement",
|
|
46515
|
-
"deprecated": false,
|
|
46516
|
-
"deprecationMessage": "",
|
|
46517
|
-
"tagName": {
|
|
46518
|
-
"text": "param"
|
|
46519
|
-
}
|
|
46520
|
-
},
|
|
46521
|
-
{
|
|
46522
|
-
"name": "source",
|
|
46523
|
-
"type": "string",
|
|
46524
|
-
"deprecated": false,
|
|
46525
|
-
"deprecationMessage": "",
|
|
46526
|
-
"tagName": {
|
|
46527
|
-
"text": "param"
|
|
46528
|
-
}
|
|
46529
|
-
},
|
|
46530
|
-
{
|
|
46531
|
-
"name": "edits",
|
|
46532
|
-
"deprecated": false,
|
|
46533
|
-
"deprecationMessage": "",
|
|
46534
|
-
"tagName": {
|
|
46535
|
-
"text": "param"
|
|
46536
|
-
}
|
|
46537
|
-
},
|
|
46538
|
-
{
|
|
46539
|
-
"name": "filePath",
|
|
46540
|
-
"type": "string",
|
|
46541
|
-
"deprecated": false,
|
|
46542
|
-
"deprecationMessage": "",
|
|
46543
|
-
"tagName": {
|
|
46544
|
-
"text": "param"
|
|
46545
|
-
}
|
|
46546
|
-
},
|
|
46547
|
-
{
|
|
46548
|
-
"name": "context",
|
|
46549
|
-
"type": "SchematicContext",
|
|
46550
|
-
"deprecated": false,
|
|
46551
|
-
"deprecationMessage": "",
|
|
46552
|
-
"tagName": {
|
|
46553
|
-
"text": "param"
|
|
46554
|
-
}
|
|
46555
|
-
}
|
|
46556
|
-
]
|
|
46557
|
-
},
|
|
46558
|
-
{
|
|
46559
|
-
"name": "collectTagRenames",
|
|
46560
|
-
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
46561
|
-
"ctype": "miscellaneous",
|
|
46562
|
-
"subtype": "function",
|
|
46563
|
-
"coverageIgnore": false,
|
|
46564
|
-
"deprecated": false,
|
|
46565
|
-
"deprecationMessage": "",
|
|
46566
|
-
"rawdescription": "",
|
|
46567
|
-
"description": "",
|
|
46568
|
-
"displayName": "collectTagRenames",
|
|
46569
|
-
"args": [
|
|
46570
|
-
{
|
|
46571
|
-
"name": "element",
|
|
46572
|
-
"type": "TmplAstElement",
|
|
46573
|
-
"deprecated": false,
|
|
46574
|
-
"deprecationMessage": ""
|
|
46575
|
-
},
|
|
46576
|
-
{
|
|
46577
|
-
"name": "source",
|
|
46578
|
-
"type": "string",
|
|
46579
|
-
"deprecated": false,
|
|
46580
|
-
"deprecationMessage": ""
|
|
46581
|
-
},
|
|
46582
|
-
{
|
|
46583
|
-
"name": "edits",
|
|
46584
|
-
"deprecated": false,
|
|
46585
|
-
"deprecationMessage": ""
|
|
46586
|
-
}
|
|
46587
|
-
],
|
|
46588
|
-
"returnType": "void",
|
|
46589
|
-
"jsdoctags": [
|
|
46590
|
-
{
|
|
46591
|
-
"name": "element",
|
|
46592
|
-
"type": "TmplAstElement",
|
|
46593
|
-
"deprecated": false,
|
|
46594
|
-
"deprecationMessage": "",
|
|
46595
|
-
"tagName": {
|
|
46596
|
-
"text": "param"
|
|
46597
|
-
}
|
|
46598
|
-
},
|
|
46599
|
-
{
|
|
46600
|
-
"name": "source",
|
|
46601
|
-
"type": "string",
|
|
46602
|
-
"deprecated": false,
|
|
46603
|
-
"deprecationMessage": "",
|
|
46604
|
-
"tagName": {
|
|
46605
|
-
"text": "param"
|
|
46606
|
-
}
|
|
46607
|
-
},
|
|
46608
|
-
{
|
|
46609
|
-
"name": "edits",
|
|
46610
|
-
"deprecated": false,
|
|
46611
|
-
"deprecationMessage": "",
|
|
46612
|
-
"tagName": {
|
|
46613
|
-
"text": "param"
|
|
46614
|
-
}
|
|
46615
|
-
}
|
|
46616
|
-
]
|
|
46617
|
-
},
|
|
46618
46480
|
{
|
|
46619
46481
|
"name": "deduplicateEdits",
|
|
46620
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
46482
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
46621
46483
|
"ctype": "miscellaneous",
|
|
46622
46484
|
"subtype": "function",
|
|
46623
46485
|
"coverageIgnore": false,
|
|
@@ -46646,38 +46508,8 @@
|
|
|
46646
46508
|
]
|
|
46647
46509
|
},
|
|
46648
46510
|
{
|
|
46649
|
-
"name": "
|
|
46650
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
46651
|
-
"ctype": "miscellaneous",
|
|
46652
|
-
"subtype": "function",
|
|
46653
|
-
"coverageIgnore": false,
|
|
46654
|
-
"deprecated": false,
|
|
46655
|
-
"deprecationMessage": "",
|
|
46656
|
-
"rawdescription": "",
|
|
46657
|
-
"description": "",
|
|
46658
|
-
"displayName": "isComponentMetadataProperty",
|
|
46659
|
-
"args": [
|
|
46660
|
-
{
|
|
46661
|
-
"name": "node",
|
|
46662
|
-
"deprecated": false,
|
|
46663
|
-
"deprecationMessage": ""
|
|
46664
|
-
}
|
|
46665
|
-
],
|
|
46666
|
-
"returnType": "boolean",
|
|
46667
|
-
"jsdoctags": [
|
|
46668
|
-
{
|
|
46669
|
-
"name": "node",
|
|
46670
|
-
"deprecated": false,
|
|
46671
|
-
"deprecationMessage": "",
|
|
46672
|
-
"tagName": {
|
|
46673
|
-
"text": "param"
|
|
46674
|
-
}
|
|
46675
|
-
}
|
|
46676
|
-
]
|
|
46677
|
-
},
|
|
46678
|
-
{
|
|
46679
|
-
"name": "isTemplateProperty",
|
|
46680
|
-
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
46511
|
+
"name": "isPartOfImport",
|
|
46512
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
46681
46513
|
"ctype": "miscellaneous",
|
|
46682
46514
|
"subtype": "function",
|
|
46683
46515
|
"coverageIgnore": false,
|
|
@@ -46685,7 +46517,7 @@
|
|
|
46685
46517
|
"deprecationMessage": "",
|
|
46686
46518
|
"rawdescription": "",
|
|
46687
46519
|
"description": "",
|
|
46688
|
-
"displayName": "
|
|
46520
|
+
"displayName": "isPartOfImport",
|
|
46689
46521
|
"args": [
|
|
46690
46522
|
{
|
|
46691
46523
|
"name": "node",
|
|
@@ -46706,8 +46538,8 @@
|
|
|
46706
46538
|
]
|
|
46707
46539
|
},
|
|
46708
46540
|
{
|
|
46709
|
-
"name": "
|
|
46710
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
46541
|
+
"name": "migrateEuiTooltip",
|
|
46542
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
46711
46543
|
"ctype": "miscellaneous",
|
|
46712
46544
|
"subtype": "function",
|
|
46713
46545
|
"coverageIgnore": false,
|
|
@@ -46715,7 +46547,7 @@
|
|
|
46715
46547
|
"deprecationMessage": "",
|
|
46716
46548
|
"rawdescription": "",
|
|
46717
46549
|
"description": "",
|
|
46718
|
-
"displayName": "
|
|
46550
|
+
"displayName": "migrateEuiTooltip",
|
|
46719
46551
|
"args": [
|
|
46720
46552
|
{
|
|
46721
46553
|
"name": "options",
|
|
@@ -46740,8 +46572,8 @@
|
|
|
46740
46572
|
]
|
|
46741
46573
|
},
|
|
46742
46574
|
{
|
|
46743
|
-
"name": "
|
|
46744
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
46575
|
+
"name": "migrateTypeScript",
|
|
46576
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
46745
46577
|
"ctype": "miscellaneous",
|
|
46746
46578
|
"subtype": "function",
|
|
46747
46579
|
"coverageIgnore": false,
|
|
@@ -46749,7 +46581,7 @@
|
|
|
46749
46581
|
"deprecationMessage": "",
|
|
46750
46582
|
"rawdescription": "",
|
|
46751
46583
|
"description": "",
|
|
46752
|
-
"displayName": "
|
|
46584
|
+
"displayName": "migrateTypeScript",
|
|
46753
46585
|
"args": [
|
|
46754
46586
|
{
|
|
46755
46587
|
"name": "source",
|
|
@@ -46802,8 +46634,8 @@
|
|
|
46802
46634
|
]
|
|
46803
46635
|
},
|
|
46804
46636
|
{
|
|
46805
|
-
"name": "
|
|
46806
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
46637
|
+
"name": "removeImportSpecifier",
|
|
46638
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
46807
46639
|
"ctype": "miscellaneous",
|
|
46808
46640
|
"subtype": "function",
|
|
46809
46641
|
"coverageIgnore": false,
|
|
@@ -46811,32 +46643,33 @@
|
|
|
46811
46643
|
"deprecationMessage": "",
|
|
46812
46644
|
"rawdescription": "",
|
|
46813
46645
|
"description": "",
|
|
46814
|
-
"displayName": "
|
|
46646
|
+
"displayName": "removeImportSpecifier",
|
|
46815
46647
|
"args": [
|
|
46816
46648
|
{
|
|
46817
|
-
"name": "
|
|
46818
|
-
"type": "string",
|
|
46649
|
+
"name": "namedImports",
|
|
46819
46650
|
"deprecated": false,
|
|
46820
46651
|
"deprecationMessage": ""
|
|
46821
46652
|
},
|
|
46822
46653
|
{
|
|
46823
|
-
"name": "
|
|
46824
|
-
"type": "string",
|
|
46654
|
+
"name": "specifier",
|
|
46825
46655
|
"deprecated": false,
|
|
46826
46656
|
"deprecationMessage": ""
|
|
46827
46657
|
},
|
|
46828
46658
|
{
|
|
46829
|
-
"name": "
|
|
46830
|
-
"
|
|
46659
|
+
"name": "sourceFile",
|
|
46660
|
+
"deprecated": false,
|
|
46661
|
+
"deprecationMessage": ""
|
|
46662
|
+
},
|
|
46663
|
+
{
|
|
46664
|
+
"name": "edits",
|
|
46831
46665
|
"deprecated": false,
|
|
46832
46666
|
"deprecationMessage": ""
|
|
46833
46667
|
}
|
|
46834
46668
|
],
|
|
46835
|
-
"returnType": "
|
|
46669
|
+
"returnType": "void",
|
|
46836
46670
|
"jsdoctags": [
|
|
46837
46671
|
{
|
|
46838
|
-
"name": "
|
|
46839
|
-
"type": "string",
|
|
46672
|
+
"name": "namedImports",
|
|
46840
46673
|
"deprecated": false,
|
|
46841
46674
|
"deprecationMessage": "",
|
|
46842
46675
|
"tagName": {
|
|
@@ -46844,8 +46677,7 @@
|
|
|
46844
46677
|
}
|
|
46845
46678
|
},
|
|
46846
46679
|
{
|
|
46847
|
-
"name": "
|
|
46848
|
-
"type": "string",
|
|
46680
|
+
"name": "specifier",
|
|
46849
46681
|
"deprecated": false,
|
|
46850
46682
|
"deprecationMessage": "",
|
|
46851
46683
|
"tagName": {
|
|
@@ -46853,8 +46685,15 @@
|
|
|
46853
46685
|
}
|
|
46854
46686
|
},
|
|
46855
46687
|
{
|
|
46856
|
-
"name": "
|
|
46857
|
-
"
|
|
46688
|
+
"name": "sourceFile",
|
|
46689
|
+
"deprecated": false,
|
|
46690
|
+
"deprecationMessage": "",
|
|
46691
|
+
"tagName": {
|
|
46692
|
+
"text": "param"
|
|
46693
|
+
}
|
|
46694
|
+
},
|
|
46695
|
+
{
|
|
46696
|
+
"name": "edits",
|
|
46858
46697
|
"deprecated": false,
|
|
46859
46698
|
"deprecationMessage": "",
|
|
46860
46699
|
"tagName": {
|
|
@@ -46864,8 +46703,8 @@
|
|
|
46864
46703
|
]
|
|
46865
46704
|
},
|
|
46866
46705
|
{
|
|
46867
|
-
"name": "
|
|
46868
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
46706
|
+
"name": "visitDir",
|
|
46707
|
+
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
46869
46708
|
"ctype": "miscellaneous",
|
|
46870
46709
|
"subtype": "function",
|
|
46871
46710
|
"coverageIgnore": false,
|
|
@@ -46873,32 +46712,25 @@
|
|
|
46873
46712
|
"deprecationMessage": "",
|
|
46874
46713
|
"rawdescription": "",
|
|
46875
46714
|
"description": "",
|
|
46876
|
-
"displayName": "
|
|
46715
|
+
"displayName": "visitDir",
|
|
46877
46716
|
"args": [
|
|
46878
46717
|
{
|
|
46879
|
-
"name": "
|
|
46880
|
-
"type": "
|
|
46881
|
-
"deprecated": false,
|
|
46882
|
-
"deprecationMessage": ""
|
|
46883
|
-
},
|
|
46884
|
-
{
|
|
46885
|
-
"name": "filePath",
|
|
46886
|
-
"type": "string",
|
|
46718
|
+
"name": "dir",
|
|
46719
|
+
"type": "DirEntry",
|
|
46887
46720
|
"deprecated": false,
|
|
46888
46721
|
"deprecationMessage": ""
|
|
46889
46722
|
},
|
|
46890
46723
|
{
|
|
46891
|
-
"name": "
|
|
46892
|
-
"type": "SchematicContext",
|
|
46724
|
+
"name": "callback",
|
|
46893
46725
|
"deprecated": false,
|
|
46894
46726
|
"deprecationMessage": ""
|
|
46895
46727
|
}
|
|
46896
46728
|
],
|
|
46897
|
-
"returnType": "
|
|
46729
|
+
"returnType": "void",
|
|
46898
46730
|
"jsdoctags": [
|
|
46899
46731
|
{
|
|
46900
|
-
"name": "
|
|
46901
|
-
"type": "
|
|
46732
|
+
"name": "dir",
|
|
46733
|
+
"type": "DirEntry",
|
|
46902
46734
|
"deprecated": false,
|
|
46903
46735
|
"deprecationMessage": "",
|
|
46904
46736
|
"tagName": {
|
|
@@ -46906,7 +46738,45 @@
|
|
|
46906
46738
|
}
|
|
46907
46739
|
},
|
|
46908
46740
|
{
|
|
46909
|
-
"name": "
|
|
46741
|
+
"name": "callback",
|
|
46742
|
+
"deprecated": false,
|
|
46743
|
+
"deprecationMessage": "",
|
|
46744
|
+
"tagName": {
|
|
46745
|
+
"text": "param"
|
|
46746
|
+
}
|
|
46747
|
+
}
|
|
46748
|
+
]
|
|
46749
|
+
}
|
|
46750
|
+
],
|
|
46751
|
+
"packages/core/schematics/migrate-eui-toolbar-menu/index.ts": [
|
|
46752
|
+
{
|
|
46753
|
+
"name": "applyEdits",
|
|
46754
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
46755
|
+
"ctype": "miscellaneous",
|
|
46756
|
+
"subtype": "function",
|
|
46757
|
+
"coverageIgnore": false,
|
|
46758
|
+
"deprecated": false,
|
|
46759
|
+
"deprecationMessage": "",
|
|
46760
|
+
"rawdescription": "",
|
|
46761
|
+
"description": "",
|
|
46762
|
+
"displayName": "applyEdits",
|
|
46763
|
+
"args": [
|
|
46764
|
+
{
|
|
46765
|
+
"name": "source",
|
|
46766
|
+
"type": "string",
|
|
46767
|
+
"deprecated": false,
|
|
46768
|
+
"deprecationMessage": ""
|
|
46769
|
+
},
|
|
46770
|
+
{
|
|
46771
|
+
"name": "edits",
|
|
46772
|
+
"deprecated": false,
|
|
46773
|
+
"deprecationMessage": ""
|
|
46774
|
+
}
|
|
46775
|
+
],
|
|
46776
|
+
"returnType": "string",
|
|
46777
|
+
"jsdoctags": [
|
|
46778
|
+
{
|
|
46779
|
+
"name": "source",
|
|
46910
46780
|
"type": "string",
|
|
46911
46781
|
"deprecated": false,
|
|
46912
46782
|
"deprecationMessage": "",
|
|
@@ -46915,8 +46785,7 @@
|
|
|
46915
46785
|
}
|
|
46916
46786
|
},
|
|
46917
46787
|
{
|
|
46918
|
-
"name": "
|
|
46919
|
-
"type": "SchematicContext",
|
|
46788
|
+
"name": "edits",
|
|
46920
46789
|
"deprecated": false,
|
|
46921
46790
|
"deprecationMessage": "",
|
|
46922
46791
|
"tagName": {
|
|
@@ -46926,7 +46795,7 @@
|
|
|
46926
46795
|
]
|
|
46927
46796
|
},
|
|
46928
46797
|
{
|
|
46929
|
-
"name": "
|
|
46798
|
+
"name": "collectOutputRemovals",
|
|
46930
46799
|
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
46931
46800
|
"ctype": "miscellaneous",
|
|
46932
46801
|
"subtype": "function",
|
|
@@ -46935,14 +46804,25 @@
|
|
|
46935
46804
|
"deprecationMessage": "",
|
|
46936
46805
|
"rawdescription": "",
|
|
46937
46806
|
"description": "",
|
|
46938
|
-
"displayName": "
|
|
46807
|
+
"displayName": "collectOutputRemovals",
|
|
46939
46808
|
"args": [
|
|
46809
|
+
{
|
|
46810
|
+
"name": "element",
|
|
46811
|
+
"type": "TmplAstElement",
|
|
46812
|
+
"deprecated": false,
|
|
46813
|
+
"deprecationMessage": ""
|
|
46814
|
+
},
|
|
46940
46815
|
{
|
|
46941
46816
|
"name": "source",
|
|
46942
46817
|
"type": "string",
|
|
46943
46818
|
"deprecated": false,
|
|
46944
46819
|
"deprecationMessage": ""
|
|
46945
46820
|
},
|
|
46821
|
+
{
|
|
46822
|
+
"name": "edits",
|
|
46823
|
+
"deprecated": false,
|
|
46824
|
+
"deprecationMessage": ""
|
|
46825
|
+
},
|
|
46946
46826
|
{
|
|
46947
46827
|
"name": "filePath",
|
|
46948
46828
|
"type": "string",
|
|
@@ -46956,8 +46836,17 @@
|
|
|
46956
46836
|
"deprecationMessage": ""
|
|
46957
46837
|
}
|
|
46958
46838
|
],
|
|
46959
|
-
"returnType": "
|
|
46839
|
+
"returnType": "void",
|
|
46960
46840
|
"jsdoctags": [
|
|
46841
|
+
{
|
|
46842
|
+
"name": "element",
|
|
46843
|
+
"type": "TmplAstElement",
|
|
46844
|
+
"deprecated": false,
|
|
46845
|
+
"deprecationMessage": "",
|
|
46846
|
+
"tagName": {
|
|
46847
|
+
"text": "param"
|
|
46848
|
+
}
|
|
46849
|
+
},
|
|
46961
46850
|
{
|
|
46962
46851
|
"name": "source",
|
|
46963
46852
|
"type": "string",
|
|
@@ -46967,6 +46856,14 @@
|
|
|
46967
46856
|
"text": "param"
|
|
46968
46857
|
}
|
|
46969
46858
|
},
|
|
46859
|
+
{
|
|
46860
|
+
"name": "edits",
|
|
46861
|
+
"deprecated": false,
|
|
46862
|
+
"deprecationMessage": "",
|
|
46863
|
+
"tagName": {
|
|
46864
|
+
"text": "param"
|
|
46865
|
+
}
|
|
46866
|
+
},
|
|
46970
46867
|
{
|
|
46971
46868
|
"name": "filePath",
|
|
46972
46869
|
"type": "string",
|
|
@@ -46988,7 +46885,7 @@
|
|
|
46988
46885
|
]
|
|
46989
46886
|
},
|
|
46990
46887
|
{
|
|
46991
|
-
"name": "
|
|
46888
|
+
"name": "collectTagRenames",
|
|
46992
46889
|
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
46993
46890
|
"ctype": "miscellaneous",
|
|
46994
46891
|
"subtype": "function",
|
|
@@ -46997,20 +46894,17 @@
|
|
|
46997
46894
|
"deprecationMessage": "",
|
|
46998
46895
|
"rawdescription": "",
|
|
46999
46896
|
"description": "",
|
|
47000
|
-
"displayName": "
|
|
46897
|
+
"displayName": "collectTagRenames",
|
|
47001
46898
|
"args": [
|
|
47002
46899
|
{
|
|
47003
|
-
"name": "
|
|
47004
|
-
"
|
|
47005
|
-
"deprecationMessage": ""
|
|
47006
|
-
},
|
|
47007
|
-
{
|
|
47008
|
-
"name": "specifier",
|
|
46900
|
+
"name": "element",
|
|
46901
|
+
"type": "TmplAstElement",
|
|
47009
46902
|
"deprecated": false,
|
|
47010
46903
|
"deprecationMessage": ""
|
|
47011
46904
|
},
|
|
47012
46905
|
{
|
|
47013
|
-
"name": "
|
|
46906
|
+
"name": "source",
|
|
46907
|
+
"type": "string",
|
|
47014
46908
|
"deprecated": false,
|
|
47015
46909
|
"deprecationMessage": ""
|
|
47016
46910
|
},
|
|
@@ -47023,7 +46917,8 @@
|
|
|
47023
46917
|
"returnType": "void",
|
|
47024
46918
|
"jsdoctags": [
|
|
47025
46919
|
{
|
|
47026
|
-
"name": "
|
|
46920
|
+
"name": "element",
|
|
46921
|
+
"type": "TmplAstElement",
|
|
47027
46922
|
"deprecated": false,
|
|
47028
46923
|
"deprecationMessage": "",
|
|
47029
46924
|
"tagName": {
|
|
@@ -47031,7 +46926,8 @@
|
|
|
47031
46926
|
}
|
|
47032
46927
|
},
|
|
47033
46928
|
{
|
|
47034
|
-
"name": "
|
|
46929
|
+
"name": "source",
|
|
46930
|
+
"type": "string",
|
|
47035
46931
|
"deprecated": false,
|
|
47036
46932
|
"deprecationMessage": "",
|
|
47037
46933
|
"tagName": {
|
|
@@ -47039,13 +46935,35 @@
|
|
|
47039
46935
|
}
|
|
47040
46936
|
},
|
|
47041
46937
|
{
|
|
47042
|
-
"name": "
|
|
46938
|
+
"name": "edits",
|
|
47043
46939
|
"deprecated": false,
|
|
47044
46940
|
"deprecationMessage": "",
|
|
47045
46941
|
"tagName": {
|
|
47046
46942
|
"text": "param"
|
|
47047
46943
|
}
|
|
47048
|
-
}
|
|
46944
|
+
}
|
|
46945
|
+
]
|
|
46946
|
+
},
|
|
46947
|
+
{
|
|
46948
|
+
"name": "deduplicateEdits",
|
|
46949
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
46950
|
+
"ctype": "miscellaneous",
|
|
46951
|
+
"subtype": "function",
|
|
46952
|
+
"coverageIgnore": false,
|
|
46953
|
+
"deprecated": false,
|
|
46954
|
+
"deprecationMessage": "",
|
|
46955
|
+
"rawdescription": "",
|
|
46956
|
+
"description": "",
|
|
46957
|
+
"displayName": "deduplicateEdits",
|
|
46958
|
+
"args": [
|
|
46959
|
+
{
|
|
46960
|
+
"name": "edits",
|
|
46961
|
+
"deprecated": false,
|
|
46962
|
+
"deprecationMessage": ""
|
|
46963
|
+
}
|
|
46964
|
+
],
|
|
46965
|
+
"returnType": "Edit[]",
|
|
46966
|
+
"jsdoctags": [
|
|
47049
46967
|
{
|
|
47050
46968
|
"name": "edits",
|
|
47051
46969
|
"deprecated": false,
|
|
@@ -47057,7 +46975,7 @@
|
|
|
47057
46975
|
]
|
|
47058
46976
|
},
|
|
47059
46977
|
{
|
|
47060
|
-
"name": "
|
|
46978
|
+
"name": "isComponentMetadataProperty",
|
|
47061
46979
|
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47062
46980
|
"ctype": "miscellaneous",
|
|
47063
46981
|
"subtype": "function",
|
|
@@ -47066,18 +46984,18 @@
|
|
|
47066
46984
|
"deprecationMessage": "",
|
|
47067
46985
|
"rawdescription": "",
|
|
47068
46986
|
"description": "",
|
|
47069
|
-
"displayName": "
|
|
46987
|
+
"displayName": "isComponentMetadataProperty",
|
|
47070
46988
|
"args": [
|
|
47071
46989
|
{
|
|
47072
|
-
"name": "
|
|
46990
|
+
"name": "node",
|
|
47073
46991
|
"deprecated": false,
|
|
47074
46992
|
"deprecationMessage": ""
|
|
47075
46993
|
}
|
|
47076
46994
|
],
|
|
47077
|
-
"returnType": "
|
|
46995
|
+
"returnType": "boolean",
|
|
47078
46996
|
"jsdoctags": [
|
|
47079
46997
|
{
|
|
47080
|
-
"name": "
|
|
46998
|
+
"name": "node",
|
|
47081
46999
|
"deprecated": false,
|
|
47082
47000
|
"deprecationMessage": "",
|
|
47083
47001
|
"tagName": {
|
|
@@ -47087,7 +47005,7 @@
|
|
|
47087
47005
|
]
|
|
47088
47006
|
},
|
|
47089
47007
|
{
|
|
47090
|
-
"name": "
|
|
47008
|
+
"name": "isTemplateProperty",
|
|
47091
47009
|
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47092
47010
|
"ctype": "miscellaneous",
|
|
47093
47011
|
"subtype": "function",
|
|
@@ -47096,35 +47014,54 @@
|
|
|
47096
47014
|
"deprecationMessage": "",
|
|
47097
47015
|
"rawdescription": "",
|
|
47098
47016
|
"description": "",
|
|
47099
|
-
"displayName": "
|
|
47017
|
+
"displayName": "isTemplateProperty",
|
|
47100
47018
|
"args": [
|
|
47101
47019
|
{
|
|
47102
|
-
"name": "
|
|
47103
|
-
"type": "DirEntry",
|
|
47104
|
-
"deprecated": false,
|
|
47105
|
-
"deprecationMessage": ""
|
|
47106
|
-
},
|
|
47107
|
-
{
|
|
47108
|
-
"name": "callback",
|
|
47020
|
+
"name": "node",
|
|
47109
47021
|
"deprecated": false,
|
|
47110
47022
|
"deprecationMessage": ""
|
|
47111
47023
|
}
|
|
47112
47024
|
],
|
|
47113
|
-
"returnType": "
|
|
47025
|
+
"returnType": "boolean",
|
|
47114
47026
|
"jsdoctags": [
|
|
47115
47027
|
{
|
|
47116
|
-
"name": "
|
|
47117
|
-
"type": "DirEntry",
|
|
47028
|
+
"name": "node",
|
|
47118
47029
|
"deprecated": false,
|
|
47119
47030
|
"deprecationMessage": "",
|
|
47120
47031
|
"tagName": {
|
|
47121
47032
|
"text": "param"
|
|
47122
47033
|
}
|
|
47123
|
-
}
|
|
47034
|
+
}
|
|
47035
|
+
]
|
|
47036
|
+
},
|
|
47037
|
+
{
|
|
47038
|
+
"name": "migrateEuiToolbarMenu",
|
|
47039
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47040
|
+
"ctype": "miscellaneous",
|
|
47041
|
+
"subtype": "function",
|
|
47042
|
+
"coverageIgnore": false,
|
|
47043
|
+
"deprecated": false,
|
|
47044
|
+
"deprecationMessage": "",
|
|
47045
|
+
"rawdescription": "",
|
|
47046
|
+
"description": "",
|
|
47047
|
+
"displayName": "migrateEuiToolbarMenu",
|
|
47048
|
+
"args": [
|
|
47124
47049
|
{
|
|
47125
|
-
"name": "
|
|
47050
|
+
"name": "options",
|
|
47051
|
+
"type": "Schema",
|
|
47052
|
+
"deprecated": false,
|
|
47053
|
+
"deprecationMessage": "",
|
|
47054
|
+
"defaultValue": "{}"
|
|
47055
|
+
}
|
|
47056
|
+
],
|
|
47057
|
+
"returnType": "Rule",
|
|
47058
|
+
"jsdoctags": [
|
|
47059
|
+
{
|
|
47060
|
+
"name": "options",
|
|
47061
|
+
"type": "Schema",
|
|
47126
47062
|
"deprecated": false,
|
|
47127
47063
|
"deprecationMessage": "",
|
|
47064
|
+
"defaultValue": "{}",
|
|
47128
47065
|
"tagName": {
|
|
47129
47066
|
"text": "param"
|
|
47130
47067
|
}
|
|
@@ -47132,7 +47069,7 @@
|
|
|
47132
47069
|
]
|
|
47133
47070
|
},
|
|
47134
47071
|
{
|
|
47135
|
-
"name": "
|
|
47072
|
+
"name": "migrateImportsAndTypes",
|
|
47136
47073
|
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47137
47074
|
"ctype": "miscellaneous",
|
|
47138
47075
|
"subtype": "function",
|
|
@@ -47141,24 +47078,14 @@
|
|
|
47141
47078
|
"deprecationMessage": "",
|
|
47142
47079
|
"rawdescription": "",
|
|
47143
47080
|
"description": "",
|
|
47144
|
-
"displayName": "
|
|
47081
|
+
"displayName": "migrateImportsAndTypes",
|
|
47145
47082
|
"args": [
|
|
47146
|
-
{
|
|
47147
|
-
"name": "nodes",
|
|
47148
|
-
"deprecated": false,
|
|
47149
|
-
"deprecationMessage": ""
|
|
47150
|
-
},
|
|
47151
47083
|
{
|
|
47152
47084
|
"name": "source",
|
|
47153
47085
|
"type": "string",
|
|
47154
47086
|
"deprecated": false,
|
|
47155
47087
|
"deprecationMessage": ""
|
|
47156
47088
|
},
|
|
47157
|
-
{
|
|
47158
|
-
"name": "edits",
|
|
47159
|
-
"deprecated": false,
|
|
47160
|
-
"deprecationMessage": ""
|
|
47161
|
-
},
|
|
47162
47089
|
{
|
|
47163
47090
|
"name": "filePath",
|
|
47164
47091
|
"type": "string",
|
|
@@ -47172,16 +47099,8 @@
|
|
|
47172
47099
|
"deprecationMessage": ""
|
|
47173
47100
|
}
|
|
47174
47101
|
],
|
|
47175
|
-
"returnType": "
|
|
47102
|
+
"returnType": "string",
|
|
47176
47103
|
"jsdoctags": [
|
|
47177
|
-
{
|
|
47178
|
-
"name": "nodes",
|
|
47179
|
-
"deprecated": false,
|
|
47180
|
-
"deprecationMessage": "",
|
|
47181
|
-
"tagName": {
|
|
47182
|
-
"text": "param"
|
|
47183
|
-
}
|
|
47184
|
-
},
|
|
47185
47104
|
{
|
|
47186
47105
|
"name": "source",
|
|
47187
47106
|
"type": "string",
|
|
@@ -47191,14 +47110,6 @@
|
|
|
47191
47110
|
"text": "param"
|
|
47192
47111
|
}
|
|
47193
47112
|
},
|
|
47194
|
-
{
|
|
47195
|
-
"name": "edits",
|
|
47196
|
-
"deprecated": false,
|
|
47197
|
-
"deprecationMessage": "",
|
|
47198
|
-
"tagName": {
|
|
47199
|
-
"text": "param"
|
|
47200
|
-
}
|
|
47201
|
-
},
|
|
47202
47113
|
{
|
|
47203
47114
|
"name": "filePath",
|
|
47204
47115
|
"type": "string",
|
|
@@ -47220,7 +47131,7 @@
|
|
|
47220
47131
|
]
|
|
47221
47132
|
},
|
|
47222
47133
|
{
|
|
47223
|
-
"name": "
|
|
47134
|
+
"name": "migrateInlineTemplates",
|
|
47224
47135
|
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47225
47136
|
"ctype": "miscellaneous",
|
|
47226
47137
|
"subtype": "function",
|
|
@@ -47229,10 +47140,11 @@
|
|
|
47229
47140
|
"deprecationMessage": "",
|
|
47230
47141
|
"rawdescription": "",
|
|
47231
47142
|
"description": "",
|
|
47232
|
-
"displayName": "
|
|
47143
|
+
"displayName": "migrateInlineTemplates",
|
|
47233
47144
|
"args": [
|
|
47234
47145
|
{
|
|
47235
|
-
"name": "
|
|
47146
|
+
"name": "source",
|
|
47147
|
+
"type": "string",
|
|
47236
47148
|
"deprecated": false,
|
|
47237
47149
|
"deprecationMessage": ""
|
|
47238
47150
|
},
|
|
@@ -47249,10 +47161,11 @@
|
|
|
47249
47161
|
"deprecationMessage": ""
|
|
47250
47162
|
}
|
|
47251
47163
|
],
|
|
47252
|
-
"returnType": "
|
|
47164
|
+
"returnType": "string",
|
|
47253
47165
|
"jsdoctags": [
|
|
47254
47166
|
{
|
|
47255
|
-
"name": "
|
|
47167
|
+
"name": "source",
|
|
47168
|
+
"type": "string",
|
|
47256
47169
|
"deprecated": false,
|
|
47257
47170
|
"deprecationMessage": "",
|
|
47258
47171
|
"tagName": {
|
|
@@ -47278,12 +47191,10 @@
|
|
|
47278
47191
|
}
|
|
47279
47192
|
}
|
|
47280
47193
|
]
|
|
47281
|
-
}
|
|
47282
|
-
],
|
|
47283
|
-
"packages/core/schematics/migrate-eui-tooltip/index.ts": [
|
|
47194
|
+
},
|
|
47284
47195
|
{
|
|
47285
|
-
"name": "
|
|
47286
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
47196
|
+
"name": "migrateTemplate",
|
|
47197
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47287
47198
|
"ctype": "miscellaneous",
|
|
47288
47199
|
"subtype": "function",
|
|
47289
47200
|
"coverageIgnore": false,
|
|
@@ -47291,7 +47202,7 @@
|
|
|
47291
47202
|
"deprecationMessage": "",
|
|
47292
47203
|
"rawdescription": "",
|
|
47293
47204
|
"description": "",
|
|
47294
|
-
"displayName": "
|
|
47205
|
+
"displayName": "migrateTemplate",
|
|
47295
47206
|
"args": [
|
|
47296
47207
|
{
|
|
47297
47208
|
"name": "source",
|
|
@@ -47300,7 +47211,14 @@
|
|
|
47300
47211
|
"deprecationMessage": ""
|
|
47301
47212
|
},
|
|
47302
47213
|
{
|
|
47303
|
-
"name": "
|
|
47214
|
+
"name": "filePath",
|
|
47215
|
+
"type": "string",
|
|
47216
|
+
"deprecated": false,
|
|
47217
|
+
"deprecationMessage": ""
|
|
47218
|
+
},
|
|
47219
|
+
{
|
|
47220
|
+
"name": "context",
|
|
47221
|
+
"type": "SchematicContext",
|
|
47304
47222
|
"deprecated": false,
|
|
47305
47223
|
"deprecationMessage": ""
|
|
47306
47224
|
}
|
|
@@ -47317,7 +47235,17 @@
|
|
|
47317
47235
|
}
|
|
47318
47236
|
},
|
|
47319
47237
|
{
|
|
47320
|
-
"name": "
|
|
47238
|
+
"name": "filePath",
|
|
47239
|
+
"type": "string",
|
|
47240
|
+
"deprecated": false,
|
|
47241
|
+
"deprecationMessage": "",
|
|
47242
|
+
"tagName": {
|
|
47243
|
+
"text": "param"
|
|
47244
|
+
}
|
|
47245
|
+
},
|
|
47246
|
+
{
|
|
47247
|
+
"name": "context",
|
|
47248
|
+
"type": "SchematicContext",
|
|
47321
47249
|
"deprecated": false,
|
|
47322
47250
|
"deprecationMessage": "",
|
|
47323
47251
|
"tagName": {
|
|
@@ -47327,8 +47255,8 @@
|
|
|
47327
47255
|
]
|
|
47328
47256
|
},
|
|
47329
47257
|
{
|
|
47330
|
-
"name": "
|
|
47331
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
47258
|
+
"name": "migrateTypeScript",
|
|
47259
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47332
47260
|
"ctype": "miscellaneous",
|
|
47333
47261
|
"subtype": "function",
|
|
47334
47262
|
"coverageIgnore": false,
|
|
@@ -47336,18 +47264,50 @@
|
|
|
47336
47264
|
"deprecationMessage": "",
|
|
47337
47265
|
"rawdescription": "",
|
|
47338
47266
|
"description": "",
|
|
47339
|
-
"displayName": "
|
|
47267
|
+
"displayName": "migrateTypeScript",
|
|
47340
47268
|
"args": [
|
|
47341
47269
|
{
|
|
47342
|
-
"name": "
|
|
47270
|
+
"name": "source",
|
|
47271
|
+
"type": "string",
|
|
47272
|
+
"deprecated": false,
|
|
47273
|
+
"deprecationMessage": ""
|
|
47274
|
+
},
|
|
47275
|
+
{
|
|
47276
|
+
"name": "filePath",
|
|
47277
|
+
"type": "string",
|
|
47278
|
+
"deprecated": false,
|
|
47279
|
+
"deprecationMessage": ""
|
|
47280
|
+
},
|
|
47281
|
+
{
|
|
47282
|
+
"name": "context",
|
|
47283
|
+
"type": "SchematicContext",
|
|
47343
47284
|
"deprecated": false,
|
|
47344
47285
|
"deprecationMessage": ""
|
|
47345
47286
|
}
|
|
47346
47287
|
],
|
|
47347
|
-
"returnType": "
|
|
47288
|
+
"returnType": "string",
|
|
47348
47289
|
"jsdoctags": [
|
|
47349
47290
|
{
|
|
47350
|
-
"name": "
|
|
47291
|
+
"name": "source",
|
|
47292
|
+
"type": "string",
|
|
47293
|
+
"deprecated": false,
|
|
47294
|
+
"deprecationMessage": "",
|
|
47295
|
+
"tagName": {
|
|
47296
|
+
"text": "param"
|
|
47297
|
+
}
|
|
47298
|
+
},
|
|
47299
|
+
{
|
|
47300
|
+
"name": "filePath",
|
|
47301
|
+
"type": "string",
|
|
47302
|
+
"deprecated": false,
|
|
47303
|
+
"deprecationMessage": "",
|
|
47304
|
+
"tagName": {
|
|
47305
|
+
"text": "param"
|
|
47306
|
+
}
|
|
47307
|
+
},
|
|
47308
|
+
{
|
|
47309
|
+
"name": "context",
|
|
47310
|
+
"type": "SchematicContext",
|
|
47351
47311
|
"deprecated": false,
|
|
47352
47312
|
"deprecationMessage": "",
|
|
47353
47313
|
"tagName": {
|
|
@@ -47357,8 +47317,8 @@
|
|
|
47357
47317
|
]
|
|
47358
47318
|
},
|
|
47359
47319
|
{
|
|
47360
|
-
"name": "
|
|
47361
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
47320
|
+
"name": "removeImportSpecifier",
|
|
47321
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47362
47322
|
"ctype": "miscellaneous",
|
|
47363
47323
|
"subtype": "function",
|
|
47364
47324
|
"coverageIgnore": false,
|
|
@@ -47366,18 +47326,57 @@
|
|
|
47366
47326
|
"deprecationMessage": "",
|
|
47367
47327
|
"rawdescription": "",
|
|
47368
47328
|
"description": "",
|
|
47369
|
-
"displayName": "
|
|
47329
|
+
"displayName": "removeImportSpecifier",
|
|
47370
47330
|
"args": [
|
|
47371
47331
|
{
|
|
47372
|
-
"name": "
|
|
47332
|
+
"name": "namedImports",
|
|
47333
|
+
"deprecated": false,
|
|
47334
|
+
"deprecationMessage": ""
|
|
47335
|
+
},
|
|
47336
|
+
{
|
|
47337
|
+
"name": "specifier",
|
|
47338
|
+
"deprecated": false,
|
|
47339
|
+
"deprecationMessage": ""
|
|
47340
|
+
},
|
|
47341
|
+
{
|
|
47342
|
+
"name": "sourceFile",
|
|
47343
|
+
"deprecated": false,
|
|
47344
|
+
"deprecationMessage": ""
|
|
47345
|
+
},
|
|
47346
|
+
{
|
|
47347
|
+
"name": "edits",
|
|
47373
47348
|
"deprecated": false,
|
|
47374
47349
|
"deprecationMessage": ""
|
|
47375
47350
|
}
|
|
47376
47351
|
],
|
|
47377
|
-
"returnType": "
|
|
47352
|
+
"returnType": "void",
|
|
47378
47353
|
"jsdoctags": [
|
|
47379
47354
|
{
|
|
47380
|
-
"name": "
|
|
47355
|
+
"name": "namedImports",
|
|
47356
|
+
"deprecated": false,
|
|
47357
|
+
"deprecationMessage": "",
|
|
47358
|
+
"tagName": {
|
|
47359
|
+
"text": "param"
|
|
47360
|
+
}
|
|
47361
|
+
},
|
|
47362
|
+
{
|
|
47363
|
+
"name": "specifier",
|
|
47364
|
+
"deprecated": false,
|
|
47365
|
+
"deprecationMessage": "",
|
|
47366
|
+
"tagName": {
|
|
47367
|
+
"text": "param"
|
|
47368
|
+
}
|
|
47369
|
+
},
|
|
47370
|
+
{
|
|
47371
|
+
"name": "sourceFile",
|
|
47372
|
+
"deprecated": false,
|
|
47373
|
+
"deprecationMessage": "",
|
|
47374
|
+
"tagName": {
|
|
47375
|
+
"text": "param"
|
|
47376
|
+
}
|
|
47377
|
+
},
|
|
47378
|
+
{
|
|
47379
|
+
"name": "edits",
|
|
47381
47380
|
"deprecated": false,
|
|
47382
47381
|
"deprecationMessage": "",
|
|
47383
47382
|
"tagName": {
|
|
@@ -47387,8 +47386,8 @@
|
|
|
47387
47386
|
]
|
|
47388
47387
|
},
|
|
47389
47388
|
{
|
|
47390
|
-
"name": "
|
|
47391
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
47389
|
+
"name": "unwrapExpression",
|
|
47390
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47392
47391
|
"ctype": "miscellaneous",
|
|
47393
47392
|
"subtype": "function",
|
|
47394
47393
|
"coverageIgnore": false,
|
|
@@ -47396,24 +47395,20 @@
|
|
|
47396
47395
|
"deprecationMessage": "",
|
|
47397
47396
|
"rawdescription": "",
|
|
47398
47397
|
"description": "",
|
|
47399
|
-
"displayName": "
|
|
47398
|
+
"displayName": "unwrapExpression",
|
|
47400
47399
|
"args": [
|
|
47401
47400
|
{
|
|
47402
|
-
"name": "
|
|
47403
|
-
"type": "Schema",
|
|
47401
|
+
"name": "expression",
|
|
47404
47402
|
"deprecated": false,
|
|
47405
|
-
"deprecationMessage": ""
|
|
47406
|
-
"defaultValue": "{}"
|
|
47403
|
+
"deprecationMessage": ""
|
|
47407
47404
|
}
|
|
47408
47405
|
],
|
|
47409
|
-
"returnType": "
|
|
47406
|
+
"returnType": "ts.Expression",
|
|
47410
47407
|
"jsdoctags": [
|
|
47411
47408
|
{
|
|
47412
|
-
"name": "
|
|
47413
|
-
"type": "Schema",
|
|
47409
|
+
"name": "expression",
|
|
47414
47410
|
"deprecated": false,
|
|
47415
47411
|
"deprecationMessage": "",
|
|
47416
|
-
"defaultValue": "{}",
|
|
47417
47412
|
"tagName": {
|
|
47418
47413
|
"text": "param"
|
|
47419
47414
|
}
|
|
@@ -47421,8 +47416,8 @@
|
|
|
47421
47416
|
]
|
|
47422
47417
|
},
|
|
47423
47418
|
{
|
|
47424
|
-
"name": "
|
|
47425
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
47419
|
+
"name": "visitDir",
|
|
47420
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47426
47421
|
"ctype": "miscellaneous",
|
|
47427
47422
|
"subtype": "function",
|
|
47428
47423
|
"coverageIgnore": false,
|
|
@@ -47430,41 +47425,25 @@
|
|
|
47430
47425
|
"deprecationMessage": "",
|
|
47431
47426
|
"rawdescription": "",
|
|
47432
47427
|
"description": "",
|
|
47433
|
-
"displayName": "
|
|
47428
|
+
"displayName": "visitDir",
|
|
47434
47429
|
"args": [
|
|
47435
47430
|
{
|
|
47436
|
-
"name": "
|
|
47437
|
-
"type": "
|
|
47438
|
-
"deprecated": false,
|
|
47439
|
-
"deprecationMessage": ""
|
|
47440
|
-
},
|
|
47441
|
-
{
|
|
47442
|
-
"name": "filePath",
|
|
47443
|
-
"type": "string",
|
|
47431
|
+
"name": "dir",
|
|
47432
|
+
"type": "DirEntry",
|
|
47444
47433
|
"deprecated": false,
|
|
47445
47434
|
"deprecationMessage": ""
|
|
47446
47435
|
},
|
|
47447
47436
|
{
|
|
47448
|
-
"name": "
|
|
47449
|
-
"type": "SchematicContext",
|
|
47437
|
+
"name": "callback",
|
|
47450
47438
|
"deprecated": false,
|
|
47451
47439
|
"deprecationMessage": ""
|
|
47452
47440
|
}
|
|
47453
47441
|
],
|
|
47454
|
-
"returnType": "
|
|
47442
|
+
"returnType": "void",
|
|
47455
47443
|
"jsdoctags": [
|
|
47456
47444
|
{
|
|
47457
|
-
"name": "
|
|
47458
|
-
"type": "
|
|
47459
|
-
"deprecated": false,
|
|
47460
|
-
"deprecationMessage": "",
|
|
47461
|
-
"tagName": {
|
|
47462
|
-
"text": "param"
|
|
47463
|
-
}
|
|
47464
|
-
},
|
|
47465
|
-
{
|
|
47466
|
-
"name": "filePath",
|
|
47467
|
-
"type": "string",
|
|
47445
|
+
"name": "dir",
|
|
47446
|
+
"type": "DirEntry",
|
|
47468
47447
|
"deprecated": false,
|
|
47469
47448
|
"deprecationMessage": "",
|
|
47470
47449
|
"tagName": {
|
|
@@ -47472,8 +47451,7 @@
|
|
|
47472
47451
|
}
|
|
47473
47452
|
},
|
|
47474
47453
|
{
|
|
47475
|
-
"name": "
|
|
47476
|
-
"type": "SchematicContext",
|
|
47454
|
+
"name": "callback",
|
|
47477
47455
|
"deprecated": false,
|
|
47478
47456
|
"deprecationMessage": "",
|
|
47479
47457
|
"tagName": {
|
|
@@ -47483,8 +47461,8 @@
|
|
|
47483
47461
|
]
|
|
47484
47462
|
},
|
|
47485
47463
|
{
|
|
47486
|
-
"name": "
|
|
47487
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
47464
|
+
"name": "visitNodes",
|
|
47465
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47488
47466
|
"ctype": "miscellaneous",
|
|
47489
47467
|
"subtype": "function",
|
|
47490
47468
|
"coverageIgnore": false,
|
|
@@ -47492,25 +47470,33 @@
|
|
|
47492
47470
|
"deprecationMessage": "",
|
|
47493
47471
|
"rawdescription": "",
|
|
47494
47472
|
"description": "",
|
|
47495
|
-
"displayName": "
|
|
47473
|
+
"displayName": "visitNodes",
|
|
47496
47474
|
"args": [
|
|
47497
47475
|
{
|
|
47498
|
-
"name": "
|
|
47476
|
+
"name": "nodes",
|
|
47499
47477
|
"deprecated": false,
|
|
47500
47478
|
"deprecationMessage": ""
|
|
47501
47479
|
},
|
|
47502
47480
|
{
|
|
47503
|
-
"name": "
|
|
47481
|
+
"name": "source",
|
|
47482
|
+
"type": "string",
|
|
47504
47483
|
"deprecated": false,
|
|
47505
47484
|
"deprecationMessage": ""
|
|
47506
47485
|
},
|
|
47507
47486
|
{
|
|
47508
|
-
"name": "
|
|
47487
|
+
"name": "edits",
|
|
47509
47488
|
"deprecated": false,
|
|
47510
47489
|
"deprecationMessage": ""
|
|
47511
47490
|
},
|
|
47512
47491
|
{
|
|
47513
|
-
"name": "
|
|
47492
|
+
"name": "filePath",
|
|
47493
|
+
"type": "string",
|
|
47494
|
+
"deprecated": false,
|
|
47495
|
+
"deprecationMessage": ""
|
|
47496
|
+
},
|
|
47497
|
+
{
|
|
47498
|
+
"name": "context",
|
|
47499
|
+
"type": "SchematicContext",
|
|
47514
47500
|
"deprecated": false,
|
|
47515
47501
|
"deprecationMessage": ""
|
|
47516
47502
|
}
|
|
@@ -47518,7 +47504,7 @@
|
|
|
47518
47504
|
"returnType": "void",
|
|
47519
47505
|
"jsdoctags": [
|
|
47520
47506
|
{
|
|
47521
|
-
"name": "
|
|
47507
|
+
"name": "nodes",
|
|
47522
47508
|
"deprecated": false,
|
|
47523
47509
|
"deprecationMessage": "",
|
|
47524
47510
|
"tagName": {
|
|
@@ -47526,7 +47512,8 @@
|
|
|
47526
47512
|
}
|
|
47527
47513
|
},
|
|
47528
47514
|
{
|
|
47529
|
-
"name": "
|
|
47515
|
+
"name": "source",
|
|
47516
|
+
"type": "string",
|
|
47530
47517
|
"deprecated": false,
|
|
47531
47518
|
"deprecationMessage": "",
|
|
47532
47519
|
"tagName": {
|
|
@@ -47534,7 +47521,7 @@
|
|
|
47534
47521
|
}
|
|
47535
47522
|
},
|
|
47536
47523
|
{
|
|
47537
|
-
"name": "
|
|
47524
|
+
"name": "edits",
|
|
47538
47525
|
"deprecated": false,
|
|
47539
47526
|
"deprecationMessage": "",
|
|
47540
47527
|
"tagName": {
|
|
@@ -47542,7 +47529,17 @@
|
|
|
47542
47529
|
}
|
|
47543
47530
|
},
|
|
47544
47531
|
{
|
|
47545
|
-
"name": "
|
|
47532
|
+
"name": "filePath",
|
|
47533
|
+
"type": "string",
|
|
47534
|
+
"deprecated": false,
|
|
47535
|
+
"deprecationMessage": "",
|
|
47536
|
+
"tagName": {
|
|
47537
|
+
"text": "param"
|
|
47538
|
+
}
|
|
47539
|
+
},
|
|
47540
|
+
{
|
|
47541
|
+
"name": "context",
|
|
47542
|
+
"type": "SchematicContext",
|
|
47546
47543
|
"deprecated": false,
|
|
47547
47544
|
"deprecationMessage": "",
|
|
47548
47545
|
"tagName": {
|
|
@@ -47552,8 +47549,8 @@
|
|
|
47552
47549
|
]
|
|
47553
47550
|
},
|
|
47554
47551
|
{
|
|
47555
|
-
"name": "
|
|
47556
|
-
"file": "packages/core/schematics/migrate-eui-
|
|
47552
|
+
"name": "warnRemovedProperties",
|
|
47553
|
+
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
47557
47554
|
"ctype": "miscellaneous",
|
|
47558
47555
|
"subtype": "function",
|
|
47559
47556
|
"coverageIgnore": false,
|
|
@@ -47561,16 +47558,22 @@
|
|
|
47561
47558
|
"deprecationMessage": "",
|
|
47562
47559
|
"rawdescription": "",
|
|
47563
47560
|
"description": "",
|
|
47564
|
-
"displayName": "
|
|
47561
|
+
"displayName": "warnRemovedProperties",
|
|
47565
47562
|
"args": [
|
|
47566
47563
|
{
|
|
47567
|
-
"name": "
|
|
47568
|
-
"type": "DirEntry",
|
|
47564
|
+
"name": "sourceFile",
|
|
47569
47565
|
"deprecated": false,
|
|
47570
47566
|
"deprecationMessage": ""
|
|
47571
47567
|
},
|
|
47572
47568
|
{
|
|
47573
|
-
"name": "
|
|
47569
|
+
"name": "filePath",
|
|
47570
|
+
"type": "string",
|
|
47571
|
+
"deprecated": false,
|
|
47572
|
+
"deprecationMessage": ""
|
|
47573
|
+
},
|
|
47574
|
+
{
|
|
47575
|
+
"name": "context",
|
|
47576
|
+
"type": "SchematicContext",
|
|
47574
47577
|
"deprecated": false,
|
|
47575
47578
|
"deprecationMessage": ""
|
|
47576
47579
|
}
|
|
@@ -47578,8 +47581,7 @@
|
|
|
47578
47581
|
"returnType": "void",
|
|
47579
47582
|
"jsdoctags": [
|
|
47580
47583
|
{
|
|
47581
|
-
"name": "
|
|
47582
|
-
"type": "DirEntry",
|
|
47584
|
+
"name": "sourceFile",
|
|
47583
47585
|
"deprecated": false,
|
|
47584
47586
|
"deprecationMessage": "",
|
|
47585
47587
|
"tagName": {
|
|
@@ -47587,7 +47589,17 @@
|
|
|
47587
47589
|
}
|
|
47588
47590
|
},
|
|
47589
47591
|
{
|
|
47590
|
-
"name": "
|
|
47592
|
+
"name": "filePath",
|
|
47593
|
+
"type": "string",
|
|
47594
|
+
"deprecated": false,
|
|
47595
|
+
"deprecationMessage": "",
|
|
47596
|
+
"tagName": {
|
|
47597
|
+
"text": "param"
|
|
47598
|
+
}
|
|
47599
|
+
},
|
|
47600
|
+
{
|
|
47601
|
+
"name": "context",
|
|
47602
|
+
"type": "SchematicContext",
|
|
47591
47603
|
"deprecated": false,
|
|
47592
47604
|
"deprecationMessage": "",
|
|
47593
47605
|
"tagName": {
|