@astryxdesign/cli 0.7.17-canary.gffd1c8e → 0.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1877 -0
- package/README.md +90 -85
- package/api/build/_adapter.d.mts +51 -0
- package/api/build/_adapter.mjs +133 -8
- package/api/build/build.doc.mjs +3 -3
- package/api/build/build.mjs +1 -1
- package/api/build/build.type.d.mts +1 -1
- package/api/build/build.type.mjs +2 -2
- package/api/build/help/help.d.mts +15 -14
- package/api/build/help/help.mjs +65 -6
- package/api/build/kit/kit.mjs +1 -1
- package/api/build/kit/start.mjs +1 -1
- package/api/component/_adapter.d.mts +28 -4
- package/api/component/_adapter.mjs +79 -45
- package/api/component/component.d.mts +1 -1
- package/api/component/component.mjs +18 -7
- package/api/component/detail/blocks/blocks.mjs +1 -2
- package/api/component/detail/showcase/showcase.mjs +19 -8
- package/api/discover/_adapter.d.mts +68 -5
- package/api/discover/_adapter.mjs +311 -63
- package/api/discover/_catalog-view.d.mts +22 -0
- package/api/discover/_catalog-view.mjs +30 -1
- package/api/discover/_icon-set-coverage.d.mts +22 -0
- package/api/discover/_icon-set-coverage.mjs +32 -0
- package/api/discover/detail/detail.d.mts +6 -3
- package/api/discover/detail/detail.mjs +14 -6
- package/api/discover/detail/doc/doc.mjs +1 -1
- package/api/discover/detail/item/item.d.mts +11 -1
- package/api/discover/detail/item/item.mjs +29 -8
- package/api/discover/discover.d.mts +36 -0
- package/api/discover/discover.doc.mjs +1 -1
- package/api/discover/discover.mjs +205 -28
- package/api/discover/discover.type.d.mts +33 -7
- package/api/discover/discover.type.mjs +21 -7
- package/api/discover/search/search.d.mts +22 -0
- package/api/discover/search/search.mjs +293 -70
- package/api/docs/_adapter.d.mts +92 -1
- package/api/docs/_adapter.mjs +264 -14
- package/api/docs/docs.d.mts +4 -2
- package/api/docs/docs.doc.mjs +10 -0
- package/api/docs/docs.mjs +25 -5
- package/api/docs/docs.type.d.mts +48 -0
- package/api/docs/docs.type.mjs +26 -0
- package/api/docs/skills/skills.d.mts +51 -0
- package/api/docs/skills/skills.mjs +216 -0
- package/api/doctor/_adapter.d.mts +254 -9
- package/api/doctor/_adapter.mjs +1228 -50
- package/api/doctor/built-checks.d.mts +39 -3
- package/api/doctor/built-checks.mjs +203 -7
- package/api/doctor/doctor.d.mts +205 -4
- package/api/doctor/doctor.doc.mjs +4 -4
- package/api/doctor/doctor.mjs +962 -22
- package/api/doctor/doctor.type.d.mts +6 -1
- package/api/doctor/doctor.type.mjs +3 -1
- package/api/doctor/theme-checks.d.mts +20 -1
- package/api/doctor/theme-checks.mjs +280 -8
- package/api/error.d.mts +12 -1
- package/api/error.mjs +18 -6
- package/api/icon/_adapter.d.mts +11 -1
- package/api/icon/_adapter.mjs +22 -1
- package/api/icon/_authoring.mjs +21 -7
- package/api/icon/add/add.mjs +1 -1
- package/api/icon/definitions/definitions.mjs +19 -8
- package/api/icon/icon.doc.mjs +3 -3
- package/api/icon/icon.type.d.mts +49 -2
- package/api/icon/icon.type.mjs +23 -4
- package/api/icon/iconMap.doc.mjs +2 -2
- package/api/icon/list/list.mjs +4 -5
- package/api/icon/map/map.mjs +13 -4
- package/api/icon/search/icon-index.mjs +4 -1
- package/api/icon/search/search.d.mts +28 -7
- package/api/icon/search/search.mjs +177 -26
- package/api/init/_adapter.d.mts +87 -3
- package/api/init/_adapter.mjs +264 -16
- package/api/init/init.d.mts +2 -2
- package/api/init/init.doc.mjs +29 -5
- package/api/init/init.mjs +149 -10
- package/api/init/init.type.d.mts +75 -9
- package/api/init/init.type.mjs +32 -4
- package/api/init/remove/remove.d.mts +7 -4
- package/api/init/remove/remove.mjs +124 -26
- package/api/init/run/run.d.mts +38 -3
- package/api/init/run/run.mjs +366 -39
- package/api/integration/_adapter.d.mts +16 -0
- package/api/integration/_adapter.mjs +45 -1
- package/api/integration/integrationCheck.doc.mjs +1 -1
- package/api/integration/pack-check.d.mts +2 -1
- package/api/integration/pack-check.mjs +10 -18
- package/api/integration/validate-integration.d.mts +5 -2
- package/api/integration/validate-integration.mjs +81 -14
- package/api/integration/validate-integration.type.d.mts +9 -4
- package/api/integration/validate-integration.type.mjs +9 -4
- package/api/integration/validateIntegration.doc.mjs +4 -2
- package/api/render/_adapter.d.mts +6 -2
- package/api/render/_adapter.mjs +301 -51
- package/api/render/render.doc.d.mts +1 -1
- package/api/render/render.doc.mjs +20 -10
- package/api/render/render.mjs +16 -13
- package/api/render/render.type.d.mts +57 -10
- package/api/render/render.type.mjs +26 -13
- package/api/search/ORDERING.md +3 -3
- package/api/search/_adapter.d.mts +31 -0
- package/api/search/_adapter.mjs +107 -15
- package/api/search/_candidate-score.d.mts +12 -4
- package/api/search/_candidate-score.mjs +94 -16
- package/api/search/_cards.json +4 -1
- package/api/search/_entries.d.mts +8 -3
- package/api/search/_entries.mjs +109 -12
- package/api/search/_fit-order.d.mts +8 -4
- package/api/search/_fit-order.mjs +35 -7
- package/api/search/_gather-docs.mjs +71 -28
- package/api/search/_gather-templates.mjs +7 -2
- package/api/search/_icons.d.mts +50 -0
- package/api/search/_icons.mjs +85 -0
- package/api/search/_lexical.d.mts +14 -1
- package/api/search/_lexical.mjs +240 -12
- package/api/search/_main-searcher.mjs +1 -1
- package/api/search/_named-keywords.d.mts +6 -3
- package/api/search/_named-keywords.mjs +70 -19
- package/api/search/_order.d.mts +27 -12
- package/api/search/_order.mjs +132 -51
- package/api/search/_result.d.mts +30 -0
- package/api/search/_result.mjs +38 -0
- package/api/search/_score.d.mts +20 -6
- package/api/search/_score.mjs +96 -16
- package/api/search/_titles.d.mts +14 -0
- package/api/search/_titles.mjs +16 -3
- package/api/search/_words.d.mts +8 -0
- package/api/search/_words.mjs +26 -1
- package/api/search/search-index.mjs +23 -12
- package/api/search/search.d.mts +3 -1
- package/api/search/search.doc.mjs +5 -4
- package/api/search/search.mjs +69 -26
- package/api/search/search.type.d.mts +55 -1
- package/api/search/search.type.mjs +35 -1
- package/api/swizzle/_adapter.d.mts +1 -1
- package/api/swizzle/_adapter.mjs +1 -5
- package/api/swizzle/_moduleGraph.d.mts +0 -6
- package/api/swizzle/_moduleGraph.mjs +0 -12
- package/api/swizzle/copy/copy.mjs +1 -1
- package/api/template/_adapter.d.mts +46 -0
- package/api/template/_adapter.mjs +198 -2
- package/api/template/cdn/cdn.mjs +5 -3
- package/api/template/copy/copy.d.mts +12 -2
- package/api/template/copy/copy.mjs +95 -21
- package/api/template/list/list.mjs +1 -2
- package/api/template/show/show.d.mts +10 -3
- package/api/template/show/show.mjs +17 -6
- package/api/template/skeleton/skeleton.mjs +1 -2
- package/api/template/template.doc.mjs +3 -3
- package/api/template/template.mjs +37 -7
- package/api/template/template.type.d.mts +3 -0
- package/api/template/template.type.mjs +5 -2
- package/api/theme/_adapter.d.mts +28 -2
- package/api/theme/_adapter.mjs +675 -17
- package/api/theme/_app-provider.d.mts +42 -0
- package/api/theme/_app-provider.mjs +61 -27
- package/api/theme/_shared-source.d.mts +33 -0
- package/api/theme/_shared-source.mjs +348 -0
- package/api/theme/add/add.d.mts +3 -0
- package/api/theme/add/add.mjs +21 -4
- package/api/theme/build/build.d.mts +57 -30
- package/api/theme/build/build.mjs +403 -441
- package/api/theme/build/core-interception.d.mts +10 -0
- package/api/theme/build/core-interception.mjs +24 -0
- package/api/theme/build/family.mjs +4 -2
- package/api/theme/build/import-specifier.d.mts +14 -0
- package/api/theme/build/import-specifier.mjs +36 -0
- package/api/theme/build/null-values.d.mts +22 -0
- package/api/theme/build/null-values.mjs +110 -21
- package/api/theme/build/self-contained.mjs +32 -11
- package/api/theme/build/setting-effects.d.mts +254 -0
- package/api/theme/build/setting-effects.mjs +1065 -0
- package/api/theme/build/style-keys.d.mts +33 -0
- package/api/theme/build/style-keys.mjs +154 -0
- package/api/theme/build/theme-object.d.mts +47 -0
- package/api/theme/build/theme-object.mjs +144 -0
- package/api/theme/eject/eject.mjs +6 -1
- package/api/theme/palette/generate/color.d.mts +41 -9
- package/api/theme/palette/generate/color.mjs +108 -39
- package/api/theme/palette/generate/generate.mjs +10 -0
- package/api/theme/palette/generate/generator.d.mts +45 -27
- package/api/theme/palette/generate/generator.mjs +330 -156
- package/api/theme/palette/generate/mapping.d.mts +456 -0
- package/api/theme/palette/generate/mapping.mjs +1903 -0
- package/api/theme/palette/generate/newer-recipe.d.mts +28 -0
- package/api/theme/palette/generate/newer-recipe.mjs +87 -0
- package/api/theme/palette/generate/types.d.mts +270 -0
- package/api/theme/palette/generate/types.mjs +123 -0
- package/api/theme/theme.d.mts +25 -4
- package/api/theme/theme.mjs +55 -5
- package/api/theme/theme.type.d.mts +71 -2
- package/api/theme/theme.type.mjs +37 -5
- package/api/theme/themeAdd.doc.mjs +3 -2
- package/api/theme/themeBuild.doc.mjs +3 -3
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme/themeRemove.doc.mjs +1 -1
- package/api/theme/themeTargets.doc.mjs +1 -1
- package/api/theme-edit/_catalog.mjs +1 -1
- package/api/theme-edit/_check.mjs +129 -45
- package/api/theme-edit/_color.d.mts +2 -74
- package/api/theme-edit/_color.mjs +33 -869
- package/api/theme-edit/_context.d.mts +3 -1
- package/api/theme-edit/_context.mjs +16 -3
- package/api/theme-edit/_css.d.mts +4 -35
- package/api/theme-edit/_css.mjs +10 -91
- package/api/theme-edit/_edit.mjs +244 -32
- package/api/theme-edit/_how-question.d.mts +1 -0
- package/api/theme-edit/_how-question.mjs +1188 -52
- package/api/theme-edit/_how.mjs +19 -3
- package/api/theme-edit/_missed.d.mts +2 -1
- package/api/theme-edit/_missed.mjs +21 -2
- package/api/theme-edit/_normal.d.mts +5 -2
- package/api/theme-edit/_normal.mjs +11 -1
- package/api/theme-edit/_palette.d.mts +26 -75
- package/api/theme-edit/_palette.mjs +242 -1384
- package/api/theme-edit/_part-words.mjs +13 -3
- package/api/theme-edit/_parts.d.mts +8 -2
- package/api/theme-edit/_parts.mjs +56 -11
- package/api/theme-edit/_preview-app.d.mts +16 -0
- package/api/theme-edit/_preview-app.mjs +47 -15
- package/api/theme-edit/_preview.mjs +49 -22
- package/api/theme-edit/_project.d.mts +14 -2
- package/api/theme-edit/_project.mjs +25 -3
- package/api/theme-edit/_settings.d.mts +3 -2
- package/api/theme-edit/_settings.mjs +166 -45
- package/api/theme-edit/_tables.d.mts +3 -11
- package/api/theme-edit/_tables.mjs +21 -33
- package/api/theme-edit/theme-edit.type.d.mts +7 -1
- package/api/theme-edit/theme-edit.type.mjs +3 -2
- package/api/upgrade/_adapter.d.mts +38 -0
- package/api/upgrade/_adapter.mjs +274 -3
- package/api/upgrade/run/run.mjs +4 -0
- package/api/upgrade/upgrade.mjs +1 -1
- package/api/upgrade/upgrade.type.d.mts +46 -7
- package/api/upgrade/upgrade.type.mjs +24 -9
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/transforms/next/index.mjs +1 -11
- package/assets/codemods/transforms/v0.7.17/index.mjs +28 -0
- package/assets/codemods/transforms/v0.7.17/migrate-item-swipe-actions-to-swipe.mjs +2160 -0
- package/assets/codemods/transforms/v0.7.17/preserve-chat-radius.mjs +515 -0
- package/assets/component-list.generated.json +1 -1
- package/assets/discover/official-packages.json +72 -0
- package/assets/docs/author-a-theme.doc.mjs +7 -4
- package/assets/docs/getting-started.doc.mjs +1 -1
- package/assets/docs/principles.doc.dense.mjs +1 -1
- package/assets/docs/principles.doc.mjs +1 -1
- package/assets/docs/principles.doc.zh.mjs +1 -1
- package/assets/docs/styling-overview.doc.mjs +5 -1
- package/assets/docs/tree/agent-guidance.doc.mjs +33 -2
- package/assets/docs/tree/check-the-props.doc.mjs +1 -1
- package/assets/docs/tree/checks.doc.mjs +1 -1
- package/assets/docs/tree/computer-integrations.doc.mjs +1 -1
- package/assets/docs/tree/doc-syntax.doc.mjs +1 -1
- package/assets/docs/tree/export-pages.doc.mjs +164 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
- package/assets/docs/tree/host-entry.doc.mjs +4 -0
- package/assets/docs/tree/i18n-library-integration.doc.mjs +7 -3
- package/assets/docs/tree/icon-sets.doc.mjs +85 -9
- package/assets/docs/tree/layout.doc.mjs +16 -5
- package/assets/docs/tree/problems.doc.mjs +2 -2
- package/assets/docs/tree/responsive.doc.mjs +2 -2
- package/assets/docs/tree/scaffold.doc.mjs +1 -0
- package/assets/docs/tree/share-a-page.doc.mjs +14 -16
- package/assets/docs/tree/skill-places.doc.mjs +91 -0
- package/assets/docs/tree/styling.doc.mjs +41 -3
- package/assets/docs/tree/template-grading-rubric.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/tokens-and-setup.doc.mjs +2 -4
- package/assets/docs/tree/tokens-color.doc.mjs +2 -2
- package/assets/docs/tree/tokens-radius.doc.mjs +1 -1
- package/assets/docs/tree/tokens.doc.mjs +32 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
- package/assets/docs/tree/typography.doc.mjs +31 -2
- package/assets/docs/use-a-theme.doc.mjs +4 -0
- package/assets/docs/working-with-ai.doc.mjs +4 -4
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/definitions/alert.doc.mjs +9 -0
- package/assets/icons/definitions/alignBottom.doc.mjs +1 -0
- package/assets/icons/definitions/alignCenter.doc.mjs +1 -0
- package/assets/icons/definitions/alignEnd.doc.mjs +1 -0
- package/assets/icons/definitions/alignJustify.doc.mjs +1 -0
- package/assets/icons/definitions/alignMiddle.doc.mjs +1 -0
- package/assets/icons/definitions/alignStart.doc.mjs +1 -0
- package/assets/icons/definitions/alignTop.doc.mjs +1 -0
- package/assets/icons/definitions/arrowDown.doc.mjs +1 -0
- package/assets/icons/definitions/arrowLeft.doc.mjs +1 -0
- package/assets/icons/definitions/arrowRight.doc.mjs +1 -0
- package/assets/icons/definitions/arrowUp.doc.mjs +1 -0
- package/assets/icons/definitions/arrowsUpDown.doc.mjs +1 -0
- package/assets/icons/definitions/bank.doc.mjs +1 -0
- package/assets/icons/definitions/block.doc.mjs +9 -0
- package/assets/icons/definitions/bold.doc.mjs +1 -0
- package/assets/icons/definitions/bookmark.doc.mjs +1 -0
- package/assets/icons/definitions/bookmarkAdd.doc.mjs +1 -0
- package/assets/icons/definitions/cart.doc.mjs +1 -0
- package/assets/icons/definitions/channel.doc.mjs +9 -0
- package/assets/icons/definitions/check.doc.mjs +1 -0
- package/assets/icons/definitions/checkDouble.doc.mjs +1 -0
- package/assets/icons/definitions/checklist.doc.mjs +9 -0
- package/assets/icons/definitions/chevronDown.doc.mjs +1 -0
- package/assets/icons/definitions/chevronLeft.doc.mjs +1 -0
- package/assets/icons/definitions/chevronRight.doc.mjs +1 -0
- package/assets/icons/definitions/chevronUp.doc.mjs +1 -0
- package/assets/icons/definitions/chevronsLeft.doc.mjs +1 -0
- package/assets/icons/definitions/chevronsRight.doc.mjs +1 -0
- package/assets/icons/definitions/clipboard.doc.mjs +1 -0
- package/assets/icons/definitions/cloud.doc.mjs +1 -1
- package/assets/icons/definitions/collapse.doc.mjs +1 -0
- package/assets/icons/definitions/columnSettings.doc.mjs +9 -0
- package/assets/icons/definitions/compose.doc.mjs +1 -0
- package/assets/icons/definitions/conversation.doc.mjs +1 -0
- package/assets/icons/definitions/copy.doc.mjs +1 -0
- package/assets/icons/definitions/copyText.doc.mjs +9 -0
- package/assets/icons/definitions/cornerRadius.doc.mjs +1 -0
- package/assets/icons/definitions/create.doc.mjs +9 -0
- package/assets/icons/definitions/creditCard.doc.mjs +1 -0
- package/assets/icons/definitions/currency.doc.mjs +9 -0
- package/assets/icons/definitions/cut.doc.mjs +1 -0
- package/assets/icons/definitions/desktop.doc.mjs +1 -0
- package/assets/icons/definitions/discount.doc.mjs +1 -0
- package/assets/icons/definitions/document.doc.mjs +1 -0
- package/assets/icons/definitions/documentSearch.doc.mjs +1 -0
- package/assets/icons/definitions/download.doc.mjs +1 -0
- package/assets/icons/definitions/error.doc.mjs +1 -0
- package/assets/icons/definitions/exitFullScreen.doc.mjs +16 -0
- package/assets/icons/definitions/expand.doc.mjs +1 -0
- package/assets/icons/definitions/eye.doc.mjs +1 -0
- package/assets/icons/definitions/eyeSlash.doc.mjs +1 -0
- package/assets/icons/definitions/file.doc.mjs +1 -0
- package/assets/icons/definitions/flipHorizontal.doc.mjs +1 -0
- package/assets/icons/definitions/flipVertical.doc.mjs +1 -0
- package/assets/icons/definitions/folder.doc.mjs +1 -0
- package/assets/icons/definitions/folderAdd.doc.mjs +1 -0
- package/assets/icons/definitions/fullScreen.doc.mjs +16 -0
- package/assets/icons/definitions/globe.doc.mjs +1 -1
- package/assets/icons/definitions/groupRows.doc.mjs +9 -0
- package/assets/icons/definitions/halftone.doc.mjs +9 -0
- package/assets/icons/definitions/help.doc.mjs +9 -0
- package/assets/icons/definitions/house.doc.mjs +9 -0
- package/assets/icons/definitions/info.doc.mjs +1 -0
- package/assets/icons/definitions/italic.doc.mjs +1 -0
- package/assets/icons/definitions/listView.doc.mjs +9 -0
- package/assets/icons/definitions/lock.doc.mjs +1 -0
- package/assets/icons/definitions/lowercase.doc.mjs +1 -0
- package/assets/icons/definitions/mail.doc.mjs +1 -1
- package/assets/icons/definitions/media.doc.mjs +9 -0
- package/assets/icons/definitions/message.doc.mjs +2 -1
- package/assets/icons/definitions/mobile.doc.mjs +1 -0
- package/assets/icons/definitions/money.doc.mjs +1 -0
- package/assets/icons/definitions/moon.doc.mjs +1 -0
- package/assets/icons/definitions/moveToFolder.doc.mjs +9 -0
- package/assets/icons/definitions/notification.doc.mjs +1 -0
- package/assets/icons/definitions/notificationActive.doc.mjs +1 -0
- package/assets/icons/definitions/notificationOff.doc.mjs +1 -0
- package/assets/icons/definitions/paddingHorizontal.doc.mjs +1 -0
- package/assets/icons/definitions/paddingPerSide.doc.mjs +1 -0
- package/assets/icons/definitions/paddingVertical.doc.mjs +1 -0
- package/assets/icons/definitions/panelBottom.doc.mjs +1 -0
- package/assets/icons/definitions/panelLeft.doc.mjs +1 -0
- package/assets/icons/definitions/panelRight.doc.mjs +1 -0
- package/assets/icons/definitions/paste.doc.mjs +9 -0
- package/assets/icons/definitions/pause.doc.mjs +1 -0
- package/assets/icons/definitions/play.doc.mjs +1 -0
- package/assets/icons/definitions/radiusPerCorner.doc.mjs +1 -0
- package/assets/icons/definitions/redo.doc.mjs +1 -0
- package/assets/icons/definitions/review.doc.mjs +9 -0
- package/assets/icons/definitions/rotate.doc.mjs +1 -0
- package/assets/icons/definitions/rotateCounterclockwise.doc.mjs +1 -0
- package/assets/icons/definitions/scale.doc.mjs +1 -2
- package/assets/icons/definitions/schedule.doc.mjs +9 -0
- package/assets/icons/definitions/search.doc.mjs +1 -0
- package/assets/icons/definitions/send.doc.mjs +1 -0
- package/assets/icons/definitions/shoppingBag.doc.mjs +1 -0
- package/assets/icons/definitions/signal.doc.mjs +9 -0
- package/assets/icons/definitions/stop.doc.mjs +1 -0
- package/assets/icons/definitions/strikethrough.doc.mjs +1 -0
- package/assets/icons/definitions/success.doc.mjs +1 -0
- package/assets/icons/definitions/sun.doc.mjs +1 -0
- package/assets/icons/definitions/tablet.doc.mjs +1 -0
- package/assets/icons/definitions/team.doc.mjs +9 -0
- package/assets/icons/definitions/textCase.doc.mjs +2 -1
- package/assets/icons/definitions/textRegular.doc.mjs +1 -0
- package/assets/icons/definitions/thumbsDown.doc.mjs +1 -0
- package/assets/icons/definitions/thumbsUp.doc.mjs +1 -0
- package/assets/icons/definitions/transfer.doc.mjs +1 -0
- package/assets/icons/definitions/trendDown.doc.mjs +1 -0
- package/assets/icons/definitions/trendUp.doc.mjs +1 -0
- package/assets/icons/definitions/underline.doc.mjs +1 -0
- package/assets/icons/definitions/undo.doc.mjs +1 -0
- package/assets/icons/definitions/unlock.doc.mjs +1 -0
- package/assets/icons/definitions/upload.doc.mjs +1 -0
- package/assets/icons/definitions/uppercase.doc.mjs +1 -0
- package/assets/icons/definitions/user.doc.mjs +1 -0
- package/assets/icons/definitions/userAdd.doc.mjs +1 -0
- package/assets/icons/definitions/userCircle.doc.mjs +1 -0
- package/assets/icons/definitions/userRemove.doc.mjs +1 -0
- package/assets/icons/definitions/users.doc.mjs +1 -0
- package/assets/icons/definitions/verified.doc.mjs +9 -0
- package/assets/icons/definitions/wallet.doc.mjs +1 -0
- package/assets/icons/definitions/warning.doc.mjs +1 -0
- package/assets/icons/definitions/wrench.doc.mjs +1 -1
- package/assets/icons/template-icons.json +661 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/AppShell/AppShellShowcase.doc.mjs +0 -7
- package/assets/templates/blocks/components/AppShell/AppShellShowcase.tsx +8 -10
- package/assets/templates/blocks/components/AppShell/AppShellSideNavOnly.doc.mjs +0 -8
- package/assets/templates/blocks/components/AppShell/AppShellSideNavOnly.tsx +10 -8
- package/assets/templates/blocks/components/AppShell/AppShellTopNavOnly.doc.mjs +0 -1
- package/assets/templates/blocks/components/AppShell/AppShellTopNavOnly.tsx +4 -2
- package/assets/templates/blocks/components/AppShell/AppShellTopNavWithSideNav.doc.mjs +0 -8
- package/assets/templates/blocks/components/AppShell/AppShellTopNavWithSideNav.tsx +10 -8
- package/assets/templates/blocks/components/AppShell/AppShellWithBanner.doc.mjs +0 -8
- package/assets/templates/blocks/components/AppShell/AppShellWithBanner.tsx +10 -8
- package/assets/templates/blocks/components/AspectRatio/AspectRatioImageGallery.tsx +1 -1
- package/assets/templates/blocks/components/AspectRatio/AspectRatioWidescreen.tsx +1 -1
- package/assets/templates/blocks/components/AspectRatio/AspectRatioWithSkeleton.tsx +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
- package/assets/templates/blocks/components/Avatar/AvatarShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarTooltip.tsx +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarWithStatus.tsx +1 -1
- package/assets/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx +1 -1
- package/assets/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +1 -1
- package/assets/templates/blocks/components/Badge/BadgeShowcase.tsx +2 -2
- package/assets/templates/blocks/components/Banner/BannerCollapsibleContent.tsx +14 -1
- package/assets/templates/blocks/components/Banner/BannerSectionVariant.tsx +10 -1
- package/assets/templates/blocks/components/Banner/BannerWithActionButton.tsx +25 -3
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +0 -1
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +2 -2
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadMenu.doc.mjs +0 -1
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadMenu.tsx +1 -1
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.doc.mjs +0 -8
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.tsx +5 -5
- package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.doc.mjs +0 -1
- package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsDeepHierarchy.doc.mjs +0 -1
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsDeepHierarchy.tsx +1 -1
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsWithIcons.doc.mjs +0 -1
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsWithIcons.tsx +2 -2
- package/assets/templates/blocks/components/Button/ButtonFloating.doc.mjs +0 -1
- package/assets/templates/blocks/components/Button/ButtonFloating.tsx +25 -2
- package/assets/templates/blocks/components/Button/ButtonShowcase.tsx +42 -4
- package/assets/templates/blocks/components/Button/ButtonSizeVariants.tsx +24 -2
- package/assets/templates/blocks/components/Button/ButtonVariants.tsx +28 -1
- package/assets/templates/blocks/components/Button/ButtonWithEndSlot.tsx +9 -0
- package/assets/templates/blocks/components/Button/ButtonWithIcon.doc.mjs +0 -6
- package/assets/templates/blocks/components/Button/ButtonWithIcon.tsx +35 -9
- package/assets/templates/blocks/components/ButtonGroup/ButtonGroupBasic.tsx +20 -3
- package/assets/templates/blocks/components/ButtonGroup/ButtonGroupFloating.tsx +16 -3
- package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +0 -6
- package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.tsx +37 -8
- package/assets/templates/blocks/components/Center/CenterHorizontal.doc.mjs +0 -8
- package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +23 -5
- package/assets/templates/blocks/components/Center/CenterInsideACard.doc.mjs +0 -1
- package/assets/templates/blocks/components/Center/CenterInsideACard.tsx +1 -1
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +0 -5
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFlat.tsx +8 -3
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFooterActions.doc.mjs +0 -5
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFooterActions.tsx +8 -3
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.doc.mjs +0 -7
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.tsx +10 -7
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerShowcase.doc.mjs +0 -1
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerShowcase.tsx +2 -2
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.doc.mjs +0 -1
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.tsx +3 -3
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.doc.mjs +0 -6
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.tsx +9 -9
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.doc.mjs +0 -6
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.tsx +10 -10
- package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonCustomIcon.doc.mjs +0 -6
- package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonCustomIcon.tsx +8 -5
- package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonShowcase.doc.mjs +0 -1
- package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonShowcase.tsx +1 -1
- package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageStatusUpdates.doc.mjs +0 -5
- package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageStatusUpdates.tsx +7 -7
- package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageWithIcon.doc.mjs +0 -6
- package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageWithIcon.tsx +7 -7
- package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.doc.mjs +0 -6
- package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.tsx +7 -7
- package/assets/templates/blocks/components/DropdownMenu/DropdownMenuBottomSheet.doc.mjs +0 -6
- package/assets/templates/blocks/components/DropdownMenu/DropdownMenuBottomSheet.tsx +7 -7
- package/assets/templates/blocks/components/DropdownMenu/DropdownMenuNoChevron.doc.mjs +0 -1
- package/assets/templates/blocks/components/DropdownMenu/DropdownMenuNoChevron.tsx +2 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateActions.doc.mjs +0 -1
- package/assets/templates/blocks/components/EmptyState/EmptyStateActions.tsx +2 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.doc.mjs +0 -1
- package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.tsx +1 -1
- package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.doc.mjs +0 -1
- package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.tsx +2 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.doc.mjs +0 -1
- package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.tsx +2 -2
- package/assets/templates/blocks/components/Grid/GridShowcase.tsx +1 -1
- package/assets/templates/blocks/components/GridSpan/GridSpanColumns.tsx +1 -1
- package/assets/templates/blocks/components/GridSpan/GridSpanShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Heading/HeadingTruncation.tsx +3 -2
- package/assets/templates/blocks/components/Hooks/useClipboardHookUsage.tsx +1 -1
- package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.doc.mjs +0 -1
- package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +38 -19
- package/assets/templates/blocks/components/Hooks/useGridFocusHookUsage.tsx +6 -6
- package/assets/templates/blocks/components/Hooks/useHotkeysHookUsage.tsx +1 -1
- package/assets/templates/blocks/components/Hooks/useInputContainerHookUsage.doc.mjs +0 -1
- package/assets/templates/blocks/components/Hooks/useInputContainerHookUsage.tsx +2 -2
- package/assets/templates/blocks/components/Hooks/useKeyboardHintHookUsage.doc.mjs +0 -1
- package/assets/templates/blocks/components/Hooks/useKeyboardHintHookUsage.tsx +2 -2
- package/assets/templates/blocks/components/Hooks/useListFocusHookUsage.tsx +8 -1
- package/assets/templates/blocks/components/Hooks/useOverflowHookUsage.tsx +17 -6
- package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.tsx +1 -1
- package/assets/templates/blocks/components/Hooks/useTreeFocusHookUsage.doc.mjs +0 -1
- package/assets/templates/blocks/components/Hooks/useTreeFocusHookUsage.tsx +1 -1
- package/assets/templates/blocks/components/HoverCard/HoverCardInteractiveContent.doc.mjs +0 -1
- package/assets/templates/blocks/components/HoverCard/HoverCardInteractiveContent.tsx +1 -1
- package/assets/templates/blocks/components/HoverCard/HoverCardProfileHoverCard.doc.mjs +0 -1
- package/assets/templates/blocks/components/HoverCard/HoverCardProfileHoverCard.tsx +1 -1
- package/assets/templates/blocks/components/Icon/useIconHookUsage.doc.mjs +0 -5
- package/assets/templates/blocks/components/Icon/useIconHookUsage.tsx +7 -7
- package/assets/templates/blocks/components/IconButton/IconButtonActionBar.tsx +11 -0
- package/assets/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +0 -1
- package/assets/templates/blocks/components/IconButton/IconButtonFloating.tsx +25 -2
- package/assets/templates/blocks/components/IconButton/IconButtonShowcase.tsx +3 -0
- package/assets/templates/blocks/components/IconButton/IconButtonTooltipIconButton.tsx +5 -0
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +3 -3
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +36 -13
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +0 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +4 -4
- package/assets/templates/blocks/components/Item/ItemShowcase.doc.mjs +0 -1
- package/assets/templates/blocks/components/Item/ItemShowcase.tsx +7 -3
- package/assets/templates/blocks/components/Layout/LayoutBasicCardLayout.tsx +14 -2
- package/assets/templates/blocks/components/Layout/LayoutContentWidth.tsx +14 -2
- package/assets/templates/blocks/components/Layout/LayoutFullBleedContent.tsx +8 -1
- package/assets/templates/blocks/components/Layout/LayoutShowcase.tsx +8 -1
- package/assets/templates/blocks/components/Layout/LayoutSidebarLayout.tsx +14 -2
- package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
- package/assets/templates/blocks/components/Markdown/MarkdownShowcase.tsx +1 -1
- package/assets/templates/blocks/components/MediaTheme/MediaThemeImageOverlay.tsx +18 -4
- package/assets/templates/blocks/components/MediaTheme/MediaThemeLightScrim.tsx +11 -3
- package/assets/templates/blocks/components/MediaTheme/MediaThemeShowcase.tsx +27 -5
- package/assets/templates/blocks/components/MobileNav/MobileNavBasicMobileNav.doc.mjs +0 -7
- package/assets/templates/blocks/components/MobileNav/MobileNavBasicMobileNav.tsx +5 -9
- package/assets/templates/blocks/components/MobileNav/MobileNavEndSideMobileNav.doc.mjs +0 -1
- package/assets/templates/blocks/components/MobileNav/MobileNavEndSideMobileNav.tsx +2 -2
- package/assets/templates/blocks/components/MobileNav/MobileNavWithoutTitleMobileNav.doc.mjs +0 -1
- package/assets/templates/blocks/components/MobileNav/MobileNavWithoutTitleMobileNav.tsx +1 -1
- package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.doc.mjs +0 -6
- package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.tsx +15 -15
- package/assets/templates/blocks/components/MoreMenu/MoreMenuWithDividers.doc.mjs +0 -5
- package/assets/templates/blocks/components/MoreMenu/MoreMenuWithDividers.tsx +4 -8
- package/assets/templates/blocks/components/MoreMenu/MoreMenuWithSections.doc.mjs +0 -5
- package/assets/templates/blocks/components/MoreMenu/MoreMenuWithSections.tsx +4 -8
- package/assets/templates/blocks/components/MultiSelector/useMultiComboboxHookUsage.doc.mjs +0 -1
- package/assets/templates/blocks/components/MultiSelector/useMultiComboboxHookUsage.tsx +1 -1
- package/assets/templates/blocks/components/OverflowList/OverflowListCappedToolbar.tsx +38 -2
- package/assets/templates/blocks/components/OverflowList/OverflowListCollapseFromStartList.tsx +17 -5
- package/assets/templates/blocks/components/OverflowList/OverflowListOverflowDropdownActions.tsx +46 -7
- package/assets/templates/blocks/components/OverflowList/OverflowListShowcase.tsx +45 -5
- package/assets/templates/blocks/components/Overlay/OverlayHoverReveal.tsx +14 -1
- package/assets/templates/blocks/components/Overlay/OverlayShowcase.tsx +10 -1
- package/assets/templates/blocks/components/Overlay/useOverlayHookUsage.tsx +12 -1
- package/assets/templates/blocks/components/Pagination/PaginationDotsCarousel.doc.mjs +0 -1
- package/assets/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +1 -1
- package/assets/templates/blocks/components/Popover/PopoverBottomSheetAlternative.doc.mjs +0 -1
- package/assets/templates/blocks/components/Popover/PopoverBottomSheetAlternative.tsx +1 -1
- package/assets/templates/blocks/components/Resizable/ResizableShowcase.tsx +12 -2
- package/assets/templates/blocks/components/Resizable/ResizableSidebar.tsx +1 -1
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +1 -1
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +1 -1
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +1 -1
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +1 -1
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +1 -1
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +1 -1
- package/assets/templates/blocks/components/Section/SectionWashHighlight.doc.mjs +0 -1
- package/assets/templates/blocks/components/Section/SectionWashHighlight.tsx +10 -2
- package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.doc.mjs +0 -1
- package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +3 -3
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.doc.mjs +0 -1
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Stack/StackAlignment.tsx +50 -6
- package/assets/templates/blocks/components/Stack/StackDirections.tsx +1 -1
- package/assets/templates/blocks/components/Stack/StackFillItem.tsx +10 -1
- package/assets/templates/blocks/components/Step/StepContent.tsx +13 -4
- package/assets/templates/blocks/components/Step/StepIndicator.tsx +3 -2
- package/assets/templates/blocks/components/Step/StepShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Step/StepStates.tsx +3 -2
- package/assets/templates/blocks/components/Stepper/StepperCustomContent.tsx +18 -14
- package/assets/templates/blocks/components/Stepper/StepperOnTrackHorizontal.tsx +1 -1
- package/assets/templates/blocks/components/Table/TableInCard.tsx +1 -1
- package/assets/templates/blocks/components/Table/TableShowcase.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.doc.mjs +0 -1
- package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.tsx +2 -2
- package/assets/templates/blocks/components/TextInput/TextInputIcon.doc.mjs +0 -1
- package/assets/templates/blocks/components/TextInput/TextInputIcon.tsx +3 -7
- package/assets/templates/blocks/components/TextInput/TextInputSearch.doc.mjs +0 -1
- package/assets/templates/blocks/components/TextInput/TextInputSearch.tsx +3 -3
- package/assets/templates/blocks/components/Theme/ThemeApply.tsx +8 -1
- package/assets/templates/blocks/components/Theme/ThemeNested.tsx +11 -1
- package/assets/templates/blocks/components/Theme/ThemeShowcase.tsx +26 -3
- package/assets/templates/blocks/components/Theme/ThemeSwitcher.tsx +8 -1
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonColor.doc.mjs +0 -11
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonColor.tsx +5 -5
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonGroup.doc.mjs +0 -9
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonGroup.tsx +5 -9
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonIconSwap.doc.mjs +0 -6
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonIconSwap.tsx +6 -6
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonLabel.doc.mjs +0 -6
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonLabel.tsx +3 -3
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonShowcase.doc.mjs +0 -6
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonShowcase.tsx +6 -6
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonStates.doc.mjs +0 -1
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonStates.tsx +2 -2
- package/assets/templates/blocks/components/Token/TokenIcon.doc.mjs +0 -6
- package/assets/templates/blocks/components/Token/TokenIcon.tsx +3 -3
- package/assets/templates/blocks/components/Token/TokenShowcase.doc.mjs +0 -1
- package/assets/templates/blocks/components/Token/TokenShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +14 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.doc.mjs +0 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +2 -2
- package/assets/templates/blocks/components/Toolbar/ToolbarBulkActions.doc.mjs +0 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarBulkActions.tsx +36 -3
- package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.doc.mjs +0 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.tsx +4 -3
- package/assets/templates/blocks/components/Toolbar/ToolbarSizes.doc.mjs +0 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarSizes.tsx +3 -3
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +0 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +8 -3
- package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.doc.mjs +0 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.tsx +6 -2
- package/assets/templates/blocks/components/Toolbar/ToolbarWithTabs.doc.mjs +0 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarWithTabs.tsx +11 -2
- package/assets/templates/blocks/components/Tooltip/TooltipActionBarTooltips.tsx +33 -3
- package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.doc.mjs +0 -1
- package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.tsx +2 -2
- package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.doc.mjs +0 -6
- package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.tsx +7 -7
- package/assets/templates/blocks/components/TopNav/TopNavHoverMenu.doc.mjs +0 -8
- package/assets/templates/blocks/components/TopNav/TopNavHoverMenu.tsx +14 -9
- package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.doc.mjs +0 -8
- package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.tsx +11 -11
- package/assets/templates/blocks/components/TopNav/TopNavMultipleDropdowns.doc.mjs +0 -5
- package/assets/templates/blocks/components/TopNav/TopNavMultipleDropdowns.tsx +4 -8
- package/assets/templates/blocks/components/TopNav/TopNavShowcase.doc.mjs +0 -5
- package/assets/templates/blocks/components/TopNav/TopNavShowcase.tsx +8 -4
- package/assets/templates/blocks/components/TopNav/TopNavWithLogo.doc.mjs +0 -1
- package/assets/templates/blocks/components/TopNav/TopNavWithLogo.tsx +7 -2
- package/assets/templates/blocks/components/TopNavItem/TopNavItemShowcase.tsx +1 -1
- package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.doc.mjs +0 -1
- package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.tsx +4 -4
- package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuShowcase.doc.mjs +0 -7
- package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuShowcase.tsx +12 -12
- package/assets/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.doc.mjs +0 -1
- package/assets/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.tsx +2 -2
- package/assets/templates/blocks/components/TopNavMenu/TopNavMenuBasic.doc.mjs +0 -1
- package/assets/templates/blocks/components/TopNavMenu/TopNavMenuBasic.tsx +4 -4
- package/assets/templates/blocks/components/TopNavMenu/TopNavMenuShowcase.doc.mjs +0 -6
- package/assets/templates/blocks/components/TopNavMenu/TopNavMenuShowcase.tsx +11 -8
- package/assets/templates/blocks/components/TreeList/TreeListFileTreeWithIcons.doc.mjs +0 -1
- package/assets/templates/blocks/components/TreeList/TreeListFileTreeWithIcons.tsx +4 -4
- package/assets/templates/blocks/components/TreeList/TreeListInteractiveSettings.doc.mjs +0 -1
- package/assets/templates/blocks/components/TreeList/TreeListInteractiveSettings.tsx +6 -3
- package/assets/templates/blocks/components/Typeahead/TypeaheadSearchField.doc.mjs +0 -1
- package/assets/templates/blocks/components/Typeahead/TypeaheadSearchField.tsx +2 -2
- package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.doc.mjs +0 -6
- package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.tsx +30 -7
- package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.doc.mjs +0 -1
- package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.tsx +4 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +19 -15
- package/assets/templates/pages/ai-chat/template.doc.mjs +0 -9
- package/assets/templates/pages/ai-chat-landing/page.tsx +16 -16
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +0 -11
- package/assets/templates/pages/blank/page.tsx +4 -2
- package/assets/templates/pages/canvas-editor/page.tsx +200 -110
- package/assets/templates/pages/canvas-editor/template.doc.mjs +0 -46
- package/assets/templates/pages/centered-hero/page.tsx +2 -2
- package/assets/templates/pages/centered-hero/template.doc.mjs +0 -1
- package/assets/templates/pages/checkout-wizard/page.tsx +31 -18
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +0 -7
- package/assets/templates/pages/classic-gallery/page.tsx +1 -1
- package/assets/templates/pages/contact-form/page.tsx +15 -10
- package/assets/templates/pages/contact-form/template.doc.mjs +0 -5
- package/assets/templates/pages/course-detail/page.tsx +10 -10
- package/assets/templates/pages/course-detail/template.doc.mjs +0 -11
- package/assets/templates/pages/dashboard/page.tsx +13 -11
- package/assets/templates/pages/dashboard/template.doc.mjs +0 -6
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +12 -12
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +0 -8
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +7 -13
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +0 -7
- package/assets/templates/pages/dashboard-comparison/page.tsx +12 -10
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +0 -8
- package/assets/templates/pages/dashboard-composition/page.tsx +30 -19
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +0 -1
- package/assets/templates/pages/dashboard-progress/page.tsx +101 -108
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +0 -7
- package/assets/templates/pages/dashboard-scorecard/page.tsx +61 -33
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +0 -7
- package/assets/templates/pages/detail-page/page.tsx +28 -11
- package/assets/templates/pages/detail-page/template.doc.mjs +0 -10
- package/assets/templates/pages/documentation/page.tsx +11 -4
- package/assets/templates/pages/documentation-design/page.tsx +39 -12
- package/assets/templates/pages/documentation-design/template.doc.mjs +0 -5
- package/assets/templates/pages/documentation-technical/page.tsx +8 -6
- package/assets/templates/pages/documentation-technical/template.doc.mjs +0 -5
- package/assets/templates/pages/editor/page.tsx +70 -48
- package/assets/templates/pages/editor/template.doc.mjs +0 -26
- package/assets/templates/pages/file-explorer/page.tsx +19 -19
- package/assets/templates/pages/file-explorer/template.doc.mjs +0 -15
- package/assets/templates/pages/form-two-column/page.tsx +1 -1
- package/assets/templates/pages/form-wizard/page.tsx +12 -5
- package/assets/templates/pages/form-wizard-dialog/page.tsx +6 -2
- package/assets/templates/pages/form-wizard-inline/page.tsx +16 -12
- package/assets/templates/pages/form-wizard-inline/template.doc.mjs +0 -6
- package/assets/templates/pages/form-wizard-vertical/page.tsx +21 -24
- package/assets/templates/pages/form-wizard-vertical/template.doc.mjs +0 -13
- package/assets/templates/pages/gallery-hero/page.tsx +2 -2
- package/assets/templates/pages/gallery-hero/template.doc.mjs +0 -1
- package/assets/templates/pages/ide/page.tsx +12 -7
- package/assets/templates/pages/ide/template.doc.mjs +0 -5
- package/assets/templates/pages/incident-console/page.tsx +4 -4
- package/assets/templates/pages/incident-console/template.doc.mjs +0 -1
- package/assets/templates/pages/kanban-board/page.tsx +128 -47
- package/assets/templates/pages/kanban-board/template.doc.mjs +0 -11
- package/assets/templates/pages/library/page.tsx +34 -64
- package/assets/templates/pages/library/template.doc.mjs +0 -1
- package/assets/templates/pages/login/page.tsx +6 -4
- package/assets/templates/pages/login/template.doc.mjs +0 -1
- package/assets/templates/pages/login-card/page.tsx +6 -4
- package/assets/templates/pages/login-card/template.doc.mjs +0 -1
- package/assets/templates/pages/login-split/page.tsx +6 -5
- package/assets/templates/pages/login-split/template.doc.mjs +0 -1
- package/assets/templates/pages/login-sso/page.tsx +6 -6
- package/assets/templates/pages/login-sso/template.doc.mjs +0 -1
- package/assets/templates/pages/messaging-shell/page.tsx +14 -14
- package/assets/templates/pages/messaging-shell/template.doc.mjs +0 -9
- package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +50 -29
- package/assets/templates/pages/payment-form/template.doc.mjs +0 -6
- package/assets/templates/pages/product-detail/page.tsx +21 -9
- package/assets/templates/pages/product-detail/template.doc.mjs +0 -1
- package/assets/templates/pages/product-gallery/page.tsx +3 -3
- package/assets/templates/pages/product-gallery/template.doc.mjs +0 -1
- package/assets/templates/pages/settings/page.tsx +35 -14
- package/assets/templates/pages/settings/template.doc.mjs +0 -1
- package/assets/templates/pages/settings-dialog/page.tsx +96 -93
- package/assets/templates/pages/settings-dialog/template.doc.mjs +0 -53
- package/assets/templates/pages/settings-sidebar/page.tsx +74 -36
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +0 -16
- package/assets/templates/pages/shell-nav/page.tsx +32 -20
- package/assets/templates/pages/shell-nav/template.doc.mjs +0 -6
- package/assets/templates/pages/shell-side-nav/page.tsx +23 -22
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +0 -11
- package/assets/templates/pages/shell-top-nav/page.tsx +13 -13
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +0 -19
- package/assets/templates/pages/side-gallery/page.tsx +5 -2
- package/assets/templates/pages/table/page.tsx +21 -21
- package/assets/templates/pages/table/template.doc.mjs +0 -10
- package/assets/templates/pages/table-collapsible/page.tsx +8 -8
- package/assets/templates/pages/table-collapsible/template.doc.mjs +0 -6
- package/assets/templates/pages/table-comparison/page.tsx +23 -23
- package/assets/templates/pages/table-comparison/template.doc.mjs +0 -14
- package/assets/templates/pages/table-filter/page.tsx +75 -47
- package/assets/templates/pages/table-filter/template.doc.mjs +0 -19
- package/assets/templates/pages/table-grouped/page.tsx +16 -15
- package/assets/templates/pages/table-grouped/template.doc.mjs +0 -11
- package/assets/templates/pages/table-inbox/page.tsx +65 -33
- package/assets/templates/pages/table-inbox/template.doc.mjs +0 -17
- package/assets/templates/pages/table-page/page.tsx +3 -6
- package/assets/templates/pages/table-page/template.doc.mjs +0 -1
- package/assets/templates/pages/table-tree/page.tsx +35 -35
- package/assets/templates/pages/table-tree/template.doc.mjs +0 -15
- package/assets/templates/pages/theme-showcase/page.tsx +48 -43
- package/assets/templates/pages/theme-showcase/template.doc.mjs +0 -19
- package/assets/templates/pages/work-item-detail/page.tsx +60 -33
- package/assets/templates/pages/work-item-detail/template.doc.mjs +0 -12
- package/assets/templates/themes/butter/butterTheme.ts +50 -9
- package/assets/templates/themes/chocolate/chocolateTheme.ts +13 -6
- package/assets/templates/themes/gothic/gothicTheme.ts +14 -2
- package/assets/templates/themes/matcha/matchaTheme.ts +10 -2
- package/assets/templates/themes/neutral/neutralTheme.ts +16 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/stone/stoneTheme.ts +32 -10
- package/assets/templates/themes/y2k/y2kTheme.ts +11 -3
- package/assets/theme.template.ts +17 -7
- package/authoring/config/config.doc.mjs +8 -1
- package/authoring/config/parse.mjs +15 -0
- package/authoring/config/skill-places.d.mts +23 -0
- package/authoring/config/skill-places.mjs +35 -0
- package/authoring/config/type.ts +16 -0
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/debug/type.ts +4 -0
- package/authoring/discover/parse.d.mts +2 -1
- package/authoring/discover/parse.mjs +73 -38
- package/authoring/discover/type.ts +9 -2
- package/authoring/doctypes/_schema.d.mts +36 -16
- package/authoring/doctypes/_schema.mjs +29 -0
- package/authoring/doctypes/base/type.ts +19 -0
- package/authoring/doctypes/command/command.doc.mjs +6 -0
- package/authoring/doctypes/command/type.ts +7 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +16 -0
- package/authoring/doctypes/icon-definition/parse.mjs +12 -0
- package/authoring/doctypes/icon-definition/type.ts +18 -0
- package/authoring/doctypes/reference/reference.doc.mjs +13 -0
- package/authoring/doctypes/reference/skill.d.mts +29 -0
- package/authoring/doctypes/reference/skill.mjs +56 -0
- package/authoring/doctypes/reference/type.ts +19 -0
- package/authoring/gap-report/parse.d.mts +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +21 -3
- package/authoring/integration/schema.mjs +25 -5
- package/authoring/integration/type.ts +14 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/build.doc.mjs +1 -1
- package/clients/cli/commands/build.mjs +11 -11
- package/clients/cli/commands/component.doc.mjs +3 -1
- package/clients/cli/commands/component.mjs +7 -3
- package/clients/cli/commands/discover.doc.mjs +2 -2
- package/clients/cli/commands/discover.mjs +108 -8
- package/clients/cli/commands/docs.doc.mjs +7 -2
- package/clients/cli/commands/docs.mjs +64 -172
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +4 -2
- package/clients/cli/commands/doctor.doc.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +16 -3
- package/clients/cli/commands/experimental/export.mjs +64 -0
- package/clients/cli/commands/experimental/icon.mjs +67 -12
- package/clients/cli/commands/experimental/import.mjs +70 -0
- package/clients/cli/commands/experimental/index.mjs +152 -13
- package/clients/cli/commands/experimental/render-output.mjs +242 -0
- package/clients/cli/commands/experimental/theme.mjs +34 -13
- package/clients/cli/commands/experimental-export.doc.mjs +73 -0
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-import.doc.mjs +53 -0
- package/clients/cli/commands/experimental-theme-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +6 -1
- package/clients/cli/commands/experimental-theme.doc.mjs +1 -1
- package/clients/cli/commands/experimental.doc.mjs +4 -4
- package/clients/cli/commands/init.doc.mjs +34 -14
- package/clients/cli/commands/integration-check.doc.mjs +1 -1
- package/clients/cli/commands/mcp.doc.mjs +5 -1
- package/clients/cli/commands/search.mjs +68 -7
- package/clients/cli/commands/template.doc.mjs +14 -5
- package/clients/cli/commands/template.mjs +18 -0
- package/clients/cli/commands/theme-add.doc.mjs +6 -2
- package/clients/cli/commands/theme-remove.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +76 -5
- package/clients/cli/commands/upgrade.doc.mjs +2 -1
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/index.mjs +30 -31
- package/clients/cli/lib/cli-error.mjs +20 -10
- package/clients/cli/lib/component-format.mjs +167 -74
- package/clients/cli/lib/define-command.mjs +10 -0
- package/clients/cli/lib/hook-format.mjs +28 -24
- package/clients/cli/lib/json-shim.mjs +9 -3
- package/clients/cli/lib/mcp-tools.mjs +8 -2
- package/clients/cli/lib/other-cli-words.mjs +99 -0
- package/clients/cli/lib/renamed-commands.mjs +21 -0
- package/clients/cli/lib/root-args.mjs +10 -3
- package/clients/cli/lib/stray-option.mjs +79 -1
- package/clients/cli/lib/unknown-command.mjs +406 -13
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +27 -0
- package/foundation/agent-docs/agent-doc-state.d.mts +20 -2
- package/foundation/agent-docs/agent-doc-state.mjs +71 -4
- package/foundation/agent-docs/agent-docs.d.mts +43 -4
- package/foundation/agent-docs/agent-docs.mjs +54 -5
- package/foundation/agent-docs/computer-agent-text.d.mts +28 -14
- package/foundation/agent-docs/computer-agent-text.mjs +85 -172
- package/foundation/agent-docs/folder-scope.d.mts +51 -0
- package/foundation/agent-docs/folder-scope.mjs +86 -0
- package/foundation/agent-docs/managed-skill-file.d.mts +115 -0
- package/foundation/agent-docs/managed-skill-file.mjs +224 -0
- package/foundation/agent-docs/skill-place-files.d.mts +119 -0
- package/foundation/agent-docs/skill-place-files.mjs +374 -0
- package/foundation/agent-docs/skill-places.d.mts +139 -0
- package/foundation/agent-docs/skill-places.mjs +321 -0
- package/foundation/color/css-color.d.mts +150 -0
- package/foundation/color/css-color.mjs +960 -0
- package/foundation/config/config-path.d.mts +2 -2
- package/foundation/config/config-path.mjs +5 -6
- package/foundation/config/config-writer.d.mts +5 -1
- package/foundation/config/config-writer.mjs +20 -4
- package/foundation/config/project.d.mts +3 -1
- package/foundation/config/project.mjs +8 -5
- package/foundation/config/theme-state.d.mts +13 -0
- package/foundation/config/theme-state.mjs +28 -0
- package/foundation/debug/event.d.mts +2 -1
- package/foundation/debug/event.mjs +2 -1
- package/foundation/discovery/button-actions.d.mts +220 -0
- package/foundation/discovery/button-actions.mjs +1527 -0
- package/foundation/discovery/cli-self-docs.d.mts +7 -0
- package/foundation/discovery/cli-self-docs.mjs +67 -6
- package/foundation/discovery/color-modes.d.mts +14 -0
- package/foundation/discovery/color-modes.mjs +53 -0
- package/foundation/discovery/command-pointers.d.mts +21 -4
- package/foundation/discovery/command-pointers.mjs +25 -4
- package/foundation/discovery/component-discovery.d.mts +10 -0
- package/foundation/discovery/component-discovery.mjs +99 -43
- package/foundation/discovery/component-replacement.d.mts +8 -0
- package/foundation/discovery/component-replacement.mjs +13 -0
- package/foundation/discovery/core-augmentation-points.d.mts +90 -0
- package/foundation/discovery/core-augmentation-points.mjs +1030 -0
- package/foundation/discovery/core-component-views.d.mts +15 -0
- package/foundation/discovery/core-component-views.mjs +176 -0
- package/foundation/discovery/core-elements.d.mts +29 -0
- package/foundation/discovery/core-elements.mjs +57 -0
- package/foundation/discovery/core-prop-types.d.mts +65 -0
- package/foundation/discovery/core-prop-types.mjs +221 -0
- package/foundation/discovery/core-props.d.mts +33 -0
- package/foundation/discovery/core-props.mjs +64 -0
- package/foundation/discovery/doc-types.d.mts +10 -42
- package/foundation/discovery/doc-types.mjs +26 -7
- package/foundation/discovery/docs-discovery.d.mts +33 -2
- package/foundation/discovery/docs-discovery.mjs +149 -72
- package/foundation/discovery/docs-section-key.d.mts +21 -1
- package/foundation/discovery/docs-section-key.mjs +57 -19
- package/foundation/discovery/hook-discovery.d.mts +2 -0
- package/foundation/discovery/hook-discovery.mjs +6 -5
- package/foundation/discovery/icon-definition-discovery.d.mts +155 -3
- package/foundation/discovery/icon-definition-discovery.mjs +197 -5
- package/foundation/discovery/icon-imports.d.mts +66 -0
- package/foundation/discovery/icon-imports.mjs +225 -0
- package/foundation/discovery/icon-ranking.d.mts +108 -4
- package/foundation/discovery/icon-ranking.mjs +277 -70
- package/foundation/discovery/icon-set-checks.d.mts +2 -0
- package/foundation/discovery/icon-set-checks.mjs +16 -2
- package/foundation/discovery/icon-set-discovery.d.mts +42 -2
- package/foundation/discovery/icon-set-discovery.mjs +85 -23
- package/foundation/discovery/icon-set-writer.d.mts +7 -2
- package/foundation/discovery/icon-set-writer.mjs +86 -7
- package/foundation/discovery/integration-skills.d.mts +62 -0
- package/foundation/discovery/integration-skills.mjs +116 -0
- package/foundation/discovery/module-exports.d.mts +8 -0
- package/foundation/discovery/module-exports.mjs +20 -21
- package/foundation/discovery/package-exports.d.mts +22 -0
- package/foundation/discovery/package-exports.mjs +44 -3
- package/foundation/discovery/project-typescript.d.mts +5 -1
- package/foundation/discovery/project-typescript.mjs +8 -2
- package/foundation/discovery/prop-drift.d.mts +16 -0
- package/foundation/discovery/prop-drift.mjs +154 -3
- package/foundation/discovery/replacement-aliases.d.mts +51 -0
- package/foundation/discovery/replacement-aliases.mjs +95 -0
- package/foundation/discovery/runner-allowlist.d.mts +1 -1
- package/foundation/discovery/runner-allowlist.mjs +1 -1
- package/foundation/discovery/stored-component-list.mjs +34 -2
- package/foundation/discovery/template-adapter.d.mts +26 -0
- package/foundation/discovery/template-adapter.mjs +221 -10
- package/foundation/discovery/template-destination.d.mts +14 -6
- package/foundation/discovery/template-destination.mjs +42 -8
- package/foundation/discovery/template-icon-meanings.d.mts +7 -2
- package/foundation/discovery/template-icon-meanings.mjs +52 -12
- package/foundation/discovery/template-icons.d.mts +44 -1
- package/foundation/discovery/template-icons.mjs +60 -63
- package/foundation/discovery/template-needs.d.mts +17 -8
- package/foundation/discovery/template-needs.mjs +119 -31
- package/foundation/discovery/template-placeholders.d.mts +149 -0
- package/foundation/discovery/template-placeholders.mjs +463 -0
- package/foundation/discovery/template-source-tree.d.mts +6 -3
- package/foundation/discovery/template-source-tree.mjs +8 -5
- package/foundation/discovery/theme-discovery.d.mts +8 -0
- package/foundation/discovery/theme-discovery.mjs +23 -6
- package/foundation/discovery/theme-imports.d.mts +1 -3
- package/foundation/discovery/theme-imports.mjs +5 -30
- package/foundation/doc-compiler/compile.mjs +6 -8
- package/foundation/doc-compiler/doc-syntax.d.mts +25 -1
- package/foundation/doc-compiler/doc-syntax.mjs +85 -10
- package/foundation/doc-compiler/doc-text.d.mts +52 -0
- package/foundation/doc-compiler/doc-text.mjs +176 -0
- package/foundation/doc-compiler/links.d.mts +8 -2
- package/foundation/doc-compiler/links.mjs +27 -6
- package/foundation/doc-compiler/read.d.mts +1 -1
- package/foundation/doc-compiler/stored-docs.d.mts +14 -3
- package/foundation/doc-compiler/stored-docs.mjs +12 -6
- package/foundation/env/cli-command.d.mts +68 -10
- package/foundation/env/cli-command.mjs +116 -22
- package/foundation/env/package-manager.d.mts +33 -2
- package/foundation/env/package-manager.mjs +68 -6
- package/foundation/env/user-dirs.d.mts +14 -0
- package/foundation/env/user-dirs.mjs +34 -1
- package/foundation/env/user-settings.d.mts +15 -0
- package/foundation/env/user-settings.mjs +56 -2
- package/foundation/fonts/font-stylesheet.d.mts +11 -0
- package/foundation/fonts/font-stylesheet.mjs +62 -7
- package/foundation/fs/cache-eviction.d.mts +7 -5
- package/foundation/fs/cache-eviction.mjs +20 -13
- package/foundation/fs/empty-folder.d.mts +12 -0
- package/foundation/fs/empty-folder.mjs +30 -0
- package/foundation/fs/file-protection.d.mts +11 -0
- package/foundation/fs/file-protection.mjs +49 -3
- package/foundation/fs/gather-cache.d.mts +14 -7
- package/foundation/fs/gather-cache.mjs +163 -67
- package/foundation/fs/import-url.d.mts +7 -5
- package/foundation/fs/import-url.mjs +7 -5
- package/foundation/fs/jiti-cache.d.mts +47 -26
- package/foundation/fs/jiti-cache.mjs +222 -130
- package/foundation/fs/loaded-files.d.mts +15 -1
- package/foundation/fs/loaded-files.mjs +40 -3
- package/foundation/fs/module-loader.d.mts +3 -1
- package/foundation/fs/module-loader.mjs +85 -5
- package/foundation/fs/path-safety.d.mts +1 -0
- package/foundation/fs/path-safety.mjs +2 -0
- package/foundation/fs/relative-specifier.d.mts +10 -0
- package/foundation/fs/relative-specifier.mjs +28 -0
- package/foundation/integrations/computer-integrations.mjs +11 -10
- package/foundation/integrations/icon-features.d.mts +1 -1
- package/foundation/integrations/icon-features.mjs +1 -1
- package/foundation/integrations/integration-warnings.d.mts +10 -0
- package/foundation/integrations/integration-warnings.mjs +12 -3
- package/foundation/integrations/integrations.d.mts +16 -2
- package/foundation/integrations/integrations.mjs +50 -8
- package/foundation/integrations/may-have-integrations.mjs +7 -6
- package/foundation/integrations/provider-resolution.mjs +19 -2
- package/foundation/integrations/validate-contributions.d.mts +4 -0
- package/foundation/integrations/validate-contributions.mjs +24 -0
- package/foundation/release/agent-text-worker.mjs +33 -1
- package/foundation/release/cache.d.mts +48 -3
- package/foundation/release/cache.mjs +196 -20
- package/foundation/release/choose.d.mts +5 -2
- package/foundation/release/choose.mjs +54 -4
- package/foundation/release/global-state.mjs +10 -2
- package/foundation/release/handoff.mjs +7 -1
- package/foundation/release/notices.d.mts +97 -9
- package/foundation/release/notices.mjs +381 -56
- package/foundation/release/project.d.mts +21 -4
- package/foundation/release/project.mjs +74 -42
- package/foundation/release/run-context.d.mts +6 -0
- package/foundation/release/run-context.mjs +9 -0
- package/foundation/render/assets.d.mts +7 -0
- package/foundation/render/assets.mjs +30 -17
- package/foundation/render/charts.d.mts +11 -10
- package/foundation/render/charts.mjs +112 -1
- package/foundation/render/class-alias.d.mts +23 -0
- package/foundation/render/class-alias.mjs +333 -0
- package/foundation/render/client-bundle.d.mts +183 -0
- package/foundation/render/client-bundle.mjs +1026 -0
- package/foundation/render/component-map.mjs +1 -1
- package/foundation/render/css-cut.d.mts +26 -0
- package/foundation/render/css-cut.mjs +344 -2
- package/foundation/render/dropped-text.d.mts +43 -0
- package/foundation/render/dropped-text.mjs +90 -0
- package/foundation/render/embedded-files.d.mts +24 -1
- package/foundation/render/embedded-files.mjs +41 -4
- package/foundation/render/embedded-imports.d.mts +72 -12
- package/foundation/render/embedded-imports.mjs +206 -70
- package/foundation/render/esbuild-dependency.d.mts +14 -0
- package/foundation/render/esbuild-dependency.mjs +41 -0
- package/foundation/render/file-header.d.mts +7 -2
- package/foundation/render/file-header.mjs +19 -10
- package/foundation/render/html-reader.d.mts +36 -17
- package/foundation/render/html-reader.mjs +239 -32
- package/foundation/render/image-attributes.d.mts +25 -0
- package/foundation/render/image-attributes.mjs +33 -0
- package/foundation/render/markup-edits.mjs +1 -1
- package/foundation/render/package-resolve-hooks.d.mts +54 -0
- package/foundation/render/package-resolve-hooks.mjs +144 -0
- package/foundation/render/page-host.mjs +1 -1
- package/foundation/render/page-worker.mjs +1307 -107
- package/foundation/render/picture-chrome.mjs +13 -1
- package/foundation/render/picture-playwright.mjs +13 -0
- package/foundation/render/picture-window.d.mts +18 -5
- package/foundation/render/picture-window.mjs +211 -19
- package/foundation/render/rebuild.mjs +2 -2
- package/foundation/render/remote-images.d.mts +83 -0
- package/foundation/render/remote-images.mjs +384 -0
- package/foundation/render/render-page.d.mts +214 -6
- package/foundation/render/render-page.mjs +1673 -163
- package/foundation/render/restore-folder.d.mts +13 -0
- package/foundation/render/restore-folder.mjs +30 -0
- package/foundation/render/served-packages.d.mts +14 -1
- package/foundation/render/served-packages.mjs +50 -6
- package/foundation/render/share-checks.d.mts +35 -0
- package/foundation/render/share-checks.mjs +95 -0
- package/foundation/render/source-block.d.mts +14 -3
- package/foundation/render/source-block.mjs +44 -9
- package/foundation/render/srcset.d.mts +32 -0
- package/foundation/render/srcset.mjs +64 -0
- package/foundation/render/ts-paths.d.mts +52 -1
- package/foundation/render/ts-paths.mjs +114 -4
- package/foundation/render/value-uses.d.mts +43 -0
- package/foundation/render/value-uses.mjs +110 -0
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.doc.mjs +16 -10
- package/foundation/response/error-codes.mjs +19 -8
- package/foundation/response/json.d.mts +0 -15
- package/foundation/response/json.mjs +1 -51
- package/foundation/response/response-types.doc.mjs +24 -13
- package/foundation/runtime/css-tree.d.mts +16 -0
- package/foundation/runtime/css-tree.mjs +46 -3
- package/foundation/runtime/lazy-dependencies.d.mts +7 -0
- package/foundation/runtime/lazy-dependencies.mjs +25 -3
- package/foundation/runtime/locked-versions.d.mts +4 -2
- package/foundation/runtime/locked-versions.mjs +18 -10
- package/foundation/runtime/package-root.d.mts +25 -0
- package/foundation/runtime/package-root.mjs +48 -0
- package/foundation/runtime/word-table.d.mts +18 -0
- package/foundation/runtime/word-table.mjs +33 -0
- package/foundation/suggest/other-command.d.mts +23 -0
- package/foundation/suggest/other-command.mjs +49 -5
- package/foundation/text/default-variant.d.mts +20 -0
- package/foundation/text/default-variant.mjs +24 -0
- package/foundation/text/definition-coverage.d.mts +21 -0
- package/foundation/text/definition-coverage.mjs +20 -0
- package/foundation/text/icon-set-next.d.mts +11 -10
- package/foundation/text/icon-set-next.mjs +19 -11
- package/foundation/text/string-utils.mjs +14 -41
- package/foundation/text/suggest-order.d.mts +10 -4
- package/foundation/text/suggest-order.mjs +20 -13
- package/package.json +8 -6
- package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +0 -394
- package/assets/docs/tree/render-pages.doc.mjs +0 -135
- package/clients/cli/commands/experimental/render.mjs +0 -154
- package/clients/cli/commands/experimental-render.doc.mjs +0 -73
|
@@ -25,8 +25,6 @@ import {isAlive} from '../../foundation/release/cache.mjs';
|
|
|
25
25
|
import {stillHolds} from '../../foundation/release/folder-lock.mjs';
|
|
26
26
|
import {AstryxError} from '../error.mjs';
|
|
27
27
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
28
|
-
import {parse} from '@babel/parser';
|
|
29
|
-
import {THEMES_DIR} from '../../foundation/discovery/theme-discovery.mjs';
|
|
30
28
|
import {
|
|
31
29
|
ANCHOR_INPUT_KEYS,
|
|
32
30
|
DEFAULT_21_STOPS,
|
|
@@ -36,12 +34,40 @@ import {
|
|
|
36
34
|
PALETTE_GENERATOR_VERSION,
|
|
37
35
|
PALETTE_RECIPE,
|
|
38
36
|
PALETTE_RECIPE_V2,
|
|
37
|
+
PALETTE_RECIPES,
|
|
39
38
|
PALETTE_WHITE,
|
|
40
39
|
generateTonalPalette,
|
|
41
40
|
modesForStrategy,
|
|
42
|
-
perceptualDelta,
|
|
43
41
|
} from '../theme/palette/generate/generator.mjs';
|
|
44
42
|
import {themePaletteGenerate} from '../theme/palette/generate/generate.mjs';
|
|
43
|
+
import {
|
|
44
|
+
ACCENT_MUTED,
|
|
45
|
+
BORDER,
|
|
46
|
+
DARK_FILL,
|
|
47
|
+
LIFT_GROUNDS,
|
|
48
|
+
LIFT_PARTS,
|
|
49
|
+
NEUTRAL_INSIDE,
|
|
50
|
+
NEUTRAL_STOPS,
|
|
51
|
+
NEUTRAL_TINTS,
|
|
52
|
+
NON_TEXT,
|
|
53
|
+
ON_MUTED,
|
|
54
|
+
PALETTE_DIALS,
|
|
55
|
+
STATUS_MUTED,
|
|
56
|
+
STATUS_TOKEN,
|
|
57
|
+
TEXT,
|
|
58
|
+
TEXT_STOP,
|
|
59
|
+
VIBRANCY_DEFAULT,
|
|
60
|
+
anchorDarkFills,
|
|
61
|
+
dialFamily,
|
|
62
|
+
fillAt,
|
|
63
|
+
grownGrays,
|
|
64
|
+
isGray,
|
|
65
|
+
mapPalette,
|
|
66
|
+
nearestShade,
|
|
67
|
+
paletteToken,
|
|
68
|
+
sameColor,
|
|
69
|
+
shade,
|
|
70
|
+
} from '../theme/palette/generate/mapping.mjs';
|
|
45
71
|
/**
|
|
46
72
|
* How the page-wide tokens a theme's own source sets are read: given by
|
|
47
73
|
* _settings (which imports this module) when it loads.
|
|
@@ -56,19 +82,16 @@ let ownSourceTokenValues = () => ({});
|
|
|
56
82
|
export function setOwnTokenReader(read) {
|
|
57
83
|
ownSourceTokenValues = read;
|
|
58
84
|
}
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
alphaOf,
|
|
62
|
-
compositeOver,
|
|
63
|
-
hex,
|
|
64
|
-
isClipped,
|
|
65
|
-
parseColor,
|
|
66
|
-
ratio,
|
|
67
|
-
} from './_color.mjs';
|
|
85
|
+
import {alphaOf, hex, isClipped, parseColor} from './_color.mjs';
|
|
68
86
|
import {splitTop} from './_css.mjs';
|
|
69
|
-
import {P
|
|
87
|
+
import {P} from './_tables.mjs';
|
|
70
88
|
import {quoteCommandArgument} from '../../foundation/env/package-manager.mjs';
|
|
71
89
|
import {sha256} from '../../foundation/render/source-block.mjs';
|
|
90
|
+
import {cliVersion} from '../../foundation/release/run-context.mjs';
|
|
91
|
+
import {
|
|
92
|
+
newerRecipe,
|
|
93
|
+
newerRecipeRefusal,
|
|
94
|
+
} from '../theme/palette/generate/newer-recipe.mjs';
|
|
72
95
|
|
|
73
96
|
export {readRegularFile};
|
|
74
97
|
|
|
@@ -224,24 +247,6 @@ function sweepTemps(dir) {
|
|
|
224
247
|
}
|
|
225
248
|
}
|
|
226
249
|
|
|
227
|
-
/**
|
|
228
|
-
* Remove `dir` when it is empty; with `deep`, the empty folders under it
|
|
229
|
-
* first. A folder with a file in it stays.
|
|
230
|
-
* @param {string} dir
|
|
231
|
-
* @param {{deep?: boolean}} [opts]
|
|
232
|
-
*/
|
|
233
|
-
export function removeEmptyFolder(dir, opts = {}) {
|
|
234
|
-
if (!fs.existsSync(dir)) return;
|
|
235
|
-
if (opts.deep)
|
|
236
|
-
for (const e of fs.readdirSync(dir, {withFileTypes: true}))
|
|
237
|
-
if (e.isDirectory()) removeEmptyFolder(path.join(dir, e.name), opts);
|
|
238
|
-
try {
|
|
239
|
-
fs.rmdirSync(dir);
|
|
240
|
-
} catch {
|
|
241
|
-
// Not empty, or gone already.
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
250
|
/**
|
|
246
251
|
* Whether a file name is one of the editor's own temp files: a whole-file
|
|
247
252
|
* write's `.<name>.astryx-<pid>-<random>.tmp`, a build's `.<name>.tmp-<id>`,
|
|
@@ -296,11 +301,17 @@ export function tempFor(file) {
|
|
|
296
301
|
* @property {{thing: string, value: string, mode?: Mode}} [fix] - The nearest setting that passes it, when one does: a darker exact color for a pale fill.
|
|
297
302
|
*/
|
|
298
303
|
|
|
304
|
+
/**
|
|
305
|
+
* A color dial's family: its seed, and the source token that gives it when
|
|
306
|
+
* the theme's own source sets the family's fill (null when the setting does).
|
|
307
|
+
* @typedef {{id: string, dial: string, seed: string, value: string, source: string | null}} DialFamily
|
|
308
|
+
*/
|
|
309
|
+
|
|
299
310
|
/**
|
|
300
311
|
* The palette mapping of a theme.
|
|
301
312
|
* @typedef {object} PaletteMapping
|
|
302
313
|
* @property {Candidate} candidate
|
|
303
|
-
* @property {
|
|
314
|
+
* @property {DialFamily[]} families
|
|
304
315
|
* @property {Record<string, {family: string, light: StopRef, dark: StopRef}>} tokens
|
|
305
316
|
* @property {ContrastCheck[]} contrast
|
|
306
317
|
* @property {number} vibrancy - The generator's vibrancy, 0 to 100.
|
|
@@ -310,18 +321,16 @@ export function tempFor(file) {
|
|
|
310
321
|
* @property {Record<string, Partial<Record<Mode, StopRef>>> | null} lift - Lifted secondary text per background token of LIFT_PARTS (the accent tint, the neutral track), per mode, from the neutral color; null without one.
|
|
311
322
|
*/
|
|
312
323
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
/** The generator's vibrancy when the theme sets none. */
|
|
324
|
-
export const VIBRANCY_DEFAULT = 50;
|
|
324
|
+
// The color dials, the vibrancy default, each dial's main token, the lifted
|
|
325
|
+
// parts and the nearest shade of a ramp: the palette mapping's, which other
|
|
326
|
+
// editor modules read through this one.
|
|
327
|
+
export {
|
|
328
|
+
LIFT_PARTS,
|
|
329
|
+
PALETTE_DIALS,
|
|
330
|
+
VIBRANCY_DEFAULT,
|
|
331
|
+
nearestShade,
|
|
332
|
+
paletteToken,
|
|
333
|
+
};
|
|
325
334
|
|
|
326
335
|
/**
|
|
327
336
|
* The vibrancy dial a settings list sets, or null.
|
|
@@ -339,237 +348,11 @@ function dialVibrancy(settings) {
|
|
|
339
348
|
: null;
|
|
340
349
|
}
|
|
341
350
|
|
|
342
|
-
/** The Core token word of each status family. */
|
|
343
|
-
const STATUS_TOKEN = wordTable(
|
|
344
|
-
/** @type {Record<string, string>} */ ({
|
|
345
|
-
success: 'success',
|
|
346
|
-
warning: 'warning',
|
|
347
|
-
danger: 'error',
|
|
348
|
-
info: 'info',
|
|
349
|
-
}),
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* The main token a color dial feeds: the exact-token escape hatch for it.
|
|
354
|
-
* @param {string} dial
|
|
355
|
-
*/
|
|
356
|
-
export const paletteToken = dial =>
|
|
357
|
-
dial === 'accent'
|
|
358
|
-
? '--color-accent'
|
|
359
|
-
: dial === 'neutral'
|
|
360
|
-
? '--color-background-surface'
|
|
361
|
-
: `--color-${STATUS_TOKEN[dial]}`;
|
|
362
|
-
|
|
363
|
-
/** Text contrast and non-text contrast (fills, focus rings, icons). */
|
|
364
|
-
const TEXT = 4.5;
|
|
365
|
-
const NON_TEXT = 3;
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* The official neutral theme's color mapping, read from the theme the CLI
|
|
369
|
-
* ships rather than copied: each token's stops, `[light, dark]`, written
|
|
370
|
-
* there as `<family>.<mode>[N]` or `withAlpha(<family>.<mode>[N], 'aa')`
|
|
371
|
-
* (one stop for both modes when it writes one), and the parts whose
|
|
372
|
-
* secondary text it lifts (`[part, block]`).
|
|
373
|
-
* @returns {{stops: Record<string, Array<{stop: number, alpha?: string}>>, lifted: Array<[string, string]>}}
|
|
374
|
-
*/
|
|
375
|
-
function readOfficialNeutral() {
|
|
376
|
-
const ast = parse(
|
|
377
|
-
fs.readFileSync(
|
|
378
|
-
path.join(THEMES_DIR, 'neutral', 'neutralTheme.ts'),
|
|
379
|
-
'utf8',
|
|
380
|
-
),
|
|
381
|
-
{sourceType: 'module', plugins: ['typescript']},
|
|
382
|
-
);
|
|
383
|
-
/** @param {any} n @returns {{stop: number, alpha?: string} | null} */
|
|
384
|
-
const stopOf = n => {
|
|
385
|
-
if (n?.type === 'CallExpression' && n.callee?.name === 'withAlpha') {
|
|
386
|
-
const inner = stopOf(n.arguments[0]);
|
|
387
|
-
const alpha = n.arguments[1]?.value;
|
|
388
|
-
return inner && typeof alpha === 'string'
|
|
389
|
-
? {...inner, alpha: alpha.toLowerCase()}
|
|
390
|
-
: null;
|
|
391
|
-
}
|
|
392
|
-
return n?.type === 'MemberExpression' &&
|
|
393
|
-
n.computed &&
|
|
394
|
-
n.property.type === 'NumericLiteral' &&
|
|
395
|
-
['light', 'dark'].includes(n.object?.property?.name)
|
|
396
|
-
? {stop: n.property.value}
|
|
397
|
-
: null;
|
|
398
|
-
};
|
|
399
|
-
/** @type {Record<string, Array<{stop: number, alpha?: string}>>} */
|
|
400
|
-
const stops = {};
|
|
401
|
-
/** @type {Array<[string, string]>} */
|
|
402
|
-
const lifted = [];
|
|
403
|
-
/** @param {any} node @param {string[]} keys */
|
|
404
|
-
const visit = (node, keys) => {
|
|
405
|
-
if (!node || typeof node !== 'object') return;
|
|
406
|
-
if (node.type === 'ObjectProperty') {
|
|
407
|
-
const key = node.key.name ?? node.key.value;
|
|
408
|
-
const at = [...keys, String(key)];
|
|
409
|
-
if (keys.at(-1) === 'tokens' && node.value.type === 'ArrayExpression') {
|
|
410
|
-
const pair = node.value.elements.map(stopOf);
|
|
411
|
-
if (pair.length === 2 && pair.every(Boolean)) stops[key] = pair;
|
|
412
|
-
} else if (keys.at(-1) === 'tokens') {
|
|
413
|
-
const one = stopOf(node.value);
|
|
414
|
-
if (one) stops[key] = [one, one];
|
|
415
|
-
}
|
|
416
|
-
if (keys.at(-3) === 'components' && key === '--color-text-secondary')
|
|
417
|
-
lifted.push([keys.at(-2) ?? '', keys.at(-1) ?? '']);
|
|
418
|
-
visit(node.value, at);
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
for (const [k, v] of Object.entries(node))
|
|
422
|
-
if (k !== 'loc' && k !== 'start' && k !== 'end')
|
|
423
|
-
for (const x of Array.isArray(v) ? v : [v]) visit(x, keys);
|
|
424
|
-
};
|
|
425
|
-
visit(ast.program, []);
|
|
426
|
-
return {stops, lifted};
|
|
427
|
-
}
|
|
428
|
-
const OFFICIAL = readOfficialNeutral();
|
|
429
|
-
/** A token's official `[light, dark]` stops. @param {string} token */
|
|
430
|
-
const officialStops = token =>
|
|
431
|
-
/** @type {[number, number]} */ (
|
|
432
|
-
(OFFICIAL.stops[token] ?? []).map(x => x.stop)
|
|
433
|
-
);
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* The tokens the neutral color sets at the official theme's stops, the
|
|
437
|
-
* page background (`--color-background-body`) with the surfaces on it, so
|
|
438
|
-
* a warm or cool gray reaches the page as it reaches the cards. The
|
|
439
|
-
* inverted surface (tooltips,
|
|
440
|
-
* toasts), which the official theme leaves to Core, is the card surface of
|
|
441
|
-
* the other mode, as Core makes it from a neutral scale, inside the ramp
|
|
442
|
-
* (Core's tones 10 and 99: never the white or black end every ramp shares)
|
|
443
|
-
* so it carries the neutral color (NEUTRAL_INSIDE); the text on it is the
|
|
444
|
-
* theme's on-dark and on-light. A layout without one of these stops uses
|
|
445
|
-
* the nearest one it has.
|
|
446
|
-
*/
|
|
447
|
-
const NEUTRAL_STOPS = wordTable(
|
|
448
|
-
/** @type {Record<string, [number, number]>} */ ({
|
|
449
|
-
...Object.fromEntries(
|
|
450
|
-
[
|
|
451
|
-
'--color-background-body',
|
|
452
|
-
'--color-background-surface',
|
|
453
|
-
'--color-background-card',
|
|
454
|
-
'--color-background-popover',
|
|
455
|
-
'--color-background-muted',
|
|
456
|
-
'--color-text-primary',
|
|
457
|
-
'--color-text-secondary',
|
|
458
|
-
'--color-text-disabled',
|
|
459
|
-
'--color-icon-primary',
|
|
460
|
-
'--color-icon-secondary',
|
|
461
|
-
'--color-icon-disabled',
|
|
462
|
-
'--color-border-emphasized',
|
|
463
|
-
'--color-skeleton',
|
|
464
|
-
'--color-on-dark',
|
|
465
|
-
'--color-on-light',
|
|
466
|
-
].map(t => [t, officialStops(t)]),
|
|
467
|
-
),
|
|
468
|
-
'--color-background-inverted': /** @type {[number, number]} */ (
|
|
469
|
-
[...officialStops('--color-background-card')].reverse()
|
|
470
|
-
),
|
|
471
|
-
}),
|
|
472
|
-
);
|
|
473
|
-
/** Neutral tokens whose shade stays inside the ramp, off its white and black ends. */
|
|
474
|
-
const NEUTRAL_INSIDE = new Set(['--color-background-inverted']);
|
|
475
|
-
/** Neutral tints: a stop with an opacity, `[[stop, alpha], [stop, alpha]]`. */
|
|
476
|
-
const NEUTRAL_TINTS = wordTable(
|
|
477
|
-
Object.fromEntries(
|
|
478
|
-
['--color-border', '--color-overlay-hover', '--color-overlay-pressed'].map(
|
|
479
|
-
t => [
|
|
480
|
-
t,
|
|
481
|
-
/** @type {[[number, string], [number, string]]} */ (
|
|
482
|
-
OFFICIAL.stops[t].map(x => [x.stop, String(x.alpha)])
|
|
483
|
-
),
|
|
484
|
-
],
|
|
485
|
-
),
|
|
486
|
-
),
|
|
487
|
-
);
|
|
488
|
-
/**
|
|
489
|
-
* Accent and status stops, `[light, dark]`, as the official neutral theme
|
|
490
|
-
* maps its accent tint and its status families (info stands for them). The
|
|
491
|
-
* dark fill starts at 70, where the theme authoring guide puts it, when the
|
|
492
|
-
* exact color does not read in dark. A status tint is translucent in dark
|
|
493
|
-
* (`[stop, alpha]`).
|
|
494
|
-
*/
|
|
495
|
-
const DARK_FILL = 70;
|
|
496
|
-
const TEXT_STOP = officialStops('--color-text-info');
|
|
497
|
-
const ACCENT_MUTED = officialStops('--color-accent-muted');
|
|
498
|
-
const STATUS_MUTED = /** @type {[number, [number, string]]} */ (
|
|
499
|
-
OFFICIAL.stops['--color-info-muted'].map((x, i) =>
|
|
500
|
-
i === 0 ? x.stop : [x.stop, String(x.alpha)],
|
|
501
|
-
)
|
|
502
|
-
);
|
|
503
|
-
const ON_MUTED = officialStops('--color-on-info-muted');
|
|
504
|
-
/**
|
|
505
|
-
* The parts whose secondary text the official neutral theme lifts, with
|
|
506
|
-
* the block it lifts it in and what the text sits on: the accent tint,
|
|
507
|
-
* except under segmented-control labels, which sit on the translucent
|
|
508
|
-
* neutral track (`--color-neutral`).
|
|
509
|
-
*/
|
|
510
|
-
export const LIFT_PARTS = OFFICIAL.lifted.map(
|
|
511
|
-
([part, block]) =>
|
|
512
|
-
/** @type {[string, string, string]} */ ([
|
|
513
|
-
part,
|
|
514
|
-
block,
|
|
515
|
-
liftGround(part, block),
|
|
516
|
-
]),
|
|
517
|
-
);
|
|
518
|
-
/**
|
|
519
|
-
* What a lifted block's secondary text sits on: a card's own fill for a
|
|
520
|
-
* card colour (the card variant rule lifts it there), the translucent
|
|
521
|
-
* neutral track under segmented-control labels, else the accent tint.
|
|
522
|
-
* @param {string} part @param {string} block
|
|
523
|
-
*/
|
|
524
|
-
function liftGround(part, block) {
|
|
525
|
-
if (part === 'segmented-control-item') return '--color-neutral';
|
|
526
|
-
const color = part === 'card' ? /^variant:([\w-]+)$/.exec(block)?.[1] : null;
|
|
527
|
-
return color ? `--color-background-${color}` : '--color-accent-muted';
|
|
528
|
-
}
|
|
529
|
-
/** What each lifted background is, and the parts on it, for notes. */
|
|
530
|
-
const LIFT_GROUNDS =
|
|
531
|
-
/** @type {Record<string, {what: string, parts: string}>} */ ({
|
|
532
|
-
'--color-accent-muted': {
|
|
533
|
-
what: 'the accent tint',
|
|
534
|
-
parts: 'selected items and rows, a dropzone, numbered citations',
|
|
535
|
-
},
|
|
536
|
-
'--color-neutral': {
|
|
537
|
-
what: 'the neutral track',
|
|
538
|
-
parts: 'segmented-control labels',
|
|
539
|
-
},
|
|
540
|
-
...Object.fromEntries(
|
|
541
|
-
LIFT_PARTS.filter(([part]) => part === 'card').map(([, block, g]) => {
|
|
542
|
-
const color = block.replace(/^variant:/, '');
|
|
543
|
-
return [g, {what: `the ${color} card fill`, parts: `${color} cards`}];
|
|
544
|
-
}),
|
|
545
|
-
),
|
|
546
|
-
});
|
|
547
|
-
const BORDER = /** @type {[number, number]} */ ([80, 65]);
|
|
548
|
-
/**
|
|
549
|
-
* Text on a fill, from the neutral family as the official themes take it:
|
|
550
|
-
* white (100) first in light, near-black (5) first in dark, and near-black
|
|
551
|
-
* first in both modes on warning. Without a neutral color, black and white.
|
|
552
|
-
*/
|
|
553
|
-
const [ON_LIGHT, ON_DARK] = officialStops('--color-on-accent');
|
|
554
|
-
const ON_FILL = wordTable(
|
|
555
|
-
/** @type {Record<Mode, [number, number]>} */ ({
|
|
556
|
-
light: [ON_LIGHT, ON_DARK],
|
|
557
|
-
dark: [ON_DARK, ON_LIGHT],
|
|
558
|
-
}),
|
|
559
|
-
);
|
|
560
351
|
/** A layout needs this many stops between black and white to map every token. */
|
|
561
352
|
const MIN_INNER_STOPS = 5;
|
|
562
353
|
/** The widest gap between two stops that still maps every token near its stop. */
|
|
563
354
|
const MAX_STOP_GAP = 25;
|
|
564
355
|
|
|
565
|
-
/** Text on surfaces darkens in light mode and lightens in dark mode. */
|
|
566
|
-
const TOWARD_CONTRAST = wordTable(
|
|
567
|
-
/** @type {Record<Mode, 1 | -1>} */ ({
|
|
568
|
-
light: -1,
|
|
569
|
-
dark: 1,
|
|
570
|
-
}),
|
|
571
|
-
);
|
|
572
|
-
|
|
573
356
|
/** @param {string} slug */
|
|
574
357
|
export function paletteFiles(slug) {
|
|
575
358
|
return {
|
|
@@ -603,15 +386,6 @@ export function seedOf(value) {
|
|
|
603
386
|
return rgb && alphaOf(value) >= 1 ? hex(rgb) : null;
|
|
604
387
|
}
|
|
605
388
|
|
|
606
|
-
/**
|
|
607
|
-
* Below this OKLCH chroma a seed reads as gray: its family is generated as a
|
|
608
|
-
* neutral, so no hue is invented for it in either mode.
|
|
609
|
-
*/
|
|
610
|
-
const GRAY_CHROMA = 0.02;
|
|
611
|
-
|
|
612
|
-
/** @param {string} seed */
|
|
613
|
-
const isGray = seed => hexToOklch(seed).C < GRAY_CHROMA;
|
|
614
|
-
|
|
615
389
|
/** Whether a seed (or no seed) has no color to saturate. @param {string | null} seed */
|
|
616
390
|
export const isGraySeed = seed => !seed || isGray(seed);
|
|
617
391
|
|
|
@@ -642,15 +416,6 @@ export function vibrancyMoves(dial, seed, from, to) {
|
|
|
642
416
|
return ramp(from) !== ramp(to);
|
|
643
417
|
}
|
|
644
418
|
|
|
645
|
-
/** @param {unknown} a @param {unknown} b */
|
|
646
|
-
function sameColor(a, b) {
|
|
647
|
-
try {
|
|
648
|
-
return normalizeColor(String(a)) === normalizeColor(String(b));
|
|
649
|
-
} catch {
|
|
650
|
-
return false;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
419
|
/**
|
|
655
420
|
* The modes a theme has: one for a one-mode theme, else light and dark.
|
|
656
421
|
* @param {{mode?: string}} data
|
|
@@ -665,22 +430,60 @@ export function modesOf(data) {
|
|
|
665
430
|
}
|
|
666
431
|
|
|
667
432
|
/**
|
|
668
|
-
* The color
|
|
433
|
+
* The light-mode color of a token value the theme's own source writes: a
|
|
434
|
+
* plain color, or the first half of a light-dark() pair.
|
|
435
|
+
* @param {string | undefined} value
|
|
436
|
+
*/
|
|
437
|
+
function lightHalf(value) {
|
|
438
|
+
const v = String(value ?? '').trim();
|
|
439
|
+
const pair = /^light-dark\((.*)\)$/is.exec(v);
|
|
440
|
+
return pair ? (splitTop(pair[1], ',')[0] ?? '').trim() : v;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* The color dial settings of a theme, in dial order. A family whose fill
|
|
445
|
+
* token the theme's own source sets exactly takes that color, the one in
|
|
446
|
+
* effect, as its seed: the shades its text, icons and tints read come from
|
|
447
|
+
* the color the fill shows, never from a dial value the source overrides.
|
|
448
|
+
* The neutral family always takes its setting.
|
|
669
449
|
* @param {{settings: Setting[]}} data
|
|
450
|
+
* @param {Record<string, string>} [own] the tokens the theme's own source sets
|
|
670
451
|
*/
|
|
671
|
-
function dialFamilies(data) {
|
|
672
|
-
/** @type {
|
|
452
|
+
function dialFamilies(data, own = {}) {
|
|
453
|
+
/** @type {DialFamily[]} */
|
|
673
454
|
const out = [];
|
|
674
455
|
for (const dial of PALETTE_DIALS) {
|
|
675
456
|
const s = [...data.settings]
|
|
676
457
|
.reverse()
|
|
677
458
|
.find(x => x?.source === 'dial' && x.thing === dial && !x.on && !x.mode);
|
|
678
|
-
|
|
679
|
-
|
|
459
|
+
// The neutral family keeps its setting: a gray the source sets exactly
|
|
460
|
+
// is one surface, not the color every gray grows from.
|
|
461
|
+
const inEffect =
|
|
462
|
+
dial === 'neutral' ? null : seedOf(lightHalf(own[paletteToken(dial)]));
|
|
463
|
+
const seed = inEffect ?? (s && seedOf(s.value));
|
|
464
|
+
if (s && seed)
|
|
465
|
+
out.push({
|
|
466
|
+
id: dial,
|
|
467
|
+
dial,
|
|
468
|
+
seed,
|
|
469
|
+
value: s.value,
|
|
470
|
+
source: inEffect ? paletteToken(dial) : null,
|
|
471
|
+
});
|
|
680
472
|
}
|
|
681
473
|
return out;
|
|
682
474
|
}
|
|
683
475
|
|
|
476
|
+
/**
|
|
477
|
+
* The seed each color family grows from now: the fill the theme's own source
|
|
478
|
+
* sets as a fixed color, else the color setting.
|
|
479
|
+
* @param {string} cwd
|
|
480
|
+
* @param {string} slug
|
|
481
|
+
* @param {{settings: Setting[]}} data
|
|
482
|
+
*/
|
|
483
|
+
export function seedsInEffect(cwd, slug, data) {
|
|
484
|
+
return dialFamilies(data, ownSourceTokenValues(cwd, slug));
|
|
485
|
+
}
|
|
486
|
+
|
|
684
487
|
/** Notes for damaged color configs kept aside during one sync. @type {string[]} */
|
|
685
488
|
const keptDamaged = [];
|
|
686
489
|
|
|
@@ -783,61 +586,6 @@ function deadKeys(config) {
|
|
|
783
586
|
return out;
|
|
784
587
|
}
|
|
785
588
|
|
|
786
|
-
/**
|
|
787
|
-
* The light stop nearest a seed color in the ramp the generator grows from
|
|
788
|
-
* it. The official themes anchor a brand color there, exactly, so the fill
|
|
789
|
-
* keeps the color as given. The end stops are pure black and white and
|
|
790
|
-
* never hold an anchor.
|
|
791
|
-
* @param {string} seed
|
|
792
|
-
* @param {any} config - Its `stops` and `vibrancy` shape the ramp.
|
|
793
|
-
* @param {'chromatic' | 'neutral'} [kind]
|
|
794
|
-
*/
|
|
795
|
-
function seedStop(seed, config, kind = 'chromatic') {
|
|
796
|
-
const {palette} = generate({
|
|
797
|
-
...(config.stops ? {stops: config.stops} : {}),
|
|
798
|
-
...(config.vibrancy != null ? {vibrancy: config.vibrancy} : {}),
|
|
799
|
-
...(kind === 'neutral' ? {neutralProfile: 'custom'} : {}),
|
|
800
|
-
modeStrategy: 'light-only',
|
|
801
|
-
families: [{id: 'seed', seed, kind}],
|
|
802
|
-
});
|
|
803
|
-
const ramp = /** @type {Record<number, string>} */ (
|
|
804
|
-
/** @type {any} */ (palette.seed).light
|
|
805
|
-
);
|
|
806
|
-
return Number(nearestShade(ramp, seed));
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
/**
|
|
810
|
-
* The stop of a ramp whose shade is nearest a color, as the eye compares
|
|
811
|
-
* them; never an end stop (pure black or white, which every ramp shares).
|
|
812
|
-
* Null for a ramp with no inner stop.
|
|
813
|
-
* @param {Record<string | number, string>} ramp
|
|
814
|
-
* @param {string} color
|
|
815
|
-
* @returns {string | null}
|
|
816
|
-
*/
|
|
817
|
-
export function nearestShade(ramp, color) {
|
|
818
|
-
const inner = Object.keys(ramp).filter(s => Number(s) > 0 && Number(s) < 100);
|
|
819
|
-
if (!inner.length) return null;
|
|
820
|
-
return inner.reduce((best, s) =>
|
|
821
|
-
perceptualDelta(ramp[s], color) < perceptualDelta(ramp[best], color)
|
|
822
|
-
? s
|
|
823
|
-
: best,
|
|
824
|
-
);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
/**
|
|
828
|
-
* The stop of a layout nearest `n`; on a tie, the one nearer the middle.
|
|
829
|
-
* @param {readonly number[]} stops
|
|
830
|
-
* @param {number} n
|
|
831
|
-
*/
|
|
832
|
-
function nearestStop(stops, n) {
|
|
833
|
-
return stops.reduce((best, s) => {
|
|
834
|
-
const d = Math.abs(s - n) - Math.abs(best - n);
|
|
835
|
-
return d < 0 || (d === 0 && Math.abs(s - 50) < Math.abs(best - 50))
|
|
836
|
-
? s
|
|
837
|
-
: best;
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
|
|
841
589
|
/**
|
|
842
590
|
* Refuse a stop layout the token mapping cannot use: numbers only, black
|
|
843
591
|
* (0) and white (100), enough shades between them, and no gap so wide that
|
|
@@ -885,42 +633,21 @@ function usableStops(stops, slug) {
|
|
|
885
633
|
}
|
|
886
634
|
|
|
887
635
|
/**
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
636
|
+
* What the palette mapping reads of a theme: its base colors, the tokens it
|
|
637
|
+
* has, its exact token settings (a page-wide token its own source sets wins,
|
|
638
|
+
* as the build shows it), the fixed color a value gives in a mode, and the
|
|
639
|
+
* command that sets a value.
|
|
640
|
+
* @param {string} cwd
|
|
641
|
+
* @param {string} slug
|
|
892
642
|
* @param {{settings: Setting[]}} data
|
|
893
643
|
* @param {{light: Record<string, string>, dark: Record<string, string>} | undefined} base
|
|
644
|
+
* @param {Record<string, unknown>} [tokenDefaults]
|
|
645
|
+
* @returns {import('../theme/palette/generate/mapping.mjs').PaletteMappingContext}
|
|
894
646
|
*/
|
|
895
|
-
function
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
base,
|
|
899
|
-
/** @type {Record<string, string>} */ own = {},
|
|
900
|
-
) {
|
|
901
|
-
const {stops} = candidate;
|
|
902
|
-
/** @param {number} n */
|
|
903
|
-
const at = n => nearestStop(stops, n);
|
|
904
|
-
/** The stop nearest `n` off the white and black ends. @param {number} n */
|
|
905
|
-
const atInside = n =>
|
|
906
|
-
nearestStop(
|
|
907
|
-
stops.filter(s => s > 0 && s < 100),
|
|
908
|
-
n,
|
|
909
|
-
);
|
|
910
|
-
/** @param {string} id @param {Mode} m @param {number} stop @param {string} [alpha] @returns {StopRef} */
|
|
911
|
-
const ref = (id, m, stop, alpha) => {
|
|
912
|
-
const color = /** @type {any} */ (candidate.palette[id])[m][stop];
|
|
913
|
-
return alpha ? {stop, color: `${color}${alpha}`, alpha} : {stop, color};
|
|
914
|
-
};
|
|
915
|
-
const neutral = Boolean(/** @type {any} */ (candidate.palette).neutral);
|
|
916
|
-
/**
|
|
917
|
-
* The whole-theme value a token setting gives in a mode, as written, or
|
|
918
|
-
* undefined.
|
|
919
|
-
* @param {string} token @param {Mode} m
|
|
920
|
-
*/
|
|
647
|
+
function paletteContext(cwd, slug, data, base, tokenDefaults = {}) {
|
|
648
|
+
const own = ownSourceTokenValues(cwd, slug);
|
|
649
|
+
/** @param {string} token @param {Mode} m @returns {string | undefined} */
|
|
921
650
|
const settingOf = (token, m) =>
|
|
922
|
-
// A page-wide token the theme's own source sets wins over the settings
|
|
923
|
-
// (the build shows it), as an exact setting would.
|
|
924
651
|
(Object.hasOwn(own, token) ? own[token] : undefined) ??
|
|
925
652
|
[...data.settings]
|
|
926
653
|
.reverse()
|
|
@@ -965,189 +692,35 @@ function tools(
|
|
|
965
692
|
const t = ref.trim();
|
|
966
693
|
if (!/^--[a-z0-9-]+$/i.test(t) || seen.has(t)) return null;
|
|
967
694
|
seen.add(t);
|
|
968
|
-
const
|
|
695
|
+
const set = settingOf(t, m);
|
|
969
696
|
const read =
|
|
970
|
-
|
|
697
|
+
set != null ? colorIn(set, m, seen) : colorIn(base?.[m]?.[t], m, seen);
|
|
971
698
|
return read ?? (rest.length ? colorIn(rest.join(','), m, seen) : null);
|
|
972
699
|
};
|
|
973
|
-
/**
|
|
974
|
-
* The exact whole-theme color a token setting gives in a mode, or null.
|
|
975
|
-
* @param {string} token @param {Mode} m
|
|
976
|
-
*/
|
|
977
|
-
const exactOf = (token, m) => {
|
|
978
|
-
const v = colorIn(settingOf(token, m), m);
|
|
979
|
-
const rgb = v == null ? null : parseColor(v);
|
|
980
|
-
return rgb && v != null && alphaOf(v) >= 1 ? hex(rgb) : null;
|
|
981
|
-
};
|
|
982
|
-
/**
|
|
983
|
-
* The exact whole-theme color a token setting gives in a mode, see-through
|
|
984
|
-
* or not, as written (a hex keeps its alpha digits; a `light-dark()` or a
|
|
985
|
-
* `var()` gives the color it reads in the mode); null when there is none
|
|
986
|
-
* or it is not a fixed color.
|
|
987
|
-
* @param {string} token @param {Mode} m
|
|
988
|
-
*/
|
|
989
|
-
const rawOf = (token, m) => colorIn(settingOf(token, m), m);
|
|
990
|
-
/**
|
|
991
|
-
* Which column of a `[light, dark]` mapping a mode takes: the light one
|
|
992
|
-
* on a light page and the dark one on a dark page, by the base theme's
|
|
993
|
-
* page, the one its surfaces were made for. A base whose light page is
|
|
994
|
-
* dark, such as Gothic, gets dark-page shades in light. A page color the
|
|
995
|
-
* theme writes is that one color: it never moves every other surface to
|
|
996
|
-
* the other column (a teal page keeps white cards and popovers), and the
|
|
997
|
-
* colors that must read on it are held to it where they are picked.
|
|
998
|
-
* @param {Mode} m
|
|
999
|
-
* @returns {0 | 1}
|
|
1000
|
-
*/
|
|
1001
|
-
const side = m => {
|
|
1002
|
-
const page = base?.[m]?.['--color-background-body'];
|
|
1003
|
-
const rgb = page ? parseColor(page) : null;
|
|
1004
|
-
if (!rgb || alphaOf(page) < 1) return m === 'light' ? 0 : 1;
|
|
1005
|
-
return ratio(rgb, [255, 255, 255]) > ratio(rgb, [0, 0, 0]) ? 1 : 0;
|
|
1006
|
-
};
|
|
1007
|
-
/**
|
|
1008
|
-
* What text and fills sit on in a mode: the theme's exact surface
|
|
1009
|
-
* colors, else the neutral color's surfaces, else the base theme's; the
|
|
1010
|
-
* family's own surface stop when nothing else is known.
|
|
1011
|
-
* @param {Mode} m @param {string} id
|
|
1012
|
-
* @returns {Array<[string, string]>}
|
|
1013
|
-
*/
|
|
1014
|
-
const surfaces = (m, id) => {
|
|
1015
|
-
/** @type {Array<[string, string]>} */
|
|
1016
|
-
const out = [];
|
|
1017
|
-
for (const n of [
|
|
1018
|
-
'--color-background-surface',
|
|
1019
|
-
'--color-background-body',
|
|
1020
|
-
'--color-background-card',
|
|
1021
|
-
]) {
|
|
1022
|
-
const own =
|
|
1023
|
-
neutral && NEUTRAL_STOPS[n]
|
|
1024
|
-
? ref('neutral', m, at(NEUTRAL_STOPS[n][side(m)])).color
|
|
1025
|
-
: null;
|
|
1026
|
-
const v = exactOf(n, m) ?? own ?? base?.[m]?.[n];
|
|
1027
|
-
if (v && parseColor(v) && alphaOf(v) >= 1)
|
|
1028
|
-
out.push([n, hex(/** @type {number[]} */ (parseColor(v)))]);
|
|
1029
|
-
}
|
|
1030
|
-
if (!out.length) {
|
|
1031
|
-
const s = at(NEUTRAL_STOPS['--color-background-surface'][side(m)]);
|
|
1032
|
-
out.push([`${id} shade ${s}`, ref(id, m, s).color]);
|
|
1033
|
-
}
|
|
1034
|
-
return out;
|
|
1035
|
-
};
|
|
1036
|
-
/**
|
|
1037
|
-
* The text shades for a fill, preferred first.
|
|
1038
|
-
* @param {string} id @param {Mode} m
|
|
1039
|
-
* @returns {StopRef[]}
|
|
1040
|
-
*/
|
|
1041
|
-
const onChoices = (id, m) =>
|
|
1042
|
-
(id === 'warning' ? [5, 100] : ON_FILL[m]).map(s =>
|
|
1043
|
-
neutral
|
|
1044
|
-
? {...ref('neutral', m, at(s)), family: 'neutral'}
|
|
1045
|
-
: s >= 50
|
|
1046
|
-
? {stop: 100, color: PALETTE_WHITE, family: 'white'}
|
|
1047
|
-
: {stop: 0, color: PALETTE_BLACK, family: 'black'},
|
|
1048
|
-
);
|
|
1049
|
-
/**
|
|
1050
|
-
* The text on a fill: the preferred shade when it reads at 4.5:1, else
|
|
1051
|
-
* the one that reads better.
|
|
1052
|
-
* @param {string} id @param {Mode} m @param {string} fill
|
|
1053
|
-
*/
|
|
1054
|
-
const onFor = (id, m, fill) => {
|
|
1055
|
-
const [a, b] = onChoices(id, m).map(on => ({
|
|
1056
|
-
on,
|
|
1057
|
-
r: contrast(on.color, fill),
|
|
1058
|
-
}));
|
|
1059
|
-
let best = a.r >= TEXT || a.r >= b.r ? a : b;
|
|
1060
|
-
const other = best === a ? b : a;
|
|
1061
|
-
// Neither reads: the end of the gray ramp on the better side (black
|
|
1062
|
-
// past near-black, white past near-white) when it reads better, so the
|
|
1063
|
-
// text picked is never one a darker or lighter gray would beat.
|
|
1064
|
-
if (best.r < TEXT) {
|
|
1065
|
-
const dark =
|
|
1066
|
-
contrast(best.on.color, PALETTE_WHITE) > contrast(fill, PALETTE_WHITE);
|
|
1067
|
-
/** @type {StopRef} */
|
|
1068
|
-
const end = neutral
|
|
1069
|
-
? {...ref('neutral', m, at(dark ? 0 : 100)), family: 'neutral'}
|
|
1070
|
-
: dark
|
|
1071
|
-
? {stop: 0, color: PALETTE_BLACK, family: 'black'}
|
|
1072
|
-
: {stop: 100, color: PALETTE_WHITE, family: 'white'};
|
|
1073
|
-
const r = contrast(end.color, fill);
|
|
1074
|
-
if (r > best.r) best = {on: end, r};
|
|
1075
|
-
}
|
|
1076
|
-
return {
|
|
1077
|
-
on: best.on,
|
|
1078
|
-
r: best.r,
|
|
1079
|
-
other: other.on,
|
|
1080
|
-
otherR: other.r,
|
|
1081
|
-
first: a.on,
|
|
1082
|
-
};
|
|
1083
|
-
};
|
|
1084
|
-
/** The lowest contrast of a color on the surfaces. @param {string} color @param {Mode} m @param {string} id */
|
|
1085
|
-
const page = (color, m, id) =>
|
|
1086
|
-
Math.min(...surfaces(m, id).map(([, bg]) => contrast(color, bg)));
|
|
1087
|
-
/**
|
|
1088
|
-
* A color as the eye sees it on the surface in a mode: a see-through one
|
|
1089
|
-
* drawn over the first surface.
|
|
1090
|
-
* @param {string} color @param {Mode} m @param {string} id
|
|
1091
|
-
*/
|
|
1092
|
-
const solid = (color, m, id) => {
|
|
1093
|
-
const rgb = /** @type {[number, number, number]} */ (parseColor(color));
|
|
1094
|
-
const a = alphaOf(color);
|
|
1095
|
-
if (a >= 1) return hex(rgb);
|
|
1096
|
-
const under = /** @type {[number, number, number]} */ (
|
|
1097
|
-
parseColor(surfaces(m, id)[0][1])
|
|
1098
|
-
);
|
|
1099
|
-
return hex(compositeOver(rgb, a, under));
|
|
1100
|
-
};
|
|
1101
700
|
return {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
701
|
+
base,
|
|
702
|
+
has: token => token in tokenDefaults,
|
|
703
|
+
reader: {
|
|
704
|
+
rgb: value =>
|
|
705
|
+
/** @type {[number, number, number] | null} */ (parseColor(value)),
|
|
706
|
+
alpha: value => alphaOf(value),
|
|
707
|
+
},
|
|
1107
708
|
settingOf,
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
709
|
+
colorIn: (value, m) => colorIn(value, m),
|
|
710
|
+
setExactly: token =>
|
|
711
|
+
data.settings.some(
|
|
712
|
+
s =>
|
|
713
|
+
s.source === 'token' &&
|
|
714
|
+
s.thing === token &&
|
|
715
|
+
!s.on &&
|
|
716
|
+
!s.when &&
|
|
717
|
+
!s.state,
|
|
718
|
+
),
|
|
719
|
+
setLine: (thing, value, mode) =>
|
|
720
|
+
`${P} set ${slug} ${thing} ${quoteCommandArgument(value)}${mode ? ` --mode ${mode}` : ''}`,
|
|
1115
721
|
};
|
|
1116
722
|
}
|
|
1117
723
|
|
|
1118
|
-
/** A text shade, named for a sentence. @param {StopRef} r */
|
|
1119
|
-
const textName = r =>
|
|
1120
|
-
r.family === 'white' || (r.family === 'neutral' && r.stop >= 95)
|
|
1121
|
-
? 'white'
|
|
1122
|
-
: r.family === 'black' || (r.family === 'neutral' && r.stop <= 10)
|
|
1123
|
-
? 'near-black'
|
|
1124
|
-
: `shade ${r.stop}`;
|
|
1125
|
-
|
|
1126
|
-
/**
|
|
1127
|
-
* Whether the exact seed color works as the dark fill: text on it reads at
|
|
1128
|
-
* 4.5:1 and it stands out from the dark surfaces at 3:1. Why not otherwise.
|
|
1129
|
-
* @param {ReturnType<typeof tools>} t
|
|
1130
|
-
* @param {string} id
|
|
1131
|
-
* @param {string} seed
|
|
1132
|
-
*/
|
|
1133
|
-
function darkExact(t, id, seed) {
|
|
1134
|
-
const on = t.onFor(id, 'dark', seed);
|
|
1135
|
-
if (on.r < TEXT)
|
|
1136
|
-
return {
|
|
1137
|
-
ok: false,
|
|
1138
|
-
ratio: round(on.r),
|
|
1139
|
-
why: `your exact color reads at only ${round(on.r)}:1 with any text shade, and text needs ${TEXT}:1`,
|
|
1140
|
-
};
|
|
1141
|
-
const p = t.page(seed, 'dark', id);
|
|
1142
|
-
if (p < NON_TEXT)
|
|
1143
|
-
return {
|
|
1144
|
-
ok: false,
|
|
1145
|
-
ratio: round(p),
|
|
1146
|
-
why: `your exact color stands out from the dark page at only ${round(p)}:1, and a fill needs ${NON_TEXT}:1`,
|
|
1147
|
-
};
|
|
1148
|
-
return {ok: true, ratio: round(on.r), why: ''};
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
724
|
/**
|
|
1152
725
|
* What the config writer decided: the config, what it kept or replaced of
|
|
1153
726
|
* a hand edit, and for each accent or status color the stop of its exact
|
|
@@ -1168,14 +741,17 @@ function darkExact(t, id, seed) {
|
|
|
1168
741
|
* the author's own stay. Null when the config would hold no family.
|
|
1169
742
|
* @param {string} cwd
|
|
1170
743
|
* @param {string} slug
|
|
1171
|
-
* @param {{mode?: string, settings: Setting[]}} data
|
|
744
|
+
* @param {{mode?: string, settings: Setting[], palette?: string}} data
|
|
1172
745
|
* @param {{light: Record<string, string>, dark: Record<string, string>}} [base] the base theme's resolved colors, which the dark check reads
|
|
1173
746
|
* @returns {PalettePlan | null}
|
|
1174
747
|
*/
|
|
1175
748
|
function planPalette(cwd, slug, data, base) {
|
|
1176
749
|
const file = paletteFiles(slug).config;
|
|
1177
750
|
const existing = readConfig(path.join(cwd, file));
|
|
1178
|
-
|
|
751
|
+
// (Before anything reads it, so the refusal names this project's way to
|
|
752
|
+
// a newer CLI.)
|
|
753
|
+
refuseUnknownRecipe(existing, file, cwd);
|
|
754
|
+
const fams = dialFamilies(data, ownSourceTokenValues(cwd, slug));
|
|
1179
755
|
if (!existing && !fams.length) return null;
|
|
1180
756
|
/** @type {string[]} */
|
|
1181
757
|
const notes = [];
|
|
@@ -1231,29 +807,35 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1231
807
|
);
|
|
1232
808
|
/** @type {any[]} */
|
|
1233
809
|
const before = Array.isArray(config.families) ? config.families : [];
|
|
1234
|
-
const savedSeeds = dialFamilies(
|
|
810
|
+
const savedSeeds = dialFamilies(
|
|
811
|
+
{settings: saved},
|
|
812
|
+
ownSourceTokenValues(cwd, slug),
|
|
813
|
+
);
|
|
814
|
+
// A config the editor wrote holds the seeds it gave, from the settings and
|
|
815
|
+
// the source as they were then: its seed is never a hand edit.
|
|
816
|
+
const configMine = configWrittenByEditor(cwd, slug, data);
|
|
1235
817
|
|
|
1236
818
|
/**
|
|
1237
819
|
* One dial family: the author's family with the dial's seed and the
|
|
1238
820
|
* exact anchors of that seed in place of the old ones.
|
|
1239
821
|
* @param {any} prev
|
|
1240
|
-
* @param {
|
|
822
|
+
* @param {DialFamily} f
|
|
1241
823
|
*/
|
|
1242
824
|
const familyOf = (prev, f) => {
|
|
1243
825
|
const old = prev && typeof prev === 'object' ? prev : {};
|
|
1244
826
|
const neutral = f.id === 'neutral';
|
|
1245
|
-
const wasSaved =
|
|
827
|
+
const wasSaved = configMine
|
|
828
|
+
? old.seed
|
|
829
|
+
: savedSeeds.find(x => x.id === f.id)?.seed;
|
|
1246
830
|
if (old.seed != null && wasSaved && !sameColor(old.seed, wasSaved))
|
|
1247
831
|
notes.push(
|
|
1248
|
-
`${file}: the ${f.id} seed ${old.seed} there is replaced by your ${f.id} setting, ${f.seed}`,
|
|
832
|
+
`${file}: the ${f.id} seed ${old.seed} there is replaced by ${f.source ? `the ${f.source} your theme source sets` : `your ${f.id} setting`}, ${f.seed}`,
|
|
1249
833
|
);
|
|
1250
|
-
const
|
|
834
|
+
const {family: made, stop} = dialFamily(f, config, modes);
|
|
835
|
+
// The setting's family as a fresh palette has it; of the author's
|
|
836
|
+
// family, a chromatic kind stays.
|
|
1251
837
|
const kind =
|
|
1252
|
-
|
|
1253
|
-
? 'neutral'
|
|
1254
|
-
: old.kind === 'chromatic'
|
|
1255
|
-
? 'chromatic'
|
|
1256
|
-
: undefined;
|
|
838
|
+
made.kind ?? (old.kind === 'chromatic' ? 'chromatic' : undefined);
|
|
1257
839
|
if (
|
|
1258
840
|
old.kind === 'neutral' &&
|
|
1259
841
|
!kind &&
|
|
@@ -1263,25 +845,8 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1263
845
|
notes.push(
|
|
1264
846
|
`${file}: the ${f.id} kind "neutral" is dropped: your ${f.id} is not a gray, and a neutral kind turns its shades gray where no exact color holds them`,
|
|
1265
847
|
);
|
|
1266
|
-
const stop = seedStop(
|
|
1267
|
-
f.seed,
|
|
1268
|
-
config,
|
|
1269
|
-
kind === 'neutral' ? 'neutral' : 'chromatic',
|
|
1270
|
-
);
|
|
1271
|
-
// White and black already end every ramp, so a neutral of either holds
|
|
1272
|
-
// no anchor of its own.
|
|
1273
|
-
const ends =
|
|
1274
|
-
neutral &&
|
|
1275
|
-
(sameColor(f.seed, PALETTE_WHITE) || sameColor(f.seed, PALETTE_BLACK));
|
|
1276
848
|
/** @type {any[]} */
|
|
1277
|
-
const mine =
|
|
1278
|
-
? []
|
|
1279
|
-
: (neutral ? modes : modes.filter(m => m === 'light')).map(m => ({
|
|
1280
|
-
mode: m,
|
|
1281
|
-
stop,
|
|
1282
|
-
color: f.seed,
|
|
1283
|
-
policy: 'exact',
|
|
1284
|
-
}));
|
|
849
|
+
const mine = made.anchors ?? [];
|
|
1285
850
|
/** @type {any[]} */
|
|
1286
851
|
const kept = [];
|
|
1287
852
|
const anchors = Array.isArray(old.anchors) ? old.anchors : [];
|
|
@@ -1322,7 +887,7 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1322
887
|
const out = {
|
|
1323
888
|
...old,
|
|
1324
889
|
id: f.id,
|
|
1325
|
-
name: old.name ??
|
|
890
|
+
name: old.name ?? made.name,
|
|
1326
891
|
seed: f.seed,
|
|
1327
892
|
...(kind ? {kind} : {}),
|
|
1328
893
|
anchors: [...mine, ...kept].sort((a, b) =>
|
|
@@ -1348,16 +913,14 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1348
913
|
const mine = fams.find(x => x.id === f.id);
|
|
1349
914
|
if (!mine) return null;
|
|
1350
915
|
const {family, stop} = familyOf(f, mine);
|
|
1351
|
-
if (mine.id !== 'neutral')
|
|
1352
|
-
fills[mine.id] = {stop, dark: false, why: '', ratio: 0};
|
|
916
|
+
if (mine.id !== 'neutral') fills[mine.id] = fillAt(stop);
|
|
1353
917
|
return family;
|
|
1354
918
|
})
|
|
1355
919
|
.filter(Boolean);
|
|
1356
920
|
for (const f of fams)
|
|
1357
921
|
if (!families.some(x => x?.id === f.id)) {
|
|
1358
922
|
const {family, stop} = familyOf(null, f);
|
|
1359
|
-
if (f.id !== 'neutral')
|
|
1360
|
-
fills[f.id] = {stop, dark: false, why: '', ratio: 0};
|
|
923
|
+
if (f.id !== 'neutral') fills[f.id] = fillAt(stop);
|
|
1361
924
|
families.push(family);
|
|
1362
925
|
}
|
|
1363
926
|
if (!families.length) return null;
|
|
@@ -1411,60 +974,23 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1411
974
|
// The exact color anchors dark mode too when it reads there, as the
|
|
1412
975
|
// official themes anchor a brand color in both modes.
|
|
1413
976
|
if (modes.includes('dark') && Object.keys(fills).length) {
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
const add = [];
|
|
1422
|
-
for (const [id, fill] of Object.entries(fills)) {
|
|
1423
|
-
const seed = /** @type {string} */ (fams.find(f => f.id === id)?.seed);
|
|
1424
|
-
const check = darkExact(t, id, seed);
|
|
1425
|
-
Object.assign(fill, {why: check.why, ratio: check.ratio});
|
|
1426
|
-
if (check.ok) add.push(id);
|
|
1427
|
-
}
|
|
1428
|
-
/** @param {string} id @param {any} cfg */
|
|
1429
|
-
const withDark = (id, cfg) => ({
|
|
1430
|
-
...cfg,
|
|
1431
|
-
families: cfg.families.map((/** @type {any} */ f) => {
|
|
1432
|
-
if (f?.id !== id) return f;
|
|
1433
|
-
const anchor = {
|
|
1434
|
-
mode: 'dark',
|
|
1435
|
-
stop: fills[id].stop,
|
|
1436
|
-
color: f.seed,
|
|
1437
|
-
policy: 'exact',
|
|
1438
|
-
};
|
|
1439
|
-
const others = (f.anchors ?? []).filter(
|
|
1440
|
-
(/** @type {any} */ a) =>
|
|
1441
|
-
!(a.mode === 'dark' && a.stop === anchor.stop),
|
|
1442
|
-
);
|
|
1443
|
-
if (others.length < (f.anchors ?? []).length)
|
|
977
|
+
try {
|
|
978
|
+
config.families = anchorDarkFills(
|
|
979
|
+
config,
|
|
980
|
+
fams,
|
|
981
|
+
fills,
|
|
982
|
+
paletteContext(cwd, slug, data, base),
|
|
983
|
+
(id, stop) =>
|
|
1444
984
|
notes.push(
|
|
1445
|
-
`${file}: your dark anchor at shade ${shade(
|
|
1446
|
-
);
|
|
1447
|
-
return {
|
|
1448
|
-
...f,
|
|
1449
|
-
anchors: [...others, anchor].sort((a, b) =>
|
|
1450
|
-
a.mode === b.mode ? a.stop - b.stop : a.mode === 'light' ? -1 : 1,
|
|
985
|
+
`${file}: your dark anchor at shade ${shade(stop)} of ${id} is replaced by your exact ${id} color`,
|
|
1451
986
|
),
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
try {
|
|
1459
|
-
generateTonalPalette(tried);
|
|
1460
|
-
next = tried;
|
|
1461
|
-
fills[id].dark = true;
|
|
1462
|
-
} catch {
|
|
1463
|
-
fills[id].why =
|
|
1464
|
-
'the dark shades cannot hold your exact color and stay in order from dark to light';
|
|
1465
|
-
}
|
|
987
|
+
);
|
|
988
|
+
} catch (error) {
|
|
989
|
+
// A config the generator refuses is refused as the editor refuses
|
|
990
|
+
// it, naming the file.
|
|
991
|
+
generate(config, file);
|
|
992
|
+
throw error;
|
|
1466
993
|
}
|
|
1467
|
-
config.families = next.families;
|
|
1468
994
|
}
|
|
1469
995
|
return {config, notes, fills};
|
|
1470
996
|
}
|
|
@@ -1509,6 +1035,38 @@ export function syncPalette(cwd, slug, data, base) {
|
|
|
1509
1035
|
return [...keptDamaged.splice(0), ...notes];
|
|
1510
1036
|
}
|
|
1511
1037
|
|
|
1038
|
+
/**
|
|
1039
|
+
* Whether the editor wrote the theme's palette config as it is now: its hash
|
|
1040
|
+
* is the one the settings hold (`data.palette`, or the saved settings, which
|
|
1041
|
+
* an undo may carry from before the palette existed), or the one the editor
|
|
1042
|
+
* recorded writing (a color change stopped before its settings were saved).
|
|
1043
|
+
* @param {string} cwd
|
|
1044
|
+
* @param {string} slug
|
|
1045
|
+
* @param {{palette?: string}} data
|
|
1046
|
+
*/
|
|
1047
|
+
function configWrittenByEditor(cwd, slug, data) {
|
|
1048
|
+
const file = path.join(cwd, paletteFiles(slug).config);
|
|
1049
|
+
if (!fs.existsSync(file)) return false;
|
|
1050
|
+
const hash = sha256(fs.readFileSync(file));
|
|
1051
|
+
/** @type {string | undefined} */
|
|
1052
|
+
let saved;
|
|
1053
|
+
try {
|
|
1054
|
+
saved = JSON.parse(
|
|
1055
|
+
fs.readFileSync(
|
|
1056
|
+
path.join(cwd, 'themes', slug, `${slug}.settings.json`),
|
|
1057
|
+
'utf8',
|
|
1058
|
+
),
|
|
1059
|
+
).palette;
|
|
1060
|
+
} catch {
|
|
1061
|
+
saved = undefined;
|
|
1062
|
+
}
|
|
1063
|
+
return (
|
|
1064
|
+
data.palette === hash ||
|
|
1065
|
+
saved === hash ||
|
|
1066
|
+
readWrittenRecord(cwd, slug)['palette.config.json'] === hash
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1512
1070
|
/**
|
|
1513
1071
|
* @param {string} cwd
|
|
1514
1072
|
* @param {string} slug
|
|
@@ -1523,26 +1081,7 @@ function syncPaletteFiles(cwd, slug, data, base) {
|
|
|
1523
1081
|
if (!plan) {
|
|
1524
1082
|
// Only palette files the editor wrote go: a hand-made palette.config.json
|
|
1525
1083
|
// (and what it generated) stays.
|
|
1526
|
-
|
|
1527
|
-
// from before the palette existed.
|
|
1528
|
-
/** @type {string | undefined} */
|
|
1529
|
-
let saved;
|
|
1530
|
-
try {
|
|
1531
|
-
saved = JSON.parse(
|
|
1532
|
-
fs.readFileSync(abs(`themes/${slug}/${slug}.settings.json`), 'utf8'),
|
|
1533
|
-
).palette;
|
|
1534
|
-
} catch {
|
|
1535
|
-
saved = undefined;
|
|
1536
|
-
}
|
|
1537
|
-
const hash = fs.existsSync(abs(f.config))
|
|
1538
|
-
? sha256(fs.readFileSync(abs(f.config)))
|
|
1539
|
-
: null;
|
|
1540
|
-
// Or the config the editor recorded writing (a color change stopped
|
|
1541
|
-
// before its settings were saved).
|
|
1542
|
-
const recorded = readWrittenRecord(cwd, slug)['palette.config.json'];
|
|
1543
|
-
const mine =
|
|
1544
|
-
hash != null &&
|
|
1545
|
-
(data.palette === hash || saved === hash || recorded === hash);
|
|
1084
|
+
const mine = configWrittenByEditor(cwd, slug, data);
|
|
1546
1085
|
delete data.palette;
|
|
1547
1086
|
if (!mine) return [];
|
|
1548
1087
|
// A palette file edited by hand is never deleted: it stays, and the
|
|
@@ -2001,12 +1540,39 @@ export function syncPaletteRefs(cwd, slug, source, pal) {
|
|
|
2001
1540
|
writeWhole(file, text);
|
|
2002
1541
|
}
|
|
2003
1542
|
|
|
1543
|
+
/**
|
|
1544
|
+
* A palette made with a recipe this CLI does not know, with the file left as
|
|
1545
|
+
* it is. A newer CLI's recipe is no fault to fix by hand: it gets the
|
|
1546
|
+
* refusal `theme palette generate` gives, with the update step that fits
|
|
1547
|
+
* where the CLI runs. Any other recipe is named as no recipe Astryx makes,
|
|
1548
|
+
* and the file is the fix: its `recipe` set to one this CLI knows.
|
|
1549
|
+
* @param {any} config
|
|
1550
|
+
* @param {string} file the config's path, for the refusal
|
|
1551
|
+
* @param {string} [cwd] the project, for the step that updates the CLI
|
|
1552
|
+
*/
|
|
1553
|
+
function refuseUnknownRecipe(config, file, cwd) {
|
|
1554
|
+
const recipe = config?.recipe;
|
|
1555
|
+
if (recipe == null || PALETTE_RECIPES.includes(recipe)) return;
|
|
1556
|
+
if (newerRecipe(recipe))
|
|
1557
|
+
throw newerRecipeRefusal({recipe, file, cwd: cwd ?? process.cwd()});
|
|
1558
|
+
// Every command that reads the theme builds this plan and meets this
|
|
1559
|
+
// refusal again, so the way out is the file itself, and no command is
|
|
1560
|
+
// offered.
|
|
1561
|
+
throw new AstryxError(
|
|
1562
|
+
`${file}: this theme's colors name the palette recipe ${String(recipe)}, which no Astryx CLI makes. Fix that part of the file by hand: set "recipe" to one of the recipes this CLI (${cliVersion()}) knows, ${PALETTE_RECIPES.join(', ')}. Nothing was changed.`,
|
|
1563
|
+
[],
|
|
1564
|
+
ERROR_CODES.ERR_PALETTE_GENERATION,
|
|
1565
|
+
);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
2004
1568
|
/**
|
|
2005
1569
|
* @param {any} config
|
|
2006
1570
|
* @param {string} [file] the config's path, for the refusal
|
|
1571
|
+
* @param {string} [cwd] the project, for the command that updates the CLI
|
|
2007
1572
|
* @returns {Candidate}
|
|
2008
1573
|
*/
|
|
2009
|
-
function generate(config, file = 'palette.config.json') {
|
|
1574
|
+
function generate(config, file = 'palette.config.json', cwd = undefined) {
|
|
1575
|
+
refuseUnknownRecipe(config, file, cwd);
|
|
2010
1576
|
try {
|
|
2011
1577
|
return generateTonalPalette(config);
|
|
2012
1578
|
} catch (e) {
|
|
@@ -2018,68 +1584,6 @@ function generate(config, file = 'palette.config.json') {
|
|
|
2018
1584
|
}
|
|
2019
1585
|
}
|
|
2020
1586
|
|
|
2021
|
-
/**
|
|
2022
|
-
* The contrast ratio of two opaque colors. A color that does not parse is
|
|
2023
|
-
* a bug in the mapping, never a ratio of 0.
|
|
2024
|
-
* @param {string} a @param {string} b
|
|
2025
|
-
*/
|
|
2026
|
-
function contrast(a, b) {
|
|
2027
|
-
const x = parseColor(a);
|
|
2028
|
-
const y = parseColor(b);
|
|
2029
|
-
if (!x || !y) throw new Error(`No contrast between "${a}" and "${b}".`);
|
|
2030
|
-
return ratio(x, y);
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
|
-
/**
|
|
2034
|
-
* A translucent stop drawn over each surface, as the opaque colors the eye
|
|
2035
|
-
* sees; an opaque stop as it is.
|
|
2036
|
-
* @param {string} name @param {StopRef} r @param {Array<[string, string]>} under
|
|
2037
|
-
* @returns {Array<[string, string]>}
|
|
2038
|
-
*/
|
|
2039
|
-
function over(name, r, under) {
|
|
2040
|
-
if (!r.alpha) return [[name, r.color]];
|
|
2041
|
-
const top = /** @type {[number, number, number]} */ (
|
|
2042
|
-
parseColor(r.color.slice(0, 7))
|
|
2043
|
-
);
|
|
2044
|
-
const a = parseInt(r.alpha, 16) / 255;
|
|
2045
|
-
return under.map(([n, bg]) => [
|
|
2046
|
-
`${name} over ${n}`,
|
|
2047
|
-
hex(
|
|
2048
|
-
compositeOver(
|
|
2049
|
-
top,
|
|
2050
|
-
a,
|
|
2051
|
-
/** @type {[number, number, number]} */ (parseColor(bg)),
|
|
2052
|
-
),
|
|
2053
|
-
),
|
|
2054
|
-
]);
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
/** @param {number} r */
|
|
2058
|
-
const round = r => Math.round(r * 100) / 100;
|
|
2059
|
-
|
|
2060
|
-
/** A stop as text: a layout may hold 16.666666666666668. @param {number} s */
|
|
2061
|
-
const shade = s => String(round(s));
|
|
2062
|
-
|
|
2063
|
-
/**
|
|
2064
|
-
* A gray ramp the generator grows from a gray of the theme (its secondary
|
|
2065
|
-
* text), for a mode: the grays of a theme whose palette has no neutral
|
|
2066
|
-
* family. Null when the seed does not grow.
|
|
2067
|
-
* @param {string} seed @param {Mode} m
|
|
2068
|
-
* @returns {Record<string, string> | null}
|
|
2069
|
-
*/
|
|
2070
|
-
function grownGrays(seed, m) {
|
|
2071
|
-
try {
|
|
2072
|
-
const g = generateTonalPalette({
|
|
2073
|
-
modeStrategy: m === 'light' ? 'light-only' : 'dark-only',
|
|
2074
|
-
neutralProfile: 'custom',
|
|
2075
|
-
families: [{id: 'gray', seed, kind: 'neutral'}],
|
|
2076
|
-
});
|
|
2077
|
-
return /** @type {any} */ (g.palette.gray)[m] ?? null;
|
|
2078
|
-
} catch {
|
|
2079
|
-
return null;
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
1587
|
/**
|
|
2084
1588
|
* A family's ramp in each mode, as the theme makes it: the palette's own
|
|
2085
1589
|
* family when its color settings define one; for the neutral family, else
|
|
@@ -2098,7 +1602,7 @@ export function familyRamp(cwd, slug, data, base, family) {
|
|
|
2098
1602
|
planPalette(cwd, slug, data, base)
|
|
2099
1603
|
);
|
|
2100
1604
|
const ramp = /** @type {any} */ (
|
|
2101
|
-
generate(plan.config, paletteFiles(slug).config).palette
|
|
1605
|
+
generate(plan.config, paletteFiles(slug).config, cwd).palette
|
|
2102
1606
|
)[family];
|
|
2103
1607
|
if (ramp?.light && ramp?.dark) return ramp;
|
|
2104
1608
|
}
|
|
@@ -2137,670 +1641,22 @@ export function familyRamp(cwd, slug, data, base, family) {
|
|
|
2137
1641
|
* @returns {PaletteMapping | null}
|
|
2138
1642
|
*/
|
|
2139
1643
|
export function paletteMapping(cwd, slug, data, base, tokenDefaults) {
|
|
2140
|
-
const fams = dialFamilies(data);
|
|
1644
|
+
const fams = dialFamilies(data, ownSourceTokenValues(cwd, slug));
|
|
2141
1645
|
if (!fams.length) return null;
|
|
2142
1646
|
const plan = /** @type {PalettePlan} */ (planPalette(cwd, slug, data, base));
|
|
2143
1647
|
const {config} = plan;
|
|
2144
|
-
const candidate = generate(config, paletteFiles(slug).config);
|
|
2145
|
-
const
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
exactOf,
|
|
2152
|
-
rawOf,
|
|
2153
|
-
settingOf,
|
|
2154
|
-
side,
|
|
2155
|
-
solid,
|
|
2156
|
-
surfaces,
|
|
2157
|
-
} = t;
|
|
2158
|
-
// Both halves, for a one-mode theme too (see planPalette).
|
|
2159
|
-
const modes = modesForStrategy('light-and-dark');
|
|
2160
|
-
/** @type {PaletteMapping['tokens']} */
|
|
2161
|
-
const tokens = {};
|
|
2162
|
-
/** @type {ContrastCheck[]} */
|
|
2163
|
-
const checks = [];
|
|
2164
|
-
/** @type {PaletteMapping['exact']} */
|
|
2165
|
-
const exact = {};
|
|
2166
|
-
/** @type {Record<string, string>} */
|
|
2167
|
-
const unread = {};
|
|
2168
|
-
const has = (/** @type {string} */ k) => k in tokenDefaults;
|
|
2169
|
-
/** A token the theme sets exactly in any mode: no check speaks for it. @param {string} k */
|
|
2170
|
-
const setExactly = k =>
|
|
2171
|
-
data.settings.some(
|
|
2172
|
-
s =>
|
|
2173
|
-
s.source === 'token' && s.thing === k && !s.on && !s.when && !s.state,
|
|
2174
|
-
);
|
|
2175
|
-
const reports = (/** @type {string} */ k) => has(k) && !setExactly(k);
|
|
2176
|
-
/**
|
|
2177
|
-
* Point a token at its stops. A theme with one mode has one ramp: the
|
|
2178
|
-
* other side repeats it.
|
|
2179
|
-
* @param {string} token @param {string} id @param {Partial<Record<Mode, StopRef>>} refs
|
|
2180
|
-
*/
|
|
2181
|
-
const put = (token, id, refs) => {
|
|
2182
|
-
if (!has(token)) return;
|
|
2183
|
-
const one = /** @type {StopRef} */ (refs[modes[0]]);
|
|
2184
|
-
tokens[token] = {
|
|
2185
|
-
family: id,
|
|
2186
|
-
light: refs.light ?? one,
|
|
2187
|
-
dark: refs.dark ?? one,
|
|
2188
|
-
};
|
|
2189
|
-
};
|
|
2190
|
-
/** @template T @param {(m: Mode) => T} fn @returns {Partial<Record<Mode, T>>} */
|
|
2191
|
-
const each = fn => Object.fromEntries(modes.map(m => [m, fn(m)]));
|
|
2192
|
-
/**
|
|
2193
|
-
* The stop nearest `start` that reads at `needs` on every color in `on`,
|
|
2194
|
-
* searched both ways (the usual way first on a tie: darker in light,
|
|
2195
|
-
* lighter in dark), so a base with dark light-mode surfaces still finds
|
|
2196
|
-
* one; the most contrasting stop of all when none does.
|
|
2197
|
-
* @param {string} token @param {string} id @param {Mode} m @param {number} start
|
|
2198
|
-
* @param {Array<[string, string]>} on - `[name, color]` pairs.
|
|
2199
|
-
* @param {number} needs
|
|
2200
|
-
*/
|
|
2201
|
-
const pick = (token, id, m, start, on, needs) => {
|
|
2202
|
-
const usual = TOWARD_CONTRAST[m];
|
|
2203
|
-
const order = [...stops].sort(
|
|
2204
|
-
(a, b) =>
|
|
2205
|
-
Math.abs(a - start) - Math.abs(b - start) ||
|
|
2206
|
-
(Math.sign(b - a) === usual ? 1 : -1),
|
|
2207
|
-
);
|
|
2208
|
-
/** @param {number} stop */
|
|
2209
|
-
const score = stop => {
|
|
2210
|
-
const c = ref(id, m, stop).color;
|
|
2211
|
-
return Math.min(...on.map(([, bg]) => contrast(c, bg)));
|
|
2212
|
-
};
|
|
2213
|
-
const scored = order.map(stop => ({stop, r: score(stop)}));
|
|
2214
|
-
const b =
|
|
2215
|
-
scored.find(x => x.r >= needs) ??
|
|
2216
|
-
scored.reduce((x, y) => (y.r > x.r ? y : x));
|
|
2217
|
-
if (reports(token))
|
|
2218
|
-
checks.push({
|
|
2219
|
-
token,
|
|
2220
|
-
mode: m,
|
|
2221
|
-
stop: b.stop,
|
|
2222
|
-
preferred: start,
|
|
2223
|
-
against: on.map(([n]) => n).join(', '),
|
|
2224
|
-
ratio: round(b.r),
|
|
2225
|
-
needs,
|
|
2226
|
-
pass: b.r >= needs,
|
|
2227
|
-
});
|
|
2228
|
-
return ref(id, m, b.stop);
|
|
2229
|
-
};
|
|
2230
|
-
|
|
2231
|
-
const neutral = fams.find(f => f.id === 'neutral');
|
|
2232
|
-
if (neutral) {
|
|
2233
|
-
for (const [token, pair] of Object.entries(NEUTRAL_STOPS)) {
|
|
2234
|
-
if (
|
|
2235
|
-
token === '--color-text-secondary' ||
|
|
2236
|
-
token === '--color-icon-secondary'
|
|
2237
|
-
)
|
|
2238
|
-
continue;
|
|
2239
|
-
const shade = NEUTRAL_INSIDE.has(token) ? atInside : at;
|
|
2240
|
-
put(
|
|
2241
|
-
token,
|
|
2242
|
-
'neutral',
|
|
2243
|
-
each(m => ref('neutral', m, shade(pair[side(m)]))),
|
|
2244
|
-
);
|
|
2245
|
-
}
|
|
2246
|
-
for (const [token, pair] of Object.entries(NEUTRAL_TINTS))
|
|
2247
|
-
put(
|
|
2248
|
-
token,
|
|
2249
|
-
'neutral',
|
|
2250
|
-
each(m => {
|
|
2251
|
-
const [s, a] = pair[side(m)];
|
|
2252
|
-
return ref('neutral', m, at(s), a);
|
|
2253
|
-
}),
|
|
2254
|
-
);
|
|
2255
|
-
for (const [token, needs] of /** @type {const} */ ([
|
|
2256
|
-
['--color-text-secondary', TEXT],
|
|
2257
|
-
['--color-icon-secondary', NON_TEXT],
|
|
2258
|
-
]))
|
|
2259
|
-
put(
|
|
2260
|
-
token,
|
|
2261
|
-
'neutral',
|
|
2262
|
-
each(m =>
|
|
2263
|
-
pick(
|
|
2264
|
-
token,
|
|
2265
|
-
'neutral',
|
|
2266
|
-
m,
|
|
2267
|
-
at(NEUTRAL_STOPS[token][side(m)]),
|
|
2268
|
-
surfaces(m, 'neutral'),
|
|
2269
|
-
needs,
|
|
2270
|
-
),
|
|
2271
|
-
),
|
|
2272
|
-
);
|
|
2273
|
-
const surface = paletteToken('neutral');
|
|
2274
|
-
const set = each(m => exactOf(surface, m));
|
|
2275
|
-
if (Object.values(set).some(Boolean))
|
|
2276
|
-
exact[surface] = /** @type {Partial<Record<Mode, string>>} */ (
|
|
2277
|
-
Object.fromEntries(Object.entries(set).filter(([, v]) => v))
|
|
2278
|
-
);
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
for (const f of fams) {
|
|
2282
|
-
if (f.id === 'neutral') continue;
|
|
2283
|
-
const word = f.id === 'accent' ? null : STATUS_TOKEN[f.id];
|
|
2284
|
-
const names = word
|
|
2285
|
-
? {
|
|
2286
|
-
fill: `--color-${word}`,
|
|
2287
|
-
on: `--color-on-${word}`,
|
|
2288
|
-
text: `--color-text-${word}`,
|
|
2289
|
-
icon: `--color-icon-${word}`,
|
|
2290
|
-
muted: `--color-${word}-muted`,
|
|
2291
|
-
onMuted: `--color-on-${word}-muted`,
|
|
2292
|
-
border: `--color-border-${word}`,
|
|
2293
|
-
focus: null,
|
|
2294
|
-
}
|
|
2295
|
-
: {
|
|
2296
|
-
fill: '--color-accent',
|
|
2297
|
-
on: '--color-on-accent',
|
|
2298
|
-
text: '--color-text-accent',
|
|
2299
|
-
icon: '--color-icon-accent',
|
|
2300
|
-
muted: '--color-accent-muted',
|
|
2301
|
-
onMuted: null,
|
|
2302
|
-
border: null,
|
|
2303
|
-
focus: '--focus-outline-color',
|
|
2304
|
-
};
|
|
2305
|
-
const plain = plan.fills[f.id];
|
|
2306
|
-
const S = plain.stop;
|
|
2307
|
-
const fillWord = f.id;
|
|
2308
|
-
/** @type {Partial<Record<Mode, string>>} */
|
|
2309
|
-
const exactFill = {};
|
|
2310
|
-
for (const m of modes) {
|
|
2311
|
-
const v = rawOf(names.fill, m);
|
|
2312
|
-
if (v) exactFill[m] = v;
|
|
2313
|
-
else if (settingOf(names.fill, m) != null)
|
|
2314
|
-
unread[names.fill] = String(settingOf(names.fill, m)).trim();
|
|
2315
|
-
}
|
|
2316
|
-
if (Object.keys(exactFill).length)
|
|
2317
|
-
exact[names.fill] = Object.fromEntries(
|
|
2318
|
-
Object.entries(exactFill).map(([m, v]) => {
|
|
2319
|
-
// A var() is named with the color it reads, so the note says
|
|
2320
|
-
// which color the text was picked for.
|
|
2321
|
-
const written = String(
|
|
2322
|
-
settingOf(names.fill, /** @type {Mode} */ (m)) ?? '',
|
|
2323
|
-
).trim();
|
|
2324
|
-
const rgb = parseColor(v);
|
|
2325
|
-
const color = rgb && alphaOf(v) >= 1 ? hex(rgb) : v;
|
|
2326
|
-
return [m, /var\(/i.test(written) ? `${written} = ${color}` : v];
|
|
2327
|
-
}),
|
|
2328
|
-
);
|
|
2329
|
-
|
|
2330
|
-
/** @type {Partial<Record<Mode, StopRef>>} */
|
|
2331
|
-
const fill = {};
|
|
2332
|
-
for (const m of modes) {
|
|
2333
|
-
if (m === 'light' || plain.dark) {
|
|
2334
|
-
fill[m] = {...ref(f.id, m, S), exact: true};
|
|
2335
|
-
continue;
|
|
2336
|
-
}
|
|
2337
|
-
// The dark fill when the exact color does not read there: shade 70,
|
|
2338
|
-
// else the shade nearest 70 that passes, else 70.
|
|
2339
|
-
const start = at(DARK_FILL);
|
|
2340
|
-
const order = [...stops]
|
|
2341
|
-
.filter(s => s > 0 && s < 100)
|
|
2342
|
-
.sort((a, b) => Math.abs(a - start) - Math.abs(b - start) || b - a);
|
|
2343
|
-
const found =
|
|
2344
|
-
order.find(s => {
|
|
2345
|
-
const c = ref(f.id, m, s).color;
|
|
2346
|
-
return (
|
|
2347
|
-
t.page(c, m, f.id) >= NON_TEXT && t.onFor(f.id, m, c).r >= TEXT
|
|
2348
|
-
);
|
|
2349
|
-
}) ?? start;
|
|
2350
|
-
fill[m] = ref(f.id, m, found);
|
|
2351
|
-
// The shade nearest your color that passes, offered as the theme's
|
|
2352
|
-
// own dark fill when it is closer to your color than the one used.
|
|
2353
|
-
const near = [...stops]
|
|
2354
|
-
.filter(s => s > 0 && s < 100)
|
|
2355
|
-
.sort((a, b) => Math.abs(a - S) - Math.abs(b - S) || b - a)
|
|
2356
|
-
.find(s => {
|
|
2357
|
-
const c = ref(f.id, m, s).color;
|
|
2358
|
-
return (
|
|
2359
|
-
t.page(c, m, f.id) >= NON_TEXT && t.onFor(f.id, m, c).r >= TEXT
|
|
2360
|
-
);
|
|
2361
|
-
});
|
|
2362
|
-
const closer =
|
|
2363
|
-
near != null && Math.abs(near - S) < Math.abs(found - S)
|
|
2364
|
-
? (() => {
|
|
2365
|
-
const c = ref(f.id, m, near).color;
|
|
2366
|
-
const o = t.onFor(f.id, m, c);
|
|
2367
|
-
return `; for a fill closer to your color in dark: ${P} set ${slug} ${names.fill} ${quoteCommandArgument(c)} --mode dark (shade ${shade(near)}, the nearest that passes, with ${textName(o.on)} text at ${round(o.r)}:1)`;
|
|
2368
|
-
})()
|
|
2369
|
-
: '';
|
|
2370
|
-
if (reports(names.fill))
|
|
2371
|
-
checks.push({
|
|
2372
|
-
token: names.fill,
|
|
2373
|
-
mode: m,
|
|
2374
|
-
stop: found,
|
|
2375
|
-
preferred: S,
|
|
2376
|
-
against: 'the dark page and the text on it',
|
|
2377
|
-
ratio: plain.ratio,
|
|
2378
|
-
needs: TEXT,
|
|
2379
|
-
pass: true,
|
|
2380
|
-
note: `in dark, ${names.fill} is shade ${shade(found)}, not your exact color: ${plain.why}${found === start ? '' : `; shade ${shade(start)} does not pass either, so it is the nearest shade that does`}${closer}`,
|
|
2381
|
-
});
|
|
2382
|
-
}
|
|
2383
|
-
put(names.fill, f.id, fill);
|
|
2384
|
-
|
|
2385
|
-
// Text on the fill reads on the fill the theme really uses: the exact
|
|
2386
|
-
// token setting when there is one. The exact color never moves; the
|
|
2387
|
-
// text changes instead.
|
|
2388
|
-
const on = each(m => {
|
|
2389
|
-
const used = exactFill[m] ?? /** @type {StopRef} */ (fill[m]).color;
|
|
2390
|
-
// A see-through exact fill is measured as it shows on the surface.
|
|
2391
|
-
const o = t.onFor(fillWord, m, solid(used, m, f.id));
|
|
2392
|
-
const what = exactFill[m]
|
|
2393
|
-
? `your exact ${names.fill} (${used}${alphaOf(used) < 1 ? `, as it shows: ${solid(used, m, f.id)}` : ''})`
|
|
2394
|
-
: `${names.fill} (shade ${shade(Number(fill[m]?.stop))})`;
|
|
2395
|
-
const moved = o.on !== o.first;
|
|
2396
|
-
if (reports(names.on))
|
|
2397
|
-
checks.push({
|
|
2398
|
-
token: names.on,
|
|
2399
|
-
mode: m,
|
|
2400
|
-
stop: o.on.stop,
|
|
2401
|
-
preferred: o.first.stop,
|
|
2402
|
-
against: what,
|
|
2403
|
-
ratio: round(o.r),
|
|
2404
|
-
needs: TEXT,
|
|
2405
|
-
pass: o.r >= TEXT,
|
|
2406
|
-
...(o.r < TEXT
|
|
2407
|
-
? {
|
|
2408
|
-
note: `text on ${what} reads at only ${round(o.r)}:1 in ${m} with white or near-black text (needs ${TEXT}:1); the fill keeps your color: pick a lighter or darker ${f.id}, or set ${names.on} exactly`,
|
|
2409
|
-
}
|
|
2410
|
-
: moved
|
|
2411
|
-
? {
|
|
2412
|
-
note: `${names.on} uses ${textName(o.on)} text in ${m}, not ${textName(o.first)}, so it reads at ${round(o.r)}:1 on ${what}, where ${textName(o.other)} text reads at only ${round(o.otherR)}:1 (button and badge labels are normal-size text, which needs ${TEXT}:1); to keep ${textName(o.other)} text anyway, set ${names.on} exactly`,
|
|
2413
|
-
}
|
|
2414
|
-
: {}),
|
|
2415
|
-
});
|
|
2416
|
-
return o.on;
|
|
2417
|
-
});
|
|
2418
|
-
put(names.on, f.id, on);
|
|
2419
|
-
|
|
2420
|
-
// A pale fill in light can disappear into the page: say so, and keep
|
|
2421
|
-
// the exact color, the dial's or the token's.
|
|
2422
|
-
if (modes.includes('light') && has(names.fill)) {
|
|
2423
|
-
const used = exactFill.light ?? /** @type {StopRef} */ (fill.light).color;
|
|
2424
|
-
const p = t.page(solid(used, 'light', f.id), 'light', f.id);
|
|
2425
|
-
// The nearest darker color that stands out from the light page.
|
|
2426
|
-
/** @type {string | null} */
|
|
2427
|
-
let darker = null;
|
|
2428
|
-
const from = parseColor(solid(used, 'light', f.id));
|
|
2429
|
-
for (let i = 1; from && i <= 100 && !darker; i++) {
|
|
2430
|
-
const c = hex(
|
|
2431
|
-
/** @type {[number, number, number]} */ (
|
|
2432
|
-
from.map(v => Math.round(v * (1 - i / 100)))
|
|
2433
|
-
),
|
|
2434
|
-
);
|
|
2435
|
-
if (t.page(c, 'light', f.id) >= NON_TEXT) darker = c;
|
|
2436
|
-
}
|
|
2437
|
-
if (p < NON_TEXT)
|
|
2438
|
-
checks.push({
|
|
2439
|
-
token: names.fill,
|
|
2440
|
-
mode: 'light',
|
|
2441
|
-
stop: S,
|
|
2442
|
-
preferred: S,
|
|
2443
|
-
against: 'the light page',
|
|
2444
|
-
ratio: round(p),
|
|
2445
|
-
needs: NON_TEXT,
|
|
2446
|
-
pass: false,
|
|
2447
|
-
note: exactFill.light
|
|
2448
|
-
? `in light, your exact ${names.fill} (${used}) stands out from the page at only ${round(p)}:1, and a fill needs ${NON_TEXT}:1, so its buttons and badges may not show: give it a darker color`
|
|
2449
|
-
: `in light, your exact ${f.id} stands out from the page at only ${round(p)}:1, and a fill needs ${NON_TEXT}:1, so ${names.fill} buttons and badges may not show: pick a darker ${f.id}`,
|
|
2450
|
-
...(darker
|
|
2451
|
-
? {
|
|
2452
|
-
fix: exactFill.light
|
|
2453
|
-
? {thing: names.fill, value: darker, mode: 'light'}
|
|
2454
|
-
: {thing: f.id, value: darker},
|
|
2455
|
-
}
|
|
2456
|
-
: {}),
|
|
2457
|
-
});
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
|
-
// The tint: the official stop, never the fill's own shade, see-through
|
|
2461
|
-
// or not. Secondary text on the parts that sit on the accent tint is
|
|
2462
|
-
// lifted instead, as the official neutral theme lifts it (`lift`).
|
|
2463
|
-
const muted = each(m => {
|
|
2464
|
-
const i = side(m);
|
|
2465
|
-
const spec = word ? STATUS_MUTED[i] : ACCENT_MUTED[i];
|
|
2466
|
-
const [s, alpha] = Array.isArray(spec) ? spec : [spec, undefined];
|
|
2467
|
-
// Nearest the official stop first, both ways; on a tie (a layout
|
|
2468
|
-
// without that stop) lighter first in light, darker in dark.
|
|
2469
|
-
const usual = i === 0 ? 1 : -1;
|
|
2470
|
-
const order = [...stops].sort(
|
|
2471
|
-
(a, b) =>
|
|
2472
|
-
Math.abs(a - s) - Math.abs(b - s) ||
|
|
2473
|
-
(Math.sign(b - a) === usual ? 1 : -1),
|
|
2474
|
-
);
|
|
2475
|
-
const away = order.filter(x => x !== fill[m]?.stop);
|
|
2476
|
-
return ref(f.id, m, away[0] ?? order[0], alpha);
|
|
2477
|
-
});
|
|
2478
|
-
put(names.muted, f.id, muted);
|
|
2479
|
-
/** The tint the theme really shows: an exact setting wins. @param {Mode} m */
|
|
2480
|
-
const mutedSeen = m => {
|
|
2481
|
-
const own = rawOf(names.muted, m);
|
|
2482
|
-
return own
|
|
2483
|
-
? surfaces(m, f.id).map(
|
|
2484
|
-
([n, bg]) =>
|
|
2485
|
-
/** @type {[string, string]} */ ([
|
|
2486
|
-
`your exact ${names.muted} over ${n}`,
|
|
2487
|
-
hex(
|
|
2488
|
-
compositeOver(
|
|
2489
|
-
/** @type {[number, number, number]} */ (parseColor(own)),
|
|
2490
|
-
alphaOf(own),
|
|
2491
|
-
/** @type {[number, number, number]} */ (parseColor(bg)),
|
|
2492
|
-
),
|
|
2493
|
-
),
|
|
2494
|
-
]),
|
|
2495
|
-
)
|
|
2496
|
-
: over(
|
|
2497
|
-
names.muted,
|
|
2498
|
-
/** @type {StopRef} */ (muted[m]),
|
|
2499
|
-
surfaces(m, f.id),
|
|
2500
|
-
);
|
|
2501
|
-
};
|
|
2502
|
-
|
|
2503
|
-
// Accent text and icons are the color you gave where it reads on what
|
|
2504
|
-
// they sit on (the surfaces and the tint), in each mode its fill is
|
|
2505
|
-
// your exact color; only where it does not do they move, to the
|
|
2506
|
-
// nearest shade that reads, and the result says so.
|
|
2507
|
-
const text = each(m => {
|
|
2508
|
-
const grounds = [...surfaces(m, f.id), ...mutedSeen(m)];
|
|
2509
|
-
// The fill the theme really shows in this mode: an exact token
|
|
2510
|
-
// setting of it, else the dial's own color at its shade. The text
|
|
2511
|
-
// starts from that color's nearest shade.
|
|
2512
|
-
const shown = exactFill[m] ? solid(exactFill[m], m, f.id) : null;
|
|
2513
|
-
const start = shown
|
|
2514
|
-
? stops.reduce((x, y) =>
|
|
2515
|
-
perceptualDelta(ref(f.id, m, y).color, shown) <
|
|
2516
|
-
perceptualDelta(ref(f.id, m, x).color, shown)
|
|
2517
|
-
? y
|
|
2518
|
-
: x,
|
|
2519
|
-
)
|
|
2520
|
-
: S;
|
|
2521
|
-
const own = shown
|
|
2522
|
-
? {...ref(f.id, m, start), color: shown}
|
|
2523
|
-
: fill[m]?.exact
|
|
2524
|
-
? ref(f.id, m, S)
|
|
2525
|
-
: null;
|
|
2526
|
-
if (own) {
|
|
2527
|
-
const r = Math.min(...grounds.map(([, bg]) => contrast(own.color, bg)));
|
|
2528
|
-
if (r >= TEXT) {
|
|
2529
|
-
if (!shown) {
|
|
2530
|
-
if (reports(names.text))
|
|
2531
|
-
checks.push({
|
|
2532
|
-
token: names.text,
|
|
2533
|
-
mode: m,
|
|
2534
|
-
stop: S,
|
|
2535
|
-
preferred: S,
|
|
2536
|
-
against: grounds.map(([n]) => n).join(', '),
|
|
2537
|
-
ratio: round(r),
|
|
2538
|
-
needs: TEXT,
|
|
2539
|
-
pass: true,
|
|
2540
|
-
});
|
|
2541
|
-
return own;
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2544
|
-
const before = checks.length;
|
|
2545
|
-
const moved = pick(names.text, f.id, m, start, grounds, TEXT);
|
|
2546
|
-
if (r >= TEXT) return moved;
|
|
2547
|
-
const last = checks.length > before ? checks[checks.length - 1] : null;
|
|
2548
|
-
if (last && (moved.stop !== start || shown))
|
|
2549
|
-
last.note = `${names.text} ${m}: your exact color (${own.color}) reads at only ${grounds
|
|
2550
|
-
.map(([n, bg]) => [n, contrast(own.color, bg)])
|
|
2551
|
-
.filter(([, x]) => Number(x) < TEXT)
|
|
2552
|
-
.map(([n, x]) => `${round(Number(x))}:1 on ${n}`)
|
|
2553
|
-
.join(
|
|
2554
|
-
', ',
|
|
2555
|
-
)} (text needs ${TEXT}:1), so ${f.id === 'accent' ? 'links and accent text' : `${f.id} text and icons`} use shade ${shade(moved.stop)} (${moved.color}), the nearest that reads; the fill keeps your color, and an exact ${names.text} keeps any color you give it`;
|
|
2556
|
-
return moved;
|
|
2557
|
-
}
|
|
2558
|
-
return pick(names.text, f.id, m, at(TEXT_STOP[side(m)]), grounds, TEXT);
|
|
2559
|
-
});
|
|
2560
|
-
put(names.text, f.id, text);
|
|
2561
|
-
put(names.icon, f.id, text);
|
|
2562
|
-
if (names.onMuted) {
|
|
2563
|
-
const onMuted = /** @type {string} */ (names.onMuted);
|
|
2564
|
-
put(
|
|
2565
|
-
onMuted,
|
|
2566
|
-
f.id,
|
|
2567
|
-
each(m =>
|
|
2568
|
-
pick(onMuted, f.id, m, at(ON_MUTED[side(m)]), mutedSeen(m), TEXT),
|
|
2569
|
-
),
|
|
2570
|
-
);
|
|
2571
|
-
}
|
|
2572
|
-
if (names.border)
|
|
2573
|
-
put(
|
|
2574
|
-
names.border,
|
|
2575
|
-
f.id,
|
|
2576
|
-
each(m => ref(f.id, m, at(BORDER[side(m)]))),
|
|
2577
|
-
);
|
|
2578
|
-
// The focus ring follows the fill; with an exact fill it keeps
|
|
2579
|
-
// following that (Core's ring reads --color-accent).
|
|
2580
|
-
if (names.focus && !Object.keys(exactFill).length) {
|
|
2581
|
-
const focus = /** @type {string} */ (names.focus);
|
|
2582
|
-
put(
|
|
2583
|
-
focus,
|
|
2584
|
-
f.id,
|
|
2585
|
-
each(m =>
|
|
2586
|
-
pick(
|
|
2587
|
-
focus,
|
|
2588
|
-
f.id,
|
|
2589
|
-
m,
|
|
2590
|
-
/** @type {StopRef} */ (fill[m]).stop,
|
|
2591
|
-
surfaces(m, f.id),
|
|
2592
|
-
NON_TEXT,
|
|
2593
|
-
),
|
|
2594
|
-
),
|
|
2595
|
-
);
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
|
-
// Secondary text on the parts the official neutral theme lifts it on
|
|
2600
|
-
// (LIFT_PARTS), lifted the same way, for every accent: for each
|
|
2601
|
-
// background (the accent tint, the neutral track), the gray shade
|
|
2602
|
-
// nearest the secondary text's own that reads at 4.5:1 on it and on it
|
|
2603
|
-
// under a hover, over every surface. The grays are the neutral color's,
|
|
2604
|
-
// else a gray ramp the generator grows from the base theme's own
|
|
2605
|
-
// secondary text (written as colors, not shades of the palette). The
|
|
2606
|
-
// tint stays at its official stop. A mode where the theme sets
|
|
2607
|
-
// secondary text exactly takes that value where it reads there, else the
|
|
2608
|
-
// gray nearest it that does: a secondary text set for the whole theme
|
|
2609
|
-
// never makes those parts less readable.
|
|
2610
|
-
/** @type {Record<string, Partial<Record<Mode, StopRef>>> | null} */
|
|
2611
|
-
let lift = null;
|
|
2612
|
-
{
|
|
2613
|
-
/** @param {Mode} m @param {string} token */
|
|
2614
|
-
const valueOf = (m, token) => {
|
|
2615
|
-
const v =
|
|
2616
|
-
rawOf(token, m) ?? tokens[token]?.[m].color ?? base?.[m]?.[token];
|
|
2617
|
-
return v && parseColor(v) ? v : null;
|
|
2618
|
-
};
|
|
2619
|
-
/** The secondary text a mode starts from. @param {Mode} m */
|
|
2620
|
-
const startText = m => {
|
|
2621
|
-
const v =
|
|
2622
|
-
tokens['--color-text-secondary']?.[m].color ??
|
|
2623
|
-
base?.[m]?.['--color-text-secondary'];
|
|
2624
|
-
return v && parseColor(v)
|
|
2625
|
-
? hex(/** @type {number[]} */ (parseColor(v)))
|
|
2626
|
-
: null;
|
|
2627
|
-
};
|
|
2628
|
-
/**
|
|
2629
|
-
* The gray ramp of a mode, and whether its shades are the palette's
|
|
2630
|
-
* neutral ones (else plain colors).
|
|
2631
|
-
* @param {Mode} m
|
|
2632
|
-
* @returns {{ramp: Record<string, string>, palette: boolean} | null}
|
|
2633
|
-
*/
|
|
2634
|
-
const grays = m => {
|
|
2635
|
-
if (neutral)
|
|
2636
|
-
return {
|
|
2637
|
-
ramp: /** @type {any} */ (candidate.palette.neutral)[m],
|
|
2638
|
-
palette: true,
|
|
2639
|
-
};
|
|
2640
|
-
const seed = startText(m);
|
|
2641
|
-
const ramp = seed ? grownGrays(seed, m) : null;
|
|
2642
|
-
return ramp ? {ramp, palette: false} : null;
|
|
2643
|
-
};
|
|
2644
|
-
/**
|
|
2645
|
-
* A color drawn over each of `under`, as the eye sees it.
|
|
2646
|
-
* @param {string} name @param {string} color @param {Array<[string, string]>} under
|
|
2647
|
-
* @returns {Array<[string, string]>}
|
|
2648
|
-
*/
|
|
2649
|
-
const drawn = (name, color, under) => {
|
|
2650
|
-
const top = /** @type {[number, number, number]} */ (parseColor(color));
|
|
2651
|
-
const a = alphaOf(color);
|
|
2652
|
-
return under.map(([n, c]) => [
|
|
2653
|
-
`${name} over ${n}`,
|
|
2654
|
-
hex(
|
|
2655
|
-
compositeOver(
|
|
2656
|
-
top,
|
|
2657
|
-
a,
|
|
2658
|
-
/** @type {[number, number, number]} */ (parseColor(c)),
|
|
2659
|
-
),
|
|
2660
|
-
),
|
|
2661
|
-
]);
|
|
2662
|
-
};
|
|
2663
|
-
/** @type {Record<string, Partial<Record<Mode, StopRef>>>} */
|
|
2664
|
-
const found = {};
|
|
2665
|
-
for (const ground of new Set(LIFT_PARTS.map(([, , g]) => g))) {
|
|
2666
|
-
const {what, parts} = LIFT_GROUNDS[ground];
|
|
2667
|
-
/**
|
|
2668
|
-
* The shade the base theme itself lifts this ground's text to in a
|
|
2669
|
-
* mode, when it gives one: the search starts there, so a change of
|
|
2670
|
-
* color moves it only when that shade no longer reads.
|
|
2671
|
-
* @param {Mode} m
|
|
2672
|
-
* @returns {string | null}
|
|
2673
|
-
*/
|
|
2674
|
-
const baseLift = m => {
|
|
2675
|
-
for (const [part, block, g] of LIFT_PARTS) {
|
|
2676
|
-
if (g !== ground) continue;
|
|
2677
|
-
const v = /** @type {any} */ (base)?.components?.[part]?.[block]?.[
|
|
2678
|
-
'--color-text-secondary'
|
|
2679
|
-
];
|
|
2680
|
-
const pair = Array.isArray(v)
|
|
2681
|
-
? v
|
|
2682
|
-
: typeof v === 'string'
|
|
2683
|
-
? /^light-dark\((.*)\)$/s.exec(v.trim())?.[1]
|
|
2684
|
-
? splitTop(
|
|
2685
|
-
/** @type {string} */ (
|
|
2686
|
-
/^light-dark\((.*)\)$/s.exec(v.trim())?.[1]
|
|
2687
|
-
),
|
|
2688
|
-
',',
|
|
2689
|
-
)
|
|
2690
|
-
: [v, v]
|
|
2691
|
-
: null;
|
|
2692
|
-
const c = pair?.[m === 'light' ? 0 : 1]?.trim();
|
|
2693
|
-
if (c && parseColor(c))
|
|
2694
|
-
return hex(/** @type {number[]} */ (parseColor(c)));
|
|
2695
|
-
}
|
|
2696
|
-
return null;
|
|
2697
|
-
};
|
|
2698
|
-
/** @type {Partial<Record<Mode, StopRef>>} */
|
|
2699
|
-
const byMode = {};
|
|
2700
|
-
for (const m of modes) {
|
|
2701
|
-
const own = rawOf('--color-text-secondary', m);
|
|
2702
|
-
const literal = () => {
|
|
2703
|
-
byMode[m] = {
|
|
2704
|
-
stop: 0,
|
|
2705
|
-
color: /** @type {string} */ (own),
|
|
2706
|
-
family: 'literal',
|
|
2707
|
-
};
|
|
2708
|
-
};
|
|
2709
|
-
const fillColor = valueOf(m, ground);
|
|
2710
|
-
const g = grays(m);
|
|
2711
|
-
const text = startText(m);
|
|
2712
|
-
if (!fillColor || !g || !text) {
|
|
2713
|
-
if (own) {
|
|
2714
|
-
literal();
|
|
2715
|
-
continue;
|
|
2716
|
-
}
|
|
2717
|
-
break;
|
|
2718
|
-
}
|
|
2719
|
-
const seen = drawn(what, fillColor, surfaces(m, 'neutral'));
|
|
2720
|
-
const hover = valueOf(m, '--color-overlay-hover');
|
|
2721
|
-
const on = [
|
|
2722
|
-
...seen,
|
|
2723
|
-
...(hover && alphaOf(hover) > 0
|
|
2724
|
-
? drawn('a hover', hover, seen).map(
|
|
2725
|
-
([n, c]) =>
|
|
2726
|
-
/** @type {[string, string]} */ ([
|
|
2727
|
-
n.replace(/^a hover over (.*)$/, '$1 under a hover'),
|
|
2728
|
-
c,
|
|
2729
|
-
]),
|
|
2730
|
-
)
|
|
2731
|
-
: []),
|
|
2732
|
-
];
|
|
2733
|
-
const keys = Object.keys(g.ramp)
|
|
2734
|
-
.map(Number)
|
|
2735
|
-
.sort((a, b) => a - b);
|
|
2736
|
-
if (
|
|
2737
|
-
own &&
|
|
2738
|
-
parseColor(own) &&
|
|
2739
|
-
Math.min(...on.map(([, bg]) => contrast(own, bg))) >= TEXT
|
|
2740
|
-
) {
|
|
2741
|
-
literal();
|
|
2742
|
-
continue;
|
|
2743
|
-
}
|
|
2744
|
-
const from =
|
|
2745
|
-
(own && parseColor(own)
|
|
2746
|
-
? hex(/** @type {number[]} */ (parseColor(own)))
|
|
2747
|
-
: null) ??
|
|
2748
|
-
baseLift(m) ??
|
|
2749
|
-
text;
|
|
2750
|
-
const start = keys.reduce((x, y) =>
|
|
2751
|
-
perceptualDelta(g.ramp[y], from) < perceptualDelta(g.ramp[x], from)
|
|
2752
|
-
? y
|
|
2753
|
-
: x,
|
|
2754
|
-
);
|
|
2755
|
-
const scored = keys
|
|
2756
|
-
.sort(
|
|
2757
|
-
(a, b) =>
|
|
2758
|
-
Math.abs(a - start) - Math.abs(b - start) ||
|
|
2759
|
-
(Math.sign(b - a) === TOWARD_CONTRAST[m] ? 1 : -1),
|
|
2760
|
-
)
|
|
2761
|
-
.map(stop => ({
|
|
2762
|
-
stop,
|
|
2763
|
-
r: Math.min(...on.map(([, bg]) => contrast(g.ramp[stop], bg))),
|
|
2764
|
-
}));
|
|
2765
|
-
const b =
|
|
2766
|
-
scored.find(x => x.r >= TEXT) ??
|
|
2767
|
-
scored.reduce((x, y) => (y.r > x.r ? y : x));
|
|
2768
|
-
byMode[m] = g.palette
|
|
2769
|
-
? ref('neutral', m, b.stop)
|
|
2770
|
-
: {stop: b.stop, color: g.ramp[b.stop], family: 'literal'};
|
|
2771
|
-
const moved =
|
|
2772
|
-
hex(/** @type {number[]} */ (parseColor(g.ramp[b.stop]))) !== from;
|
|
2773
|
-
if (b.r < TEXT || moved)
|
|
2774
|
-
checks.push({
|
|
2775
|
-
token: '--color-text-secondary',
|
|
2776
|
-
mode: m,
|
|
2777
|
-
stop: b.stop,
|
|
2778
|
-
preferred: start,
|
|
2779
|
-
against: `${what} over the surfaces`,
|
|
2780
|
-
ratio: round(b.r),
|
|
2781
|
-
needs: TEXT,
|
|
2782
|
-
pass: b.r >= TEXT,
|
|
2783
|
-
dials: ['accent', 'neutral'],
|
|
2784
|
-
note:
|
|
2785
|
-
b.r >= TEXT
|
|
2786
|
-
? `--color-text-secondary on ${parts} uses ${g.ramp[b.stop]} in ${m}, not ${from}, so it stays readable (${round(b.r)}:1) on ${what} and under a hover`
|
|
2787
|
-
: `--color-text-secondary on ${parts} reads at only ${round(b.r)}:1 in ${m} on ${what} even at ${g.ramp[b.stop]}, the most contrasting gray (needs ${TEXT}:1): pick another accent or neutral, or set --color-text-secondary on those parts exactly`,
|
|
2788
|
-
});
|
|
2789
|
-
}
|
|
2790
|
-
if (modes.every(m => byMode[m])) found[ground] = byMode;
|
|
2791
|
-
}
|
|
2792
|
-
if (Object.keys(found).length) lift = found;
|
|
2793
|
-
}
|
|
2794
|
-
|
|
1648
|
+
const candidate = generate(config, paletteFiles(slug).config, cwd);
|
|
1649
|
+
const mapping = mapPalette(
|
|
1650
|
+
candidate,
|
|
1651
|
+
fams,
|
|
1652
|
+
plan.fills,
|
|
1653
|
+
paletteContext(cwd, slug, data, base, tokenDefaults),
|
|
1654
|
+
);
|
|
2795
1655
|
return {
|
|
2796
1656
|
candidate,
|
|
2797
1657
|
families: fams,
|
|
2798
|
-
|
|
2799
|
-
contrast: checks.filter(c => c.note !== ''),
|
|
2800
|
-
lift,
|
|
1658
|
+
...mapping,
|
|
2801
1659
|
vibrancy: config.vibrancy ?? VIBRANCY_DEFAULT,
|
|
2802
|
-
exact,
|
|
2803
|
-
unread,
|
|
2804
1660
|
notes: [
|
|
2805
1661
|
...plan.notes,
|
|
2806
1662
|
...(paletteEdited(cwd, slug)
|
|
@@ -2858,7 +1714,7 @@ export function mappingRows(dial) {
|
|
|
2858
1714
|
'your exact color sits at its own shade, light and dark, and the shades around it follow it (white and black are already the ends of every ramp)',
|
|
2859
1715
|
...Object.entries(NEUTRAL_STOPS).map(
|
|
2860
1716
|
([t, [l, d]]) =>
|
|
2861
|
-
`${t}: light shade ${l}, dark shade ${d}${t.endsWith('-secondary') ? ` (moves to a shade that reads at ${t.includes('icon') ? NON_TEXT : TEXT}:1 on the surfaces)` : NEUTRAL_INSIDE.
|
|
1717
|
+
`${t}: light shade ${l}, dark shade ${d}${t.endsWith('-secondary') ? ` (moves to a shade that reads at ${t.includes('icon') ? NON_TEXT : TEXT}:1 on the surfaces)` : NEUTRAL_INSIDE.includes(t) ? ' (the card surface of the other mode, for tooltips and toasts, at the nearest shade inside the ramp so it carries your color)' : ''}`,
|
|
2862
1718
|
),
|
|
2863
1719
|
...Object.entries(NEUTRAL_TINTS).map(
|
|
2864
1720
|
([t, [[l, la], [d, da]]]) =>
|
|
@@ -3026,7 +1882,9 @@ export function paletteNotes(pal, dial, slug, modes = ['light', 'dark']) {
|
|
|
3026
1882
|
const given = pal.families.find(x => x.dial === dial);
|
|
3027
1883
|
if (given && isClipped(given.value))
|
|
3028
1884
|
notes.push(
|
|
3029
|
-
|
|
1885
|
+
given.source
|
|
1886
|
+
? `your ${dial} ${given.value} is outside the colors every screen shows (sRGB); the nearest one is ${seedOf(given.value)}, but the ${given.source} your theme source sets, ${given.seed}, is used`
|
|
1887
|
+
: `your ${dial} ${given.value} is outside the colors every screen shows (sRGB), so the nearest one, ${seedOf(given.value)}, is used`,
|
|
3030
1888
|
);
|
|
3031
1889
|
for (const c of dialChecks(pal, dial, modes)) {
|
|
3032
1890
|
if (c.note || !c.pass) notes.push(checkNote(c, dial));
|