@godxjp/ui 31.31.7 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -121
- package/agent/START-HERE.md +10 -10
- package/agent/components/Accordion.json +2 -2
- package/agent/components/AccountChip.json +1 -1
- package/agent/components/Actions.json +1 -1
- package/agent/components/Activity.json +2 -2
- package/agent/components/Affix.json +1 -1
- package/agent/components/Alert.json +22 -6
- package/agent/components/AlertDialog.json +8 -1
- package/agent/components/Anchor.json +4 -3
- package/agent/components/AppLauncher.json +2 -2
- package/agent/components/AppProvider.json +19 -11
- package/agent/components/AppSettingPicker.json +18 -2
- package/agent/components/AppShell.json +4 -5
- package/agent/components/AreaChart.json +0 -1
- package/agent/components/AspectRatio.json +2 -2
- package/agent/components/Attachments.json +3 -3
- package/agent/components/AuthAccountSummary.json +1 -1
- package/agent/components/AuthDivider.json +1 -1
- package/agent/components/AuthExpiryProvider.json +0 -1
- package/agent/components/AuthFooter.json +2 -2
- package/agent/components/AuthIdentity.json +3 -3
- package/agent/components/AuthStack.json +1 -1
- package/agent/components/Avatar.json +2 -12
- package/agent/components/Badge.json +1 -1
- package/agent/components/BarChart.json +0 -1
- package/agent/components/BranchScopePicker.json +1 -1
- package/agent/components/Breadcrumb.json +1 -1
- package/agent/components/Button.json +3 -3
- package/agent/components/Calendar.json +1 -1
- package/agent/components/Card.json +2 -2
- package/agent/components/CardBar.json +0 -1
- package/agent/components/CardContent.json +0 -1
- package/agent/components/Carousel.json +4 -3
- package/agent/components/Cascader.json +1 -1
- package/agent/components/CenteredShell.json +78 -17
- package/agent/components/ChatBubble.json +3 -3
- package/agent/components/ChatBubbleList.json +3 -3
- package/agent/components/ChatComposer.json +3 -3
- package/agent/components/ChatSuggestion.json +3 -3
- package/agent/components/Checkbox.json +1 -1
- package/agent/components/CheckboxGroup.json +0 -1
- package/agent/components/CodeBlock.json +1 -1
- package/agent/components/Collapsible.json +4 -4
- package/agent/components/ColorPicker.json +1 -1
- package/agent/components/Command.json +5 -5
- package/agent/components/CommandPalette.json +1 -1
- package/agent/components/CompactBarTrend.json +1 -1
- package/agent/components/Conversations.json +3 -3
- package/agent/components/CredentialReveal.json +1 -1
- package/agent/components/DataState.json +2 -2
- package/agent/components/DataTable.json +1 -1
- package/agent/components/DatePicker.json +1 -1
- package/agent/components/Descriptions.json +1 -1
- package/agent/components/Dialog.json +2 -2
- package/agent/components/DraggablePanel.json +5 -4
- package/agent/components/DropdownMenu.json +1 -1
- package/agent/components/EmojiPicker.json +3 -2
- package/agent/components/EmptyState.json +1 -1
- package/agent/components/ErrorSurface.json +3 -3
- package/agent/components/FeatureList.json +1 -1
- package/agent/components/Field.json +0 -1
- package/agent/components/Flex.json +34 -4
- package/agent/components/FloatButton.json +6 -5
- package/agent/components/Form.json +1 -1
- package/agent/components/FormErrors.json +0 -1
- package/agent/components/FormField.json +6 -6
- package/agent/components/FormFieldArray.json +0 -1
- package/agent/components/FormFieldControl.json +0 -1
- package/agent/components/FormRoot.json +1 -1
- package/agent/components/Heading.json +3 -0
- package/agent/components/Icon.json +1 -1
- package/agent/components/Image.json +7 -4
- package/agent/components/InfiniteQueryState.json +1 -1
- package/agent/components/Input.json +1 -1
- package/agent/components/InputOTP.json +2 -2
- package/agent/components/Label.json +3 -3
- package/agent/components/LegalDocumentShell.json +5 -4
- package/agent/components/Legend.json +1 -1
- package/agent/components/LineChart.json +0 -1
- package/agent/components/Link.json +0 -1
- package/agent/components/ListRow.json +1 -1
- package/agent/components/Logo.json +5 -4
- package/agent/components/Marquee.json +4 -3
- package/agent/components/Masonry.json +4 -3
- package/agent/components/MasterDetail.json +1 -1
- package/agent/components/MegaMenu.json +4 -3
- package/agent/components/MobileShell.json +4 -4
- package/agent/components/NavList.json +1 -1
- package/agent/components/NumberInput.json +1 -1
- package/agent/components/OrgChart.json +4 -3
- package/agent/components/OrgSwitcher.json +1 -1
- package/agent/components/OverlayPortalProvider.json +0 -1
- package/agent/components/PageContainer.json +3 -3
- package/agent/components/PageCover.json +3 -2
- package/agent/components/Pagination.json +1 -1
- package/agent/components/PasswordInput.json +1 -1
- package/agent/components/PasswordStrength.json +1 -1
- package/agent/components/PermissionMatrix.json +1 -1
- package/agent/components/PieChart.json +0 -1
- package/agent/components/Popover.json +31 -6
- package/agent/components/PrefetchLink.json +1 -1
- package/agent/components/Progress.json +1 -1
- package/agent/components/Prose.json +1 -1
- package/agent/components/QrCode.json +1 -1
- package/agent/components/Radio.json +0 -1
- package/agent/components/RadioGroup.json +2 -2
- package/agent/components/RangeTimeline.json +2 -1
- package/agent/components/Rating.json +1 -1
- package/agent/components/RecordPicker.json +1 -1
- package/agent/components/ResizablePanel.json +1 -1
- package/agent/components/ResponsiveGrid.json +2 -2
- package/agent/components/Reveal.json +3 -3
- package/agent/components/ScrollArea.json +2 -2
- package/agent/components/SearchInput.json +1 -1
- package/agent/components/Segmented.json +1 -1
- package/agent/components/Select.json +7 -5
- package/agent/components/Separator.json +1 -1
- package/agent/components/ServiceCatalogCta.json +0 -1
- package/agent/components/ServiceLauncherCard.json +1 -1
- package/agent/components/ServiceRolePanel.json +1 -1
- package/agent/components/Sheet.json +5 -5
- package/agent/components/Sidebar.json +1 -1
- package/agent/components/Skeleton.json +26 -12
- package/agent/components/Slider.json +2 -2
- package/agent/components/SortableList.json +3 -2
- package/agent/components/SplitPane.json +1 -1
- package/agent/components/StatCard.json +1 -1
- package/agent/components/Steps.json +1 -1
- package/agent/components/Swatch.json +1 -1
- package/agent/components/Switch.json +1 -1
- package/agent/components/Table.json +1 -1
- package/agent/components/Tabs.json +3 -3
- package/agent/components/Text.json +5 -1
- package/agent/components/TextDiff.json +5 -4
- package/agent/components/Textarea.json +1 -1
- package/agent/components/ThemeScope.json +1 -1
- package/agent/components/ThoughtChain.json +3 -3
- package/agent/components/TimePicker.json +1 -1
- package/agent/components/Timeline.json +1 -1
- package/agent/components/TimelineGrid.json +5 -4
- package/agent/components/Toaster.json +0 -1
- package/agent/components/Toggle.json +3 -3
- package/agent/components/ToggleGroup.json +1 -1
- package/agent/components/Toolbar.json +10 -3
- package/agent/components/Tooltip.json +9 -9
- package/agent/components/Topbar.json +1 -1
- package/agent/components/TopbarItem.json +1 -1
- package/agent/components/Transfer.json +2 -2
- package/agent/components/Tree.json +1 -1
- package/agent/components/TreeSelect.json +1 -1
- package/agent/components/TwoFactorSetup.json +1 -1
- package/agent/components/Upload.json +1 -1
- package/agent/components/UploadCropDialog.json +1 -1
- package/agent/components/Welcome.json +3 -3
- package/agent/components/formatDate.json +2 -2
- package/agent/components/inertiaUpload.json +0 -1
- package/agent/components/useZodForm.json +0 -1
- package/agent/components-index.json +80 -154
- package/agent/components.json +541 -1737
- package/agent/index.json +10 -10
- package/agent/llms.txt +9 -9
- package/agent/patterns/account-recovery-settings.json +1 -1
- package/agent/patterns/auth-recovery-panels.json +2 -2
- package/agent/patterns/error-pages.json +1 -1
- package/agent/patterns/pricing-plans.json +17 -0
- package/agent/patterns-index.json +17 -1
- package/agent/patterns.json +21 -4
- package/agent/rules.json +30 -65
- package/agent/tokens.json +27 -57
- package/agent/vocabulary.json +3 -3
- package/dist/app/app-provider.d.ts +5 -3
- package/dist/app/app-provider.js +47 -12
- package/dist/app/date-format-labels.d.ts +3 -1
- package/dist/app/date-format-labels.js +2 -4
- package/dist/app/date-formats.d.ts +21 -2
- package/dist/app/date-formats.js +51 -2
- package/dist/app/index.d.ts +3 -1
- package/dist/app/index.js +5 -0
- package/dist/app/locales.d.ts +58 -3
- package/dist/app/locales.js +134 -8
- package/dist/app/preset.d.ts +25 -0
- package/dist/app/preset.js +10 -0
- package/dist/app/request-headers.d.ts +3 -3
- package/dist/app/request-headers.js +19 -10
- package/dist/app/settings-scope.d.ts +54 -0
- package/dist/app/settings-scope.js +46 -0
- package/dist/app/tenant-theme.js +8 -3
- package/dist/app/time-format-labels.d.ts +4 -1
- package/dist/app/time-format-labels.js +7 -1
- package/dist/app/types.d.ts +10 -2
- package/dist/app/use-formatting.d.ts +1 -1
- package/dist/components/admin/index.d.ts +1 -1
- package/dist/components/admin/index.js +1 -1
- package/dist/components/data-display/accordion.d.ts +51 -1
- package/dist/components/data-display/accordion.js +247 -1
- package/dist/components/data-display/avatar.d.ts +16 -1
- package/dist/components/data-display/avatar.js +109 -1
- package/dist/components/data-display/credential-reveal.d.ts +9 -2
- package/dist/components/data-display/credential-reveal.js +156 -1
- package/dist/components/data-display/image.js +5 -3
- package/dist/components/data-display/index.d.ts +0 -21
- package/dist/components/data-display/index.js +1 -43
- package/dist/components/data-display/popover.d.ts +15 -3
- package/dist/components/data-display/popover.js +168 -2
- package/dist/components/data-entry/branch-scope-picker.d.ts +1 -1
- package/dist/components/data-entry/index.d.ts +5 -12
- package/dist/components/data-entry/index.js +11 -12
- package/dist/components/data-entry/input-otp.d.ts +48 -2
- package/dist/components/data-entry/input-otp.js +94 -1
- package/dist/components/data-entry/number-input.d.ts +1 -1
- package/dist/components/data-entry/password-input.d.ts +38 -2
- package/dist/components/data-entry/password-input.js +56 -1
- package/dist/components/data-entry/rating.d.ts +38 -2
- package/dist/components/data-entry/rating.js +127 -1
- package/dist/components/data-entry/segmented.d.ts +94 -2
- package/dist/components/data-entry/segmented.js +104 -1
- package/dist/components/{ui/tag-input.d.ts → data-entry/select-tags-inline.d.ts} +7 -4
- package/dist/components/{ui/tag-input.js → data-entry/select-tags-inline.js} +4 -4
- package/dist/components/data-entry/select.js +4 -0
- package/dist/components/data-entry/toggle-group.d.ts +108 -2
- package/dist/components/data-entry/toggle-group.js +189 -1
- package/dist/components/data-entry/toggle.d.ts +86 -2
- package/dist/components/data-entry/toggle.js +153 -2
- package/dist/components/feedback/alert.d.ts +5 -3
- package/dist/components/feedback/alert.js +14 -2
- package/dist/components/feedback/index.d.ts +2 -6
- package/dist/components/feedback/index.js +1 -13
- package/dist/components/feedback/skeleton.d.ts +4 -17
- package/dist/components/feedback/skeleton.js +3 -40
- package/dist/components/general/index.d.ts +2 -4
- package/dist/components/general/index.js +1 -6
- package/dist/components/general/typography.d.ts +4 -58
- package/dist/components/general/typography.js +7 -141
- package/dist/components/layout/aspect-ratio.d.ts +24 -1
- package/dist/components/layout/aspect-ratio.js +18 -1
- package/dist/components/layout/auth-divider.js +1 -1
- package/dist/components/layout/auth-identity.js +6 -2
- package/dist/components/layout/centered-shell.d.ts +13 -8
- package/dist/components/layout/centered-shell.js +43 -1
- package/dist/components/layout/flex.d.ts +1 -1
- package/dist/components/layout/flex.js +73 -1
- package/dist/components/layout/index.d.ts +1 -13
- package/dist/components/layout/index.js +0 -12
- package/dist/components/layout/separator.d.ts +25 -2
- package/dist/components/layout/separator.js +71 -1
- package/dist/components/navigation/{app-setting-toggle.d.ts → app-setting-cycle.d.ts} +3 -4
- package/dist/components/navigation/{app-setting-toggle.js → app-setting-cycle.js} +3 -3
- package/dist/components/navigation/app-setting-picker.d.ts +6 -2
- package/dist/components/navigation/app-setting-picker.js +20 -2
- package/dist/components/navigation/index.d.ts +3 -11
- package/dist/components/navigation/index.js +1 -9
- package/dist/components/navigation/tabs.js +1 -1
- package/dist/components/ui/carousel.d.ts +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/index.d.ts +11 -5
- package/dist/components/ui/index.js +5 -5
- package/dist/contracts/measurement.json +2 -2
- package/dist/email/brand-mark.d.ts +3 -2
- package/dist/email/brand-mark.js +1 -1
- package/dist/email/tokens.generated.d.ts +6 -6
- package/dist/email/tokens.generated.js +6 -6
- package/dist/i18n/locale-tags.d.ts +25 -0
- package/dist/i18n/locale-tags.js +59 -0
- package/dist/i18n/translate.d.ts +20 -3
- package/dist/i18n/translate.js +25 -14
- package/dist/i18n/use-translation.d.ts +3 -3
- package/dist/i18n/use-translation.js +4 -2
- package/dist/{components/navigation → lab}/anchor.d.ts +2 -2
- package/dist/{components/navigation → lab}/anchor.js +5 -5
- package/dist/{components/data-display → lab}/carousel.js +2 -2
- package/dist/{components/layout → lab}/draggable-panel.d.ts +8 -8
- package/dist/{components/layout → lab}/draggable-panel.js +2 -2
- package/dist/{components/data-entry → lab}/emoji-picker.d.ts +2 -2
- package/dist/{components/data-entry → lab}/emoji-picker.js +6 -6
- package/dist/{components/general → lab}/float-button.d.ts +8 -8
- package/dist/{components/general → lab}/float-button.js +7 -7
- package/dist/lab/index.d.ts +39 -0
- package/dist/lab/index.js +48 -0
- package/dist/{components/layout → lab}/legal-document-shell.d.ts +2 -2
- package/dist/{components/layout → lab}/legal-document-shell.js +4 -4
- package/dist/{components/data-display → lab}/marquee.d.ts +5 -5
- package/dist/{components/data-display → lab}/marquee.js +5 -5
- package/dist/{components/layout → lab}/masonry.d.ts +2 -2
- package/dist/{components/layout → lab}/masonry.js +3 -3
- package/dist/{components/navigation → lab}/mega-menu.d.ts +4 -4
- package/dist/{components/navigation → lab}/mega-menu.js +2 -2
- package/dist/{components/data-display → lab}/org-chart.d.ts +2 -2
- package/dist/{components/data-display → lab}/org-chart.js +4 -4
- package/dist/{components/layout → lab}/page-cover.d.ts +2 -2
- package/dist/{components/layout → lab}/page-cover.js +2 -2
- package/dist/{components/data-display → lab}/range-timeline.d.ts +1 -1
- package/dist/{components/data-display → lab}/range-timeline.js +6 -6
- package/dist/{components/data-entry → lab}/sortable-list.d.ts +2 -2
- package/dist/{components/data-entry → lab}/sortable-list.js +3 -3
- package/dist/{components/data-display → lab}/text-diff.d.ts +3 -3
- package/dist/{components/data-display → lab}/text-diff.js +4 -4
- package/dist/{components/data-display → lab}/timeline-grid.d.ts +2 -2
- package/dist/{components/data-display → lab}/timeline-grid.js +1 -1
- package/dist/lib/control-styles.js +1 -1
- package/dist/lib/datetime/format.js +20 -6
- package/dist/lib/datetime/sync.d.ts +6 -2
- package/dist/lib/datetime/sync.js +14 -18
- package/dist/lib/platform.d.ts +1 -1
- package/dist/props/components/app.prop.d.ts +28 -13
- package/dist/props/components/data-display.prop.d.ts +19 -29
- package/dist/props/components/feedback.prop.d.ts +15 -44
- package/dist/props/components/general.prop.d.ts +2 -64
- package/dist/props/components/index.d.ts +9 -1
- package/dist/props/components/layout.prop.d.ts +41 -57
- package/dist/props/registry.d.ts +48 -101
- package/dist/props/registry.js +45 -129
- package/dist/props/vocabulary/index.d.ts +1 -1
- package/dist/props/vocabulary/interaction.prop.d.ts +3 -12
- package/dist/styles/alert-layout.css +0 -29
- package/dist/styles/data-display-layout.css +14 -22
- package/dist/styles/dialog-layout.css +4 -0
- package/dist/styles/fonts/OFL.txt +93 -0
- package/dist/styles/form-layout.css +4 -0
- package/dist/styles/index.css +0 -2
- package/dist/styles/layers.json +44 -179
- package/dist/styles/text-layout.css +0 -15
- package/dist/styles.css +2 -0
- package/dist/themes/godx.css +43 -0
- package/dist/themes/godx.d.ts +13 -0
- package/dist/themes/godx.js +12 -0
- package/dist/tokens/components/feedback.css +0 -6
- package/dist/tokens/derived.css +23 -22
- package/dist/tokens/foundation.css +4 -6
- package/docs/COMPOSITION-VS-COMPONENT.md +58 -33
- package/docs/CONSUMER-RULES.md +1 -1
- package/docs/CUSTOMER-THEMING.md +17 -53
- package/docs/migrations/v32.md +98 -0
- package/package.json +58 -19
- package/scripts/_agent-setup.mjs +54 -3
- package/scripts/brand-accent.generated.mjs +15 -2
- package/scripts/cli.mjs +36 -11
- package/scripts/codemod.mjs +522 -0
- package/scripts/consumer-rule.md +21 -43
- package/scripts/postinstall.mjs +10 -47
- package/scripts/prune-css.mjs +1 -1
- package/scripts/ui-audit.mjs +5 -2
- package/dist/components/data-display/chat-bubble.d.ts +0 -30
- package/dist/components/data-display/chat-bubble.js +0 -229
- package/dist/components/data-display/hover-card.d.ts +0 -1
- package/dist/components/data-display/hover-card.js +0 -7
- package/dist/components/data-display/thought-chain.d.ts +0 -42
- package/dist/components/data-display/thought-chain.js +0 -177
- package/dist/components/data-display/thumbnail.d.ts +0 -37
- package/dist/components/data-display/thumbnail.js +0 -20
- package/dist/components/data-display/welcome.d.ts +0 -26
- package/dist/components/data-display/welcome.js +0 -37
- package/dist/components/data-entry/attachments.d.ts +0 -19
- package/dist/components/data-entry/attachments.js +0 -366
- package/dist/components/data-entry/chat-composer.d.ts +0 -51
- package/dist/components/data-entry/chat-composer.js +0 -200
- package/dist/components/data-entry/chat-suggestion.d.ts +0 -28
- package/dist/components/data-entry/chat-suggestion.js +0 -309
- package/dist/components/data-entry/tag-input.d.ts +0 -2
- package/dist/components/data-entry/tag-input.js +0 -5
- package/dist/components/feedback/banner.d.ts +0 -21
- package/dist/components/feedback/banner.js +0 -19
- package/dist/components/feedback/callout.d.ts +0 -23
- package/dist/components/feedback/callout.js +0 -42
- package/dist/components/layout/auth-shell.d.ts +0 -10
- package/dist/components/layout/auth-shell.js +0 -42
- package/dist/components/layout/space-compact.d.ts +0 -65
- package/dist/components/layout/space-compact.js +0 -52
- package/dist/components/navigation/conversations.d.ts +0 -39
- package/dist/components/navigation/conversations.js +0 -371
- package/dist/components/ui/accordion.d.ts +0 -51
- package/dist/components/ui/accordion.js +0 -254
- package/dist/components/ui/aspect-ratio.d.ts +0 -24
- package/dist/components/ui/aspect-ratio.js +0 -21
- package/dist/components/ui/avatar.d.ts +0 -16
- package/dist/components/ui/avatar.js +0 -115
- package/dist/components/ui/credential-reveal.d.ts +0 -9
- package/dist/components/ui/credential-reveal.js +0 -160
- package/dist/components/ui/hover-card.d.ts +0 -47
- package/dist/components/ui/hover-card.js +0 -205
- package/dist/components/ui/input-otp.d.ts +0 -48
- package/dist/components/ui/input-otp.js +0 -101
- package/dist/components/ui/password-input.d.ts +0 -38
- package/dist/components/ui/password-input.js +0 -60
- package/dist/components/ui/rating.d.ts +0 -38
- package/dist/components/ui/rating.js +0 -131
- package/dist/components/ui/segmented.d.ts +0 -94
- package/dist/components/ui/segmented.js +0 -108
- package/dist/components/ui/separator.d.ts +0 -25
- package/dist/components/ui/separator.js +0 -74
- package/dist/components/ui/toggle-group.d.ts +0 -108
- package/dist/components/ui/toggle-group.js +0 -194
- package/dist/components/ui/toggle.d.ts +0 -86
- package/dist/components/ui/toggle.js +0 -156
- package/docs/CANONICAL-CONTRACTS.md +0 -206
- package/docs/COMPONENTS.md +0 -163
- package/docs/DATETIME.md +0 -78
- package/docs/DEVELOPMENT.md +0 -269
- package/docs/FRAME-A11Y-CI.md +0 -287
- package/docs/FRAME-COVERAGE-LEDGER.md +0 -123
- package/docs/FRAME-COVERAGE-REPORT.md +0 -228
- package/docs/FRAME-COVERAGE-STANDARD.md +0 -65
- package/docs/FRAME-COVERAGE.md +0 -29
- package/docs/MEASUREMENT-CONTRACT.md +0 -109
- package/docs/PROPS-REGISTRY.md +0 -61
- package/docs/PROPS-VOCABULARY.md +0 -100
- package/docs/REGISTRY.md +0 -70
- package/docs/TESTING.md +0 -107
- package/docs/THEME-API-COVERAGE.md +0 -538
- package/docs/WHAT-BELONGS-HERE.md +0 -179
- package/docs/asset-modules.d.ts +0 -53
- package/docs/assets/cover-terrain.svg +0 -6
- package/docs/assets/portrait-amber.svg +0 -5
- package/docs/assets/portrait-clay.svg +0 -5
- package/docs/assets/portrait-indigo.svg +0 -5
- package/docs/assets/portrait-iris.svg +0 -5
- package/docs/assets/portrait-moss.svg +0 -5
- package/docs/assets/portrait-plum.svg +0 -5
- package/docs/assets/portrait-slate.svg +0 -5
- package/docs/assets/service-mark-rose.svg +0 -6
- package/docs/assets/service-mark-teal.svg +0 -5
- package/docs/assets/shot-landscape.svg +0 -12
- package/docs/assets/shot-portrait.svg +0 -10
- package/docs/assets/tcgm/card-1.svg +0 -1
- package/docs/assets/tcgm/card-2.svg +0 -1
- package/docs/assets/tcgm/card-3.svg +0 -1
- package/docs/assets/tcgm/card-4.svg +0 -1
- package/docs/assets/tcgm/card-5.svg +0 -1
- package/docs/assets/tcgm/card-6.svg +0 -1
- package/docs/assets/tcgm/hero-prism.svg +0 -1
- package/docs/assets/tcgm/scene-1.svg +0 -1
- package/docs/assets/tcgm/scene-2.svg +0 -1
- package/docs/assets/tcgm/scene-3.svg +0 -1
- package/docs/assets/tcgm/scene-4.svg +0 -1
- package/docs/assets/tcgm/scene-5.svg +0 -1
- package/docs/assets/tcgm/tcgm-lockup-color.svg +0 -1
- package/docs/assets/tcgm/tcgm-symbol-color.svg +0 -1
- package/docs/charts/cjk-category-axis.tsx +0 -81
- package/docs/charts/compact-bar-trend.tsx +0 -327
- package/docs/charts/size-tiers.tsx +0 -192
- package/docs/data-display/accordion.tsx +0 -99
- package/docs/data-display/avatar.tsx +0 -502
- package/docs/data-display/badge.tsx +0 -335
- package/docs/data-display/card/examples/detail-panel.tsx +0 -106
- package/docs/data-display/card/examples/tab-list.tsx +0 -97
- package/docs/data-display/card/index.md +0 -3
- package/docs/data-display/card/index.tsx +0 -390
- package/docs/data-display/carousel.tsx +0 -160
- package/docs/data-display/charts.tsx +0 -278
- package/docs/data-display/chat-bubble.tsx +0 -397
- package/docs/data-display/code-block.tsx +0 -188
- package/docs/data-display/collapsible.tsx +0 -162
- package/docs/data-display/credential-reveal.tsx +0 -148
- package/docs/data-display/data-table/examples/antd-parity.tsx +0 -257
- package/docs/data-display/data-table/examples/approval-queue.tsx +0 -212
- package/docs/data-display/data-table/examples/grid-features.tsx +0 -158
- package/docs/data-display/data-table/examples/list-page.tsx +0 -175
- package/docs/data-display/data-table/examples/selectable-inbox.tsx +0 -113
- package/docs/data-display/data-table/examples/server-paged.tsx +0 -179
- package/docs/data-display/data-table/examples/striped-list.tsx +0 -173
- package/docs/data-display/data-table/index.md +0 -9
- package/docs/data-display/data-table/index.tsx +0 -407
- package/docs/data-display/descriptions.tsx +0 -263
- package/docs/data-display/empty-state.tsx +0 -164
- package/docs/data-display/feature-list.tsx +0 -159
- package/docs/data-display/hover-card.tsx +0 -181
- package/docs/data-display/image.tsx +0 -170
- package/docs/data-display/legend.tsx +0 -158
- package/docs/data-display/list-row.tsx +0 -441
- package/docs/data-display/markdown.tsx +0 -86
- package/docs/data-display/marquee.tsx +0 -254
- package/docs/data-display/org-chart.tsx +0 -165
- package/docs/data-display/permission-matrix.tsx +0 -188
- package/docs/data-display/popover-touch.tsx +0 -27
- package/docs/data-display/popover.tsx +0 -331
- package/docs/data-display/progress.tsx +0 -162
- package/docs/data-display/prose.tsx +0 -169
- package/docs/data-display/qr-code.tsx +0 -68
- package/docs/data-display/scroll-area.tsx +0 -420
- package/docs/data-display/service-launcher-card.tsx +0 -445
- package/docs/data-display/stat-card.tsx +0 -354
- package/docs/data-display/swatch.tsx +0 -107
- package/docs/data-display/table.tsx +0 -362
- package/docs/data-display/text-diff.tsx +0 -89
- package/docs/data-display/thought-chain.tsx +0 -176
- package/docs/data-display/thumbnail.tsx +0 -128
- package/docs/data-display/timeline-grid.tsx +0 -119
- package/docs/data-display/timeline.tsx +0 -671
- package/docs/data-display/touch-actions.tsx +0 -36
- package/docs/data-display/tree.tsx +0 -724
- package/docs/data-display/welcome.tsx +0 -115
- package/docs/data-entry/attachments.tsx +0 -160
- package/docs/data-entry/block-editor.tsx +0 -105
- package/docs/data-entry/branch-scope-picker.tsx +0 -128
- package/docs/data-entry/calendar.tsx +0 -226
- package/docs/data-entry/cascader.tsx +0 -380
- package/docs/data-entry/chat-composer.tsx +0 -619
- package/docs/data-entry/chat-suggestion.tsx +0 -301
- package/docs/data-entry/checkbox.tsx +0 -256
- package/docs/data-entry/color-picker.tsx +0 -189
- package/docs/data-entry/command-palette.tsx +0 -179
- package/docs/data-entry/command.tsx +0 -341
- package/docs/data-entry/country-picker-recipe.tsx +0 -175
- package/docs/data-entry/date-picker.tsx +0 -452
- package/docs/data-entry/emoji-picker.tsx +0 -35
- package/docs/data-entry/form/examples/employee-settings.tsx +0 -267
- package/docs/data-entry/form/examples/invoice-form.tsx +0 -387
- package/docs/data-entry/form-dynamic-fields.tsx +0 -199
- package/docs/data-entry/form-field/examples/a11y-contract.tsx +0 -242
- package/docs/data-entry/form-field/examples/create-form.tsx +0 -107
- package/docs/data-entry/form-field/index.md +0 -8
- package/docs/data-entry/form-field/index.tsx +0 -337
- package/docs/data-entry/form-inertia.tsx +0 -80
- package/docs/data-entry/form-root.tsx +0 -112
- package/docs/data-entry/form.tsx +0 -1498
- package/docs/data-entry/input-otp.tsx +0 -258
- package/docs/data-entry/input.tsx +0 -796
- package/docs/data-entry/label.tsx +0 -102
- package/docs/data-entry/markdown-editor.tsx +0 -69
- package/docs/data-entry/number-input.tsx +0 -279
- package/docs/data-entry/password-input.tsx +0 -102
- package/docs/data-entry/password-strength.tsx +0 -99
- package/docs/data-entry/radio-group.tsx +0 -316
- package/docs/data-entry/rating.tsx +0 -91
- package/docs/data-entry/record-picker.tsx +0 -209
- package/docs/data-entry/search-input.tsx +0 -121
- package/docs/data-entry/segmented-in-filter-row.tsx +0 -60
- package/docs/data-entry/segmented.tsx +0 -300
- package/docs/data-entry/select-async-contracts.tsx +0 -108
- package/docs/data-entry/select-matrix.tsx +0 -209
- package/docs/data-entry/select.tsx +0 -547
- package/docs/data-entry/slider.tsx +0 -212
- package/docs/data-entry/sortable-list.tsx +0 -76
- package/docs/data-entry/switch.tsx +0 -314
- package/docs/data-entry/tag-input.tsx +0 -145
- package/docs/data-entry/textarea.tsx +0 -249
- package/docs/data-entry/time-picker.tsx +0 -187
- package/docs/data-entry/time-range-picker.tsx +0 -55
- package/docs/data-entry/toggle-count.tsx +0 -348
- package/docs/data-entry/toggle-group.tsx +0 -438
- package/docs/data-entry/toggle.tsx +0 -217
- package/docs/data-entry/transfer.tsx +0 -115
- package/docs/data-entry/tree-select.tsx +0 -204
- package/docs/data-entry/upload-crop-dialog.tsx +0 -109
- package/docs/data-entry/upload.tsx +0 -310
- package/docs/feedback/alert-dialog.tsx +0 -270
- package/docs/feedback/alert.tsx +0 -248
- package/docs/feedback/auth-expiry.tsx +0 -104
- package/docs/feedback/banner.tsx +0 -183
- package/docs/feedback/callout.tsx +0 -220
- package/docs/feedback/danger-confirm.tsx +0 -91
- package/docs/feedback/dialog-touch.tsx +0 -24
- package/docs/feedback/dialog.tsx +0 -373
- package/docs/feedback/sheet.tsx +0 -510
- package/docs/feedback/skeleton.tsx +0 -168
- package/docs/feedback/toast.tsx +0 -135
- package/docs/feedback/tooltip.tsx +0 -171
- package/docs/feedback/two-factor-setup.tsx +0 -68
- package/docs/foundation/_email-specimen.ts +0 -274
- package/docs/foundation/_theme-editor-scope.ts +0 -222
- package/docs/foundation/colors.tsx +0 -207
- package/docs/foundation/density.tsx +0 -242
- package/docs/foundation/email-tokens.tsx +0 -323
- package/docs/foundation/radius-shadow.tsx +0 -154
- package/docs/foundation/spacing.tsx +0 -216
- package/docs/foundation/theme-editor.tsx +0 -654
- package/docs/foundation/typography.tsx +0 -147
- package/docs/general/actions.tsx +0 -175
- package/docs/general/activity.tsx +0 -289
- package/docs/general/button/examples/destructive-confirm.tsx +0 -90
- package/docs/general/button/examples/form-actions.tsx +0 -87
- package/docs/general/button/examples/toolbar.tsx +0 -160
- package/docs/general/button/index.md +0 -16
- package/docs/general/button/index.tsx +0 -236
- package/docs/general/float-button.tsx +0 -133
- package/docs/general/icon.tsx +0 -217
- package/docs/general/logo.tsx +0 -194
- package/docs/general/reveal.tsx +0 -309
- package/docs/general/typography.tsx +0 -542
- package/docs/i18n/messages/en.json +0 -1715
- package/docs/i18n/messages/ja.json +0 -1708
- package/docs/i18n/messages/vi.json +0 -1708
- package/docs/layout/account-chip.tsx +0 -72
- package/docs/layout/admin-collection.tsx +0 -122
- package/docs/layout/affix.tsx +0 -209
- package/docs/layout/app-launcher.tsx +0 -211
- package/docs/layout/app-shell-arrangements.tsx +0 -225
- package/docs/layout/app-shell-narrow-bar.tsx +0 -205
- package/docs/layout/app-shell-states.tsx +0 -171
- package/docs/layout/app-shell.tsx +0 -395
- package/docs/layout/aspect-ratio.tsx +0 -135
- package/docs/layout/auth-account-summary.tsx +0 -103
- package/docs/layout/auth-divider.tsx +0 -28
- package/docs/layout/auth-footer.tsx +0 -37
- package/docs/layout/auth-identity.tsx +0 -70
- package/docs/layout/auth-recovery/examples/mfa-challenge.md +0 -41
- package/docs/layout/auth-recovery/examples/mfa-challenge.tsx +0 -254
- package/docs/layout/auth-recovery/examples/mobile-390.md +0 -25
- package/docs/layout/auth-recovery/examples/mobile-390.tsx +0 -82
- package/docs/layout/auth-recovery/examples/password-recovery.md +0 -24
- package/docs/layout/auth-recovery/examples/password-recovery.tsx +0 -197
- package/docs/layout/auth-recovery/examples/wrapping-ja-en-vi.md +0 -27
- package/docs/layout/auth-recovery/examples/wrapping-ja-en-vi.tsx +0 -156
- package/docs/layout/auth-recovery/index.md +0 -140
- package/docs/layout/auth-recovery/index.tsx +0 -96
- package/docs/layout/auth-shell-context.tsx +0 -103
- package/docs/layout/auth-shell-device.tsx +0 -112
- package/docs/layout/auth-shell-registration.tsx +0 -338
- package/docs/layout/auth-shell-variants.tsx +0 -143
- package/docs/layout/auth-shell.tsx +0 -59
- package/docs/layout/auth-stack.tsx +0 -40
- package/docs/layout/centered-shell.tsx +0 -102
- package/docs/layout/draggable-panel.tsx +0 -127
- package/docs/layout/error-surface/examples/application-403.tsx +0 -84
- package/docs/layout/error-surface/examples/application-404.tsx +0 -77
- package/docs/layout/error-surface/examples/system-500.tsx +0 -47
- package/docs/layout/error-surface/examples/system-503.tsx +0 -48
- package/docs/layout/error-surface/index.md +0 -153
- package/docs/layout/error-surface/index.tsx +0 -239
- package/docs/layout/flex.tsx +0 -444
- package/docs/layout/legal-document-shell/_data.ts +0 -110
- package/docs/layout/legal-document-shell/examples/desktop-1440.md +0 -12
- package/docs/layout/legal-document-shell/examples/desktop-1440.tsx +0 -83
- package/docs/layout/legal-document-shell/examples/mobile-390.md +0 -22
- package/docs/layout/legal-document-shell/examples/mobile-390.tsx +0 -70
- package/docs/layout/legal-document-shell/examples/tablet-1024.md +0 -3
- package/docs/layout/legal-document-shell/examples/tablet-1024.tsx +0 -84
- package/docs/layout/legal-document-shell/examples/wrapping-ja-en-vi.md +0 -18
- package/docs/layout/legal-document-shell/examples/wrapping-ja-en-vi.tsx +0 -61
- package/docs/layout/legal-document-shell/index.md +0 -51
- package/docs/layout/legal-document-shell/index.tsx +0 -101
- package/docs/layout/masonry.tsx +0 -291
- package/docs/layout/master-detail.tsx +0 -390
- package/docs/layout/mobile-shell.tsx +0 -106
- package/docs/layout/nav-list.tsx +0 -584
- package/docs/layout/org-switcher.tsx +0 -131
- package/docs/layout/page-container.tsx +0 -1020
- package/docs/layout/page-cover.tsx +0 -56
- package/docs/layout/resizable-panel.tsx +0 -419
- package/docs/layout/responsive-grid.tsx +0 -403
- package/docs/layout/separator.tsx +0 -327
- package/docs/layout/service-role-panel.tsx +0 -144
- package/docs/layout/sidebar.tsx +0 -689
- package/docs/layout/space-compact.tsx +0 -202
- package/docs/layout/split-pane.tsx +0 -532
- package/docs/layout/topbar-item.tsx +0 -233
- package/docs/layout/topbar.tsx +0 -360
- package/docs/navigation/anchor.tsx +0 -295
- package/docs/navigation/app-setting-picker.tsx +0 -178
- package/docs/navigation/app-setting-toggle.tsx +0 -111
- package/docs/navigation/breadcrumb.tsx +0 -207
- package/docs/navigation/card-tabs.tsx +0 -344
- package/docs/navigation/conversations.tsx +0 -176
- package/docs/navigation/dropdown-menu.tsx +0 -345
- package/docs/navigation/filter-bar.tsx +0 -247
- package/docs/navigation/mega-menu-panel.tsx +0 -86
- package/docs/navigation/mega-menu.tsx +0 -254
- package/docs/navigation/pagination.tsx +0 -293
- package/docs/navigation/steps.tsx +0 -315
- package/docs/navigation/tabs-rtl.tsx +0 -28
- package/docs/navigation/tabs.tsx +0 -755
- package/docs/navigation/toolbar.tsx +0 -347
- package/docs/providers/app-provider.tsx +0 -191
- package/docs/providers/format-date.tsx +0 -230
- package/docs/providers/theme-scope.tsx +0 -186
- package/docs/query/button-refetch.tsx +0 -161
- package/docs/query/data-state.tsx +0 -262
- package/docs/query/infinite-query-state.tsx +0 -97
- package/docs/query/mutation-feedback.tsx +0 -128
- package/docs/query/touch-actions.tsx +0 -68
- package/docs/react-router/prefetch-link.tsx +0 -262
- package/docs/roadmap/ai-chat-components.md +0 -206
- package/docs/roadmap/antd-parity.md +0 -155
- package/docs/roadmap/badge-tag-chip-count.md +0 -172
- package/docs/roadmap/list-masonry.md +0 -159
- package/docs/roadmap/parity-audit-data-display-feedback.md +0 -567
- package/docs/roadmap/parity-audit-data-entry.md +0 -368
- package/docs/roadmap/parity-audit-layout-navigation-general.md +0 -459
- package/docs/roadmap/parity-backlog.md +0 -77
- package/docs/roadmap/tree-components.md +0 -151
- package/docs/roadmap/website-components.md +0 -813
- package/docs/showcase/acme-portal.tsx +0 -461
- package/docs/showcase/acme-website.tsx +0 -499
- package/docs/showcase/caimono-price-comparison.tsx +0 -919
- package/docs/showcase/case1-warehouse-dashboard.tsx +0 -358
- package/docs/showcase/case2-employee-me.tsx +0 -438
- package/docs/showcase/case3-approval-workflow.tsx +0 -531
- package/docs/showcase/case4-login.tsx +0 -312
- package/docs/showcase/case5-shift-calendar.tsx +0 -702
- package/docs/showcase/case6-agency-handy.tsx +0 -1120
- package/docs/showcase/futurelastic-web.tsx +0 -441
- package/docs/showcase/marketing-page.tsx +0 -895
- package/docs/showcase/org-switcher.tsx +0 -320
- package/docs/showcase/permission-matrix.tsx +0 -354
- package/docs/showcase/public-landing.tsx +0 -210
- package/docs/showcase/settings-account-sections.tsx +0 -559
- package/docs/showcase/settings-security-mfa.tsx +0 -145
- package/docs/showcase/table-approval-queue.tsx +0 -199
- package/docs/showcase/table-bulk-actions.tsx +0 -468
- package/docs/showcase/table-compact-kintone.tsx +0 -438
- package/docs/showcase/table-conditional-format.tsx +0 -367
- package/docs/showcase/table-crud-list.tsx +0 -544
- package/docs/showcase/table-density.tsx +0 -349
- package/docs/showcase/table-expandable-rows.tsx +0 -496
- package/docs/showcase/table-filter-chips.tsx +0 -468
- package/docs/showcase/table-footer-totals.tsx +0 -328
- package/docs/showcase/table-grouped-subtotals.tsx +0 -398
- package/docs/showcase/table-master-detail.tsx +0 -482
- package/docs/showcase/table-pagination.tsx +0 -409
- package/docs/showcase/table-states.tsx +0 -371
- package/docs/showcase/table-sticky-columns.tsx +0 -377
- package/docs/showcase/table-tree-rows.tsx +0 -451
- package/docs/showcase/table-view-tabs.tsx +0 -488
- package/docs/showcase/tcgm-website.tsx +0 -1047
- package/docs/showcase/tenant-brand-color.tsx +0 -338
- package/docs/showcase/theme-customization.tsx +0 -1292
- package/docs/showcase/theme-lab.tsx +0 -2125
- package/docs/themes/flat.css +0 -466
- package/docs/themes/glassmorphism.css +0 -960
- package/docs/themes/index.ts +0 -219
- package/docs/themes/neubrutalism.css +0 -481
- /package/dist/components/navigation/{filter-bar.d.ts → toolbar.d.ts} +0 -0
- /package/dist/components/navigation/{filter-bar.js → toolbar.js} +0 -0
- /package/dist/{components/data-display → lab}/carousel.d.ts +0 -0
- /package/dist/{components/data-entry → lab}/emoji-data.d.ts +0 -0
- /package/dist/{components/data-entry → lab}/emoji-data.js +0 -0
- /package/dist/{components/data-display → lab}/marquee-reveal.d.ts +0 -0
- /package/dist/{components/data-display → lab}/marquee-reveal.js +0 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `npx godxjp-ui codemod v32 [paths…] [--godx] [--dry-run]` — the mechanical half of upgrading to
|
|
4
|
+
* v32 (docs/migrations/v32.md). What it cannot decide, it reports instead of guessing.
|
|
5
|
+
*
|
|
6
|
+
* --godx the app is a GoDX product: keep today's look with the GoDX preset (violet, the GoDX
|
|
7
|
+
* mark, vi default locale, the Japanese fonts)
|
|
8
|
+
* --dry-run list every change without writing
|
|
9
|
+
*
|
|
10
|
+
* Transforms (each one idempotent: running twice changes nothing the second time):
|
|
11
|
+
* 1. fonts are opt-in (gh#1221): after an import of "@godxjp/ui/styles", add the fonts import.
|
|
12
|
+
* 2. with --godx (gh#1220): add the preset stylesheet after it, and `preset={godxPreset}` (+ its
|
|
13
|
+
* import) to every `<AppProvider` that has no `preset`.
|
|
14
|
+
* 3. component renames/moves (gh#1223): import specifiers rewritten from RENAMES below.
|
|
15
|
+
* Reported, not changed: an `<AppProvider` with no `defaultLocale` and no preset now starts in `en`
|
|
16
|
+
* (or `<html lang>`), not `vi` (gh#1219).
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* gh#1223 import renames: `{ from: [module, name], to: [module, name] }`. A JSX usage of the old
|
|
23
|
+
* name is renamed with it. Moves that change props (Banner → Alert variant) carry `note`, which is
|
|
24
|
+
* reported for the human to finish.
|
|
25
|
+
*/
|
|
26
|
+
const UI = (group) => [`@godxjp/ui/${group}`, "@godxjp/ui"];
|
|
27
|
+
/**
|
|
28
|
+
* `add`: props written onto every opening tag of the renamed component (unless that prop is already
|
|
29
|
+
* there). `map`: prop values rewritten in the same tag. `note`: what only a person can finish.
|
|
30
|
+
*/
|
|
31
|
+
const rename = (groups, from, toMod, to, extra = {}) => ({
|
|
32
|
+
from: [groups, from],
|
|
33
|
+
to: [toMod, to],
|
|
34
|
+
...(typeof extra === "string" ? { note: extra } : extra),
|
|
35
|
+
});
|
|
36
|
+
const move = (groups, toMod, names) => names.map((n) => rename(groups, n, toMod, n));
|
|
37
|
+
|
|
38
|
+
export const RENAMES = [
|
|
39
|
+
rename(UI("feedback"), "Banner", "@godxjp/ui/feedback", "Alert", { add: { variant: "banner" } }),
|
|
40
|
+
rename(UI("feedback"), "Callout", "@godxjp/ui/feedback", "Alert", {
|
|
41
|
+
add: { variant: "callout" },
|
|
42
|
+
}),
|
|
43
|
+
rename(UI("data-entry"), "TagInput", "@godxjp/ui/data-entry", "Select", {
|
|
44
|
+
add: { mode: "tags", open: "{false}" },
|
|
45
|
+
note: "Select takes no ref; move a ref to a wrapper element",
|
|
46
|
+
}),
|
|
47
|
+
rename(UI("data-display"), "Thumbnail", "@godxjp/ui/data-display", "Image", {
|
|
48
|
+
add: { fit: "intrinsic", preview: "{false}" },
|
|
49
|
+
}),
|
|
50
|
+
rename(UI("data-display"), "HoverCard", "@godxjp/ui/data-display", "Popover", {
|
|
51
|
+
add: { openOn: "hover" },
|
|
52
|
+
}),
|
|
53
|
+
rename(UI("data-display"), "HoverCardTrigger", "@godxjp/ui/data-display", "PopoverTrigger"),
|
|
54
|
+
rename(UI("data-display"), "HoverCardContent", "@godxjp/ui/data-display", "PopoverContent"),
|
|
55
|
+
rename(UI("layout"), "AuthShell", "@godxjp/ui/layout", "CenteredShell", {
|
|
56
|
+
add: { variant: "auth" },
|
|
57
|
+
map: { variant: { canonical: "auth-canonical" } },
|
|
58
|
+
}),
|
|
59
|
+
rename(UI("layout"), "SpaceCompact", "@godxjp/ui/layout", "Flex", {
|
|
60
|
+
add: { attached: true },
|
|
61
|
+
note: 'orientation="vertical" / vertical becomes direction="col"',
|
|
62
|
+
}),
|
|
63
|
+
rename(UI("navigation"), "AppSettingToggle", "@godxjp/ui/navigation", "AppSettingPicker", {
|
|
64
|
+
add: { menu: "{false}" },
|
|
65
|
+
}),
|
|
66
|
+
rename(UI("general"), "Title", "@godxjp/ui/general", "Heading", {
|
|
67
|
+
note: "Title (antd shim) was removed: check level / size on Heading",
|
|
68
|
+
}),
|
|
69
|
+
rename(UI("general"), "Paragraph", "@godxjp/ui/general", "Text", {
|
|
70
|
+
add: { as: "p" },
|
|
71
|
+
note: "ellipsis.rows becomes clamp",
|
|
72
|
+
}),
|
|
73
|
+
rename(UI("general"), "Typography", "@godxjp/ui/data-display", "Prose", {
|
|
74
|
+
note: "Typography (antd shim) was removed: check the children render as prose",
|
|
75
|
+
}),
|
|
76
|
+
// Prop types whose component was merged (gh#1223): the new name, where one exists.
|
|
77
|
+
rename(UI("layout"), "AuthShellProp", "@godxjp/ui/layout", "CenteredShellAuthProp"),
|
|
78
|
+
rename(UI("layout"), "AuthShellProps", "@godxjp/ui/layout", "CenteredShellAuthProp"),
|
|
79
|
+
rename(
|
|
80
|
+
UI("navigation"),
|
|
81
|
+
"AppSettingToggleProp",
|
|
82
|
+
"@godxjp/ui/navigation",
|
|
83
|
+
"AppSettingPickerCycleProp",
|
|
84
|
+
),
|
|
85
|
+
rename(
|
|
86
|
+
UI("navigation"),
|
|
87
|
+
"AppSettingToggleProps",
|
|
88
|
+
"@godxjp/ui/navigation",
|
|
89
|
+
"AppSettingPickerCycleProp",
|
|
90
|
+
),
|
|
91
|
+
rename(UI("navigation"), "AppSettingToggleKind", "@godxjp/ui/navigation", "AppSettingCycleKind"),
|
|
92
|
+
rename(UI("feedback"), "SkeletonAvatarProp", "@godxjp/ui/feedback", "SkeletonArticleAvatarProp"),
|
|
93
|
+
rename(UI("feedback"), "SkeletonAvatarProps", "@godxjp/ui/feedback", "SkeletonArticleAvatarProp"),
|
|
94
|
+
...move(UI("general"), "@godxjp/ui/lab", [
|
|
95
|
+
"FloatButton",
|
|
96
|
+
"FloatButtonBackTopProp",
|
|
97
|
+
"FloatButtonBackTopProps",
|
|
98
|
+
"FloatButtonBadgeProp",
|
|
99
|
+
"FloatButtonGroupProp",
|
|
100
|
+
"FloatButtonGroupProps",
|
|
101
|
+
"FloatButtonPlacementProp",
|
|
102
|
+
"FloatButtonProp",
|
|
103
|
+
"FloatButtonProps",
|
|
104
|
+
"FloatButtonShapeProp",
|
|
105
|
+
"FloatButtonTooltipProp",
|
|
106
|
+
"FloatButtonTriggerProp",
|
|
107
|
+
"FloatButtonTypeProp",
|
|
108
|
+
]),
|
|
109
|
+
...move(UI("layout"), "@godxjp/ui/lab", [
|
|
110
|
+
"PageCover",
|
|
111
|
+
"PageCoverProp",
|
|
112
|
+
"PageCoverProps",
|
|
113
|
+
"DraggablePanel",
|
|
114
|
+
"DraggablePanelProp",
|
|
115
|
+
"DraggablePanelProps",
|
|
116
|
+
"DraggablePanelPlacementProp",
|
|
117
|
+
"DraggablePanelPositionProp",
|
|
118
|
+
"DraggablePanelLabels",
|
|
119
|
+
"DragAxisProp",
|
|
120
|
+
"DragBoundsProp",
|
|
121
|
+
"LegalDocumentShell",
|
|
122
|
+
"LegalDocumentSectionProp",
|
|
123
|
+
"LegalDocumentShellProp",
|
|
124
|
+
"LegalDocumentShellProps",
|
|
125
|
+
"Masonry",
|
|
126
|
+
"MasonryColumnsProp",
|
|
127
|
+
"MasonryGapProp",
|
|
128
|
+
"MasonryItemProp",
|
|
129
|
+
"MasonryLayoutEntryProp",
|
|
130
|
+
"MasonryProp",
|
|
131
|
+
"MasonryProps",
|
|
132
|
+
]),
|
|
133
|
+
...move(UI("data-display"), "@godxjp/ui/lab", [
|
|
134
|
+
"Marquee",
|
|
135
|
+
"MarqueeDirectionProp",
|
|
136
|
+
"MarqueeProp",
|
|
137
|
+
"MarqueeProps",
|
|
138
|
+
"MarqueeSpeedProp",
|
|
139
|
+
"TextDiff",
|
|
140
|
+
"diffText",
|
|
141
|
+
"tokenizeText",
|
|
142
|
+
"TextDiffGranularity",
|
|
143
|
+
"TextDiffProp",
|
|
144
|
+
"TextDiffProps",
|
|
145
|
+
"TextDiffSegment",
|
|
146
|
+
"TimelineGrid",
|
|
147
|
+
"TimelineGridColumnProp",
|
|
148
|
+
"TimelineGridEventProp",
|
|
149
|
+
"TimelineGridProp",
|
|
150
|
+
"TimelineGridProps",
|
|
151
|
+
"Carousel",
|
|
152
|
+
"CarouselContent",
|
|
153
|
+
"CarouselItem",
|
|
154
|
+
"CarouselNext",
|
|
155
|
+
"CarouselPrevious",
|
|
156
|
+
"CarouselDots",
|
|
157
|
+
"useCarousel",
|
|
158
|
+
"CarouselApi",
|
|
159
|
+
"RangeTimeline",
|
|
160
|
+
"RangeTimelineProps",
|
|
161
|
+
"RangeTimelineRow",
|
|
162
|
+
"OrgChart",
|
|
163
|
+
"OrgChartNodeProp",
|
|
164
|
+
"OrgChartNodeVariantProp",
|
|
165
|
+
"OrgChartProp",
|
|
166
|
+
"OrgChartProps",
|
|
167
|
+
]),
|
|
168
|
+
...move(UI("data-entry"), "@godxjp/ui/lab", [
|
|
169
|
+
"EmojiPicker",
|
|
170
|
+
"SortableList",
|
|
171
|
+
"SortableListItemProp",
|
|
172
|
+
"SortableListProp",
|
|
173
|
+
"SortableListProps",
|
|
174
|
+
"EmojiPickerProp",
|
|
175
|
+
"EmojiPickerProps",
|
|
176
|
+
]),
|
|
177
|
+
...move(UI("navigation"), "@godxjp/ui/lab", [
|
|
178
|
+
"MegaMenu",
|
|
179
|
+
"MegaMenuProp",
|
|
180
|
+
"MegaMenuProps",
|
|
181
|
+
"MegaMenuItemProp",
|
|
182
|
+
"MegaMenuItemProps",
|
|
183
|
+
"MegaMenuPanelProp",
|
|
184
|
+
"MegaMenuPanelProps",
|
|
185
|
+
"MegaMenuGroupProp",
|
|
186
|
+
"MegaMenuGroupProps",
|
|
187
|
+
"MegaMenuLinkProp",
|
|
188
|
+
"MegaMenuLinkProps",
|
|
189
|
+
"MegaMenuLinkComponentProp",
|
|
190
|
+
"MegaMenuLinkComponentProps",
|
|
191
|
+
"MegaMenuTriggerActionProp",
|
|
192
|
+
"MegaMenuTriggerActionProps",
|
|
193
|
+
"Anchor",
|
|
194
|
+
"AnchorContainerProp",
|
|
195
|
+
"AnchorDirectionProp",
|
|
196
|
+
"AnchorItemProp",
|
|
197
|
+
"AnchorProp",
|
|
198
|
+
"AnchorProps",
|
|
199
|
+
]),
|
|
200
|
+
...move(UI("data-display"), "@godxjp/chat", [
|
|
201
|
+
"ChatBubble",
|
|
202
|
+
"ChatBubbleList",
|
|
203
|
+
"ChatBubbleListProp",
|
|
204
|
+
"ChatBubbleListProps",
|
|
205
|
+
"ChatBubblePlacementProp",
|
|
206
|
+
"ChatBubbleProp",
|
|
207
|
+
"ChatBubbleProps",
|
|
208
|
+
"ChatBubbleToneProp",
|
|
209
|
+
"ChatBubbleTypingProp",
|
|
210
|
+
"ChatBubbleVariantProp",
|
|
211
|
+
"ChatMessageProp",
|
|
212
|
+
"Welcome",
|
|
213
|
+
"WelcomeProp",
|
|
214
|
+
"WelcomeProps",
|
|
215
|
+
"WelcomeVariantProp",
|
|
216
|
+
"ThoughtChain",
|
|
217
|
+
"ThoughtChainItem",
|
|
218
|
+
"ThoughtChainProp",
|
|
219
|
+
"ThoughtChainProps",
|
|
220
|
+
"ThoughtChainItemsProp",
|
|
221
|
+
"ThoughtChainItemProp",
|
|
222
|
+
"ThoughtChainItemProps",
|
|
223
|
+
"ThoughtChainStatusProp",
|
|
224
|
+
"ThoughtChainLineProp",
|
|
225
|
+
"ThoughtChainVariantProp",
|
|
226
|
+
]),
|
|
227
|
+
...move(UI("data-entry"), "@godxjp/chat", [
|
|
228
|
+
"ChatComposer",
|
|
229
|
+
"ChatComposerProp",
|
|
230
|
+
"ChatComposerProps",
|
|
231
|
+
"ChatComposerSubmitTypeProp",
|
|
232
|
+
"ChatSuggestion",
|
|
233
|
+
"ChatSuggestionProp",
|
|
234
|
+
"ChatSuggestionProps",
|
|
235
|
+
"ChatSuggestionItemProp",
|
|
236
|
+
"ChatSuggestionRenderProp",
|
|
237
|
+
"Attachments",
|
|
238
|
+
"AttachmentsProp",
|
|
239
|
+
"AttachmentsProps",
|
|
240
|
+
"AttachmentsItemProp",
|
|
241
|
+
"AttachmentsPlaceholderProp",
|
|
242
|
+
"AttachmentsOverflowProp",
|
|
243
|
+
"AttachmentsRefProp",
|
|
244
|
+
]),
|
|
245
|
+
...move(UI("navigation"), "@godxjp/chat", [
|
|
246
|
+
"Conversations",
|
|
247
|
+
"ConversationsProp",
|
|
248
|
+
"ConversationsProps",
|
|
249
|
+
"ConversationsItemProp",
|
|
250
|
+
"ConversationsDividerProp",
|
|
251
|
+
"ConversationsEntryProp",
|
|
252
|
+
"ConversationsMenuProp",
|
|
253
|
+
"ConversationsMenuItemProp",
|
|
254
|
+
"ConversationsGroupableProp",
|
|
255
|
+
"ConversationsCreationProp",
|
|
256
|
+
]),
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
/** Removed with no replacement: reported, never rewritten. */
|
|
260
|
+
export const REMOVED = {
|
|
261
|
+
BannerProp: 'use AlertProp with variant="banner"',
|
|
262
|
+
BannerProps: 'use AlertProp with variant="banner"',
|
|
263
|
+
CalloutProp: 'use AlertProp with variant="callout"',
|
|
264
|
+
CalloutProps: 'use AlertProp with variant="callout"',
|
|
265
|
+
ThumbnailProp: 'use ImageProp with fit="intrinsic"',
|
|
266
|
+
ThumbnailProps: 'use ImageProp with fit="intrinsic"',
|
|
267
|
+
ThumbnailSizeProp: "use Image width/height",
|
|
268
|
+
TagInputProps: 'use the Select props (mode="tags")',
|
|
269
|
+
SpaceCompactProp: "use FlexProp with attached",
|
|
270
|
+
SpaceCompactProps: "use FlexProp with attached",
|
|
271
|
+
TypographyProp: "use the Prose props",
|
|
272
|
+
TypographyProps: "use the Prose props",
|
|
273
|
+
TypographyTitleProp: "use HeadingProp",
|
|
274
|
+
TitleProps: "use HeadingProp",
|
|
275
|
+
ParagraphProp: 'use TextProp with as="p"',
|
|
276
|
+
ParagraphProps: 'use TextProp with as="p"',
|
|
277
|
+
SkeletonButtonProp: "use a sized Skeleton",
|
|
278
|
+
SkeletonButtonProps: "use a sized Skeleton",
|
|
279
|
+
SkeletonNodeProp: "use a sized Skeleton",
|
|
280
|
+
SkeletonNodeProps: "use a sized Skeleton",
|
|
281
|
+
SkeletonImageProp: "use a sized Skeleton",
|
|
282
|
+
SkeletonImageProps: "use a sized Skeleton",
|
|
283
|
+
SkeletonAvatar: "use SkeletonArticle avatar, or a sized Skeleton",
|
|
284
|
+
SkeletonButton: "use a sized Skeleton",
|
|
285
|
+
SkeletonImage: "use a sized Skeleton",
|
|
286
|
+
SkeletonNode: "use a sized Skeleton",
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const SKIP_DIRS = new Set([
|
|
290
|
+
"node_modules",
|
|
291
|
+
"dist",
|
|
292
|
+
"build",
|
|
293
|
+
"vendor",
|
|
294
|
+
".git",
|
|
295
|
+
"public",
|
|
296
|
+
"coverage",
|
|
297
|
+
]);
|
|
298
|
+
const CODE = /\.(tsx?|jsx?|mjs|cjs)$/;
|
|
299
|
+
const STYLE_IMPORT_CSS = /^([ \t]*)@import\s+(["'])@godxjp\/ui\/styles\2\s*;[ \t]*$/m;
|
|
300
|
+
const STYLE_IMPORT_JS = /^([ \t]*)import\s+(["'])@godxjp\/ui\/styles\2\s*;?[ \t]*$/m;
|
|
301
|
+
const FONTS = "@godxjp/ui/styles/fonts.css";
|
|
302
|
+
const GODX_CSS = "@godxjp/ui/themes/godx.css";
|
|
303
|
+
|
|
304
|
+
export function transformSource(file, source, { godx = false } = {}) {
|
|
305
|
+
let out = source;
|
|
306
|
+
const notes = [];
|
|
307
|
+
const isCss = file.endsWith(".css");
|
|
308
|
+
const styleImport = isCss ? STYLE_IMPORT_CSS : STYLE_IMPORT_JS;
|
|
309
|
+
const m = out.match(styleImport);
|
|
310
|
+
if (m) {
|
|
311
|
+
const [line, indent, q] = m;
|
|
312
|
+
const add = [];
|
|
313
|
+
if (!out.includes(FONTS) && !out.includes("@godxjp/ui/styles/fonts")) add.push(FONTS);
|
|
314
|
+
if (godx && !out.includes(GODX_CSS)) add.push(GODX_CSS);
|
|
315
|
+
if (add.length) {
|
|
316
|
+
const extra = add
|
|
317
|
+
.map((spec) =>
|
|
318
|
+
isCss ? `${indent}@import ${q}${spec}${q};` : `${indent}import ${q}${spec}${q};`,
|
|
319
|
+
)
|
|
320
|
+
.join("\n");
|
|
321
|
+
out = out.replace(line, `${line}\n${extra}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (!isCss && /<AppProvider\b/.test(out)) {
|
|
325
|
+
const tags = out.match(/<AppProvider\b[^>]*>/g) ?? [];
|
|
326
|
+
for (const tag of tags) {
|
|
327
|
+
if (/\bpreset=/.test(tag)) continue;
|
|
328
|
+
if (godx) {
|
|
329
|
+
out = out.replace(tag, tag.replace(/^<AppProvider\b/, "<AppProvider preset={godxPreset}"));
|
|
330
|
+
} else if (!/\bdefaultLocale=/.test(tag)) {
|
|
331
|
+
notes.push(
|
|
332
|
+
"<AppProvider> has no defaultLocale and no preset: v32 starts in <html lang> or en (was vi). " +
|
|
333
|
+
'Add defaultLocale="vi" if that is what you meant, or rerun with --godx.',
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (
|
|
338
|
+
godx &&
|
|
339
|
+
out.includes("preset={godxPreset}") &&
|
|
340
|
+
!/\bgodxPreset\b[^\n]*from\s+["']@godxjp\/ui\/themes\/godx["']/.test(out)
|
|
341
|
+
) {
|
|
342
|
+
out = addImport(out, 'import { godxPreset } from "@godxjp/ui/themes/godx";');
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (!isCss) out = applyRenames(out, notes);
|
|
346
|
+
if (!isCss) out = narrowLocaleType(out, notes, godx);
|
|
347
|
+
return { out, changed: out !== source, notes };
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const IMPORT_RE =
|
|
351
|
+
/import\s*(type\s+)?\{([^}]*)\}\s*from\s*(["'])(@godxjp\/[\w-]+(?:\/[\w-]+)?)\3\s*;?/g;
|
|
352
|
+
|
|
353
|
+
function applyRenames(source, notes) {
|
|
354
|
+
let out = source;
|
|
355
|
+
const moved = new Map(); // toMod -> [{ spec, typeOnly }]
|
|
356
|
+
const jsxRenames = [];
|
|
357
|
+
out = out.replace(IMPORT_RE, (stmt, typeKw, body, q, mod) => {
|
|
358
|
+
const keep = [];
|
|
359
|
+
let touched = false;
|
|
360
|
+
for (const raw of body
|
|
361
|
+
.split(",")
|
|
362
|
+
.map((x) => x.trim())
|
|
363
|
+
.filter(Boolean)) {
|
|
364
|
+
const inlineType = raw.startsWith("type ");
|
|
365
|
+
const spec = raw.replace(/^type\s+/, "");
|
|
366
|
+
const [name, alias] = spec.split(/\s+as\s+/);
|
|
367
|
+
const removed = REMOVED[name];
|
|
368
|
+
if (removed && mod.startsWith("@godxjp/ui"))
|
|
369
|
+
notes.push(`${name} was removed in v32: ${removed}`);
|
|
370
|
+
const r = RENAMES.find((x) => x.from[1] === name && x.from[0].includes(mod));
|
|
371
|
+
if (!r) {
|
|
372
|
+
keep.push(raw);
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
touched = true;
|
|
376
|
+
const [toMod, toName] = r.to;
|
|
377
|
+
const newSpec = alias ? `${toName} as ${alias}` : toName;
|
|
378
|
+
const list = moved.get(toMod) ?? [];
|
|
379
|
+
list.push({ spec: newSpec, typeOnly: Boolean(typeKw) || inlineType });
|
|
380
|
+
moved.set(toMod, list);
|
|
381
|
+
if (!alias && (toName !== name || r.add || r.map)) jsxRenames.push([name, toName, r]);
|
|
382
|
+
if (r.note) notes.push(`${name} → ${toName}${toMod !== mod ? ` (${toMod})` : ""}: ${r.note}`);
|
|
383
|
+
}
|
|
384
|
+
if (!touched) return stmt;
|
|
385
|
+
return keep.length ? `import ${typeKw ?? ""}{ ${keep.join(", ")} } from ${q}${mod}${q};` : "";
|
|
386
|
+
});
|
|
387
|
+
for (const [from, to, r] of jsxRenames) {
|
|
388
|
+
// Opening tags first, so the props the merge needs land on the element itself.
|
|
389
|
+
out = out.replace(
|
|
390
|
+
new RegExp(`<${from}(?=[\\s>/])([^>]*?)(/?)>`, "g"),
|
|
391
|
+
(_all, attrs, selfClose) => {
|
|
392
|
+
let a = attrs;
|
|
393
|
+
for (const [prop, values] of Object.entries(r.map ?? {})) {
|
|
394
|
+
for (const [oldValue, newValue] of Object.entries(values)) {
|
|
395
|
+
a = a.replace(new RegExp(`\\b${prop}=(["'])${oldValue}\\1`), `${prop}="${newValue}"`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
for (const [prop, value] of Object.entries(r.add ?? {})) {
|
|
399
|
+
if (new RegExp(`(^|\\s)${prop}(=|\\s|$)`).test(a)) continue;
|
|
400
|
+
const written =
|
|
401
|
+
value === true
|
|
402
|
+
? prop
|
|
403
|
+
: String(value).startsWith("{")
|
|
404
|
+
? `${prop}=${value}`
|
|
405
|
+
: `${prop}="${value}"`;
|
|
406
|
+
a = ` ${written}${a}`;
|
|
407
|
+
}
|
|
408
|
+
return `<${to}${a}${selfClose}>`;
|
|
409
|
+
},
|
|
410
|
+
);
|
|
411
|
+
// Closing tags and compound members (`</Callout>`, `<Callout.Title>`).
|
|
412
|
+
out = out.replace(new RegExp(`(</|<)${from}(?=[.>])`, "g"), `$1${to}`);
|
|
413
|
+
}
|
|
414
|
+
for (const [toMod, specs] of moved) {
|
|
415
|
+
for (const typeOnly of [false, true]) {
|
|
416
|
+
const names = specs.filter((x) => x.typeOnly === typeOnly).map((x) => x.spec);
|
|
417
|
+
if (!names.length) continue;
|
|
418
|
+
const existing = new RegExp(
|
|
419
|
+
`import\\s*${typeOnly ? "type\\s+" : ""}\\{([^}]*)\\}\\s*from\\s*(["'])${toMod.replace(/[/]/g, "\\/")}\\2\\s*;?`,
|
|
420
|
+
);
|
|
421
|
+
const m = out.match(existing);
|
|
422
|
+
if (m) {
|
|
423
|
+
const have = m[1]
|
|
424
|
+
.split(",")
|
|
425
|
+
.map((x) => x.trim())
|
|
426
|
+
.filter(Boolean);
|
|
427
|
+
const merged = [...new Set([...have, ...names])];
|
|
428
|
+
out = out.replace(
|
|
429
|
+
m[0],
|
|
430
|
+
`import ${typeOnly ? "type " : ""}{ ${merged.join(", ")} } from ${m[2]}${toMod}${m[2]};`,
|
|
431
|
+
);
|
|
432
|
+
} else {
|
|
433
|
+
out = addImport(
|
|
434
|
+
out,
|
|
435
|
+
`import ${typeOnly ? "type " : ""}{ ${[...new Set(names)].join(", ")} } from "${toMod}";`,
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return out.replace(/\n{3,}/g, "\n\n");
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* gh#1219: `AppLocale` widened from "vi" | "en" | "ja" to any BCP-47 string; the old union is now
|
|
445
|
+
* `BuiltInLocale`. Code that indexes a { ja, en, vi } copy table with an AppLocale stops compiling.
|
|
446
|
+
* A GoDX product only uses the built-ins, so under --godx the type is renamed (behaviour unchanged).
|
|
447
|
+
* Otherwise it is reported: the app decides whether it will register other locales.
|
|
448
|
+
*/
|
|
449
|
+
function narrowLocaleType(source, notes, godx) {
|
|
450
|
+
const imp = source.match(
|
|
451
|
+
/import\s*(type\s+)?\{[^}]*\bAppLocale\b[^}]*\}\s*from\s*["']@godxjp\/ui(?:\/app)?["']/,
|
|
452
|
+
);
|
|
453
|
+
if (!imp) return source;
|
|
454
|
+
if (!godx) {
|
|
455
|
+
notes.push(
|
|
456
|
+
"AppLocale is any BCP-47 string since v32; indexing a { ja, en, vi } table with it no longer type-checks. Use BuiltInLocale for such tables, or rerun with --godx.",
|
|
457
|
+
);
|
|
458
|
+
return source;
|
|
459
|
+
}
|
|
460
|
+
return source.replace(/\bAppLocale\b/g, "BuiltInLocale");
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function addImport(source, line) {
|
|
464
|
+
const imports = [...source.matchAll(/^import[^;]*;[ \t]*$/gm)];
|
|
465
|
+
if (!imports.length) return `${line}\n${source}`;
|
|
466
|
+
const last = imports[imports.length - 1];
|
|
467
|
+
const at = last.index + last[0].length;
|
|
468
|
+
return `${source.slice(0, at)}\n${line}${source.slice(at)}`;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function* walk(target) {
|
|
472
|
+
const st = statSync(target);
|
|
473
|
+
if (st.isFile()) {
|
|
474
|
+
yield target;
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
for (const entry of readdirSync(target)) {
|
|
478
|
+
if (SKIP_DIRS.has(entry)) continue;
|
|
479
|
+
const full = path.join(target, entry);
|
|
480
|
+
const s = statSync(full);
|
|
481
|
+
if (s.isDirectory()) yield* walk(full);
|
|
482
|
+
else if (CODE.test(entry) || entry.endsWith(".css")) yield full;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export function run(argv) {
|
|
487
|
+
const [version, ...rest] = argv;
|
|
488
|
+
if (version !== "v32") {
|
|
489
|
+
console.error("usage: godxjp-ui codemod v32 [paths…] [--godx] [--dry-run]");
|
|
490
|
+
return 2;
|
|
491
|
+
}
|
|
492
|
+
const godx = rest.includes("--godx");
|
|
493
|
+
const dryRun = rest.includes("--dry-run");
|
|
494
|
+
const targets = rest.filter((a) => !a.startsWith("--"));
|
|
495
|
+
const roots = targets.length ? targets : ["."];
|
|
496
|
+
let changed = 0;
|
|
497
|
+
const report = [];
|
|
498
|
+
for (const root of roots) {
|
|
499
|
+
if (!existsSync(root)) {
|
|
500
|
+
console.error(`✗ ${root} does not exist`);
|
|
501
|
+
return 2;
|
|
502
|
+
}
|
|
503
|
+
for (const file of walk(root)) {
|
|
504
|
+
const source = readFileSync(file, "utf8");
|
|
505
|
+
if (!source.includes("@godxjp/")) continue;
|
|
506
|
+
const { out, changed: did, notes } = transformSource(file, source, { godx });
|
|
507
|
+
if (did) {
|
|
508
|
+
changed += 1;
|
|
509
|
+
report.push(`${dryRun ? "would change" : "changed"} ${file}`);
|
|
510
|
+
if (!dryRun) writeFileSync(file, out);
|
|
511
|
+
}
|
|
512
|
+
for (const n of notes) report.push(`note ${file}: ${n}`);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
for (const line of report) console.log(line);
|
|
516
|
+
console.log(
|
|
517
|
+
`${dryRun ? "dry run: " : ""}${changed} file(s) ${dryRun ? "would change" : "changed"}.`,
|
|
518
|
+
);
|
|
519
|
+
return 0;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (import.meta.url === `file://${process.argv[1]}`) process.exit(run(process.argv.slice(2)));
|
package/scripts/consumer-rule.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @godxjp/ui
|
|
2
2
|
|
|
3
|
-
> **Tệp này do gói `@godxjp/ui` sở hữu.**
|
|
4
|
-
>
|
|
5
|
-
>
|
|
3
|
+
> **Tệp này do gói `@godxjp/ui` sở hữu.** Cài gói không tự ghi gì cả: nội dung chỉ được ghi lại
|
|
4
|
+
> khi bạn chạy `npx godxjp-ui sync-rules` (thêm `--dry-run` để xem trước). Chạy lại sau mỗi lần
|
|
5
|
+
> nâng cấp. Dấu `<!-- godxjp-ui:version -->` luôn được đồng bộ với phiên bản
|
|
6
6
|
> gói đang cài — kể cả khi thân tệp không đổi giữa hai bản.
|
|
7
7
|
> Đừng sửa ở đây — luật của riêng kho thuộc về một tệp khác trong `.ai/rules/`,
|
|
8
8
|
> và index sẽ nạp cả hai. (Khác với `.claude/skills/.../SKILL.md`, nơi mục §8
|
|
@@ -12,50 +12,28 @@
|
|
|
12
12
|
`docs/CONSUMER-RULES.md` (10 luật) và, với kho chuột bạch, ở
|
|
13
13
|
`.claude/skills/godx-ui-guinea-pig/SKILL.md`.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Loading styles: one entry, fonts are opt-in
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import "@godxjp/ui/styles.css"; // precompiled, no Tailwind needed
|
|
19
|
+
```
|
|
16
20
|
|
|
17
21
|
```css
|
|
18
|
-
@import "@godxjp/ui/styles"; /*
|
|
19
|
-
@import "@godxjp/ui/styles/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
@import "@godxjp/ui/styles"; /* Tailwind v4: every component layer, NO font files */
|
|
23
|
+
@import "@godxjp/ui/styles/fonts.css"; /* optional, after the styles import: the bundled faces */
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Since v32 the styles entry no longer bundles fonts. A Japanese app that wants the bundled faces
|
|
27
|
+
installs them and adds the fonts import (the GoDX preset does both for you):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add @fontsource/noto-sans-jp @fontsource/m-plus-2
|
|
22
31
|
```
|
|
23
32
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Lối thứ ba dành cho kho **tự cấp Noto Sans JP** (next/font, self-host) mà vẫn muốn cửa
|
|
30
|
-
sổ swap không đội hình: nó chở đúng 6 `@font-face` metric-matched, `src` toàn `local()`
|
|
31
|
-
nên **không tải byte nào**. Nhớ tự xếp tên họ chữ ngay sau mặt chữ của bạn:
|
|
32
|
-
`--font-sans-base: "Noto Sans JP", "Noto Sans JP Fallback", system-ui, sans-serif;`
|
|
33
|
-
|
|
34
|
-
Lối thứ tư dành cho **app tiếng Nhật vẫn muốn font kèm gói**, nhưng không muốn trả số
|
|
35
|
-
vòng tải mỗi lần chuyển màn: nó thay 729 lát bằng **một tệp gộp cho mỗi weight**, phủ
|
|
36
|
-
JIS X 0208 mức 1 (2965 kanji + kana + ký hiệu + Latin + tiếng Việt, 3861 code point).
|
|
37
|
-
Đo trên ba weight, chỉ Noto Sans JP:
|
|
38
|
-
|
|
39
|
-
| số ký tự Nhật khác nhau trên màn | `styles` | `core-with-jis-level1` |
|
|
40
|
-
| -------------------------------- | ---------------------------- | -------------------------- |
|
|
41
|
-
| 448 (nhãn `ja` của chính gói) | 99 request · 1.051.268 byte | 3 request · 1.534.636 byte |
|
|
42
|
-
| 694 (nhãn + tên, địa chỉ, câu) | 150 request · 1.772.728 byte | 3 request · 1.534.636 byte |
|
|
43
|
-
| 772 (thêm chút văn xuôi) | 216 request · 3.491.840 byte | 3 request · 1.534.636 byte |
|
|
44
|
-
|
|
45
|
-
Cột trái phình theo NỘI DUNG và phải trả lại ở mỗi màn có ký tự mới; cột phải không đổi.
|
|
46
|
-
**Dưới khoảng 620 ký tự khác nhau thì cắt lát ít byte hơn** (đổi bằng ~100 request), nên
|
|
47
|
-
app nào render ít chữ Nhật hơn cả menu của gói này thì cứ ở `styles`. Lối này KHÔNG chở
|
|
48
|
-
JIS mức 2 — kanji trong họ tên hiếm sẽ rơi xuống mặt chữ của hệ điều hành, nên hãy xếp
|
|
49
|
-
một mặt chữ Nhật của hệ ngay sau mặt chữ của gói. Nó cũng không đụng `--font-sans-base`,
|
|
50
|
-
y như lối thứ ba.
|
|
51
|
-
|
|
52
|
-
`core` giữ `@font-face` = **0** và đó là lời hứa đo được —
|
|
53
|
-
`grep -c '@font-face' node_modules/@godxjp/ui/dist/styles/core.css` → `0`. Vì vậy các
|
|
54
|
-
fallback nằm ở entry riêng chứ không nhét vào `core`.
|
|
55
|
-
|
|
56
|
-
Không lối nào trong bốn là cherry-pick: cả bốn đều được hỗ trợ và thứ tự layer vẫn
|
|
57
|
-
nguyên vẹn. Cherry-pick từng layer riêng lẻ thì vẫn cấm — đó là thứ làm vỡ hợp đồng thứ
|
|
58
|
-
tự, không phải việc chọn lối vào.
|
|
33
|
+
An app that supplies its own face (next/font, self-host, a system stack) skips the fonts import and
|
|
34
|
+
names its face with `--font-sans-base`. Never cherry-pick individual `*-layout.css` layers: that
|
|
35
|
+
breaks the layer-order contract, which is not the same thing as choosing an entry point. Reasons
|
|
36
|
+
and measurements are in `docs/CUSTOMER-THEMING.md`.
|
|
59
37
|
|
|
60
38
|
## Bố cục chuẩn của platform: BA CỘT, và ba cột là BA PHẠM VI
|
|
61
39
|
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -1,56 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Inert install (#1215): this script writes NOTHING into the consumer project. Agent files
|
|
4
|
+
* (.mcp.json, CLAUDE.md block, .claude/godxjp-ui-workflow.md, .ai/rules/godxjp-ui.md) are written
|
|
5
|
+
* only by the explicit `npx godxjp-ui sync-rules` (see `runSyncRules` in _agent-setup.mjs).
|
|
6
|
+
* Silent in CI, when opted out, and when installing the library itself.
|
|
6
7
|
*/
|
|
7
|
-
import {
|
|
8
|
-
ensureClaudeMd,
|
|
9
|
-
ensureMcpJson,
|
|
10
|
-
ensureConsumerRules,
|
|
11
|
-
outOfProjectUiMcpReport,
|
|
12
|
-
refreshGuineaPigSkill,
|
|
13
|
-
shouldSkip,
|
|
14
|
-
writeWorkflowMd,
|
|
15
|
-
} from "./_agent-setup.mjs";
|
|
16
|
-
|
|
17
|
-
const root = process.env.INIT_CWD || process.cwd();
|
|
18
|
-
|
|
19
|
-
const skip = shouldSkip(root);
|
|
20
|
-
if (skip) process.exit(0); // silent: CI / opt-out / self-install / no consumer project
|
|
8
|
+
import { shouldSkip } from "./_agent-setup.mjs";
|
|
21
9
|
|
|
22
10
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
console.log(`\n @godxjp/ui → .mcp.json ${r}\n`);
|
|
28
|
-
}
|
|
29
|
-
// A registration outside the project is reported whatever the project file says, before any of
|
|
30
|
-
// the quiet exits below: it is live beside ours and nothing here will ever change it (gh#722).
|
|
31
|
-
const outside = outOfProjectUiMcpReport(root);
|
|
32
|
-
if (outside) console.log(outside);
|
|
33
|
-
// The mandate is plain text the agent reads every turn (CLAUDE.md block + workflow file). It
|
|
34
|
-
// changes nothing in the dev loop, so it is installed by default: an agent that never saw the
|
|
35
|
-
// but no mandate). Only the hooks — which DO change the loop — stay behind `init-agent`.
|
|
36
|
-
const md = ensureClaudeMd(root);
|
|
37
|
-
if (md.startsWith("left untouched")) {
|
|
38
|
-
console.log(` @godxjp/ui → CLAUDE.md ${md}\n`);
|
|
11
|
+
if (!shouldSkip(process.env.INIT_CWD || process.cwd())) {
|
|
12
|
+
console.log(
|
|
13
|
+
"\n @godxjp/ui: agent files are not written on install. Run `npx godxjp-ui sync-rules` to set them up (add --dry-run to preview).\n",
|
|
14
|
+
);
|
|
39
15
|
}
|
|
40
|
-
const wf = writeWorkflowMd(root);
|
|
41
|
-
const skill = refreshGuineaPigSkill(root);
|
|
42
|
-
const rules = ensureConsumerRules(root);
|
|
43
|
-
if (r.startsWith("left untouched") || md.startsWith("left untouched")) process.exit(0); // already reported
|
|
44
|
-
if (r === "present" && md === "present" && !wf && !skill && !rules) process.exit(0); // current — stay quiet
|
|
45
|
-
console.log(
|
|
46
|
-
`\n @godxjp/ui → MCP in .mcp.json (${r}); workflow mandate in CLAUDE.md (${md}).\n` +
|
|
47
|
-
(rules ? ` common consumer rules in .ai/rules/godxjp-ui.md (glob ${rules}/**).\n` : "") +
|
|
48
|
-
(skill ? " guinea-pig skill refreshed to this version (your section 8 kept).\n" : "") +
|
|
49
|
-
" Your agent now has live component + audit guidance. Restart it to pick up the MCP.\n" +
|
|
50
|
-
" For auto-audit on every edit (PostToolUse + SessionStart hooks):\n" +
|
|
51
|
-
" npx @godxjp/ui init-agent\n",
|
|
52
|
-
);
|
|
53
16
|
} catch {
|
|
54
|
-
// Never fail an install over optional
|
|
17
|
+
// Never fail an install over an optional hint.
|
|
55
18
|
}
|
|
56
19
|
process.exit(0);
|