@nldd/design-system 0.8.93 → 0.8.95
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/NOTICES.md +21 -1
- package/README.md +111 -15
- package/custom-elements.json +584 -121
- package/dist/components/actions/button/button.d.ts +8 -5
- package/dist/components/actions/button/button.d.ts.map +1 -1
- package/dist/components/actions/button/button.js +11 -5
- package/dist/components/actions/button/button.js.map +1 -1
- package/dist/components/actions/button/button.styles.d.ts.map +1 -1
- package/dist/components/actions/button/button.styles.js +41 -73
- package/dist/components/actions/button/button.styles.js.map +1 -1
- package/dist/components/actions/button/button.template.d.ts.map +1 -1
- package/dist/components/actions/button/button.template.js +1 -0
- package/dist/components/actions/button/button.template.js.map +1 -1
- package/dist/components/actions/button-bar/button-bar.d.ts +11 -4
- package/dist/components/actions/button-bar/button-bar.d.ts.map +1 -1
- package/dist/components/actions/button-bar/button-bar.js +25 -9
- package/dist/components/actions/button-bar/button-bar.js.map +1 -1
- package/dist/components/actions/button-bar/button-bar.styles.d.ts.map +1 -1
- package/dist/components/actions/button-bar/button-bar.styles.js +18 -3
- package/dist/components/actions/button-bar/button-bar.styles.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.d.ts +8 -5
- package/dist/components/actions/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.js +11 -5
- package/dist/components/actions/icon-button/icon-button.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.styles.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.styles.js +35 -61
- package/dist/components/actions/icon-button/icon-button.styles.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.template.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.template.js +1 -0
- package/dist/components/actions/icon-button/icon-button.template.js.map +1 -1
- package/dist/components/actions/menu/menu.d.ts +17 -2
- package/dist/components/actions/menu/menu.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.js +34 -11
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/menu/menu.template.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.template.js +5 -3
- package/dist/components/actions/menu/menu.template.js.map +1 -1
- package/dist/components/actions/split-button/split-button.d.ts +2 -2
- package/dist/components/actions/split-button/split-button.d.ts.map +1 -1
- package/dist/components/actions/split-button/split-button.js +5 -4
- package/dist/components/actions/split-button/split-button.js.map +1 -1
- package/dist/components/actions/split-button/split-button.styles.d.ts.map +1 -1
- package/dist/components/actions/split-button/split-button.styles.js +18 -3
- package/dist/components/actions/split-button/split-button.styles.js.map +1 -1
- package/dist/components/actions/split-button/split-button.template.js +2 -2
- package/dist/components/actions/split-button/split-button.template.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.d.ts +3 -1
- package/dist/components/actions/toolbar/toolbar.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.js +21 -10
- package/dist/components/actions/toolbar/toolbar.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.styles.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.styles.js +3 -2
- package/dist/components/actions/toolbar/toolbar.styles.js.map +1 -1
- package/dist/components/components.js +1446 -729
- package/dist/components/content/avatar/avatar.js +1 -1
- package/dist/components/content/avatar/avatar.js.map +1 -1
- package/dist/components/content/blockquote/blockquote.styles.d.ts.map +1 -1
- package/dist/components/content/blockquote/blockquote.styles.js +1 -0
- package/dist/components/content/blockquote/blockquote.styles.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.d.ts +2 -2
- package/dist/components/content/code-viewer/code-viewer.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.js +10 -6
- package/dist/components/content/code-viewer/code-viewer.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.styles.js +6 -6
- package/dist/components/content/image/image.d.ts.map +1 -1
- package/dist/components/content/image/image.js +2 -1
- package/dist/components/content/image/image.js.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.d.ts +3 -3
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.d.ts.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.js +3 -3
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.styles.js +7 -7
- package/dist/components/content/rich-text/rich-text.d.ts +2 -0
- package/dist/components/content/rich-text/rich-text.d.ts.map +1 -1
- package/dist/components/content/rich-text/rich-text.js +8 -1
- package/dist/components/content/rich-text/rich-text.js.map +1 -1
- package/dist/components/content/text/text.styles.d.ts.map +1 -1
- package/dist/components/content/text/text.styles.js +1 -0
- package/dist/components/content/text/text.styles.js.map +1 -1
- package/dist/components/content/token/token.d.ts.map +1 -1
- package/dist/components/content/token/token.js +2 -1
- package/dist/components/content/token/token.js.map +1 -1
- package/dist/components/content/token/token.template.js +2 -2
- package/dist/components/{decorate-lwt_OrAG.js → decorate-CO88j7Lc.js} +1 -1
- package/dist/components/{dist-M6GKopqu.js → dist-BWEAw34D.js} +1 -1
- package/dist/components/{dist-OlffRM7-.js → dist-BWRYv3Mp.js} +1 -1
- package/dist/components/{dist-CSYXsT7W.js → dist-Bi4EHsFY.js} +2 -2
- package/dist/components/{dist-B5ie2Bo9.js → dist-C3uWRipu.js} +1 -1
- package/dist/components/{dist-CoUVHSu-.js → dist-CH9m014O.js} +1 -1
- package/dist/components/{dist-Dn3c5gfb.js → dist-CpW8MF-L.js} +42 -27
- package/dist/components/{dist-RPaf2J9c.js → dist-CvL6_ezZ.js} +2 -2
- package/dist/components/{dist-CGOykrJw.js → dist-DMHTTJRJ.js} +2 -2
- package/dist/components/{dist-BUu-NW5O.js → dist-DTOshgo1.js} +1 -1
- package/dist/components/{dist-Dxn9Up8K.js → dist-DV6Mp5N1.js} +3 -3
- package/dist/components/{dist-CQzaKTa8.js → dist-PlhQXXtE.js} +1 -1
- package/dist/components/forms/form-actions/form-actions.d.ts +1 -1
- package/dist/components/forms/form-actions/form-actions.js +1 -1
- package/dist/components/{icon-DWNVcttg.js → icon-Typdp4av.js} +1 -1
- package/dist/components/{icon-button-hO6k8W63.js → icon-button-9mo3oIyL.js} +50 -72
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.d.ts +5 -5
- package/dist/components/inputs/code-editor/code-editor.d.ts.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.js +5 -5
- package/dist/components/inputs/code-editor/code-editor.js.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.styles.js +3 -3
- package/dist/components/inputs/combo-box/combo-box.d.ts +43 -2
- package/dist/components/inputs/combo-box/combo-box.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.js +115 -40
- package/dist/components/inputs/combo-box/combo-box.js.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.template.js +2 -2
- package/dist/components/inputs/date-field/date-field.d.ts.map +1 -1
- package/dist/components/inputs/date-field/date-field.js +2 -1
- package/dist/components/inputs/date-field/date-field.js.map +1 -1
- package/dist/components/inputs/date-field/date-field.template.js +1 -1
- package/dist/components/inputs/date-picker/date-picker.template.js +2 -2
- package/dist/components/inputs/date-picker/date-picker.template.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.d.ts +0 -2
- package/dist/components/inputs/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.js +1 -13
- package/dist/components/inputs/dropdown/dropdown.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.styles.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.styles.js +24 -12
- package/dist/components/inputs/dropdown/dropdown.styles.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.template.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.template.js +0 -1
- package/dist/components/inputs/dropdown/dropdown.template.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.d.ts.map +1 -1
- package/dist/components/inputs/file-field/file-field.js +2 -7
- package/dist/components/inputs/file-field/file-field.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.template.js +2 -2
- package/dist/components/inputs/number-field/number-field.d.ts.map +1 -1
- package/dist/components/inputs/number-field/number-field.js +2 -1
- package/dist/components/inputs/number-field/number-field.js.map +1 -1
- package/dist/components/inputs/number-field/number-field.template.js +2 -2
- package/dist/components/inputs/search-field/search-field.d.ts.map +1 -1
- package/dist/components/inputs/search-field/search-field.js +2 -1
- package/dist/components/inputs/search-field/search-field.js.map +1 -1
- package/dist/components/inputs/search-field/search-field.template.js +2 -2
- package/dist/components/inputs/segmented-control/segmented-control.d.ts +6 -0
- package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.js +13 -0
- package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.styles.d.ts.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.styles.js +54 -16
- package/dist/components/inputs/segmented-control/segmented-control.styles.js.map +1 -1
- package/dist/components/inputs/stepper/stepper.d.ts.map +1 -1
- package/dist/components/inputs/stepper/stepper.js +2 -1
- package/dist/components/inputs/stepper/stepper.js.map +1 -1
- package/dist/components/inputs/stepper/stepper.template.js +2 -2
- package/dist/components/inputs/text-editor/text-editor.annotations.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.annotations.js +6 -4
- package/dist/components/inputs/text-editor/text-editor.annotations.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.d.ts +27 -64
- package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.i18n.d.ts +2 -0
- package/dist/components/inputs/text-editor/text-editor.i18n.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.i18n.js +5 -0
- package/dist/components/inputs/text-editor/text-editor.i18n.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.js +87 -20
- package/dist/components/inputs/text-editor/text-editor.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.labels.d.ts +4 -0
- package/dist/components/inputs/text-editor/text-editor.labels.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.labels.js +5 -0
- package/dist/components/inputs/text-editor/text-editor.labels.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.links.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.links.js +6 -4
- package/dist/components/inputs/text-editor/text-editor.links.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.js +5 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts +27 -3
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.mentions.js +144 -25
- package/dist/components/inputs/text-editor/text-editor.mentions.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.spellcheck.d.ts +11 -0
- package/dist/components/inputs/text-editor/text-editor.spellcheck.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.spellcheck.js +134 -0
- package/dist/components/inputs/text-editor/text-editor.spellcheck.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.styles.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.styles.js +9 -3
- package/dist/components/inputs/text-editor/text-editor.styles.js.map +1 -1
- package/dist/components/inputs/time-field/time-field.d.ts.map +1 -1
- package/dist/components/inputs/time-field/time-field.js +2 -1
- package/dist/components/inputs/time-field/time-field.js.map +1 -1
- package/dist/components/inputs/time-field/time-field.template.js +2 -2
- package/dist/components/inputs/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/inputs/time-picker/time-picker.js +2 -1
- package/dist/components/inputs/time-picker/time-picker.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.d.ts +12 -0
- package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.js +17 -0
- package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.styles.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.styles.js +99 -12
- package/dist/components/inputs/toggle-button/toggle-button.styles.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.template.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.template.js +3 -2
- package/dist/components/inputs/toggle-button/toggle-button.template.js.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts +4 -2
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js +8 -2
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js.map +1 -1
- package/dist/components/inputs/token-field/token-field.d.ts +26 -1
- package/dist/components/inputs/token-field/token-field.d.ts.map +1 -1
- package/dist/components/inputs/token-field/token-field.js +59 -6
- package/dist/components/inputs/token-field/token-field.js.map +1 -1
- package/dist/components/inputs/token-field/token-field.template.js +1 -1
- package/dist/components/layout/card/card.d.ts +3 -0
- package/dist/components/layout/card/card.d.ts.map +1 -1
- package/dist/components/layout/card/card.js +3 -0
- package/dist/components/layout/card/card.js.map +1 -1
- package/dist/components/layout/card/card.styles.d.ts.map +1 -1
- package/dist/components/layout/card/card.styles.js +22 -2
- package/dist/components/layout/card/card.styles.js.map +1 -1
- package/dist/components/layout/collection/collection.d.ts.map +1 -1
- package/dist/components/layout/collection/collection.js +2 -1
- package/dist/components/layout/collection/collection.js.map +1 -1
- package/dist/components/layout/collection/collection.template.js +1 -1
- package/dist/components/layout/page-footer/page-footer.d.ts +0 -2
- package/dist/components/layout/page-footer/page-footer.d.ts.map +1 -1
- package/dist/components/layout/page-footer/page-footer.js +4 -19
- package/dist/components/layout/page-footer/page-footer.js.map +1 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.d.ts.map +1 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.js +2 -1
- package/dist/components/layout/page-sections/sidebar-section/sidebar-section.js.map +1 -1
- package/dist/components/layout/popover/popover.d.ts.map +1 -1
- package/dist/components/layout/popover/popover.js +2 -1
- package/dist/components/layout/popover/popover.js.map +1 -1
- package/dist/components/layout/window/window.d.ts.map +1 -1
- package/dist/components/layout/window/window.js +2 -1
- package/dist/components/layout/window/window.js.map +1 -1
- package/dist/components/lists-and-tables/cells/drag-handle-cell/drag-handle-cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/drag-handle-cell/drag-handle-cell.js +2 -1
- package/dist/components/lists-and-tables/cells/drag-handle-cell/drag-handle-cell.js.map +1 -1
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.d.ts +7 -7
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.js +9 -9
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.js.map +1 -1
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.styles.js +5 -5
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.template.js +1 -1
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.template.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.d.ts +11 -8
- package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.js +31 -31
- package/dist/components/lists-and-tables/list/list.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.styles.js +5 -5
- package/dist/components/lists-and-tables/list/list.template.js +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.d.ts +4 -4
- package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.js +10 -10
- package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
- package/dist/components/lists-and-tables/table/table.d.ts +2 -0
- package/dist/components/lists-and-tables/table/table.d.ts.map +1 -1
- package/dist/components/lists-and-tables/table/table.js +10 -7
- package/dist/components/lists-and-tables/table/table.js.map +1 -1
- package/dist/components/navigation/breadcrumbs/breadcrumbs.d.ts +0 -2
- package/dist/components/navigation/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/dist/components/navigation/breadcrumbs/breadcrumbs.js +4 -19
- package/dist/components/navigation/breadcrumbs/breadcrumbs.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.js +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.d.ts +0 -3
- package/dist/components/navigation/pagination/pagination.d.ts.map +1 -1
- package/dist/components/navigation/pagination/pagination.js +2 -13
- package/dist/components/navigation/pagination/pagination.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.template.js +2 -2
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts +12 -0
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js +37 -2
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.d.ts.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js +62 -3
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.styles.js.map +1 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.template.js +3 -3
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.d.ts.map +1 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.js +2 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.js.map +1 -1
- package/dist/components/status-and-feedback/banner/banner.d.ts.map +1 -1
- package/dist/components/status-and-feedback/banner/banner.js +2 -1
- package/dist/components/status-and-feedback/banner/banner.js.map +1 -1
- package/dist/components/status-and-feedback/banner/banner.template.js +1 -1
- package/dist/components/status-and-feedback/just-in-time-education/just-in-time-education.template.js +1 -1
- package/dist/components/status-and-feedback/notification/notification.template.js +1 -1
- package/dist/components/status-and-feedback/progress-bar/progress-bar.d.ts +4 -4
- package/dist/components/status-and-feedback/progress-bar/progress-bar.d.ts.map +1 -1
- package/dist/components/status-and-feedback/progress-bar/progress-bar.js +11 -10
- package/dist/components/status-and-feedback/progress-bar/progress-bar.js.map +1 -1
- package/dist/components/status-and-feedback/progress-bar/progress-bar.styles.js +6 -6
- package/dist/components/status-and-feedback/progress-bar/progress-bar.template.js +1 -1
- package/dist/components/status-and-feedback/progress-bar/progress-bar.template.js.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.d.ts +6 -4
- package/dist/components/status-and-feedback/progress-circle/progress-circle.d.ts.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.js +16 -13
- package/dist/components/status-and-feedback/progress-circle/progress-circle.js.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.styles.js +3 -3
- package/dist/components/status-and-feedback/step-indicator/step-indicator.d.ts +37 -22
- package/dist/components/status-and-feedback/step-indicator/step-indicator.d.ts.map +1 -1
- package/dist/components/status-and-feedback/step-indicator/step-indicator.js +63 -31
- package/dist/components/status-and-feedback/step-indicator/step-indicator.js.map +1 -1
- package/dist/components/{visibility-mixin-BU1vIMW7.js → visibility-mixin-Crbt8PFP.js} +1 -1
- package/dist/components/with-translations-C8_0-9y8.js +97 -0
- package/dist/css/document-reset.css +7 -0
- package/dist/css/rich-text.css +5 -3
- package/dist/css/variables.css +30 -42
- package/dist/nldd.min.js +1071 -871
- package/dist/translations/en-US.d.ts +17 -0
- package/dist/translations/en-US.d.ts.map +1 -0
- package/dist/translations/en-US.js +185 -0
- package/dist/translations/en-US.js.map +1 -0
- package/dist/translations/fy.d.ts +20 -0
- package/dist/translations/fy.d.ts.map +1 -0
- package/dist/translations/fy.js +185 -0
- package/dist/translations/fy.js.map +1 -0
- package/dist/translations/nl.generated.d.ts +188 -0
- package/dist/translations/nl.generated.d.ts.map +1 -0
- package/dist/translations/nl.generated.js +101 -0
- package/dist/translations/nl.generated.js.map +1 -0
- package/dist/translations/pap-AW.d.ts +22 -0
- package/dist/translations/pap-AW.d.ts.map +1 -0
- package/dist/translations/pap-AW.js +185 -0
- package/dist/translations/pap-AW.js.map +1 -0
- package/dist/translations/pap-CW.d.ts +22 -0
- package/dist/translations/pap-CW.d.ts.map +1 -0
- package/dist/translations/pap-CW.js +185 -0
- package/dist/translations/pap-CW.js.map +1 -0
- package/dist/types/vue.d.ts +84 -47
- package/dist/utilities/translations.d.ts +37 -0
- package/dist/utilities/translations.d.ts.map +1 -0
- package/dist/utilities/translations.js +80 -0
- package/dist/utilities/translations.js.map +1 -0
- package/dist/utilities/with-translations.d.ts.map +1 -1
- package/dist/utilities/with-translations.js +2 -15
- package/dist/utilities/with-translations.js.map +1 -1
- package/package.json +33 -7
- package/dist/components/with-translations-BAKFoEKy.js +0 -69
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The translation layer shared by every component.
|
|
3
|
+
*
|
|
4
|
+
* A component looks a text up in this order: its own `translations` property,
|
|
5
|
+
* then what the app set for the whole package with `setTranslations()`, then
|
|
6
|
+
* its Dutch default. The package-wide layer is what reaches a component that
|
|
7
|
+
* another component builds in its shadow root, such as the activity indicator
|
|
8
|
+
* in a loading button or the calendar in a date field: nobody outside can set
|
|
9
|
+
* `translations` on those, but they all read this layer.
|
|
10
|
+
*
|
|
11
|
+
* Keys are language, not content. A text that differs per instance, such as
|
|
12
|
+
* "Aan het bewaren" on one button and "Aan het laden" on another, belongs in an
|
|
13
|
+
* attribute on that element.
|
|
14
|
+
*/
|
|
15
|
+
var _a;
|
|
16
|
+
// On globalThis under a registered symbol: the package entry is a bundle and
|
|
17
|
+
// the per-component entries are separate modules, so an app that imports both
|
|
18
|
+
// loads this file twice. Both copies have to read the same layer.
|
|
19
|
+
const STORE_KEY = Symbol.for('nldd.translations');
|
|
20
|
+
const store = ((_a = globalThis)[STORE_KEY] ?? (_a[STORE_KEY] = { translations: {} }));
|
|
21
|
+
/**
|
|
22
|
+
* Sets the texts for the whole package, replacing what was set before. Keys you
|
|
23
|
+
* leave out fall back to Dutch. To start from the shipped English and change a
|
|
24
|
+
* few texts, spread them: `setTranslations({ ...enUS, 'key': 'Mine' })`.
|
|
25
|
+
*
|
|
26
|
+
* Call it before the components render. Calling it again re-renders the
|
|
27
|
+
* components on the page, so a language switch at runtime works too. Call it
|
|
28
|
+
* when the language changes, not on every render: each call walks the page.
|
|
29
|
+
* A component inside a closed shadow root is out of its reach and keeps its old
|
|
30
|
+
* texts until it renders again; ask it to with `requestUpdate()`.
|
|
31
|
+
*/
|
|
32
|
+
export function setTranslations(translations) {
|
|
33
|
+
store.translations = { ...translations };
|
|
34
|
+
if (import.meta.env?.DEV)
|
|
35
|
+
warnUnknownKeys(store.translations);
|
|
36
|
+
if (typeof document !== 'undefined')
|
|
37
|
+
rerender(document);
|
|
38
|
+
}
|
|
39
|
+
/** What the app set with `setTranslations()`, for tests and debugging. */
|
|
40
|
+
export function getTranslations() {
|
|
41
|
+
return store.translations;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Looks a key up through the three layers and fills in `{placeholders}`. Every
|
|
45
|
+
* component's `_t()` goes through here, so none of them skips the package-wide
|
|
46
|
+
* layer.
|
|
47
|
+
*/
|
|
48
|
+
export function translate(own, defaults, key, vars) {
|
|
49
|
+
const name = key;
|
|
50
|
+
let text = own?.[key] ?? store.translations[name] ?? defaults[key] ?? name;
|
|
51
|
+
if (vars) {
|
|
52
|
+
for (const [k, v] of Object.entries(vars)) {
|
|
53
|
+
text = text.split(`{${k}}`).join(String(v));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return text;
|
|
57
|
+
}
|
|
58
|
+
/** Asks every nldd component on the page, also inside shadow roots, to render again. */
|
|
59
|
+
function rerender(root) {
|
|
60
|
+
for (const el of Array.from(root.querySelectorAll('*'))) {
|
|
61
|
+
if (el.tagName.startsWith('NLDD-'))
|
|
62
|
+
el.requestUpdate?.();
|
|
63
|
+
if (el.shadowRoot)
|
|
64
|
+
rerender(el.shadowRoot);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A key no component knows does nothing, silently. That is what happens to an
|
|
69
|
+
* override after a key is renamed, so in DEV it says so. The full key list is
|
|
70
|
+
* loaded only here, so production bundles do not carry it.
|
|
71
|
+
*/
|
|
72
|
+
function warnUnknownKeys(translations) {
|
|
73
|
+
import('../translations/nl.generated.js').then(({ nl }) => {
|
|
74
|
+
const unknown = Object.keys(translations).filter((key) => !(key in nl));
|
|
75
|
+
if (unknown.length) {
|
|
76
|
+
console.warn(`setTranslations: no component knows ${unknown.length === 1 ? 'this key, so it does' : 'these keys, so they do'} nothing: ${unknown.join(', ')}`);
|
|
77
|
+
}
|
|
78
|
+
}).catch(() => { });
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=translations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.js","sourceRoot":"","sources":["../../src/utilities/translations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;AAQH,6EAA6E;AAC7E,8EAA8E;AAC9E,kEAAkE;AAClE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAClD,MAAM,KAAK,GAAU,OAAE,UAAsC,EAAC,SAAS,SAAT,SAAS,IAAM,EAAE,YAAY,EAAE,EAAE,EAAE,EAAU,CAAC;AAE5G;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,YAA0B;IACzD,KAAK,CAAC,YAAY,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IACzC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;QAAE,eAAe,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9D,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACzD,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,eAAe;IAC9B,OAAO,KAAK,CAAC,YAAY,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACxB,GAA2B,EAC3B,QAAW,EACX,GAAY,EACZ,IAAsC;IAEtC,MAAM,IAAI,GAAG,GAAa,CAAC;IAC3B,IAAI,IAAI,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;IAC3E,IAAI,IAAI,EAAE,CAAC;QACV,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,wFAAwF;AACxF,SAAS,QAAQ,CAAC,IAAqC;IACtD,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACzD,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAAG,EAA+C,CAAC,aAAa,EAAE,EAAE,CAAC;QACvG,IAAI,EAAE,CAAC,UAAU;YAAE,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;AACF,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,YAA0B;IAClD,MAAM,CAAC,iCAAiC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QACzD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;QACxE,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,uCAAuC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,wBAAwB,aAAa,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChK,CAAC;IACF,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-translations.d.ts","sourceRoot":"","sources":["../../src/utilities/with-translations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjC,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChE,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,GAAG,OAAO,UAAU,EACjD,QAAQ,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"with-translations.d.ts","sourceRoot":"","sources":["../../src/utilities/with-translations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjC,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChE,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,GAAG,OAAO,UAAU,EACjD,QAAQ,EAAE,CAAC,GAY4B,WAAW,CAAC,UAAU,GAAG;IAC/D,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;CACjE,CAAC,GAAG,OAAO,UAAU,CACtB"}
|
|
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { property } from 'lit/decorators.js';
|
|
8
|
+
import { translate } from './translations.js';
|
|
8
9
|
/**
|
|
9
10
|
* Mixin that adds i18n support to a LitElement component.
|
|
10
11
|
*
|
|
@@ -29,24 +30,10 @@ export function withTranslations(Base, defaults) {
|
|
|
29
30
|
constructor() {
|
|
30
31
|
super(...arguments);
|
|
31
32
|
this.translations = {};
|
|
32
|
-
/** @internal */
|
|
33
|
-
this._mergedTranslations = { ...defaults };
|
|
34
33
|
}
|
|
35
34
|
/** @internal */
|
|
36
35
|
_t(key, vars) {
|
|
37
|
-
|
|
38
|
-
if (vars) {
|
|
39
|
-
for (const [k, v] of Object.entries(vars)) {
|
|
40
|
-
str = str.split(`{${k}}`).join(String(v));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return str;
|
|
44
|
-
}
|
|
45
|
-
willUpdate(changed) {
|
|
46
|
-
super.willUpdate(changed);
|
|
47
|
-
if (changed.has('translations')) {
|
|
48
|
-
this._mergedTranslations = { ...defaults, ...this.translations };
|
|
49
|
-
}
|
|
36
|
+
return translate(this.translations, defaults, key, vars);
|
|
50
37
|
}
|
|
51
38
|
}
|
|
52
39
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-translations.js","sourceRoot":"","sources":["../../src/utilities/with-translations.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"with-translations.js","sourceRoot":"","sources":["../../src/utilities/with-translations.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB,CAC/B,IAAiD,EACjD,QAAW;IAEX,MAAM,iBAAkB,SAAQ,IAAI;QAApC;;YAEC,iBAAY,GAAe,EAAE,CAAC;QAM/B,CAAC;QAJA,gBAAgB;QAChB,EAAE,CAAC,GAAY,EAAE,IAAsC;YACtD,OAAO,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAC1D,CAAC;KACD;IANA;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACG;IAQ/B,OAAO,iBAGe,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nldd/design-system",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.95",
|
|
4
4
|
"description": "Designsysteem voor de Nederlandse Digitale Dienst",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/components/components.js",
|
|
@@ -455,12 +455,37 @@
|
|
|
455
455
|
"./styles/variables": "./dist/css/variables.css",
|
|
456
456
|
"./styles/tokens": "./dist/css/tokens.css",
|
|
457
457
|
"./styles/fouc": "./dist/css/fouc.css",
|
|
458
|
+
"./fonts/*": "./dist/fonts/*",
|
|
458
459
|
"./favicon.svg": "./dist/favicon.svg",
|
|
459
460
|
"./touch-icon.png": "./dist/touch-icon.png",
|
|
460
461
|
"./breakpoints": {
|
|
461
462
|
"types": "./dist/assets/styles/breakpoints.d.ts",
|
|
462
463
|
"default": "./dist/assets/styles/breakpoints.js"
|
|
463
464
|
},
|
|
465
|
+
"./translations": {
|
|
466
|
+
"types": "./dist/utilities/translations.d.ts",
|
|
467
|
+
"default": "./dist/utilities/translations.js"
|
|
468
|
+
},
|
|
469
|
+
"./translations/nl": {
|
|
470
|
+
"types": "./dist/translations/nl.generated.d.ts",
|
|
471
|
+
"default": "./dist/translations/nl.generated.js"
|
|
472
|
+
},
|
|
473
|
+
"./translations/en-US": {
|
|
474
|
+
"types": "./dist/translations/en-US.d.ts",
|
|
475
|
+
"default": "./dist/translations/en-US.js"
|
|
476
|
+
},
|
|
477
|
+
"./translations/fy": {
|
|
478
|
+
"types": "./dist/translations/fy.d.ts",
|
|
479
|
+
"default": "./dist/translations/fy.js"
|
|
480
|
+
},
|
|
481
|
+
"./translations/pap-AW": {
|
|
482
|
+
"types": "./dist/translations/pap-AW.d.ts",
|
|
483
|
+
"default": "./dist/translations/pap-AW.js"
|
|
484
|
+
},
|
|
485
|
+
"./translations/pap-CW": {
|
|
486
|
+
"types": "./dist/translations/pap-CW.d.ts",
|
|
487
|
+
"default": "./dist/translations/pap-CW.js"
|
|
488
|
+
},
|
|
464
489
|
"./vue": {
|
|
465
490
|
"types": "./dist/types/vue.d.ts"
|
|
466
491
|
}
|
|
@@ -497,7 +522,7 @@
|
|
|
497
522
|
"validate:host-styles": "node scripts/validate-host-styles.js",
|
|
498
523
|
"validate:component-api": "node scripts/validate-component-api.js",
|
|
499
524
|
"validate:skill-markup": "node scripts/validate-skill-markup.js",
|
|
500
|
-
"build:components": "npm run clean:components && npm run build:icons && npm run build:components:modules && npm run build:components:bundle && npm run build:components:standalone && npm run build:exports && npm run generate:cem",
|
|
525
|
+
"build:components": "npm run clean:components && npm run build:icons && npm run generate:translations && npm run build:components:modules && npm run build:components:bundle && npm run build:components:standalone && npm run build:exports && npm run generate:cem",
|
|
501
526
|
"build:icons": "node scripts/generate-icon-registry.js && node scripts/generate-logo.js",
|
|
502
527
|
"build:components:modules": "tsc -p tsconfig.build.json",
|
|
503
528
|
"build:components:bundle": "vite build",
|
|
@@ -525,7 +550,8 @@
|
|
|
525
550
|
"pretypecheck": "npm run build:icons",
|
|
526
551
|
"typecheck": "tsc --noEmit",
|
|
527
552
|
"test:vue-types": "vue-tsc --noEmit -p type-tests/vue/tsconfig.json",
|
|
528
|
-
"build:components:standalone": "vite build --config vite.bundle.config.ts"
|
|
553
|
+
"build:components:standalone": "vite build --config vite.bundle.config.ts",
|
|
554
|
+
"generate:translations": "node scripts/generate-translations.js"
|
|
529
555
|
},
|
|
530
556
|
"devDependencies": {
|
|
531
557
|
"@commitlint/cli": "^21.2.1",
|
|
@@ -539,8 +565,8 @@
|
|
|
539
565
|
"@storybook/addon-docs": "^10.6.0",
|
|
540
566
|
"@storybook/addon-themes": "^10.6.0",
|
|
541
567
|
"@storybook/web-components-vite": "^10.6.0",
|
|
542
|
-
"@vitest/browser-playwright": "5.0.
|
|
543
|
-
"@vitest/coverage-v8": "5.0.
|
|
568
|
+
"@vitest/browser-playwright": "5.0.3",
|
|
569
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
544
570
|
"axe-core": "^4.13.0",
|
|
545
571
|
"conventional-changelog": "^8.1.0",
|
|
546
572
|
"conventional-changelog-conventionalcommits": "10.2.1",
|
|
@@ -553,8 +579,8 @@
|
|
|
553
579
|
"storybook": "^10.6.0",
|
|
554
580
|
"typescript": "^5.3.0",
|
|
555
581
|
"typescript-eslint": "^8.58.0",
|
|
556
|
-
"vite": "8.3.
|
|
557
|
-
"vitest": "5.0.
|
|
582
|
+
"vite": "8.3.1",
|
|
583
|
+
"vitest": "5.0.3",
|
|
558
584
|
"vue": "^3.5.40",
|
|
559
585
|
"vue-tsc": "^3.3.7"
|
|
560
586
|
},
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { t as __decorate } from "./decorate-lwt_OrAG.js";
|
|
2
|
-
import { property } from "lit/decorators.js";
|
|
3
|
-
//#region src/utilities/link-rel.ts
|
|
4
|
-
/**
|
|
5
|
-
* The `rel` of a link that may open in a new tab.
|
|
6
|
-
*
|
|
7
|
-
* A link with `target="_blank"` gets `noopener noreferrer`: the page it opens
|
|
8
|
-
* gets no handle on this one through `window.opener`, and no referrer. A `rel`
|
|
9
|
-
* the consumer sets is added to, never replaced. `rel="external"` on a `_blank`
|
|
10
|
-
* link describes the link, and it is no reason to leave that door open.
|
|
11
|
-
*
|
|
12
|
-
* Returns an empty string when there is nothing to write, so a template can
|
|
13
|
-
* leave the attribute off with `|| nothing`.
|
|
14
|
-
*/
|
|
15
|
-
function linkRel(rel, target) {
|
|
16
|
-
const base = rel ?? "";
|
|
17
|
-
if (target !== "_blank") return base.trim();
|
|
18
|
-
const parts = new Set(base.split(/\s+/).filter(Boolean));
|
|
19
|
-
parts.add("noopener");
|
|
20
|
-
parts.add("noreferrer");
|
|
21
|
-
return [...parts].join(" ");
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/utilities/with-translations.ts
|
|
25
|
-
/**
|
|
26
|
-
* Mixin that adds i18n support to a LitElement component.
|
|
27
|
-
*
|
|
28
|
-
* Provides a `translations` property for overriding defaults,
|
|
29
|
-
* a merged translations object, and a `_t()` method for lookups.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* import { withTranslations } from '../../../utilities/with-translations.js';
|
|
34
|
-
* import { myDefaults } from './my-component.i18n.js';
|
|
35
|
-
* import type { MyTranslations } from './my-component.i18n.js';
|
|
36
|
-
*
|
|
37
|
-
* class MyComponent extends withTranslations<MyTranslations>(LitElement, myDefaults) {
|
|
38
|
-
* render() {
|
|
39
|
-
* return html`${this._t('my-key')}`;
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
function withTranslations(Base, defaults) {
|
|
45
|
-
class TranslationsMixin extends Base {
|
|
46
|
-
constructor(..._args) {
|
|
47
|
-
super(..._args);
|
|
48
|
-
this.translations = {};
|
|
49
|
-
this._mergedTranslations = { ...defaults };
|
|
50
|
-
}
|
|
51
|
-
/** @internal */
|
|
52
|
-
_t(key, vars) {
|
|
53
|
-
let str = this._mergedTranslations[key] ?? String(key);
|
|
54
|
-
if (vars) for (const [k, v] of Object.entries(vars)) str = str.split(`{${k}}`).join(String(v));
|
|
55
|
-
return str;
|
|
56
|
-
}
|
|
57
|
-
willUpdate(changed) {
|
|
58
|
-
super.willUpdate(changed);
|
|
59
|
-
if (changed.has("translations")) this._mergedTranslations = {
|
|
60
|
-
...defaults,
|
|
61
|
-
...this.translations
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
__decorate([property({ type: Object })], TranslationsMixin.prototype, "translations", void 0);
|
|
66
|
-
return TranslationsMixin;
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
export { linkRel as n, withTranslations as t };
|