@siemens/element-ng 49.16.0 → 51.0.0-rc.10
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/README.md +1 -1
- package/fesm2022/siemens-element-ng-about.mjs +41 -25
- package/fesm2022/siemens-element-ng-about.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-accordion.mjs +59 -41
- package/fesm2022/siemens-element-ng-accordion.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-action-modal.mjs +83 -53
- package/fesm2022/siemens-element-ng-action-modal.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-ag-grid.mjs +143 -148
- package/fesm2022/siemens-element-ng-ag-grid.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-application-header.mjs +180 -188
- package/fesm2022/siemens-element-ng-application-header.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-auto-collapsable-list.mjs +34 -28
- package/fesm2022/siemens-element-ng-auto-collapsable-list.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-autocomplete.mjs +27 -22
- package/fesm2022/siemens-element-ng-autocomplete.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-avatar.mjs +34 -24
- package/fesm2022/siemens-element-ng-avatar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-badge.mjs +9 -8
- package/fesm2022/siemens-element-ng-badge.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-breadcrumb-router.mjs +17 -14
- package/fesm2022/siemens-element-ng-breadcrumb-router.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-breadcrumb.mjs +21 -17
- package/fesm2022/siemens-element-ng-breadcrumb.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-card.mjs +72 -47
- package/fesm2022/siemens-element-ng-card.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-carousel.mjs +58 -34
- package/fesm2022/siemens-element-ng-carousel.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-chat-messages.mjs +323 -215
- package/fesm2022/siemens-element-ng-chat-messages.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-circle-status.mjs +39 -25
- package/fesm2022/siemens-element-ng-circle-status.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-color-picker.mjs +44 -34
- package/fesm2022/siemens-element-ng-color-picker.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-column-selection-dialog.mjs +58 -37
- package/fesm2022/siemens-element-ng-column-selection-dialog.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-common.mjs +22 -22
- package/fesm2022/siemens-element-ng-common.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-connection-strength.mjs +14 -12
- package/fesm2022/siemens-element-ng-connection-strength.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-content-action-bar.mjs +37 -28
- package/fesm2022/siemens-element-ng-content-action-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-copyright-notice.mjs +19 -14
- package/fesm2022/siemens-element-ng-copyright-notice.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-dashboard.mjs +337 -223
- package/fesm2022/siemens-element-ng-dashboard.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-datatable.mjs +12 -15
- package/fesm2022/siemens-element-ng-datatable.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-date-range-filter.mjs +126 -76
- package/fesm2022/siemens-element-ng-date-range-filter.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-datepicker.mjs +393 -251
- package/fesm2022/siemens-element-ng-datepicker.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-electron-titlebar.mjs +22 -17
- package/fesm2022/siemens-element-ng-electron-titlebar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-empty-state.mjs +15 -12
- package/fesm2022/siemens-element-ng-empty-state.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-file-uploader.mjs +105 -91
- package/fesm2022/siemens-element-ng-file-uploader.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-filter-bar.mjs +33 -25
- package/fesm2022/siemens-element-ng-filter-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-filtered-search.mjs +274 -165
- package/fesm2022/siemens-element-ng-filtered-search.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-footer.mjs +12 -10
- package/fesm2022/siemens-element-ng-footer.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-form.mjs +361 -116
- package/fesm2022/siemens-element-ng-form.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-formly-legacy.mjs +99 -0
- package/fesm2022/siemens-element-ng-formly-legacy.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-formly.mjs +224 -318
- package/fesm2022/siemens-element-ng-formly.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-header-dropdown.mjs +40 -30
- package/fesm2022/siemens-element-ng-header-dropdown.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-help-button.mjs +6 -6
- package/fesm2022/siemens-element-ng-help-button.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-icon.mjs +56 -57
- package/fesm2022/siemens-element-ng-icon.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-info-page.mjs +17 -11
- package/fesm2022/siemens-element-ng-info-page.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-inline-notification.mjs +19 -14
- package/fesm2022/siemens-element-ng-inline-notification.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-ip-input.mjs +19 -15
- package/fesm2022/siemens-element-ng-ip-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-landing-page.mjs +121 -75
- package/fesm2022/siemens-element-ng-landing-page.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-language-switcher.mjs +16 -12
- package/fesm2022/siemens-element-ng-language-switcher.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-link.mjs +31 -21
- package/fesm2022/siemens-element-ng-link.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-list-details.mjs +132 -66
- package/fesm2022/siemens-element-ng-list-details.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-loading-spinner.mjs +51 -64
- package/fesm2022/siemens-element-ng-loading-spinner.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-localization.mjs +14 -12
- package/fesm2022/siemens-element-ng-localization.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-main-detail-container.mjs +116 -51
- package/fesm2022/siemens-element-ng-main-detail-container.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-maplibre.mjs +401 -0
- package/fesm2022/siemens-element-ng-maplibre.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-markdown-directives-tabs.mjs +70 -0
- package/fesm2022/siemens-element-ng-markdown-directives-tabs.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-markdown-extensions-citations.mjs +215 -0
- package/fesm2022/siemens-element-ng-markdown-extensions-citations.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-markdown-extensions-katex.mjs +76 -0
- package/fesm2022/siemens-element-ng-markdown-extensions-katex.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-markdown-extensions-mermaid.mjs +86 -0
- package/fesm2022/siemens-element-ng-markdown-extensions-mermaid.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-markdown-hightlighter-highlightjs.mjs +130 -0
- package/fesm2022/siemens-element-ng-markdown-hightlighter-highlightjs.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-markdown.mjs +800 -0
- package/fesm2022/siemens-element-ng-markdown.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-menu.mjs +71 -57
- package/fesm2022/siemens-element-ng-menu.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-modal.mjs +14 -11
- package/fesm2022/siemens-element-ng-modal.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar-vertical-next.mjs +251 -206
- package/fesm2022/siemens-element-ng-navbar-vertical-next.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar-vertical.mjs +123 -86
- package/fesm2022/siemens-element-ng-navbar-vertical.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar.mjs +72 -45
- package/fesm2022/siemens-element-ng-navbar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-notification-item.mjs +19 -11
- package/fesm2022/siemens-element-ng-notification-item.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-number-input.mjs +41 -29
- package/fesm2022/siemens-element-ng-number-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-pagination.mjs +31 -20
- package/fesm2022/siemens-element-ng-pagination.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-password-strength.mjs +33 -24
- package/fesm2022/siemens-element-ng-password-strength.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-password-toggle.mjs +19 -14
- package/fesm2022/siemens-element-ng-password-toggle.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-phone-number.mjs +144 -139
- package/fesm2022/siemens-element-ng-phone-number.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-photo-upload.mjs +85 -52
- package/fesm2022/siemens-element-ng-photo-upload.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-pills-input.mjs +56 -41
- package/fesm2022/siemens-element-ng-pills-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-popover-legacy.mjs +43 -28
- package/fesm2022/siemens-element-ng-popover-legacy.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-popover.mjs +35 -27
- package/fesm2022/siemens-element-ng-popover.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-progressbar.mjs +23 -16
- package/fesm2022/siemens-element-ng-progressbar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-resize-observer.mjs +32 -43
- package/fesm2022/siemens-element-ng-resize-observer.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-result-details-list.mjs +12 -10
- package/fesm2022/siemens-element-ng-result-details-list.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-search-bar.mjs +38 -37
- package/fesm2022/siemens-element-ng-search-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-select.mjs +265 -170
- package/fesm2022/siemens-element-ng-select.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-shadow-root.mjs +4 -4
- package/fesm2022/siemens-element-ng-shadow-root.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-side-panel.mjs +181 -104
- package/fesm2022/siemens-element-ng-side-panel.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-skip-links.mjs +21 -24
- package/fesm2022/siemens-element-ng-skip-links.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-slider.mjs +45 -30
- package/fesm2022/siemens-element-ng-slider.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-source-chip.mjs +79 -0
- package/fesm2022/siemens-element-ng-source-chip.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-split.mjs +290 -306
- package/fesm2022/siemens-element-ng-split.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-bar.mjs +66 -52
- package/fesm2022/siemens-element-ng-status-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-counter.mjs +15 -11
- package/fesm2022/siemens-element-ng-status-counter.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-toggle.mjs +26 -16
- package/fesm2022/siemens-element-ng-status-toggle.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-summary-chip.mjs +25 -16
- package/fesm2022/siemens-element-ng-summary-chip.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-summary-widget.mjs +27 -17
- package/fesm2022/siemens-element-ng-summary-widget.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-system-banner.mjs +13 -10
- package/fesm2022/siemens-element-ng-system-banner.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tabs-legacy.mjs +20 -17
- package/fesm2022/siemens-element-ng-tabs-legacy.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tabs.mjs +156 -131
- package/fesm2022/siemens-element-ng-tabs.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-theme.mjs +29 -6
- package/fesm2022/siemens-element-ng-theme.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-threshold.mjs +62 -42
- package/fesm2022/siemens-element-ng-threshold.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-toast-notification.mjs +59 -40
- package/fesm2022/siemens-element-ng-toast-notification.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tooltip.mjs +108 -82
- package/fesm2022/siemens-element-ng-tooltip.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tour.mjs +36 -19
- package/fesm2022/siemens-element-ng-tour.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-translate.mjs +0 -1
- package/fesm2022/siemens-element-ng-translate.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tree-view.mjs +113 -84
- package/fesm2022/siemens-element-ng-tree-view.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-typeahead.mjs +69 -49
- package/fesm2022/siemens-element-ng-typeahead.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-wizard.mjs +95 -54
- package/fesm2022/siemens-element-ng-wizard.mjs.map +1 -1
- package/formly-legacy/package.json +4 -0
- package/maplibre/package.json +4 -0
- package/maplibre/styles/_index.scss +1 -0
- package/maplibre/styles/maplibre-gl.scss +724 -0
- package/markdown/directives/tabs/package.json +4 -0
- package/markdown/extensions/citations/package.json +4 -0
- package/markdown/extensions/katex/package.json +4 -0
- package/markdown/extensions/mermaid/package.json +4 -0
- package/markdown/hightlighter/highlightjs/package.json +4 -0
- package/markdown/package.json +4 -0
- package/package.json +96 -25
- package/schematics/collection.json +5 -0
- package/schematics/{migrations/icon-path-migration → migrate-tabs-legacy}/index.js +1 -1
- package/schematics/migrate-tabs-legacy/migrate-tabs-legacy-rule.js +675 -0
- package/schematics/migrate-tabs-legacy/schema.json +14 -0
- package/schematics/migration.json +4 -4
- package/schematics/migrations/data/class-member-replacement.js +1 -19
- package/schematics/migrations/data/component-property-names.js +1 -25
- package/schematics/migrations/data/component-property-to-child.js +11 -0
- package/schematics/migrations/data/css-custom-properties.js +224 -0
- package/schematics/migrations/data/element-class-changes.js +116 -18
- package/schematics/migrations/data/element-migration-data.js +6 -0
- package/schematics/migrations/data/element-selectors.js +1 -9
- package/schematics/migrations/data/index.js +0 -4
- package/schematics/migrations/data/migration-test-data.js +49 -6
- package/schematics/migrations/data/provider-function-removals.js +7 -0
- package/schematics/migrations/data/symbol-removals.js +17 -7
- package/schematics/migrations/data/symbol-renaming.js +3 -44
- package/schematics/migrations/element-migration/element-migration.js +6 -6
- package/schematics/migrations/utilities/component-property-to-child.migration.js +73 -0
- package/schematics/migrations/utilities/css-custom-property.migration.js +51 -0
- package/schematics/migrations/utilities/element-class-change.migration.js +10 -5
- package/schematics/migrations/utilities/import-removal.js +39 -0
- package/schematics/migrations/utilities/index.js +4 -0
- package/schematics/migrations/utilities/provider-function-removal.migration.js +116 -0
- package/schematics/ng-update/index.js +1 -1
- package/schematics/ng-update/migrate-content-formatter.js +288 -0
- package/schematics/ng-update/migrate-list-details-units.js +86 -0
- package/schematics/ng-update/migrate-main-detail-units.js +89 -0
- package/schematics/ng-update/migrate-markdown-renderer.js +106 -0
- package/schematics/ng-update/migrate-spacers.js +32 -0
- package/schematics/ng-update/migrate-split-collapse.js +276 -0
- package/schematics/ng-update/migrate-split-scale.js +524 -0
- package/schematics/ng-update/migrate-split-sizes.js +107 -0
- package/schematics/ng-update/migrate-to-v51.js +35 -0
- package/schematics/utils/index.js +1 -0
- package/schematics/utils/template-edit-utils.js +35 -0
- package/schematics/utils/template-utils.js +31 -45
- package/source-chip/package.json +4 -0
- package/template-i18n.json +78 -47
- package/types/siemens-element-ng-application-header.d.ts +7 -33
- package/types/siemens-element-ng-avatar.d.ts +1 -1
- package/types/siemens-element-ng-breadcrumb.d.ts +1 -1
- package/types/siemens-element-ng-chat-messages.d.ts +118 -70
- package/types/siemens-element-ng-circle-status.d.ts +1 -1
- package/types/siemens-element-ng-content-action-bar.d.ts +1 -1
- package/types/siemens-element-ng-dashboard.d.ts +2 -2
- package/types/siemens-element-ng-datatable.d.ts +5 -56
- package/types/siemens-element-ng-date-range-filter.d.ts +1 -1
- package/types/siemens-element-ng-datepicker.d.ts +8 -15
- package/types/siemens-element-ng-electron-titlebar.d.ts +1 -1
- package/types/siemens-element-ng-file-uploader.d.ts +13 -31
- package/types/siemens-element-ng-filter-bar.d.ts +1 -1
- package/types/siemens-element-ng-filtered-search.d.ts +4 -4
- package/types/siemens-element-ng-form.d.ts +183 -44
- package/types/siemens-element-ng-formly-legacy.d.ts +40 -0
- package/types/siemens-element-ng-formly.d.ts +34 -167
- package/types/siemens-element-ng-icon.d.ts +2 -19
- package/types/siemens-element-ng-landing-page.d.ts +2 -2
- package/types/siemens-element-ng-list-details.d.ts +25 -3
- package/types/siemens-element-ng-loading-spinner.d.ts +11 -17
- package/types/siemens-element-ng-main-detail-container.d.ts +23 -3
- package/types/siemens-element-ng-maplibre.d.ts +190 -0
- package/types/siemens-element-ng-markdown-directives-tabs.d.ts +10 -0
- package/types/siemens-element-ng-markdown-extensions-citations.d.ts +11 -0
- package/types/siemens-element-ng-markdown-extensions-katex.d.ts +19 -0
- package/types/siemens-element-ng-markdown-extensions-mermaid.d.ts +11 -0
- package/types/siemens-element-ng-markdown-hightlighter-highlightjs.d.ts +48 -0
- package/types/siemens-element-ng-markdown.d.ts +367 -0
- package/types/siemens-element-ng-menu.d.ts +2 -0
- package/types/siemens-element-ng-navbar-vertical-next.d.ts +87 -39
- package/types/siemens-element-ng-navbar-vertical.d.ts +1 -1
- package/types/siemens-element-ng-navbar.d.ts +3 -3
- package/types/siemens-element-ng-notification-item.d.ts +12 -0
- package/types/siemens-element-ng-phone-number.d.ts +28 -10
- package/types/siemens-element-ng-photo-upload.d.ts +4 -4
- package/types/siemens-element-ng-resize-observer.d.ts +0 -17
- package/types/siemens-element-ng-search-bar.d.ts +2 -9
- package/types/siemens-element-ng-select.d.ts +32 -5
- package/types/siemens-element-ng-side-panel.d.ts +25 -11
- package/types/siemens-element-ng-source-chip.d.ts +53 -0
- package/types/siemens-element-ng-split.d.ts +101 -78
- package/types/siemens-element-ng-status-bar.d.ts +5 -13
- package/types/siemens-element-ng-status-counter.d.ts +1 -1
- package/types/siemens-element-ng-system-banner.d.ts +2 -2
- package/types/siemens-element-ng-tabs.d.ts +1 -2
- package/types/siemens-element-ng-theme.d.ts +12 -2
- package/types/siemens-element-ng-threshold.d.ts +1 -1
- package/types/siemens-element-ng-toast-notification.d.ts +0 -1
- package/types/siemens-element-ng-tooltip.d.ts +7 -7
- package/types/siemens-element-ng-translate.d.ts +35 -5
- package/types/siemens-element-ng-tree-view.d.ts +3 -0
- package/types/siemens-element-ng-wizard.d.ts +18 -3
- package/fesm2022/siemens-element-ng-icon-status.mjs +0 -46
- package/fesm2022/siemens-element-ng-icon-status.mjs.map +0 -1
- package/fesm2022/siemens-element-ng-markdown-renderer.mjs +0 -263
- package/fesm2022/siemens-element-ng-markdown-renderer.mjs.map +0 -1
- package/fesm2022/siemens-element-ng-sort-bar.mjs +0 -99
- package/fesm2022/siemens-element-ng-sort-bar.mjs.map +0 -1
- package/icon-status/package.json +0 -4
- package/markdown-renderer/package.json +0 -4
- package/schematics/migrations/icon-path-migration/icon-path-migration.js +0 -95
- package/schematics/ng-update/migrate-to-v49.js +0 -21
- package/schematics/vitest-setup.js +0 -5
- package/sort-bar/package.json +0 -4
- package/types/siemens-element-ng-icon-status.d.ts +0 -25
- package/types/siemens-element-ng-markdown-renderer.d.ts +0 -36
- package/types/siemens-element-ng-sort-bar.d.ts +0 -59
- /package/{LICENSE.md → LICENSE} +0 -0
|
@@ -0,0 +1,800 @@
|
|
|
1
|
+
import { NgTemplateOutlet, NgComponentOutlet, JsonPipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InjectionToken, inject, input, computed, Component, linkedSignal, signal, SecurityContext, viewChild, TemplateRef, Directive, effect, untracked, booleanAttribute, output, viewChildren, contentChildren } from '@angular/core';
|
|
4
|
+
import remarkDirective from 'remark-directive';
|
|
5
|
+
import remarkGfm from 'remark-gfm';
|
|
6
|
+
import remarkParse from 'remark-parse';
|
|
7
|
+
import { unified } from 'unified';
|
|
8
|
+
import { elementLightOn, elementDocument, elementOk, elementCopy, elementDownload } from '@siemens/element-icons';
|
|
9
|
+
import { STATUS_ICON_CONFIG, addIcons, SiIconComponent, SiStatusIconComponent } from '@siemens/element-ng/icon';
|
|
10
|
+
import { t, SiTranslatePipe } from '@siemens/element-translate-ng/translate';
|
|
11
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
15
|
+
* SPDX-License-Identifier: MIT
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Token to pass the si-markdown component w/o circular dependencies.
|
|
19
|
+
*/
|
|
20
|
+
const SI_MARKDOWN_CONTROL = new InjectionToken('si.markdown.control');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
24
|
+
* SPDX-License-Identifier: MIT
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Renders a fragment of markdown based on the children of a single node in the AST.
|
|
28
|
+
*/
|
|
29
|
+
class SiMarkdownFragmentComponent {
|
|
30
|
+
control = inject(SI_MARKDOWN_CONTROL);
|
|
31
|
+
/** The node for which to render all children */
|
|
32
|
+
node = input.required({ ...(ngDevMode ? { debugName: "node" } : /* istanbul ignore next */ {}), alias: 'siMarkdownFragment' });
|
|
33
|
+
/** all the children of the node */
|
|
34
|
+
children = computed(() => this.node().children ?? [], /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "children" }] : /* istanbul ignore next */ []));
|
|
36
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownFragmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
37
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiMarkdownFragmentComponent, isStandalone: true, selector: "si-markdown-fragment, [siMarkdownFragment]", inputs: { node: { classPropertyName: "node", publicName: "siMarkdownFragment", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "markdown-content" }, ngImport: i0, template: "<ng-content />\n\n@let templates = control.templates();\n@for (child of children(); track $index) {\n <ng-container\n [ngTemplateOutlet]=\"templates.get(child.type) ?? templates.get('__default-template')\"\n [ngTemplateOutletContext]=\"{ $implicit: child, parent: node() }\"\n />\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
38
|
+
}
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownFragmentComponent, decorators: [{
|
|
40
|
+
type: Component,
|
|
41
|
+
args: [{ selector: 'si-markdown-fragment, [siMarkdownFragment]', imports: [NgTemplateOutlet], host: {
|
|
42
|
+
class: 'markdown-content'
|
|
43
|
+
}, template: "<ng-content />\n\n@let templates = control.templates();\n@for (child of children(); track $index) {\n <ng-container\n [ngTemplateOutlet]=\"templates.get(child.type) ?? templates.get('__default-template')\"\n [ngTemplateOutletContext]=\"{ $implicit: child, parent: node() }\"\n />\n}\n" }]
|
|
44
|
+
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "siMarkdownFragment", required: true }] }] } });
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
48
|
+
* SPDX-License-Identifier: MIT
|
|
49
|
+
*/
|
|
50
|
+
class SiMarkdownCalloutComponent {
|
|
51
|
+
statusIcons = inject(STATUS_ICON_CONFIG);
|
|
52
|
+
node = input.required(/* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
54
|
+
parent = input.required(/* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "parent" }] : /* istanbul ignore next */ []));
|
|
56
|
+
options = input(/* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [undefined, { debugName: "options" }] : /* istanbul ignore next */ []));
|
|
58
|
+
icons = addIcons({ elementLightOn });
|
|
59
|
+
callouts = {
|
|
60
|
+
info: { label: this.statusIcons.info.ariaLabel, severity: 'info' },
|
|
61
|
+
success: { label: this.statusIcons.success.ariaLabel, severity: 'success' },
|
|
62
|
+
warning: { label: this.statusIcons.warning.ariaLabel, severity: 'warning' },
|
|
63
|
+
danger: { label: this.statusIcons.danger.ariaLabel, severity: 'danger' },
|
|
64
|
+
caution: { label: this.statusIcons.caution.ariaLabel, severity: 'caution' },
|
|
65
|
+
critical: { label: this.statusIcons.critical.ariaLabel, severity: 'critical' },
|
|
66
|
+
note: {
|
|
67
|
+
label: t(() => $localize `:@@SI_MARKDOWN_CALLOUT.NOTE:Note`),
|
|
68
|
+
severity: 'info'
|
|
69
|
+
},
|
|
70
|
+
tip: {
|
|
71
|
+
label: t(() => $localize `:@@SI_MARKDOWN_CALLOUT.TIP:Tip`),
|
|
72
|
+
severity: 'success',
|
|
73
|
+
icon: this.icons.elementLightOn,
|
|
74
|
+
color: this.statusIcons.success.color
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
config = computed(() => {
|
|
78
|
+
const directive = this.node();
|
|
79
|
+
const type = directive.attributes.type?.toLocaleLowerCase();
|
|
80
|
+
return {
|
|
81
|
+
callout: this.callouts[type] ?? this.callouts.note,
|
|
82
|
+
heading: directive.attributes.heading
|
|
83
|
+
};
|
|
84
|
+
}, /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
86
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownCalloutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
87
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiMarkdownCalloutComponent, isStandalone: true, selector: "si-markdown-callout", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "d-block mb-4" }, ngImport: i0, template: "@let conf = config();\n<div class=\"card card-outline\" [class]=\"`accent-${conf.callout.severity}`\">\n <div class=\"card-header d-flex aling-items-center\">\n @if (conf.callout.icon) {\n <si-icon\n class=\"icon me-4 flex-shrink-0\"\n [icon]=\"conf.callout.icon\"\n [class]=\"conf.callout.color\"\n />\n } @else {\n <si-status-icon\n class=\"icon me-4 flex-shrink-0\"\n aria-hidden=\"true\"\n [status]=\"conf.callout.severity\"\n />\n }\n <span [class]=\"`text-${conf.callout.severity}`\">\n {{ conf.callout.label | translate }}\n @if (conf.heading) {\n - {{ conf.heading }}\n }\n </span>\n </div>\n <div class=\"card-body pb-4\">\n <div [siMarkdownFragment]=\"node()\"></div>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiStatusIconComponent, selector: "si-status-icon", inputs: ["status"] }, { kind: "component", type: SiMarkdownFragmentComponent, selector: "si-markdown-fragment, [siMarkdownFragment]", inputs: ["siMarkdownFragment"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
88
|
+
}
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownCalloutComponent, decorators: [{
|
|
90
|
+
type: Component,
|
|
91
|
+
args: [{ selector: 'si-markdown-callout', imports: [SiIconComponent, SiStatusIconComponent, SiMarkdownFragmentComponent, SiTranslatePipe], host: {
|
|
92
|
+
class: 'd-block mb-4'
|
|
93
|
+
}, template: "@let conf = config();\n<div class=\"card card-outline\" [class]=\"`accent-${conf.callout.severity}`\">\n <div class=\"card-header d-flex aling-items-center\">\n @if (conf.callout.icon) {\n <si-icon\n class=\"icon me-4 flex-shrink-0\"\n [icon]=\"conf.callout.icon\"\n [class]=\"conf.callout.color\"\n />\n } @else {\n <si-status-icon\n class=\"icon me-4 flex-shrink-0\"\n aria-hidden=\"true\"\n [status]=\"conf.callout.severity\"\n />\n }\n <span [class]=\"`text-${conf.callout.severity}`\">\n {{ conf.callout.label | translate }}\n @if (conf.heading) {\n - {{ conf.heading }}\n }\n </span>\n </div>\n <div class=\"card-body pb-4\">\n <div [siMarkdownFragment]=\"node()\"></div>\n </div>\n</div>\n" }]
|
|
94
|
+
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], parent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parent", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
95
|
+
|
|
96
|
+
const siMarkdownCalloutDirective = () => ({
|
|
97
|
+
type: 'callout',
|
|
98
|
+
component: SiMarkdownCalloutComponent
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
103
|
+
* SPDX-License-Identifier: MIT
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
108
|
+
* SPDX-License-Identifier: MIT
|
|
109
|
+
*/
|
|
110
|
+
class SiMarkdownCodeComponent {
|
|
111
|
+
node = input.required(/* @ts-ignore */
|
|
112
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
113
|
+
parent = input.required(/* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "parent" }] : /* istanbul ignore next */ []));
|
|
115
|
+
options = input(/* @ts-ignore */
|
|
116
|
+
...(ngDevMode ? [undefined, { debugName: "options" }] : /* istanbul ignore next */ []));
|
|
117
|
+
icons = addIcons({ elementCopy, elementOk, elementDocument });
|
|
118
|
+
labelCopy = t(() => $localize `:@@SI_MARKDOWN.COPY_CODE:Copy code`);
|
|
119
|
+
labelCopied = t(() => $localize `:@@SI_MARKDOWN.COPIED_CODE:Copied`);
|
|
120
|
+
code = computed(() => this.node().value, /* @ts-ignore */
|
|
121
|
+
...(ngDevMode ? [{ debugName: "code" }] : /* istanbul ignore next */ []));
|
|
122
|
+
language = computed(() => this.node().lang, /* @ts-ignore */
|
|
123
|
+
...(ngDevMode ? [{ debugName: "language" }] : /* istanbul ignore next */ []));
|
|
124
|
+
highlighter = computed(() => this.options()?.getHighlighter(), /* @ts-ignore */
|
|
125
|
+
...(ngDevMode ? [{ debugName: "highlighter" }] : /* istanbul ignore next */ []));
|
|
126
|
+
filename = computed(() => {
|
|
127
|
+
const meta = this.node().meta ?? '';
|
|
128
|
+
const match = meta.match('\\[([^\\]]+)\\]');
|
|
129
|
+
return match ? match[1] : '';
|
|
130
|
+
}, /* @ts-ignore */
|
|
131
|
+
...(ngDevMode ? [{ debugName: "filename" }] : /* istanbul ignore next */ []));
|
|
132
|
+
languageToDisplay = linkedSignal(() => this.language(), /* @ts-ignore */
|
|
133
|
+
...(ngDevMode ? [{ debugName: "languageToDisplay" }] : /* istanbul ignore next */ []));
|
|
134
|
+
copied = signal(false, /* @ts-ignore */
|
|
135
|
+
...(ngDevMode ? [{ debugName: "copied" }] : /* istanbul ignore next */ []));
|
|
136
|
+
copyTimeout;
|
|
137
|
+
updateLanguage = (lang) => this.languageToDisplay.set(lang);
|
|
138
|
+
ngOnDestroy() {
|
|
139
|
+
clearTimeout(this.copyTimeout);
|
|
140
|
+
}
|
|
141
|
+
async copy() {
|
|
142
|
+
await navigator.clipboard.writeText(this.code());
|
|
143
|
+
this.copied.set(true);
|
|
144
|
+
this.copyTimeout = setTimeout(() => this.copied.set(false), 1500);
|
|
145
|
+
}
|
|
146
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownCodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
147
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiMarkdownCodeComponent, isStandalone: true, selector: "si-markdown-code", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-line": "node().position?.start?.line" }, classAttribute: "d-flex flex-column px-6 py-5 mb-6 border rounded" }, ngImport: i0, template: "<div class=\"d-flex align-items-center mb-6\">\n @let file = filename();\n @if (file) {\n <span class=\"filename border rounded-1 px-1 me-4\">\n <si-icon class=\"icon-sm\" [icon]=\"icons.elementDocument\" />\n {{ file }}\n </span>\n }\n <span class=\"code-language\" [class.text-secondary]=\"file\">\n {{ languageToDisplay() }}\n </span>\n <div class=\"ms-auto\">\n @if (copied()) {\n <div class=\"btn text-secondary btn-sm copied\">\n <si-icon class=\"icon\" [icon]=\"icons.elementOk\" />\n {{ labelCopied | translate }}\n </div>\n } @else {\n <button\n type=\"button\"\n class=\"btn btn-tertiary btn-icon btn-sm\"\n [aria-label]=\"labelCopy | translate\"\n (click)=\"copy()\"\n >\n <si-icon class=\"icon\" [icon]=\"icons.elementCopy\" />\n </button>\n }\n </div>\n</div>\n\n@let hl = highlighter();\n@if (hl) {\n <ng-container\n [ngComponentOutlet]=\"hl.component\"\n [ngComponentOutletInputs]=\"{\n code: code(),\n language: language(),\n options: hl.options,\n updateLanguage\n }\"\n />\n} @else {\n <pre class=\"border-0 m-0 p-0\"><code>{{ code() }}</code></pre>\n}\n", dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
148
|
+
}
|
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownCodeComponent, decorators: [{
|
|
150
|
+
type: Component,
|
|
151
|
+
args: [{ selector: 'si-markdown-code', imports: [NgComponentOutlet, SiIconComponent, SiTranslatePipe], host: {
|
|
152
|
+
class: 'd-flex flex-column px-6 py-5 mb-6 border rounded',
|
|
153
|
+
'[attr.data-line]': 'node().position?.start?.line'
|
|
154
|
+
}, template: "<div class=\"d-flex align-items-center mb-6\">\n @let file = filename();\n @if (file) {\n <span class=\"filename border rounded-1 px-1 me-4\">\n <si-icon class=\"icon-sm\" [icon]=\"icons.elementDocument\" />\n {{ file }}\n </span>\n }\n <span class=\"code-language\" [class.text-secondary]=\"file\">\n {{ languageToDisplay() }}\n </span>\n <div class=\"ms-auto\">\n @if (copied()) {\n <div class=\"btn text-secondary btn-sm copied\">\n <si-icon class=\"icon\" [icon]=\"icons.elementOk\" />\n {{ labelCopied | translate }}\n </div>\n } @else {\n <button\n type=\"button\"\n class=\"btn btn-tertiary btn-icon btn-sm\"\n [aria-label]=\"labelCopy | translate\"\n (click)=\"copy()\"\n >\n <si-icon class=\"icon\" [icon]=\"icons.elementCopy\" />\n </button>\n }\n </div>\n</div>\n\n@let hl = highlighter();\n@if (hl) {\n <ng-container\n [ngComponentOutlet]=\"hl.component\"\n [ngComponentOutletInputs]=\"{\n code: code(),\n language: language(),\n options: hl.options,\n updateLanguage\n }\"\n />\n} @else {\n <pre class=\"border-0 m-0 p-0\"><code>{{ code() }}</code></pre>\n}\n" }]
|
|
155
|
+
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], parent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parent", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
156
|
+
|
|
157
|
+
/** Extension to render code blocks. This is always installed automatically. */
|
|
158
|
+
const siMarkdownCode = (options) => {
|
|
159
|
+
return {
|
|
160
|
+
types: [{ type: 'code', component: SiMarkdownCodeComponent, options }]
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
166
|
+
* SPDX-License-Identifier: MIT
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
171
|
+
* SPDX-License-Identifier: MIT
|
|
172
|
+
*/
|
|
173
|
+
class SiMarkdownDirectiveComponent {
|
|
174
|
+
node = input.required(/* @ts-ignore */
|
|
175
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
176
|
+
parent = input.required(/* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [{ debugName: "parent" }] : /* istanbul ignore next */ []));
|
|
178
|
+
options = input(/* @ts-ignore */
|
|
179
|
+
...(ngDevMode ? [undefined, { debugName: "options" }] : /* istanbul ignore next */ []));
|
|
180
|
+
directiveComponent = computed(() => {
|
|
181
|
+
const directive = this.node();
|
|
182
|
+
return this.options()?.get(directive.name)?.component;
|
|
183
|
+
}, /* @ts-ignore */
|
|
184
|
+
...(ngDevMode ? [{ debugName: "directiveComponent" }] : /* istanbul ignore next */ []));
|
|
185
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownDirectiveComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
186
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiMarkdownDirectiveComponent, isStandalone: true, selector: "si-markdown-directive", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
187
|
+
@let component = directiveComponent();
|
|
188
|
+
@if (component) {
|
|
189
|
+
<ng-container
|
|
190
|
+
[ngComponentOutlet]="component"
|
|
191
|
+
[ngComponentOutletInputs]="{ node: node(), parent: parent() }"
|
|
192
|
+
/>
|
|
193
|
+
} @else {
|
|
194
|
+
<div [siMarkdownFragment]="node()"></div>
|
|
195
|
+
}
|
|
196
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: SiMarkdownFragmentComponent, selector: "si-markdown-fragment, [siMarkdownFragment]", inputs: ["siMarkdownFragment"] }] });
|
|
197
|
+
}
|
|
198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownDirectiveComponent, decorators: [{
|
|
199
|
+
type: Component,
|
|
200
|
+
args: [{
|
|
201
|
+
selector: 'si-markdown-directive',
|
|
202
|
+
imports: [NgComponentOutlet, SiMarkdownFragmentComponent],
|
|
203
|
+
template: `
|
|
204
|
+
@let component = directiveComponent();
|
|
205
|
+
@if (component) {
|
|
206
|
+
<ng-container
|
|
207
|
+
[ngComponentOutlet]="component"
|
|
208
|
+
[ngComponentOutletInputs]="{ node: node(), parent: parent() }"
|
|
209
|
+
/>
|
|
210
|
+
} @else {
|
|
211
|
+
<div [siMarkdownFragment]="node()"></div>
|
|
212
|
+
}
|
|
213
|
+
`
|
|
214
|
+
}]
|
|
215
|
+
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], parent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parent", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
216
|
+
|
|
217
|
+
const directiveNodeTypes = ['containerDirective', 'leafDirective', 'textDirective'];
|
|
218
|
+
/** Installs component rendering for directives parsed by `remark-directive`. */
|
|
219
|
+
const siMarkdownDirective = (directives) => ({
|
|
220
|
+
types: directiveNodeTypes.map(type => ({
|
|
221
|
+
type,
|
|
222
|
+
component: SiMarkdownDirectiveComponent,
|
|
223
|
+
options: directives
|
|
224
|
+
}))
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
229
|
+
* SPDX-License-Identifier: MIT
|
|
230
|
+
*/
|
|
231
|
+
class SiMarkdownInlineHtmlComponent {
|
|
232
|
+
sanitizer = inject(DomSanitizer);
|
|
233
|
+
node = input.required(/* @ts-ignore */
|
|
234
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
235
|
+
parent = input.required(/* @ts-ignore */
|
|
236
|
+
...(ngDevMode ? [{ debugName: "parent" }] : /* istanbul ignore next */ []));
|
|
237
|
+
options = input(/* @ts-ignore */
|
|
238
|
+
...(ngDevMode ? [undefined, { debugName: "options" }] : /* istanbul ignore next */ []));
|
|
239
|
+
html = computed(() => this.node().value, /* @ts-ignore */
|
|
240
|
+
...(ngDevMode ? [{ debugName: "html" }] : /* istanbul ignore next */ []));
|
|
241
|
+
sanitized = computed(() => {
|
|
242
|
+
const html = this.html();
|
|
243
|
+
// because those are very common
|
|
244
|
+
if (html === '<br>' || html === '<hr>') {
|
|
245
|
+
return this.sanitizer.bypassSecurityTrustHtml(html);
|
|
246
|
+
}
|
|
247
|
+
return this.sanitizer.sanitize(SecurityContext.HTML, html);
|
|
248
|
+
}, /* @ts-ignore */
|
|
249
|
+
...(ngDevMode ? [{ debugName: "sanitized" }] : /* istanbul ignore next */ []));
|
|
250
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownInlineHtmlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
251
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.8", type: SiMarkdownInlineHtmlComponent, isStandalone: true, selector: "si-markdown-inline-html", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "innerHTML": "sanitized()" } }, ngImport: i0, template: '', isInline: true });
|
|
252
|
+
}
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownInlineHtmlComponent, decorators: [{
|
|
254
|
+
type: Component,
|
|
255
|
+
args: [{
|
|
256
|
+
selector: 'si-markdown-inline-html',
|
|
257
|
+
template: '',
|
|
258
|
+
host: {
|
|
259
|
+
'[innerHTML]': 'sanitized()'
|
|
260
|
+
}
|
|
261
|
+
}]
|
|
262
|
+
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], parent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parent", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
263
|
+
|
|
264
|
+
/** Extension to render sanitized inline HTML. This is always installed automatically. */
|
|
265
|
+
const siMarkdownInlineHtml = () => {
|
|
266
|
+
return {
|
|
267
|
+
types: [{ type: 'html', component: SiMarkdownInlineHtmlComponent }]
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
273
|
+
* SPDX-License-Identifier: MIT
|
|
274
|
+
*/
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
278
|
+
* SPDX-License-Identifier: MIT
|
|
279
|
+
*/
|
|
280
|
+
class SiMarkdownLinkComponent {
|
|
281
|
+
node = input.required(/* @ts-ignore */
|
|
282
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
283
|
+
parent = input.required(/* @ts-ignore */
|
|
284
|
+
...(ngDevMode ? [{ debugName: "parent" }] : /* istanbul ignore next */ []));
|
|
285
|
+
options = input(/* @ts-ignore */
|
|
286
|
+
...(ngDevMode ? [undefined, { debugName: "options" }] : /* istanbul ignore next */ []));
|
|
287
|
+
icons = addIcons({ elementDocument });
|
|
288
|
+
link = computed(() => this.node(), /* @ts-ignore */
|
|
289
|
+
...(ngDevMode ? [{ debugName: "link" }] : /* istanbul ignore next */ []));
|
|
290
|
+
fileUrl = computed(() => {
|
|
291
|
+
try {
|
|
292
|
+
const url = new URL(this.link().url);
|
|
293
|
+
return url.protocol === 'file:' ? url : undefined;
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
}, /* @ts-ignore */
|
|
299
|
+
...(ngDevMode ? [{ debugName: "fileUrl" }] : /* istanbul ignore next */ []));
|
|
300
|
+
isFileLink = computed(() => this.fileUrl() !== undefined, /* @ts-ignore */
|
|
301
|
+
...(ngDevMode ? [{ debugName: "isFileLink" }] : /* istanbul ignore next */ []));
|
|
302
|
+
filename = computed(() => {
|
|
303
|
+
const path = this.fileUrl()?.pathname ?? '';
|
|
304
|
+
return decodeURIComponent(path).split('/').at(-1) ?? '';
|
|
305
|
+
}, /* @ts-ignore */
|
|
306
|
+
...(ngDevMode ? [{ debugName: "filename" }] : /* istanbul ignore next */ []));
|
|
307
|
+
hasLabel = computed(() => this.link().children.length > 0, /* @ts-ignore */
|
|
308
|
+
...(ngDevMode ? [{ debugName: "hasLabel" }] : /* istanbul ignore next */ []));
|
|
309
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownLinkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
310
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiMarkdownLinkComponent, isStandalone: true, selector: "si-markdown-link", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let directLink = link();\n@if (isFileLink()) {\n <a\n class=\"filename border rounded-1 px-1 d-inline-flex align-items-center\"\n [href]=\"directLink.url\"\n [title]=\"directLink.title ?? ''\"\n >\n <si-icon class=\"icon-sm me-1\" [icon]=\"icons.elementDocument\" />\n @if (hasLabel()) {\n <span [siMarkdownFragment]=\"directLink\"></span>\n } @else {\n {{ filename() }}\n }\n </a>\n} @else {\n <a [href]=\"directLink.url\" [title]=\"directLink.title ?? ''\" [siMarkdownFragment]=\"directLink\"></a>\n}\n", styles: [":host{vertical-align:middle}\n"], dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiMarkdownFragmentComponent, selector: "si-markdown-fragment, [siMarkdownFragment]", inputs: ["siMarkdownFragment"] }] });
|
|
311
|
+
}
|
|
312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownLinkComponent, decorators: [{
|
|
313
|
+
type: Component,
|
|
314
|
+
args: [{ selector: 'si-markdown-link', imports: [SiIconComponent, SiMarkdownFragmentComponent], template: "@let directLink = link();\n@if (isFileLink()) {\n <a\n class=\"filename border rounded-1 px-1 d-inline-flex align-items-center\"\n [href]=\"directLink.url\"\n [title]=\"directLink.title ?? ''\"\n >\n <si-icon class=\"icon-sm me-1\" [icon]=\"icons.elementDocument\" />\n @if (hasLabel()) {\n <span [siMarkdownFragment]=\"directLink\"></span>\n } @else {\n {{ filename() }}\n }\n </a>\n} @else {\n <a [href]=\"directLink.url\" [title]=\"directLink.title ?? ''\" [siMarkdownFragment]=\"directLink\"></a>\n}\n", styles: [":host{vertical-align:middle}\n"] }]
|
|
315
|
+
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], parent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parent", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
316
|
+
|
|
317
|
+
/** Extension to render markdown links. This is always installed automatically. */
|
|
318
|
+
const siMarkdownLink = () => {
|
|
319
|
+
return {
|
|
320
|
+
types: [{ type: 'link', component: SiMarkdownLinkComponent }]
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
326
|
+
* SPDX-License-Identifier: MIT
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
331
|
+
* SPDX-License-Identifier: MIT
|
|
332
|
+
*/
|
|
333
|
+
class SiMarkdownTableComponent {
|
|
334
|
+
node = input.required(/* @ts-ignore */
|
|
335
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
336
|
+
parent = input.required(/* @ts-ignore */
|
|
337
|
+
...(ngDevMode ? [{ debugName: "parent" }] : /* istanbul ignore next */ []));
|
|
338
|
+
options = input(/* @ts-ignore */
|
|
339
|
+
...(ngDevMode ? [undefined, { debugName: "options" }] : /* istanbul ignore next */ []));
|
|
340
|
+
icons = addIcons({ elementCopy, elementDownload, elementOk });
|
|
341
|
+
labelCopy = t(() => $localize `:@@SI_MARKDOWN.COPY_TABLE_AS_CSV:Copy table as CSV`);
|
|
342
|
+
labelCopied = t(() => $localize `:@@SI_MARKDOWN.COPIED_CODE:Copied`);
|
|
343
|
+
labelDownload = t(() => $localize `:@@SI_MARKDOWN.DOWNLOAD_TABLE_AS_CSV:Download table as CSV`);
|
|
344
|
+
table = computed(() => this.node(), /* @ts-ignore */
|
|
345
|
+
...(ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []));
|
|
346
|
+
copied = signal(false, /* @ts-ignore */
|
|
347
|
+
...(ngDevMode ? [{ debugName: "copied" }] : /* istanbul ignore next */ []));
|
|
348
|
+
tableElement = viewChild.required('renderedTable', /* @ts-ignore */
|
|
349
|
+
...(ngDevMode ? [{ debugName: "tableElement" }] : /* istanbul ignore next */ []));
|
|
350
|
+
copyTimeout;
|
|
351
|
+
ngOnDestroy() {
|
|
352
|
+
clearTimeout(this.copyTimeout);
|
|
353
|
+
}
|
|
354
|
+
async copy() {
|
|
355
|
+
await navigator.clipboard.writeText(this.csv());
|
|
356
|
+
this.copied.set(true);
|
|
357
|
+
this.copyTimeout = setTimeout(() => this.copied.set(false), 1500);
|
|
358
|
+
}
|
|
359
|
+
download() {
|
|
360
|
+
const blob = new Blob([this.csv()], { type: 'text/csv;charset=utf-8' });
|
|
361
|
+
const url = URL.createObjectURL(blob);
|
|
362
|
+
const link = document.createElement('a');
|
|
363
|
+
link.href = url;
|
|
364
|
+
link.download = 'table.csv';
|
|
365
|
+
link.click();
|
|
366
|
+
URL.revokeObjectURL(url);
|
|
367
|
+
}
|
|
368
|
+
csv() {
|
|
369
|
+
return Array.from(this.tableElement().nativeElement.rows, row => Array.from(row.cells, cell => this.escapeCsvField(cell.innerText.trim())).join(',')).join('\r\n');
|
|
370
|
+
}
|
|
371
|
+
escapeCsvField(value) {
|
|
372
|
+
return /[",\r\n]/.test(value) ? `"${value.replaceAll('"', '""')}"` : value;
|
|
373
|
+
}
|
|
374
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
375
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiMarkdownTableComponent, isStandalone: true, selector: "si-markdown-table", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, parent: { classPropertyName: "parent", publicName: "parent", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "tableElement", first: true, predicate: ["renderedTable"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"markdown-table-container mb-6\">\n <div class=\"markdown-table-wrapper\">\n <table\n #renderedTable\n class=\"markdown-table table mb-0\"\n [attr.data-line]=\"table().position?.start?.line\"\n >\n <thead>\n <tr>\n @for (cell of table().children[0].children; track $index) {\n <th [siMarkdownFragment]=\"cell\" [style.text-align]=\"table().align?.[$index]\"></th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of table().children.slice(1); track $index) {\n <tr [attr.data-line]=\"row.position?.start?.line\">\n @for (cell of row.children; track $index; let cellIndex = $index) {\n <td [siMarkdownFragment]=\"cell\" [style.text-align]=\"table().align?.[cellIndex]\"></td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n <div class=\"markdown-table-actions d-flex justify-content-end gap-2 mt-2\">\n @if (copied()) {\n <div class=\"btn text-secondary btn-sm copied\">\n <si-icon class=\"icon\" [icon]=\"icons.elementOk\" />\n {{ labelCopied | translate }}\n </div>\n } @else {\n <button\n type=\"button\"\n class=\"btn btn-tertiary btn-icon btn-sm\"\n [aria-label]=\"labelCopy | translate\"\n (click)=\"copy()\"\n >\n <si-icon class=\"icon\" [icon]=\"icons.elementCopy\" />\n </button>\n }\n <button\n type=\"button\"\n class=\"btn btn-tertiary btn-icon btn-sm\"\n [aria-label]=\"labelDownload | translate\"\n (click)=\"download()\"\n >\n <si-icon class=\"icon\" [icon]=\"icons.elementDownload\" />\n </button>\n </div>\n</div>\n", styles: [":host{display:block;max-inline-size:100%;min-inline-size:0}.markdown-table-container{inline-size:fit-content;max-inline-size:100%}.markdown-table-wrapper{max-inline-size:100%;overflow-x:auto}\n"], dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiMarkdownFragmentComponent, selector: "si-markdown-fragment, [siMarkdownFragment]", inputs: ["siMarkdownFragment"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
376
|
+
}
|
|
377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownTableComponent, decorators: [{
|
|
378
|
+
type: Component,
|
|
379
|
+
args: [{ selector: 'si-markdown-table', imports: [SiIconComponent, SiMarkdownFragmentComponent, SiTranslatePipe], template: "<div class=\"markdown-table-container mb-6\">\n <div class=\"markdown-table-wrapper\">\n <table\n #renderedTable\n class=\"markdown-table table mb-0\"\n [attr.data-line]=\"table().position?.start?.line\"\n >\n <thead>\n <tr>\n @for (cell of table().children[0].children; track $index) {\n <th [siMarkdownFragment]=\"cell\" [style.text-align]=\"table().align?.[$index]\"></th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of table().children.slice(1); track $index) {\n <tr [attr.data-line]=\"row.position?.start?.line\">\n @for (cell of row.children; track $index; let cellIndex = $index) {\n <td [siMarkdownFragment]=\"cell\" [style.text-align]=\"table().align?.[cellIndex]\"></td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n <div class=\"markdown-table-actions d-flex justify-content-end gap-2 mt-2\">\n @if (copied()) {\n <div class=\"btn text-secondary btn-sm copied\">\n <si-icon class=\"icon\" [icon]=\"icons.elementOk\" />\n {{ labelCopied | translate }}\n </div>\n } @else {\n <button\n type=\"button\"\n class=\"btn btn-tertiary btn-icon btn-sm\"\n [aria-label]=\"labelCopy | translate\"\n (click)=\"copy()\"\n >\n <si-icon class=\"icon\" [icon]=\"icons.elementCopy\" />\n </button>\n }\n <button\n type=\"button\"\n class=\"btn btn-tertiary btn-icon btn-sm\"\n [aria-label]=\"labelDownload | translate\"\n (click)=\"download()\"\n >\n <si-icon class=\"icon\" [icon]=\"icons.elementDownload\" />\n </button>\n </div>\n</div>\n", styles: [":host{display:block;max-inline-size:100%;min-inline-size:0}.markdown-table-container{inline-size:fit-content;max-inline-size:100%}.markdown-table-wrapper{max-inline-size:100%;overflow-x:auto}\n"] }]
|
|
380
|
+
}], propDecorators: { node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], parent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parent", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], tableElement: [{ type: i0.ViewChild, args: ['renderedTable', { isSignal: true }] }] } });
|
|
381
|
+
|
|
382
|
+
/** Extension to render markdown tables. This is always installed automatically. */
|
|
383
|
+
const siMarkdownTable = () => {
|
|
384
|
+
return {
|
|
385
|
+
types: [{ type: 'table', component: SiMarkdownTableComponent }]
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
391
|
+
* SPDX-License-Identifier: MIT
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
const githubAdmonitionPattern = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\][ \t]*(?:\r?\n|$)/;
|
|
395
|
+
/** Turns GitHub style admonitions into a callout directive */
|
|
396
|
+
const toCalloutDirective = (node) => {
|
|
397
|
+
const firstChild = node.children[0];
|
|
398
|
+
if (firstChild?.type !== 'paragraph') {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
const firstText = firstChild.children[0];
|
|
402
|
+
if (firstText?.type !== 'text') {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const match = githubAdmonitionPattern.exec(firstText.value);
|
|
406
|
+
if (!match) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
firstText.value = firstText.value.slice(match[0].length);
|
|
410
|
+
if (!firstText.value) {
|
|
411
|
+
firstChild.children.shift();
|
|
412
|
+
}
|
|
413
|
+
if (!firstChild.children.length) {
|
|
414
|
+
node.children.shift();
|
|
415
|
+
}
|
|
416
|
+
Object.assign(node, {
|
|
417
|
+
type: 'containerDirective',
|
|
418
|
+
name: 'callout',
|
|
419
|
+
attributes: { type: match[1].toLowerCase() }
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
/** Moves footnote definitions into a single root-level container. */
|
|
423
|
+
const siMarkdownPostprocess = () => tree => {
|
|
424
|
+
const footnoteReferences = [];
|
|
425
|
+
const footnoteDefinitions = [];
|
|
426
|
+
const footnoteDefinitionsMap = new Map();
|
|
427
|
+
const definitionsMap = new Map();
|
|
428
|
+
const collect = (parent) => {
|
|
429
|
+
for (let index = 0; index < parent.children.length; index++) {
|
|
430
|
+
const child = parent.children[index];
|
|
431
|
+
if (child.type === 'blockquote') {
|
|
432
|
+
toCalloutDirective(child);
|
|
433
|
+
}
|
|
434
|
+
if (child.type === 'footnoteReference') {
|
|
435
|
+
footnoteReferences.push(child);
|
|
436
|
+
}
|
|
437
|
+
else if (child.type === 'footnoteDefinition') {
|
|
438
|
+
footnoteDefinitions.push(child);
|
|
439
|
+
footnoteDefinitionsMap.set(child.identifier, child);
|
|
440
|
+
parent.children.splice(index, 1);
|
|
441
|
+
index--;
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
else if (child.type === 'definition') {
|
|
445
|
+
definitionsMap.set(child.identifier, child);
|
|
446
|
+
parent.children.splice(index, 1);
|
|
447
|
+
index--;
|
|
448
|
+
}
|
|
449
|
+
if ('children' in child) {
|
|
450
|
+
collect(child);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
collect(tree);
|
|
455
|
+
// Footnotes are always numbered
|
|
456
|
+
for (let index = 0; index < footnoteDefinitions.length; index++) {
|
|
457
|
+
const footnoteDefinition = footnoteDefinitions[index];
|
|
458
|
+
footnoteDefinition.label = `${index + 1}`;
|
|
459
|
+
}
|
|
460
|
+
// updated all references
|
|
461
|
+
for (const reference of footnoteReferences) {
|
|
462
|
+
const footnoteDefinition = footnoteDefinitionsMap.get(reference.identifier);
|
|
463
|
+
if (footnoteDefinition) {
|
|
464
|
+
reference.label = footnoteDefinition.label;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
const root = {
|
|
468
|
+
...tree,
|
|
469
|
+
references: {
|
|
470
|
+
footnoteDefinitions: footnoteDefinitionsMap,
|
|
471
|
+
definitions: definitionsMap
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
if (footnoteDefinitions.length) {
|
|
475
|
+
root.children.push({ type: 'footnotes', children: footnoteDefinitions });
|
|
476
|
+
}
|
|
477
|
+
return root;
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Options for the markdown renderer. This holds all configuration and allows installing
|
|
482
|
+
* extensions. A number of extensions are already ready to use and shipped with Element.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* import { siMarkdownMathKaTeX } from '@siemens/element-ng/markdown/extensions/math';
|
|
487
|
+
* import remarkGemoji from 'remark-gemoji';
|
|
488
|
+
*
|
|
489
|
+
* protected markdownOptions = new SiMarkdownOptions()
|
|
490
|
+
* .installExtension(siMarkdownMathKaTeX())
|
|
491
|
+
* .installUnifiedPlugin(remarkGemoji);
|
|
492
|
+
* ```
|
|
493
|
+
*
|
|
494
|
+
* ```html
|
|
495
|
+
* <si-markdown [markdown]="markdownText()" [options]="markdownOptions" />
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
class SiMarkdownOptions {
|
|
499
|
+
plugins = [];
|
|
500
|
+
types = [];
|
|
501
|
+
codeTypes = new Map();
|
|
502
|
+
directives = new Map();
|
|
503
|
+
highlighter;
|
|
504
|
+
constructor() {
|
|
505
|
+
this.installExtension(siMarkdownInlineHtml())
|
|
506
|
+
.installExtension(siMarkdownLink())
|
|
507
|
+
.installExtension(siMarkdownTable())
|
|
508
|
+
.installExtension(siMarkdownCode({ getHighlighter: () => this.getHighlighter() }))
|
|
509
|
+
.installExtension(siMarkdownDirective(this.directives))
|
|
510
|
+
.registerDirective(siMarkdownCalloutDirective());
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Installs a plugin into the `unified` chain
|
|
514
|
+
* @param plugin - The `unified` plugin
|
|
515
|
+
* @param options - Options for the plugin
|
|
516
|
+
* @returns self for chaining
|
|
517
|
+
*/
|
|
518
|
+
installUnifiedPlugin(plugin, options) {
|
|
519
|
+
this.plugins.push({ plugin, options });
|
|
520
|
+
return this;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Registers a component used to render a named Markdown directive.
|
|
524
|
+
* @param directive - The directive with name and handling component
|
|
525
|
+
* @returns self for chaining
|
|
526
|
+
*/
|
|
527
|
+
registerDirective(directives) {
|
|
528
|
+
if (!Array.isArray(directives)) {
|
|
529
|
+
directives = [directives];
|
|
530
|
+
}
|
|
531
|
+
for (const directive of directives) {
|
|
532
|
+
this.directives.set(directive.type, directive);
|
|
533
|
+
}
|
|
534
|
+
return this;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Installs a extension which can contain plugins, type handlers
|
|
538
|
+
* @param extension - The extension definition
|
|
539
|
+
* @returns self for chaining
|
|
540
|
+
*/
|
|
541
|
+
installExtension(extension) {
|
|
542
|
+
if (extension.plugins) {
|
|
543
|
+
this.plugins.push(...extension.plugins);
|
|
544
|
+
}
|
|
545
|
+
if (extension.types) {
|
|
546
|
+
this.types.push(...extension.types);
|
|
547
|
+
}
|
|
548
|
+
if (extension.codeTypes) {
|
|
549
|
+
for (const ct of extension.codeTypes) {
|
|
550
|
+
this.codeTypes.set(ct.type, ct);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (extension.directives) {
|
|
554
|
+
this.registerDirective(extension.directives);
|
|
555
|
+
}
|
|
556
|
+
return this;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Sets the code highlighter
|
|
560
|
+
* @param highlighter - The highlighter
|
|
561
|
+
*/
|
|
562
|
+
setCodeHighlighter(highlighter) {
|
|
563
|
+
this.highlighter = highlighter;
|
|
564
|
+
return this;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Creates the `unified` processor with all plugins and options
|
|
568
|
+
* @returns `unified` processor
|
|
569
|
+
*/
|
|
570
|
+
makeProcessor(meta) {
|
|
571
|
+
const processor = unified().use(remarkParse).use(remarkGfm).use(remarkDirective);
|
|
572
|
+
for (const p of this.plugins) {
|
|
573
|
+
const options = typeof p.options === 'function' ? p.options(meta) : p.options;
|
|
574
|
+
processor.use(p.plugin, options);
|
|
575
|
+
}
|
|
576
|
+
return processor.use(siMarkdownPostprocess);
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* @returns All type handlers
|
|
580
|
+
*/
|
|
581
|
+
getTypeHandlers() {
|
|
582
|
+
return this.types;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* @returns All code type handlers
|
|
586
|
+
*/
|
|
587
|
+
getCodeTypeHandlers() {
|
|
588
|
+
return this.codeTypes;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* @returns The highlighter
|
|
592
|
+
*/
|
|
593
|
+
getHighlighter() {
|
|
594
|
+
return this.highlighter;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const makeSiMarkdownOptions = () => new SiMarkdownOptions();
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
601
|
+
* SPDX-License-Identifier: MIT
|
|
602
|
+
*/
|
|
603
|
+
/** Directive used to mark a template as a node type for rendering. */
|
|
604
|
+
class SiMarkdownTemplateDirective {
|
|
605
|
+
template = inject(TemplateRef);
|
|
606
|
+
// this should be required, but in some transitional state in the templates computed, this fails
|
|
607
|
+
/** @defaultValue '#dummy' */
|
|
608
|
+
nodeType = input('#dummy', { ...(ngDevMode ? { debugName: "nodeType" } : /* istanbul ignore next */ {}), alias: 'siMarkdownTemplate' });
|
|
609
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
610
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiMarkdownTemplateDirective, isStandalone: true, selector: "[siMarkdownTemplate]", inputs: { nodeType: { classPropertyName: "nodeType", publicName: "siMarkdownTemplate", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
611
|
+
}
|
|
612
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownTemplateDirective, decorators: [{
|
|
613
|
+
type: Directive,
|
|
614
|
+
args: [{
|
|
615
|
+
selector: '[siMarkdownTemplate]'
|
|
616
|
+
}]
|
|
617
|
+
}], propDecorators: { nodeType: [{ type: i0.Input, args: [{ isSignal: true, alias: "siMarkdownTemplate", required: false }] }] } });
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
621
|
+
* SPDX-License-Identifier: MIT
|
|
622
|
+
*/
|
|
623
|
+
/**
|
|
624
|
+
* Computed value, but async. This exists because the `resource()` API is not suitable. During
|
|
625
|
+
* loading, the value changes to `undefined`. The proposed solution of resource snapshots and
|
|
626
|
+
* a `withPreviousValue()` function that uses `resourceFromSnapshots()` isn't suitable either
|
|
627
|
+
* because it's experimental.
|
|
628
|
+
*
|
|
629
|
+
* @param options - the options
|
|
630
|
+
* @returns readonly signal
|
|
631
|
+
*/
|
|
632
|
+
const computedAsync = (options) => {
|
|
633
|
+
const resultSignal = signal(options.initial, /* @ts-ignore */
|
|
634
|
+
...(ngDevMode ? [{ debugName: "resultSignal" }] : /* istanbul ignore next */ []));
|
|
635
|
+
effect(async (onCleanup) => {
|
|
636
|
+
const params = options.params();
|
|
637
|
+
let destroyed = false;
|
|
638
|
+
untracked(async () => {
|
|
639
|
+
const result = await options.computation(params);
|
|
640
|
+
if (!destroyed) {
|
|
641
|
+
resultSignal.set(result);
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
onCleanup(() => (destroyed = true));
|
|
645
|
+
});
|
|
646
|
+
return resultSignal.asReadonly();
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* A readonly throttled version of a signal. Emits at most every `interval` milliseconds
|
|
650
|
+
* @param source - the source signal
|
|
651
|
+
* @param interval - the interval
|
|
652
|
+
* @param immediatelyEmitFirstChange - immediately emit the first change
|
|
653
|
+
* @returns A readonly signal
|
|
654
|
+
*/
|
|
655
|
+
const throttledSignal = (source, interval, immediatelyEmitFirstChange = true) => {
|
|
656
|
+
const resultSignal = signal(source(), /* @ts-ignore */
|
|
657
|
+
...(ngDevMode ? [{ debugName: "resultSignal" }] : /* istanbul ignore next */ []));
|
|
658
|
+
let lastEmitted = 0;
|
|
659
|
+
let timer = null;
|
|
660
|
+
let firstChangeSeen = false;
|
|
661
|
+
effect(onCleanup => {
|
|
662
|
+
const value = source();
|
|
663
|
+
const now = Date.now();
|
|
664
|
+
if (!firstChangeSeen && immediatelyEmitFirstChange) {
|
|
665
|
+
firstChangeSeen = true;
|
|
666
|
+
resultSignal.set(value);
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
if (now - lastEmitted >= interval) {
|
|
670
|
+
resultSignal.set(value);
|
|
671
|
+
lastEmitted = now;
|
|
672
|
+
if (timer) {
|
|
673
|
+
clearTimeout(timer);
|
|
674
|
+
timer = null;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
timer ??= setTimeout(() => {
|
|
679
|
+
resultSignal.set(source());
|
|
680
|
+
lastEmitted = Date.now();
|
|
681
|
+
timer = null;
|
|
682
|
+
}, interval - (now - lastEmitted));
|
|
683
|
+
}
|
|
684
|
+
onCleanup(() => {
|
|
685
|
+
if (timer) {
|
|
686
|
+
clearTimeout(timer);
|
|
687
|
+
timer = null;
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
});
|
|
691
|
+
return resultSignal.asReadonly();
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
696
|
+
* SPDX-License-Identifier: MIT
|
|
697
|
+
*/
|
|
698
|
+
/**
|
|
699
|
+
* Component to display markdown text
|
|
700
|
+
*
|
|
701
|
+
* This component is built using concepts from [ngx-remark](https://github.com/ericleib/ngx-remark),
|
|
702
|
+
* namely using Angular templates to render the AST produced by `remark`.
|
|
703
|
+
*
|
|
704
|
+
* Unlike `ngx-remark`, it features a configuration based approach of extensibility so that multiple
|
|
705
|
+
* instances of the component can be used with the same configuration, e.g. inside a chat component
|
|
706
|
+
* w/o repeating templates.
|
|
707
|
+
*
|
|
708
|
+
* @experimental
|
|
709
|
+
*/
|
|
710
|
+
class SiMarkdownComponent {
|
|
711
|
+
static idCounter = 1;
|
|
712
|
+
/**
|
|
713
|
+
* The markdown text to transform and display
|
|
714
|
+
* @defaultValue ''
|
|
715
|
+
*/
|
|
716
|
+
markdown = input('', /* @ts-ignore */
|
|
717
|
+
...(ngDevMode ? [{ debugName: "markdown" }] : /* istanbul ignore next */ []));
|
|
718
|
+
/**
|
|
719
|
+
* Options to control rendering. Can be shared across multiple instances.
|
|
720
|
+
*/
|
|
721
|
+
options = input(/* @ts-ignore */
|
|
722
|
+
...(ngDevMode ? [undefined, { debugName: "options" }] : /* istanbul ignore next */ []));
|
|
723
|
+
/** Citation metadata used to create citations. */
|
|
724
|
+
citations = input(/* @ts-ignore */
|
|
725
|
+
...(ngDevMode ? [undefined, { debugName: "citations" }] : /* istanbul ignore next */ []));
|
|
726
|
+
/**
|
|
727
|
+
* Debug mode. When true, unknown node types will be displayed along with the node
|
|
728
|
+
* as JSON.
|
|
729
|
+
* @defaultValue false
|
|
730
|
+
*/
|
|
731
|
+
debug = input(false, { ...(ngDevMode ? { debugName: "debug" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
732
|
+
/** Emitted by extension components. */
|
|
733
|
+
extensionEvent = output();
|
|
734
|
+
baseId = `__si-markdown-${SiMarkdownComponent.idCounter++}`;
|
|
735
|
+
parsed = throttledSignal(computedAsync({
|
|
736
|
+
params: () => ({ markdown: this.markdown(), processor: this.config().processor }),
|
|
737
|
+
computation: params => this.parseMarkdown(params.markdown, params.processor),
|
|
738
|
+
initial: undefined
|
|
739
|
+
}), 50);
|
|
740
|
+
templateQuery = viewChildren(SiMarkdownTemplateDirective, /* @ts-ignore */
|
|
741
|
+
...(ngDevMode ? [{ debugName: "templateQuery" }] : /* istanbul ignore next */ []));
|
|
742
|
+
customTemplateQuery = contentChildren(SiMarkdownTemplateDirective, /* @ts-ignore */
|
|
743
|
+
...(ngDevMode ? [{ debugName: "customTemplateQuery" }] : /* istanbul ignore next */ []));
|
|
744
|
+
/** @internal */
|
|
745
|
+
templates = computed(() => {
|
|
746
|
+
const map = new Map();
|
|
747
|
+
for (const template of this.templateQuery()) {
|
|
748
|
+
map.set(template.nodeType(), template.template);
|
|
749
|
+
}
|
|
750
|
+
for (const template of this.customTemplateQuery()) {
|
|
751
|
+
map.set(template.nodeType(), template.template);
|
|
752
|
+
}
|
|
753
|
+
return map;
|
|
754
|
+
}, /* @ts-ignore */
|
|
755
|
+
...(ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []));
|
|
756
|
+
/** Gives access to metadata in extension components */
|
|
757
|
+
meta = computed(() => ({ citations: this.citations() }), /* @ts-ignore */
|
|
758
|
+
...(ngDevMode ? [{ debugName: "meta" }] : /* istanbul ignore next */ []));
|
|
759
|
+
actualOptions = computed(() => this.options() ?? new SiMarkdownOptions(), /* @ts-ignore */
|
|
760
|
+
...(ngDevMode ? [{ debugName: "actualOptions" }] : /* istanbul ignore next */ []));
|
|
761
|
+
config = computed(() => {
|
|
762
|
+
const options = this.actualOptions();
|
|
763
|
+
return {
|
|
764
|
+
processor: options.makeProcessor(this.meta()),
|
|
765
|
+
typeHandlers: options.getTypeHandlers(),
|
|
766
|
+
codeTypeHandlers: options.getCodeTypeHandlers()
|
|
767
|
+
};
|
|
768
|
+
}, /* @ts-ignore */
|
|
769
|
+
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
770
|
+
async parseMarkdown(md, processor) {
|
|
771
|
+
if (!md) {
|
|
772
|
+
return undefined;
|
|
773
|
+
}
|
|
774
|
+
const parsed = processor.parse(md);
|
|
775
|
+
return await processor.run(parsed);
|
|
776
|
+
}
|
|
777
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
778
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiMarkdownComponent, isStandalone: true, selector: "si-markdown", inputs: { markdown: { classPropertyName: "markdown", publicName: "markdown", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, citations: { classPropertyName: "citations", publicName: "citations", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { extensionEvent: "extensionEvent" }, providers: [{ provide: SI_MARKDOWN_CONTROL, useExisting: SiMarkdownComponent }], queries: [{ propertyName: "customTemplateQuery", predicate: SiMarkdownTemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "templateQuery", predicate: SiMarkdownTemplateDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/attributes-order -->\n\n@let ast = parsed();\n@if (ast) {\n <si-markdown-fragment [siMarkdownFragment]=\"ast\" />\n}\n\n<ng-template siMarkdownTemplate=\"heading\" let-node>\n <div\n role=\"heading\"\n [aria-level]=\"node.depth\"\n [class]=\"`h${node.depth}`\"\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"node\"\n ></div>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"paragraph\" let-node>\n <p [attr.data-line]=\"node?.position?.start.line\" [siMarkdownFragment]=\"node\"></p>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"blockquote\" let-node>\n <blockquote\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"node\"\n ></blockquote>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"list\" let-node>\n @if (node.ordered) {\n <ol\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"node\"\n [start]=\"node.start\"\n ></ol>\n } @else {\n <ul [attr.data-line]=\"node?.position?.start.line\" [siMarkdownFragment]=\"node\"></ul>\n }\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"listItem\" let-node let-parent=\"parent\">\n @if (node.checked !== null) {\n <li class=\"task-list-item\" [attr.data-line]=\"node?.position?.start.line\">\n <label\n [siMarkdownFragment]=\"\n !parent.loose && node.children.length === 1 && node.children[0].children\n ? node.children[0]\n : node\n \"\n >\n <input\n type=\"checkbox\"\n class=\"form-check-input\"\n tabindex=\"-1\"\n aria-disabled=\"true\"\n [checked]=\"node.checked\"\n />\n </label>\n </li>\n } @else {\n <li\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"\n !parent.loose && node.children.length === 1 && node.children[0].children\n ? node.children[0]\n : node\n \"\n ></li>\n }\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"linkReference\" let-node>\n @let def = ast?.references?.definitions?.get(node.identifier);\n @if (def) {\n <a [href]=\"def.url\" [title]=\"def.title ?? ''\">{{ def.label }}</a>\n }\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"emphasis\" let-node>\n <em [siMarkdownFragment]=\"node\"></em>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"strong\" let-node>\n <strong [siMarkdownFragment]=\"node\"></strong>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"delete\" let-node>\n <del [siMarkdownFragment]=\"node\"></del>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"text\" let-node>\n <span>{{ node.value }}</span>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"image\" let-node>\n <img [src]=\"node.url\" [alt]=\"node.alt ?? ''\" [title]=\"node.title ?? ''\" />\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"imageReference\" let-node>\n @let def = ast?.references?.definitions?.get(node.identifier);\n @if (def) {\n <img [src]=\"def.url\" [alt]=\"node.alt ?? ''\" [title]=\"def.title ?? ''\" />\n }\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"thematicBreak\" let-node>\n <hr [attr.data-line]=\"node?.position?.start.line\" />\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"break\">\n <br />\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"footnotes\" let-node>\n <hr />\n <ol\n class=\"footnotes\"\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"node\"\n ></ol>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"footnoteReference\" let-node>\n <sup class=\"footnote-ref\">\n <a [href]=\"`#${baseId}:fn:${node.identifier}`\">{{ node.label }}</a>\n </sup>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"footnoteDefinition\" let-node>\n <li\n class=\"footnote-def\"\n [attr.data-line]=\"node?.position?.start.line\"\n [id]=\"`${baseId}:fn:${node.identifier}`\"\n [siMarkdownFragment]=\"node\"\n ></li>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"inlineCode\" let-node>\n <code [class]=\"`language-${node.lang || 'plain'}`\">{{ node.value }}</code>\n</ng-template>\n\n@let conf = config();\n@let codeTypes = conf.codeTypeHandlers;\n@for (handler of conf.typeHandlers; track handler.type) {\n <ng-template [siMarkdownTemplate]=\"handler.type\" let-node let-parent=\"parent\">\n @if (handler.type === 'code' && codeTypes.has(node.lang)) {\n @let specialHandler = codeTypes.get(node.lang)!;\n <ng-container\n [ngComponentOutlet]=\"specialHandler.component\"\n [ngComponentOutletInputs]=\"{ node, parent, options: specialHandler.options }\"\n />\n } @else {\n <ng-container\n [ngComponentOutlet]=\"handler.component\"\n [ngComponentOutletInputs]=\"{ node, parent, options: handler.options }\"\n />\n }\n </ng-template>\n}\n\n<ng-template siMarkdownTemplate=\"__default-template\" let-node>\n @if (debug()) {\n <div class=\"markdown-unkown-node-type text-danger\">\n Node type not implemented: <b>{{ node.type }}</b>\n <pre class=\"mt-1\">{{ node | json }}</pre>\n </div>\n }\n</ng-template>\n", styles: [":host{display:block;max-inline-size:100%;min-inline-size:0}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: SiMarkdownTemplateDirective, selector: "[siMarkdownTemplate]", inputs: ["siMarkdownTemplate"] }, { kind: "component", type: SiMarkdownFragmentComponent, selector: "si-markdown-fragment, [siMarkdownFragment]", inputs: ["siMarkdownFragment"] }, { kind: "pipe", type: JsonPipe, name: "json" }] });
|
|
779
|
+
}
|
|
780
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiMarkdownComponent, decorators: [{
|
|
781
|
+
type: Component,
|
|
782
|
+
args: [{ selector: 'si-markdown', imports: [NgComponentOutlet, SiMarkdownTemplateDirective, SiMarkdownFragmentComponent, JsonPipe], providers: [{ provide: SI_MARKDOWN_CONTROL, useExisting: SiMarkdownComponent }], template: "<!-- eslint-disable @angular-eslint/template/attributes-order -->\n\n@let ast = parsed();\n@if (ast) {\n <si-markdown-fragment [siMarkdownFragment]=\"ast\" />\n}\n\n<ng-template siMarkdownTemplate=\"heading\" let-node>\n <div\n role=\"heading\"\n [aria-level]=\"node.depth\"\n [class]=\"`h${node.depth}`\"\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"node\"\n ></div>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"paragraph\" let-node>\n <p [attr.data-line]=\"node?.position?.start.line\" [siMarkdownFragment]=\"node\"></p>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"blockquote\" let-node>\n <blockquote\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"node\"\n ></blockquote>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"list\" let-node>\n @if (node.ordered) {\n <ol\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"node\"\n [start]=\"node.start\"\n ></ol>\n } @else {\n <ul [attr.data-line]=\"node?.position?.start.line\" [siMarkdownFragment]=\"node\"></ul>\n }\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"listItem\" let-node let-parent=\"parent\">\n @if (node.checked !== null) {\n <li class=\"task-list-item\" [attr.data-line]=\"node?.position?.start.line\">\n <label\n [siMarkdownFragment]=\"\n !parent.loose && node.children.length === 1 && node.children[0].children\n ? node.children[0]\n : node\n \"\n >\n <input\n type=\"checkbox\"\n class=\"form-check-input\"\n tabindex=\"-1\"\n aria-disabled=\"true\"\n [checked]=\"node.checked\"\n />\n </label>\n </li>\n } @else {\n <li\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"\n !parent.loose && node.children.length === 1 && node.children[0].children\n ? node.children[0]\n : node\n \"\n ></li>\n }\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"linkReference\" let-node>\n @let def = ast?.references?.definitions?.get(node.identifier);\n @if (def) {\n <a [href]=\"def.url\" [title]=\"def.title ?? ''\">{{ def.label }}</a>\n }\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"emphasis\" let-node>\n <em [siMarkdownFragment]=\"node\"></em>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"strong\" let-node>\n <strong [siMarkdownFragment]=\"node\"></strong>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"delete\" let-node>\n <del [siMarkdownFragment]=\"node\"></del>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"text\" let-node>\n <span>{{ node.value }}</span>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"image\" let-node>\n <img [src]=\"node.url\" [alt]=\"node.alt ?? ''\" [title]=\"node.title ?? ''\" />\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"imageReference\" let-node>\n @let def = ast?.references?.definitions?.get(node.identifier);\n @if (def) {\n <img [src]=\"def.url\" [alt]=\"node.alt ?? ''\" [title]=\"def.title ?? ''\" />\n }\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"thematicBreak\" let-node>\n <hr [attr.data-line]=\"node?.position?.start.line\" />\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"break\">\n <br />\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"footnotes\" let-node>\n <hr />\n <ol\n class=\"footnotes\"\n [attr.data-line]=\"node?.position?.start.line\"\n [siMarkdownFragment]=\"node\"\n ></ol>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"footnoteReference\" let-node>\n <sup class=\"footnote-ref\">\n <a [href]=\"`#${baseId}:fn:${node.identifier}`\">{{ node.label }}</a>\n </sup>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"footnoteDefinition\" let-node>\n <li\n class=\"footnote-def\"\n [attr.data-line]=\"node?.position?.start.line\"\n [id]=\"`${baseId}:fn:${node.identifier}`\"\n [siMarkdownFragment]=\"node\"\n ></li>\n</ng-template>\n\n<ng-template siMarkdownTemplate=\"inlineCode\" let-node>\n <code [class]=\"`language-${node.lang || 'plain'}`\">{{ node.value }}</code>\n</ng-template>\n\n@let conf = config();\n@let codeTypes = conf.codeTypeHandlers;\n@for (handler of conf.typeHandlers; track handler.type) {\n <ng-template [siMarkdownTemplate]=\"handler.type\" let-node let-parent=\"parent\">\n @if (handler.type === 'code' && codeTypes.has(node.lang)) {\n @let specialHandler = codeTypes.get(node.lang)!;\n <ng-container\n [ngComponentOutlet]=\"specialHandler.component\"\n [ngComponentOutletInputs]=\"{ node, parent, options: specialHandler.options }\"\n />\n } @else {\n <ng-container\n [ngComponentOutlet]=\"handler.component\"\n [ngComponentOutletInputs]=\"{ node, parent, options: handler.options }\"\n />\n }\n </ng-template>\n}\n\n<ng-template siMarkdownTemplate=\"__default-template\" let-node>\n @if (debug()) {\n <div class=\"markdown-unkown-node-type text-danger\">\n Node type not implemented: <b>{{ node.type }}</b>\n <pre class=\"mt-1\">{{ node | json }}</pre>\n </div>\n }\n</ng-template>\n", styles: [":host{display:block;max-inline-size:100%;min-inline-size:0}\n"] }]
|
|
783
|
+
}], propDecorators: { markdown: [{ type: i0.Input, args: [{ isSignal: true, alias: "markdown", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], citations: [{ type: i0.Input, args: [{ isSignal: true, alias: "citations", required: false }] }], debug: [{ type: i0.Input, args: [{ isSignal: true, alias: "debug", required: false }] }], extensionEvent: [{ type: i0.Output, args: ["extensionEvent"] }], templateQuery: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => SiMarkdownTemplateDirective), { isSignal: true }] }], customTemplateQuery: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SiMarkdownTemplateDirective), { isSignal: true }] }] } });
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
787
|
+
* SPDX-License-Identifier: MIT
|
|
788
|
+
*/
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
792
|
+
* SPDX-License-Identifier: MIT
|
|
793
|
+
*/
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Generated bundle index. Do not edit.
|
|
797
|
+
*/
|
|
798
|
+
|
|
799
|
+
export { SI_MARKDOWN_CONTROL, SiMarkdownCalloutComponent, SiMarkdownComponent, SiMarkdownFragmentComponent, SiMarkdownInlineHtmlComponent, SiMarkdownOptions, SiMarkdownTemplateDirective, computedAsync, makeSiMarkdownOptions, siMarkdownDirective, throttledSignal };
|
|
800
|
+
//# sourceMappingURL=siemens-element-ng-markdown.mjs.map
|