@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,1128 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file The data behind `astryx experimental theme`: the dials and their
|
|
5
|
-
* rungs, the part groups, the built-in themes a theme can build on, and the
|
|
6
|
-
* words `how` understands. A new dial, rung, group or word is a table entry
|
|
7
|
-
* here with a test, not new code.
|
|
8
|
-
*
|
|
9
|
-
* @position api/theme-edit — data read by the engine and the help text
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
SYSTEM_FONTS_BY_PLATFORM,
|
|
14
|
-
appleFaceGeneric,
|
|
15
|
-
collectUnloadedFonts,
|
|
16
|
-
systemFontFamilies,
|
|
17
|
-
} from '../theme/build/font-warning.mjs';
|
|
18
|
-
|
|
19
|
-
export {appleFaceGeneric, systemFontFamilies};
|
|
20
|
-
|
|
21
|
-
export {wordTable} from '../../foundation/runtime/word-table.mjs';
|
|
22
|
-
import {wordTable} from '../../foundation/runtime/word-table.mjs';
|
|
23
|
-
|
|
24
|
-
/** The command prefix every suggested command starts with. */
|
|
25
|
-
export const P = 'astryx experimental theme editor';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Parts that take their color from a color prop, whose rule Core writes
|
|
29
|
-
* after part styles: a color set on them never shows.
|
|
30
|
-
*/
|
|
31
|
-
export const COLOR_PROP_PARTS = ['text', 'heading', 'link'];
|
|
32
|
-
|
|
33
|
-
/** The lookup command: what a part reads, a setting, a question, a picture. */
|
|
34
|
-
export const HOW = `${P} how`;
|
|
35
|
-
|
|
36
|
-
/** The built-in themes, once the adapter has found them. @type {string[] | null} */
|
|
37
|
-
let builtIn = null;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The built-in themes a theme can build on (`new --like`, `set base`),
|
|
41
|
-
* neutral first. Finding them reads the installed packages, which is the
|
|
42
|
-
* adapter's to do: the adapter hands them in once, as it loads
|
|
43
|
-
* (knowBuiltInThemes), and this table stays pure. Read before then (code
|
|
44
|
-
* that runs the editor around its adapter), it says so rather than act as
|
|
45
|
-
* if no built-in theme were installed.
|
|
46
|
-
* @type {string[]}
|
|
47
|
-
*/
|
|
48
|
-
export const LIKE = /** @type {string[]} */ (
|
|
49
|
-
new Proxy([], {
|
|
50
|
-
get(_empty, key) {
|
|
51
|
-
if (!builtIn)
|
|
52
|
-
throw new Error(
|
|
53
|
-
'the built-in themes are not known yet: the theme editor runs through its adapter (api/theme-edit/_adapter.mjs), which finds them',
|
|
54
|
-
);
|
|
55
|
-
const v = Reflect.get(builtIn, key);
|
|
56
|
-
return typeof v === 'function' ? v.bind(builtIn) : v;
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Hand the editor the built-in themes the adapter found; they are listed
|
|
63
|
-
* neutral first, and the base dial names them.
|
|
64
|
-
* @param {string[]} slugs
|
|
65
|
-
*/
|
|
66
|
-
export function knowBuiltInThemes(slugs) {
|
|
67
|
-
builtIn = [...slugs].sort(
|
|
68
|
-
(a, b) => Number(b === 'neutral') - Number(a === 'neutral'),
|
|
69
|
-
);
|
|
70
|
-
Object.assign(DIALS.base, baseDialWords());
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** What the base dial's help and values say: the built-in themes, or none. */
|
|
74
|
-
function baseDialWords() {
|
|
75
|
-
const names = builtIn ?? [];
|
|
76
|
-
return {
|
|
77
|
-
help: `The built-in theme this theme builds on: ${names.join(', ')}, or none. Changing it keeps all your settings.`,
|
|
78
|
-
values: `${[...names, 'none'].join('|')}`,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Groups of parts that should look alike. `--on <group>` styles every member.
|
|
84
|
-
* @type {Record<string, string[]>}
|
|
85
|
-
*/
|
|
86
|
-
export const FAMILIES = wordTable({
|
|
87
|
-
inputs: [
|
|
88
|
-
'text-input',
|
|
89
|
-
'text-area',
|
|
90
|
-
'number-input',
|
|
91
|
-
'date-input',
|
|
92
|
-
'time-input',
|
|
93
|
-
'date-time-input',
|
|
94
|
-
'date-range-input',
|
|
95
|
-
'selector',
|
|
96
|
-
'multi-selector',
|
|
97
|
-
'complex-selector',
|
|
98
|
-
'typeahead',
|
|
99
|
-
'tokenizer',
|
|
100
|
-
'file-input',
|
|
101
|
-
],
|
|
102
|
-
containers: [
|
|
103
|
-
'card',
|
|
104
|
-
'dialog',
|
|
105
|
-
'drawer',
|
|
106
|
-
'popover',
|
|
107
|
-
'hover-card',
|
|
108
|
-
'bottom-sheet',
|
|
109
|
-
'selectable-card',
|
|
110
|
-
'clickable-card',
|
|
111
|
-
],
|
|
112
|
-
checks: ['checkbox-indicator', 'radio-indicator'],
|
|
113
|
-
menus: [
|
|
114
|
-
'dropdown-menu',
|
|
115
|
-
'selector-popup',
|
|
116
|
-
'multi-selector-popup',
|
|
117
|
-
'typeahead-dropdown',
|
|
118
|
-
'context-menu',
|
|
119
|
-
],
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Groups whose members always look alike: styling one member styles them
|
|
124
|
-
* all unless `--only` is given. Other groups spread only when `--on`
|
|
125
|
-
* names the group itself.
|
|
126
|
-
*/
|
|
127
|
-
export const AUTO_SPREAD = ['inputs', 'checks'];
|
|
128
|
-
|
|
129
|
-
/** The family roles `--on` takes as groups. */
|
|
130
|
-
export const GROUP_ROLES = /** @type {const} */ ([
|
|
131
|
-
'button-like',
|
|
132
|
-
'overlays',
|
|
133
|
-
'option-rows',
|
|
134
|
-
'selected-items',
|
|
135
|
-
'accent-fills',
|
|
136
|
-
'inset-fields',
|
|
137
|
-
'status-surfaces',
|
|
138
|
-
'overlay-headers',
|
|
139
|
-
'controls',
|
|
140
|
-
]);
|
|
141
|
-
|
|
142
|
-
/** @param {string} target @returns {string | null} */
|
|
143
|
-
export const familyOf = target =>
|
|
144
|
-
Object.entries(FAMILIES).find(([, members]) =>
|
|
145
|
-
members.includes(target),
|
|
146
|
-
)?.[0] ?? null;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* What `--only` means on a place, the one rule `set --only` and the
|
|
150
|
-
* settings reader share: on a member of a group that spreads (a text input
|
|
151
|
-
* of inputs) it keeps the change on that member (`member`); on any other
|
|
152
|
-
* part it changes nothing, as the part is styled on its own already
|
|
153
|
-
* (`own`), except on a control's own height, which keeps the height on
|
|
154
|
-
* that control (onlyFits, and onlyHeightShape for the settings reader);
|
|
155
|
-
* on a group itself, the editor's own (inputs) or a family role
|
|
156
|
-
* (button-like), or with no part, it means nothing at all (`group`).
|
|
157
|
-
* @param {string | undefined} on
|
|
158
|
-
* @returns {'member' | 'own' | 'group'}
|
|
159
|
-
*/
|
|
160
|
-
export const onlyMeans = on => {
|
|
161
|
-
if (
|
|
162
|
-
!on ||
|
|
163
|
-
Object.hasOwn(FAMILIES, on) ||
|
|
164
|
-
GROUP_ROLES.includes(/** @type {any} */ (on))
|
|
165
|
-
)
|
|
166
|
-
return 'group';
|
|
167
|
-
const fam = familyOf(on);
|
|
168
|
-
return fam && AUTO_SPREAD.includes(fam) ? 'member' : 'own';
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
/** @type {Array<[string, number]>} */
|
|
172
|
-
export const CORNERS = [
|
|
173
|
-
['square', 0],
|
|
174
|
-
['small', 8],
|
|
175
|
-
['medium', 10],
|
|
176
|
-
['large', 12],
|
|
177
|
-
['round', 16],
|
|
178
|
-
['pill', 9999],
|
|
179
|
-
];
|
|
180
|
-
/**
|
|
181
|
-
* The step `corners more` and `less` take between round and pill: half as
|
|
182
|
-
* round again as round, so one step more from round is not a pill.
|
|
183
|
-
*/
|
|
184
|
-
export const ROUND_TO_PILL_STEP = `${(CORNERS.find(([n]) => n === 'round')?.[1] ?? 16) * 1.5}px`;
|
|
185
|
-
/**
|
|
186
|
-
* The density words, the one table every reading of room uses: words for
|
|
187
|
-
* more room (roomy), for less (dense), and complaints that there is too
|
|
188
|
-
* little (crowded). An ask names the density it wants; after "too" the
|
|
189
|
-
* word names the density there is, so the change goes the other way.
|
|
190
|
-
*/
|
|
191
|
-
export const DENSITY = /** @type {const} */ ({
|
|
192
|
-
roomy: [
|
|
193
|
-
'airy',
|
|
194
|
-
'airier',
|
|
195
|
-
'spacious',
|
|
196
|
-
'roomy',
|
|
197
|
-
'roomier',
|
|
198
|
-
'loose',
|
|
199
|
-
'looser',
|
|
200
|
-
'relaxed',
|
|
201
|
-
'comfortable',
|
|
202
|
-
'sparse',
|
|
203
|
-
'padded',
|
|
204
|
-
'generous',
|
|
205
|
-
'spread out',
|
|
206
|
-
],
|
|
207
|
-
dense: ['dense', 'denser', 'compact', 'tight', 'tighter', 'condensed'],
|
|
208
|
-
crowded: ['cramped', 'crowded', 'packed'],
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* The density words of the kinds given, as one alternation for a regular
|
|
213
|
-
* expression.
|
|
214
|
-
* @param {...keyof typeof DENSITY} kinds
|
|
215
|
-
*/
|
|
216
|
-
export const densityWords = (...kinds) =>
|
|
217
|
-
kinds.flatMap(k => DENSITY[k]).join('|');
|
|
218
|
-
|
|
219
|
-
/** @type {Array<[string, number]>} */
|
|
220
|
-
export const SPACING = [
|
|
221
|
-
['tight', 0.75],
|
|
222
|
-
['compact', 0.875],
|
|
223
|
-
['medium', 1],
|
|
224
|
-
['roomy', 1.125],
|
|
225
|
-
['spacious', 1.25],
|
|
226
|
-
];
|
|
227
|
-
/** @type {Array<[string, number]>} */
|
|
228
|
-
export const TEXT_SIZE = [
|
|
229
|
-
['small', 13],
|
|
230
|
-
['medium', 14],
|
|
231
|
-
['large', 15],
|
|
232
|
-
['larger', 16],
|
|
233
|
-
];
|
|
234
|
-
|
|
235
|
-
/** The type roles a font may be set for alone (`font <x> --on <role>`). */
|
|
236
|
-
export const FONT_ROLES = ['body', 'heading', 'code'];
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Font presets: the family, then its fallbacks.
|
|
240
|
-
* @type {Record<string, [string, string]>}
|
|
241
|
-
*/
|
|
242
|
-
export const FONTS = wordTable({
|
|
243
|
-
system: ['system-ui', '-apple-system, "Segoe UI", Roboto, sans-serif'],
|
|
244
|
-
tahoma: ['Tahoma', 'Verdana, "Segoe UI", sans-serif'],
|
|
245
|
-
verdana: ['Verdana', 'Tahoma, sans-serif'],
|
|
246
|
-
segoe: ['Segoe UI', 'Tahoma, sans-serif'],
|
|
247
|
-
helvetica: ['Helvetica', 'Arial, sans-serif'],
|
|
248
|
-
georgia: ['Georgia', '"Times New Roman", serif'],
|
|
249
|
-
serif: ['Georgia', '"Times New Roman", serif'],
|
|
250
|
-
mono: ['ui-monospace', '"SF Mono", Menlo, Consolas, monospace'],
|
|
251
|
-
courier: ['Courier New', 'Courier, monospace'],
|
|
252
|
-
rounded: ['Nunito', '"Varela Round", system-ui, sans-serif'],
|
|
253
|
-
comic: ['Comic Sans MS', '"Comic Neue", cursive'],
|
|
254
|
-
});
|
|
255
|
-
export {CSS_WIDE} from '../../foundation/color/css-color.mjs';
|
|
256
|
-
import {CSS_WIDE} from '../../foundation/color/css-color.mjs';
|
|
257
|
-
|
|
258
|
-
/** CSS-wide keywords, and `default`, which font-family reserves: never a family, and invalid inside a list. */
|
|
259
|
-
export const CSS_WIDE_KEYWORDS = [...CSS_WIDE, 'default'];
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Whether a family needs no font file somewhere: a CSS generic family, or a
|
|
263
|
-
* family on the theme build's own list of system fonts (the one list; the
|
|
264
|
-
* build's font warning reads it).
|
|
265
|
-
* @param {string} family without quotes
|
|
266
|
-
*/
|
|
267
|
-
export const isSystemFamily = family =>
|
|
268
|
-
family.trim() !== '' &&
|
|
269
|
-
collectUnloadedFonts({
|
|
270
|
-
tokens: {'--font-family-body': JSON.stringify(family.trim())},
|
|
271
|
-
}).length === 0;
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* The families on that list that only one system ships, with that system:
|
|
275
|
-
* fallback stacks name them on purpose, but as a theme's own font they do
|
|
276
|
-
* not load everywhere.
|
|
277
|
-
*/
|
|
278
|
-
const ONE_SYSTEM_FAMILIES = new Map(
|
|
279
|
-
Object.entries(SYSTEM_FONTS_BY_PLATFORM)
|
|
280
|
-
.filter(([system]) => system !== 'everywhere')
|
|
281
|
-
.flatMap(([system, names]) => names.map(n => [n, system])),
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
/** @param {string} family */
|
|
285
|
-
const familyKey = family => family.trim().replace(/\s+/g, ' ').toLowerCase();
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* The one system that ships a family on the theme build's list, or null for
|
|
289
|
-
* a family every desktop has (or none does).
|
|
290
|
-
* @param {string} family without quotes
|
|
291
|
-
*/
|
|
292
|
-
export const oneSystemOf = family =>
|
|
293
|
-
isSystemFamily(family)
|
|
294
|
-
? (ONE_SYSTEM_FAMILIES.get(familyKey(family)) ?? null)
|
|
295
|
-
: null;
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Whether a family loads with no font file on every usual desktop: a CSS
|
|
299
|
-
* generic, or a system family macOS and Windows both ship.
|
|
300
|
-
* @param {string} family without quotes
|
|
301
|
-
*/
|
|
302
|
-
export const isDesktopFamily = family =>
|
|
303
|
-
isSystemFamily(family) &&
|
|
304
|
-
!ONE_SYSTEM_FAMILIES.has(familyKey(family)) &&
|
|
305
|
-
!appleFaceGeneric(family);
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Presets that show a font every desktop has, so no font file is needed:
|
|
309
|
-
* the family itself, or (for one that ships on one system, such as Segoe
|
|
310
|
-
* UI) the first fallback.
|
|
311
|
-
*/
|
|
312
|
-
export const SYSTEM_FONTS = Object.keys(FONTS).filter(k =>
|
|
313
|
-
[FONTS[k][0], FONTS[k][1].split(',')[0].replace(/["']/g, '')].some(
|
|
314
|
-
isDesktopFamily,
|
|
315
|
-
),
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Open fonts with a package that loads them: preset -> family. The package
|
|
320
|
-
* is `@fontsource/<preset>` and the fallbacks follow the kind of font
|
|
321
|
-
* (`-mono`, serif, sans), except where OPEN_FONT_PACKAGES says otherwise.
|
|
322
|
-
* When the package is installed, previews show the font; the app loads it
|
|
323
|
-
* by importing the package once.
|
|
324
|
-
*/
|
|
325
|
-
const OPEN_FONT_FAMILIES = wordTable({
|
|
326
|
-
inter: 'Inter',
|
|
327
|
-
roboto: 'Roboto',
|
|
328
|
-
poppins: 'Poppins',
|
|
329
|
-
figtree: 'Figtree',
|
|
330
|
-
'dm-sans': 'DM Sans',
|
|
331
|
-
manrope: 'Manrope',
|
|
332
|
-
'space-grotesk': 'Space Grotesk',
|
|
333
|
-
'ibm-plex-sans': 'IBM Plex Sans',
|
|
334
|
-
'ibm-plex-mono': 'IBM Plex Mono',
|
|
335
|
-
'jetbrains-mono': 'JetBrains Mono',
|
|
336
|
-
nunito: 'Nunito',
|
|
337
|
-
'source-serif': 'Source Serif 4',
|
|
338
|
-
'mona-sans': 'Mona Sans',
|
|
339
|
-
geist: 'Geist Sans',
|
|
340
|
-
'geist-mono': 'Geist Mono',
|
|
341
|
-
});
|
|
342
|
-
/** Presets whose package is not named after them. */
|
|
343
|
-
const OPEN_FONT_PACKAGES = wordTable(
|
|
344
|
-
/** @type {Record<string, string>} */ ({
|
|
345
|
-
'source-serif': 'source-serif-4',
|
|
346
|
-
geist: 'geist-sans',
|
|
347
|
-
}),
|
|
348
|
-
);
|
|
349
|
-
/** @type {Record<string, {family: string, fallbacks: string, pkg: string}>} */
|
|
350
|
-
export const OPEN_FONTS = wordTable(
|
|
351
|
-
Object.fromEntries(
|
|
352
|
-
Object.entries(OPEN_FONT_FAMILIES).map(([key, family]) => [
|
|
353
|
-
key,
|
|
354
|
-
{
|
|
355
|
-
family,
|
|
356
|
-
fallbacks: key.endsWith('-mono')
|
|
357
|
-
? 'ui-monospace, monospace'
|
|
358
|
-
: /serif/i.test(family)
|
|
359
|
-
? 'Georgia, serif'
|
|
360
|
-
: 'system-ui, sans-serif',
|
|
361
|
-
pkg: `@fontsource/${OPEN_FONT_PACKAGES[key] ?? key}`,
|
|
362
|
-
},
|
|
363
|
-
]),
|
|
364
|
-
),
|
|
365
|
-
);
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* The CSS font-family stack a font dial word stands for (a preset such as
|
|
369
|
-
* mono, or an open font such as inter): its family, quoted when it holds a
|
|
370
|
-
* space, then its fallbacks. Null for any other word. A part's font-family
|
|
371
|
-
* takes this stack, never the word itself, which names no family.
|
|
372
|
-
* @param {string} word
|
|
373
|
-
* @returns {string | null}
|
|
374
|
-
*/
|
|
375
|
-
export function fontStack(word) {
|
|
376
|
-
const w = String(word).trim().toLowerCase();
|
|
377
|
-
const [family, fallbacks] = FONTS[w]
|
|
378
|
-
? FONTS[w]
|
|
379
|
-
: OPEN_FONTS[w]
|
|
380
|
-
? [OPEN_FONTS[w].family.replace(/"/g, ''), OPEN_FONTS[w].fallbacks]
|
|
381
|
-
: [null, null];
|
|
382
|
-
if (!family) return null;
|
|
383
|
-
return `${/\s/.test(family) ? `"${family}"` : family}, ${fallbacks}`;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Brand fonts no package loads, and the closest open font, for the warning
|
|
388
|
-
* a theme that names one gets.
|
|
389
|
-
* @type {Record<string, string>}
|
|
390
|
-
*/
|
|
391
|
-
export const CLOSEST_OPEN_FONT = wordTable({
|
|
392
|
-
'sf pro': 'inter',
|
|
393
|
-
'sf pro text': 'inter',
|
|
394
|
-
'sf pro display': 'inter',
|
|
395
|
-
'san francisco': 'inter',
|
|
396
|
-
'-apple-system': 'inter',
|
|
397
|
-
söhne: 'inter',
|
|
398
|
-
sohne: 'inter',
|
|
399
|
-
cereal: 'manrope',
|
|
400
|
-
'airbnb cereal': 'manrope',
|
|
401
|
-
circular: 'dm-sans',
|
|
402
|
-
'gt walsheim': 'dm-sans',
|
|
403
|
-
'helvetica neue': 'inter',
|
|
404
|
-
'segoe ui variable': 'inter',
|
|
405
|
-
'gg sans': 'nunito',
|
|
406
|
-
whitney: 'nunito',
|
|
407
|
-
graphik: 'inter',
|
|
408
|
-
'proxima nova': 'figtree',
|
|
409
|
-
avenir: 'nunito',
|
|
410
|
-
'avenir next': 'nunito',
|
|
411
|
-
futura: 'poppins',
|
|
412
|
-
menlo: 'jetbrains-mono',
|
|
413
|
-
'sf mono': 'jetbrains-mono',
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
/** Heading weights (`headings` dial): rung -> font-weight. */
|
|
417
|
-
/**
|
|
418
|
-
* Where the theme's page color shows, said by every answer that sets or
|
|
419
|
-
* names it: `--color-background-body` paints inside AppShell only.
|
|
420
|
-
*/
|
|
421
|
-
export const PAGE_COLOR_NOTE =
|
|
422
|
-
"Your theme's page color shows inside AppShell. Wrap the page in AppShell; if you can't, add `body { background: var(--color-background-body) }` to global CSS (doctor's purity check flags any stylesheet, so prefer AppShell). An Astryx area embedded in a page another app owns adds no body rule: that page is not its own.";
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* The page color note for a theme in its mode: a theme that ships one mode
|
|
426
|
-
* draws its text for that mode's page, so the host page must take the
|
|
427
|
-
* theme's page color in every OS mode too.
|
|
428
|
-
* @param {string | undefined} mode the theme's mode setting
|
|
429
|
-
* @returns {string}
|
|
430
|
-
*/
|
|
431
|
-
export const pageColorNote = mode =>
|
|
432
|
-
/^(?:dark|light)-only$/.test(String(mode ?? ''))
|
|
433
|
-
? `${PAGE_COLOR_NOTE} This theme has one mode (${mode}): its text is drawn for its own page, so the page must take the theme's page color in every OS mode, or its text lands on the browser's own page color in the other OS mode.`
|
|
434
|
-
: PAGE_COLOR_NOTE;
|
|
435
|
-
|
|
436
|
-
export const HEADING_WEIGHTS = wordTable(
|
|
437
|
-
/** @type {Record<string, string>} */ ({
|
|
438
|
-
light: '300',
|
|
439
|
-
regular: '400',
|
|
440
|
-
medium: '500',
|
|
441
|
-
semibold: '600',
|
|
442
|
-
bold: '700',
|
|
443
|
-
heavy: '800',
|
|
444
|
-
}),
|
|
445
|
-
);
|
|
446
|
-
/** Heading letter spacing (`headings` dial): rung -> letter-spacing. */
|
|
447
|
-
export const HEADING_TRACKING = wordTable(
|
|
448
|
-
/** @type {Record<string, string>} */ ({
|
|
449
|
-
tight: '-0.02em',
|
|
450
|
-
tighter: '-0.04em',
|
|
451
|
-
normal: '0',
|
|
452
|
-
wide: '0.02em',
|
|
453
|
-
}),
|
|
454
|
-
);
|
|
455
|
-
|
|
456
|
-
/** The `surfaces` dial: how every container sits on the page. */
|
|
457
|
-
export const SURFACES = wordTable(
|
|
458
|
-
/** @type {Record<string, Record<string, string>>} */ ({
|
|
459
|
-
flat: {
|
|
460
|
-
borderStyle: 'none',
|
|
461
|
-
boxShadow: 'none',
|
|
462
|
-
backgroundColor: 'var(--color-background-muted)',
|
|
463
|
-
},
|
|
464
|
-
outlined: {
|
|
465
|
-
borderStyle: 'solid',
|
|
466
|
-
borderWidth: '1px',
|
|
467
|
-
borderColor: 'var(--color-border)',
|
|
468
|
-
boxShadow: 'none',
|
|
469
|
-
},
|
|
470
|
-
raised: {borderStyle: 'none', boxShadow: 'var(--shadow-med)'},
|
|
471
|
-
glass: {
|
|
472
|
-
backgroundColor:
|
|
473
|
-
'color-mix(in srgb, var(--color-background-card) 72%, transparent)',
|
|
474
|
-
backdropFilter: 'blur(14px) saturate(1.4)',
|
|
475
|
-
borderStyle: 'solid',
|
|
476
|
-
borderWidth: '1px',
|
|
477
|
-
borderColor: 'rgb(255 255 255 / 0.22)',
|
|
478
|
-
boxShadow: 'var(--shadow-low)',
|
|
479
|
-
},
|
|
480
|
-
}),
|
|
481
|
-
);
|
|
482
|
-
/**
|
|
483
|
-
* The panels that float over the page (menus, popovers, dialogs): under
|
|
484
|
-
* `surfaces flat` they keep their own fill and a hairline edge
|
|
485
|
-
* ({@link FLOATING_SURFACES}), since a panel over content needs an edge to
|
|
486
|
-
* be seen.
|
|
487
|
-
*/
|
|
488
|
-
export const FLOATING_PANELS = [
|
|
489
|
-
'dialog',
|
|
490
|
-
'popover',
|
|
491
|
-
'drawer',
|
|
492
|
-
'hover-card',
|
|
493
|
-
'dropdown-menu',
|
|
494
|
-
'selector-popup',
|
|
495
|
-
];
|
|
496
|
-
|
|
497
|
-
/** A rung of the `surfaces` dial as the floating panels take it, where it differs. */
|
|
498
|
-
export const FLOATING_SURFACES = wordTable(
|
|
499
|
-
/** @type {Record<string, Record<string, string>>} */ ({
|
|
500
|
-
flat: {
|
|
501
|
-
borderStyle: 'solid',
|
|
502
|
-
borderWidth: '1px',
|
|
503
|
-
borderColor: 'var(--color-border)',
|
|
504
|
-
boxShadow: 'none',
|
|
505
|
-
},
|
|
506
|
-
}),
|
|
507
|
-
);
|
|
508
|
-
|
|
509
|
-
/** The parts the `surfaces` dial moves. */
|
|
510
|
-
export const SURFACE_PARTS = [
|
|
511
|
-
'card',
|
|
512
|
-
'dialog',
|
|
513
|
-
'popover',
|
|
514
|
-
'drawer',
|
|
515
|
-
'hover-card',
|
|
516
|
-
'dropdown-menu',
|
|
517
|
-
'selector-popup',
|
|
518
|
-
'banner-frame',
|
|
519
|
-
];
|
|
520
|
-
|
|
521
|
-
/** The `type` dial: heading scale ratio, heading weight, heading letter spacing. */
|
|
522
|
-
export const TYPE_STYLES =
|
|
523
|
-
/** @type {Record<string, {ratio: number, weight: string | null, tracking: string | null}>} */ ({
|
|
524
|
-
compact: {ratio: 1.15, weight: '600', tracking: '0'},
|
|
525
|
-
standard: {ratio: 1.2, weight: null, tracking: null},
|
|
526
|
-
editorial: {ratio: 1.3, weight: '600', tracking: '-0.02em'},
|
|
527
|
-
display: {ratio: 1.4, weight: '800', tracking: '-0.035em'},
|
|
528
|
-
});
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* @typedef {object} Dial
|
|
532
|
-
* @property {string} help - What the dial does, its rungs, and where it applies.
|
|
533
|
-
* @property {string} values - The values it takes, `|`-separated.
|
|
534
|
-
* @property {string[]} examples - Commands after the prefix; `my` is the theme.
|
|
535
|
-
* @property {string} words - Words `how` matches to the dial.
|
|
536
|
-
* @property {'px'} [unit] - The unit its `<number>` is in: the number typed
|
|
537
|
-
* with that unit (`24px`, `24 PX`) is the same number (dialNumber).
|
|
538
|
-
*/
|
|
539
|
-
|
|
540
|
-
/** @type {Record<string, Dial>} */
|
|
541
|
-
export const DIALS = wordTable({
|
|
542
|
-
corners: {
|
|
543
|
-
help:
|
|
544
|
-
'How round corners are. Rungs: ' +
|
|
545
|
-
CORNERS.flatMap(([n, v]) => [
|
|
546
|
-
...(n === 'pill'
|
|
547
|
-
? [`${ROUND_TO_PILL_STEP} (the step between round and pill)`]
|
|
548
|
-
: []),
|
|
549
|
-
`${n} (${v === 9999 ? 'fully round' : `${v}px`})`,
|
|
550
|
-
]).join(', ') +
|
|
551
|
-
`, or a size like 6px. more and less step through them in that order, ${ROUND_TO_PILL_STEP} included. Whole theme: sets the 4 corner tokens in the base theme's proportions (containers and pages at most as round as at pill; inner corners at most as round as at round), and gives the chat radius (--radius-chat: a composer, its drawer, message bubbles) from the container radius, at the base theme's ratio of the two and at most one and a half times the base's chat radius, so it follows it and moves the way the corners move. With --on <part or group>: that part's border-radius. Corners are a size, so they are the same in light and dark.`,
|
|
552
|
-
values: 'square|small|medium|large|round|pill|more|less|<size like 6px>',
|
|
553
|
-
examples: [
|
|
554
|
-
'set my corners pill',
|
|
555
|
-
'set my corners more',
|
|
556
|
-
'set my corners square --on button',
|
|
557
|
-
'set my corners large --on containers',
|
|
558
|
-
],
|
|
559
|
-
words:
|
|
560
|
-
'round rounded radius corner corners curve curved circle circular pill sharp square border-radius bubbly soft',
|
|
561
|
-
},
|
|
562
|
-
spacing: {
|
|
563
|
-
help:
|
|
564
|
-
'How much room there is: padding, gaps and control heights together. Rungs: ' +
|
|
565
|
-
SPACING.map(([n, f]) => `${n} (x${f})`).join(', ') +
|
|
566
|
-
'. Whole theme: scales every spacing token and control height (a denser theme has shorter controls; the small, medium and large sizes stay apart and in order, none under 24px). With --on <part or group>: only inside it.',
|
|
567
|
-
values: 'tight|compact|medium|roomy|spacious|more|less',
|
|
568
|
-
examples: [
|
|
569
|
-
'set my spacing compact',
|
|
570
|
-
'set my spacing more',
|
|
571
|
-
'set my spacing roomy --on card',
|
|
572
|
-
],
|
|
573
|
-
words: `spacing space room density padding gap gaps margin breathing spread ${densityWords('roomy', 'dense', 'crowded').replace(/\|/g, ' ')}`,
|
|
574
|
-
},
|
|
575
|
-
accent: {
|
|
576
|
-
help: 'The main brand color: primary buttons, links, selection and the focus ring. From the one color the editor generates its shades, light and dark, and points the accent tokens at them: --color-accent, --color-on-accent, --color-text-accent, --color-icon-accent, --color-accent-muted and --focus-outline-color. The fill keeps the exact color you gave in light, and in dark too when text on it reads at 4.5:1 and it stands out from the dark page at 3:1; otherwise dark mode uses shade 70, where the official themes put a dark fill, or the shade nearest it that passes both, and the result says so. Text on the fill is the neutral color\'s white or near-black (pure white or black without a neutral color), whichever reads on it. The fill never moves: when no text reads on it, or a pale fill does not stand out from the light page, the result says so. Other tokens move to a nearby shade when they must read: text at 4.5:1, the focus ring at 3:1. `how colors` explains it; the Colors preview page (`preview add`) shows every shade. For an exact color, set the token itself (set my --color-accent "#7c3aed"): an exact token always wins over the generated colors.',
|
|
577
|
-
values: '<color>',
|
|
578
|
-
examples: ['set my accent "#7c3aed"', 'set my accent rebeccapurple'],
|
|
579
|
-
words:
|
|
580
|
-
'accent brand primary main color colour key highlight link selection seed',
|
|
581
|
-
},
|
|
582
|
-
neutral: {
|
|
583
|
-
help: "The gray of the theme: surfaces (cards, panels, popovers, muted fills), text, icons, borders, skeletons and hover tints. The page background follows it too, at the official theme's page shade of the gray; a colored gray's pale shades fade toward white as a gray scale's do, so the page and the cards on it carry only a faint tint of it. For a clearly tinted page (cream, a pale blue) or a white one, set --color-background-body to that color (with --mode light in a theme with both modes), which then keeps its color. From the one color the editor generates light and dark shades; your exact color sits at its own shade in both modes, and the shades around it follow it. The surface, text, icon, border, skeleton and overlay tokens point at those shades. Secondary text and icons move to a shade that reads on the surfaces. Give a gray with a little color (\"#64748b\") for a cool or warm neutral; a strong color makes colored surfaces. `how colors` explains it.",
|
|
584
|
-
values: '<color>',
|
|
585
|
-
examples: ['set my neutral "#64748b"', 'set my neutral "#78716c"'],
|
|
586
|
-
words:
|
|
587
|
-
'neutral gray grey surface surfaces background text border tint warm cool slate stone',
|
|
588
|
-
},
|
|
589
|
-
success: {
|
|
590
|
-
help: 'The success color (done, valid, positive). From it the editor generates light and dark shades, and --color-success, --color-on-success, --color-text-success, --color-icon-success, --color-success-muted, --color-on-success-muted and --color-border-success point at them. `how colors` explains it.',
|
|
591
|
-
values: '<color>',
|
|
592
|
-
examples: ['set my success "#16a34a"'],
|
|
593
|
-
words: 'success green ok valid positive done status',
|
|
594
|
-
},
|
|
595
|
-
warning: {
|
|
596
|
-
help: 'The warning color (caution). From it the editor generates light and dark shades, and the --color-warning tokens (fill, on, text, icon, muted, on-muted, border) point at them. `how colors` explains it.',
|
|
597
|
-
values: '<color>',
|
|
598
|
-
examples: ['set my warning "#f59e0b"'],
|
|
599
|
-
words: 'warning caution yellow amber status',
|
|
600
|
-
},
|
|
601
|
-
danger: {
|
|
602
|
-
help: 'The danger color (errors, destructive actions). From it the editor generates light and dark shades, and the --color-error tokens (fill, on, text, icon, muted, on-muted, border) point at them. `how colors` explains it.',
|
|
603
|
-
values: '<color>',
|
|
604
|
-
examples: ['set my danger "#dc2626"'],
|
|
605
|
-
words: 'danger error destructive red invalid negative status',
|
|
606
|
-
},
|
|
607
|
-
info: {
|
|
608
|
-
help: 'The info color (notices, help). From it the editor generates light and dark shades, and the --color-info tokens (fill, on, text, icon, muted, on-muted, border) point at them. `how colors` explains it.',
|
|
609
|
-
values: '<color>',
|
|
610
|
-
examples: ['set my info "#0284c7"'],
|
|
611
|
-
words: 'info information notice help blue status',
|
|
612
|
-
},
|
|
613
|
-
vibrancy: {
|
|
614
|
-
help: 'How saturated the generated colors are: 0 is gray, 100 the most vivid, 50 the default; more and less step by 10. Every color the theme sets (accent, neutral, success, warning, danger, info) is generated again; each exact color you gave stays as given at its own shade, and the shades around it get more or less color. more at 100 and less at 0 change nothing, so they are refused. The whole theme only, and only once the theme sets a color; undoing the last color removes vibrancy too.',
|
|
615
|
-
values: '<0-100>|more|less',
|
|
616
|
-
examples: ['set my vibrancy 70', 'set my vibrancy less'],
|
|
617
|
-
words:
|
|
618
|
-
'vibrancy vibrant saturation saturated colorful colourful vivid muted dull washed pastel intense',
|
|
619
|
-
},
|
|
620
|
-
font: {
|
|
621
|
-
help:
|
|
622
|
-
'The typeface. System presets (fonts systems ship, so no package loads them; a system with none of a stack shows its own font of that kind, and a picture says when this machine draws a serif, monospace or cursive stack in a font of another kind): ' +
|
|
623
|
-
SYSTEM_FONTS.join(', ') +
|
|
624
|
-
'. Open fonts with a loading package: ' +
|
|
625
|
-
Object.keys(OPEN_FONTS).join(', ') +
|
|
626
|
-
' (previews show them when the package is installed; the result names the import line for the app). Also: rounded (Nunito, an open font: it loads once its package is installed, and until then shows Varela Round or the system font), any family name in quotes, or a whole stack with commas ("Inter, Helvetica, sans-serif"). Whole theme: body and headings. With --on heading|body|code: only that role. An open font loads only once its package is installed (the result of set names the install line for your package manager, and the closest font that needs no install); any other font must be loaded by the app.',
|
|
627
|
-
values: `${[...Object.keys(FONTS), ...Object.keys(OPEN_FONTS)].join('|')}|"<family or stack>"`,
|
|
628
|
-
examples: [
|
|
629
|
-
'set my font mono',
|
|
630
|
-
'set my font serif --on heading',
|
|
631
|
-
'set my font "Inter"',
|
|
632
|
-
],
|
|
633
|
-
words:
|
|
634
|
-
'font typeface type family letters serif sans mono monospace typography',
|
|
635
|
-
},
|
|
636
|
-
headings: {
|
|
637
|
-
help:
|
|
638
|
-
'How headings look, all levels and display sizes together. Weight: ' +
|
|
639
|
-
Object.entries(HEADING_WEIGHTS)
|
|
640
|
-
.map(([n, v]) => `${n} (${v})`)
|
|
641
|
-
.join(', ') +
|
|
642
|
-
'. Tracking (letter spacing): ' +
|
|
643
|
-
Object.entries(HEADING_TRACKING)
|
|
644
|
-
.map(([n, v]) => `${n} (${v})`)
|
|
645
|
-
.join(', ') +
|
|
646
|
-
'. Set one word at a time: weight words and tracking words are separate settings. headings always wins over type for weight and tracking, whatever the order. Whole theme only; for one heading level use font-weight --on heading --when level:<1-6>.',
|
|
647
|
-
values: [
|
|
648
|
-
...Object.keys(HEADING_WEIGHTS),
|
|
649
|
-
...Object.keys(HEADING_TRACKING),
|
|
650
|
-
].join('|'),
|
|
651
|
-
examples: ['set my headings bold', 'set my headings tight'],
|
|
652
|
-
words:
|
|
653
|
-
'heading headings title titles display headline bold heavy weight tracking letter spacing tight',
|
|
654
|
-
},
|
|
655
|
-
surfaces: {
|
|
656
|
-
help: 'How panels (cards, dialogs, popovers, menus, the banner) sit on the page. flat: no border, no shadow, a tinted fill (menus, popovers and dialogs, which float over the page, keep their own fill and a hairline border instead). outlined: a 1px border, no shadow. raised: no border, a soft shadow. glass: see-through fill with a blur and a faint light edge. Moves every container at once.',
|
|
657
|
-
values: Object.keys(SURFACES).join('|'),
|
|
658
|
-
examples: ['set my surfaces outlined', 'set my surfaces raised'],
|
|
659
|
-
words:
|
|
660
|
-
'surface surfaces panel panels flat outlined raised elevated glass frosted blur depth',
|
|
661
|
-
},
|
|
662
|
-
buttons: {
|
|
663
|
-
help: 'The button style, all variants together. solid: filled primary (the default). outline: primary is an accent outline with accent text. soft: primary is a light accent tint with accent text. caps: solid with uppercase, bold, spaced labels that never shrink. Corners come from the corners dial (corners pill --on button).',
|
|
664
|
-
values: 'solid|outline|soft|caps',
|
|
665
|
-
examples: ['set my buttons outline', 'set my buttons caps'],
|
|
666
|
-
words: 'cta solid outline outlined soft tint caps uppercase filled',
|
|
667
|
-
},
|
|
668
|
-
badges: {
|
|
669
|
-
help: "The badge style, the status and category badges together, in the theme's own status and category colors; the neutral badge keeps its look. solid: each status badge filled with its status color, its text in that color's on-color; each category badge filled with a strong color of its hue, its text in the page color or the primary text color. soft: each status badge a light tint of its color with text in that tint's on-color; the category badges keep their look. outline: each status and category badge a thin line in its own text color, with that text, on the surface it sits on. Each badge takes the first of its colors that reads at 4.5:1. A badge none of whose own colors read on the base falls back to a pair that reads, where one exists, and the set result names it: in solid it keeps its tint; in outline it draws the primary text inside a line of its color. show names a badge that still does not read. A property the theme sets on the badge itself stays, in the modes it is set for. Corners come from the corners dial (corners <value> --on badge).",
|
|
670
|
-
values: 'solid|soft|outline',
|
|
671
|
-
examples: ['set my badges soft', 'set my badges outline'],
|
|
672
|
-
words:
|
|
673
|
-
'badge badges tag tags label labels chip chips status solid filled soft tint tinted outline outlined',
|
|
674
|
-
},
|
|
675
|
-
type: {
|
|
676
|
-
help: 'The type personality: how far headings step up from body text and how they are set. compact: small steps (x1.15), semibold. standard: the default (x1.2). editorial: bigger steps (x1.3), tight tracking, semibold. display: big steps (x1.4), heavy weight, tighter tracking (a marketing feel). Text below the base size keeps its standard sizes, so small text stays readable. Works with text-size; a headings setting keeps its weight or tracking whatever the order. Phones (touch screens below 1024px wide) keep the base theme reading sizes.',
|
|
677
|
-
values: Object.keys(TYPE_STYLES).join('|'),
|
|
678
|
-
examples: ['set my type display', 'set my type editorial'],
|
|
679
|
-
words:
|
|
680
|
-
'typography personality editorial display marketing scale hierarchy hero',
|
|
681
|
-
},
|
|
682
|
-
'text-size': {
|
|
683
|
-
help:
|
|
684
|
-
'Base text size; every heading size scales from it. Rungs: ' +
|
|
685
|
-
TEXT_SIZE.map(([n, v]) => `${n} (${v}px)`).join(', ') +
|
|
686
|
-
', or a number of pixels from 10 to 32. Phones (touch screens below 1024px wide) keep the base theme reading sizes.',
|
|
687
|
-
values: 'small|medium|large|larger|more|less|<number>',
|
|
688
|
-
unit: 'px',
|
|
689
|
-
examples: ['set my text-size small', 'set my text-size more'],
|
|
690
|
-
words: 'text size font size small big large scale',
|
|
691
|
-
},
|
|
692
|
-
base: {
|
|
693
|
-
...baseDialWords(),
|
|
694
|
-
examples: ['set my base neutral', 'set my base none'],
|
|
695
|
-
words: 'base start starting built-in extends foundation',
|
|
696
|
-
},
|
|
697
|
-
mode: {
|
|
698
|
-
help: "Which color modes the theme supports. light-only / dark-only: the colors the theme sets get one value, its mode's shade; settings saved for the other mode stay saved but do not apply (the result names them); the in-app preview starts in that mode with no switch. both (default): colors without --mode apply to both; --mode light|dark sets one side, and the other side keeps the base theme's value.",
|
|
699
|
-
values: 'both|light-only|dark-only',
|
|
700
|
-
examples: ['set my mode dark-only'],
|
|
701
|
-
words: 'mode light dark only night day scheme',
|
|
702
|
-
},
|
|
703
|
-
});
|
|
704
|
-
|
|
705
|
-
/** CSS properties grouped by the aspect of a part they change. */
|
|
706
|
-
export const GROUPS = wordTable(
|
|
707
|
-
/** @type {Record<string, string[]>} */ ({
|
|
708
|
-
text: ['color', 'fill', '-webkit-text-fill-color', 'caret-color'],
|
|
709
|
-
background: ['background-color', 'background-image', 'background'],
|
|
710
|
-
border: [
|
|
711
|
-
'border-color',
|
|
712
|
-
'border-top-color',
|
|
713
|
-
'border-bottom-color',
|
|
714
|
-
'border-left-color',
|
|
715
|
-
'border-right-color',
|
|
716
|
-
'border-block-color',
|
|
717
|
-
'border-inline-color',
|
|
718
|
-
'border-width',
|
|
719
|
-
'border-style',
|
|
720
|
-
'outline-color',
|
|
721
|
-
],
|
|
722
|
-
corners: [
|
|
723
|
-
'border-radius',
|
|
724
|
-
'border-start-start-radius',
|
|
725
|
-
'border-start-end-radius',
|
|
726
|
-
'border-end-start-radius',
|
|
727
|
-
'border-end-end-radius',
|
|
728
|
-
'border-top-left-radius',
|
|
729
|
-
'border-top-right-radius',
|
|
730
|
-
'border-bottom-left-radius',
|
|
731
|
-
'border-bottom-right-radius',
|
|
732
|
-
],
|
|
733
|
-
shadow: ['box-shadow'],
|
|
734
|
-
spacing: [
|
|
735
|
-
'padding',
|
|
736
|
-
'padding-block',
|
|
737
|
-
'padding-inline',
|
|
738
|
-
'padding-top',
|
|
739
|
-
'padding-bottom',
|
|
740
|
-
'padding-inline-start',
|
|
741
|
-
'padding-inline-end',
|
|
742
|
-
'padding-left',
|
|
743
|
-
'padding-right',
|
|
744
|
-
'gap',
|
|
745
|
-
'row-gap',
|
|
746
|
-
'column-gap',
|
|
747
|
-
'margin',
|
|
748
|
-
'margin-block',
|
|
749
|
-
'margin-inline',
|
|
750
|
-
'margin-top',
|
|
751
|
-
'margin-bottom',
|
|
752
|
-
'margin-left',
|
|
753
|
-
'margin-right',
|
|
754
|
-
'margin-block-start',
|
|
755
|
-
'margin-block-end',
|
|
756
|
-
'margin-inline-start',
|
|
757
|
-
'margin-inline-end',
|
|
758
|
-
],
|
|
759
|
-
font: [
|
|
760
|
-
'font-family',
|
|
761
|
-
'font-size',
|
|
762
|
-
'font-weight',
|
|
763
|
-
'line-height',
|
|
764
|
-
'letter-spacing',
|
|
765
|
-
'text-transform',
|
|
766
|
-
],
|
|
767
|
-
size: [
|
|
768
|
-
'height',
|
|
769
|
-
'min-height',
|
|
770
|
-
'width',
|
|
771
|
-
'min-width',
|
|
772
|
-
'block-size',
|
|
773
|
-
'inline-size',
|
|
774
|
-
],
|
|
775
|
-
}),
|
|
776
|
-
);
|
|
777
|
-
|
|
778
|
-
/** The CSS property that sets each aspect directly, whatever token it reads. */
|
|
779
|
-
export const DIRECT = wordTable(
|
|
780
|
-
/** @type {Record<string, string>} */ ({
|
|
781
|
-
text: 'color',
|
|
782
|
-
background: 'background',
|
|
783
|
-
border: 'border',
|
|
784
|
-
corners: 'border-radius',
|
|
785
|
-
shadow: 'box-shadow',
|
|
786
|
-
spacing: 'padding',
|
|
787
|
-
font: 'font-weight',
|
|
788
|
-
size: 'min-height',
|
|
789
|
-
}),
|
|
790
|
-
);
|
|
791
|
-
|
|
792
|
-
/** Properties whose value is one plain color. */
|
|
793
|
-
export const COLOR_PROPS =
|
|
794
|
-
/^(color|background-color|border(-(top|right|bottom|left|block|inline))?-color|outline-color|fill|stroke|caret-color|text-decoration-color)$/;
|
|
795
|
-
|
|
796
|
-
/** Tokens `show` prints the resolved value of. */
|
|
797
|
-
export const KEY_TOKENS = [
|
|
798
|
-
'--color-accent',
|
|
799
|
-
'--color-text-accent',
|
|
800
|
-
'--color-on-accent',
|
|
801
|
-
'--color-background-body',
|
|
802
|
-
'--color-background-surface',
|
|
803
|
-
'--color-background-card',
|
|
804
|
-
'--color-text-primary',
|
|
805
|
-
'--color-text-secondary',
|
|
806
|
-
'--color-border',
|
|
807
|
-
'--radius-element',
|
|
808
|
-
'--radius-container',
|
|
809
|
-
'--spacing-4',
|
|
810
|
-
'--font-family-body',
|
|
811
|
-
];
|
|
812
|
-
|
|
813
|
-
/** The CSS properties `how --list properties` shows without a filter. */
|
|
814
|
-
export const COMMON_PROPERTIES = [
|
|
815
|
-
'background',
|
|
816
|
-
'background-color',
|
|
817
|
-
'color',
|
|
818
|
-
'border',
|
|
819
|
-
'border-color',
|
|
820
|
-
'border-width',
|
|
821
|
-
'border-style',
|
|
822
|
-
'border-radius',
|
|
823
|
-
'box-shadow',
|
|
824
|
-
'padding',
|
|
825
|
-
'gap',
|
|
826
|
-
'min-height',
|
|
827
|
-
'font-family',
|
|
828
|
-
'font-size',
|
|
829
|
-
'font-weight',
|
|
830
|
-
'letter-spacing',
|
|
831
|
-
'text-transform',
|
|
832
|
-
'opacity',
|
|
833
|
-
'outline',
|
|
834
|
-
];
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* Words people use for a thing that is not a dial, token or property, and
|
|
838
|
-
* the commands that do what they mean.
|
|
839
|
-
* @type {Record<string, (value: string, on: string | undefined) => string[]>}
|
|
840
|
-
*/
|
|
841
|
-
export const THING_HINTS = wordTable({
|
|
842
|
-
gradient: (v, on) => [
|
|
843
|
-
`${P} set <theme> background "linear-gradient(${v || '#ffffff, #dddddd'})" --on ${on ?? '<part>'}`,
|
|
844
|
-
],
|
|
845
|
-
bevel: (_v, on) => [
|
|
846
|
-
`${P} set <theme> box-shadow "inset 1px 1px 0 #ffffff, inset -1px -1px 0 #9ca3af" --on ${on ?? '<part>'}`,
|
|
847
|
-
],
|
|
848
|
-
// The value given is carried (none, false and off are no shadow); the
|
|
849
|
-
// sample only when none is.
|
|
850
|
-
shadow: (v, on) => [
|
|
851
|
-
`${P} set <theme> box-shadow ${/^(none|false|off|no|0)$/i.test(v.trim()) ? 'none' : v.trim() ? JSON.stringify(v.trim()) : '"0 2px 6px rgb(0 0 0 / 0.3)"'} --on ${on ?? '<part>'}`,
|
|
852
|
-
],
|
|
853
|
-
radius: (v, on) => [
|
|
854
|
-
`${P} set <theme> corners ${v || 'medium'}${on ? ` --on ${on}` : ''}`,
|
|
855
|
-
],
|
|
856
|
-
rounded: (v, on) => [
|
|
857
|
-
`${P} set <theme> corners ${/^(none|false|off|no|0)$/i.test(v.trim()) ? 'square' : /^(true|yes|on)?$/i.test(v.trim()) ? 'round' : v.trim()}${on ? ` --on ${on}` : ''}`,
|
|
858
|
-
],
|
|
859
|
-
padding: (_v, on) => [
|
|
860
|
-
`${P} set <theme> spacing roomy${on ? ` --on ${on}` : ''}`,
|
|
861
|
-
`${P} set <theme> padding 12px --on ${on ?? '<part>'}`,
|
|
862
|
-
],
|
|
863
|
-
// The density named carries over: a spacing rung as it is, a word for
|
|
864
|
-
// more or less room as the rung that way; else how spacing.
|
|
865
|
-
density: (v, on) => {
|
|
866
|
-
const w = v.trim().toLowerCase();
|
|
867
|
-
const rung = SPACING.some(([n]) => n === w)
|
|
868
|
-
? w
|
|
869
|
-
: new RegExp(`^(?:${densityWords('roomy')})$`).test(w)
|
|
870
|
-
? 'roomy'
|
|
871
|
-
: new RegExp(
|
|
872
|
-
`^(?:${densityWords('dense', 'crowded')}|small|less)$`,
|
|
873
|
-
).test(w)
|
|
874
|
-
? 'compact'
|
|
875
|
-
: null;
|
|
876
|
-
return [
|
|
877
|
-
rung
|
|
878
|
-
? `${P} set <theme> spacing ${rung}${on ? ` --on ${on}` : ''}`
|
|
879
|
-
: `${HOW} spacing`,
|
|
880
|
-
];
|
|
881
|
-
},
|
|
882
|
-
bold: (v, on) => [
|
|
883
|
-
`${P} set <theme> font-weight ${/^(none|false|off|no|normal)$/i.test(v.trim()) ? 'normal' : 'bold'} --on ${on ?? '<part>'}`,
|
|
884
|
-
],
|
|
885
|
-
'text-color': (_v, on) => [`${HOW} "text color on ${on ?? '<part>'}"`],
|
|
886
|
-
});
|
|
887
|
-
|
|
888
|
-
/** Sample values for design words in a `how` question. */
|
|
889
|
-
export const DESIGN = wordTable(
|
|
890
|
-
/** @type {Record<string, string>} */ ({
|
|
891
|
-
gradient: '"linear-gradient(#ffffff, #d1d5db)"',
|
|
892
|
-
glossy: '"linear-gradient(#ffffff 0%, #c7d2fe 45%, #6366f1 100%)"',
|
|
893
|
-
bevel: '"inset 1px 1px 0 #ffffff, inset -1px -1px 0 #9ca3af"',
|
|
894
|
-
'sunken bevel': '"inset 1px 1px 0 #9ca3af, inset -1px -1px 0 #ffffff"',
|
|
895
|
-
raised: '"0 1px 2px rgb(0 0 0 / 0.3)"',
|
|
896
|
-
flat: 'none',
|
|
897
|
-
sunken: '"inset 1px 1px 2px rgb(0 0 0 / 0.3)"',
|
|
898
|
-
}),
|
|
899
|
-
);
|
|
900
|
-
|
|
901
|
-
/**
|
|
902
|
-
* Parts drawn by a Card (their class sits on the Card's own element), so
|
|
903
|
-
* their padding is the card's padding variables.
|
|
904
|
-
*/
|
|
905
|
-
export const CARD_LIKE = ['clickable-card', 'selectable-card'];
|
|
906
|
-
|
|
907
|
-
/**
|
|
908
|
-
* Parts whose theme class sits on a transparent wrapper while Core draws the
|
|
909
|
-
* visible box on an inner element with no class of its own (see
|
|
910
|
-
* /core-gaps: the composer body). Padding reaches the box only through the
|
|
911
|
-
* part's padding variable; a surface (background, border, shadow) paints
|
|
912
|
-
* the wrapper's square corners; a density re-sets the variable on the box.
|
|
913
|
-
*/
|
|
914
|
-
export const WRAPPED_PARTS = /** @type {Record<string, {box: string}>} */ ({
|
|
915
|
-
'chat-composer': {box: 'the rounded composer body'},
|
|
916
|
-
});
|
|
917
|
-
|
|
918
|
-
/**
|
|
919
|
-
* The pseudo-classes of CSS Selectors (Level 4 and 5, and the HTML, media,
|
|
920
|
-
* view-transition, scroll-marker and interest states browsers ship), by
|
|
921
|
-
* name: the names a part's `:name` block is read against, so one a typo
|
|
922
|
-
* away from a name here is named as that typo.
|
|
923
|
-
*/
|
|
924
|
-
export const CSS_PSEUDO_CLASSES = new Set([
|
|
925
|
-
'active',
|
|
926
|
-
'active-view-transition',
|
|
927
|
-
'active-view-transition-type',
|
|
928
|
-
'any-link',
|
|
929
|
-
'autofill',
|
|
930
|
-
'blank',
|
|
931
|
-
'buffering',
|
|
932
|
-
'checked',
|
|
933
|
-
'closed',
|
|
934
|
-
'current',
|
|
935
|
-
'default',
|
|
936
|
-
'defined',
|
|
937
|
-
'dir',
|
|
938
|
-
'disabled',
|
|
939
|
-
'empty',
|
|
940
|
-
'enabled',
|
|
941
|
-
'first',
|
|
942
|
-
'first-child',
|
|
943
|
-
'first-of-type',
|
|
944
|
-
'focus',
|
|
945
|
-
'focus-visible',
|
|
946
|
-
'focus-within',
|
|
947
|
-
'fullscreen',
|
|
948
|
-
'future',
|
|
949
|
-
'has',
|
|
950
|
-
'has-slotted',
|
|
951
|
-
'heading',
|
|
952
|
-
'host',
|
|
953
|
-
'host-context',
|
|
954
|
-
'hover',
|
|
955
|
-
'in-range',
|
|
956
|
-
'indeterminate',
|
|
957
|
-
'interest-source',
|
|
958
|
-
'interest-target',
|
|
959
|
-
'invalid',
|
|
960
|
-
'is',
|
|
961
|
-
'lang',
|
|
962
|
-
'last-child',
|
|
963
|
-
'last-of-type',
|
|
964
|
-
'left',
|
|
965
|
-
'link',
|
|
966
|
-
'local-link',
|
|
967
|
-
'modal',
|
|
968
|
-
'muted',
|
|
969
|
-
'not',
|
|
970
|
-
'nth-child',
|
|
971
|
-
'nth-col',
|
|
972
|
-
'nth-last-child',
|
|
973
|
-
'nth-last-col',
|
|
974
|
-
'nth-last-of-type',
|
|
975
|
-
'nth-of-type',
|
|
976
|
-
'only-child',
|
|
977
|
-
'only-of-type',
|
|
978
|
-
'open',
|
|
979
|
-
'optional',
|
|
980
|
-
'out-of-range',
|
|
981
|
-
'past',
|
|
982
|
-
'paused',
|
|
983
|
-
'picture-in-picture',
|
|
984
|
-
'placeholder-shown',
|
|
985
|
-
'playing',
|
|
986
|
-
'popover-open',
|
|
987
|
-
'read-only',
|
|
988
|
-
'read-write',
|
|
989
|
-
'required',
|
|
990
|
-
'right',
|
|
991
|
-
'root',
|
|
992
|
-
'scope',
|
|
993
|
-
'seeking',
|
|
994
|
-
'stalled',
|
|
995
|
-
'state',
|
|
996
|
-
'target',
|
|
997
|
-
'target-after',
|
|
998
|
-
'target-before',
|
|
999
|
-
'target-current',
|
|
1000
|
-
'target-within',
|
|
1001
|
-
'user-invalid',
|
|
1002
|
-
'user-valid',
|
|
1003
|
-
'valid',
|
|
1004
|
-
'visited',
|
|
1005
|
-
'volume-locked',
|
|
1006
|
-
'where',
|
|
1007
|
-
'xr-overlay',
|
|
1008
|
-
]);
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* The pseudo-elements of CSS (the `::name` forms browsers ship), by name: the
|
|
1012
|
-
* names a part's `::name` block is read against. The four CSS 2 ones also
|
|
1013
|
-
* take one colon.
|
|
1014
|
-
*/
|
|
1015
|
-
export const CSS_PSEUDO_ELEMENTS = new Set([
|
|
1016
|
-
'after',
|
|
1017
|
-
'backdrop',
|
|
1018
|
-
'before',
|
|
1019
|
-
'checkmark',
|
|
1020
|
-
'column',
|
|
1021
|
-
'cue',
|
|
1022
|
-
'cue-region',
|
|
1023
|
-
'details-content',
|
|
1024
|
-
'file-selector-button',
|
|
1025
|
-
'first-letter',
|
|
1026
|
-
'first-line',
|
|
1027
|
-
'grammar-error',
|
|
1028
|
-
'highlight',
|
|
1029
|
-
'marker',
|
|
1030
|
-
'part',
|
|
1031
|
-
'picker',
|
|
1032
|
-
'picker-icon',
|
|
1033
|
-
'placeholder',
|
|
1034
|
-
'scroll-button',
|
|
1035
|
-
'scroll-marker',
|
|
1036
|
-
'scroll-marker-group',
|
|
1037
|
-
'search-text',
|
|
1038
|
-
'selection',
|
|
1039
|
-
'slotted',
|
|
1040
|
-
'spelling-error',
|
|
1041
|
-
'target-text',
|
|
1042
|
-
'view-transition',
|
|
1043
|
-
'view-transition-group',
|
|
1044
|
-
'view-transition-image-pair',
|
|
1045
|
-
'view-transition-new',
|
|
1046
|
-
'view-transition-old',
|
|
1047
|
-
]);
|
|
1048
|
-
|
|
1049
|
-
/** The pseudo-elements CSS 2 wrote with one colon, which browsers still read. */
|
|
1050
|
-
export const ONE_COLON_PSEUDO_ELEMENTS = new Set([
|
|
1051
|
-
'after',
|
|
1052
|
-
'before',
|
|
1053
|
-
'first-letter',
|
|
1054
|
-
'first-line',
|
|
1055
|
-
]);
|
|
1056
|
-
|
|
1057
|
-
/** Other words for a state, each read as the first of these there is. */
|
|
1058
|
-
export const STATE_SYNONYMS = wordTable(
|
|
1059
|
-
/** @type {Record<string, string[]>} */ ({
|
|
1060
|
-
pressed: ['isPressed', 'active'],
|
|
1061
|
-
press: ['isPressed', 'active'],
|
|
1062
|
-
on: ['isPressed', 'checked', 'selected'],
|
|
1063
|
-
down: ['active'],
|
|
1064
|
-
clicked: ['active'],
|
|
1065
|
-
hovered: ['hover'],
|
|
1066
|
-
focused: ['focus-visible', 'focus-within', 'focus'],
|
|
1067
|
-
checked: ['checked', 'selected'],
|
|
1068
|
-
selected: ['selected', 'checked'],
|
|
1069
|
-
open: ['open', 'expanded'],
|
|
1070
|
-
expanded: ['expanded', 'open'],
|
|
1071
|
-
inactive: ['disabled'],
|
|
1072
|
-
}),
|
|
1073
|
-
);
|
|
1074
|
-
|
|
1075
|
-
/** States every part takes, beyond the ones its doc lists. */
|
|
1076
|
-
export const COMMON_STATES = [
|
|
1077
|
-
'hover',
|
|
1078
|
-
'active',
|
|
1079
|
-
'focus',
|
|
1080
|
-
'focus-visible',
|
|
1081
|
-
'focus-within',
|
|
1082
|
-
'disabled',
|
|
1083
|
-
];
|
|
1084
|
-
|
|
1085
|
-
/**
|
|
1086
|
-
* Words for a mode, and the mode each means, beside the mode's own name in
|
|
1087
|
-
* its written forms (dark-only, darkmode, mode dark), which modeWord reads:
|
|
1088
|
-
* the table of the one mode reader.
|
|
1089
|
-
*/
|
|
1090
|
-
export const MODE_WORDS = /** @type {Record<string, 'light' | 'dark'>} */ ({
|
|
1091
|
-
day: 'light',
|
|
1092
|
-
daytime: 'light',
|
|
1093
|
-
night: 'dark',
|
|
1094
|
-
nighttime: 'dark',
|
|
1095
|
-
});
|
|
1096
|
-
|
|
1097
|
-
// These tables are looked up by words people type: with no prototype,
|
|
1098
|
-
// `constructor` or `__proto__` is never found in them.
|
|
1099
|
-
for (const table of [
|
|
1100
|
-
FAMILIES,
|
|
1101
|
-
FONTS,
|
|
1102
|
-
OPEN_FONTS,
|
|
1103
|
-
CLOSEST_OPEN_FONT,
|
|
1104
|
-
HEADING_WEIGHTS,
|
|
1105
|
-
HEADING_TRACKING,
|
|
1106
|
-
SURFACES,
|
|
1107
|
-
TYPE_STYLES,
|
|
1108
|
-
DIALS,
|
|
1109
|
-
GROUPS,
|
|
1110
|
-
DIRECT,
|
|
1111
|
-
THING_HINTS,
|
|
1112
|
-
DESIGN,
|
|
1113
|
-
MODE_WORDS,
|
|
1114
|
-
])
|
|
1115
|
-
Object.setPrototypeOf(table, null);
|
|
1116
|
-
|
|
1117
|
-
/** The groups of the theme-building page (its sections), in order. */
|
|
1118
|
-
export const SHOWCASE_GROUPS = Object.freeze([
|
|
1119
|
-
'actions',
|
|
1120
|
-
'inputs',
|
|
1121
|
-
'selection',
|
|
1122
|
-
'navigation',
|
|
1123
|
-
'feedback',
|
|
1124
|
-
'data',
|
|
1125
|
-
'containers',
|
|
1126
|
-
'overlays',
|
|
1127
|
-
'pages',
|
|
1128
|
-
]);
|