@ebrains/components 2.0.0 → 2.1.0
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/dist/cjs/clone-846acfdd.js +5 -0
- package/dist/cjs/color-primary-palette_6.cjs.entry.js +15 -15
- package/dist/cjs/components-section.cjs.entry.js +2 -2
- package/dist/cjs/components.cjs.js +2 -2
- package/dist/cjs/correct-use-of-colors.cjs.entry.js +2 -2
- package/dist/cjs/docs-palettes.cjs.entry.js +2 -2
- package/dist/cjs/docs-tokens.cjs.entry.js +2 -2
- package/dist/cjs/edit-ff5b84d8.js +5 -0
- package/dist/cjs/{eds-avatar_26.cjs.entry.js → eds-accordion_33.cjs.entry.js} +3467 -157
- package/dist/cjs/eds-app-root.cjs.entry.js +2 -2
- package/dist/cjs/eds-card-desc_2.cjs.entry.js +3 -3
- package/dist/cjs/eds-card-generic.cjs.entry.js +1 -1
- package/dist/cjs/eds-card-project.cjs.entry.js +2 -2
- package/dist/cjs/eds-card-section.cjs.entry.js +1 -1
- package/dist/cjs/eds-card-tags.cjs.entry.js +2 -2
- package/dist/cjs/eds-card-tool.cjs.entry.js +2 -2
- package/dist/cjs/eds-cookies-preference.cjs.entry.js +2 -2
- package/dist/cjs/eds-feedback.cjs.entry.js +2 -2
- package/dist/cjs/eds-footer.cjs.entry.js +9 -3
- package/dist/cjs/eds-frame.cjs.entry.js +2 -2
- package/dist/cjs/eds-fullscreen-menu.cjs.entry.js +1 -1
- package/dist/cjs/eds-gauge.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-arrow-diagonal.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-arrow-right.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-bin.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-bluesky.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-bookmark.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-chevron-down.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-chevron-left.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-chevron-right.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-chevron-up.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-clone.cjs.entry.js +18 -0
- package/dist/cjs/eds-icon-close.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-copy.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-draft.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-edit.cjs.entry.js +3 -3
- package/dist/cjs/eds-icon-eu.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-external.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-facebook.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-gitlab.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-linkedin.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-loader.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-mastodon.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-menu.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-minus.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-more.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-paper.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-plus.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-portal.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-private.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-public.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-search.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-star.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-start.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-success.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-thumbs-down.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-thumbs-up.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-tutorial.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-twitter.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-unknown.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-updown.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-user.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-view.cjs.entry.js +18 -0
- package/dist/cjs/eds-icon-youtube.cjs.entry.js +2 -2
- package/dist/cjs/eds-modal.cjs.entry.js +3 -3
- package/dist/cjs/eds-pie.cjs.entry.js +1 -1
- package/dist/cjs/eds-progress-bar.cjs.entry.js +2 -2
- package/dist/cjs/eds-section-core_2.cjs.entry.js +4 -4
- package/dist/cjs/eds-social-networks.cjs.entry.js +2 -2
- package/dist/cjs/eds-spinner.cjs.entry.js +2 -2
- package/dist/cjs/eds-splash-screen.cjs.entry.js +1 -1
- package/dist/cjs/eds-timeline.cjs.entry.js +2 -2
- package/dist/cjs/eds-toast-manager.cjs.entry.js +2 -2
- package/dist/cjs/eds-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/eds-trl.cjs.entry.js +2 -2
- package/dist/cjs/incorrect-use-of-colors.cjs.entry.js +2 -2
- package/dist/cjs/{index-88c8039f.js → index-0249a32e.js} +15 -28
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/logo-space.cjs.entry.js +2 -2
- package/dist/cjs/logo-variations-horizontal_2.cjs.entry.js +3 -3
- package/dist/cjs/logo-variations-tabs.cjs.entry.js +2 -2
- package/dist/cjs/logo-wrong-usage.cjs.entry.js +2 -2
- package/dist/cjs/svg-repository.cjs.entry.js +8 -4
- package/dist/cjs/token-list_3.cjs.entry.js +4 -4
- package/dist/cjs/token-ratios.cjs.entry.js +2 -2
- package/dist/cjs/token-spacing.cjs.entry.js +2 -2
- package/dist/cjs/token-typography.cjs.entry.js +2 -2
- package/dist/cjs/view-80d5c6c8.js +5 -0
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/eds-accordion/eds-accordion.js +1 -1
- package/dist/collection/components/eds-alert/eds-alert.js +30 -3
- package/dist/collection/components/eds-avatar/eds-avatar.js +1 -1
- package/dist/collection/components/eds-block-break/eds-block-break.js +1 -1
- package/dist/collection/components/eds-breadcrump/eds-breadcrump.js +1 -1
- package/dist/collection/components/eds-button/eds-button.css +4 -0
- package/dist/collection/components/eds-button/eds-button.js +19 -8
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-desc/eds-card-desc.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-tags/eds-card-tags.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-title/eds-card-title.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-project/eds-card-project.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-tool/eds-card-tool.js +1 -1
- package/dist/collection/components/eds-charts/eds-gauge/eds-gauge.js +1 -1
- package/dist/collection/components/eds-code-block/eds-code-block.js +1 -1
- package/dist/collection/components/eds-dropdown/eds-dropdown.js +2 -2
- package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-down/eds-icon-chevron-down.js +1 -1
- package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-left/eds-icon-chevron-left.js +1 -1
- package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-right/eds-icon-chevron-right.js +1 -1
- package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-up/eds-icon-chevron-up.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-arrow-diagonal/eds-icon-arrow-diagonal.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-arrow-right/eds-icon-arrow-right.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-bin/eds-icon-bin.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-bookmark/eds-icon-bookmark.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-clone/eds-icon-clone.js +36 -0
- package/dist/collection/components/eds-icons/eds-icon-close/eds-icon-close.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-copy/eds-icon-copy.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-draft/eds-icon-draft.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-edit/eds-icon-edit.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-eu/eds-icon-eu.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-external/eds-icon-external.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-gitlab/eds-icon-gitlab.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-loader/eds-icon-loader.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-menu/eds-icon-menu.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-minus/eds-icon-minus.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-more/eds-icon-more.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-paper/eds-icon-paper.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-plus/eds-icon-plus.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-portal/eds-icon-portal.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-private/eds-icon-private.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-public/eds-icon-public.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-search/eds-icon-search.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-star/eds-icon-star.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-start/eds-icon-start.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-success/eds-icon-success.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-thumbs-down/eds-icon-thumbs-down.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-thumbs-up/eds-icon-thumbs-up.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-tutorial/eds-icon-tutorial.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-unknown/eds-icon-unknown.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-updown/eds-icon-updown.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-user/eds-icon-user.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-view/eds-icon-view.js +36 -0
- package/dist/collection/components/eds-icons/social/eds-icon-bluesky/eds-icon-bluesky.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-facebook/eds-icon-facebook.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-linkedin/eds-icon-linkedin.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-mastodon/eds-icon-mastodon.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-twitter/eds-icon-twitter.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-youtube/eds-icon-youtube.js +1 -1
- package/dist/collection/components/eds-img/eds-img.js +2 -2
- package/dist/collection/components/eds-input-elements/eds-input/eds-input.js +2 -2
- package/dist/collection/components/eds-input-elements/eds-input-footer/eds-input-footer.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input-label/eds-input-label.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input-range/eds-input-range.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input-search/eds-input-search.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input-select/eds-input-select.js +2 -2
- package/dist/collection/components/eds-input-field/eds-input-field.js +3 -2
- package/dist/collection/components/eds-link/eds-link.js +27 -7
- package/dist/collection/components/eds-link/eds-link.stories.js +3 -1
- package/dist/collection/components/eds-logo/eds-logo.js +1 -1
- package/dist/collection/components/eds-modal/eds-modal.js +2 -2
- package/dist/collection/components/eds-nps/eds-npm.stories.js +36 -0
- package/dist/collection/components/eds-nps/eds-nps.css +73 -0
- package/dist/collection/components/eds-nps/eds-nps.js +163 -0
- package/dist/collection/components/eds-pagination/eds-pagination.css +4 -0
- package/dist/collection/components/eds-pagination/eds-pagination.js +130 -50
- package/dist/collection/components/eds-progress-bar/eds-progress-bar.js +1 -1
- package/dist/collection/components/eds-rating/eds-rating.js +25 -3
- package/dist/collection/components/eds-section/eds-section-core/eds-section-core.js +1 -1
- package/dist/collection/components/eds-section/eds-section-heading/eds-section-heading.js +2 -2
- package/dist/collection/components/eds-spinner/eds-spinner.js +1 -1
- package/dist/collection/components/eds-switch/eds-switch.css +15 -5
- package/dist/collection/components/eds-switch/eds-switch.js +26 -4
- package/dist/collection/components/eds-table/eds-table.js +38 -37
- package/dist/collection/components/eds-table/eds-table.stories.js +1 -1
- package/dist/collection/components/eds-tag/eds-tag.js +1 -1
- package/dist/collection/components/eds-timeline/eds-timeline.js +1 -1
- package/dist/collection/components/eds-tooltip/eds-tooltip.js +1 -1
- package/dist/collection/components/eds-trl/eds-trl.js +1 -1
- package/dist/collection/eds-docs-ui/colors/color-palette/primary.js +1 -1
- package/dist/collection/eds-docs-ui/colors/color-palette/secondary.js +1 -1
- package/dist/collection/eds-docs-ui/colors/color-palette/support.js +1 -1
- package/dist/collection/eds-docs-ui/colors/gradient-palette/primary.js +1 -1
- package/dist/collection/eds-docs-ui/colors/gradient-palette/secondary.js +7 -7
- package/dist/collection/eds-docs-ui/colors/gradient-palette/support.js +3 -3
- package/dist/collection/eds-docs-ui/colors/use-of-colors/correct-use-of-colors.js +1 -1
- package/dist/collection/eds-docs-ui/colors/use-of-colors/incorrect-use-of-colors.js +1 -1
- package/dist/collection/eds-docs-ui/components-section/components-section.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/docs-tokens/docs-tokens.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-list/token-list.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-radii/token-radii.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-ratios/token-ratios.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-shadows/token-shadows.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-spacing/token-spacing.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-typography/token-typography.js +1 -1
- package/dist/collection/eds-docs-ui/docs-palettes/docs-palettes.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-space/logo-space.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-variations/horizontal/logo-variations-horizontal.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-variations/vertical/logo-variations-vertical.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-variations-tabs/logo-variations.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-wrong-usage/logo-wrong-usage.js +1 -1
- package/dist/collection/eds-docs-ui/svg-repository/svg-repository.js +1 -1
- package/dist/collection/shared-ui/eds-cookies-preference/eds-cookies-preference.js +1 -1
- package/dist/collection/shared-ui/eds-feedback/eds-feedback.js +1 -1
- package/dist/collection/shared-ui/eds-footer/eds-footer.js +8 -2
- package/dist/collection/shared-ui/eds-form/eds-form.js +26 -4
- package/dist/collection/shared-ui/eds-form/eds-form.stories.js +1 -1
- package/dist/collection/shared-ui/eds-frame/eds-frame.js +1 -1
- package/dist/collection/shared-ui/eds-header/eds-header.js +1 -1
- package/dist/collection/shared-ui/eds-social-networks/eds-social-networks.js +1 -1
- package/dist/collection/shared-ui/eds-tabs/eds-tabs.css +26 -5
- package/dist/collection/shared-ui/eds-tabs/eds-tabs.js +89 -31
- package/dist/collection/shared-ui/eds-toast-manager/eds-toast-manager.js +1 -1
- package/dist/collection/shared-ui/eds-user/eds-user.js +1 -1
- package/dist/collection/shared-ui/examples/eds-app-root/eds-app-root.js +1 -1
- package/dist/collection/utils/eds-form/formValidators.js +33 -0
- package/dist/components/clone.js +3 -0
- package/dist/components/components-section.js +1 -1
- package/dist/components/components.css +7 -9
- package/dist/components/components.esm.js +1 -1
- package/dist/components/correct-use-of-colors.js +1 -1
- package/dist/components/docs-palettes.js +1 -1
- package/dist/components/docs-tokens.js +1 -1
- package/dist/components/edit.js +1 -1
- package/dist/components/eds-accordion2.js +1 -1
- package/dist/components/eds-alert2.js +21 -5
- package/dist/components/eds-app-root.js +1 -1
- package/dist/components/eds-avatar2.js +1 -1
- package/dist/components/eds-block-break2.js +1 -1
- package/dist/components/eds-breadcrumb.js +1 -1
- package/dist/components/eds-button2.js +21 -10
- package/dist/components/eds-card-desc2.js +1 -1
- package/dist/components/eds-card-project.js +1 -1
- package/dist/components/eds-card-tags.js +1 -1
- package/dist/components/eds-card-title2.js +1 -1
- package/dist/components/eds-card-tool.js +1 -1
- package/dist/components/eds-code-block2.js +1 -1
- package/dist/components/eds-cookies-preference.js +1 -1
- package/dist/components/eds-dropdown2.js +2 -2
- package/dist/components/eds-feedback.js +1 -1
- package/dist/components/eds-footer2.js +8 -2
- package/dist/components/eds-form.js +80 -22
- package/dist/components/eds-frame.js +1 -1
- package/dist/components/eds-gauge.js +1 -1
- package/dist/components/eds-header.js +1 -1
- package/dist/components/eds-icon-arrow-diagonal.js +1 -1
- package/dist/components/eds-icon-arrow-right.js +1 -1
- package/dist/components/eds-icon-bin.js +1 -1
- package/dist/components/eds-icon-bluesky.js +1 -1
- package/dist/components/eds-icon-bookmark.js +1 -1
- package/dist/components/eds-icon-chevron-down.js +1 -1
- package/dist/components/eds-icon-chevron-left.js +1 -1
- package/dist/components/eds-icon-chevron-right.js +1 -1
- package/dist/components/eds-icon-chevron-up.js +1 -1
- package/dist/components/eds-icon-clone.d.ts +11 -0
- package/dist/components/eds-icon-clone.js +33 -0
- package/dist/components/eds-icon-close.js +1 -1
- package/dist/components/eds-icon-copy.js +1 -1
- package/dist/components/eds-icon-draft.js +1 -1
- package/dist/components/eds-icon-edit.js +1 -1
- package/dist/components/eds-icon-eu.js +1 -1
- package/dist/components/eds-icon-external.js +1 -1
- package/dist/components/eds-icon-facebook.js +1 -1
- package/dist/components/eds-icon-gitlab.js +1 -1
- package/dist/components/eds-icon-linkedin.js +1 -1
- package/dist/components/eds-icon-loader.js +1 -1
- package/dist/components/eds-icon-mastodon.js +1 -1
- package/dist/components/eds-icon-menu.js +1 -1
- package/dist/components/eds-icon-minus.js +1 -1
- package/dist/components/eds-icon-more.js +1 -1
- package/dist/components/eds-icon-paper.js +1 -1
- package/dist/components/eds-icon-plus.js +1 -1
- package/dist/components/eds-icon-portal.js +1 -1
- package/dist/components/eds-icon-private.js +1 -1
- package/dist/components/eds-icon-public.js +1 -1
- package/dist/components/eds-icon-search.js +1 -1
- package/dist/components/eds-icon-star.js +1 -1
- package/dist/components/eds-icon-start.js +1 -1
- package/dist/components/eds-icon-success.js +1 -1
- package/dist/components/eds-icon-thumbs-down.js +1 -1
- package/dist/components/eds-icon-thumbs-up.js +1 -1
- package/dist/components/eds-icon-tutorial.js +1 -1
- package/dist/components/eds-icon-twitter.js +1 -1
- package/dist/components/eds-icon-unknown.js +1 -1
- package/dist/components/eds-icon-updown.js +1 -1
- package/dist/components/eds-icon-user.js +1 -1
- package/dist/components/eds-icon-view.d.ts +11 -0
- package/dist/components/eds-icon-view.js +33 -0
- package/dist/components/eds-icon-youtube.js +1 -1
- package/dist/components/eds-img2.js +2 -2
- package/dist/components/eds-input-field2.js +4 -3
- package/dist/components/eds-input-footer2.js +1 -1
- package/dist/components/eds-input-label2.js +1 -1
- package/dist/components/eds-input-range2.js +1 -1
- package/dist/components/eds-input-search2.js +1 -1
- package/dist/components/eds-input-select2.js +2 -2
- package/dist/components/eds-input2.js +2 -2
- package/dist/components/eds-link2.js +27 -7
- package/dist/components/eds-logo2.js +1 -1
- package/dist/components/eds-modal.js +2 -2
- package/dist/components/eds-nps.d.ts +11 -0
- package/dist/components/eds-nps.js +6 -0
- package/dist/components/eds-nps2.js +120 -0
- package/dist/components/eds-pagination2.js +119 -52
- package/dist/components/eds-progress-bar2.js +1 -1
- package/dist/components/eds-rating2.js +25 -3
- package/dist/components/eds-section-core2.js +1 -1
- package/dist/components/eds-section-heading2.js +2 -2
- package/dist/components/eds-social-networks2.js +1 -1
- package/dist/components/eds-spinner2.js +1 -1
- package/dist/components/eds-switch.js +27 -5
- package/dist/components/eds-table2.js +45 -20
- package/dist/components/eds-tabs.js +90 -32
- package/dist/components/eds-tag2.js +1 -1
- package/dist/components/eds-timeline.js +1 -1
- package/dist/components/eds-toast-manager.js +1 -1
- package/dist/components/eds-tooltip.js +1 -1
- package/dist/components/eds-trl.js +8 -2
- package/dist/components/eds-user.js +3 -9
- package/dist/components/incorrect-use-of-colors.js +9 -3
- package/dist/components/logo-space.js +8 -2
- package/dist/components/logo-variations-horizontal2.js +1 -1
- package/dist/components/logo-variations-tabs.js +1 -1
- package/dist/components/logo-variations-vertical2.js +1 -1
- package/dist/components/logo-wrong-usage.js +1 -1
- package/dist/components/p-05654483.entry.js +1 -0
- package/dist/components/{p-9e53eca3.entry.js → p-09079c5c.entry.js} +1 -1
- package/dist/components/p-10997947.entry.js +1 -0
- package/dist/components/p-19e69c03.entry.js +1 -0
- package/dist/components/p-1ab1ea29.entry.js +1 -0
- package/dist/components/p-1bcf743d.entry.js +1 -0
- package/dist/components/{p-9d18d7b1.entry.js → p-1d18106d.entry.js} +1 -1
- package/dist/components/{p-adbd0d7b.entry.js → p-265150a1.entry.js} +1 -1
- package/dist/components/p-27c4a06e.js +1 -0
- package/dist/components/{p-e35e156d.entry.js → p-2e0c3fc4.entry.js} +1 -1
- package/dist/components/{p-6d3b5818.entry.js → p-2ef4dd11.entry.js} +1 -1
- package/dist/components/p-3360e1e2.entry.js +1 -0
- package/dist/components/{p-93e6ba0f.entry.js → p-38bc21e9.entry.js} +1 -1
- package/dist/components/p-3b29e0fd.entry.js +1 -0
- package/dist/components/p-42457a0f.entry.js +1 -0
- package/dist/components/p-4a6a72db.entry.js +1 -0
- package/dist/components/p-4b33909d.entry.js +1 -0
- package/dist/components/p-4bf4bc93.entry.js +1 -0
- package/dist/components/{p-773a119a.entry.js → p-4c84fcf4.entry.js} +1 -1
- package/dist/components/p-4eb2cf7f.js +1 -0
- package/dist/components/p-5367bb59.entry.js +1 -0
- package/dist/components/p-547a53d6.entry.js +1 -0
- package/dist/components/p-560fc3a4.entry.js +1 -0
- package/dist/components/p-5a58f1c1.entry.js +1 -0
- package/dist/components/p-5b55f951.entry.js +1 -0
- package/dist/components/p-5ba49cf2.entry.js +1 -0
- package/dist/components/p-5dd85979.entry.js +1 -0
- package/dist/components/{p-356846cd.entry.js → p-5f348b0e.entry.js} +1 -1
- package/dist/components/p-634b6ca2.entry.js +1 -0
- package/dist/components/{p-b073d78f.entry.js → p-64b7a6fc.entry.js} +1 -1
- package/dist/components/{p-02d94d2d.entry.js → p-6614881d.entry.js} +1 -1
- package/dist/components/{p-2839899a.entry.js → p-67ec46b4.entry.js} +1 -1
- package/dist/components/p-6b988c76.entry.js +1 -0
- package/dist/components/p-6cd6ff0c.entry.js +1 -0
- package/dist/components/{p-f6ca2aa6.entry.js → p-706a106c.entry.js} +1 -1
- package/dist/components/p-71ee4af2.entry.js +1 -0
- package/dist/components/{p-794f11e7.entry.js → p-743f9f8f.entry.js} +1 -1
- package/dist/components/p-789f54cb.entry.js +1 -0
- package/dist/components/{p-8c0b0121.entry.js → p-79afd8aa.entry.js} +1 -1
- package/dist/components/{p-b3a40663.entry.js → p-7a3f2576.entry.js} +1 -1
- package/dist/components/p-7a5623b5.entry.js +1 -0
- package/dist/components/p-7ca6db64.entry.js +1 -0
- package/dist/components/p-7fa46b01.entry.js +1 -0
- package/dist/components/{p-3e183368.entry.js → p-8627afc0.entry.js} +1 -1
- package/dist/components/p-86eff0cb.entry.js +1 -0
- package/dist/components/p-89048f87.entry.js +1 -0
- package/dist/components/p-8cf98230.entry.js +1 -0
- package/dist/components/{p-8dee879d.entry.js → p-8d363a3c.entry.js} +1 -1
- package/dist/components/p-9261d27c.entry.js +1 -0
- package/dist/components/p-97323c46.entry.js +1 -0
- package/dist/components/p-9b90296c.entry.js +1 -0
- package/dist/components/{p-1f5c19b9.entry.js → p-9c1c5e8d.entry.js} +1 -1
- package/dist/components/p-9cb14b1f.entry.js +1 -0
- package/dist/components/p-9f0a34b4.entry.js +1 -0
- package/dist/components/p-a8ca8346.entry.js +1 -0
- package/dist/components/{p-43468b0f.entry.js → p-ab3b0a53.entry.js} +1 -1
- package/dist/components/p-b0d38b78.entry.js +1 -0
- package/dist/components/{p-66f4cdd9.entry.js → p-b31babda.entry.js} +1 -1
- package/dist/components/p-b6ee4250.entry.js +1 -0
- package/dist/components/{p-0687532c.entry.js → p-b88a2267.entry.js} +1 -1
- package/dist/components/{p-024789cc.entry.js → p-b9a1aba3.entry.js} +1 -1
- package/dist/components/p-b9fdcb1b.entry.js +1 -0
- package/dist/components/{p-73c74835.entry.js → p-ba9f41de.entry.js} +1 -1
- package/dist/components/p-beacaa4f.entry.js +1 -0
- package/dist/components/p-bfa23535.entry.js +1 -0
- package/dist/components/p-c4ac0528.entry.js +1 -0
- package/dist/components/p-cb114bf4.entry.js +1 -0
- package/dist/components/p-cd05a97b.entry.js +1 -0
- package/dist/components/{p-3a331c68.entry.js → p-cd787744.entry.js} +1 -1
- package/dist/components/p-cdc1c8e8.entry.js +1 -0
- package/dist/components/{p-4e473b4e.entry.js → p-d1927da7.entry.js} +1 -1
- package/dist/components/{p-564431ad.entry.js → p-d1d1943b.entry.js} +1 -1
- package/dist/components/{p-543f2347.entry.js → p-d2e485a1.entry.js} +1 -1
- package/dist/components/{p-e2e7250a.entry.js → p-d95d7353.entry.js} +1 -1
- package/dist/components/{p-76905315.entry.js → p-e0ada7e0.entry.js} +1 -1
- package/dist/components/{p-70e8e66f.entry.js → p-e210ddbb.entry.js} +1 -1
- package/dist/components/p-e5892379.entry.js +1 -0
- package/dist/components/p-e8374410.entry.js +1 -0
- package/dist/components/p-e90da4ba.entry.js +1 -0
- package/dist/components/p-ec706eed.entry.js +1 -0
- package/dist/components/{p-28ae3f3a.js → p-efbc374c.js} +2 -2
- package/dist/components/p-f2abe4d8.js +1 -0
- package/dist/components/p-f32963ff.entry.js +9 -0
- package/dist/components/p-f40dd50d.entry.js +1 -0
- package/dist/components/p-f6012c17.entry.js +1 -0
- package/dist/components/p-fcba31fa.entry.js +1 -0
- package/dist/components/primary.js +1 -1
- package/dist/components/primary2.js +1 -1
- package/dist/components/secondary.js +1 -1
- package/dist/components/secondary2.js +7 -7
- package/dist/components/support.js +1 -1
- package/dist/components/support2.js +3 -3
- package/dist/components/svg-repository.js +13 -3
- package/dist/components/token-list2.js +1 -1
- package/dist/components/token-radii2.js +1 -1
- package/dist/components/token-ratios.js +1 -1
- package/dist/components/token-shadows2.js +1 -1
- package/dist/components/token-spacing.js +1 -1
- package/dist/components/token-typography.js +1 -1
- package/dist/components/view.js +3 -0
- package/dist/esm/clone-dab56639.js +3 -0
- package/dist/esm/color-primary-palette_6.entry.js +15 -15
- package/dist/esm/components-section.entry.js +2 -2
- package/dist/esm/components.js +3 -3
- package/dist/esm/correct-use-of-colors.entry.js +2 -2
- package/dist/esm/docs-palettes.entry.js +2 -2
- package/dist/esm/docs-tokens.entry.js +2 -2
- package/dist/esm/edit-3893a517.js +3 -0
- package/dist/esm/{eds-avatar_26.entry.js → eds-accordion_33.entry.js} +3462 -159
- package/dist/esm/eds-app-root.entry.js +2 -2
- package/dist/esm/eds-card-desc_2.entry.js +3 -3
- package/dist/esm/eds-card-generic.entry.js +1 -1
- package/dist/esm/eds-card-project.entry.js +2 -2
- package/dist/esm/eds-card-section.entry.js +1 -1
- package/dist/esm/eds-card-tags.entry.js +2 -2
- package/dist/esm/eds-card-tool.entry.js +2 -2
- package/dist/esm/eds-cookies-preference.entry.js +2 -2
- package/dist/esm/eds-feedback.entry.js +2 -2
- package/dist/esm/eds-footer.entry.js +9 -3
- package/dist/esm/eds-frame.entry.js +2 -2
- package/dist/esm/eds-fullscreen-menu.entry.js +1 -1
- package/dist/esm/eds-gauge.entry.js +2 -2
- package/dist/esm/eds-icon-arrow-diagonal.entry.js +2 -2
- package/dist/esm/eds-icon-arrow-right.entry.js +2 -2
- package/dist/esm/eds-icon-bin.entry.js +2 -2
- package/dist/esm/eds-icon-bluesky.entry.js +2 -2
- package/dist/esm/eds-icon-bookmark.entry.js +2 -2
- package/dist/esm/eds-icon-chevron-down.entry.js +2 -2
- package/dist/esm/eds-icon-chevron-left.entry.js +2 -2
- package/dist/esm/eds-icon-chevron-right.entry.js +2 -2
- package/dist/esm/eds-icon-chevron-up.entry.js +2 -2
- package/dist/esm/eds-icon-clone.entry.js +14 -0
- package/dist/esm/eds-icon-close.entry.js +2 -2
- package/dist/esm/eds-icon-copy.entry.js +2 -2
- package/dist/esm/eds-icon-draft.entry.js +2 -2
- package/dist/esm/eds-icon-edit.entry.js +3 -3
- package/dist/esm/eds-icon-eu.entry.js +2 -2
- package/dist/esm/eds-icon-external.entry.js +2 -2
- package/dist/esm/eds-icon-facebook.entry.js +2 -2
- package/dist/esm/eds-icon-gitlab.entry.js +2 -2
- package/dist/esm/eds-icon-linkedin.entry.js +2 -2
- package/dist/esm/eds-icon-loader.entry.js +2 -2
- package/dist/esm/eds-icon-mastodon.entry.js +2 -2
- package/dist/esm/eds-icon-menu.entry.js +2 -2
- package/dist/esm/eds-icon-minus.entry.js +2 -2
- package/dist/esm/eds-icon-more.entry.js +2 -2
- package/dist/esm/eds-icon-paper.entry.js +2 -2
- package/dist/esm/eds-icon-plus.entry.js +2 -2
- package/dist/esm/eds-icon-portal.entry.js +2 -2
- package/dist/esm/eds-icon-private.entry.js +2 -2
- package/dist/esm/eds-icon-public.entry.js +2 -2
- package/dist/esm/eds-icon-search.entry.js +2 -2
- package/dist/esm/eds-icon-star.entry.js +2 -2
- package/dist/esm/eds-icon-start.entry.js +2 -2
- package/dist/esm/eds-icon-success.entry.js +2 -2
- package/dist/esm/eds-icon-thumbs-down.entry.js +2 -2
- package/dist/esm/eds-icon-thumbs-up.entry.js +2 -2
- package/dist/esm/eds-icon-tutorial.entry.js +2 -2
- package/dist/esm/eds-icon-twitter.entry.js +2 -2
- package/dist/esm/eds-icon-unknown.entry.js +2 -2
- package/dist/esm/eds-icon-updown.entry.js +2 -2
- package/dist/esm/eds-icon-user.entry.js +2 -2
- package/dist/esm/eds-icon-view.entry.js +14 -0
- package/dist/esm/eds-icon-youtube.entry.js +2 -2
- package/dist/esm/eds-modal.entry.js +3 -3
- package/dist/esm/eds-pie.entry.js +1 -1
- package/dist/esm/eds-progress-bar.entry.js +2 -2
- package/dist/esm/eds-section-core_2.entry.js +4 -4
- package/dist/esm/eds-social-networks.entry.js +2 -2
- package/dist/esm/eds-spinner.entry.js +2 -2
- package/dist/esm/eds-splash-screen.entry.js +1 -1
- package/dist/esm/eds-timeline.entry.js +2 -2
- package/dist/esm/eds-toast-manager.entry.js +2 -2
- package/dist/esm/eds-tooltip.entry.js +2 -2
- package/dist/esm/eds-trl.entry.js +2 -2
- package/dist/esm/incorrect-use-of-colors.entry.js +2 -2
- package/dist/esm/{index-fdb33359.js → index-e84b871c.js} +15 -28
- package/dist/esm/loader.js +3 -3
- package/dist/esm/logo-space.entry.js +2 -2
- package/dist/esm/logo-variations-horizontal_2.entry.js +3 -3
- package/dist/esm/logo-variations-tabs.entry.js +2 -2
- package/dist/esm/logo-wrong-usage.entry.js +2 -2
- package/dist/esm/svg-repository.entry.js +8 -4
- package/dist/esm/token-list_3.entry.js +4 -4
- package/dist/esm/token-ratios.entry.js +2 -2
- package/dist/esm/token-spacing.entry.js +2 -2
- package/dist/esm/token-typography.entry.js +2 -2
- package/dist/esm/view-e900f2d4.js +3 -0
- package/dist/hydrate/index.js +690 -257
- package/dist/hydrate/index.mjs +690 -257
- package/dist/types/Users/nigeor/Documents/Projects/EBRAINS/ebrains-ui-ecosystem/packages/components/.stencil/packages/svgs/src/lib/svgs.d.ts +3 -1
- package/dist/types/components/eds-alert/eds-alert.d.ts +6 -0
- package/dist/types/components/eds-button/eds-button.d.ts +1 -0
- package/dist/types/components/eds-icons/eds-icon-clone/eds-icon-clone.d.ts +10 -0
- package/dist/types/components/eds-icons/eds-icon-view/eds-icon-view.d.ts +10 -0
- package/dist/types/components/eds-link/eds-link.d.ts +1 -0
- package/dist/types/components/eds-nps/eds-npm.stories.d.ts +28 -0
- package/dist/types/components/eds-nps/eds-nps.d.ts +20 -0
- package/dist/types/components/eds-pagination/eds-pagination.d.ts +23 -2
- package/dist/types/components/eds-rating/eds-rating.d.ts +3 -1
- package/dist/types/components/eds-switch/eds-switch.d.ts +1 -0
- package/dist/types/components/eds-table/eds-table.d.ts +3 -4
- package/dist/types/components/eds-table/eds-table.stories.d.ts +7 -2
- package/dist/types/components.d.ts +133 -12
- package/dist/types/shared-ui/eds-form/eds-form.d.ts +1 -0
- package/dist/types/shared-ui/eds-tabs/eds-tabs.d.ts +7 -9
- package/dist/types/utils/eds-form/formValidators.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/edit-5714c144.js +0 -5
- package/dist/cjs/eds-accordion.cjs.entry.js +0 -87
- package/dist/cjs/eds-alert.cjs.entry.js +0 -104
- package/dist/cjs/eds-breadcrumb.cjs.entry.js +0 -145
- package/dist/cjs/eds-code-block.cjs.entry.js +0 -2489
- package/dist/cjs/eds-matomo-notice.cjs.entry.js +0 -125
- package/dist/cjs/eds-switch.cjs.entry.js +0 -46
- package/dist/components/p-023bc47c.entry.js +0 -1
- package/dist/components/p-02df910c.entry.js +0 -1
- package/dist/components/p-0be79e08.entry.js +0 -1
- package/dist/components/p-0e74d8b4.entry.js +0 -1
- package/dist/components/p-11efb1d1.entry.js +0 -1
- package/dist/components/p-1791ce82.entry.js +0 -1
- package/dist/components/p-19d586e6.entry.js +0 -1
- package/dist/components/p-2679926c.entry.js +0 -1
- package/dist/components/p-2d1a7471.entry.js +0 -1
- package/dist/components/p-2ff16a39.entry.js +0 -1
- package/dist/components/p-32e18e48.entry.js +0 -1
- package/dist/components/p-38e99d4b.entry.js +0 -1
- package/dist/components/p-4088ae0e.entry.js +0 -1
- package/dist/components/p-4277fb1a.entry.js +0 -1
- package/dist/components/p-42a73db4.entry.js +0 -1
- package/dist/components/p-44055e68.entry.js +0 -1
- package/dist/components/p-4a5d0dcd.entry.js +0 -1
- package/dist/components/p-4a7412ec.entry.js +0 -1
- package/dist/components/p-4b88d84c.entry.js +0 -1
- package/dist/components/p-50f43dfd.entry.js +0 -1
- package/dist/components/p-562afa88.entry.js +0 -1
- package/dist/components/p-5aa4065a.entry.js +0 -1
- package/dist/components/p-5ae1c931.entry.js +0 -1
- package/dist/components/p-634258e6.entry.js +0 -1
- package/dist/components/p-68f45098.entry.js +0 -1
- package/dist/components/p-73a44c48.entry.js +0 -1
- package/dist/components/p-7dbe791f.entry.js +0 -1
- package/dist/components/p-7ec52188.entry.js +0 -1
- package/dist/components/p-7fc84bb2.js +0 -1
- package/dist/components/p-82559816.entry.js +0 -1
- package/dist/components/p-85683b18.entry.js +0 -1
- package/dist/components/p-8681e5d8.entry.js +0 -1
- package/dist/components/p-877d13d9.entry.js +0 -1
- package/dist/components/p-911b1c0b.entry.js +0 -1
- package/dist/components/p-960aa103.entry.js +0 -1
- package/dist/components/p-996005b7.entry.js +0 -1
- package/dist/components/p-aa5e75b4.entry.js +0 -1
- package/dist/components/p-ae9393b6.entry.js +0 -1
- package/dist/components/p-af137162.entry.js +0 -1
- package/dist/components/p-b630e51a.entry.js +0 -1
- package/dist/components/p-bb9af709.entry.js +0 -1
- package/dist/components/p-c2dc3692.entry.js +0 -1
- package/dist/components/p-c91b4eec.entry.js +0 -1
- package/dist/components/p-caff3355.entry.js +0 -1
- package/dist/components/p-ce66ea37.entry.js +0 -1
- package/dist/components/p-d4f239d7.entry.js +0 -1
- package/dist/components/p-d7251d4d.entry.js +0 -1
- package/dist/components/p-deb9bbed.entry.js +0 -1
- package/dist/components/p-ed4d9bf5.entry.js +0 -1
- package/dist/components/p-ed7696a2.entry.js +0 -1
- package/dist/components/p-f2416727.entry.js +0 -1
- package/dist/components/p-f28b5da7.entry.js +0 -1
- package/dist/components/p-f3839914.entry.js +0 -1
- package/dist/components/p-f42b6251.entry.js +0 -1
- package/dist/components/p-f7a31196.entry.js +0 -1
- package/dist/components/p-f973c83b.entry.js +0 -1
- package/dist/components/p-fe167c78.entry.js +0 -9
- package/dist/esm/edit-1dc8d11b.js +0 -3
- package/dist/esm/eds-accordion.entry.js +0 -83
- package/dist/esm/eds-alert.entry.js +0 -100
- package/dist/esm/eds-breadcrumb.entry.js +0 -141
- package/dist/esm/eds-code-block.entry.js +0 -2485
- package/dist/esm/eds-matomo-notice.entry.js +0 -121
- package/dist/esm/eds-switch.entry.js +0 -42
- /package/dist/collection/shared-ui/eds-toast-manager/{eds-toast-manager.stories.js → eds-toast-manager.st.js} +0 -0
- /package/dist/types/shared-ui/eds-toast-manager/{eds-toast-manager.stories.d.ts → eds-toast-manager.st.d.ts} +0 -0
|
@@ -2,13 +2,198 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-0249a32e.js');
|
|
6
6
|
const analytics = require('./analytics-28713bf7.js');
|
|
7
7
|
const index$1 = require('./index-ab9fbefe.js');
|
|
8
8
|
const sharedUtils = require('./sharedUtils-8e287250.js');
|
|
9
9
|
const logoColor = require('./logo-color-6c787ac1.js');
|
|
10
10
|
const logoWhiteNoBg = require('./logo-white-no-bg-4a0e0f4b.js');
|
|
11
11
|
|
|
12
|
+
const edsAccordionCss = "blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}.min-h-56{min-height:3.5rem}.container{width:calc(var(--container-width, 100%) - (2 * var(--breakout-container-outer-gutter, var(--container-outer-gutter, var(--outer-gutter, 0)))));margin-right:auto;margin-left:auto}.container>*{--container-outer-gutter:0;--breakout-container-outer-gutter:0}.break-words{overflow-wrap:break-word}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.effect-color{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.border-softer{border:2px solid rgba(0, 0, 0, .1)}.bg-default{background-color:var(--grey-200)}.bg-inverse{background-color:var(--white)}.relative{position:relative}.absolute{position:absolute}.inset-x-16{left:1rem;right:1rem}.top-16{top:1rem}.pr-32{padding-right:2rem}.pr-36{padding-right:2.25rem}.pr-40{padding-right:2.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.line-clamp-4{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4}.w-full{width:100%}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.rounded-md{border-radius:12px}.outline-none{outline:2px solid transparent;outline-offset:2px}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.text-light{color:var(--grey-700)}.z-1{z-index:1}.z-10{z-index:10}.effect-height{transition-duration:300ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-property:height}.h-0{height:0rem}.h-auto{height:auto}.pt-4{padding-top:0.25rem}.overflow-hidden{overflow:hidden}.grid{display:grid}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-16{padding:1rem}.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}.f-heading-06{font-family:var(--f-heading-06-fontFamily);font-weight:var(--f-heading-06-fontWeight);font-size:var(--f-heading-06-fontSize);line-height:var(--f-heading-06-lineHeight);letter-spacing:var(--f-heading-06-letterSpacing)}.text-left{text-align:left}.text-center{text-align:center}";
|
|
13
|
+
const EdsAccordionStyle0 = edsAccordionCss;
|
|
14
|
+
|
|
15
|
+
const EdsAccordion = class {
|
|
16
|
+
constructor(hostRef) {
|
|
17
|
+
index.registerInstance(this, hostRef);
|
|
18
|
+
this.accordion = index.createEvent(this, "accordion", 7);
|
|
19
|
+
/**
|
|
20
|
+
* Handles the click event on the accordion header to toggle expansion.
|
|
21
|
+
* Toggles the `isExpanded` state and emits the `accordion` event.
|
|
22
|
+
*/
|
|
23
|
+
this.handleClick = () => {
|
|
24
|
+
var _a;
|
|
25
|
+
this.isExpanded = !this.isExpanded;
|
|
26
|
+
this.accordion.emit(this.isExpanded);
|
|
27
|
+
this.setPanelHeight();
|
|
28
|
+
analytics.sendAnalytics({
|
|
29
|
+
category: 'ui-component',
|
|
30
|
+
parentContext: null,
|
|
31
|
+
tag: this.el.tagName.toLowerCase(),
|
|
32
|
+
name: ((_a = this.heading) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
|
|
33
|
+
action: this.isExpanded ? 'expanded' : 'collapsed'
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Calculates and sets the panel height based on the content height
|
|
38
|
+
* and adjusts based on the `shortContent` and `isExpanded` states.
|
|
39
|
+
*/
|
|
40
|
+
this.setPanelHeight = () => {
|
|
41
|
+
if (this.childContentRef) {
|
|
42
|
+
this.shortContent =
|
|
43
|
+
this.wrapperRef.scrollWidth > 830 && !this.description
|
|
44
|
+
? this.childContentRef.scrollHeight <= 80
|
|
45
|
+
: this.childContentRef.scrollHeight <= 20;
|
|
46
|
+
this.panelHeight = this.isExpanded && !this.shortContent ? this.childContentRef.scrollHeight : 0;
|
|
47
|
+
}
|
|
48
|
+
if (this.headerRef) {
|
|
49
|
+
this.headerHeight = this.headerRef.scrollHeight - 30;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
this.heading = undefined;
|
|
53
|
+
this.description = undefined;
|
|
54
|
+
this.switchBg = true;
|
|
55
|
+
this.expanded = false;
|
|
56
|
+
this.clampText = true;
|
|
57
|
+
this.buttonIntent = 'tertiary';
|
|
58
|
+
this.isExpanded = this.expanded;
|
|
59
|
+
this.panelHeight = 0;
|
|
60
|
+
this.shortContent = false;
|
|
61
|
+
this.headerHeight = 0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Lifecycle method that sets up the initial panel height and adds a resize event listener
|
|
65
|
+
* to recalculate height on window resize.
|
|
66
|
+
*/
|
|
67
|
+
componentDidLoad() {
|
|
68
|
+
this.setPanelHeight();
|
|
69
|
+
window.addEventListener('resize', this.setPanelHeight);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Lifecycle method that cleans up the resize event listener when the component is removed.
|
|
73
|
+
*/
|
|
74
|
+
disconnectedCallback() {
|
|
75
|
+
window.removeEventListener('resize', this.setPanelHeight);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Renders the accordion structure, including header, content, description, and any slotted content.
|
|
79
|
+
* Adjusts styles based on `switchBg`, `tiny`, `clampText`, and other props.
|
|
80
|
+
*/
|
|
81
|
+
render() {
|
|
82
|
+
return (index.h("div", { key: '1abfd8bfea763bc10e6f17148dbc252d0c3ffdea', ref: (el) => (this.wrapperRef = el), class: `flex effect-color border-softer relative grid overflow-hidden rounded-lg border-2 p-16
|
|
83
|
+
${this.switchBg && this.isExpanded ? 'bg-inverse' : 'bg-default'}
|
|
84
|
+
${this.switchBg ? 'hover:bg-inverse' : ''}
|
|
85
|
+
${this.description ? 'min-h-56' : ''}` }, index.h("h3", { key: '137a3311195d51f46c6677558219828e5f4d06b5', ref: (el) => (this.headerRef = el), class: "mr-auto f-heading-06 text-left absolute inset-x-16 break-words top-16 pr-40" }, this.heading), index.h("div", { key: '0fc6d493fd61726a53a8c4311bd183eb3ad5b270', class: "ml-auto" }, index.h("eds-button", { key: 'cb8182e05c5c11950c0e624ce6b11e27a4d506ab', id: "toggleAccordion", intent: this.buttonIntent, "aria-expanded": this.isExpanded || this.shortContent, "aria-label": "Toggle accordion", "aria-controls": "accordionSection", class: `effect-color flex w-full items-center justify-between rounded-md`, onClick: this.handleClick, icon: "chevron-down" })), index.h("div", { key: '084bfb116dcccadf7253ca8ac8de6a1e1d4aa41f', class: `w-full`, style: Number.isFinite(this.headerHeight) ? { marginTop: `${this.headerHeight}px` } : {} }, this.description ? (index.h("span", { class: `text-light ${!this.isExpanded && this.clampText ? 'line-clamp-1' : ''}` }, this.description)) : null, index.h("section", { key: 'c332a210fa4ce90f1974098ff790a7600dfb1721', id: "accordionSection", "aria-labelledby": "accordionHeader", "aria-hidden": !this.isExpanded, class: `z-1 effect-height relative h-0 w-full ${!this.isExpanded && this.clampText ? 'overflow-hidden' : ''}`, style: { height: this.isExpanded ? 'auto' : '0' } }, index.h("div", { key: '842bc3bc7a968ef5a428a97327f38253e8a32888', ref: (el) => (this.childContentRef = el), class: `accordion-content effect-color pt-4`, "aria-hidden": !this.isExpanded }, index.h("span", { key: '7c8fa8040da18cc2c128b42cdf9e75bfffe4c439', class: `${!this.isExpanded && this.clampText ? 'line-clamp-2' : ''}` }, index.h("slot", { key: '852837c0c8c9d8a36f6263f7a943f50d82563a3c' })))))));
|
|
86
|
+
}
|
|
87
|
+
get el() { return index.getElement(this); }
|
|
88
|
+
};
|
|
89
|
+
EdsAccordion.style = EdsAccordionStyle0;
|
|
90
|
+
|
|
91
|
+
const edsAlertCss = "*,\n::before,\n::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n}\n\np {\n margin: 0;\n}\n\n.f-ui-01 {\n font-family: var(--f-ui-01-fontFamily);\n font-weight: var(--f-ui-01-fontWeight);\n font-size: var(--f-ui-01-fontSize);\n line-height: var(--f-ui-01-lineHeight);\n letter-spacing: var(--f-ui-01-letterSpacing);\n}\n\n.border-inside {\n position: relative;\n\n &::after {\n pointer-events: none;\n }\n\n &::after {\n position: absolute;\n }\n\n &::after {\n inset: 0rem;\n }\n\n &::after {\n z-index: 1;\n }\n\n &::after {\n border-radius: 8px;\n }\n\n &::after {\n border-width: 1px;\n }\n\n &::after {\n border-width: 2px;\n }\n\n &::after {\n border-color: rgba(0, 0, 0, .1);\n }\n\n &::after {\n content: '';\n }\n}\n\n.flex {\n display: flex;\n}\n\n.w-full {\n width: 100%;\n}\n\n.flex-row {\n flex-direction: row;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.gap-x-12 {\n -moz-column-gap: 0.75rem;\n column-gap: 0.75rem;\n}\n\n.space-y-12> :not([hidden])~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));\n}\n\n.rounded-lg {\n border-radius: 16px;\n}\n\n.bg-dark {\n background-color: var(--grey-300);\n}\n\n.bg-error {\n background-color: var(--red-200);\n}\n\n.bg-success {\n background-color: var(--green-200);\n}\n\n.bg-warning {\n background-color: var(--yellow-200);\n}\n\n.p-16 {\n padding: 1rem;\n}\n\n.p-20 {\n padding: 1.25rem;\n}\n\n.px-12 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n\n.px-20 {\n padding-left: 1.25rem;\n padding-right: 1.25rem;\n}\n\n.py-12 {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n}\n\n.py-20 {\n padding-top: 1.25rem;\n padding-bottom: 1.25rem;\n}\n\n.py-8 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n\n.pr-12 {\n padding-right: 0.75rem;\n}\n\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n[class*=underline-] {\n text-decoration-line: underline;\n}\n\n.after\\:rounded-lg::after {\n border-radius: 16px;\n}\n\n.after\\:border-softest::after {\n border-color: rgba(0, 0, 0, .05);\n}";
|
|
92
|
+
const EdsAlertStyle0 = edsAlertCss;
|
|
93
|
+
|
|
94
|
+
const alertStyles = index$1.cva(['w-full bg-dark'], {
|
|
95
|
+
variants: {
|
|
96
|
+
intent: {
|
|
97
|
+
default: '',
|
|
98
|
+
warning: 'bg-warning',
|
|
99
|
+
error: 'bg-error',
|
|
100
|
+
success: 'bg-success'
|
|
101
|
+
},
|
|
102
|
+
brd: {
|
|
103
|
+
rounded: 'rounded-lg border-inside after:border-softest after:rounded-lg',
|
|
104
|
+
normal: ''
|
|
105
|
+
},
|
|
106
|
+
direction: {
|
|
107
|
+
vertical: 'space-y-12',
|
|
108
|
+
horizontal: 'flex flex-row items-center justify-between gap-x-12'
|
|
109
|
+
},
|
|
110
|
+
withBtn: {
|
|
111
|
+
false: '',
|
|
112
|
+
true: ''
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
compoundVariants: [
|
|
116
|
+
{
|
|
117
|
+
direction: 'horizontal',
|
|
118
|
+
withBtn: true,
|
|
119
|
+
class: 'px-20 pr-12 py-12'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
direction: 'horizontal',
|
|
123
|
+
withBtn: false,
|
|
124
|
+
class: 'p-20'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
direction: 'vertical',
|
|
128
|
+
withBtn: true,
|
|
129
|
+
class: 'p-16'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
direction: 'vertical',
|
|
133
|
+
withBtn: false,
|
|
134
|
+
class: 'px-12 py-20'
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
defaultVariants: {
|
|
138
|
+
intent: 'default',
|
|
139
|
+
brd: 'rounded',
|
|
140
|
+
direction: 'horizontal'
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const EdsAlert = class {
|
|
144
|
+
constructor(hostRef) {
|
|
145
|
+
index.registerInstance(this, hostRef);
|
|
146
|
+
this.edsalert = index.createEvent(this, "edsalert", 7);
|
|
147
|
+
this.message = undefined;
|
|
148
|
+
this.pressableLabel = undefined;
|
|
149
|
+
this.pressableUrl = undefined;
|
|
150
|
+
this.direction = 'horizontal';
|
|
151
|
+
this.intent = 'default';
|
|
152
|
+
this.brd = 'rounded';
|
|
153
|
+
this.withBtn = false;
|
|
154
|
+
}
|
|
155
|
+
componentWillLoad() {
|
|
156
|
+
this.withBtn = Boolean(this.pressableLabel);
|
|
157
|
+
}
|
|
158
|
+
componentDidLoad() {
|
|
159
|
+
// Focus the alert container for immediate screen reader announcement
|
|
160
|
+
/*if (this.intent === 'error' || this.intent === 'warning') {
|
|
161
|
+
this.el.shadowRoot?.querySelector('[role="alert"]')?.setAttribute('tabindex', '-1');
|
|
162
|
+
(this.el.shadowRoot?.querySelector('[role="alert"]') as HTMLElement)?.focus();
|
|
163
|
+
}*/
|
|
164
|
+
var _a;
|
|
165
|
+
// Query for the 'eds-link' element inside the shadow root.
|
|
166
|
+
const lnk = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('eds-link');
|
|
167
|
+
if (lnk) {
|
|
168
|
+
this.emitContext(lnk);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
emitContext(linkElement) {
|
|
172
|
+
const event = new CustomEvent('parentContext', {
|
|
173
|
+
detail: {
|
|
174
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
175
|
+
identifier: null
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
linkElement.dispatchEvent(event);
|
|
179
|
+
}
|
|
180
|
+
handleAction() {
|
|
181
|
+
// Emit the alertAction event for parent components to handle
|
|
182
|
+
this.edsalert.emit();
|
|
183
|
+
}
|
|
184
|
+
render() {
|
|
185
|
+
const ariaLabel = this.intent !== 'default' ? `${this.intent} alert` : 'alert';
|
|
186
|
+
return (index.h("div", { key: '2d22944e7ae86cf2523c194e20215a3d986083d9', class: alertStyles({
|
|
187
|
+
intent: this.intent,
|
|
188
|
+
brd: this.brd,
|
|
189
|
+
direction: this.direction,
|
|
190
|
+
withBtn: this.withBtn
|
|
191
|
+
}), role: "alert", "aria-label": ariaLabel, "aria-live": this.intent === 'error' ? 'assertive' : 'polite', "aria-labelledby": "alert-message", "aria-describedby": this.withBtn ? 'alert-action' : undefined }, index.h("p", { key: 'b6c22446b0d87fb01a3cb882fe205ef48ea60b05', id: "alert-message", class: "f-ui-01 py-8", innerHTML: this.message }), this.withBtn && (index.h("div", { key: '8414820eb7b65c83459cfb90adef3ea696e42444', id: "alert-action" }, this.pressableUrl ? (index.h("eds-link", { class: "eds-alert-link", label: this.pressableLabel, url: this.pressableUrl, intent: "secondary", external: true })) : (index.h("eds-button", { class: "eds-alert-button", label: this.pressableLabel, intent: "secondary", onClick: () => this.handleAction() }))))));
|
|
192
|
+
}
|
|
193
|
+
get el() { return index.getElement(this); }
|
|
194
|
+
};
|
|
195
|
+
EdsAlert.style = EdsAlertStyle0;
|
|
196
|
+
|
|
12
197
|
const edsAvatarCss = "::before,\n::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n.border-inside {\n position: relative;\n\n &::after {\n pointer-events: none;\n }\n\n &::after {\n position: absolute;\n }\n\n &::after {\n inset: 0rem;\n }\n\n &::after {\n z-index: 1;\n }\n\n &::after {\n border-radius: 8px;\n }\n\n &::after {\n border-width: 1px;\n }\n\n &::after {\n border-width: 2px;\n }\n\n &::after {\n border: 2px solid rgba(0, 0, 0, .1);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-pill {\n &::after {\n border-radius: 100px;\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-inverse {\n &::after {\n border: 2px solid rgba(255, 255, 255, 0.3);\n }\n\n &::after {\n content: '';\n }\n}\n\n.aspect-1x1 {\n aspect-ratio: 1/1;\n}\n\n.flex {\n display: flex;\n}\n\n.inline-flex {\n display: inline-flex;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-center {\n justify-content: center;\n}\n\n.overflow-hidden {\n overflow: hidden;\n}\n\n.px-4 {\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n}\n\n.rounded-pill {\n border-radius: 100px;\n}\n\n.rounded-sm {\n border-radius: 8px;\n}\n\n.rounded-xs {\n border-radius: 4px;\n}\n\n.rounded-full {\n border-radius: 9999px;\n}\n\n.bg-dark {\n background-color: var(--grey-300);\n}\n\n.bg-darker {\n background-color: var(--grey-400);\n}\n\n.bg-stronger {\n background-color: var(--grey-900);\n}\n\n.bg-strongest {\n background-color: var(--black);\n}\n\n.text-accent {\n color: var(--green-500);\n}\n\n.text-default {\n color: var(--black);\n}\n\n.\\!no-underline {\n text-decoration-line: none !important;\n}\n\n.f-ui-01 {\n font-family: var(--f-ui-01-fontFamily);\n font-weight: var(--f-ui-01-fontWeight);\n font-size: var(--f-ui-01-fontSize);\n line-height: var(--f-ui-01-lineHeight);\n letter-spacing: var(--f-ui-01-letterSpacing);\n}\n\n.w-32 {\n width: 2rem;\n}\n\n.w-44 {\n width: 2.75rem;\n}\n\n.w-\\[54px\\] {\n width: 54px;\n}\n\n.bg-gradient-01-top {\n background: linear-gradient(to bottom, #00E766, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-01-bottom {\n background: linear-gradient(to top, #00E766, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-02-top {\n background: linear-gradient(to bottom, #F3F30A, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-02-bottom {\n background: linear-gradient(to top, #F3F30A, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-03-top {\n background: linear-gradient(to bottom, #C461FF, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-03-bottom {\n background: linear-gradient(to top, #C461FF, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-04-top {\n background: linear-gradient(to bottom, #2B69FC, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-04-bottom {\n background: linear-gradient(to top, #2B69FC, ease-in-out, #E6E6E6);\n}";
|
|
13
198
|
const EdsAvatarStyle0 = edsAvatarCss;
|
|
14
199
|
|
|
@@ -66,7 +251,7 @@ const EdsAvatar = class {
|
|
|
66
251
|
* @returns {JSX.Element} The rendered avatar component.
|
|
67
252
|
*/
|
|
68
253
|
render() {
|
|
69
|
-
return (index.h("div", { key: '
|
|
254
|
+
return (index.h("div", { key: '34e86e50b1176efd8ae0cd9b30cd3823527d7eee', class: this.containerClasses }, this.picture ? (index.h("eds-img", { src: this.picture, width: 54, height: 54, sizes: "120px", alt: `${this.firstName} ${this.lastName}`, lazyload: true, withBg: true })) : (index.h("abbr", { title: this.computedInitials || `${this.firstName} ${this.lastName}`, class: "!no-underline f-ui-01" }, this.computedInitials))));
|
|
70
255
|
}
|
|
71
256
|
};
|
|
72
257
|
EdsAvatar.style = EdsAvatarStyle0;
|
|
@@ -80,12 +265,149 @@ const EdsBlockBreak = class {
|
|
|
80
265
|
this.inverse = false;
|
|
81
266
|
}
|
|
82
267
|
render() {
|
|
83
|
-
return index.h("hr", { key: '
|
|
268
|
+
return index.h("hr", { key: '688e11c730af1193f28db196cd144c6dd2efc3c6', class: `${this.inverse ? 'border-default' : 'border-softer'} my-16 inline-block w-full border-t-2` });
|
|
84
269
|
}
|
|
85
270
|
};
|
|
86
271
|
EdsBlockBreak.style = EdsBlockBreakStyle0;
|
|
87
272
|
|
|
88
|
-
const edsButtonCss = "*,\n::before,\n::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n}\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\n 1. Change the font styles in all browsers.\n 2. Remove the margin in Firefox and Safari.\n 3. Remove default padding in all browsers.\n */\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\n\n/*\n Remove the inheritance of text transform in Edge and Firefox.\n */\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n 1. Correct the inability to style clickable types in iOS and Safari.\n 2. Remove default button styles.\n */\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button;\n /* 1 */\n background-color: transparent;\n /* 2 */\n background-image: none;\n /* 2 */\n}\n\np {\n margin: 0;\n}\n\n/*\n Set the default cursor for buttons.\n */\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\n Make sure disabled buttons don't get the pointer cursor.\n */\n:disabled {\n cursor: default;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n.f-body-01 {\n font-family: var(--f-body-01-fontFamily);\n font-weight: var(--f-body-01-fontWeight);\n font-size: var(--f-body-01-fontSize);\n line-height: var(--f-body-01-lineHeight);\n letter-spacing: var(--f-body-01-letterSpacing);\n}\n\n.f-body-02 {\n font-family: var(--f-body-02-fontFamily);\n font-weight: var(--f-body-02-fontWeight);\n font-size: var(--f-body-02-fontSize);\n line-height: var(--f-body-02-lineHeight);\n letter-spacing: var(--f-body-02-letterSpacing);\n}\n\n.f-ui-01 {\n font-family: var(--f-ui-01-fontFamily);\n font-weight: var(--f-ui-01-fontWeight);\n font-size: var(--f-ui-01-fontSize);\n line-height: var(--f-ui-01-lineHeight);\n letter-spacing: var(--f-ui-01-letterSpacing);\n}\n\n.f-ui-02 {\n font-family: var(--f-ui-02-fontFamily);\n font-weight: var(--f-ui-02-fontWeight);\n font-size: var(--f-ui-02-fontSize);\n line-height: var(--f-ui-02-lineHeight);\n letter-spacing: var(--f-ui-02-letterSpacing);\n}\n\n.border-inside {\n position: relative;\n\n &::after {\n pointer-events: none;\n }\n\n &::after {\n position: absolute;\n }\n\n &::after {\n inset: 0rem;\n }\n\n &::after {\n z-index: 1;\n }\n\n &::after {\n border-radius: 8px;\n }\n\n &::after {\n border-width: 1px;\n }\n\n &::after {\n border-width: 2px;\n }\n\n &::after {\n border-color: rgba(0, 0, 0, .1);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-inverse {\n &::after {\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-pill {\n &::after {\n border-radius: 100px;\n }\n\n &::after {\n content: '';\n }\n}\n\n.loader {\n box-sizing: border-box;\n display: inline-block;\n height: 1rem;\n width: 1rem;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.loader {\n animation: spin 1s linear infinite;\n border-radius: 9999px;\n border: 3px solid rgba(0, 0, 0, .3);\n border-bottom-color: #000;\n}\n\n/** region TRANSITIONS */\n.effect-color {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0, 0, 0.2, 1);\n}\n\n.effect-focus {\n outline-width: 3px;\n outline-offset: 2px;\n outline-color: var(--green-500);\n}\n\n.effect-focus:focus-visible {\n outline-style: solid;\n}\n\n.effect-focus-within {\n outline-width: 3px;\n outline-offset: 2px;\n outline-color: var(--green-500);\n}\n\n.effect-focus-within:focus-within {\n outline-style: solid;\n}\n\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.pointer-events-none {\n pointer-events: none;\n}\n\n.static {\n position: static;\n}\n\n.fixed {\n position: fixed;\n}\n\n.absolute {\n position: absolute;\n}\n\n.relative {\n position: relative;\n}\n\n.sticky {\n position: sticky;\n}\n\n.inset-0 {\n inset: 0rem;\n}\n\n.inset-x-16 {\n left: 1rem;\n right: 1rem;\n}\n\n.-top-8 {\n top: -0.5rem;\n}\n\n.left-0 {\n left: 0rem;\n}\n\n.left-1\\/2 {\n left: 50%;\n}\n\n.left-4 {\n left: 0.25rem;\n}\n\n.left-\\[4px\\] {\n left: 4px;\n}\n\n.right-0 {\n right: 0rem;\n}\n\n.right-4 {\n right: 0.25rem;\n}\n\n.right-8 {\n right: 0.5rem;\n}\n\n.right-\\[6px\\] {\n right: 6px;\n}\n\n.top-0 {\n top: 0rem;\n}\n\n.top-1\\/2 {\n top: 50%;\n}\n\n.m-0 {\n margin: 0rem;\n}\n\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n\n.-ml-16 {\n margin-left: -1rem;\n}\n\n.-mr-16 {\n margin-right: -1rem;\n}\n\n.ml-0 {\n margin-left: 0rem;\n}\n\n.ml-4 {\n margin-left: 0.25rem;\n}\n\n.ml-64 {\n margin-left: 4rem;\n}\n\n.ml-8 {\n margin-left: 0.5rem;\n}\n\n.ml-auto {\n margin-left: auto;\n}\n\n.mr-4 {\n margin-right: 0.25rem;\n}\n\n.mr-8 {\n margin-right: 0.5rem;\n}\n\n.mr-auto {\n margin-right: auto;\n}\n\n.block {\n display: block;\n}\n\n.inline-block {\n display: inline-block;\n}\n\n.inline {\n display: inline;\n}\n\n.flex {\n display: flex;\n}\n\n.inline-flex {\n display: inline-flex;\n}\n\n.hidden {\n display: none;\n}\n\n.h-20 {\n height: 1.25rem;\n}\n\n.h-24 {\n height: 1.5rem;\n}\n\n.h-36 {\n height: 2.25rem;\n}\n\n.h-44 {\n height: 2.75rem;\n}\n\n.h-auto {\n height: auto;\n}\n\n.h-full {\n height: 100%;\n}\n\n.\\!min-h-20 {\n min-height: 1.25rem !important;\n}\n\n.min-h-screen {\n min-height: 100vh;\n}\n\n.w-20 {\n width: 1.25rem;\n}\n\n.w-full {\n width: 100%;\n}\n\n.flex-none {\n flex: none;\n}\n\n.grow {\n flex-grow: 1;\n}\n\n.cursor-pointer {\n cursor: pointer;\n}\n\n.resize {\n resize: both;\n}\n\n.flex-row {\n flex-direction: row;\n}\n\n.flex-row-reverse {\n flex-direction: row-reverse;\n}\n\n.flex-col {\n flex-direction: column;\n}\n\n.flex-wrap {\n flex-wrap: wrap;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-center {\n justify-content: center;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.space-x-2> :not([hidden])~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.125rem * var(--tw-space-x-reverse));\n margin-left: calc(0.125rem * calc(1 - var(--tw-space-x-reverse)));\n}\n\n.overflow-hidden {\n overflow: hidden;\n}\n\n.overflow-x-auto {\n overflow-x: auto;\n}\n\n.overflow-x-hidden {\n overflow-x: hidden;\n}\n\n.overflow-y-scroll {\n overflow-y: scroll;\n}\n\n.whitespace-nowrap {\n white-space: nowrap;\n}\n\n.break-words {\n overflow-wrap: break-word;\n}\n\n.rounded {\n border-radius: 0.25rem;\n}\n\n.rounded-full {\n border-radius: 9999px;\n}\n\n.rounded-lg {\n border-radius: 16px;\n}\n\n.rounded-md {\n border-radius: 12px;\n}\n\n.rounded-pill {\n border-radius: 100px;\n}\n\n.rounded-sm {\n border-radius: 8px;\n}\n\n.rounded-xxs {\n border-radius: 2px;\n}\n\n.border {\n border-width: 1px;\n}\n\n.border-\\[\\#0034CB\\] {\n --tw-border-opacity: 1;\n border-color: rgb(0 52 203 / var(--tw-border-opacity));\n}\n\n.border-\\[\\#d2d2d2\\] {\n --tw-border-opacity: 1;\n border-color: rgb(210 210 210 / var(--tw-border-opacity));\n}\n\n.border-softest {\n border-color: rgba(0, 0, 0, .05);\n}\n\n.border-b-softer {\n border-bottom-color: rgba(0, 0, 0, .1);\n}\n\n.\\!bg-accent-dark {\n background-color: var(--green-600) !important;\n}\n\n.\\!bg-darker {\n background-color: var(--grey-400) !important;\n}\n\n.\\!bg-strong-dark {\n background-color: var(--grey-800) !important;\n}\n\n.bg-accent {\n background-color: var(--green-500);\n}\n\n.bg-accent-dark {\n background-color: var(--green-600);\n}\n\n.bg-dark {\n background-color: var(--grey-300);\n}\n\n.bg-darker {\n background-color: var(--grey-400);\n}\n\n.bg-overlay {\n background-color: rgba(0, 0, 0, 0.25);\n}\n\n.bg-strong {\n background-color: var(--grey-700);\n}\n\n.bg-strong-dark {\n background-color: var(--grey-800);\n}\n\n.bg-stronger {\n background-color: var(--grey-900);\n}\n\n.bg-strongest {\n background-color: var(--black);\n}\n\n.p-12 {\n padding: 0.75rem;\n}\n\n.p-6 {\n padding: 0.375rem;\n}\n\n.p-8 {\n padding: 0.5rem;\n}\n\n.\\!px-0 {\n padding-left: 0rem !important;\n padding-right: 0rem !important;\n}\n\n.px-12 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n\n.px-16 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n\n.py-8 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n\n.pl-4 {\n padding-left: 0.25rem;\n}\n\n.pl-8 {\n padding-left: 0.5rem;\n}\n\n.pr-4 {\n padding-right: 0.25rem;\n}\n\n.pr-8 {\n padding-right: 0.5rem;\n}\n\n.\\!text-current {\n color: currentColor !important;\n}\n\n.text-accent {\n color: var(--green-500);\n}\n\n.text-current {\n color: currentColor;\n}\n\n.text-default {\n color: var(--black);\n}\n\n.text-inverse {\n color: var(--white);\n}\n\n.text-lightest {\n color: var(--grey-500);\n}\n\n.opacity-0 {\n opacity: 0;\n}\n\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.shadow-accent {\n --tw-shadow: 0px 0px 12px rgba(0, 201, 89, 0.6);\n --tw-shadow-colored: 0px 0px 12px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.underline-offset-4 {\n text-underline-offset: 0.2em;\n}\n\n.\\@container {\n container-type: inline-size;\n}\n\n.after\\:effect-opacity::after {\n transition-property: opacity;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0, 0, 0.2, 1);\n}\n\n.even\\:bg-inverse-softer:nth-child(even) {\n background-color: rgba(255, 255, 255, .15);\n}\n\n.invalid\\:text-lightest:invalid {\n color: var(--grey-500);\n}\n\n.focus-within\\:bg-transparent:focus-within {\n background-color: var(--transparent);\n}\n\n.hover\\:bg-accent-dark:hover {\n background-color: var(--green-600);\n}\n\n.hover\\:bg-dark:hover {\n background-color: var(--grey-300);\n}\n\n.hover\\:bg-darker:hover {\n background-color: var(--grey-400);\n}\n\n.hover\\:bg-default:hover {\n background-color: var(--grey-200);\n}\n\n.hover\\:bg-inverse:hover {\n background-color: var(--white);\n}\n\n.hover\\:bg-strong-dark:hover {\n background-color: var(--grey-800);\n}\n\n.hover\\:bg-transparent:hover {\n background-color: var(--transparent);\n}\n\n.hover\\:text-default:hover {\n color: var(--black);\n}\n\n.hover\\:text-lighter:hover {\n color: var(--grey-600);\n}\n\n.hover\\:\\!underline:hover {\n text-decoration-line: underline !important;\n}\n\n.hover\\:no-underline:hover {\n text-decoration-line: none;\n}\n\n.hover\\:shadow-hover:hover {\n --tw-shadow: 0px 0px 16px rgba(0, 0, 0, 0.2);\n --tw-shadow-colored: 0px 0px 16px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.focus\\:shadow-none:focus {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.focus\\:outline-none:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n\n.disabled\\:cursor-not-allowed:disabled {\n cursor: not-allowed;\n}\n\n.disabled\\:bg-dark:disabled {\n background-color: var(--grey-300);\n}\n\n.disabled\\:text-lightest:disabled {\n color: var(--grey-500);\n}\n\n.aria-disabled\\:cursor-not-allowed[aria-disabled=\"true\"] {\n cursor: not-allowed;\n}\n\n.aria-disabled\\:\\!border-transparent[aria-disabled=\"true\"] {\n border-color: var(--transparent) !important;\n}\n\n.aria-disabled\\:bg-dark[aria-disabled=\"true\"] {\n background-color: var(--grey-300);\n}\n\n.aria-disabled\\:bg-transparent[aria-disabled=\"true\"] {\n background-color: var(--transparent);\n}\n\n.aria-disabled\\:text-light[aria-disabled=\"true\"] {\n color: var(--grey-700);\n}\n\n.aria-disabled\\:text-lightest[aria-disabled=\"true\"] {\n color: var(--grey-500);\n}\n\n.aria-disabled\\:line-through[aria-disabled=\"true\"] {\n text-decoration-line: line-through;\n}\n\n.aria-disabled\\:shadow-none[aria-disabled=\"true\"] {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.aria-current-page\\:bg-darker[aria-current=\"page\"] {\n background-color: var(--grey-400);\n}\n\n.after\\:absolute::after {\n position: absolute;\n}\n\n.after\\:inset-0::after {\n inset: 0rem;\n}\n\n.after\\:inset-x-0::after {\n left: 0rem;\n right: 0rem;\n}\n\n.after\\:bottom-0::after {\n bottom: 0rem;\n}\n\n.after\\:left-16::after {\n left: 1rem;\n}\n\n.after\\:right-16::after {\n right: 1rem;\n}\n\n.after\\:z-10::after {\n z-index: 10;\n}\n\n.after\\:rounded-lg::after {\n border-radius: 16px;\n}\n\n.after\\:rounded-t-lg::after {\n border-top-left-radius: 16px;\n border-top-right-radius: 16px;\n}\n\n.after\\:border-3::after {\n border-width: 3px;\n}\n\n.after\\:border-b-2::after {\n border-bottom-width: 2px;\n}\n\n.after\\:\\!border-transparent::after {\n border-color: var(--transparent) !important;\n}\n\n.after\\:border-accent::after {\n border-color: var(--green-500);\n}\n\n.after\\:border-softest::after {\n border-color: rgba(0, 0, 0, .05);\n}\n\n.after\\:opacity-0::after {\n opacity: 0;\n}\n\n.after\\:content-\\[\\'\\'\\]::after {\n --tw-content: '';\n content: var(--tw-content);\n}\n\n.hover\\:after\\:\\!border-transparent:hover::after {\n border-color: var(--transparent) !important;\n}\n\n.hover\\:after\\:opacity-100:hover::after {\n opacity: 1;\n}\n\n.focus-visible\\:after\\:opacity-100:focus-visible::after {\n opacity: 1;\n}\n\n.aria-disabled\\:after\\:\\!border-transparent[aria-disabled=\"true\"]::after {\n border-color: var(--transparent) !important;\n}\n\n.hover\\:before\\:opacity-100:hover::before {\n opacity: 1;\n}";
|
|
273
|
+
const edsBreadcrumbCss = "blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}.hidden{display:none}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.125rem * var(--tw-space-x-reverse));margin-left:calc(0.125rem * calc(1 - var(--tw-space-x-reverse)))}.px-2{padding-left:0.125rem;padding-right:0.125rem}.w-20{width:1.25rem}.w-28{width:1.75rem}.w-32{width:2rem}.w-44{width:2.75rem}.h-20{height:1.25rem}.h-24{height:1.5rem}.h-28{height:1.75rem}.h-32{height:2rem}@media (min-width: 750px){.md\\:block{display:block}}";
|
|
274
|
+
const EdsBreadcrumbStyle0 = edsBreadcrumbCss;
|
|
275
|
+
|
|
276
|
+
const EdsBreadcrumb = class {
|
|
277
|
+
constructor(hostRef) {
|
|
278
|
+
index.registerInstance(this, hostRef);
|
|
279
|
+
/**
|
|
280
|
+
* Updates the maximum number of visible items and tracks if the screen is small.
|
|
281
|
+
*/
|
|
282
|
+
this.updateScreenSize = () => {
|
|
283
|
+
const width = window.innerWidth;
|
|
284
|
+
if (width < 769) {
|
|
285
|
+
this.maxVisibleItems = 3;
|
|
286
|
+
}
|
|
287
|
+
else if (width <= 1024) {
|
|
288
|
+
this.maxVisibleItems = 3;
|
|
289
|
+
}
|
|
290
|
+
else if (width <= 1280) {
|
|
291
|
+
this.maxVisibleItems = 3;
|
|
292
|
+
}
|
|
293
|
+
else if (width <= 2200) {
|
|
294
|
+
this.maxVisibleItems = 4;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.maxVisibleItems = 6;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
this.items = [];
|
|
301
|
+
this.intent = 'ghost';
|
|
302
|
+
this.parsedItems = [];
|
|
303
|
+
this.isSmallScreen = false;
|
|
304
|
+
this.maxVisibleItems = 6;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Watches for changes to the `items` prop and parses it.
|
|
308
|
+
*/
|
|
309
|
+
parseItems(newValue) {
|
|
310
|
+
this.parsedItems = sharedUtils.parseData(newValue);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Lifecycle method that runs when the component is about to be loaded.
|
|
314
|
+
* It parses the initial `items` prop value.
|
|
315
|
+
*/
|
|
316
|
+
componentWillLoad() {
|
|
317
|
+
this.parseItems(this.items);
|
|
318
|
+
this.updateScreenSize();
|
|
319
|
+
window.addEventListener('resize', this.updateScreenSize);
|
|
320
|
+
}
|
|
321
|
+
disconnectedCallback() {
|
|
322
|
+
window.removeEventListener('resize', this.updateScreenSize);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Lifecycle method that runs when the component has fully loaded.
|
|
326
|
+
* It emits a custom event for each `eds-link` element contained within the breadcrumb.
|
|
327
|
+
*/
|
|
328
|
+
componentDidLoad() {
|
|
329
|
+
var _a;
|
|
330
|
+
const links = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('eds-link');
|
|
331
|
+
links === null || links === void 0 ? void 0 : links.forEach((link) => {
|
|
332
|
+
this.emitContext(link);
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Emits a custom event called `parentContext` for a given link element.
|
|
337
|
+
* This event provides context information about the breadcrumb component.
|
|
338
|
+
*
|
|
339
|
+
* @param linkElement - The link element to which the event will be dispatched.
|
|
340
|
+
*/
|
|
341
|
+
emitContext(linkElement) {
|
|
342
|
+
const event = new CustomEvent('parentContext', {
|
|
343
|
+
detail: {
|
|
344
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
345
|
+
identifier: null
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
linkElement.dispatchEvent(event);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Returns breadcrumb items with potential truncation if there are too many.
|
|
352
|
+
* It inserts an ellipsis item where necessary.
|
|
353
|
+
*/
|
|
354
|
+
getTruncatedItems() {
|
|
355
|
+
const totalItems = this.parsedItems.length;
|
|
356
|
+
const ellipsis = { label: '...', url: '', isHidden: true };
|
|
357
|
+
if (totalItems > this.maxVisibleItems) {
|
|
358
|
+
const firstItem = this.parsedItems[0];
|
|
359
|
+
const lastItems = this.parsedItems.slice(-2);
|
|
360
|
+
if (this.maxVisibleItems === 3) {
|
|
361
|
+
return [firstItem, ellipsis, ...lastItems];
|
|
362
|
+
}
|
|
363
|
+
else if (this.maxVisibleItems === 4) {
|
|
364
|
+
const middleItem = this.parsedItems[Math.floor(totalItems / 2)];
|
|
365
|
+
return [firstItem, middleItem, ellipsis, ...lastItems];
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return this.parsedItems;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Helper to determine the display label and full label.
|
|
372
|
+
* If the label is longer than 15 characters and the item is not the current (last) item,
|
|
373
|
+
* we display a truncated version but use the full label for aria attributes.
|
|
374
|
+
*/
|
|
375
|
+
getLabels(item, isCurrent) {
|
|
376
|
+
if (!isCurrent && item.label.length > 15) {
|
|
377
|
+
return { displayLabel: `${item.label.slice(0, 15)}...`, fullLabel: item.label };
|
|
378
|
+
}
|
|
379
|
+
return { displayLabel: item.label, fullLabel: item.label };
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Render method for the breadcrumb component.
|
|
383
|
+
* It creates a navigation element with an ordered list of breadcrumb links.
|
|
384
|
+
* The last link is marked as the current page.
|
|
385
|
+
*/
|
|
386
|
+
render() {
|
|
387
|
+
const itemsToRender = this.getTruncatedItems();
|
|
388
|
+
return (index.h("nav", { key: '0625a234ec9f5095abbeaafa11e56bceb0432764', "aria-label": "Breadcrumb" }, index.h("ol", { key: '3898a4b048eca6c606a6948b26ec25a608cb908e', class: "flex items-center space-x-2" }, itemsToRender.map((item, index$1) => {
|
|
389
|
+
const isLast = index$1 === itemsToRender.length - 1;
|
|
390
|
+
return (index.h("li", { class: "flex items-center" }, !item.isHidden ? ((() => {
|
|
391
|
+
const { fullLabel } = this.getLabels(item, isLast);
|
|
392
|
+
const linkIntent = isLast
|
|
393
|
+
? this.intent === 'strong'
|
|
394
|
+
? 'weak'
|
|
395
|
+
: this.intent === 'weak'
|
|
396
|
+
? 'strong'
|
|
397
|
+
: this.intent
|
|
398
|
+
: this.intent;
|
|
399
|
+
return (index.h("eds-link", Object.assign({ label: fullLabel, url: item.url, intent: linkIntent, disabled: isLast, current: isLast, "aria-label": fullLabel, size: "small", "icon-small": "false" }, (isLast ? { 'aria-current': 'page' } : {}))));
|
|
400
|
+
})()) : (index.h("eds-link", { label: "...", url: "#", intent: "strong", current: false, "aria-label": "...", size: "small", "icon-small": "false", icon: "chevron-right" })), !isLast && !item.isHidden && (index.h("eds-icon-wrapper", { icon: "chevron-right", class: "w-20 h-20" }))));
|
|
401
|
+
}))));
|
|
402
|
+
}
|
|
403
|
+
get el() { return index.getElement(this); }
|
|
404
|
+
static get watchers() { return {
|
|
405
|
+
"items": ["parseItems"]
|
|
406
|
+
}; }
|
|
407
|
+
};
|
|
408
|
+
EdsBreadcrumb.style = EdsBreadcrumbStyle0;
|
|
409
|
+
|
|
410
|
+
const edsButtonCss = "*,\n::before,\n::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n}\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\n 1. Change the font styles in all browsers.\n 2. Remove the margin in Firefox and Safari.\n 3. Remove default padding in all browsers.\n */\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\n\n/*\n Remove the inheritance of text transform in Edge and Firefox.\n */\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n 1. Correct the inability to style clickable types in iOS and Safari.\n 2. Remove default button styles.\n */\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button;\n /* 1 */\n background-color: transparent;\n /* 2 */\n background-image: none;\n /* 2 */\n}\n\np {\n margin: 0;\n}\n\n/*\n Set the default cursor for buttons.\n */\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\n Make sure disabled buttons don't get the pointer cursor.\n */\n:disabled {\n cursor: default;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n.f-body-01 {\n font-family: var(--f-body-01-fontFamily);\n font-weight: var(--f-body-01-fontWeight);\n font-size: var(--f-body-01-fontSize);\n line-height: var(--f-body-01-lineHeight);\n letter-spacing: var(--f-body-01-letterSpacing);\n}\n\n.f-body-02 {\n font-family: var(--f-body-02-fontFamily);\n font-weight: var(--f-body-02-fontWeight);\n font-size: var(--f-body-02-fontSize);\n line-height: var(--f-body-02-lineHeight);\n letter-spacing: var(--f-body-02-letterSpacing);\n}\n\n.f-ui-01 {\n font-family: var(--f-ui-01-fontFamily);\n font-weight: var(--f-ui-01-fontWeight);\n font-size: var(--f-ui-01-fontSize);\n line-height: var(--f-ui-01-lineHeight);\n letter-spacing: var(--f-ui-01-letterSpacing);\n}\n\n.f-ui-02 {\n font-family: var(--f-ui-02-fontFamily);\n font-weight: var(--f-ui-02-fontWeight);\n font-size: var(--f-ui-02-fontSize);\n line-height: var(--f-ui-02-lineHeight);\n letter-spacing: var(--f-ui-02-letterSpacing);\n}\n\n.border-inside {\n position: relative;\n\n &::after {\n pointer-events: none;\n }\n\n &::after {\n position: absolute;\n }\n\n &::after {\n inset: 0rem;\n }\n\n &::after {\n z-index: 1;\n }\n\n &::after {\n border-radius: 8px;\n }\n\n &::after {\n border-width: 1px;\n }\n\n &::after {\n border-width: 2px;\n }\n\n &::after {\n border-color: rgba(0, 0, 0, .1);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-inverse {\n &::after {\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-pill {\n &::after {\n border-radius: 100px;\n }\n\n &::after {\n content: '';\n }\n}\n\n.loader {\n box-sizing: border-box;\n display: inline-block;\n height: 1rem;\n width: 1rem;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.loader {\n animation: spin 1s linear infinite;\n border-radius: 9999px;\n border: 3px solid rgba(0, 0, 0, .3);\n border-bottom-color: #000;\n}\n\n/** region TRANSITIONS */\n.effect-color {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0, 0, 0.2, 1);\n}\n\n.effect-focus {\n outline-width: 3px;\n outline-offset: 2px;\n outline-color: var(--green-500);\n}\n\n.effect-focus:focus-visible {\n outline-style: solid;\n}\n\n.effect-focus-within {\n outline-width: 3px;\n outline-offset: 2px;\n outline-color: var(--green-500);\n}\n\n.effect-focus-within:focus-within {\n outline-style: solid;\n}\n\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.pointer-events-none {\n pointer-events: none;\n}\n\n.static {\n position: static;\n}\n\n.fixed {\n position: fixed;\n}\n\n.absolute {\n position: absolute;\n}\n\n.relative {\n position: relative;\n}\n\n.sticky {\n position: sticky;\n}\n\n.inset-0 {\n inset: 0rem;\n}\n\n.inset-x-16 {\n left: 1rem;\n right: 1rem;\n}\n\n.-top-8 {\n top: -0.5rem;\n}\n\n.left-0 {\n left: 0rem;\n}\n\n.left-1\\/2 {\n left: 50%;\n}\n\n.left-4 {\n left: 0.25rem;\n}\n\n.left-\\[4px\\] {\n left: 4px;\n}\n\n.right-0 {\n right: 0rem;\n}\n\n.right-4 {\n right: 0.25rem;\n}\n\n.right-8 {\n right: 0.5rem;\n}\n\n.right-\\[6px\\] {\n right: 6px;\n}\n\n.top-0 {\n top: 0rem;\n}\n\n.top-1\\/2 {\n top: 50%;\n}\n\n.m-0 {\n margin: 0rem;\n}\n\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n\n.-ml-16 {\n margin-left: -1rem;\n}\n\n.-mr-16 {\n margin-right: -1rem;\n}\n\n.ml-0 {\n margin-left: 0rem;\n}\n\n.ml-4 {\n margin-left: 0.25rem;\n}\n\n.ml-64 {\n margin-left: 4rem;\n}\n\n.ml-8 {\n margin-left: 0.5rem;\n}\n\n.ml-auto {\n margin-left: auto;\n}\n\n.mr-4 {\n margin-right: 0.25rem;\n}\n\n.mr-8 {\n margin-right: 0.5rem;\n}\n\n.mr-auto {\n margin-right: auto;\n}\n\n.block {\n display: block;\n}\n\n.\\!block {\n display: block !important;\n}\n\n.inline-block {\n display: inline-block;\n}\n\n.inline {\n display: inline;\n}\n\n.flex {\n display: flex;\n}\n\n.inline-flex {\n display: inline-flex;\n}\n\n.hidden {\n display: none;\n}\n\n.h-20 {\n height: 1.25rem;\n}\n\n.h-24 {\n height: 1.5rem;\n}\n\n.h-36 {\n height: 2.25rem;\n}\n\n.h-44 {\n height: 2.75rem;\n}\n\n.h-auto {\n height: auto;\n}\n\n.h-full {\n height: 100%;\n}\n\n.\\!min-h-20 {\n min-height: 1.25rem !important;\n}\n\n.min-h-screen {\n min-height: 100vh;\n}\n\n.w-20 {\n width: 1.25rem;\n}\n\n.w-full {\n width: 100%;\n}\n\n.flex-none {\n flex: none;\n}\n\n.grow {\n flex-grow: 1;\n}\n\n.cursor-pointer {\n cursor: pointer;\n}\n\n.resize {\n resize: both;\n}\n\n.flex-row {\n flex-direction: row;\n}\n\n.flex-row-reverse {\n flex-direction: row-reverse;\n}\n\n.flex-col {\n flex-direction: column;\n}\n\n.flex-wrap {\n flex-wrap: wrap;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-center {\n justify-content: center;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.space-x-2> :not([hidden])~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.125rem * var(--tw-space-x-reverse));\n margin-left: calc(0.125rem * calc(1 - var(--tw-space-x-reverse)));\n}\n\n.overflow-hidden {\n overflow: hidden;\n}\n\n.overflow-x-auto {\n overflow-x: auto;\n}\n\n.overflow-x-hidden {\n overflow-x: hidden;\n}\n\n.overflow-y-scroll {\n overflow-y: scroll;\n}\n\n.whitespace-nowrap {\n white-space: nowrap;\n}\n\n.break-words {\n overflow-wrap: break-word;\n}\n\n.rounded {\n border-radius: 0.25rem;\n}\n\n.rounded-full {\n border-radius: 9999px;\n}\n\n.rounded-lg {\n border-radius: 16px;\n}\n\n.rounded-md {\n border-radius: 12px;\n}\n\n.rounded-pill {\n border-radius: 100px;\n}\n\n.rounded-sm {\n border-radius: 8px;\n}\n\n.rounded-xxs {\n border-radius: 2px;\n}\n\n.border {\n border-width: 1px;\n}\n\n.border-\\[\\#0034CB\\] {\n --tw-border-opacity: 1;\n border-color: rgb(0 52 203 / var(--tw-border-opacity));\n}\n\n.border-\\[\\#d2d2d2\\] {\n --tw-border-opacity: 1;\n border-color: rgb(210 210 210 / var(--tw-border-opacity));\n}\n\n.border-softest {\n border-color: rgba(0, 0, 0, .05);\n}\n\n.border-b-softer {\n border-bottom-color: rgba(0, 0, 0, .1);\n}\n\n.\\!bg-accent-dark {\n background-color: var(--green-600) !important;\n}\n\n.\\!bg-darker {\n background-color: var(--grey-400) !important;\n}\n\n.\\!bg-strong-dark {\n background-color: var(--grey-800) !important;\n}\n\n.bg-accent {\n background-color: var(--green-500);\n}\n\n.bg-accent-dark {\n background-color: var(--green-600);\n}\n\n.bg-dark {\n background-color: var(--grey-300);\n}\n\n.bg-darker {\n background-color: var(--grey-400);\n}\n\n.bg-overlay {\n background-color: rgba(0, 0, 0, 0.25);\n}\n\n.bg-strong {\n background-color: var(--grey-700);\n}\n\n.bg-strong-dark {\n background-color: var(--grey-800);\n}\n\n.bg-stronger {\n background-color: var(--grey-900);\n}\n\n.bg-strongest {\n background-color: var(--black);\n}\n\n.p-12 {\n padding: 0.75rem;\n}\n\n.p-6 {\n padding: 0.375rem;\n}\n\n.p-8 {\n padding: 0.5rem;\n}\n\n.\\!px-0 {\n padding-left: 0rem !important;\n padding-right: 0rem !important;\n}\n\n.px-12 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n\n.px-16 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n\n.py-8 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n\n.pl-4 {\n padding-left: 0.25rem;\n}\n\n.pl-8 {\n padding-left: 0.5rem;\n}\n\n.pr-4 {\n padding-right: 0.25rem;\n}\n\n.pr-8 {\n padding-right: 0.5rem;\n}\n\n.\\!text-current {\n color: currentColor !important;\n}\n\n.text-accent {\n color: var(--green-500);\n}\n\n.text-current {\n color: currentColor;\n}\n\n.text-default {\n color: var(--black);\n}\n\n.text-inverse {\n color: var(--white);\n}\n\n.text-lightest {\n color: var(--grey-500);\n}\n\n.opacity-0 {\n opacity: 0;\n}\n\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.shadow-accent {\n --tw-shadow: 0px 0px 12px rgba(0, 201, 89, 0.6);\n --tw-shadow-colored: 0px 0px 12px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.underline-offset-4 {\n text-underline-offset: 0.2em;\n}\n\n.\\@container {\n container-type: inline-size;\n}\n\n.after\\:effect-opacity::after {\n transition-property: opacity;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0, 0, 0.2, 1);\n}\n\n.even\\:bg-inverse-softer:nth-child(even) {\n background-color: rgba(255, 255, 255, .15);\n}\n\n.invalid\\:text-lightest:invalid {\n color: var(--grey-500);\n}\n\n.focus-within\\:bg-transparent:focus-within {\n background-color: var(--transparent);\n}\n\n.hover\\:bg-accent-dark:hover {\n background-color: var(--green-600);\n}\n\n.hover\\:bg-dark:hover {\n background-color: var(--grey-300);\n}\n\n.hover\\:bg-darker:hover {\n background-color: var(--grey-400);\n}\n\n.hover\\:bg-default:hover {\n background-color: var(--grey-200);\n}\n\n.hover\\:bg-inverse:hover {\n background-color: var(--white);\n}\n\n.hover\\:bg-strong-dark:hover {\n background-color: var(--grey-800);\n}\n\n.hover\\:bg-transparent:hover {\n background-color: var(--transparent);\n}\n\n.hover\\:text-default:hover {\n color: var(--black);\n}\n\n.hover\\:text-lighter:hover {\n color: var(--grey-600);\n}\n\n.hover\\:\\!underline:hover {\n text-decoration-line: underline !important;\n}\n\n.hover\\:no-underline:hover {\n text-decoration-line: none;\n}\n\n.hover\\:shadow-hover:hover {\n --tw-shadow: 0px 0px 16px rgba(0, 0, 0, 0.2);\n --tw-shadow-colored: 0px 0px 16px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.focus\\:shadow-none:focus {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.focus\\:outline-none:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n\n.disabled\\:cursor-not-allowed:disabled {\n cursor: not-allowed;\n}\n\n.disabled\\:bg-dark:disabled {\n background-color: var(--grey-300);\n}\n\n.disabled\\:text-lightest:disabled {\n color: var(--grey-500);\n}\n\n.aria-disabled\\:cursor-not-allowed[aria-disabled=\"true\"] {\n cursor: not-allowed;\n}\n\n.aria-disabled\\:\\!border-transparent[aria-disabled=\"true\"] {\n border-color: var(--transparent) !important;\n}\n\n.aria-disabled\\:bg-dark[aria-disabled=\"true\"] {\n background-color: var(--grey-300);\n}\n\n.aria-disabled\\:bg-transparent[aria-disabled=\"true\"] {\n background-color: var(--transparent);\n}\n\n.aria-disabled\\:text-light[aria-disabled=\"true\"] {\n color: var(--grey-700);\n}\n\n.aria-disabled\\:text-lightest[aria-disabled=\"true\"] {\n color: var(--grey-500);\n}\n\n.aria-disabled\\:line-through[aria-disabled=\"true\"] {\n text-decoration-line: line-through;\n}\n\n.aria-disabled\\:shadow-none[aria-disabled=\"true\"] {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.aria-current-page\\:bg-darker[aria-current=\"page\"] {\n background-color: var(--grey-400);\n}\n\n.after\\:absolute::after {\n position: absolute;\n}\n\n.after\\:inset-0::after {\n inset: 0rem;\n}\n\n.after\\:inset-x-0::after {\n left: 0rem;\n right: 0rem;\n}\n\n.after\\:bottom-0::after {\n bottom: 0rem;\n}\n\n.after\\:left-16::after {\n left: 1rem;\n}\n\n.after\\:right-16::after {\n right: 1rem;\n}\n\n.after\\:z-10::after {\n z-index: 10;\n}\n\n.after\\:rounded-lg::after {\n border-radius: 16px;\n}\n\n.after\\:rounded-t-lg::after {\n border-top-left-radius: 16px;\n border-top-right-radius: 16px;\n}\n\n.after\\:border-3::after {\n border-width: 3px;\n}\n\n.after\\:border-b-2::after {\n border-bottom-width: 2px;\n}\n\n.after\\:\\!border-transparent::after {\n border-color: var(--transparent) !important;\n}\n\n.after\\:border-accent::after {\n border-color: var(--green-500);\n}\n\n.after\\:border-softest::after {\n border-color: rgba(0, 0, 0, .05);\n}\n\n.after\\:opacity-0::after {\n opacity: 0;\n}\n\n.after\\:content-\\[\\'\\'\\]::after {\n --tw-content: '';\n content: var(--tw-content);\n}\n\n.hover\\:after\\:\\!border-transparent:hover::after {\n border-color: var(--transparent) !important;\n}\n\n.hover\\:after\\:opacity-100:hover::after {\n opacity: 1;\n}\n\n.focus-visible\\:after\\:opacity-100:focus-visible::after {\n opacity: 1;\n}\n\n.aria-disabled\\:after\\:\\!border-transparent[aria-disabled=\"true\"]::after {\n border-color: var(--transparent) !important;\n}\n\n.hover\\:before\\:opacity-100:hover::before {\n opacity: 1;\n}";
|
|
89
411
|
const EdsButtonStyle0 = edsButtonCss;
|
|
90
412
|
|
|
91
413
|
const EdsButton = class {
|
|
@@ -105,7 +427,7 @@ const EdsButton = class {
|
|
|
105
427
|
secondary: 'border-inside border-inside-inverse text-inverse bg-strongest hover:bg-strong-dark',
|
|
106
428
|
tertiary: 'border-inside after:border-softest bg-dark hover:bg-darker',
|
|
107
429
|
ghost: 'border-inside hover:bg-darker',
|
|
108
|
-
ghostInverse: 'border-inside hover:bg-dark'
|
|
430
|
+
ghostInverse: 'border-inside text-lightest hover:bg-dark'
|
|
109
431
|
},
|
|
110
432
|
loading: {
|
|
111
433
|
true: 'pointer-events-none',
|
|
@@ -215,8 +537,7 @@ const EdsButton = class {
|
|
|
215
537
|
}
|
|
216
538
|
handleClick(event) {
|
|
217
539
|
var _a, _b;
|
|
218
|
-
if (this.disabled) {
|
|
219
|
-
// Prevent navigation if the link is disabled
|
|
540
|
+
if (this.disabled || this.loading) {
|
|
220
541
|
event.preventDefault();
|
|
221
542
|
return;
|
|
222
543
|
}
|
|
@@ -232,28 +553,2522 @@ const EdsButton = class {
|
|
|
232
553
|
this.triggerClick(); // Trigger the passed-in function
|
|
233
554
|
}
|
|
234
555
|
}
|
|
556
|
+
handleKeyDown(event) {
|
|
557
|
+
if (this.disabled || this.loading) {
|
|
558
|
+
// Fix: check loading too
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if (event.key === 'Enter' || (this.elementType === 'a' && event.key === ' ')) {
|
|
562
|
+
event.preventDefault();
|
|
563
|
+
this.handleClick(event);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
render() {
|
|
567
|
+
const classes = this.button({
|
|
568
|
+
intent: this.intent,
|
|
569
|
+
loading: this.loading,
|
|
570
|
+
iconPos: this.iconPos,
|
|
571
|
+
size: this.size,
|
|
572
|
+
pill: this.pill,
|
|
573
|
+
iconOnly: !this.label,
|
|
574
|
+
iconSmall: this.iconSmall
|
|
575
|
+
});
|
|
576
|
+
const ElementType = this.elementType;
|
|
577
|
+
const isInteractive = !this.disabled && !this.loading;
|
|
578
|
+
return (index.h(index.Host, { key: '835cc81d3563abf1b5cb4c21165de1ef726d1e43' }, index.h(ElementType, { key: 'df05b2b2152e707e5fdd6028c5f557097d7e2b04', tabindex: isInteractive ? '0' : '-1', "aria-label": this.label ? undefined : this.ariaLabel, "aria-disabled": this.disabled || this.loading ? 'true' : undefined, "aria-busy": this.loading ? 'true' : undefined, disabled: this.elementType === 'button' ? this.disabled || this.loading : undefined, role: this.elementType === 'a' ? 'button' : undefined, class: `${classes || ''} ${this.extraClass || ''}`, onClick: (event) => this.handleClick(event), onKeyDown: (event) => this.handleKeyDown(event) }, this.label && (index.h("span", { key: '27c7473403e7c1bfd3dfc270151d44dbb639ceb3', class: this.loading ? 'opacity-0' : '', "aria-hidden": this.loading ? 'true' : undefined }, this.label)), this.loading && (index.h("span", { key: 'f52496884816bc299fb76c1afae5e4798bf642d2', class: "absolute inset-0 flex items-center justify-center", "aria-hidden": "true" }, index.h("span", { key: 'd42bf2c229f6956a1e0dbe64aa6c79ad5608ca5c', class: "loader", style: {
|
|
579
|
+
border: `3px solid ${this.intent === 'secondary' ? 'rgba(255, 255, 255, .3)' : 'rgba(0, 0, 0, .3)'}`,
|
|
580
|
+
borderBottomColor: this.intent === 'secondary' ? '#fff' : '#000'
|
|
581
|
+
} }))), this.icon ? (index.h("eds-icon-wrapper", { class: `
|
|
582
|
+
flex inline-flex items-center justify-center
|
|
583
|
+
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
584
|
+
`, icon: this.icon, "aria-hidden": "true" })) : null)));
|
|
585
|
+
}
|
|
586
|
+
static get delegatesFocus() { return true; }
|
|
587
|
+
get el() { return index.getElement(this); }
|
|
588
|
+
};
|
|
589
|
+
EdsButton.style = EdsButtonStyle0;
|
|
590
|
+
|
|
591
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
592
|
+
|
|
593
|
+
var prism = {exports: {}};
|
|
594
|
+
|
|
595
|
+
(function (module) {
|
|
596
|
+
/* **********************************************
|
|
597
|
+
Begin prism-core.js
|
|
598
|
+
********************************************** */
|
|
599
|
+
|
|
600
|
+
/// <reference lib="WebWorker"/>
|
|
601
|
+
|
|
602
|
+
var _self = (typeof window !== 'undefined')
|
|
603
|
+
? window // if in browser
|
|
604
|
+
: (
|
|
605
|
+
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
|
|
606
|
+
? self // if in worker
|
|
607
|
+
: {} // if in node js
|
|
608
|
+
);
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
612
|
+
*
|
|
613
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
614
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
615
|
+
* @namespace
|
|
616
|
+
* @public
|
|
617
|
+
*/
|
|
618
|
+
var Prism = (function (_self) {
|
|
619
|
+
|
|
620
|
+
// Private helper vars
|
|
621
|
+
var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
|
|
622
|
+
var uniqueId = 0;
|
|
623
|
+
|
|
624
|
+
// The grammar object for plaintext
|
|
625
|
+
var plainTextGrammar = {};
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
var _ = {
|
|
629
|
+
/**
|
|
630
|
+
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
631
|
+
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
632
|
+
* additional languages or plugins yourself.
|
|
633
|
+
*
|
|
634
|
+
* By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
|
|
635
|
+
*
|
|
636
|
+
* You obviously have to change this value before the automatic highlighting started. To do this, you can add an
|
|
637
|
+
* empty Prism object into the global scope before loading the Prism script like this:
|
|
638
|
+
*
|
|
639
|
+
* ```js
|
|
640
|
+
* window.Prism = window.Prism || {};
|
|
641
|
+
* Prism.manual = true;
|
|
642
|
+
* // add a new <script> to load Prism's script
|
|
643
|
+
* ```
|
|
644
|
+
*
|
|
645
|
+
* @default false
|
|
646
|
+
* @type {boolean}
|
|
647
|
+
* @memberof Prism
|
|
648
|
+
* @public
|
|
649
|
+
*/
|
|
650
|
+
manual: _self.Prism && _self.Prism.manual,
|
|
651
|
+
/**
|
|
652
|
+
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
|
653
|
+
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
|
654
|
+
* own worker, you don't want it to do this.
|
|
655
|
+
*
|
|
656
|
+
* By setting this value to `true`, Prism will not add its own listeners to the worker.
|
|
657
|
+
*
|
|
658
|
+
* You obviously have to change this value before Prism executes. To do this, you can add an
|
|
659
|
+
* empty Prism object into the global scope before loading the Prism script like this:
|
|
660
|
+
*
|
|
661
|
+
* ```js
|
|
662
|
+
* window.Prism = window.Prism || {};
|
|
663
|
+
* Prism.disableWorkerMessageHandler = true;
|
|
664
|
+
* // Load Prism's script
|
|
665
|
+
* ```
|
|
666
|
+
*
|
|
667
|
+
* @default false
|
|
668
|
+
* @type {boolean}
|
|
669
|
+
* @memberof Prism
|
|
670
|
+
* @public
|
|
671
|
+
*/
|
|
672
|
+
disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* A namespace for utility methods.
|
|
676
|
+
*
|
|
677
|
+
* All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
|
|
678
|
+
* change or disappear at any time.
|
|
679
|
+
*
|
|
680
|
+
* @namespace
|
|
681
|
+
* @memberof Prism
|
|
682
|
+
*/
|
|
683
|
+
util: {
|
|
684
|
+
encode: function encode(tokens) {
|
|
685
|
+
if (tokens instanceof Token) {
|
|
686
|
+
return new Token(tokens.type, encode(tokens.content), tokens.alias);
|
|
687
|
+
} else if (Array.isArray(tokens)) {
|
|
688
|
+
return tokens.map(encode);
|
|
689
|
+
} else {
|
|
690
|
+
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Returns the name of the type of the given value.
|
|
696
|
+
*
|
|
697
|
+
* @param {any} o
|
|
698
|
+
* @returns {string}
|
|
699
|
+
* @example
|
|
700
|
+
* type(null) === 'Null'
|
|
701
|
+
* type(undefined) === 'Undefined'
|
|
702
|
+
* type(123) === 'Number'
|
|
703
|
+
* type('foo') === 'String'
|
|
704
|
+
* type(true) === 'Boolean'
|
|
705
|
+
* type([1, 2]) === 'Array'
|
|
706
|
+
* type({}) === 'Object'
|
|
707
|
+
* type(String) === 'Function'
|
|
708
|
+
* type(/abc+/) === 'RegExp'
|
|
709
|
+
*/
|
|
710
|
+
type: function (o) {
|
|
711
|
+
return Object.prototype.toString.call(o).slice(8, -1);
|
|
712
|
+
},
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Returns a unique number for the given object. Later calls will still return the same number.
|
|
716
|
+
*
|
|
717
|
+
* @param {Object} obj
|
|
718
|
+
* @returns {number}
|
|
719
|
+
*/
|
|
720
|
+
objId: function (obj) {
|
|
721
|
+
if (!obj['__id']) {
|
|
722
|
+
Object.defineProperty(obj, '__id', { value: ++uniqueId });
|
|
723
|
+
}
|
|
724
|
+
return obj['__id'];
|
|
725
|
+
},
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Creates a deep clone of the given object.
|
|
729
|
+
*
|
|
730
|
+
* The main intended use of this function is to clone language definitions.
|
|
731
|
+
*
|
|
732
|
+
* @param {T} o
|
|
733
|
+
* @param {Record<number, any>} [visited]
|
|
734
|
+
* @returns {T}
|
|
735
|
+
* @template T
|
|
736
|
+
*/
|
|
737
|
+
clone: function deepClone(o, visited) {
|
|
738
|
+
visited = visited || {};
|
|
739
|
+
|
|
740
|
+
var clone; var id;
|
|
741
|
+
switch (_.util.type(o)) {
|
|
742
|
+
case 'Object':
|
|
743
|
+
id = _.util.objId(o);
|
|
744
|
+
if (visited[id]) {
|
|
745
|
+
return visited[id];
|
|
746
|
+
}
|
|
747
|
+
clone = /** @type {Record<string, any>} */ ({});
|
|
748
|
+
visited[id] = clone;
|
|
749
|
+
|
|
750
|
+
for (var key in o) {
|
|
751
|
+
if (o.hasOwnProperty(key)) {
|
|
752
|
+
clone[key] = deepClone(o[key], visited);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return /** @type {any} */ (clone);
|
|
757
|
+
|
|
758
|
+
case 'Array':
|
|
759
|
+
id = _.util.objId(o);
|
|
760
|
+
if (visited[id]) {
|
|
761
|
+
return visited[id];
|
|
762
|
+
}
|
|
763
|
+
clone = [];
|
|
764
|
+
visited[id] = clone;
|
|
765
|
+
|
|
766
|
+
(/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
|
|
767
|
+
clone[i] = deepClone(v, visited);
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
return /** @type {any} */ (clone);
|
|
771
|
+
|
|
772
|
+
default:
|
|
773
|
+
return o;
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
|
|
779
|
+
*
|
|
780
|
+
* If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
|
|
781
|
+
*
|
|
782
|
+
* @param {Element} element
|
|
783
|
+
* @returns {string}
|
|
784
|
+
*/
|
|
785
|
+
getLanguage: function (element) {
|
|
786
|
+
while (element) {
|
|
787
|
+
var m = lang.exec(element.className);
|
|
788
|
+
if (m) {
|
|
789
|
+
return m[1].toLowerCase();
|
|
790
|
+
}
|
|
791
|
+
element = element.parentElement;
|
|
792
|
+
}
|
|
793
|
+
return 'none';
|
|
794
|
+
},
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Sets the Prism `language-xxxx` class of the given element.
|
|
798
|
+
*
|
|
799
|
+
* @param {Element} element
|
|
800
|
+
* @param {string} language
|
|
801
|
+
* @returns {void}
|
|
802
|
+
*/
|
|
803
|
+
setLanguage: function (element, language) {
|
|
804
|
+
// remove all `language-xxxx` classes
|
|
805
|
+
// (this might leave behind a leading space)
|
|
806
|
+
element.className = element.className.replace(RegExp(lang, 'gi'), '');
|
|
807
|
+
|
|
808
|
+
// add the new `language-xxxx` class
|
|
809
|
+
// (using `classList` will automatically clean up spaces for us)
|
|
810
|
+
element.classList.add('language-' + language);
|
|
811
|
+
},
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Returns the script element that is currently executing.
|
|
815
|
+
*
|
|
816
|
+
* This does __not__ work for line script element.
|
|
817
|
+
*
|
|
818
|
+
* @returns {HTMLScriptElement | null}
|
|
819
|
+
*/
|
|
820
|
+
currentScript: function () {
|
|
821
|
+
if (typeof document === 'undefined') {
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
|
|
825
|
+
return /** @type {any} */ (document.currentScript);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// IE11 workaround
|
|
829
|
+
// we'll get the src of the current script by parsing IE11's error stack trace
|
|
830
|
+
// this will not work for inline scripts
|
|
831
|
+
|
|
832
|
+
try {
|
|
833
|
+
throw new Error();
|
|
834
|
+
} catch (err) {
|
|
835
|
+
// Get file src url from stack. Specifically works with the format of stack traces in IE.
|
|
836
|
+
// A stack will look like this:
|
|
837
|
+
//
|
|
838
|
+
// Error
|
|
839
|
+
// at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
|
|
840
|
+
// at Global code (http://localhost/components/prism-core.js:606:1)
|
|
841
|
+
|
|
842
|
+
var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
|
|
843
|
+
if (src) {
|
|
844
|
+
var scripts = document.getElementsByTagName('script');
|
|
845
|
+
for (var i in scripts) {
|
|
846
|
+
if (scripts[i].src == src) {
|
|
847
|
+
return scripts[i];
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Returns whether a given class is active for `element`.
|
|
857
|
+
*
|
|
858
|
+
* The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
|
|
859
|
+
* if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
|
|
860
|
+
* given class is just the given class with a `no-` prefix.
|
|
861
|
+
*
|
|
862
|
+
* Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
|
|
863
|
+
* closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
|
|
864
|
+
* ancestors have the given class or the negated version of it, then the default activation will be returned.
|
|
865
|
+
*
|
|
866
|
+
* In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
|
|
867
|
+
* version of it, the class is considered active.
|
|
868
|
+
*
|
|
869
|
+
* @param {Element} element
|
|
870
|
+
* @param {string} className
|
|
871
|
+
* @param {boolean} [defaultActivation=false]
|
|
872
|
+
* @returns {boolean}
|
|
873
|
+
*/
|
|
874
|
+
isActive: function (element, className, defaultActivation) {
|
|
875
|
+
var no = 'no-' + className;
|
|
876
|
+
|
|
877
|
+
while (element) {
|
|
878
|
+
var classList = element.classList;
|
|
879
|
+
if (classList.contains(className)) {
|
|
880
|
+
return true;
|
|
881
|
+
}
|
|
882
|
+
if (classList.contains(no)) {
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
element = element.parentElement;
|
|
886
|
+
}
|
|
887
|
+
return !!defaultActivation;
|
|
888
|
+
}
|
|
889
|
+
},
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
|
|
893
|
+
*
|
|
894
|
+
* @namespace
|
|
895
|
+
* @memberof Prism
|
|
896
|
+
* @public
|
|
897
|
+
*/
|
|
898
|
+
languages: {
|
|
899
|
+
/**
|
|
900
|
+
* The grammar for plain, unformatted text.
|
|
901
|
+
*/
|
|
902
|
+
plain: plainTextGrammar,
|
|
903
|
+
plaintext: plainTextGrammar,
|
|
904
|
+
text: plainTextGrammar,
|
|
905
|
+
txt: plainTextGrammar,
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
909
|
+
*
|
|
910
|
+
* If a token in `redef` also appears in the copied language, then the existing token in the copied language
|
|
911
|
+
* will be overwritten at its original position.
|
|
912
|
+
*
|
|
913
|
+
* ## Best practices
|
|
914
|
+
*
|
|
915
|
+
* Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
|
|
916
|
+
* doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
|
|
917
|
+
* understand the language definition because, normally, the order of tokens matters in Prism grammars.
|
|
918
|
+
*
|
|
919
|
+
* Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
|
|
920
|
+
* Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
|
|
921
|
+
*
|
|
922
|
+
* @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
|
|
923
|
+
* @param {Grammar} redef The new tokens to append.
|
|
924
|
+
* @returns {Grammar} The new language created.
|
|
925
|
+
* @public
|
|
926
|
+
* @example
|
|
927
|
+
* Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
|
|
928
|
+
* // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
|
|
929
|
+
* // at its original position
|
|
930
|
+
* 'comment': { ... },
|
|
931
|
+
* // CSS doesn't have a 'color' token, so this token will be appended
|
|
932
|
+
* 'color': /\b(?:red|green|blue)\b/
|
|
933
|
+
* });
|
|
934
|
+
*/
|
|
935
|
+
extend: function (id, redef) {
|
|
936
|
+
var lang = _.util.clone(_.languages[id]);
|
|
937
|
+
|
|
938
|
+
for (var key in redef) {
|
|
939
|
+
lang[key] = redef[key];
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
return lang;
|
|
943
|
+
},
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Inserts tokens _before_ another token in a language definition or any other grammar.
|
|
947
|
+
*
|
|
948
|
+
* ## Usage
|
|
949
|
+
*
|
|
950
|
+
* This helper method makes it easy to modify existing languages. For example, the CSS language definition
|
|
951
|
+
* not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
|
|
952
|
+
* in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
|
|
953
|
+
* appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
|
|
954
|
+
* this:
|
|
955
|
+
*
|
|
956
|
+
* ```js
|
|
957
|
+
* Prism.languages.markup.style = {
|
|
958
|
+
* // token
|
|
959
|
+
* };
|
|
960
|
+
* ```
|
|
961
|
+
*
|
|
962
|
+
* then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
|
|
963
|
+
* before existing tokens. For the CSS example above, you would use it like this:
|
|
964
|
+
*
|
|
965
|
+
* ```js
|
|
966
|
+
* Prism.languages.insertBefore('markup', 'cdata', {
|
|
967
|
+
* 'style': {
|
|
968
|
+
* // token
|
|
969
|
+
* }
|
|
970
|
+
* });
|
|
971
|
+
* ```
|
|
972
|
+
*
|
|
973
|
+
* ## Special cases
|
|
974
|
+
*
|
|
975
|
+
* If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
|
|
976
|
+
* will be ignored.
|
|
977
|
+
*
|
|
978
|
+
* This behavior can be used to insert tokens after `before`:
|
|
979
|
+
*
|
|
980
|
+
* ```js
|
|
981
|
+
* Prism.languages.insertBefore('markup', 'comment', {
|
|
982
|
+
* 'comment': Prism.languages.markup.comment,
|
|
983
|
+
* // tokens after 'comment'
|
|
984
|
+
* });
|
|
985
|
+
* ```
|
|
986
|
+
*
|
|
987
|
+
* ## Limitations
|
|
988
|
+
*
|
|
989
|
+
* The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
|
|
990
|
+
* properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
|
|
991
|
+
* differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
|
|
992
|
+
* deleting properties which is necessary to insert at arbitrary positions.
|
|
993
|
+
*
|
|
994
|
+
* To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
|
|
995
|
+
* Instead, it will create a new object and replace all references to the target object with the new one. This
|
|
996
|
+
* can be done without temporarily deleting properties, so the iteration order is well-defined.
|
|
997
|
+
*
|
|
998
|
+
* However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
|
|
999
|
+
* you hold the target object in a variable, then the value of the variable will not change.
|
|
1000
|
+
*
|
|
1001
|
+
* ```js
|
|
1002
|
+
* var oldMarkup = Prism.languages.markup;
|
|
1003
|
+
* var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
|
|
1004
|
+
*
|
|
1005
|
+
* assert(oldMarkup !== Prism.languages.markup);
|
|
1006
|
+
* assert(newMarkup === Prism.languages.markup);
|
|
1007
|
+
* ```
|
|
1008
|
+
*
|
|
1009
|
+
* @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
|
|
1010
|
+
* object to be modified.
|
|
1011
|
+
* @param {string} before The key to insert before.
|
|
1012
|
+
* @param {Grammar} insert An object containing the key-value pairs to be inserted.
|
|
1013
|
+
* @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
|
|
1014
|
+
* object to be modified.
|
|
1015
|
+
*
|
|
1016
|
+
* Defaults to `Prism.languages`.
|
|
1017
|
+
* @returns {Grammar} The new grammar object.
|
|
1018
|
+
* @public
|
|
1019
|
+
*/
|
|
1020
|
+
insertBefore: function (inside, before, insert, root) {
|
|
1021
|
+
root = root || /** @type {any} */ (_.languages);
|
|
1022
|
+
var grammar = root[inside];
|
|
1023
|
+
/** @type {Grammar} */
|
|
1024
|
+
var ret = {};
|
|
1025
|
+
|
|
1026
|
+
for (var token in grammar) {
|
|
1027
|
+
if (grammar.hasOwnProperty(token)) {
|
|
1028
|
+
|
|
1029
|
+
if (token == before) {
|
|
1030
|
+
for (var newToken in insert) {
|
|
1031
|
+
if (insert.hasOwnProperty(newToken)) {
|
|
1032
|
+
ret[newToken] = insert[newToken];
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// Do not insert token which also occur in insert. See #1525
|
|
1038
|
+
if (!insert.hasOwnProperty(token)) {
|
|
1039
|
+
ret[token] = grammar[token];
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
var old = root[inside];
|
|
1045
|
+
root[inside] = ret;
|
|
1046
|
+
|
|
1047
|
+
// Update references in other language definitions
|
|
1048
|
+
_.languages.DFS(_.languages, function (key, value) {
|
|
1049
|
+
if (value === old && key != inside) {
|
|
1050
|
+
this[key] = ret;
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
return ret;
|
|
1055
|
+
},
|
|
1056
|
+
|
|
1057
|
+
// Traverse a language definition with Depth First Search
|
|
1058
|
+
DFS: function DFS(o, callback, type, visited) {
|
|
1059
|
+
visited = visited || {};
|
|
1060
|
+
|
|
1061
|
+
var objId = _.util.objId;
|
|
1062
|
+
|
|
1063
|
+
for (var i in o) {
|
|
1064
|
+
if (o.hasOwnProperty(i)) {
|
|
1065
|
+
callback.call(o, i, o[i], type || i);
|
|
1066
|
+
|
|
1067
|
+
var property = o[i];
|
|
1068
|
+
var propertyType = _.util.type(property);
|
|
1069
|
+
|
|
1070
|
+
if (propertyType === 'Object' && !visited[objId(property)]) {
|
|
1071
|
+
visited[objId(property)] = true;
|
|
1072
|
+
DFS(property, callback, null, visited);
|
|
1073
|
+
} else if (propertyType === 'Array' && !visited[objId(property)]) {
|
|
1074
|
+
visited[objId(property)] = true;
|
|
1075
|
+
DFS(property, callback, i, visited);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
},
|
|
1081
|
+
|
|
1082
|
+
plugins: {},
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* This is the most high-level function in Prism’s API.
|
|
1086
|
+
* It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
|
|
1087
|
+
* each one of them.
|
|
1088
|
+
*
|
|
1089
|
+
* This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
|
|
1090
|
+
*
|
|
1091
|
+
* @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
|
|
1092
|
+
* @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
|
|
1093
|
+
* @memberof Prism
|
|
1094
|
+
* @public
|
|
1095
|
+
*/
|
|
1096
|
+
highlightAll: function (async, callback) {
|
|
1097
|
+
_.highlightAllUnder(document, async, callback);
|
|
1098
|
+
},
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
|
1102
|
+
* {@link Prism.highlightElement} on each one of them.
|
|
1103
|
+
*
|
|
1104
|
+
* The following hooks will be run:
|
|
1105
|
+
* 1. `before-highlightall`
|
|
1106
|
+
* 2. `before-all-elements-highlight`
|
|
1107
|
+
* 3. All hooks of {@link Prism.highlightElement} for each element.
|
|
1108
|
+
*
|
|
1109
|
+
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
|
|
1110
|
+
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
|
|
1111
|
+
* @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
|
|
1112
|
+
* @memberof Prism
|
|
1113
|
+
* @public
|
|
1114
|
+
*/
|
|
1115
|
+
highlightAllUnder: function (container, async, callback) {
|
|
1116
|
+
var env = {
|
|
1117
|
+
callback: callback,
|
|
1118
|
+
container: container,
|
|
1119
|
+
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
_.hooks.run('before-highlightall', env);
|
|
1123
|
+
|
|
1124
|
+
env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
|
|
1125
|
+
|
|
1126
|
+
_.hooks.run('before-all-elements-highlight', env);
|
|
1127
|
+
|
|
1128
|
+
for (var i = 0, element; (element = env.elements[i++]);) {
|
|
1129
|
+
_.highlightElement(element, async === true, env.callback);
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* Highlights the code inside a single element.
|
|
1135
|
+
*
|
|
1136
|
+
* The following hooks will be run:
|
|
1137
|
+
* 1. `before-sanity-check`
|
|
1138
|
+
* 2. `before-highlight`
|
|
1139
|
+
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
|
|
1140
|
+
* 4. `before-insert`
|
|
1141
|
+
* 5. `after-highlight`
|
|
1142
|
+
* 6. `complete`
|
|
1143
|
+
*
|
|
1144
|
+
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
|
|
1145
|
+
* the element's language.
|
|
1146
|
+
*
|
|
1147
|
+
* @param {Element} element The element containing the code.
|
|
1148
|
+
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
|
|
1149
|
+
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
|
|
1150
|
+
* to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
|
|
1151
|
+
* [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
|
|
1152
|
+
*
|
|
1153
|
+
* Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
|
|
1154
|
+
* asynchronous highlighting to work. You can build your own bundle on the
|
|
1155
|
+
* [Download page](https://prismjs.com/download.html).
|
|
1156
|
+
* @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
|
|
1157
|
+
* Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
|
|
1158
|
+
* @memberof Prism
|
|
1159
|
+
* @public
|
|
1160
|
+
*/
|
|
1161
|
+
highlightElement: function (element, async, callback) {
|
|
1162
|
+
// Find language
|
|
1163
|
+
var language = _.util.getLanguage(element);
|
|
1164
|
+
var grammar = _.languages[language];
|
|
1165
|
+
|
|
1166
|
+
// Set language on the element, if not present
|
|
1167
|
+
_.util.setLanguage(element, language);
|
|
1168
|
+
|
|
1169
|
+
// Set language on the parent, for styling
|
|
1170
|
+
var parent = element.parentElement;
|
|
1171
|
+
if (parent && parent.nodeName.toLowerCase() === 'pre') {
|
|
1172
|
+
_.util.setLanguage(parent, language);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
var code = element.textContent;
|
|
1176
|
+
|
|
1177
|
+
var env = {
|
|
1178
|
+
element: element,
|
|
1179
|
+
language: language,
|
|
1180
|
+
grammar: grammar,
|
|
1181
|
+
code: code
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
function insertHighlightedCode(highlightedCode) {
|
|
1185
|
+
env.highlightedCode = highlightedCode;
|
|
1186
|
+
|
|
1187
|
+
_.hooks.run('before-insert', env);
|
|
1188
|
+
|
|
1189
|
+
env.element.innerHTML = env.highlightedCode;
|
|
1190
|
+
|
|
1191
|
+
_.hooks.run('after-highlight', env);
|
|
1192
|
+
_.hooks.run('complete', env);
|
|
1193
|
+
callback && callback.call(env.element);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
_.hooks.run('before-sanity-check', env);
|
|
1197
|
+
|
|
1198
|
+
// plugins may change/add the parent/element
|
|
1199
|
+
parent = env.element.parentElement;
|
|
1200
|
+
if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
|
|
1201
|
+
parent.setAttribute('tabindex', '0');
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
if (!env.code) {
|
|
1205
|
+
_.hooks.run('complete', env);
|
|
1206
|
+
callback && callback.call(env.element);
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
_.hooks.run('before-highlight', env);
|
|
1211
|
+
|
|
1212
|
+
if (!env.grammar) {
|
|
1213
|
+
insertHighlightedCode(_.util.encode(env.code));
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
if (async && _self.Worker) {
|
|
1218
|
+
var worker = new Worker(_.filename);
|
|
1219
|
+
|
|
1220
|
+
worker.onmessage = function (evt) {
|
|
1221
|
+
insertHighlightedCode(evt.data);
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
worker.postMessage(JSON.stringify({
|
|
1225
|
+
language: env.language,
|
|
1226
|
+
code: env.code,
|
|
1227
|
+
immediateClose: true
|
|
1228
|
+
}));
|
|
1229
|
+
} else {
|
|
1230
|
+
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
|
|
1231
|
+
}
|
|
1232
|
+
},
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
1236
|
+
* and the language definitions to use, and returns a string with the HTML produced.
|
|
1237
|
+
*
|
|
1238
|
+
* The following hooks will be run:
|
|
1239
|
+
* 1. `before-tokenize`
|
|
1240
|
+
* 2. `after-tokenize`
|
|
1241
|
+
* 3. `wrap`: On each {@link Token}.
|
|
1242
|
+
*
|
|
1243
|
+
* @param {string} text A string with the code to be highlighted.
|
|
1244
|
+
* @param {Grammar} grammar An object containing the tokens to use.
|
|
1245
|
+
*
|
|
1246
|
+
* Usually a language definition like `Prism.languages.markup`.
|
|
1247
|
+
* @param {string} language The name of the language definition passed to `grammar`.
|
|
1248
|
+
* @returns {string} The highlighted HTML.
|
|
1249
|
+
* @memberof Prism
|
|
1250
|
+
* @public
|
|
1251
|
+
* @example
|
|
1252
|
+
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
1253
|
+
*/
|
|
1254
|
+
highlight: function (text, grammar, language) {
|
|
1255
|
+
var env = {
|
|
1256
|
+
code: text,
|
|
1257
|
+
grammar: grammar,
|
|
1258
|
+
language: language
|
|
1259
|
+
};
|
|
1260
|
+
_.hooks.run('before-tokenize', env);
|
|
1261
|
+
if (!env.grammar) {
|
|
1262
|
+
throw new Error('The language "' + env.language + '" has no grammar.');
|
|
1263
|
+
}
|
|
1264
|
+
env.tokens = _.tokenize(env.code, env.grammar);
|
|
1265
|
+
_.hooks.run('after-tokenize', env);
|
|
1266
|
+
return Token.stringify(_.util.encode(env.tokens), env.language);
|
|
1267
|
+
},
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
1271
|
+
* and the language definitions to use, and returns an array with the tokenized code.
|
|
1272
|
+
*
|
|
1273
|
+
* When the language definition includes nested tokens, the function is called recursively on each of these tokens.
|
|
1274
|
+
*
|
|
1275
|
+
* This method could be useful in other contexts as well, as a very crude parser.
|
|
1276
|
+
*
|
|
1277
|
+
* @param {string} text A string with the code to be highlighted.
|
|
1278
|
+
* @param {Grammar} grammar An object containing the tokens to use.
|
|
1279
|
+
*
|
|
1280
|
+
* Usually a language definition like `Prism.languages.markup`.
|
|
1281
|
+
* @returns {TokenStream} An array of strings and tokens, a token stream.
|
|
1282
|
+
* @memberof Prism
|
|
1283
|
+
* @public
|
|
1284
|
+
* @example
|
|
1285
|
+
* let code = `var foo = 0;`;
|
|
1286
|
+
* let tokens = Prism.tokenize(code, Prism.languages.javascript);
|
|
1287
|
+
* tokens.forEach(token => {
|
|
1288
|
+
* if (token instanceof Prism.Token && token.type === 'number') {
|
|
1289
|
+
* console.log(`Found numeric literal: ${token.content}`);
|
|
1290
|
+
* }
|
|
1291
|
+
* });
|
|
1292
|
+
*/
|
|
1293
|
+
tokenize: function (text, grammar) {
|
|
1294
|
+
var rest = grammar.rest;
|
|
1295
|
+
if (rest) {
|
|
1296
|
+
for (var token in rest) {
|
|
1297
|
+
grammar[token] = rest[token];
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
delete grammar.rest;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
var tokenList = new LinkedList();
|
|
1304
|
+
addAfter(tokenList, tokenList.head, text);
|
|
1305
|
+
|
|
1306
|
+
matchGrammar(text, tokenList, grammar, tokenList.head, 0);
|
|
1307
|
+
|
|
1308
|
+
return toArray(tokenList);
|
|
1309
|
+
},
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* @namespace
|
|
1313
|
+
* @memberof Prism
|
|
1314
|
+
* @public
|
|
1315
|
+
*/
|
|
1316
|
+
hooks: {
|
|
1317
|
+
all: {},
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* Adds the given callback to the list of callbacks for the given hook.
|
|
1321
|
+
*
|
|
1322
|
+
* The callback will be invoked when the hook it is registered for is run.
|
|
1323
|
+
* Hooks are usually directly run by a highlight function but you can also run hooks yourself.
|
|
1324
|
+
*
|
|
1325
|
+
* One callback function can be registered to multiple hooks and the same hook multiple times.
|
|
1326
|
+
*
|
|
1327
|
+
* @param {string} name The name of the hook.
|
|
1328
|
+
* @param {HookCallback} callback The callback function which is given environment variables.
|
|
1329
|
+
* @public
|
|
1330
|
+
*/
|
|
1331
|
+
add: function (name, callback) {
|
|
1332
|
+
var hooks = _.hooks.all;
|
|
1333
|
+
|
|
1334
|
+
hooks[name] = hooks[name] || [];
|
|
1335
|
+
|
|
1336
|
+
hooks[name].push(callback);
|
|
1337
|
+
},
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Runs a hook invoking all registered callbacks with the given environment variables.
|
|
1341
|
+
*
|
|
1342
|
+
* Callbacks will be invoked synchronously and in the order in which they were registered.
|
|
1343
|
+
*
|
|
1344
|
+
* @param {string} name The name of the hook.
|
|
1345
|
+
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
|
1346
|
+
* @public
|
|
1347
|
+
*/
|
|
1348
|
+
run: function (name, env) {
|
|
1349
|
+
var callbacks = _.hooks.all[name];
|
|
1350
|
+
|
|
1351
|
+
if (!callbacks || !callbacks.length) {
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
for (var i = 0, callback; (callback = callbacks[i++]);) {
|
|
1356
|
+
callback(env);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
|
|
1361
|
+
Token: Token
|
|
1362
|
+
};
|
|
1363
|
+
_self.Prism = _;
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
// Typescript note:
|
|
1367
|
+
// The following can be used to import the Token type in JSDoc:
|
|
1368
|
+
//
|
|
1369
|
+
// @typedef {InstanceType<import("./prism-core")["Token"]>} Token
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Creates a new token.
|
|
1373
|
+
*
|
|
1374
|
+
* @param {string} type See {@link Token#type type}
|
|
1375
|
+
* @param {string | TokenStream} content See {@link Token#content content}
|
|
1376
|
+
* @param {string|string[]} [alias] The alias(es) of the token.
|
|
1377
|
+
* @param {string} [matchedStr=""] A copy of the full string this token was created from.
|
|
1378
|
+
* @class
|
|
1379
|
+
* @global
|
|
1380
|
+
* @public
|
|
1381
|
+
*/
|
|
1382
|
+
function Token(type, content, alias, matchedStr) {
|
|
1383
|
+
/**
|
|
1384
|
+
* The type of the token.
|
|
1385
|
+
*
|
|
1386
|
+
* This is usually the key of a pattern in a {@link Grammar}.
|
|
1387
|
+
*
|
|
1388
|
+
* @type {string}
|
|
1389
|
+
* @see GrammarToken
|
|
1390
|
+
* @public
|
|
1391
|
+
*/
|
|
1392
|
+
this.type = type;
|
|
1393
|
+
/**
|
|
1394
|
+
* The strings or tokens contained by this token.
|
|
1395
|
+
*
|
|
1396
|
+
* This will be a token stream if the pattern matched also defined an `inside` grammar.
|
|
1397
|
+
*
|
|
1398
|
+
* @type {string | TokenStream}
|
|
1399
|
+
* @public
|
|
1400
|
+
*/
|
|
1401
|
+
this.content = content;
|
|
1402
|
+
/**
|
|
1403
|
+
* The alias(es) of the token.
|
|
1404
|
+
*
|
|
1405
|
+
* @type {string|string[]}
|
|
1406
|
+
* @see GrammarToken
|
|
1407
|
+
* @public
|
|
1408
|
+
*/
|
|
1409
|
+
this.alias = alias;
|
|
1410
|
+
// Copy of the full string this token was created from
|
|
1411
|
+
this.length = (matchedStr || '').length | 0;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* A token stream is an array of strings and {@link Token Token} objects.
|
|
1416
|
+
*
|
|
1417
|
+
* Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
|
|
1418
|
+
* them.
|
|
1419
|
+
*
|
|
1420
|
+
* 1. No adjacent strings.
|
|
1421
|
+
* 2. No empty strings.
|
|
1422
|
+
*
|
|
1423
|
+
* The only exception here is the token stream that only contains the empty string and nothing else.
|
|
1424
|
+
*
|
|
1425
|
+
* @typedef {Array<string | Token>} TokenStream
|
|
1426
|
+
* @global
|
|
1427
|
+
* @public
|
|
1428
|
+
*/
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Converts the given token or token stream to an HTML representation.
|
|
1432
|
+
*
|
|
1433
|
+
* The following hooks will be run:
|
|
1434
|
+
* 1. `wrap`: On each {@link Token}.
|
|
1435
|
+
*
|
|
1436
|
+
* @param {string | Token | TokenStream} o The token or token stream to be converted.
|
|
1437
|
+
* @param {string} language The name of current language.
|
|
1438
|
+
* @returns {string} The HTML representation of the token or token stream.
|
|
1439
|
+
* @memberof Token
|
|
1440
|
+
* @static
|
|
1441
|
+
*/
|
|
1442
|
+
Token.stringify = function stringify(o, language) {
|
|
1443
|
+
if (typeof o == 'string') {
|
|
1444
|
+
return o;
|
|
1445
|
+
}
|
|
1446
|
+
if (Array.isArray(o)) {
|
|
1447
|
+
var s = '';
|
|
1448
|
+
o.forEach(function (e) {
|
|
1449
|
+
s += stringify(e, language);
|
|
1450
|
+
});
|
|
1451
|
+
return s;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
var env = {
|
|
1455
|
+
type: o.type,
|
|
1456
|
+
content: stringify(o.content, language),
|
|
1457
|
+
tag: 'span',
|
|
1458
|
+
classes: ['token', o.type],
|
|
1459
|
+
attributes: {},
|
|
1460
|
+
language: language
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1463
|
+
var aliases = o.alias;
|
|
1464
|
+
if (aliases) {
|
|
1465
|
+
if (Array.isArray(aliases)) {
|
|
1466
|
+
Array.prototype.push.apply(env.classes, aliases);
|
|
1467
|
+
} else {
|
|
1468
|
+
env.classes.push(aliases);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
_.hooks.run('wrap', env);
|
|
1473
|
+
|
|
1474
|
+
var attributes = '';
|
|
1475
|
+
for (var name in env.attributes) {
|
|
1476
|
+
attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* @param {RegExp} pattern
|
|
1484
|
+
* @param {number} pos
|
|
1485
|
+
* @param {string} text
|
|
1486
|
+
* @param {boolean} lookbehind
|
|
1487
|
+
* @returns {RegExpExecArray | null}
|
|
1488
|
+
*/
|
|
1489
|
+
function matchPattern(pattern, pos, text, lookbehind) {
|
|
1490
|
+
pattern.lastIndex = pos;
|
|
1491
|
+
var match = pattern.exec(text);
|
|
1492
|
+
if (match && lookbehind && match[1]) {
|
|
1493
|
+
// change the match to remove the text matched by the Prism lookbehind group
|
|
1494
|
+
var lookbehindLength = match[1].length;
|
|
1495
|
+
match.index += lookbehindLength;
|
|
1496
|
+
match[0] = match[0].slice(lookbehindLength);
|
|
1497
|
+
}
|
|
1498
|
+
return match;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* @param {string} text
|
|
1503
|
+
* @param {LinkedList<string | Token>} tokenList
|
|
1504
|
+
* @param {any} grammar
|
|
1505
|
+
* @param {LinkedListNode<string | Token>} startNode
|
|
1506
|
+
* @param {number} startPos
|
|
1507
|
+
* @param {RematchOptions} [rematch]
|
|
1508
|
+
* @returns {void}
|
|
1509
|
+
* @private
|
|
1510
|
+
*
|
|
1511
|
+
* @typedef RematchOptions
|
|
1512
|
+
* @property {string} cause
|
|
1513
|
+
* @property {number} reach
|
|
1514
|
+
*/
|
|
1515
|
+
function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
|
|
1516
|
+
for (var token in grammar) {
|
|
1517
|
+
if (!grammar.hasOwnProperty(token) || !grammar[token]) {
|
|
1518
|
+
continue;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
var patterns = grammar[token];
|
|
1522
|
+
patterns = Array.isArray(patterns) ? patterns : [patterns];
|
|
1523
|
+
|
|
1524
|
+
for (var j = 0; j < patterns.length; ++j) {
|
|
1525
|
+
if (rematch && rematch.cause == token + ',' + j) {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
var patternObj = patterns[j];
|
|
1530
|
+
var inside = patternObj.inside;
|
|
1531
|
+
var lookbehind = !!patternObj.lookbehind;
|
|
1532
|
+
var greedy = !!patternObj.greedy;
|
|
1533
|
+
var alias = patternObj.alias;
|
|
1534
|
+
|
|
1535
|
+
if (greedy && !patternObj.pattern.global) {
|
|
1536
|
+
// Without the global flag, lastIndex won't work
|
|
1537
|
+
var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
|
|
1538
|
+
patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** @type {RegExp} */
|
|
1542
|
+
var pattern = patternObj.pattern || patternObj;
|
|
1543
|
+
|
|
1544
|
+
for ( // iterate the token list and keep track of the current token/string position
|
|
1545
|
+
var currentNode = startNode.next, pos = startPos;
|
|
1546
|
+
currentNode !== tokenList.tail;
|
|
1547
|
+
pos += currentNode.value.length, currentNode = currentNode.next
|
|
1548
|
+
) {
|
|
1549
|
+
|
|
1550
|
+
if (rematch && pos >= rematch.reach) {
|
|
1551
|
+
break;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
var str = currentNode.value;
|
|
1555
|
+
|
|
1556
|
+
if (tokenList.length > text.length) {
|
|
1557
|
+
// Something went terribly wrong, ABORT, ABORT!
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
if (str instanceof Token) {
|
|
1562
|
+
continue;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
var removeCount = 1; // this is the to parameter of removeBetween
|
|
1566
|
+
var match;
|
|
1567
|
+
|
|
1568
|
+
if (greedy) {
|
|
1569
|
+
match = matchPattern(pattern, pos, text, lookbehind);
|
|
1570
|
+
if (!match || match.index >= text.length) {
|
|
1571
|
+
break;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
var from = match.index;
|
|
1575
|
+
var to = match.index + match[0].length;
|
|
1576
|
+
var p = pos;
|
|
1577
|
+
|
|
1578
|
+
// find the node that contains the match
|
|
1579
|
+
p += currentNode.value.length;
|
|
1580
|
+
while (from >= p) {
|
|
1581
|
+
currentNode = currentNode.next;
|
|
1582
|
+
p += currentNode.value.length;
|
|
1583
|
+
}
|
|
1584
|
+
// adjust pos (and p)
|
|
1585
|
+
p -= currentNode.value.length;
|
|
1586
|
+
pos = p;
|
|
1587
|
+
|
|
1588
|
+
// the current node is a Token, then the match starts inside another Token, which is invalid
|
|
1589
|
+
if (currentNode.value instanceof Token) {
|
|
1590
|
+
continue;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
// find the last node which is affected by this match
|
|
1594
|
+
for (
|
|
1595
|
+
var k = currentNode;
|
|
1596
|
+
k !== tokenList.tail && (p < to || typeof k.value === 'string');
|
|
1597
|
+
k = k.next
|
|
1598
|
+
) {
|
|
1599
|
+
removeCount++;
|
|
1600
|
+
p += k.value.length;
|
|
1601
|
+
}
|
|
1602
|
+
removeCount--;
|
|
1603
|
+
|
|
1604
|
+
// replace with the new match
|
|
1605
|
+
str = text.slice(pos, p);
|
|
1606
|
+
match.index -= pos;
|
|
1607
|
+
} else {
|
|
1608
|
+
match = matchPattern(pattern, 0, str, lookbehind);
|
|
1609
|
+
if (!match) {
|
|
1610
|
+
continue;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
// eslint-disable-next-line no-redeclare
|
|
1615
|
+
var from = match.index;
|
|
1616
|
+
var matchStr = match[0];
|
|
1617
|
+
var before = str.slice(0, from);
|
|
1618
|
+
var after = str.slice(from + matchStr.length);
|
|
1619
|
+
|
|
1620
|
+
var reach = pos + str.length;
|
|
1621
|
+
if (rematch && reach > rematch.reach) {
|
|
1622
|
+
rematch.reach = reach;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
var removeFrom = currentNode.prev;
|
|
1626
|
+
|
|
1627
|
+
if (before) {
|
|
1628
|
+
removeFrom = addAfter(tokenList, removeFrom, before);
|
|
1629
|
+
pos += before.length;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
removeRange(tokenList, removeFrom, removeCount);
|
|
1633
|
+
|
|
1634
|
+
var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
|
|
1635
|
+
currentNode = addAfter(tokenList, removeFrom, wrapped);
|
|
1636
|
+
|
|
1637
|
+
if (after) {
|
|
1638
|
+
addAfter(tokenList, currentNode, after);
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
if (removeCount > 1) {
|
|
1642
|
+
// at least one Token object was removed, so we have to do some rematching
|
|
1643
|
+
// this can only happen if the current pattern is greedy
|
|
1644
|
+
|
|
1645
|
+
/** @type {RematchOptions} */
|
|
1646
|
+
var nestedRematch = {
|
|
1647
|
+
cause: token + ',' + j,
|
|
1648
|
+
reach: reach
|
|
1649
|
+
};
|
|
1650
|
+
matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
|
|
1651
|
+
|
|
1652
|
+
// the reach might have been extended because of the rematching
|
|
1653
|
+
if (rematch && nestedRematch.reach > rematch.reach) {
|
|
1654
|
+
rematch.reach = nestedRematch.reach;
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
/**
|
|
1663
|
+
* @typedef LinkedListNode
|
|
1664
|
+
* @property {T} value
|
|
1665
|
+
* @property {LinkedListNode<T> | null} prev The previous node.
|
|
1666
|
+
* @property {LinkedListNode<T> | null} next The next node.
|
|
1667
|
+
* @template T
|
|
1668
|
+
* @private
|
|
1669
|
+
*/
|
|
1670
|
+
|
|
1671
|
+
/**
|
|
1672
|
+
* @template T
|
|
1673
|
+
* @private
|
|
1674
|
+
*/
|
|
1675
|
+
function LinkedList() {
|
|
1676
|
+
/** @type {LinkedListNode<T>} */
|
|
1677
|
+
var head = { value: null, prev: null, next: null };
|
|
1678
|
+
/** @type {LinkedListNode<T>} */
|
|
1679
|
+
var tail = { value: null, prev: head, next: null };
|
|
1680
|
+
head.next = tail;
|
|
1681
|
+
|
|
1682
|
+
/** @type {LinkedListNode<T>} */
|
|
1683
|
+
this.head = head;
|
|
1684
|
+
/** @type {LinkedListNode<T>} */
|
|
1685
|
+
this.tail = tail;
|
|
1686
|
+
this.length = 0;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Adds a new node with the given value to the list.
|
|
1691
|
+
*
|
|
1692
|
+
* @param {LinkedList<T>} list
|
|
1693
|
+
* @param {LinkedListNode<T>} node
|
|
1694
|
+
* @param {T} value
|
|
1695
|
+
* @returns {LinkedListNode<T>} The added node.
|
|
1696
|
+
* @template T
|
|
1697
|
+
*/
|
|
1698
|
+
function addAfter(list, node, value) {
|
|
1699
|
+
// assumes that node != list.tail && values.length >= 0
|
|
1700
|
+
var next = node.next;
|
|
1701
|
+
|
|
1702
|
+
var newNode = { value: value, prev: node, next: next };
|
|
1703
|
+
node.next = newNode;
|
|
1704
|
+
next.prev = newNode;
|
|
1705
|
+
list.length++;
|
|
1706
|
+
|
|
1707
|
+
return newNode;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Removes `count` nodes after the given node. The given node will not be removed.
|
|
1711
|
+
*
|
|
1712
|
+
* @param {LinkedList<T>} list
|
|
1713
|
+
* @param {LinkedListNode<T>} node
|
|
1714
|
+
* @param {number} count
|
|
1715
|
+
* @template T
|
|
1716
|
+
*/
|
|
1717
|
+
function removeRange(list, node, count) {
|
|
1718
|
+
var next = node.next;
|
|
1719
|
+
for (var i = 0; i < count && next !== list.tail; i++) {
|
|
1720
|
+
next = next.next;
|
|
1721
|
+
}
|
|
1722
|
+
node.next = next;
|
|
1723
|
+
next.prev = node;
|
|
1724
|
+
list.length -= i;
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* @param {LinkedList<T>} list
|
|
1728
|
+
* @returns {T[]}
|
|
1729
|
+
* @template T
|
|
1730
|
+
*/
|
|
1731
|
+
function toArray(list) {
|
|
1732
|
+
var array = [];
|
|
1733
|
+
var node = list.head.next;
|
|
1734
|
+
while (node !== list.tail) {
|
|
1735
|
+
array.push(node.value);
|
|
1736
|
+
node = node.next;
|
|
1737
|
+
}
|
|
1738
|
+
return array;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
if (!_self.document) {
|
|
1743
|
+
if (!_self.addEventListener) {
|
|
1744
|
+
// in Node.js
|
|
1745
|
+
return _;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
if (!_.disableWorkerMessageHandler) {
|
|
1749
|
+
// In worker
|
|
1750
|
+
_self.addEventListener('message', function (evt) {
|
|
1751
|
+
var message = JSON.parse(evt.data);
|
|
1752
|
+
var lang = message.language;
|
|
1753
|
+
var code = message.code;
|
|
1754
|
+
var immediateClose = message.immediateClose;
|
|
1755
|
+
|
|
1756
|
+
_self.postMessage(_.highlight(code, _.languages[lang], lang));
|
|
1757
|
+
if (immediateClose) {
|
|
1758
|
+
_self.close();
|
|
1759
|
+
}
|
|
1760
|
+
}, false);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
return _;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
// Get current script and highlight
|
|
1767
|
+
var script = _.util.currentScript();
|
|
1768
|
+
|
|
1769
|
+
if (script) {
|
|
1770
|
+
_.filename = script.src;
|
|
1771
|
+
|
|
1772
|
+
if (script.hasAttribute('data-manual')) {
|
|
1773
|
+
_.manual = true;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
function highlightAutomaticallyCallback() {
|
|
1778
|
+
if (!_.manual) {
|
|
1779
|
+
_.highlightAll();
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
if (!_.manual) {
|
|
1784
|
+
// If the document state is "loading", then we'll use DOMContentLoaded.
|
|
1785
|
+
// If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
|
|
1786
|
+
// DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
|
|
1787
|
+
// might take longer one animation frame to execute which can create a race condition where only some plugins have
|
|
1788
|
+
// been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
|
|
1789
|
+
// See https://github.com/PrismJS/prism/issues/2102
|
|
1790
|
+
var readyState = document.readyState;
|
|
1791
|
+
if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
|
|
1792
|
+
document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
|
|
1793
|
+
} else {
|
|
1794
|
+
if (window.requestAnimationFrame) {
|
|
1795
|
+
window.requestAnimationFrame(highlightAutomaticallyCallback);
|
|
1796
|
+
} else {
|
|
1797
|
+
window.setTimeout(highlightAutomaticallyCallback, 16);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
return _;
|
|
1803
|
+
|
|
1804
|
+
}(_self));
|
|
1805
|
+
|
|
1806
|
+
if (module.exports) {
|
|
1807
|
+
module.exports = Prism;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
// hack for components to work correctly in node.js
|
|
1811
|
+
if (typeof commonjsGlobal !== 'undefined') {
|
|
1812
|
+
commonjsGlobal.Prism = Prism;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
// some additional documentation/types
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* The expansion of a simple `RegExp` literal to support additional properties.
|
|
1819
|
+
*
|
|
1820
|
+
* @typedef GrammarToken
|
|
1821
|
+
* @property {RegExp} pattern The regular expression of the token.
|
|
1822
|
+
* @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
|
|
1823
|
+
* behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
|
|
1824
|
+
* @property {boolean} [greedy=false] Whether the token is greedy.
|
|
1825
|
+
* @property {string|string[]} [alias] An optional alias or list of aliases.
|
|
1826
|
+
* @property {Grammar} [inside] The nested grammar of this token.
|
|
1827
|
+
*
|
|
1828
|
+
* The `inside` grammar will be used to tokenize the text value of each token of this kind.
|
|
1829
|
+
*
|
|
1830
|
+
* This can be used to make nested and even recursive language definitions.
|
|
1831
|
+
*
|
|
1832
|
+
* Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
|
|
1833
|
+
* each another.
|
|
1834
|
+
* @global
|
|
1835
|
+
* @public
|
|
1836
|
+
*/
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* @typedef Grammar
|
|
1840
|
+
* @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
|
|
1841
|
+
* @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
|
|
1842
|
+
* @global
|
|
1843
|
+
* @public
|
|
1844
|
+
*/
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* A function which will invoked after an element was successfully highlighted.
|
|
1848
|
+
*
|
|
1849
|
+
* @callback HighlightCallback
|
|
1850
|
+
* @param {Element} element The element successfully highlighted.
|
|
1851
|
+
* @returns {void}
|
|
1852
|
+
* @global
|
|
1853
|
+
* @public
|
|
1854
|
+
*/
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* @callback HookCallback
|
|
1858
|
+
* @param {Object<string, any>} env The environment variables of the hook.
|
|
1859
|
+
* @returns {void}
|
|
1860
|
+
* @global
|
|
1861
|
+
* @public
|
|
1862
|
+
*/
|
|
1863
|
+
|
|
1864
|
+
|
|
1865
|
+
/* **********************************************
|
|
1866
|
+
Begin prism-markup.js
|
|
1867
|
+
********************************************** */
|
|
1868
|
+
|
|
1869
|
+
Prism.languages.markup = {
|
|
1870
|
+
'comment': {
|
|
1871
|
+
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
1872
|
+
greedy: true
|
|
1873
|
+
},
|
|
1874
|
+
'prolog': {
|
|
1875
|
+
pattern: /<\?[\s\S]+?\?>/,
|
|
1876
|
+
greedy: true
|
|
1877
|
+
},
|
|
1878
|
+
'doctype': {
|
|
1879
|
+
// https://www.w3.org/TR/xml/#NT-doctypedecl
|
|
1880
|
+
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
|
1881
|
+
greedy: true,
|
|
1882
|
+
inside: {
|
|
1883
|
+
'internal-subset': {
|
|
1884
|
+
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
1885
|
+
lookbehind: true,
|
|
1886
|
+
greedy: true,
|
|
1887
|
+
inside: null // see below
|
|
1888
|
+
},
|
|
1889
|
+
'string': {
|
|
1890
|
+
pattern: /"[^"]*"|'[^']*'/,
|
|
1891
|
+
greedy: true
|
|
1892
|
+
},
|
|
1893
|
+
'punctuation': /^<!|>$|[[\]]/,
|
|
1894
|
+
'doctype-tag': /^DOCTYPE/i,
|
|
1895
|
+
'name': /[^\s<>'"]+/
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1898
|
+
'cdata': {
|
|
1899
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1900
|
+
greedy: true
|
|
1901
|
+
},
|
|
1902
|
+
'tag': {
|
|
1903
|
+
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
|
1904
|
+
greedy: true,
|
|
1905
|
+
inside: {
|
|
1906
|
+
'tag': {
|
|
1907
|
+
pattern: /^<\/?[^\s>\/]+/,
|
|
1908
|
+
inside: {
|
|
1909
|
+
'punctuation': /^<\/?/,
|
|
1910
|
+
'namespace': /^[^\s>\/:]+:/
|
|
1911
|
+
}
|
|
1912
|
+
},
|
|
1913
|
+
'special-attr': [],
|
|
1914
|
+
'attr-value': {
|
|
1915
|
+
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
1916
|
+
inside: {
|
|
1917
|
+
'punctuation': [
|
|
1918
|
+
{
|
|
1919
|
+
pattern: /^=/,
|
|
1920
|
+
alias: 'attr-equals'
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
pattern: /^(\s*)["']|["']$/,
|
|
1924
|
+
lookbehind: true
|
|
1925
|
+
}
|
|
1926
|
+
]
|
|
1927
|
+
}
|
|
1928
|
+
},
|
|
1929
|
+
'punctuation': /\/?>/,
|
|
1930
|
+
'attr-name': {
|
|
1931
|
+
pattern: /[^\s>\/]+/,
|
|
1932
|
+
inside: {
|
|
1933
|
+
'namespace': /^[^\s>\/:]+:/
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
}
|
|
1938
|
+
},
|
|
1939
|
+
'entity': [
|
|
1940
|
+
{
|
|
1941
|
+
pattern: /&[\da-z]{1,8};/i,
|
|
1942
|
+
alias: 'named-entity'
|
|
1943
|
+
},
|
|
1944
|
+
/&#x?[\da-f]{1,8};/i
|
|
1945
|
+
]
|
|
1946
|
+
};
|
|
1947
|
+
|
|
1948
|
+
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
|
|
1949
|
+
Prism.languages.markup['entity'];
|
|
1950
|
+
Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
|
|
1951
|
+
|
|
1952
|
+
// Plugin to make entity title show the real entity, idea by Roman Komarov
|
|
1953
|
+
Prism.hooks.add('wrap', function (env) {
|
|
1954
|
+
|
|
1955
|
+
if (env.type === 'entity') {
|
|
1956
|
+
env.attributes['title'] = env.content.replace(/&/, '&');
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
|
|
1960
|
+
Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
|
|
1961
|
+
/**
|
|
1962
|
+
* Adds an inlined language to markup.
|
|
1963
|
+
*
|
|
1964
|
+
* An example of an inlined language is CSS with `<style>` tags.
|
|
1965
|
+
*
|
|
1966
|
+
* @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
|
|
1967
|
+
* case insensitive.
|
|
1968
|
+
* @param {string} lang The language key.
|
|
1969
|
+
* @example
|
|
1970
|
+
* addInlined('style', 'css');
|
|
1971
|
+
*/
|
|
1972
|
+
value: function addInlined(tagName, lang) {
|
|
1973
|
+
var includedCdataInside = {};
|
|
1974
|
+
includedCdataInside['language-' + lang] = {
|
|
1975
|
+
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1976
|
+
lookbehind: true,
|
|
1977
|
+
inside: Prism.languages[lang]
|
|
1978
|
+
};
|
|
1979
|
+
includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
|
|
1980
|
+
|
|
1981
|
+
var inside = {
|
|
1982
|
+
'included-cdata': {
|
|
1983
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1984
|
+
inside: includedCdataInside
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
inside['language-' + lang] = {
|
|
1988
|
+
pattern: /[\s\S]+/,
|
|
1989
|
+
inside: Prism.languages[lang]
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
var def = {};
|
|
1993
|
+
def[tagName] = {
|
|
1994
|
+
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
|
|
1995
|
+
lookbehind: true,
|
|
1996
|
+
greedy: true,
|
|
1997
|
+
inside: inside
|
|
1998
|
+
};
|
|
1999
|
+
|
|
2000
|
+
Prism.languages.insertBefore('markup', 'cdata', def);
|
|
2001
|
+
}
|
|
2002
|
+
});
|
|
2003
|
+
Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
|
|
2004
|
+
/**
|
|
2005
|
+
* Adds an pattern to highlight languages embedded in HTML attributes.
|
|
2006
|
+
*
|
|
2007
|
+
* An example of an inlined language is CSS with `style` attributes.
|
|
2008
|
+
*
|
|
2009
|
+
* @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
|
|
2010
|
+
* case insensitive.
|
|
2011
|
+
* @param {string} lang The language key.
|
|
2012
|
+
* @example
|
|
2013
|
+
* addAttribute('style', 'css');
|
|
2014
|
+
*/
|
|
2015
|
+
value: function (attrName, lang) {
|
|
2016
|
+
Prism.languages.markup.tag.inside['special-attr'].push({
|
|
2017
|
+
pattern: RegExp(
|
|
2018
|
+
/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
2019
|
+
'i'
|
|
2020
|
+
),
|
|
2021
|
+
lookbehind: true,
|
|
2022
|
+
inside: {
|
|
2023
|
+
'attr-name': /^[^\s=]+/,
|
|
2024
|
+
'attr-value': {
|
|
2025
|
+
pattern: /=[\s\S]+/,
|
|
2026
|
+
inside: {
|
|
2027
|
+
'value': {
|
|
2028
|
+
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
2029
|
+
lookbehind: true,
|
|
2030
|
+
alias: [lang, 'language-' + lang],
|
|
2031
|
+
inside: Prism.languages[lang]
|
|
2032
|
+
},
|
|
2033
|
+
'punctuation': [
|
|
2034
|
+
{
|
|
2035
|
+
pattern: /^=/,
|
|
2036
|
+
alias: 'attr-equals'
|
|
2037
|
+
},
|
|
2038
|
+
/"|'/
|
|
2039
|
+
]
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
|
|
2047
|
+
Prism.languages.html = Prism.languages.markup;
|
|
2048
|
+
Prism.languages.mathml = Prism.languages.markup;
|
|
2049
|
+
Prism.languages.svg = Prism.languages.markup;
|
|
2050
|
+
|
|
2051
|
+
Prism.languages.xml = Prism.languages.extend('markup', {});
|
|
2052
|
+
Prism.languages.ssml = Prism.languages.xml;
|
|
2053
|
+
Prism.languages.atom = Prism.languages.xml;
|
|
2054
|
+
Prism.languages.rss = Prism.languages.xml;
|
|
2055
|
+
|
|
2056
|
+
|
|
2057
|
+
/* **********************************************
|
|
2058
|
+
Begin prism-css.js
|
|
2059
|
+
********************************************** */
|
|
2060
|
+
|
|
2061
|
+
(function (Prism) {
|
|
2062
|
+
|
|
2063
|
+
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
2064
|
+
|
|
2065
|
+
Prism.languages.css = {
|
|
2066
|
+
'comment': /\/\*[\s\S]*?\*\//,
|
|
2067
|
+
'atrule': {
|
|
2068
|
+
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
2069
|
+
inside: {
|
|
2070
|
+
'rule': /^@[\w-]+/,
|
|
2071
|
+
'selector-function-argument': {
|
|
2072
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
2073
|
+
lookbehind: true,
|
|
2074
|
+
alias: 'selector'
|
|
2075
|
+
},
|
|
2076
|
+
'keyword': {
|
|
2077
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
2078
|
+
lookbehind: true
|
|
2079
|
+
}
|
|
2080
|
+
// See rest below
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
'url': {
|
|
2084
|
+
// https://drafts.csswg.org/css-values-3/#urls
|
|
2085
|
+
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
2086
|
+
greedy: true,
|
|
2087
|
+
inside: {
|
|
2088
|
+
'function': /^url/i,
|
|
2089
|
+
'punctuation': /^\(|\)$/,
|
|
2090
|
+
'string': {
|
|
2091
|
+
pattern: RegExp('^' + string.source + '$'),
|
|
2092
|
+
alias: 'url'
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
},
|
|
2096
|
+
'selector': {
|
|
2097
|
+
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
2098
|
+
lookbehind: true
|
|
2099
|
+
},
|
|
2100
|
+
'string': {
|
|
2101
|
+
pattern: string,
|
|
2102
|
+
greedy: true
|
|
2103
|
+
},
|
|
2104
|
+
'property': {
|
|
2105
|
+
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
2106
|
+
lookbehind: true
|
|
2107
|
+
},
|
|
2108
|
+
'important': /!important\b/i,
|
|
2109
|
+
'function': {
|
|
2110
|
+
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
2111
|
+
lookbehind: true
|
|
2112
|
+
},
|
|
2113
|
+
'punctuation': /[(){};:,]/
|
|
2114
|
+
};
|
|
2115
|
+
|
|
2116
|
+
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
2117
|
+
|
|
2118
|
+
var markup = Prism.languages.markup;
|
|
2119
|
+
if (markup) {
|
|
2120
|
+
markup.tag.addInlined('style', 'css');
|
|
2121
|
+
markup.tag.addAttribute('style', 'css');
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
}(Prism));
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
/* **********************************************
|
|
2128
|
+
Begin prism-clike.js
|
|
2129
|
+
********************************************** */
|
|
2130
|
+
|
|
2131
|
+
Prism.languages.clike = {
|
|
2132
|
+
'comment': [
|
|
2133
|
+
{
|
|
2134
|
+
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
2135
|
+
lookbehind: true,
|
|
2136
|
+
greedy: true
|
|
2137
|
+
},
|
|
2138
|
+
{
|
|
2139
|
+
pattern: /(^|[^\\:])\/\/.*/,
|
|
2140
|
+
lookbehind: true,
|
|
2141
|
+
greedy: true
|
|
2142
|
+
}
|
|
2143
|
+
],
|
|
2144
|
+
'string': {
|
|
2145
|
+
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
2146
|
+
greedy: true
|
|
2147
|
+
},
|
|
2148
|
+
'class-name': {
|
|
2149
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
2150
|
+
lookbehind: true,
|
|
2151
|
+
inside: {
|
|
2152
|
+
'punctuation': /[.\\]/
|
|
2153
|
+
}
|
|
2154
|
+
},
|
|
2155
|
+
'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
2156
|
+
'boolean': /\b(?:false|true)\b/,
|
|
2157
|
+
'function': /\b\w+(?=\()/,
|
|
2158
|
+
'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
2159
|
+
'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
2160
|
+
'punctuation': /[{}[\];(),.:]/
|
|
2161
|
+
};
|
|
2162
|
+
|
|
2163
|
+
|
|
2164
|
+
/* **********************************************
|
|
2165
|
+
Begin prism-javascript.js
|
|
2166
|
+
********************************************** */
|
|
2167
|
+
|
|
2168
|
+
Prism.languages.javascript = Prism.languages.extend('clike', {
|
|
2169
|
+
'class-name': [
|
|
2170
|
+
Prism.languages.clike['class-name'],
|
|
2171
|
+
{
|
|
2172
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
2173
|
+
lookbehind: true
|
|
2174
|
+
}
|
|
2175
|
+
],
|
|
2176
|
+
'keyword': [
|
|
2177
|
+
{
|
|
2178
|
+
pattern: /((?:^|\})\s*)catch\b/,
|
|
2179
|
+
lookbehind: true
|
|
2180
|
+
},
|
|
2181
|
+
{
|
|
2182
|
+
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
2183
|
+
lookbehind: true
|
|
2184
|
+
},
|
|
2185
|
+
],
|
|
2186
|
+
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
2187
|
+
'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
2188
|
+
'number': {
|
|
2189
|
+
pattern: RegExp(
|
|
2190
|
+
/(^|[^\w$])/.source +
|
|
2191
|
+
'(?:' +
|
|
2192
|
+
(
|
|
2193
|
+
// constant
|
|
2194
|
+
/NaN|Infinity/.source +
|
|
2195
|
+
'|' +
|
|
2196
|
+
// binary integer
|
|
2197
|
+
/0[bB][01]+(?:_[01]+)*n?/.source +
|
|
2198
|
+
'|' +
|
|
2199
|
+
// octal integer
|
|
2200
|
+
/0[oO][0-7]+(?:_[0-7]+)*n?/.source +
|
|
2201
|
+
'|' +
|
|
2202
|
+
// hexadecimal integer
|
|
2203
|
+
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
|
|
2204
|
+
'|' +
|
|
2205
|
+
// decimal bigint
|
|
2206
|
+
/\d+(?:_\d+)*n/.source +
|
|
2207
|
+
'|' +
|
|
2208
|
+
// decimal number (integer or float) but no bigint
|
|
2209
|
+
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
|
|
2210
|
+
) +
|
|
2211
|
+
')' +
|
|
2212
|
+
/(?![\w$])/.source
|
|
2213
|
+
),
|
|
2214
|
+
lookbehind: true
|
|
2215
|
+
},
|
|
2216
|
+
'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
2217
|
+
});
|
|
2218
|
+
|
|
2219
|
+
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
|
2220
|
+
|
|
2221
|
+
Prism.languages.insertBefore('javascript', 'keyword', {
|
|
2222
|
+
'regex': {
|
|
2223
|
+
pattern: RegExp(
|
|
2224
|
+
// lookbehind
|
|
2225
|
+
// eslint-disable-next-line regexp/no-dupe-characters-character-class
|
|
2226
|
+
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
|
|
2227
|
+
// Regex pattern:
|
|
2228
|
+
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
|
2229
|
+
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
|
2230
|
+
// with the only syntax, so we have to define 2 different regex patterns.
|
|
2231
|
+
/\//.source +
|
|
2232
|
+
'(?:' +
|
|
2233
|
+
/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
|
|
2234
|
+
'|' +
|
|
2235
|
+
// `v` flag syntax. This supports 3 levels of nested character classes.
|
|
2236
|
+
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
|
|
2237
|
+
')' +
|
|
2238
|
+
// lookahead
|
|
2239
|
+
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
|
|
2240
|
+
),
|
|
2241
|
+
lookbehind: true,
|
|
2242
|
+
greedy: true,
|
|
2243
|
+
inside: {
|
|
2244
|
+
'regex-source': {
|
|
2245
|
+
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
2246
|
+
lookbehind: true,
|
|
2247
|
+
alias: 'language-regex',
|
|
2248
|
+
inside: Prism.languages.regex
|
|
2249
|
+
},
|
|
2250
|
+
'regex-delimiter': /^\/|\/$/,
|
|
2251
|
+
'regex-flags': /^[a-z]+$/,
|
|
2252
|
+
}
|
|
2253
|
+
},
|
|
2254
|
+
// This must be declared before keyword because we use "function" inside the look-forward
|
|
2255
|
+
'function-variable': {
|
|
2256
|
+
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
|
2257
|
+
alias: 'function'
|
|
2258
|
+
},
|
|
2259
|
+
'parameter': [
|
|
2260
|
+
{
|
|
2261
|
+
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
2262
|
+
lookbehind: true,
|
|
2263
|
+
inside: Prism.languages.javascript
|
|
2264
|
+
},
|
|
2265
|
+
{
|
|
2266
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
2267
|
+
lookbehind: true,
|
|
2268
|
+
inside: Prism.languages.javascript
|
|
2269
|
+
},
|
|
2270
|
+
{
|
|
2271
|
+
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
2272
|
+
lookbehind: true,
|
|
2273
|
+
inside: Prism.languages.javascript
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
2277
|
+
lookbehind: true,
|
|
2278
|
+
inside: Prism.languages.javascript
|
|
2279
|
+
}
|
|
2280
|
+
],
|
|
2281
|
+
'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
2282
|
+
});
|
|
2283
|
+
|
|
2284
|
+
Prism.languages.insertBefore('javascript', 'string', {
|
|
2285
|
+
'hashbang': {
|
|
2286
|
+
pattern: /^#!.*/,
|
|
2287
|
+
greedy: true,
|
|
2288
|
+
alias: 'comment'
|
|
2289
|
+
},
|
|
2290
|
+
'template-string': {
|
|
2291
|
+
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
|
2292
|
+
greedy: true,
|
|
2293
|
+
inside: {
|
|
2294
|
+
'template-punctuation': {
|
|
2295
|
+
pattern: /^`|`$/,
|
|
2296
|
+
alias: 'string'
|
|
2297
|
+
},
|
|
2298
|
+
'interpolation': {
|
|
2299
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
2300
|
+
lookbehind: true,
|
|
2301
|
+
inside: {
|
|
2302
|
+
'interpolation-punctuation': {
|
|
2303
|
+
pattern: /^\$\{|\}$/,
|
|
2304
|
+
alias: 'punctuation'
|
|
2305
|
+
},
|
|
2306
|
+
rest: Prism.languages.javascript
|
|
2307
|
+
}
|
|
2308
|
+
},
|
|
2309
|
+
'string': /[\s\S]+/
|
|
2310
|
+
}
|
|
2311
|
+
},
|
|
2312
|
+
'string-property': {
|
|
2313
|
+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
2314
|
+
lookbehind: true,
|
|
2315
|
+
greedy: true,
|
|
2316
|
+
alias: 'property'
|
|
2317
|
+
}
|
|
2318
|
+
});
|
|
2319
|
+
|
|
2320
|
+
Prism.languages.insertBefore('javascript', 'operator', {
|
|
2321
|
+
'literal-property': {
|
|
2322
|
+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
2323
|
+
lookbehind: true,
|
|
2324
|
+
alias: 'property'
|
|
2325
|
+
},
|
|
2326
|
+
});
|
|
2327
|
+
|
|
2328
|
+
if (Prism.languages.markup) {
|
|
2329
|
+
Prism.languages.markup.tag.addInlined('script', 'javascript');
|
|
2330
|
+
|
|
2331
|
+
// add attribute support for all DOM events.
|
|
2332
|
+
// https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
|
|
2333
|
+
Prism.languages.markup.tag.addAttribute(
|
|
2334
|
+
/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
|
|
2335
|
+
'javascript'
|
|
2336
|
+
);
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
Prism.languages.js = Prism.languages.javascript;
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
/* **********************************************
|
|
2343
|
+
Begin prism-file-highlight.js
|
|
2344
|
+
********************************************** */
|
|
2345
|
+
|
|
2346
|
+
(function () {
|
|
2347
|
+
|
|
2348
|
+
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
|
2349
|
+
return;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
|
|
2353
|
+
if (!Element.prototype.matches) {
|
|
2354
|
+
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
var LOADING_MESSAGE = 'Loading…';
|
|
2358
|
+
var FAILURE_MESSAGE = function (status, message) {
|
|
2359
|
+
return '✖ Error ' + status + ' while fetching file: ' + message;
|
|
2360
|
+
};
|
|
2361
|
+
var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
|
|
2362
|
+
|
|
2363
|
+
var EXTENSIONS = {
|
|
2364
|
+
'js': 'javascript',
|
|
2365
|
+
'py': 'python',
|
|
2366
|
+
'rb': 'ruby',
|
|
2367
|
+
'ps1': 'powershell',
|
|
2368
|
+
'psm1': 'powershell',
|
|
2369
|
+
'sh': 'bash',
|
|
2370
|
+
'bat': 'batch',
|
|
2371
|
+
'h': 'c',
|
|
2372
|
+
'tex': 'latex'
|
|
2373
|
+
};
|
|
2374
|
+
|
|
2375
|
+
var STATUS_ATTR = 'data-src-status';
|
|
2376
|
+
var STATUS_LOADING = 'loading';
|
|
2377
|
+
var STATUS_LOADED = 'loaded';
|
|
2378
|
+
var STATUS_FAILED = 'failed';
|
|
2379
|
+
|
|
2380
|
+
var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
|
|
2381
|
+
+ ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* Loads the given file.
|
|
2385
|
+
*
|
|
2386
|
+
* @param {string} src The URL or path of the source file to load.
|
|
2387
|
+
* @param {(result: string) => void} success
|
|
2388
|
+
* @param {(reason: string) => void} error
|
|
2389
|
+
*/
|
|
2390
|
+
function loadFile(src, success, error) {
|
|
2391
|
+
var xhr = new XMLHttpRequest();
|
|
2392
|
+
xhr.open('GET', src, true);
|
|
2393
|
+
xhr.onreadystatechange = function () {
|
|
2394
|
+
if (xhr.readyState == 4) {
|
|
2395
|
+
if (xhr.status < 400 && xhr.responseText) {
|
|
2396
|
+
success(xhr.responseText);
|
|
2397
|
+
} else {
|
|
2398
|
+
if (xhr.status >= 400) {
|
|
2399
|
+
error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
|
|
2400
|
+
} else {
|
|
2401
|
+
error(FAILURE_EMPTY_MESSAGE);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
};
|
|
2406
|
+
xhr.send(null);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
/**
|
|
2410
|
+
* Parses the given range.
|
|
2411
|
+
*
|
|
2412
|
+
* This returns a range with inclusive ends.
|
|
2413
|
+
*
|
|
2414
|
+
* @param {string | null | undefined} range
|
|
2415
|
+
* @returns {[number, number | undefined] | undefined}
|
|
2416
|
+
*/
|
|
2417
|
+
function parseRange(range) {
|
|
2418
|
+
var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
|
|
2419
|
+
if (m) {
|
|
2420
|
+
var start = Number(m[1]);
|
|
2421
|
+
var comma = m[2];
|
|
2422
|
+
var end = m[3];
|
|
2423
|
+
|
|
2424
|
+
if (!comma) {
|
|
2425
|
+
return [start, start];
|
|
2426
|
+
}
|
|
2427
|
+
if (!end) {
|
|
2428
|
+
return [start, undefined];
|
|
2429
|
+
}
|
|
2430
|
+
return [start, Number(end)];
|
|
2431
|
+
}
|
|
2432
|
+
return undefined;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
Prism.hooks.add('before-highlightall', function (env) {
|
|
2436
|
+
env.selector += ', ' + SELECTOR;
|
|
2437
|
+
});
|
|
2438
|
+
|
|
2439
|
+
Prism.hooks.add('before-sanity-check', function (env) {
|
|
2440
|
+
var pre = /** @type {HTMLPreElement} */ (env.element);
|
|
2441
|
+
if (pre.matches(SELECTOR)) {
|
|
2442
|
+
env.code = ''; // fast-path the whole thing and go to complete
|
|
2443
|
+
|
|
2444
|
+
pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
|
|
2445
|
+
|
|
2446
|
+
// add code element with loading message
|
|
2447
|
+
var code = pre.appendChild(document.createElement('CODE'));
|
|
2448
|
+
code.textContent = LOADING_MESSAGE;
|
|
2449
|
+
|
|
2450
|
+
var src = pre.getAttribute('data-src');
|
|
2451
|
+
|
|
2452
|
+
var language = env.language;
|
|
2453
|
+
if (language === 'none') {
|
|
2454
|
+
// the language might be 'none' because there is no language set;
|
|
2455
|
+
// in this case, we want to use the extension as the language
|
|
2456
|
+
var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
|
|
2457
|
+
language = EXTENSIONS[extension] || extension;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
// set language classes
|
|
2461
|
+
Prism.util.setLanguage(code, language);
|
|
2462
|
+
Prism.util.setLanguage(pre, language);
|
|
2463
|
+
|
|
2464
|
+
// preload the language
|
|
2465
|
+
var autoloader = Prism.plugins.autoloader;
|
|
2466
|
+
if (autoloader) {
|
|
2467
|
+
autoloader.loadLanguages(language);
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
// load file
|
|
2471
|
+
loadFile(
|
|
2472
|
+
src,
|
|
2473
|
+
function (text) {
|
|
2474
|
+
// mark as loaded
|
|
2475
|
+
pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
|
|
2476
|
+
|
|
2477
|
+
// handle data-range
|
|
2478
|
+
var range = parseRange(pre.getAttribute('data-range'));
|
|
2479
|
+
if (range) {
|
|
2480
|
+
var lines = text.split(/\r\n?|\n/g);
|
|
2481
|
+
|
|
2482
|
+
// the range is one-based and inclusive on both ends
|
|
2483
|
+
var start = range[0];
|
|
2484
|
+
var end = range[1] == null ? lines.length : range[1];
|
|
2485
|
+
|
|
2486
|
+
if (start < 0) { start += lines.length; }
|
|
2487
|
+
start = Math.max(0, Math.min(start - 1, lines.length));
|
|
2488
|
+
if (end < 0) { end += lines.length; }
|
|
2489
|
+
end = Math.max(0, Math.min(end, lines.length));
|
|
2490
|
+
|
|
2491
|
+
text = lines.slice(start, end).join('\n');
|
|
2492
|
+
|
|
2493
|
+
// add data-start for line numbers
|
|
2494
|
+
if (!pre.hasAttribute('data-start')) {
|
|
2495
|
+
pre.setAttribute('data-start', String(start + 1));
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
// highlight code
|
|
2500
|
+
code.textContent = text;
|
|
2501
|
+
Prism.highlightElement(code);
|
|
2502
|
+
},
|
|
2503
|
+
function (error) {
|
|
2504
|
+
// mark as failed
|
|
2505
|
+
pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
|
|
2506
|
+
|
|
2507
|
+
code.textContent = error;
|
|
2508
|
+
}
|
|
2509
|
+
);
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2512
|
+
|
|
2513
|
+
Prism.plugins.fileHighlight = {
|
|
2514
|
+
/**
|
|
2515
|
+
* Executes the File Highlight plugin for all matching `pre` elements under the given container.
|
|
2516
|
+
*
|
|
2517
|
+
* Note: Elements which are already loaded or currently loading will not be touched by this method.
|
|
2518
|
+
*
|
|
2519
|
+
* @param {ParentNode} [container=document]
|
|
2520
|
+
*/
|
|
2521
|
+
highlight: function highlight(container) {
|
|
2522
|
+
var elements = (container || document).querySelectorAll(SELECTOR);
|
|
2523
|
+
|
|
2524
|
+
for (var i = 0, element; (element = elements[i++]);) {
|
|
2525
|
+
Prism.highlightElement(element);
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2530
|
+
var logged = false;
|
|
2531
|
+
/** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
|
|
2532
|
+
Prism.fileHighlight = function () {
|
|
2533
|
+
if (!logged) {
|
|
2534
|
+
console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
|
|
2535
|
+
logged = true;
|
|
2536
|
+
}
|
|
2537
|
+
Prism.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
2538
|
+
};
|
|
2539
|
+
|
|
2540
|
+
}());
|
|
2541
|
+
}(prism));
|
|
2542
|
+
|
|
2543
|
+
const Prism$1 = prism.exports;
|
|
2544
|
+
|
|
2545
|
+
Prism.languages.python = {
|
|
2546
|
+
'comment': {
|
|
2547
|
+
pattern: /(^|[^\\])#.*/,
|
|
2548
|
+
lookbehind: true,
|
|
2549
|
+
greedy: true
|
|
2550
|
+
},
|
|
2551
|
+
'string-interpolation': {
|
|
2552
|
+
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
|
2553
|
+
greedy: true,
|
|
2554
|
+
inside: {
|
|
2555
|
+
'interpolation': {
|
|
2556
|
+
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
|
2557
|
+
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
|
2558
|
+
lookbehind: true,
|
|
2559
|
+
inside: {
|
|
2560
|
+
'format-spec': {
|
|
2561
|
+
pattern: /(:)[^:(){}]+(?=\}$)/,
|
|
2562
|
+
lookbehind: true
|
|
2563
|
+
},
|
|
2564
|
+
'conversion-option': {
|
|
2565
|
+
pattern: //,
|
|
2566
|
+
alias: 'punctuation'
|
|
2567
|
+
},
|
|
2568
|
+
rest: null
|
|
2569
|
+
}
|
|
2570
|
+
},
|
|
2571
|
+
'string': /[\s\S]+/
|
|
2572
|
+
}
|
|
2573
|
+
},
|
|
2574
|
+
'triple-quoted-string': {
|
|
2575
|
+
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
|
2576
|
+
greedy: true,
|
|
2577
|
+
alias: 'string'
|
|
2578
|
+
},
|
|
2579
|
+
'string': {
|
|
2580
|
+
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
|
2581
|
+
greedy: true
|
|
2582
|
+
},
|
|
2583
|
+
'function': {
|
|
2584
|
+
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
|
2585
|
+
lookbehind: true
|
|
2586
|
+
},
|
|
2587
|
+
'class-name': {
|
|
2588
|
+
pattern: /(\bclass\s+)\w+/i,
|
|
2589
|
+
lookbehind: true
|
|
2590
|
+
},
|
|
2591
|
+
'decorator': {
|
|
2592
|
+
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
|
2593
|
+
lookbehind: true,
|
|
2594
|
+
alias: ['annotation', 'punctuation'],
|
|
2595
|
+
inside: {
|
|
2596
|
+
'punctuation': /\./
|
|
2597
|
+
}
|
|
2598
|
+
},
|
|
2599
|
+
'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
|
2600
|
+
'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
|
2601
|
+
'boolean': /\b(?:False|None|True)\b/,
|
|
2602
|
+
'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
2603
|
+
'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
2604
|
+
'punctuation': /[{}[\];(),.:]/
|
|
2605
|
+
};
|
|
2606
|
+
|
|
2607
|
+
Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
|
|
2608
|
+
|
|
2609
|
+
Prism.languages.py = Prism.languages.python;
|
|
2610
|
+
|
|
2611
|
+
(function (Prism) {
|
|
2612
|
+
// $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
|
|
2613
|
+
// + LC_ALL, RANDOM, REPLY, SECONDS.
|
|
2614
|
+
// + make sure PS1..4 are here as they are not always set,
|
|
2615
|
+
// - some useless things.
|
|
2616
|
+
var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
|
|
2617
|
+
|
|
2618
|
+
var commandAfterHeredoc = {
|
|
2619
|
+
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
2620
|
+
lookbehind: true,
|
|
2621
|
+
alias: 'punctuation', // this looks reasonably well in all themes
|
|
2622
|
+
inside: null // see below
|
|
2623
|
+
};
|
|
2624
|
+
|
|
2625
|
+
var insideString = {
|
|
2626
|
+
'bash': commandAfterHeredoc,
|
|
2627
|
+
'environment': {
|
|
2628
|
+
pattern: RegExp('\\$' + envVars),
|
|
2629
|
+
alias: 'constant'
|
|
2630
|
+
},
|
|
2631
|
+
'variable': [
|
|
2632
|
+
// [0]: Arithmetic Environment
|
|
2633
|
+
{
|
|
2634
|
+
pattern: /\$?\(\([\s\S]+?\)\)/,
|
|
2635
|
+
greedy: true,
|
|
2636
|
+
inside: {
|
|
2637
|
+
// If there is a $ sign at the beginning highlight $(( and )) as variable
|
|
2638
|
+
'variable': [
|
|
2639
|
+
{
|
|
2640
|
+
pattern: /(^\$\(\([\s\S]+)\)\)/,
|
|
2641
|
+
lookbehind: true
|
|
2642
|
+
},
|
|
2643
|
+
/^\$\(\(/
|
|
2644
|
+
],
|
|
2645
|
+
'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
2646
|
+
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
|
|
2647
|
+
'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
|
2648
|
+
// If there is no $ sign at the beginning highlight (( and )) as punctuation
|
|
2649
|
+
'punctuation': /\(\(?|\)\)?|,|;/
|
|
2650
|
+
}
|
|
2651
|
+
},
|
|
2652
|
+
// [1]: Command Substitution
|
|
2653
|
+
{
|
|
2654
|
+
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
|
2655
|
+
greedy: true,
|
|
2656
|
+
inside: {
|
|
2657
|
+
'variable': /^\$\(|^`|\)$|`$/
|
|
2658
|
+
}
|
|
2659
|
+
},
|
|
2660
|
+
// [2]: Brace expansion
|
|
2661
|
+
{
|
|
2662
|
+
pattern: /\$\{[^}]+\}/,
|
|
2663
|
+
greedy: true,
|
|
2664
|
+
inside: {
|
|
2665
|
+
'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
2666
|
+
'punctuation': /[\[\]]/,
|
|
2667
|
+
'environment': {
|
|
2668
|
+
pattern: RegExp('(\\{)' + envVars),
|
|
2669
|
+
lookbehind: true,
|
|
2670
|
+
alias: 'constant'
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
},
|
|
2674
|
+
/\$(?:\w+|[#?*!@$])/
|
|
2675
|
+
],
|
|
2676
|
+
// Escape sequences from echo and printf's manuals, and escaped quotes.
|
|
2677
|
+
'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
|
2678
|
+
};
|
|
2679
|
+
|
|
2680
|
+
Prism.languages.bash = {
|
|
2681
|
+
'shebang': {
|
|
2682
|
+
pattern: /^#!\s*\/.*/,
|
|
2683
|
+
alias: 'important'
|
|
2684
|
+
},
|
|
2685
|
+
'comment': {
|
|
2686
|
+
pattern: /(^|[^"{\\$])#.*/,
|
|
2687
|
+
lookbehind: true
|
|
2688
|
+
},
|
|
2689
|
+
'function-name': [
|
|
2690
|
+
// a) function foo {
|
|
2691
|
+
// b) foo() {
|
|
2692
|
+
// c) function foo() {
|
|
2693
|
+
// but not “foo {”
|
|
2694
|
+
{
|
|
2695
|
+
// a) and c)
|
|
2696
|
+
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
|
2697
|
+
lookbehind: true,
|
|
2698
|
+
alias: 'function'
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
// b)
|
|
2702
|
+
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
2703
|
+
alias: 'function'
|
|
2704
|
+
}
|
|
2705
|
+
],
|
|
2706
|
+
// Highlight variable names as variables in for and select beginnings.
|
|
2707
|
+
'for-or-select': {
|
|
2708
|
+
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
2709
|
+
alias: 'variable',
|
|
2710
|
+
lookbehind: true
|
|
2711
|
+
},
|
|
2712
|
+
// Highlight variable names as variables in the left-hand part
|
|
2713
|
+
// of assignments (“=” and “+=”).
|
|
2714
|
+
'assign-left': {
|
|
2715
|
+
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
2716
|
+
inside: {
|
|
2717
|
+
'environment': {
|
|
2718
|
+
pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
|
|
2719
|
+
lookbehind: true,
|
|
2720
|
+
alias: 'constant'
|
|
2721
|
+
}
|
|
2722
|
+
},
|
|
2723
|
+
alias: 'variable',
|
|
2724
|
+
lookbehind: true
|
|
2725
|
+
},
|
|
2726
|
+
// Highlight parameter names as variables
|
|
2727
|
+
'parameter': {
|
|
2728
|
+
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
|
|
2729
|
+
alias: 'variable',
|
|
2730
|
+
lookbehind: true
|
|
2731
|
+
},
|
|
2732
|
+
'string': [
|
|
2733
|
+
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
|
|
2734
|
+
{
|
|
2735
|
+
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
|
2736
|
+
lookbehind: true,
|
|
2737
|
+
greedy: true,
|
|
2738
|
+
inside: insideString
|
|
2739
|
+
},
|
|
2740
|
+
// Here-document with quotes around the tag
|
|
2741
|
+
// → No expansion (so no “inside”).
|
|
2742
|
+
{
|
|
2743
|
+
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
|
2744
|
+
lookbehind: true,
|
|
2745
|
+
greedy: true,
|
|
2746
|
+
inside: {
|
|
2747
|
+
'bash': commandAfterHeredoc
|
|
2748
|
+
}
|
|
2749
|
+
},
|
|
2750
|
+
// “Normal” string
|
|
2751
|
+
{
|
|
2752
|
+
// https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
|
|
2753
|
+
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
2754
|
+
lookbehind: true,
|
|
2755
|
+
greedy: true,
|
|
2756
|
+
inside: insideString
|
|
2757
|
+
},
|
|
2758
|
+
{
|
|
2759
|
+
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
|
|
2760
|
+
pattern: /(^|[^$\\])'[^']*'/,
|
|
2761
|
+
lookbehind: true,
|
|
2762
|
+
greedy: true
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
// https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
|
|
2766
|
+
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
2767
|
+
greedy: true,
|
|
2768
|
+
inside: {
|
|
2769
|
+
'entity': insideString.entity
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
],
|
|
2773
|
+
'environment': {
|
|
2774
|
+
pattern: RegExp('\\$?' + envVars),
|
|
2775
|
+
alias: 'constant'
|
|
2776
|
+
},
|
|
2777
|
+
'variable': insideString.variable,
|
|
2778
|
+
'function': {
|
|
2779
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
|
|
2780
|
+
lookbehind: true
|
|
2781
|
+
},
|
|
2782
|
+
'keyword': {
|
|
2783
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
|
2784
|
+
lookbehind: true
|
|
2785
|
+
},
|
|
2786
|
+
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
|
2787
|
+
'builtin': {
|
|
2788
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
|
|
2789
|
+
lookbehind: true,
|
|
2790
|
+
// Alias added to make those easier to distinguish from strings.
|
|
2791
|
+
alias: 'class-name'
|
|
2792
|
+
},
|
|
2793
|
+
'boolean': {
|
|
2794
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
|
2795
|
+
lookbehind: true
|
|
2796
|
+
},
|
|
2797
|
+
'file-descriptor': {
|
|
2798
|
+
pattern: /\B&\d\b/,
|
|
2799
|
+
alias: 'important'
|
|
2800
|
+
},
|
|
2801
|
+
'operator': {
|
|
2802
|
+
// Lots of redirections here, but not just that.
|
|
2803
|
+
pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
|
2804
|
+
inside: {
|
|
2805
|
+
'file-descriptor': {
|
|
2806
|
+
pattern: /^\d/,
|
|
2807
|
+
alias: 'important'
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
},
|
|
2811
|
+
'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
|
|
2812
|
+
'number': {
|
|
2813
|
+
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
|
2814
|
+
lookbehind: true
|
|
2815
|
+
}
|
|
2816
|
+
};
|
|
2817
|
+
|
|
2818
|
+
commandAfterHeredoc.inside = Prism.languages.bash;
|
|
2819
|
+
|
|
2820
|
+
/* Patterns in command substitution. */
|
|
2821
|
+
var toBeCopied = [
|
|
2822
|
+
'comment',
|
|
2823
|
+
'function-name',
|
|
2824
|
+
'for-or-select',
|
|
2825
|
+
'assign-left',
|
|
2826
|
+
'parameter',
|
|
2827
|
+
'string',
|
|
2828
|
+
'environment',
|
|
2829
|
+
'function',
|
|
2830
|
+
'keyword',
|
|
2831
|
+
'builtin',
|
|
2832
|
+
'boolean',
|
|
2833
|
+
'file-descriptor',
|
|
2834
|
+
'operator',
|
|
2835
|
+
'punctuation',
|
|
2836
|
+
'number'
|
|
2837
|
+
];
|
|
2838
|
+
var inside = insideString.variable[1].inside;
|
|
2839
|
+
for (var i = 0; i < toBeCopied.length; i++) {
|
|
2840
|
+
inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
Prism.languages.sh = Prism.languages.bash;
|
|
2844
|
+
Prism.languages.shell = Prism.languages.bash;
|
|
2845
|
+
}(Prism));
|
|
2846
|
+
|
|
2847
|
+
(function (Prism) {
|
|
2848
|
+
|
|
2849
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
|
|
2850
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
|
|
2851
|
+
var anchorOrAlias = /[*&][^\s[\]{},]+/;
|
|
2852
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
|
|
2853
|
+
var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
|
|
2854
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
|
|
2855
|
+
var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|'
|
|
2856
|
+
+ anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
|
|
2857
|
+
// https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
|
|
2858
|
+
// This is a simplified version that doesn't support "#" and multiline keys
|
|
2859
|
+
// All these long scarry character classes are simplified versions of YAML's characters
|
|
2860
|
+
var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source
|
|
2861
|
+
.replace(/<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source; });
|
|
2862
|
+
var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
|
|
2863
|
+
|
|
2864
|
+
/**
|
|
2865
|
+
*
|
|
2866
|
+
* @param {string} value
|
|
2867
|
+
* @param {string} [flags]
|
|
2868
|
+
* @returns {RegExp}
|
|
2869
|
+
*/
|
|
2870
|
+
function createValuePattern(value, flags) {
|
|
2871
|
+
flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
|
|
2872
|
+
var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source
|
|
2873
|
+
.replace(/<<prop>>/g, function () { return properties; }).replace(/<<value>>/g, function () { return value; });
|
|
2874
|
+
return RegExp(pattern, flags);
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
Prism.languages.yaml = {
|
|
2878
|
+
'scalar': {
|
|
2879
|
+
pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source
|
|
2880
|
+
.replace(/<<prop>>/g, function () { return properties; })),
|
|
2881
|
+
lookbehind: true,
|
|
2882
|
+
alias: 'string'
|
|
2883
|
+
},
|
|
2884
|
+
'comment': /#.*/,
|
|
2885
|
+
'key': {
|
|
2886
|
+
pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source
|
|
2887
|
+
.replace(/<<prop>>/g, function () { return properties; })
|
|
2888
|
+
.replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; })),
|
|
2889
|
+
lookbehind: true,
|
|
2890
|
+
greedy: true,
|
|
2891
|
+
alias: 'atrule'
|
|
2892
|
+
},
|
|
2893
|
+
'directive': {
|
|
2894
|
+
pattern: /(^[ \t]*)%.+/m,
|
|
2895
|
+
lookbehind: true,
|
|
2896
|
+
alias: 'important'
|
|
2897
|
+
},
|
|
2898
|
+
'datetime': {
|
|
2899
|
+
pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
|
|
2900
|
+
lookbehind: true,
|
|
2901
|
+
alias: 'number'
|
|
2902
|
+
},
|
|
2903
|
+
'boolean': {
|
|
2904
|
+
pattern: createValuePattern(/false|true/.source, 'i'),
|
|
2905
|
+
lookbehind: true,
|
|
2906
|
+
alias: 'important'
|
|
2907
|
+
},
|
|
2908
|
+
'null': {
|
|
2909
|
+
pattern: createValuePattern(/null|~/.source, 'i'),
|
|
2910
|
+
lookbehind: true,
|
|
2911
|
+
alias: 'important'
|
|
2912
|
+
},
|
|
2913
|
+
'string': {
|
|
2914
|
+
pattern: createValuePattern(string),
|
|
2915
|
+
lookbehind: true,
|
|
2916
|
+
greedy: true
|
|
2917
|
+
},
|
|
2918
|
+
'number': {
|
|
2919
|
+
pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
|
|
2920
|
+
lookbehind: true
|
|
2921
|
+
},
|
|
2922
|
+
'tag': tag,
|
|
2923
|
+
'important': anchorOrAlias,
|
|
2924
|
+
'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
|
|
2925
|
+
};
|
|
2926
|
+
|
|
2927
|
+
Prism.languages.yml = Prism.languages.yaml;
|
|
2928
|
+
|
|
2929
|
+
}(Prism));
|
|
2930
|
+
|
|
2931
|
+
(function (Prism) {
|
|
2932
|
+
|
|
2933
|
+
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
2934
|
+
|
|
2935
|
+
Prism.languages.css = {
|
|
2936
|
+
'comment': /\/\*[\s\S]*?\*\//,
|
|
2937
|
+
'atrule': {
|
|
2938
|
+
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
2939
|
+
inside: {
|
|
2940
|
+
'rule': /^@[\w-]+/,
|
|
2941
|
+
'selector-function-argument': {
|
|
2942
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
2943
|
+
lookbehind: true,
|
|
2944
|
+
alias: 'selector'
|
|
2945
|
+
},
|
|
2946
|
+
'keyword': {
|
|
2947
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
2948
|
+
lookbehind: true
|
|
2949
|
+
}
|
|
2950
|
+
// See rest below
|
|
2951
|
+
}
|
|
2952
|
+
},
|
|
2953
|
+
'url': {
|
|
2954
|
+
// https://drafts.csswg.org/css-values-3/#urls
|
|
2955
|
+
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
2956
|
+
greedy: true,
|
|
2957
|
+
inside: {
|
|
2958
|
+
'function': /^url/i,
|
|
2959
|
+
'punctuation': /^\(|\)$/,
|
|
2960
|
+
'string': {
|
|
2961
|
+
pattern: RegExp('^' + string.source + '$'),
|
|
2962
|
+
alias: 'url'
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
},
|
|
2966
|
+
'selector': {
|
|
2967
|
+
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
2968
|
+
lookbehind: true
|
|
2969
|
+
},
|
|
2970
|
+
'string': {
|
|
2971
|
+
pattern: string,
|
|
2972
|
+
greedy: true
|
|
2973
|
+
},
|
|
2974
|
+
'property': {
|
|
2975
|
+
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
2976
|
+
lookbehind: true
|
|
2977
|
+
},
|
|
2978
|
+
'important': /!important\b/i,
|
|
2979
|
+
'function': {
|
|
2980
|
+
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
2981
|
+
lookbehind: true
|
|
2982
|
+
},
|
|
2983
|
+
'punctuation': /[(){};:,]/
|
|
2984
|
+
};
|
|
2985
|
+
|
|
2986
|
+
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
2987
|
+
|
|
2988
|
+
var markup = Prism.languages.markup;
|
|
2989
|
+
if (markup) {
|
|
2990
|
+
markup.tag.addInlined('style', 'css');
|
|
2991
|
+
markup.tag.addAttribute('style', 'css');
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
}(Prism));
|
|
2995
|
+
|
|
2996
|
+
const edsCodeBlockCss = ":host{display:block;font-family:var(--font-family, 'Courier New', monospace)}pre[class*=\"language-\"]{white-space:pre-wrap;word-break:break-word;}.language{font-weight:bold;text-transform:uppercase}pre{margin:0;border-radius:8px;color:var(--purple-200);overflow:auto}code{font-family:'Courier New', monospace}.token.keyword{color:var(--purple-500)}.token.string{color:var(--green-500)}.token.function{color:var(--cyan-500)}.token.comment{color:var(--grey-700)}.relative{position:relative}.bg-stronger{background-color:var(--grey-900)}.rounded-sm{border-radius:8px}.rounded-xs{border-radius:4px}.text-inverse{color:var(--white)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.p-0{padding:0rem}.p-12{padding:0.75rem}.p-16{padding:1rem}.p-20{padding:1.25rem}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.pl-8{padding-left:0.5rem}.mb-10{margin-bottom:0.625rem}.mb-12{margin-bottom:0.75rem}.mb-28{margin-bottom:1.75rem}.pb-16{padding-bottom:1rem}.pb-20{padding-bottom:1.25rem}.pb-28{padding-bottom:1.75rem}.pb-60{padding-bottom:3.75rem}.pb-8{padding-bottom:0.5rem}.mt-16{margin-top:1rem}.mt-2{margin-top:0.125rem}.mt-20{margin-top:1.25rem}.mt-28{margin-top:1.75rem}.w-20{width:1.25rem}.h-20{height:1.25rem}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}";
|
|
2997
|
+
const EdsCodeBlockStyle0 = edsCodeBlockCss;
|
|
2998
|
+
|
|
2999
|
+
const EdsCodeBlock = class {
|
|
3000
|
+
constructor(hostRef) {
|
|
3001
|
+
index.registerInstance(this, hostRef);
|
|
3002
|
+
this.code = undefined;
|
|
3003
|
+
this.language = undefined;
|
|
3004
|
+
this.copied = false;
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* Copies the current code content to the clipboard and sets a temporary copied state.
|
|
3008
|
+
*
|
|
3009
|
+
* @private
|
|
3010
|
+
* @returns {void}
|
|
3011
|
+
*/
|
|
3012
|
+
copyToClipboard() {
|
|
3013
|
+
navigator.clipboard.writeText(this.code).then(() => {
|
|
3014
|
+
this.copied = true;
|
|
3015
|
+
/*const analyticsName = this.createHumanFriendlyAnalyticsName(this.code, this.language);
|
|
3016
|
+
sendAnalytics({
|
|
3017
|
+
category: 'ui-component',
|
|
3018
|
+
parentContext: null,
|
|
3019
|
+
tag: this.el.tagName.toLowerCase(),
|
|
3020
|
+
name: analyticsName || '',
|
|
3021
|
+
action: 'copy'
|
|
3022
|
+
});*/
|
|
3023
|
+
setTimeout(() => (this.copied = false), 2000);
|
|
3024
|
+
});
|
|
3025
|
+
}
|
|
3026
|
+
/**
|
|
3027
|
+
* Utility function that creates a human-friendly analytics name based on the code and language.
|
|
3028
|
+
* It uses:
|
|
3029
|
+
* - The language (in uppercase)
|
|
3030
|
+
* - The number of non-empty lines in the code
|
|
3031
|
+
* - The first non-empty line of code (truncated to 30 characters, if needed)
|
|
3032
|
+
*
|
|
3033
|
+
* returns A descriptive analytics name.
|
|
3034
|
+
*/
|
|
3035
|
+
/*private createHumanFriendlyAnalyticsName(code: string, language: string): string {
|
|
3036
|
+
// Count non-empty lines
|
|
3037
|
+
const lines = code.split('\n').filter(line => line.trim() !== '').length;
|
|
3038
|
+
|
|
3039
|
+
// Find the first non-empty line and trim it
|
|
3040
|
+
let firstNonEmptyLine = code.split('\n').find(line => line.trim() !== '');
|
|
3041
|
+
firstNonEmptyLine = firstNonEmptyLine ? firstNonEmptyLine.trim() : '';
|
|
3042
|
+
|
|
3043
|
+
// Truncate the snippet if it’s too long
|
|
3044
|
+
if (firstNonEmptyLine.length > 30) {
|
|
3045
|
+
firstNonEmptyLine = firstNonEmptyLine.substring(0, 30) + '...';
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
return `CodeBlock:${language.toLowerCase()}|${lines}-line(s)|${firstNonEmptyLine.toLowerCase()}`;
|
|
3049
|
+
}*/
|
|
3050
|
+
/**
|
|
3051
|
+
* Returns the syntax-highlighted HTML for the code.
|
|
3052
|
+
* If the provided language is supported by Prism, this method returns the highlighted code.
|
|
3053
|
+
* Otherwise, it logs a warning and returns the raw code.
|
|
3054
|
+
*
|
|
3055
|
+
* @private
|
|
3056
|
+
* @returns {string} The highlighted HTML string for the code block.
|
|
3057
|
+
*/
|
|
3058
|
+
getHighlightedCode() {
|
|
3059
|
+
if (this.language && Prism$1.languages[this.language]) {
|
|
3060
|
+
return Prism$1.highlight(this.code, Prism$1.languages[this.language], this.language);
|
|
3061
|
+
}
|
|
3062
|
+
// eslint-disable-next-line
|
|
3063
|
+
//console.warn(`Unsupported or missing language: ${this.language}`);
|
|
3064
|
+
return this.code; // Fallback if language is not provided or unsupported
|
|
3065
|
+
}
|
|
235
3066
|
render() {
|
|
236
|
-
|
|
237
|
-
intent: this.intent,
|
|
238
|
-
loading: this.loading,
|
|
239
|
-
iconPos: this.iconPos,
|
|
240
|
-
size: this.size,
|
|
241
|
-
pill: this.pill,
|
|
242
|
-
iconOnly: !this.label,
|
|
243
|
-
iconSmall: this.iconSmall
|
|
244
|
-
});
|
|
245
|
-
const ElementType = this.elementType;
|
|
246
|
-
return (index.h(ElementType, { key: 'ecdd901c70578c07ef094aadbcd287588d4ba705', "aria-label": this.label || this.ariaLabel || undefined, "aria-disabled": this.elementType === 'button' ? this.disabled : undefined, disabled: this.elementType === 'button' ? this.disabled : undefined, class: `${classes || ''} ${this.extraClass || ''}`, onClick: (event) => this.handleClick(event) }, this.label && index.h("span", { key: 'af8d0ca1c5c3e54f9db3066931a69d3a5a812666', class: this.loading ? 'opacity-0' : '' }, this.label), this.loading && (index.h("span", { key: '29b72c15e80f46e023f829568f58d8a8dca82b78', class: "absolute inset-0 flex items-center justify-center" }, index.h("span", { key: 'bad8bd059b1312ca3f5ab173b1203eb395e9bbd8', class: "loader", style: {
|
|
247
|
-
border: `3px solid ${this.intent === 'secondary' ? 'rgba(255, 255, 255, .3)' : 'rgba(0, 0, 0, .3)'}`,
|
|
248
|
-
borderBottomColor: this.intent === 'secondary' ? '#fff' : '#000'
|
|
249
|
-
} }))), this.icon ? (index.h("eds-icon-wrapper", { class: `
|
|
250
|
-
flex inline-flex items-center justify-center
|
|
251
|
-
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
252
|
-
`, icon: this.icon })) : null));
|
|
3067
|
+
return (index.h("div", { key: '3cfaec27c58d05868313150f1a358ff64c8eafbd', class: "relative bg-stronger rounded-sm" }, index.h("div", { key: 'ed91821385f30305348750dbfffec5fdd7b4dbb8', class: "text-inverse flex justify-between items-center p-8" }, this.language ? (index.h("span", { class: "f-ui-03" }, this.language.toUpperCase())) : (index.h("pre", { class: "bg-stronger pl-8", role: "region", "aria-label": "Code block without language" }, index.h("code", { innerHTML: this.getHighlightedCode() }))), index.h("span", { key: '3e419585214883c878a8e84c440dbd29d590002d', "aria-hidden": "true", class: "w-20 h-20 mt-8" }, index.h("eds-icon-wrapper", { key: '051fa9c714d5c077d5d96ec9b92f8a744ec123bc', icon: this.copied ? 'success' : 'copy', onClick: () => this.copyToClipboard() })), index.h("span", { key: '707950ce89cb0c24b1afac42a8801d13659b6bab', class: "sr-only" }, "Copy Code")), this.language && (index.h("pre", { key: '59923dd4c16cfecafffa2edaaac5ef7579c3f128', class: `language-${this.language} bg-stronger pl-8 pb-8`, role: "region", "aria-label": `Code block in ${this.language}` }, index.h("code", { key: '8c708992c04029d71685ad8922383ecdda05ac3c', innerHTML: this.getHighlightedCode() })))));
|
|
253
3068
|
}
|
|
254
3069
|
get el() { return index.getElement(this); }
|
|
255
3070
|
};
|
|
256
|
-
|
|
3071
|
+
EdsCodeBlock.style = EdsCodeBlockStyle0;
|
|
257
3072
|
|
|
258
3073
|
const edsDropdownCss = ".z-focus{z-index:99}.relative{position:relative}.shadow-small{--tw-shadow:0px 1.5px 2px rgba(0, 0, 0, 0.1);--tw-shadow-colored:0px 1.5px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.bg-inverse{background-color:var(--white)}.border-softest{border:2px solid rgba(0, 0, 0, .05)}.z-10{z-index:10}.z-on-top{z-index:99999}.absolute{position:absolute}.top-full{top:100%}.mt-4{margin-top:0.25rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.gap-y-4{row-gap:0.25rem}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-8{padding:0.5rem}.left-0{left:0rem}.left-1\\/2{left:50%}.left-4{left:0.25rem}.left-\\[4px\\]{left:4px}.right-0{right:0rem}.right-4{right:0.25rem}.right-8{right:0.5rem}";
|
|
259
3074
|
const EdsDropdownStyle0 = edsDropdownCss;
|
|
@@ -360,14 +3175,14 @@ const EdsDropdown = class {
|
|
|
360
3175
|
* @returns {JSX.Element} The rendered dropdown component.
|
|
361
3176
|
*/
|
|
362
3177
|
render() {
|
|
363
|
-
return (index.h("div", { key: '
|
|
3178
|
+
return (index.h("div", { key: '31e8b1fd4e146cbcad4d74bd78dff1cd1e1950bd', class: "z-focus relative", ref: (el) => (this.dropdownContent = el) }, index.h("eds-button", { key: '7021a0b0ff66780a324d7d9d1f6cff250ab64178', label: this.label, "aria-label": this.ariaLabel, icon: this.icon, intent: this.intent, onClick: this.handleClick, "aria-expanded": this.isOpen.toString(), "aria-haspopup": "menu" }), index.h("nav", { key: '904fd2a7f727a8b3966eab6cf9ebdb0efa474ae0', role: "menu", class: {
|
|
364
3179
|
'shadow-small bg-inverse border-softest z-10 z-on-top absolute top-full mt-4 flex flex-col gap-y-4 border-2 p-8': true,
|
|
365
3180
|
'left-4': this.dropdownPos === 'left' && this.dropdownOffset,
|
|
366
3181
|
'left-0': this.dropdownPos === 'left' && !this.dropdownOffset,
|
|
367
3182
|
'right-4': this.dropdownPos === 'right' && this.dropdownOffset,
|
|
368
3183
|
'right-0': this.dropdownPos === 'right' && !this.dropdownOffset,
|
|
369
3184
|
'rounded-lg': this.rounded
|
|
370
|
-
}, style: { display: this.isOpen ? 'block' : 'none' }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, index.h("slot", { key: '
|
|
3185
|
+
}, style: { display: this.isOpen ? 'block' : 'none' }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, index.h("slot", { key: 'b416621930c7117775fef2ee91bdca0f660302f5' }))));
|
|
371
3186
|
}
|
|
372
3187
|
get host() { return index.getElement(this); }
|
|
373
3188
|
};
|
|
@@ -458,6 +3273,13 @@ function findRatingElement(formEl) {
|
|
|
458
3273
|
}
|
|
459
3274
|
return null;
|
|
460
3275
|
}
|
|
3276
|
+
function findNpsElement(formEl) {
|
|
3277
|
+
const elements = Array.from(formEl.querySelectorAll('eds-nps'));
|
|
3278
|
+
for (const element of elements) {
|
|
3279
|
+
return element;
|
|
3280
|
+
}
|
|
3281
|
+
return null;
|
|
3282
|
+
}
|
|
461
3283
|
/**
|
|
462
3284
|
* Validates all fields and returns an object containing the errors and a flag indicating any errors.
|
|
463
3285
|
*/
|
|
@@ -467,6 +3289,7 @@ isFieldVisible) {
|
|
|
467
3289
|
const errors = {};
|
|
468
3290
|
let hasError = false;
|
|
469
3291
|
parsedFields.forEach((field) => {
|
|
3292
|
+
var _a;
|
|
470
3293
|
// Only validate fields that are visible.
|
|
471
3294
|
if (!isFieldVisible(field, values)) {
|
|
472
3295
|
// If a field is hidden, clear its error.
|
|
@@ -502,6 +3325,28 @@ isFieldVisible) {
|
|
|
502
3325
|
}
|
|
503
3326
|
}
|
|
504
3327
|
}
|
|
3328
|
+
// NPS type
|
|
3329
|
+
else if (field.type === 'nps') {
|
|
3330
|
+
const npsEl = findNpsElement(formEl);
|
|
3331
|
+
if (npsEl && npsEl.shadowRoot) {
|
|
3332
|
+
const raw = (_a = npsEl.shadowRoot
|
|
3333
|
+
.querySelector('div[role="radio"][aria-checked="true"] eds-button')) === null || _a === void 0 ? void 0 : _a.getAttribute('aria-label');
|
|
3334
|
+
const value = raw !== null ? parseInt(raw, 10) : null;
|
|
3335
|
+
if (value === null) {
|
|
3336
|
+
// eslint-disable-next-line
|
|
3337
|
+
if (field.required) {
|
|
3338
|
+
errors[field.name] = ['This field is required.'];
|
|
3339
|
+
hasError = true;
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
else if (field.required) {
|
|
3344
|
+
// No NPS component found but required
|
|
3345
|
+
errors[field.name] = ['This field is required.'];
|
|
3346
|
+
hasError = true;
|
|
3347
|
+
}
|
|
3348
|
+
return;
|
|
3349
|
+
}
|
|
505
3350
|
else {
|
|
506
3351
|
// For all other types, find the first matching element.
|
|
507
3352
|
const inputEl = findFieldElement(formEl, field.name);
|
|
@@ -791,6 +3636,25 @@ const EdsForm = class {
|
|
|
791
3636
|
message: `${field.name} updated`
|
|
792
3637
|
});
|
|
793
3638
|
}
|
|
3639
|
+
handleNPS(e, field) {
|
|
3640
|
+
const score = e.detail;
|
|
3641
|
+
this.values = Object.assign(Object.assign({}, this.values), { [field.name]: score });
|
|
3642
|
+
const newErrors = Object.assign({}, this.errors);
|
|
3643
|
+
if (field.required && score === null) {
|
|
3644
|
+
newErrors[field.name] = ['This field is required'];
|
|
3645
|
+
}
|
|
3646
|
+
else {
|
|
3647
|
+
delete newErrors[field.name];
|
|
3648
|
+
}
|
|
3649
|
+
this.errors = newErrors;
|
|
3650
|
+
this.hasError = Object.keys(newErrors).length > 0;
|
|
3651
|
+
this.form.emit({
|
|
3652
|
+
event: 'change',
|
|
3653
|
+
field: field.name,
|
|
3654
|
+
value: score,
|
|
3655
|
+
message: `${field.name} updated`
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
794
3658
|
handleSubmit() {
|
|
795
3659
|
var _a, _b;
|
|
796
3660
|
if (this.isSubmitting) {
|
|
@@ -859,7 +3723,7 @@ const EdsForm = class {
|
|
|
859
3723
|
return map;
|
|
860
3724
|
}
|
|
861
3725
|
renderField(field) {
|
|
862
|
-
var _a, _b;
|
|
3726
|
+
var _a, _b, _c;
|
|
863
3727
|
if (!this.isFieldVisible(field)) {
|
|
864
3728
|
return null;
|
|
865
3729
|
}
|
|
@@ -869,7 +3733,10 @@ const EdsForm = class {
|
|
|
869
3733
|
const val = this.values[field.name] || 0;
|
|
870
3734
|
return (index.h("div", { class: "form-group rating-field", key: field.name }, index.h("div", { class: "flex justify-between" }, field && (index.h("eds-input-label", { name: `rating-${field.name}`, label: field.label, disabled: field.disabled, required: field.required }))), index.h("eds-rating", { id: `rating-${field.name}`, "rating-type": field.ratingType, "rating-count": field.ratingCount, "selected-rating": val, onRating: (e) => this.handleRating(e, field) }), index.h("div", { class: "mt-6" }, index.h("eds-input-footer", { id: `${field.name}-footer`, name: field.name, message: field.message, "error-message": (_a = this.errors[field.name]) === null || _a === void 0 ? void 0 : _a.join('<br/>'), error: !!this.errors[field.name], link: field.link }))));
|
|
871
3735
|
}
|
|
872
|
-
|
|
3736
|
+
else if (field.type === 'nps') {
|
|
3737
|
+
return (index.h("div", { class: "form-group nps-field", key: field.name }, index.h("div", { class: "flex justify-between" }, field && (index.h("eds-input-label", { name: `nps-${field.name}`, label: field.question, disabled: field.disabled, required: field.required }))), index.h("eds-nps", { id: `nps-${field.name}`, "right-label": field.rightLabel, "left-label": field.leftLabel, onNps: (e) => this.handleNPS(e, field) }), index.h("div", { class: "mt-6" }, index.h("eds-input-footer", { id: `${field.name}-footer`, name: field.name, message: field.message, "error-message": (_b = this.errors[field.name]) === null || _b === void 0 ? void 0 : _b.join('<br/>'), error: !!this.errors[field.name], link: field.link }))));
|
|
3738
|
+
}
|
|
3739
|
+
return (index.h("eds-input-field", { key: field.name, name: field.name, label: field.label, placeholder: field.placeholder, type: field.type, value: this.values[field.name], required: field.required, hint: field.hint, message: field.message, error: !!this.errors[field.name], errorMessage: (_c = this.errors[field.name]) === null || _c === void 0 ? void 0 : _c.join('<br/>'), options: field.options, onInput: (e) => this.handleInput(e, field), onChangeNative: (e) => this.handleChange(e, field) }));
|
|
873
3740
|
}
|
|
874
3741
|
async getData() {
|
|
875
3742
|
return this.makeFormData();
|
|
@@ -878,9 +3745,9 @@ const EdsForm = class {
|
|
|
878
3745
|
const hiddenFields = this.parsedFields.filter((field) => field.type === 'hidden');
|
|
879
3746
|
//const otherFields = this.parsedFields.filter((field) => field.type !== 'hidden');
|
|
880
3747
|
const buckets = this.groupedFields;
|
|
881
|
-
return (index.h("form", { key: '
|
|
3748
|
+
return (index.h("form", { key: 'a66997f39b5be347a4d502f77bcd1da9d1a274ac', ref: (el) => (this.formEl = el), autocomplete: "on", onSubmit: this.handleSubmit }, index.h("div", { key: 'f8800d2ebe64b3279234ab8ebe20e535dc822872' }, index.h("slot", { key: 'b4194073b281dec35a79a6cc974fdf7476a67807' }), hiddenFields.map((field, index$1) => (index.h("eds-input", { key: index$1, type: "hidden", name: field.name, value: field.value }))), this.parsedGroups
|
|
882
3749
|
.filter((g) => Array.isArray(buckets[g.id]) && buckets[g.id].length > 0)
|
|
883
|
-
.map((g) => (index.h("div", { class: "container mt-20", key: g.id }, index.h("span", { class: "f-body-02" }, index.h("b", null, g.title)), index.h("div", { class: "border-group mt-32 mb-32 flex flex-col gap-y-24" }, buckets[g.id].map((f) => this.renderField(f)))))), index.h("div", { key: '
|
|
3750
|
+
.map((g) => (index.h("div", { class: "container mt-20", key: g.id }, index.h("span", { class: "f-body-02" }, index.h("b", null, g.title)), index.h("div", { class: "border-group mt-32 mb-32 flex flex-col gap-y-24" }, buckets[g.id].map((f) => this.renderField(f)))))), index.h("div", { key: '2fc83ebb6b0a472f6853618602c37ee83adae9ff', class: "flex flex-col mt-20 gap-y-24" }, buckets['__ungrouped'].map((f) => this.renderField(f)))), this.formBtn && (index.h("div", { key: '91b569b1a4513945f3228c374ae45b52ea17f91d', class: "mt-32" }, index.h("eds-button", { key: '1a8feaecd5a7f292f8aeae3db900700b4f7fb8d4', intent: "primary", label: this.formBtnLabel, disabled: this.isSubmitting, loading: this.isSubmitting, onClick: () => this.handleSubmit() })))));
|
|
884
3751
|
}
|
|
885
3752
|
get el() { return index.getElement(this); }
|
|
886
3753
|
static get watchers() { return {
|
|
@@ -938,7 +3805,7 @@ const EdsHeader = class {
|
|
|
938
3805
|
const classes = variantClasses[this.headerVariant] || variantClasses.default;
|
|
939
3806
|
// Logo color variant: default and inverse use 'color', strong uses 'color-white'
|
|
940
3807
|
const logoType = this.headerVariant === 'strong' ? 'color-white' : 'color';
|
|
941
|
-
return (index.h("header", { key: '
|
|
3808
|
+
return (index.h("header", { key: '812ad4427cbb3f4b0ca9e305870c35d63487dc59', class: `flex items-center justify-between relative z-10 ${classes}` }, index.h("div", { key: '531acdceb12ca45fea125091dee4d8a0ff39a10b', class: "mr-auto w-[200px] h-[85px]" }, index.h("eds-logo", { key: 'bb2708b3c8eacc575117bfed404b7c9db4fd05e2', type: logoType, href: this.homeUrl })), this.parsedLinks && (index.h("nav", { key: 'a80192d7666416c29025a1ac5812946f14feec3f', class: "absolute left-1/2 top-1/2 grow -translate-x-1/2 -translate-y-1/2 justify-center hidden md:flex" }, index.h("ul", { key: 'fae258c468367837a9738bcbe2442709fdc601a0', class: "flex gap-x-2" }, this.parsedLinks.map((link) => (index.h("eds-link", { label: link.label, "aria-label": link.label, url: link.url, intent: "ghost", size: "large", icon: link.icon, external: link.external, "extra-class": "after:effect-opacity aria-current-page:bg-darker whitespace-nowrap !text-current after:!border-transparent after:opacity-0 hover:after:!border-transparent hover:after:opacity-100" })))))), index.h("slot", { key: '9588ef20e19fda76115074c39d902eebead3c845' }), this.menuEnabled && (index.h("div", { key: 'ce2e43645a1c33ca7d6495acd820ad0a93cefdf9', class: "md:hidden flex overflow-hidden px-16" }, index.h("eds-button", { key: 'ed73c7e7a6544f60eea9dbf43379ffe4967c0dbd', "aria-label": "Menu", intent: this.headerVariant === 'default' ? 'ghost' : 'ghostInverse', icon: "menu", size: "small", onClick: () => this.handleToggleMenu() })))));
|
|
942
3809
|
}
|
|
943
3810
|
get hostEl() { return index.getElement(this); }
|
|
944
3811
|
};
|
|
@@ -1020,10 +3887,10 @@ const EdsImg = class {
|
|
|
1020
3887
|
imgOpts['loading'] = 'lazy';
|
|
1021
3888
|
imgOpts['decoding'] = 'async';
|
|
1022
3889
|
}
|
|
1023
|
-
return (index.h("div", { key: '
|
|
3890
|
+
return (index.h("div", { key: '605bff5657ca79678517527a9462b31608e5af7a', class: {
|
|
1024
3891
|
'items-center justify-center': true,
|
|
1025
3892
|
'effect-bg-pattern': this.lazyload && this.showBg
|
|
1026
|
-
} }, index.h("picture", { key: '
|
|
3893
|
+
} }, index.h("picture", { key: '0d0def26688c1ec7214211d02875160965e2ce48' }, this.formats.map((format) => (index.h("source", { type: format.type, srcSet: format.srcset, media: format.media, sizes: this.sizes }))), index.h("img", Object.assign({ key: 'c9c307a5fdf25d9792db2a76f4d08fcd27b50401', ref: (el) => (this.img = el), class: {
|
|
1027
3894
|
'effect-opacity object-cover object-center': true,
|
|
1028
3895
|
'opacity-100': this.loaded,
|
|
1029
3896
|
'opacity-0': !this.loaded
|
|
@@ -1082,7 +3949,7 @@ const EdsInput = class {
|
|
|
1082
3949
|
render() {
|
|
1083
3950
|
const withIcon = !!this.icon;
|
|
1084
3951
|
const describedBy = this.hasMessage || this.error ? `${this.name}-error` : '';
|
|
1085
|
-
return (index.h("div", { key: '
|
|
3952
|
+
return (index.h("div", { key: 'a26224d6345099df6bc5110d42b701980603f7f7', class: "relative flex items-center" }, this.type === 'textarea' ? (index.h("textarea", { id: this.inputId || this.name, name: this.name, placeholder: this.placeholder, value: this.innerVal.toString(), required: this.required, disabled: this.disabled, class: `min-h-80 input input-textarea ${withIcon ? 'input-with-icon' : ''} ${this.error ? 'input-error' : ''} ${this.extraClass}`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput })) : this.type === 'select' ? (index.h("select", { id: this.inputId || this.name, name: this.name, required: this.required, disabled: this.disabled, class: `input input-select ${this.error ? 'input-error' : ''} ${this.extraClass}`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, onInput: this.handleInput, onChange: this.handleInput }, this.options.map((option) => (index.h("option", { value: option.value, selected: option.value === this.innerVal, key: option.value }, option.label))))) : (index.h("input", Object.assign({ id: this.inputId || this.name, name: this.name, placeholder: this.placeholder, value: this.innerVal.toString(), required: this.required, disabled: this.disabled, type: this.type, checked: ['radio', 'checkbox'].includes(this.type) ? this.checked : undefined }, (this.type === 'number'
|
|
1086
3953
|
? {
|
|
1087
3954
|
min: this.min,
|
|
1088
3955
|
max: this.max,
|
|
@@ -1093,7 +3960,7 @@ const EdsInput = class {
|
|
|
1093
3960
|
input ${this.type === 'radio' ? 'input-radio' : this.type === 'checkbox' ? 'input-checkbox' : ''}
|
|
1094
3961
|
${withIcon && this.type !== 'radio' && this.type !== 'checkbox' ? 'input-icon pl-36' : ''}
|
|
1095
3962
|
${this.error ? 'input-error' : ''}
|
|
1096
|
-
`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput }))), this.maxLength && this.type === 'textarea' && (index.h("span", { key: '
|
|
3963
|
+
`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput }))), this.maxLength && this.type === 'textarea' && (index.h("span", { key: 'beb48d08d18b5ca5b054b1b579e2f9527af222e9', class: `input-counter f-ui-05 absolute bottom-8 right-8 ${this.maxLengthReached ? 'input-counter-error' : ''}` }, this.maxLength)), this.icon && (index.h("eds-icon-wrapper", { key: '06948fe33c35c5830edd50a37411281865ef6d12', class: `absolute top-1/2 left-[4px] -translate-y-1/2 ${this.disabled ? 'text-lightest' : 'text-lightest'}`, icon: this.icon }))));
|
|
1097
3964
|
}
|
|
1098
3965
|
get el() { return index.getElement(this); }
|
|
1099
3966
|
static get watchers() { return {
|
|
@@ -1204,7 +4071,7 @@ const EdsInputField = class {
|
|
|
1204
4071
|
}
|
|
1205
4072
|
render() {
|
|
1206
4073
|
const inputOpts = Object.assign({ name: this.name, id: this.inputId, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleNativeInput, onChange: this.handleNativeChange, type: this.type, required: this.required, value: this.value, error: this.error, icon: this.icon, checked: this.checked }, (this.type === 'number' ? { min: this.min, max: this.max, step: this.step } : {}));
|
|
1207
|
-
return (index.h("div", { key: '
|
|
4074
|
+
return (index.h("div", { key: '615165ebb5980d2da414ad4028e053b46358eb4e' }, this.type === 'checkbox' || this.type === 'radio' ? (this.parsedOptions.length > 0 ? (index.h("fieldset", { class: "space-y-4 mt-8" }, index.h("div", { class: "flex justify-between" }, this.label && (index.h("eds-input-label", { name: this.inputId || this.name, label: this.label, required: this.required })), this.hint && (index.h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.parsedOptions.map((option) => (index.h("div", { class: "flex items-center gap-x-4 gap-y-4", key: option.value }, index.h("eds-input", Object.assign({}, inputOpts, { value: option.value, checked: typeof this.value === 'string' && this.value.split(',').includes(String(option.value)) })), index.h("label", { htmlFor: this.name, class: `input-label-options ${this.disabled ? 'text-lighter' : ''}` }, option.label)))))) : (index.h("div", { class: "flex items-center gap-x-8" }, index.h("eds-input", Object.assign({}, inputOpts, { value: this.value, checked: this.value === 'on' || this.checked })), this.label && (index.h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required }))))) : (index.h("div", null, index.h("div", { class: "flex justify-between" }, this.label && (index.h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required })), this.hint && (index.h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.type === 'select' ? (index.h("eds-input-select", Object.assign({}, inputOpts, { options: this.parsedOptions }))) : this.type === 'file' ? (index.h("input", { type: "file", id: this.inputId || this.name, name: this.name, onChange: this.onChangeNative, disabled: this.disabled, required: this.required })) : this.type === 'search' ? (index.h("eds-input-search", { name: "search-box" })) : this.type === 'range' ? ((() => {
|
|
1208
4075
|
var _a, _b, _c;
|
|
1209
4076
|
const rangeProps = {
|
|
1210
4077
|
name: inputOpts.name,
|
|
@@ -1217,8 +4084,9 @@ const EdsInputField = class {
|
|
|
1217
4084
|
const opt = this.parsedOptions;
|
|
1218
4085
|
const numberValue = typeof this.value === 'string' ? parseFloat(this.value) : this.value || 0;
|
|
1219
4086
|
return (index.h("eds-input-range", Object.assign({}, rangeProps, { min: (_a = opt[0]) === null || _a === void 0 ? void 0 : _a.value, max: (_b = opt[1]) === null || _b === void 0 ? void 0 : _b.value, step: (_c = opt[2]) === null || _c === void 0 ? void 0 : _c.value, value: numberValue })));
|
|
1220
|
-
})()) : (index.h("eds-input", Object.assign({}, inputOpts))))), index.h("div", { key: '
|
|
4087
|
+
})()) : (index.h("eds-input", Object.assign({}, inputOpts))))), index.h("div", { key: '4ca8edfb4538caab53e89f16008683aea28adfbc', class: "mt-6" }, index.h("eds-input-footer", { key: '68053a16f607a277a5c806f3c830b24acf3b1f50', id: `${this.name}-footer`, name: this.name, message: this.message, "error-message": this.errorMessage, error: this.error, link: this.link }))));
|
|
1221
4088
|
}
|
|
4089
|
+
static get delegatesFocus() { return true; }
|
|
1222
4090
|
get hostEl() { return index.getElement(this); }
|
|
1223
4091
|
};
|
|
1224
4092
|
EdsInputField.style = EdsInputFieldStyle0;
|
|
@@ -1236,7 +4104,7 @@ const EdsInputFooter = class {
|
|
|
1236
4104
|
this.link = undefined;
|
|
1237
4105
|
}
|
|
1238
4106
|
render() {
|
|
1239
|
-
return (index.h("div", { key: '
|
|
4107
|
+
return (index.h("div", { key: '58bce34f2ec417696ba03d6c8c0c77fa1d900f9a' }, this.error && this.errorMessage && (index.h("div", { key: 'be14dc0f6e9494c1ee436fd8f822112eab6d2ce2', id: `error_${this.name}`, class: "text-error flex items-center" }, index.h("eds-icon-wrapper", { key: 'aaa2010441b0bfe9445e4b6401115b29606ac507', icon: "warning" }), index.h("p", { key: '277ac1de538e873c7da9b592e60dfd276738025d', class: "f-ui-04 ml-4 mb-4", innerHTML: this.errorMessage }))), this.message && index.h("p", { key: '4f07c6efe398bb002322a35279e68b237eac860e', id: `desc_${this.name}`, class: "f-ui-05 text-lighter", innerHTML: this.message }), this.link && (index.h("a", { key: '50d042530985eeafd7334b0bb38fd2c14aed0e3f', href: this.link.url, class: "f-ui-05 effect-color hover:text-lighter underline underline-offset-4" }, this.link.label))));
|
|
1240
4108
|
}
|
|
1241
4109
|
};
|
|
1242
4110
|
EdsInputFooter.style = EdsInputFooterStyle0;
|
|
@@ -1253,7 +4121,7 @@ const EdsInputLabel = class {
|
|
|
1253
4121
|
this.disabled = false;
|
|
1254
4122
|
}
|
|
1255
4123
|
render() {
|
|
1256
|
-
return (index.h("label", { key: '
|
|
4124
|
+
return (index.h("label", { key: '622cd7e26774448ca86c1168d0a287d7b61d3e29', htmlFor: this.name, class: `input-label ${this.disabled ? 'text-lighter' : ''}` }, this.label, this.required && (index.h("span", { key: 'c3162e765af70dd972e3cd0ca360cd3f52003f76' }, index.h("span", { key: '5bca5243c95399fefff4fa21b6c1477a287a3cb4', "aria-hidden": "true" }, "*"), index.h("span", { key: 'bc1c229ac387161e4aa314498dbbc77fbab62955', class: "sr-only" }, "required")))));
|
|
1257
4125
|
}
|
|
1258
4126
|
};
|
|
1259
4127
|
EdsInputLabel.style = EdsInputLabelStyle0;
|
|
@@ -1300,7 +4168,7 @@ const EdsInputRange = class {
|
|
|
1300
4168
|
return this.inputElement;
|
|
1301
4169
|
}
|
|
1302
4170
|
render() {
|
|
1303
|
-
return (index.h("div", { key: '
|
|
4171
|
+
return (index.h("div", { key: '51c9adb300d50eecb48de1547c0a0475692aa97b', class: "relative flex flex-col items-start" }, index.h("input", { key: '65ac18497d2a4307d7f5161951b87bb38cdad892', id: this.inputId || this.name, name: this.name, min: this.min, max: this.max, step: this.step, value: this.sliderVal, required: this.required, disabled: this.disabled, type: "range", class: "w-full py-6 input", tabindex: "0", role: "slider", "aria-describedby": `desc_${this.name}`, "aria-valuemin": this.min, "aria-valuemax": this.max, "aria-valuenow": this.sliderVal, onInput: this.onInput, onChange: this.onChange }), index.h("p", { key: '9b717fce31d2340f3b4bc4b5583e6b1e7764314f', id: `desc_${this.name}`, class: "block f-ui-05 mt-4 text-lighter" }, "Current value: ", this.sliderVal)));
|
|
1304
4172
|
}
|
|
1305
4173
|
get el() { return index.getElement(this); }
|
|
1306
4174
|
static get watchers() { return {
|
|
@@ -1369,7 +4237,7 @@ const EdsInputSearch = class {
|
|
|
1369
4237
|
return this.inputElement;
|
|
1370
4238
|
}
|
|
1371
4239
|
render() {
|
|
1372
|
-
return (index.h("div", { key: '
|
|
4240
|
+
return (index.h("div", { key: '40f0faa26610671e0a89055e5a51fb17ab17c470', class: "relative flex items-center" }, index.h("eds-icon-wrapper", { key: '910f6681ae719608c6f2787de4b3871742dd290a', icon: "search", class: "absolute top-1/2 left-[4px] -translate-y-1/2 text-lightest", "aria-hidden": "true" }), index.h("input", { key: '77534918bd9f2bcd4014e5b201a4f7eb2c0753b4', id: this.inputId || this.name, name: this.name, placeholder: this.placeholder, value: this.value || '', required: this.required, disabled: this.disabled, type: "search", "aria-label": this.placeholder, class: `input pl-36 ${this.decorate}`,
|
|
1373
4241
|
//onInput={this.onInput}
|
|
1374
4242
|
onChange: this.onChange })));
|
|
1375
4243
|
}
|
|
@@ -1398,12 +4266,12 @@ const EdsInputSelect = class {
|
|
|
1398
4266
|
const selectId = this.inputId || this.name;
|
|
1399
4267
|
const placeholderText = this.placeholder || `Pick from the list`;
|
|
1400
4268
|
const describedBy = this.hasMessage || this.error ? `${this.name}-error` : undefined;
|
|
1401
|
-
return (index.h("div", { key: '
|
|
4269
|
+
return (index.h("div", { key: 'f154a5f34a0d09cf6a02e24f13ed9af46532c76c', class: "relative" }, index.h("select", { key: '0982936337bcbec3e2b81f7edc1436506841c782', id: selectId, name: this.name, class: {
|
|
1402
4270
|
input: true,
|
|
1403
4271
|
'input-error': this.error,
|
|
1404
4272
|
'px-4': true,
|
|
1405
4273
|
'py-2': true
|
|
1406
|
-
}, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, disabled: this.disabled, required: this.required, onChange: this.handleChange }, index.h("option", { key: '
|
|
4274
|
+
}, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, disabled: this.disabled, required: this.required, onChange: this.handleChange }, index.h("option", { key: '7656fa514dec6b8b05bbb8d02636bf5e2ee8d213', value: "", disabled: true, hidden: true }, placeholderText), this.options.map((opt, index$1) => (index.h("option", { key: index$1, value: opt.value, selected: opt.value === this.value }, opt.label)))), index.h("span", { key: '8464aa5ef3eab675f493b582736c25a7edd88224', class: "bg-dark rounded-xs absolute top-1/2 right-[6px] flex h-28 w-28 -translate-y-1/2 items-center justify-center" }, index.h("eds-icon-wrapper", { key: '092271b13e4d496a85c55fbb5f1756805cd5d3de', class: "w-20 h-20", icon: "chevron-right" }))));
|
|
1407
4275
|
}
|
|
1408
4276
|
};
|
|
1409
4277
|
|
|
@@ -1579,12 +4447,34 @@ const EdsLink = class {
|
|
|
1579
4447
|
action: 'click'
|
|
1580
4448
|
});
|
|
1581
4449
|
}
|
|
4450
|
+
handleKeyDown(event) {
|
|
4451
|
+
if (this.disabled) {
|
|
4452
|
+
return;
|
|
4453
|
+
}
|
|
4454
|
+
// Handle Enter and Space keys for activation
|
|
4455
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
4456
|
+
event.preventDefault();
|
|
4457
|
+
this.handleClick(event);
|
|
4458
|
+
// For actual navigation, trigger the native link behavior
|
|
4459
|
+
if (this.url && !this.disabled) {
|
|
4460
|
+
if (this.external) {
|
|
4461
|
+
window.open(this.url, '_blank', 'noopener,noreferrer');
|
|
4462
|
+
}
|
|
4463
|
+
else {
|
|
4464
|
+
window.location.href = this.url;
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
1582
4469
|
getLinkSize() {
|
|
4470
|
+
if (this.intent === 'underline') {
|
|
4471
|
+
return 'underline';
|
|
4472
|
+
}
|
|
1583
4473
|
return this.size;
|
|
1584
4474
|
}
|
|
1585
4475
|
renderLeftIcon() {
|
|
1586
4476
|
if (this.icon && this.iconPos === 'left') {
|
|
1587
|
-
return (index.h("span", { class:
|
|
4477
|
+
return (index.h("span", { class: "flex" }, index.h("eds-icon-wrapper", { "aria-hidden": "true", class: `
|
|
1588
4478
|
flex inline-flex items-center justify-center
|
|
1589
4479
|
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
1590
4480
|
`, icon: this.icon })));
|
|
@@ -1593,7 +4483,7 @@ const EdsLink = class {
|
|
|
1593
4483
|
}
|
|
1594
4484
|
renderRightIcon() {
|
|
1595
4485
|
if (this.icon && this.iconPos === 'right') {
|
|
1596
|
-
return (index.h("span", { class:
|
|
4486
|
+
return (index.h("span", { class: "flex" }, index.h("eds-icon-wrapper", { "aria-hidden": "true", class: `
|
|
1597
4487
|
flex inline-flex items-center justify-center
|
|
1598
4488
|
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
1599
4489
|
`, icon: this.icon })));
|
|
@@ -1601,8 +4491,6 @@ const EdsLink = class {
|
|
|
1601
4491
|
return null;
|
|
1602
4492
|
}
|
|
1603
4493
|
render() {
|
|
1604
|
-
// If the link is disabled, use a <span>; otherwise, use an <a> element.
|
|
1605
|
-
const ComponentType = this.disabled ? 'span' : 'a';
|
|
1606
4494
|
const classes = linkStyles({
|
|
1607
4495
|
intent: this.intent,
|
|
1608
4496
|
size: this.getLinkSize(),
|
|
@@ -1610,12 +4498,12 @@ const EdsLink = class {
|
|
|
1610
4498
|
isActive: this.current,
|
|
1611
4499
|
hasIcon: !!this.icon
|
|
1612
4500
|
});
|
|
1613
|
-
|
|
1614
|
-
const
|
|
4501
|
+
const isInteractive = !this.disabled;
|
|
4502
|
+
const isIconOnly = !this.label || (this.hideLabelOnSmallScreen && this.icon);
|
|
1615
4503
|
const labelClasses = this.hideLabelOnSmallScreen
|
|
1616
4504
|
? 'hidden lg:flex' // Tailwind example: hidden on small screens, visible on larger
|
|
1617
4505
|
: '';
|
|
1618
|
-
return (index.h(
|
|
4506
|
+
return (index.h("a", { key: '929b7318ec6475113125e40d789476df76e59e38', class: `${classes || ''} ${this.extraClass || ''}`, href: isInteractive ? this.url : undefined, target: this.external && isInteractive ? '_blank' : undefined, rel: this.external && isInteractive ? 'noopener noreferrer' : undefined, tabIndex: isInteractive ? 0 : -1, "aria-label": isIconOnly ? this.ariaLabel || 'Link' : undefined, "aria-disabled": this.disabled ? 'true' : undefined, "aria-current": this.current ? 'page' : undefined, role: this.disabled ? 'link' : undefined, download: this.download ? '' : undefined, onClick: (event) => this.handleClick(event), onKeyDown: (event) => this.handleKeyDown(event) }, index.h("span", { key: '4b965dcb07ebca43577b0dcd9f2d11495caa761a', class: "z-1 relative inline-flex items-center justify-center" }, this.renderLeftIcon(), this.label && index.h("span", { key: 'a4327fe130fb8c3962096eff3415ad62e19230f4', class: labelClasses }, this.label), this.renderRightIcon())));
|
|
1619
4507
|
}
|
|
1620
4508
|
get el() { return index.getElement(this); }
|
|
1621
4509
|
};
|
|
@@ -1683,29 +4571,273 @@ const EdsLogo = class {
|
|
|
1683
4571
|
}
|
|
1684
4572
|
render() {
|
|
1685
4573
|
const logoContent = this.getLogo();
|
|
1686
|
-
return (index.h("a", { key: '
|
|
4574
|
+
return (index.h("a", { key: 'fff2a45eb8b41f59026ff7033824484339e3c0a9', href: this.href, onClick: () => this.handleClick(), class: "eds-logo-wrapper", "aria-label": this.label }, index.h("div", { key: 'bc13988a739af1c94d5eadbabf558cbbb10927b8', innerHTML: logoContent })));
|
|
1687
4575
|
}
|
|
1688
4576
|
get el() { return index.getElement(this); }
|
|
1689
4577
|
};
|
|
1690
4578
|
EdsLogo.style = EdsLogoStyle0;
|
|
1691
4579
|
|
|
1692
|
-
const
|
|
4580
|
+
const edsMatomoNoticeCss = ".fixed{position:fixed}.absolute{position:absolute}.w-full{width:100%}.bottom-0{bottom:0rem}.bottom-4{bottom:0.25rem}.p-4{padding:0.25rem}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.z-10{z-index:10}.z-\\[999999\\]{z-index:999999}.left-0{left:0rem}.left-1\\/2{left:50%}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.flex{display:flex}.gap-12{gap:0.75rem}.gap-20{gap:1.25rem}.gap-4{gap:0.25rem}@media (min-width: 750px){.md\\:left-1\\/2{left:50%}.md\\:flex{display:flex}.md\\:hidden{display:none}.md\\:-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}}";
|
|
4581
|
+
const EdsMatomoNoticeStyle0 = edsMatomoNoticeCss;
|
|
4582
|
+
|
|
4583
|
+
const EdsMatomoNotice = class {
|
|
4584
|
+
constructor(hostRef) {
|
|
4585
|
+
index.registerInstance(this, hostRef);
|
|
4586
|
+
this.consent = index.createEvent(this, "consent", 7);
|
|
4587
|
+
this.heading = 'Analytics Consent';
|
|
4588
|
+
this.description = "We use anonymous analytics to improve our services. No data is collected unless you give your consent. If you don't wish to send data right now, you can always re-enable analytics later by clicking the Cookies Preference button in the footer. However, by opting in today, you're joining a community that shapes our product's future—all while keeping your data completely anonymous.";
|
|
4589
|
+
this.optOutMessage = "You are already part of our community, and your anonymous data helps shape our product's future! Rest assured, your privacy is fully protected.";
|
|
4590
|
+
this.forceShow = false;
|
|
4591
|
+
this.showNotice = true;
|
|
4592
|
+
}
|
|
4593
|
+
/**
|
|
4594
|
+
* Listens for global custom events to open the matomo-consent.
|
|
4595
|
+
*/
|
|
4596
|
+
toggleCookiesConsent() {
|
|
4597
|
+
this.showNotice = !this.showNotice;
|
|
4598
|
+
}
|
|
4599
|
+
/**
|
|
4600
|
+
* Checks if the consent cookie exists.
|
|
4601
|
+
*/
|
|
4602
|
+
hasCookieConsent() {
|
|
4603
|
+
return !!document.cookie.split('; ').find((row) => row.startsWith('mtm_consent='));
|
|
4604
|
+
}
|
|
4605
|
+
/**
|
|
4606
|
+
* Checks if the user has opted out after has opted in.
|
|
4607
|
+
*/
|
|
4608
|
+
optedOut() {
|
|
4609
|
+
return !!document.cookie.split('; ').find((row) => row.startsWith('mtm_consent_removed'));
|
|
4610
|
+
}
|
|
4611
|
+
/**
|
|
4612
|
+
* Generate a unique storage key based on appId or the app's domain.
|
|
4613
|
+
*/
|
|
4614
|
+
getStorageKey() {
|
|
4615
|
+
return `${window.location.host}-matomo-deferred`;
|
|
4616
|
+
}
|
|
4617
|
+
/**
|
|
4618
|
+
* Check cookies and sessionStorage (unless forceShow is true) to decide if the notice should be shown.
|
|
4619
|
+
*/
|
|
4620
|
+
componentWillLoad() {
|
|
4621
|
+
// If a decision has been made previously (opted in or out), don't show the notice.
|
|
4622
|
+
const consentGiven = localStorage.getItem(`${window.location.host}-matomo-consent-given`);
|
|
4623
|
+
if (consentGiven === 'out' || this.optedOut()) {
|
|
4624
|
+
this.showNotice = false;
|
|
4625
|
+
return;
|
|
4626
|
+
}
|
|
4627
|
+
if (this.forceShow) {
|
|
4628
|
+
// If forceShow is true, always show the notice
|
|
4629
|
+
this.showNotice = true;
|
|
4630
|
+
}
|
|
4631
|
+
else {
|
|
4632
|
+
// If user has already consented, hide the notice
|
|
4633
|
+
// eslint-disable-next-line
|
|
4634
|
+
if (this.hasCookieConsent()) {
|
|
4635
|
+
this.showNotice = false;
|
|
4636
|
+
}
|
|
4637
|
+
else {
|
|
4638
|
+
// Otherwise check if user deferred in this session
|
|
4639
|
+
const sessionDeferred = sessionStorage.getItem(this.getStorageKey());
|
|
4640
|
+
this.showNotice = !sessionDeferred;
|
|
4641
|
+
}
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
componentDidLoad() {
|
|
4645
|
+
const btns = this.el.shadowRoot.querySelectorAll('eds-button');
|
|
4646
|
+
btns.forEach((b) => {
|
|
4647
|
+
this.emitContext(b);
|
|
4648
|
+
});
|
|
4649
|
+
}
|
|
4650
|
+
emitContext(linkElement) {
|
|
4651
|
+
const event = new CustomEvent('parentContext', {
|
|
4652
|
+
detail: {
|
|
4653
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
4654
|
+
identifier: null
|
|
4655
|
+
}
|
|
4656
|
+
});
|
|
4657
|
+
linkElement.dispatchEvent(event);
|
|
4658
|
+
}
|
|
4659
|
+
optInAnalytics() {
|
|
4660
|
+
analytics.matomoOptIn();
|
|
4661
|
+
localStorage.removeItem(`${window.location.host}-matomo-consent-given`);
|
|
4662
|
+
this.hideNotice();
|
|
4663
|
+
this.consent.emit('in');
|
|
4664
|
+
}
|
|
4665
|
+
optOutAnalytics() {
|
|
4666
|
+
analytics.matomoOptOut();
|
|
4667
|
+
this.hideNotice();
|
|
4668
|
+
this.consent.emit('out');
|
|
4669
|
+
}
|
|
4670
|
+
noThanks() {
|
|
4671
|
+
analytics.matomoOptOut();
|
|
4672
|
+
localStorage.setItem(`${window.location.host}-matomo-consent-given`, 'out');
|
|
4673
|
+
this.hideNotice();
|
|
4674
|
+
this.consent.emit('out');
|
|
4675
|
+
}
|
|
4676
|
+
/*private deferDecision() {
|
|
4677
|
+
sessionStorage.setItem(this.getStorageKey(), 'true');
|
|
4678
|
+
this.hideNotice();
|
|
4679
|
+
this.consent.emit('defer');
|
|
4680
|
+
}*/
|
|
4681
|
+
keepMeIn() {
|
|
4682
|
+
this.hideNotice();
|
|
4683
|
+
}
|
|
4684
|
+
hideNotice() {
|
|
4685
|
+
this.showNotice = false;
|
|
4686
|
+
}
|
|
4687
|
+
render() {
|
|
4688
|
+
if (!this.showNotice) {
|
|
4689
|
+
return null;
|
|
4690
|
+
}
|
|
4691
|
+
return (index.h("div", { class: "fixed bottom-0 p-8 z-[999999] grow md:left-1/2 md:-translate-x-1/2 md:-translate-y-1/2 justify-center" }, index.h("eds-accordion", { title: this.heading, description: this.hasCookieConsent() ? this.optOutMessage : this.description, switchBg: true, expanded: true }, this.hasCookieConsent() ? (index.h("div", { class: "flex items-center gap-4" }, this.optedOut() ? (index.h("eds-button", { intent: "primary", label: "Opt me in again", "aria-label": "Opt me in again", onClick: () => this.optInAnalytics() })) : (index.h("eds-button", { intent: "primary", label: "Keep Me In", "aria-label": "Keep Me In", onClick: () => this.keepMeIn() })), index.h("eds-button", { intent: "ghostInverse", label: "Opt-out", "aria-label": "Opt-out from analytics", onClick: () => this.optOutAnalytics() }))) : (index.h("div", { class: "flex items-center gap-4" }, index.h("eds-button", { intent: "primary", label: "I agree", "aria-label": "Opt-in for analytics", onClick: () => this.optInAnalytics() }), index.h("eds-button", { intent: "ghost", label: "No, thanks", "aria-label": "Opt-out from analytics", onClick: () => this.noThanks() }))))));
|
|
4692
|
+
}
|
|
4693
|
+
get el() { return index.getElement(this); }
|
|
4694
|
+
};
|
|
4695
|
+
EdsMatomoNotice.style = EdsMatomoNoticeStyle0;
|
|
4696
|
+
|
|
4697
|
+
const edsNpsCss = ".flex{display:flex}.justify-between{justify-content:space-between}.mt-4{margin-top:0.25rem}.mt-8{margin-top:0.5rem}.ml-4{margin-left:0.25rem}.mr-4{margin-right:0.25rem}.grid{display:grid}.grid-col-span-1{--container-grid-columns:1;grid-column:span 1 / span 1}.grid-cols-11{grid-template-columns:repeat(11, minmax(0, 1fr))}.grid-cols-11[class*=\"grid-line-x\"][class*=\"grid-line-x\"]>*:nth-child(n)::before{border-bottom-width:1px}.grid-cols-11[class*=\"grid-line-xfull\"]>*:nth-child(n)::before{inset-inline-start:calc(var(--inner-gutter) / -2);inset-inline-end:calc(var(--inner-gutter) / -2)}.grid-cols-11[class*=\"grid-line-x\"]>*:nth-child(11n+1)::before{inset-inline-start:0}.grid-cols-11[class*=\"grid-line-x\"]>*:nth-child(11n+11)::before{inset-inline-end:0}.grid-cols-11[class*=\"grid-line-x\"]>*:nth-child(11n+1):nth-last-child(-n+11)::before{border-bottom-width:0}.grid-cols-11[class*=\"grid-line-x\"]>*:nth-child(11n+1):nth-last-child(-n+11)~*::before{border-bottom-width:0}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(n)::after{border-inline-end-width:1px}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(11n+11)::after{border-inline-end-width:0}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(-n+11)::after{top:0}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(11n+1):nth-last-child(-n+11)::after{bottom:0}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(11n+1):nth-last-child(-n+11)~li::after{bottom:0}.f-ui-04{font-family:var(--f-ui-04-fontFamily);font-weight:var(--f-ui-04-fontWeight);font-size:var(--f-ui-04-fontSize);line-height:var(--f-ui-04-lineHeight);letter-spacing:var(--f-ui-04-letterSpacing)}.text-light{color:var(--grey-700)}";
|
|
4698
|
+
const EdsNpsStyle0 = edsNpsCss;
|
|
4699
|
+
|
|
4700
|
+
const EdsNps = class {
|
|
4701
|
+
constructor(hostRef) {
|
|
4702
|
+
index.registerInstance(this, hostRef);
|
|
4703
|
+
this.nps = index.createEvent(this, "nps", 7);
|
|
4704
|
+
this.min = 0;
|
|
4705
|
+
this.max = 10;
|
|
4706
|
+
this.question = undefined;
|
|
4707
|
+
this.leftLabel = undefined;
|
|
4708
|
+
this.rightLabel = undefined;
|
|
4709
|
+
this.selectedValue = null;
|
|
4710
|
+
}
|
|
4711
|
+
handleClick(value) {
|
|
4712
|
+
this.selectedValue = value;
|
|
4713
|
+
this.nps.emit(value);
|
|
4714
|
+
}
|
|
4715
|
+
handleKeyNav(e) {
|
|
4716
|
+
const radios = Array.from(this.el.shadowRoot.querySelectorAll('eds-button'));
|
|
4717
|
+
const currentIndex = radios.findIndex((r) => r.tabIndex === 0);
|
|
4718
|
+
switch (e.key) {
|
|
4719
|
+
case 'ArrowRight':
|
|
4720
|
+
case 'ArrowLeft': {
|
|
4721
|
+
e.preventDefault();
|
|
4722
|
+
const delta = e.key === 'ArrowRight' ? 1 : -1;
|
|
4723
|
+
const nextIndex = Math.min(this.max, Math.max(0, currentIndex + delta));
|
|
4724
|
+
this.activateRadio(radios, nextIndex);
|
|
4725
|
+
break;
|
|
4726
|
+
}
|
|
4727
|
+
case 'Home': {
|
|
4728
|
+
e.preventDefault();
|
|
4729
|
+
this.activateRadio(radios, 0);
|
|
4730
|
+
break;
|
|
4731
|
+
}
|
|
4732
|
+
case 'End': {
|
|
4733
|
+
e.preventDefault();
|
|
4734
|
+
this.activateRadio(radios, this.max);
|
|
4735
|
+
break;
|
|
4736
|
+
}
|
|
4737
|
+
case 'Enter':
|
|
4738
|
+
case ' ': {
|
|
4739
|
+
e.preventDefault();
|
|
4740
|
+
if (currentIndex >= 0) {
|
|
4741
|
+
this.handleClick(this.min + currentIndex);
|
|
4742
|
+
}
|
|
4743
|
+
break;
|
|
4744
|
+
}
|
|
4745
|
+
case 'Escape': {
|
|
4746
|
+
e.preventDefault();
|
|
4747
|
+
if (currentIndex >= 0) {
|
|
4748
|
+
radios[currentIndex].blur();
|
|
4749
|
+
}
|
|
4750
|
+
break;
|
|
4751
|
+
}
|
|
4752
|
+
default:
|
|
4753
|
+
return;
|
|
4754
|
+
}
|
|
4755
|
+
}
|
|
4756
|
+
activateRadio(radios, index) {
|
|
4757
|
+
const target = radios[index];
|
|
4758
|
+
const value = this.min + index;
|
|
4759
|
+
this.handleClick(value);
|
|
4760
|
+
target.focus();
|
|
4761
|
+
}
|
|
4762
|
+
render() {
|
|
4763
|
+
const count = this.max - this.min + 1;
|
|
4764
|
+
const fallback = 0;
|
|
4765
|
+
return (index.h("div", { key: 'd675e1e4ecc306511c0324d0b76ee66237cb6738', class: "eds-nps" }, index.h("eds-input-label", { key: '2eede06f6ee166c36b0cf315a35435c89c3c0ba5', id: "nps-question", name: "nps-question", label: this.question }), index.h("div", { key: '16105649fe6b3b229127c9a741367a6381db774f', role: "group", id: "nps-buttons", "aria-labelledby": "nps-question", class: "grid grid-cols-11", onKeyDown: (e) => this.handleKeyNav(e) }, Array.from({ length: count }, (_, i) => {
|
|
4766
|
+
const val = this.min + i;
|
|
4767
|
+
const isSelected = val === this.selectedValue;
|
|
4768
|
+
const tabIndex = this.selectedValue === null ? (i === fallback ? 0 : -1) : isSelected ? 0 : -1;
|
|
4769
|
+
return (index.h("div", { class: "grid-col-span-1", key: val }, index.h("eds-button", { tabindex: tabIndex, label: `${val}`, "aria-label": `${val}`, intent: isSelected ? 'primary' : 'ghost', "extra-class": "!block !px-0 w-full", triggerClick: () => this.handleClick(val) })));
|
|
4770
|
+
})), index.h("div", { key: 'e7bd70a4f1a8083d9c3e08fdf8de55999a27d92d', class: "flex justify-between mt-8" }, index.h("span", { key: 'ea3fbbac20a162e7cf5f2d5e3321c8bc9297014e', class: "f-ui-04 text-light ml-4" }, this.leftLabel), index.h("span", { key: '3ff59cde0c532587ead8b8a1eaaff6c630e7e7ac', class: "f-ui-04 text-light mr-4" }, this.rightLabel))));
|
|
4771
|
+
}
|
|
4772
|
+
get el() { return index.getElement(this); }
|
|
4773
|
+
};
|
|
4774
|
+
EdsNps.style = EdsNpsStyle0;
|
|
4775
|
+
|
|
4776
|
+
const edsPaginationCss = "ul,menu{list-style:none;margin:0;padding:0}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.f-ui-02{font-family:var(--f-ui-02-fontFamily);font-weight:var(--f-ui-02-fontWeight);font-size:var(--f-ui-02-fontSize);line-height:var(--f-ui-02-lineHeight);letter-spacing:var(--f-ui-02-letterSpacing)}.f-ui-02-light{font-family:var(--f-ui-02-light-fontFamily);font-weight:var(--f-ui-02-light-fontWeight);font-size:var(--f-ui-02-light-fontSize);line-height:var(--f-ui-02-light-lineHeight);letter-spacing:var(--f-ui-02-light-letterSpacing)}.text-light{color:var(--grey-700)}.text-lightest{color:var(--grey-500)}.mb-28{margin-bottom:1.75rem}.w-full{width:100%}.w-20{width:1.25rem}.h-20{height:1.25rem}.h-28{height:1.75rem}.h-32{height:2rem}.h-36{height:2.25rem}.text-center{text-align:center}.flex{display:flex}.inline-flex{display:inline-flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-x-8{-moz-column-gap:0.5rem;column-gap:0.5rem}.mr-auto{margin-right:auto}.ml-auto{margin-left:auto}.\\!p-8{padding:0.5rem !important}.ml-4{margin-left:0.25rem}.mr-4{margin-right:0.25rem}.hidden{display:none}.gap-1{gap:0.0625rem}.py-4{padding-top:0.25rem;padding-bottom:0.25rem}.transition-colors{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}@media (min-width: 900px){.lg\\:\\!pr-12{padding-right:0.75rem !important}.lg\\:flex{display:flex}}";
|
|
1693
4777
|
const EdsPaginationStyle0 = edsPaginationCss;
|
|
1694
4778
|
|
|
1695
4779
|
const EdsPagination = class {
|
|
1696
4780
|
constructor(hostRef) {
|
|
1697
4781
|
index.registerInstance(this, hostRef);
|
|
4782
|
+
/**
|
|
4783
|
+
* Handles keyboard navigation within the pagination
|
|
4784
|
+
*/
|
|
4785
|
+
this.handleKeyDown = (e) => {
|
|
4786
|
+
if (this.mode !== 'default' || !this.useButtons) {
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
const navigableItems = this.getNavigableItems();
|
|
4790
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
4791
|
+
e.preventDefault();
|
|
4792
|
+
const increment = e.key === 'ArrowRight' ? 1 : -1;
|
|
4793
|
+
let currentIndex = this.focusedIndex;
|
|
4794
|
+
// If no item is focused, start from current page or first item
|
|
4795
|
+
if (currentIndex === -1) {
|
|
4796
|
+
const currentPageIndex = navigableItems.findIndex((item) => item.type === 'page' && item.page === this.currentPage);
|
|
4797
|
+
currentIndex = currentPageIndex !== -1 ? currentPageIndex : 0;
|
|
4798
|
+
}
|
|
4799
|
+
let newIndex = currentIndex + increment;
|
|
4800
|
+
// Wrap around navigation
|
|
4801
|
+
if (newIndex >= navigableItems.length) {
|
|
4802
|
+
newIndex = 0;
|
|
4803
|
+
}
|
|
4804
|
+
else if (newIndex < 0) {
|
|
4805
|
+
newIndex = navigableItems.length - 1;
|
|
4806
|
+
}
|
|
4807
|
+
this.focusedIndex = newIndex;
|
|
4808
|
+
this.focusPaginationItem(newIndex);
|
|
4809
|
+
}
|
|
4810
|
+
else if (e.key === 'Home') {
|
|
4811
|
+
e.preventDefault();
|
|
4812
|
+
this.focusedIndex = 0;
|
|
4813
|
+
this.focusPaginationItem(0);
|
|
4814
|
+
}
|
|
4815
|
+
else if (e.key === 'End') {
|
|
4816
|
+
e.preventDefault();
|
|
4817
|
+
const lastIndex = navigableItems.length - 1;
|
|
4818
|
+
this.focusedIndex = lastIndex;
|
|
4819
|
+
this.focusPaginationItem(lastIndex);
|
|
4820
|
+
}
|
|
4821
|
+
};
|
|
4822
|
+
/**
|
|
4823
|
+
* Handles focus events for pagination items
|
|
4824
|
+
*/
|
|
4825
|
+
this.handleItemFocus = (index) => {
|
|
4826
|
+
this.focusedIndex = index;
|
|
4827
|
+
};
|
|
1698
4828
|
this.currentPage = undefined;
|
|
1699
4829
|
this.lastPage = undefined;
|
|
1700
4830
|
this.perPage = 10;
|
|
1701
4831
|
this.total = 0;
|
|
1702
4832
|
this.url = '';
|
|
1703
4833
|
this.mode = 'default';
|
|
4834
|
+
this.useButtons = true;
|
|
1704
4835
|
this.prevLabel = 'Prev';
|
|
1705
4836
|
this.nextLabel = 'Next';
|
|
1706
4837
|
this.prevUrl = '';
|
|
1707
4838
|
this.nextUrl = '';
|
|
1708
4839
|
this.links = [];
|
|
4840
|
+
this.focusedIndex = -1;
|
|
1709
4841
|
}
|
|
1710
4842
|
/** Lifecycle hook to generate pagination links on component load */
|
|
1711
4843
|
componentWillLoad() {
|
|
@@ -1714,24 +4846,17 @@ const EdsPagination = class {
|
|
|
1714
4846
|
}
|
|
1715
4847
|
}
|
|
1716
4848
|
componentDidLoad() {
|
|
1717
|
-
//
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
this.emitContext(links[0]);
|
|
1725
|
-
|
|
1726
|
-
// Emit context for the last link, if it's different from the first
|
|
1727
|
-
if (links.length > 1) {
|
|
1728
|
-
this.emitContext(links[links.length - 1]);
|
|
1729
|
-
}
|
|
1730
|
-
}*/
|
|
4849
|
+
// Only emit context for links, not buttons
|
|
4850
|
+
if (!this.useButtons) {
|
|
4851
|
+
const links = this.hostEl.shadowRoot.querySelectorAll('eds-link');
|
|
4852
|
+
links.forEach((lnk) => {
|
|
4853
|
+
this.emitContext(lnk);
|
|
4854
|
+
});
|
|
4855
|
+
}
|
|
1731
4856
|
}
|
|
1732
4857
|
/**
|
|
1733
4858
|
* Emits a custom event called `parentContext` for a given link element.
|
|
1734
|
-
* This event provides context information about the
|
|
4859
|
+
* This event provides context information about the pagination component.
|
|
1735
4860
|
*
|
|
1736
4861
|
* @param linkElement - The link element to which the event will be dispatched.
|
|
1737
4862
|
*/
|
|
@@ -1749,6 +4874,34 @@ const EdsPagination = class {
|
|
|
1749
4874
|
this.generateLinks();
|
|
1750
4875
|
}
|
|
1751
4876
|
}
|
|
4877
|
+
/**
|
|
4878
|
+
* Gets all navigable pagination items for keyboard navigation
|
|
4879
|
+
*/
|
|
4880
|
+
getNavigableItems() {
|
|
4881
|
+
const items = [];
|
|
4882
|
+
// Previous button
|
|
4883
|
+
items.push({ type: 'prev', disabled: this.isFirstPage() });
|
|
4884
|
+
// Page numbers
|
|
4885
|
+
this.links.forEach((link) => {
|
|
4886
|
+
if (typeof link === 'object') {
|
|
4887
|
+
items.push({ type: 'page', page: parseInt(link.label), disabled: false });
|
|
4888
|
+
}
|
|
4889
|
+
});
|
|
4890
|
+
// Next button
|
|
4891
|
+
items.push({ type: 'next', disabled: this.isLastPage() });
|
|
4892
|
+
return items.filter((item) => !item.disabled);
|
|
4893
|
+
}
|
|
4894
|
+
/**
|
|
4895
|
+
* Focuses a specific pagination item by index
|
|
4896
|
+
*/
|
|
4897
|
+
focusPaginationItem(index) {
|
|
4898
|
+
var _a;
|
|
4899
|
+
const buttons = (_a = this.hostEl.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.pagination-button');
|
|
4900
|
+
const targetButton = buttons === null || buttons === void 0 ? void 0 : buttons[index];
|
|
4901
|
+
if (targetButton) {
|
|
4902
|
+
targetButton.focus();
|
|
4903
|
+
}
|
|
4904
|
+
}
|
|
1752
4905
|
/**
|
|
1753
4906
|
* Checks if the current page is the first page
|
|
1754
4907
|
* @returns {boolean} - true if current page is the first page
|
|
@@ -1771,7 +4924,7 @@ const EdsPagination = class {
|
|
|
1771
4924
|
generateLink(page) {
|
|
1772
4925
|
const urlHasQuery = this.url.includes('?');
|
|
1773
4926
|
return {
|
|
1774
|
-
ariaLabel: `
|
|
4927
|
+
ariaLabel: `Go to page ${page}`,
|
|
1775
4928
|
url: `${this.url}${urlHasQuery ? '&' : '?'}page=${page}`,
|
|
1776
4929
|
label: page.toString(),
|
|
1777
4930
|
current: this.currentPage === page,
|
|
@@ -1791,7 +4944,6 @@ const EdsPagination = class {
|
|
|
1791
4944
|
* Creates a pagination range based on delta, current, and total pages
|
|
1792
4945
|
* @param {number} current - Current page number
|
|
1793
4946
|
* @param {number} total - Total number of pages
|
|
1794
|
-
* @param {number} delta - Range of pages to display around the current page
|
|
1795
4947
|
* @returns {(number | string)[]} - Range of page numbers or ellipses
|
|
1796
4948
|
*/
|
|
1797
4949
|
getPaginationGenerator(current, total) {
|
|
@@ -1806,7 +4958,7 @@ const EdsPagination = class {
|
|
|
1806
4958
|
else {
|
|
1807
4959
|
// Always show the first page
|
|
1808
4960
|
range.push(1);
|
|
1809
|
-
// Add ellipsis if there
|
|
4961
|
+
// Add ellipsis if there's a gap between the first page and the current range start
|
|
1810
4962
|
if (current - delta > 2) {
|
|
1811
4963
|
range.push('...');
|
|
1812
4964
|
}
|
|
@@ -1814,7 +4966,7 @@ const EdsPagination = class {
|
|
|
1814
4966
|
for (let i = Math.max(2, current - delta); i <= Math.min(total - 1, current + delta); i++) {
|
|
1815
4967
|
range.push(i);
|
|
1816
4968
|
}
|
|
1817
|
-
// Add ellipsis if there
|
|
4969
|
+
// Add ellipsis if there's a gap between the current range end and the last page
|
|
1818
4970
|
if (current + delta < total - 1) {
|
|
1819
4971
|
range.push('...');
|
|
1820
4972
|
}
|
|
@@ -1829,9 +4981,11 @@ const EdsPagination = class {
|
|
|
1829
4981
|
*/
|
|
1830
4982
|
pageResults() {
|
|
1831
4983
|
if (this.total > 0) {
|
|
4984
|
+
const start = this.perPage * ((this.currentPage || 1) - 1) + 1;
|
|
4985
|
+
const end = Math.min(this.perPage * (this.currentPage || 1), this.total);
|
|
1832
4986
|
return this.total > this.perPage
|
|
1833
|
-
?
|
|
1834
|
-
:
|
|
4987
|
+
? `Showing ${start} to ${end} of ${this.total} results`
|
|
4988
|
+
: `Showing ${this.total} result${this.total !== 1 ? 's' : ''}`;
|
|
1835
4989
|
}
|
|
1836
4990
|
return '';
|
|
1837
4991
|
}
|
|
@@ -1844,7 +4998,9 @@ const EdsPagination = class {
|
|
|
1844
4998
|
if (this.mode === 'navigator') {
|
|
1845
4999
|
return; // No page clicking logic for navigator mode
|
|
1846
5000
|
}
|
|
1847
|
-
|
|
5001
|
+
if (this.useButtons) {
|
|
5002
|
+
event.preventDefault(); // Prevent default for buttons
|
|
5003
|
+
}
|
|
1848
5004
|
if (newPage !== this.currentPage) {
|
|
1849
5005
|
this.links = this.links.map((link) => typeof link === 'object' ? Object.assign(Object.assign({}, link), { current: parseInt(link.label) === newPage }) : link);
|
|
1850
5006
|
const pageChangeEvent = new CustomEvent('page', {
|
|
@@ -1857,38 +5013,25 @@ const EdsPagination = class {
|
|
|
1857
5013
|
}
|
|
1858
5014
|
}
|
|
1859
5015
|
render() {
|
|
1860
|
-
|
|
1861
|
-
|
|
5016
|
+
const navigableIndex = -1; // Track index for keyboard navigation
|
|
5017
|
+
return (index.h("div", { key: '753a7e573a09e7fcb66eac9e11e00f690c49543d' }, this.total > 0 && this.mode === 'default' && (index.h("p", { key: '6286d71622614a835d471812a55d5c6bef37a13e', class: "f-ui-03 text-light mb-28 w-full text-center", "aria-live": "polite", id: "pagination-info" }, index.h("span", { key: 'daa7bfa31e736a40c46641fed88653d51eeabc67', class: "text-light sr-only" }, "Results:"), this.pageResults())), this.mode === 'navigator' || (this.lastPage && this.lastPage > 1) ? (index.h("nav", { "aria-label": "Pagination Navigation", "aria-describedby": this.mode === 'default' ? 'pagination-info' : undefined, onKeyDown: this.handleKeyDown }, index.h("ul", { class: "flex items-center justify-center gap-x-8", role: "list" }, index.h("li", { class: "mr-auto" }, this.useButtons ? (index.h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, index.h("eds-button", { label: this.prevLabel, disabled: this.mode === 'navigator' ? !this.prevUrl : this.isFirstPage(), "aria-label": "Go to previous page", icon: "chevron-left", "icon-pos": "left", size: "small", "icon-small": "true", intent: "ghost", "extra-class": "!p-8 lg:!pr-12 pagination-button", onClick: (event) => {
|
|
5018
|
+
if (this.mode === 'default' && !this.isFirstPage()) {
|
|
5019
|
+
this.handlePageClick(event, (this.currentPage || 1) - 1);
|
|
5020
|
+
}
|
|
5021
|
+
} }))) : (index.h("eds-link", { label: this.prevLabel, url: this.mode === 'navigator'
|
|
5022
|
+
? this.prevUrl || '#'
|
|
1862
5023
|
: this.isFirstPage()
|
|
1863
5024
|
? '#'
|
|
1864
|
-
: this.generateLink(this.currentPage - 1).url, disabled: this.mode === 'navigator'
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
if (this.isFirstPage()) {
|
|
1869
|
-
event.preventDefault(); // Prevent click if disabled
|
|
1870
|
-
}
|
|
1871
|
-
else {
|
|
1872
|
-
this.handlePageClick(event, (this.currentPage || 1) - 1);
|
|
1873
|
-
}
|
|
5025
|
+
: this.generateLink(this.currentPage - 1).url, disabled: this.mode === 'navigator' ? !this.prevUrl : this.isFirstPage(), "aria-label": "Go to previous page", icon: "chevron-left", "icon-pos": "left", size: "small", "icon-small": "true", intent: "strong", "hide-label-on-small-screen": true, class: "!p-8 lg:!pr-12" }))), this.mode === 'default' &&
|
|
5026
|
+
this.links.map((link, index$1) => (index.h("li", { key: index$1, class: "f-ui-02 flex h-36 items-center justify-center" }, typeof link === 'string' ? (index.h("span", { class: "flex items-center justify-center", "aria-hidden": "true" }, link)) : this.useButtons ? (index.h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, index.h("eds-button", { label: link.label, "aria-label": link.current ? `Current page, page ${link.label}` : `Go to page ${link.label}`, "aria-current": link.current ? 'page' : undefined, size: "small", "extra-class": "!p-8 pagination-button", intent: link.current ? 'secondary' : 'ghost', onClick: (event) => this.handlePageClick(event, parseInt(link.label)) }))) : (index.h("eds-link", { url: link.url, "aria-label": link.ariaLabel, label: link.label, current: link.current, "aria-current": link.current ? 'page' : undefined, size: "small", class: "!p-8", intent: link.current ? 'secondary' : 'ghost', onClick: (event) => this.handlePageClick(event, parseInt(link.label)) }))))), index.h("li", { class: "ml-auto" }, this.useButtons ? (index.h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, index.h("eds-button", { label: this.nextLabel, disabled: this.mode === 'navigator' ? !this.nextUrl : this.isLastPage(), "aria-label": "Go to next page", size: "small", "icon-small": "true", icon: "chevron-right", intent: "ghost", "extra-class": "!p-8 lg:!pl-12 pagination-button", onClick: (event) => {
|
|
5027
|
+
if (this.mode === 'default' && !this.isLastPage()) {
|
|
5028
|
+
this.handlePageClick(event, (this.currentPage || 1) + 1);
|
|
1874
5029
|
}
|
|
1875
|
-
} })), this.mode === '
|
|
1876
|
-
|
|
1877
|
-
? this.nextUrl || '#' // Use nextUrl if provided, otherwise disable with '#'
|
|
5030
|
+
} }))) : (index.h("eds-link", { label: this.nextLabel, url: this.mode === 'navigator'
|
|
5031
|
+
? this.nextUrl || '#'
|
|
1878
5032
|
: this.isLastPage()
|
|
1879
5033
|
? '#'
|
|
1880
|
-
: this.generateLink(this.currentPage + 1).url, disabled: this.mode === 'navigator'
|
|
1881
|
-
? !this.nextUrl // Disable if nextUrl is not provided
|
|
1882
|
-
: this.isLastPage(), "aria-label": "Next page", size: "small", "icon-small": "true", icon: "chevron-right", intent: "strong", "hide-label-on-small-screen": true, class: "!p-8 lg:!pl-12 flex items-center gap-1 py-4 transition-colors", onClick: (event) => {
|
|
1883
|
-
if (this.mode === 'default') {
|
|
1884
|
-
if (this.isLastPage()) {
|
|
1885
|
-
event.preventDefault(); // Prevent click if disabled
|
|
1886
|
-
}
|
|
1887
|
-
else {
|
|
1888
|
-
this.handlePageClick(event, (this.currentPage || 1) + 1);
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
} }))))) : null));
|
|
5034
|
+
: this.generateLink(this.currentPage + 1).url, disabled: this.mode === 'navigator' ? !this.nextUrl : this.isLastPage(), "aria-label": "Go to next page", size: "small", "icon-small": "true", icon: "chevron-right", intent: "strong", "hide-label-on-small-screen": true, class: "!p-8 lg:!pl-12 flex items-center gap-1 py-4 transition-colors" })))))) : null));
|
|
1892
5035
|
}
|
|
1893
5036
|
get hostEl() { return index.getElement(this); }
|
|
1894
5037
|
static get watchers() { return {
|
|
@@ -1905,6 +5048,7 @@ const EdsRating = class {
|
|
|
1905
5048
|
constructor(hostRef) {
|
|
1906
5049
|
index.registerInstance(this, hostRef);
|
|
1907
5050
|
this.rating = index.createEvent(this, "rating", 7);
|
|
5051
|
+
this.buttonRefs = [];
|
|
1908
5052
|
this.ratingType = 'star';
|
|
1909
5053
|
this.ratingCount = 5;
|
|
1910
5054
|
this.selectedRating = 0;
|
|
@@ -1938,16 +5082,37 @@ const EdsRating = class {
|
|
|
1938
5082
|
* Handles the click event on a star.
|
|
1939
5083
|
* @param rating - The selected rating value.
|
|
1940
5084
|
*/
|
|
1941
|
-
|
|
5085
|
+
onSelect(rating) {
|
|
1942
5086
|
this.selectedRating = rating;
|
|
1943
5087
|
this.rating.emit(rating);
|
|
5088
|
+
setTimeout(() => {
|
|
5089
|
+
const btn = this.buttonRefs[rating - 1];
|
|
5090
|
+
btn === null || btn === void 0 ? void 0 : btn.focus();
|
|
5091
|
+
}, 0);
|
|
5092
|
+
}
|
|
5093
|
+
handleKeyNav(e) {
|
|
5094
|
+
const { key } = e;
|
|
5095
|
+
if (!['ArrowRight', 'ArrowLeft', 'ArrowDown', 'ArrowUp'].includes(key)) {
|
|
5096
|
+
return;
|
|
5097
|
+
}
|
|
5098
|
+
e.preventDefault();
|
|
5099
|
+
const increment = key === 'ArrowRight' || key === 'ArrowDown' ? 1 : -1;
|
|
5100
|
+
let next = (this.selectedRating || 1) + increment;
|
|
5101
|
+
if (next > this.ratingCount) {
|
|
5102
|
+
next = 1;
|
|
5103
|
+
}
|
|
5104
|
+
if (next < 1) {
|
|
5105
|
+
next = this.ratingCount;
|
|
5106
|
+
}
|
|
5107
|
+
this.onSelect(next);
|
|
1944
5108
|
}
|
|
1945
5109
|
render() {
|
|
1946
|
-
return (index.h("div", { key: '
|
|
5110
|
+
return (index.h("div", { key: 'bd72970d86f2dbb21d58671fc85feea3011749b3', id: "rating-buttons", role: "radiogroup", "aria-labelledby": "rating", class: "stars flex space-x-1 my-8", onKeyDown: (e) => this.handleKeyNav(e) }, Array.from({ length: this.ratingCount }, (_, index$1) => {
|
|
1947
5111
|
const starRating = index$1 + 1;
|
|
1948
5112
|
const isSelected = starRating <= this.selectedRating;
|
|
1949
5113
|
// Use the mapping text if available; otherwise, fall back to a generic label.
|
|
1950
|
-
|
|
5114
|
+
const checked = this.selectedRating === starRating;
|
|
5115
|
+
return (index.h("eds-button", { ref: (el) => (this.buttonRefs[index$1] = el), icon: this.ratingType, role: "radio", "aria-checked": checked, "aria-label": `${starRating} ${this.ratingType}${starRating > 1 ? 's' : ''}`, onClick: () => this.onSelect(starRating), tabIndex: checked || (this.selectedRating === 0 && index$1 === 0) ? 0 : -1, intent: isSelected ? 'primary' : 'ghost', size: "large", "extra-class": "p-2" // Optional padding or styling for the star button
|
|
1951
5116
|
}));
|
|
1952
5117
|
})));
|
|
1953
5118
|
}
|
|
@@ -2135,6 +5300,66 @@ const EdsStepsV2 = class {
|
|
|
2135
5300
|
};
|
|
2136
5301
|
EdsStepsV2.style = EdsStepsV2Style0;
|
|
2137
5302
|
|
|
5303
|
+
const edsSwitchCss = ":host{display:inline-block}.switch-container{display:inline-flex;align-items:center}.switch-label{font-family:var(--f-ui-02-light-fontFamily);font-weight:var(--f-ui-02-light-fontWeight);font-size:var(--f-ui-02-light-fontSize);line-height:var(--f-ui-02-light-lineHeight);letter-spacing:var(--f-ui-02-light-letterSpacing)}button.switch{position:relative;display:inline-flex;align-items:center;width:50px;height:26px;border:none;border-radius:13px;background-color:#ccc;padding:0;cursor:pointer;transition:background-color 0.2s}button.switch.switch--checked{background-color:var(--green-500)}button.switch.switch--disabled{opacity:0.6;cursor:not-allowed}.switch-handle{position:absolute;width:22px;height:22px;border-radius:50%;background-color:#fff;top:2px;left:2px;transition:transform 0.2s}button.switch.switch--checked .switch-handle{transform:translateX(24px)}.ml-8{margin-left:0.5rem}.mr-8{margin-right:0.5rem}.switch:focus{outline:2px solid #005fcc;outline-offset:2px}.switch:focus:not(:focus-visible){outline:none}.switch:focus-visible{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}";
|
|
5304
|
+
const EdsSwitchStyle0 = edsSwitchCss;
|
|
5305
|
+
|
|
5306
|
+
const EdsSwitch = class {
|
|
5307
|
+
constructor(hostRef) {
|
|
5308
|
+
index.registerInstance(this, hostRef);
|
|
5309
|
+
this.uiswitch = index.createEvent(this, "uiswitch", 7);
|
|
5310
|
+
this.toggleSwitch = () => {
|
|
5311
|
+
if (this.disabled) {
|
|
5312
|
+
return;
|
|
5313
|
+
}
|
|
5314
|
+
this.checked = !this.checked;
|
|
5315
|
+
this.uiswitch.emit({ value: this.checked });
|
|
5316
|
+
analytics.sendAnalytics({
|
|
5317
|
+
category: 'ui-component',
|
|
5318
|
+
tag: this.el.tagName.toLowerCase(),
|
|
5319
|
+
name: this.checked ? this.labelOn : this.labelOff || '',
|
|
5320
|
+
action: 'checked'
|
|
5321
|
+
});
|
|
5322
|
+
};
|
|
5323
|
+
this.handleKeyDown = (e) => {
|
|
5324
|
+
if (this.disabled) {
|
|
5325
|
+
return;
|
|
5326
|
+
}
|
|
5327
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
5328
|
+
e.preventDefault();
|
|
5329
|
+
this.toggleSwitch();
|
|
5330
|
+
}
|
|
5331
|
+
};
|
|
5332
|
+
this.checked = false;
|
|
5333
|
+
this.disabled = false;
|
|
5334
|
+
this.labelOn = '';
|
|
5335
|
+
this.labelOff = '';
|
|
5336
|
+
}
|
|
5337
|
+
render() {
|
|
5338
|
+
const switchId = `switch-${Math.random().toString(36).substr(2, 9)}`;
|
|
5339
|
+
const labelledBy = [];
|
|
5340
|
+
if (this.labelOff) {
|
|
5341
|
+
labelledBy.push(`${switchId}-off`);
|
|
5342
|
+
}
|
|
5343
|
+
if (this.labelOn) {
|
|
5344
|
+
labelledBy.push(`${switchId}-on`);
|
|
5345
|
+
}
|
|
5346
|
+
const accessibleLabel = labelledBy.length === 0
|
|
5347
|
+
? this.labelOn || this.labelOff
|
|
5348
|
+
? this.checked
|
|
5349
|
+
? this.labelOn
|
|
5350
|
+
: this.labelOff
|
|
5351
|
+
: 'Toggle switch'
|
|
5352
|
+
: undefined;
|
|
5353
|
+
return (index.h("div", { key: 'f4c99a2ec360af6030de11698bab82833b3f415f', class: "switch-container" }, this.labelOff && (index.h("span", { key: '8bb8d063e744c194c0d44a0c371ae8224f9611cb', id: `${switchId}-off`, class: "switch-label switch-label--off mr-8" }, this.labelOff)), index.h("button", { key: 'ccc49c8ac6f639707c90822e24f3ae3ab8f2c26c', id: switchId, tabindex: this.disabled ? '-1' : '0', type: "button", role: "switch", "aria-checked": this.checked ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-labelledby": labelledBy.length > 0 ? labelledBy.join(' ') : undefined, "aria-label": accessibleLabel, class: {
|
|
5354
|
+
switch: true,
|
|
5355
|
+
'switch--checked': this.checked,
|
|
5356
|
+
'switch--disabled': this.disabled
|
|
5357
|
+
}, onClick: this.toggleSwitch, onKeyDown: this.handleKeyDown, disabled: this.disabled }, index.h("span", { key: '2275930bc9909c0a95c6c10e28f715fe1afe9294', class: "switch-handle" })), this.labelOn && (index.h("span", { key: 'd789fd15943c1fadf1f87c55059261eaf5e05a8f', id: `${switchId}-on`, class: "switch-label switch-label--on ml-8" }, this.labelOn))));
|
|
5358
|
+
}
|
|
5359
|
+
get el() { return index.getElement(this); }
|
|
5360
|
+
};
|
|
5361
|
+
EdsSwitch.style = EdsSwitchStyle0;
|
|
5362
|
+
|
|
2138
5363
|
const edsTableCss = "table{text-indent:0;border-color:inherit;border-collapse:collapse;}.container{width:calc(var(--container-width, 100%) - (2 * var(--breakout-container-outer-gutter, var(--container-outer-gutter, var(--outer-gutter, 0)))));margin-right:auto;margin-left:auto}.container>*{--container-outer-gutter:0;--breakout-container-outer-gutter:0}.pt-32{padding-top:2rem}.pt-40{padding-top:2.5rem}.pt-48{padding-top:3rem}.pb-28{padding-bottom:1.75rem}.pb-60{padding-bottom:3.75rem}.mt-20{margin-top:1.25rem}.mt-28{margin-top:1.75rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.overflow-x-auto{overflow-x:auto}.mt-6{margin-top:0.375rem}.p-0{padding:0rem}.m-0{margin:0rem}.border{border-width:1px}.border-softer{border:1px solid rgba(0, 0, 0, .1)}.even\\:bg-inverse-softer:nth-child(even){background-color:rgba(255, 255, 255, .15)}.px-8{padding-left:0.5rem;padding-right:0.5rem}.px-20{padding-left:1.25rem;padding-right:1.25rem}.py-8{padding-top:0.5rem;padding-bottom:0.5rem}.f-ui-01{font-family:var(--f-ui-01-fontFamily);font-weight:var(--f-ui-01-fontWeight);font-size:var(--f-ui-01-fontSize);line-height:var(--f-ui-01-lineHeight);letter-spacing:var(--f-ui-01-letterSpacing)}.f-ui-02{font-family:var(--f-ui-02-fontFamily);font-weight:var(--f-ui-02-fontWeight);font-size:var(--f-ui-02-fontSize);line-height:var(--f-ui-02-lineHeight);letter-spacing:var(--f-ui-02-letterSpacing)}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.text-center{text-align:center}.break-words{overflow-wrap:anywhere}";
|
|
2139
5364
|
const EdsTableStyle0 = edsTableCss;
|
|
2140
5365
|
|
|
@@ -2145,8 +5370,33 @@ const EdsTable = class {
|
|
|
2145
5370
|
this.handleResize = () => {
|
|
2146
5371
|
this.updateContainerWidth();
|
|
2147
5372
|
};
|
|
5373
|
+
this.onActionKeyDown = (e) => {
|
|
5374
|
+
var _a;
|
|
5375
|
+
if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') {
|
|
5376
|
+
return;
|
|
5377
|
+
}
|
|
5378
|
+
e.preventDefault();
|
|
5379
|
+
const currentButton = e.target;
|
|
5380
|
+
const toolbar = currentButton.closest('[role="toolbar"]');
|
|
5381
|
+
if (!toolbar) {
|
|
5382
|
+
return;
|
|
5383
|
+
}
|
|
5384
|
+
// Find all focusable action buttons in this row
|
|
5385
|
+
const actionButtons = Array.from(toolbar.querySelectorAll('eds-button'));
|
|
5386
|
+
const currentIndex = actionButtons.indexOf(currentButton);
|
|
5387
|
+
if (currentIndex === -1) {
|
|
5388
|
+
return;
|
|
5389
|
+
}
|
|
5390
|
+
let nextIndex;
|
|
5391
|
+
if (e.key === 'ArrowRight') {
|
|
5392
|
+
nextIndex = (currentIndex + 1) % actionButtons.length;
|
|
5393
|
+
}
|
|
5394
|
+
else {
|
|
5395
|
+
nextIndex = (currentIndex - 1 + actionButtons.length) % actionButtons.length;
|
|
5396
|
+
}
|
|
5397
|
+
(_a = actionButtons[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5398
|
+
};
|
|
2148
5399
|
this.data = null;
|
|
2149
|
-
this.endpoint = null;
|
|
2150
5400
|
this.config = {};
|
|
2151
5401
|
this.rowsPerPage = 10;
|
|
2152
5402
|
this.paginationEnabled = true;
|
|
@@ -2184,7 +5434,7 @@ const EdsTable = class {
|
|
|
2184
5434
|
componentWillLoad() {
|
|
2185
5435
|
this.parseConfig();
|
|
2186
5436
|
this.handleActionsChange();
|
|
2187
|
-
this.
|
|
5437
|
+
this.parseData();
|
|
2188
5438
|
}
|
|
2189
5439
|
componentDidLoad() {
|
|
2190
5440
|
this.updateContainerWidth();
|
|
@@ -2232,17 +5482,6 @@ const EdsTable = class {
|
|
|
2232
5482
|
this.parsedConfig = {};
|
|
2233
5483
|
}
|
|
2234
5484
|
}
|
|
2235
|
-
async fetchData() {
|
|
2236
|
-
try {
|
|
2237
|
-
const response = await fetch(this.endpoint);
|
|
2238
|
-
const data = await response.json();
|
|
2239
|
-
this.data = data;
|
|
2240
|
-
}
|
|
2241
|
-
catch (error) {
|
|
2242
|
-
// eslint-disable-next-line
|
|
2243
|
-
console.error('Failed to fetch data:', error);
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
5485
|
setupPaginationListener() {
|
|
2247
5486
|
if (!this.shouldEnablePagination()) {
|
|
2248
5487
|
return;
|
|
@@ -2297,7 +5536,8 @@ const EdsTable = class {
|
|
|
2297
5536
|
const checked = !!row[boundField];
|
|
2298
5537
|
return (index.h("eds-input-field", { name: `chc-${actionName}`, label: act.label, type: "checkbox", checked: checked, onChange: (e) => this.emitAction(act.name, row, e.target.checked) }));
|
|
2299
5538
|
}
|
|
2300
|
-
|
|
5539
|
+
// Let all action buttons be focusable naturally
|
|
5540
|
+
return (index.h("eds-button", { label: act.label, icon: act.icon, pill: true, size: "small", intent: "ghost", tabIndex: 0, onClick: () => this.emitAction(act.name, row) }));
|
|
2301
5541
|
}
|
|
2302
5542
|
emitAction(actionName, row, checked) {
|
|
2303
5543
|
analytics.sendAnalytics({
|
|
@@ -2343,7 +5583,7 @@ const EdsTable = class {
|
|
|
2343
5583
|
const columnWidth = visibleColumnsCount > 0 ? Math.floor((currentContainerWidth / visibleColumnsCount) * this.divisionFactor()) : 100;
|
|
2344
5584
|
const paginatedRows = this.getPaginatedRows();
|
|
2345
5585
|
const lastPage = Math.ceil(this.totalRows / this.rowsPerPage);
|
|
2346
|
-
return (index.h("div", { key: '
|
|
5586
|
+
return (index.h("div", { key: '87e7cc3c87618ede91bb51d7a07cd597a438d6c5' }, this.searchEnabled && (index.h("div", { key: '6b77700a913e272eef4c932d40c5c5d001ff6b5c' }, index.h("eds-input-field", { key: 1, name: "search", "aria-label": "Search", type: "text", placeholder: "Search...", onInput: (event) => this.handleSearch(event) }))), index.h("div", { key: '6f2ffc7a3ba2cc8e8194670a7ecb9e237f7dc60a', class: "mt-20" }, index.h("table", { key: '0227d3029f30ab9928cd01ba8dc2eccde2073f47', class: "block overflow-x-auto mt-6 p-0" }, index.h("thead", { key: 'c1f844d8413b596d5ca07d6b79ebd36c8a17f51f' }, index.h("tr", { key: 'caadaaf66314e3ea7d47a748b6e899389a7e2d55', class: "m-0 p-0 border border-softer even:bg-inverse-softer" }, this.columns.map((col) => {
|
|
2347
5587
|
var _a;
|
|
2348
5588
|
if (col === 'actions') {
|
|
2349
5589
|
return (index.h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }));
|
|
@@ -2352,17 +5592,22 @@ const EdsTable = class {
|
|
|
2352
5592
|
return (index.h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }, this.capitalize(col)));
|
|
2353
5593
|
}
|
|
2354
5594
|
return null;
|
|
2355
|
-
}))), index.h("tbody", { key: '
|
|
5595
|
+
}))), index.h("tbody", { key: 'da9286063f16a5c346ce8854361cb15573166a19' }, paginatedRows.map((row) => (index.h("tr", { class: "m-0 p-0 border border-softer even:bg-inverse-softer" }, this.columns.map((col) => {
|
|
2356
5596
|
var _a;
|
|
2357
5597
|
if (col === 'actions') {
|
|
2358
|
-
return (index.h("td", { class: "text-center border border-softer m-0 f-ui-02 break-words actions-cell", style: { minWidth: `${columnWidth - 4}px` } }, index.h("div", {
|
|
5598
|
+
return (index.h("td", { class: "text-center border border-softer m-0 f-ui-02 break-words actions-cell", style: { minWidth: `${columnWidth - 4}px` } }, index.h("div", { role: "toolbar", "aria-label": "Row actions", onKeyDown: this.onActionKeyDown, style: {
|
|
5599
|
+
display: 'flex',
|
|
5600
|
+
gap: '0.5rem',
|
|
5601
|
+
justifyContent: 'center',
|
|
5602
|
+
flexWrap: 'wrap'
|
|
5603
|
+
} }, this.parsedActions.map((act) => (index.h("span", { style: { whiteSpace: 'nowrap' } }, this.renderSingleActionCell(act.name, row)))))));
|
|
2359
5604
|
}
|
|
2360
5605
|
if (!((_a = this.parsedConfig[col]) === null || _a === void 0 ? void 0 : _a.hidden)) {
|
|
2361
5606
|
// Regular data cell
|
|
2362
5607
|
return (index.h("td", { class: "text-center border border-softer m-0 py-8 f-ui-2 break-words", style: { minWidth: `${columnWidth - 4}px` } }, this.renderCell(row[col], col)));
|
|
2363
5608
|
}
|
|
2364
5609
|
return null;
|
|
2365
|
-
}))))))), this.shouldEnablePagination() && (index.h("div", { key: '
|
|
5610
|
+
}))))))), this.shouldEnablePagination() && (index.h("div", { key: 'b7e7991225cf9fb16ca882dc42c7adead202aac5', class: "mt-20" }, index.h("eds-pagination", { key: '011f209f89300357e6052ee4d118f353419d5a45', currentPage: this.currentPage, lastPage: lastPage, perPage: this.rowsPerPage, total: this.totalRows, mode: "default" })))));
|
|
2366
5611
|
}
|
|
2367
5612
|
get hostEl() { return index.getElement(this); }
|
|
2368
5613
|
static get watchers() { return {
|
|
@@ -2373,22 +5618,27 @@ const EdsTable = class {
|
|
|
2373
5618
|
};
|
|
2374
5619
|
EdsTable.style = EdsTableStyle0;
|
|
2375
5620
|
|
|
2376
|
-
const edsTabsCss = "*,::before,::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(147 197 253 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor;}::before,::after{--tw-content:''}a{color:inherit;text-decoration:inherit}.relative{position:relative}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.whitespace-nowrap{white-space:nowrap}.effect-
|
|
5621
|
+
const edsTabsCss = "*,::before,::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(147 197 253 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor;}::before,::after{--tw-content:''}a{color:inherit;text-decoration:inherit}.relative{position:relative}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.whitespace-nowrap{white-space:nowrap}.effect-focus{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}.effect-focus:focus-visible{outline-style:solid}.effect-focus-within{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}.focus-visible\\:text-default:focus-visible{color:var(--black)}.hover\\:text-default:hover{color:var(--black)}.border-2{border-width:2px}.after\\:content-\\[\\'\\'\\]::after{--tw-content:'';content:var(--tw-content)}.after\\:bottom-0::after{bottom:0rem}.after\\:border-0::after{border-width:0px}.after\\:border-b-2::after{border-bottom-width:2px}.after\\:absolute::after{position:absolute}.after\\:inset-0::after{inset:0rem}.after\\:rounded-lg::after{border-radius:16px}.after\\:border-solid::after{border-style:solid}.after\\:border-3::after{border-width:3px}.after\\:border-accent::after{border-color:var(--green-500)}.after\\:opacity-0::after{opacity:0}.outline-none{outline:2px solid transparent;outline-offset:2px}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:after\\:opacity-100:focus-visible::after{opacity:1}.rounded-t-lg{border-top-left-radius:16px;border-top-right-radius:16px}.rounded-tl-lg{border-top-left-radius:16px}.rounded-tr-lg{border-top-right-radius:16px}.border-l-0{border-left-width:0px}.border-r-0{border-right-width:0px}.border-b-0{border-bottom-width:0px}.pr-28{padding-right:1.75rem}.pl-28{padding-left:1.75rem}.-mr-16{margin-right:-1rem}.-ml-16{margin-left:-1rem}.px-16{padding-left:1rem;padding-right:1rem}.py-12{padding-top:0.75rem;padding-bottom:0.75rem}.after\\:left-16::after{left:1rem}.after\\:right-16::after{right:1rem}.text-lighter{color:var(--grey-600)}.bg-dark{background-color:var(--grey-300)}.hover\\:bg-darker:hover{background-color:var(--grey-400)}.border-soft{border-color:var(--grey-400)}.border-softest{border-color:rgba(0, 0, 0, .05)}.bg-default{background-color:var(--grey-200)}.text-default{color:var(--black)}.z-99{z-index:99}.after\\:z-10::after{z-index:10}.before\\:bottom-0::before{bottom:0rem}.before\\:h-12::before{height:0.75rem}.before\\:opacity-5::before{opacity:0.05}.before\\:content-\\[\\'\\'\\]::before{--tw-content:'';content:var(--tw-content)}.before\\:absolute::before{position:absolute}.before\\:-bottom-2::before{bottom:-0.125rem}.after\\:inset-x-0::after{left:0rem;right:0rem}.before\\:inset-x-0::before{left:0rem;right:0rem}.before\\:h-3::before{height:0.1875rem}.before\\:bg-default::before{background-color:var(--grey-200)}.after\\:border-soft::after{border-color:rgba(0, 0, 0, .15 )}.after\\:border-softest::after{border-color:rgba(0, 0, 0, .05)}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.before\\:bg-gradient-y::before{background:linear-gradient(to bottom, transparent, ease-in-out, black)}.scroller-x{-ms-overflow-style:none;scrollbar-width:none}.overflow-x-auto{overflow-x:auto}.max-w-xxxl{max-width:2200px}.z-1{z-index:1}.mx-auto{margin-left:auto;margin-right:auto}.pt-8{padding-top:0.5rem}.pr-16{padding-right:1rem}.pl-16{padding-left:1rem}.inline-flex{display:inline-flex}@media (min-width: 900px){.lg\\:px-28{padding-left:1.75rem;padding-right:1.75rem}}@media (min-width: 2200px){.xxxl\\:px-0{padding-left:0rem;padding-right:0rem}}";
|
|
2377
5622
|
const EdsTabsStyle0 = edsTabsCss;
|
|
2378
5623
|
|
|
2379
5624
|
const EdsTabs = class {
|
|
2380
5625
|
constructor(hostRef) {
|
|
2381
5626
|
index.registerInstance(this, hostRef);
|
|
2382
5627
|
this.tab = index.createEvent(this, "tab", 7);
|
|
5628
|
+
this.tabRefs = [];
|
|
5629
|
+
// Store tab reference
|
|
5630
|
+
this.setTabRef = (el, index) => {
|
|
5631
|
+
if (el) {
|
|
5632
|
+
this.tabRefs[index] = el;
|
|
5633
|
+
}
|
|
5634
|
+
};
|
|
2383
5635
|
// cva configuration
|
|
2384
5636
|
this.tabCva = index$1.cva([
|
|
2385
5637
|
'relative py-12',
|
|
2386
5638
|
'f-ui-03 whitespace-nowrap',
|
|
2387
|
-
'effect-color',
|
|
5639
|
+
'effect-color effect-focus',
|
|
2388
5640
|
'focus-visible:text-default hover:text-default',
|
|
2389
|
-
'border-2'
|
|
2390
|
-
"after:content-[''] after:absolute after:inset-0 after:rounded-t-lg after:opacity-0",
|
|
2391
|
-
'outline-none focus:outline-none focus-visible:outline-none focus-visible:after:opacity-100'
|
|
5641
|
+
'border-2'
|
|
2392
5642
|
], {
|
|
2393
5643
|
variants: {
|
|
2394
5644
|
position: {
|
|
@@ -2398,7 +5648,10 @@ const EdsTabs = class {
|
|
|
2398
5648
|
right: 'pl-28 pr-16 rounded-tr-lg border-l-0 -ml-16 after:left-16'
|
|
2399
5649
|
},
|
|
2400
5650
|
active: {
|
|
2401
|
-
false:
|
|
5651
|
+
false: [
|
|
5652
|
+
'text-lighter bg-dark hover:bg-darker border-softest border-b-0 z-1',
|
|
5653
|
+
"after:content-[''] after:absolute after:bottom-0 after:inset-x-0 after:h-2 after:border-soft"
|
|
5654
|
+
],
|
|
2402
5655
|
true: [
|
|
2403
5656
|
'bg-default text-default z-99',
|
|
2404
5657
|
'rounded-t-lg',
|
|
@@ -2417,28 +5670,35 @@ const EdsTabs = class {
|
|
|
2417
5670
|
componentWillLoad() {
|
|
2418
5671
|
this.parseTabs();
|
|
2419
5672
|
this.setActiveIndex();
|
|
2420
|
-
this.tab.emit({ tabId: this.identifier, index:
|
|
5673
|
+
this.tab.emit({ tabId: this.identifier, index: this.activeIndex });
|
|
2421
5674
|
}
|
|
2422
5675
|
/**
|
|
2423
|
-
* Parses the `
|
|
2424
|
-
* Returns an empty array if parsing fails or if `
|
|
2425
|
-
*
|
|
2426
|
-
* @returns {any[]} Array of parsed link objects
|
|
2427
|
-
*/
|
|
2428
|
-
/**
|
|
2429
|
-
* Parses the `links` prop into an array of link objects.
|
|
2430
|
-
* Returns an empty array if parsing fails or if `links` is not a valid JSON string or object.
|
|
5676
|
+
* Parses the `tabs` prop into an array of tab objects.
|
|
5677
|
+
* Returns an empty array if parsing fails or if `tabs` is not a valid JSON string or object.
|
|
2431
5678
|
*
|
|
2432
|
-
* @returns {any[]} Array of parsed
|
|
5679
|
+
* @returns {any[]} Array of parsed tab objects
|
|
2433
5680
|
*/
|
|
2434
5681
|
parseTabs() {
|
|
2435
5682
|
this.parsedTabs = sharedUtils.parseData(this.tabs);
|
|
5683
|
+
// Reset tab refs when tabs change
|
|
5684
|
+
this.tabRefs = [];
|
|
2436
5685
|
}
|
|
2437
5686
|
componentDidLoad() {
|
|
2438
5687
|
this.scrollToActiveTab();
|
|
2439
5688
|
}
|
|
5689
|
+
componentDidUpdate() {
|
|
5690
|
+
// Ensure we have the correct number of tab refs after render
|
|
5691
|
+
if (this.tabRefs.length !== this.parsedTabs.length) {
|
|
5692
|
+
this.tabRefs = new Array(this.parsedTabs.length).fill(null);
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
2440
5695
|
setActiveIndex() {
|
|
2441
5696
|
this.activeIndex = this.parsedTabs.findIndex((tab) => tab.active);
|
|
5697
|
+
// If no active tab found, default to first tab
|
|
5698
|
+
if (this.activeIndex === -1 && this.parsedTabs.length > 0) {
|
|
5699
|
+
this.activeIndex = 0;
|
|
5700
|
+
this.parsedTabs[0].active = true;
|
|
5701
|
+
}
|
|
2442
5702
|
}
|
|
2443
5703
|
scrollToActiveTab() {
|
|
2444
5704
|
var _a;
|
|
@@ -2460,31 +5720,74 @@ const EdsTabs = class {
|
|
|
2460
5720
|
: index < this.activeIndex
|
|
2461
5721
|
? 'left'
|
|
2462
5722
|
: 'right';
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
5723
|
+
const rawZ = position === 'left' ? index : this.parsedTabs.length + 1 - index;
|
|
5724
|
+
// clamp inactive to at least 1
|
|
5725
|
+
const z = active ? this.parsedTabs.length + 99 : Math.max(rawZ, 1);
|
|
5726
|
+
return Object.assign({ class: this.tabCva({ active, position }), style: {
|
|
5727
|
+
// stringify the number so it matches { [key: string]: string }
|
|
5728
|
+
zIndex: `${z}`
|
|
2468
5729
|
} }, (active ? { 'data-tab-active': 'true' } : {}));
|
|
2469
5730
|
}
|
|
2470
|
-
handleTabClick(index, tabLabel) {
|
|
5731
|
+
handleTabClick(index, tabLabel, shouldFocus = true) {
|
|
5732
|
+
// Validate index
|
|
5733
|
+
if (index < 0 || index >= this.parsedTabs.length) {
|
|
5734
|
+
return;
|
|
5735
|
+
}
|
|
2471
5736
|
// Update the active index and set all tabs' active state accordingly
|
|
2472
5737
|
this.activeIndex = index;
|
|
2473
5738
|
this.parsedTabs = this.parsedTabs.map((tab, tabIndex) => (Object.assign(Object.assign({}, tab), { active: tabIndex === index })));
|
|
2474
5739
|
this.tab.emit({ tabId: this.identifier, index: index, name: tabLabel });
|
|
2475
|
-
analytics
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
5740
|
+
// Only send analytics for actual clicks, not keyboard navigation
|
|
5741
|
+
if (shouldFocus) {
|
|
5742
|
+
analytics.sendAnalytics({
|
|
5743
|
+
category: 'ui-component',
|
|
5744
|
+
tag: this.el.tagName.toLowerCase(),
|
|
5745
|
+
name: (tabLabel === null || tabLabel === void 0 ? void 0 : tabLabel.toLowerCase()) || '',
|
|
5746
|
+
action: 'click'
|
|
5747
|
+
});
|
|
5748
|
+
}
|
|
5749
|
+
// Focus management for keyboard navigation
|
|
5750
|
+
if (shouldFocus && this.tabRefs[index]) {
|
|
5751
|
+
// Use a small timeout to ensure the DOM has updated
|
|
5752
|
+
setTimeout(() => {
|
|
5753
|
+
var _a;
|
|
5754
|
+
(_a = this.tabRefs[index]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5755
|
+
}, 0);
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
onKeyDown(ev, idx) {
|
|
5759
|
+
let newIndex = idx;
|
|
5760
|
+
switch (ev.key) {
|
|
5761
|
+
case 'ArrowRight':
|
|
5762
|
+
newIndex = (idx + 1) % this.parsedTabs.length;
|
|
5763
|
+
ev.preventDefault();
|
|
5764
|
+
break;
|
|
5765
|
+
case 'ArrowLeft':
|
|
5766
|
+
newIndex = (idx - 1 + this.parsedTabs.length) % this.parsedTabs.length;
|
|
5767
|
+
ev.preventDefault();
|
|
5768
|
+
break;
|
|
5769
|
+
case 'Home':
|
|
5770
|
+
newIndex = 0;
|
|
5771
|
+
ev.preventDefault();
|
|
5772
|
+
break;
|
|
5773
|
+
case 'End':
|
|
5774
|
+
newIndex = this.parsedTabs.length - 1;
|
|
5775
|
+
ev.preventDefault();
|
|
5776
|
+
break;
|
|
5777
|
+
default:
|
|
5778
|
+
return; // Don't handle other keys
|
|
5779
|
+
}
|
|
5780
|
+
if (newIndex !== idx) {
|
|
5781
|
+
this.handleTabClick(newIndex, this.parsedTabs[newIndex].label, true);
|
|
5782
|
+
}
|
|
2481
5783
|
}
|
|
2482
5784
|
render() {
|
|
2483
|
-
return (index.h("div", { key: '
|
|
2484
|
-
const TabComponent =
|
|
5785
|
+
return (index.h("div", { key: 'e3bd802f08f460d5f3e89860669fefe2a8006e59', id: `${this.identifier}` }, index.h("div", { key: 'bcbd4afb8febec0520075c8e34269f184e2d9738', class: "scroller-x overflow-x-auto relative z-[1] mx-auto px-16 pt-8 lg:px-28 after:border-soft before:bg-gradient-y relative overflow-x-hidden before:absolute before:inset-x-0 before:bottom-0 before:h-12 before:opacity-5 before:content-[''] after:absolute after:inset-x-0 after:bottom-0 after:border-b-2 after:content-['']" }, index.h("nav", { key: '32e93b3ee6831918fd863fb23f1a5af1ae979201', role: "tablist", ref: (el) => (this.tabContainer = el), class: "inline-flex", "aria-label": this.navAriaLabel }, this.parsedTabs.map((tab, index$1) => {
|
|
5786
|
+
const TabComponent = 'button';
|
|
2485
5787
|
const tabProps = this.getTabOptions(tab.active, index$1);
|
|
2486
|
-
|
|
2487
|
-
|
|
5788
|
+
const isActive = index$1 === this.activeIndex;
|
|
5789
|
+
return (index.h(TabComponent, Object.assign({}, tabProps, { type: "button", role: "tab", "aria-selected": tab.active ? 'true' : 'false', tabIndex: isActive ? 0 : -1, "aria-label": tab.ariaLabel || tab.label, "aria-controls": `panel-${index$1}`, id: `tab-${index$1}`, ref: (el) => this.setTabRef(el, index$1), onClick: () => this.handleTabClick(index$1, tab.label, true), onKeyDown: (e) => this.onKeyDown(e, index$1) }), tab.label || tab.ariaLabel));
|
|
5790
|
+
}))), index.h("div", { key: 'ffe610574d342933121cbaca9bcb8fb483fde60b', class: "tab-panels" }, this.parsedTabs.map((_, index$1) => (index.h("div", { role: "tabpanel", id: `panel-${index$1}`, "aria-labelledby": `tab-${index$1}`, hidden: index$1 !== this.activeIndex, tabIndex: index$1 === this.activeIndex ? 0 : -1, class: "effect-focus" }, index.h("slot", { name: `panel-${index$1}` })))))));
|
|
2488
5791
|
}
|
|
2489
5792
|
get el() { return index.getElement(this); }
|
|
2490
5793
|
static get watchers() { return {
|
|
@@ -2529,7 +5832,7 @@ const EdsTag = class {
|
|
|
2529
5832
|
}
|
|
2530
5833
|
render() {
|
|
2531
5834
|
const classes = tagStyles({ intent: this.intent, size: this.size });
|
|
2532
|
-
return index.h("span", { key: '
|
|
5835
|
+
return index.h("span", { key: '939fafa4bc525b747956931f49b27e6125ecbb34', class: classes }, this.label);
|
|
2533
5836
|
}
|
|
2534
5837
|
};
|
|
2535
5838
|
EdsTag.style = EdsTagStyle0;
|
|
@@ -2637,15 +5940,19 @@ const EdsUser = class {
|
|
|
2637
5940
|
}
|
|
2638
5941
|
render() {
|
|
2639
5942
|
const user = this.parsedUser;
|
|
2640
|
-
return (index.h("div", { key: '
|
|
5943
|
+
return (index.h("div", { key: '8a1f10cc85d8e2707042c85bc597b76fb2d25da4', class: "block" }, index.h("div", { key: 'a744de3d113920b8ff0d01ce273672b2bff57c97', class: "flex items-center" }, index.h("eds-dropdown", { key: 'e9230372d79936a785050ebb3e41f40e73282a57', label: `Hi, ${user.preferred_username}`, intent: "tertiary", "aria-label": "User Menu", "dropdown-pos": "right", "dropdown-offset": "false", icon: "chevron-down", class: "text-default" }, index.h("div", { key: '7d4bd0ee0985c840a18764cac784726ff1c987fb', class: "min-w-[280px] p-8" }, index.h("div", { key: '603d6807988dd79cd4e7827918ff8932d8463fc3', class: "flex gap-x-16" }, index.h("eds-avatar", { key: '65ba89139cb6e3b6cb90c2072eb68cc7dc1da49c', "first-name": user.given_name, "last-name": user.family_name, initials: this.initials, color: "grey" }), index.h("div", { key: 'df35b758918ebccbdfe6630bd356e647522404e1', class: "max-w-full" }, user.name && index.h("p", { key: '7174f34445bb1a0b77a3c1b893421bd104832485', class: "f-ui-01 text-default w-full text-ellipsis" }, user.name), user.preferred_username && index.h("p", { key: '72d853f5014c03803dce7aa0a74d96847ed8c875', class: "f-ui-03-light text-light mt-4" }, user.preferred_username), user.email && index.h("p", { key: 'e406e2f3ca8504220ee9586a1d176c15c7236502', class: "f-ui-03-light text-light mt-4" }, user.email))), index.h("div", { key: '8fd3b42ab4eb3d1d70a0b827e3a03af8503c55d1', class: "text-default flex w-full flex-col gap-y-8" }, index.h("slot", { key: '6a477155c256543b7793947d52feb3f5abb0df6e' })))))));
|
|
2641
5944
|
}
|
|
2642
5945
|
get hostEl() { return index.getElement(this); }
|
|
2643
5946
|
};
|
|
2644
5947
|
EdsUser.style = EdsUserStyle0;
|
|
2645
5948
|
|
|
5949
|
+
exports.eds_accordion = EdsAccordion;
|
|
5950
|
+
exports.eds_alert = EdsAlert;
|
|
2646
5951
|
exports.eds_avatar = EdsAvatar;
|
|
2647
5952
|
exports.eds_block_break = EdsBlockBreak;
|
|
5953
|
+
exports.eds_breadcrumb = EdsBreadcrumb;
|
|
2648
5954
|
exports.eds_button = EdsButton;
|
|
5955
|
+
exports.eds_code_block = EdsCodeBlock;
|
|
2649
5956
|
exports.eds_dropdown = EdsDropdown;
|
|
2650
5957
|
exports.eds_form = EdsForm;
|
|
2651
5958
|
exports.eds_header = EdsHeader;
|
|
@@ -2660,10 +5967,13 @@ exports.eds_input_search = EdsInputSearch;
|
|
|
2660
5967
|
exports.eds_input_select = EdsInputSelect;
|
|
2661
5968
|
exports.eds_link = EdsLink;
|
|
2662
5969
|
exports.eds_logo = EdsLogo;
|
|
5970
|
+
exports.eds_matomo_notice = EdsMatomoNotice;
|
|
5971
|
+
exports.eds_nps = EdsNps;
|
|
2663
5972
|
exports.eds_pagination = EdsPagination;
|
|
2664
5973
|
exports.eds_rating = EdsRating;
|
|
2665
5974
|
exports.eds_steps = EdsSteps;
|
|
2666
5975
|
exports.eds_steps_v2 = EdsStepsV2;
|
|
5976
|
+
exports.eds_switch = EdsSwitch;
|
|
2667
5977
|
exports.eds_table = EdsTable;
|
|
2668
5978
|
exports.eds_tabs = EdsTabs;
|
|
2669
5979
|
exports.eds_tag = EdsTag;
|