@astryxdesign/cli 0.7.18-canary.gfca8508 → 0.7.18
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 +185 -19
- package/README.md +19 -19
- package/api/component/_adapter.d.mts +2 -1
- package/api/component/_adapter.mjs +2 -1
- package/api/docs/_adapter.d.mts +6 -5
- package/api/docs/_adapter.mjs +36 -5
- package/api/doctor/_adapter.d.mts +6 -3
- package/api/doctor/_adapter.mjs +13 -5
- package/api/doctor/doctor.mjs +2 -2
- package/api/doctor/font-packages.d.mts +36 -0
- package/api/doctor/font-packages.mjs +124 -0
- package/api/doctor/theme-checks.mjs +110 -49
- package/api/experimental.d.mts +0 -2
- package/api/experimental.mjs +0 -12
- package/api/icon/_adapter.d.mts +1 -1
- package/api/icon/_adapter.mjs +1 -0
- package/api/icon/_authoring.mjs +17 -8
- package/api/icon/_default-look.mjs +15 -15
- package/api/icon/add/add.mjs +9 -4
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +1 -1
- package/api/icon/icon.type.d.mts +33 -33
- package/api/icon/icon.type.mjs +45 -45
- package/api/icon/iconAdd.doc.mjs +1 -1
- package/api/icon/iconNewSet.doc.mjs +3 -3
- package/api/icon/iconUse.doc.mjs +5 -5
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/icon/use/use.mjs +4 -4
- package/api/init/run/run.mjs +0 -1
- package/api/integration/add-helpers.mjs +1 -1
- package/api/render/_adapter.mjs +7 -1
- package/api/search/ORDERING.md +1 -1
- package/api/search/_candidate-score.mjs +20 -0
- package/api/search/_words.d.mts +8 -0
- package/api/search/_words.mjs +15 -0
- package/api/template/template.type.d.mts +2 -2
- package/api/template/template.type.mjs +2 -2
- package/api/theme/_adapter.mjs +19 -11
- package/api/theme/build/build.d.mts +19 -51
- package/api/theme/build/build.mjs +195 -189
- package/api/theme/build/font-warning.d.mts +19 -2
- package/api/theme/build/font-warning.mjs +46 -5
- package/api/theme/generateTonalPalette.doc.mjs +1 -1
- package/api/theme/palette/generate/derive-look.mjs +108 -37
- package/api/theme/palette/generate/mapping.mjs +2 -0
- package/api/theme/template/template.d.mts +0 -17
- package/api/theme/template/template.mjs +1 -42
- package/api/theme/theme.type.d.mts +5 -4
- package/api/theme/theme.type.mjs +5 -4
- package/api/theme/themePaletteGenerate.doc.mjs +1 -1
- package/api/theme/themeRemove.doc.mjs +1 -1
- package/assets/codemods/transforms/v0.7.0/preserve-bottom-sheet-content-padding.mjs +3 -1
- package/assets/component-list.generated.json +1 -1
- package/assets/discover/official-packages.json +26 -2
- package/assets/docs/author-a-theme.doc.mjs +6 -5
- package/assets/docs/browser-support.doc.mjs +1 -0
- package/assets/docs/icons.doc.mjs +8 -7
- package/assets/docs/motion.doc.mjs +46 -0
- package/assets/docs/theme.doc.dense.mjs +6 -17
- package/assets/docs/theme.doc.mjs +6 -16
- package/assets/docs/theme.doc.zh.mjs +6 -16
- package/assets/docs/tree/ci-and-containers.doc.mjs +1 -1
- package/assets/docs/tree/font-setup.doc.mjs +30 -0
- package/assets/docs/tree/icon-sets.doc.mjs +1 -1
- package/assets/docs/tree/template-icons.doc.mjs +3 -3
- package/assets/docs/tree/tokens-color.doc.mjs +5 -0
- package/assets/docs/tree/tokens.doc.mjs +4 -3
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/definitions/drag.doc.mjs +1 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +1 -1
- package/assets/templates/blocks/components/Card/SelectableCardElevated.tsx +20 -10
- package/assets/templates/blocks/components/Card/SelectableCardShowcase.doc.mjs +1 -1
- package/assets/templates/blocks/components/Card/SelectableCardShowcase.tsx +36 -16
- package/assets/templates/blocks/components/ChatComposerInput/ChatComposerInputMentionTrigger.tsx +6 -0
- package/assets/templates/blocks/components/ChatComposerInput/ChatComposerInputMultipleTriggers.tsx +6 -0
- package/assets/templates/blocks/components/Hooks/useIndicatorFocusRingHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Hooks/useIndicatorFocusRingHookUsage.tsx +63 -0
- package/assets/templates/blocks/components/Hooks/useLongPressHookUsage.doc.mjs +29 -0
- package/assets/templates/blocks/components/Hooks/useLongPressHookUsage.tsx +237 -0
- package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +10 -72
- package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.doc.mjs +1 -1
- package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.tsx +7 -7
- package/assets/templates/blocks/components/Table/TableCustomRowTable.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/TableCustomRowTable.tsx +96 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat-landing/page.tsx +4 -0
- package/assets/templates/pages/dashboard-scorecard/page.tsx +26 -7
- package/assets/templates/pages/editor/page.tsx +13 -3
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/butter/butterTheme.ts +12 -10
- package/assets/templates/themes/butter/icons.tsx +2 -0
- package/assets/templates/themes/chocolate/chocolateTheme.ts +1 -0
- package/assets/templates/themes/chocolate/icons.tsx +2 -0
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/gothic/gothicTheme.ts +1 -0
- package/assets/templates/themes/gothic/icons.tsx +2 -0
- package/assets/templates/themes/matcha/icons.tsx +2 -0
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/matcha/matchaTheme.ts +1 -0
- package/assets/templates/themes/neutral/icons.tsx +2 -0
- package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/neutral/neutralTheme.ts +1 -0
- package/assets/templates/themes/stone/icons.tsx +2 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/stone/stoneTheme.ts +1 -0
- package/assets/templates/themes/y2k/icons.tsx +2 -0
- package/assets/templates/themes/y2k/y2kTheme.ts +1 -0
- package/assets/theme.template.ts +9 -5
- package/authoring/config/parse.mjs +1 -1
- package/authoring/doctypes/base/type.ts +2 -3
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/icon-set/icon-names.mjs +1 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/authoring/integration/type.ts +1 -1
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/experimental/icon.mjs +7 -7
- package/clients/cli/commands/experimental/index.mjs +0 -5
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
- package/clients/cli/commands/experimental-icon-use.doc.mjs +4 -4
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental.doc.mjs +2 -6
- package/clients/cli/commands/template.mjs +1 -1
- package/clients/cli/commands/theme-build.doc.mjs +8 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -1
- package/clients/cli/commands/theme-remove.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +1 -11
- package/clients/cli/commands/theme.mjs +110 -475
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/index.mjs +4 -34
- package/clients/cli/lib/base-gate.mjs +2 -3
- package/clients/cli/lib/cli-error.mjs +8 -72
- package/clients/cli/lib/define-command.mjs +0 -19
- package/clients/cli/lib/json-shim.mjs +11 -633
- package/clients/cli/lib/manifest.mjs +0 -4
- package/clients/cli/lib/stray-option.mjs +1 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/color/css-color.mjs +2 -3
- package/foundation/discovery/app-layout.d.mts +13 -0
- package/foundation/discovery/app-layout.mjs +35 -0
- package/foundation/discovery/fixture-refs.d.mts +51 -0
- package/foundation/discovery/fixture-refs.mjs +351 -0
- package/foundation/discovery/icon-definition-discovery.mjs +1 -1
- package/foundation/discovery/icon-ranking.mjs +2 -2
- package/foundation/discovery/icon-set-checks.mjs +1 -1
- package/foundation/discovery/icon-set-discovery.mjs +1 -1
- package/foundation/discovery/icon-set-writer.d.mts +24 -7
- package/foundation/discovery/icon-set-writer.mjs +66 -22
- package/foundation/discovery/static-descriptor.d.mts +49 -0
- package/foundation/discovery/static-descriptor.mjs +548 -0
- package/foundation/discovery/template-adapter.d.mts +0 -47
- package/foundation/discovery/template-adapter.mjs +1 -333
- package/foundation/discovery/theme-discovery.d.mts +6 -47
- package/foundation/discovery/theme-discovery.mjs +15 -537
- package/foundation/doc-compiler/import.mjs +1 -1
- package/foundation/env/user-dirs.d.mts +5 -2
- package/foundation/env/user-dirs.mjs +12 -5
- package/foundation/fonts/next-font.d.mts +26 -0
- package/foundation/fonts/next-font.mjs +149 -0
- package/foundation/fs/empty-folder.mjs +2 -2
- package/foundation/fs/read-record.mjs +11 -4
- package/foundation/pictures/pictures.d.mts +1 -45
- package/foundation/pictures/pictures.mjs +8 -8
- package/foundation/release/folder-lock.mjs +3 -2
- package/foundation/render/cut-short.d.mts +2 -2
- package/foundation/render/cut-short.mjs +2 -2
- package/foundation/render/drawn-contrast.d.mts +2 -2
- package/foundation/render/drawn-contrast.mjs +2 -2
- package/foundation/render/font-probe.d.mts +2 -2
- package/foundation/render/font-probe.mjs +2 -2
- package/foundation/render/layers.mjs +1 -2
- package/foundation/render/package-resolve-hooks.d.mts +25 -5
- package/foundation/render/package-resolve-hooks.mjs +77 -14
- package/foundation/render/page-worker.mjs +24 -12
- package/foundation/render/part-boxes.d.mts +2 -3
- package/foundation/render/part-boxes.mjs +2 -3
- package/foundation/render/picture-chrome.mjs +5 -0
- package/foundation/render/render-page.d.mts +1 -1
- package/foundation/render/render-page.mjs +4 -5
- package/foundation/render/single-copy-hooks.d.mts +2 -0
- package/foundation/render/single-copy-hooks.mjs +2 -0
- package/foundation/response/error-codes.doc.mjs +14 -14
- package/foundation/response/error-codes.mjs +13 -13
- package/foundation/response/response-types.doc.mjs +7 -68
- package/foundation/runtime/css-tree.mjs +2 -2
- package/foundation/runtime/word-table.d.mts +1 -1
- package/foundation/runtime/word-table.mjs +1 -1
- package/foundation/suggest/other-command.d.mts +52 -15
- package/foundation/suggest/other-command.mjs +168 -45
- package/foundation/text/suggest-order.d.mts +7 -0
- package/foundation/text/suggest-order.mjs +1 -1
- package/package.json +7 -8
- package/api/theme-edit/_adapter.d.mts +0 -228
- package/api/theme-edit/_adapter.mjs +0 -2025
- package/api/theme-edit/_catalog.d.mts +0 -172
- package/api/theme-edit/_catalog.mjs +0 -806
- package/api/theme-edit/_check.d.mts +0 -391
- package/api/theme-edit/_check.mjs +0 -9370
- package/api/theme-edit/_color.d.mts +0 -135
- package/api/theme-edit/_color.mjs +0 -480
- package/api/theme-edit/_compiler.d.mts +0 -77
- package/api/theme-edit/_compiler.mjs +0 -1053
- package/api/theme-edit/_context.d.mts +0 -399
- package/api/theme-edit/_context.mjs +0 -1778
- package/api/theme-edit/_css.d.mts +0 -169
- package/api/theme-edit/_css.mjs +0 -1167
- package/api/theme-edit/_edit.d.mts +0 -167
- package/api/theme-edit/_edit.mjs +0 -11220
- package/api/theme-edit/_how-commands.d.mts +0 -315
- package/api/theme-edit/_how-commands.mjs +0 -1664
- package/api/theme-edit/_how-question.d.mts +0 -341
- package/api/theme-edit/_how-question.mjs +0 -33339
- package/api/theme-edit/_how-sides.d.mts +0 -22
- package/api/theme-edit/_how-sides.mjs +0 -173
- package/api/theme-edit/_how-steps.d.mts +0 -42
- package/api/theme-edit/_how-steps.mjs +0 -208
- package/api/theme-edit/_how-values.d.mts +0 -29
- package/api/theme-edit/_how-values.mjs +0 -111
- package/api/theme-edit/_how-words.d.mts +0 -15
- package/api/theme-edit/_how-words.mjs +0 -239
- package/api/theme-edit/_how.d.mts +0 -55
- package/api/theme-edit/_how.mjs +0 -2388
- package/api/theme-edit/_importers.d.mts +0 -38
- package/api/theme-edit/_importers.mjs +0 -188
- package/api/theme-edit/_marks.d.mts +0 -39
- package/api/theme-edit/_marks.mjs +0 -67
- package/api/theme-edit/_missed.d.mts +0 -56
- package/api/theme-edit/_missed.mjs +0 -1128
- package/api/theme-edit/_name-rule.d.mts +0 -11
- package/api/theme-edit/_name-rule.mjs +0 -12
- package/api/theme-edit/_normal.d.mts +0 -365
- package/api/theme-edit/_normal.mjs +0 -1978
- package/api/theme-edit/_overview.d.mts +0 -9
- package/api/theme-edit/_overview.mjs +0 -293
- package/api/theme-edit/_palette.d.mts +0 -616
- package/api/theme-edit/_palette.mjs +0 -2776
- package/api/theme-edit/_part-pieces.d.mts +0 -54
- package/api/theme-edit/_part-pieces.mjs +0 -179
- package/api/theme-edit/_part-words.d.mts +0 -39
- package/api/theme-edit/_part-words.mjs +0 -242
- package/api/theme-edit/_parts.d.mts +0 -402
- package/api/theme-edit/_parts.mjs +0 -2322
- package/api/theme-edit/_picture-traits.d.mts +0 -259
- package/api/theme-edit/_picture-traits.mjs +0 -1030
- package/api/theme-edit/_png.d.mts +0 -94
- package/api/theme-edit/_png.mjs +0 -479
- package/api/theme-edit/_preview-app.d.mts +0 -172
- package/api/theme-edit/_preview-app.mjs +0 -6430
- package/api/theme-edit/_preview.d.mts +0 -484
- package/api/theme-edit/_preview.mjs +0 -2775
- package/api/theme-edit/_project.d.mts +0 -207
- package/api/theme-edit/_project.mjs +0 -643
- package/api/theme-edit/_resolved.d.mts +0 -46
- package/api/theme-edit/_resolved.mjs +0 -800
- package/api/theme-edit/_set-line.d.mts +0 -29
- package/api/theme-edit/_set-line.mjs +0 -100
- package/api/theme-edit/_settings.d.mts +0 -2426
- package/api/theme-edit/_settings.mjs +0 -18449
- package/api/theme-edit/_tables.d.mts +0 -227
- package/api/theme-edit/_tables.mjs +0 -1128
- package/api/theme-edit/_text-looks.d.mts +0 -78
- package/api/theme-edit/_text-looks.mjs +0 -376
- package/api/theme-edit/_vet.d.mts +0 -50
- package/api/theme-edit/_vet.mjs +0 -166
- package/api/theme-edit/how/how.d.mts +0 -17
- package/api/theme-edit/how/how.mjs +0 -28
- package/api/theme-edit/new/new.d.mts +0 -11
- package/api/theme-edit/new/new.mjs +0 -22
- package/api/theme-edit/preview-add/preview-add.d.mts +0 -14
- package/api/theme-edit/preview-add/preview-add.mjs +0 -25
- package/api/theme-edit/preview-app/preview-app.d.mts +0 -13
- package/api/theme-edit/preview-app/preview-app.mjs +0 -24
- package/api/theme-edit/preview-list/preview-list.d.mts +0 -10
- package/api/theme-edit/preview-list/preview-list.mjs +0 -21
- package/api/theme-edit/preview-remove/preview-remove.d.mts +0 -12
- package/api/theme-edit/preview-remove/preview-remove.mjs +0 -23
- package/api/theme-edit/set/set.d.mts +0 -13
- package/api/theme-edit/set/set.mjs +0 -24
- package/api/theme-edit/show/show.d.mts +0 -13
- package/api/theme-edit/show/show.mjs +0 -24
- package/api/theme-edit/theme-edit.d.mts +0 -12
- package/api/theme-edit/theme-edit.mjs +0 -36
- package/api/theme-edit/theme-edit.type.d.mts +0 -730
- package/api/theme-edit/theme-edit.type.mjs +0 -342
- package/api/theme-edit/themeEditHow.doc.d.mts +0 -6
- package/api/theme-edit/themeEditHow.doc.mjs +0 -105
- package/api/theme-edit/themeEditNew.doc.d.mts +0 -5
- package/api/theme-edit/themeEditNew.doc.mjs +0 -112
- package/api/theme-edit/themeEditPreviewAdd.doc.d.mts +0 -6
- package/api/theme-edit/themeEditPreviewAdd.doc.mjs +0 -121
- package/api/theme-edit/themeEditPreviewApp.doc.d.mts +0 -6
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +0 -87
- package/api/theme-edit/themeEditPreviewList.doc.d.mts +0 -6
- package/api/theme-edit/themeEditPreviewList.doc.mjs +0 -62
- package/api/theme-edit/themeEditPreviewRemove.doc.d.mts +0 -6
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +0 -96
- package/api/theme-edit/themeEditSet.doc.d.mts +0 -6
- package/api/theme-edit/themeEditSet.doc.mjs +0 -175
- package/api/theme-edit/themeEditShow.doc.d.mts +0 -6
- package/api/theme-edit/themeEditShow.doc.mjs +0 -118
- package/api/theme-edit/themeEditUndo.doc.d.mts +0 -6
- package/api/theme-edit/themeEditUndo.doc.mjs +0 -133
- package/api/theme-edit/undo/undo.d.mts +0 -13
- package/api/theme-edit/undo/undo.mjs +0 -24
- package/assets/preview-app/README.md +0 -6
- package/assets/preview-app/css.d.ts +0 -5
- package/assets/preview-app/gitignore +0 -4
- package/assets/preview-app/next.config.mjs +0 -12
- package/assets/preview-app/package.json +0 -24
- package/assets/preview-app/src/app/globals.css +0 -6
- package/assets/preview-app/src/app/layout.tsx +0 -21
- package/assets/preview-app/src/app/page.tsx +0 -94
- package/assets/preview-app/src/app/providers.tsx +0 -16
- package/assets/preview-app/tsconfig.json +0 -27
- package/clients/cli/commands/experimental/theme.mjs +0 -2990
- package/clients/cli/commands/experimental-theme-add.doc.mjs +0 -80
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +0 -98
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +0 -196
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +0 -174
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +0 -139
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +0 -77
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +0 -105
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +0 -49
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +0 -72
- package/clients/cli/commands/experimental-theme-list.doc.mjs +0 -49
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +0 -88
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +0 -61
- package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +0 -48
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +0 -59
- package/clients/cli/commands/experimental-theme-preview.doc.mjs +0 -41
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +0 -57
- package/clients/cli/commands/experimental-theme-targets.doc.mjs +0 -62
- package/clients/cli/commands/experimental-theme-template.doc.mjs +0 -63
- package/clients/cli/commands/experimental-theme-use.doc.mjs +0 -57
- package/clients/cli/commands/experimental-theme.doc.mjs +0 -60
- package/foundation/fonts/fontsource-families.generated.d.mts +0 -5
- package/foundation/fonts/fontsource-families.generated.mjs +0 -2110
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Every value of a numbered look family a part draws ("display headings":
|
|
6
|
-
* display-1 to display-3): the values its prop takes, as its component's
|
|
7
|
-
* doc types them, and any more Core's data saw it drawn in. Sorted.
|
|
8
|
-
* @param {string} family the value without its number, "display"
|
|
9
|
-
* @param {string[]} typed the values the prop's documented type lists
|
|
10
|
-
* @param {string[]} drawn the values Core's data saw
|
|
11
|
-
* @returns {string[]}
|
|
12
|
-
*/
|
|
13
|
-
export function numberedLookValues(family: string, typed: string[], drawn: string[]): string[];
|
|
14
|
-
/**
|
|
15
|
-
* A clause on a plural family ("heavy display headings", and "make them
|
|
16
|
-
* blue" after it) is one answer: its drafts, one per look, become the
|
|
17
|
-
* first one, a sequence of each look's first option, in order, with
|
|
18
|
-
* repeated steps said once; the looks' other options (a whole-theme dial
|
|
19
|
-
* offered beside a look's own line) stay out of it, so it changes only the
|
|
20
|
-
* family. The text names each look. A size said for
|
|
21
|
-
* the family is the largest look's: the others scale by the steps between
|
|
22
|
-
* their sizes now (`sizeOf`), so the type scale keeps its shape.
|
|
23
|
-
* Changes `drafts` in place.
|
|
24
|
-
* @template {{text: string, options: object[][], sequence?: boolean}} D
|
|
25
|
-
* @template {{parts: Array<{on: string, when?: string}>, aspects?: string[], colors?: unknown[], lengths?: string[], mode?: string | null}} C
|
|
26
|
-
* @param {D[]} drafts
|
|
27
|
-
* @param {(d: D) => C | undefined} clauseOf
|
|
28
|
-
* @param {C[]} clauses
|
|
29
|
-
* @param {Array<{on: string, whens: string[]}>} families
|
|
30
|
-
* @param {(when: string, on: string) => number | null} sizeOf a look's size
|
|
31
|
-
* now on the family's part, in px
|
|
32
|
-
* @returns {Array<{clause: C, text: string}>} the clauses on a family no
|
|
33
|
-
* look of which writes anything and no draft holds, with what to say
|
|
34
|
-
*/
|
|
35
|
-
export function oneAnswerPerFamily<D extends {
|
|
36
|
-
text: string;
|
|
37
|
-
options: object[][];
|
|
38
|
-
sequence?: boolean;
|
|
39
|
-
}, C extends {
|
|
40
|
-
parts: Array<{
|
|
41
|
-
on: string;
|
|
42
|
-
when?: string;
|
|
43
|
-
}>;
|
|
44
|
-
aspects?: string[];
|
|
45
|
-
colors?: unknown[];
|
|
46
|
-
lengths?: string[];
|
|
47
|
-
mode?: string | null;
|
|
48
|
-
}>(drafts: D[], clauseOf: (d: D) => C | undefined, clauses: C[], families: Array<{
|
|
49
|
-
on: string;
|
|
50
|
-
whens: string[];
|
|
51
|
-
}>, sizeOf: (when: string, on: string) => number | null): Array<{
|
|
52
|
-
clause: C;
|
|
53
|
-
text: string;
|
|
54
|
-
}>;
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file A part's own looks and pieces, read from what Core documents about
|
|
5
|
-
* its components: the values of a numbered look ("display headings"), and
|
|
6
|
-
* one answer for a clause on that whole family.
|
|
7
|
-
* @position api/theme-edit — read by _how-question.mjs; reads lengths with
|
|
8
|
-
* _settings.mjs's lengthPx
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {lengthPx} from './_settings.mjs';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Every value of a numbered look family a part draws ("display headings":
|
|
15
|
-
* display-1 to display-3): the values its prop takes, as its component's
|
|
16
|
-
* doc types them, and any more Core's data saw it drawn in. Sorted.
|
|
17
|
-
* @param {string} family the value without its number, "display"
|
|
18
|
-
* @param {string[]} typed the values the prop's documented type lists
|
|
19
|
-
* @param {string[]} drawn the values Core's data saw
|
|
20
|
-
* @returns {string[]}
|
|
21
|
-
*/
|
|
22
|
-
export function numberedLookValues(family, typed, drawn) {
|
|
23
|
-
return [...new Set([...typed, ...drawn])]
|
|
24
|
-
.filter(v => v.startsWith(`${family}-`) && /-\d+$/.test(v))
|
|
25
|
-
.sort((a, b) => Number(/\d+$/.exec(a)?.[0]) - Number(/\d+$/.exec(b)?.[0]));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* A clause on a plural family ("heavy display headings", and "make them
|
|
30
|
-
* blue" after it) is one answer: its drafts, one per look, become the
|
|
31
|
-
* first one, a sequence of each look's first option, in order, with
|
|
32
|
-
* repeated steps said once; the looks' other options (a whole-theme dial
|
|
33
|
-
* offered beside a look's own line) stay out of it, so it changes only the
|
|
34
|
-
* family. The text names each look. A size said for
|
|
35
|
-
* the family is the largest look's: the others scale by the steps between
|
|
36
|
-
* their sizes now (`sizeOf`), so the type scale keeps its shape.
|
|
37
|
-
* Changes `drafts` in place.
|
|
38
|
-
* @template {{text: string, options: object[][], sequence?: boolean}} D
|
|
39
|
-
* @template {{parts: Array<{on: string, when?: string}>, aspects?: string[], colors?: unknown[], lengths?: string[], mode?: string | null}} C
|
|
40
|
-
* @param {D[]} drafts
|
|
41
|
-
* @param {(d: D) => C | undefined} clauseOf
|
|
42
|
-
* @param {C[]} clauses
|
|
43
|
-
* @param {Array<{on: string, whens: string[]}>} families
|
|
44
|
-
* @param {(when: string, on: string) => number | null} sizeOf a look's size
|
|
45
|
-
* now on the family's part, in px
|
|
46
|
-
* @returns {Array<{clause: C, text: string}>} the clauses on a family no
|
|
47
|
-
* look of which writes anything and no draft holds, with what to say
|
|
48
|
-
*/
|
|
49
|
-
export function oneAnswerPerFamily(drafts, clauseOf, clauses, families, sizeOf) {
|
|
50
|
-
/** @type {Array<{clause: C, text: string}>} */
|
|
51
|
-
const unanswered = [];
|
|
52
|
-
for (const c of clauses) {
|
|
53
|
-
const fam = families.find(
|
|
54
|
-
f => c.parts.filter(p => p.on === f.on && f.whens.includes(p.when ?? '')).length > 1,
|
|
55
|
-
);
|
|
56
|
-
if (!fam) continue;
|
|
57
|
-
// (Each draft's look, from its own lines; a look with no draft that
|
|
58
|
-
// writes anything, "bigger" from a clamp() size, is left out and said.)
|
|
59
|
-
const lookOf = (/** @type {D} */ d) =>
|
|
60
|
-
/** @type {any[]} */ (d.options[0] ?? []).find(st => fam.whens.includes(st?.when))?.when;
|
|
61
|
-
const kept = fam.whens.filter(w =>
|
|
62
|
-
drafts.some(d => clauseOf(d) === c && d.options.length && lookOf(d) === w),
|
|
63
|
-
);
|
|
64
|
-
const mine = kept.map(
|
|
65
|
-
w => /** @type {D} */ (drafts.find(d => clauseOf(d) === c && d.options.length && lookOf(d) === w)),
|
|
66
|
-
);
|
|
67
|
-
const level = (/** @type {string} */ w) => w.split(':')[1];
|
|
68
|
-
const left = fam.whens.filter(w => !kept.includes(w));
|
|
69
|
-
const noLength = left.every(w => !sizeOf(w, fam.on));
|
|
70
|
-
const leftNote = left.length
|
|
71
|
-
? `${left.map(level).join(', ')} not changed${noLength ? `: ${left.length > 1 ? 'their sizes are' : 'its size is'} no length now (a clamp() or calc() size), so no step can be taken from ${left.length > 1 ? 'them' : 'it'}` : ''}`
|
|
72
|
-
: '';
|
|
73
|
-
if (mine.length === 0) {
|
|
74
|
-
// (No look writes anything because none has a length size now: one
|
|
75
|
-
// answer names them all, never a "say it as a part and a look". The
|
|
76
|
-
// caller adds it for the clause. Any other ask no look takes keeps
|
|
77
|
-
// the usual answer.)
|
|
78
|
-
// (Only a step ask about size alone, "display headings bigger": a
|
|
79
|
-
// font, an alignment, a color, a size or a mode said with it keeps
|
|
80
|
-
// its own answers, and a draft that writes anything is never
|
|
81
|
-
// dropped.)
|
|
82
|
-
const sizeOnly =
|
|
83
|
-
(c.aspects ?? []).length > 0 &&
|
|
84
|
-
(c.aspects ?? []).every(a => a === 'fontsize') &&
|
|
85
|
-
!(c.colors ?? []).length &&
|
|
86
|
-
!(c.lengths ?? []).length &&
|
|
87
|
-
!c.mode;
|
|
88
|
-
const own = drafts.filter(d => clauseOf(d) === c);
|
|
89
|
-
if (!noLength || !sizeOnly || own.some(d => d.options.length)) continue;
|
|
90
|
-
const text = `${fam.whens.map(level).join(', ')} not changed: their sizes are no length now (a clamp() or calc() size), so no step can be taken from them; say a size for them instead ("${level(fam.whens[0]).replace(/-\d+$/, '')} headings 72px")`;
|
|
91
|
-
if (!own.length) unanswered.push({clause: c, text});
|
|
92
|
-
else {
|
|
93
|
-
own[0].text = text;
|
|
94
|
-
drafts.splice(
|
|
95
|
-
0,
|
|
96
|
-
drafts.length,
|
|
97
|
-
...drafts.filter(d => clauseOf(d) !== c || d === own[0]),
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
if (mine.length === 1) {
|
|
103
|
-
if (leftNote) mine[0].text += `; ${leftNote}`;
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
const [head, ...rest] = mine;
|
|
107
|
-
const scaled = scaleFamilySizes(mine, kept, w => sizeOf(w, fam.on));
|
|
108
|
-
const seen = new Set();
|
|
109
|
-
head.options = [
|
|
110
|
-
mine
|
|
111
|
-
.flatMap(d => d.options[0] ?? [])
|
|
112
|
-
.filter(st => !seen.has(JSON.stringify(st)) && seen.add(JSON.stringify(st))),
|
|
113
|
-
];
|
|
114
|
-
head.sequence = true;
|
|
115
|
-
const [attr] = kept[0].split(':');
|
|
116
|
-
head.text = head.text.replace(
|
|
117
|
-
`(${kept[0].replace(':', ' ')})`,
|
|
118
|
-
`(${attr} ${kept.map(level).join(', ')})`,
|
|
119
|
-
);
|
|
120
|
-
if (scaled) head.text += `; ${scaled}`;
|
|
121
|
-
if (leftNote) head.text += `; ${leftNote}`;
|
|
122
|
-
drafts.splice(0, drafts.length, ...drafts.filter(d => !rest.includes(d)));
|
|
123
|
-
}
|
|
124
|
-
return unanswered;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** A step's size in px, or null. @param {unknown} v */
|
|
128
|
-
const pxOf = v => lengthPx(String(v));
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* A size in px written in the unit of `like` (px, rem or em).
|
|
132
|
-
* @param {number} px
|
|
133
|
-
* @param {unknown} like
|
|
134
|
-
*/
|
|
135
|
-
const inUnitOf = (px, like) => {
|
|
136
|
-
const unit = /(rem|em)\s*$/i.exec(String(like))?.[1]?.toLowerCase();
|
|
137
|
-
return unit ? `${Number((px / 16).toFixed(3))}${unit}` : `${Math.round(px)}px`;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Scale the size steps of a family's drafts, one draft per look in the
|
|
142
|
-
* order of `whens`: the size said is the largest look's, and every other
|
|
143
|
-
* look's size is that size times the ratio of its size now to the largest
|
|
144
|
-
* look's size now, in the unit said. Says what it wrote, or that the steps
|
|
145
|
-
* cannot be kept when a look's size now is unknown; null when no size is
|
|
146
|
-
* said.
|
|
147
|
-
* @param {Array<{options: object[][]}>} drafts
|
|
148
|
-
* @param {string[]} whens
|
|
149
|
-
* @param {(when: string) => number | null} sizeOf
|
|
150
|
-
* @returns {string | null}
|
|
151
|
-
*/
|
|
152
|
-
function scaleFamilySizes(drafts, whens, sizeOf) {
|
|
153
|
-
const isSize = (/** @type {any} */ st) =>
|
|
154
|
-
(st.thing === 'font-size' || /^--text-[\w-]+-size$/.test(st.thing)) && pxOf(st.value) != null;
|
|
155
|
-
const now = whens.map(w => sizeOf(w));
|
|
156
|
-
if (!drafts.some(d => d.options.flat().some(isSize))) return null;
|
|
157
|
-
const level = (/** @type {string} */ w) => w.split(':')[1];
|
|
158
|
-
// (A look whose size now is no length, a clamp() or calc(), leaves the
|
|
159
|
-
// steps unknown: each look takes the size said, and the answer says so.)
|
|
160
|
-
const unknown = whens.filter((_, i) => !now[i]);
|
|
161
|
-
if (unknown.length)
|
|
162
|
-
return `each look takes the size said: the steps between them cannot be kept, since ${unknown
|
|
163
|
-
.map(level)
|
|
164
|
-
.join(', ')}'s size now is no length (a clamp() or calc() size)`;
|
|
165
|
-
const top = now.indexOf(Math.max(.../** @type {number[]} */ (now)));
|
|
166
|
-
const said = drafts[top]?.options.flat().find(isSize);
|
|
167
|
-
if (!said) return null;
|
|
168
|
-
const value = /** @type {any} */ (said).value;
|
|
169
|
-
const px = /** @type {number} */ (pxOf(value));
|
|
170
|
-
const sizes = now.map(n => (px * /** @type {number} */ (n)) / /** @type {number} */ (now[top]));
|
|
171
|
-
const written = sizes.map(v => inUnitOf(v, value));
|
|
172
|
-
drafts.forEach((d, i) => {
|
|
173
|
-
for (const o of d.options) for (const st of o) if (isSize(st)) /** @type {any} */ (st).value = written[i];
|
|
174
|
-
});
|
|
175
|
-
return `${level(whens[top])} ${written[top]}, the others scaled to keep the steps between them (${whens
|
|
176
|
-
.map((w, i) => (i === top ? '' : `${level(w)} ${written[i]}`))
|
|
177
|
-
.filter(Boolean)
|
|
178
|
-
.join(', ')})`;
|
|
179
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The part or group a plain word names, as how reads it (`checkboxes` is
|
|
6
|
-
* the checks group, `panels` the containers), or null.
|
|
7
|
-
* @param {string} word
|
|
8
|
-
* @returns {string | null}
|
|
9
|
-
*/
|
|
10
|
-
export function partForWord(word: string): string | null;
|
|
11
|
-
/**
|
|
12
|
-
* The single words the table reads as a part or group, each with what it
|
|
13
|
-
* names (`sidebar` side-nav, `checkbox` checks, `toggle` switch): the words
|
|
14
|
-
* a part's typo is read against beside the part names. Taken from the
|
|
15
|
-
* table's own words, a plural's singular (`toggles?`) included.
|
|
16
|
-
* @returns {Map<string, string>}
|
|
17
|
-
*/
|
|
18
|
-
export function partWords(): Map<string, string>;
|
|
19
|
-
/**
|
|
20
|
-
* @file The plain words for parts that Core's catalog cannot give (groups,
|
|
21
|
-
* variants, font roles, phrases of several words, and words two components
|
|
22
|
-
* share), and the part or group one plain word names.
|
|
23
|
-
* @position api/theme-edit — a leaf with no imports, read by _how-question.mjs
|
|
24
|
-
* and _check.mjs
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Phrases for parts that Core's catalog cannot give: groups, variants,
|
|
28
|
-
* font roles, phrases of several words, and words two components share.
|
|
29
|
-
* They are read before the catalog's names and doc keywords
|
|
30
|
-
* (partLexicon), longest phrase first.
|
|
31
|
-
* @type {Array<[RegExp, {on: string, when?: string, role?: string, level?: string, missing?: string}]>}
|
|
32
|
-
*/
|
|
33
|
-
export const OVERRIDES: Array<[RegExp, {
|
|
34
|
-
on: string;
|
|
35
|
-
when?: string;
|
|
36
|
-
role?: string;
|
|
37
|
-
level?: string;
|
|
38
|
-
missing?: string;
|
|
39
|
-
}]>;
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file The plain words for parts that Core's catalog cannot give (groups,
|
|
5
|
-
* variants, font roles, phrases of several words, and words two components
|
|
6
|
-
* share), and the part or group one plain word names.
|
|
7
|
-
* @position api/theme-edit — a leaf with no imports, read by _how-question.mjs
|
|
8
|
-
* and _check.mjs
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Phrases for parts that Core's catalog cannot give: groups, variants,
|
|
13
|
-
* font roles, phrases of several words, and words two components share.
|
|
14
|
-
* They are read before the catalog's names and doc keywords
|
|
15
|
-
* (partLexicon), longest phrase first.
|
|
16
|
-
* @type {Array<[RegExp, {on: string, when?: string, role?: string, level?: string, missing?: string}]>}
|
|
17
|
-
*/
|
|
18
|
-
export const OVERRIDES = [
|
|
19
|
-
// (Design systems' names for parts Core has under another name: an
|
|
20
|
-
// underline nav is a row of tabs; a navigation rail is the side nav.)
|
|
21
|
-
[/\bunderline[- ]?navs?\b/, {on: 'tab'}],
|
|
22
|
-
[/\b(?:navigation|nav) rails?\b/, {on: 'side-nav'}],
|
|
23
|
-
// (A page's title is its top heading, never the page.)
|
|
24
|
-
[/\bpage (?:titles?|headings?|headers?)\b/, {on: 'heading', level: '1'}],
|
|
25
|
-
[/\b(?:dividers?|separators?)\b/, {on: 'divider'}],
|
|
26
|
-
// (An action, "a toast's action", is the button it holds: before
|
|
27
|
-
// "button" or at the end of a phrase only. "Action items", "the actions
|
|
28
|
-
// column" and "an actions menu" are other parts. A call to action is the
|
|
29
|
-
// primary button, below.)
|
|
30
|
-
[
|
|
31
|
-
/(?<!\bcalls? to )\bactions?(?:\s+buttons?\b|(?=\s*(?:$|[,.;:!?)])))/,
|
|
32
|
-
{on: 'button'},
|
|
33
|
-
],
|
|
34
|
-
// (The page's main panel, the area its content sits in.)
|
|
35
|
-
[
|
|
36
|
-
/\b(?:main\s+)?content\s+(?:area|panel|region|pane)s?\b|\bmain\s+(?:area|panel|pane)s?\b/,
|
|
37
|
-
{on: 'layout-content'},
|
|
38
|
-
],
|
|
39
|
-
[
|
|
40
|
-
/\baccordions? (headers?|triggers?|titles?|headings?)\b/,
|
|
41
|
-
{on: 'collapsible-trigger'},
|
|
42
|
-
],
|
|
43
|
-
[/\baccordions?\b/, {on: 'collapsible'}],
|
|
44
|
-
[/\bcombo ?box(es)?\b/, {on: 'complex-selector'}],
|
|
45
|
-
// A calendar's range band, and the band a hover would select.
|
|
46
|
-
[
|
|
47
|
-
/\b(?:calendar\s+)?range\s+preview(?:\s+bands?)?\b|\bpreview\s+bands?\b/,
|
|
48
|
-
{on: 'calendar-range-preview'},
|
|
49
|
-
],
|
|
50
|
-
[/\b(?:calendar\s+)?range\s+bands?\b/, {on: 'calendar-range'}],
|
|
51
|
-
// (Other design systems' names for the same parts: a snackbar is a
|
|
52
|
-
// toast, a lozenge a badge, the form controls the inputs.)
|
|
53
|
-
[/\b(?:notifications?|snack ?bars?)\b/, {on: 'toast'}],
|
|
54
|
-
[/\b(focus (ring|outline)s?)\b/, {on: 'focus-ring'}],
|
|
55
|
-
[/\b((modal |dialog )?(overlay|scrim|backdrop))\b/, {on: 'overlay'}],
|
|
56
|
-
[/\bicons?\b/, {on: 'icons'}],
|
|
57
|
-
[
|
|
58
|
-
// (The header row is the header cells: "table header row gray" is
|
|
59
|
-
// never every row.)
|
|
60
|
-
/\b(table header rows?|header rows?|table headers?|column headers?|table headings?)\b/,
|
|
61
|
-
{on: 'table-header-cell'},
|
|
62
|
-
],
|
|
63
|
-
[
|
|
64
|
-
/\b(tabs? (underline|indicator)s?|underline (of|on|under) (the )?tabs?)\b/,
|
|
65
|
-
{on: 'tab-indicator'},
|
|
66
|
-
],
|
|
67
|
-
[/\b(status dots?)\b/, {on: 'status-dot'}],
|
|
68
|
-
// (Its indicator too: "the progress indicator".)
|
|
69
|
-
[
|
|
70
|
-
/\b(progress( bars?)?( fill| indicators?)?|loading bar)\b/,
|
|
71
|
-
{on: 'progress-bar-fill'},
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
/\b((side ?nav|sidebar)( nav(igation)?)? (links?|items?))\b/,
|
|
75
|
-
{on: 'side-nav-item'},
|
|
76
|
-
],
|
|
77
|
-
[
|
|
78
|
-
/\b((dropdown |context )?menu (items?|options?|entries)|dropdown items?)\b/,
|
|
79
|
-
{on: 'dropdown-menu-item'},
|
|
80
|
-
],
|
|
81
|
-
// (A top nav's or a navbar's links are its items, never the top nav and
|
|
82
|
-
// every link.)
|
|
83
|
-
[
|
|
84
|
-
/\b((?:top )?(?:nav(igation)?(?: ?bar)?|navbar) (links?|items?))\b/,
|
|
85
|
-
{on: 'top-nav-item'},
|
|
86
|
-
],
|
|
87
|
-
// A context menu is its own part in Core (its items are the dropdown
|
|
88
|
-
// menu's items, which it reuses).
|
|
89
|
-
[/\b(context ?menus?|right[- ]click menus?)\b/, {on: 'context-menu'}],
|
|
90
|
-
// (Menus said plainly are every menu, the menus group; a dropdown menu,
|
|
91
|
-
// or one menu, is the dropdown menu.)
|
|
92
|
-
[/\b(?<!dropdown )menus\b/, {on: 'menus'}],
|
|
93
|
-
[/\b((dropdown )?menus?)\b/, {on: 'dropdown-menu'}],
|
|
94
|
-
// A part's own header or footer ("dialog header", "card footer") is that
|
|
95
|
-
// part's, never the app's top bar or footer.
|
|
96
|
-
[
|
|
97
|
-
/(?<!\b(?:dialog|modal|card|drawer|sheet|popover|panel|section|table|menu)s? )\bfooters?\b/,
|
|
98
|
-
{on: 'layout-footer'},
|
|
99
|
-
],
|
|
100
|
-
[/\b(side ?nav|sidebar|side ?panel)\b/, {on: 'side-nav'}],
|
|
101
|
-
[
|
|
102
|
-
/\b(app (name|title)|logo|site title|product name)\b/,
|
|
103
|
-
{on: 'top-nav-heading'},
|
|
104
|
-
],
|
|
105
|
-
[
|
|
106
|
-
/(?<!\b(?:dialog|modal|card|drawer|sheet|popover|panel|section|table|menu)s? )\b(header|top ?bar|title ?bar|nav(?:igation)? ?bar|app ?bar|masthead)\b/,
|
|
107
|
-
{on: 'app-shell-header'},
|
|
108
|
-
],
|
|
109
|
-
[/\b(page|app background|whole background|body background)\b/, {on: 'page'}],
|
|
110
|
-
// A radio's dot is its own part (the mark a checked radio shows).
|
|
111
|
-
[/\bradio( button)?s?'?\s+dots?\b/, {on: 'radio-indicator-dot'}],
|
|
112
|
-
[/\b(radio( buttons?)?|radios)\b/, {on: 'radio-indicator'}],
|
|
113
|
-
// (The accent buttons and the call to action are the primary button:
|
|
114
|
-
// the one the accent fills.)
|
|
115
|
-
[
|
|
116
|
-
/\b(primary|main|accent) buttons?\b|\b(?:ctas?|calls? to action)(?: buttons?)?\b/,
|
|
117
|
-
{on: 'button', when: 'variant:primary'},
|
|
118
|
-
],
|
|
119
|
-
[/\bsecondary buttons?\b/, {on: 'button', when: 'variant:secondary'}],
|
|
120
|
-
[/\bghost buttons?\b/, {on: 'button', when: 'variant:ghost'}],
|
|
121
|
-
[
|
|
122
|
-
/\b(danger|destructive|delete) (buttons?|ones?|variant)\b/,
|
|
123
|
-
{on: 'button', when: 'variant:destructive'},
|
|
124
|
-
],
|
|
125
|
-
// (Never the operating system, "Windows 11 accent …": a window named
|
|
126
|
-
// with a version is a product.)
|
|
127
|
-
[
|
|
128
|
-
/\b(panels?|windows?(?!\s+(?:\d|xp\b|vista\b))|boxes|tiles?|containers?)\b/,
|
|
129
|
-
{on: 'containers'},
|
|
130
|
-
],
|
|
131
|
-
[/\b(banners?|alerts?|notices?|announcements?)\b/, {on: 'banner'}],
|
|
132
|
-
// A sheet is Core's bottom sheet (never a style sheet).
|
|
133
|
-
[/(?<!\bstyle[\s-]?)\b(?:bottom[\s-]?)?sheets?\b/, {on: 'bottom-sheet'}],
|
|
134
|
-
[/\b(text ?areas?|multi-?line (inputs?|fields?))\b/, {on: 'text-area'}],
|
|
135
|
-
[
|
|
136
|
-
/\b(select (dropdowns?|menus?|box(es)?|inputs?)|selects|dropdowns?|pickers?|select(?! (the|a|an|all|any|one|which|what|it|them)\b))\b/,
|
|
137
|
-
{on: 'selector'},
|
|
138
|
-
],
|
|
139
|
-
[/\b(skeletons?( loaders?)?|loading placeholders?)\b/, {on: 'skeleton'}],
|
|
140
|
-
[
|
|
141
|
-
/\b(inputs?|text ?box(es)?|text ?fields?|form (fields?|controls?|elements?)|fields?)\b/,
|
|
142
|
-
{on: 'inputs'},
|
|
143
|
-
],
|
|
144
|
-
// A checkbox is the box itself; the checks group (checkbox and radio)
|
|
145
|
-
// goes by its own name.
|
|
146
|
-
// A check mark is the mark drawn inside the box, never the box.
|
|
147
|
-
[
|
|
148
|
-
/\b(?:checkbox(?:es)?\s+)?(?:check ?marks?|ticks?)\b/,
|
|
149
|
-
{on: 'checkbox-indicator-check'},
|
|
150
|
-
],
|
|
151
|
-
[/\b(checkbox(es)?)\b/, {on: 'checkbox-indicator'}],
|
|
152
|
-
// "indicators" alone: the check and radio indicators (the checks group).
|
|
153
|
-
[/\b(?:check(?:box)?\s+and\s+radio\s+)?indicators?\b/, {on: 'checks'}],
|
|
154
|
-
// A switch's or toggle's thumb, knob or handle: the thumb, never the
|
|
155
|
-
// track.
|
|
156
|
-
[
|
|
157
|
-
/\b(?:toggle|switch)(?:e?s)?(?:'s)?\s+(?:thumbs?|knobs?|handles?)\b/,
|
|
158
|
-
{on: 'switch-thumb'},
|
|
159
|
-
],
|
|
160
|
-
// The buttons or items of a toggle group (its own possessive or not):
|
|
161
|
-
// Core's toggle buttons, never a switch's.
|
|
162
|
-
[
|
|
163
|
-
/\btoggle[- ]?(?:button[- ]?)?groups?(?:'s|s'|’s)?\s+(?:buttons?|items?|options?)\b/,
|
|
164
|
-
{on: 'toggle-button'},
|
|
165
|
-
],
|
|
166
|
-
// A toggle group: the group of toggle buttons, never a switch.
|
|
167
|
-
[/\btoggle[- ]?(?:button[- ]?)?groups?\b/, {on: 'toggle-button-group'}],
|
|
168
|
-
// A toggle button: Core's toggle button, never a switch.
|
|
169
|
-
[/\btoggle[- ]?buttons?\b/, {on: 'toggle-button'}],
|
|
170
|
-
// "switch off", "switch the buttons to" are the verb, not the part; the
|
|
171
|
-
// switch's "on color" or "on state" (its checked look) is the part.
|
|
172
|
-
[
|
|
173
|
-
/\b(toggles?|switch(?:e?s)?(?! (?:off|on(?\b)|to|the|out|it|them|over|back|from)\b))\b/,
|
|
174
|
-
{on: 'switch'},
|
|
175
|
-
],
|
|
176
|
-
[/\b((table )?cells?)\b/, {on: 'table-cell'}],
|
|
177
|
-
[/\b(table rows?|rows?|tables?)\b/, {on: 'table-row'}],
|
|
178
|
-
// (A keyboard key, "the key chips", is Core's Kbd, never a badge.)
|
|
179
|
-
[
|
|
180
|
-
/\b(kbds?|keyboard (keys?|shortcuts?|chips?)|key ?(chips?|caps?)|shortcut keys?)\b/,
|
|
181
|
-
{on: 'kbd'},
|
|
182
|
-
],
|
|
183
|
-
// (Kbd's key badges, each key's own box, by their own name.)
|
|
184
|
-
[/\bkey badges?\b/, {on: 'kbd-key'}],
|
|
185
|
-
[/\b(badges?|chips?|tags?|lozenges?)\b/, {on: 'badge'}],
|
|
186
|
-
[/\bh([1-6])\b/, {on: 'heading'}],
|
|
187
|
-
// (A large title, the biggest title a screen has, is its top heading.)
|
|
188
|
-
[/\blarge titles?\b/, {on: 'heading', level: '1'}],
|
|
189
|
-
// (A display heading is the heading's largest display look.)
|
|
190
|
-
[/\bdisplay (?:headings?|titles?|text)\b/, {on: 'heading', when: 'type:display-1'}],
|
|
191
|
-
[/\b(headings?|titles?)\b/, {on: 'heading'}],
|
|
192
|
-
[/\b(modals?|popups?)\b/, {on: 'dialog'}],
|
|
193
|
-
[/\bcode\b/, {on: 'code', role: 'code'}],
|
|
194
|
-
// Small, secondary and supporting text, captions and fine print: the
|
|
195
|
-
// supporting text style, not the base size.
|
|
196
|
-
[
|
|
197
|
-
/\b((?:small|secondary|supporting|helper|hint|caption|muted) (?:text|copy)|fine print|captions?|footnotes?)\b/,
|
|
198
|
-
{on: 'body', role: 'supporting'},
|
|
199
|
-
],
|
|
200
|
-
[/\bbody( text)?\b/, {on: 'body', role: 'body'}],
|
|
201
|
-
];
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* The part or group a plain word names, as how reads it (`checkboxes` is
|
|
205
|
-
* the checks group, `panels` the containers), or null.
|
|
206
|
-
* @param {string} word
|
|
207
|
-
* @returns {string | null}
|
|
208
|
-
*/
|
|
209
|
-
export function partForWord(word) {
|
|
210
|
-
const w = String(word ?? '')
|
|
211
|
-
.trim()
|
|
212
|
-
.toLowerCase();
|
|
213
|
-
if (!w) return null;
|
|
214
|
-
for (const [re, hit] of OVERRIDES)
|
|
215
|
-
if (/** @type {RegExp} */ (re).test(w))
|
|
216
|
-
return /** @type {{on: string}} */ (hit).on;
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/** @type {Map<string, string> | null} */
|
|
221
|
-
let words = null;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* The single words the table reads as a part or group, each with what it
|
|
225
|
-
* names (`sidebar` side-nav, `checkbox` checks, `toggle` switch): the words
|
|
226
|
-
* a part's typo is read against beside the part names. Taken from the
|
|
227
|
-
* table's own words, a plural's singular (`toggles?`) included.
|
|
228
|
-
* @returns {Map<string, string>}
|
|
229
|
-
*/
|
|
230
|
-
export function partWords() {
|
|
231
|
-
if (words) return words;
|
|
232
|
-
words = new Map();
|
|
233
|
-
for (const [re] of OVERRIDES)
|
|
234
|
-
for (const m of re.source.matchAll(/[a-z]{3,}(\?)?/g)) {
|
|
235
|
-
const w = m[0].replace(/\?$/, '');
|
|
236
|
-
for (const each of m[1] ? [w, w.slice(0, -1)] : [w]) {
|
|
237
|
-
const on = partForWord(each);
|
|
238
|
-
if (on && !words.has(each)) words.set(each, on);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return words;
|
|
242
|
-
}
|