@threadlabs/looma 0.23.16 → 0.23.17
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/components/ui-avatar/ui-avatar.html +1 -1
- package/components/ui-avatar-group/ui-avatar-group.html +1 -3
- package/components/ui-breadcrumb-item/ui-breadcrumb-item.html +1 -1
- package/components/ui-button/ui-button.html +4 -4
- package/components/ui-combobox/ui-combobox.html +19 -21
- package/components/ui-description-item/ui-description-item.html +1 -1
- package/components/ui-dialog/ui-dialog.html +1 -1
- package/components/ui-disclosure/ui-disclosure.html +1 -1
- package/components/ui-editable/ui-editable.html +4 -4
- package/components/ui-editor-insert-table-grid/ui-editor-insert-table-grid.html +1 -1
- package/components/ui-editor-mention-menu/ui-editor-mention-menu.html +2 -2
- package/components/ui-editor-mention-menu-item/ui-editor-mention-menu-item.html +2 -2
- package/components/ui-editor-slash-menu-group/ui-editor-slash-menu-group.html +1 -1
- package/components/ui-editor-slash-menu-item/ui-editor-slash-menu-item.html +1 -1
- package/components/ui-editor-table-context-menu/ui-editor-table-context-menu.html +2 -2
- package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.html +2 -2
- package/components/ui-icon-button/ui-icon-button.html +1 -1
- package/components/ui-listbox/ui-listbox.html +2 -2
- package/components/ui-menu-group/ui-menu-group.html +1 -1
- package/components/ui-menu-item/ui-menu-item.html +1 -1
- package/components/ui-meter/ui-meter.html +7 -8
- package/components/ui-nav-item/ui-nav-item.html +2 -2
- package/components/ui-radio-group/ui-radio-group.html +1 -1
- package/components/ui-section/ui-section.html +1 -1
- package/components/ui-spinner/ui-spinner.html +4 -4
- package/components/ui-status-message/ui-status-message.html +2 -2
- package/components/ui-tabs/ui-tabs.html +1 -1
- package/components/ui-toast-region/ui-toast-region.html +1 -1
- package/components/ui-tree-item/ui-tree-item.html +3 -3
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/styles/ui-action-bar.css +1 -1
- package/styles/ui-affordance-scope.css +1 -1
- package/styles/ui-avatar-group.css +1 -1
- package/styles/ui-avatar.css +1 -1
- package/styles/ui-badge.css +1 -1
- package/styles/ui-breadcrumb-item.css +1 -1
- package/styles/ui-breadcrumbs.css +1 -1
- package/styles/ui-button.css +1 -1
- package/styles/ui-callout.css +1 -1
- package/styles/ui-card.css +1 -1
- package/styles/ui-checkbox.css +1 -1
- package/styles/ui-cluster.css +1 -1
- package/styles/ui-combobox.css +1 -1
- package/styles/ui-container.css +1 -1
- package/styles/ui-context-menu.css +1 -1
- package/styles/ui-cover.css +1 -1
- package/styles/ui-description-item.css +1 -1
- package/styles/ui-description-list.css +1 -1
- package/styles/ui-dialog.css +1 -1
- package/styles/ui-disclosure.css +1 -1
- package/styles/ui-editable.css +1 -1
- package/styles/ui-editor-insert-table-grid.css +1 -1
- package/styles/ui-editor-mention-menu-item.css +1 -1
- package/styles/ui-editor-mention-menu.css +1 -1
- package/styles/ui-editor-slash-menu-group.css +1 -1
- package/styles/ui-editor-slash-menu-item.css +1 -1
- package/styles/ui-editor-slash-menu.css +1 -1
- package/styles/ui-editor-table-context-menu.css +1 -1
- package/styles/ui-editor-table-overlay.css +1 -1
- package/styles/ui-editor-table-toolbar.css +1 -1
- package/styles/ui-editor-toolbar.css +1 -1
- package/styles/ui-floating-action-button.css +1 -1
- package/styles/ui-form-field.css +1 -1
- package/styles/ui-grid.css +1 -1
- package/styles/ui-icon-button.css +1 -1
- package/styles/ui-icon.css +1 -1
- package/styles/ui-input-group.css +1 -1
- package/styles/ui-input.css +1 -1
- package/styles/ui-list-item.css +1 -1
- package/styles/ui-list.css +1 -1
- package/styles/ui-listbox.css +1 -1
- package/styles/ui-menu-group.css +1 -1
- package/styles/ui-menu-item.css +1 -1
- package/styles/ui-menu.css +1 -1
- package/styles/ui-meter.css +1 -1
- package/styles/ui-nav-item.css +1 -1
- package/styles/ui-page-header.css +1 -1
- package/styles/ui-popover.css +1 -1
- package/styles/ui-radio-group.css +1 -1
- package/styles/ui-radio.css +1 -1
- package/styles/ui-reel.css +1 -1
- package/styles/ui-scroll-area.css +1 -1
- package/styles/ui-search-result-row.css +1 -1
- package/styles/ui-search-shell.css +1 -1
- package/styles/ui-section.css +1 -1
- package/styles/ui-select.css +1 -1
- package/styles/ui-separator.css +1 -1
- package/styles/ui-sidebar.css +1 -1
- package/styles/ui-spinner.css +1 -1
- package/styles/ui-stack.css +1 -1
- package/styles/ui-status-message.css +1 -1
- package/styles/ui-switch.css +1 -1
- package/styles/ui-switcher.css +1 -1
- package/styles/ui-table.css +1 -1
- package/styles/ui-tabs.css +1 -1
- package/styles/ui-text.css +1 -1
- package/styles/ui-textarea.css +1 -1
- package/styles/ui-toast-region.css +1 -1
- package/styles/ui-toast.css +1 -1
- package/styles/ui-tooltip.css +1 -1
- package/styles/ui-top-bar.css +1 -1
- package/styles/ui-tree-item.css +1 -1
- package/styles/ui-tree.css +1 -1
- package/vanilla/UiActionBar.d.ts +1 -1
- package/vanilla/UiActionBar.js +1 -1
- package/vanilla/UiAffordanceScope.d.ts +1 -1
- package/vanilla/UiAffordanceScope.js +1 -1
- package/vanilla/UiAvatar.d.ts +1 -1
- package/vanilla/UiAvatar.js +9 -7
- package/vanilla/UiAvatarGroup.d.ts +1 -1
- package/vanilla/UiAvatarGroup.js +4 -4
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +1 -1
- package/vanilla/UiBreadcrumbItem.d.ts +1 -1
- package/vanilla/UiBreadcrumbItem.js +2 -2
- package/vanilla/UiBreadcrumbs.d.ts +1 -1
- package/vanilla/UiBreadcrumbs.js +1 -1
- package/vanilla/UiButton.d.ts +1 -1
- package/vanilla/UiButton.js +2 -2
- package/vanilla/UiCallout.d.ts +1 -1
- package/vanilla/UiCallout.js +1 -1
- package/vanilla/UiCard.d.ts +1 -1
- package/vanilla/UiCard.js +1 -1
- package/vanilla/UiCheckbox.d.ts +1 -1
- package/vanilla/UiCheckbox.js +1 -1
- package/vanilla/UiCluster.d.ts +1 -1
- package/vanilla/UiCluster.js +1 -1
- package/vanilla/UiCombobox.d.ts +1 -1
- package/vanilla/UiCombobox.js +29 -25
- package/vanilla/UiContainer.d.ts +1 -1
- package/vanilla/UiContainer.js +1 -1
- package/vanilla/UiContextMenu.d.ts +1 -1
- package/vanilla/UiContextMenu.js +1 -1
- package/vanilla/UiCover.d.ts +1 -1
- package/vanilla/UiCover.js +1 -1
- package/vanilla/UiDescriptionItem.d.ts +1 -1
- package/vanilla/UiDescriptionItem.js +5 -5
- package/vanilla/UiDescriptionList.d.ts +1 -1
- package/vanilla/UiDescriptionList.js +1 -1
- package/vanilla/UiDialog.d.ts +1 -1
- package/vanilla/UiDialog.js +16 -14
- package/vanilla/UiDisclosure.d.ts +1 -1
- package/vanilla/UiDisclosure.js +4 -4
- package/vanilla/UiEditable.d.ts +1 -1
- package/vanilla/UiEditable.js +35 -27
- package/vanilla/UiEditorInsertTableGrid.d.ts +1 -1
- package/vanilla/UiEditorInsertTableGrid.js +20 -18
- package/vanilla/UiEditorMentionMenu.d.ts +1 -1
- package/vanilla/UiEditorMentionMenu.js +27 -25
- package/vanilla/UiEditorMentionMenuItem.d.ts +1 -1
- package/vanilla/UiEditorMentionMenuItem.js +6 -4
- package/vanilla/UiEditorSlashMenu.d.ts +1 -1
- package/vanilla/UiEditorSlashMenu.js +1 -1
- package/vanilla/UiEditorSlashMenuGroup.d.ts +1 -1
- package/vanilla/UiEditorSlashMenuGroup.js +9 -7
- package/vanilla/UiEditorSlashMenuItem.d.ts +1 -1
- package/vanilla/UiEditorSlashMenuItem.js +4 -2
- package/vanilla/UiEditorTableContextMenu.d.ts +1 -1
- package/vanilla/UiEditorTableContextMenu.js +2 -2
- package/vanilla/UiEditorTableOverlay.d.ts +1 -1
- package/vanilla/UiEditorTableOverlay.js +1 -1
- package/vanilla/UiEditorTableToolbar.d.ts +1 -1
- package/vanilla/UiEditorTableToolbar.js +2 -2
- package/vanilla/UiEditorToolbar.d.ts +1 -1
- package/vanilla/UiEditorToolbar.js +1 -1
- package/vanilla/UiFloatingActionButton.d.ts +1 -1
- package/vanilla/UiFloatingActionButton.js +1 -1
- package/vanilla/UiFormField.d.ts +1 -1
- package/vanilla/UiFormField.js +1 -1
- package/vanilla/UiGrid.d.ts +1 -1
- package/vanilla/UiGrid.js +1 -1
- package/vanilla/UiIcon.d.ts +1 -1
- package/vanilla/UiIcon.js +1 -1
- package/vanilla/UiIconButton.d.ts +1 -1
- package/vanilla/UiIconButton.js +2 -2
- package/vanilla/UiInput.d.ts +1 -1
- package/vanilla/UiInput.js +1 -1
- package/vanilla/UiInputGroup.d.ts +1 -1
- package/vanilla/UiInputGroup.js +1 -1
- package/vanilla/UiList.d.ts +1 -1
- package/vanilla/UiList.js +1 -1
- package/vanilla/UiListItem.d.ts +1 -1
- package/vanilla/UiListItem.js +1 -1
- package/vanilla/UiListbox.d.ts +1 -1
- package/vanilla/UiListbox.js +2 -2
- package/vanilla/UiMenu.d.ts +1 -1
- package/vanilla/UiMenu.js +1 -1
- package/vanilla/UiMenuGroup.d.ts +1 -1
- package/vanilla/UiMenuGroup.js +4 -2
- package/vanilla/UiMenuItem.d.ts +1 -1
- package/vanilla/UiMenuItem.js +2 -2
- package/vanilla/UiMeter.d.ts +1 -1
- package/vanilla/UiMeter.js +2 -2
- package/vanilla/UiNavItem.d.ts +1 -1
- package/vanilla/UiNavItem.js +2 -2
- package/vanilla/UiPageHeader.d.ts +1 -1
- package/vanilla/UiPageHeader.js +1 -1
- package/vanilla/UiPopover.d.ts +1 -1
- package/vanilla/UiPopover.js +1 -1
- package/vanilla/UiRadio.d.ts +1 -1
- package/vanilla/UiRadio.js +1 -1
- package/vanilla/UiRadioGroup.d.ts +1 -1
- package/vanilla/UiRadioGroup.js +4 -4
- package/vanilla/UiReel.d.ts +1 -1
- package/vanilla/UiReel.js +1 -1
- package/vanilla/UiScrollArea.d.ts +1 -1
- package/vanilla/UiScrollArea.js +1 -1
- package/vanilla/UiSearchResultRow.d.ts +1 -1
- package/vanilla/UiSearchResultRow.js +1 -1
- package/vanilla/UiSearchShell.d.ts +1 -1
- package/vanilla/UiSearchShell.js +1 -1
- package/vanilla/UiSection.d.ts +1 -1
- package/vanilla/UiSection.js +4 -4
- package/vanilla/UiSelect.d.ts +1 -1
- package/vanilla/UiSelect.js +1 -1
- package/vanilla/UiSeparator.d.ts +1 -1
- package/vanilla/UiSeparator.js +1 -1
- package/vanilla/UiSidebar.d.ts +1 -1
- package/vanilla/UiSidebar.js +1 -1
- package/vanilla/UiSpinner.d.ts +1 -1
- package/vanilla/UiSpinner.js +2 -2
- package/vanilla/UiStack.d.ts +1 -1
- package/vanilla/UiStack.js +1 -1
- package/vanilla/UiStatusMessage.d.ts +1 -1
- package/vanilla/UiStatusMessage.js +4 -4
- package/vanilla/UiSwitch.d.ts +1 -1
- package/vanilla/UiSwitch.js +1 -1
- package/vanilla/UiSwitcher.d.ts +1 -1
- package/vanilla/UiSwitcher.js +1 -1
- package/vanilla/UiTable.d.ts +1 -1
- package/vanilla/UiTable.js +1 -1
- package/vanilla/UiTabs.d.ts +1 -1
- package/vanilla/UiTabs.js +2 -2
- package/vanilla/UiText.d.ts +1 -1
- package/vanilla/UiText.js +1 -1
- package/vanilla/UiTextarea.d.ts +1 -1
- package/vanilla/UiTextarea.js +1 -1
- package/vanilla/UiToast.d.ts +1 -1
- package/vanilla/UiToast.js +1 -1
- package/vanilla/UiToastRegion.d.ts +1 -1
- package/vanilla/UiToastRegion.js +2 -2
- package/vanilla/UiTooltip.d.ts +1 -1
- package/vanilla/UiTooltip.js +1 -1
- package/vanilla/UiTopBar.d.ts +1 -1
- package/vanilla/UiTopBar.js +1 -1
- package/vanilla/UiTree.d.ts +1 -1
- package/vanilla/UiTree.js +1 -1
- package/vanilla/UiTreeItem.d.ts +1 -1
- package/vanilla/UiTreeItem.js +4 -4
- package/vue/UiActionBar.vue +1 -1
- package/vue/UiAffordanceScope.vue +1 -1
- package/vue/UiAvatar.vue +1 -1
- package/vue/UiAvatarGroup.vue +9 -2
- package/vue/UiBadge.vue +1 -1
- package/vue/UiBreadcrumbItem.vue +55 -9
- package/vue/UiBreadcrumbs.vue +1 -1
- package/vue/UiButton.vue +162 -37
- package/vue/UiCallout.vue +1 -1
- package/vue/UiCard.vue +1 -1
- package/vue/UiCheckbox.vue +8 -1
- package/vue/UiCluster.vue +1 -1
- package/vue/UiCombobox.d.ts +1 -1
- package/vue/UiCombobox.vue +190 -73
- package/vue/UiContainer.vue +1 -1
- package/vue/UiContextMenu.vue +1 -1
- package/vue/UiCover.vue +1 -1
- package/vue/UiDescriptionItem.vue +1 -1
- package/vue/UiDescriptionList.vue +1 -1
- package/vue/UiDialog.vue +1 -1
- package/vue/UiDisclosure.vue +1 -1
- package/vue/UiEditable.vue +9 -4
- package/vue/UiEditorInsertTableGrid.vue +19 -2
- package/vue/UiEditorMentionMenu.vue +20 -2
- package/vue/UiEditorMentionMenuItem.vue +1 -1
- package/vue/UiEditorSlashMenu.vue +1 -1
- package/vue/UiEditorSlashMenuGroup.vue +1 -1
- package/vue/UiEditorSlashMenuItem.vue +1 -1
- package/vue/UiEditorTableContextMenu.vue +46 -5
- package/vue/UiEditorTableOverlay.vue +55 -26
- package/vue/UiEditorTableToolbar.vue +46 -5
- package/vue/UiEditorToolbar.vue +1 -1
- package/vue/UiFloatingActionButton.vue +1 -1
- package/vue/UiFormField.vue +1 -1
- package/vue/UiGrid.vue +1 -1
- package/vue/UiIcon.vue +1 -1
- package/vue/UiIconButton.vue +58 -14
- package/vue/UiInput.vue +1 -1
- package/vue/UiInputGroup.vue +1 -1
- package/vue/UiList.vue +1 -1
- package/vue/UiListItem.vue +1 -1
- package/vue/UiListbox.vue +47 -13
- package/vue/UiMenu.vue +1 -1
- package/vue/UiMenuGroup.vue +1 -1
- package/vue/UiMenuItem.vue +46 -10
- package/vue/UiMeter.d.ts +2 -2
- package/vue/UiMeter.vue +675 -97
- package/vue/UiNavItem.vue +97 -39
- package/vue/UiPageHeader.vue +1 -1
- package/vue/UiPopover.vue +1 -1
- package/vue/UiRadio.vue +8 -1
- package/vue/UiRadioGroup.vue +1 -1
- package/vue/UiReel.vue +1 -1
- package/vue/UiScrollArea.vue +1 -1
- package/vue/UiSearchResultRow.vue +1 -1
- package/vue/UiSearchShell.vue +1 -1
- package/vue/UiSection.vue +1 -1
- package/vue/UiSelect.vue +1 -1
- package/vue/UiSeparator.vue +1 -1
- package/vue/UiSidebar.vue +1 -1
- package/vue/UiSpinner.vue +159 -31
- package/vue/UiStack.vue +1 -1
- package/vue/UiStatusMessage.vue +42 -4
- package/vue/UiSwitch.vue +8 -1
- package/vue/UiSwitcher.vue +1 -1
- package/vue/UiTable.vue +1 -1
- package/vue/UiTabs.vue +20 -2
- package/vue/UiText.d.ts +1 -1
- package/vue/UiText.vue +1 -1
- package/vue/UiTextarea.vue +1 -1
- package/vue/UiToast.vue +1 -1
- package/vue/UiToastRegion.vue +20 -2
- package/vue/UiTooltip.vue +1 -1
- package/vue/UiTopBar.vue +1 -1
- package/vue/UiTree.vue +1 -1
- package/vue/UiTreeItem.vue +113 -25
- package/vue/chunks/UiActionBar.js +1 -1
- package/vue/chunks/UiAffordanceScope.js +1 -1
- package/vue/chunks/UiAvatar.js +1 -1
- package/vue/chunks/UiAvatarGroup.js +7 -2
- package/vue/chunks/UiBadge.js +1 -1
- package/vue/chunks/UiBreadcrumbItem.js +27 -12
- package/vue/chunks/UiBreadcrumbs.js +1 -1
- package/vue/chunks/UiButton.js +67 -29
- package/vue/chunks/UiCallout.js +1 -1
- package/vue/chunks/UiCard.js +1 -1
- package/vue/chunks/UiCheckbox.js +6 -1
- package/vue/chunks/UiCluster.js +1 -1
- package/vue/chunks/UiCombobox.js +155 -56
- package/vue/chunks/UiContainer.js +1 -1
- package/vue/chunks/UiContextMenu.js +1 -1
- package/vue/chunks/UiCover.js +1 -1
- package/vue/chunks/UiDescriptionItem.js +1 -1
- package/vue/chunks/UiDescriptionList.js +1 -1
- package/vue/chunks/UiDialog.js +1 -1
- package/vue/chunks/UiDisclosure.js +1 -1
- package/vue/chunks/UiEditable.js +10 -5
- package/vue/chunks/UiEditorInsertTableGrid.js +18 -3
- package/vue/chunks/UiEditorMentionMenu.js +8 -2
- package/vue/chunks/UiEditorMentionMenuItem.js +1 -1
- package/vue/chunks/UiEditorSlashMenu.js +1 -1
- package/vue/chunks/UiEditorSlashMenuGroup.js +1 -1
- package/vue/chunks/UiEditorSlashMenuItem.js +1 -1
- package/vue/chunks/UiEditorTableContextMenu.js +13 -7
- package/vue/chunks/UiEditorTableOverlay.js +43 -23
- package/vue/chunks/UiEditorTableToolbar.js +13 -7
- package/vue/chunks/UiEditorToolbar.js +1 -1
- package/vue/chunks/UiFloatingActionButton.js +1 -1
- package/vue/chunks/UiFormField.js +1 -1
- package/vue/chunks/UiGrid.js +1 -1
- package/vue/chunks/UiIcon.js +1 -1
- package/vue/chunks/UiIconButton.js +25 -11
- package/vue/chunks/UiInput.js +1 -1
- package/vue/chunks/UiInputGroup.js +1 -1
- package/vue/chunks/UiList.js +1 -1
- package/vue/chunks/UiListItem.js +1 -1
- package/vue/chunks/UiListbox.js +29 -15
- package/vue/chunks/UiMenu.js +1 -1
- package/vue/chunks/UiMenuGroup.js +1 -1
- package/vue/chunks/UiMenuItem.js +23 -9
- package/vue/chunks/UiMeter.js +373 -37
- package/vue/chunks/UiNavItem.js +67 -39
- package/vue/chunks/UiPageHeader.js +1 -1
- package/vue/chunks/UiPopover.js +1 -1
- package/vue/chunks/UiRadio.js +6 -1
- package/vue/chunks/UiRadioGroup.js +1 -1
- package/vue/chunks/UiReel.js +1 -1
- package/vue/chunks/UiScrollArea.js +1 -1
- package/vue/chunks/UiSearchResultRow.js +1 -1
- package/vue/chunks/UiSearchShell.js +1 -1
- package/vue/chunks/UiSection.js +1 -1
- package/vue/chunks/UiSelect.js +1 -1
- package/vue/chunks/UiSeparator.js +1 -1
- package/vue/chunks/UiSidebar.js +1 -1
- package/vue/chunks/UiSpinner.js +75 -36
- package/vue/chunks/UiStack.js +1 -1
- package/vue/chunks/UiStatusMessage.js +21 -6
- package/vue/chunks/UiSwitch.js +6 -1
- package/vue/chunks/UiSwitcher.js +1 -1
- package/vue/chunks/UiTable.js +1 -1
- package/vue/chunks/UiTabs.js +8 -2
- package/vue/chunks/UiText.js +1 -1
- package/vue/chunks/UiTextarea.js +1 -1
- package/vue/chunks/UiToast.js +1 -1
- package/vue/chunks/UiToastRegion.js +8 -2
- package/vue/chunks/UiTooltip.js +1 -1
- package/vue/chunks/UiTopBar.js +1 -1
- package/vue/chunks/UiTree.js +1 -1
- package/vue/chunks/UiTreeItem.js +52 -19
- package/vue/chunks/props.js +11 -6
- package/vue/components.css +1302 -1302
- package/vue/host.ts +15 -3
package/vue/UiMeter.vue
CHANGED
|
@@ -1,4 +1,353 @@
|
|
|
1
|
-
<!-- Generated by HTML Next 1.0.0-alpha.
|
|
1
|
+
<!-- Generated by HTML Next 1.0.0-alpha.25 for Vue 3.5. Do not edit. -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
function createFormatValue(): any {
|
|
4
|
+
// FIFO bounds native instances and retained keys; only constructor inputs, never values, are cached.
|
|
5
|
+
const cache = new Map()
|
|
6
|
+
function formatterFor(name: any, locale: any, options: any) {
|
|
7
|
+
const constructor = Reflect.get(Intl, name)
|
|
8
|
+
// There is no cheap native query for changes to the default time zone. Keep native lookup for
|
|
9
|
+
// instants without an explicit zone; civil HTML values already supply their fixed UTC anchor.
|
|
10
|
+
if (name === 'DateTimeFormat' && options.timeZone === undefined) {
|
|
11
|
+
return new constructor(locale, options)
|
|
12
|
+
}
|
|
13
|
+
const entries = []
|
|
14
|
+
for (const key of Object.keys(options).sort()) {
|
|
15
|
+
const value = options[key]
|
|
16
|
+
if (value === undefined) {
|
|
17
|
+
continue
|
|
18
|
+
}
|
|
19
|
+
// Native option coercion can observe mutable objects. Bypass caching rather than stringify
|
|
20
|
+
// them or collapse NaN/infinity into null, which would change validation and side effects.
|
|
21
|
+
if (
|
|
22
|
+
value !== null && typeof value !== 'string' && typeof value !== 'boolean'
|
|
23
|
+
&& typeof value !== 'number'
|
|
24
|
+
|| typeof value === 'number' && !Number.isFinite(value)
|
|
25
|
+
) {
|
|
26
|
+
return new constructor(locale, options)
|
|
27
|
+
}
|
|
28
|
+
entries.push([key, typeof value, Object.is(value, -0) ? '-0' : value])
|
|
29
|
+
}
|
|
30
|
+
const language = locale === undefined && typeof navigator !== 'undefined'
|
|
31
|
+
? navigator.language
|
|
32
|
+
: undefined
|
|
33
|
+
const key = JSON.stringify([name, locale, language, entries])
|
|
34
|
+
if (key.length > 4096) {
|
|
35
|
+
return new constructor(locale, options)
|
|
36
|
+
}
|
|
37
|
+
const cached = cache.get(key)
|
|
38
|
+
if (cached !== undefined && cached.constructor === constructor) {
|
|
39
|
+
return cached.value
|
|
40
|
+
}
|
|
41
|
+
const value = new constructor(locale, options)
|
|
42
|
+
if (cache.size >= 128 && !cache.has(key)) {
|
|
43
|
+
cache.delete(cache.keys().next().value)
|
|
44
|
+
}
|
|
45
|
+
cache.set(key, { constructor, value })
|
|
46
|
+
return value
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The native Intl adapter. Self-contained so converters emit this same implementation only when
|
|
50
|
+
* authored expressions use formatting, without importing the live parser or interpreter.
|
|
51
|
+
* undefined is absence; the shared invalid-result symbol tells each target to retain its output.
|
|
52
|
+
*/
|
|
53
|
+
return function formatValue(value: any, inputType: any, operation: any, ...args: any[]) {
|
|
54
|
+
const invalid = Symbol.for('html-next.invalid-result')
|
|
55
|
+
if (value === invalid || args.includes(invalid)) {
|
|
56
|
+
return invalid
|
|
57
|
+
}
|
|
58
|
+
if (value === undefined || value === null || args.some((arg: any) => arg === undefined)) {
|
|
59
|
+
return undefined
|
|
60
|
+
}
|
|
61
|
+
const end = operation === 'formatRange' ? args.shift() : undefined
|
|
62
|
+
if (operation === 'formatRange' && (end === null || end === undefined)) {
|
|
63
|
+
return undefined
|
|
64
|
+
}
|
|
65
|
+
const explicit = typeof args[0] === 'string'
|
|
66
|
+
const defaults = {
|
|
67
|
+
number: 'number',
|
|
68
|
+
integer: 'number',
|
|
69
|
+
percentage: 'percent',
|
|
70
|
+
date: 'date',
|
|
71
|
+
time: 'time',
|
|
72
|
+
datetime: 'dateTime',
|
|
73
|
+
'datetime-local': 'dateTime',
|
|
74
|
+
duration: 'duration',
|
|
75
|
+
list: 'list',
|
|
76
|
+
}
|
|
77
|
+
const format = explicit ? args.shift() : Reflect.get(defaults, inputType ?? '')
|
|
78
|
+
const options = args.length > 0 ? args.shift() : {}
|
|
79
|
+
const locale = args.shift()
|
|
80
|
+
if (
|
|
81
|
+
args.length > 0 || !format || options === null || typeof options !== 'object'
|
|
82
|
+
|| Array.isArray(options) || locale !== undefined && typeof locale !== 'string'
|
|
83
|
+
) {
|
|
84
|
+
return invalid
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const durationFields = [
|
|
88
|
+
'years',
|
|
89
|
+
'months',
|
|
90
|
+
'weeks',
|
|
91
|
+
'days',
|
|
92
|
+
'hours',
|
|
93
|
+
'minutes',
|
|
94
|
+
'seconds',
|
|
95
|
+
'milliseconds',
|
|
96
|
+
'microseconds',
|
|
97
|
+
'nanoseconds',
|
|
98
|
+
]
|
|
99
|
+
const settings = { ...options }
|
|
100
|
+
let formatter
|
|
101
|
+
let input = value
|
|
102
|
+
let last = end
|
|
103
|
+
let zoneFree = false
|
|
104
|
+
if (['number', 'currency', 'percent', 'unit'].includes(format)) {
|
|
105
|
+
if (format !== 'number') {
|
|
106
|
+
if (settings.style !== undefined && settings.style !== format) {
|
|
107
|
+
return invalid
|
|
108
|
+
}
|
|
109
|
+
settings.style = format
|
|
110
|
+
}
|
|
111
|
+
const quantity = (candidate: any) => {
|
|
112
|
+
if (
|
|
113
|
+
inputType === 'percentage' && typeof candidate === 'string'
|
|
114
|
+
&& /^-?(?:\d+(?:\.\d+)?|\.\d+)%$/.test(candidate)
|
|
115
|
+
) {
|
|
116
|
+
return Number(candidate.slice(0, -1)) / 100
|
|
117
|
+
}
|
|
118
|
+
return candidate
|
|
119
|
+
}
|
|
120
|
+
input = quantity(input)
|
|
121
|
+
last = quantity(last)
|
|
122
|
+
if (
|
|
123
|
+
typeof input !== 'number' || !Number.isFinite(input)
|
|
124
|
+
|| operation === 'formatRange' && (typeof last !== 'number' || !Number.isFinite(last))
|
|
125
|
+
) {
|
|
126
|
+
return invalid
|
|
127
|
+
}
|
|
128
|
+
formatter = formatterFor('NumberFormat', locale, settings)
|
|
129
|
+
} else if (['date', 'time', 'dateTime'].includes(format)) {
|
|
130
|
+
const civil = inputType === 'date' || inputType === 'time' || inputType === 'datetime-local'
|
|
131
|
+
|| typeof input === 'string' && !/(?:Z|[+-]\d\d:\d\d)$/.test(input)
|
|
132
|
+
zoneFree = civil
|
|
133
|
+
if (civil && (settings.timeZone !== undefined || settings.timeZoneName !== undefined)) {
|
|
134
|
+
return invalid
|
|
135
|
+
}
|
|
136
|
+
if (
|
|
137
|
+
format === 'date'
|
|
138
|
+
&& (settings.timeStyle !== undefined
|
|
139
|
+
|| ['hour', 'minute', 'second', 'dayPeriod', 'fractionalSecondDigits'].some((
|
|
140
|
+
key: any,
|
|
141
|
+
) => settings[key] !== undefined))
|
|
142
|
+
|| format === 'time'
|
|
143
|
+
&& (settings.dateStyle !== undefined
|
|
144
|
+
|| ['year', 'month', 'day', 'weekday', 'era'].some((key: any) =>
|
|
145
|
+
settings[key] !== undefined
|
|
146
|
+
))
|
|
147
|
+
) {
|
|
148
|
+
return invalid
|
|
149
|
+
}
|
|
150
|
+
const fields = [
|
|
151
|
+
'year',
|
|
152
|
+
'month',
|
|
153
|
+
'day',
|
|
154
|
+
'weekday',
|
|
155
|
+
'era',
|
|
156
|
+
'hour',
|
|
157
|
+
'minute',
|
|
158
|
+
'second',
|
|
159
|
+
'dayPeriod',
|
|
160
|
+
'fractionalSecondDigits',
|
|
161
|
+
]
|
|
162
|
+
if (
|
|
163
|
+
settings.dateStyle === undefined && settings.timeStyle === undefined
|
|
164
|
+
&& !fields.some((key: any) => settings[key] !== undefined)
|
|
165
|
+
) {
|
|
166
|
+
if (format !== 'time') {
|
|
167
|
+
settings.dateStyle = 'medium'
|
|
168
|
+
}
|
|
169
|
+
if (format !== 'date') {
|
|
170
|
+
settings.timeStyle = 'medium'
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (civil) {
|
|
174
|
+
settings.timeZone = 'UTC'
|
|
175
|
+
}
|
|
176
|
+
const asDate = (candidate: any) => {
|
|
177
|
+
if (typeof candidate === 'number' && Number.isFinite(candidate)) {
|
|
178
|
+
return new Date(candidate)
|
|
179
|
+
}
|
|
180
|
+
if (typeof candidate !== 'string') {
|
|
181
|
+
return undefined
|
|
182
|
+
}
|
|
183
|
+
let written = candidate.replace(' ', 'T')
|
|
184
|
+
if (/^\d\d:\d\d(?::\d\d(?:\.\d{1,3})?)?$/.test(written)) {
|
|
185
|
+
if (format !== 'time') {
|
|
186
|
+
return undefined
|
|
187
|
+
}
|
|
188
|
+
written = '1970-01-01T' + written + 'Z'
|
|
189
|
+
} else if (/^\d{4,}-\d\d-\d\d$/.test(written)) {
|
|
190
|
+
if (format !== 'date') {
|
|
191
|
+
return undefined
|
|
192
|
+
}
|
|
193
|
+
written += 'T00:00:00Z'
|
|
194
|
+
} else if (/^\d{4,}-\d\d-\d\dT\d\d:\d\d(?::\d\d(?:\.\d{1,3})?)?$/.test(written)) {
|
|
195
|
+
written += 'Z'
|
|
196
|
+
} else if (
|
|
197
|
+
!/^\d{4,}-\d\d-\d\dT\d\d:\d\d(?::\d\d(?:\.\d{1,3})?)?(?:Z|[+-]\d\d:\d\d)$/.test(written)
|
|
198
|
+
) {
|
|
199
|
+
return undefined
|
|
200
|
+
}
|
|
201
|
+
const date = new Date(
|
|
202
|
+
written.replace(/^(\d{5,})-/, (_match: any, year: any) =>
|
|
203
|
+
'+' + year.padStart(6, '0') + '-'),
|
|
204
|
+
)
|
|
205
|
+
if (!Number.isFinite(date.getTime())) {
|
|
206
|
+
return undefined
|
|
207
|
+
}
|
|
208
|
+
// Native Date normalizes invalid days; authored HTML dates must not roll into another day.
|
|
209
|
+
const match = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d))?/.exec(written)
|
|
210
|
+
if (!match) {
|
|
211
|
+
return undefined
|
|
212
|
+
}
|
|
213
|
+
const probe = new Date(0)
|
|
214
|
+
probe.setUTCFullYear(Number(match[1]), Number(match[2]) - 1, Number(match[3]))
|
|
215
|
+
if (
|
|
216
|
+
Number(match[1]) === 0 || probe.getUTCMonth() !== Number(match[2]) - 1
|
|
217
|
+
|| probe.getUTCDate() !== Number(match[3]) || Number(match[4]) > 23
|
|
218
|
+
|| Number(match[5]) > 59 || Number(match[6] ?? 0) > 59
|
|
219
|
+
) {
|
|
220
|
+
return undefined
|
|
221
|
+
}
|
|
222
|
+
return date
|
|
223
|
+
}
|
|
224
|
+
input = asDate(input)
|
|
225
|
+
last = operation === 'formatRange' ? asDate(last) : undefined
|
|
226
|
+
if (!input || operation === 'formatRange' && !last) {
|
|
227
|
+
return invalid
|
|
228
|
+
}
|
|
229
|
+
formatter = formatterFor('DateTimeFormat', locale, settings)
|
|
230
|
+
} else {
|
|
231
|
+
if (operation === 'formatRange') {
|
|
232
|
+
return invalid
|
|
233
|
+
}
|
|
234
|
+
if (format === 'relativeTime') {
|
|
235
|
+
if (
|
|
236
|
+
typeof input !== 'number' || !Number.isFinite(input)
|
|
237
|
+
|| typeof settings.unit !== 'string'
|
|
238
|
+
) {
|
|
239
|
+
return invalid
|
|
240
|
+
}
|
|
241
|
+
const unit = settings.unit
|
|
242
|
+
delete settings.unit
|
|
243
|
+
formatter = formatterFor('RelativeTimeFormat', locale, settings)
|
|
244
|
+
return operation === 'formatParts'
|
|
245
|
+
? formatter.formatToParts(input, unit)
|
|
246
|
+
: formatter.format(input, unit)
|
|
247
|
+
}
|
|
248
|
+
if (format === 'list') {
|
|
249
|
+
if (!Array.isArray(input) || input.some((item: any) => typeof item !== 'string')) {
|
|
250
|
+
return invalid
|
|
251
|
+
}
|
|
252
|
+
formatter = formatterFor('ListFormat', locale, settings)
|
|
253
|
+
} else if (format === 'duration') {
|
|
254
|
+
if (inputType === 'duration' && typeof input === 'string') {
|
|
255
|
+
const match = /^(-?(?:\d+(?:\.\d+)?|\.\d+))(ms|s)$/.exec(input)
|
|
256
|
+
if (!match) {
|
|
257
|
+
return invalid
|
|
258
|
+
}
|
|
259
|
+
const milliseconds = Number(match[1]) * (match[2] === 's' ? 1000 : 1)
|
|
260
|
+
if (!Number.isFinite(milliseconds)) {
|
|
261
|
+
return invalid
|
|
262
|
+
}
|
|
263
|
+
const hours = Math.trunc(milliseconds / 3600000)
|
|
264
|
+
const minutes = Math.trunc((milliseconds % 3600000) / 60000)
|
|
265
|
+
const seconds = Math.trunc((milliseconds % 60000) / 1000)
|
|
266
|
+
input = {
|
|
267
|
+
hours,
|
|
268
|
+
minutes,
|
|
269
|
+
seconds,
|
|
270
|
+
milliseconds: Math.trunc(milliseconds % 1000),
|
|
271
|
+
microseconds: Math.trunc((milliseconds - Math.trunc(milliseconds)) * 1000),
|
|
272
|
+
nanoseconds: Math.round(
|
|
273
|
+
(milliseconds * 1000 - Math.trunc(milliseconds * 1000)) * 1000,
|
|
274
|
+
),
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (
|
|
278
|
+
input === null || typeof input !== 'object' || Array.isArray(input)
|
|
279
|
+
|| Object.keys(input).some((key: any) => !durationFields.includes(key))
|
|
280
|
+
) {
|
|
281
|
+
return invalid
|
|
282
|
+
}
|
|
283
|
+
const DurationFormat = Reflect.get(Intl, 'DurationFormat')
|
|
284
|
+
if (!DurationFormat) {
|
|
285
|
+
return invalid
|
|
286
|
+
}
|
|
287
|
+
formatter = formatterFor('DurationFormat', locale, settings)
|
|
288
|
+
} else if (format === 'displayName') {
|
|
289
|
+
if (typeof input !== 'string' || operation === 'formatParts') {
|
|
290
|
+
return invalid
|
|
291
|
+
}
|
|
292
|
+
return formatterFor('DisplayNames', locale, settings).of(input)
|
|
293
|
+
} else if (format === 'plural') {
|
|
294
|
+
if (typeof input !== 'number' || !Number.isFinite(input) || operation === 'formatParts') {
|
|
295
|
+
return invalid
|
|
296
|
+
}
|
|
297
|
+
const forms = settings.forms
|
|
298
|
+
if (
|
|
299
|
+
!forms || typeof forms !== 'object' || Array.isArray(forms)
|
|
300
|
+
|| typeof forms.other !== 'string' || Object.entries(forms).some(([key, entry]: any) =>
|
|
301
|
+
!['zero', 'one', 'two', 'few', 'many', 'other'].includes(key)
|
|
302
|
+
|| typeof entry !== 'string'
|
|
303
|
+
)
|
|
304
|
+
) {
|
|
305
|
+
return invalid
|
|
306
|
+
}
|
|
307
|
+
delete settings.forms
|
|
308
|
+
const category = formatterFor('PluralRules', locale, settings).select(input)
|
|
309
|
+
const message = forms[category] ?? forms.other
|
|
310
|
+
const numberOptions = { ...settings }
|
|
311
|
+
delete numberOptions.type
|
|
312
|
+
delete numberOptions.forms
|
|
313
|
+
const number = formatterFor('NumberFormat', locale, numberOptions).format(input)
|
|
314
|
+
return message.replace(/#/g, () => number)
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (!zoneFree && operation !== 'formatParts') {
|
|
318
|
+
return operation === 'formatRange'
|
|
319
|
+
? formatter.formatRange(input, last)
|
|
320
|
+
: formatter.format(input)
|
|
321
|
+
}
|
|
322
|
+
const parts = operation === 'formatRange'
|
|
323
|
+
? formatter.formatRangeToParts(input, last)
|
|
324
|
+
: formatter.formatToParts(input)
|
|
325
|
+
if (
|
|
326
|
+
zoneFree && operation !== 'formatParts'
|
|
327
|
+
&& !parts.some((part: any) => part.type === 'timeZoneName')
|
|
328
|
+
) {
|
|
329
|
+
return operation === 'formatRange'
|
|
330
|
+
? formatter.formatRange(input, last)
|
|
331
|
+
: formatter.format(input)
|
|
332
|
+
}
|
|
333
|
+
const visible = zoneFree
|
|
334
|
+
? parts.filter((part: any, index: any) =>
|
|
335
|
+
part.type !== 'timeZoneName'
|
|
336
|
+
&& !(part.type === 'literal' && /^[\s(),]*$/.test(part.value)
|
|
337
|
+
&& (parts[index - 1]?.type === 'timeZoneName'
|
|
338
|
+
|| parts[index + 1]?.type === 'timeZoneName'))
|
|
339
|
+
)
|
|
340
|
+
: parts
|
|
341
|
+
return operation === 'formatParts' ? visible : visible.map((part: any) => part.value).join('')
|
|
342
|
+
} catch {
|
|
343
|
+
return invalid
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const moduleFormatValue = createFormatValue()
|
|
349
|
+
</script>
|
|
350
|
+
|
|
2
351
|
<script setup lang="ts">
|
|
3
352
|
import { computed, getCurrentInstance, watchSyncEffect } from 'vue'
|
|
4
353
|
import type { PropType } from 'vue'
|
|
@@ -6,6 +355,8 @@ import { checkedProp, vPropValidity } from './props'
|
|
|
6
355
|
|
|
7
356
|
defineOptions({ inheritAttrs: false })
|
|
8
357
|
|
|
358
|
+
const formatValue = moduleFormatValue
|
|
359
|
+
|
|
9
360
|
const propValidityContract = {
|
|
10
361
|
props: {
|
|
11
362
|
label: {
|
|
@@ -63,7 +414,7 @@ const propValidityContract = {
|
|
|
63
414
|
required: false,
|
|
64
415
|
target: { attribute: 'valuetext' },
|
|
65
416
|
description:
|
|
66
|
-
'The value as assistive technology reads it ("$750 of $1,240 collected", "3 of 5 done, overdue"). Empty reads the percentage.',
|
|
417
|
+
'The value as assistive technology reads it ("$750 of $1,240 collected", "3 of 5 done, overdue"). Empty reads the whole percentage in the current\n locale.',
|
|
67
418
|
default: '',
|
|
68
419
|
},
|
|
69
420
|
},
|
|
@@ -203,73 +554,233 @@ function cycleCheckedComputed<T>(evaluate: () => T) {
|
|
|
203
554
|
},
|
|
204
555
|
})
|
|
205
556
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
? undefined
|
|
226
|
-
: number(amount.value)! / number(checkedProps.value.max)!,
|
|
227
|
-
)! * number(100)!,
|
|
228
|
-
false: 0,
|
|
229
|
-
}) as Record<string, any>)[
|
|
230
|
-
`${(number(checkedProps.value.max) === undefined || number(0) === undefined
|
|
231
|
-
? undefined
|
|
232
|
-
: number(checkedProps.value.max)! > number(0)!)}`
|
|
233
|
-
]
|
|
234
|
-
)
|
|
235
|
-
const whole = cycleCheckedComputed(
|
|
236
|
-
() => (number(
|
|
237
|
-
number(percent.value) === undefined || number(0.5) === undefined
|
|
238
|
-
? undefined
|
|
239
|
-
: number(percent.value)! + number(0.5)!,
|
|
240
|
-
) === undefined
|
|
241
|
-
|| number(
|
|
557
|
+
let amountPrevious: any = null
|
|
558
|
+
const amount = cycleCheckedComputed(() => {
|
|
559
|
+
const next: any = math('clamp', ['number', 'number', 'number'], [
|
|
560
|
+
0,
|
|
561
|
+
checkedProps.value.value,
|
|
562
|
+
checkedProps.value.max,
|
|
563
|
+
]) as number | symbol | undefined
|
|
564
|
+
if (next === Symbol.for('html-next.invalid-result')) return amountPrevious
|
|
565
|
+
return amountPrevious = next
|
|
566
|
+
})
|
|
567
|
+
let percentPrevious: any = null
|
|
568
|
+
const percent = cycleCheckedComputed(() => {
|
|
569
|
+
const next: any = ((objectValue: any, indexValue: any) =>
|
|
570
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
571
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
572
|
+
? Symbol.for('html-next.invalid-result')
|
|
573
|
+
: objectValue[indexValue])(
|
|
574
|
+
{
|
|
575
|
+
true:
|
|
242
576
|
number(
|
|
243
|
-
number(
|
|
577
|
+
number(amount.value) === undefined || number(checkedProps.value.max) === undefined
|
|
244
578
|
? undefined
|
|
245
|
-
: number(
|
|
246
|
-
) === undefined || number(
|
|
579
|
+
: number(amount.value)! / number(checkedProps.value.max)!,
|
|
580
|
+
) === undefined || number(100) === undefined
|
|
247
581
|
? undefined
|
|
248
582
|
: number(
|
|
249
|
-
number(
|
|
583
|
+
number(amount.value) === undefined || number(checkedProps.value.max) === undefined
|
|
250
584
|
? undefined
|
|
251
|
-
: number(
|
|
252
|
-
)!
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
585
|
+
: number(amount.value)! / number(checkedProps.value.max)!,
|
|
586
|
+
)! * number(100)!,
|
|
587
|
+
false: 0,
|
|
588
|
+
},
|
|
589
|
+
concat(
|
|
590
|
+
number(checkedProps.value.max) === undefined || number(0) === undefined
|
|
591
|
+
? undefined
|
|
592
|
+
: number(checkedProps.value.max)! > number(0)!,
|
|
593
|
+
),
|
|
594
|
+
)
|
|
595
|
+
if (next === Symbol.for('html-next.invalid-result')) {
|
|
596
|
+
return percentPrevious
|
|
597
|
+
}
|
|
598
|
+
return percentPrevious = next
|
|
599
|
+
})
|
|
600
|
+
let guardedPrevious: any = null
|
|
601
|
+
const guarded = computed(() => {
|
|
602
|
+
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
603
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
604
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
605
|
+
? Symbol.for('html-next.invalid-result')
|
|
606
|
+
: objectValue[indexValue])(
|
|
607
|
+
(() => {
|
|
608
|
+
const value = {
|
|
609
|
+
true: checkedProps.value.valueText,
|
|
610
|
+
false: formatValue(
|
|
611
|
+
number(percent.value) === undefined || number(100) === undefined
|
|
262
612
|
? undefined
|
|
263
|
-
: number(percent.value)!
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
)
|
|
613
|
+
: number(percent.value)! / number(100)!,
|
|
614
|
+
'number',
|
|
615
|
+
'format',
|
|
616
|
+
'percent',
|
|
617
|
+
{ maximumFractionDigits: 0 },
|
|
618
|
+
),
|
|
619
|
+
}
|
|
620
|
+
return Object.values(value).some((entry: unknown) =>
|
|
621
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
622
|
+
)
|
|
623
|
+
? Symbol.for('html-next.invalid-result')
|
|
624
|
+
: value
|
|
625
|
+
})(),
|
|
626
|
+
concat(checkedProps.value.valueText !== ''),
|
|
627
|
+
)
|
|
628
|
+
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
629
|
+
return guardedPrevious
|
|
630
|
+
}
|
|
631
|
+
return guardedPrevious = typeof (((objectValue: any, indexValue: any) =>
|
|
632
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
633
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
634
|
+
? Symbol.for('html-next.invalid-result')
|
|
635
|
+
: objectValue[indexValue])(
|
|
636
|
+
(() => {
|
|
637
|
+
const value = {
|
|
638
|
+
true: checkedProps.value.valueText,
|
|
639
|
+
false: formatValue(
|
|
640
|
+
number(percent.value) === undefined || number(100) === undefined
|
|
641
|
+
? undefined
|
|
642
|
+
: number(percent.value)! / number(100)!,
|
|
643
|
+
'number',
|
|
644
|
+
'format',
|
|
645
|
+
'percent',
|
|
646
|
+
{ maximumFractionDigits: 0 },
|
|
647
|
+
),
|
|
648
|
+
}
|
|
649
|
+
return Object.values(value).some((entry: unknown) =>
|
|
650
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
651
|
+
)
|
|
652
|
+
? Symbol.for('html-next.invalid-result')
|
|
653
|
+
: value
|
|
654
|
+
})(),
|
|
655
|
+
concat(checkedProps.value.valueText !== ''),
|
|
656
|
+
)) === 'boolean'
|
|
657
|
+
? String(((objectValue: any, indexValue: any) =>
|
|
658
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
659
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
660
|
+
? Symbol.for('html-next.invalid-result')
|
|
661
|
+
: objectValue[indexValue])(
|
|
662
|
+
(() => {
|
|
663
|
+
const value = {
|
|
664
|
+
true: checkedProps.value.valueText,
|
|
665
|
+
false: formatValue(
|
|
666
|
+
number(percent.value) === undefined || number(100) === undefined
|
|
667
|
+
? undefined
|
|
668
|
+
: number(percent.value)! / number(100)!,
|
|
669
|
+
'number',
|
|
670
|
+
'format',
|
|
671
|
+
'percent',
|
|
672
|
+
{ maximumFractionDigits: 0 },
|
|
673
|
+
),
|
|
674
|
+
}
|
|
675
|
+
return Object.values(value).some((entry: unknown) =>
|
|
676
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
677
|
+
)
|
|
678
|
+
? Symbol.for('html-next.invalid-result')
|
|
679
|
+
: value
|
|
680
|
+
})(),
|
|
681
|
+
concat(checkedProps.value.valueText !== ''),
|
|
682
|
+
))
|
|
683
|
+
: attribute(((objectValue: any, indexValue: any) =>
|
|
684
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
685
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
686
|
+
? Symbol.for('html-next.invalid-result')
|
|
687
|
+
: objectValue[indexValue])(
|
|
688
|
+
(() => {
|
|
689
|
+
const value = {
|
|
690
|
+
true: checkedProps.value.valueText,
|
|
691
|
+
false: formatValue(
|
|
692
|
+
number(percent.value) === undefined || number(100) === undefined
|
|
693
|
+
? undefined
|
|
694
|
+
: number(percent.value)! / number(100)!,
|
|
695
|
+
'number',
|
|
696
|
+
'format',
|
|
697
|
+
'percent',
|
|
698
|
+
{ maximumFractionDigits: 0 },
|
|
699
|
+
),
|
|
700
|
+
}
|
|
701
|
+
return Object.values(value).some((entry: unknown) =>
|
|
702
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
703
|
+
)
|
|
704
|
+
? Symbol.for('html-next.invalid-result')
|
|
705
|
+
: value
|
|
706
|
+
})(),
|
|
707
|
+
concat(checkedProps.value.valueText !== ''),
|
|
708
|
+
))
|
|
709
|
+
})
|
|
710
|
+
let guardedBindingPrevious: any = null
|
|
711
|
+
const guardedBinding = computed(() => {
|
|
712
|
+
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
713
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
714
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
715
|
+
? Symbol.for('html-next.invalid-result')
|
|
716
|
+
: objectValue[indexValue])(
|
|
717
|
+
{ true: checkedProps.value.label, false: null },
|
|
718
|
+
concat(checkedProps.value.label !== ''),
|
|
719
|
+
)
|
|
720
|
+
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
721
|
+
return guardedBindingPrevious
|
|
722
|
+
}
|
|
723
|
+
return guardedBindingPrevious = typeof (((objectValue: any, indexValue: any) =>
|
|
724
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
725
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
726
|
+
? Symbol.for('html-next.invalid-result')
|
|
727
|
+
: objectValue[indexValue])(
|
|
728
|
+
{ true: checkedProps.value.label, false: null },
|
|
729
|
+
concat(checkedProps.value.label !== ''),
|
|
730
|
+
)) === 'boolean'
|
|
731
|
+
? String(((objectValue: any, indexValue: any) =>
|
|
732
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
733
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
734
|
+
? Symbol.for('html-next.invalid-result')
|
|
735
|
+
: objectValue[indexValue])(
|
|
736
|
+
{ true: checkedProps.value.label, false: null },
|
|
737
|
+
concat(checkedProps.value.label !== ''),
|
|
738
|
+
))
|
|
739
|
+
: attribute(((objectValue: any, indexValue: any) =>
|
|
740
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
741
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
742
|
+
? Symbol.for('html-next.invalid-result')
|
|
743
|
+
: objectValue[indexValue])(
|
|
744
|
+
{ true: checkedProps.value.label, false: null },
|
|
745
|
+
concat(checkedProps.value.label !== ''),
|
|
746
|
+
))
|
|
747
|
+
})
|
|
748
|
+
let guardedBinding2Previous: any = null
|
|
749
|
+
const guardedBinding2 = computed(() => {
|
|
750
|
+
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
751
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
752
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
753
|
+
? Symbol.for('html-next.invalid-result')
|
|
754
|
+
: objectValue[indexValue])(
|
|
755
|
+
{ true: checkedProps.value.segments, false: null },
|
|
756
|
+
concat(
|
|
757
|
+
number(checkedProps.value.segments) === undefined || number(1) === undefined
|
|
758
|
+
? undefined
|
|
759
|
+
: number(checkedProps.value.segments)! > number(1)!,
|
|
760
|
+
),
|
|
761
|
+
)
|
|
762
|
+
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
763
|
+
return guardedBinding2Previous
|
|
764
|
+
}
|
|
765
|
+
return guardedBinding2Previous = attribute(((objectValue: any, indexValue: any) =>
|
|
766
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
767
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
768
|
+
? Symbol.for('html-next.invalid-result')
|
|
769
|
+
: objectValue[indexValue])(
|
|
770
|
+
{ true: checkedProps.value.segments, false: null },
|
|
771
|
+
concat(
|
|
772
|
+
number(checkedProps.value.segments) === undefined || number(1) === undefined
|
|
773
|
+
? undefined
|
|
774
|
+
: number(checkedProps.value.segments)! > number(1)!,
|
|
775
|
+
),
|
|
776
|
+
))
|
|
777
|
+
})
|
|
778
|
+
let guardedBinding3Previous: any = null
|
|
779
|
+
const guardedBinding3 = computed(() => {
|
|
780
|
+
const candidate: any = concat(percent.value, '%')
|
|
781
|
+
if (candidate === Symbol.for('html-next.invalid-result')) return guardedBinding3Previous
|
|
782
|
+
return guardedBinding3Previous = candidate
|
|
783
|
+
})
|
|
273
784
|
const hydrationNode = hydrationInstance?.vnode.el
|
|
274
785
|
if (
|
|
275
786
|
typeof window !== 'undefined' && hydrationNode != null
|
|
@@ -310,6 +821,103 @@ function attribute(value: unknown): any {
|
|
|
310
821
|
function number(value: unknown): number | undefined {
|
|
311
822
|
return typeof value === 'number' && !Number.isNaN(value) ? value : undefined
|
|
312
823
|
}
|
|
824
|
+
|
|
825
|
+
// A nonempty scalar call cannot produce the invalid-result sentinel.
|
|
826
|
+
type ConcatResult<T extends unknown[]> = T extends
|
|
827
|
+
[
|
|
828
|
+
string | number | boolean | null | undefined,
|
|
829
|
+
...(string | number | boolean | null | undefined)[],
|
|
830
|
+
] ? string | undefined
|
|
831
|
+
: string | symbol | undefined
|
|
832
|
+
function concat<T extends unknown[]>(...values: T): ConcatResult<T> {
|
|
833
|
+
if (values.some(value => value === Symbol.for('html-next.invalid-result'))) {
|
|
834
|
+
return Symbol.for('html-next.invalid-result') as ConcatResult<T>
|
|
835
|
+
}
|
|
836
|
+
if (values.some(value => value === undefined)) return undefined as ConcatResult<T>
|
|
837
|
+
if (values.length === 0 || values.some(value => typeof value === 'object' && value !== null)) {
|
|
838
|
+
return Symbol.for('html-next.invalid-result') as ConcatResult<T>
|
|
839
|
+
}
|
|
840
|
+
return values.map(value => value === null ? '' : String(value)).join('') as ConcatResult<T>
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
function math(
|
|
844
|
+
fn: string,
|
|
845
|
+
kinds: readonly string[],
|
|
846
|
+
values: readonly unknown[],
|
|
847
|
+
): number | string | symbol | undefined {
|
|
848
|
+
if (values.includes(Symbol.for('html-next.invalid-result'))) {
|
|
849
|
+
return Symbol.for('html-next.invalid-result')
|
|
850
|
+
}
|
|
851
|
+
if (values.some(value => value === undefined || value === null)) return undefined
|
|
852
|
+
if (
|
|
853
|
+
(fn === 'abs' || fn === 'negate') && values.length !== 1
|
|
854
|
+
|| fn === 'round' && (values.length < 1 || values.length > 2)
|
|
855
|
+
|| (fn === 'min' || fn === 'max') && values.length === 0
|
|
856
|
+
|| fn === 'clamp' && values.length !== 3
|
|
857
|
+
) return Symbol.for('html-next.invalid-result')
|
|
858
|
+
const kind = kinds[0]
|
|
859
|
+
const dimensional = kind === 'length' || kind === 'percentage' || kind === 'duration'
|
|
860
|
+
if (!dimensional && kind !== 'number') return Symbol.for('html-next.invalid-result')
|
|
861
|
+
let unit: string | undefined
|
|
862
|
+
const numbers: number[] = []
|
|
863
|
+
for (let index = 0; index < values.length; index++) {
|
|
864
|
+
if (kinds[index] !== kind) return Symbol.for('html-next.invalid-result')
|
|
865
|
+
const value = values[index]
|
|
866
|
+
if (!dimensional) {
|
|
867
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
868
|
+
return Symbol.for('html-next.invalid-result')
|
|
869
|
+
}
|
|
870
|
+
numbers.push(value)
|
|
871
|
+
continue
|
|
872
|
+
}
|
|
873
|
+
if (typeof value !== 'string') return Symbol.for('html-next.invalid-result')
|
|
874
|
+
const match =
|
|
875
|
+
/^(-?(?:\d+(?:\.\d+)?|\.\d+))(vmin|vmax|rem|px|em|vw|vh|ch|ex|cm|mm|in|pt|pc|q|ms|s|%)$/.exec(
|
|
876
|
+
value,
|
|
877
|
+
)
|
|
878
|
+
if (match === null || unit !== undefined && match[2] !== unit) {
|
|
879
|
+
return Symbol.for('html-next.invalid-result')
|
|
880
|
+
}
|
|
881
|
+
unit = match[2]
|
|
882
|
+
if (
|
|
883
|
+
(unit === '%' ? 'percentage' : unit === 'ms' || unit === 's' ? 'duration' : 'length') !== kind
|
|
884
|
+
) return Symbol.for('html-next.invalid-result')
|
|
885
|
+
const number = Number(match[1])
|
|
886
|
+
if (!Number.isFinite(number)) return Symbol.for('html-next.invalid-result')
|
|
887
|
+
numbers.push(number)
|
|
888
|
+
}
|
|
889
|
+
let result: number
|
|
890
|
+
switch (fn) {
|
|
891
|
+
case 'abs':
|
|
892
|
+
result = Math.abs(numbers[0]!)
|
|
893
|
+
break
|
|
894
|
+
case 'negate':
|
|
895
|
+
result = -numbers[0]!
|
|
896
|
+
break
|
|
897
|
+
case 'round': {
|
|
898
|
+
const step = Math.abs(numbers[1] ?? 1)
|
|
899
|
+
if (step === 0) return Symbol.for('html-next.invalid-result')
|
|
900
|
+
result = Math.round(numbers[0]! / step) * step
|
|
901
|
+
break
|
|
902
|
+
}
|
|
903
|
+
case 'min':
|
|
904
|
+
result = Math.min(...numbers)
|
|
905
|
+
break
|
|
906
|
+
case 'max':
|
|
907
|
+
result = Math.max(...numbers)
|
|
908
|
+
break
|
|
909
|
+
case 'clamp':
|
|
910
|
+
result = Math.max(numbers[0]!, Math.min(numbers[1]!, numbers[2]!))
|
|
911
|
+
break
|
|
912
|
+
default:
|
|
913
|
+
return Symbol.for('html-next.invalid-result')
|
|
914
|
+
}
|
|
915
|
+
return !Number.isFinite(result)
|
|
916
|
+
? Symbol.for('html-next.invalid-result')
|
|
917
|
+
: unit === undefined
|
|
918
|
+
? result
|
|
919
|
+
: String(result) + unit
|
|
920
|
+
}
|
|
313
921
|
</script>
|
|
314
922
|
|
|
315
923
|
<template>
|
|
@@ -320,39 +928,9 @@ function number(value: unknown): number | undefined {
|
|
|
320
928
|
v-bind="nativeAttrs($attrs)"
|
|
321
929
|
:aria-valuemax="checkedProps.max ?? undefined"
|
|
322
930
|
:aria-valuenow="amount"
|
|
323
|
-
:aria-valuetext="
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
? String(
|
|
327
|
-
(({ true: checkedProps.valueText, false: `${whole ?? ''}%` }) as Record<string, any>)[
|
|
328
|
-
`${checkedProps.valueText !== ''}`
|
|
329
|
-
],
|
|
330
|
-
)
|
|
331
|
-
: attribute(
|
|
332
|
-
(({ true: checkedProps.valueText, false: `${whole ?? ''}%` }) as Record<string, any>)[
|
|
333
|
-
`${checkedProps.valueText !== ''}`
|
|
334
|
-
],
|
|
335
|
-
)"
|
|
336
|
-
:aria-label="typeof ((({ true: checkedProps.label, false: null }) as Record<string, any>)[
|
|
337
|
-
`${checkedProps.label !== ''}`
|
|
338
|
-
]) === 'boolean'
|
|
339
|
-
? String(
|
|
340
|
-
(({ true: checkedProps.label, false: null }) as Record<string, any>)[
|
|
341
|
-
`${checkedProps.label !== ''}`
|
|
342
|
-
],
|
|
343
|
-
)
|
|
344
|
-
: attribute(
|
|
345
|
-
(({ true: checkedProps.label, false: null }) as Record<string, any>)[
|
|
346
|
-
`${checkedProps.label !== ''}`
|
|
347
|
-
],
|
|
348
|
-
)"
|
|
349
|
-
:data-ui-meter-segments="attribute(
|
|
350
|
-
(({ true: checkedProps.segments, false: null }) as Record<string, any>)[
|
|
351
|
-
`${(number(checkedProps.segments) === undefined || number(1) === undefined
|
|
352
|
-
? undefined
|
|
353
|
-
: number(checkedProps.segments)! > number(1)!)}`
|
|
354
|
-
],
|
|
355
|
-
)"
|
|
931
|
+
:aria-valuetext="guarded"
|
|
932
|
+
:aria-label="guardedBinding"
|
|
933
|
+
:data-ui-meter-segments="guardedBinding2"
|
|
356
934
|
v-prop-validity="{ contract: propValidityContract, values: { ...props } }"
|
|
357
935
|
:data-label="reflectedProp('label', 'label', checkedProps.label, undefined, false)"
|
|
358
936
|
:data-max="reflectedProp('max', 'max', checkedProps.max, undefined, false)"
|
|
@@ -362,7 +940,7 @@ function number(value: unknown): number | undefined {
|
|
|
362
940
|
:data-value="reflectedProp('value', 'value', checkedProps.value, undefined, false)"
|
|
363
941
|
:data-value-text="reflectedProp('valueText', 'value-text', checkedProps.valueText, undefined, false)"
|
|
364
942
|
:data-ui-meter-state="hostState || undefined"
|
|
365
|
-
><span class="fill" :style="{ 'inline-size':
|
|
943
|
+
><span class="fill" :style="{ 'inline-size': guardedBinding3 }"></span></span>
|
|
366
944
|
</template>
|
|
367
945
|
|
|
368
946
|
<style scoped>
|