vira 32.0.0-beta.0 → 32.0.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/elements/color/vira-all-color-space-sliders.element.d.ts +11 -0
- package/dist/elements/color/vira-all-color-space-sliders.element.js +55 -0
- package/dist/elements/color/vira-all-spaces-color-picker.element.d.ts +15 -0
- package/dist/elements/color/vira-all-spaces-color-picker.element.js +73 -0
- package/dist/elements/color/vira-color-details.element.d.ts +14 -0
- package/{src/elements/color/vira-color-details.element.ts → dist/elements/color/vira-color-details.element.js} +43 -59
- package/dist/elements/color/vira-color-format-sliders.element.d.ts +14 -0
- package/dist/elements/color/vira-color-format-sliders.element.js +60 -0
- package/dist/elements/color/vira-color-pair-contrast-summary.element.d.ts +9 -0
- package/{src/elements/color/vira-color-pair-contrast-summary.element.ts → dist/elements/color/vira-color-pair-contrast-summary.element.js} +68 -100
- package/dist/elements/color/vira-color-pair.element.d.ts +17 -0
- package/{src/elements/color/vira-color-pair.element.ts → dist/elements/color/vira-color-pair.element.js} +50 -71
- package/dist/elements/color/vira-color-picker.element.d.ts +20 -0
- package/{src/elements/color/vira-color-picker.element.ts → dist/elements/color/vira-color-picker.element.js} +92 -117
- package/dist/elements/color/vira-color-slider.element.d.ts +14 -0
- package/dist/elements/color/vira-color-slider.element.js +124 -0
- package/dist/elements/color/vira-color-swatch.element.d.ts +20 -0
- package/{src/elements/color/vira-color-swatch.element.ts → dist/elements/color/vira-color-swatch.element.js} +6 -16
- package/dist/elements/color/vira-contrast-indicator.element.d.ts +10 -0
- package/{src/elements/color/vira-contrast-indicator.element.ts → dist/elements/color/vira-contrast-indicator.element.js} +13 -28
- package/dist/elements/index.js +39 -0
- package/dist/elements/pop-up/vira-menu-item.element.d.ts +38 -0
- package/{src/elements/pop-up/vira-menu-item.element.ts → dist/elements/pop-up/vira-menu-item.element.js} +80 -117
- package/dist/elements/pop-up/vira-menu-trigger.element.d.ts +45 -0
- package/dist/elements/pop-up/vira-menu-trigger.element.js +100 -0
- package/dist/elements/pop-up/vira-menu.element.d.ts +36 -0
- package/{src/elements/pop-up/vira-menu.element.ts → dist/elements/pop-up/vira-menu.element.js} +28 -31
- package/dist/elements/pop-up/vira-pop-up-trigger.element.d.ts +109 -0
- package/dist/elements/pop-up/vira-pop-up-trigger.element.js +408 -0
- package/dist/elements/vira-absolute-time.element.d.ts +35 -0
- package/dist/elements/vira-absolute-time.element.js +43 -0
- package/dist/elements/vira-bold-text.element.d.ts +9 -0
- package/{src/elements/vira-bold-text.element.ts → dist/elements/vira-bold-text.element.js} +11 -10
- package/dist/elements/vira-button.element.d.ts +44 -0
- package/{src/elements/vira-button.element.ts → dist/elements/vira-button.element.js} +107 -255
- package/dist/elements/vira-card.element.d.ts +18 -0
- package/{src/elements/vira-card.element.ts → dist/elements/vira-card.element.js} +19 -18
- package/dist/elements/vira-checkbox.element.d.ts +44 -0
- package/{src/elements/vira-checkbox.element.ts → dist/elements/vira-checkbox.element.js} +48 -95
- package/dist/elements/vira-collapsible-card.element.d.ts +36 -0
- package/{src/elements/vira-collapsible-card.element.ts → dist/elements/vira-collapsible-card.element.js} +44 -71
- package/dist/elements/vira-collapsible-wrapper.element.d.ts +30 -0
- package/{src/elements/vira-collapsible-wrapper.element.ts → dist/elements/vira-collapsible-wrapper.element.js} +47 -59
- package/dist/elements/vira-date-input.element.d.ts +47 -0
- package/dist/elements/vira-date-input.element.js +142 -0
- package/dist/elements/vira-drawer.element.d.ts +24 -0
- package/{src/elements/vira-drawer.element.ts → dist/elements/vira-drawer.element.js} +98 -125
- package/dist/elements/vira-dropdown.element.d.ts +43 -0
- package/dist/elements/vira-dropdown.element.js +247 -0
- package/dist/elements/vira-error.element.d.ts +7 -0
- package/{src/elements/vira-error.element.ts → dist/elements/vira-error.element.js} +7 -8
- package/dist/elements/vira-form.element.d.ts +56 -0
- package/dist/elements/vira-form.element.js +376 -0
- package/dist/elements/vira-icon.element.d.ts +13 -0
- package/{src/elements/vira-icon.element.ts → dist/elements/vira-icon.element.js} +12 -16
- package/dist/elements/vira-image.element.d.ts +45 -0
- package/{src/elements/vira-image.element.ts → dist/elements/vira-image.element.js} +50 -70
- package/dist/elements/vira-input.element.d.ts +64 -0
- package/{src/elements/vira-input.element.ts → dist/elements/vira-input.element.js} +112 -167
- package/dist/elements/vira-json-form.element.d.ts +35 -0
- package/{src/elements/vira-json-form.element.ts → dist/elements/vira-json-form.element.js} +356 -522
- package/dist/elements/vira-link.element.d.ts +78 -0
- package/{src/elements/vira-link.element.ts → dist/elements/vira-link.element.js} +24 -83
- package/dist/elements/vira-modal.element.d.ts +40 -0
- package/{src/elements/vira-modal.element.ts → dist/elements/vira-modal.element.js} +68 -104
- package/dist/elements/vira-progress.element.d.ts +18 -0
- package/{src/elements/vira-progress.element.ts → dist/elements/vira-progress.element.js} +12 -25
- package/dist/elements/vira-relative-time.element.d.ts +42 -0
- package/dist/elements/vira-relative-time.element.js +96 -0
- package/dist/elements/vira-select.element.d.ts +44 -0
- package/{src/elements/vira-select.element.ts → dist/elements/vira-select.element.js} +89 -138
- package/dist/elements/vira-tabs.element.d.ts +124 -0
- package/{src/elements/vira-tabs.element.ts → dist/elements/vira-tabs.element.js} +242 -446
- package/dist/elements/vira-tag.element.d.ts +40 -0
- package/{src/elements/vira-tag.element.ts → dist/elements/vira-tag.element.js} +152 -266
- package/dist/elements/vira-text-area.element.d.ts +48 -0
- package/{src/elements/vira-text-area.element.ts → dist/elements/vira-text-area.element.js} +52 -70
- package/dist/elements/vira-theme-switcher.element.d.ts +17 -0
- package/{src/elements/vira-theme-switcher.element.ts → dist/elements/vira-theme-switcher.element.js} +34 -49
- package/dist/icons/colored-icon.d.ts +11 -0
- package/{src/icons/colored-icon.ts → dist/icons/colored-icon.js} +17 -24
- package/dist/icons/icon-css-vars.d.ts +14 -0
- package/{src/icons/icon-css-vars.ts → dist/icons/icon-css-vars.js} +1 -2
- package/{src/icons/icon-svg.ts → dist/icons/icon-svg.d.ts} +3 -15
- package/dist/icons/icon-svg.js +12 -0
- package/dist/icons/icon-svgs/16/check-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/check-16.icon.ts → dist/icons/icon-svgs/16/check-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/chevron-down-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/chevron-down-16.icon.ts → dist/icons/icon-svgs/16/chevron-down-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/chevron-up-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/chevron-up-16.icon.ts → dist/icons/icon-svgs/16/chevron-up-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/dash-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/dash-16.icon.ts → dist/icons/icon-svgs/16/dash-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/element-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/element-16.icon.ts → dist/icons/icon-svgs/16/element-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/plus-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/plus-16.icon.ts → dist/icons/icon-svgs/16/plus-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/upload-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/upload-16.icon.ts → dist/icons/icon-svgs/16/upload-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/x-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/x-16.icon.ts → dist/icons/icon-svgs/16/x-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/arrow-down-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/arrow-down-24.icon.ts → dist/icons/icon-svgs/24/arrow-down-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/arrow-left-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/arrow-left-24.icon.ts → dist/icons/icon-svgs/24/arrow-left-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/arrow-right-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/arrow-right-24.icon.ts → dist/icons/icon-svgs/24/arrow-right-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/arrow-up-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/arrow-up-24.icon.ts → dist/icons/icon-svgs/24/arrow-up-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/auto-theme-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/auto-theme-24.icon.ts → dist/icons/icon-svgs/24/auto-theme-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/bell-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/bell-24.icon.ts → dist/icons/icon-svgs/24/bell-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/chat-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/chat-24.icon.ts → dist/icons/icon-svgs/24/chat-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/check-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/check-24.icon.ts → dist/icons/icon-svgs/24/check-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/chevron-down-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/chevron-down-24.icon.ts → dist/icons/icon-svgs/24/chevron-down-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/chevron-up-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/chevron-up-24.icon.ts → dist/icons/icon-svgs/24/chevron-up-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/close-x-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/close-x-24.icon.ts → dist/icons/icon-svgs/24/close-x-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/commit-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/commit-24.icon.ts → dist/icons/icon-svgs/24/commit-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/copy-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/copy-24.icon.ts → dist/icons/icon-svgs/24/copy-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/document-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/document-24.icon.ts → dist/icons/icon-svgs/24/document-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/document-search-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/document-search-24.icon.ts → dist/icons/icon-svgs/24/document-search-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/double-chevron-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/double-chevron-24.icon.ts → dist/icons/icon-svgs/24/double-chevron-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/element-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/element-24.icon.ts → dist/icons/icon-svgs/24/element-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/external-link-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/external-link-24.icon.ts → dist/icons/icon-svgs/24/external-link-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/eye-closed-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/eye-closed-24.icon.ts → dist/icons/icon-svgs/24/eye-closed-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/eye-open-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/eye-open-24.icon.ts → dist/icons/icon-svgs/24/eye-open-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/filter-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/filter-24.icon.ts → dist/icons/icon-svgs/24/filter-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/globe-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/globe-24.icon.ts → dist/icons/icon-svgs/24/globe-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/link-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/link-24.icon.ts → dist/icons/icon-svgs/24/link-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/loader-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/loader-24.icon.ts → dist/icons/icon-svgs/24/loader-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/loader-animated-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/loader-animated-24.icon.ts → dist/icons/icon-svgs/24/loader-animated-24.icon.js} +6 -8
- package/dist/icons/icon-svgs/24/lock-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/lock-24.icon.ts → dist/icons/icon-svgs/24/lock-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/magnifying-glass-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/magnifying-glass-24.icon.ts → dist/icons/icon-svgs/24/magnifying-glass-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/moon-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/moon-24.icon.ts → dist/icons/icon-svgs/24/moon-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/options-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/options-24.icon.ts → dist/icons/icon-svgs/24/options-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/pencil-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/pencil-24.icon.ts → dist/icons/icon-svgs/24/pencil-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/plus-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/plus-24.icon.ts → dist/icons/icon-svgs/24/plus-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/printer-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/printer-24.icon.ts → dist/icons/icon-svgs/24/printer-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/shield-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/shield-24.icon.ts → dist/icons/icon-svgs/24/shield-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/sort-ascending-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/sort-ascending-24.icon.ts → dist/icons/icon-svgs/24/sort-ascending-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/sort-descending-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/sort-descending-24.icon.ts → dist/icons/icon-svgs/24/sort-descending-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/sparkle-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/sparkle-24.icon.ts → dist/icons/icon-svgs/24/sparkle-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/speaker-loud-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/speaker-loud-24.icon.ts → dist/icons/icon-svgs/24/speaker-loud-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/speaker-medium-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/speaker-medium-24.icon.ts → dist/icons/icon-svgs/24/speaker-medium-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/speaker-muted-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/speaker-muted-24.icon.ts → dist/icons/icon-svgs/24/speaker-muted-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/speaker-quiet-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/speaker-quiet-24.icon.ts → dist/icons/icon-svgs/24/speaker-quiet-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/star-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/star-24.icon.ts → dist/icons/icon-svgs/24/star-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-failure-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-failure-24.icon.ts → dist/icons/icon-svgs/24/status-failure-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-in-progress-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-in-progress-24.icon.ts → dist/icons/icon-svgs/24/status-in-progress-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-success-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-success-24.icon.ts → dist/icons/icon-svgs/24/status-success-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-unknown-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-unknown-24.icon.ts → dist/icons/icon-svgs/24/status-unknown-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-warning-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-warning-24.icon.ts → dist/icons/icon-svgs/24/status-warning-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/sun-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/sun-24.icon.ts → dist/icons/icon-svgs/24/sun-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/upload-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/upload-24.icon.ts → dist/icons/icon-svgs/24/upload-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/x-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/x-24.icon.ts → dist/icons/icon-svgs/24/x-24.icon.js} +4 -5
- package/dist/icons/index.d.ts +197 -0
- package/{src/icons/index.ts → dist/icons/index.js} +60 -65
- package/dist/icons/lucide-icons.d.ts +15 -0
- package/dist/icons/lucide-icons.js +79 -0
- package/dist/icons/sized-icon.d.ts +8 -0
- package/{src/icons/sized-icon.ts → dist/icons/sized-icon.js} +1 -3
- package/dist/index.js +4 -0
- package/dist/styles/disabled.d.ts +6 -0
- package/{src/styles/disabled.ts → dist/styles/disabled.js} +2 -3
- package/dist/styles/durations.d.ts +22 -0
- package/{src/styles/durations.ts → dist/styles/durations.js} +1 -2
- package/dist/styles/focus.d.ts +26 -0
- package/{src/styles/focus.ts → dist/styles/focus.js} +12 -40
- package/dist/styles/font.d.ts +12 -0
- package/{src/styles/font.ts → dist/styles/font.js} +1 -3
- package/dist/styles/form-styles.d.ts +46 -0
- package/dist/styles/form-styles.js +53 -0
- package/dist/styles/form-variants.d.ts +117 -0
- package/{src/styles/form-variants.ts → dist/styles/form-variants.js} +34 -42
- package/{src/styles/index.ts → dist/styles/index.d.ts} +0 -1
- package/dist/styles/index.js +14 -0
- package/dist/styles/native-styles.d.ts +13 -0
- package/{src/styles/native-styles.ts → dist/styles/native-styles.js} +3 -5
- package/dist/styles/scrollbar.d.ts +6 -0
- package/{src/styles/scrollbar.ts → dist/styles/scrollbar.js} +3 -4
- package/dist/styles/shadows.d.ts +19 -0
- package/{src/styles/shadows.ts → dist/styles/shadows.js} +5 -7
- package/dist/styles/user-select.d.ts +6 -0
- package/{src/styles/user-select.ts → dist/styles/user-select.js} +2 -3
- package/dist/styles/vira-color-palette.d.ts +178 -0
- package/{src/styles/vira-color-palette.ts → dist/styles/vira-color-palette.js} +1 -3
- package/dist/styles/vira-color-theme-object.d.ts +65 -0
- package/dist/styles/vira-color-theme-object.js +65 -0
- package/dist/styles/vira-color-theme.d.ts +2785 -0
- package/{src/styles/vira-color-theme.ts → dist/styles/vira-color-theme.js} +1222 -1227
- package/dist/util/color-local-storage.client.d.ts +4 -0
- package/dist/util/color-local-storage.client.js +6 -0
- package/dist/util/define-table.d.ts +115 -0
- package/dist/util/define-table.js +115 -0
- package/dist/util/define-vira-element.d.ts +18 -0
- package/dist/util/define-vira-element.js +19 -0
- package/dist/util/dynamic-element.d.ts +62 -0
- package/dist/util/dynamic-element.js +61 -0
- package/dist/util/index.js +11 -0
- package/dist/util/overflow-observer.d.ts +25 -0
- package/{src/util/overflow-observer.ts → dist/util/overflow-observer.js} +1 -30
- package/dist/util/pop-up-helpers.d.ts +59 -0
- package/dist/util/pop-up-helpers.js +66 -0
- package/dist/util/pop-up-manager.d.ts +200 -0
- package/dist/util/pop-up-manager.js +258 -0
- package/dist/util/shared-text-input-logic.d.ts +69 -0
- package/dist/util/shared-text-input-logic.js +114 -0
- package/dist/util/vira-form-fields.d.ts +145 -0
- package/dist/util/vira-form-fields.js +66 -0
- package/dist/util/vira-json-schema.d.ts +206 -0
- package/{src/util/vira-json-schema.ts → dist/util/vira-json-schema.js} +155 -298
- package/{src/util/vira-select-option.ts → dist/util/vira-select-option.d.ts} +2 -9
- package/dist/util/vira-select-option.js +8 -0
- package/dist/util/vira-theme-client.d.ts +83 -0
- package/dist/util/vira-theme-client.js +93 -0
- package/package.json +13 -13
- package/src/elements/color/vira-all-color-space-sliders.element.ts +0 -66
- package/src/elements/color/vira-all-spaces-color-picker.element.ts +0 -85
- package/src/elements/color/vira-color-format-sliders.element.ts +0 -78
- package/src/elements/color/vira-color-slider.element.ts +0 -169
- package/src/elements/pop-up/vira-menu-trigger.element.ts +0 -135
- package/src/elements/pop-up/vira-pop-up-trigger.element.ts +0 -539
- package/src/elements/vira-absolute-time.element.ts +0 -81
- package/src/elements/vira-date-input.element.ts +0 -185
- package/src/elements/vira-dropdown.element.ts +0 -310
- package/src/elements/vira-form.element.ts +0 -466
- package/src/elements/vira-relative-time.element.ts +0 -135
- package/src/icons/icon-color.test-helper.ts +0 -9
- package/src/icons/lucide-icons.ts +0 -120
- package/src/styles/form-styles.ts +0 -86
- package/src/styles/vira-color-palette.json +0 -170
- package/src/styles/vira-color-theme-object.ts +0 -170
- package/src/util/color-local-storage.client.ts +0 -7
- package/src/util/define-table.ts +0 -286
- package/src/util/define-vira-element.ts +0 -29
- package/src/util/dynamic-element.ts +0 -128
- package/src/util/pop-up-helpers.ts +0 -133
- package/src/util/pop-up-manager.ts +0 -434
- package/src/util/shared-text-input-logic.ts +0 -192
- package/src/util/vira-form-fields.ts +0 -195
- package/src/util/vira-theme-client.ts +0 -140
- /package/{src/elements/index.ts → dist/elements/index.d.ts} +0 -0
- /package/{src/index.ts → dist/index.d.ts} +0 -0
- /package/{src/util/index.ts → dist/util/index.d.ts} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LocalStorageClient } from '@electrovir/local-storage-client';
|
|
2
|
+
export declare const colorLocalStorageClient: LocalStorageClient<{
|
|
3
|
+
lastFormat: import("object-shape-tester").Shape<import("@sinclair/typebox").TUnion<(import("@sinclair/typebox").TLiteral<"rgb"> | import("@sinclair/typebox").TLiteral<"hex"> | import("@sinclair/typebox").TLiteral<"hsl"> | import("@sinclair/typebox").TLiteral<"hwb"> | import("@sinclair/typebox").TLiteral<"lab"> | import("@sinclair/typebox").TLiteral<"lch"> | import("@sinclair/typebox").TLiteral<"oklab"> | import("@sinclair/typebox").TLiteral<"oklch">)[]>>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ColorFormatName } from '@electrovir/color/dist/data/color-class/color-formats.js';
|
|
2
|
+
import { LocalStorageClient } from '@electrovir/local-storage-client';
|
|
3
|
+
import { enumShape } from 'object-shape-tester';
|
|
4
|
+
export const colorLocalStorageClient = new LocalStorageClient({
|
|
5
|
+
lastFormat: enumShape(ColorFormatName),
|
|
6
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type ArrayElement, type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
+
import { type HtmlInterpolation } from 'element-vir';
|
|
3
|
+
/**
|
|
4
|
+
* An individual key definition in {@link ViraTableHeaders}.
|
|
5
|
+
*
|
|
6
|
+
* @category Internal
|
|
7
|
+
*/
|
|
8
|
+
export type ViraTableKey = Readonly<{
|
|
9
|
+
/** The key that cells must set a value to. */
|
|
10
|
+
key: string | number;
|
|
11
|
+
} & PartialWithUndefined<{
|
|
12
|
+
/** If this is not provided, `key` will be used directly. */
|
|
13
|
+
content: HtmlInterpolation;
|
|
14
|
+
/** If set to `true`, this header (and it's column) won't be rendered. */
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
}>>;
|
|
17
|
+
/**
|
|
18
|
+
* All header definitions for a {@link ViraTable} instance.
|
|
19
|
+
*
|
|
20
|
+
* @category Internal
|
|
21
|
+
*/
|
|
22
|
+
export type ViraTableHeaders = ReadonlyArray<ViraTableKey>;
|
|
23
|
+
/**
|
|
24
|
+
* An individual entry in {@link ViraTable}. In default table orientation, this will be a row. In
|
|
25
|
+
* horizontal orientation, this will be a column.
|
|
26
|
+
*
|
|
27
|
+
* @category Internal
|
|
28
|
+
*/
|
|
29
|
+
export type ViraTableEntry<Headers extends ViraTableHeaders | undefined = undefined> = Record<HeaderKey<Headers>, HtmlInterpolation>;
|
|
30
|
+
/**
|
|
31
|
+
* An individual cell in {@link ViraTableRow}.
|
|
32
|
+
*
|
|
33
|
+
* @category Internal
|
|
34
|
+
*/
|
|
35
|
+
export type ViraTableCell<Headers extends ViraTableHeaders | undefined = undefined, CellData = any> = {
|
|
36
|
+
content: HtmlInterpolation;
|
|
37
|
+
key: HeaderKey<Headers>;
|
|
38
|
+
/**
|
|
39
|
+
* The original entry that created this row (in default or vertical table orientation) or column
|
|
40
|
+
* (in horizontal table orientation). This is `undefined` in header cells.
|
|
41
|
+
*/
|
|
42
|
+
data: CellData;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* An individual row in {@link ViraTable}.
|
|
46
|
+
*
|
|
47
|
+
* @category Internal
|
|
48
|
+
*/
|
|
49
|
+
export type ViraTableRow<Headers extends ViraTableHeaders | undefined = undefined, CellData = any, RowData = CellData> = {
|
|
50
|
+
cells: ViraTableCell<Headers, CellData>[];
|
|
51
|
+
data: RowData;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* All keys for the given headers.
|
|
55
|
+
*
|
|
56
|
+
* @category Internal
|
|
57
|
+
*/
|
|
58
|
+
export type HeaderKey<Headers extends ViraTableHeaders | undefined = undefined> = undefined extends Headers ? string | number : ArrayElement<Exclude<Headers, undefined>>['key'];
|
|
59
|
+
/**
|
|
60
|
+
* Table information that can easily be mapped into a `<table>` element.
|
|
61
|
+
*
|
|
62
|
+
* @category Internal
|
|
63
|
+
*/
|
|
64
|
+
export type ViraTable<Headers extends ViraTableHeaders | undefined = undefined, Orientation extends ViraTableOrientation = ViraTableOrientation.Vertical, OriginalData extends ReadonlyArray<any> = any[]> = Orientation extends ViraTableOrientation.Horizontal ? {
|
|
65
|
+
headerRow: undefined;
|
|
66
|
+
orientation: Orientation;
|
|
67
|
+
rows: ViraTableRow<Headers, ArrayElement<OriginalData> | undefined, undefined>[];
|
|
68
|
+
} : {
|
|
69
|
+
headerRow: ViraTableCell<Headers, undefined>[];
|
|
70
|
+
orientation: Orientation;
|
|
71
|
+
rows: ViraTableRow<Headers, ArrayElement<OriginalData>>[];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Orientation options for {@link ViraTable}.
|
|
75
|
+
*
|
|
76
|
+
* @category Internal
|
|
77
|
+
*/
|
|
78
|
+
export declare enum ViraTableOrientation {
|
|
79
|
+
/**
|
|
80
|
+
* This corresponds to a _vertical_ entry sequence (as you move from entry to entry, you move
|
|
81
|
+
* across the table vertically). This is the default table layout. Each entry becomes a new row.
|
|
82
|
+
* Headers are in a separate row.
|
|
83
|
+
*/
|
|
84
|
+
Vertical = "vertical",
|
|
85
|
+
/**
|
|
86
|
+
* This corresponds to a _horizontal_ entry sequence (as you move from entry to entry, you move
|
|
87
|
+
* across the table horizontally). Each entry becomes a column. Headers are the left most
|
|
88
|
+
* column.
|
|
89
|
+
*/
|
|
90
|
+
Horizontal = "horizontal"
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Options for {@link defineTable}.
|
|
94
|
+
*
|
|
95
|
+
* @category Internal
|
|
96
|
+
*/
|
|
97
|
+
export type ViraTableOptions<Orientation extends ViraTableOrientation = ViraTableOrientation> = PartialWithUndefined<{
|
|
98
|
+
orientation: Orientation;
|
|
99
|
+
hideHeaders: boolean;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Accepts headers and entries and lays them out into rows according to the given
|
|
103
|
+
* `options.orientation` (defaulting to vertical). This does not itself create a `<table>` element,
|
|
104
|
+
* but makes it easy to loop over rows to (with `.map()`) to generate rows in a table.
|
|
105
|
+
*
|
|
106
|
+
* @category Table
|
|
107
|
+
*/
|
|
108
|
+
export declare function defineTable<const Headers extends ViraTableHeaders, OriginalData extends ReadonlyArray<any>, const Orientation extends ViraTableOrientation = ViraTableOrientation.Vertical>(
|
|
109
|
+
/** The order of these keys determines the order that they render in. */
|
|
110
|
+
{ headers, originalData, dataMap, options, }: Readonly<{
|
|
111
|
+
headers: Readonly<Headers>;
|
|
112
|
+
originalData: OriginalData;
|
|
113
|
+
dataMap: (entry: ArrayElement<OriginalData>, entryIndex: number) => ViraTableEntry<Headers> | undefined;
|
|
114
|
+
options?: ViraTableOptions<Orientation>;
|
|
115
|
+
}>): ViraTable<Headers, Orientation, OriginalData>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { check } from '@augment-vir/assert';
|
|
2
|
+
import { filterMap } from '@augment-vir/common';
|
|
3
|
+
/**
|
|
4
|
+
* Orientation options for {@link ViraTable}.
|
|
5
|
+
*
|
|
6
|
+
* @category Internal
|
|
7
|
+
*/
|
|
8
|
+
export var ViraTableOrientation;
|
|
9
|
+
(function (ViraTableOrientation) {
|
|
10
|
+
/**
|
|
11
|
+
* This corresponds to a _vertical_ entry sequence (as you move from entry to entry, you move
|
|
12
|
+
* across the table vertically). This is the default table layout. Each entry becomes a new row.
|
|
13
|
+
* Headers are in a separate row.
|
|
14
|
+
*/
|
|
15
|
+
ViraTableOrientation["Vertical"] = "vertical";
|
|
16
|
+
/**
|
|
17
|
+
* This corresponds to a _horizontal_ entry sequence (as you move from entry to entry, you move
|
|
18
|
+
* across the table horizontally). Each entry becomes a column. Headers are the left most
|
|
19
|
+
* column.
|
|
20
|
+
*/
|
|
21
|
+
ViraTableOrientation["Horizontal"] = "horizontal";
|
|
22
|
+
})(ViraTableOrientation || (ViraTableOrientation = {}));
|
|
23
|
+
/**
|
|
24
|
+
* Accepts headers and entries and lays them out into rows according to the given
|
|
25
|
+
* `options.orientation` (defaulting to vertical). This does not itself create a `<table>` element,
|
|
26
|
+
* but makes it easy to loop over rows to (with `.map()`) to generate rows in a table.
|
|
27
|
+
*
|
|
28
|
+
* @category Table
|
|
29
|
+
*/
|
|
30
|
+
export function defineTable(
|
|
31
|
+
/** The order of these keys determines the order that they render in. */
|
|
32
|
+
{ headers, originalData, dataMap, options = {}, }) {
|
|
33
|
+
const mappedData = originalData.map((dataRow, rowIndex) => {
|
|
34
|
+
return {
|
|
35
|
+
cells: dataMap(dataRow, rowIndex),
|
|
36
|
+
data: dataRow,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
if (options.orientation === ViraTableOrientation.Horizontal) {
|
|
40
|
+
const rows = filterMap(headers, (header) => {
|
|
41
|
+
if (header.disabled) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const headerCellArray = options.hideHeaders
|
|
45
|
+
? []
|
|
46
|
+
: [
|
|
47
|
+
{
|
|
48
|
+
content: header.content ?? header.key,
|
|
49
|
+
key: header.key,
|
|
50
|
+
data: undefined,
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
const cells = filterMap(mappedData, ({ data, cells, }) => {
|
|
54
|
+
if (!cells) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
content: cells[header.key],
|
|
59
|
+
key: header.key,
|
|
60
|
+
data,
|
|
61
|
+
};
|
|
62
|
+
}, check.isTruthy);
|
|
63
|
+
const allCells = [
|
|
64
|
+
...headerCellArray,
|
|
65
|
+
...cells,
|
|
66
|
+
];
|
|
67
|
+
return {
|
|
68
|
+
cells: allCells,
|
|
69
|
+
data: undefined,
|
|
70
|
+
};
|
|
71
|
+
}, check.isTruthy);
|
|
72
|
+
return {
|
|
73
|
+
headerRow: undefined,
|
|
74
|
+
rows,
|
|
75
|
+
orientation: ViraTableOrientation.Horizontal,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const headerRow = options.hideHeaders
|
|
80
|
+
? []
|
|
81
|
+
: filterMap(headers, (header) => {
|
|
82
|
+
if (header.disabled) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
content: header.content ?? header.key,
|
|
87
|
+
key: header.key,
|
|
88
|
+
data: undefined,
|
|
89
|
+
};
|
|
90
|
+
}, check.isTruthy);
|
|
91
|
+
const rows = filterMap(mappedData, ({ cells, data }) => {
|
|
92
|
+
if (!cells) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
cells: filterMap(headers, (header) => {
|
|
97
|
+
if (header.disabled) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
content: cells[header.key],
|
|
102
|
+
key: header.key,
|
|
103
|
+
data,
|
|
104
|
+
};
|
|
105
|
+
}, check.isTruthy),
|
|
106
|
+
data,
|
|
107
|
+
};
|
|
108
|
+
}, check.isTruthy);
|
|
109
|
+
return {
|
|
110
|
+
headerRow,
|
|
111
|
+
rows,
|
|
112
|
+
orientation: ViraTableOrientation.Vertical,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Required prefix for all vira elements.
|
|
3
|
+
*
|
|
4
|
+
* @category Internal
|
|
5
|
+
*/
|
|
6
|
+
export declare const ViraTagNamePrefix = "vira-";
|
|
7
|
+
/**
|
|
8
|
+
* Required tag name for all vira elements. This includes {@link ViraTagNamePrefix} in it.
|
|
9
|
+
*
|
|
10
|
+
* @category Internal
|
|
11
|
+
*/
|
|
12
|
+
export type ViraTagName = `${typeof ViraTagNamePrefix}${string}`;
|
|
13
|
+
/**
|
|
14
|
+
* Define a vira element with custom requirements (like the `vira-` element tag prefix).
|
|
15
|
+
*
|
|
16
|
+
* @category Internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const defineViraElement: <Inputs extends {}>(...errorParams: import("element-vir").DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends `vira-${string}`, State extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly [], const TestIds extends ReadonlyArray<string> = readonly []>(inputs: import("element-vir").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) => import("element-vir").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { wrapDefineElement } from 'element-vir';
|
|
2
|
+
/**
|
|
3
|
+
* Required prefix for all vira elements.
|
|
4
|
+
*
|
|
5
|
+
* @category Internal
|
|
6
|
+
*/
|
|
7
|
+
export const ViraTagNamePrefix = 'vira-';
|
|
8
|
+
/**
|
|
9
|
+
* Define a vira element with custom requirements (like the `vira-` element tag prefix).
|
|
10
|
+
*
|
|
11
|
+
* @category Internal
|
|
12
|
+
*/
|
|
13
|
+
export const defineViraElement = wrapDefineElement({
|
|
14
|
+
assertInputs(inputs) {
|
|
15
|
+
if (!inputs.tagName.startsWith(ViraTagNamePrefix)) {
|
|
16
|
+
throw new Error(`Tag name should start with '${ViraTagNamePrefix}' but got '${inputs.tagName}'`);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type RequireExactlyOne, type Values } from '@augment-vir/common';
|
|
2
|
+
import { type AsyncProp, type DeclarativeElementDefinition } from 'element-vir';
|
|
3
|
+
/**
|
|
4
|
+
* Base type for loaders passed to {@link createDynamicElementLoader}.
|
|
5
|
+
*
|
|
6
|
+
* @category Internal
|
|
7
|
+
*/
|
|
8
|
+
export type BaseDynamicElementLoaders = Record<string, () => Promise<DeclarativeElementDefinition>>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a dynamic element loader. This should go in your element state. This makes deferring
|
|
11
|
+
* element importing convenient and allows parts of your app to be placed in separate bundles. Make
|
|
12
|
+
* sure to also use {@link renderDynamicElement} to use the output of this loader.
|
|
13
|
+
*
|
|
14
|
+
* @category Util
|
|
15
|
+
* @see {@link renderDynamicElement}
|
|
16
|
+
* @see [example usage](https://github.com/electrovir/vira/blob/dev/packages/vira-book/src/element-book/entries/dynamic-elements.book.ts)
|
|
17
|
+
*/
|
|
18
|
+
export declare function createDynamicElementLoader<const Loaders extends Readonly<BaseDynamicElementLoaders>>(loaders: Readonly<Loaders>): DynamicElementAsyncProp<Loaders>;
|
|
19
|
+
/**
|
|
20
|
+
* The value for the async prop {@link DynamicElementAsyncProp}.
|
|
21
|
+
*
|
|
22
|
+
* @category Internal
|
|
23
|
+
*/
|
|
24
|
+
export type DynamicElementValue<Loaders extends BaseDynamicElementLoaders> = {
|
|
25
|
+
cache: Partial<Record<keyof Loaders, DeclarativeElementDefinition>>;
|
|
26
|
+
element: Awaited<ReturnType<Values<Loaders>>>;
|
|
27
|
+
key: keyof Loaders;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* An async prop for dynamic loading elements. This is the output from
|
|
31
|
+
* {@link createDynamicElementLoader}.
|
|
32
|
+
*
|
|
33
|
+
* @category Internal
|
|
34
|
+
*/
|
|
35
|
+
export type DynamicElementAsyncProp<Loaders extends BaseDynamicElementLoaders> = AsyncProp<DynamicElementValue<Loaders>, keyof Loaders>;
|
|
36
|
+
/**
|
|
37
|
+
* Params for the `ready` callback in {@link renderDynamicElement}.
|
|
38
|
+
*
|
|
39
|
+
* @category Internal
|
|
40
|
+
*/
|
|
41
|
+
export type ReadyParams<Loaders extends Readonly<BaseDynamicElementLoaders>> = RequireExactlyOne<{
|
|
42
|
+
[Key in keyof Loaders]: Awaited<ReturnType<Loaders[Key]>>;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Renders the current state of a dynamic element loader. This should go in your render function.
|
|
46
|
+
* Make sure to also use {@link createDynamicElementLoader} to create a dynamic loader in your
|
|
47
|
+
* element's state.
|
|
48
|
+
*
|
|
49
|
+
* @category Util
|
|
50
|
+
* @see {@link createDynamicElementLoader}
|
|
51
|
+
* @see [example usage](https://github.com/electrovir/vira/blob/dev/packages/vira-book/src/element-book/entries/dynamic-elements.book.ts)
|
|
52
|
+
*/
|
|
53
|
+
export declare function renderDynamicElement<const Loaders extends BaseDynamicElementLoaders, const LoadingReturnValue, const ReadyReturnValue, const ErrorReturnValue>(asyncProp: DynamicElementAsyncProp<Loaders>, { ready, loading, error, key, }: {
|
|
54
|
+
/**
|
|
55
|
+
* If this is left undefined (or falsy), the current key will not be set, whatever the
|
|
56
|
+
* existing key is will continue to be used.
|
|
57
|
+
*/
|
|
58
|
+
key?: keyof NoInfer<Loaders> | undefined;
|
|
59
|
+
loading(this: void, params: Promise<ReadyParams<NoInfer<Loaders>>>): LoadingReturnValue;
|
|
60
|
+
ready(this: void, params: ReadyParams<NoInfer<Loaders>>): ReadyReturnValue;
|
|
61
|
+
error(this: void, error: Error): ErrorReturnValue;
|
|
62
|
+
}): ReadyReturnValue | LoadingReturnValue | ErrorReturnValue;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { asyncProp } from 'element-vir';
|
|
2
|
+
/**
|
|
3
|
+
* Create a dynamic element loader. This should go in your element state. This makes deferring
|
|
4
|
+
* element importing convenient and allows parts of your app to be placed in separate bundles. Make
|
|
5
|
+
* sure to also use {@link renderDynamicElement} to use the output of this loader.
|
|
6
|
+
*
|
|
7
|
+
* @category Util
|
|
8
|
+
* @see {@link renderDynamicElement}
|
|
9
|
+
* @see [example usage](https://github.com/electrovir/vira/blob/dev/packages/vira-book/src/element-book/entries/dynamic-elements.book.ts)
|
|
10
|
+
*/
|
|
11
|
+
export function createDynamicElementLoader(loaders) {
|
|
12
|
+
return asyncProp({
|
|
13
|
+
async updateCallback(elementKey, previousResolvedValue) {
|
|
14
|
+
if (previousResolvedValue && elementKey in previousResolvedValue.cache) {
|
|
15
|
+
return {
|
|
16
|
+
cache: previousResolvedValue.cache,
|
|
17
|
+
element: previousResolvedValue.cache[elementKey],
|
|
18
|
+
key: elementKey,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const imported = await loaders[elementKey]();
|
|
22
|
+
return {
|
|
23
|
+
cache: {
|
|
24
|
+
...previousResolvedValue?.cache,
|
|
25
|
+
[elementKey]: imported,
|
|
26
|
+
},
|
|
27
|
+
element: imported,
|
|
28
|
+
key: elementKey,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Renders the current state of a dynamic element loader. This should go in your render function.
|
|
35
|
+
* Make sure to also use {@link createDynamicElementLoader} to create a dynamic loader in your
|
|
36
|
+
* element's state.
|
|
37
|
+
*
|
|
38
|
+
* @category Util
|
|
39
|
+
* @see {@link createDynamicElementLoader}
|
|
40
|
+
* @see [example usage](https://github.com/electrovir/vira/blob/dev/packages/vira-book/src/element-book/entries/dynamic-elements.book.ts)
|
|
41
|
+
*/
|
|
42
|
+
export function renderDynamicElement(asyncProp, { ready, loading, error, key, }) {
|
|
43
|
+
if (key) {
|
|
44
|
+
asyncProp.update(key);
|
|
45
|
+
}
|
|
46
|
+
if (asyncProp.value instanceof Error) {
|
|
47
|
+
return error(asyncProp.value);
|
|
48
|
+
}
|
|
49
|
+
else if (asyncProp.value instanceof Promise) {
|
|
50
|
+
return loading(asyncProp.value.then((value) => {
|
|
51
|
+
return {
|
|
52
|
+
[value.key]: value.element,
|
|
53
|
+
};
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return ready({
|
|
58
|
+
[asyncProp.value.key]: asyncProp.value.element,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './define-table.js';
|
|
2
|
+
export * from './define-vira-element.js';
|
|
3
|
+
export * from './dynamic-element.js';
|
|
4
|
+
export * from './overflow-observer.js';
|
|
5
|
+
export * from './pop-up-helpers.js';
|
|
6
|
+
export * from './pop-up-manager.js';
|
|
7
|
+
export * from './shared-text-input-logic.js';
|
|
8
|
+
export * from './vira-form-fields.js';
|
|
9
|
+
export * from './vira-json-schema.js';
|
|
10
|
+
export * from './vira-select-option.js';
|
|
11
|
+
export * from './vira-theme-client.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an observer that monitors whether an element's content overflows its visible width. Uses
|
|
3
|
+
* a ResizeObserver for size changes and a MutationObserver for DOM content changes.
|
|
4
|
+
*
|
|
5
|
+
* @category Util
|
|
6
|
+
* @returns A cleanup function that disconnects all observers.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createOverflowObserver({ element, widthElement, onChange, hysteresisPx, }: Readonly<{
|
|
9
|
+
/** The element whose `scrollWidth` is measured for content size. */
|
|
10
|
+
element: Element;
|
|
11
|
+
/**
|
|
12
|
+
* Optional separate element whose `clientWidth` is used as the available width. Defaults to
|
|
13
|
+
* `element`. Useful when `element` may be collapsed but the available width should come from a
|
|
14
|
+
* parent.
|
|
15
|
+
*/
|
|
16
|
+
widthElement?: Element | undefined;
|
|
17
|
+
onChange: (isOverflowing: boolean) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Pixel margin required to flip the overflow state. Once overflowing, the content must fit
|
|
20
|
+
* within `availableWidth - hysteresisPx` to flip back; once not overflowing, the content must
|
|
21
|
+
* exceed `availableWidth + hysteresisPx` to flip on. Prevents rapid toggling from minute size
|
|
22
|
+
* changes.
|
|
23
|
+
*/
|
|
24
|
+
hysteresisPx?: number | undefined;
|
|
25
|
+
}>): () => void;
|
|
@@ -5,60 +5,31 @@
|
|
|
5
5
|
* @category Util
|
|
6
6
|
* @returns A cleanup function that disconnects all observers.
|
|
7
7
|
*/
|
|
8
|
-
export function createOverflowObserver({
|
|
9
|
-
element,
|
|
10
|
-
widthElement,
|
|
11
|
-
onChange,
|
|
12
|
-
hysteresisPx = 0,
|
|
13
|
-
}: Readonly<{
|
|
14
|
-
/** The element whose `scrollWidth` is measured for content size. */
|
|
15
|
-
element: Element;
|
|
16
|
-
/**
|
|
17
|
-
* Optional separate element whose `clientWidth` is used as the available width. Defaults to
|
|
18
|
-
* `element`. Useful when `element` may be collapsed but the available width should come from a
|
|
19
|
-
* parent.
|
|
20
|
-
*/
|
|
21
|
-
widthElement?: Element | undefined;
|
|
22
|
-
onChange: (isOverflowing: boolean) => void;
|
|
23
|
-
/**
|
|
24
|
-
* Pixel margin required to flip the overflow state. Once overflowing, the content must fit
|
|
25
|
-
* within `availableWidth - hysteresisPx` to flip back; once not overflowing, the content must
|
|
26
|
-
* exceed `availableWidth + hysteresisPx` to flip on. Prevents rapid toggling from minute size
|
|
27
|
-
* changes.
|
|
28
|
-
*/
|
|
29
|
-
hysteresisPx?: number | undefined;
|
|
30
|
-
}>): () => void {
|
|
8
|
+
export function createOverflowObserver({ element, widthElement, onChange, hysteresisPx = 0, }) {
|
|
31
9
|
const availableWidthElement = widthElement || element;
|
|
32
10
|
let isOverflowing = false;
|
|
33
|
-
|
|
34
11
|
function checkOverflow() {
|
|
35
12
|
const contentWidth = element.scrollWidth;
|
|
36
13
|
const availableWidth = availableWidthElement.clientWidth;
|
|
37
14
|
const threshold = isOverflowing ? -hysteresisPx : hysteresisPx;
|
|
38
15
|
const nextOverflowing = contentWidth > availableWidth + threshold;
|
|
39
|
-
|
|
40
16
|
if (nextOverflowing !== isOverflowing) {
|
|
41
17
|
isOverflowing = nextOverflowing;
|
|
42
18
|
onChange(isOverflowing);
|
|
43
19
|
}
|
|
44
20
|
}
|
|
45
|
-
|
|
46
21
|
const resizeObserver = new ResizeObserver(checkOverflow);
|
|
47
22
|
resizeObserver.observe(element);
|
|
48
|
-
|
|
49
23
|
if (availableWidthElement !== element) {
|
|
50
24
|
resizeObserver.observe(availableWidthElement);
|
|
51
25
|
}
|
|
52
|
-
|
|
53
26
|
const mutationObserver = new MutationObserver(checkOverflow);
|
|
54
27
|
mutationObserver.observe(element, {
|
|
55
28
|
childList: true,
|
|
56
29
|
subtree: true,
|
|
57
30
|
characterData: true,
|
|
58
31
|
});
|
|
59
|
-
|
|
60
32
|
checkOverflow();
|
|
61
|
-
|
|
62
33
|
return () => {
|
|
63
34
|
resizeObserver.disconnect();
|
|
64
35
|
mutationObserver.disconnect();
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type MaybePromise, type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
+
import { type HtmlInterpolation } from 'element-vir';
|
|
3
|
+
import { ViraMenuItem } from '../elements/pop-up/vira-menu-item.element.js';
|
|
4
|
+
import { type PopUpManager, type PopUpManagerOptions, type ShowPopUpResult } from './pop-up-manager.js';
|
|
5
|
+
/**
|
|
6
|
+
* Verifies that all items have unique ids.
|
|
7
|
+
*
|
|
8
|
+
* @category Internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function assertUniqueIdProps(items: ReadonlyArray<Readonly<{
|
|
11
|
+
id: PropertyKey;
|
|
12
|
+
}>>): void;
|
|
13
|
+
/**
|
|
14
|
+
* Handles toggling pop up state for `ViraDropdown`.
|
|
15
|
+
*
|
|
16
|
+
* @category Internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function triggerPopUpState({ open, callback, popUpManager, host, options, }: Readonly<{
|
|
19
|
+
open: boolean;
|
|
20
|
+
popUpManager: PopUpManager;
|
|
21
|
+
host: HTMLElement;
|
|
22
|
+
} & PartialWithUndefined<{
|
|
23
|
+
callback?: ((showPopUpResult: ShowPopUpResult | undefined) => void) | undefined;
|
|
24
|
+
options?: Partial<PopUpManagerOptions> | undefined;
|
|
25
|
+
}>>): void;
|
|
26
|
+
/**
|
|
27
|
+
* A helper type to be used with {@link renderMenuItemEntries}.
|
|
28
|
+
*
|
|
29
|
+
* @category PopUp
|
|
30
|
+
*/
|
|
31
|
+
export type ViraMenuItemEntry = {
|
|
32
|
+
content: HtmlInterpolation;
|
|
33
|
+
} & PartialWithUndefined<{
|
|
34
|
+
selected: boolean;
|
|
35
|
+
/** Called when any item is activated. */
|
|
36
|
+
onClick: MenuItemClickCallback;
|
|
37
|
+
/**
|
|
38
|
+
* If set to `true`, this menu item won't show up at all.
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
hidden: boolean;
|
|
43
|
+
}> & typeof ViraMenuItem.InputsType;
|
|
44
|
+
/**
|
|
45
|
+
* A callback for menu items getting activated, to be used with {@link renderMenuItemEntries}.
|
|
46
|
+
*
|
|
47
|
+
* @category PopUp
|
|
48
|
+
*/
|
|
49
|
+
export type MenuItemClickCallback = (params: Readonly<{
|
|
50
|
+
/** The menu item's index in the array. */
|
|
51
|
+
index: number;
|
|
52
|
+
event: MouseEvent;
|
|
53
|
+
}>) => MaybePromise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* A helper for rendering a bunch of menu items.
|
|
56
|
+
*
|
|
57
|
+
* @category PopUp
|
|
58
|
+
*/
|
|
59
|
+
export declare function renderMenuItemEntries(items: ReadonlyArray<Readonly<ViraMenuItemEntry>>): import("lit-html").HTMLTemplateResult[];
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { filterMap, joinWithFinalConjunction, } from '@augment-vir/common';
|
|
2
|
+
import { html, listen } from 'element-vir';
|
|
3
|
+
import { ViraMenuItem } from '../elements/pop-up/vira-menu-item.element.js';
|
|
4
|
+
/**
|
|
5
|
+
* Verifies that all items have unique ids.
|
|
6
|
+
*
|
|
7
|
+
* @category Internal
|
|
8
|
+
*/
|
|
9
|
+
export function assertUniqueIdProps(items) {
|
|
10
|
+
const usedIds = new Set();
|
|
11
|
+
const duplicateIds = [];
|
|
12
|
+
items.forEach((option) => {
|
|
13
|
+
if (usedIds.has(option.id)) {
|
|
14
|
+
duplicateIds.push(option.id);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
usedIds.add(option.id);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
if (duplicateIds.length) {
|
|
21
|
+
throw new Error(`Duplicate option ids were given: ${joinWithFinalConjunction(duplicateIds)}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Handles toggling pop up state for `ViraDropdown`.
|
|
26
|
+
*
|
|
27
|
+
* @category Internal
|
|
28
|
+
*/
|
|
29
|
+
export function triggerPopUpState({ open, callback, popUpManager, host, options, }) {
|
|
30
|
+
if (open) {
|
|
31
|
+
const showPopUpResult = popUpManager.showPopUp(host, options);
|
|
32
|
+
callback?.(showPopUpResult);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
popUpManager.removePopUp();
|
|
36
|
+
callback?.(undefined);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A helper for rendering a bunch of menu items.
|
|
41
|
+
*
|
|
42
|
+
* @category PopUp
|
|
43
|
+
*/
|
|
44
|
+
export function renderMenuItemEntries(items) {
|
|
45
|
+
return filterMap(items, (item, index) => {
|
|
46
|
+
return html `
|
|
47
|
+
<${ViraMenuItem.assign({
|
|
48
|
+
...item,
|
|
49
|
+
})}
|
|
50
|
+
${listen('click', async (event) => {
|
|
51
|
+
if (item.disabled) {
|
|
52
|
+
event.stopImmediatePropagation();
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
await item.onClick?.({
|
|
57
|
+
event,
|
|
58
|
+
index,
|
|
59
|
+
});
|
|
60
|
+
})}
|
|
61
|
+
>
|
|
62
|
+
${item.content}
|
|
63
|
+
</${ViraMenuItem}>
|
|
64
|
+
`;
|
|
65
|
+
}, (template, menuItem) => !menuItem.hidden);
|
|
66
|
+
}
|