@astryxdesign/cli 0.7.17-canary.gffd1fc0 → 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 -84
- package/api/build/_adapter.d.mts +51 -0
- package/api/build/_adapter.mjs +133 -7
- package/api/build/build.doc.mjs +3 -3
- package/api/build/build.mjs +23 -14
- 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/showcase/showcase.mjs +19 -8
- package/api/discover/_adapter.d.mts +71 -8
- package/api/discover/_adapter.mjs +320 -69
- 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 +206 -29
- 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/_entry-names.mjs +4 -3
- 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 +256 -10
- package/api/doctor/_adapter.mjs +1233 -51
- package/api/doctor/built-checks.d.mts +39 -3
- package/api/doctor/built-checks.mjs +203 -7
- package/api/doctor/doctor.d.mts +222 -10
- package/api/doctor/doctor.doc.mjs +4 -4
- package/api/doctor/doctor.mjs +1005 -43
- 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 +307 -7
- package/api/error.d.mts +12 -1
- package/api/error.mjs +18 -6
- package/api/icon/_adapter.d.mts +13 -2
- package/api/icon/_adapter.mjs +32 -16
- package/api/icon/_authoring.mjs +21 -7
- package/api/icon/_records.d.mts +3 -1
- package/api/icon/_records.mjs +30 -3
- package/api/icon/add/add.mjs +1 -1
- package/api/icon/definitions/definitions.mjs +19 -8
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +4 -4
- package/api/icon/icon.type.d.mts +80 -2
- package/api/icon/icon.type.mjs +40 -5
- package/api/icon/iconMap.doc.mjs +2 -2
- package/api/icon/list/list.mjs +7 -5
- package/api/icon/map/map.mjs +13 -4
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/icon/search/icon-index.mjs +22 -9
- package/api/icon/search/search.d.mts +47 -3
- package/api/icon/search/search.mjs +306 -9
- package/api/init/_adapter.d.mts +97 -0
- package/api/init/_adapter.mjs +284 -15
- package/api/init/init.d.mts +3 -3
- package/api/init/init.doc.mjs +30 -6
- package/api/init/init.mjs +150 -11
- package/api/init/init.type.d.mts +102 -8
- package/api/init/init.type.mjs +44 -3
- package/api/init/remove/remove.d.mts +7 -4
- package/api/init/remove/remove.mjs +124 -26
- package/api/init/run/run.d.mts +48 -3
- package/api/init/run/run.mjs +444 -37
- package/api/integration/_adapter.d.mts +21 -4
- package/api/integration/_adapter.mjs +52 -6
- 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 +6 -3
- package/api/integration/validate-integration.mjs +86 -15
- package/api/integration/validate-integration.type.d.mts +12 -5
- package/api/integration/validate-integration.type.mjs +12 -5
- 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 +85 -15
- package/api/search/_gather-templates.mjs +6 -0
- 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 +13 -0
- package/api/search/_named-keywords.d.mts +6 -3
- package/api/search/_named-keywords.mjs +70 -19
- package/api/search/_order.d.mts +34 -1
- package/api/search/_order.mjs +156 -13
- 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/show/show.d.mts +10 -3
- package/api/template/show/show.mjs +16 -4
- package/api/template/template.doc.mjs +3 -3
- package/api/template/template.mjs +55 -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 +61 -30
- package/api/theme/build/build.mjs +552 -489
- 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/input-fields.d.mts +9 -0
- package/api/theme/build/input-fields.mjs +155 -16
- package/api/theme/build/null-values.d.mts +22 -0
- package/api/theme/build/null-values.mjs +110 -21
- package/api/theme/build/radius-values.d.mts +18 -0
- package/api/theme/build/radius-values.mjs +76 -0
- 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/build/typography-values.mjs +7 -23
- package/api/theme/build/written-values.d.mts +18 -0
- package/api/theme/build/written-values.mjs +107 -31
- 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 +347 -149
- 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 +4 -4
- 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.d.mts +40 -0
- package/api/theme-edit/_catalog.mjs +101 -23
- package/api/theme-edit/_check.mjs +333 -79
- package/api/theme-edit/_color.d.mts +2 -60
- package/api/theme-edit/_color.mjs +33 -847
- package/api/theme-edit/_compiler.mjs +52 -0
- package/api/theme-edit/_context.d.mts +23 -3
- package/api/theme-edit/_context.mjs +173 -32
- package/api/theme-edit/_css.d.mts +4 -35
- package/api/theme-edit/_css.mjs +10 -91
- package/api/theme-edit/_edit.mjs +667 -87
- package/api/theme-edit/_how-question.d.mts +15 -0
- package/api/theme-edit/_how-question.mjs +2729 -179
- package/api/theme-edit/_how.mjs +62 -3
- package/api/theme-edit/_missed.d.mts +2 -1
- package/api/theme-edit/_missed.mjs +128 -29
- package/api/theme-edit/_normal.d.mts +22 -5
- package/api/theme-edit/_normal.mjs +95 -4
- package/api/theme-edit/_palette.d.mts +34 -74
- package/api/theme-edit/_palette.mjs +261 -1278
- package/api/theme-edit/_part-words.mjs +29 -6
- package/api/theme-edit/_parts.d.mts +16 -2
- package/api/theme-edit/_parts.mjs +161 -41
- package/api/theme-edit/_png.d.mts +24 -0
- package/api/theme-edit/_png.mjs +99 -0
- package/api/theme-edit/_preview-app.d.mts +16 -0
- package/api/theme-edit/_preview-app.mjs +52 -18
- package/api/theme-edit/_preview.d.mts +44 -26
- package/api/theme-edit/_preview.mjs +304 -89
- package/api/theme-edit/_project.d.mts +18 -2
- package/api/theme-edit/_project.mjs +27 -3
- package/api/theme-edit/_settings.d.mts +118 -1
- package/api/theme-edit/_settings.mjs +1336 -76
- package/api/theme-edit/_tables.d.mts +19 -11
- package/api/theme-edit/_tables.mjs +55 -37
- package/api/theme-edit/theme-edit.type.d.mts +20 -2
- package/api/theme-edit/theme-edit.type.mjs +9 -6
- package/api/upgrade/_adapter.d.mts +43 -4
- package/api/upgrade/_adapter.mjs +281 -8
- 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 +34 -3
- package/assets/docs/tree/check-the-props.doc.mjs +1 -1
- package/assets/docs/tree/checks.doc.mjs +2 -2
- 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-definitions.doc.mjs +3 -3
- package/assets/docs/tree/icon-sets.doc.mjs +87 -11
- 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/short-and-findable.doc.mjs +3 -3
- 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/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +4 -0
- package/assets/docs/working-with-ai.doc.mjs +44 -9
- 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/installed-icon-set.doc.mjs +30 -0
- 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/CodeBlock/CodeBlockTerminal.tsx +1 -1
- 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 +37 -19
- package/assets/templates/pages/dashboard/template.doc.mjs +0 -6
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +16 -14
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +0 -8
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +14 -16
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +0 -7
- package/assets/templates/pages/dashboard-comparison/page.tsx +17 -12
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +0 -8
- package/assets/templates/pages/dashboard-composition/page.tsx +40 -23
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +0 -1
- package/assets/templates/pages/dashboard-progress/page.tsx +105 -109
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +0 -7
- package/assets/templates/pages/dashboard-scorecard/page.tsx +74 -37
- 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 +39 -17
- package/assets/templates/pages/table-grouped/template.doc.mjs +0 -11
- package/assets/templates/pages/table-inbox/page.tsx +147 -65
- 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/butterPaletteRefs.generated.ts +12 -12
- package/assets/templates/themes/butter/butterTheme.ts +244 -10
- package/assets/templates/themes/chocolate/chocolateTheme.ts +81 -10
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
- package/assets/templates/themes/gothic/gothicTheme.ts +126 -4
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
- package/assets/templates/themes/matcha/matchaTheme.ts +58 -14
- package/assets/templates/themes/neutral/neutralTheme.ts +45 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +3 -3
- package/assets/templates/themes/stone/stoneTheme.ts +101 -10
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
- package/assets/templates/themes/y2k/y2kTheme.ts +257 -14
- 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 +20 -3
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/debug/type.ts +4 -0
- package/authoring/discover/parse.d.mts +4 -3
- package/authoring/discover/parse.mjs +76 -41
- package/authoring/discover/type.ts +9 -1
- 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 +17 -1
- 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 +20 -14
- package/clients/cli/commands/component.doc.mjs +3 -1
- package/clients/cli/commands/component.mjs +21 -6
- package/clients/cli/commands/discover.doc.mjs +2 -2
- package/clients/cli/commands/discover.mjs +112 -9
- package/clients/cli/commands/docs.doc.mjs +17 -10
- package/clients/cli/commands/docs.mjs +112 -191
- 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 +387 -229
- 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 +69 -23
- package/clients/cli/commands/experimental-export.doc.mjs +73 -0
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
- 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-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +7 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -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 +63 -31
- package/clients/cli/commands/integration-check.doc.mjs +1 -1
- package/clients/cli/commands/mcp.doc.mjs +57 -0
- package/clients/cli/commands/mcp.mjs +51 -0
- package/clients/cli/commands/search.mjs +78 -9
- package/clients/cli/commands/template.doc.mjs +14 -5
- package/clients/cli/commands/template.mjs +21 -2
- package/clients/cli/commands/theme-add.doc.mjs +6 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- 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 +86 -5
- package/clients/cli/commands/upgrade.doc.mjs +2 -1
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +52 -6
- package/clients/cli/index.mjs +44 -37
- 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 +92 -4
- package/clients/cli/lib/hook-format.mjs +28 -24
- package/clients/cli/lib/json-shim.mjs +61 -4
- package/clients/cli/lib/manifest.mjs +9 -1
- package/clients/cli/lib/mcp-server.mjs +286 -0
- package/clients/cli/lib/mcp-tools.mjs +405 -0
- 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 +79 -5
- package/foundation/agent-docs/agent-docs.mjs +137 -10
- 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 +8 -5
- package/foundation/config/project.mjs +35 -17
- 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 +118 -4
- package/foundation/discovery/icon-ranking.mjs +453 -59
- 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 +68 -2
- package/foundation/discovery/icon-set-discovery.mjs +124 -23
- package/foundation/discovery/icon-set-writer.d.mts +9 -13
- package/foundation/discovery/icon-set-writer.mjs +89 -36
- 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/name-roots.d.mts +5 -0
- package/foundation/discovery/name-roots.mjs +11 -0
- 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 +2 -1
- package/foundation/discovery/runner-allowlist.mjs +3 -1
- package/foundation/discovery/runner-commands.mjs +1 -0
- package/foundation/discovery/stored-component-list.mjs +34 -2
- package/foundation/discovery/template-adapter.d.mts +27 -1
- 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 +46 -3
- package/foundation/discovery/template-icons.mjs +72 -109
- package/foundation/discovery/template-needs.d.mts +34 -5
- package/foundation/discovery/template-needs.mjs +164 -22
- 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/project-scope.d.mts +9 -0
- package/foundation/env/project-scope.mjs +28 -2
- 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/read-record.mjs +9 -5
- 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 +63 -0
- package/foundation/integrations/icon-features.mjs +54 -0
- 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 +13 -3
- package/foundation/integrations/validate-contributions.mjs +64 -13
- 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 +421 -59
- 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/cut-short.d.mts +7 -1
- package/foundation/render/cut-short.mjs +46 -6
- 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 +54 -29
- package/foundation/render/picture-playwright.mjs +78 -42
- package/foundation/render/picture-window.d.mts +44 -5
- package/foundation/render/picture-window.mjs +265 -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 +219 -8
- package/foundation/render/render-page.mjs +1702 -165
- 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 +28 -17
- 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-id.d.mts +20 -0
- package/foundation/text/icon-id.mjs +40 -0
- package/foundation/text/icon-set-next.d.mts +26 -0
- package/foundation/text/icon-set-next.mjs +37 -0
- 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>`,
|
|
@@ -293,13 +298,20 @@ export function tempFor(file) {
|
|
|
293
298
|
* @property {boolean} pass
|
|
294
299
|
* @property {string} [note] - The whole sentence to report, when the check is not a plain stop move.
|
|
295
300
|
* @property {string[]} [dials] - The color dials whose notes report it, when its token belongs to none of them.
|
|
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.
|
|
302
|
+
*/
|
|
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
|
|
296
308
|
*/
|
|
297
309
|
|
|
298
310
|
/**
|
|
299
311
|
* The palette mapping of a theme.
|
|
300
312
|
* @typedef {object} PaletteMapping
|
|
301
313
|
* @property {Candidate} candidate
|
|
302
|
-
* @property {
|
|
314
|
+
* @property {DialFamily[]} families
|
|
303
315
|
* @property {Record<string, {family: string, light: StopRef, dark: StopRef}>} tokens
|
|
304
316
|
* @property {ContrastCheck[]} contrast
|
|
305
317
|
* @property {number} vibrancy - The generator's vibrancy, 0 to 100.
|
|
@@ -309,18 +321,16 @@ export function tempFor(file) {
|
|
|
309
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.
|
|
310
322
|
*/
|
|
311
323
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
/** The generator's vibrancy when the theme sets none. */
|
|
323
|
-
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
|
+
};
|
|
324
334
|
|
|
325
335
|
/**
|
|
326
336
|
* The vibrancy dial a settings list sets, or null.
|
|
@@ -338,222 +348,11 @@ function dialVibrancy(settings) {
|
|
|
338
348
|
: null;
|
|
339
349
|
}
|
|
340
350
|
|
|
341
|
-
/** The Core token word of each status family. */
|
|
342
|
-
const STATUS_TOKEN = wordTable(
|
|
343
|
-
/** @type {Record<string, string>} */ ({
|
|
344
|
-
success: 'success',
|
|
345
|
-
warning: 'warning',
|
|
346
|
-
danger: 'error',
|
|
347
|
-
info: 'info',
|
|
348
|
-
}),
|
|
349
|
-
);
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* The main token a color dial feeds: the exact-token escape hatch for it.
|
|
353
|
-
* @param {string} dial
|
|
354
|
-
*/
|
|
355
|
-
export const paletteToken = dial =>
|
|
356
|
-
dial === 'accent'
|
|
357
|
-
? '--color-accent'
|
|
358
|
-
: dial === 'neutral'
|
|
359
|
-
? '--color-background-surface'
|
|
360
|
-
: `--color-${STATUS_TOKEN[dial]}`;
|
|
361
|
-
|
|
362
|
-
/** Text contrast and non-text contrast (fills, focus rings, icons). */
|
|
363
|
-
const TEXT = 4.5;
|
|
364
|
-
const NON_TEXT = 3;
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* The official neutral theme's color mapping, read from the theme the CLI
|
|
368
|
-
* ships rather than copied: each token's stops, `[light, dark]`, written
|
|
369
|
-
* there as `<family>.<mode>[N]` or `withAlpha(<family>.<mode>[N], 'aa')`
|
|
370
|
-
* (one stop for both modes when it writes one), and the parts whose
|
|
371
|
-
* secondary text it lifts (`[part, block]`).
|
|
372
|
-
* @returns {{stops: Record<string, Array<{stop: number, alpha?: string}>>, lifted: Array<[string, string]>}}
|
|
373
|
-
*/
|
|
374
|
-
function readOfficialNeutral() {
|
|
375
|
-
const ast = parse(
|
|
376
|
-
fs.readFileSync(
|
|
377
|
-
path.join(THEMES_DIR, 'neutral', 'neutralTheme.ts'),
|
|
378
|
-
'utf8',
|
|
379
|
-
),
|
|
380
|
-
{sourceType: 'module', plugins: ['typescript']},
|
|
381
|
-
);
|
|
382
|
-
/** @param {any} n @returns {{stop: number, alpha?: string} | null} */
|
|
383
|
-
const stopOf = n => {
|
|
384
|
-
if (n?.type === 'CallExpression' && n.callee?.name === 'withAlpha') {
|
|
385
|
-
const inner = stopOf(n.arguments[0]);
|
|
386
|
-
const alpha = n.arguments[1]?.value;
|
|
387
|
-
return inner && typeof alpha === 'string'
|
|
388
|
-
? {...inner, alpha: alpha.toLowerCase()}
|
|
389
|
-
: null;
|
|
390
|
-
}
|
|
391
|
-
return n?.type === 'MemberExpression' &&
|
|
392
|
-
n.computed &&
|
|
393
|
-
n.property.type === 'NumericLiteral' &&
|
|
394
|
-
['light', 'dark'].includes(n.object?.property?.name)
|
|
395
|
-
? {stop: n.property.value}
|
|
396
|
-
: null;
|
|
397
|
-
};
|
|
398
|
-
/** @type {Record<string, Array<{stop: number, alpha?: string}>>} */
|
|
399
|
-
const stops = {};
|
|
400
|
-
/** @type {Array<[string, string]>} */
|
|
401
|
-
const lifted = [];
|
|
402
|
-
/** @param {any} node @param {string[]} keys */
|
|
403
|
-
const visit = (node, keys) => {
|
|
404
|
-
if (!node || typeof node !== 'object') return;
|
|
405
|
-
if (node.type === 'ObjectProperty') {
|
|
406
|
-
const key = node.key.name ?? node.key.value;
|
|
407
|
-
const at = [...keys, String(key)];
|
|
408
|
-
if (keys.at(-1) === 'tokens' && node.value.type === 'ArrayExpression') {
|
|
409
|
-
const pair = node.value.elements.map(stopOf);
|
|
410
|
-
if (pair.length === 2 && pair.every(Boolean)) stops[key] = pair;
|
|
411
|
-
} else if (keys.at(-1) === 'tokens') {
|
|
412
|
-
const one = stopOf(node.value);
|
|
413
|
-
if (one) stops[key] = [one, one];
|
|
414
|
-
}
|
|
415
|
-
if (keys.at(-3) === 'components' && key === '--color-text-secondary')
|
|
416
|
-
lifted.push([keys.at(-2) ?? '', keys.at(-1) ?? '']);
|
|
417
|
-
visit(node.value, at);
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
for (const [k, v] of Object.entries(node))
|
|
421
|
-
if (k !== 'loc' && k !== 'start' && k !== 'end')
|
|
422
|
-
for (const x of Array.isArray(v) ? v : [v]) visit(x, keys);
|
|
423
|
-
};
|
|
424
|
-
visit(ast.program, []);
|
|
425
|
-
return {stops, lifted};
|
|
426
|
-
}
|
|
427
|
-
const OFFICIAL = readOfficialNeutral();
|
|
428
|
-
/** A token's official `[light, dark]` stops. @param {string} token */
|
|
429
|
-
const officialStops = token =>
|
|
430
|
-
/** @type {[number, number]} */ (
|
|
431
|
-
(OFFICIAL.stops[token] ?? []).map(x => x.stop)
|
|
432
|
-
);
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* The tokens the neutral color sets at the official theme's stops, the
|
|
436
|
-
* page background (`--color-background-body`) with the surfaces on it, so
|
|
437
|
-
* a warm or cool gray reaches the page as it reaches the cards. The
|
|
438
|
-
* inverted surface (tooltips,
|
|
439
|
-
* toasts), which the official theme leaves to Core, is the card surface of
|
|
440
|
-
* the other mode, as Core makes it from a neutral scale, inside the ramp
|
|
441
|
-
* (Core's tones 10 and 99: never the white or black end every ramp shares)
|
|
442
|
-
* so it carries the neutral color (NEUTRAL_INSIDE); the text on it is the
|
|
443
|
-
* theme's on-dark and on-light. A layout without one of these stops uses
|
|
444
|
-
* the nearest one it has.
|
|
445
|
-
*/
|
|
446
|
-
const NEUTRAL_STOPS = wordTable(
|
|
447
|
-
/** @type {Record<string, [number, number]>} */ ({
|
|
448
|
-
...Object.fromEntries(
|
|
449
|
-
[
|
|
450
|
-
'--color-background-body',
|
|
451
|
-
'--color-background-surface',
|
|
452
|
-
'--color-background-card',
|
|
453
|
-
'--color-background-popover',
|
|
454
|
-
'--color-background-muted',
|
|
455
|
-
'--color-text-primary',
|
|
456
|
-
'--color-text-secondary',
|
|
457
|
-
'--color-text-disabled',
|
|
458
|
-
'--color-icon-primary',
|
|
459
|
-
'--color-icon-secondary',
|
|
460
|
-
'--color-icon-disabled',
|
|
461
|
-
'--color-border-emphasized',
|
|
462
|
-
'--color-skeleton',
|
|
463
|
-
'--color-on-dark',
|
|
464
|
-
'--color-on-light',
|
|
465
|
-
].map(t => [t, officialStops(t)]),
|
|
466
|
-
),
|
|
467
|
-
'--color-background-inverted': /** @type {[number, number]} */ (
|
|
468
|
-
[...officialStops('--color-background-card')].reverse()
|
|
469
|
-
),
|
|
470
|
-
}),
|
|
471
|
-
);
|
|
472
|
-
/** Neutral tokens whose shade stays inside the ramp, off its white and black ends. */
|
|
473
|
-
const NEUTRAL_INSIDE = new Set(['--color-background-inverted']);
|
|
474
|
-
/** Neutral tints: a stop with an opacity, `[[stop, alpha], [stop, alpha]]`. */
|
|
475
|
-
const NEUTRAL_TINTS = wordTable(
|
|
476
|
-
Object.fromEntries(
|
|
477
|
-
['--color-border', '--color-overlay-hover', '--color-overlay-pressed'].map(
|
|
478
|
-
t => [
|
|
479
|
-
t,
|
|
480
|
-
/** @type {[[number, string], [number, string]]} */ (
|
|
481
|
-
OFFICIAL.stops[t].map(x => [x.stop, String(x.alpha)])
|
|
482
|
-
),
|
|
483
|
-
],
|
|
484
|
-
),
|
|
485
|
-
),
|
|
486
|
-
);
|
|
487
|
-
/**
|
|
488
|
-
* Accent and status stops, `[light, dark]`, as the official neutral theme
|
|
489
|
-
* maps its accent tint and its status families (info stands for them). The
|
|
490
|
-
* dark fill starts at 70, where the theme authoring guide puts it, when the
|
|
491
|
-
* exact color does not read in dark. A status tint is translucent in dark
|
|
492
|
-
* (`[stop, alpha]`).
|
|
493
|
-
*/
|
|
494
|
-
const DARK_FILL = 70;
|
|
495
|
-
const TEXT_STOP = officialStops('--color-text-info');
|
|
496
|
-
const ACCENT_MUTED = officialStops('--color-accent-muted');
|
|
497
|
-
const STATUS_MUTED = /** @type {[number, [number, string]]} */ (
|
|
498
|
-
OFFICIAL.stops['--color-info-muted'].map((x, i) =>
|
|
499
|
-
i === 0 ? x.stop : [x.stop, String(x.alpha)],
|
|
500
|
-
)
|
|
501
|
-
);
|
|
502
|
-
const ON_MUTED = officialStops('--color-on-info-muted');
|
|
503
|
-
/**
|
|
504
|
-
* The parts whose secondary text the official neutral theme lifts, with
|
|
505
|
-
* the block it lifts it in and what the text sits on: the accent tint,
|
|
506
|
-
* except under segmented-control labels, which sit on the translucent
|
|
507
|
-
* neutral track (`--color-neutral`).
|
|
508
|
-
*/
|
|
509
|
-
export const LIFT_PARTS = OFFICIAL.lifted.map(
|
|
510
|
-
([part, block]) =>
|
|
511
|
-
/** @type {[string, string, string]} */ ([
|
|
512
|
-
part,
|
|
513
|
-
block,
|
|
514
|
-
part === 'segmented-control-item'
|
|
515
|
-
? '--color-neutral'
|
|
516
|
-
: '--color-accent-muted',
|
|
517
|
-
]),
|
|
518
|
-
);
|
|
519
|
-
/** What each lifted background is, and the parts on it, for notes. */
|
|
520
|
-
const LIFT_GROUNDS =
|
|
521
|
-
/** @type {Record<string, {what: string, parts: string}>} */ ({
|
|
522
|
-
'--color-accent-muted': {
|
|
523
|
-
what: 'the accent tint',
|
|
524
|
-
parts: 'selected items and rows, a dropzone, numbered citations',
|
|
525
|
-
},
|
|
526
|
-
'--color-neutral': {
|
|
527
|
-
what: 'the neutral track',
|
|
528
|
-
parts: 'segmented-control labels',
|
|
529
|
-
},
|
|
530
|
-
});
|
|
531
|
-
const BORDER = /** @type {[number, number]} */ ([80, 65]);
|
|
532
|
-
/**
|
|
533
|
-
* Text on a fill, from the neutral family as the official themes take it:
|
|
534
|
-
* white (100) first in light, near-black (5) first in dark, and near-black
|
|
535
|
-
* first in both modes on warning. Without a neutral color, black and white.
|
|
536
|
-
*/
|
|
537
|
-
const [ON_LIGHT, ON_DARK] = officialStops('--color-on-accent');
|
|
538
|
-
const ON_FILL = wordTable(
|
|
539
|
-
/** @type {Record<Mode, [number, number]>} */ ({
|
|
540
|
-
light: [ON_LIGHT, ON_DARK],
|
|
541
|
-
dark: [ON_DARK, ON_LIGHT],
|
|
542
|
-
}),
|
|
543
|
-
);
|
|
544
351
|
/** A layout needs this many stops between black and white to map every token. */
|
|
545
352
|
const MIN_INNER_STOPS = 5;
|
|
546
353
|
/** The widest gap between two stops that still maps every token near its stop. */
|
|
547
354
|
const MAX_STOP_GAP = 25;
|
|
548
355
|
|
|
549
|
-
/** Text on surfaces darkens in light mode and lightens in dark mode. */
|
|
550
|
-
const TOWARD_CONTRAST = wordTable(
|
|
551
|
-
/** @type {Record<Mode, 1 | -1>} */ ({
|
|
552
|
-
light: -1,
|
|
553
|
-
dark: 1,
|
|
554
|
-
}),
|
|
555
|
-
);
|
|
556
|
-
|
|
557
356
|
/** @param {string} slug */
|
|
558
357
|
export function paletteFiles(slug) {
|
|
559
358
|
return {
|
|
@@ -587,15 +386,6 @@ export function seedOf(value) {
|
|
|
587
386
|
return rgb && alphaOf(value) >= 1 ? hex(rgb) : null;
|
|
588
387
|
}
|
|
589
388
|
|
|
590
|
-
/**
|
|
591
|
-
* Below this OKLCH chroma a seed reads as gray: its family is generated as a
|
|
592
|
-
* neutral, so no hue is invented for it in either mode.
|
|
593
|
-
*/
|
|
594
|
-
const GRAY_CHROMA = 0.02;
|
|
595
|
-
|
|
596
|
-
/** @param {string} seed */
|
|
597
|
-
const isGray = seed => hexToOklch(seed).C < GRAY_CHROMA;
|
|
598
|
-
|
|
599
389
|
/** Whether a seed (or no seed) has no color to saturate. @param {string | null} seed */
|
|
600
390
|
export const isGraySeed = seed => !seed || isGray(seed);
|
|
601
391
|
|
|
@@ -626,15 +416,6 @@ export function vibrancyMoves(dial, seed, from, to) {
|
|
|
626
416
|
return ramp(from) !== ramp(to);
|
|
627
417
|
}
|
|
628
418
|
|
|
629
|
-
/** @param {unknown} a @param {unknown} b */
|
|
630
|
-
function sameColor(a, b) {
|
|
631
|
-
try {
|
|
632
|
-
return normalizeColor(String(a)) === normalizeColor(String(b));
|
|
633
|
-
} catch {
|
|
634
|
-
return false;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
419
|
/**
|
|
639
420
|
* The modes a theme has: one for a one-mode theme, else light and dark.
|
|
640
421
|
* @param {{mode?: string}} data
|
|
@@ -649,22 +430,60 @@ export function modesOf(data) {
|
|
|
649
430
|
}
|
|
650
431
|
|
|
651
432
|
/**
|
|
652
|
-
* 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.
|
|
653
449
|
* @param {{settings: Setting[]}} data
|
|
450
|
+
* @param {Record<string, string>} [own] the tokens the theme's own source sets
|
|
654
451
|
*/
|
|
655
|
-
function dialFamilies(data) {
|
|
656
|
-
/** @type {
|
|
452
|
+
function dialFamilies(data, own = {}) {
|
|
453
|
+
/** @type {DialFamily[]} */
|
|
657
454
|
const out = [];
|
|
658
455
|
for (const dial of PALETTE_DIALS) {
|
|
659
456
|
const s = [...data.settings]
|
|
660
457
|
.reverse()
|
|
661
458
|
.find(x => x?.source === 'dial' && x.thing === dial && !x.on && !x.mode);
|
|
662
|
-
|
|
663
|
-
|
|
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
|
+
});
|
|
664
472
|
}
|
|
665
473
|
return out;
|
|
666
474
|
}
|
|
667
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
|
+
|
|
668
487
|
/** Notes for damaged color configs kept aside during one sync. @type {string[]} */
|
|
669
488
|
const keptDamaged = [];
|
|
670
489
|
|
|
@@ -767,61 +586,6 @@ function deadKeys(config) {
|
|
|
767
586
|
return out;
|
|
768
587
|
}
|
|
769
588
|
|
|
770
|
-
/**
|
|
771
|
-
* The light stop nearest a seed color in the ramp the generator grows from
|
|
772
|
-
* it. The official themes anchor a brand color there, exactly, so the fill
|
|
773
|
-
* keeps the color as given. The end stops are pure black and white and
|
|
774
|
-
* never hold an anchor.
|
|
775
|
-
* @param {string} seed
|
|
776
|
-
* @param {any} config - Its `stops` and `vibrancy` shape the ramp.
|
|
777
|
-
* @param {'chromatic' | 'neutral'} [kind]
|
|
778
|
-
*/
|
|
779
|
-
function seedStop(seed, config, kind = 'chromatic') {
|
|
780
|
-
const {palette} = generate({
|
|
781
|
-
...(config.stops ? {stops: config.stops} : {}),
|
|
782
|
-
...(config.vibrancy != null ? {vibrancy: config.vibrancy} : {}),
|
|
783
|
-
...(kind === 'neutral' ? {neutralProfile: 'custom'} : {}),
|
|
784
|
-
modeStrategy: 'light-only',
|
|
785
|
-
families: [{id: 'seed', seed, kind}],
|
|
786
|
-
});
|
|
787
|
-
const ramp = /** @type {Record<number, string>} */ (
|
|
788
|
-
/** @type {any} */ (palette.seed).light
|
|
789
|
-
);
|
|
790
|
-
return Number(nearestShade(ramp, seed));
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
/**
|
|
794
|
-
* The stop of a ramp whose shade is nearest a color, as the eye compares
|
|
795
|
-
* them; never an end stop (pure black or white, which every ramp shares).
|
|
796
|
-
* Null for a ramp with no inner stop.
|
|
797
|
-
* @param {Record<string | number, string>} ramp
|
|
798
|
-
* @param {string} color
|
|
799
|
-
* @returns {string | null}
|
|
800
|
-
*/
|
|
801
|
-
export function nearestShade(ramp, color) {
|
|
802
|
-
const inner = Object.keys(ramp).filter(s => Number(s) > 0 && Number(s) < 100);
|
|
803
|
-
if (!inner.length) return null;
|
|
804
|
-
return inner.reduce((best, s) =>
|
|
805
|
-
perceptualDelta(ramp[s], color) < perceptualDelta(ramp[best], color)
|
|
806
|
-
? s
|
|
807
|
-
: best,
|
|
808
|
-
);
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* The stop of a layout nearest `n`; on a tie, the one nearer the middle.
|
|
813
|
-
* @param {readonly number[]} stops
|
|
814
|
-
* @param {number} n
|
|
815
|
-
*/
|
|
816
|
-
function nearestStop(stops, n) {
|
|
817
|
-
return stops.reduce((best, s) => {
|
|
818
|
-
const d = Math.abs(s - n) - Math.abs(best - n);
|
|
819
|
-
return d < 0 || (d === 0 && Math.abs(s - 50) < Math.abs(best - 50))
|
|
820
|
-
? s
|
|
821
|
-
: best;
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
|
|
825
589
|
/**
|
|
826
590
|
* Refuse a stop layout the token mapping cannot use: numbers only, black
|
|
827
591
|
* (0) and white (100), enough shades between them, and no gap so wide that
|
|
@@ -869,42 +633,21 @@ function usableStops(stops, slug) {
|
|
|
869
633
|
}
|
|
870
634
|
|
|
871
635
|
/**
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
*
|
|
875
|
-
*
|
|
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
|
|
876
642
|
* @param {{settings: Setting[]}} data
|
|
877
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}
|
|
878
646
|
*/
|
|
879
|
-
function
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
base,
|
|
883
|
-
/** @type {Record<string, string>} */ own = {},
|
|
884
|
-
) {
|
|
885
|
-
const {stops} = candidate;
|
|
886
|
-
/** @param {number} n */
|
|
887
|
-
const at = n => nearestStop(stops, n);
|
|
888
|
-
/** The stop nearest `n` off the white and black ends. @param {number} n */
|
|
889
|
-
const atInside = n =>
|
|
890
|
-
nearestStop(
|
|
891
|
-
stops.filter(s => s > 0 && s < 100),
|
|
892
|
-
n,
|
|
893
|
-
);
|
|
894
|
-
/** @param {string} id @param {Mode} m @param {number} stop @param {string} [alpha] @returns {StopRef} */
|
|
895
|
-
const ref = (id, m, stop, alpha) => {
|
|
896
|
-
const color = /** @type {any} */ (candidate.palette[id])[m][stop];
|
|
897
|
-
return alpha ? {stop, color: `${color}${alpha}`, alpha} : {stop, color};
|
|
898
|
-
};
|
|
899
|
-
const neutral = Boolean(/** @type {any} */ (candidate.palette).neutral);
|
|
900
|
-
/**
|
|
901
|
-
* The whole-theme value a token setting gives in a mode, as written, or
|
|
902
|
-
* undefined.
|
|
903
|
-
* @param {string} token @param {Mode} m
|
|
904
|
-
*/
|
|
647
|
+
function paletteContext(cwd, slug, data, base, tokenDefaults = {}) {
|
|
648
|
+
const own = ownSourceTokenValues(cwd, slug);
|
|
649
|
+
/** @param {string} token @param {Mode} m @returns {string | undefined} */
|
|
905
650
|
const settingOf = (token, m) =>
|
|
906
|
-
// A page-wide token the theme's own source sets wins over the settings
|
|
907
|
-
// (the build shows it), as an exact setting would.
|
|
908
651
|
(Object.hasOwn(own, token) ? own[token] : undefined) ??
|
|
909
652
|
[...data.settings]
|
|
910
653
|
.reverse()
|
|
@@ -949,174 +692,35 @@ function tools(
|
|
|
949
692
|
const t = ref.trim();
|
|
950
693
|
if (!/^--[a-z0-9-]+$/i.test(t) || seen.has(t)) return null;
|
|
951
694
|
seen.add(t);
|
|
952
|
-
const
|
|
695
|
+
const set = settingOf(t, m);
|
|
953
696
|
const read =
|
|
954
|
-
|
|
697
|
+
set != null ? colorIn(set, m, seen) : colorIn(base?.[m]?.[t], m, seen);
|
|
955
698
|
return read ?? (rest.length ? colorIn(rest.join(','), m, seen) : null);
|
|
956
699
|
};
|
|
957
|
-
/**
|
|
958
|
-
* The exact whole-theme color a token setting gives in a mode, or null.
|
|
959
|
-
* @param {string} token @param {Mode} m
|
|
960
|
-
*/
|
|
961
|
-
const exactOf = (token, m) => {
|
|
962
|
-
const v = colorIn(settingOf(token, m), m);
|
|
963
|
-
const rgb = v == null ? null : parseColor(v);
|
|
964
|
-
return rgb && v != null && alphaOf(v) >= 1 ? hex(rgb) : null;
|
|
965
|
-
};
|
|
966
|
-
/**
|
|
967
|
-
* The exact whole-theme color a token setting gives in a mode, see-through
|
|
968
|
-
* or not, as written (a hex keeps its alpha digits; a `light-dark()` or a
|
|
969
|
-
* `var()` gives the color it reads in the mode); null when there is none
|
|
970
|
-
* or it is not a fixed color.
|
|
971
|
-
* @param {string} token @param {Mode} m
|
|
972
|
-
*/
|
|
973
|
-
const rawOf = (token, m) => colorIn(settingOf(token, m), m);
|
|
974
|
-
/**
|
|
975
|
-
* Which column of a `[light, dark]` mapping a mode takes: the light one
|
|
976
|
-
* on a light page and the dark one on a dark page, by the base theme's
|
|
977
|
-
* page, the one its surfaces were made for. A base whose light page is
|
|
978
|
-
* dark, such as Gothic, gets dark-page shades in light. A page color the
|
|
979
|
-
* theme writes is that one color: it never moves every other surface to
|
|
980
|
-
* the other column (a teal page keeps white cards and popovers), and the
|
|
981
|
-
* colors that must read on it are held to it where they are picked.
|
|
982
|
-
* @param {Mode} m
|
|
983
|
-
* @returns {0 | 1}
|
|
984
|
-
*/
|
|
985
|
-
const side = m => {
|
|
986
|
-
const page = base?.[m]?.['--color-background-body'];
|
|
987
|
-
const rgb = page ? parseColor(page) : null;
|
|
988
|
-
if (!rgb || alphaOf(page) < 1) return m === 'light' ? 0 : 1;
|
|
989
|
-
return ratio(rgb, [255, 255, 255]) > ratio(rgb, [0, 0, 0]) ? 1 : 0;
|
|
990
|
-
};
|
|
991
|
-
/**
|
|
992
|
-
* What text and fills sit on in a mode: the theme's exact surface
|
|
993
|
-
* colors, else the neutral color's surfaces, else the base theme's; the
|
|
994
|
-
* family's own surface stop when nothing else is known.
|
|
995
|
-
* @param {Mode} m @param {string} id
|
|
996
|
-
* @returns {Array<[string, string]>}
|
|
997
|
-
*/
|
|
998
|
-
const surfaces = (m, id) => {
|
|
999
|
-
/** @type {Array<[string, string]>} */
|
|
1000
|
-
const out = [];
|
|
1001
|
-
for (const n of [
|
|
1002
|
-
'--color-background-surface',
|
|
1003
|
-
'--color-background-body',
|
|
1004
|
-
'--color-background-card',
|
|
1005
|
-
]) {
|
|
1006
|
-
const own =
|
|
1007
|
-
neutral && NEUTRAL_STOPS[n]
|
|
1008
|
-
? ref('neutral', m, at(NEUTRAL_STOPS[n][side(m)])).color
|
|
1009
|
-
: null;
|
|
1010
|
-
const v = exactOf(n, m) ?? own ?? base?.[m]?.[n];
|
|
1011
|
-
if (v && parseColor(v) && alphaOf(v) >= 1)
|
|
1012
|
-
out.push([n, hex(/** @type {number[]} */ (parseColor(v)))]);
|
|
1013
|
-
}
|
|
1014
|
-
if (!out.length) {
|
|
1015
|
-
const s = at(NEUTRAL_STOPS['--color-background-surface'][side(m)]);
|
|
1016
|
-
out.push([`${id} shade ${s}`, ref(id, m, s).color]);
|
|
1017
|
-
}
|
|
1018
|
-
return out;
|
|
1019
|
-
};
|
|
1020
|
-
/**
|
|
1021
|
-
* The text shades for a fill, preferred first.
|
|
1022
|
-
* @param {string} id @param {Mode} m
|
|
1023
|
-
* @returns {StopRef[]}
|
|
1024
|
-
*/
|
|
1025
|
-
const onChoices = (id, m) =>
|
|
1026
|
-
(id === 'warning' ? [5, 100] : ON_FILL[m]).map(s =>
|
|
1027
|
-
neutral
|
|
1028
|
-
? {...ref('neutral', m, at(s)), family: 'neutral'}
|
|
1029
|
-
: s >= 50
|
|
1030
|
-
? {stop: 100, color: PALETTE_WHITE, family: 'white'}
|
|
1031
|
-
: {stop: 0, color: PALETTE_BLACK, family: 'black'},
|
|
1032
|
-
);
|
|
1033
|
-
/**
|
|
1034
|
-
* The text on a fill: the preferred shade when it reads at 4.5:1, else
|
|
1035
|
-
* the one that reads better.
|
|
1036
|
-
* @param {string} id @param {Mode} m @param {string} fill
|
|
1037
|
-
*/
|
|
1038
|
-
const onFor = (id, m, fill) => {
|
|
1039
|
-
const [a, b] = onChoices(id, m).map(on => ({
|
|
1040
|
-
on,
|
|
1041
|
-
r: contrast(on.color, fill),
|
|
1042
|
-
}));
|
|
1043
|
-
const best = a.r >= TEXT || a.r >= b.r ? a : b;
|
|
1044
|
-
const other = best === a ? b : a;
|
|
1045
|
-
return {
|
|
1046
|
-
on: best.on,
|
|
1047
|
-
r: best.r,
|
|
1048
|
-
other: other.on,
|
|
1049
|
-
otherR: other.r,
|
|
1050
|
-
first: a.on,
|
|
1051
|
-
};
|
|
1052
|
-
};
|
|
1053
|
-
/** The lowest contrast of a color on the surfaces. @param {string} color @param {Mode} m @param {string} id */
|
|
1054
|
-
const page = (color, m, id) =>
|
|
1055
|
-
Math.min(...surfaces(m, id).map(([, bg]) => contrast(color, bg)));
|
|
1056
|
-
/**
|
|
1057
|
-
* A color as the eye sees it on the surface in a mode: a see-through one
|
|
1058
|
-
* drawn over the first surface.
|
|
1059
|
-
* @param {string} color @param {Mode} m @param {string} id
|
|
1060
|
-
*/
|
|
1061
|
-
const solid = (color, m, id) => {
|
|
1062
|
-
const rgb = /** @type {[number, number, number]} */ (parseColor(color));
|
|
1063
|
-
const a = alphaOf(color);
|
|
1064
|
-
if (a >= 1) return hex(rgb);
|
|
1065
|
-
const under = /** @type {[number, number, number]} */ (
|
|
1066
|
-
parseColor(surfaces(m, id)[0][1])
|
|
1067
|
-
);
|
|
1068
|
-
return hex(compositeOver(rgb, a, under));
|
|
1069
|
-
};
|
|
1070
700
|
return {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
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
|
+
},
|
|
1076
708
|
settingOf,
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
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}` : ''}`,
|
|
1084
721
|
};
|
|
1085
722
|
}
|
|
1086
723
|
|
|
1087
|
-
/** A text shade, named for a sentence. @param {StopRef} r */
|
|
1088
|
-
const textName = r =>
|
|
1089
|
-
r.family === 'white' || (r.family === 'neutral' && r.stop >= 95)
|
|
1090
|
-
? 'white'
|
|
1091
|
-
: r.family === 'black' || (r.family === 'neutral' && r.stop <= 10)
|
|
1092
|
-
? 'near-black'
|
|
1093
|
-
: `shade ${r.stop}`;
|
|
1094
|
-
|
|
1095
|
-
/**
|
|
1096
|
-
* Whether the exact seed color works as the dark fill: text on it reads at
|
|
1097
|
-
* 4.5:1 and it stands out from the dark surfaces at 3:1. Why not otherwise.
|
|
1098
|
-
* @param {ReturnType<typeof tools>} t
|
|
1099
|
-
* @param {string} id
|
|
1100
|
-
* @param {string} seed
|
|
1101
|
-
*/
|
|
1102
|
-
function darkExact(t, id, seed) {
|
|
1103
|
-
const on = t.onFor(id, 'dark', seed);
|
|
1104
|
-
if (on.r < TEXT)
|
|
1105
|
-
return {
|
|
1106
|
-
ok: false,
|
|
1107
|
-
ratio: round(on.r),
|
|
1108
|
-
why: `your exact color reads at only ${round(on.r)}:1 with any text shade, and text needs ${TEXT}:1`,
|
|
1109
|
-
};
|
|
1110
|
-
const p = t.page(seed, 'dark', id);
|
|
1111
|
-
if (p < NON_TEXT)
|
|
1112
|
-
return {
|
|
1113
|
-
ok: false,
|
|
1114
|
-
ratio: round(p),
|
|
1115
|
-
why: `your exact color stands out from the dark page at only ${round(p)}:1, and a fill needs ${NON_TEXT}:1`,
|
|
1116
|
-
};
|
|
1117
|
-
return {ok: true, ratio: round(on.r), why: ''};
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
724
|
/**
|
|
1121
725
|
* What the config writer decided: the config, what it kept or replaced of
|
|
1122
726
|
* a hand edit, and for each accent or status color the stop of its exact
|
|
@@ -1137,14 +741,17 @@ function darkExact(t, id, seed) {
|
|
|
1137
741
|
* the author's own stay. Null when the config would hold no family.
|
|
1138
742
|
* @param {string} cwd
|
|
1139
743
|
* @param {string} slug
|
|
1140
|
-
* @param {{mode?: string, settings: Setting[]}} data
|
|
744
|
+
* @param {{mode?: string, settings: Setting[], palette?: string}} data
|
|
1141
745
|
* @param {{light: Record<string, string>, dark: Record<string, string>}} [base] the base theme's resolved colors, which the dark check reads
|
|
1142
746
|
* @returns {PalettePlan | null}
|
|
1143
747
|
*/
|
|
1144
748
|
function planPalette(cwd, slug, data, base) {
|
|
1145
749
|
const file = paletteFiles(slug).config;
|
|
1146
750
|
const existing = readConfig(path.join(cwd, file));
|
|
1147
|
-
|
|
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));
|
|
1148
755
|
if (!existing && !fams.length) return null;
|
|
1149
756
|
/** @type {string[]} */
|
|
1150
757
|
const notes = [];
|
|
@@ -1200,29 +807,35 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1200
807
|
);
|
|
1201
808
|
/** @type {any[]} */
|
|
1202
809
|
const before = Array.isArray(config.families) ? config.families : [];
|
|
1203
|
-
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);
|
|
1204
817
|
|
|
1205
818
|
/**
|
|
1206
819
|
* One dial family: the author's family with the dial's seed and the
|
|
1207
820
|
* exact anchors of that seed in place of the old ones.
|
|
1208
821
|
* @param {any} prev
|
|
1209
|
-
* @param {
|
|
822
|
+
* @param {DialFamily} f
|
|
1210
823
|
*/
|
|
1211
824
|
const familyOf = (prev, f) => {
|
|
1212
825
|
const old = prev && typeof prev === 'object' ? prev : {};
|
|
1213
826
|
const neutral = f.id === 'neutral';
|
|
1214
|
-
const wasSaved =
|
|
827
|
+
const wasSaved = configMine
|
|
828
|
+
? old.seed
|
|
829
|
+
: savedSeeds.find(x => x.id === f.id)?.seed;
|
|
1215
830
|
if (old.seed != null && wasSaved && !sameColor(old.seed, wasSaved))
|
|
1216
831
|
notes.push(
|
|
1217
|
-
`${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}`,
|
|
1218
833
|
);
|
|
1219
|
-
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.
|
|
1220
837
|
const kind =
|
|
1221
|
-
|
|
1222
|
-
? 'neutral'
|
|
1223
|
-
: old.kind === 'chromatic'
|
|
1224
|
-
? 'chromatic'
|
|
1225
|
-
: undefined;
|
|
838
|
+
made.kind ?? (old.kind === 'chromatic' ? 'chromatic' : undefined);
|
|
1226
839
|
if (
|
|
1227
840
|
old.kind === 'neutral' &&
|
|
1228
841
|
!kind &&
|
|
@@ -1232,25 +845,8 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1232
845
|
notes.push(
|
|
1233
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`,
|
|
1234
847
|
);
|
|
1235
|
-
const stop = seedStop(
|
|
1236
|
-
f.seed,
|
|
1237
|
-
config,
|
|
1238
|
-
kind === 'neutral' ? 'neutral' : 'chromatic',
|
|
1239
|
-
);
|
|
1240
|
-
// White and black already end every ramp, so a neutral of either holds
|
|
1241
|
-
// no anchor of its own.
|
|
1242
|
-
const ends =
|
|
1243
|
-
neutral &&
|
|
1244
|
-
(sameColor(f.seed, PALETTE_WHITE) || sameColor(f.seed, PALETTE_BLACK));
|
|
1245
848
|
/** @type {any[]} */
|
|
1246
|
-
const mine =
|
|
1247
|
-
? []
|
|
1248
|
-
: (neutral ? modes : modes.filter(m => m === 'light')).map(m => ({
|
|
1249
|
-
mode: m,
|
|
1250
|
-
stop,
|
|
1251
|
-
color: f.seed,
|
|
1252
|
-
policy: 'exact',
|
|
1253
|
-
}));
|
|
849
|
+
const mine = made.anchors ?? [];
|
|
1254
850
|
/** @type {any[]} */
|
|
1255
851
|
const kept = [];
|
|
1256
852
|
const anchors = Array.isArray(old.anchors) ? old.anchors : [];
|
|
@@ -1291,7 +887,7 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1291
887
|
const out = {
|
|
1292
888
|
...old,
|
|
1293
889
|
id: f.id,
|
|
1294
|
-
name: old.name ??
|
|
890
|
+
name: old.name ?? made.name,
|
|
1295
891
|
seed: f.seed,
|
|
1296
892
|
...(kind ? {kind} : {}),
|
|
1297
893
|
anchors: [...mine, ...kept].sort((a, b) =>
|
|
@@ -1317,16 +913,14 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1317
913
|
const mine = fams.find(x => x.id === f.id);
|
|
1318
914
|
if (!mine) return null;
|
|
1319
915
|
const {family, stop} = familyOf(f, mine);
|
|
1320
|
-
if (mine.id !== 'neutral')
|
|
1321
|
-
fills[mine.id] = {stop, dark: false, why: '', ratio: 0};
|
|
916
|
+
if (mine.id !== 'neutral') fills[mine.id] = fillAt(stop);
|
|
1322
917
|
return family;
|
|
1323
918
|
})
|
|
1324
919
|
.filter(Boolean);
|
|
1325
920
|
for (const f of fams)
|
|
1326
921
|
if (!families.some(x => x?.id === f.id)) {
|
|
1327
922
|
const {family, stop} = familyOf(null, f);
|
|
1328
|
-
if (f.id !== 'neutral')
|
|
1329
|
-
fills[f.id] = {stop, dark: false, why: '', ratio: 0};
|
|
923
|
+
if (f.id !== 'neutral') fills[f.id] = fillAt(stop);
|
|
1330
924
|
families.push(family);
|
|
1331
925
|
}
|
|
1332
926
|
if (!families.length) return null;
|
|
@@ -1380,60 +974,23 @@ function planPalette(cwd, slug, data, base) {
|
|
|
1380
974
|
// The exact color anchors dark mode too when it reads there, as the
|
|
1381
975
|
// official themes anchor a brand color in both modes.
|
|
1382
976
|
if (modes.includes('dark') && Object.keys(fills).length) {
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
const add = [];
|
|
1391
|
-
for (const [id, fill] of Object.entries(fills)) {
|
|
1392
|
-
const seed = /** @type {string} */ (fams.find(f => f.id === id)?.seed);
|
|
1393
|
-
const check = darkExact(t, id, seed);
|
|
1394
|
-
Object.assign(fill, {why: check.why, ratio: check.ratio});
|
|
1395
|
-
if (check.ok) add.push(id);
|
|
1396
|
-
}
|
|
1397
|
-
/** @param {string} id @param {any} cfg */
|
|
1398
|
-
const withDark = (id, cfg) => ({
|
|
1399
|
-
...cfg,
|
|
1400
|
-
families: cfg.families.map((/** @type {any} */ f) => {
|
|
1401
|
-
if (f?.id !== id) return f;
|
|
1402
|
-
const anchor = {
|
|
1403
|
-
mode: 'dark',
|
|
1404
|
-
stop: fills[id].stop,
|
|
1405
|
-
color: f.seed,
|
|
1406
|
-
policy: 'exact',
|
|
1407
|
-
};
|
|
1408
|
-
const others = (f.anchors ?? []).filter(
|
|
1409
|
-
(/** @type {any} */ a) =>
|
|
1410
|
-
!(a.mode === 'dark' && a.stop === anchor.stop),
|
|
1411
|
-
);
|
|
1412
|
-
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) =>
|
|
1413
984
|
notes.push(
|
|
1414
|
-
`${file}: your dark anchor at shade ${shade(
|
|
1415
|
-
);
|
|
1416
|
-
return {
|
|
1417
|
-
...f,
|
|
1418
|
-
anchors: [...others, anchor].sort((a, b) =>
|
|
1419
|
-
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`,
|
|
1420
986
|
),
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
try {
|
|
1428
|
-
generateTonalPalette(tried);
|
|
1429
|
-
next = tried;
|
|
1430
|
-
fills[id].dark = true;
|
|
1431
|
-
} catch {
|
|
1432
|
-
fills[id].why =
|
|
1433
|
-
'the dark shades cannot hold your exact color and stay in order from dark to light';
|
|
1434
|
-
}
|
|
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;
|
|
1435
993
|
}
|
|
1436
|
-
config.families = next.families;
|
|
1437
994
|
}
|
|
1438
995
|
return {config, notes, fills};
|
|
1439
996
|
}
|
|
@@ -1478,6 +1035,38 @@ export function syncPalette(cwd, slug, data, base) {
|
|
|
1478
1035
|
return [...keptDamaged.splice(0), ...notes];
|
|
1479
1036
|
}
|
|
1480
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
|
+
|
|
1481
1070
|
/**
|
|
1482
1071
|
* @param {string} cwd
|
|
1483
1072
|
* @param {string} slug
|
|
@@ -1492,26 +1081,7 @@ function syncPaletteFiles(cwd, slug, data, base) {
|
|
|
1492
1081
|
if (!plan) {
|
|
1493
1082
|
// Only palette files the editor wrote go: a hand-made palette.config.json
|
|
1494
1083
|
// (and what it generated) stays.
|
|
1495
|
-
|
|
1496
|
-
// from before the palette existed.
|
|
1497
|
-
/** @type {string | undefined} */
|
|
1498
|
-
let saved;
|
|
1499
|
-
try {
|
|
1500
|
-
saved = JSON.parse(
|
|
1501
|
-
fs.readFileSync(abs(`themes/${slug}/${slug}.settings.json`), 'utf8'),
|
|
1502
|
-
).palette;
|
|
1503
|
-
} catch {
|
|
1504
|
-
saved = undefined;
|
|
1505
|
-
}
|
|
1506
|
-
const hash = fs.existsSync(abs(f.config))
|
|
1507
|
-
? sha256(fs.readFileSync(abs(f.config)))
|
|
1508
|
-
: null;
|
|
1509
|
-
// Or the config the editor recorded writing (a color change stopped
|
|
1510
|
-
// before its settings were saved).
|
|
1511
|
-
const recorded = readWrittenRecord(cwd, slug)['palette.config.json'];
|
|
1512
|
-
const mine =
|
|
1513
|
-
hash != null &&
|
|
1514
|
-
(data.palette === hash || saved === hash || recorded === hash);
|
|
1084
|
+
const mine = configWrittenByEditor(cwd, slug, data);
|
|
1515
1085
|
delete data.palette;
|
|
1516
1086
|
if (!mine) return [];
|
|
1517
1087
|
// A palette file edited by hand is never deleted: it stays, and the
|
|
@@ -1970,12 +1540,39 @@ export function syncPaletteRefs(cwd, slug, source, pal) {
|
|
|
1970
1540
|
writeWhole(file, text);
|
|
1971
1541
|
}
|
|
1972
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
|
+
|
|
1973
1568
|
/**
|
|
1974
1569
|
* @param {any} config
|
|
1975
1570
|
* @param {string} [file] the config's path, for the refusal
|
|
1571
|
+
* @param {string} [cwd] the project, for the command that updates the CLI
|
|
1976
1572
|
* @returns {Candidate}
|
|
1977
1573
|
*/
|
|
1978
|
-
function generate(config, file = 'palette.config.json') {
|
|
1574
|
+
function generate(config, file = 'palette.config.json', cwd = undefined) {
|
|
1575
|
+
refuseUnknownRecipe(config, file, cwd);
|
|
1979
1576
|
try {
|
|
1980
1577
|
return generateTonalPalette(config);
|
|
1981
1578
|
} catch (e) {
|
|
@@ -1987,68 +1584,6 @@ function generate(config, file = 'palette.config.json') {
|
|
|
1987
1584
|
}
|
|
1988
1585
|
}
|
|
1989
1586
|
|
|
1990
|
-
/**
|
|
1991
|
-
* The contrast ratio of two opaque colors. A color that does not parse is
|
|
1992
|
-
* a bug in the mapping, never a ratio of 0.
|
|
1993
|
-
* @param {string} a @param {string} b
|
|
1994
|
-
*/
|
|
1995
|
-
function contrast(a, b) {
|
|
1996
|
-
const x = parseColor(a);
|
|
1997
|
-
const y = parseColor(b);
|
|
1998
|
-
if (!x || !y) throw new Error(`No contrast between "${a}" and "${b}".`);
|
|
1999
|
-
return ratio(x, y);
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
/**
|
|
2003
|
-
* A translucent stop drawn over each surface, as the opaque colors the eye
|
|
2004
|
-
* sees; an opaque stop as it is.
|
|
2005
|
-
* @param {string} name @param {StopRef} r @param {Array<[string, string]>} under
|
|
2006
|
-
* @returns {Array<[string, string]>}
|
|
2007
|
-
*/
|
|
2008
|
-
function over(name, r, under) {
|
|
2009
|
-
if (!r.alpha) return [[name, r.color]];
|
|
2010
|
-
const top = /** @type {[number, number, number]} */ (
|
|
2011
|
-
parseColor(r.color.slice(0, 7))
|
|
2012
|
-
);
|
|
2013
|
-
const a = parseInt(r.alpha, 16) / 255;
|
|
2014
|
-
return under.map(([n, bg]) => [
|
|
2015
|
-
`${name} over ${n}`,
|
|
2016
|
-
hex(
|
|
2017
|
-
compositeOver(
|
|
2018
|
-
top,
|
|
2019
|
-
a,
|
|
2020
|
-
/** @type {[number, number, number]} */ (parseColor(bg)),
|
|
2021
|
-
),
|
|
2022
|
-
),
|
|
2023
|
-
]);
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
/** @param {number} r */
|
|
2027
|
-
const round = r => Math.round(r * 100) / 100;
|
|
2028
|
-
|
|
2029
|
-
/** A stop as text: a layout may hold 16.666666666666668. @param {number} s */
|
|
2030
|
-
const shade = s => String(round(s));
|
|
2031
|
-
|
|
2032
|
-
/**
|
|
2033
|
-
* A gray ramp the generator grows from a gray of the theme (its secondary
|
|
2034
|
-
* text), for a mode: the grays of a theme whose palette has no neutral
|
|
2035
|
-
* family. Null when the seed does not grow.
|
|
2036
|
-
* @param {string} seed @param {Mode} m
|
|
2037
|
-
* @returns {Record<string, string> | null}
|
|
2038
|
-
*/
|
|
2039
|
-
function grownGrays(seed, m) {
|
|
2040
|
-
try {
|
|
2041
|
-
const g = generateTonalPalette({
|
|
2042
|
-
modeStrategy: m === 'light' ? 'light-only' : 'dark-only',
|
|
2043
|
-
neutralProfile: 'custom',
|
|
2044
|
-
families: [{id: 'gray', seed, kind: 'neutral'}],
|
|
2045
|
-
});
|
|
2046
|
-
return /** @type {any} */ (g.palette.gray)[m] ?? null;
|
|
2047
|
-
} catch {
|
|
2048
|
-
return null;
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
1587
|
/**
|
|
2053
1588
|
* A family's ramp in each mode, as the theme makes it: the palette's own
|
|
2054
1589
|
* family when its color settings define one; for the neutral family, else
|
|
@@ -2067,7 +1602,7 @@ export function familyRamp(cwd, slug, data, base, family) {
|
|
|
2067
1602
|
planPalette(cwd, slug, data, base)
|
|
2068
1603
|
);
|
|
2069
1604
|
const ramp = /** @type {any} */ (
|
|
2070
|
-
generate(plan.config, paletteFiles(slug).config).palette
|
|
1605
|
+
generate(plan.config, paletteFiles(slug).config, cwd).palette
|
|
2071
1606
|
)[family];
|
|
2072
1607
|
if (ramp?.light && ramp?.dark) return ramp;
|
|
2073
1608
|
}
|
|
@@ -2106,589 +1641,22 @@ export function familyRamp(cwd, slug, data, base, family) {
|
|
|
2106
1641
|
* @returns {PaletteMapping | null}
|
|
2107
1642
|
*/
|
|
2108
1643
|
export function paletteMapping(cwd, slug, data, base, tokenDefaults) {
|
|
2109
|
-
const fams = dialFamilies(data);
|
|
1644
|
+
const fams = dialFamilies(data, ownSourceTokenValues(cwd, slug));
|
|
2110
1645
|
if (!fams.length) return null;
|
|
2111
1646
|
const plan = /** @type {PalettePlan} */ (planPalette(cwd, slug, data, base));
|
|
2112
1647
|
const {config} = plan;
|
|
2113
|
-
const candidate = generate(config, paletteFiles(slug).config);
|
|
2114
|
-
const
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
exactOf,
|
|
2121
|
-
rawOf,
|
|
2122
|
-
settingOf,
|
|
2123
|
-
side,
|
|
2124
|
-
solid,
|
|
2125
|
-
surfaces,
|
|
2126
|
-
} = t;
|
|
2127
|
-
// Both halves, for a one-mode theme too (see planPalette).
|
|
2128
|
-
const modes = modesForStrategy('light-and-dark');
|
|
2129
|
-
/** @type {PaletteMapping['tokens']} */
|
|
2130
|
-
const tokens = {};
|
|
2131
|
-
/** @type {ContrastCheck[]} */
|
|
2132
|
-
const checks = [];
|
|
2133
|
-
/** @type {PaletteMapping['exact']} */
|
|
2134
|
-
const exact = {};
|
|
2135
|
-
/** @type {Record<string, string>} */
|
|
2136
|
-
const unread = {};
|
|
2137
|
-
const has = (/** @type {string} */ k) => k in tokenDefaults;
|
|
2138
|
-
/** A token the theme sets exactly in any mode: no check speaks for it. @param {string} k */
|
|
2139
|
-
const setExactly = k =>
|
|
2140
|
-
data.settings.some(
|
|
2141
|
-
s =>
|
|
2142
|
-
s.source === 'token' && s.thing === k && !s.on && !s.when && !s.state,
|
|
2143
|
-
);
|
|
2144
|
-
const reports = (/** @type {string} */ k) => has(k) && !setExactly(k);
|
|
2145
|
-
/**
|
|
2146
|
-
* Point a token at its stops. A theme with one mode has one ramp: the
|
|
2147
|
-
* other side repeats it.
|
|
2148
|
-
* @param {string} token @param {string} id @param {Partial<Record<Mode, StopRef>>} refs
|
|
2149
|
-
*/
|
|
2150
|
-
const put = (token, id, refs) => {
|
|
2151
|
-
if (!has(token)) return;
|
|
2152
|
-
const one = /** @type {StopRef} */ (refs[modes[0]]);
|
|
2153
|
-
tokens[token] = {
|
|
2154
|
-
family: id,
|
|
2155
|
-
light: refs.light ?? one,
|
|
2156
|
-
dark: refs.dark ?? one,
|
|
2157
|
-
};
|
|
2158
|
-
};
|
|
2159
|
-
/** @template T @param {(m: Mode) => T} fn @returns {Partial<Record<Mode, T>>} */
|
|
2160
|
-
const each = fn => Object.fromEntries(modes.map(m => [m, fn(m)]));
|
|
2161
|
-
/**
|
|
2162
|
-
* The stop nearest `start` that reads at `needs` on every color in `on`,
|
|
2163
|
-
* searched both ways (the usual way first on a tie: darker in light,
|
|
2164
|
-
* lighter in dark), so a base with dark light-mode surfaces still finds
|
|
2165
|
-
* one; the most contrasting stop of all when none does.
|
|
2166
|
-
* @param {string} token @param {string} id @param {Mode} m @param {number} start
|
|
2167
|
-
* @param {Array<[string, string]>} on - `[name, color]` pairs.
|
|
2168
|
-
* @param {number} needs
|
|
2169
|
-
*/
|
|
2170
|
-
const pick = (token, id, m, start, on, needs) => {
|
|
2171
|
-
const usual = TOWARD_CONTRAST[m];
|
|
2172
|
-
const order = [...stops].sort(
|
|
2173
|
-
(a, b) =>
|
|
2174
|
-
Math.abs(a - start) - Math.abs(b - start) ||
|
|
2175
|
-
(Math.sign(b - a) === usual ? 1 : -1),
|
|
2176
|
-
);
|
|
2177
|
-
/** @param {number} stop */
|
|
2178
|
-
const score = stop => {
|
|
2179
|
-
const c = ref(id, m, stop).color;
|
|
2180
|
-
return Math.min(...on.map(([, bg]) => contrast(c, bg)));
|
|
2181
|
-
};
|
|
2182
|
-
const scored = order.map(stop => ({stop, r: score(stop)}));
|
|
2183
|
-
const b =
|
|
2184
|
-
scored.find(x => x.r >= needs) ??
|
|
2185
|
-
scored.reduce((x, y) => (y.r > x.r ? y : x));
|
|
2186
|
-
if (reports(token))
|
|
2187
|
-
checks.push({
|
|
2188
|
-
token,
|
|
2189
|
-
mode: m,
|
|
2190
|
-
stop: b.stop,
|
|
2191
|
-
preferred: start,
|
|
2192
|
-
against: on.map(([n]) => n).join(', '),
|
|
2193
|
-
ratio: round(b.r),
|
|
2194
|
-
needs,
|
|
2195
|
-
pass: b.r >= needs,
|
|
2196
|
-
});
|
|
2197
|
-
return ref(id, m, b.stop);
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
const neutral = fams.find(f => f.id === 'neutral');
|
|
2201
|
-
if (neutral) {
|
|
2202
|
-
for (const [token, pair] of Object.entries(NEUTRAL_STOPS)) {
|
|
2203
|
-
if (
|
|
2204
|
-
token === '--color-text-secondary' ||
|
|
2205
|
-
token === '--color-icon-secondary'
|
|
2206
|
-
)
|
|
2207
|
-
continue;
|
|
2208
|
-
const shade = NEUTRAL_INSIDE.has(token) ? atInside : at;
|
|
2209
|
-
put(
|
|
2210
|
-
token,
|
|
2211
|
-
'neutral',
|
|
2212
|
-
each(m => ref('neutral', m, shade(pair[side(m)]))),
|
|
2213
|
-
);
|
|
2214
|
-
}
|
|
2215
|
-
for (const [token, pair] of Object.entries(NEUTRAL_TINTS))
|
|
2216
|
-
put(
|
|
2217
|
-
token,
|
|
2218
|
-
'neutral',
|
|
2219
|
-
each(m => {
|
|
2220
|
-
const [s, a] = pair[side(m)];
|
|
2221
|
-
return ref('neutral', m, at(s), a);
|
|
2222
|
-
}),
|
|
2223
|
-
);
|
|
2224
|
-
for (const [token, needs] of /** @type {const} */ ([
|
|
2225
|
-
['--color-text-secondary', TEXT],
|
|
2226
|
-
['--color-icon-secondary', NON_TEXT],
|
|
2227
|
-
]))
|
|
2228
|
-
put(
|
|
2229
|
-
token,
|
|
2230
|
-
'neutral',
|
|
2231
|
-
each(m =>
|
|
2232
|
-
pick(
|
|
2233
|
-
token,
|
|
2234
|
-
'neutral',
|
|
2235
|
-
m,
|
|
2236
|
-
at(NEUTRAL_STOPS[token][side(m)]),
|
|
2237
|
-
surfaces(m, 'neutral'),
|
|
2238
|
-
needs,
|
|
2239
|
-
),
|
|
2240
|
-
),
|
|
2241
|
-
);
|
|
2242
|
-
const surface = paletteToken('neutral');
|
|
2243
|
-
const set = each(m => exactOf(surface, m));
|
|
2244
|
-
if (Object.values(set).some(Boolean))
|
|
2245
|
-
exact[surface] = /** @type {Partial<Record<Mode, string>>} */ (
|
|
2246
|
-
Object.fromEntries(Object.entries(set).filter(([, v]) => v))
|
|
2247
|
-
);
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
for (const f of fams) {
|
|
2251
|
-
if (f.id === 'neutral') continue;
|
|
2252
|
-
const word = f.id === 'accent' ? null : STATUS_TOKEN[f.id];
|
|
2253
|
-
const names = word
|
|
2254
|
-
? {
|
|
2255
|
-
fill: `--color-${word}`,
|
|
2256
|
-
on: `--color-on-${word}`,
|
|
2257
|
-
text: `--color-text-${word}`,
|
|
2258
|
-
icon: `--color-icon-${word}`,
|
|
2259
|
-
muted: `--color-${word}-muted`,
|
|
2260
|
-
onMuted: `--color-on-${word}-muted`,
|
|
2261
|
-
border: `--color-border-${word}`,
|
|
2262
|
-
focus: null,
|
|
2263
|
-
}
|
|
2264
|
-
: {
|
|
2265
|
-
fill: '--color-accent',
|
|
2266
|
-
on: '--color-on-accent',
|
|
2267
|
-
text: '--color-text-accent',
|
|
2268
|
-
icon: '--color-icon-accent',
|
|
2269
|
-
muted: '--color-accent-muted',
|
|
2270
|
-
onMuted: null,
|
|
2271
|
-
border: null,
|
|
2272
|
-
focus: '--focus-outline-color',
|
|
2273
|
-
};
|
|
2274
|
-
const plain = plan.fills[f.id];
|
|
2275
|
-
const S = plain.stop;
|
|
2276
|
-
const fillWord = f.id;
|
|
2277
|
-
/** @type {Partial<Record<Mode, string>>} */
|
|
2278
|
-
const exactFill = {};
|
|
2279
|
-
for (const m of modes) {
|
|
2280
|
-
const v = rawOf(names.fill, m);
|
|
2281
|
-
if (v) exactFill[m] = v;
|
|
2282
|
-
else if (settingOf(names.fill, m) != null)
|
|
2283
|
-
unread[names.fill] = String(settingOf(names.fill, m)).trim();
|
|
2284
|
-
}
|
|
2285
|
-
if (Object.keys(exactFill).length)
|
|
2286
|
-
exact[names.fill] = Object.fromEntries(
|
|
2287
|
-
Object.entries(exactFill).map(([m, v]) => {
|
|
2288
|
-
// A var() is named with the color it reads, so the note says
|
|
2289
|
-
// which color the text was picked for.
|
|
2290
|
-
const written = String(
|
|
2291
|
-
settingOf(names.fill, /** @type {Mode} */ (m)) ?? '',
|
|
2292
|
-
).trim();
|
|
2293
|
-
const rgb = parseColor(v);
|
|
2294
|
-
const color = rgb && alphaOf(v) >= 1 ? hex(rgb) : v;
|
|
2295
|
-
return [m, /var\(/i.test(written) ? `${written} = ${color}` : v];
|
|
2296
|
-
}),
|
|
2297
|
-
);
|
|
2298
|
-
|
|
2299
|
-
/** @type {Partial<Record<Mode, StopRef>>} */
|
|
2300
|
-
const fill = {};
|
|
2301
|
-
for (const m of modes) {
|
|
2302
|
-
if (m === 'light' || plain.dark) {
|
|
2303
|
-
fill[m] = {...ref(f.id, m, S), exact: true};
|
|
2304
|
-
continue;
|
|
2305
|
-
}
|
|
2306
|
-
// The dark fill when the exact color does not read there: shade 70,
|
|
2307
|
-
// else the shade nearest 70 that passes, else 70.
|
|
2308
|
-
const start = at(DARK_FILL);
|
|
2309
|
-
const order = [...stops]
|
|
2310
|
-
.filter(s => s > 0 && s < 100)
|
|
2311
|
-
.sort((a, b) => Math.abs(a - start) - Math.abs(b - start) || b - a);
|
|
2312
|
-
const found =
|
|
2313
|
-
order.find(s => {
|
|
2314
|
-
const c = ref(f.id, m, s).color;
|
|
2315
|
-
return (
|
|
2316
|
-
t.page(c, m, f.id) >= NON_TEXT && t.onFor(f.id, m, c).r >= TEXT
|
|
2317
|
-
);
|
|
2318
|
-
}) ?? start;
|
|
2319
|
-
fill[m] = ref(f.id, m, found);
|
|
2320
|
-
if (reports(names.fill))
|
|
2321
|
-
checks.push({
|
|
2322
|
-
token: names.fill,
|
|
2323
|
-
mode: m,
|
|
2324
|
-
stop: found,
|
|
2325
|
-
preferred: S,
|
|
2326
|
-
against: 'the dark page and the text on it',
|
|
2327
|
-
ratio: plain.ratio,
|
|
2328
|
-
needs: TEXT,
|
|
2329
|
-
pass: true,
|
|
2330
|
-
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`}`,
|
|
2331
|
-
});
|
|
2332
|
-
}
|
|
2333
|
-
put(names.fill, f.id, fill);
|
|
2334
|
-
|
|
2335
|
-
// Text on the fill reads on the fill the theme really uses: the exact
|
|
2336
|
-
// token setting when there is one. The exact color never moves; the
|
|
2337
|
-
// text changes instead.
|
|
2338
|
-
const on = each(m => {
|
|
2339
|
-
const used = exactFill[m] ?? /** @type {StopRef} */ (fill[m]).color;
|
|
2340
|
-
// A see-through exact fill is measured as it shows on the surface.
|
|
2341
|
-
const o = t.onFor(fillWord, m, solid(used, m, f.id));
|
|
2342
|
-
const what = exactFill[m]
|
|
2343
|
-
? `your exact ${names.fill} (${used}${alphaOf(used) < 1 ? `, as it shows: ${solid(used, m, f.id)}` : ''})`
|
|
2344
|
-
: `${names.fill} (shade ${shade(Number(fill[m]?.stop))})`;
|
|
2345
|
-
const moved = o.on !== o.first;
|
|
2346
|
-
if (reports(names.on))
|
|
2347
|
-
checks.push({
|
|
2348
|
-
token: names.on,
|
|
2349
|
-
mode: m,
|
|
2350
|
-
stop: o.on.stop,
|
|
2351
|
-
preferred: o.first.stop,
|
|
2352
|
-
against: what,
|
|
2353
|
-
ratio: round(o.r),
|
|
2354
|
-
needs: TEXT,
|
|
2355
|
-
pass: o.r >= TEXT,
|
|
2356
|
-
...(o.r < TEXT
|
|
2357
|
-
? {
|
|
2358
|
-
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`,
|
|
2359
|
-
}
|
|
2360
|
-
: moved
|
|
2361
|
-
? {
|
|
2362
|
-
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`,
|
|
2363
|
-
}
|
|
2364
|
-
: {}),
|
|
2365
|
-
});
|
|
2366
|
-
return o.on;
|
|
2367
|
-
});
|
|
2368
|
-
put(names.on, f.id, on);
|
|
2369
|
-
|
|
2370
|
-
// A pale fill in light can disappear into the page: say so, and keep
|
|
2371
|
-
// the exact color, the dial's or the token's.
|
|
2372
|
-
if (modes.includes('light') && has(names.fill)) {
|
|
2373
|
-
const used = exactFill.light ?? /** @type {StopRef} */ (fill.light).color;
|
|
2374
|
-
const p = t.page(solid(used, 'light', f.id), 'light', f.id);
|
|
2375
|
-
if (p < NON_TEXT)
|
|
2376
|
-
checks.push({
|
|
2377
|
-
token: names.fill,
|
|
2378
|
-
mode: 'light',
|
|
2379
|
-
stop: S,
|
|
2380
|
-
preferred: S,
|
|
2381
|
-
against: 'the light page',
|
|
2382
|
-
ratio: round(p),
|
|
2383
|
-
needs: NON_TEXT,
|
|
2384
|
-
pass: false,
|
|
2385
|
-
note: exactFill.light
|
|
2386
|
-
? `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`
|
|
2387
|
-
: `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}`,
|
|
2388
|
-
});
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
// The tint: the official stop, never the fill's own shade, see-through
|
|
2392
|
-
// or not. Secondary text on the parts that sit on the accent tint is
|
|
2393
|
-
// lifted instead, as the official neutral theme lifts it (`lift`).
|
|
2394
|
-
const muted = each(m => {
|
|
2395
|
-
const i = side(m);
|
|
2396
|
-
const spec = word ? STATUS_MUTED[i] : ACCENT_MUTED[i];
|
|
2397
|
-
const [s, alpha] = Array.isArray(spec) ? spec : [spec, undefined];
|
|
2398
|
-
// Nearest the official stop first, both ways; on a tie (a layout
|
|
2399
|
-
// without that stop) lighter first in light, darker in dark.
|
|
2400
|
-
const usual = i === 0 ? 1 : -1;
|
|
2401
|
-
const order = [...stops].sort(
|
|
2402
|
-
(a, b) =>
|
|
2403
|
-
Math.abs(a - s) - Math.abs(b - s) ||
|
|
2404
|
-
(Math.sign(b - a) === usual ? 1 : -1),
|
|
2405
|
-
);
|
|
2406
|
-
const away = order.filter(x => x !== fill[m]?.stop);
|
|
2407
|
-
return ref(f.id, m, away[0] ?? order[0], alpha);
|
|
2408
|
-
});
|
|
2409
|
-
put(names.muted, f.id, muted);
|
|
2410
|
-
/** The tint the theme really shows: an exact setting wins. @param {Mode} m */
|
|
2411
|
-
const mutedSeen = m => {
|
|
2412
|
-
const own = rawOf(names.muted, m);
|
|
2413
|
-
return own
|
|
2414
|
-
? surfaces(m, f.id).map(
|
|
2415
|
-
([n, bg]) =>
|
|
2416
|
-
/** @type {[string, string]} */ ([
|
|
2417
|
-
`your exact ${names.muted} over ${n}`,
|
|
2418
|
-
hex(
|
|
2419
|
-
compositeOver(
|
|
2420
|
-
/** @type {[number, number, number]} */ (parseColor(own)),
|
|
2421
|
-
alphaOf(own),
|
|
2422
|
-
/** @type {[number, number, number]} */ (parseColor(bg)),
|
|
2423
|
-
),
|
|
2424
|
-
),
|
|
2425
|
-
]),
|
|
2426
|
-
)
|
|
2427
|
-
: over(
|
|
2428
|
-
names.muted,
|
|
2429
|
-
/** @type {StopRef} */ (muted[m]),
|
|
2430
|
-
surfaces(m, f.id),
|
|
2431
|
-
);
|
|
2432
|
-
};
|
|
2433
|
-
|
|
2434
|
-
// Accent text and icons are the color you gave where it reads on what
|
|
2435
|
-
// they sit on (the surfaces and the tint), in each mode its fill is
|
|
2436
|
-
// your exact color; only where it does not do they move, to the
|
|
2437
|
-
// nearest shade that reads, and the result says so.
|
|
2438
|
-
const text = each(m => {
|
|
2439
|
-
const grounds = [...surfaces(m, f.id), ...mutedSeen(m)];
|
|
2440
|
-
const own = fill[m]?.exact ? ref(f.id, m, S) : null;
|
|
2441
|
-
if (own) {
|
|
2442
|
-
const r = Math.min(...grounds.map(([, bg]) => contrast(own.color, bg)));
|
|
2443
|
-
if (r >= TEXT) {
|
|
2444
|
-
if (reports(names.text))
|
|
2445
|
-
checks.push({
|
|
2446
|
-
token: names.text,
|
|
2447
|
-
mode: m,
|
|
2448
|
-
stop: S,
|
|
2449
|
-
preferred: S,
|
|
2450
|
-
against: grounds.map(([n]) => n).join(', '),
|
|
2451
|
-
ratio: round(r),
|
|
2452
|
-
needs: TEXT,
|
|
2453
|
-
pass: true,
|
|
2454
|
-
});
|
|
2455
|
-
return own;
|
|
2456
|
-
}
|
|
2457
|
-
const before = checks.length;
|
|
2458
|
-
const moved = pick(names.text, f.id, m, S, grounds, TEXT);
|
|
2459
|
-
const last = checks.length > before ? checks[checks.length - 1] : null;
|
|
2460
|
-
if (last && moved.stop !== S)
|
|
2461
|
-
last.note = `${names.text} ${m}: your exact color (${own.color}) reads at only ${grounds
|
|
2462
|
-
.map(([n, bg]) => [n, contrast(own.color, bg)])
|
|
2463
|
-
.filter(([, x]) => Number(x) < TEXT)
|
|
2464
|
-
.map(([n, x]) => `${round(Number(x))}:1 on ${n}`)
|
|
2465
|
-
.join(
|
|
2466
|
-
', ',
|
|
2467
|
-
)} (text needs ${TEXT}:1), so links and accent text 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`;
|
|
2468
|
-
return moved;
|
|
2469
|
-
}
|
|
2470
|
-
return pick(names.text, f.id, m, at(TEXT_STOP[side(m)]), grounds, TEXT);
|
|
2471
|
-
});
|
|
2472
|
-
put(names.text, f.id, text);
|
|
2473
|
-
put(names.icon, f.id, text);
|
|
2474
|
-
if (names.onMuted) {
|
|
2475
|
-
const onMuted = /** @type {string} */ (names.onMuted);
|
|
2476
|
-
put(
|
|
2477
|
-
onMuted,
|
|
2478
|
-
f.id,
|
|
2479
|
-
each(m =>
|
|
2480
|
-
pick(onMuted, f.id, m, at(ON_MUTED[side(m)]), mutedSeen(m), TEXT),
|
|
2481
|
-
),
|
|
2482
|
-
);
|
|
2483
|
-
}
|
|
2484
|
-
if (names.border)
|
|
2485
|
-
put(
|
|
2486
|
-
names.border,
|
|
2487
|
-
f.id,
|
|
2488
|
-
each(m => ref(f.id, m, at(BORDER[side(m)]))),
|
|
2489
|
-
);
|
|
2490
|
-
// The focus ring follows the fill; with an exact fill it keeps
|
|
2491
|
-
// following that (Core's ring reads --color-accent).
|
|
2492
|
-
if (names.focus && !Object.keys(exactFill).length) {
|
|
2493
|
-
const focus = /** @type {string} */ (names.focus);
|
|
2494
|
-
put(
|
|
2495
|
-
focus,
|
|
2496
|
-
f.id,
|
|
2497
|
-
each(m =>
|
|
2498
|
-
pick(
|
|
2499
|
-
focus,
|
|
2500
|
-
f.id,
|
|
2501
|
-
m,
|
|
2502
|
-
/** @type {StopRef} */ (fill[m]).stop,
|
|
2503
|
-
surfaces(m, f.id),
|
|
2504
|
-
NON_TEXT,
|
|
2505
|
-
),
|
|
2506
|
-
),
|
|
2507
|
-
);
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
// Secondary text on the parts the official neutral theme lifts it on
|
|
2512
|
-
// (LIFT_PARTS), lifted the same way, for every accent: for each
|
|
2513
|
-
// background (the accent tint, the neutral track), the gray shade
|
|
2514
|
-
// nearest the secondary text's own that reads at 4.5:1 on it and on it
|
|
2515
|
-
// under a hover, over every surface. The grays are the neutral color's,
|
|
2516
|
-
// else a gray ramp the generator grows from the base theme's own
|
|
2517
|
-
// secondary text (written as colors, not shades of the palette). The
|
|
2518
|
-
// tint stays at its official stop. A mode where the theme sets
|
|
2519
|
-
// secondary text exactly takes that value instead, as written.
|
|
2520
|
-
/** @type {Record<string, Partial<Record<Mode, StopRef>>> | null} */
|
|
2521
|
-
let lift = null;
|
|
2522
|
-
{
|
|
2523
|
-
/** @param {Mode} m @param {string} token */
|
|
2524
|
-
const valueOf = (m, token) => {
|
|
2525
|
-
const v =
|
|
2526
|
-
rawOf(token, m) ?? tokens[token]?.[m].color ?? base?.[m]?.[token];
|
|
2527
|
-
return v && parseColor(v) ? v : null;
|
|
2528
|
-
};
|
|
2529
|
-
/** The secondary text a mode starts from. @param {Mode} m */
|
|
2530
|
-
const startText = m => {
|
|
2531
|
-
const v =
|
|
2532
|
-
tokens['--color-text-secondary']?.[m].color ??
|
|
2533
|
-
base?.[m]?.['--color-text-secondary'];
|
|
2534
|
-
return v && parseColor(v)
|
|
2535
|
-
? hex(/** @type {number[]} */ (parseColor(v)))
|
|
2536
|
-
: null;
|
|
2537
|
-
};
|
|
2538
|
-
/**
|
|
2539
|
-
* The gray ramp of a mode, and whether its shades are the palette's
|
|
2540
|
-
* neutral ones (else plain colors).
|
|
2541
|
-
* @param {Mode} m
|
|
2542
|
-
* @returns {{ramp: Record<string, string>, palette: boolean} | null}
|
|
2543
|
-
*/
|
|
2544
|
-
const grays = m => {
|
|
2545
|
-
if (neutral)
|
|
2546
|
-
return {
|
|
2547
|
-
ramp: /** @type {any} */ (candidate.palette.neutral)[m],
|
|
2548
|
-
palette: true,
|
|
2549
|
-
};
|
|
2550
|
-
const seed = startText(m);
|
|
2551
|
-
const ramp = seed ? grownGrays(seed, m) : null;
|
|
2552
|
-
return ramp ? {ramp, palette: false} : null;
|
|
2553
|
-
};
|
|
2554
|
-
/**
|
|
2555
|
-
* A color drawn over each of `under`, as the eye sees it.
|
|
2556
|
-
* @param {string} name @param {string} color @param {Array<[string, string]>} under
|
|
2557
|
-
* @returns {Array<[string, string]>}
|
|
2558
|
-
*/
|
|
2559
|
-
const drawn = (name, color, under) => {
|
|
2560
|
-
const top = /** @type {[number, number, number]} */ (parseColor(color));
|
|
2561
|
-
const a = alphaOf(color);
|
|
2562
|
-
return under.map(([n, c]) => [
|
|
2563
|
-
`${name} over ${n}`,
|
|
2564
|
-
hex(
|
|
2565
|
-
compositeOver(
|
|
2566
|
-
top,
|
|
2567
|
-
a,
|
|
2568
|
-
/** @type {[number, number, number]} */ (parseColor(c)),
|
|
2569
|
-
),
|
|
2570
|
-
),
|
|
2571
|
-
]);
|
|
2572
|
-
};
|
|
2573
|
-
/** @type {Record<string, Partial<Record<Mode, StopRef>>>} */
|
|
2574
|
-
const found = {};
|
|
2575
|
-
for (const ground of new Set(LIFT_PARTS.map(([, , g]) => g))) {
|
|
2576
|
-
const {what, parts} = LIFT_GROUNDS[ground];
|
|
2577
|
-
/**
|
|
2578
|
-
* The shade the base theme itself lifts this ground's text to in a
|
|
2579
|
-
* mode, when it gives one: the search starts there, so a change of
|
|
2580
|
-
* color moves it only when that shade no longer reads.
|
|
2581
|
-
* @param {Mode} m
|
|
2582
|
-
* @returns {string | null}
|
|
2583
|
-
*/
|
|
2584
|
-
const baseLift = m => {
|
|
2585
|
-
for (const [part, block, g] of LIFT_PARTS) {
|
|
2586
|
-
if (g !== ground) continue;
|
|
2587
|
-
const v = /** @type {any} */ (base)?.components?.[part]?.[block]?.[
|
|
2588
|
-
'--color-text-secondary'
|
|
2589
|
-
];
|
|
2590
|
-
const pair = Array.isArray(v)
|
|
2591
|
-
? v
|
|
2592
|
-
: typeof v === 'string'
|
|
2593
|
-
? /^light-dark\((.*)\)$/s.exec(v.trim())?.[1]
|
|
2594
|
-
? splitTop(
|
|
2595
|
-
/** @type {string} */ (
|
|
2596
|
-
/^light-dark\((.*)\)$/s.exec(v.trim())?.[1]
|
|
2597
|
-
),
|
|
2598
|
-
',',
|
|
2599
|
-
)
|
|
2600
|
-
: [v, v]
|
|
2601
|
-
: null;
|
|
2602
|
-
const c = pair?.[m === 'light' ? 0 : 1]?.trim();
|
|
2603
|
-
if (c && parseColor(c))
|
|
2604
|
-
return hex(/** @type {number[]} */ (parseColor(c)));
|
|
2605
|
-
}
|
|
2606
|
-
return null;
|
|
2607
|
-
};
|
|
2608
|
-
/** @type {Partial<Record<Mode, StopRef>>} */
|
|
2609
|
-
const byMode = {};
|
|
2610
|
-
for (const m of modes) {
|
|
2611
|
-
const own = rawOf('--color-text-secondary', m);
|
|
2612
|
-
if (own) {
|
|
2613
|
-
byMode[m] = {stop: 0, color: own, family: 'literal'};
|
|
2614
|
-
continue;
|
|
2615
|
-
}
|
|
2616
|
-
const fillColor = valueOf(m, ground);
|
|
2617
|
-
const g = grays(m);
|
|
2618
|
-
const text = startText(m);
|
|
2619
|
-
if (!fillColor || !g || !text) break;
|
|
2620
|
-
const seen = drawn(what, fillColor, surfaces(m, 'neutral'));
|
|
2621
|
-
const hover = valueOf(m, '--color-overlay-hover');
|
|
2622
|
-
const on = [
|
|
2623
|
-
...seen,
|
|
2624
|
-
...(hover && alphaOf(hover) > 0
|
|
2625
|
-
? drawn('a hover', hover, seen).map(
|
|
2626
|
-
([n, c]) =>
|
|
2627
|
-
/** @type {[string, string]} */ ([
|
|
2628
|
-
n.replace(/^a hover over (.*)$/, '$1 under a hover'),
|
|
2629
|
-
c,
|
|
2630
|
-
]),
|
|
2631
|
-
)
|
|
2632
|
-
: []),
|
|
2633
|
-
];
|
|
2634
|
-
const keys = Object.keys(g.ramp)
|
|
2635
|
-
.map(Number)
|
|
2636
|
-
.sort((a, b) => a - b);
|
|
2637
|
-
const from = baseLift(m) ?? text;
|
|
2638
|
-
const start = keys.reduce((x, y) =>
|
|
2639
|
-
perceptualDelta(g.ramp[y], from) < perceptualDelta(g.ramp[x], from)
|
|
2640
|
-
? y
|
|
2641
|
-
: x,
|
|
2642
|
-
);
|
|
2643
|
-
const scored = keys
|
|
2644
|
-
.sort(
|
|
2645
|
-
(a, b) =>
|
|
2646
|
-
Math.abs(a - start) - Math.abs(b - start) ||
|
|
2647
|
-
(Math.sign(b - a) === TOWARD_CONTRAST[m] ? 1 : -1),
|
|
2648
|
-
)
|
|
2649
|
-
.map(stop => ({
|
|
2650
|
-
stop,
|
|
2651
|
-
r: Math.min(...on.map(([, bg]) => contrast(g.ramp[stop], bg))),
|
|
2652
|
-
}));
|
|
2653
|
-
const b =
|
|
2654
|
-
scored.find(x => x.r >= TEXT) ??
|
|
2655
|
-
scored.reduce((x, y) => (y.r > x.r ? y : x));
|
|
2656
|
-
byMode[m] = g.palette
|
|
2657
|
-
? ref('neutral', m, b.stop)
|
|
2658
|
-
: {stop: b.stop, color: g.ramp[b.stop], family: 'literal'};
|
|
2659
|
-
const moved =
|
|
2660
|
-
hex(/** @type {number[]} */ (parseColor(g.ramp[b.stop]))) !== from;
|
|
2661
|
-
if (b.r < TEXT || moved)
|
|
2662
|
-
checks.push({
|
|
2663
|
-
token: '--color-text-secondary',
|
|
2664
|
-
mode: m,
|
|
2665
|
-
stop: b.stop,
|
|
2666
|
-
preferred: start,
|
|
2667
|
-
against: `${what} over the surfaces`,
|
|
2668
|
-
ratio: round(b.r),
|
|
2669
|
-
needs: TEXT,
|
|
2670
|
-
pass: b.r >= TEXT,
|
|
2671
|
-
dials: ['accent', 'neutral'],
|
|
2672
|
-
note:
|
|
2673
|
-
b.r >= TEXT
|
|
2674
|
-
? `--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`
|
|
2675
|
-
: `--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`,
|
|
2676
|
-
});
|
|
2677
|
-
}
|
|
2678
|
-
if (modes.every(m => byMode[m])) found[ground] = byMode;
|
|
2679
|
-
}
|
|
2680
|
-
if (Object.keys(found).length) lift = found;
|
|
2681
|
-
}
|
|
2682
|
-
|
|
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
|
+
);
|
|
2683
1655
|
return {
|
|
2684
1656
|
candidate,
|
|
2685
1657
|
families: fams,
|
|
2686
|
-
|
|
2687
|
-
contrast: checks.filter(c => c.note !== ''),
|
|
2688
|
-
lift,
|
|
1658
|
+
...mapping,
|
|
2689
1659
|
vibrancy: config.vibrancy ?? VIBRANCY_DEFAULT,
|
|
2690
|
-
exact,
|
|
2691
|
-
unread,
|
|
2692
1660
|
notes: [
|
|
2693
1661
|
...plan.notes,
|
|
2694
1662
|
...(paletteEdited(cwd, slug)
|
|
@@ -2746,16 +1714,25 @@ export function mappingRows(dial) {
|
|
|
2746
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)',
|
|
2747
1715
|
...Object.entries(NEUTRAL_STOPS).map(
|
|
2748
1716
|
([t, [l, d]]) =>
|
|
2749
|
-
`${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)' : ''}`,
|
|
2750
1718
|
),
|
|
2751
1719
|
...Object.entries(NEUTRAL_TINTS).map(
|
|
2752
1720
|
([t, [[l, la], [d, da]]]) =>
|
|
2753
1721
|
`${t}: light shade ${l} at opacity ${la}, dark shade ${d} at opacity ${da}`,
|
|
2754
1722
|
),
|
|
2755
|
-
...Object.
|
|
2756
|
-
g =>
|
|
2757
|
-
|
|
2758
|
-
|
|
1723
|
+
...Object.entries(LIFT_GROUNDS)
|
|
1724
|
+
.filter(([g]) => !g.startsWith('--color-background-'))
|
|
1725
|
+
.map(
|
|
1726
|
+
([, g]) =>
|
|
1727
|
+
`--color-text-secondary on ${g.parts}: the shade nearest the secondary text's that reads at ${TEXT}:1 on ${g.what} and under a hover, as the official theme lifts it`,
|
|
1728
|
+
),
|
|
1729
|
+
...(Object.keys(LIFT_GROUNDS).some(g =>
|
|
1730
|
+
g.startsWith('--color-background-'),
|
|
1731
|
+
)
|
|
1732
|
+
? [
|
|
1733
|
+
`--color-text-secondary on coloured cards: the shade nearest the secondary text's that reads at ${TEXT}:1 on each card's fill, as the official theme lifts it`,
|
|
1734
|
+
]
|
|
1735
|
+
: []),
|
|
2759
1736
|
];
|
|
2760
1737
|
const word = dial === 'accent' ? null : STATUS_TOKEN[dial];
|
|
2761
1738
|
if (dial !== 'accent' && !word) return [];
|
|
@@ -2840,7 +1817,11 @@ export function paletteFailures(pal, dial, modes = ['light', 'dark']) {
|
|
|
2840
1817
|
if (!pal) return [];
|
|
2841
1818
|
return dialChecks(pal, dial, modes)
|
|
2842
1819
|
.filter(c => !c.pass)
|
|
2843
|
-
.map(c => ({
|
|
1820
|
+
.map(c => ({
|
|
1821
|
+
key: paletteCheckKey(c),
|
|
1822
|
+
text: checkNote(c, dial),
|
|
1823
|
+
...(c.fix ? {fix: c.fix} : {}),
|
|
1824
|
+
}));
|
|
2844
1825
|
}
|
|
2845
1826
|
|
|
2846
1827
|
/**
|
|
@@ -2901,7 +1882,9 @@ export function paletteNotes(pal, dial, slug, modes = ['light', 'dark']) {
|
|
|
2901
1882
|
const given = pal.families.find(x => x.dial === dial);
|
|
2902
1883
|
if (given && isClipped(given.value))
|
|
2903
1884
|
notes.push(
|
|
2904
|
-
|
|
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`,
|
|
2905
1888
|
);
|
|
2906
1889
|
for (const c of dialChecks(pal, dial, modes)) {
|
|
2907
1890
|
if (c.note || !c.pass) notes.push(checkNote(c, dial));
|