@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
|
@@ -31,6 +31,7 @@ import {AstryxError} from '../error.mjs';
|
|
|
31
31
|
import {logger} from '../logger.mjs';
|
|
32
32
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
33
33
|
import {cssUnescape} from '../../foundation/text/css-escape.mjs';
|
|
34
|
+
import {TS_SOURCES} from '../../foundation/render/ts-paths.mjs';
|
|
34
35
|
import {levenshteinDistance} from '../../foundation/text/levenshtein.mjs';
|
|
35
36
|
import {coreVarValues} from './_parts.mjs';
|
|
36
37
|
import {
|
|
@@ -55,6 +56,7 @@ import {
|
|
|
55
56
|
customPropertyValues,
|
|
56
57
|
declarationValues,
|
|
57
58
|
elementCustomProperties,
|
|
59
|
+
fontKey,
|
|
58
60
|
fontRules,
|
|
59
61
|
} from '../../foundation/fonts/font-stylesheet.mjs';
|
|
60
62
|
import {
|
|
@@ -73,12 +75,15 @@ import {
|
|
|
73
75
|
SPACING,
|
|
74
76
|
SURFACES,
|
|
75
77
|
SURFACE_PARTS,
|
|
78
|
+
FLOATING_PANELS,
|
|
79
|
+
FLOATING_SURFACES,
|
|
76
80
|
TEXT_SIZE,
|
|
77
81
|
TYPE_STYLES,
|
|
78
82
|
familyOf,
|
|
79
83
|
WRAPPED_PARTS,
|
|
80
84
|
CARD_LIKE,
|
|
81
85
|
SHOWCASE_GROUPS,
|
|
86
|
+
onlyMeans,
|
|
82
87
|
} from './_tables.mjs';
|
|
83
88
|
import {TOP_BAR_COMPONENTS} from './_catalog.mjs';
|
|
84
89
|
import {
|
|
@@ -100,6 +105,7 @@ import {
|
|
|
100
105
|
isColorValue,
|
|
101
106
|
isSafeValue,
|
|
102
107
|
parseColor,
|
|
108
|
+
oklabDistance,
|
|
103
109
|
ratio,
|
|
104
110
|
splitTop,
|
|
105
111
|
} from './_color.mjs';
|
|
@@ -115,14 +121,15 @@ import {
|
|
|
115
121
|
syncPaletteRefs,
|
|
116
122
|
refuseIfLockLost,
|
|
117
123
|
lockHeld,
|
|
118
|
-
removeEmptyFolder,
|
|
119
124
|
writeWhole,
|
|
120
125
|
setOwnTokenReader,
|
|
121
126
|
readRecordIn,
|
|
122
127
|
readRegularFile,
|
|
123
128
|
readWrittenRecord,
|
|
124
129
|
writeWrittenRecord,
|
|
130
|
+
familyRamp,
|
|
125
131
|
} from './_palette.mjs';
|
|
132
|
+
import {removeEmptyFolder} from '../../foundation/fs/empty-folder.mjs';
|
|
126
133
|
import {EDITOR_STAMP, pngTexts} from './_png.mjs';
|
|
127
134
|
import {MODAL, isColorToken} from './_compiler.mjs';
|
|
128
135
|
import {
|
|
@@ -168,7 +175,7 @@ setOwnTokenReader((cwd, slug) => ownSourceTokenValues(cwd, slug));
|
|
|
168
175
|
/** What lifted secondary text sits on: the contrast check measures it there. */
|
|
169
176
|
const LIFT_GROUND_TOKENS = new Set(LIFT_PARTS.map(([, , g]) => g));
|
|
170
177
|
|
|
171
|
-
/** @typedef {{project: import('./_project.mjs').ThemeProject, C: import('./_compiler.mjs').Compiler, unchecked?: string | null, uncheckedCode?: string | null, wrote?: Map<string, string | null>, base?: {light: Record<string, string>, dark: Record<string, string>, components?: Record<string, any>}, keepStops?: Record<string, Record<'light' | 'dark', {family: string, stop: number, alpha?: string}>> | null, keepRadii?: Record<string, string> | null, sizeNotes?: string[], compileNotes?: string[], derived?: Record<string, Array<{property: string, vars?: string[], replaces?: boolean, expand?: string}>>, takesPictures?: {sheet: string | null} | null}} Ctx */
|
|
178
|
+
/** @typedef {{project: import('./_project.mjs').ThemeProject, C: import('./_compiler.mjs').Compiler, unchecked?: string | null, uncheckedCode?: string | null, wrote?: Map<string, string | null>, base?: {light: Record<string, string>, dark: Record<string, string>, components?: Record<string, any>}, keepStops?: Record<string, Record<'light' | 'dark', {family: string, stop: number, alpha?: string}>> | null, keepRadii?: Record<string, string> | null, sizeNotes?: string[], compileNotes?: string[], derived?: Record<string, Array<{property: string, vars?: string[], replaces?: boolean, expand?: string, corners?: boolean}>>, takesPictures?: {sheet: string | null} | null}} Ctx */
|
|
172
179
|
/** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
|
|
173
180
|
/** @typedef {import('./_parts.mjs').TextPair} TextPair */
|
|
174
181
|
|
|
@@ -319,7 +326,7 @@ export function dialTakesText(dial) {
|
|
|
319
326
|
export function dialValueFits(dial, value) {
|
|
320
327
|
const spec = DIALS[/** @type {keyof typeof DIALS} */ (dial)]?.values;
|
|
321
328
|
if (!spec) return false;
|
|
322
|
-
const v = String(value).trim();
|
|
329
|
+
const v = dialNumber(dial, String(value).trim());
|
|
323
330
|
if (v === '') return false;
|
|
324
331
|
return spec.split('|').some(option => {
|
|
325
332
|
if (!option.startsWith('<') && !option.startsWith('"'))
|
|
@@ -335,6 +342,24 @@ export function dialValueFits(dial, value) {
|
|
|
335
342
|
});
|
|
336
343
|
}
|
|
337
344
|
|
|
345
|
+
/**
|
|
346
|
+
* A dial's number as the dial takes it: for a dial whose number is in a
|
|
347
|
+
* unit (text-size's pixels), the number typed with that unit, in any case
|
|
348
|
+
* and with a space before it (`24px`, `24 PX`), is that number; any other
|
|
349
|
+
* value is returned as it is. The one reader for typed and saved values.
|
|
350
|
+
* @param {string} dial
|
|
351
|
+
* @param {string} value
|
|
352
|
+
* @returns {string}
|
|
353
|
+
*/
|
|
354
|
+
export function dialNumber(dial, value) {
|
|
355
|
+
const unit = DIALS[/** @type {keyof typeof DIALS} */ (dial)]?.unit;
|
|
356
|
+
if (!unit) return value;
|
|
357
|
+
const m = new RegExp(`^\\s*([+]?\\d*\\.?\\d+)\\s*${unit}\\s*$`, 'i').exec(
|
|
358
|
+
String(value),
|
|
359
|
+
);
|
|
360
|
+
return m ? m[1].replace(/^\+/, '') : value;
|
|
361
|
+
}
|
|
362
|
+
|
|
338
363
|
/** @param {string} file @returns {string | null} */
|
|
339
364
|
const contentHash = file => {
|
|
340
365
|
try {
|
|
@@ -1670,7 +1695,7 @@ export function settingsProblem(
|
|
|
1670
1695
|
if (s.only != null && s.only !== true)
|
|
1671
1696
|
return `${s.thing} has only ${JSON.stringify(s.only)}, not true or false`;
|
|
1672
1697
|
if (s.only === true && !onlyFits(s))
|
|
1673
|
-
return `${describe({...s, only: undefined, value: '?'}).replace(' = ?', '')} has only, which is for one member of a group
|
|
1698
|
+
return `${describe({...s, only: undefined, value: '?'}).replace(' = ?', '')} has only, which is for one member of a group (${s.on ? `not the ${s.on} group itself` : 'it names no part'})`;
|
|
1674
1699
|
const key = keyOf(s);
|
|
1675
1700
|
// The command that changes or removes a setting listed twice keeps one
|
|
1676
1701
|
// value, or none, so it fixes the list. An entry with a twin is named
|
|
@@ -2232,12 +2257,19 @@ function readEntryWords(data, early = /** @type {string[]} */ ([])) {
|
|
|
2232
2257
|
['dial', undefined, null, ''].includes(s.source) ||
|
|
2233
2258
|
String(s.source).toLowerCase() === 'dial'
|
|
2234
2259
|
) {
|
|
2235
|
-
// A corners size saved in rem is the px set saves it as
|
|
2260
|
+
// A corners size saved in rem is the px set saves it as; a dial's
|
|
2261
|
+
// number saved with its unit (text-size `20px`) is that number.
|
|
2262
|
+
const number =
|
|
2263
|
+
typeof s.value === 'string' ? dialNumber(s.thing, s.value) : null;
|
|
2236
2264
|
const word =
|
|
2237
2265
|
typeof s.value !== 'string'
|
|
2238
2266
|
? null
|
|
2239
2267
|
: (dialWordOf(s.thing, s.value) ??
|
|
2240
|
-
(s.thing === 'corners'
|
|
2268
|
+
(s.thing === 'corners'
|
|
2269
|
+
? cornersPlain(s.value)
|
|
2270
|
+
: number !== s.value
|
|
2271
|
+
? number
|
|
2272
|
+
: null));
|
|
2241
2273
|
if (word && word !== s.value) {
|
|
2242
2274
|
notes.push(
|
|
2243
2275
|
`${s.thing} was saved as ${JSON.stringify(s.value)}, read as ${word}`,
|
|
@@ -2302,9 +2334,60 @@ function readEntryWords(data, early = /** @type {string[]} */ ([])) {
|
|
|
2302
2334
|
}
|
|
2303
2335
|
}
|
|
2304
2336
|
}
|
|
2337
|
+
readMeaninglessOnly(data, notes);
|
|
2305
2338
|
ENTRY_NOTES.set(data, notes);
|
|
2306
2339
|
}
|
|
2307
2340
|
|
|
2341
|
+
/**
|
|
2342
|
+
* An `only` that means nothing where it is saved (on a part styled on its
|
|
2343
|
+
* own, onlyMeans: an editor that took --only there saved it) is read as
|
|
2344
|
+
* without it, which is how the build applies it, and said once. Read so, an entry can fall on the place of another
|
|
2345
|
+
* (a plain one beside it): the later one is the one the build shows, so it
|
|
2346
|
+
* is kept, and the earlier one is named.
|
|
2347
|
+
* @param {any} data
|
|
2348
|
+
* @param {string[]} notes
|
|
2349
|
+
*/
|
|
2350
|
+
function readMeaninglessOnly(data, notes) {
|
|
2351
|
+
if (!Array.isArray(data?.settings)) return;
|
|
2352
|
+
/** @type {Set<any>} */
|
|
2353
|
+
const read = new Set();
|
|
2354
|
+
for (const s of data.settings) {
|
|
2355
|
+
if (
|
|
2356
|
+
!s ||
|
|
2357
|
+
typeof s.thing !== 'string' ||
|
|
2358
|
+
s.only !== true ||
|
|
2359
|
+
typeof s.on !== 'string' ||
|
|
2360
|
+
onlyMeans(s.on) !== 'own'
|
|
2361
|
+
)
|
|
2362
|
+
continue;
|
|
2363
|
+
delete s.only;
|
|
2364
|
+
read.add(s);
|
|
2365
|
+
notes.push(
|
|
2366
|
+
`${describe({...s, value: '?'}).replace(' = ?', '')} was saved with only, which changes nothing there (${s.on} is styled on its own already; only ${AUTO_SPREAD.join(' and ')} spread to their group), so it is read as without it; the next change saves it so`,
|
|
2367
|
+
);
|
|
2368
|
+
}
|
|
2369
|
+
if (!read.size) return;
|
|
2370
|
+
/** @type {Map<string, any>} */
|
|
2371
|
+
const last = new Map();
|
|
2372
|
+
for (const s of data.settings)
|
|
2373
|
+
if (s && typeof s.thing === 'string') last.set(keyOf(s), s);
|
|
2374
|
+
const dropped = data.settings.filter(
|
|
2375
|
+
(/** @type {any} */ s) =>
|
|
2376
|
+
s &&
|
|
2377
|
+
typeof s.thing === 'string' &&
|
|
2378
|
+
last.get(keyOf(s)) !== s &&
|
|
2379
|
+
(read.has(s) || read.has(last.get(keyOf(s)))),
|
|
2380
|
+
);
|
|
2381
|
+
if (!dropped.length) return;
|
|
2382
|
+
data.settings = data.settings.filter(
|
|
2383
|
+
(/** @type {any} */ s) => !dropped.includes(s),
|
|
2384
|
+
);
|
|
2385
|
+
for (const s of dropped)
|
|
2386
|
+
notes.push(
|
|
2387
|
+
`${describe(s)} sits where a later entry of the same setting does, read without only, and that later one is the one that shows; the earlier one is left out`,
|
|
2388
|
+
);
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2308
2391
|
/** @type {WeakMap<object, string[]>} */
|
|
2309
2392
|
const ENTRY_NOTES = new WeakMap();
|
|
2310
2393
|
|
|
@@ -2346,15 +2429,13 @@ export function entryDamage(s) {
|
|
|
2346
2429
|
}
|
|
2347
2430
|
|
|
2348
2431
|
/**
|
|
2349
|
-
* Whether `only`
|
|
2350
|
-
*
|
|
2432
|
+
* Whether a saved `only` reads, as `set --only` reads it (onlyMeans): on a
|
|
2433
|
+
* part, a member of a group or not (on one styled on its own it changes
|
|
2434
|
+
* nothing, and the entry builds as without it); never on a group itself.
|
|
2351
2435
|
* @param {any} s
|
|
2352
2436
|
*/
|
|
2353
2437
|
function onlyFits(s) {
|
|
2354
|
-
|
|
2355
|
-
return Boolean(
|
|
2356
|
-
fam && !FAMILIES[s.on] && AUTO_SPREAD.includes(/** @type {string} */ (fam)),
|
|
2357
|
-
);
|
|
2438
|
+
return typeof s.on === 'string' && onlyMeans(s.on) !== 'group';
|
|
2358
2439
|
}
|
|
2359
2440
|
|
|
2360
2441
|
/**
|
|
@@ -3790,6 +3871,81 @@ function builtTopTokens(cwd, slug) {
|
|
|
3790
3871
|
return topTokensOf(themeFiles(cwd, slug).js);
|
|
3791
3872
|
}
|
|
3792
3873
|
|
|
3874
|
+
/**
|
|
3875
|
+
* The base rule block of a part that a census rule (its attributes,
|
|
3876
|
+
* `variant=neutral,size=md`) falls under, most specific first: `base`, or a
|
|
3877
|
+
* block keyed by conditions (`variant:neutral`) every one of which the rule
|
|
3878
|
+
* has. Null when the base sets none.
|
|
3879
|
+
* @param {Record<string, any> | undefined} blocks the base's blocks for the part
|
|
3880
|
+
* @param {string} rule
|
|
3881
|
+
* @returns {{key: string, block: Record<string, any>}[]}
|
|
3882
|
+
*/
|
|
3883
|
+
export function baseBlocksFor(blocks, rule) {
|
|
3884
|
+
const attrs = rule.split(',').filter(Boolean);
|
|
3885
|
+
return Object.entries(blocks ?? {})
|
|
3886
|
+
.filter(([k, b]) => {
|
|
3887
|
+
if (!b || typeof b !== 'object') return false;
|
|
3888
|
+
if (k === 'base') return true;
|
|
3889
|
+
const pairs = k.split(',');
|
|
3890
|
+
return pairs.every(
|
|
3891
|
+
pr =>
|
|
3892
|
+
/^[a-z]+:[\w-]+$/.test(pr) && attrs.includes(pr.replace(':', '=')),
|
|
3893
|
+
);
|
|
3894
|
+
})
|
|
3895
|
+
.sort(([a], [b]) =>
|
|
3896
|
+
a === 'base'
|
|
3897
|
+
? 1
|
|
3898
|
+
: b === 'base'
|
|
3899
|
+
? -1
|
|
3900
|
+
: b.split(',').length - a.split(',').length,
|
|
3901
|
+
)
|
|
3902
|
+
.map(([key, block]) => ({key, block}));
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
/**
|
|
3906
|
+
* Where a base theme draws a property a token feeds in Core with something
|
|
3907
|
+
* else: each part and condition at rest under which Core reads the token for
|
|
3908
|
+
* a property but the base theme's own rule for the part sets that property
|
|
3909
|
+
* to another value (neutral's neutral badge fills with
|
|
3910
|
+
* --color-background-gray, not --color-neutral), with the base's value. The
|
|
3911
|
+
* token never reaches those.
|
|
3912
|
+
* @param {any} C the part data
|
|
3913
|
+
* @param {any} base the base theme, with its part blocks (`components`)
|
|
3914
|
+
* @param {string} token
|
|
3915
|
+
* @returns {Array<{part: string, when: string | null, prop: string, value: string}>}
|
|
3916
|
+
*/
|
|
3917
|
+
export function baseRedraws(C, base, token) {
|
|
3918
|
+
/** @type {Map<string, {part: string, when: string | null, prop: string, value: string}>} */
|
|
3919
|
+
const out = new Map();
|
|
3920
|
+
const blocks = base?.components ?? {};
|
|
3921
|
+
for (const [part, rec] of Object.entries(C?.MAP ?? {})) {
|
|
3922
|
+
if (!blocks[part]) continue;
|
|
3923
|
+
for (const [prop, at] of Object.entries(
|
|
3924
|
+
/** @type {Record<string, Record<string, unknown>>} */ (
|
|
3925
|
+
/** @type {any} */ (rec)?.at ?? {}
|
|
3926
|
+
),
|
|
3927
|
+
))
|
|
3928
|
+
for (const [k, v] of Object.entries(at)) {
|
|
3929
|
+
const [rule, cond = ''] = k.split(' ');
|
|
3930
|
+
if (cond || !String(v).includes(`var(${token})`)) continue;
|
|
3931
|
+
const camel = prop.replace(/-([a-z])/g, (_m, x) => x.toUpperCase());
|
|
3932
|
+
const hit = baseBlocksFor(blocks[part], rule).find(
|
|
3933
|
+
({block}) => typeof block[camel] === 'string',
|
|
3934
|
+
);
|
|
3935
|
+
if (!hit || String(hit.block[camel]).includes(`var(${token})`))
|
|
3936
|
+
continue;
|
|
3937
|
+
const when = hit.key === 'base' ? null : hit.key;
|
|
3938
|
+
out.set(`${part}|${when}|${prop}`, {
|
|
3939
|
+
part,
|
|
3940
|
+
when,
|
|
3941
|
+
prop,
|
|
3942
|
+
value: String(hit.block[camel]),
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3945
|
+
}
|
|
3946
|
+
return [...out.values()];
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3793
3949
|
/**
|
|
3794
3950
|
* The tokens a base theme's own component rules for a part read through
|
|
3795
3951
|
* var() (neutral's progress-bar reads --color-border-emphasized), from its
|
|
@@ -4264,7 +4420,7 @@ export function partsOf(ctx, s) {
|
|
|
4264
4420
|
: members;
|
|
4265
4421
|
if (FAMILIES[s.on]) return spread(FAMILIES[s.on].filter(has));
|
|
4266
4422
|
const fam = familyOf(s.on);
|
|
4267
|
-
if (fam &&
|
|
4423
|
+
if (fam && onlyMeans(s.on) === 'member' && !s.only)
|
|
4268
4424
|
return spread(FAMILIES[fam].filter(has).filter(m => drawnAlike(ctx, s, m)));
|
|
4269
4425
|
return [s.on];
|
|
4270
4426
|
}
|
|
@@ -4428,11 +4584,25 @@ export function fontOf(value) {
|
|
|
4428
4584
|
fallbacks:
|
|
4429
4585
|
parts.length > 1
|
|
4430
4586
|
? without(family, parts.slice(1))
|
|
4431
|
-
: without(family,
|
|
4587
|
+
: without(family, aloneFallbacks(family)),
|
|
4432
4588
|
pkg: pkgOf(family),
|
|
4433
4589
|
};
|
|
4434
4590
|
}
|
|
4435
4591
|
|
|
4592
|
+
/**
|
|
4593
|
+
* The fallbacks a family typed alone gets, by the kind its name says, as
|
|
4594
|
+
* the open fonts get theirs: a monospace name (Mono, Code) monospace ones,
|
|
4595
|
+
* a serif name (but no sans) serif ones, any other sans-serif ones.
|
|
4596
|
+
* @param {string} family
|
|
4597
|
+
* @returns {string[]}
|
|
4598
|
+
*/
|
|
4599
|
+
function aloneFallbacks(family) {
|
|
4600
|
+
if (/\b(mono|code)\b/i.test(family)) return ['ui-monospace', 'monospace'];
|
|
4601
|
+
if (/serif/i.test(family) && !/sans/i.test(family))
|
|
4602
|
+
return ['Georgia', 'serif'];
|
|
4603
|
+
return ['system-ui', 'sans-serif'];
|
|
4604
|
+
}
|
|
4605
|
+
|
|
4436
4606
|
/**
|
|
4437
4607
|
* Spacing in a font family name as CSS reads a bare name: every Unicode
|
|
4438
4608
|
* space (a no-break space, a thin space, a tab) is one space, a run of them
|
|
@@ -4892,6 +5062,180 @@ export function controlSizes(sizes, f, kept = {}, noRoom = []) {
|
|
|
4892
5062
|
.filter(([k]) => !(k in kept));
|
|
4893
5063
|
}
|
|
4894
5064
|
|
|
5065
|
+
/** The role each role-color dial sets, as Core's tokens and variants name it. */
|
|
5066
|
+
const ROLE_OF_DIAL = /** @type {const} */ ({
|
|
5067
|
+
accent: 'accent',
|
|
5068
|
+
success: 'success',
|
|
5069
|
+
warning: 'warning',
|
|
5070
|
+
danger: 'error',
|
|
5071
|
+
info: 'info',
|
|
5072
|
+
});
|
|
5073
|
+
|
|
5074
|
+
/**
|
|
5075
|
+
* Where a role color the theme sets (a role dial, or a whole-theme role
|
|
5076
|
+
* token) must be written onto a part for it to show, because the base theme
|
|
5077
|
+
* draws that role there on its own:
|
|
5078
|
+
* - a variant named for the role in a color of the base's palette written
|
|
5079
|
+
* out (butter's success badge) points at
|
|
5080
|
+
* the role's token, as Core draws that variant;
|
|
5081
|
+
* - a role token the base points at another token on a part (stone's
|
|
5082
|
+
* success banner at its green) takes the theme's own value there
|
|
5083
|
+
* (`value` null: the theme's token);
|
|
5084
|
+
* - a color the base gives a part as its own accent, written as the color
|
|
5085
|
+
* itself (butter's nav links and outline buttons in its blue), points at
|
|
5086
|
+
* the accent token.
|
|
5087
|
+
* Each comes once, and never where the theme sets that property on the
|
|
5088
|
+
* part itself. The compiler writes them; the missed list leaves them out.
|
|
5089
|
+
* @param {Ctx} ctx
|
|
5090
|
+
* @param {ThemeData} data
|
|
5091
|
+
* @param {any} base the base theme resolved: its tokens per mode and its components
|
|
5092
|
+
* @returns {Array<{part: string, when: string | undefined, prop: string, value: string | null}>}
|
|
5093
|
+
*/
|
|
5094
|
+
export function roleReach(ctx, data, base) {
|
|
5095
|
+
/** @type {Set<string>} */
|
|
5096
|
+
const roles = new Set();
|
|
5097
|
+
for (const x of data.settings) {
|
|
5098
|
+
if (x.on || x.state || x.when) continue;
|
|
5099
|
+
if (x.source === 'dial' && x.thing in ROLE_OF_DIAL)
|
|
5100
|
+
roles.add(
|
|
5101
|
+
ROLE_OF_DIAL[/** @type {keyof typeof ROLE_OF_DIAL} */ (x.thing)],
|
|
5102
|
+
);
|
|
5103
|
+
const token =
|
|
5104
|
+
x.source === 'token' &&
|
|
5105
|
+
/^--color-(?:on-|text-|icon-)?(accent|info|success|warning|error)(?:-[\w-]+)?$/.exec(
|
|
5106
|
+
x.thing,
|
|
5107
|
+
)?.[1];
|
|
5108
|
+
if (token) roles.add(token);
|
|
5109
|
+
}
|
|
5110
|
+
/** @type {Array<{part: string, when: string | undefined, prop: string, value: string | null}>} */
|
|
5111
|
+
const out = [];
|
|
5112
|
+
if (!roles.size) return out;
|
|
5113
|
+
const modes = modesOf(data);
|
|
5114
|
+
/** A literal color in a mode: its half of light-dark(). @param {string} v @param {string} m */
|
|
5115
|
+
const literal = (v, m) => {
|
|
5116
|
+
const pair = /^light-dark\((.*)\)$/is.exec(String(v).trim());
|
|
5117
|
+
const halves = pair ? splitTop(pair[1], ',') : null;
|
|
5118
|
+
const x = (
|
|
5119
|
+
halves?.length === 2 ? halves[m === 'light' ? 0 : 1] : String(v)
|
|
5120
|
+
).trim();
|
|
5121
|
+
return /^var\(/.test(x) ? null : parseColor(x);
|
|
5122
|
+
};
|
|
5123
|
+
const ACCENTS = [
|
|
5124
|
+
'--color-accent',
|
|
5125
|
+
'--color-text-accent',
|
|
5126
|
+
'--color-icon-accent',
|
|
5127
|
+
];
|
|
5128
|
+
for (const [part, looks] of Object.entries(
|
|
5129
|
+
/** @type {Record<string, Record<string, any>>} */ (base?.components ?? {}),
|
|
5130
|
+
)) {
|
|
5131
|
+
if (!ctx.project.target.has(part)) continue;
|
|
5132
|
+
for (const [key, look] of Object.entries(looks ?? {})) {
|
|
5133
|
+
if (key !== 'base' && !/^[\w-]+:[\w-]+$/.test(key)) continue;
|
|
5134
|
+
if (!look || typeof look !== 'object') continue;
|
|
5135
|
+
const when = key === 'base' ? undefined : key;
|
|
5136
|
+
/** @param {string} prop */
|
|
5137
|
+
const owns = prop =>
|
|
5138
|
+
data.settings.some(
|
|
5139
|
+
x =>
|
|
5140
|
+
x.on &&
|
|
5141
|
+
!x.state &&
|
|
5142
|
+
(x.when ?? undefined) === when &&
|
|
5143
|
+
partsOf(ctx, x).includes(part) &&
|
|
5144
|
+
(x.thing === prop ||
|
|
5145
|
+
x.thing === kebab(prop) ||
|
|
5146
|
+
(prop === 'borderColor' && x.thing === 'border')),
|
|
5147
|
+
);
|
|
5148
|
+
/** @param {string} prop @param {string | null} value */
|
|
5149
|
+
const add = (prop, value) => {
|
|
5150
|
+
if (
|
|
5151
|
+
owns(prop) ||
|
|
5152
|
+
out.some(o => o.part === part && o.when === when && o.prop === prop)
|
|
5153
|
+
)
|
|
5154
|
+
return;
|
|
5155
|
+
out.push({part, when, prop, value});
|
|
5156
|
+
};
|
|
5157
|
+
const named = /^variant:(accent|info|success|warning|error)$/.exec(
|
|
5158
|
+
String(when ?? ''),
|
|
5159
|
+
)?.[1];
|
|
5160
|
+
if (named && roles.has(named))
|
|
5161
|
+
for (const [prop, side] of /** @type {const} */ ([
|
|
5162
|
+
['backgroundColor', 'background'],
|
|
5163
|
+
['color', 'text'],
|
|
5164
|
+
])) {
|
|
5165
|
+
const v = look[prop];
|
|
5166
|
+
if (typeof v !== 'string') continue;
|
|
5167
|
+
// A token of another family (stone's info badge on the
|
|
5168
|
+
// categorical blue): the role token the base theme gives that same
|
|
5169
|
+
// color takes its place, so the look stays and follows the role.
|
|
5170
|
+
const ref = /^var\(\s*(--[\w-]+)\s*\)$/.exec(v.trim())?.[1];
|
|
5171
|
+
if (ref) {
|
|
5172
|
+
if (new RegExp(`-${named}(-|$)`).test(ref)) continue;
|
|
5173
|
+
const same = (/** @type {string} */ k) =>
|
|
5174
|
+
modes.filter(
|
|
5175
|
+
m =>
|
|
5176
|
+
base?.[m]?.[k] != null &&
|
|
5177
|
+
String(base[m][k]).toLowerCase() ===
|
|
5178
|
+
String(base?.[m]?.[ref] ?? '').toLowerCase(),
|
|
5179
|
+
).length;
|
|
5180
|
+
const pick = (
|
|
5181
|
+
side === 'text'
|
|
5182
|
+
? [
|
|
5183
|
+
`--color-on-${named}-muted`,
|
|
5184
|
+
`--color-text-${named}`,
|
|
5185
|
+
`--color-on-${named}`,
|
|
5186
|
+
]
|
|
5187
|
+
: [`--color-${named}-muted`, `--color-${named}`]
|
|
5188
|
+
)
|
|
5189
|
+
.map(k => ({k, n: same(k)}))
|
|
5190
|
+
.filter(x => x.n > 0)
|
|
5191
|
+
.sort((x, y) => y.n - x.n)[0]?.k;
|
|
5192
|
+
if (pick) {
|
|
5193
|
+
add(prop, `var(${pick})`);
|
|
5194
|
+
continue;
|
|
5195
|
+
}
|
|
5196
|
+
} else if (!modes.every(m => literal(v, m) != null)) continue;
|
|
5197
|
+
const core = (ctx.C.partReads(part, side) ?? []).find(
|
|
5198
|
+
(/** @type {any} */ r) => r.when.includes(`variant=${named}`),
|
|
5199
|
+
)?.token;
|
|
5200
|
+
add(
|
|
5201
|
+
prop,
|
|
5202
|
+
`var(${core ?? (side === 'text' ? `--color-text-${named}` : `--color-${named}`)})`,
|
|
5203
|
+
);
|
|
5204
|
+
}
|
|
5205
|
+
for (const [prop, v] of Object.entries(look)) {
|
|
5206
|
+
const role =
|
|
5207
|
+
/^--color-(?:on-)?(accent|info|success|warning|error)(?:-[\w-]+)?$/.exec(
|
|
5208
|
+
prop,
|
|
5209
|
+
)?.[1];
|
|
5210
|
+
if (!role || !roles.has(role) || typeof v !== 'string') continue;
|
|
5211
|
+
const to = /^var\(\s*(--[\w-]+)\s*\)$/.exec(v.trim())?.[1];
|
|
5212
|
+
if (to && to !== prop) add(prop, null);
|
|
5213
|
+
}
|
|
5214
|
+
if (roles.has('accent'))
|
|
5215
|
+
for (const [prop, token] of /** @type {const} */ ([
|
|
5216
|
+
['color', '--color-text-accent'],
|
|
5217
|
+
['backgroundColor', '--color-accent'],
|
|
5218
|
+
['borderColor', '--color-accent'],
|
|
5219
|
+
])) {
|
|
5220
|
+
const v = look[prop];
|
|
5221
|
+
if (typeof v !== 'string') continue;
|
|
5222
|
+
const isBaseAccent = modes.every(m => {
|
|
5223
|
+
const c = literal(v, m);
|
|
5224
|
+
return (
|
|
5225
|
+
c != null &&
|
|
5226
|
+
ACCENTS.some(a => {
|
|
5227
|
+
const b = parseColor(String(base?.[m]?.[a] ?? ''));
|
|
5228
|
+
return b != null && b.every((x, k) => x === c[k]);
|
|
5229
|
+
})
|
|
5230
|
+
);
|
|
5231
|
+
});
|
|
5232
|
+
if (isBaseAccent) add(prop, `var(${token})`);
|
|
5233
|
+
}
|
|
5234
|
+
}
|
|
5235
|
+
}
|
|
5236
|
+
return out;
|
|
5237
|
+
}
|
|
5238
|
+
|
|
4895
5239
|
/**
|
|
4896
5240
|
* The settings, as a `defineTheme` object.
|
|
4897
5241
|
* @param {Ctx} ctx
|
|
@@ -4903,16 +5247,10 @@ export function compileTheme(ctx, data, base) {
|
|
|
4903
5247
|
ctx.sizeNotes = [];
|
|
4904
5248
|
ctx.compileNotes = [];
|
|
4905
5249
|
// A setting the editor no longer accepts never reaches the build; a
|
|
4906
|
-
// saved state is
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
.filter(s => !valueProblem(s))
|
|
4911
|
-
.map(s => {
|
|
4912
|
-
const read = savedStateRead(ctx, s);
|
|
4913
|
-
return read && read !== s.state ? {...s, state: read} : s;
|
|
4914
|
-
}),
|
|
4915
|
-
};
|
|
5250
|
+
// saved state is the part's own from here on (readSavedStates), so every
|
|
5251
|
+
// line made from the theme names it so.
|
|
5252
|
+
readSavedStates(ctx, data);
|
|
5253
|
+
data = {...data, settings: data.settings.filter(s => !valueProblem(s))};
|
|
4916
5254
|
const TOKENS = ctx.project.core.tokenDefaults;
|
|
4917
5255
|
// The base theme's type scale, read back from its sizes: base text, and
|
|
4918
5256
|
// the ratio (2xl is three steps above base).
|
|
@@ -5190,7 +5528,9 @@ export function compileTheme(ctx, data, base) {
|
|
|
5190
5528
|
* children), as each corner's own radius, so Core writes no copy of the
|
|
5191
5529
|
* whole value there (where one corner reads it, and `10px / 20px` or four
|
|
5192
5530
|
* values are wrong). The inner variable takes one radius, the first
|
|
5193
|
-
* corner's across
|
|
5531
|
+
* corner's across. A Core whose entry has `corners` writes each corner's
|
|
5532
|
+
* variable from the longhands, so the content takes each corner; an older
|
|
5533
|
+
* Core gives the content the first corner's radius for all four.
|
|
5194
5534
|
* Null for any other property, part or a single radius.
|
|
5195
5535
|
* @param {string} target @param {Setting} s
|
|
5196
5536
|
* @returns {Record<string, string> | null}
|
|
@@ -6252,10 +6592,43 @@ export function compileTheme(ctx, data, base) {
|
|
|
6252
6592
|
? /^light-dark\((.*),\s*([^,]*)\)$/.exec(own.trim())
|
|
6253
6593
|
: null;
|
|
6254
6594
|
/** @param {'light' | 'dark'} m */
|
|
6255
|
-
const
|
|
6256
|
-
exactText[m] ??
|
|
6595
|
+
const baseAt = m =>
|
|
6257
6596
|
(split ? split[m === 'light' ? 1 : 2].trim() : own) ??
|
|
6258
6597
|
base[m]['--color-text-secondary'];
|
|
6598
|
+
/** A token as the theme draws it so far in a mode, its references read. @param {string} k @param {'light' | 'dark'} m */
|
|
6599
|
+
const drawnAs = (k, m) => {
|
|
6600
|
+
let v = String(tok[k]?.[m] ?? base[m][k] ?? '');
|
|
6601
|
+
for (let i = 0; i < 6; i++) {
|
|
6602
|
+
const ref = /^var\(\s*(--[\w-]+)\s*\)$/.exec(v.trim())?.[1];
|
|
6603
|
+
if (!ref) break;
|
|
6604
|
+
v = String(tok[ref]?.[m] ?? base[m][ref] ?? '');
|
|
6605
|
+
}
|
|
6606
|
+
return v;
|
|
6607
|
+
};
|
|
6608
|
+
// The exact color where it reads on what the part sits on (over the
|
|
6609
|
+
// surface), else the base theme's own lift there.
|
|
6610
|
+
/** @param {'light' | 'dark'} m */
|
|
6611
|
+
const at = m => {
|
|
6612
|
+
const exact = exactText[m];
|
|
6613
|
+
if (exact == null) return baseAt(m);
|
|
6614
|
+
const fill = drawnAs(ground, m);
|
|
6615
|
+
const under = parseColor(drawnAs('--color-background-surface', m));
|
|
6616
|
+
const top = parseColor(fill);
|
|
6617
|
+
const text = parseColor(exact);
|
|
6618
|
+
if (!top || !under || !text) return exact;
|
|
6619
|
+
const seen = compositeOver(
|
|
6620
|
+
/** @type {[number, number, number]} */ (top),
|
|
6621
|
+
alphaOf(fill),
|
|
6622
|
+
/** @type {[number, number, number]} */ (under),
|
|
6623
|
+
);
|
|
6624
|
+
const fallback = baseAt(m);
|
|
6625
|
+
const back = parseColor(String(fallback));
|
|
6626
|
+
return ratio(text, seen) >= 4.5 ||
|
|
6627
|
+
!back ||
|
|
6628
|
+
ratio(back, seen) <= ratio(text, seen)
|
|
6629
|
+
? exact
|
|
6630
|
+
: fallback;
|
|
6631
|
+
};
|
|
6259
6632
|
lift = {light: {color: at('light')}, dark: {color: at('dark')}};
|
|
6260
6633
|
}
|
|
6261
6634
|
if (!lift || !ctx.project.target.has(target)) continue;
|
|
@@ -6353,6 +6726,13 @@ export function compileTheme(ctx, data, base) {
|
|
|
6353
6726
|
// build by an earlier editor, or a step back) are kept, as the
|
|
6354
6727
|
// colors are: they change only when corners or the base does.
|
|
6355
6728
|
putTok(token, ctx.keepRadii?.[token] ?? derived(token));
|
|
6729
|
+
// Chat surfaces (a composer, its drawer, a message bubble) read
|
|
6730
|
+
// --radius-chat, which Core defaults to the container radius and
|
|
6731
|
+
// the bundled themes pin to a value of their own: the dial gives it
|
|
6732
|
+
// back to the container radius, as Core's own default does, so it
|
|
6733
|
+
// follows whatever container radius the theme ends up with (the
|
|
6734
|
+
// dial's, or an exact one set after it).
|
|
6735
|
+
putTok('--radius-chat', 'var(--radius-container)');
|
|
6356
6736
|
// A part rule of the base theme that gives a radius other than the
|
|
6357
6737
|
// dial token the part reads (a length, or a token the dial never
|
|
6358
6738
|
// moves, such as --radius-full) would keep it over the dial: the
|
|
@@ -6380,6 +6760,22 @@ export function compileTheme(ctx, data, base) {
|
|
|
6380
6760
|
// The palette mapping above sets these tokens.
|
|
6381
6761
|
} else if (s.thing === 'font') {
|
|
6382
6762
|
const f = fontOf(s.value);
|
|
6763
|
+
// A family typed alone that the base theme already uses keeps the
|
|
6764
|
+
// base's own fallbacks (Fraunces keeps Georgia, serif).
|
|
6765
|
+
if (!s.value.includes(',') && !FONTS[s.value] && !OPEN_FONTS[s.value])
|
|
6766
|
+
for (const token of [
|
|
6767
|
+
'--font-family-heading',
|
|
6768
|
+
'--font-family-body',
|
|
6769
|
+
'--font-family-code',
|
|
6770
|
+
]) {
|
|
6771
|
+
const stack = base.light[token];
|
|
6772
|
+
if (!stack || !stack.includes(',')) continue;
|
|
6773
|
+
const own = fontOf(stack);
|
|
6774
|
+
if (fontKey(own.family) !== fontKey(f.family)) continue;
|
|
6775
|
+
// The base's fallbacks as it writes them, quotes and all.
|
|
6776
|
+
f.fallbacks = stack.slice(stack.indexOf(',') + 1).trim();
|
|
6777
|
+
break;
|
|
6778
|
+
}
|
|
6383
6779
|
theme.typography ??= {};
|
|
6384
6780
|
for (const r of s.on ? [s.on] : ['body', 'heading'])
|
|
6385
6781
|
theme.typography[r] = {
|
|
@@ -6396,7 +6792,11 @@ export function compileTheme(ctx, data, base) {
|
|
|
6396
6792
|
};
|
|
6397
6793
|
} else if (s.thing === 'surfaces') {
|
|
6398
6794
|
for (const t of SURFACE_PARTS.filter(x => ctx.project.target.has(x))) {
|
|
6399
|
-
|
|
6795
|
+
// (A panel floating over the page keeps an edge under flat.)
|
|
6796
|
+
const look =
|
|
6797
|
+
FLOATING_PANELS.includes(t) && FLOATING_SURFACES[s.value]
|
|
6798
|
+
? FLOATING_SURFACES[s.value]
|
|
6799
|
+
: SURFACES[s.value];
|
|
6400
6800
|
// A frame that paints nothing (the banner's): its line and shadow
|
|
6401
6801
|
// go on the part inside it that paints the rounded fill, so they
|
|
6402
6802
|
// follow its corners; a square ring around them otherwise.
|
|
@@ -7082,13 +7482,25 @@ export function compileTheme(ctx, data, base) {
|
|
|
7082
7482
|
const tint = {};
|
|
7083
7483
|
/** @type {Partial<Record<'light' | 'dark', string>>} */
|
|
7084
7484
|
const edge = {};
|
|
7485
|
+
// A mode in which the theme gives the panel a fill of its own (white
|
|
7486
|
+
// cards) shows that fill, not the tint: its pieces stay as they are.
|
|
7487
|
+
/** @param {'light' | 'dark'} m */
|
|
7488
|
+
const ownFill = m =>
|
|
7489
|
+
data.settings.some(
|
|
7490
|
+
x =>
|
|
7491
|
+
x.source === 'property' &&
|
|
7492
|
+
/^background(-color)?$/.test(x.thing) &&
|
|
7493
|
+
!x.state &&
|
|
7494
|
+
(!x.mode || x.mode === m) &&
|
|
7495
|
+
partsOf(ctx, x).includes(t),
|
|
7496
|
+
);
|
|
7085
7497
|
for (const m of /** @type {const} */ (['light', 'dark'])) {
|
|
7086
7498
|
const fill = shown('--color-background-muted', m);
|
|
7087
7499
|
const surface = shown(own, m);
|
|
7088
7500
|
const line = shown('--color-border-emphasized', m);
|
|
7089
7501
|
if (!fill) continue;
|
|
7090
7502
|
tint[m] = fill;
|
|
7091
|
-
if (!surface || !line) continue;
|
|
7503
|
+
if (!surface || !line || ownFill(m)) continue;
|
|
7092
7504
|
const rgb = (/** @type {string} */ x) =>
|
|
7093
7505
|
/** @type {[number, number, number]} */ (parseColor(x));
|
|
7094
7506
|
const need = ratio(rgb(line), rgb(surface));
|
|
@@ -7113,6 +7525,10 @@ export function compileTheme(ctx, data, base) {
|
|
|
7113
7525
|
for (const m of /** @type {const} */ (['light', 'dark'])) {
|
|
7114
7526
|
const v = shown(k, m);
|
|
7115
7527
|
const f = tint[m];
|
|
7528
|
+
if (ownFill(m)) {
|
|
7529
|
+
blends[m] = false;
|
|
7530
|
+
continue;
|
|
7531
|
+
}
|
|
7116
7532
|
// A gray piece reads as the tint when it is near its lightness; a
|
|
7117
7533
|
// colored one (a status or category fill) keeps its hue.
|
|
7118
7534
|
blends[m] =
|
|
@@ -7151,6 +7567,20 @@ export function compileTheme(ctx, data, base) {
|
|
|
7151
7567
|
? d
|
|
7152
7568
|
: l;
|
|
7153
7569
|
}
|
|
7570
|
+
// A role color the theme sets reaches the parts where the base theme
|
|
7571
|
+
// draws that role on its own (see roleReach). What the theme sets on the
|
|
7572
|
+
// part itself stays.
|
|
7573
|
+
for (const r of roleReach(ctx, data, base)) {
|
|
7574
|
+
const mine = r.value ?? theme.tokens[r.prop];
|
|
7575
|
+
if (mine == null) continue;
|
|
7576
|
+
const b = block(
|
|
7577
|
+
/** @type {Setting} */ ({thing: '', value: '', when: r.when}),
|
|
7578
|
+
r.part,
|
|
7579
|
+
);
|
|
7580
|
+
b[r.prop] ??= Array.isArray(mine)
|
|
7581
|
+
? `light-dark(${mine[0]}, ${mine[1]})`
|
|
7582
|
+
: String(mine);
|
|
7583
|
+
}
|
|
7154
7584
|
// Base themes set the type tokens again for phones (a coarse pointer
|
|
7155
7585
|
// below the lg width); an exact font family or weight, and the headings
|
|
7156
7586
|
// dial's weights, are written there too, so they apply on every screen.
|
|
@@ -7872,7 +8302,7 @@ const MODULE_EXTENSIONS = [
|
|
|
7872
8302
|
/**
|
|
7873
8303
|
* The file a relative import names, resolved as TypeScript resolves it: a
|
|
7874
8304
|
* JavaScript extension names its TypeScript source (`.js` → `.ts`/`.tsx`,
|
|
7875
|
-
* `.jsx` → `.tsx`, `.mjs` → `.mts`, `.cjs` → `.cts`), then the path as
|
|
8305
|
+
* `.jsx` → `.tsx`/`.ts`, `.mjs` → `.mts`, `.cjs` → `.cts`), then the path as
|
|
7876
8306
|
* written, with each module extension, and as a folder's index file.
|
|
7877
8307
|
* @param {string} dir
|
|
7878
8308
|
* @param {string} spec
|
|
@@ -7882,12 +8312,7 @@ export function localModuleFile(dir, spec) {
|
|
|
7882
8312
|
const base = path.resolve(dir, spec);
|
|
7883
8313
|
const ext = path.extname(base);
|
|
7884
8314
|
const stem = base.slice(0, base.length - ext.length);
|
|
7885
|
-
const sourceFor =
|
|
7886
|
-
'.js': ['.ts', '.tsx'],
|
|
7887
|
-
'.jsx': ['.tsx'],
|
|
7888
|
-
'.mjs': ['.mts'],
|
|
7889
|
-
'.cjs': ['.cts'],
|
|
7890
|
-
})[ext];
|
|
8315
|
+
const sourceFor = TS_SOURCES[ext];
|
|
7891
8316
|
return [
|
|
7892
8317
|
...(sourceFor ?? []).map(x => stem + x),
|
|
7893
8318
|
base,
|
|
@@ -8677,8 +9102,9 @@ async function buildThemeSteps(ctx, slug, data) {
|
|
|
8677
9102
|
`removed ${removedPictures.join(', ')}: ${removedPictures.length === 1 ? 'a picture' : 'pictures'} of ${slug} as it was before this build; ${[
|
|
8678
9103
|
...new Set(
|
|
8679
9104
|
removedPictures.map(p => {
|
|
9105
|
+
// A family's picture, or a piece cut from it (sheet-inputs-2.png).
|
|
8680
9106
|
const section =
|
|
8681
|
-
/\/sheet-(?!dark
|
|
9107
|
+
/\/sheet-(?!dark[-.])([a-z][a-z-]*?)(-dark)?(-\d+)?\.png$/.exec(
|
|
8682
9108
|
p,
|
|
8683
9109
|
)?.[1];
|
|
8684
9110
|
// The open states are taken by every --png: no section named.
|
|
@@ -8734,6 +9160,9 @@ async function runBuild(ctx, slug, data) {
|
|
|
8734
9160
|
{cwd},
|
|
8735
9161
|
{compact: true},
|
|
8736
9162
|
{
|
|
9163
|
+
// The theme folder is the editor's: a half-written or damaged
|
|
9164
|
+
// output there is repaired, never refused as a file of the user's.
|
|
9165
|
+
ownsOutputs: true,
|
|
8737
9166
|
colorModes: data
|
|
8738
9167
|
? oneColorMode(modesOf(data))
|
|
8739
9168
|
: buildColorModes(cwd, slug),
|
|
@@ -9562,36 +9991,48 @@ export async function contrastProblems(ctx, data, res) {
|
|
|
9562
9991
|
/**
|
|
9563
9992
|
* A fill the theme paints on a part between the text and the ground the
|
|
9564
9993
|
* census measured it on (a side nav pane painted blue, between its items
|
|
9565
|
-
* and the app shell)
|
|
9566
|
-
*
|
|
9994
|
+
* and the app shell), or on the text's own part (a tab the base draws
|
|
9995
|
+
* with no fill, painted gray): the text sits on that fill now. The
|
|
9996
|
+
* setting's value and the part it paints, or null when the theme paints
|
|
9997
|
+
* none there.
|
|
9567
9998
|
* @param {TextPair} p @param {string} m
|
|
9999
|
+
* @returns {{value: string, part: string} | null}
|
|
9568
10000
|
*/
|
|
9569
|
-
const
|
|
10001
|
+
const nearerFillOf = (p, m) => {
|
|
9570
10002
|
const t = p.fg.target;
|
|
9571
10003
|
const g = p.bg.target;
|
|
9572
10004
|
if (!t || !g || g === t || /** @type {any} */ (p).over) return null;
|
|
9573
10005
|
const holds = (/** @type {string} */ a, /** @type {string} */ b) =>
|
|
9574
10006
|
/** @type {any} */ (ctx.C.MAP[a]?.contains ?? []).includes(b);
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
(
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
10007
|
+
/** @param {string} q */
|
|
10008
|
+
const between = q =>
|
|
10009
|
+
q === t ||
|
|
10010
|
+
(q !== g &&
|
|
10011
|
+
// (The census drew the text inside that part, and that part
|
|
10012
|
+
// inside the ground: a side nav's item in the side nav.)
|
|
10013
|
+
(p.within ?? []).includes(q) &&
|
|
10014
|
+
holds(g, q));
|
|
10015
|
+
const fill = [...data.settings]
|
|
10016
|
+
.reverse()
|
|
10017
|
+
.find(
|
|
10018
|
+
x =>
|
|
10019
|
+
x.source === 'property' &&
|
|
10020
|
+
/^background(-color)?$/.test(x.thing) &&
|
|
10021
|
+
!x.when &&
|
|
10022
|
+
!x.state &&
|
|
10023
|
+
(!x.mode || x.mode === m) &&
|
|
10024
|
+
x.on &&
|
|
10025
|
+
partsOf(ctx, x).some(between),
|
|
10026
|
+
);
|
|
10027
|
+
return fill
|
|
10028
|
+
? {
|
|
10029
|
+
value: String(fill.value),
|
|
10030
|
+
part: /** @type {string} */ (partsOf(ctx, fill).find(between)),
|
|
10031
|
+
}
|
|
10032
|
+
: null;
|
|
9594
10033
|
};
|
|
10034
|
+
/** @param {TextPair} p @param {string} m */
|
|
10035
|
+
const nearerFill = (p, m) => nearerFillOf(p, m)?.value ?? null;
|
|
9595
10036
|
/** @type {(p: TextPair, side: 'fg' | 'bg', m: string) => string | null} */
|
|
9596
10037
|
const value = (p, side, m0) => {
|
|
9597
10038
|
const m = inScheme(p, side, m0);
|
|
@@ -9932,13 +10373,101 @@ export async function contrastProblems(ctx, data, res) {
|
|
|
9932
10373
|
modesOf(data).length > 1 ? ` --mode ${m}` : '';
|
|
9933
10374
|
/** @type {(text: string) => ThemeProblem} */
|
|
9934
10375
|
const plain = text => ({text, fix: null, key: text});
|
|
10376
|
+
/**
|
|
10377
|
+
* The whole-theme text token setting that draws a pair's text in a mode,
|
|
10378
|
+
* when no setting on a part does: one line on that token fixes every
|
|
10379
|
+
* place it is too faint.
|
|
10380
|
+
* @param {TextPair} pair @param {string} m
|
|
10381
|
+
* @returns {Setting | null}
|
|
10382
|
+
*/
|
|
10383
|
+
const wholeOf = (pair, m) => {
|
|
10384
|
+
if (drawnBy(pair, m) || /** @type {any} */ (pair).mediaOf) return null;
|
|
10385
|
+
const toks = textTokens(pair, m, value);
|
|
10386
|
+
return (
|
|
10387
|
+
[...data.settings]
|
|
10388
|
+
.reverse()
|
|
10389
|
+
.find(
|
|
10390
|
+
y =>
|
|
10391
|
+
y.source === 'token' &&
|
|
10392
|
+
!y.on &&
|
|
10393
|
+
!y.when &&
|
|
10394
|
+
!y.state &&
|
|
10395
|
+
(!y.mode || y.mode === m) &&
|
|
10396
|
+
toks.includes(y.thing),
|
|
10397
|
+
) ?? null
|
|
10398
|
+
);
|
|
10399
|
+
};
|
|
10400
|
+
/** The grounds each whole-theme text token is too faint on, by token and mode. @type {Map<string, Array<[number, number, number]>>} */
|
|
10401
|
+
const wholeGrounds = new Map();
|
|
10402
|
+
for (const x of problems) {
|
|
10403
|
+
const w = wholeOf(/** @type {TextPair} */ (x.pair), x.mode);
|
|
10404
|
+
if (!w) continue;
|
|
10405
|
+
const k = `${w.thing}|${x.mode}`;
|
|
10406
|
+
wholeGrounds.set(k, [...(wholeGrounds.get(k) ?? []), x.ground]);
|
|
10407
|
+
}
|
|
9935
10408
|
const scoped = scopedTextProblems(ctx, data, res);
|
|
10409
|
+
/**
|
|
10410
|
+
* A destructive button a person cannot tell from the primary one: their
|
|
10411
|
+
* fills, as drawn, close in OKLab in a mode. A note (it fails no
|
|
10412
|
+
* contrast), with the line that draws the destructive button in the
|
|
10413
|
+
* theme's danger color, and its text on it.
|
|
10414
|
+
* @returns {ThemeProblem[]}
|
|
10415
|
+
*/
|
|
10416
|
+
const destructiveLookalike = () => {
|
|
10417
|
+
/** The button pair drawn in a variant. @param {string} v */
|
|
10418
|
+
const pairOf = v =>
|
|
10419
|
+
variantPairs.find(
|
|
10420
|
+
q =>
|
|
10421
|
+
q.fg.target === 'button' &&
|
|
10422
|
+
/** @type {any} */ (q).when === `variant:${v}`,
|
|
10423
|
+
) ??
|
|
10424
|
+
(v === 'primary'
|
|
10425
|
+
? censusPairs.find(
|
|
10426
|
+
q =>
|
|
10427
|
+
q.fg.target === 'button' &&
|
|
10428
|
+
q.bg.target === 'button' &&
|
|
10429
|
+
!pairVariant(q),
|
|
10430
|
+
)
|
|
10431
|
+
: null);
|
|
10432
|
+
const primary = pairOf('primary');
|
|
10433
|
+
const destructive = pairOf('destructive');
|
|
10434
|
+
if (!primary || !destructive) return [];
|
|
10435
|
+
/** @type {ThemeProblem[]} */
|
|
10436
|
+
const out = [];
|
|
10437
|
+
for (const m of modesOf(data)) {
|
|
10438
|
+
const page = parseColor(
|
|
10439
|
+
String(
|
|
10440
|
+
res[/** @type {'light' | 'dark'} */ (m)]['--color-background-body'],
|
|
10441
|
+
),
|
|
10442
|
+
);
|
|
10443
|
+
/** A fill as drawn on the page. @param {TextPair} q */
|
|
10444
|
+
const drawn = q => {
|
|
10445
|
+
const v = String(value(q, 'bg', m) ?? '');
|
|
10446
|
+
const c = parseColor(v);
|
|
10447
|
+
if (!c || !page || /gradient\(|url\(/.test(v)) return null;
|
|
10448
|
+
return compositeOver(c, alphaOf(v), page);
|
|
10449
|
+
};
|
|
10450
|
+
const a = drawn(primary);
|
|
10451
|
+
const b = drawn(destructive);
|
|
10452
|
+
if (!a || !b) continue;
|
|
10453
|
+
const d = oklabDistance(a, b);
|
|
10454
|
+
if (d >= LOOKS_ALIKE) continue;
|
|
10455
|
+
out.push({
|
|
10456
|
+
key: `lookalike|button|destructive|${m}`,
|
|
10457
|
+
note: true,
|
|
10458
|
+
text: `the destructive button (${hex(b)}) looks like the primary button (${hex(a)}) in ${m}, so Delete and Save read alike; to draw it in the theme's danger color: ${P} set ${data.name} background-color 'var(--color-error)' --on button --when variant:destructive && ${P} set ${data.name} color 'var(--color-on-error)' --on button --when variant:destructive`,
|
|
10459
|
+
fix: null,
|
|
10460
|
+
});
|
|
10461
|
+
break;
|
|
10462
|
+
}
|
|
10463
|
+
return out;
|
|
10464
|
+
};
|
|
9936
10465
|
return [
|
|
9937
10466
|
...problems.map(x => ({
|
|
9938
10467
|
// What the problem is, whatever its ratio: the text, the token or
|
|
9939
10468
|
// property that draws it, what it sits on, its variant and mode.
|
|
9940
10469
|
key: `text|${x.part}|${x.textPart ?? ''}|${x.fgToken ?? ''}|${x.bgPart ?? ''}|${/** @type {any} */ (x.pair)?.bg?.tokens?.join('+') ?? ''}|${x.when ?? ''}|${x.sample}|${x.mode}`,
|
|
9941
|
-
text: `text in ${x.part} ("${x.sample}") is ${x.ratio}:1 in ${/** @type {any} */ (x.pair)?.drawnIn ? `${/** @type {any} */ (x.pair).drawnIn} (${/** @type {any} */ (x.pair).mediaOf} draws it in its ${/** @type {any} */ (x.pair).drawnIn} scheme)` : x.mode} (${x.fg} on ${x.bgPart ?? 'the page'}'s ${x.bg}${x.over ? ` over ${x.over}` : ''}); text needs 4.5:1`,
|
|
10470
|
+
text: `text in ${x.part} ("${x.sample}") is ${x.ratio}:1 in ${/** @type {any} */ (x.pair)?.drawnIn ? `${/** @type {any} */ (x.pair).drawnIn} (${/** @type {any} */ (x.pair).mediaOf} draws it in its ${/** @type {any} */ (x.pair).drawnIn} scheme)` : x.mode} (${x.fg} on ${(x.pair ? nearerFillOf(/** @type {TextPair} */ (x.pair), inScheme(/** @type {TextPair} */ (x.pair), 'bg', x.mode))?.part : null) ?? x.bgPart ?? 'the page'}'s ${x.bg}${x.over ? ` over ${x.over}` : ''}); text needs 4.5:1`,
|
|
9942
10471
|
// The fix sets what draws the text: the setting that wins in CSS,
|
|
9943
10472
|
// where one does, else the text token where the text sits.
|
|
9944
10473
|
fix: (() => {
|
|
@@ -10128,6 +10657,23 @@ export async function contrastProblems(ctx, data, res) {
|
|
|
10128
10657
|
)
|
|
10129
10658
|
return `${P} set ${slug} background-color '${String(pane.value)}' --on ${x.bgPart}${only(x.bgPart)}${stateFlag}${modeFlag(x.mode)}`;
|
|
10130
10659
|
}
|
|
10660
|
+
// Text a whole-theme token setting draws, too faint in several
|
|
10661
|
+
// places: one line on that token, the nearest color that reads on
|
|
10662
|
+
// every ground it is too faint on (all of one side, light or dark).
|
|
10663
|
+
const whole = wholeOf(pair, x.mode);
|
|
10664
|
+
const wholeOn = whole
|
|
10665
|
+
? wholeGrounds.get(`${whole.thing}|${x.mode}`)
|
|
10666
|
+
: null;
|
|
10667
|
+
if (
|
|
10668
|
+
whole &&
|
|
10669
|
+
wholeOn &&
|
|
10670
|
+
wholeOn.length > 1 &&
|
|
10671
|
+
wholeOn.every(g => plainOn(g) === plainOn(wholeOn[0]))
|
|
10672
|
+
) {
|
|
10673
|
+
const fg = parseColor(String(value(pair, 'fg', x.mode) ?? ''));
|
|
10674
|
+
if (fg)
|
|
10675
|
+
return `${P} set ${slug} ${whole.thing} '${nearestReading(fg, wholeOn, 4.5)}'${modeFlag(x.mode)}`;
|
|
10676
|
+
}
|
|
10131
10677
|
if (drawn) {
|
|
10132
10678
|
const onText =
|
|
10133
10679
|
drawn.on && partsOf(ctx, drawn).includes(String(x.textPart));
|
|
@@ -10230,9 +10776,13 @@ export async function contrastProblems(ctx, data, res) {
|
|
|
10230
10776
|
) === 1
|
|
10231
10777
|
? `${P} set ${slug} ${token} ${color} --on ${x.textPart}${only(x.textPart)}${when(variant)}${stateFlag}${modeFlag(x.mode)}`
|
|
10232
10778
|
: null;
|
|
10779
|
+
// (The ground is the part the theme painted under the text, where
|
|
10780
|
+
// it painted one: a tab given a fill of its own.)
|
|
10781
|
+
const groundPart =
|
|
10782
|
+
nearerFillOf(pair, inScheme(pair, 'bg', x.mode))?.part ?? x.bgPart;
|
|
10233
10783
|
if (token)
|
|
10234
10784
|
return x.bgPart && x.bgPart !== x.textPart
|
|
10235
|
-
? `${P} set ${slug} ${token} ${color} --on ${
|
|
10785
|
+
? `${P} set ${slug} ${token} ${color} --on ${groundPart}${only(String(groundPart))}${when(/** @type {any} */ (pair).groundWhen ?? x.when)}${stateFlag}${modeFlag(x.mode)}`
|
|
10236
10786
|
: `${P} set ${slug} ${token} ${color}${x.textPart ? ` --on ${x.textPart}${only(x.textPart)}` : ''}${when(variant)}${stateFlag}${modeFlag(x.mode)}`;
|
|
10237
10787
|
return x.textPart
|
|
10238
10788
|
? `${P} set ${slug} color ${color} --on ${x.textPart}${only(x.textPart)}${when(x.when)}${stateFlag}${modeFlag(x.mode)}`
|
|
@@ -10240,18 +10790,17 @@ export async function contrastProblems(ctx, data, res) {
|
|
|
10240
10790
|
})(),
|
|
10241
10791
|
})),
|
|
10242
10792
|
...borderContrastProblems(ctx, data, res, base),
|
|
10793
|
+
...trackContrastProblems(ctx, data, res, base),
|
|
10794
|
+
...floatingEdgeProblems(ctx, data, res, base),
|
|
10243
10795
|
...scoped.problems,
|
|
10796
|
+
...buttonStyleProblems(ctx, data, res),
|
|
10797
|
+
...placeholderProblems(ctx, data, res, base),
|
|
10244
10798
|
...leakedButtonProblems(ctx, data, res),
|
|
10799
|
+
...destructiveLookalike(),
|
|
10245
10800
|
// Pairs styled for one state or condition whose colors cannot be read
|
|
10246
10801
|
// as one color, and the button styles, are not measured yet.
|
|
10247
10802
|
...(() => {
|
|
10248
|
-
const scopedLeft = [
|
|
10249
|
-
...new Set(scoped.unmeasured),
|
|
10250
|
-
...data.settings.filter(
|
|
10251
|
-
// The button style recolors the primary button only.
|
|
10252
|
-
x => x.thing === 'buttons' && ['soft', 'outline'].includes(x.value),
|
|
10253
|
-
),
|
|
10254
|
-
];
|
|
10803
|
+
const scopedLeft = [...new Set(scoped.unmeasured)];
|
|
10255
10804
|
return scopedLeft.length
|
|
10256
10805
|
? [
|
|
10257
10806
|
plain(
|
|
@@ -10280,7 +10829,7 @@ export async function contrastProblems(ctx, data, res) {
|
|
|
10280
10829
|
* no one command does. `key` names the problem whatever its ratio (what
|
|
10281
10830
|
* is drawn, on what, in which variant and mode), so a change that only
|
|
10282
10831
|
* moves a ratio makes no new problem.
|
|
10283
|
-
* @typedef {{text: string, fix: string | null, key: string}} ThemeProblem
|
|
10832
|
+
* @typedef {{text: string, fix: string | null, key: string, note?: boolean}} ThemeProblem
|
|
10284
10833
|
*/
|
|
10285
10834
|
|
|
10286
10835
|
/**
|
|
@@ -10545,6 +11094,328 @@ function borderContrastProblems(ctx, data, res, base) {
|
|
|
10545
11094
|
return [...out.values()];
|
|
10546
11095
|
}
|
|
10547
11096
|
|
|
11097
|
+
/**
|
|
11098
|
+
* Track contrast problems this theme caused: a value a part draws on a
|
|
11099
|
+
* track (a progress bar's fill, a slider's thumb) below 3:1 against the
|
|
11100
|
+
* track at rest in a mode, where the base theme's was not as low. The fill
|
|
11101
|
+
* is how the value is read, so it needs 3:1 against what it sits on (WCAG
|
|
11102
|
+
* 1.4.11), as a control's edge does. A track is a part named for one (its
|
|
11103
|
+
* name ends in -track), and what it draws a value with is each part of its
|
|
11104
|
+
* component beside or inside it that paints a fill of its own. A fill
|
|
11105
|
+
* inside the track (a progress bar's) is read against the track alone; one
|
|
11106
|
+
* beside it (a slider's thumb, larger than the track) is lost only when it
|
|
11107
|
+
* reads neither on the track nor on the page.
|
|
11108
|
+
* Each fill reads its token where the parts around it point it (neutral's
|
|
11109
|
+
* progress track reads the muted fill, which its progress bar points at
|
|
11110
|
+
* the emphasized border). The fix is the nearest color for the track that
|
|
11111
|
+
* reaches 3:1, on the track alone, so the fill keeps the color it shows
|
|
11112
|
+
* everywhere else.
|
|
11113
|
+
* @param {Ctx} ctx
|
|
11114
|
+
* @param {ThemeData} data
|
|
11115
|
+
* @param {{light: Record<string, string>, dark: Record<string, string>}} res
|
|
11116
|
+
* @param {{light: Record<string, string>, dark: Record<string, string>, components?: Record<string, any>}} base
|
|
11117
|
+
* @returns {ThemeProblem[]}
|
|
11118
|
+
*/
|
|
11119
|
+
function trackContrastProblems(ctx, data, res, base) {
|
|
11120
|
+
const map = /** @type {Record<string, any>} */ (ctx.C.MAP);
|
|
11121
|
+
const modeFlag = (/** @type {string} */ m) =>
|
|
11122
|
+
modesOf(data).length > 1 ? ` --mode ${m}` : '';
|
|
11123
|
+
/** The component a part belongs to. @param {string} t */
|
|
11124
|
+
const component = t => ctx.project.target.get(t)?.component ?? null;
|
|
11125
|
+
/** The parts that hold a part. @param {string} t */
|
|
11126
|
+
const holders = t =>
|
|
11127
|
+
Object.keys(map).filter(h => map[h]?.contains?.includes(t));
|
|
11128
|
+
/** The token a part fills itself with at rest, or null. @param {string} t */
|
|
11129
|
+
const fillToken = t =>
|
|
11130
|
+
ctx.C.partReads(t, 'background').find(
|
|
11131
|
+
r =>
|
|
11132
|
+
r.token &&
|
|
11133
|
+
r.when.includes('') &&
|
|
11134
|
+
r.props.some(p => /^background(-color)?$/.test(p)),
|
|
11135
|
+
)?.token ??
|
|
11136
|
+
ctx.C.partReads(t, 'background').find(
|
|
11137
|
+
r => r.token && r.props.some(p => /^background(-color)?$/.test(p)),
|
|
11138
|
+
)?.token ??
|
|
11139
|
+
null;
|
|
11140
|
+
/**
|
|
11141
|
+
* A token's color in a mode on a part: where the part or a part holding
|
|
11142
|
+
* it points the token at another value, that value, as the theme built
|
|
11143
|
+
* it (its own blocks) or the base theme draws it.
|
|
11144
|
+
* @param {string} token @param {string} t @param {'light' | 'dark'} m
|
|
11145
|
+
* @param {Record<string, string>} tokens @param {Record<string, any>} [own] part-scoped tokens
|
|
11146
|
+
* @param {Record<string, any>} [blocks] the base theme's part blocks
|
|
11147
|
+
*/
|
|
11148
|
+
const colorOn = (token, t, m, tokens, own, blocks) => {
|
|
11149
|
+
const around = [t, ...holders(t)];
|
|
11150
|
+
let v = `var(${token})`;
|
|
11151
|
+
for (let i = 0; i < 6; i++) {
|
|
11152
|
+
const pair = /^light-dark\((.*)\)$/is.exec(v.trim());
|
|
11153
|
+
if (pair) {
|
|
11154
|
+
const halves = splitTop(pair[1], ',');
|
|
11155
|
+
if (halves.length === 2) v = halves[m === 'light' ? 0 : 1].trim();
|
|
11156
|
+
}
|
|
11157
|
+
const ref = /^var\(\s*(--[\w-]+)\s*(?:,[^)]*)?\)$/.exec(v.trim())?.[1];
|
|
11158
|
+
if (!ref) break;
|
|
11159
|
+
const scoped =
|
|
11160
|
+
around
|
|
11161
|
+
.map(
|
|
11162
|
+
a =>
|
|
11163
|
+
own?.[a]?.[ref] ??
|
|
11164
|
+
blocks?.[a]?.base?.[ref] ??
|
|
11165
|
+
Object.values(blocks?.[a] ?? {}).find(
|
|
11166
|
+
(/** @type {any} */ b) =>
|
|
11167
|
+
b && typeof b === 'object' && typeof b[ref] === 'string',
|
|
11168
|
+
)?.[ref],
|
|
11169
|
+
)
|
|
11170
|
+
.find(x => typeof x === 'string' && x !== `var(${ref})`) ?? null;
|
|
11171
|
+
v = String(scoped ?? tokens[ref] ?? '');
|
|
11172
|
+
}
|
|
11173
|
+
const rgb = parseColor(v.trim());
|
|
11174
|
+
return rgb ? {rgb, alpha: alphaOf(v), value: v.trim()} : null;
|
|
11175
|
+
};
|
|
11176
|
+
/**
|
|
11177
|
+
* A part's own fill in a mode, as the theme sets it at rest (a later
|
|
11178
|
+
* setting wins), read in that mode, or null.
|
|
11179
|
+
* @param {string} t @param {'light' | 'dark'} m
|
|
11180
|
+
*/
|
|
11181
|
+
const ownFill = (t, m) => {
|
|
11182
|
+
const hit = [...data.settings]
|
|
11183
|
+
.reverse()
|
|
11184
|
+
.find(
|
|
11185
|
+
x =>
|
|
11186
|
+
!x.state &&
|
|
11187
|
+
!x.when &&
|
|
11188
|
+
(!x.mode || x.mode === m) &&
|
|
11189
|
+
x.source === 'property' &&
|
|
11190
|
+
/^background(-color)?$/.test(x.thing) &&
|
|
11191
|
+
partsOf(ctx, x).includes(t),
|
|
11192
|
+
);
|
|
11193
|
+
if (!hit) return null;
|
|
11194
|
+
const halves = /^light-dark\((.*)\)$/is.exec(String(hit.value).trim());
|
|
11195
|
+
const one = halves
|
|
11196
|
+
? (splitTop(halves[1], ',')[m === 'light' ? 0 : 1] ?? '').trim()
|
|
11197
|
+
: String(hit.value).trim();
|
|
11198
|
+
const ref = /^var\(\s*(--[\w-]+)/.exec(one)?.[1];
|
|
11199
|
+
const v = ref ? String(res[m][ref] ?? '') : one;
|
|
11200
|
+
const rgb = parseColor(v);
|
|
11201
|
+
return rgb ? {rgb, alpha: alphaOf(v), value: v} : null;
|
|
11202
|
+
};
|
|
11203
|
+
/** @type {ThemeProblem[]} */
|
|
11204
|
+
const out = [];
|
|
11205
|
+
const own = /** @type {any} */ (res).parts ?? {};
|
|
11206
|
+
for (const track of Object.keys(map).filter(t => /-track$/.test(t))) {
|
|
11207
|
+
if (!ctx.project.target.has(track)) continue;
|
|
11208
|
+
const trackToken = fillToken(track);
|
|
11209
|
+
if (!trackToken) continue;
|
|
11210
|
+
const fills = [
|
|
11211
|
+
...new Set([
|
|
11212
|
+
...(map[track]?.contains ?? []),
|
|
11213
|
+
...holders(track).flatMap(h => map[h]?.contains ?? []),
|
|
11214
|
+
]),
|
|
11215
|
+
].filter(
|
|
11216
|
+
f =>
|
|
11217
|
+
f !== track &&
|
|
11218
|
+
!/-track$/.test(f) &&
|
|
11219
|
+
!holders(track).includes(f) &&
|
|
11220
|
+
component(f) != null &&
|
|
11221
|
+
component(f) === component(track) &&
|
|
11222
|
+
Boolean(fillToken(f)),
|
|
11223
|
+
);
|
|
11224
|
+
for (const fill of fills) {
|
|
11225
|
+
const fillTok = /** @type {string} */ (fillToken(fill));
|
|
11226
|
+
for (const m of modesOf(data)) {
|
|
11227
|
+
const mode = /** @type {'light' | 'dark'} */ (m);
|
|
11228
|
+
const page = parseColor(String(res[mode]['--color-background-body']));
|
|
11229
|
+
const basePage = parseColor(
|
|
11230
|
+
String(base[mode]['--color-background-body']),
|
|
11231
|
+
);
|
|
11232
|
+
const tr =
|
|
11233
|
+
ownFill(track, mode) ??
|
|
11234
|
+
colorOn(trackToken, track, mode, res[mode], own, base.components);
|
|
11235
|
+
const fi =
|
|
11236
|
+
ownFill(fill, mode) ??
|
|
11237
|
+
colorOn(fillTok, fill, mode, res[mode], own, base.components);
|
|
11238
|
+
const btr = colorOn(
|
|
11239
|
+
trackToken,
|
|
11240
|
+
track,
|
|
11241
|
+
mode,
|
|
11242
|
+
base[mode],
|
|
11243
|
+
undefined,
|
|
11244
|
+
base.components,
|
|
11245
|
+
);
|
|
11246
|
+
const bfi = colorOn(
|
|
11247
|
+
fillTok,
|
|
11248
|
+
fill,
|
|
11249
|
+
mode,
|
|
11250
|
+
base[mode],
|
|
11251
|
+
undefined,
|
|
11252
|
+
base.components,
|
|
11253
|
+
);
|
|
11254
|
+
if (!tr || !fi || !page) continue;
|
|
11255
|
+
const inside = Boolean(map[track]?.contains?.includes(fill));
|
|
11256
|
+
/** How well a fill reads where it sits. @param {any} f @param {any} t @param {[number, number, number]} pg */
|
|
11257
|
+
const reads = (f, t, pg) => {
|
|
11258
|
+
const g = compositeOver(t.rgb, t.alpha, pg);
|
|
11259
|
+
const onTrack = ratio(compositeOver(f.rgb, f.alpha, g), g);
|
|
11260
|
+
return inside
|
|
11261
|
+
? onTrack
|
|
11262
|
+
: Math.max(onTrack, ratio(compositeOver(f.rgb, f.alpha, pg), pg));
|
|
11263
|
+
};
|
|
11264
|
+
const ground = compositeOver(tr.rgb, tr.alpha, page);
|
|
11265
|
+
const now = reads(fi, tr, page);
|
|
11266
|
+
const was = btr && bfi && basePage ? reads(bfi, btr, basePage) : null;
|
|
11267
|
+
if (now >= 3 || (was != null && was <= now)) continue;
|
|
11268
|
+
// The fix moves the side the theme moved: the track when its color
|
|
11269
|
+
// is not the base's (a border it follows), else the fill, on that
|
|
11270
|
+
// part alone, so the color it shows elsewhere stays.
|
|
11271
|
+
const trackMoved = !btr || hex(btr.rgb) !== hex(tr.rgb);
|
|
11272
|
+
const fillGround = inside
|
|
11273
|
+
? ground
|
|
11274
|
+
: /** @type {[number, number, number]} */ (page);
|
|
11275
|
+
const color = trackMoved
|
|
11276
|
+
? nearestReading(ground, [compositeOver(fi.rgb, fi.alpha, ground)], 3)
|
|
11277
|
+
: nearestReading(
|
|
11278
|
+
compositeOver(fi.rgb, fi.alpha, ground),
|
|
11279
|
+
[ground, ...(inside ? [] : [fillGround])],
|
|
11280
|
+
3,
|
|
11281
|
+
);
|
|
11282
|
+
out.push({
|
|
11283
|
+
key: `track|${track}|${fill}|${mode}`,
|
|
11284
|
+
text: `the ${fill} (${hex(fi.rgb)}) is ${now.toFixed(2)}:1 on the ${track} (${hex(ground)})${inside ? '' : ' and no better on the page'} in ${mode}; a value drawn on a track needs 3:1 to be read`,
|
|
11285
|
+
fix: `${P} set ${data.name} background-color '${color}' --on ${trackMoved ? track : fill}${modeFlag(mode)}`,
|
|
11286
|
+
});
|
|
11287
|
+
}
|
|
11288
|
+
}
|
|
11289
|
+
}
|
|
11290
|
+
return out;
|
|
11291
|
+
}
|
|
11292
|
+
|
|
11293
|
+
/**
|
|
11294
|
+
* Floating edge problems: a panel that floats over the page (a menu, a
|
|
11295
|
+
* popover, a dialog) whose fill is within 1.1:1 of the page in a mode,
|
|
11296
|
+
* with no border and no shadow, has no edge to be seen by, whether the
|
|
11297
|
+
* surfaces dial or the theme's own settings drew it so. The fix is a
|
|
11298
|
+
* hairline border of the theme's border color on the panel.
|
|
11299
|
+
* @param {Ctx} ctx
|
|
11300
|
+
* @param {ThemeData} data
|
|
11301
|
+
* @param {{light: Record<string, string>, dark: Record<string, string>}} res
|
|
11302
|
+
* @param {{light: Record<string, string>, dark: Record<string, string>, components?: Record<string, any>}} base
|
|
11303
|
+
* @returns {ThemeProblem[]}
|
|
11304
|
+
*/
|
|
11305
|
+
function floatingEdgeProblems(ctx, data, res, base) {
|
|
11306
|
+
const map = /** @type {Record<string, any>} */ (ctx.C.MAP);
|
|
11307
|
+
const own = /** @type {any} */ (res).parts ?? {};
|
|
11308
|
+
/** The latest setting at rest on a part, of one of some things. @param {string} t @param {RegExp} thing @param {'light' | 'dark'} [m] */
|
|
11309
|
+
const last = (t, thing, m) =>
|
|
11310
|
+
[...data.settings]
|
|
11311
|
+
.reverse()
|
|
11312
|
+
.find(
|
|
11313
|
+
x =>
|
|
11314
|
+
!x.state &&
|
|
11315
|
+
!x.when &&
|
|
11316
|
+
(!m || !x.mode || x.mode === m) &&
|
|
11317
|
+
thing.test(x.thing) &&
|
|
11318
|
+
(x.thing === 'surfaces' || partsOf(ctx, x).includes(t)),
|
|
11319
|
+
);
|
|
11320
|
+
/** A value in a mode: its half of light-dark(), its tokens read. @param {string} v @param {string} t @param {'light' | 'dark'} m */
|
|
11321
|
+
const read = (v, t, m) => {
|
|
11322
|
+
let x = String(v ?? '').trim();
|
|
11323
|
+
for (let i = 0; i < 6; i++) {
|
|
11324
|
+
const pair = /^light-dark\((.*)\)$/is.exec(x);
|
|
11325
|
+
if (pair) {
|
|
11326
|
+
const halves = splitTop(pair[1], ',');
|
|
11327
|
+
if (halves.length === 2) x = halves[m === 'light' ? 0 : 1].trim();
|
|
11328
|
+
}
|
|
11329
|
+
const ref = /^var\(\s*(--[\w-]+)\s*(?:,[^)]*)?\)$/.exec(x)?.[1];
|
|
11330
|
+
if (!ref) break;
|
|
11331
|
+
x = String(
|
|
11332
|
+
own[t]?.[ref] ?? base.components?.[t]?.base?.[ref] ?? res[m][ref] ?? '',
|
|
11333
|
+
).trim();
|
|
11334
|
+
}
|
|
11335
|
+
return x;
|
|
11336
|
+
};
|
|
11337
|
+
/** The census value a part draws at rest for a property, or null. @param {string} t @param {string} prop */
|
|
11338
|
+
const atRest = (t, prop) => {
|
|
11339
|
+
const at = map[t]?.at?.[prop] ?? {};
|
|
11340
|
+
const k =
|
|
11341
|
+
Object.keys(at).find(x => !x.includes(' ') && !/variant=|=/.test(x)) ??
|
|
11342
|
+
Object.keys(at).find(x => !x.includes(' '));
|
|
11343
|
+
return k == null ? null : String(at[k]);
|
|
11344
|
+
};
|
|
11345
|
+
const surfaces = last('', /^surfaces$/)?.value ?? null;
|
|
11346
|
+
/** @type {ThemeProblem[]} */
|
|
11347
|
+
const out = [];
|
|
11348
|
+
for (const t of FLOATING_PANELS) {
|
|
11349
|
+
if (!ctx.project.target.has(t) || !map[t]) continue;
|
|
11350
|
+
// Its edge as the theme draws it: a border or a shadow of its own, the
|
|
11351
|
+
// surfaces dial's, else Core's (and the base theme's) at rest.
|
|
11352
|
+
const borderSet = last(t, /^border(-style|-width)?$/);
|
|
11353
|
+
const border = borderSet
|
|
11354
|
+
? !/(^|\s)(none|hidden)(\s|$)|^0(px)?(\s|$)/.test(String(borderSet.value))
|
|
11355
|
+
: surfaces
|
|
11356
|
+
? ['outlined', 'glass', 'flat'].includes(String(surfaces))
|
|
11357
|
+
: (() => {
|
|
11358
|
+
const style =
|
|
11359
|
+
base.components?.[t]?.base?.borderStyle ??
|
|
11360
|
+
atRest(t, 'border-style');
|
|
11361
|
+
const width =
|
|
11362
|
+
base.components?.[t]?.base?.borderWidth ??
|
|
11363
|
+
atRest(t, 'border-width');
|
|
11364
|
+
return (
|
|
11365
|
+
Boolean(style) &&
|
|
11366
|
+
!/none|hidden/.test(String(style)) &&
|
|
11367
|
+
!/^0(px)?$/.test(String(width ?? '1px').trim())
|
|
11368
|
+
);
|
|
11369
|
+
})();
|
|
11370
|
+
if (border) continue;
|
|
11371
|
+
for (const m of modesOf(data)) {
|
|
11372
|
+
const mode = /** @type {'light' | 'dark'} */ (m);
|
|
11373
|
+
const shadowSet = last(t, /^box-shadow$/, mode);
|
|
11374
|
+
const shadowValue = shadowSet
|
|
11375
|
+
? String(shadowSet.value)
|
|
11376
|
+
: surfaces && ['raised', 'glass'].includes(String(surfaces))
|
|
11377
|
+
? 'shadow'
|
|
11378
|
+
: surfaces
|
|
11379
|
+
? 'none'
|
|
11380
|
+
: String(
|
|
11381
|
+
base.components?.[t]?.base?.boxShadow ??
|
|
11382
|
+
atRest(t, 'box-shadow') ??
|
|
11383
|
+
'none',
|
|
11384
|
+
);
|
|
11385
|
+
const shadow =
|
|
11386
|
+
shadowValue === 'shadow' ||
|
|
11387
|
+
!/^\s*(none|0 0 transparent)?\s*$/.test(read(shadowValue, t, mode));
|
|
11388
|
+
if (shadow) continue;
|
|
11389
|
+
const fillSet = last(t, /^background(-color)?$/, mode);
|
|
11390
|
+
const fillValue = fillSet
|
|
11391
|
+
? String(fillSet.value)
|
|
11392
|
+
: String(
|
|
11393
|
+
base.components?.[t]?.base?.backgroundColor ??
|
|
11394
|
+
atRest(t, 'background-color') ??
|
|
11395
|
+
'',
|
|
11396
|
+
);
|
|
11397
|
+
const fill = parseColor(read(fillValue, t, mode));
|
|
11398
|
+
const page = parseColor(String(res[mode]['--color-background-body']));
|
|
11399
|
+
if (!fill || !page || alphaOf(read(fillValue, t, mode)) < 1) continue;
|
|
11400
|
+
const r = ratio(fill, page);
|
|
11401
|
+
if (r >= FLOATING_SHOWS) continue;
|
|
11402
|
+
out.push({
|
|
11403
|
+
key: `floating|${t}|${mode}`,
|
|
11404
|
+
text: `the ${t} (${hex(fill)}) is ${r.toFixed(2)}:1 on the page (${hex(page)}) in ${mode}, with no border or shadow: a panel floating over the page has no edge to be seen by`,
|
|
11405
|
+
fix: `${P} set ${data.name} border '1px solid var(--color-border)' --on ${t}`,
|
|
11406
|
+
});
|
|
11407
|
+
break;
|
|
11408
|
+
}
|
|
11409
|
+
}
|
|
11410
|
+
return out;
|
|
11411
|
+
}
|
|
11412
|
+
|
|
11413
|
+
/**
|
|
11414
|
+
* Below this contrast with the page, a floating panel with no border or
|
|
11415
|
+
* shadow reads as the page itself.
|
|
11416
|
+
*/
|
|
11417
|
+
const FLOATING_SHOWS = 1.1;
|
|
11418
|
+
|
|
10548
11419
|
/**
|
|
10549
11420
|
* A button color the theme sets that also paints the buttons Core draws
|
|
10550
11421
|
* inside a toast (its close button, an icon in a ghost button): measured on
|
|
@@ -10712,6 +11583,234 @@ function leakedButtonProblems(ctx, data, res) {
|
|
|
10712
11583
|
return [...out.values()];
|
|
10713
11584
|
}
|
|
10714
11585
|
|
|
11586
|
+
/**
|
|
11587
|
+
* The peak opacity Core's loading placeholder pulses to (Skeleton climbs
|
|
11588
|
+
* from 0.25 to 0.925), and the contrast under which a placeholder at that
|
|
11589
|
+
* peak cannot be told from what it sits on.
|
|
11590
|
+
*/
|
|
11591
|
+
const PLACEHOLDER_PEAK = 0.925;
|
|
11592
|
+
const PLACEHOLDER_SHOWS = 1.2;
|
|
11593
|
+
|
|
11594
|
+
/**
|
|
11595
|
+
* Whether a check is a note rather than a problem: what could not be
|
|
11596
|
+
* measured, a failure the base theme draws itself (no line of the theme's
|
|
11597
|
+
* makes it, and the base's own fix is its maker's), or a look worth a word
|
|
11598
|
+
* that fails nothing (a check marked `note`).
|
|
11599
|
+
* @param {{text: string, note?: boolean}} x
|
|
11600
|
+
*/
|
|
11601
|
+
export function isCheckNote(x) {
|
|
11602
|
+
return (
|
|
11603
|
+
Boolean(x.note) ||
|
|
11604
|
+
x.text.startsWith('not checked') ||
|
|
11605
|
+
x.text.startsWith("the base theme's ")
|
|
11606
|
+
);
|
|
11607
|
+
}
|
|
11608
|
+
|
|
11609
|
+
/**
|
|
11610
|
+
* How close two button fills may look before a person cannot tell them
|
|
11611
|
+
* apart at a glance: their OKLab distance.
|
|
11612
|
+
*/
|
|
11613
|
+
const LOOKS_ALIKE = 0.1;
|
|
11614
|
+
|
|
11615
|
+
/**
|
|
11616
|
+
* Loading placeholders (the parts that paint --color-skeleton) a person
|
|
11617
|
+
* cannot see: under {@link PLACEHOLDER_SHOWS}:1 against the page or a
|
|
11618
|
+
* card's surface at their pulse's peak, in a mode. A problem where the
|
|
11619
|
+
* theme's own colors make it so, with the nearest placeholder color that
|
|
11620
|
+
* shows on both; a note where the base theme draws it so itself.
|
|
11621
|
+
* @param {Ctx} ctx
|
|
11622
|
+
* @param {ThemeData} data
|
|
11623
|
+
* @param {{light: Record<string, string>, dark: Record<string, string>}} res
|
|
11624
|
+
* @param {{light: Record<string, string>, dark: Record<string, string>}} base
|
|
11625
|
+
* @returns {ThemeProblem[]}
|
|
11626
|
+
*/
|
|
11627
|
+
function placeholderProblems(ctx, data, res, base) {
|
|
11628
|
+
const TOKEN = '--color-skeleton';
|
|
11629
|
+
const parts = Object.keys(ctx.C.MAP).filter(t =>
|
|
11630
|
+
(ctx.C.partReads(t, 'background') ?? []).some(r => r.token === TOKEN),
|
|
11631
|
+
);
|
|
11632
|
+
if (!parts.length) return [];
|
|
11633
|
+
const modes = modesOf(data);
|
|
11634
|
+
/** @type {ThemeProblem[]} */
|
|
11635
|
+
const out = [];
|
|
11636
|
+
for (const m0 of modes) {
|
|
11637
|
+
const m = /** @type {'light' | 'dark'} */ (m0);
|
|
11638
|
+
const v = String(res[m][TOKEN] ?? '');
|
|
11639
|
+
const c0 = parseColor(v);
|
|
11640
|
+
const page = parseColor(String(res[m]['--color-background-body'] ?? ''));
|
|
11641
|
+
const surface = parseColor(
|
|
11642
|
+
String(res[m]['--color-background-surface'] ?? ''),
|
|
11643
|
+
);
|
|
11644
|
+
if (!c0 || !page) continue;
|
|
11645
|
+
const grounds = /** @type {Array<[number, number, number]>} */ (
|
|
11646
|
+
[page, surface].filter(Boolean)
|
|
11647
|
+
);
|
|
11648
|
+
const a = alphaOf(v) * PLACEHOLDER_PEAK;
|
|
11649
|
+
/** @param {[number, number, number]} c */
|
|
11650
|
+
const worst = c =>
|
|
11651
|
+
Math.min(...grounds.map(g => ratio(compositeOver(c, a, g), g)));
|
|
11652
|
+
const r = worst(c0);
|
|
11653
|
+
if (r >= PLACEHOLDER_SHOWS) continue;
|
|
11654
|
+
const same = [
|
|
11655
|
+
TOKEN,
|
|
11656
|
+
'--color-background-body',
|
|
11657
|
+
'--color-background-surface',
|
|
11658
|
+
].every(k => String(res[m][k]) === String(base[m]?.[k]));
|
|
11659
|
+
const what = `the loading placeholder (${parts.slice(0, 3).join(', ')}, ${TOKEN} ${v}) is ${r.toFixed(2)}:1 on the page${surface ? ' or a surface' : ''} in ${m} at its brightest`;
|
|
11660
|
+
if (same) {
|
|
11661
|
+
out.push({
|
|
11662
|
+
key: `placeholder|base|${m}`,
|
|
11663
|
+
text: `the base theme's ${what.slice(4)}, so it barely shows; the base theme draws it so`,
|
|
11664
|
+
fix: null,
|
|
11665
|
+
});
|
|
11666
|
+
continue;
|
|
11667
|
+
}
|
|
11668
|
+
// The theme's own gray nearest the placeholder's color that shows on
|
|
11669
|
+
// the page and the surface at the peak; else the nearest shade of the
|
|
11670
|
+
// placeholder's own color, darker or lighter (whichever stands out on
|
|
11671
|
+
// the page), with its hue and colorfulness kept.
|
|
11672
|
+
const lab = (/** @type {string} */ x) => oklabCoordinates(x);
|
|
11673
|
+
const [l0, ca, cb] = lab(hex(c0));
|
|
11674
|
+
const grays = Object.values(
|
|
11675
|
+
familyRamp(ctx.project.cwd, data.name, data, base, 'neutral')?.[m] ?? {},
|
|
11676
|
+
)
|
|
11677
|
+
.filter(x => parseColor(String(x)))
|
|
11678
|
+
.map(x => {
|
|
11679
|
+
const [l, a1, b1] = lab(String(x));
|
|
11680
|
+
return {x: String(x), d: Math.hypot(l - l0, a1 - ca, b1 - cb)};
|
|
11681
|
+
})
|
|
11682
|
+
.sort((p, q) => p.d - q.d);
|
|
11683
|
+
let fix = /** @type {string | null} */ (
|
|
11684
|
+
grays.find(
|
|
11685
|
+
g =>
|
|
11686
|
+
worst(/** @type {[number, number, number]} */ (parseColor(g.x))) >=
|
|
11687
|
+
PLACEHOLDER_SHOWS,
|
|
11688
|
+
)?.x ?? null
|
|
11689
|
+
);
|
|
11690
|
+
const away = plainOn(page) === '#000000' ? -1 : 1;
|
|
11691
|
+
for (let i = 1; i <= 100 && !fix; i++) {
|
|
11692
|
+
const shade = oklabCoordinatesToHex([
|
|
11693
|
+
Math.max(0, Math.min(1, l0 + (away * i) / 200)),
|
|
11694
|
+
ca,
|
|
11695
|
+
cb,
|
|
11696
|
+
]);
|
|
11697
|
+
const c = /** @type {[number, number, number]} */ (parseColor(shade));
|
|
11698
|
+
if (worst(c) >= PLACEHOLDER_SHOWS) fix = shade;
|
|
11699
|
+
}
|
|
11700
|
+
out.push({
|
|
11701
|
+
key: `placeholder|${m}`,
|
|
11702
|
+
text: `${what}; a placeholder needs ${PLACEHOLDER_SHOWS}:1 to show`,
|
|
11703
|
+
fix: fix
|
|
11704
|
+
? `${P} set ${data.name} ${TOKEN} '${fix}'${modes.length > 1 ? ` --mode ${m}` : ''}`
|
|
11705
|
+
: null,
|
|
11706
|
+
});
|
|
11707
|
+
}
|
|
11708
|
+
return out;
|
|
11709
|
+
}
|
|
11710
|
+
|
|
11711
|
+
/**
|
|
11712
|
+
* Text contrast for the primary button the button style draws (`buttons
|
|
11713
|
+
* soft`: the accent's muted fill with accent text; `outline`: no fill, so
|
|
11714
|
+
* its accent text sits on the page and on a card's surface), in each mode.
|
|
11715
|
+
* A later color or fill setting on the primary button wins over the
|
|
11716
|
+
* style's, in the order the settings come. Below 4.5:1 is a problem, fixed
|
|
11717
|
+
* with the nearest color that reads on every ground it sits on there.
|
|
11718
|
+
* @param {Ctx} ctx
|
|
11719
|
+
* @param {ThemeData} data
|
|
11720
|
+
* @param {{light: Record<string, string>, dark: Record<string, string>}} res
|
|
11721
|
+
* @returns {ThemeProblem[]}
|
|
11722
|
+
*/
|
|
11723
|
+
function buttonStyleProblems(ctx, data, res) {
|
|
11724
|
+
let at = -1;
|
|
11725
|
+
data.settings.forEach((x, i) => {
|
|
11726
|
+
if (x.source === 'dial' && x.thing === 'buttons' && !x.on) at = i;
|
|
11727
|
+
});
|
|
11728
|
+
const style = at >= 0 ? data.settings[at] : null;
|
|
11729
|
+
if (!style || !['soft', 'outline'].includes(String(style.value))) return [];
|
|
11730
|
+
const modes = modesOf(data);
|
|
11731
|
+
const modeFlag = (/** @type {string} */ m) =>
|
|
11732
|
+
modes.length > 1 ? ` --mode ${m}` : '';
|
|
11733
|
+
/** A value as one color in a mode. @param {unknown} v @param {'light' | 'dark'} m */
|
|
11734
|
+
const inMode = (v, m) => {
|
|
11735
|
+
let x = String(v ?? '').trim();
|
|
11736
|
+
for (let i = 0; i < 4; i++) {
|
|
11737
|
+
const pair = /^light-dark\((.*)\)$/is.exec(x);
|
|
11738
|
+
if (pair) {
|
|
11739
|
+
const halves = splitTop(pair[1], ',');
|
|
11740
|
+
if (halves.length === 2) x = halves[m === 'light' ? 0 : 1].trim();
|
|
11741
|
+
}
|
|
11742
|
+
const ref = /^var\(\s*(--[\w-]+)\s*(?:,[^)]*)?\)$/.exec(x);
|
|
11743
|
+
if (!ref) break;
|
|
11744
|
+
x = String(res[m][ref[1]] ?? '');
|
|
11745
|
+
}
|
|
11746
|
+
return x;
|
|
11747
|
+
};
|
|
11748
|
+
const drawn =
|
|
11749
|
+
style.value === 'soft'
|
|
11750
|
+
? {fill: 'var(--color-accent-muted)', color: 'var(--color-text-accent)'}
|
|
11751
|
+
: {fill: 'transparent', color: 'var(--color-text-accent)'};
|
|
11752
|
+
/**
|
|
11753
|
+
* The setting of a property that wins on the primary button, in a mode:
|
|
11754
|
+
* an exact property on the primary variant's own rule, set before the
|
|
11755
|
+
* style or after (an exact property wins over a dial on the same rule);
|
|
11756
|
+
* else a later one on the plain rule.
|
|
11757
|
+
* @param {RegExp} thing @param {string} m
|
|
11758
|
+
*/
|
|
11759
|
+
const later = (thing, m) => {
|
|
11760
|
+
/** @param {import('./_settings.mjs').Setting} y */
|
|
11761
|
+
const fits = y =>
|
|
11762
|
+
y.source === 'property' &&
|
|
11763
|
+
thing.test(y.thing) &&
|
|
11764
|
+
!y.state &&
|
|
11765
|
+
(!y.mode || y.mode === m) &&
|
|
11766
|
+
!!y.on &&
|
|
11767
|
+
partsOf(ctx, y).includes('button');
|
|
11768
|
+
return (
|
|
11769
|
+
[...data.settings]
|
|
11770
|
+
.reverse()
|
|
11771
|
+
.find(y => fits(y) && y.when === 'variant:primary') ??
|
|
11772
|
+
[...data.settings.slice(at + 1)]
|
|
11773
|
+
.reverse()
|
|
11774
|
+
.find(y => fits(y) && !y.when) ??
|
|
11775
|
+
null
|
|
11776
|
+
);
|
|
11777
|
+
};
|
|
11778
|
+
/** @type {ThemeProblem[]} */
|
|
11779
|
+
const out = [];
|
|
11780
|
+
for (const m0 of modes) {
|
|
11781
|
+
const m = /** @type {'light' | 'dark'} */ (m0);
|
|
11782
|
+
const page = parseColor(String(res[m]['--color-background-body']));
|
|
11783
|
+
if (!page) continue;
|
|
11784
|
+
const fillSet = later(/^background(-color)?$/, m);
|
|
11785
|
+
const colorSet = later(/^color$/, m);
|
|
11786
|
+
const fillValue = inMode(fillSet ? fillSet.value : drawn.fill, m);
|
|
11787
|
+
const textValue = inMode(colorSet ? colorSet.value : drawn.color, m);
|
|
11788
|
+
if (/gradient\(|url\(/.test(`${fillValue}${textValue}`)) continue;
|
|
11789
|
+
const surface = parseColor(
|
|
11790
|
+
String(res[m]['--color-background-surface'] ?? ''),
|
|
11791
|
+
);
|
|
11792
|
+
const under = /** @type {Array<[number, number, number]>} */ (
|
|
11793
|
+
[page, surface].filter(Boolean)
|
|
11794
|
+
);
|
|
11795
|
+
const f0 = parseColor(fillValue);
|
|
11796
|
+
const a = f0 ? alphaOf(fillValue) : 0;
|
|
11797
|
+
const grounds = under.map(u => (f0 && a > 0 ? compositeOver(f0, a, u) : u));
|
|
11798
|
+
const fg0 = parseColor(textValue);
|
|
11799
|
+
if (!fg0 || !grounds.length) continue;
|
|
11800
|
+
const worst = grounds
|
|
11801
|
+
.map(g => ({g, r: ratio(compositeOver(fg0, alphaOf(textValue), g), g)}))
|
|
11802
|
+
.sort((x, y) => x.r - y.r)[0];
|
|
11803
|
+
if (worst.r >= 4.5) continue;
|
|
11804
|
+
const fg = compositeOver(fg0, alphaOf(textValue), worst.g);
|
|
11805
|
+
out.push({
|
|
11806
|
+
key: `button-style|${style.value}|${m}`,
|
|
11807
|
+
text: `text in button (variant primary, buttons ${style.value}) is ${worst.r.toFixed(2)}:1 in ${m} (${textValue} on ${fillValue === 'transparent' ? 'the page and surface' : fillValue}); text needs 4.5:1`,
|
|
11808
|
+
fix: `${P} set ${data.name} color '${nearestReading(fg, grounds, 4.5)}' --on button --when variant:primary${modeFlag(m)}`,
|
|
11809
|
+
});
|
|
11810
|
+
}
|
|
11811
|
+
return out;
|
|
11812
|
+
}
|
|
11813
|
+
|
|
10715
11814
|
/**
|
|
10716
11815
|
* Text contrast for a part in one state or condition the theme styles on
|
|
10717
11816
|
* its own (a selected row's fill, an info banner's fill, a selected nav
|
|
@@ -11526,6 +12625,23 @@ export function stateKey(state, wrapsControl = false) {
|
|
|
11526
12625
|
* button): set names each as a state, and the build writes it as the
|
|
11527
12626
|
* attribute.
|
|
11528
12627
|
*/
|
|
12628
|
+
/**
|
|
12629
|
+
* The states a pointer or the keyboard puts a part in for a moment (hover,
|
|
12630
|
+
* focus, a press), as against the conditions a part holds (checked,
|
|
12631
|
+
* selected, disabled, invalid, open). Two moment states said together
|
|
12632
|
+
* ("hovered and pressed buttons") are each one; a list with a condition in
|
|
12633
|
+
* it ("the checked and disabled checkboxes") is the part in all of them at
|
|
12634
|
+
* once.
|
|
12635
|
+
*/
|
|
12636
|
+
export const MOMENT_STATES = [
|
|
12637
|
+
'hover',
|
|
12638
|
+
'focus',
|
|
12639
|
+
'focus-visible',
|
|
12640
|
+
'focus-within',
|
|
12641
|
+
'active',
|
|
12642
|
+
'pressed',
|
|
12643
|
+
];
|
|
12644
|
+
|
|
11529
12645
|
export const ARIA_STATES = {
|
|
11530
12646
|
current: {
|
|
11531
12647
|
attr: 'aria-current',
|
|
@@ -11654,7 +12770,10 @@ export function readSavedStates(ctx, data) {
|
|
|
11654
12770
|
for (const s of data.settings ?? []) {
|
|
11655
12771
|
const read = savedStateRead(ctx, s);
|
|
11656
12772
|
const was = SAVED_STATE.get(s) ?? s?.state;
|
|
12773
|
+
// (A state the loader put in its words, `selected + hover`, is noted
|
|
12774
|
+
// here too, with its spelling as saved.)
|
|
11657
12775
|
if (!read || (read === s.state && was === s.state)) continue;
|
|
12776
|
+
if (!LOADED_STATE.has(s)) LOADED_STATE.set(s, String(s.state));
|
|
11658
12777
|
ENTRY_NOTES.get(data)?.push(
|
|
11659
12778
|
`${s.thing} on ${s.on} was saved with state ${JSON.stringify(was)}, read as ${read}`,
|
|
11660
12779
|
);
|
|
@@ -11662,6 +12781,31 @@ export function readSavedStates(ctx, data) {
|
|
|
11662
12781
|
}
|
|
11663
12782
|
}
|
|
11664
12783
|
|
|
12784
|
+
/**
|
|
12785
|
+
* The state an entry had as the theme was loaded, before readSavedStates
|
|
12786
|
+
* read it as the part's own; the stamp of a build is the settings as loaded,
|
|
12787
|
+
* so a build that only reads them (show) matches the file it read, and a
|
|
12788
|
+
* change that writes them forgets it (commitTheme), as the file then holds
|
|
12789
|
+
* the part's spelling.
|
|
12790
|
+
* @type {WeakMap<object, string>}
|
|
12791
|
+
*/
|
|
12792
|
+
const LOADED_STATE = new WeakMap();
|
|
12793
|
+
|
|
12794
|
+
/**
|
|
12795
|
+
* The settings as they were loaded: each state readSavedStates read put
|
|
12796
|
+
* back as the loader read it.
|
|
12797
|
+
* @param {ThemeData} data
|
|
12798
|
+
* @returns {ThemeData}
|
|
12799
|
+
*/
|
|
12800
|
+
function loadedForm(data) {
|
|
12801
|
+
return {
|
|
12802
|
+
...data,
|
|
12803
|
+
settings: data.settings.map(s =>
|
|
12804
|
+
LOADED_STATE.has(s) ? {...s, state: LOADED_STATE.get(s)} : s,
|
|
12805
|
+
),
|
|
12806
|
+
};
|
|
12807
|
+
}
|
|
12808
|
+
|
|
11665
12809
|
/**
|
|
11666
12810
|
* Where a setting's state goes in the built theme: the style key (its
|
|
11667
12811
|
* variant and every state Core writes as a key of its own, `checked+disabled`)
|
|
@@ -11853,6 +12997,10 @@ export function radiusAt(base, value, token) {
|
|
|
11853
12997
|
const atPill = Math.max(32, 1.5 * roundPx * ratio(token, 2.5));
|
|
11854
12998
|
return Math.round(pill ? atPill : Math.min(atPill, px * ratio(token, 2.5)));
|
|
11855
12999
|
}
|
|
13000
|
+
// Chat surfaces are on the container step (Core's chat radius defaults to
|
|
13001
|
+
// the container radius): the container radius at this value.
|
|
13002
|
+
if (token === '--radius-chat')
|
|
13003
|
+
return radiusAt(base, value, '--radius-container');
|
|
11856
13004
|
return pill ? 9999 : px;
|
|
11857
13005
|
}
|
|
11858
13006
|
|
|
@@ -12203,7 +13351,7 @@ export function refuseLinks(cwd, slug) {
|
|
|
12203
13351
|
export function settingsStamp(data) {
|
|
12204
13352
|
// The settings as the file keeps them, so the stamp of a build matches
|
|
12205
13353
|
// the file it was built from.
|
|
12206
|
-
const saved = savedForm(data);
|
|
13354
|
+
const saved = savedForm(loadedForm(data));
|
|
12207
13355
|
const hash = createHash('sha256')
|
|
12208
13356
|
.update(
|
|
12209
13357
|
JSON.stringify({
|
|
@@ -12487,6 +13635,78 @@ export function readHistory(file) {
|
|
|
12487
13635
|
};
|
|
12488
13636
|
}
|
|
12489
13637
|
|
|
13638
|
+
/**
|
|
13639
|
+
* The custom properties a built stylesheet sets on its parts, by rule: the
|
|
13640
|
+
* selector and the property, with the value. The theme's own scope
|
|
13641
|
+
* (`:scope`, `:root`) is left out: resolvedTokens reads it.
|
|
13642
|
+
* @param {string | null} css
|
|
13643
|
+
* @returns {Map<string, string>}
|
|
13644
|
+
*/
|
|
13645
|
+
function partTokenValues(css) {
|
|
13646
|
+
/** @type {Map<string, string>} */
|
|
13647
|
+
const out = new Map();
|
|
13648
|
+
if (!css) return out;
|
|
13649
|
+
try {
|
|
13650
|
+
postcss.parse(css).walkRules(rule => {
|
|
13651
|
+
if (/^(?::scope|:root|html\b)/.test(rule.selector.trim())) return;
|
|
13652
|
+
rule.each(node => {
|
|
13653
|
+
if (node.type === 'decl' && node.prop.startsWith('--'))
|
|
13654
|
+
out.set(`${rule.selector}\u0000${node.prop}`, node.value);
|
|
13655
|
+
});
|
|
13656
|
+
});
|
|
13657
|
+
} catch {
|
|
13658
|
+
// A stylesheet that does not parse lists no part token changes.
|
|
13659
|
+
}
|
|
13660
|
+
return out;
|
|
13661
|
+
}
|
|
13662
|
+
|
|
13663
|
+
/**
|
|
13664
|
+
* Each part token whose built value changed between two stylesheets, as a
|
|
13665
|
+
* changedTokens line: the property, the rule it is set on, and each mode
|
|
13666
|
+
* whose half moved (the theme's own mode first).
|
|
13667
|
+
* @param {string | null} before
|
|
13668
|
+
* @param {string | null} after
|
|
13669
|
+
* @param {Array<'light' | 'dark'>} modes the modes the theme has
|
|
13670
|
+
* @returns {string[]}
|
|
13671
|
+
*/
|
|
13672
|
+
function partTokenChanges(before, after, modes) {
|
|
13673
|
+
if (!before || !after) return [];
|
|
13674
|
+
const was = partTokenValues(before);
|
|
13675
|
+
const now = partTokenValues(after);
|
|
13676
|
+
/** @param {string | undefined} v */
|
|
13677
|
+
const halves = v => {
|
|
13678
|
+
const m = /^light-dark\(([\s\S]*)\)$/i.exec(String(v ?? '').trim());
|
|
13679
|
+
const parts = m ? splitTop(m[1], ',').map(x => x.trim()) : null;
|
|
13680
|
+
return parts && parts.length === 2
|
|
13681
|
+
? {light: parts[0], dark: parts[1]}
|
|
13682
|
+
: {light: v, dark: v};
|
|
13683
|
+
};
|
|
13684
|
+
/** @type {Array<'light' | 'dark'>} */
|
|
13685
|
+
const order = modes.includes('light') ? ['light', 'dark'] : ['dark', 'light'];
|
|
13686
|
+
/** @type {string[]} */
|
|
13687
|
+
const out = [];
|
|
13688
|
+
for (const key of new Set([...was.keys(), ...now.keys()])) {
|
|
13689
|
+
const a = was.get(key);
|
|
13690
|
+
const b = now.get(key);
|
|
13691
|
+
if (String(a ?? '').toLowerCase() === String(b ?? '').toLowerCase())
|
|
13692
|
+
continue;
|
|
13693
|
+
const [selector, prop] = key.split('\u0000');
|
|
13694
|
+
const where = selector.replace(/\.astryx-/g, '').replace(/\s+/g, ' ');
|
|
13695
|
+
const [ha, hb] = [halves(a), halves(b)];
|
|
13696
|
+
const sides = order.filter(
|
|
13697
|
+
m =>
|
|
13698
|
+
String(ha[m] ?? '').toLowerCase() !== String(hb[m] ?? '').toLowerCase(),
|
|
13699
|
+
);
|
|
13700
|
+
const one =
|
|
13701
|
+
sides.length === 2 && ha.light === ha.dark && hb.light === hb.dark;
|
|
13702
|
+
for (const m of one ? [order[0]] : sides)
|
|
13703
|
+
out.push(
|
|
13704
|
+
`${prop} on ${where}${one ? '' : ` (${m})`}: ${ha[m] ?? 'unset'} -> ${hb[m] ?? 'unset'}`,
|
|
13705
|
+
);
|
|
13706
|
+
}
|
|
13707
|
+
return out;
|
|
13708
|
+
}
|
|
13709
|
+
|
|
12490
13710
|
/**
|
|
12491
13711
|
* Write the settings, build, and on a failed build put back what was there.
|
|
12492
13712
|
* Returns what changed in the resolved tokens and the lifted keys that are
|
|
@@ -12508,6 +13728,9 @@ export async function commitTheme(
|
|
|
12508
13728
|
const f = themeFiles(cwd, slug);
|
|
12509
13729
|
refuseLinks(cwd, slug);
|
|
12510
13730
|
await refuseThemeSource(cwd, slug);
|
|
13731
|
+
// The settings are written as they are now read (a saved state in the
|
|
13732
|
+
// part's own spelling): the build is stamped with what is written.
|
|
13733
|
+
for (const s of data.settings) LOADED_STATE.delete(s);
|
|
12511
13734
|
const snapBefore = fs.existsSync(f.settings)
|
|
12512
13735
|
? fs.readFileSync(f.settings, 'utf8')
|
|
12513
13736
|
: null;
|
|
@@ -12543,6 +13766,7 @@ export async function commitTheme(
|
|
|
12543
13766
|
if (noop && fs.existsSync(f.js) && !stale)
|
|
12544
13767
|
return {
|
|
12545
13768
|
changed: [],
|
|
13769
|
+
changedParts: [],
|
|
12546
13770
|
res: {light: {}, dark: {}},
|
|
12547
13771
|
problems: [],
|
|
12548
13772
|
problemList: [],
|
|
@@ -12574,6 +13798,15 @@ export async function commitTheme(
|
|
|
12574
13798
|
notes.push(
|
|
12575
13799
|
`there was no last build (${path.basename(f.js)} is missing), so the token changes are not listed; the theme is built again`,
|
|
12576
13800
|
);
|
|
13801
|
+
/** The built stylesheet the change is measured against. */
|
|
13802
|
+
const cssNow = () => {
|
|
13803
|
+
try {
|
|
13804
|
+
return fs.readFileSync(f.css, 'utf8');
|
|
13805
|
+
} catch {
|
|
13806
|
+
return null;
|
|
13807
|
+
}
|
|
13808
|
+
};
|
|
13809
|
+
let cssBefore = snapBefore && !staleBefore ? cssNow() : null;
|
|
12577
13810
|
let resBefore =
|
|
12578
13811
|
snapBefore && fs.existsSync(f.js) && !staleBefore
|
|
12579
13812
|
? await resolvedTokens(ctx, slug).catch(() => {
|
|
@@ -12666,6 +13899,7 @@ export async function commitTheme(
|
|
|
12666
13899
|
// is measured against what they show.
|
|
12667
13900
|
if (staleBefore && saved) {
|
|
12668
13901
|
await buildTheme(ctx, slug, saved);
|
|
13902
|
+
cssBefore = cssNow();
|
|
12669
13903
|
resBefore = await resolvedTokens(ctx, slug).catch(() => {
|
|
12670
13904
|
notes.push(
|
|
12671
13905
|
`the last build (${path.basename(f.js)}) could not be read, so the token changes are not listed; the theme is built again`,
|
|
@@ -12819,6 +14053,8 @@ export async function commitTheme(
|
|
|
12819
14053
|
/** @type {string[]} */
|
|
12820
14054
|
const changed = [];
|
|
12821
14055
|
/** @type {string[]} */
|
|
14056
|
+
const changedParts = [];
|
|
14057
|
+
/** @type {string[]} */
|
|
12822
14058
|
let problems = [];
|
|
12823
14059
|
/** @type {ThemeProblem[]} */
|
|
12824
14060
|
let problemList = [];
|
|
@@ -12833,7 +14069,13 @@ export async function commitTheme(
|
|
|
12833
14069
|
String(a).toLowerCase() === String(b).toLowerCase();
|
|
12834
14070
|
// Both modes are compared: a theme that becomes one-mode changes what
|
|
12835
14071
|
// the other mode's visitors see, though it no longer has that mode.
|
|
12836
|
-
|
|
14072
|
+
// (The theme's own mode comes first: a dark-only theme lists its
|
|
14073
|
+
// dark changes before the light ones.)
|
|
14074
|
+
/** @type {Array<'light' | 'dark'>} */
|
|
14075
|
+
const order = modes.includes('light')
|
|
14076
|
+
? ['light', 'dark']
|
|
14077
|
+
: ['dark', 'light'];
|
|
14078
|
+
for (const m of order) {
|
|
12837
14079
|
const own = modes.includes(m);
|
|
12838
14080
|
for (const k of Object.keys(res[m])) {
|
|
12839
14081
|
// A change of letter case alone (#FFFFFF, #ffffff) is no change.
|
|
@@ -12856,12 +14098,13 @@ export async function commitTheme(
|
|
|
12856
14098
|
}
|
|
12857
14099
|
}
|
|
12858
14100
|
}
|
|
14101
|
+
// A token the built stylesheet sets on a part (a readable text color
|
|
14102
|
+
// on a selected row, a dropzone) moves with the dials too: each one
|
|
14103
|
+
// whose built value changed is listed, by its rule, in each mode.
|
|
14104
|
+
if (resBefore)
|
|
14105
|
+
changedParts.push(...partTokenChanges(cssBefore, cssNow(), modes));
|
|
12859
14106
|
const found = await contrastProblems(ctx, data, res);
|
|
12860
|
-
|
|
12861
|
-
notes.push(
|
|
12862
|
-
...found.filter(x => x.text.startsWith('not checked')).map(x => x.text),
|
|
12863
|
-
);
|
|
12864
|
-
problemList = found.filter(x => !x.text.startsWith('not checked'));
|
|
14107
|
+
problemList = found.filter(x => !isCheckNote(x));
|
|
12865
14108
|
problems = problemList.map(x => x.text);
|
|
12866
14109
|
// The problems this change made: the ones the settings before it did
|
|
12867
14110
|
// not have, measured the same way.
|
|
@@ -12872,11 +14115,24 @@ export async function commitTheme(
|
|
|
12872
14115
|
)
|
|
12873
14116
|
: new Set();
|
|
12874
14117
|
newProblems = problemList.filter(x => !had.has(x.key));
|
|
14118
|
+
// What cannot be measured is a note, not a problem; a failure the base
|
|
14119
|
+
// theme draws itself is said when this change brings it (show says it
|
|
14120
|
+
// every time), not after every change.
|
|
14121
|
+
notes.push(
|
|
14122
|
+
...found
|
|
14123
|
+
.filter(
|
|
14124
|
+
x =>
|
|
14125
|
+
isCheckNote(x) &&
|
|
14126
|
+
(x.text.startsWith('not checked') || !had.has(x.key)),
|
|
14127
|
+
)
|
|
14128
|
+
.map(x => x.text),
|
|
14129
|
+
);
|
|
12875
14130
|
} catch (e) {
|
|
12876
14131
|
ctx.unchecked ??= `checking it failed: ${e instanceof Error ? e.message : String(e)}`;
|
|
12877
14132
|
}
|
|
12878
14133
|
return {
|
|
12879
14134
|
changed,
|
|
14135
|
+
changedParts,
|
|
12880
14136
|
res,
|
|
12881
14137
|
problems,
|
|
12882
14138
|
problemList,
|
|
@@ -12885,6 +14141,10 @@ export async function commitTheme(
|
|
|
12885
14141
|
lifted: built.lifted.filter(x => !liftedBefore.has(x)),
|
|
12886
14142
|
notes,
|
|
12887
14143
|
unchanged: false,
|
|
14144
|
+
// The theme and its tokens before this change, for what a caller says
|
|
14145
|
+
// of the change against them.
|
|
14146
|
+
before,
|
|
14147
|
+
resBefore,
|
|
12888
14148
|
};
|
|
12889
14149
|
}
|
|
12890
14150
|
|