@aeris-ui/core 22.0.0-alpha.1 → 22.0.0-alpha.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 +200 -191
- package/fesm2022/aeris-ui-core-accordion.mjs +646 -255
- package/fesm2022/aeris-ui-core-accordion.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-animate-on-scroll.mjs +284 -103
- package/fesm2022/aeris-ui-core-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-auto-complete.mjs +1228 -446
- package/fesm2022/aeris-ui-core-auto-complete.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-auto-focus.mjs +111 -61
- package/fesm2022/aeris-ui-core-auto-focus.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-avatar.mjs +383 -101
- package/fesm2022/aeris-ui-core-avatar.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-badge.mjs +562 -115
- package/fesm2022/aeris-ui-core-badge.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-block-ui.mjs +209 -101
- package/fesm2022/aeris-ui-core-block-ui.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-breadcrumb.mjs +581 -189
- package/fesm2022/aeris-ui-core-breadcrumb.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-button-group.mjs +153 -38
- package/fesm2022/aeris-ui-core-button-group.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-button.mjs +741 -139
- package/fesm2022/aeris-ui-core-button.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-card.mjs +371 -101
- package/fesm2022/aeris-ui-core-card.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-carousel.mjs +773 -369
- package/fesm2022/aeris-ui-core-carousel.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-cascade-select.mjs +1171 -521
- package/fesm2022/aeris-ui-core-cascade-select.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-chart.mjs +455 -258
- package/fesm2022/aeris-ui-core-chart.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-checkbox.mjs +440 -140
- package/fesm2022/aeris-ui-core-checkbox.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-chip.mjs +430 -117
- package/fesm2022/aeris-ui-core-chip.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-class-names.mjs +87 -65
- package/fesm2022/aeris-ui-core-class-names.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-code-block.mjs +637 -0
- package/fesm2022/aeris-ui-core-code-block.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-color-picker.mjs +1340 -700
- package/fesm2022/aeris-ui-core-color-picker.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-compare.mjs +823 -318
- package/fesm2022/aeris-ui-core-compare.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-confirm-dialog.mjs +1404 -555
- package/fesm2022/aeris-ui-core-confirm-dialog.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-confirm-popup.mjs +1471 -740
- package/fesm2022/aeris-ui-core-confirm-popup.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-context-menu.mjs +918 -443
- package/fesm2022/aeris-ui-core-context-menu.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-date-picker.mjs +1942 -1123
- package/fesm2022/aeris-ui-core-date-picker.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-dialog.mjs +1079 -346
- package/fesm2022/aeris-ui-core-dialog.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-divider.mjs +204 -43
- package/fesm2022/aeris-ui-core-divider.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-drawer.mjs +1015 -322
- package/fesm2022/aeris-ui-core-drawer.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-dynamic-dialog.mjs +410 -254
- package/fesm2022/aeris-ui-core-dynamic-dialog.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-editor.mjs +967 -587
- package/fesm2022/aeris-ui-core-editor.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-file-upload.mjs +1379 -522
- package/fesm2022/aeris-ui-core-file-upload.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-filter-service.mjs +258 -301
- package/fesm2022/aeris-ui-core-filter-service.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-fluid.mjs +68 -21
- package/fesm2022/aeris-ui-core-fluid.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-focus-trap.mjs +206 -182
- package/fesm2022/aeris-ui-core-focus-trap.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-form-field.mjs +688 -0
- package/fesm2022/aeris-ui-core-form-field.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-galleria.mjs +2446 -1117
- package/fesm2022/aeris-ui-core-galleria.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-glass.mjs +110 -33
- package/fesm2022/aeris-ui-core-glass.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-icon-field.mjs +426 -98
- package/fesm2022/aeris-ui-core-icon-field.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-inplace.mjs +452 -130
- package/fesm2022/aeris-ui-core-inplace.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-group.mjs +413 -107
- package/fesm2022/aeris-ui-core-input-group.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-mask.mjs +658 -255
- package/fesm2022/aeris-ui-core-input-mask.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-number.mjs +926 -291
- package/fesm2022/aeris-ui-core-input-number.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-otp.mjs +678 -264
- package/fesm2022/aeris-ui-core-input-otp.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-input-text.mjs +625 -158
- package/fesm2022/aeris-ui-core-input-text.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-key-filter.mjs +263 -201
- package/fesm2022/aeris-ui-core-key-filter.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-mega-menu.mjs +613 -382
- package/fesm2022/aeris-ui-core-mega-menu.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-menu.mjs +1062 -472
- package/fesm2022/aeris-ui-core-menu.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-menubar.mjs +994 -393
- package/fesm2022/aeris-ui-core-menubar.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-message.mjs +477 -145
- package/fesm2022/aeris-ui-core-message.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-meter-group.mjs +623 -230
- package/fesm2022/aeris-ui-core-meter-group.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-multi-select.mjs +1598 -561
- package/fesm2022/aeris-ui-core-multi-select.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-order-list.mjs +592 -220
- package/fesm2022/aeris-ui-core-order-list.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-organization-chart.mjs +485 -199
- package/fesm2022/aeris-ui-core-organization-chart.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-paginator.mjs +428 -123
- package/fesm2022/aeris-ui-core-paginator.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-panel.mjs +596 -196
- package/fesm2022/aeris-ui-core-panel.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-password.mjs +925 -249
- package/fesm2022/aeris-ui-core-password.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-pick-list.mjs +1280 -659
- package/fesm2022/aeris-ui-core-pick-list.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-popover.mjs +912 -375
- package/fesm2022/aeris-ui-core-popover.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-progress-bar.mjs +549 -176
- package/fesm2022/aeris-ui-core-progress-bar.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-progress-spinner.mjs +410 -133
- package/fesm2022/aeris-ui-core-progress-spinner.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-radio-button.mjs +394 -124
- package/fesm2022/aeris-ui-core-radio-button.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-rating.mjs +506 -231
- package/fesm2022/aeris-ui-core-rating.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-scroll-panel.mjs +457 -154
- package/fesm2022/aeris-ui-core-scroll-panel.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-scroll-top.mjs +226 -63
- package/fesm2022/aeris-ui-core-scroll-top.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-select.mjs +1845 -648
- package/fesm2022/aeris-ui-core-select.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-skeleton.mjs +149 -45
- package/fesm2022/aeris-ui-core-skeleton.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-slider.mjs +884 -430
- package/fesm2022/aeris-ui-core-slider.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-speed-dial.mjs +861 -337
- package/fesm2022/aeris-ui-core-speed-dial.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-split-button.mjs +955 -266
- package/fesm2022/aeris-ui-core-split-button.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-splitter.mjs +812 -352
- package/fesm2022/aeris-ui-core-splitter.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-stepper.mjs +697 -254
- package/fesm2022/aeris-ui-core-stepper.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-style-class.mjs +587 -342
- package/fesm2022/aeris-ui-core-style-class.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-table.mjs +2034 -869
- package/fesm2022/aeris-ui-core-table.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tabs.mjs +789 -279
- package/fesm2022/aeris-ui-core-tabs.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-textarea.mjs +856 -219
- package/fesm2022/aeris-ui-core-textarea.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-theme-builder.mjs +1284 -1399
- package/fesm2022/aeris-ui-core-theme-builder.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-theming.mjs +132 -144
- package/fesm2022/aeris-ui-core-theming.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tiered-menu.mjs +909 -441
- package/fesm2022/aeris-ui-core-tiered-menu.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-timeline.mjs +407 -131
- package/fesm2022/aeris-ui-core-timeline.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-toast.mjs +1076 -384
- package/fesm2022/aeris-ui-core-toast.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-toggle-switch.mjs +398 -132
- package/fesm2022/aeris-ui-core-toggle-switch.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-toolbar.mjs +458 -121
- package/fesm2022/aeris-ui-core-toolbar.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tooltip.mjs +625 -330
- package/fesm2022/aeris-ui-core-tooltip.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tree-select.mjs +1453 -621
- package/fesm2022/aeris-ui-core-tree-select.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tree-table.mjs +2019 -940
- package/fesm2022/aeris-ui-core-tree-table.mjs.map +1 -1
- package/fesm2022/aeris-ui-core-tree.mjs +1107 -658
- package/fesm2022/aeris-ui-core-tree.mjs.map +1 -1
- package/fesm2022/aeris-ui-core.mjs +985 -316
- package/fesm2022/aeris-ui-core.mjs.map +1 -1
- package/package.json +20 -8
- package/schematics/ng-add/schema.json +1 -1
- package/schematics/runtime/schematics/ng-add/options.js +4 -4
- package/schematics/runtime/schematics/ng-add/options.js.map +1 -1
- package/schematics/runtime/schematics/ng-add/workspace.js +1 -1
- package/schematics/runtime/schematics/ng-add/workspace.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-contrast.js +6 -17
- package/schematics/runtime/theme-builder/aeris-contrast.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-foundation.js +10 -4
- package/schematics/runtime/theme-builder/aeris-foundation.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-semantic-tones.js +28 -5
- package/schematics/runtime/theme-builder/aeris-semantic-tones.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme-generator.js +2 -2
- package/schematics/runtime/theme-builder/aeris-theme-generator.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme-resolver.js +22 -8
- package/schematics/runtime/theme-builder/aeris-theme-resolver.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme-tokens.js +12 -4
- package/schematics/runtime/theme-builder/aeris-theme-tokens.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme-validation.js +7 -1
- package/schematics/runtime/theme-builder/aeris-theme-validation.js.map +1 -1
- package/schematics/runtime/theme-builder/aeris-theme.js +49 -33
- package/schematics/runtime/theme-builder/aeris-theme.js.map +1 -1
- package/styles/_fallback-colors.scss +10 -0
- package/styles/_mobile.scss +16 -0
- package/styles/_tokens.scss +5 -5
- package/styles/aeris.css +412 -125
- package/styles/controls.css +61 -29
- package/tools/aeris-theme.mjs +2 -2
- package/tools/aeris-theme.schema.json +5 -2
- package/types/aeris-ui-core-accordion.d.ts +167 -93
- package/types/aeris-ui-core-animate-on-scroll.d.ts +72 -31
- package/types/aeris-ui-core-auto-complete.d.ts +327 -140
- package/types/aeris-ui-core-auto-focus.d.ts +24 -16
- package/types/aeris-ui-core-avatar.d.ts +112 -42
- package/types/aeris-ui-core-badge.d.ts +160 -46
- package/types/aeris-ui-core-block-ui.d.ts +47 -27
- package/types/aeris-ui-core-breadcrumb.d.ts +163 -92
- package/types/aeris-ui-core-button-group.d.ts +37 -16
- package/types/aeris-ui-core-button.d.ts +226 -67
- package/types/aeris-ui-core-card.d.ts +74 -37
- package/types/aeris-ui-core-carousel.d.ts +201 -117
- package/types/aeris-ui-core-cascade-select.d.ts +257 -123
- package/types/aeris-ui-core-chart.d.ts +134 -84
- package/types/aeris-ui-core-checkbox.d.ts +139 -54
- package/types/aeris-ui-core-chip.d.ts +116 -51
- package/types/aeris-ui-core-class-names.d.ts +22 -20
- package/types/aeris-ui-core-code-block.d.ts +188 -0
- package/types/aeris-ui-core-color-picker.d.ts +348 -143
- package/types/aeris-ui-core-compare.d.ts +224 -102
- package/types/aeris-ui-core-confirm-dialog.d.ts +442 -245
- package/types/aeris-ui-core-confirm-popup.d.ts +442 -263
- package/types/aeris-ui-core-context-menu.d.ts +264 -146
- package/types/aeris-ui-core-date-picker.d.ts +489 -217
- package/types/aeris-ui-core-dialog.d.ts +288 -117
- package/types/aeris-ui-core-divider.d.ts +58 -20
- package/types/aeris-ui-core-drawer.d.ts +273 -112
- package/types/aeris-ui-core-dynamic-dialog.d.ts +158 -137
- package/types/aeris-ui-core-editor.d.ts +250 -123
- package/types/aeris-ui-core-file-upload.d.ts +367 -197
- package/types/aeris-ui-core-filter-service.d.ts +48 -52
- package/types/aeris-ui-core-fluid.d.ts +12 -9
- package/types/aeris-ui-core-focus-trap.d.ts +39 -31
- package/types/aeris-ui-core-form-field.d.ts +163 -0
- package/types/aeris-ui-core-galleria.d.ts +588 -256
- package/types/aeris-ui-core-glass.d.ts +24 -11
- package/types/aeris-ui-core-icon-field.d.ts +94 -32
- package/types/aeris-ui-core-inplace.d.ts +123 -62
- package/types/aeris-ui-core-input-group.d.ts +84 -33
- package/types/aeris-ui-core-input-mask.d.ts +194 -69
- package/types/aeris-ui-core-input-number.d.ts +272 -87
- package/types/aeris-ui-core-input-otp.d.ts +191 -81
- package/types/aeris-ui-core-input-text.d.ts +185 -60
- package/types/aeris-ui-core-key-filter.d.ts +53 -39
- package/types/aeris-ui-core-mega-menu.d.ts +175 -121
- package/types/aeris-ui-core-menu.d.ts +277 -168
- package/types/aeris-ui-core-menubar.d.ts +273 -135
- package/types/aeris-ui-core-message.d.ts +132 -60
- package/types/aeris-ui-core-meter-group.d.ts +163 -90
- package/types/aeris-ui-core-multi-select.d.ts +439 -180
- package/types/aeris-ui-core-order-list.d.ts +144 -66
- package/types/aeris-ui-core-organization-chart.d.ts +133 -77
- package/types/aeris-ui-core-paginator.d.ts +93 -38
- package/types/aeris-ui-core-panel.d.ts +149 -78
- package/types/aeris-ui-core-password.d.ts +258 -102
- package/types/aeris-ui-core-pick-list.d.ts +374 -179
- package/types/aeris-ui-core-popover.d.ts +219 -105
- package/types/aeris-ui-core-progress-bar.d.ts +157 -73
- package/types/aeris-ui-core-progress-spinner.d.ts +110 -48
- package/types/aeris-ui-core-radio-button.d.ts +124 -50
- package/types/aeris-ui-core-rating.d.ts +149 -76
- package/types/aeris-ui-core-scroll-panel.d.ts +142 -64
- package/types/aeris-ui-core-scroll-top.d.ts +66 -29
- package/types/aeris-ui-core-select.d.ts +475 -217
- package/types/aeris-ui-core-skeleton.d.ts +39 -17
- package/types/aeris-ui-core-slider.d.ts +270 -115
- package/types/aeris-ui-core-speed-dial.d.ts +241 -111
- package/types/aeris-ui-core-split-button.d.ts +267 -113
- package/types/aeris-ui-core-splitter.d.ts +225 -106
- package/types/aeris-ui-core-stepper.d.ts +184 -91
- package/types/aeris-ui-core-style-class.d.ts +141 -71
- package/types/aeris-ui-core-table.d.ts +596 -304
- package/types/aeris-ui-core-tabs.d.ts +181 -76
- package/types/aeris-ui-core-textarea.d.ts +261 -78
- package/types/aeris-ui-core-theme-builder.d.ts +472 -450
- package/types/aeris-ui-core-theming.d.ts +42 -45
- package/types/aeris-ui-core-tiered-menu.d.ts +251 -142
- package/types/aeris-ui-core-timeline.d.ts +109 -71
- package/types/aeris-ui-core-toast.d.ts +225 -115
- package/types/aeris-ui-core-toggle-switch.d.ts +125 -51
- package/types/aeris-ui-core-toolbar.d.ts +98 -41
- package/types/aeris-ui-core-tooltip.d.ts +157 -88
- package/types/aeris-ui-core-tree-select.d.ts +364 -171
- package/types/aeris-ui-core-tree-table.d.ts +566 -286
- package/types/aeris-ui-core-tree.d.ts +270 -165
- package/types/aeris-ui-core.d.ts +197 -72
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, ElementRef, booleanAttribute, computed, effect, inject, input, model, output, resource, signal, viewChildren } from "@angular/core";
|
|
3
|
+
const grammars = {
|
|
4
|
+
html: () => import("shiki/langs/html.mjs"),
|
|
5
|
+
typescript: () => import("shiki/langs/typescript.mjs"),
|
|
6
|
+
javascript: () => import("shiki/langs/javascript.mjs"),
|
|
7
|
+
css: () => import("shiki/langs/css.mjs"),
|
|
8
|
+
scss: () => import("shiki/langs/scss.mjs"),
|
|
9
|
+
json: () => import("shiki/langs/json.mjs"),
|
|
10
|
+
shell: () => import("shiki/langs/shellscript.mjs")
|
|
11
|
+
};
|
|
12
|
+
const aliases = {
|
|
13
|
+
ts: "typescript",
|
|
14
|
+
js: "javascript",
|
|
15
|
+
angular: "html",
|
|
16
|
+
xml: "html",
|
|
17
|
+
bash: "shell",
|
|
18
|
+
sh: "shell",
|
|
19
|
+
shellscript: "shell"
|
|
20
|
+
};
|
|
21
|
+
let highlighter;
|
|
22
|
+
const pendingLanguages = /* @__PURE__ */ new Map();
|
|
23
|
+
const lightColors = {
|
|
24
|
+
"#22863A": "#17692D",
|
|
25
|
+
"#D73A49": "#B52634",
|
|
26
|
+
"#6A737D": "#57606A",
|
|
27
|
+
"#E36209": "#934307",
|
|
28
|
+
"#B08800": "#775C00",
|
|
29
|
+
"#F6F8FA": "#24292E"
|
|
30
|
+
};
|
|
31
|
+
function normalizeAerisCodeLanguage(language) {
|
|
32
|
+
const normalized = language.trim().toLowerCase();
|
|
33
|
+
return aliases[normalized] ?? normalized;
|
|
34
|
+
}
|
|
35
|
+
function supportsAerisCodeLanguage(language) {
|
|
36
|
+
return Object.hasOwn(grammars, normalizeAerisCodeLanguage(language));
|
|
37
|
+
}
|
|
38
|
+
function plainAerisCode(code) {
|
|
39
|
+
const endings = code.match(/\r\n|\r|\n/g) ?? [];
|
|
40
|
+
return code.split(/\r\n|\r|\n/).map((text, index) => ({
|
|
41
|
+
number: index + 1,
|
|
42
|
+
tokens: [{ text }],
|
|
43
|
+
ending: endings[index] ?? ""
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
function getHighlighter() {
|
|
47
|
+
highlighter ??= Promise.all([
|
|
48
|
+
import("shiki/core"),
|
|
49
|
+
import("shiki/engine/javascript"),
|
|
50
|
+
import("shiki/themes/github-light.mjs"),
|
|
51
|
+
import("shiki/themes/github-dark.mjs")
|
|
52
|
+
]).then(([core, engine, light, dark]) => core.createHighlighterCore({
|
|
53
|
+
themes: [light.default, dark.default],
|
|
54
|
+
langs: [],
|
|
55
|
+
engine: engine.createJavaScriptRegexEngine()
|
|
56
|
+
})).catch((error) => {
|
|
57
|
+
highlighter = void 0;
|
|
58
|
+
throw error;
|
|
59
|
+
});
|
|
60
|
+
return highlighter;
|
|
61
|
+
}
|
|
62
|
+
async function highlightAerisCode(code, language) {
|
|
63
|
+
const normalized = normalizeAerisCodeLanguage(language);
|
|
64
|
+
if (!supportsAerisCodeLanguage(normalized) || code.length > 1e5) return plainAerisCode(code);
|
|
65
|
+
const engine = await getHighlighter();
|
|
66
|
+
const key = normalized;
|
|
67
|
+
let pending = pendingLanguages.get(key);
|
|
68
|
+
if (!pending) {
|
|
69
|
+
pending = engine.loadLanguage(grammars[key]()).catch((error) => {
|
|
70
|
+
pendingLanguages.delete(key);
|
|
71
|
+
throw error;
|
|
72
|
+
});
|
|
73
|
+
pendingLanguages.set(key, pending);
|
|
74
|
+
}
|
|
75
|
+
await pending;
|
|
76
|
+
const endings = code.match(/\r\n|\r|\n/g) ?? [];
|
|
77
|
+
return engine.codeToTokensWithThemes(code.replace(/\r\n|\r/g, "\n"), {
|
|
78
|
+
lang: key === "shell" ? "shellscript" : key,
|
|
79
|
+
themes: {
|
|
80
|
+
light: "github-light",
|
|
81
|
+
dark: "github-dark"
|
|
82
|
+
}
|
|
83
|
+
}).map((line, index) => ({
|
|
84
|
+
number: index + 1,
|
|
85
|
+
ending: endings[index] ?? "",
|
|
86
|
+
tokens: line.map((token) => {
|
|
87
|
+
const light = token.variants["light"];
|
|
88
|
+
const dark = token.variants["dark"];
|
|
89
|
+
const style = light.fontStyle ?? 0;
|
|
90
|
+
return {
|
|
91
|
+
text: token.content,
|
|
92
|
+
light: light.color ? lightColors[light.color.toUpperCase()] ?? light.color : void 0,
|
|
93
|
+
dark: dark.color,
|
|
94
|
+
italic: style & 1 ? "italic" : void 0,
|
|
95
|
+
weight: style & 2 ? "700" : void 0,
|
|
96
|
+
decoration: style & 4 ? "underline" : void 0
|
|
97
|
+
};
|
|
98
|
+
})
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
let nextId = 0;
|
|
102
|
+
var AerisCodeBlock = class AerisCodeBlock {
|
|
103
|
+
code = input("", ...ngDevMode ? [{ debugName: "code" }] : /* istanbul ignore next */ []);
|
|
104
|
+
language = input("text", ...ngDevMode ? [{ debugName: "language" }] : /* istanbul ignore next */ []);
|
|
105
|
+
label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
106
|
+
sources = input([], ...ngDevMode ? [{ debugName: "sources" }] : /* istanbul ignore next */ []);
|
|
107
|
+
activeSource = model(0, ...ngDevMode ? [{ debugName: "activeSource" }] : /* istanbul ignore next */ []);
|
|
108
|
+
highlight = input(true, {
|
|
109
|
+
...ngDevMode ? { debugName: "highlight" } : /* istanbul ignore next */ {},
|
|
110
|
+
transform: booleanAttribute
|
|
111
|
+
});
|
|
112
|
+
lineNumbers = input(false, {
|
|
113
|
+
...ngDevMode ? { debugName: "lineNumbers" } : /* istanbul ignore next */ {},
|
|
114
|
+
transform: booleanAttribute
|
|
115
|
+
});
|
|
116
|
+
highlightLines = input([], ...ngDevMode ? [{ debugName: "highlightLines" }] : /* istanbul ignore next */ []);
|
|
117
|
+
wrap = input(false, {
|
|
118
|
+
...ngDevMode ? { debugName: "wrap" } : /* istanbul ignore next */ {},
|
|
119
|
+
transform: booleanAttribute
|
|
120
|
+
});
|
|
121
|
+
maxHeight = input(null, ...ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []);
|
|
122
|
+
tabSize = input(2, ...ngDevMode ? [{ debugName: "tabSize" }] : /* istanbul ignore next */ []);
|
|
123
|
+
copyable = input(true, {
|
|
124
|
+
...ngDevMode ? { debugName: "copyable" } : /* istanbul ignore next */ {},
|
|
125
|
+
transform: booleanAttribute
|
|
126
|
+
});
|
|
127
|
+
ariaLabel = input("Code example", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
128
|
+
copyLabel = input("Copy", ...ngDevMode ? [{ debugName: "copyLabel" }] : /* istanbul ignore next */ []);
|
|
129
|
+
copiedLabel = input("Copied", ...ngDevMode ? [{ debugName: "copiedLabel" }] : /* istanbul ignore next */ []);
|
|
130
|
+
copyAriaLabel = input("Copy code", ...ngDevMode ? [{ debugName: "copyAriaLabel" }] : /* istanbul ignore next */ []);
|
|
131
|
+
copiedMessage = input("Code copied to clipboard.", ...ngDevMode ? [{ debugName: "copiedMessage" }] : /* istanbul ignore next */ []);
|
|
132
|
+
copyErrorMessage = input("Unable to copy code. Select the code and copy it manually.", ...ngDevMode ? [{ debugName: "copyErrorMessage" }] : /* istanbul ignore next */ []);
|
|
133
|
+
sourceTabsLabel = input("Code source", ...ngDevMode ? [{ debugName: "sourceTabsLabel" }] : /* istanbul ignore next */ []);
|
|
134
|
+
scrollHint = input("Swipe sideways for long lines", ...ngDevMode ? [{ debugName: "scrollHint" }] : /* istanbul ignore next */ []);
|
|
135
|
+
scrollDescription = input("Scroll horizontally to view long lines.", ...ngDevMode ? [{ debugName: "scrollDescription" }] : /* istanbul ignore next */ []);
|
|
136
|
+
copied = output();
|
|
137
|
+
copyError = output();
|
|
138
|
+
highlightError = output();
|
|
139
|
+
blockId = `aeris-code-block-${++nextId}`;
|
|
140
|
+
availableSources = computed(() => this.sources().length ? this.sources() : [{
|
|
141
|
+
code: this.code(),
|
|
142
|
+
language: this.language(),
|
|
143
|
+
label: this.label() || this.language()
|
|
144
|
+
}], ...ngDevMode ? [{ debugName: "availableSources" }] : /* istanbul ignore next */ []);
|
|
145
|
+
resolvedIndex = computed(() => Math.min(Math.max(0, Math.trunc(this.activeSource()) || 0), this.availableSources().length - 1), ...ngDevMode ? [{ debugName: "resolvedIndex" }] : /* istanbul ignore next */ []);
|
|
146
|
+
source = computed(() => this.availableSources()[this.resolvedIndex()], ...ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []);
|
|
147
|
+
syntax = resource({
|
|
148
|
+
...ngDevMode ? { debugName: "syntax" } : /* istanbul ignore next */ {},
|
|
149
|
+
params: () => this.highlight() && supportsAerisCodeLanguage(this.source().language) && this.source().code.length <= 1e5 ? {
|
|
150
|
+
code: this.source().code,
|
|
151
|
+
language: this.source().language
|
|
152
|
+
} : void 0,
|
|
153
|
+
loader: async ({ params, abortSignal }) => {
|
|
154
|
+
try {
|
|
155
|
+
return await highlightAerisCode(params.code, params.language);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
if (!this.destroyed && !abortSignal.aborted) this.highlightError.emit(error);
|
|
158
|
+
return plainAerisCode(params.code);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
lines = computed(() => this.syntax.value() ?? plainAerisCode(this.source().code), ...ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []);
|
|
163
|
+
markedLines = computed(() => new Set(this.highlightLines()), ...ngDevMode ? [{ debugName: "markedLines" }] : /* istanbul ignore next */ []);
|
|
164
|
+
resolvedTabSize = computed(() => Math.min(16, Math.max(1, Math.trunc(this.tabSize()) || 2)), ...ngDevMode ? [{ debugName: "resolvedTabSize" }] : /* istanbul ignore next */ []);
|
|
165
|
+
copyState = signal("idle", ...ngDevMode ? [{ debugName: "copyState" }] : /* istanbul ignore next */ []);
|
|
166
|
+
announcement = computed(() => this.copyState() === "copied" ? this.copiedMessage() : this.copyState() === "error" ? this.copyErrorMessage() : "", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
|
|
167
|
+
tabs = viewChildren("tab", ...ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []);
|
|
168
|
+
host = inject(ElementRef);
|
|
169
|
+
resetTimer;
|
|
170
|
+
destroyed = false;
|
|
171
|
+
constructor() {
|
|
172
|
+
inject(DestroyRef).onDestroy(() => {
|
|
173
|
+
this.destroyed = true;
|
|
174
|
+
clearTimeout(this.resetTimer);
|
|
175
|
+
});
|
|
176
|
+
effect(() => {
|
|
177
|
+
this.source();
|
|
178
|
+
clearTimeout(this.resetTimer);
|
|
179
|
+
this.copyState.set("idle");
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
selectSource(index) {
|
|
183
|
+
if (Number.isInteger(index) && index >= 0 && index < this.availableSources().length) this.activeSource.set(index);
|
|
184
|
+
}
|
|
185
|
+
async copy() {
|
|
186
|
+
if (!this.copyable() || this.copyState() === "copying" || this.destroyed) return false;
|
|
187
|
+
const source = this.source();
|
|
188
|
+
const index = this.resolvedIndex();
|
|
189
|
+
this.copyState.set("copying");
|
|
190
|
+
try {
|
|
191
|
+
if (!globalThis.navigator?.clipboard?.writeText) throw new Error("Clipboard access requires a supported browser and a secure context.");
|
|
192
|
+
await globalThis.navigator.clipboard.writeText(source.code);
|
|
193
|
+
if (this.destroyed) return true;
|
|
194
|
+
if (this.source() === source) {
|
|
195
|
+
this.copyState.set("copied");
|
|
196
|
+
clearTimeout(this.resetTimer);
|
|
197
|
+
this.resetTimer = setTimeout(() => this.copyState.set("idle"), 1800);
|
|
198
|
+
}
|
|
199
|
+
this.copied.emit({
|
|
200
|
+
code: source.code,
|
|
201
|
+
language: source.language,
|
|
202
|
+
index
|
|
203
|
+
});
|
|
204
|
+
return true;
|
|
205
|
+
} catch (error) {
|
|
206
|
+
if (!this.destroyed) {
|
|
207
|
+
if (this.source() === source) this.copyState.set("error");
|
|
208
|
+
this.copyError.emit(error);
|
|
209
|
+
}
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
handleTabKeydown(event, index) {
|
|
214
|
+
const rtl = this.host.nativeElement.ownerDocument.defaultView?.getComputedStyle(this.host.nativeElement).direction === "rtl";
|
|
215
|
+
let next;
|
|
216
|
+
if (event.key === "Home") next = 0;
|
|
217
|
+
else if (event.key === "End") next = this.availableSources().length - 1;
|
|
218
|
+
else if (event.key === "ArrowLeft" || event.key === "ArrowRight") next = (index + (event.key === "ArrowRight" ? 1 : -1) * (rtl ? -1 : 1) + this.availableSources().length) % this.availableSources().length;
|
|
219
|
+
else return;
|
|
220
|
+
event.preventDefault();
|
|
221
|
+
this.selectSource(next);
|
|
222
|
+
const tab = this.tabs()[next]?.nativeElement;
|
|
223
|
+
tab?.focus({ preventScroll: true });
|
|
224
|
+
if (tab?.parentElement) {
|
|
225
|
+
const bounds = tab.getBoundingClientRect();
|
|
226
|
+
const viewport = tab.parentElement.getBoundingClientRect();
|
|
227
|
+
const offset = bounds.left < viewport.left ? bounds.left - viewport.left : bounds.right > viewport.right ? bounds.right - viewport.right : 0;
|
|
228
|
+
if (offset) tab.parentElement.scrollBy({
|
|
229
|
+
left: offset,
|
|
230
|
+
behavior: "instant"
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
235
|
+
minVersion: "12.0.0",
|
|
236
|
+
version: "22.2.2",
|
|
237
|
+
ngImport: i0,
|
|
238
|
+
type: AerisCodeBlock,
|
|
239
|
+
deps: [],
|
|
240
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
241
|
+
});
|
|
242
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
243
|
+
minVersion: "17.0.0",
|
|
244
|
+
version: "22.2.2",
|
|
245
|
+
type: AerisCodeBlock,
|
|
246
|
+
isStandalone: true,
|
|
247
|
+
selector: "aeris-code-block",
|
|
248
|
+
inputs: {
|
|
249
|
+
code: {
|
|
250
|
+
classPropertyName: "code",
|
|
251
|
+
publicName: "code",
|
|
252
|
+
isSignal: true,
|
|
253
|
+
isRequired: false,
|
|
254
|
+
transformFunction: null
|
|
255
|
+
},
|
|
256
|
+
language: {
|
|
257
|
+
classPropertyName: "language",
|
|
258
|
+
publicName: "language",
|
|
259
|
+
isSignal: true,
|
|
260
|
+
isRequired: false,
|
|
261
|
+
transformFunction: null
|
|
262
|
+
},
|
|
263
|
+
label: {
|
|
264
|
+
classPropertyName: "label",
|
|
265
|
+
publicName: "label",
|
|
266
|
+
isSignal: true,
|
|
267
|
+
isRequired: false,
|
|
268
|
+
transformFunction: null
|
|
269
|
+
},
|
|
270
|
+
sources: {
|
|
271
|
+
classPropertyName: "sources",
|
|
272
|
+
publicName: "sources",
|
|
273
|
+
isSignal: true,
|
|
274
|
+
isRequired: false,
|
|
275
|
+
transformFunction: null
|
|
276
|
+
},
|
|
277
|
+
activeSource: {
|
|
278
|
+
classPropertyName: "activeSource",
|
|
279
|
+
publicName: "activeSource",
|
|
280
|
+
isSignal: true,
|
|
281
|
+
isRequired: false,
|
|
282
|
+
transformFunction: null
|
|
283
|
+
},
|
|
284
|
+
highlight: {
|
|
285
|
+
classPropertyName: "highlight",
|
|
286
|
+
publicName: "highlight",
|
|
287
|
+
isSignal: true,
|
|
288
|
+
isRequired: false,
|
|
289
|
+
transformFunction: null
|
|
290
|
+
},
|
|
291
|
+
lineNumbers: {
|
|
292
|
+
classPropertyName: "lineNumbers",
|
|
293
|
+
publicName: "lineNumbers",
|
|
294
|
+
isSignal: true,
|
|
295
|
+
isRequired: false,
|
|
296
|
+
transformFunction: null
|
|
297
|
+
},
|
|
298
|
+
highlightLines: {
|
|
299
|
+
classPropertyName: "highlightLines",
|
|
300
|
+
publicName: "highlightLines",
|
|
301
|
+
isSignal: true,
|
|
302
|
+
isRequired: false,
|
|
303
|
+
transformFunction: null
|
|
304
|
+
},
|
|
305
|
+
wrap: {
|
|
306
|
+
classPropertyName: "wrap",
|
|
307
|
+
publicName: "wrap",
|
|
308
|
+
isSignal: true,
|
|
309
|
+
isRequired: false,
|
|
310
|
+
transformFunction: null
|
|
311
|
+
},
|
|
312
|
+
maxHeight: {
|
|
313
|
+
classPropertyName: "maxHeight",
|
|
314
|
+
publicName: "maxHeight",
|
|
315
|
+
isSignal: true,
|
|
316
|
+
isRequired: false,
|
|
317
|
+
transformFunction: null
|
|
318
|
+
},
|
|
319
|
+
tabSize: {
|
|
320
|
+
classPropertyName: "tabSize",
|
|
321
|
+
publicName: "tabSize",
|
|
322
|
+
isSignal: true,
|
|
323
|
+
isRequired: false,
|
|
324
|
+
transformFunction: null
|
|
325
|
+
},
|
|
326
|
+
copyable: {
|
|
327
|
+
classPropertyName: "copyable",
|
|
328
|
+
publicName: "copyable",
|
|
329
|
+
isSignal: true,
|
|
330
|
+
isRequired: false,
|
|
331
|
+
transformFunction: null
|
|
332
|
+
},
|
|
333
|
+
ariaLabel: {
|
|
334
|
+
classPropertyName: "ariaLabel",
|
|
335
|
+
publicName: "ariaLabel",
|
|
336
|
+
isSignal: true,
|
|
337
|
+
isRequired: false,
|
|
338
|
+
transformFunction: null
|
|
339
|
+
},
|
|
340
|
+
copyLabel: {
|
|
341
|
+
classPropertyName: "copyLabel",
|
|
342
|
+
publicName: "copyLabel",
|
|
343
|
+
isSignal: true,
|
|
344
|
+
isRequired: false,
|
|
345
|
+
transformFunction: null
|
|
346
|
+
},
|
|
347
|
+
copiedLabel: {
|
|
348
|
+
classPropertyName: "copiedLabel",
|
|
349
|
+
publicName: "copiedLabel",
|
|
350
|
+
isSignal: true,
|
|
351
|
+
isRequired: false,
|
|
352
|
+
transformFunction: null
|
|
353
|
+
},
|
|
354
|
+
copyAriaLabel: {
|
|
355
|
+
classPropertyName: "copyAriaLabel",
|
|
356
|
+
publicName: "copyAriaLabel",
|
|
357
|
+
isSignal: true,
|
|
358
|
+
isRequired: false,
|
|
359
|
+
transformFunction: null
|
|
360
|
+
},
|
|
361
|
+
copiedMessage: {
|
|
362
|
+
classPropertyName: "copiedMessage",
|
|
363
|
+
publicName: "copiedMessage",
|
|
364
|
+
isSignal: true,
|
|
365
|
+
isRequired: false,
|
|
366
|
+
transformFunction: null
|
|
367
|
+
},
|
|
368
|
+
copyErrorMessage: {
|
|
369
|
+
classPropertyName: "copyErrorMessage",
|
|
370
|
+
publicName: "copyErrorMessage",
|
|
371
|
+
isSignal: true,
|
|
372
|
+
isRequired: false,
|
|
373
|
+
transformFunction: null
|
|
374
|
+
},
|
|
375
|
+
sourceTabsLabel: {
|
|
376
|
+
classPropertyName: "sourceTabsLabel",
|
|
377
|
+
publicName: "sourceTabsLabel",
|
|
378
|
+
isSignal: true,
|
|
379
|
+
isRequired: false,
|
|
380
|
+
transformFunction: null
|
|
381
|
+
},
|
|
382
|
+
scrollHint: {
|
|
383
|
+
classPropertyName: "scrollHint",
|
|
384
|
+
publicName: "scrollHint",
|
|
385
|
+
isSignal: true,
|
|
386
|
+
isRequired: false,
|
|
387
|
+
transformFunction: null
|
|
388
|
+
},
|
|
389
|
+
scrollDescription: {
|
|
390
|
+
classPropertyName: "scrollDescription",
|
|
391
|
+
publicName: "scrollDescription",
|
|
392
|
+
isSignal: true,
|
|
393
|
+
isRequired: false,
|
|
394
|
+
transformFunction: null
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
outputs: {
|
|
398
|
+
activeSource: "activeSourceChange",
|
|
399
|
+
copied: "copied",
|
|
400
|
+
copyError: "copyError",
|
|
401
|
+
highlightError: "highlightError"
|
|
402
|
+
},
|
|
403
|
+
host: {
|
|
404
|
+
properties: {
|
|
405
|
+
"attr.data-wrap": "wrap() || null",
|
|
406
|
+
"attr.data-line-numbers": "lineNumbers() || null",
|
|
407
|
+
"style.--_aeris-code-block-max-height": "maxHeight()",
|
|
408
|
+
"style.--aeris-code-block-tab-size": "resolvedTabSize()"
|
|
409
|
+
},
|
|
410
|
+
classAttribute: "aeris-code-block"
|
|
411
|
+
},
|
|
412
|
+
viewQueries: [{
|
|
413
|
+
propertyName: "tabs",
|
|
414
|
+
predicate: ["tab"],
|
|
415
|
+
descendants: true,
|
|
416
|
+
isSignal: true
|
|
417
|
+
}],
|
|
418
|
+
ngImport: i0,
|
|
419
|
+
template: "<div class=\"aeris-code-block__header\">\n @if (availableSources().length > 1) {\n <div class=\"aeris-code-block__toolbar\" role=\"tablist\" [attr.aria-label]=\"sourceTabsLabel()\">\n @for (item of availableSources(); track $index) {\n <button\n #tab\n type=\"button\"\n role=\"tab\"\n [id]=\"blockId + '-tab-' + $index\"\n [attr.aria-selected]=\"resolvedIndex() === $index\"\n [attr.aria-controls]=\"blockId + '-panel'\"\n [tabIndex]=\"resolvedIndex() === $index ? 0 : -1\"\n (click)=\"selectSource($index)\"\n (keydown)=\"handleTabKeydown($event, $index)\"\n >\n {{ item.label }}\n </button>\n }\n </div>\n } @else {\n <span class=\"aeris-code-block__label\">{{ source().label }}</span>\n }\n @if (copyable()) {\n <button\n class=\"aeris-code-block__copy\"\n type=\"button\"\n [attr.aria-label]=\"copyAriaLabel()\"\n [disabled]=\"copyState() === 'copying'\"\n (click)=\"copy()\"\n >\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n @if (copyState() === 'copied') {\n <path d=\"m5 12 4 4 10-10\" />\n } @else {\n <rect x=\"8\" y=\"8\" width=\"12\" height=\"12\" rx=\"2\" />\n <path d=\"M16 8V4H4v12h4\" />\n }\n </svg>\n <span class=\"aeris-code-block__copy-label\">{{\n copyState() === 'copied' ? copiedLabel() : copyLabel()\n }}</span>\n </button>\n }\n</div>\n<pre\n class=\"aeris-code-block__pre\"\n tabindex=\"0\"\n [id]=\"blockId + '-panel'\"\n [attr.role]=\"availableSources().length > 1 ? 'tabpanel' : 'region'\"\n [attr.aria-label]=\"availableSources().length > 1 ? null : ariaLabel()\"\n [attr.aria-labelledby]=\"\n availableSources().length > 1 ? blockId + '-tab-' + resolvedIndex() : null\n \"\n [attr.aria-description]=\"wrap() ? null : scrollDescription()\"\n><code>@for (line of lines(); track line.number) {<span class=\"aeris-code-block__line\" [attr.data-highlighted]=\"markedLines().has(line.number) || null\">@if (lineNumbers()) {<span class=\"aeris-code-block__number\" aria-hidden=\"true\">{{ line.number }}</span>}@for (token of line.tokens; track $index) {<span [attr.data-token]=\"token.light ? 'highlighted' : 'plain'\" [style.--_aeris-code-light]=\"token.light\" [style.--_aeris-code-dark]=\"token.dark\" [style.font-style]=\"token.italic\" [style.font-weight]=\"token.weight\" [style.text-decoration]=\"token.decoration\">{{ token.text }}</span>}</span>{{ line.ending }}}</code></pre>\n@if (!wrap() && scrollHint()) {\n <span class=\"aeris-code-block__mobile-hint\" aria-hidden=\"true\">{{ scrollHint() }}</span>\n}\n<span class=\"aeris-code-block__status\" role=\"status\" aria-live=\"polite\">{{ announcement() }}</span>\n",
|
|
420
|
+
styles: [":host{display:block;box-sizing:border-box;min-inline-size:0;max-inline-size:100%;overflow:hidden;border:1px solid var(--aeris-code-block-border, var(--aeris-border, #efefef));border-radius:var(--aeris-code-block-radius, var(--aeris-radius-surface, .6875rem));background:var(--aeris-code-block-background, var(--aeris-surface-2, #f3f3f3));color:var(--aeris-code-block-color, var(--aeris-text, #111111))}.aeris-code-block__header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;min-inline-size:0;border-block-end:1px solid var(--aeris-code-block-border, var(--aeris-border))}.aeris-code-block__toolbar{min-inline-size:0;display:flex;gap:var(--aeris-density-gap, .5rem);padding:var(--aeris-overlay-padding, .375rem);overflow-x:auto;scrollbar-width:none;touch-action:pan-x pan-y;overscroll-behavior-inline:contain;overscroll-behavior-x:contain}.aeris-code-block__label{min-inline-size:0;overflow-wrap:anywhere;padding:var(--aeris-item-padding-y, .5rem) var(--aeris-item-padding-x, .75rem);font-size:var(--aeris-font-size-md, .8125rem);font-weight:600}button{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;gap:var(--aeris-density-gap, .5rem);min-block-size:max(2rem,var(--aeris-control-height, 2.625rem) - .5rem);padding-inline:var(--aeris-control-padding-x, .75rem);border:1px solid transparent;border-radius:var(--aeris-radius-item, .4375rem);background:transparent;color:inherit;font:inherit;font-size:var(--aeris-font-size-md, .8125rem);white-space:nowrap;cursor:pointer;transition:background-color var(--aeris-motion-normal, .15s) ease}button[aria-selected=true]{background:var(--aeris-surface, #fff)}button:focus-visible,.aeris-code-block__pre:focus-visible{outline:2px solid var(--aeris-focus, #111111);outline-offset:-2px}button:disabled{opacity:.6;cursor:wait}@media(hover:hover){button:hover:not(:disabled){background:var(--aeris-interactive-hover, #e5e5e5)}}.aeris-code-block__copy{margin-inline-end:var(--aeris-overlay-padding, .375rem);margin-block:var(--aeris-overlay-padding, .375rem)}svg{inline-size:var(--aeris-icon-size, 1rem);block-size:var(--aeris-icon-size, 1rem);flex-shrink:0}.aeris-code-block__pre{box-sizing:border-box;inline-size:100%;max-inline-size:100%;max-block-size:var(--_aeris-code-block-max-height, var(--aeris-code-block-max-height, min(34rem, 68dvh)));margin:0;padding:var(--aeris-code-block-padding, var(--aeris-surface-padding, 1.25rem));overflow:auto;overscroll-behavior-inline:contain;overscroll-behavior-block:auto;overscroll-behavior-x:contain;overscroll-behavior-y:auto;touch-action:pan-x pan-y;scrollbar-width:thin;scrollbar-color:var(--aeris-border, #ddd) transparent;direction:ltr;text-align:start}code{display:block;inline-size:max-content;min-inline-size:100%;font:var(--aeris-code-block-font-size, .8125rem)/var(--aeris-code-block-line-height, 1.75) var(--aeris-code-block-font-family, ui-monospace, SFMono-Regular, Consolas, monospace);tab-size:var(--aeris-code-block-tab-size, 2);white-space:pre}.aeris-code-block__line{display:inline-block;min-inline-size:100%}.aeris-code-block__line[data-highlighted]{background:var(--aeris-code-block-line-highlight, var(--aeris-primary-soft, #e5e5e5))}.aeris-code-block__number{display:inline-block;inline-size:4ch;padding-inline-end:1rem;text-align:end;color:var(--aeris-text-2, #555);-webkit-user-select:none;user-select:none}:host([data-wrap]) code{inline-size:100%;white-space:pre-wrap;overflow-wrap:anywhere}[data-token]{color:var(--aeris-code-block-token-color, var(--_aeris-code-light, inherit))}:host-context([data-aeris-theme=dark]) [data-token]{color:var(--aeris-code-block-token-color, var(--_aeris-code-dark, inherit))}.aeris-code-block__status{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.aeris-code-block__mobile-hint{display:none}@media(max-width:40rem){.aeris-code-block__copy{inline-size:2.25rem;min-inline-size:2.25rem;padding-inline:0}.aeris-code-block__copy-label{display:none}.aeris-code-block__pre{max-block-size:var(--_aeris-code-block-max-height, none)}.aeris-code-block__mobile-hint{display:block;padding:.375rem .75rem;text-align:end;font-size:var(--aeris-font-size-sm, .75rem);color:var(--aeris-text-2, #555)}}@media(prefers-reduced-motion:reduce){button{transition:none}}\n"]
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
424
|
+
minVersion: "12.0.0",
|
|
425
|
+
version: "22.2.2",
|
|
426
|
+
ngImport: i0,
|
|
427
|
+
type: AerisCodeBlock,
|
|
428
|
+
decorators: [{
|
|
429
|
+
type: Component,
|
|
430
|
+
args: [{
|
|
431
|
+
selector: "aeris-code-block",
|
|
432
|
+
host: {
|
|
433
|
+
class: "aeris-code-block",
|
|
434
|
+
"[attr.data-wrap]": "wrap() || null",
|
|
435
|
+
"[attr.data-line-numbers]": "lineNumbers() || null",
|
|
436
|
+
"[style.--_aeris-code-block-max-height]": "maxHeight()",
|
|
437
|
+
"[style.--aeris-code-block-tab-size]": "resolvedTabSize()"
|
|
438
|
+
},
|
|
439
|
+
template: "<div class=\"aeris-code-block__header\">\n @if (availableSources().length > 1) {\n <div class=\"aeris-code-block__toolbar\" role=\"tablist\" [attr.aria-label]=\"sourceTabsLabel()\">\n @for (item of availableSources(); track $index) {\n <button\n #tab\n type=\"button\"\n role=\"tab\"\n [id]=\"blockId + '-tab-' + $index\"\n [attr.aria-selected]=\"resolvedIndex() === $index\"\n [attr.aria-controls]=\"blockId + '-panel'\"\n [tabIndex]=\"resolvedIndex() === $index ? 0 : -1\"\n (click)=\"selectSource($index)\"\n (keydown)=\"handleTabKeydown($event, $index)\"\n >\n {{ item.label }}\n </button>\n }\n </div>\n } @else {\n <span class=\"aeris-code-block__label\">{{ source().label }}</span>\n }\n @if (copyable()) {\n <button\n class=\"aeris-code-block__copy\"\n type=\"button\"\n [attr.aria-label]=\"copyAriaLabel()\"\n [disabled]=\"copyState() === 'copying'\"\n (click)=\"copy()\"\n >\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n @if (copyState() === 'copied') {\n <path d=\"m5 12 4 4 10-10\" />\n } @else {\n <rect x=\"8\" y=\"8\" width=\"12\" height=\"12\" rx=\"2\" />\n <path d=\"M16 8V4H4v12h4\" />\n }\n </svg>\n <span class=\"aeris-code-block__copy-label\">{{\n copyState() === 'copied' ? copiedLabel() : copyLabel()\n }}</span>\n </button>\n }\n</div>\n<pre\n class=\"aeris-code-block__pre\"\n tabindex=\"0\"\n [id]=\"blockId + '-panel'\"\n [attr.role]=\"availableSources().length > 1 ? 'tabpanel' : 'region'\"\n [attr.aria-label]=\"availableSources().length > 1 ? null : ariaLabel()\"\n [attr.aria-labelledby]=\"\n availableSources().length > 1 ? blockId + '-tab-' + resolvedIndex() : null\n \"\n [attr.aria-description]=\"wrap() ? null : scrollDescription()\"\n><code>@for (line of lines(); track line.number) {<span class=\"aeris-code-block__line\" [attr.data-highlighted]=\"markedLines().has(line.number) || null\">@if (lineNumbers()) {<span class=\"aeris-code-block__number\" aria-hidden=\"true\">{{ line.number }}</span>}@for (token of line.tokens; track $index) {<span [attr.data-token]=\"token.light ? 'highlighted' : 'plain'\" [style.--_aeris-code-light]=\"token.light\" [style.--_aeris-code-dark]=\"token.dark\" [style.font-style]=\"token.italic\" [style.font-weight]=\"token.weight\" [style.text-decoration]=\"token.decoration\">{{ token.text }}</span>}</span>{{ line.ending }}}</code></pre>\n@if (!wrap() && scrollHint()) {\n <span class=\"aeris-code-block__mobile-hint\" aria-hidden=\"true\">{{ scrollHint() }}</span>\n}\n<span class=\"aeris-code-block__status\" role=\"status\" aria-live=\"polite\">{{ announcement() }}</span>\n",
|
|
440
|
+
styles: [":host{display:block;box-sizing:border-box;min-inline-size:0;max-inline-size:100%;overflow:hidden;border:1px solid var(--aeris-code-block-border, var(--aeris-border, #efefef));border-radius:var(--aeris-code-block-radius, var(--aeris-radius-surface, .6875rem));background:var(--aeris-code-block-background, var(--aeris-surface-2, #f3f3f3));color:var(--aeris-code-block-color, var(--aeris-text, #111111))}.aeris-code-block__header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;min-inline-size:0;border-block-end:1px solid var(--aeris-code-block-border, var(--aeris-border))}.aeris-code-block__toolbar{min-inline-size:0;display:flex;gap:var(--aeris-density-gap, .5rem);padding:var(--aeris-overlay-padding, .375rem);overflow-x:auto;scrollbar-width:none;touch-action:pan-x pan-y;overscroll-behavior-inline:contain;overscroll-behavior-x:contain}.aeris-code-block__label{min-inline-size:0;overflow-wrap:anywhere;padding:var(--aeris-item-padding-y, .5rem) var(--aeris-item-padding-x, .75rem);font-size:var(--aeris-font-size-md, .8125rem);font-weight:600}button{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;gap:var(--aeris-density-gap, .5rem);min-block-size:max(2rem,var(--aeris-control-height, 2.625rem) - .5rem);padding-inline:var(--aeris-control-padding-x, .75rem);border:1px solid transparent;border-radius:var(--aeris-radius-item, .4375rem);background:transparent;color:inherit;font:inherit;font-size:var(--aeris-font-size-md, .8125rem);white-space:nowrap;cursor:pointer;transition:background-color var(--aeris-motion-normal, .15s) ease}button[aria-selected=true]{background:var(--aeris-surface, #fff)}button:focus-visible,.aeris-code-block__pre:focus-visible{outline:2px solid var(--aeris-focus, #111111);outline-offset:-2px}button:disabled{opacity:.6;cursor:wait}@media(hover:hover){button:hover:not(:disabled){background:var(--aeris-interactive-hover, #e5e5e5)}}.aeris-code-block__copy{margin-inline-end:var(--aeris-overlay-padding, .375rem);margin-block:var(--aeris-overlay-padding, .375rem)}svg{inline-size:var(--aeris-icon-size, 1rem);block-size:var(--aeris-icon-size, 1rem);flex-shrink:0}.aeris-code-block__pre{box-sizing:border-box;inline-size:100%;max-inline-size:100%;max-block-size:var(--_aeris-code-block-max-height, var(--aeris-code-block-max-height, min(34rem, 68dvh)));margin:0;padding:var(--aeris-code-block-padding, var(--aeris-surface-padding, 1.25rem));overflow:auto;overscroll-behavior-inline:contain;overscroll-behavior-block:auto;overscroll-behavior-x:contain;overscroll-behavior-y:auto;touch-action:pan-x pan-y;scrollbar-width:thin;scrollbar-color:var(--aeris-border, #ddd) transparent;direction:ltr;text-align:start}code{display:block;inline-size:max-content;min-inline-size:100%;font:var(--aeris-code-block-font-size, .8125rem)/var(--aeris-code-block-line-height, 1.75) var(--aeris-code-block-font-family, ui-monospace, SFMono-Regular, Consolas, monospace);tab-size:var(--aeris-code-block-tab-size, 2);white-space:pre}.aeris-code-block__line{display:inline-block;min-inline-size:100%}.aeris-code-block__line[data-highlighted]{background:var(--aeris-code-block-line-highlight, var(--aeris-primary-soft, #e5e5e5))}.aeris-code-block__number{display:inline-block;inline-size:4ch;padding-inline-end:1rem;text-align:end;color:var(--aeris-text-2, #555);-webkit-user-select:none;user-select:none}:host([data-wrap]) code{inline-size:100%;white-space:pre-wrap;overflow-wrap:anywhere}[data-token]{color:var(--aeris-code-block-token-color, var(--_aeris-code-light, inherit))}:host-context([data-aeris-theme=dark]) [data-token]{color:var(--aeris-code-block-token-color, var(--_aeris-code-dark, inherit))}.aeris-code-block__status{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.aeris-code-block__mobile-hint{display:none}@media(max-width:40rem){.aeris-code-block__copy{inline-size:2.25rem;min-inline-size:2.25rem;padding-inline:0}.aeris-code-block__copy-label{display:none}.aeris-code-block__pre{max-block-size:var(--_aeris-code-block-max-height, none)}.aeris-code-block__mobile-hint{display:block;padding:.375rem .75rem;text-align:end;font-size:var(--aeris-font-size-sm, .75rem);color:var(--aeris-text-2, #555)}}@media(prefers-reduced-motion:reduce){button{transition:none}}\n"]
|
|
441
|
+
}]
|
|
442
|
+
}],
|
|
443
|
+
ctorParameters: () => [],
|
|
444
|
+
propDecorators: {
|
|
445
|
+
code: [{
|
|
446
|
+
type: i0.Input,
|
|
447
|
+
args: [{
|
|
448
|
+
isSignal: true,
|
|
449
|
+
alias: "code",
|
|
450
|
+
required: false
|
|
451
|
+
}]
|
|
452
|
+
}],
|
|
453
|
+
language: [{
|
|
454
|
+
type: i0.Input,
|
|
455
|
+
args: [{
|
|
456
|
+
isSignal: true,
|
|
457
|
+
alias: "language",
|
|
458
|
+
required: false
|
|
459
|
+
}]
|
|
460
|
+
}],
|
|
461
|
+
label: [{
|
|
462
|
+
type: i0.Input,
|
|
463
|
+
args: [{
|
|
464
|
+
isSignal: true,
|
|
465
|
+
alias: "label",
|
|
466
|
+
required: false
|
|
467
|
+
}]
|
|
468
|
+
}],
|
|
469
|
+
sources: [{
|
|
470
|
+
type: i0.Input,
|
|
471
|
+
args: [{
|
|
472
|
+
isSignal: true,
|
|
473
|
+
alias: "sources",
|
|
474
|
+
required: false
|
|
475
|
+
}]
|
|
476
|
+
}],
|
|
477
|
+
activeSource: [{
|
|
478
|
+
type: i0.Input,
|
|
479
|
+
args: [{
|
|
480
|
+
isSignal: true,
|
|
481
|
+
alias: "activeSource",
|
|
482
|
+
required: false
|
|
483
|
+
}]
|
|
484
|
+
}, {
|
|
485
|
+
type: i0.Output,
|
|
486
|
+
args: ["activeSourceChange"]
|
|
487
|
+
}],
|
|
488
|
+
highlight: [{
|
|
489
|
+
type: i0.Input,
|
|
490
|
+
args: [{
|
|
491
|
+
isSignal: true,
|
|
492
|
+
alias: "highlight",
|
|
493
|
+
required: false
|
|
494
|
+
}]
|
|
495
|
+
}],
|
|
496
|
+
lineNumbers: [{
|
|
497
|
+
type: i0.Input,
|
|
498
|
+
args: [{
|
|
499
|
+
isSignal: true,
|
|
500
|
+
alias: "lineNumbers",
|
|
501
|
+
required: false
|
|
502
|
+
}]
|
|
503
|
+
}],
|
|
504
|
+
highlightLines: [{
|
|
505
|
+
type: i0.Input,
|
|
506
|
+
args: [{
|
|
507
|
+
isSignal: true,
|
|
508
|
+
alias: "highlightLines",
|
|
509
|
+
required: false
|
|
510
|
+
}]
|
|
511
|
+
}],
|
|
512
|
+
wrap: [{
|
|
513
|
+
type: i0.Input,
|
|
514
|
+
args: [{
|
|
515
|
+
isSignal: true,
|
|
516
|
+
alias: "wrap",
|
|
517
|
+
required: false
|
|
518
|
+
}]
|
|
519
|
+
}],
|
|
520
|
+
maxHeight: [{
|
|
521
|
+
type: i0.Input,
|
|
522
|
+
args: [{
|
|
523
|
+
isSignal: true,
|
|
524
|
+
alias: "maxHeight",
|
|
525
|
+
required: false
|
|
526
|
+
}]
|
|
527
|
+
}],
|
|
528
|
+
tabSize: [{
|
|
529
|
+
type: i0.Input,
|
|
530
|
+
args: [{
|
|
531
|
+
isSignal: true,
|
|
532
|
+
alias: "tabSize",
|
|
533
|
+
required: false
|
|
534
|
+
}]
|
|
535
|
+
}],
|
|
536
|
+
copyable: [{
|
|
537
|
+
type: i0.Input,
|
|
538
|
+
args: [{
|
|
539
|
+
isSignal: true,
|
|
540
|
+
alias: "copyable",
|
|
541
|
+
required: false
|
|
542
|
+
}]
|
|
543
|
+
}],
|
|
544
|
+
ariaLabel: [{
|
|
545
|
+
type: i0.Input,
|
|
546
|
+
args: [{
|
|
547
|
+
isSignal: true,
|
|
548
|
+
alias: "ariaLabel",
|
|
549
|
+
required: false
|
|
550
|
+
}]
|
|
551
|
+
}],
|
|
552
|
+
copyLabel: [{
|
|
553
|
+
type: i0.Input,
|
|
554
|
+
args: [{
|
|
555
|
+
isSignal: true,
|
|
556
|
+
alias: "copyLabel",
|
|
557
|
+
required: false
|
|
558
|
+
}]
|
|
559
|
+
}],
|
|
560
|
+
copiedLabel: [{
|
|
561
|
+
type: i0.Input,
|
|
562
|
+
args: [{
|
|
563
|
+
isSignal: true,
|
|
564
|
+
alias: "copiedLabel",
|
|
565
|
+
required: false
|
|
566
|
+
}]
|
|
567
|
+
}],
|
|
568
|
+
copyAriaLabel: [{
|
|
569
|
+
type: i0.Input,
|
|
570
|
+
args: [{
|
|
571
|
+
isSignal: true,
|
|
572
|
+
alias: "copyAriaLabel",
|
|
573
|
+
required: false
|
|
574
|
+
}]
|
|
575
|
+
}],
|
|
576
|
+
copiedMessage: [{
|
|
577
|
+
type: i0.Input,
|
|
578
|
+
args: [{
|
|
579
|
+
isSignal: true,
|
|
580
|
+
alias: "copiedMessage",
|
|
581
|
+
required: false
|
|
582
|
+
}]
|
|
583
|
+
}],
|
|
584
|
+
copyErrorMessage: [{
|
|
585
|
+
type: i0.Input,
|
|
586
|
+
args: [{
|
|
587
|
+
isSignal: true,
|
|
588
|
+
alias: "copyErrorMessage",
|
|
589
|
+
required: false
|
|
590
|
+
}]
|
|
591
|
+
}],
|
|
592
|
+
sourceTabsLabel: [{
|
|
593
|
+
type: i0.Input,
|
|
594
|
+
args: [{
|
|
595
|
+
isSignal: true,
|
|
596
|
+
alias: "sourceTabsLabel",
|
|
597
|
+
required: false
|
|
598
|
+
}]
|
|
599
|
+
}],
|
|
600
|
+
scrollHint: [{
|
|
601
|
+
type: i0.Input,
|
|
602
|
+
args: [{
|
|
603
|
+
isSignal: true,
|
|
604
|
+
alias: "scrollHint",
|
|
605
|
+
required: false
|
|
606
|
+
}]
|
|
607
|
+
}],
|
|
608
|
+
scrollDescription: [{
|
|
609
|
+
type: i0.Input,
|
|
610
|
+
args: [{
|
|
611
|
+
isSignal: true,
|
|
612
|
+
alias: "scrollDescription",
|
|
613
|
+
required: false
|
|
614
|
+
}]
|
|
615
|
+
}],
|
|
616
|
+
copied: [{
|
|
617
|
+
type: i0.Output,
|
|
618
|
+
args: ["copied"]
|
|
619
|
+
}],
|
|
620
|
+
copyError: [{
|
|
621
|
+
type: i0.Output,
|
|
622
|
+
args: ["copyError"]
|
|
623
|
+
}],
|
|
624
|
+
highlightError: [{
|
|
625
|
+
type: i0.Output,
|
|
626
|
+
args: ["highlightError"]
|
|
627
|
+
}],
|
|
628
|
+
tabs: [{
|
|
629
|
+
type: i0.ViewChildren,
|
|
630
|
+
args: ["tab", { isSignal: true }]
|
|
631
|
+
}]
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
const AerisCodeBlockModule = [AerisCodeBlock];
|
|
635
|
+
export { AerisCodeBlock, AerisCodeBlockModule };
|
|
636
|
+
|
|
637
|
+
//# sourceMappingURL=aeris-ui-core-code-block.mjs.map
|