bitboss-ui 3.0.0-beta.71 → 3.0.0-beta.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/cli.mjs +9 -3
- package/dist/ai/BbAccordion.md +38 -19
- package/dist/ai/BbBadge.md +25 -22
- package/dist/ai/BbBreadcrumbs.md +1 -1
- package/dist/ai/BbButton.md +32 -27
- package/dist/ai/BbCalendar.md +1 -0
- package/dist/ai/BbCarousel.md +6 -4
- package/dist/ai/BbCheckboxGroup.md +2 -1
- package/dist/ai/BbColorInput.md +1 -1
- package/dist/ai/BbConfirm.md +65 -81
- package/dist/ai/BbConfirmPortal.md +2 -2
- package/dist/ai/BbDatePicker.md +1 -6
- package/dist/ai/BbDatePickerInput.md +2 -2
- package/dist/ai/BbDialog.md +233 -164
- package/dist/ai/BbDropdown.md +52 -16
- package/dist/ai/BbDropdownButton.md +11 -12
- package/dist/ai/BbDropzone.md +12 -8
- package/dist/ai/BbForm.md +100 -13
- package/dist/ai/BbHost.md +2 -2
- package/dist/ai/BbHoverCardPortal.md +1 -1
- package/dist/ai/BbIcon.md +1 -1
- package/dist/ai/BbIndicator.md +17 -15
- package/dist/ai/BbNumberInput.md +7 -5
- package/dist/ai/BbOffCanvas.md +29 -7
- package/dist/ai/BbPagination.md +2 -2
- package/dist/ai/BbPopover.md +15 -9
- package/dist/ai/BbPopoverPortal.md +1 -1
- package/dist/ai/BbRadioGroup.md +29 -7
- package/dist/ai/BbRating.md +8 -7
- package/dist/ai/BbSelect.md +29 -8
- package/dist/ai/BbSelectPopover.md +9 -3
- package/dist/ai/BbSlider.md +12 -8
- package/dist/ai/BbSpinner.md +3 -2
- package/dist/ai/BbSwitch.md +3 -3
- package/dist/ai/BbSwitchGroup.md +7 -6
- package/dist/ai/BbTable.md +205 -82
- package/dist/ai/BbTabs.md +29 -4
- package/dist/ai/BbTag.md +1 -1
- package/dist/ai/BbTextInput.md +7 -5
- package/dist/ai/BbTextarea.md +4 -3
- package/dist/ai/BbTimePickerInput.md +1 -1
- package/dist/ai/BbToast.md +3 -2
- package/dist/ai/BbTooltip.md +22 -17
- package/dist/ai/BbTree.md +49 -24
- package/dist/ai/CommonFieldInput.md +1 -1
- package/dist/ai/changelog.json +242 -9
- package/dist/ai/components.json +52 -51
- package/dist/ai/composables/useBbDialog.md +5 -8
- package/dist/ai/composables/useBbForm.md +3 -0
- package/dist/ai/composables/useConfirm.md +65 -56
- package/dist/ai/composables/useToast.md +2 -1
- package/dist/ai/guides/agent-contract.md +3 -3
- package/dist/ai/guides/app-layout.md +3 -2
- package/dist/ai/guides/eslint-rules.md +3 -1
- package/dist/ai/guides/fetch-items-playbook.md +1 -1
- package/dist/ai/guides/floating-bottom-panel.md +3 -2
- package/dist/ai/guides/icons-policy.md +7 -5
- package/dist/ai/guides/inertia-helpers.md +35 -30
- package/dist/ai/guides/installation-and-plugin-setup.md +17 -14
- package/dist/ai/guides/migration/adoption-checklist.md +2 -2
- package/dist/ai/guides/migration/components/bb-badge.md +12 -1
- package/dist/ai/guides/migration/components/bb-button.md +24 -0
- package/dist/ai/guides/migration/components/bb-dropdown-button.md +11 -0
- package/dist/ai/guides/migration/components/bb-tabs.md +2 -2
- package/dist/ai/guides/migration/components/bb-toast.md +11 -0
- package/dist/ai/guides/migration/components/use-confirm.md +72 -26
- package/dist/ai/guides/migration/v2-to-v3.md +52 -10
- package/dist/ai/guides/migration/v3-beta-css-classes.md +1 -1
- package/dist/ai/guides/options-items-playbook.md +4 -3
- package/dist/ai/guides/passthrough.md +2 -2
- package/dist/ai/helpers/inertia/manifest.json +28 -15
- package/dist/ai/helpers/inertia/messages.ts +3 -3
- package/dist/ai/helpers/inertia/useConfirmOnRouteLeave.ts +10 -10
- package/dist/ai/helpers/inertia/usePromiseForm.ts +1 -1
- package/dist/ai/helpers/inertia/usePromiseRouter.ts +7 -2
- package/dist/ai/index.md +3 -3
- package/dist/ai/manifest/common.json +3 -3
- package/dist/ai/manifest/components/BbAccordion.json +8 -5
- package/dist/ai/manifest/components/BbAccordion.tree.json +1 -0
- package/dist/ai/manifest/components/BbBadge.json +8 -7
- package/dist/ai/manifest/components/BbBadge.removed.json +3 -1
- package/dist/ai/manifest/components/BbBadge.tree.json +73 -0
- package/dist/ai/manifest/components/BbBreadcrumbs.json +1 -1
- package/dist/ai/manifest/components/BbButton.json +5 -6
- package/dist/ai/manifest/components/BbButton.removed.json +3 -1
- package/dist/ai/manifest/components/BbButton.tree.json +24 -7
- package/dist/ai/manifest/components/BbCalendar.json +2 -1
- package/dist/ai/manifest/components/BbCheckboxGroup.json +2 -2
- package/dist/ai/manifest/components/BbColorInput.json +1 -1
- package/dist/ai/manifest/components/BbColorInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbConfirm.json +2 -2
- package/dist/ai/manifest/components/BbConfirm.removed.json +9 -0
- package/dist/ai/manifest/components/BbConfirm.tree.json +4 -5
- package/dist/ai/manifest/components/BbConfirmPortal.json +3 -3
- package/dist/ai/manifest/components/BbConfirmPortal.removed.json +7 -0
- package/dist/ai/manifest/components/BbDatePicker.json +2 -1
- package/dist/ai/manifest/components/BbDatePicker.tree.json +0 -6
- package/dist/ai/manifest/components/BbDatePickerInput.json +2 -2
- package/dist/ai/manifest/components/BbDatePickerInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbDialog.json +6 -1
- package/dist/ai/manifest/components/BbDialog.tree.json +41 -1
- package/dist/ai/manifest/components/BbDropdown.json +9 -8
- package/dist/ai/manifest/components/BbDropdown.tree.json +4 -0
- package/dist/ai/manifest/components/BbDropdownButton.json +8 -9
- package/dist/ai/manifest/components/BbDropdownButton.removed.json +3 -1
- package/dist/ai/manifest/components/BbForm.json +3 -1
- package/dist/ai/manifest/components/BbNumberInput.json +1 -1
- package/dist/ai/manifest/components/BbNumberInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbOffCanvas.json +6 -1
- package/dist/ai/manifest/components/BbOffCanvas.tree.json +40 -0
- package/dist/ai/manifest/components/BbPagination.json +1 -1
- package/dist/ai/manifest/components/BbRadioGroup.json +4 -3
- package/dist/ai/manifest/components/BbRating.json +2 -2
- package/dist/ai/manifest/components/BbSelect.json +16 -15
- package/dist/ai/manifest/components/BbSelect.tree.json +1 -1
- package/dist/ai/manifest/components/BbSelectPopover.json +1 -0
- package/dist/ai/manifest/components/BbSwitch.json +4 -4
- package/dist/ai/manifest/components/BbSwitchGroup.json +7 -7
- package/dist/ai/manifest/components/BbTable.json +15 -14
- package/dist/ai/manifest/components/BbTable.tree.json +2 -0
- package/dist/ai/manifest/components/BbTabs.json +3 -3
- package/dist/ai/manifest/components/BbTabsList.json +1 -1
- package/dist/ai/manifest/components/BbTabsRoot.json +1 -1
- package/dist/ai/manifest/components/BbTag.json +1 -1
- package/dist/ai/manifest/components/BbTag.tree.json +1 -1
- package/dist/ai/manifest/components/BbTextInput.json +1 -1
- package/dist/ai/manifest/components/BbTextInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbTextarea.json +1 -1
- package/dist/ai/manifest/components/BbTextarea.tree.json +1 -1
- package/dist/ai/manifest/components/BbTimePicker.json +1 -1
- package/dist/ai/manifest/components/BbTimePickerInput.json +1 -1
- package/dist/ai/manifest/components/BbTimePickerInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbToast.removed.json +2 -1
- package/dist/ai/manifest/components/BbTree.json +2 -2
- package/dist/ai/manifest/components/CommonFieldInput.tree.json +3 -3
- package/dist/ai/manifest/index.json +4 -4
- package/dist/ai/manifest/meta.json +5 -1
- package/dist/ai/manifest/types.advanced.json +9 -9
- package/dist/ai/manifest/types.api.json +6 -5
- package/dist/ai/recipes/inertia/approvals-inbox.md +23 -16
- package/dist/ai/recipes/inertia/inline-edit-workspace.md +12 -5
- package/dist/ai/recipes/inertia/layout-scaffold.md +5 -3
- package/dist/ai/recipes/inertia/onboarding.md +23 -12
- package/dist/ai/recipes/inertia/ownership-atlas.md +34 -18
- package/dist/ai/recipes/inertia/record-form.md +12 -8
- package/dist/ai/recipes/inertia/records-workspace.md +14 -7
- package/dist/ai/recipes/inertia/settings-workspace.md +75 -60
- package/dist/ai/recipes/inertia/upload-center.md +17 -9
- package/dist/ai/recipes/inertia/wizard-form.md +2 -2
- package/dist/ai/recipes/nuxt/approvals-inbox.md +23 -16
- package/dist/ai/recipes/nuxt/inline-edit-workspace.md +12 -5
- package/dist/ai/recipes/nuxt/layout-scaffold.md +5 -3
- package/dist/ai/recipes/nuxt/onboarding.md +5 -4
- package/dist/ai/recipes/nuxt/ownership-atlas.md +34 -18
- package/dist/ai/recipes/nuxt/record-form.md +14 -10
- package/dist/ai/recipes/nuxt/records-workspace.md +14 -7
- package/dist/ai/recipes/nuxt/settings-workspace.md +70 -60
- package/dist/ai/recipes/nuxt/upload-center.md +17 -9
- package/dist/ai/recipes/nuxt/wizard-form.md +4 -4
- package/dist/ai/recipes/vue/approvals-inbox.md +23 -16
- package/dist/ai/recipes/vue/inline-edit-workspace.md +12 -5
- package/dist/ai/recipes/vue/layout-scaffold.md +5 -3
- package/dist/ai/recipes/vue/onboarding.md +5 -4
- package/dist/ai/recipes/vue/ownership-atlas.md +34 -18
- package/dist/ai/recipes/vue/record-form.md +14 -10
- package/dist/ai/recipes/vue/records-workspace.md +14 -7
- package/dist/ai/recipes/vue/settings-workspace.md +70 -60
- package/dist/ai/recipes/vue/upload-center.md +17 -9
- package/dist/ai/recipes/vue/wizard-form.md +4 -4
- package/dist/ai/source/BbAccordion.md +50 -16
- package/dist/ai/source/BbBadge.md +420 -26
- package/dist/ai/source/BbBadgeButton.md +378 -12
- package/dist/ai/source/BbButton.md +205 -55
- package/dist/ai/source/BbCalendar.md +5 -0
- package/dist/ai/source/BbCheckboxGroup.md +38 -13
- package/dist/ai/source/BbConfigScope.md +19 -2
- package/dist/ai/source/BbConfirm.md +74 -80
- package/dist/ai/source/BbConfirmPortal.md +6 -6
- package/dist/ai/source/BbDatePicker.md +9 -2
- package/dist/ai/source/BbDatePickerInput.md +3 -1
- package/dist/ai/source/BbDialog.md +53 -2
- package/dist/ai/source/BbDropdown.md +350 -98
- package/dist/ai/source/BbDropdownButton.md +20 -12
- package/dist/ai/source/BbDropdownGroup.md +136 -58
- package/dist/ai/source/BbForm.md +152 -11
- package/dist/ai/source/BbOffCanvas.md +53 -2
- package/dist/ai/source/BbPagination.md +1 -1
- package/dist/ai/source/BbRadioGroup.md +72 -10
- package/dist/ai/source/BbRating.md +30 -22
- package/dist/ai/source/BbSelect.md +11 -1
- package/dist/ai/source/BbSelectPopover.md +105 -34
- package/dist/ai/source/BbSwitch.md +23 -8
- package/dist/ai/source/BbSwitchGroup.md +67 -21
- package/dist/ai/source/BbTable.md +359 -48
- package/dist/ai/source/BbTabs.md +6 -0
- package/dist/ai/source/BbTabsList.md +10 -0
- package/dist/ai/source/BbTabsPanels.md +6 -0
- package/dist/ai/source/BbTabsRoot.md +6 -0
- package/dist/ai/source/BbTree.md +14 -4
- package/dist/ai/source/CommonFieldInput.md +2 -1
- package/dist/components/BbAccordion/BbAccordion.vue.d.ts +7 -3
- package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +52 -38
- package/dist/components/BbAccordion/ptKeys.generated.d.ts +20 -0
- package/dist/components/BbAccordion/types.d.ts +21 -7
- package/dist/components/BbAccordion/types.js +1 -1
- package/dist/components/BbAlert/BbAlert.vue.d.ts +1 -1
- package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/BbBadge/BbBadge.vue.d.ts +1 -1
- package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +65 -42
- package/dist/components/BbBadge/types.d.ts +15 -12
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +79 -73
- package/dist/components/BbButton/types.d.ts +7 -6
- package/dist/components/BbCalendar/BbCalendar.vue.d.ts +2 -1
- package/dist/components/BbCalendar/BbCalendar.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/BbCalendar/types.d.ts +5 -0
- package/dist/components/BbCalendar/useCalendarGrid.js +1 -1
- package/dist/components/BbCalendar/useDayGrid.js +1 -1
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +10 -4
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/BbCheckboxGroup/types.d.ts +2 -2
- package/dist/components/BbConfigScope/BbConfigScope.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +71 -132
- package/dist/components/BbConfirm/ptKeys.generated.d.ts +5 -5
- package/dist/components/BbConfirm/types.d.ts +5 -5
- package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +2 -1
- package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/components/BbDatePicker/types.d.ts +5 -0
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +1 -1
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/BbDatePickerInput/types.d.ts +2 -1
- package/dist/components/BbDialog/BbDialog.vue.d.ts +3 -0
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +263 -235
- package/dist/components/BbDialog/overlayActions.js +94 -0
- package/dist/components/BbDialog/types.d.ts +24 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +382 -332
- package/dist/components/BbDropdown/dropdownHandle.js +6 -0
- package/dist/components/BbDropdown/normalizeGroups.js +58 -48
- package/dist/components/BbDropdown/types.d.ts +107 -48
- package/dist/components/BbDropdown/types.js +2 -2
- package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +71 -71
- package/dist/components/BbDropdownButton/types.d.ts +2 -4
- package/dist/components/BbForm/BbForm.vue.d.ts +2 -1
- package/dist/components/BbForm/BbForm.vue_vue_type_script_setup_true_lang.js +241 -199
- package/dist/components/BbForm/recognizeValidation.d.ts +9 -0
- package/dist/components/BbForm/recognizeValidation.js +55 -0
- package/dist/components/BbForm/validationError.d.ts +10 -0
- package/dist/components/BbForm/validationError.js +11 -0
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +3 -0
- package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +414 -389
- package/dist/components/BbOffCanvas/sheetAttrs.js +5 -5
- package/dist/components/BbOffCanvas/types.d.ts +24 -0
- package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +10 -4
- package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +173 -157
- package/dist/components/BbRadioGroup/types.d.ts +9 -3
- package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +112 -103
- package/dist/components/BbRating/types.d.ts +3 -2
- package/dist/components/BbSelect/BbSelect.vue.d.ts +9 -8
- package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/components/BbSelect/types.d.ts +8 -0
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +11 -4
- package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +513 -502
- package/dist/components/BbSelectPopover/types.d.ts +10 -2
- package/dist/components/BbSwitch/BbSwitch.vue.d.ts +2 -0
- package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +85 -73
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +10 -4
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +171 -152
- package/dist/components/BbSwitchGroup/types.d.ts +1 -1
- package/dist/components/BbTable/BbTable.vue.d.ts +36 -25
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +1338 -1215
- package/dist/components/BbTable/BbTableDataRow.js +2 -1
- package/dist/components/BbTable/BbTableRowMenu.js +36 -0
- package/dist/components/BbTable/types.d.ts +32 -17
- package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/BbTabs/types.d.ts +6 -0
- package/dist/components/BbTextInput/BbTextInput.vue.d.ts +1 -1
- package/dist/components/BbTextarea/BbTextarea.vue.d.ts +1 -1
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +1 -1
- package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +88 -94
- package/dist/components/BbTree/BbTree.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbTree/BbTreeLevel.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/components/BbTree/types.d.ts +8 -2
- package/dist/components/CommonFieldInput/CommonFieldInput.vue_vue_type_script_setup_true_lang.js +39 -39
- package/dist/composables/formSubmitLock.js +15 -8
- package/dist/composables/overlayRegistry.d.ts +5 -0
- package/dist/composables/overlayRegistry.js +154 -148
- package/dist/composables/useBbDropdown.d.ts +8 -0
- package/dist/composables/useBbDropdown.js +3 -1
- package/dist/composables/useBbTabs.js +138 -138
- package/dist/composables/useConfirm.d.ts +63 -52
- package/dist/composables/useConfirm.js +22 -18
- package/dist/deprecation/ai-deprecations.json.js +1 -1
- package/dist/directives/bbDropdown.d.ts +7 -7
- package/dist/directives/bbDropdown.js +21 -14
- package/dist/directives/bbTooltip.d.ts +3 -3
- package/dist/directives/createPopoverDirective.js +57 -35
- package/dist/i18n/locales/ar.json +5 -1
- package/dist/i18n/locales/cs.json +5 -1
- package/dist/i18n/locales/da.json +5 -1
- package/dist/i18n/locales/de-CH.json +5 -1
- package/dist/i18n/locales/de.json +5 -1
- package/dist/i18n/locales/el.json +5 -1
- package/dist/i18n/locales/en-GB.json +5 -1
- package/dist/i18n/locales/en.json +5 -1
- package/dist/i18n/locales/es-MX.json +5 -1
- package/dist/i18n/locales/es.json +5 -1
- package/dist/i18n/locales/fa.json +5 -1
- package/dist/i18n/locales/fi.json +5 -1
- package/dist/i18n/locales/fr.json +5 -1
- package/dist/i18n/locales/he.json +5 -1
- package/dist/i18n/locales/hu.json +5 -1
- package/dist/i18n/locales/it.json +5 -1
- package/dist/i18n/locales/ja.json +5 -1
- package/dist/i18n/locales/ko.json +5 -1
- package/dist/i18n/locales/nb.json +5 -1
- package/dist/i18n/locales/nl.json +5 -1
- package/dist/i18n/locales/pl.json +5 -1
- package/dist/i18n/locales/pt-BR.json +5 -1
- package/dist/i18n/locales/pt-PT.json +5 -1
- package/dist/i18n/locales/ro.json +5 -1
- package/dist/i18n/locales/ru.json +5 -1
- package/dist/i18n/locales/sv.json +5 -1
- package/dist/i18n/locales/tr.json +5 -1
- package/dist/i18n/locales/uk.json +5 -1
- package/dist/i18n/locales/zh-CN.json +5 -1
- package/dist/i18n/locales/zh-HK.json +5 -1
- package/dist/i18n/locales/zh-TW.json +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -3
- package/dist/llms-full.txt +1997 -1151
- package/dist/llms-medium.txt +21 -18
- package/dist/llms.txt +2 -2
- package/dist/locale-blueprint.json +5 -1
- package/dist/plugin.js +17 -40
- package/dist/pluginCore.js +30 -0
- package/dist/styles.css +2 -2
- package/dist/types/ActionButton.d.ts +26 -5
- package/dist/types/ActionButton.js +11 -0
- package/dist/types/ConfigDefaults.d.ts +34 -3
- package/dist/types/ConfigDefaults.js +14 -8
- package/dist/types/ItemPath.d.ts +33 -4
- package/dist/types/ptComponentMap.d.ts +1 -1
- package/dist/utilities/functions/clickCount.js +14 -0
- package/dist/utilities/functions/hash.js +90 -3
- package/dist/utilities/functions/isEqual.js +61 -3
- package/dist/utils/versionCheck.js +1 -1
- package/dist/vite.js +0 -1
- package/llms.txt +2 -2
- package/package.json +12 -2
- package/scripts/README.md +43 -39
- package/scripts/lib/adoption-checklist.json +2 -2
- package/scripts/lib/eslint-disable.mjs +5 -3
- package/scripts/lib/eslint-plugin.d.ts +2 -0
- package/scripts/lib/eslint-plugin.mjs +213 -1
- package/scripts/lib/helpers-add.mjs +21 -2
- package/scripts/lib/redundant-item-accessor.mjs +4 -1
- package/scripts/lib/release-results.mjs +180 -5
- package/scripts/lib/renamed-item-field.mjs +4 -1
- package/scripts/lib/tab-links.mjs +4 -1
- package/scripts/lib/tree-default-expandable.mjs +53 -0
- package/scripts/lib/validate-bb-markup.mjs +536 -52
|
@@ -24,6 +24,7 @@ import { textNullValueFindings } from './text-null-value.mjs';
|
|
|
24
24
|
import { dropdownDefaultSlotFindings } from './dropdown-default-slot.mjs';
|
|
25
25
|
import { collapsibleTriggerAriaFindings } from './collapsible-trigger-aria.mjs';
|
|
26
26
|
import { carouselPropOrLocalFindings } from './carousel-prop-or-local.mjs';
|
|
27
|
+
import { redundantTreeExpandableFindings } from './tree-default-expandable.mjs';
|
|
27
28
|
import { carouselItemsWithoutSlideFindings } from './carousel-items-without-slide.mjs';
|
|
28
29
|
import { hiddenLabelPlaceholderFindings } from './hidden-label-placeholder.mjs';
|
|
29
30
|
import { preferVBbDialogFindings } from './prefer-v-bb-dialog.mjs';
|
|
@@ -417,6 +418,26 @@ const INTENT_ALIASES = {
|
|
|
417
418
|
note: 'Headless UI spells it `manual`; here it is the boolean `manual-activation` (bare = on, `:manual-activation="false"` = automatic). Unset, it is on for `server` strips',
|
|
418
419
|
},
|
|
419
420
|
},
|
|
421
|
+
// the opt-out under the names an author guesses for it. Hiding is the
|
|
422
|
+
// default, so the only knob is the one that keeps the trigger.
|
|
423
|
+
BbDropdown: {
|
|
424
|
+
hideActivatorOnEmpty: {
|
|
425
|
+
to: 'keep-activator',
|
|
426
|
+
note: 'hiding a trigger with no visible row is already the default; the knob is `keep-activator` (bare = keep it, inert, with `empty` in the activator slot)',
|
|
427
|
+
},
|
|
428
|
+
showActivatorOnEmpty: {
|
|
429
|
+
to: 'keep-activator',
|
|
430
|
+
note: 'the opt-out is `keep-activator` (bare = keep the trigger when no row is visible: inert, with `empty` in the activator slot)',
|
|
431
|
+
},
|
|
432
|
+
disableHideActivatorOnEmpty: {
|
|
433
|
+
to: 'keep-activator',
|
|
434
|
+
note: 'the opt-out is `keep-activator` (bare = keep the trigger when no row is visible: inert, with `empty` in the activator slot)',
|
|
435
|
+
},
|
|
436
|
+
keepActivatorOnEmpty: {
|
|
437
|
+
to: 'keep-activator',
|
|
438
|
+
note: 'it is `keep-activator`: it only ever acts when no row is visible',
|
|
439
|
+
},
|
|
440
|
+
},
|
|
420
441
|
BbTabsRoot: {
|
|
421
442
|
activationMode: {
|
|
422
443
|
to: 'manual-activation',
|
|
@@ -883,6 +904,10 @@ export function validateVueSnippet(code, manifest, options = {}) {
|
|
|
883
904
|
findings.push(
|
|
884
905
|
...carouselPropOrLocalFindings(ast, { aliases, own: allowComponents })
|
|
885
906
|
);
|
|
907
|
+
// `:expandable="(n) => !!n.children?.length"` restates BbTree's default.
|
|
908
|
+
findings.push(
|
|
909
|
+
...redundantTreeExpandableFindings(ast, { aliases, own: allowComponents })
|
|
910
|
+
);
|
|
886
911
|
for (const {
|
|
887
912
|
start: _start,
|
|
888
913
|
tag: _tag,
|
|
@@ -2516,6 +2541,26 @@ const unwrapTsExpression = (node) => {
|
|
|
2516
2541
|
/** The reactive wrappers whose literal argument `check` may read through. */
|
|
2517
2542
|
const LITERAL_WRAPPERS = new Set(['ref', 'reactive']);
|
|
2518
2543
|
|
|
2544
|
+
/**
|
|
2545
|
+
* Whether an AST holds an Identifier spelling `name` other than `except`
|
|
2546
|
+
* itself. Every occurrence counts — a property key, a parameter, a
|
|
2547
|
+
* same-named shadow: over-counting only ever unseals (never a guess).
|
|
2548
|
+
*/
|
|
2549
|
+
const hasIdentifierBeyond = (root, name, except) => {
|
|
2550
|
+
const stack = [root];
|
|
2551
|
+
const seen = new Set();
|
|
2552
|
+
while (stack.length) {
|
|
2553
|
+
const value = stack.pop();
|
|
2554
|
+
if (!value || typeof value !== 'object' || seen.has(value)) continue;
|
|
2555
|
+
seen.add(value);
|
|
2556
|
+
if (value !== except && value.type === 'Identifier' && value.name === name)
|
|
2557
|
+
return true;
|
|
2558
|
+
for (const child of Object.values(value))
|
|
2559
|
+
if (child && typeof child === 'object') stack.push(child);
|
|
2560
|
+
}
|
|
2561
|
+
return false;
|
|
2562
|
+
};
|
|
2563
|
+
|
|
2519
2564
|
/**
|
|
2520
2565
|
* The top-level array literals of an SFC's `<script setup>`, keyed by name:
|
|
2521
2566
|
* `const x = […]`, `const x = ref([…])`, `const x = reactive([…])` (TS
|
|
@@ -2526,17 +2571,29 @@ const LITERAL_WRAPPERS = new Set(['ref', 'reactive']);
|
|
|
2526
2571
|
* guessed. Parsed with the same `vue/compiler-sfc` (Babel), so `check` stays
|
|
2527
2572
|
* zero-config.
|
|
2528
2573
|
*
|
|
2529
|
-
* `map.mutated` names the arrays the file changes
|
|
2530
|
-
*
|
|
2531
|
-
*
|
|
2574
|
+
* `map.mutated` names the arrays the file changes —
|
|
2575
|
+
* `x.push(…)`, `x.value = …`, `x[i] = …`, a call it is handed to
|
|
2576
|
+
* (`normalize(x)`), anywhere in the SFC, before a later declaration too — so
|
|
2577
|
+
* a rule judging the written rows steps aside for them.
|
|
2578
|
+
*
|
|
2579
|
+
* `map.sealed` is the stricter subset a rule may trust
|
|
2580
|
+
* to be the FINAL data: a plain `const x = […]` — no `ref` / `reactive` /
|
|
2581
|
+
* call, no type annotation, no `as`, no `satisfies`, no generic, not
|
|
2582
|
+
* exported — whose name occurs nowhere else in the script (no write, no
|
|
2583
|
+
* call argument, no spread, not even a read) and nowhere outside it
|
|
2584
|
+
* except as a `:items="x"` / `:columns="x"` binding. A `ref([…])` seed a
|
|
2585
|
+
* fetch replaces, or a typed array whose later rows come from elsewhere, is
|
|
2586
|
+
* never sealed: no write scan can prove such an array is the final data.
|
|
2532
2587
|
* @param {string} code
|
|
2533
|
-
* @returns {Map<string, any> & { mutated: Set<string> }}
|
|
2588
|
+
* @returns {Map<string, any> & { mutated: Set<string>, sealed: Set<string> }}
|
|
2534
2589
|
*/
|
|
2535
2590
|
export function scriptSetupArrayConsts(code) {
|
|
2536
|
-
const map =
|
|
2537
|
-
|
|
2538
|
-
|
|
2591
|
+
const map =
|
|
2592
|
+
/** @type {Map<string, any> & { mutated: Set<string>, sealed: Set<string> }} */ (
|
|
2593
|
+
new Map()
|
|
2594
|
+
);
|
|
2539
2595
|
map.mutated = new Set();
|
|
2596
|
+
map.sealed = new Set();
|
|
2540
2597
|
const match = /<script\b[^>]*\bsetup\b[^>]*>([\s\S]*?)<\/script>/i.exec(code);
|
|
2541
2598
|
if (!match) return map;
|
|
2542
2599
|
let program;
|
|
@@ -2548,7 +2605,11 @@ export function scriptSetupArrayConsts(code) {
|
|
|
2548
2605
|
} catch {
|
|
2549
2606
|
return map;
|
|
2550
2607
|
}
|
|
2551
|
-
|
|
2608
|
+
// Each array's own declarator, blanked before the write scan below.
|
|
2609
|
+
const declarators = [];
|
|
2610
|
+
// Sealed candidates, checked for stray references below: the declarator
|
|
2611
|
+
// id is the one Identifier occurrence the scan allows.
|
|
2612
|
+
const plain = new Map();
|
|
2552
2613
|
for (const statement of program.body) {
|
|
2553
2614
|
const decl =
|
|
2554
2615
|
statement.type === 'ExportNamedDeclaration'
|
|
@@ -2557,6 +2618,15 @@ export function scriptSetupArrayConsts(code) {
|
|
|
2557
2618
|
if (decl?.type !== 'VariableDeclaration' || decl.kind !== 'const') continue;
|
|
2558
2619
|
for (const declarator of decl.declarations) {
|
|
2559
2620
|
if (declarator.id.type !== 'Identifier') continue;
|
|
2621
|
+
if (
|
|
2622
|
+
statement.type !== 'ExportNamedDeclaration' &&
|
|
2623
|
+
!declarator.id.typeAnnotation &&
|
|
2624
|
+
declarator.init?.type === 'ArrayExpression'
|
|
2625
|
+
)
|
|
2626
|
+
plain.set(declarator.id.name, {
|
|
2627
|
+
id: declarator.id,
|
|
2628
|
+
init: declarator.init,
|
|
2629
|
+
});
|
|
2560
2630
|
let init = unwrapTsExpression(declarator.init);
|
|
2561
2631
|
if (
|
|
2562
2632
|
init?.type === 'CallExpression' &&
|
|
@@ -2567,25 +2637,58 @@ export function scriptSetupArrayConsts(code) {
|
|
|
2567
2637
|
init = unwrapTsExpression(init.arguments[0]);
|
|
2568
2638
|
if (init?.type === 'ArrayExpression') {
|
|
2569
2639
|
map.set(declarator.id.name, init);
|
|
2570
|
-
|
|
2640
|
+
declarators.push([declarator.start ?? 0, declarator.end ?? 0]);
|
|
2571
2641
|
}
|
|
2572
2642
|
}
|
|
2573
2643
|
}
|
|
2574
|
-
//
|
|
2575
|
-
//
|
|
2576
|
-
//
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2644
|
+
// The whole script with each array's own declarator blanked (a write may
|
|
2645
|
+
// sit anywhere, before a later declarator too), and
|
|
2646
|
+
// everything outside it (the template). `=(?![=>])` is an assignment, not
|
|
2647
|
+
// `==` or an arrow, and one followed by a quote is a template attribute
|
|
2648
|
+
// (`:columns="columns"`).
|
|
2649
|
+
let script = match[1];
|
|
2650
|
+
for (const [start, end] of declarators)
|
|
2651
|
+
script =
|
|
2652
|
+
script.slice(0, start) + ' '.repeat(end - start) + script.slice(end);
|
|
2653
|
+
const after =
|
|
2654
|
+
code.slice(0, match.index) +
|
|
2655
|
+
script +
|
|
2656
|
+
code.slice(match.index + match[0].length);
|
|
2580
2657
|
for (const key of map.keys()) {
|
|
2581
2658
|
const name = key.replace(/\$/g, '\\$');
|
|
2582
2659
|
const ref = `(?<![\\w$.:@#-])${name}(?:\\s*\\.\\s*value)?\\s*`;
|
|
2583
2660
|
const assign = `=(?![=>])(?!\\s*["'])`;
|
|
2661
|
+
// A call that receives the array may change it (`normalize(rows)`):
|
|
2662
|
+
// `(rows)` / `, rows` as an argument, not an arrow's own parameter.
|
|
2663
|
+
const handOff = `[(,]\\s*${name}(?:\\s*\\.\\s*value)?\\s*(?=[,)])(?![^)]*\\)\\s*=>)`;
|
|
2584
2664
|
const mutation = new RegExp(
|
|
2585
|
-
`${ref}(?:\\.\\s*(?:push|unshift|splice|pop|shift|sort|reverse|fill|copyWithin)\\s*\\(|\\.\\s*length\\s*${assign}|\\[[^\\]]*\\]\\s*${assign}|${assign})|Object\\.assign\\(\\s*${name}\\b|v-model(?::[\\w-]+)?\\s*=\\s*["']\\s*${name}\\s*["']`
|
|
2665
|
+
`${ref}(?:\\.\\s*(?:push|unshift|splice|pop|shift|sort|reverse|fill|copyWithin)\\s*\\(|\\.\\s*length\\s*${assign}|\\[[^\\]]*\\]\\s*${assign}|${assign})|Object\\.assign\\(\\s*${name}\\b|v-model(?::[\\w-]+)?\\s*=\\s*["']\\s*${name}\\s*["']|${handOff}`
|
|
2586
2666
|
);
|
|
2587
2667
|
if (mutation.test(after)) map.mutated.add(key);
|
|
2588
2668
|
}
|
|
2669
|
+
// A plain candidate is sealed only when nothing else can reach it: no
|
|
2670
|
+
// other Identifier in the script (nested scopes included — statement
|
|
2671
|
+
// order is irrelevant, unlike the `mutated` scan above), and outside
|
|
2672
|
+
// the script no occurrence but a `:items="x"` binding itself (a
|
|
2673
|
+
// template handler or `v-model` naming it could still hand it off).
|
|
2674
|
+
const outside =
|
|
2675
|
+
code.slice(0, match.index) + code.slice(match.index + match[0].length);
|
|
2676
|
+
for (const [key, candidate] of plain) {
|
|
2677
|
+
if (map.get(key) !== candidate.init) continue;
|
|
2678
|
+
if (hasIdentifierBeyond(program, key, candidate.id)) continue;
|
|
2679
|
+
const name = key.replace(/\$/g, '\\$');
|
|
2680
|
+
const bound = new RegExp(
|
|
2681
|
+
`(?:v-bind:|:)(?:items|columns)\\s*=\\s*(["'])\\s*${name}\\s*\\1`,
|
|
2682
|
+
'g'
|
|
2683
|
+
);
|
|
2684
|
+
if (
|
|
2685
|
+
new RegExp(`(?<![\\w$])${name}(?![\\w$])`).test(
|
|
2686
|
+
outside.replace(bound, '')
|
|
2687
|
+
)
|
|
2688
|
+
)
|
|
2689
|
+
continue;
|
|
2690
|
+
map.sealed.add(key);
|
|
2691
|
+
}
|
|
2589
2692
|
return map;
|
|
2590
2693
|
}
|
|
2591
2694
|
|
|
@@ -2608,6 +2711,21 @@ const resolveArray = (node, arrays) => {
|
|
|
2608
2711
|
return null;
|
|
2609
2712
|
};
|
|
2610
2713
|
|
|
2714
|
+
/**
|
|
2715
|
+
* Resolve an array whose WRITTEN elements a rule judges one by one (a row
|
|
2716
|
+
* with no label, a reserved key): an inline literal, or a same-file array
|
|
2717
|
+
* the file never changes. A later write (`rows.value =
|
|
2718
|
+
* rows.value.map(…)`, a call it is handed to) can relabel or rekey the very
|
|
2719
|
+
* rows the finding names, so a `mutated` array is out of reach. `ref` /
|
|
2720
|
+
* `reactive` / typed seeds stay readable: their written rows do render.
|
|
2721
|
+
*/
|
|
2722
|
+
const resolveWrittenArray = (node, arrays) => {
|
|
2723
|
+
const unwrapped = unwrapTsExpression(node);
|
|
2724
|
+
if (unwrapped?.type === 'Identifier' && arrays.mutated?.has(unwrapped.name))
|
|
2725
|
+
return null;
|
|
2726
|
+
return resolveArray(unwrapped, arrays);
|
|
2727
|
+
};
|
|
2728
|
+
|
|
2611
2729
|
/**
|
|
2612
2730
|
* an object item the option default chain cannot label — no `label`
|
|
2613
2731
|
* and no `text` key. A spread may bring either, so it is never judged.
|
|
@@ -2661,7 +2779,7 @@ export function checkObjectItemsWithoutText(name, surface, node, arrays) {
|
|
|
2661
2779
|
? { type: 'Identifier', name: content }
|
|
2662
2780
|
: null);
|
|
2663
2781
|
}
|
|
2664
|
-
const items = itemsExp ?
|
|
2782
|
+
const items = itemsExp ? resolveWrittenArray(itemsExp, arrays) : null;
|
|
2665
2783
|
if (!items) return [];
|
|
2666
2784
|
|
|
2667
2785
|
if (name === 'BbDropdown') {
|
|
@@ -2673,7 +2791,7 @@ export function checkObjectItemsWithoutText(name, surface, node, arrays) {
|
|
|
2673
2791
|
if (entry.properties.some((p) => p.type === 'SpreadElement')) continue;
|
|
2674
2792
|
const children = objectKeyNode(entry, 'items');
|
|
2675
2793
|
const childArray = children
|
|
2676
|
-
?
|
|
2794
|
+
? resolveWrittenArray(children.value, arrays)
|
|
2677
2795
|
: null;
|
|
2678
2796
|
if (!childArray) continue;
|
|
2679
2797
|
// A literal group with no mapper renders hand-written rows by their
|
|
@@ -2724,6 +2842,346 @@ export function checkObjectItemsWithoutText(name, surface, node, arrays) {
|
|
|
2724
2842
|
];
|
|
2725
2843
|
}
|
|
2726
2844
|
|
|
2845
|
+
/**
|
|
2846
|
+
* Resolve an array `unknown-item-key` may trust to hold EVERY row: an
|
|
2847
|
+
* inline literal, or a sealed same-file script array — a plain
|
|
2848
|
+
* `const x = […]` nothing else references (`scriptSetupArrayConsts`'
|
|
2849
|
+
* `sealed`). A `ref` / `reactive` / typed /
|
|
2850
|
+
* handed-off array is a seed or a sample, never provably the final
|
|
2851
|
+
* data, and no write scan can prove otherwise. Anything unsealed is out of
|
|
2852
|
+
* reach: silent, never guessed. Also the completeness half of
|
|
2853
|
+
* `keyedSlotLookup`.
|
|
2854
|
+
*/
|
|
2855
|
+
const resolveVisibleArray = (node, arrays) => {
|
|
2856
|
+
const unwrapped = unwrapTsExpression(node);
|
|
2857
|
+
if (unwrapped?.type === 'ArrayExpression') return unwrapped;
|
|
2858
|
+
if (unwrapped?.type === 'Identifier' && arrays.sealed?.has(unwrapped.name))
|
|
2859
|
+
return arrays.get(unwrapped.name) ?? null;
|
|
2860
|
+
return null;
|
|
2861
|
+
};
|
|
2862
|
+
|
|
2863
|
+
/** A static key's name (plain, quoted or numeric), or undefined. */
|
|
2864
|
+
const staticKeyName = (property) => {
|
|
2865
|
+
if (
|
|
2866
|
+
(property.type !== 'ObjectProperty' && property.type !== 'ObjectMethod') ||
|
|
2867
|
+
property.computed
|
|
2868
|
+
)
|
|
2869
|
+
return undefined;
|
|
2870
|
+
if (property.key.type === 'Identifier') return property.key.name;
|
|
2871
|
+
if (property.key.type === 'StringLiteral') return property.key.value;
|
|
2872
|
+
if (property.key.type === 'NumericLiteral') return String(property.key.value);
|
|
2873
|
+
return undefined;
|
|
2874
|
+
};
|
|
2875
|
+
|
|
2876
|
+
/**
|
|
2877
|
+
* Whether an object literal is plain enough to trust its key set: every
|
|
2878
|
+
* property a non-computed property or method — no spread (it may bring, or
|
|
2879
|
+
* override, any key), no computed key (it may spell any name).
|
|
2880
|
+
*/
|
|
2881
|
+
const isPlainObjectLiteral = (node) =>
|
|
2882
|
+
node?.type === 'ObjectExpression' &&
|
|
2883
|
+
node.properties.every(
|
|
2884
|
+
(p) =>
|
|
2885
|
+
(p.type === 'ObjectProperty' || p.type === 'ObjectMethod') && !p.computed
|
|
2886
|
+
);
|
|
2887
|
+
|
|
2888
|
+
/**
|
|
2889
|
+
* The rows of a visible array, or null when they cannot ALL be read: every
|
|
2890
|
+
* element a plain literal object (nested arrays flattened when `flatten`,
|
|
2891
|
+
* as a dropdown group flattens its rows). One spread, computed key, call,
|
|
2892
|
+
* identifier or primitive poisons the whole array; zero rows prove nothing.
|
|
2893
|
+
*/
|
|
2894
|
+
const plainRowsOf = (array, flatten) => {
|
|
2895
|
+
const rows = [];
|
|
2896
|
+
const collect = (node) => {
|
|
2897
|
+
for (const raw of node.elements) {
|
|
2898
|
+
const element = unwrapTsExpression(raw);
|
|
2899
|
+
if (flatten && element?.type === 'ArrayExpression') {
|
|
2900
|
+
if (!collect(element)) return false;
|
|
2901
|
+
} else if (isPlainObjectLiteral(element)) rows.push(element);
|
|
2902
|
+
else return false;
|
|
2903
|
+
}
|
|
2904
|
+
return true;
|
|
2905
|
+
};
|
|
2906
|
+
return collect(array) && rows.length ? rows : null;
|
|
2907
|
+
};
|
|
2908
|
+
|
|
2909
|
+
/** A string literal's value (`'name'`, `` `name` ``), or undefined. */
|
|
2910
|
+
const accessorString = (node) => {
|
|
2911
|
+
const value = unwrapTsExpression(node);
|
|
2912
|
+
if (value?.type === 'StringLiteral') return value.value;
|
|
2913
|
+
if (
|
|
2914
|
+
value?.type === 'TemplateLiteral' &&
|
|
2915
|
+
value.expressions.length === 0 &&
|
|
2916
|
+
value.quasis.length === 1
|
|
2917
|
+
)
|
|
2918
|
+
return value.quasis[0].value.cooked ?? undefined;
|
|
2919
|
+
return undefined;
|
|
2920
|
+
};
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* Value kinds a dot path certainly cannot walk into (the runtime `get`
|
|
2924
|
+
* only enters objects): a literal primitive or function ends the walk on
|
|
2925
|
+
* that row. Anything else (identifier, call, array…) is unresolvable.
|
|
2926
|
+
*/
|
|
2927
|
+
const TERMINAL_VALUE = new Set([
|
|
2928
|
+
'StringLiteral',
|
|
2929
|
+
'NumericLiteral',
|
|
2930
|
+
'BooleanLiteral',
|
|
2931
|
+
'NullLiteral',
|
|
2932
|
+
'BigIntLiteral',
|
|
2933
|
+
'TemplateLiteral',
|
|
2934
|
+
'ArrowFunctionExpression',
|
|
2935
|
+
'FunctionExpression',
|
|
2936
|
+
]);
|
|
2937
|
+
|
|
2938
|
+
/**
|
|
2939
|
+
* Judge one dot path against plain rows: null when some row resolves it or
|
|
2940
|
+
* any row leaves it unresolvable; else the first segment no row has, with
|
|
2941
|
+
* the field names at that level (for a "did you mean"). A segment check is
|
|
2942
|
+
* key-exists, like the runtime: `{ name: undefined }` has the field.
|
|
2943
|
+
* @param {any[]} rows plain ObjectExpression nodes
|
|
2944
|
+
* @param {string} path
|
|
2945
|
+
* @returns {{ index: number, fields: string[] } | null}
|
|
2946
|
+
*/
|
|
2947
|
+
const pathMiss = (rows, path) => {
|
|
2948
|
+
const segments = path.split('.');
|
|
2949
|
+
// `get` walks with `in`, so a prototype name resolves on every row; an
|
|
2950
|
+
// empty segment names nothing the runtime reads as written. Neither
|
|
2951
|
+
// is judged.
|
|
2952
|
+
if (segments.some((segment) => segment === '' || segment in Object.prototype))
|
|
2953
|
+
return null;
|
|
2954
|
+
let level = rows;
|
|
2955
|
+
for (let index = 0; index < segments.length; index++) {
|
|
2956
|
+
const segment = segments[index];
|
|
2957
|
+
const values = [];
|
|
2958
|
+
let unknown = false;
|
|
2959
|
+
for (const object of level) {
|
|
2960
|
+
const property = objectKeyNode(object, segment);
|
|
2961
|
+
if (property) values.push(property);
|
|
2962
|
+
else if (!isPlainObjectLiteral(object)) unknown = true;
|
|
2963
|
+
}
|
|
2964
|
+
if (!values.length)
|
|
2965
|
+
return unknown
|
|
2966
|
+
? null
|
|
2967
|
+
: {
|
|
2968
|
+
index,
|
|
2969
|
+
fields: [
|
|
2970
|
+
...new Set(
|
|
2971
|
+
level.flatMap((object) =>
|
|
2972
|
+
object.properties.map(staticKeyName).filter(Boolean)
|
|
2973
|
+
)
|
|
2974
|
+
),
|
|
2975
|
+
],
|
|
2976
|
+
};
|
|
2977
|
+
if (index === segments.length - 1) return null; // some row has it
|
|
2978
|
+
const next = [];
|
|
2979
|
+
for (const property of values) {
|
|
2980
|
+
const value = unwrapTsExpression(
|
|
2981
|
+
property.type === 'ObjectMethod' ? property : property.value
|
|
2982
|
+
);
|
|
2983
|
+
if (value?.type === 'ObjectExpression') next.push(value);
|
|
2984
|
+
else if (!TERMINAL_VALUE.has(value?.type)) unknown = true;
|
|
2985
|
+
}
|
|
2986
|
+
if (!next.length) return unknown ? null : { index: index + 1, fields: [] };
|
|
2987
|
+
if (unknown) return null; // an opaque branch may resolve the rest
|
|
2988
|
+
level = next;
|
|
2989
|
+
}
|
|
2990
|
+
return null;
|
|
2991
|
+
};
|
|
2992
|
+
|
|
2993
|
+
/** The "did you mean" tail for a missed path: the nearest field at its level. */
|
|
2994
|
+
const pathSuggestion = (path, miss) => {
|
|
2995
|
+
const segments = path.split('.');
|
|
2996
|
+
const near = nearestName(segments[miss.index], miss.fields);
|
|
2997
|
+
if (!near) return '';
|
|
2998
|
+
segments[miss.index] = near;
|
|
2999
|
+
return ` — did you mean \`${segments.join('.')}\`?`;
|
|
3000
|
+
};
|
|
3001
|
+
|
|
3002
|
+
/**
|
|
3003
|
+
* The accessor paths a plain group entry declares: `itemText`, `itemValue`
|
|
3004
|
+
* and each string path of an object-form `itemProps`. A function accessor,
|
|
3005
|
+
* a duplicated key or an unreadable shape contributes nothing — never a
|
|
3006
|
+
* guess. `where` spells the accessor as written, for the message.
|
|
3007
|
+
*/
|
|
3008
|
+
const groupAccessorsOf = (entry) => {
|
|
3009
|
+
const accessors = [];
|
|
3010
|
+
const once = (object, key) => {
|
|
3011
|
+
const found = object.properties.filter((p) => staticKeyName(p) === key);
|
|
3012
|
+
return found.length === 1 && found[0].type === 'ObjectProperty'
|
|
3013
|
+
? found[0]
|
|
3014
|
+
: null;
|
|
3015
|
+
};
|
|
3016
|
+
for (const key of ['itemText', 'itemValue']) {
|
|
3017
|
+
const property = once(entry, key);
|
|
3018
|
+
const path = property ? accessorString(property.value) : undefined;
|
|
3019
|
+
if (path)
|
|
3020
|
+
accessors.push({ attr: key, where: `\`${key}: '${path}'\``, path });
|
|
3021
|
+
}
|
|
3022
|
+
const itemProps = once(entry, 'itemProps');
|
|
3023
|
+
const fields = unwrapTsExpression(itemProps?.value);
|
|
3024
|
+
if (isPlainObjectLiteral(fields)) {
|
|
3025
|
+
const seen = new Set();
|
|
3026
|
+
for (const property of fields.properties) {
|
|
3027
|
+
const field = staticKeyName(property);
|
|
3028
|
+
if (!field || property.type !== 'ObjectProperty') continue;
|
|
3029
|
+
if (seen.has(field)) continue; // duplicated: the later one wins, unread
|
|
3030
|
+
seen.add(field);
|
|
3031
|
+
if (!once(fields, field)) continue;
|
|
3032
|
+
const path = accessorString(property.value);
|
|
3033
|
+
if (path)
|
|
3034
|
+
accessors.push({
|
|
3035
|
+
attr: 'itemProps',
|
|
3036
|
+
where: `\`itemProps.${field}: '${path}'\``,
|
|
3037
|
+
path,
|
|
3038
|
+
});
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
return accessors;
|
|
3042
|
+
};
|
|
3043
|
+
|
|
3044
|
+
/** A bound `:items` expression node of an element, inline or a bare name. */
|
|
3045
|
+
const itemsExpressionOf = (node) => {
|
|
3046
|
+
for (const prop of node.props ?? []) {
|
|
3047
|
+
if (prop.type !== PROP_DIRECTIVE || prop.name !== 'bind') continue;
|
|
3048
|
+
if (!prop.arg?.isStatic || prop.arg.content !== 'items') continue;
|
|
3049
|
+
const content = (prop.exp?.content ?? '').trim();
|
|
3050
|
+
return (
|
|
3051
|
+
prop.exp?.ast ??
|
|
3052
|
+
(/^[A-Za-z_$][\w$]*$/.test(content)
|
|
3053
|
+
? { type: 'Identifier', name: content }
|
|
3054
|
+
: parseTemplateExpression(content))
|
|
3055
|
+
);
|
|
3056
|
+
}
|
|
3057
|
+
return null;
|
|
3058
|
+
};
|
|
3059
|
+
|
|
3060
|
+
/** The components whose `item-text` / `item-value` read a field of the item. */
|
|
3061
|
+
const ITEM_KEY_SURFACES = new Set([
|
|
3062
|
+
'BbSelect',
|
|
3063
|
+
'BbSelectPopover',
|
|
3064
|
+
'BbCheckboxGroup',
|
|
3065
|
+
'BbRadioGroup',
|
|
3066
|
+
'BbSwitchGroup',
|
|
3067
|
+
'BbTable',
|
|
3068
|
+
]);
|
|
3069
|
+
|
|
3070
|
+
/**
|
|
3071
|
+
* an item-key accessor — a group's
|
|
3072
|
+
* `itemText` / `itemValue` / string `itemProps` paths on BbDropdown /
|
|
3073
|
+
* BbDropdownButton, or `item-text` / `item-value` on the option surfaces
|
|
3074
|
+
* (and BbTable's `item-value`) — naming a field NONE of its rows have reads
|
|
3075
|
+
* `undefined` off
|
|
3076
|
+
* every row, so the typo renders blank in silence. Flagged only when
|
|
3077
|
+
* certain: the rows are in the same file (an inline `:items="[…]"` or a
|
|
3078
|
+
* sealed `scriptSetupArrayConsts` array — a plain `const x = […]` with
|
|
3079
|
+
* no wrapper, no declared type and no other reference; a `ref` seed or
|
|
3080
|
+
* a typed sample is never provably final) and every row is a plain
|
|
3081
|
+
* literal object. A getter or fetched `items`, a function accessor, or one
|
|
3082
|
+
* unreadable row (spread, computed key, call, identifier, primitive) skips
|
|
3083
|
+
* the whole group silently; a key on SOME row counts as present (optional
|
|
3084
|
+
* fields); a dotted path is walked only through nested object literals.
|
|
3085
|
+
* A dropdown entry needs no `group: true` to be judged: `itemText` and kin
|
|
3086
|
+
* mean nothing on a plain row, so an entry carrying them is a mapped group
|
|
3087
|
+
* as written, markers or not.
|
|
3088
|
+
*
|
|
3089
|
+
* @param {string} name
|
|
3090
|
+
* @param {ComponentSurface} surface
|
|
3091
|
+
* @param {{ props?: Array<Record<string, any>> }} node compiler-sfc element
|
|
3092
|
+
* @param {Map<string, any>} arrays from `scriptSetupArrayConsts`
|
|
3093
|
+
*/
|
|
3094
|
+
export function checkItemKeyPaths(name, surface, node, arrays) {
|
|
3095
|
+
const itemsExp = itemsExpressionOf(node);
|
|
3096
|
+
const items = itemsExp ? resolveVisibleArray(itemsExp, arrays) : null;
|
|
3097
|
+
if (!items) return [];
|
|
3098
|
+
|
|
3099
|
+
if (name === 'BbDropdown' || name === 'BbDropdownButton') {
|
|
3100
|
+
const findings = [];
|
|
3101
|
+
const walk = (array) => {
|
|
3102
|
+
for (const raw of array.elements) {
|
|
3103
|
+
const entry = unwrapTsExpression(raw);
|
|
3104
|
+
if (entry?.type === 'ArrayExpression') {
|
|
3105
|
+
walk(entry);
|
|
3106
|
+
continue;
|
|
3107
|
+
}
|
|
3108
|
+
if (!isPlainObjectLiteral(entry)) continue;
|
|
3109
|
+
const children = objectKeyNode(entry, 'items');
|
|
3110
|
+
const childArray =
|
|
3111
|
+
children?.type === 'ObjectProperty'
|
|
3112
|
+
? resolveVisibleArray(children.value, arrays)
|
|
3113
|
+
: null;
|
|
3114
|
+
if (!childArray) continue;
|
|
3115
|
+
const accessors = groupAccessorsOf(entry);
|
|
3116
|
+
const rows = accessors.length ? plainRowsOf(childArray, true) : null;
|
|
3117
|
+
if (rows) {
|
|
3118
|
+
const id = accessorString(objectKeyNode(entry, 'id')?.value);
|
|
3119
|
+
const group = id ? `group \`${id}\`` : 'a group';
|
|
3120
|
+
for (const accessor of accessors) {
|
|
3121
|
+
const miss = pathMiss(rows, accessor.path);
|
|
3122
|
+
if (miss)
|
|
3123
|
+
findings.push({
|
|
3124
|
+
kind: 'unknown-item-key',
|
|
3125
|
+
attr: accessor.attr,
|
|
3126
|
+
message: `${accessor.where} names no field on the rows of ${group} on ${name}${pathSuggestion(accessor.path, miss) || '.'}`,
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
walk(childArray);
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
walk(items);
|
|
3134
|
+
return findings;
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
// Only the surfaces whose accessor reads the ITEM itself. A same-named
|
|
3138
|
+
// prop may read something else — BbTree's `item-value` reads `meta[key]`,
|
|
3139
|
+
// so its rows (`{ meta, children }`) would all "miss" — and an unlisted
|
|
3140
|
+
// component is never judged.
|
|
3141
|
+
if (!ITEM_KEY_SURFACES.has(name)) return [];
|
|
3142
|
+
const declared = ['itemText', 'itemValue'].filter((camel) =>
|
|
3143
|
+
(surface.props ?? []).some((p) => toCamel(p.name) === camel)
|
|
3144
|
+
);
|
|
3145
|
+
if (!declared.length) return [];
|
|
3146
|
+
// A `v-bind` spread or a dynamic binding may carry the accessor or the
|
|
3147
|
+
// items this element really runs with; the written ones prove nothing.
|
|
3148
|
+
const spread = (node.props ?? []).some(
|
|
3149
|
+
(p) => p.type === PROP_DIRECTIVE && p.name === 'bind' && !p.arg?.isStatic
|
|
3150
|
+
);
|
|
3151
|
+
if (spread) return [];
|
|
3152
|
+
const rows = plainRowsOf(items, false);
|
|
3153
|
+
if (!rows) return [];
|
|
3154
|
+
const findings = [];
|
|
3155
|
+
for (const camel of declared) {
|
|
3156
|
+
const written = (node.props ?? []).filter((p) =>
|
|
3157
|
+
p.type === PROP_ATTRIBUTE
|
|
3158
|
+
? toCamel(p.name) === camel
|
|
3159
|
+
: p.type === PROP_DIRECTIVE &&
|
|
3160
|
+
p.name === 'bind' &&
|
|
3161
|
+
p.arg?.isStatic &&
|
|
3162
|
+
toCamel(p.arg.content) === camel
|
|
3163
|
+
);
|
|
3164
|
+
if (written.length !== 1) continue; // absent, or set twice: unread
|
|
3165
|
+
const [prop] = written;
|
|
3166
|
+
const path =
|
|
3167
|
+
prop.type === PROP_ATTRIBUTE
|
|
3168
|
+
? (prop.value?.content ?? '').trim() || undefined
|
|
3169
|
+
: accessorString(
|
|
3170
|
+
prop.exp?.ast ??
|
|
3171
|
+
parseTemplateExpression((prop.exp?.content ?? '').trim())
|
|
3172
|
+
);
|
|
3173
|
+
if (!path) continue; // a function or dynamic accessor: never checked
|
|
3174
|
+
const miss = pathMiss(rows, path);
|
|
3175
|
+
if (miss)
|
|
3176
|
+
findings.push({
|
|
3177
|
+
kind: 'unknown-item-key',
|
|
3178
|
+
attr: toKebab(camel),
|
|
3179
|
+
message: `\`${toKebab(camel)}="${path}"\` names no field on ${name}'s \`items\`${pathSuggestion(path, miss) || '.'}`,
|
|
3180
|
+
});
|
|
3181
|
+
}
|
|
3182
|
+
return findings;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
2727
3185
|
/**
|
|
2728
3186
|
* Attributes that name any element, whatever the component: an author who set
|
|
2729
3187
|
* one of them named the control on purpose (`title` is a weak name, but it is
|
|
@@ -2739,8 +3197,8 @@ export const NAMED_COMPONENTS = new Set([
|
|
|
2739
3197
|
'BbDropdownButton',
|
|
2740
3198
|
]);
|
|
2741
3199
|
|
|
2742
|
-
/** BbButton's icon props
|
|
2743
|
-
const BUTTON_ICON_PROPS = ['
|
|
3200
|
+
/** BbButton's icon props (`icon-only` hides the text beside them). */
|
|
3201
|
+
const BUTTON_ICON_PROPS = ['prepend:icon', 'append:icon'];
|
|
2744
3202
|
|
|
2745
3203
|
/**
|
|
2746
3204
|
* a control that renders with no accessible name. Screen readers say
|
|
@@ -2748,16 +3206,15 @@ const BUTTON_ICON_PROPS = ['icon', 'prepend:icon', 'append:icon'];
|
|
|
2748
3206
|
* the library:
|
|
2749
3207
|
*
|
|
2750
3208
|
* - a BbButton with an icon and no words: no default-slot content, no `text`.
|
|
2751
|
-
* With `icon`
|
|
2752
|
-
* (
|
|
2753
|
-
* BbBadgeButton has no icon-only mode
|
|
2754
|
-
* scope.
|
|
3209
|
+
* With `icon-only` the words are visually hidden but still name the
|
|
3210
|
+
* button (BbButton.vue), so the fix costs nothing visually.
|
|
3211
|
+
* BbBadgeButton has no icon-only mode, so it is not in scope.
|
|
2755
3212
|
* - a BbDropdownButton with no label at all (beta.58): the component
|
|
2756
3213
|
* IS the main button, so with no default slot and no `text` its main
|
|
2757
3214
|
* button is empty — the shape every pre-beta.58 split button has, whose
|
|
2758
3215
|
* label came from `items[0]` (now a menu row). Reported whatever its icons.
|
|
2759
|
-
* - a BbBadge with `icon` and no default-slot content:
|
|
2760
|
-
*
|
|
3216
|
+
* - a BbBadge with `icon-only` and no default-slot content: the slot IS the
|
|
3217
|
+
* badge's visually hidden label, or its `text`.
|
|
2761
3218
|
* - a BbProgress with no `label`: `role="progressbar"` requires a name.
|
|
2762
3219
|
*
|
|
2763
3220
|
* BbSpinner has no rule: without a label it is decorative, which is correct.
|
|
@@ -2801,14 +3258,19 @@ export function checkAccessibleName(name, ctx) {
|
|
|
2801
3258
|
];
|
|
2802
3259
|
}
|
|
2803
3260
|
if (name === 'BbBadge') {
|
|
2804
|
-
if (
|
|
3261
|
+
if (
|
|
3262
|
+
!ctx.hasProp('iconOnly') ||
|
|
3263
|
+
ctx.hasProp('text') ||
|
|
3264
|
+
ctx.hasDefaultContent
|
|
3265
|
+
)
|
|
3266
|
+
return [];
|
|
2805
3267
|
return [
|
|
2806
3268
|
{
|
|
2807
3269
|
kind: 'nameless-control',
|
|
2808
|
-
attr: 'icon',
|
|
3270
|
+
attr: 'icon-only',
|
|
2809
3271
|
message:
|
|
2810
|
-
'This BbBadge shows only an icon and has no accessible name — with `icon
|
|
2811
|
-
hint: 'Put the words in the default slot: `<BbBadge icon="…">Pagato</BbBadge>`. They are visually hidden and still name the badge.',
|
|
3272
|
+
'This BbBadge shows only an icon and has no accessible name — with `icon-only`, the default slot is its label.',
|
|
3273
|
+
hint: 'Put the words in the default slot: `<BbBadge icon-only prepend:icon="…">Pagato</BbBadge>`. They are visually hidden and still name the badge.',
|
|
2812
3274
|
},
|
|
2813
3275
|
];
|
|
2814
3276
|
}
|
|
@@ -2819,10 +3281,9 @@ export function checkAccessibleName(name, ctx) {
|
|
|
2819
3281
|
kind: 'nameless-control',
|
|
2820
3282
|
attr: icon,
|
|
2821
3283
|
message: `This BbButton shows only an icon and has no accessible name — a screen reader announces a bare "button".`,
|
|
2822
|
-
hint:
|
|
2823
|
-
icon
|
|
2824
|
-
|
|
2825
|
-
: 'Put the words in the default slot (`<BbButton prepend:icon="…">Delete</BbButton>`), or use `icon` for an icon-only look: its slot text is visually hidden and still names the button.',
|
|
3284
|
+
hint: ctx.hasProp('iconOnly')
|
|
3285
|
+
? 'Put the words in the default slot: `<BbButton icon-only prepend:icon="…">Delete</BbButton>`. With `icon-only` they are visually hidden and still name the button.'
|
|
3286
|
+
: 'Put the words in the default slot (`<BbButton prepend:icon="…">Delete</BbButton>`), and add `icon-only` for an icon-only look: the words are visually hidden and still name the button.',
|
|
2826
3287
|
},
|
|
2827
3288
|
];
|
|
2828
3289
|
}
|
|
@@ -2897,16 +3358,18 @@ const literalKeyOf = (element, field) => {
|
|
|
2897
3358
|
* @param {Map<string, any>} arrays
|
|
2898
3359
|
* @returns {{ keys: string[], wrap: (key: string) => string } | null}
|
|
2899
3360
|
*/
|
|
2900
|
-
const computedSlotKeys = (
|
|
3361
|
+
const computedSlotKeys = (
|
|
3362
|
+
slotText,
|
|
3363
|
+
loopText,
|
|
3364
|
+
arrays,
|
|
3365
|
+
resolve = resolveArray
|
|
3366
|
+
) => {
|
|
2901
3367
|
const match = /^\s*\(?\s*([A-Za-z_$][\w$]*)[^]*?\s+(?:in|of)\s+([^]+)$/.exec(
|
|
2902
3368
|
loopText ?? ''
|
|
2903
3369
|
);
|
|
2904
3370
|
if (!match) return null;
|
|
2905
3371
|
const [, alias, sourceText] = match;
|
|
2906
|
-
const source =
|
|
2907
|
-
parseTemplateExpression(sourceText.trim()),
|
|
2908
|
-
arrays
|
|
2909
|
-
);
|
|
3372
|
+
const source = resolve(parseTemplateExpression(sourceText.trim()), arrays);
|
|
2910
3373
|
if (!source) return null;
|
|
2911
3374
|
|
|
2912
3375
|
const slotExpr = parseTemplateExpression(slotText);
|
|
@@ -3014,8 +3477,16 @@ export function checkComputedSlotKeys(name, surface, node, arrays) {
|
|
|
3014
3477
|
if (!dynamic) return [];
|
|
3015
3478
|
const findings = [];
|
|
3016
3479
|
for (const template of computedSlotTemplates(node)) {
|
|
3017
|
-
|
|
3480
|
+
// The keys are judged one by one: a source the file changes is out of
|
|
3481
|
+
// reach (it may rename them); the warning below still knows it as seen.
|
|
3482
|
+
const resolved = computedSlotKeys(
|
|
3483
|
+
template.slot,
|
|
3484
|
+
template.loop,
|
|
3485
|
+
arrays,
|
|
3486
|
+
resolveWrittenArray
|
|
3487
|
+
);
|
|
3018
3488
|
if (!resolved) {
|
|
3489
|
+
if (computedSlotKeys(template.slot, template.loop, arrays)) continue;
|
|
3019
3490
|
const warning = computedSlotKeyWarning(name, surface, template, arrays);
|
|
3020
3491
|
if (warning) findings.push({ ...warning, line: template.line });
|
|
3021
3492
|
continue;
|
|
@@ -3255,7 +3726,7 @@ export function checkReservedKeys(name, surface, node, arrays) {
|
|
|
3255
3726
|
);
|
|
3256
3727
|
if (!binding) return [];
|
|
3257
3728
|
const content = (binding.exp?.content ?? '').trim();
|
|
3258
|
-
const list =
|
|
3729
|
+
const list = resolveWrittenArray(
|
|
3259
3730
|
binding.exp?.ast ??
|
|
3260
3731
|
(/^[A-Za-z_$][\w$]*$/.test(content)
|
|
3261
3732
|
? { type: 'Identifier', name: content }
|
|
@@ -3286,7 +3757,9 @@ export function checkReservedKeys(name, surface, node, arrays) {
|
|
|
3286
3757
|
source.nested && entry?.type === 'ObjectExpression'
|
|
3287
3758
|
? objectKeyNode(entry, 'items')
|
|
3288
3759
|
: null;
|
|
3289
|
-
const childArray = children
|
|
3760
|
+
const childArray = children
|
|
3761
|
+
? resolveWrittenArray(children.value, arrays)
|
|
3762
|
+
: null;
|
|
3290
3763
|
if (childArray) walk(childArray);
|
|
3291
3764
|
}
|
|
3292
3765
|
};
|
|
@@ -3333,14 +3806,15 @@ export function keyedSlotLookup(name, surface, propSource, arrays) {
|
|
|
3333
3806
|
const text = propSource(source.prop);
|
|
3334
3807
|
if (!text) return null;
|
|
3335
3808
|
const expression = parseTemplateExpression(text.trim());
|
|
3336
|
-
const list =
|
|
3809
|
+
const list = resolveWrittenArray(expression, arrays);
|
|
3337
3810
|
if (!list) return null;
|
|
3338
3811
|
const keys = [];
|
|
3339
|
-
//
|
|
3340
|
-
//
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
)
|
|
3812
|
+
// every key must be in sight: an inline
|
|
3813
|
+
// literal, or a sealed same-file array — a `ref` seed a fetch replaces, a
|
|
3814
|
+
// typed array with rows from elsewhere, or one the file changes or hands
|
|
3815
|
+
// off may hold keys the literal does not show.
|
|
3816
|
+
// A key the literal shows is still judged on its own (`renamed-slot`).
|
|
3817
|
+
let complete = resolveVisibleArray(expression, arrays) !== null;
|
|
3344
3818
|
const walk = (array) => {
|
|
3345
3819
|
for (const element of array.elements) {
|
|
3346
3820
|
const key = identityOf(source, element);
|
|
@@ -3352,9 +3826,9 @@ export function keyedSlotLookup(name, surface, propSource, arrays) {
|
|
|
3352
3826
|
? objectKeyNode(entry, 'items')
|
|
3353
3827
|
: null;
|
|
3354
3828
|
if (children) {
|
|
3355
|
-
const childArray =
|
|
3829
|
+
const childArray = resolveWrittenArray(children.value, arrays);
|
|
3830
|
+
if (!resolveVisibleArray(children.value, arrays)) complete = false;
|
|
3356
3831
|
if (childArray) walk(childArray);
|
|
3357
|
-
else complete = false;
|
|
3358
3832
|
}
|
|
3359
3833
|
}
|
|
3360
3834
|
};
|
|
@@ -3640,7 +4114,7 @@ export function checkDropdownKeys(name, node, arrays) {
|
|
|
3640
4114
|
);
|
|
3641
4115
|
if (!binding) return [];
|
|
3642
4116
|
const content = (binding.exp?.content ?? '').trim();
|
|
3643
|
-
const list =
|
|
4117
|
+
const list = resolveWrittenArray(
|
|
3644
4118
|
binding.exp?.ast ??
|
|
3645
4119
|
(/^[A-Za-z_$][\w$]*$/.test(content)
|
|
3646
4120
|
? { type: 'Identifier', name: content }
|
|
@@ -3678,7 +4152,9 @@ export function checkDropdownKeys(name, node, arrays) {
|
|
|
3678
4152
|
if (entry.properties.some((p) => p.type === 'SpreadElement')) continue;
|
|
3679
4153
|
const isGroup = literal(entry, 'group') === true || isSelectable(entry);
|
|
3680
4154
|
const children = objectKeyNode(entry, 'items');
|
|
3681
|
-
const childArray = children
|
|
4155
|
+
const childArray = children
|
|
4156
|
+
? resolveWrittenArray(children.value, arrays)
|
|
4157
|
+
: null;
|
|
3682
4158
|
if (isGroup) {
|
|
3683
4159
|
const groupId = literal(entry, 'id');
|
|
3684
4160
|
// A group still spelling `key` is `renamed-item-field`'s.
|
|
@@ -4538,6 +5014,14 @@ function validateElement(node, manifest, findings, options = {}) {
|
|
|
4538
5014
|
)) {
|
|
4539
5015
|
findings.push({ component: name, ...finding, line: tagLine });
|
|
4540
5016
|
}
|
|
5017
|
+
for (const finding of checkItemKeyPaths(
|
|
5018
|
+
name,
|
|
5019
|
+
surface,
|
|
5020
|
+
node,
|
|
5021
|
+
options.arrays ?? new Map()
|
|
5022
|
+
)) {
|
|
5023
|
+
findings.push({ component: name, ...finding, line: tagLine });
|
|
5024
|
+
}
|
|
4541
5025
|
const directives = (node.props ?? []).filter(
|
|
4542
5026
|
(p) => p.type === PROP_DIRECTIVE
|
|
4543
5027
|
);
|