@mgamadeus/ddd-admin-ui 0.1.0-rc.1 → 0.1.0-rc.2
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/.claude/skills/ddd-admin-ui-specialist/SKILL.md +148 -18
- package/CHANGELOG.md +17 -0
- package/README.md +196 -88
- package/STANDARDS.md +385 -0
- package/dist/components.css +167 -22
- package/dist/form/DrawerFooter.d.ts +18 -0
- package/dist/form/DrawerFooter.d.ts.map +1 -0
- package/dist/form/DrawerFooter.js +47 -0
- package/dist/form/DrawerFooter.js.map +1 -0
- package/dist/form/Form.d.ts +25 -10
- package/dist/form/Form.d.ts.map +1 -1
- package/dist/form/Form.js +17 -8
- package/dist/form/Form.js.map +1 -1
- package/dist/form/FormActions.d.ts +35 -0
- package/dist/form/FormActions.d.ts.map +1 -0
- package/dist/form/FormActions.js +80 -0
- package/dist/form/FormActions.js.map +1 -0
- package/dist/form/FormDrawer.d.ts +36 -0
- package/dist/form/FormDrawer.d.ts.map +1 -0
- package/dist/form/FormDrawer.js +31 -0
- package/dist/form/FormDrawer.js.map +1 -0
- package/dist/form/FormErrors.d.ts +22 -0
- package/dist/form/FormErrors.d.ts.map +1 -0
- package/dist/form/FormErrors.js +46 -0
- package/dist/form/FormErrors.js.map +1 -0
- package/dist/form/FormField.d.ts +74 -0
- package/dist/form/FormField.d.ts.map +1 -0
- package/dist/form/FormField.js +46 -0
- package/dist/form/FormField.js.map +1 -0
- package/dist/form/FormHeader.d.ts +20 -0
- package/dist/form/FormHeader.d.ts.map +1 -0
- package/dist/form/FormHeader.js +9 -0
- package/dist/form/FormHeader.js.map +1 -0
- package/dist/form/FormJumpBar.d.ts +20 -0
- package/dist/form/FormJumpBar.d.ts.map +1 -0
- package/dist/form/FormJumpBar.js +49 -0
- package/dist/form/FormJumpBar.js.map +1 -0
- package/dist/form/FormSubmitButton.d.ts +17 -0
- package/dist/form/FormSubmitButton.d.ts.map +1 -0
- package/dist/form/FormSubmitButton.js +14 -0
- package/dist/form/FormSubmitButton.js.map +1 -0
- package/dist/form/FormWrapper.d.ts +13 -0
- package/dist/form/FormWrapper.d.ts.map +1 -0
- package/dist/form/FormWrapper.js +15 -0
- package/dist/form/FormWrapper.js.map +1 -0
- package/dist/form/drawerSlots.d.ts +10 -0
- package/dist/form/drawerSlots.d.ts.map +1 -0
- package/dist/form/drawerSlots.js +7 -0
- package/dist/form/drawerSlots.js.map +1 -0
- package/dist/form/fieldLabels.d.ts +15 -8
- package/dist/form/fieldLabels.d.ts.map +1 -1
- package/dist/form/fieldLabels.js +18 -6
- package/dist/form/fieldLabels.js.map +1 -1
- package/dist/form/formPanelClasses.d.ts +3 -0
- package/dist/form/formPanelClasses.d.ts.map +1 -0
- package/dist/form/formPanelClasses.js +3 -0
- package/dist/form/formPanelClasses.js.map +1 -0
- package/dist/form/index.d.ts +57 -2
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +33 -2
- package/dist/form/index.js.map +1 -1
- package/dist/form/useConfirmDialog.d.ts +9 -0
- package/dist/form/useConfirmDialog.d.ts.map +1 -0
- package/dist/form/useConfirmDialog.js +29 -0
- package/dist/form/useConfirmDialog.js.map +1 -0
- package/dist/glass/ActionRow.d.ts +27 -0
- package/dist/glass/ActionRow.d.ts.map +1 -0
- package/dist/glass/ActionRow.js +22 -0
- package/dist/glass/ActionRow.js.map +1 -0
- package/dist/glass/CollapsibleCard.d.ts +36 -0
- package/dist/glass/CollapsibleCard.d.ts.map +1 -0
- package/dist/glass/CollapsibleCard.js +27 -0
- package/dist/glass/CollapsibleCard.js.map +1 -0
- package/dist/glass/GlassGroup.d.ts +26 -0
- package/dist/glass/GlassGroup.d.ts.map +1 -0
- package/dist/glass/GlassGroup.js +34 -0
- package/dist/glass/GlassGroup.js.map +1 -0
- package/dist/glass/GlassPill.d.ts +23 -0
- package/dist/glass/GlassPill.d.ts.map +1 -0
- package/dist/glass/GlassPill.js +20 -0
- package/dist/glass/GlassPill.js.map +1 -0
- package/dist/glass/QuickFilterPills.d.ts +38 -0
- package/dist/glass/QuickFilterPills.d.ts.map +1 -0
- package/dist/glass/QuickFilterPills.js +30 -0
- package/dist/glass/QuickFilterPills.js.map +1 -0
- package/dist/glass/index.d.ts +10 -1
- package/dist/glass/index.d.ts.map +1 -1
- package/dist/glass/index.js +6 -1
- package/dist/glass/index.js.map +1 -1
- package/dist/i18n/Translate.d.ts +5 -4
- package/dist/i18n/Translate.d.ts.map +1 -1
- package/dist/i18n/Translate.js +3 -3
- package/dist/i18n/Translate.js.map +1 -1
- package/dist/i18n/format.d.ts +13 -0
- package/dist/i18n/format.d.ts.map +1 -0
- package/dist/i18n/format.js +15 -0
- package/dist/i18n/format.js.map +1 -0
- package/dist/i18n/hints.json +130 -0
- package/dist/i18n/index.d.ts +5 -3
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +5 -3
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/localeFormat.d.ts +10 -0
- package/dist/i18n/localeFormat.d.ts.map +1 -0
- package/dist/i18n/localeFormat.js +36 -0
- package/dist/i18n/localeFormat.js.map +1 -0
- package/dist/i18n/plural.d.ts +15 -0
- package/dist/i18n/plural.d.ts.map +1 -0
- package/dist/i18n/plural.js +95 -0
- package/dist/i18n/plural.js.map +1 -0
- package/dist/i18n/serverMessages.d.ts +26 -0
- package/dist/i18n/serverMessages.d.ts.map +1 -0
- package/dist/i18n/serverMessages.js +146 -0
- package/dist/i18n/serverMessages.js.map +1 -0
- package/dist/i18n/store.d.ts +28 -16
- package/dist/i18n/store.d.ts.map +1 -1
- package/dist/i18n/store.js +26 -20
- package/dist/i18n/store.js.map +1 -1
- package/dist/i18n/useTranslate.d.ts +15 -7
- package/dist/i18n/useTranslate.d.ts.map +1 -1
- package/dist/i18n/useTranslate.js +17 -7
- package/dist/i18n/useTranslate.js.map +1 -1
- package/dist/i18n-keys.json +1050 -13
- package/dist/list/ChipToggleGroup.d.ts +36 -0
- package/dist/list/ChipToggleGroup.d.ts.map +1 -0
- package/dist/list/ChipToggleGroup.js +34 -0
- package/dist/list/ChipToggleGroup.js.map +1 -0
- package/dist/list/Combobox.d.ts +32 -0
- package/dist/list/Combobox.d.ts.map +1 -0
- package/dist/list/Combobox.js +27 -0
- package/dist/list/Combobox.js.map +1 -0
- package/dist/list/EmptyValue.d.ts +14 -0
- package/dist/list/EmptyValue.d.ts.map +1 -0
- package/dist/list/EmptyValue.js +11 -0
- package/dist/list/EmptyValue.js.map +1 -0
- package/dist/list/EntityListBody.d.ts +27 -0
- package/dist/list/EntityListBody.d.ts.map +1 -0
- package/dist/list/EntityListBody.js +24 -0
- package/dist/list/EntityListBody.js.map +1 -0
- package/dist/list/EntityListBulkBar.d.ts +38 -0
- package/dist/list/EntityListBulkBar.d.ts.map +1 -0
- package/dist/list/EntityListBulkBar.js +19 -0
- package/dist/list/EntityListBulkBar.js.map +1 -0
- package/dist/list/EntityListCard.d.ts +22 -0
- package/dist/list/EntityListCard.d.ts.map +1 -0
- package/dist/list/EntityListCard.js +15 -0
- package/dist/list/EntityListCard.js.map +1 -0
- package/dist/list/EntityListEmpty.d.ts +13 -0
- package/dist/list/EntityListEmpty.d.ts.map +1 -0
- package/dist/list/EntityListEmpty.js +11 -0
- package/dist/list/EntityListEmpty.js.map +1 -0
- package/dist/list/EntityListGrid.d.ts +29 -0
- package/dist/list/EntityListGrid.d.ts.map +1 -0
- package/dist/list/EntityListGrid.js +21 -0
- package/dist/list/EntityListGrid.js.map +1 -0
- package/dist/list/EntityListLoadMore.d.ts +15 -0
- package/dist/list/EntityListLoadMore.d.ts.map +1 -0
- package/dist/list/EntityListLoadMore.js +27 -0
- package/dist/list/EntityListLoadMore.js.map +1 -0
- package/dist/list/EntityListStatus.d.ts +11 -0
- package/dist/list/EntityListStatus.d.ts.map +1 -0
- package/dist/list/EntityListStatus.js +22 -0
- package/dist/list/EntityListStatus.js.map +1 -0
- package/dist/list/EntityListTable.d.ts +34 -0
- package/dist/list/EntityListTable.d.ts.map +1 -0
- package/dist/list/EntityListTable.js +43 -0
- package/dist/list/EntityListTable.js.map +1 -0
- package/dist/list/EntityListToolbar.d.ts +39 -0
- package/dist/list/EntityListToolbar.d.ts.map +1 -0
- package/dist/list/EntityListToolbar.js +25 -0
- package/dist/list/EntityListToolbar.js.map +1 -0
- package/dist/list/EntityListViewToggle.d.ts +17 -0
- package/dist/list/EntityListViewToggle.d.ts.map +1 -0
- package/dist/list/EntityListViewToggle.js +38 -0
- package/dist/list/EntityListViewToggle.js.map +1 -0
- package/dist/list/MultiSelect.d.ts +33 -0
- package/dist/list/MultiSelect.d.ts.map +1 -0
- package/dist/list/MultiSelect.js +60 -0
- package/dist/list/MultiSelect.js.map +1 -0
- package/dist/list/SearchField.d.ts +24 -0
- package/dist/list/SearchField.d.ts.map +1 -0
- package/dist/list/SearchField.js +42 -0
- package/dist/list/SearchField.js.map +1 -0
- package/dist/list/StatusBadge.d.ts +34 -0
- package/dist/list/StatusBadge.d.ts.map +1 -0
- package/dist/list/StatusBadge.js +44 -0
- package/dist/list/StatusBadge.js.map +1 -0
- package/dist/list/Tag.d.ts +16 -0
- package/dist/list/Tag.d.ts.map +1 -0
- package/dist/list/Tag.js +15 -0
- package/dist/list/Tag.js.map +1 -0
- package/dist/list/cells.d.ts +53 -0
- package/dist/list/cells.d.ts.map +1 -0
- package/dist/list/cells.js +62 -0
- package/dist/list/cells.js.map +1 -0
- package/dist/list/filterClasses.d.ts +8 -0
- package/dist/list/filterClasses.d.ts.map +1 -0
- package/dist/list/filterClasses.js +8 -0
- package/dist/list/filterClasses.js.map +1 -0
- package/dist/list/filterOptions.d.ts +7 -0
- package/dist/list/filterOptions.d.ts.map +1 -0
- package/dist/list/filterOptions.js +7 -0
- package/dist/list/filterOptions.js.map +1 -0
- package/dist/list/filters.d.ts +78 -0
- package/dist/list/filters.d.ts.map +1 -0
- package/dist/list/filters.js +54 -0
- package/dist/list/filters.js.map +1 -0
- package/dist/list/index.d.ts +88 -2
- package/dist/list/index.d.ts.map +1 -1
- package/dist/list/index.js +50 -2
- package/dist/list/index.js.map +1 -1
- package/dist/list/types.d.ts +59 -0
- package/dist/list/types.d.ts.map +1 -0
- package/dist/list/types.js +3 -0
- package/dist/list/types.js.map +1 -0
- package/dist/logic/browser/prepareImageFile.d.ts +18 -0
- package/dist/logic/browser/prepareImageFile.d.ts.map +1 -0
- package/dist/logic/browser/prepareImageFile.js +26 -0
- package/dist/logic/browser/prepareImageFile.js.map +1 -0
- package/dist/logic/index.d.ts +56 -5
- package/dist/logic/index.d.ts.map +1 -1
- package/dist/logic/index.js +37 -4
- package/dist/logic/index.js.map +1 -1
- package/dist/logic/pure/conditions.d.ts +46 -0
- package/dist/logic/pure/conditions.d.ts.map +1 -0
- package/dist/logic/pure/conditions.js +39 -0
- package/dist/logic/pure/conditions.js.map +1 -0
- package/dist/logic/pure/confirm.d.ts +19 -0
- package/dist/logic/pure/confirm.d.ts.map +1 -0
- package/dist/logic/pure/confirm.js +10 -0
- package/dist/logic/pure/confirm.js.map +1 -0
- package/dist/logic/pure/displayMode.d.ts +12 -0
- package/dist/logic/pure/displayMode.d.ts.map +1 -0
- package/dist/logic/pure/displayMode.js +11 -0
- package/dist/logic/pure/displayMode.js.map +1 -0
- package/dist/logic/pure/entityDrawer.d.ts +24 -0
- package/dist/logic/pure/entityDrawer.d.ts.map +1 -0
- package/dist/logic/pure/entityDrawer.js +3 -0
- package/dist/logic/pure/entityDrawer.js.map +1 -0
- package/dist/logic/pure/fieldPath.d.ts +9 -0
- package/dist/logic/pure/fieldPath.d.ts.map +1 -0
- package/dist/logic/pure/fieldPath.js +17 -0
- package/dist/logic/pure/fieldPath.js.map +1 -0
- package/dist/logic/pure/formValues.d.ts +14 -0
- package/dist/logic/pure/formValues.d.ts.map +1 -0
- package/dist/logic/pure/formValues.js +82 -0
- package/dist/logic/pure/formValues.js.map +1 -0
- package/dist/logic/pure/format.d.ts +14 -14
- package/dist/logic/pure/format.d.ts.map +1 -1
- package/dist/logic/pure/format.js +50 -29
- package/dist/logic/pure/format.js.map +1 -1
- package/dist/logic/pure/locales.d.ts +27 -0
- package/dist/logic/pure/locales.d.ts.map +1 -0
- package/dist/logic/pure/locales.js +50 -0
- package/dist/logic/pure/locales.js.map +1 -0
- package/dist/logic/pure/notify.d.ts +28 -5
- package/dist/logic/pure/notify.d.ts.map +1 -1
- package/dist/logic/pure/notify.js +41 -22
- package/dist/logic/pure/notify.js.map +1 -1
- package/dist/logic/pure/rowActivation.d.ts +6 -0
- package/dist/logic/pure/rowActivation.d.ts.map +1 -0
- package/dist/logic/pure/rowActivation.js +7 -0
- package/dist/logic/pure/rowActivation.js.map +1 -0
- package/dist/logic/pure/runSequential.d.ts +31 -0
- package/dist/logic/pure/runSequential.d.ts.map +1 -0
- package/dist/logic/pure/runSequential.js +47 -0
- package/dist/logic/pure/runSequential.js.map +1 -0
- package/dist/logic/pure/schemas.d.ts +14 -0
- package/dist/logic/pure/schemas.d.ts.map +1 -0
- package/dist/logic/pure/schemas.js +6 -0
- package/dist/logic/pure/schemas.js.map +1 -0
- package/dist/logic/pure/serverViolations.d.ts +35 -0
- package/dist/logic/pure/serverViolations.d.ts.map +1 -0
- package/dist/logic/pure/serverViolations.js +77 -0
- package/dist/logic/pure/serverViolations.js.map +1 -0
- package/dist/logic/pure/status.d.ts +21 -0
- package/dist/logic/pure/status.d.ts.map +1 -0
- package/dist/logic/pure/status.js +3 -0
- package/dist/logic/pure/status.js.map +1 -0
- package/dist/logic/pure/submitError.d.ts +11 -0
- package/dist/logic/pure/submitError.d.ts.map +1 -0
- package/dist/logic/pure/submitError.js +9 -0
- package/dist/logic/pure/submitError.js.map +1 -0
- package/dist/logic/pure/translationState.d.ts +29 -0
- package/dist/logic/pure/translationState.d.ts.map +1 -0
- package/dist/logic/pure/translationState.js +88 -0
- package/dist/logic/pure/translationState.js.map +1 -0
- package/dist/logic/pure/urlListState.d.ts +18 -0
- package/dist/logic/pure/urlListState.d.ts.map +1 -0
- package/dist/logic/pure/urlListState.js +3 -0
- package/dist/logic/pure/urlListState.js.map +1 -0
- package/dist/logic/react/conditionHooks.d.ts +20 -0
- package/dist/logic/react/conditionHooks.d.ts.map +1 -0
- package/dist/logic/react/conditionHooks.js +51 -0
- package/dist/logic/react/conditionHooks.js.map +1 -0
- package/dist/logic/react/useCopyToClipboard.d.ts +9 -0
- package/dist/logic/react/useCopyToClipboard.d.ts.map +1 -0
- package/dist/logic/react/useCopyToClipboard.js +28 -0
- package/dist/logic/react/useCopyToClipboard.js.map +1 -0
- package/dist/logic/react/useDebouncedValue.d.ts +3 -0
- package/dist/logic/react/useDebouncedValue.d.ts.map +1 -0
- package/dist/logic/react/useDebouncedValue.js +12 -0
- package/dist/logic/react/useDebouncedValue.js.map +1 -0
- package/dist/logic/react/useEntityDrawer.d.ts +54 -0
- package/dist/logic/react/useEntityDrawer.d.ts.map +1 -0
- package/dist/logic/react/useEntityDrawer.js +81 -0
- package/dist/logic/react/useEntityDrawer.js.map +1 -0
- package/dist/logic/react/useEntityTranslations.d.ts +57 -0
- package/dist/logic/react/useEntityTranslations.d.ts.map +1 -0
- package/dist/logic/react/useEntityTranslations.js +50 -0
- package/dist/logic/react/useEntityTranslations.js.map +1 -0
- package/dist/logic/react/useFormDirty.d.ts +15 -0
- package/dist/logic/react/useFormDirty.d.ts.map +1 -0
- package/dist/logic/react/useFormDirty.js +17 -0
- package/dist/logic/react/useFormDirty.js.map +1 -0
- package/dist/logic/react/useGrowingWindowList.d.ts +50 -0
- package/dist/logic/react/useGrowingWindowList.d.ts.map +1 -0
- package/dist/logic/react/useGrowingWindowList.js +38 -0
- package/dist/logic/react/useGrowingWindowList.js.map +1 -0
- package/dist/logic/react/useHydrated.d.ts +7 -0
- package/dist/logic/react/useHydrated.d.ts.map +1 -0
- package/dist/logic/react/useHydrated.js +12 -0
- package/dist/logic/react/useHydrated.js.map +1 -0
- package/dist/logic/react/useInfiniteScrollSentinel.d.ts +6 -0
- package/dist/logic/react/useInfiniteScrollSentinel.d.ts.map +1 -0
- package/dist/logic/react/useInfiniteScrollSentinel.js +24 -0
- package/dist/logic/react/useInfiniteScrollSentinel.js.map +1 -0
- package/dist/logic/react/useLocaleName.d.ts +3 -0
- package/dist/logic/react/useLocaleName.d.ts.map +1 -0
- package/dist/logic/react/useLocaleName.js +10 -0
- package/dist/logic/react/useLocaleName.js.map +1 -0
- package/dist/logic/react/useRowActivation.d.ts +12 -0
- package/dist/logic/react/useRowActivation.d.ts.map +1 -0
- package/dist/logic/react/useRowActivation.js +35 -0
- package/dist/logic/react/useRowActivation.js.map +1 -0
- package/dist/logic/react/useRowSelection.d.ts +40 -0
- package/dist/logic/react/useRowSelection.d.ts.map +1 -0
- package/dist/logic/react/useRowSelection.js +70 -0
- package/dist/logic/react/useRowSelection.js.map +1 -0
- package/dist/logic/react/useTranslationRunner.d.ts +27 -0
- package/dist/logic/react/useTranslationRunner.d.ts.map +1 -0
- package/dist/logic/react/useTranslationRunner.js +57 -0
- package/dist/logic/react/useTranslationRunner.js.map +1 -0
- package/dist/logic/react/useUnsavedChangesGuard.d.ts +30 -0
- package/dist/logic/react/useUnsavedChangesGuard.d.ts.map +1 -0
- package/dist/logic/react/useUnsavedChangesGuard.js +66 -0
- package/dist/logic/react/useUnsavedChangesGuard.js.map +1 -0
- package/dist/logic/react/useUrlListState.d.ts +39 -0
- package/dist/logic/react/useUrlListState.d.ts.map +1 -0
- package/dist/logic/react/useUrlListState.js +96 -0
- package/dist/logic/react/useUrlListState.js.map +1 -0
- package/dist/media/FormMediaItemField.d.ts +38 -0
- package/dist/media/FormMediaItemField.d.ts.map +1 -0
- package/dist/media/FormMediaItemField.js +35 -0
- package/dist/media/FormMediaItemField.js.map +1 -0
- package/dist/media/MediaItemField.d.ts +17 -3
- package/dist/media/MediaItemField.d.ts.map +1 -1
- package/dist/media/MediaItemField.js +11 -7
- package/dist/media/MediaItemField.js.map +1 -1
- package/dist/media/MediaItemPickerDialog.d.ts +48 -0
- package/dist/media/MediaItemPickerDialog.d.ts.map +1 -0
- package/dist/media/MediaItemPickerDialog.js +36 -0
- package/dist/media/MediaItemPickerDialog.js.map +1 -0
- package/dist/media/MediaPreview.d.ts +16 -0
- package/dist/media/MediaPreview.d.ts.map +1 -0
- package/dist/media/MediaPreview.js +20 -0
- package/dist/media/MediaPreview.js.map +1 -0
- package/dist/media/index.d.ts +17 -2
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +7 -0
- package/dist/media/index.js.map +1 -1
- package/dist/media/types.d.ts +23 -6
- package/dist/media/types.d.ts.map +1 -1
- package/dist/next/index.d.ts +7 -2
- package/dist/next/index.d.ts.map +1 -1
- package/dist/next/index.js +7 -2
- package/dist/next/index.js.map +1 -1
- package/dist/next/listViewParam.d.ts +3 -0
- package/dist/next/listViewParam.d.ts.map +1 -0
- package/dist/next/listViewParam.js +3 -0
- package/dist/next/listViewParam.js.map +1 -0
- package/dist/next/searchParamsWriter.d.ts +30 -6
- package/dist/next/searchParamsWriter.d.ts.map +1 -1
- package/dist/next/searchParamsWriter.js +80 -27
- package/dist/next/searchParamsWriter.js.map +1 -1
- package/dist/next/storage.d.ts +11 -0
- package/dist/next/storage.d.ts.map +1 -0
- package/dist/next/storage.js +34 -0
- package/dist/next/storage.js.map +1 -0
- package/dist/next/useListViewParam.d.ts +12 -0
- package/dist/next/useListViewParam.d.ts.map +1 -0
- package/dist/next/useListViewParam.js +45 -0
- package/dist/next/useListViewParam.js.map +1 -0
- package/dist/next/useNextDrawerUrlAdapter.d.ts +11 -0
- package/dist/next/useNextDrawerUrlAdapter.d.ts.map +1 -0
- package/dist/next/useNextDrawerUrlAdapter.js +28 -0
- package/dist/next/useNextDrawerUrlAdapter.js.map +1 -0
- package/dist/next/useNextUrlStateAdapter.d.ts +20 -0
- package/dist/next/useNextUrlStateAdapter.d.ts.map +1 -0
- package/dist/next/useNextUrlStateAdapter.js +28 -0
- package/dist/next/useNextUrlStateAdapter.js.map +1 -0
- package/dist/notify-sonner/Toaster.d.ts +8 -0
- package/dist/notify-sonner/Toaster.d.ts.map +1 -0
- package/dist/notify-sonner/Toaster.js +24 -0
- package/dist/notify-sonner/Toaster.js.map +1 -0
- package/dist/notify-sonner/index.d.ts +1 -0
- package/dist/notify-sonner/index.d.ts.map +1 -1
- package/dist/notify-sonner/index.js +2 -0
- package/dist/notify-sonner/index.js.map +1 -1
- package/dist/notify-sonner/sonnerNotifications.d.ts +1 -1
- package/dist/notify-sonner/sonnerNotifications.d.ts.map +1 -1
- package/dist/notify-sonner/sonnerNotifications.js +23 -6
- package/dist/notify-sonner/sonnerNotifications.js.map +1 -1
- package/dist/page/DefinitionList.d.ts +24 -0
- package/dist/page/DefinitionList.d.ts.map +1 -0
- package/dist/page/DefinitionList.js +20 -0
- package/dist/page/DefinitionList.js.map +1 -0
- package/dist/page/DetailHeader.d.ts +26 -0
- package/dist/page/DetailHeader.d.ts.map +1 -0
- package/dist/page/DetailHeader.js +14 -0
- package/dist/page/DetailHeader.js.map +1 -0
- package/dist/page/EditableCard.d.ts +39 -0
- package/dist/page/EditableCard.d.ts.map +1 -0
- package/dist/page/EditableCard.js +21 -0
- package/dist/page/EditableCard.js.map +1 -0
- package/dist/page/EntityDetailShell.d.ts +48 -0
- package/dist/page/EntityDetailShell.d.ts.map +1 -0
- package/dist/page/EntityDetailShell.js +25 -0
- package/dist/page/EntityDetailShell.js.map +1 -0
- package/dist/page/EntityListPage.d.ts +30 -0
- package/dist/page/EntityListPage.d.ts.map +1 -0
- package/dist/page/EntityListPage.js +12 -0
- package/dist/page/EntityListPage.js.map +1 -0
- package/dist/page/EntityMetadata.d.ts +21 -0
- package/dist/page/EntityMetadata.d.ts.map +1 -0
- package/dist/page/EntityMetadata.js +39 -0
- package/dist/page/EntityMetadata.js.map +1 -0
- package/dist/page/EntityTabs.d.ts +38 -0
- package/dist/page/EntityTabs.d.ts.map +1 -0
- package/dist/page/EntityTabs.js +51 -0
- package/dist/page/EntityTabs.js.map +1 -0
- package/dist/page/PageFrame.d.ts +18 -2
- package/dist/page/PageFrame.d.ts.map +1 -1
- package/dist/page/PageFrame.js +8 -2
- package/dist/page/PageFrame.js.map +1 -1
- package/dist/page/PageHeader.d.ts +27 -0
- package/dist/page/PageHeader.d.ts.map +1 -0
- package/dist/page/PageHeader.js +16 -0
- package/dist/page/PageHeader.js.map +1 -0
- package/dist/page/PageLayout.d.ts +15 -0
- package/dist/page/PageLayout.d.ts.map +1 -0
- package/dist/page/PageLayout.js +10 -0
- package/dist/page/PageLayout.js.map +1 -0
- package/dist/page/PageToolbar.d.ts +73 -0
- package/dist/page/PageToolbar.d.ts.map +1 -0
- package/dist/page/PageToolbar.js +49 -0
- package/dist/page/PageToolbar.js.map +1 -0
- package/dist/page/SectionHeader.d.ts +27 -0
- package/dist/page/SectionHeader.d.ts.map +1 -0
- package/dist/page/SectionHeader.js +14 -0
- package/dist/page/SectionHeader.js.map +1 -0
- package/dist/page/StatusCallout.d.ts +28 -0
- package/dist/page/StatusCallout.d.ts.map +1 -0
- package/dist/page/StatusCallout.js +35 -0
- package/dist/page/StatusCallout.js.map +1 -0
- package/dist/page/index.d.ts +28 -1
- package/dist/page/index.d.ts.map +1 -1
- package/dist/page/index.js +18 -0
- package/dist/page/index.js.map +1 -1
- package/dist/page/links.d.ts +18 -0
- package/dist/page/links.d.ts.map +1 -0
- package/dist/page/links.js +4 -0
- package/dist/page/links.js.map +1 -0
- package/dist/primitives/alert.d.ts +17 -0
- package/dist/primitives/alert.d.ts.map +1 -0
- package/dist/primitives/alert.js +36 -0
- package/dist/primitives/alert.js.map +1 -0
- package/dist/primitives/badge.d.ts +10 -0
- package/dist/primitives/badge.d.ts.map +1 -0
- package/dist/primitives/badge.js +30 -0
- package/dist/primitives/badge.js.map +1 -0
- package/dist/primitives/breadcrumb.d.ts +12 -0
- package/dist/primitives/breadcrumb.d.ts.map +1 -0
- package/dist/primitives/breadcrumb.js +33 -0
- package/dist/primitives/breadcrumb.js.map +1 -0
- package/dist/primitives/button.d.ts +10 -8
- package/dist/primitives/button.d.ts.map +1 -1
- package/dist/primitives/button.js +41 -10
- package/dist/primitives/button.js.map +1 -1
- package/dist/primitives/card.d.ts +10 -0
- package/dist/primitives/card.d.ts.map +1 -0
- package/dist/primitives/card.js +29 -0
- package/dist/primitives/card.js.map +1 -0
- package/dist/primitives/checkbox.d.ts +5 -0
- package/dist/primitives/checkbox.d.ts.map +1 -0
- package/dist/primitives/checkbox.js +11 -0
- package/dist/primitives/checkbox.js.map +1 -0
- package/dist/primitives/cn.d.ts +1 -1
- package/dist/primitives/cn.d.ts.map +1 -1
- package/dist/primitives/cn.js +1 -1
- package/dist/primitives/cn.js.map +1 -1
- package/dist/primitives/collapsible.d.ts +6 -0
- package/dist/primitives/collapsible.d.ts.map +1 -0
- package/dist/primitives/collapsible.js +14 -0
- package/dist/primitives/collapsible.js.map +1 -0
- package/dist/primitives/command.d.ts +19 -0
- package/dist/primitives/command.d.ts.map +1 -0
- package/dist/primitives/command.js +38 -0
- package/dist/primitives/command.js.map +1 -0
- package/dist/primitives/dialog.d.ts +17 -9
- package/dist/primitives/dialog.d.ts.map +1 -1
- package/dist/primitives/dialog.js +39 -14
- package/dist/primitives/dialog.js.map +1 -1
- package/dist/primitives/dropdown-menu.d.ts +23 -0
- package/dist/primitives/dropdown-menu.d.ts.map +1 -0
- package/dist/primitives/dropdown-menu.js +48 -0
- package/dist/primitives/dropdown-menu.js.map +1 -0
- package/dist/primitives/fieldSurface.d.ts +23 -0
- package/dist/primitives/fieldSurface.d.ts.map +1 -0
- package/dist/primitives/fieldSurface.js +23 -0
- package/dist/primitives/fieldSurface.js.map +1 -0
- package/dist/primitives/index.d.ts +24 -5
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +25 -5
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/input.d.ts +12 -0
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +20 -0
- package/dist/primitives/input.js.map +1 -0
- package/dist/primitives/label.d.ts +5 -0
- package/dist/primitives/label.d.ts.map +1 -0
- package/dist/primitives/label.js +10 -0
- package/dist/primitives/label.js.map +1 -0
- package/dist/primitives/listSurface.d.ts +8 -0
- package/dist/primitives/listSurface.d.ts.map +1 -0
- package/dist/primitives/listSurface.js +8 -0
- package/dist/primitives/listSurface.js.map +1 -0
- package/dist/primitives/popover.d.ts +11 -0
- package/dist/primitives/popover.d.ts.map +1 -0
- package/dist/primitives/popover.js +31 -0
- package/dist/primitives/popover.js.map +1 -0
- package/dist/primitives/portal.d.ts +16 -0
- package/dist/primitives/portal.d.ts.map +1 -0
- package/dist/primitives/portal.js +9 -0
- package/dist/primitives/portal.js.map +1 -0
- package/dist/primitives/select.d.ts +20 -8
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +46 -12
- package/dist/primitives/select.js.map +1 -1
- package/dist/primitives/separator.d.ts +5 -0
- package/dist/primitives/separator.d.ts.map +1 -0
- package/dist/primitives/separator.js +10 -0
- package/dist/primitives/separator.js.map +1 -0
- package/dist/primitives/sheet.d.ts +14 -8
- package/dist/primitives/sheet.d.ts.map +1 -1
- package/dist/primitives/sheet.js +42 -11
- package/dist/primitives/sheet.js.map +1 -1
- package/dist/primitives/skeleton.d.ts +3 -0
- package/dist/primitives/skeleton.d.ts.map +1 -0
- package/dist/primitives/skeleton.js +7 -0
- package/dist/primitives/skeleton.js.map +1 -0
- package/dist/primitives/switch.d.ts +7 -0
- package/dist/primitives/switch.d.ts.map +1 -0
- package/dist/primitives/switch.js +10 -0
- package/dist/primitives/switch.js.map +1 -0
- package/dist/primitives/table.d.ts +11 -0
- package/dist/primitives/table.d.ts.map +1 -0
- package/dist/primitives/table.js +30 -0
- package/dist/primitives/table.js.map +1 -0
- package/dist/primitives/textarea.d.ts +4 -0
- package/dist/primitives/textarea.d.ts.map +1 -0
- package/dist/primitives/textarea.js +11 -0
- package/dist/primitives/textarea.js.map +1 -0
- package/dist/primitives/tooltip.d.ts +8 -0
- package/dist/primitives/tooltip.d.ts.map +1 -0
- package/dist/primitives/tooltip.js +21 -0
- package/dist/primitives/tooltip.js.map +1 -0
- package/dist/provider/AdminUiProvider.d.ts +8 -6
- package/dist/provider/AdminUiProvider.d.ts.map +1 -1
- package/dist/provider/AdminUiProvider.js +37 -22
- package/dist/provider/AdminUiProvider.js.map +1 -1
- package/dist/provider/adminUiContext.d.ts +6 -0
- package/dist/provider/adminUiContext.d.ts.map +1 -0
- package/dist/provider/adminUiContext.js +9 -0
- package/dist/provider/adminUiContext.js.map +1 -0
- package/dist/provider/index.d.ts +4 -2
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +4 -1
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/storageKey.d.ts +4 -0
- package/dist/provider/storageKey.d.ts.map +1 -0
- package/dist/provider/storageKey.js +3 -0
- package/dist/provider/storageKey.js.map +1 -0
- package/dist/provider/types.d.ts +38 -6
- package/dist/provider/types.d.ts.map +1 -1
- package/dist/scripts/build-i18n-manifest.mjs +138 -0
- package/dist/scripts/check-radix.mjs +131 -0
- package/dist/scripts/check-tokens.mjs +236 -0
- package/dist/theme.css +15 -11
- package/dist/tokens.json +388 -53
- package/dist/translations/FormTranslatableFields.d.ts +30 -0
- package/dist/translations/FormTranslatableFields.d.ts.map +1 -0
- package/dist/translations/FormTranslatableFields.js +58 -0
- package/dist/translations/FormTranslatableFields.js.map +1 -0
- package/dist/translations/TranslatableField.d.ts +48 -0
- package/dist/translations/TranslatableField.d.ts.map +1 -0
- package/dist/translations/TranslatableField.js +44 -0
- package/dist/translations/TranslatableField.js.map +1 -0
- package/dist/translations/TranslatableInput.d.ts +14 -0
- package/dist/translations/TranslatableInput.d.ts.map +1 -0
- package/dist/translations/TranslatableInput.js +15 -0
- package/dist/translations/TranslatableInput.js.map +1 -0
- package/dist/translations/TranslatableMarkdown.d.ts +21 -0
- package/dist/translations/TranslatableMarkdown.d.ts.map +1 -0
- package/dist/translations/TranslatableMarkdown.js +12 -0
- package/dist/translations/TranslatableMarkdown.js.map +1 -0
- package/dist/translations/TranslationControls.d.ts +22 -0
- package/dist/translations/TranslationControls.d.ts.map +1 -0
- package/dist/translations/TranslationControls.js +31 -0
- package/dist/translations/TranslationControls.js.map +1 -0
- package/dist/translations/index.d.ts +30 -1
- package/dist/translations/index.d.ts.map +1 -1
- package/dist/translations/index.js +17 -1
- package/dist/translations/index.js.map +1 -1
- package/package.json +27 -29
- package/dist/data/StatTile.d.ts +0 -8
- package/dist/data/StatTile.d.ts.map +0 -1
- package/dist/data/StatTile.js +0 -6
- package/dist/data/StatTile.js.map +0 -1
- package/dist/data/index.d.ts +0 -2
- package/dist/data/index.d.ts.map +0 -1
- package/dist/data/index.js +0 -2
- package/dist/data/index.js.map +0 -1
- package/dist/glass/GlassPanel.d.ts +0 -7
- package/dist/glass/GlassPanel.d.ts.map +0 -1
- package/dist/glass/GlassPanel.js +0 -5
- package/dist/glass/GlassPanel.js.map +0 -1
- package/dist/i18n/m.d.ts +0 -7
- package/dist/i18n/m.d.ts.map +0 -1
- package/dist/i18n/m.js +0 -7
- package/dist/i18n/m.js.map +0 -1
- package/dist/list/ClearFiltersButton.d.ts +0 -7
- package/dist/list/ClearFiltersButton.d.ts.map +0 -1
- package/dist/list/ClearFiltersButton.js +0 -10
- package/dist/list/ClearFiltersButton.js.map +0 -1
- package/dist/list/DateCell.d.ts +0 -8
- package/dist/list/DateCell.d.ts.map +0 -1
- package/dist/list/DateCell.js +0 -12
- package/dist/list/DateCell.js.map +0 -1
- package/dist/logic/pure/errors.d.ts +0 -3
- package/dist/logic/pure/errors.d.ts.map +0 -1
- package/dist/logic/pure/errors.js +0 -5
- package/dist/logic/pure/errors.js.map +0 -1
- package/dist/logic/pure/statusMap.d.ts +0 -12
- package/dist/logic/pure/statusMap.d.ts.map +0 -1
- package/dist/logic/pure/statusMap.js +0 -5
- package/dist/logic/pure/statusMap.js.map +0 -1
- package/dist/logic/react/useToggle.d.ts +0 -8
- package/dist/logic/react/useToggle.d.ts.map +0 -1
- package/dist/logic/react/useToggle.js +0 -9
- package/dist/logic/react/useToggle.js.map +0 -1
- package/dist/next/useNextSearchParam.d.ts +0 -3
- package/dist/next/useNextSearchParam.d.ts.map +0 -1
- package/dist/next/useNextSearchParam.js +0 -16
- package/dist/next/useNextSearchParam.js.map +0 -1
- package/dist/primitives/portalContainer.d.ts +0 -8
- package/dist/primitives/portalContainer.d.ts.map +0 -1
- package/dist/primitives/portalContainer.js +0 -12
- package/dist/primitives/portalContainer.js.map +0 -1
- package/dist/translations/TranslatableInputField.d.ts +0 -8
- package/dist/translations/TranslatableInputField.d.ts.map +0 -1
- package/dist/translations/TranslatableInputField.js +0 -12
- package/dist/translations/TranslatableInputField.js.map +0 -1
- package/docs/README.md +0 -11
- package/scripts/check-tokens.mjs +0 -136
- package/scripts/lib/i18n-manifest.mjs +0 -91
- package/scripts/lib/source-scan.mjs +0 -258
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The package's text manifest (i18n-keys.json): every UI text of the blocks and primitives with its key, context, the
|
|
3
|
+
// translator hint from i18n/hints.json and the files that use it. A host's text export merges it instead of scanning
|
|
4
|
+
// the package.
|
|
5
|
+
//
|
|
6
|
+
// Usage: node build-i18n-manifest.mjs [--check] [--built] [--dir <package dir>]
|
|
7
|
+
// --dir the package root (default: the package this script belongs to). With a `src/` folder (the repository)
|
|
8
|
+
// the source is read and the manifest is i18n-keys.json; without one (an installed package, an extracted
|
|
9
|
+
// tarball) the built JS of dist is read and the manifest is dist/i18n-keys.json
|
|
10
|
+
// --built read the built JS of dist even when a `src/` folder exists (check-package, rule 12)
|
|
11
|
+
// --check exit 1 when the manifest on disk is missing, stale or unsorted, or a key has no hint
|
|
12
|
+
//
|
|
13
|
+
// Scan rules (the same as the host export): string literals passed to `t()`, `translateText()` and `m()` with an
|
|
14
|
+
// optional `{ context }`, and `<Translate context>…</Translate>` elements; a file containing the marker
|
|
15
|
+
// `@translations-ignore-file` is skipped; tests are skipped. Key = text, or `${text}__${context}` with a context.
|
|
16
|
+
import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
19
|
+
|
|
20
|
+
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const dirFlag = process.argv.indexOf('--dir');
|
|
22
|
+
// the shipped copy runs from dist/scripts, the repository's from scripts
|
|
23
|
+
const ownPackageDir = join(scriptDir, '..', ...(dirname(scriptDir).endsWith(`${sep}dist`) ? ['..'] : []));
|
|
24
|
+
const packageDir = resolve(dirFlag !== -1 ? process.argv[dirFlag + 1] : ownPackageDir);
|
|
25
|
+
const check = process.argv.includes('--check');
|
|
26
|
+
|
|
27
|
+
/** Order by code unit, never by locale: the manifest must come out the same on every machine. */
|
|
28
|
+
const compareKeys = (left, right) => (left < right ? -1 : left > right ? 1 : 0);
|
|
29
|
+
|
|
30
|
+
const sourceRoot = join(packageDir, 'src');
|
|
31
|
+
const sourceMode = !process.argv.includes('--built') && existsSync(join(sourceRoot, 'i18n', 'store.ts'));
|
|
32
|
+
const base = sourceMode ? packageDir : join(packageDir, 'dist');
|
|
33
|
+
const manifestPath = join(base, 'i18n-keys.json');
|
|
34
|
+
const hintsPath = join(base, 'i18n', 'hints.json');
|
|
35
|
+
const metaPath = join(packageDir, 'package.json');
|
|
36
|
+
|
|
37
|
+
const LITERAL = String.raw`'(?:[^'\\\n]|\\.)*'|"(?:[^"\\\n]|\\.)*"|\x60(?:[^\x60\\$]|\\.)*\x60`;
|
|
38
|
+
const CALL = new RegExp(String.raw`\b(?:t|translateText|m)\(\s*(${LITERAL})\s*(,\s*\{[^}]*\})?`, 'g');
|
|
39
|
+
const CONTEXT = new RegExp(String.raw`context\s*:\s*(${LITERAL})`);
|
|
40
|
+
const ELEMENT = /<Translate\b([^>]*)>([^<{}]+)<\/Translate>/g;
|
|
41
|
+
const ELEMENT_CONTEXT = /context=(?:"([^"]*)"|'([^']*)'|\{\s*['"]([^'"]*)['"]\s*\})/;
|
|
42
|
+
const IGNORE_MARKER = '@translations-ignore-file';
|
|
43
|
+
|
|
44
|
+
const unquote = literal =>
|
|
45
|
+
literal
|
|
46
|
+
.slice(1, -1)
|
|
47
|
+
.replace(/\\n/g, '\n')
|
|
48
|
+
.replace(/\\(.)/g, '$1');
|
|
49
|
+
|
|
50
|
+
const walk = dir =>
|
|
51
|
+
readdirSync(dir).flatMap(name => {
|
|
52
|
+
const path = join(dir, name);
|
|
53
|
+
if (statSync(path).isDirectory()) return name === 'node_modules' || name === 'scripts' || (sourceMode && name === 'dist') ? [] : walk(path);
|
|
54
|
+
return [path];
|
|
55
|
+
});
|
|
56
|
+
const toPosix = path => path.split(sep).join('/');
|
|
57
|
+
|
|
58
|
+
/** Source files with the path the manifest names (source-relative, e.g. `list/EntityListToolbar.tsx`). */
|
|
59
|
+
const sourceFiles = () => {
|
|
60
|
+
if (sourceMode) {
|
|
61
|
+
return walk(sourceRoot)
|
|
62
|
+
.filter(path => /\.(ts|tsx)$/.test(path) && !/\.test\.tsx?$/.test(path) && !path.endsWith('.d.ts'))
|
|
63
|
+
.map(path => ({ path, name: toPosix(relative(sourceRoot, path)) }));
|
|
64
|
+
}
|
|
65
|
+
// built JS keeps the calls and the comments; the path is the dist path with the source's extension (`.ts` or
|
|
66
|
+
// `.tsx`, read from the file's source map)
|
|
67
|
+
const distRoot = join(packageDir, 'dist');
|
|
68
|
+
return walk(distRoot)
|
|
69
|
+
.filter(path => path.endsWith('.js') && !/\.test\.js$/.test(path))
|
|
70
|
+
.map(path => {
|
|
71
|
+
const mapPath = `${path}.map`;
|
|
72
|
+
const map = existsSync(mapPath) ? JSON.parse(readFileSync(mapPath, 'utf8')) : null;
|
|
73
|
+
const extension = /\.tsx?$/.exec(map?.sources?.[0] ?? '')?.[0] ?? '.js';
|
|
74
|
+
return { path, name: toPosix(relative(distRoot, path)).replace(/\.js$/, extension) };
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const scan = ({ path, name }) => {
|
|
79
|
+
const source = readFileSync(path, 'utf8');
|
|
80
|
+
if (source.includes(IGNORE_MARKER)) return [];
|
|
81
|
+
const usages = [];
|
|
82
|
+
for (const match of source.matchAll(CALL)) {
|
|
83
|
+
const context = match[2] ? CONTEXT.exec(match[2]) : null;
|
|
84
|
+
usages.push({ text: unquote(match[1]), context: context ? unquote(context[1]) : undefined, file: name });
|
|
85
|
+
}
|
|
86
|
+
for (const match of source.matchAll(ELEMENT)) {
|
|
87
|
+
const context = ELEMENT_CONTEXT.exec(match[1]);
|
|
88
|
+
const text = match[2].replace(/\s+/g, ' ').trim();
|
|
89
|
+
if (text) usages.push({ text, context: context ? (context[1] ?? context[2] ?? context[3]) : undefined, file: name });
|
|
90
|
+
}
|
|
91
|
+
return usages;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const build = () => {
|
|
95
|
+
const hints = existsSync(hintsPath) ? JSON.parse(readFileSync(hintsPath, 'utf8')) : {};
|
|
96
|
+
const meta = JSON.parse(readFileSync(metaPath, 'utf8'));
|
|
97
|
+
const byKey = new Map();
|
|
98
|
+
for (const usage of sourceFiles().flatMap(scan)) {
|
|
99
|
+
const key = usage.context ? `${usage.text}__${usage.context}` : usage.text;
|
|
100
|
+
const entry = byKey.get(key) ?? { key, text: usage.text, ...(usage.context ? { context: usage.context } : {}), files: new Set() };
|
|
101
|
+
entry.files.add(usage.file);
|
|
102
|
+
byKey.set(key, entry);
|
|
103
|
+
}
|
|
104
|
+
const keys = [...byKey.values()]
|
|
105
|
+
.sort((left, right) => compareKeys(left.key, right.key))
|
|
106
|
+
.map(entry => ({ ...entry, hint: hints[entry.key] ?? '', files: [...entry.files].sort() }));
|
|
107
|
+
const missingHints = keys.filter(entry => entry.hint.trim() === '').map(entry => entry.key);
|
|
108
|
+
const unusedHints = Object.keys(hints).filter(key => !byKey.has(key));
|
|
109
|
+
return {
|
|
110
|
+
manifest: { package: meta.name, version: meta.version, generatedBy: 'scripts/build-i18n-manifest.mjs', keys },
|
|
111
|
+
missingHints,
|
|
112
|
+
unusedHints,
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const serialise = manifest => `${JSON.stringify(manifest, null, 2)}\n`;
|
|
117
|
+
const { manifest, missingHints, unusedHints } = build();
|
|
118
|
+
const summary = `${manifest.keys.length} keys, ${missingHints.length} without a hint, ${unusedHints.length} hints without a usage`;
|
|
119
|
+
|
|
120
|
+
if (check) {
|
|
121
|
+
const problems = [];
|
|
122
|
+
if (!existsSync(manifestPath)) problems.push(`${toPosix(relative(packageDir, manifestPath))} missing`);
|
|
123
|
+
else {
|
|
124
|
+
const current = readFileSync(manifestPath, 'utf8');
|
|
125
|
+
const keys = JSON.parse(current).keys ?? [];
|
|
126
|
+
if (keys.some((entry, index) => index > 0 && compareKeys(keys[index - 1].key, entry.key) > 0)) problems.push('not sorted by key');
|
|
127
|
+
if (current !== serialise(manifest)) problems.push('stale: differs from a fresh run');
|
|
128
|
+
}
|
|
129
|
+
for (const key of missingHints) problems.push(`no hint: ${JSON.stringify(key)}`);
|
|
130
|
+
if (problems.length > 0) {
|
|
131
|
+
console.log(`build-i18n-manifest: ${problems.join('; ')} (${summary})`);
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
console.log(`build-i18n-manifest: ok (${summary}; ${sourceMode ? 'source' : 'built JS'})`);
|
|
135
|
+
} else {
|
|
136
|
+
writeFileSync(manifestPath, serialise(manifest));
|
|
137
|
+
console.log(`build-i18n-manifest: wrote ${toPosix(relative(packageDir, manifestPath))} (${summary})`);
|
|
138
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Checks that a host installs every Radix package once. Radix keeps its focus traps, outside-click layers and portals
|
|
3
|
+
// in module state: two copies of one package (an overlay from `radix-ui` and another from a single `@radix-ui/*`
|
|
4
|
+
// package or from a dependency such as `cmdk`) do not see each other, so one overlay's focus trap does not pause for
|
|
5
|
+
// the other's, and an outside click closes the wrong one.
|
|
6
|
+
//
|
|
7
|
+
// Usage: node check-radix.mjs [host directory] (default: the working directory)
|
|
8
|
+
// Reads the node_modules folders of the host directory and of every folder above it (where the host resolves
|
|
9
|
+
// packages from), in the npm layout (nested node_modules) and the pnpm layout (node_modules/.pnpm).
|
|
10
|
+
// Exit 0 when every `radix-ui` / `@radix-ui/*` package is installed once; exit 1 with one line per package installed
|
|
11
|
+
// more than once — in two versions, or in one version twice (two pnpm peer variants, a nested npm copy) — with where
|
|
12
|
+
// each copy sits; exit 2 on bad arguments.
|
|
13
|
+
|
|
14
|
+
import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
15
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
16
|
+
|
|
17
|
+
const hostArg = process.argv[2];
|
|
18
|
+
const host = resolve(hostArg ?? '.');
|
|
19
|
+
if (!existsSync(host) || !statSync(host).isDirectory()) {
|
|
20
|
+
console.error(`usage: node check-radix.mjs [host directory] (not a directory: ${host})`);
|
|
21
|
+
process.exit(2);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** name → version → set of install folders (real paths) */
|
|
25
|
+
const installs = new Map();
|
|
26
|
+
const visited = new Set();
|
|
27
|
+
|
|
28
|
+
const listDir = path => {
|
|
29
|
+
try {
|
|
30
|
+
return readdirSync(path, { withFileTypes: true });
|
|
31
|
+
} catch {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const isDirectory = path => {
|
|
37
|
+
try {
|
|
38
|
+
return statSync(path).isDirectory();
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const record = (name, packageDir) => {
|
|
45
|
+
const manifestPath = join(packageDir, 'package.json');
|
|
46
|
+
if (!existsSync(manifestPath)) return;
|
|
47
|
+
const real = realpathSync(packageDir);
|
|
48
|
+
const { version } = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
49
|
+
if (typeof version !== 'string') return;
|
|
50
|
+
const versions = installs.get(name) ?? new Map();
|
|
51
|
+
const folders = versions.get(version) ?? new Set();
|
|
52
|
+
folders.add(real);
|
|
53
|
+
versions.set(version, folders);
|
|
54
|
+
installs.set(name, versions);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** One node_modules folder: Radix packages are recorded, every other package's own node_modules is read in turn. */
|
|
58
|
+
const walk = nodeModules => {
|
|
59
|
+
if (!isDirectory(nodeModules)) return;
|
|
60
|
+
const real = realpathSync(nodeModules);
|
|
61
|
+
if (visited.has(real)) return;
|
|
62
|
+
visited.add(real);
|
|
63
|
+
for (const entry of listDir(nodeModules)) {
|
|
64
|
+
const path = join(nodeModules, entry.name);
|
|
65
|
+
if (entry.name === '.pnpm') {
|
|
66
|
+
for (const store of listDir(path)) walk(join(path, store.name, 'node_modules'));
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (entry.name.startsWith('.')) continue;
|
|
70
|
+
if (entry.name.startsWith('@')) {
|
|
71
|
+
for (const scoped of listDir(path)) {
|
|
72
|
+
const packageDir = join(path, scoped.name);
|
|
73
|
+
if (entry.name === '@radix-ui') record(`@radix-ui/${scoped.name}`, packageDir);
|
|
74
|
+
walk(join(packageDir, 'node_modules'));
|
|
75
|
+
}
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (entry.name === 'radix-ui') record('radix-ui', path);
|
|
79
|
+
walk(join(path, 'node_modules'));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
for (let folder = host; ; folder = dirname(folder)) {
|
|
84
|
+
walk(join(folder, 'node_modules'));
|
|
85
|
+
if (dirname(folder) === folder) break;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Numeric version order (`1.1.3` before `1.1.11`); pre-release suffixes compare as text. */
|
|
89
|
+
const byVersion = (a, b) => {
|
|
90
|
+
const left = a.split(/[.-]/);
|
|
91
|
+
const right = b.split(/[.-]/);
|
|
92
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
93
|
+
const x = left[index] ?? '';
|
|
94
|
+
const y = right[index] ?? '';
|
|
95
|
+
if (x === y) continue;
|
|
96
|
+
const numeric = /^\d+$/.test(x) && /^\d+$/.test(y);
|
|
97
|
+
return numeric ? Number(x) - Number(y) : x < y ? -1 : 1;
|
|
98
|
+
}
|
|
99
|
+
return 0;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** Install folders shown per version; the rest is counted. */
|
|
103
|
+
const SHOWN_FOLDERS = 3;
|
|
104
|
+
|
|
105
|
+
const where = folder => {
|
|
106
|
+
const path = relative(host, folder);
|
|
107
|
+
return path.startsWith('..') ? folder : path;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const copies = versions => [...versions.values()].reduce((count, folders) => count + folders.size, 0);
|
|
111
|
+
const duplicates = [...installs.entries()].filter(([, versions]) => copies(versions) > 1).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
112
|
+
const packages = installs.size;
|
|
113
|
+
if (packages === 0) {
|
|
114
|
+
console.log(`check-radix: no radix-ui or @radix-ui/* package found from ${host}`);
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
117
|
+
if (duplicates.length > 0) {
|
|
118
|
+
console.log(`check-radix: ${duplicates.length} Radix package(s) installed more than once (${packages} checked)`);
|
|
119
|
+
for (const [name, versions] of duplicates) {
|
|
120
|
+
const ordered = [...versions.keys()].sort(byVersion);
|
|
121
|
+
console.log(` duplicate: ${name} ${ordered.join(', ')} (${copies(versions)} copies)`);
|
|
122
|
+
for (const version of ordered) {
|
|
123
|
+
const folders = [...versions.get(version)].map(where).sort();
|
|
124
|
+
for (const folder of folders.slice(0, SHOWN_FOLDERS)) console.log(` ${version} ${folder}`);
|
|
125
|
+
if (folders.length > SHOWN_FOLDERS) console.log(` ${version} … ${folders.length - SHOWN_FOLDERS} more`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
console.log(' fix: align the single @radix-ui/* packages (and overrides for dependencies) to the versions radix-ui pins');
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
console.log(`check-radix: ok (${packages} Radix packages, one copy each)`);
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Checks a host's built stylesheet against tokens.json: every colour role's utilities exist, every required custom
|
|
3
|
+
// property is declared on :root (and on .dark when themed), declared colour values fit how the stylesheet uses them,
|
|
4
|
+
// the layer defaults of components.css are present, and the data attributes components.css reads appear in its rules.
|
|
5
|
+
//
|
|
6
|
+
// Colour values follow use: a role property read only inside a channel function (`hsl(var(--card))`,
|
|
7
|
+
// `rgb(var(--x) / 0.5)`, `oklch(…)`) may hold channels (`0 0% 100%`); a property read anywhere else (a plain
|
|
8
|
+
// `background-color: var(--card)`, inside `color-mix()` or `light-dark()`, which take whole colours) must hold a colour.
|
|
9
|
+
// A custom property that passes another one on (`--surface: var(--card)`) takes the uses of the receiving property.
|
|
10
|
+
// A role property that nothing reads is held to the strict rule.
|
|
11
|
+
//
|
|
12
|
+
// Usage: node check-tokens.mjs <built.css | directory of .css files> [tokens.json]
|
|
13
|
+
// Exit 0 when everything is provided; exit 1 with one line per missing item otherwise; exit 2 on bad arguments.
|
|
14
|
+
//
|
|
15
|
+
// The parser is a small tolerant one (no dependency): it strips comments, honours strings and nested blocks, and reads
|
|
16
|
+
// selectors and declarations of style rules at any depth (@layer, @media, @supports). Limits: it does not evaluate
|
|
17
|
+
// `var()`, cascade order or media conditions; a property counts as declared when any rule for the scope declares it;
|
|
18
|
+
// a colour value passes as a hex colour, a colour function (rgb, hsl, hwb, lab, lch, oklab, oklch, color, color-mix,
|
|
19
|
+
// light-dark), a `var()` reference or a single keyword (named colours are not checked against the CSS list).
|
|
20
|
+
|
|
21
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
22
|
+
import { dirname, join, resolve } from 'node:path';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
|
|
25
|
+
const [cssArg, tokensArg] = process.argv.slice(2);
|
|
26
|
+
if (!cssArg) {
|
|
27
|
+
console.error('usage: node check-tokens.mjs <built.css | directory of .css files> [tokens.json]');
|
|
28
|
+
process.exit(2);
|
|
29
|
+
}
|
|
30
|
+
const tokensPath = resolve(tokensArg ?? join(dirname(fileURLToPath(import.meta.url)), '..', 'tokens.json'));
|
|
31
|
+
const cssPath = resolve(cssArg);
|
|
32
|
+
if (!existsSync(cssPath) || !existsSync(tokensPath)) {
|
|
33
|
+
console.error(`not found: ${existsSync(cssPath) ? tokensPath : cssPath}`);
|
|
34
|
+
process.exit(2);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const cssFiles = statSync(cssPath).isDirectory()
|
|
38
|
+
? readdirSync(cssPath)
|
|
39
|
+
.filter(name => name.endsWith('.css'))
|
|
40
|
+
.map(name => join(cssPath, name))
|
|
41
|
+
: [cssPath];
|
|
42
|
+
const tokens = JSON.parse(readFileSync(tokensPath, 'utf8'));
|
|
43
|
+
|
|
44
|
+
/** Style rules as `{ selector, declarations: Map<property, value> }`, at any nesting depth. */
|
|
45
|
+
const parseRules = source => {
|
|
46
|
+
const text = source.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
47
|
+
const rules = [];
|
|
48
|
+
const stack = [];
|
|
49
|
+
let buffer = '';
|
|
50
|
+
let quote = null;
|
|
51
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
52
|
+
const char = text[index];
|
|
53
|
+
if (quote) {
|
|
54
|
+
buffer += char;
|
|
55
|
+
if (char === '\\') {
|
|
56
|
+
buffer += text[index + 1] ?? '';
|
|
57
|
+
index += 1;
|
|
58
|
+
} else if (char === quote) quote = null;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (char === '\\') {
|
|
62
|
+
// an escaped character in a selector (`.content-\[\'x\'\]`, `.w-1\/2`): never a quote or a brace
|
|
63
|
+
buffer += char + (text[index + 1] ?? '');
|
|
64
|
+
index += 1;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (char === '"' || char === "'") {
|
|
68
|
+
quote = char;
|
|
69
|
+
buffer += char;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (char === '{') {
|
|
73
|
+
const prelude = buffer.trim();
|
|
74
|
+
buffer = '';
|
|
75
|
+
const rule = prelude.startsWith('@') ? null : { selector: prelude, declarations: new Map() };
|
|
76
|
+
if (rule) rules.push(rule);
|
|
77
|
+
stack.push(rule);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (char === ';' || char === '}') {
|
|
81
|
+
const current = stack[stack.length - 1];
|
|
82
|
+
const chunk = buffer.trim();
|
|
83
|
+
buffer = '';
|
|
84
|
+
if (current && chunk.includes(':')) {
|
|
85
|
+
const colon = chunk.indexOf(':');
|
|
86
|
+
current.declarations.set(chunk.slice(0, colon).trim(), chunk.slice(colon + 1).trim());
|
|
87
|
+
}
|
|
88
|
+
if (char === '}') stack.pop();
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
buffer += char;
|
|
92
|
+
}
|
|
93
|
+
return rules;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const rules = cssFiles.flatMap(file => parseRules(readFileSync(file, 'utf8')));
|
|
97
|
+
|
|
98
|
+
/** Every class name in the selectors, unescaped (`hover\:bg-card\/90` → `hover:bg-card/90`). */
|
|
99
|
+
const classNames = new Set();
|
|
100
|
+
for (const rule of rules) {
|
|
101
|
+
for (const match of rule.selector.matchAll(/\.((?:\\.|[A-Za-z0-9_-])+)/g)) {
|
|
102
|
+
classNames.add(match[1].replace(/\\(.)/g, '$1'));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** A utility is provided when it exists bare or under any variant (`hover:bg-tint`, `dark:bg-input/30`). */
|
|
106
|
+
const hasUtility = utility => {
|
|
107
|
+
if (classNames.has(utility)) return true;
|
|
108
|
+
for (const name of classNames) if (name.endsWith(`:${utility}`)) return true;
|
|
109
|
+
return false;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const selectorParts = rule => rule.selector.split(',').map(part => part.trim());
|
|
113
|
+
const isRootSelector = part => /^(:root|html|:host|:where\(:root\))$/.test(part);
|
|
114
|
+
const isDarkSelector = part => /^(:root|html)?\.dark$/.test(part);
|
|
115
|
+
const declaredIn = (property, predicate) =>
|
|
116
|
+
rules.some(rule => rule.declarations.has(property) && selectorParts(rule).some(predicate));
|
|
117
|
+
|
|
118
|
+
const missing = [];
|
|
119
|
+
|
|
120
|
+
for (const [role, definition] of Object.entries(tokens.colors ?? {})) {
|
|
121
|
+
const absent = (definition.utilities ?? []).filter(utility => !hasUtility(utility));
|
|
122
|
+
if (absent.length > 0) missing.push(`colour role "${role}": no rule for ${absent.join(', ')}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
for (const [property, definition] of Object.entries(tokens.properties ?? {})) {
|
|
126
|
+
if (definition.required === false) continue;
|
|
127
|
+
if (!declaredIn(property, isRootSelector)) missing.push(`property ${property}: not declared on :root`);
|
|
128
|
+
if (definition.themed && !declaredIn(property, isDarkSelector)) {
|
|
129
|
+
missing.push(`property ${property}: themed, but not declared on .dark`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Functions whose arguments are colour channels, so `fn(var(--x))` needs channels in `--x`, not a colour. */
|
|
134
|
+
const CHANNEL_FUNCTIONS = new Set(['rgb', 'rgba', 'hsl', 'hsla', 'hwb', 'lab', 'lch', 'oklab', 'oklch', 'color']);
|
|
135
|
+
|
|
136
|
+
/** Every `var(--name…)` in a value, with the innermost enclosing function other than `var` (`null` at top level). */
|
|
137
|
+
const varReads = value => {
|
|
138
|
+
const reads = [];
|
|
139
|
+
const stack = [];
|
|
140
|
+
const pattern = /([A-Za-z-]*)\(|\)/g;
|
|
141
|
+
let match = pattern.exec(value);
|
|
142
|
+
while (match !== null) {
|
|
143
|
+
if (match[0] === ')') stack.pop();
|
|
144
|
+
else {
|
|
145
|
+
const name = match[1].toLowerCase();
|
|
146
|
+
if (name === 'var') {
|
|
147
|
+
const property = /^\s*(--[A-Za-z0-9_-]+)/.exec(value.slice(pattern.lastIndex));
|
|
148
|
+
const outer = stack.filter(item => item !== 'var');
|
|
149
|
+
if (property) reads.push({ property: property[1], within: outer.length > 0 ? outer[outer.length - 1] : null });
|
|
150
|
+
}
|
|
151
|
+
stack.push(name);
|
|
152
|
+
}
|
|
153
|
+
match = pattern.exec(value);
|
|
154
|
+
}
|
|
155
|
+
return reads;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/** Per custom property: where it is read, as `{ declaredOn, within, selector }`. */
|
|
159
|
+
const readsOf = new Map();
|
|
160
|
+
for (const rule of rules) {
|
|
161
|
+
for (const [declaredOn, value] of rule.declarations) {
|
|
162
|
+
for (const read of varReads(value)) {
|
|
163
|
+
const list = readsOf.get(read.property) ?? [];
|
|
164
|
+
list.push({ declaredOn, within: read.within, selector: rule.selector });
|
|
165
|
+
readsOf.set(read.property, list);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The first read of `property` that needs a whole colour (`null` when every read is inside a channel function), as
|
|
172
|
+
* text for the report. A read passed on to another custom property counts as that property's reads.
|
|
173
|
+
*/
|
|
174
|
+
const colourRead = (property, seen = new Set()) => {
|
|
175
|
+
if (seen.has(property)) return null;
|
|
176
|
+
seen.add(property);
|
|
177
|
+
const reads = readsOf.get(property) ?? [];
|
|
178
|
+
if (reads.length === 0) return 'read nowhere';
|
|
179
|
+
for (const read of reads) {
|
|
180
|
+
if (read.within !== null && CHANNEL_FUNCTIONS.has(read.within)) continue;
|
|
181
|
+
if (read.within === null && read.declaredOn.startsWith('--')) {
|
|
182
|
+
const onward = colourRead(read.declaredOn, seen);
|
|
183
|
+
if (onward !== null && onward !== 'read nowhere') return `passed to ${read.declaredOn}, ${onward}`;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
return `read as ${read.declaredOn}: ${read.within ? `${read.within}(var(${property}))` : `var(${property})`} in "${read.selector}"`;
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/** Channels of a colour function: numbers, percentages, angles, `none`, separated by spaces, commas or `/`. */
|
|
192
|
+
const isChannelValue = value =>
|
|
193
|
+
/^(?:[+-]?(?:\d+\.?\d*|\.\d+)(?:%|deg|rad|grad|turn)?|none)(?:\s*[\s,/]\s*(?:[+-]?(?:\d+\.?\d*|\.\d+)(?:%|deg|rad|grad|turn)?|none))*$/i.test(
|
|
194
|
+
value.replace(/\s*!important\s*$/, '').trim()
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
/** Does a declared value read as a colour? (see the limits above) */
|
|
198
|
+
const isColourValue = value => {
|
|
199
|
+
const trimmed = value.replace(/\s*!important\s*$/, '').trim();
|
|
200
|
+
if (/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(trimmed)) return true;
|
|
201
|
+
if (/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark|var)\(.*\)$/i.test(trimmed)) return true;
|
|
202
|
+
return /^[a-z]+$/i.test(trimmed);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
for (const role of Object.keys(tokens.colors ?? {})) {
|
|
206
|
+
for (const property of [`--${role}`, `--color-${role}`]) {
|
|
207
|
+
for (const rule of rules) {
|
|
208
|
+
const value = rule.declarations.get(property);
|
|
209
|
+
if (value === undefined || isColourValue(value)) continue;
|
|
210
|
+
const needsColour = colourRead(property);
|
|
211
|
+
if (needsColour === null && isChannelValue(value)) continue;
|
|
212
|
+
const why = needsColour === null ? 'neither a colour nor channels' : `not a colour, but ${needsColour}`;
|
|
213
|
+
missing.push(`colour role "${role}": ${property} in "${rule.selector}" is ${why} (${value})`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
for (const [property, definition] of Object.entries(tokens.layers ?? {})) {
|
|
219
|
+
const declared = rules.some(rule => rule.declarations.get(property) === String(definition.default));
|
|
220
|
+
if (!declared) missing.push(`layer ${property}: default ${definition.default} not declared (is components.css imported?)`);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
for (const [attribute, definition] of Object.entries(tokens.dataAttributes ?? {})) {
|
|
224
|
+
if (definition.readBy !== 'components.css') continue;
|
|
225
|
+
if (!rules.some(rule => rule.selector.includes(`[${attribute}`))) {
|
|
226
|
+
missing.push(`data attribute ${attribute}: no rule reads it (is components.css imported?)`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const checked = `${Object.keys(tokens.colors ?? {}).length} colour roles, ${Object.keys(tokens.properties ?? {}).length} properties, ${Object.keys(tokens.layers ?? {}).length} layers, ${Object.keys(tokens.dataAttributes ?? {}).length} data attributes`;
|
|
231
|
+
if (missing.length > 0) {
|
|
232
|
+
console.log(`check-tokens: ${missing.length} missing (${checked}; ${cssFiles.length} css file(s))`);
|
|
233
|
+
for (const line of missing) console.log(` missing: ${line}`);
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
console.log(`check-tokens: ok (${checked}; ${cssFiles.length} css file(s), ${rules.length} rules)`);
|
package/dist/theme.css
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
2
|
+
The Tailwind theme binding of the blocks and primitives for a host whose colours are complete values under bare
|
|
3
|
+
names (`--card: #fff`). It registers each colour role once (`--color-<role>`), which generates `bg-*`, `text-*`,
|
|
4
|
+
`border-*` and `ring-*`, the radii derived from `--radius`, and the raised surface shadow. A host with another colour
|
|
5
|
+
encoding provides the same utility names its own way instead of importing this file. Import it after `tailwindcss`.
|
|
6
|
+
*/
|
|
8
7
|
@theme inline {
|
|
8
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
9
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
10
|
+
--radius-lg: var(--radius);
|
|
11
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
12
|
+
|
|
9
13
|
--color-background: var(--background);
|
|
10
14
|
--color-foreground: var(--foreground);
|
|
11
15
|
--color-card: var(--card);
|
|
@@ -28,17 +32,17 @@
|
|
|
28
32
|
--color-brand: var(--brand);
|
|
29
33
|
--color-brand-emphasis: var(--brand-emphasis);
|
|
30
34
|
--color-brand-light: var(--brand-light);
|
|
31
|
-
--color-brand-ink: var(--brand-ink);
|
|
32
35
|
--color-border: var(--border);
|
|
33
36
|
--color-input: var(--input);
|
|
34
37
|
--color-ring: var(--ring);
|
|
38
|
+
--color-brand-ink: var(--brand-ink);
|
|
35
39
|
--color-tint: var(--tint);
|
|
36
40
|
--color-tint-strong: var(--tint-strong);
|
|
37
41
|
--color-segment-active: var(--segment-active);
|
|
38
42
|
--color-field-edge: var(--field-edge);
|
|
39
43
|
--color-field-edge-strong: var(--field-edge-strong);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
--
|
|
44
|
+
|
|
45
|
+
/* The raised surface shadow as a theme shadow (`shadow-surface-raised`), so it composes with a `ring-*` (the list
|
|
46
|
+
surface: raised shadow + a faint ink ring) instead of one box-shadow replacing the other. */
|
|
47
|
+
--shadow-surface-raised: var(--surface-shadow-raised);
|
|
44
48
|
}
|