@astryxdesign/cli 0.7.18-canary.gfacee17 → 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 +5 -5
- 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 +2 -2
- package/api/icon/_adapter.mjs +6 -2
- package/api/icon/_authoring.mjs +22 -13
- package/api/icon/_default-look.mjs +15 -15
- package/api/icon/add/add.mjs +14 -9
- package/api/icon/icon.doc.mjs +7 -7
- package/api/icon/icon.type.d.mts +33 -33
- package/api/icon/icon.type.mjs +45 -45
- package/api/icon/iconAdd.doc.mjs +9 -10
- package/api/icon/iconMap.doc.mjs +11 -12
- package/api/icon/iconNewDefinition.doc.mjs +8 -8
- package/api/icon/iconNewSet.doc.mjs +5 -5
- package/api/icon/map/map.mjs +7 -7
- 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/integration/validate-integration.type.d.mts +6 -6
- package/api/integration/validate-integration.type.mjs +6 -6
- package/api/render/_adapter.d.mts +5 -3
- package/api/render/_adapter.mjs +64 -4
- package/api/render/render.doc.mjs +9 -2
- package/api/render/render.mjs +5 -2
- package/api/render/render.type.d.mts +17 -0
- package/api/render/render.type.mjs +10 -0
- 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/data-colors-in-renderers.doc.mjs +400 -0
- package/assets/docs/tree/font-setup.doc.mjs +30 -0
- package/assets/docs/tree/icon-sets.doc.mjs +2 -2
- package/assets/docs/tree/share-a-page.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/tree/visualization.doc.mjs +30 -0
- 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/doctor.mjs +2 -2
- package/clients/cli/commands/experimental/export.mjs +2 -1
- package/clients/cli/commands/experimental/icon.mjs +17 -17
- package/clients/cli/commands/experimental/index.mjs +0 -5
- package/clients/cli/commands/experimental/render-output.mjs +9 -0
- package/clients/cli/commands/experimental-export.doc.mjs +6 -0
- package/clients/cli/commands/experimental-icon-add.doc.mjs +8 -8
- package/clients/cli/commands/experimental-icon-map.doc.mjs +6 -6
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +6 -6
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +3 -3
- package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +6 -6
- 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/cli-self-docs.mjs +4 -4
- package/foundation/discovery/fixture-refs.d.mts +51 -0
- package/foundation/discovery/fixture-refs.mjs +351 -0
- package/foundation/discovery/icon-definition-discovery.mjs +7 -7
- package/foundation/discovery/icon-ranking.mjs +2 -2
- package/foundation/discovery/icon-set-checks.mjs +6 -6
- package/foundation/discovery/icon-set-discovery.mjs +2 -2
- package/foundation/discovery/icon-set-writer.d.mts +24 -7
- package/foundation/discovery/icon-set-writer.mjs +75 -31
- 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/bundle.mjs +2 -2
- 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 +152 -0
- package/foundation/pictures/pictures.mjs +565 -0
- 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 +18 -15
- package/foundation/render/picture-playwright.mjs +10 -7
- package/foundation/render/picture-window.d.mts +13 -0
- package/foundation/render/picture-window.mjs +31 -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 +8 -69
- 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 -33291
- 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 -2294
- 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 -549
- package/api/theme-edit/_preview.mjs +0 -3264
- 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 -18435
- 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
|
@@ -2,8 +2,15 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
5
|
+
* The system family that replaced a family's older name, as the system
|
|
6
|
+
* names it, or null.
|
|
7
|
+
* @param {string} family without quotes
|
|
8
|
+
* @returns {string | null}
|
|
9
|
+
*/
|
|
10
|
+
export function systemFontSuccessor(family: string): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* The generic family that reaches one of Apple's interface faces, by any of
|
|
13
|
+
* its names, or null for any other family.
|
|
7
14
|
* @param {string} family without quotes
|
|
8
15
|
* @returns {string | null}
|
|
9
16
|
*/
|
|
@@ -143,6 +150,16 @@ export const SYSTEM_FONTS_BY_PLATFORM: {
|
|
|
143
150
|
'Android, ChromeOS and Linux': string[];
|
|
144
151
|
Linux: string[];
|
|
145
152
|
};
|
|
153
|
+
/**
|
|
154
|
+
* Older names of a system family, on the family that replaced them: a
|
|
155
|
+
* theme that names the older one ("MS Sans Serif") reaches the family a
|
|
156
|
+
* machine has now, written right after it.
|
|
157
|
+
* @type {Readonly<Record<string, {name: string, aliases: readonly string[]}>>}
|
|
158
|
+
*/
|
|
159
|
+
export const SYSTEM_FONT_ALIASES: Readonly<Record<string, {
|
|
160
|
+
name: string;
|
|
161
|
+
aliases: readonly string[];
|
|
162
|
+
}>>;
|
|
146
163
|
/**
|
|
147
164
|
* Apple's own interface faces, by lowercase name, with the generic family
|
|
148
165
|
* that reaches each. Apple systems hide them from a lookup by family name,
|
|
@@ -228,6 +228,33 @@ export const SYSTEM_FONTS_BY_PLATFORM = {
|
|
|
228
228
|
],
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Older names of a system family, on the family that replaced them: a
|
|
233
|
+
* theme that names the older one ("MS Sans Serif") reaches the family a
|
|
234
|
+
* machine has now, written right after it.
|
|
235
|
+
* @type {Readonly<Record<string, {name: string, aliases: readonly string[]}>>}
|
|
236
|
+
*/
|
|
237
|
+
export const SYSTEM_FONT_ALIASES = {
|
|
238
|
+
'microsoft sans serif': {
|
|
239
|
+
name: 'Microsoft Sans Serif',
|
|
240
|
+
aliases: ['ms sans serif'],
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The system family that replaced a family's older name, as the system
|
|
246
|
+
* names it, or null.
|
|
247
|
+
* @param {string} family without quotes
|
|
248
|
+
* @returns {string | null}
|
|
249
|
+
*/
|
|
250
|
+
export function systemFontSuccessor(family) {
|
|
251
|
+
const low = family.trim().toLowerCase();
|
|
252
|
+
return (
|
|
253
|
+
Object.values(SYSTEM_FONT_ALIASES).find(f => f.aliases.includes(low))
|
|
254
|
+
?.name ?? null
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
231
258
|
/**
|
|
232
259
|
* Apple's own interface faces, by lowercase name, with the generic family
|
|
233
260
|
* that reaches each. Apple systems hide them from a lookup by family name,
|
|
@@ -248,14 +275,26 @@ export const APPLE_FACE_GENERICS = /** @type {Record<string, string>} */ ({
|
|
|
248
275
|
});
|
|
249
276
|
|
|
250
277
|
/**
|
|
251
|
-
*
|
|
252
|
-
*
|
|
278
|
+
* Other names of those faces, by lowercase name, with the face's own name.
|
|
279
|
+
* `SFMono-Regular` is SF Mono's PostScript name, the one that monospace
|
|
280
|
+
* stacks name after `ui-monospace`.
|
|
281
|
+
*/
|
|
282
|
+
const APPLE_FACE_ALIASES = /** @type {Record<string, string>} */ ({
|
|
283
|
+
'sfmono-regular': 'sf mono',
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* The generic family that reaches one of Apple's interface faces, by any of
|
|
288
|
+
* its names, or null for any other family.
|
|
253
289
|
* @param {string} family without quotes
|
|
254
290
|
* @returns {string | null}
|
|
255
291
|
*/
|
|
256
292
|
export function appleFaceGeneric(family) {
|
|
257
|
-
const
|
|
258
|
-
// Only the
|
|
293
|
+
const name = family.trim().replace(/\s+/g, ' ').toLowerCase();
|
|
294
|
+
// Only the tables' own names: a word such as constructor is no face.
|
|
295
|
+
const key = Object.hasOwn(APPLE_FACE_ALIASES, name)
|
|
296
|
+
? APPLE_FACE_ALIASES[name]
|
|
297
|
+
: name;
|
|
259
298
|
return Object.hasOwn(APPLE_FACE_GENERICS, key)
|
|
260
299
|
? APPLE_FACE_GENERICS[key]
|
|
261
300
|
: null;
|
|
@@ -263,11 +302,13 @@ export function appleFaceGeneric(family) {
|
|
|
263
302
|
|
|
264
303
|
/**
|
|
265
304
|
* Every family a system ships, by lowercase name, and Apple's interface
|
|
266
|
-
* faces: nothing loads those either, and no install
|
|
305
|
+
* faces by each of their names: nothing loads those either, and no install
|
|
306
|
+
* line applies to them.
|
|
267
307
|
*/
|
|
268
308
|
const SYSTEM_FAMILIES = new Set([
|
|
269
309
|
...Object.values(SYSTEM_FONTS_BY_PLATFORM).flat(),
|
|
270
310
|
...Object.keys(APPLE_FACE_GENERICS),
|
|
311
|
+
...Object.keys(APPLE_FACE_ALIASES),
|
|
271
312
|
]);
|
|
272
313
|
|
|
273
314
|
/**
|
|
@@ -9,7 +9,7 @@ export const doc = {
|
|
|
9
9
|
displayName: 'generateTonalPalette()',
|
|
10
10
|
summary: 'Generate candidate tonal palette data without filesystem effects.',
|
|
11
11
|
description:
|
|
12
|
-
'Runs the recipe the request names: astryx-oklch-v1 when it names none, so a request or config made before v2 keeps its colors, or astryx-oklch-v2, whose pale stops follow the vibrancy and each seed\'s own chroma.
|
|
12
|
+
'Runs the recipe the request names: astryx-oklch-v1 when it names none, so a request or config made before v2 keeps its colors, or astryx-oklch-v2, whose pale stops follow the vibrancy and each seed\'s own chroma. A new config should name v2. A config keeps the recipe it records; to pin one, record "recipe": "astryx-oklch-v1" (or v2) in the palette config. The returned candidate ' +
|
|
13
13
|
'contains exact hex values for review; it does not modify a theme, write files, ' +
|
|
14
14
|
'perform semantic mapping, or make accessibility claims. Stop numbers remain ' +
|
|
15
15
|
'stable across layouts, and requested decimal stops are emitted explicitly. ' +
|
|
@@ -678,10 +678,11 @@ export function deriveLookColors({
|
|
|
678
678
|
m,
|
|
679
679
|
);
|
|
680
680
|
} else {
|
|
681
|
-
if (shown.includes(m))
|
|
681
|
+
if (shown.includes(m)) {
|
|
682
682
|
moved.push(
|
|
683
683
|
`--color-background-${h} takes a ${shift(badge.fill.stop, apart.fill.stop)} tint in ${m}, apart from ${twin.hue}`,
|
|
684
684
|
);
|
|
685
|
+
}
|
|
685
686
|
badge = apart;
|
|
686
687
|
}
|
|
687
688
|
}
|
|
@@ -773,10 +774,11 @@ export function deriveLookColors({
|
|
|
773
774
|
);
|
|
774
775
|
} else {
|
|
775
776
|
picked[h][m] = at(h, m, apart);
|
|
776
|
-
if (shown.includes(m))
|
|
777
|
+
if (shown.includes(m)) {
|
|
777
778
|
moved.push(
|
|
778
779
|
`--color-data-categorical-${h} takes a ${shift(own.stop, apart)} shade in ${m}, apart from ${like.hue}`,
|
|
779
780
|
);
|
|
781
|
+
}
|
|
780
782
|
}
|
|
781
783
|
}
|
|
782
784
|
placed.push({hue: h, color: picked[h][m].color});
|
|
@@ -917,14 +919,25 @@ export function deriveStatusColors({
|
|
|
917
919
|
*/
|
|
918
920
|
fn => {
|
|
919
921
|
const v = /** @type {Record<Mode, Stop>} */ ({});
|
|
920
|
-
for (const m of /** @type {Mode[]} */ (['light', 'dark']))
|
|
922
|
+
for (const m of /** @type {Mode[]} */ (['light', 'dark'])) {
|
|
921
923
|
v[m] = fn(modes.includes(m) ? m : modes[0]);
|
|
924
|
+
}
|
|
922
925
|
return v;
|
|
923
926
|
};
|
|
927
|
+
// A mode the caller does not draw takes the drawn mode's text color, as
|
|
928
|
+
// each() takes its stop.
|
|
929
|
+
const drawn =
|
|
930
|
+
/**
|
|
931
|
+
* @param {Mode} m
|
|
932
|
+
* @returns {Mode}
|
|
933
|
+
*/
|
|
934
|
+
m => (modes.includes(m) ? m : modes[0]);
|
|
924
935
|
for (const id of roles) {
|
|
925
936
|
const w = STATUS_ROLES[id];
|
|
926
937
|
const fam = palette[id];
|
|
927
|
-
if (!w || !fam)
|
|
938
|
+
if (!w || !fam) {
|
|
939
|
+
continue;
|
|
940
|
+
}
|
|
928
941
|
const at =
|
|
929
942
|
/**
|
|
930
943
|
* @param {Mode} m
|
|
@@ -946,9 +959,13 @@ export function deriveStatusColors({
|
|
|
946
959
|
* @returns {void}
|
|
947
960
|
*/
|
|
948
961
|
(m, line, text = false) => {
|
|
949
|
-
if (!shown.includes(m))
|
|
962
|
+
if (!shown.includes(m)) {
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
950
965
|
fails.push(line);
|
|
951
|
-
if (text)
|
|
966
|
+
if (text) {
|
|
967
|
+
unread = true;
|
|
968
|
+
}
|
|
952
969
|
};
|
|
953
970
|
/**
|
|
954
971
|
* The stop nearest `start` that reads at `needs` on every color in `bg`.
|
|
@@ -976,18 +993,19 @@ export function deriveStatusColors({
|
|
|
976
993
|
const best =
|
|
977
994
|
scored.find(x => x.r >= needs) ??
|
|
978
995
|
scored.reduce((x, y) => (y.r > x.r ? y : x));
|
|
979
|
-
if (best.r < needs)
|
|
996
|
+
if (best.r < needs) {
|
|
980
997
|
fail(
|
|
981
998
|
m,
|
|
982
999
|
`${token} reads at only ${ratioDown(best.r)}:1 in ${m} at its most readable shade (needs ${needs}:1)`,
|
|
983
1000
|
true,
|
|
984
1001
|
);
|
|
1002
|
+
}
|
|
985
1003
|
return at(m, best.stop);
|
|
986
1004
|
};
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
const onFill =
|
|
1005
|
+
/**
|
|
1006
|
+
* @type {Partial<Record<Mode, Stop & {family: string}>>}
|
|
1007
|
+
*/
|
|
1008
|
+
const onFill = {};
|
|
991
1009
|
// Warning is a bright fill that carries near-black text, as Core's is:
|
|
992
1010
|
// its text, not its edge, makes it read, so it is not held to 3:1 on
|
|
993
1011
|
// the page.
|
|
@@ -1028,20 +1046,23 @@ export function deriveStatusColors({
|
|
|
1028
1046
|
*/
|
|
1029
1047
|
(s, ink) => {
|
|
1030
1048
|
const c = at(m, s).color;
|
|
1031
|
-
if (!standsOut(c))
|
|
1049
|
+
if (!standsOut(c)) {
|
|
1032
1050
|
fail(
|
|
1033
1051
|
m,
|
|
1034
1052
|
`--color-${w} stands out from the page at under ${NON_TEXT}:1 in ${m}`,
|
|
1035
1053
|
);
|
|
1036
|
-
|
|
1054
|
+
}
|
|
1055
|
+
if (!apart(c)) {
|
|
1037
1056
|
fail(m, `--color-${w} is drawn like your accent in ${m}`);
|
|
1057
|
+
}
|
|
1038
1058
|
const r = contrastRatio(ink.color, c);
|
|
1039
|
-
if (r < TEXT)
|
|
1059
|
+
if (r < TEXT) {
|
|
1040
1060
|
fail(
|
|
1041
1061
|
m,
|
|
1042
1062
|
`--color-on-${w} reads at only ${ratioDown(r)}:1 on --color-${w} in ${m} at its most readable shade (needs ${TEXT}:1)`,
|
|
1043
1063
|
true,
|
|
1044
1064
|
);
|
|
1065
|
+
}
|
|
1045
1066
|
onFill[m] = ink;
|
|
1046
1067
|
return at(m, s);
|
|
1047
1068
|
};
|
|
@@ -1049,15 +1070,21 @@ export function deriveStatusColors({
|
|
|
1049
1070
|
// standing out from the page first, then standing apart from the
|
|
1050
1071
|
// accent. Text that reads on no stop keeps the role at the base
|
|
1051
1072
|
// theme's colors.
|
|
1052
|
-
for (const keep of [[standsOut, apart], [apart], []])
|
|
1073
|
+
for (const keep of [[standsOut, apart], [apart], []]) {
|
|
1053
1074
|
// The role's usual text first: the nearest stop it reads on, before
|
|
1054
1075
|
// the other text on a nearer stop.
|
|
1055
|
-
for (const ink of choices)
|
|
1076
|
+
for (const ink of choices) {
|
|
1056
1077
|
for (const s of allowed) {
|
|
1057
1078
|
const c = at(m, s).color;
|
|
1058
|
-
if (
|
|
1079
|
+
if (
|
|
1080
|
+
keep.every(ok => ok(c)) &&
|
|
1081
|
+
contrastRatio(ink.color, c) >= TEXT
|
|
1082
|
+
) {
|
|
1059
1083
|
return take(s, ink);
|
|
1084
|
+
}
|
|
1060
1085
|
}
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1061
1088
|
// No stop carries readable text: the one that carries it best.
|
|
1062
1089
|
const best = allowed.reduce((x, y) =>
|
|
1063
1090
|
contrastRatio(choices[0].color, at(m, y).color) >
|
|
@@ -1076,8 +1103,9 @@ export function deriveStatusColors({
|
|
|
1076
1103
|
const paler = sorted.filter(
|
|
1077
1104
|
s => s > fill[m].stop && at(m, s).color !== fill[m].color,
|
|
1078
1105
|
);
|
|
1079
|
-
if (stop <= fill[m].stop || at(m, stop).color === fill[m].color)
|
|
1106
|
+
if (stop <= fill[m].stop || at(m, stop).color === fill[m].color) {
|
|
1080
1107
|
stop = paler[0] ?? stop;
|
|
1108
|
+
}
|
|
1081
1109
|
}
|
|
1082
1110
|
const solid = at(m, stop);
|
|
1083
1111
|
return m === 'dark'
|
|
@@ -1141,18 +1169,30 @@ export function deriveStatusColors({
|
|
|
1141
1169
|
continue;
|
|
1142
1170
|
}
|
|
1143
1171
|
// A one-mode theme measures its mode for both sides: one note each.
|
|
1144
|
-
for (const line of fails)
|
|
1145
|
-
|
|
1172
|
+
for (const line of fails) {
|
|
1173
|
+
if (!why.includes(line)) {
|
|
1174
|
+
why.push(line);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
if (fails.length) {
|
|
1178
|
+
short.push(id);
|
|
1179
|
+
}
|
|
1146
1180
|
state[id] = 'derived';
|
|
1147
|
-
for (const [k, v] of Object.entries(set))
|
|
1148
|
-
if (wanted(k))
|
|
1181
|
+
for (const [k, v] of Object.entries(set)) {
|
|
1182
|
+
if (wanted(k)) {
|
|
1183
|
+
tokens[k] = {family: id, ...v};
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1149
1186
|
const inkToken = `--color-on-${w}`;
|
|
1150
|
-
|
|
1187
|
+
const inkLight = onFill[drawn('light')];
|
|
1188
|
+
const inkDark = onFill[drawn('dark')];
|
|
1189
|
+
if (inkLight && inkDark && wanted(inkToken)) {
|
|
1151
1190
|
tokens[inkToken] = {
|
|
1152
|
-
family:
|
|
1153
|
-
light:
|
|
1154
|
-
dark:
|
|
1191
|
+
family: inkLight.family,
|
|
1192
|
+
light: inkLight,
|
|
1193
|
+
dark: inkDark,
|
|
1155
1194
|
};
|
|
1195
|
+
}
|
|
1156
1196
|
}
|
|
1157
1197
|
return {tokens, roles: state, why, short};
|
|
1158
1198
|
}
|
|
@@ -1222,20 +1262,46 @@ export function deriveCodeColors({
|
|
|
1222
1262
|
stop,
|
|
1223
1263
|
color: palette[id][m][stop],
|
|
1224
1264
|
});
|
|
1265
|
+
// A token carries both modes. A mode the caller does not draw takes the
|
|
1266
|
+
// drawn mode's stop, as each() does in deriveLookColors.
|
|
1267
|
+
const drawn =
|
|
1268
|
+
/**
|
|
1269
|
+
* @param {Mode} m
|
|
1270
|
+
* @returns {Mode}
|
|
1271
|
+
*/
|
|
1272
|
+
m => (modes.includes(m) ? m : modes[0]);
|
|
1273
|
+
const both =
|
|
1274
|
+
/**
|
|
1275
|
+
* @param {Partial<Record<Mode, Stop>>} v
|
|
1276
|
+
* @returns {Record<Mode, Stop> | null}
|
|
1277
|
+
*/
|
|
1278
|
+
v => {
|
|
1279
|
+
const light = v[drawn('light')];
|
|
1280
|
+
const dark = v[drawn('dark')];
|
|
1281
|
+
return light && dark ? {light, dark} : null;
|
|
1282
|
+
};
|
|
1225
1283
|
/**
|
|
1226
1284
|
* @type {Partial<Record<Mode, Stop>>}
|
|
1227
1285
|
*/
|
|
1228
1286
|
const ground = {};
|
|
1229
1287
|
if (palette.neutral) {
|
|
1230
|
-
|
|
1288
|
+
/**
|
|
1289
|
+
* @type {Partial<Record<Mode, Stop>>}
|
|
1290
|
+
*/
|
|
1291
|
+
const bg = {};
|
|
1231
1292
|
for (const m of modes) {
|
|
1232
|
-
|
|
1233
|
-
|
|
1293
|
+
const stop = at('neutral', m, near(CODE_GROUND[m]));
|
|
1294
|
+
bg[m] = stop;
|
|
1295
|
+
ground[m] = stop;
|
|
1234
1296
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1297
|
+
const background = both(bg);
|
|
1298
|
+
if (background && wanted('--color-syntax-background')) {
|
|
1299
|
+
tokens['--color-syntax-background'] = {family: 'neutral', ...background};
|
|
1237
1300
|
}
|
|
1238
|
-
|
|
1301
|
+
/**
|
|
1302
|
+
* @type {Partial<Record<Mode, Stop>>}
|
|
1303
|
+
*/
|
|
1304
|
+
const scrim = {};
|
|
1239
1305
|
for (const m of modes) {
|
|
1240
1306
|
const s = near(SCRIM[m].stop);
|
|
1241
1307
|
const c = palette.neutral[m][s];
|
|
@@ -1245,8 +1311,9 @@ export function deriveCodeColors({
|
|
|
1245
1311
|
alpha: SCRIM[m].alpha,
|
|
1246
1312
|
};
|
|
1247
1313
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1314
|
+
const overlay = both(scrim);
|
|
1315
|
+
if (overlay && wanted('--color-overlay')) {
|
|
1316
|
+
tokens['--color-overlay'] = {family: 'neutral', ...overlay};
|
|
1250
1317
|
}
|
|
1251
1318
|
}
|
|
1252
1319
|
for (const [role, [id, light, dark]] of Object.entries(SYNTAX_STOPS)) {
|
|
@@ -1254,7 +1321,10 @@ export function deriveCodeColors({
|
|
|
1254
1321
|
if (!palette[id] || !wanted(k)) {
|
|
1255
1322
|
continue;
|
|
1256
1323
|
}
|
|
1257
|
-
|
|
1324
|
+
/**
|
|
1325
|
+
* @type {Partial<Record<Mode, Stop>>}
|
|
1326
|
+
*/
|
|
1327
|
+
const refs = {};
|
|
1258
1328
|
let ok = true;
|
|
1259
1329
|
for (const m of modes) {
|
|
1260
1330
|
// A code background the theme sets itself is the one code shows on.
|
|
@@ -1279,8 +1349,9 @@ export function deriveCodeColors({
|
|
|
1279
1349
|
}
|
|
1280
1350
|
refs[m] = at(id, m, s);
|
|
1281
1351
|
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1352
|
+
const pair = ok ? both(refs) : null;
|
|
1353
|
+
if (pair) {
|
|
1354
|
+
tokens[k] = {family: id, ...pair};
|
|
1284
1355
|
}
|
|
1285
1356
|
}
|
|
1286
1357
|
return {tokens, unreadable};
|
|
@@ -295,6 +295,7 @@ export const OFFICIAL_NEUTRAL_STOPS = ownTable({
|
|
|
295
295
|
'--color-icon-secondary': [{stop: 45}, {stop: 65}],
|
|
296
296
|
'--color-icon-disabled': [{stop: 60}, {stop: 35}],
|
|
297
297
|
'--color-border-emphasized': [{stop: 85}, {stop: 35}],
|
|
298
|
+
'--color-border-control': [{stop: 55}, {stop: 50}],
|
|
298
299
|
'--color-skeleton': [{stop: 85}, {stop: 35}],
|
|
299
300
|
'--color-on-dark': [{stop: 100}, {stop: 100}],
|
|
300
301
|
'--color-on-light': [{stop: 5}, {stop: 5}],
|
|
@@ -372,6 +373,7 @@ export const NEUTRAL_STOPS = ownTable({
|
|
|
372
373
|
'--color-icon-secondary',
|
|
373
374
|
'--color-icon-disabled',
|
|
374
375
|
'--color-border-emphasized',
|
|
376
|
+
'--color-border-control',
|
|
375
377
|
'--color-skeleton',
|
|
376
378
|
'--color-on-dark',
|
|
377
379
|
'--color-on-light',
|
|
@@ -15,23 +15,6 @@ export function themeTemplate(options?: {
|
|
|
15
15
|
overwrite?: boolean;
|
|
16
16
|
cwd?: string;
|
|
17
17
|
}): import("../theme.type.mjs").ThemeTemplateResponse;
|
|
18
|
-
/**
|
|
19
|
-
* The template write behind `themeTemplate`, with the experimental editor's
|
|
20
|
-
* one difference: with `editorFilesOnly`, in a folder the theme editor made
|
|
21
|
-
* only the editor's own files (`<folder>.*`) are protected, so an earlier
|
|
22
|
-
* template there is the person's. Internal: the experimental `template`
|
|
23
|
-
* command reaches it through `editorThemeTemplate` (api/theme-edit), and it
|
|
24
|
-
* is not part of the public API.
|
|
25
|
-
* @internal
|
|
26
|
-
* @param {{targetPath?: string, overwrite?: boolean, cwd?: string}} options
|
|
27
|
-
* @param {boolean} editorFilesOnly
|
|
28
|
-
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
29
|
-
*/
|
|
30
|
-
export function writeThemeTemplate(options: {
|
|
31
|
-
targetPath?: string;
|
|
32
|
-
overwrite?: boolean;
|
|
33
|
-
cwd?: string;
|
|
34
|
-
}, editorFilesOnly: boolean): import("../theme.type.mjs").ThemeTemplateResponse;
|
|
35
18
|
/** The annotated `defineTheme` reference that ships with the CLI. */
|
|
36
19
|
export const THEME_TEMPLATE_SRC: string;
|
|
37
20
|
/** The warning the CLI prints when it writes the template outside a project. */
|
|
@@ -83,22 +83,6 @@ function isReplaceableThemeFile(file) {
|
|
|
83
83
|
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
84
84
|
*/
|
|
85
85
|
export function themeTemplate(options = {}) {
|
|
86
|
-
return writeThemeTemplate(options, false);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The template write behind `themeTemplate`, with the experimental editor's
|
|
91
|
-
* one difference: with `editorFilesOnly`, in a folder the theme editor made
|
|
92
|
-
* only the editor's own files (`<folder>.*`) are protected, so an earlier
|
|
93
|
-
* template there is the person's. Internal: the experimental `template`
|
|
94
|
-
* command reaches it through `editorThemeTemplate` (api/theme-edit), and it
|
|
95
|
-
* is not part of the public API.
|
|
96
|
-
* @internal
|
|
97
|
-
* @param {{targetPath?: string, overwrite?: boolean, cwd?: string}} options
|
|
98
|
-
* @param {boolean} editorFilesOnly
|
|
99
|
-
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
100
|
-
*/
|
|
101
|
-
export function writeThemeTemplate(options, editorFilesOnly) {
|
|
102
86
|
const {
|
|
103
87
|
targetPath = THEME_TEMPLATE_DEFAULT_PATH,
|
|
104
88
|
overwrite = false,
|
|
@@ -204,32 +188,7 @@ export function writeThemeTemplate(options, editorFilesOnly) {
|
|
|
204
188
|
? fs.realpathSync(path.dirname(resolved))
|
|
205
189
|
: path.dirname(resolved);
|
|
206
190
|
const record = fs.existsSync(resolved) ? editorThemeRecord(realDir) : null;
|
|
207
|
-
|
|
208
|
-
// editorFilesOnly any other file there (an earlier template) is the
|
|
209
|
-
// person's.
|
|
210
|
-
// On a case-insensitive disk `T.theme.ts` is `t.theme.ts`: names are
|
|
211
|
-
// compared in any case, and an existing file by what it is on disk.
|
|
212
|
-
const folder = path.basename(realDir).toLowerCase();
|
|
213
|
-
const sameFile = (/** @type {string} */ other) => {
|
|
214
|
-
try {
|
|
215
|
-
const a = fs.statSync(resolved);
|
|
216
|
-
const b = fs.statSync(other);
|
|
217
|
-
return a.ino === b.ino && a.dev === b.dev;
|
|
218
|
-
} catch {
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
const editorFile =
|
|
223
|
-
record != null &&
|
|
224
|
-
(!editorFilesOnly ||
|
|
225
|
-
path.basename(resolved).toLowerCase().startsWith(`${folder}.`) ||
|
|
226
|
-
fs
|
|
227
|
-
.readdirSync(realDir)
|
|
228
|
-
.some(
|
|
229
|
-
f =>
|
|
230
|
-
f.toLowerCase().startsWith(`${folder}.`) &&
|
|
231
|
-
sameFile(path.join(realDir, f)),
|
|
232
|
-
));
|
|
191
|
+
const editorFile = record != null;
|
|
233
192
|
const editorRecord = overwrite && editorFile ? record : null;
|
|
234
193
|
if (editorRecord) {
|
|
235
194
|
throw new AstryxError(
|
|
@@ -259,9 +259,10 @@ export type ThemeAppResponse = {
|
|
|
259
259
|
* dependencies it added.
|
|
260
260
|
* `undo` is present when `theme remove` removed a theme `theme add` copied
|
|
261
261
|
* from a shared theme: `removed` the files of the copy it deleted, `kept`
|
|
262
|
-
* those changed since the add (
|
|
262
|
+
* those changed since the add (when one changed, the whole copy stays, with
|
|
263
|
+
* its receipt), `uninstalled` the packages
|
|
263
264
|
* the add installed that no theme still in the record is owned by or
|
|
264
|
-
* imports, and `uninstallError`
|
|
265
|
+
* imports (none while the copy stays whole), and `uninstallError`
|
|
265
266
|
* why that uninstall failed.
|
|
266
267
|
*/
|
|
267
268
|
package?: string | undefined;
|
|
@@ -479,8 +480,8 @@ export type TonalPaletteGenerationInput = {
|
|
|
479
480
|
* The recipe to
|
|
480
481
|
* run: astryx-oklch-v1 when none is named, so a request or config made
|
|
481
482
|
* before v2 keeps its colors; astryx-oklch-v2 makes pale stops
|
|
482
|
-
* follow the vibrancy and the seed's own chroma.
|
|
483
|
-
*
|
|
483
|
+
* follow the vibrancy and the seed's own chroma. A new config should name
|
|
484
|
+
* v2; a config pins its recipe by naming it.
|
|
484
485
|
*/
|
|
485
486
|
recipe?: "astryx-oklch-v1" | "astryx-oklch-v2" | undefined;
|
|
486
487
|
families: TonalPaletteFamilyInput[];
|
package/api/theme/theme.type.mjs
CHANGED
|
@@ -170,9 +170,10 @@
|
|
|
170
170
|
* dependencies it added.
|
|
171
171
|
* `undo` is present when `theme remove` removed a theme `theme add` copied
|
|
172
172
|
* from a shared theme: `removed` the files of the copy it deleted, `kept`
|
|
173
|
-
* those changed since the add (
|
|
173
|
+
* those changed since the add (when one changed, the whole copy stays, with
|
|
174
|
+
* its receipt), `uninstalled` the packages
|
|
174
175
|
* the add installed that no theme still in the record is owned by or
|
|
175
|
-
* imports, and `uninstallError`
|
|
176
|
+
* imports (none while the copy stays whole), and `uninstallError`
|
|
176
177
|
* why that uninstall failed.
|
|
177
178
|
* @property {{themes: ThemeAppEntry[], default: string, modulePath: string, change: {action: 'add'|'remove'|'use', slug: string, changed: boolean, firstAdd: boolean, wireModes?: true, moduleRemoved?: true, themeModes?: true}, notes?: string[], appProvider?: {wiredBy: Array<{export: string, from: string, themeProp?: string, modeProp?: string}>, wire: string, themeProp?: string, line?: string}, copy?: {from: string, folder: string, outputDir: string, files: string[], installed: string[], installRan?: false, installCommand: string | null, installGuidance?: string, installError?: string, installRetryCommand?: string, previousDefault?: string, written: string[], config: {module: string, default: string, dependencies: string[]}}, undo?: {removed: string[], kept: string[], uninstalled: string[], uninstallError?: string}}} data
|
|
178
179
|
*/
|
|
@@ -271,8 +272,8 @@
|
|
|
271
272
|
* @property {'astryx-oklch-v1' | 'astryx-oklch-v2'} [recipe] The recipe to
|
|
272
273
|
* run: astryx-oklch-v1 when none is named, so a request or config made
|
|
273
274
|
* before v2 keeps its colors; astryx-oklch-v2 makes pale stops
|
|
274
|
-
* follow the vibrancy and the seed's own chroma.
|
|
275
|
-
*
|
|
275
|
+
* follow the vibrancy and the seed's own chroma. A new config should name
|
|
276
|
+
* v2; a config pins its recipe by naming it.
|
|
276
277
|
* @property {TonalPaletteFamilyInput[]} families
|
|
277
278
|
* @property {number} [vibrancy] Chroma control from 0 (most muted) through 50
|
|
278
279
|
* (default) to 100 (most vivid).
|
|
@@ -9,7 +9,7 @@ export const doc = {
|
|
|
9
9
|
displayName: 'themePaletteGenerate()',
|
|
10
10
|
summary: 'Generate an author-reviewable palette candidate from JSON input.',
|
|
11
11
|
description:
|
|
12
|
-
'Runs the recipe the request names: astryx-oklch-v1 when it names none, so a request or config made before v2 keeps its colors, or astryx-oklch-v2, whose pale stops follow the vibrancy and each seed\'s own chroma.
|
|
12
|
+
'Runs the recipe the request names: astryx-oklch-v1 when it names none, so a request or config made before v2 keeps its colors, or astryx-oklch-v2, whose pale stops follow the vibrancy and each seed\'s own chroma. A new config should name v2. A config keeps the recipe it records; to pin one, record "recipe": "astryx-oklch-v1" (or v2) in the palette config, against an explicit generation request. ' +
|
|
13
13
|
'It always emits standalone `black` and `white` values that generated TypeScript can import ' +
|
|
14
14
|
'directly into semantic theme tokens; those names are reserved from tonal family IDs. It also ' +
|
|
15
15
|
'defaults family ramps to 21 stops from 0 through 100, repeating exact black and white ' +
|
|
@@ -11,7 +11,7 @@ export const doc = {
|
|
|
11
11
|
displayName: 'themeRemove()',
|
|
12
12
|
summary: "Remove a theme from an app's generated theme module.",
|
|
13
13
|
description:
|
|
14
|
-
'Reads the generated module record, removes one added theme, and regenerates the whole module. The default cannot be removed while other themes are added: themeUse selects another one first. The only added theme can be removed: that removes the module file when it is exactly what the CLI wrote. Removing a theme that themeAdd copied from a shared theme also undoes that add (the files it wrote that are unchanged, and the packages it installed that no theme still in the record is owned by or imports); the receipt carries data.undo.',
|
|
14
|
+
'Reads the generated module record, removes one added theme, and regenerates the whole module. The default cannot be removed while other themes are added: themeUse selects another one first. The only added theme can be removed: that removes the module file when it is exactly what the CLI wrote. Removing a theme that themeAdd copied from a shared theme also undoes that add (the files it wrote that are unchanged, unless one changed, which keeps the whole copy with its receipt and the packages it installed, and adding the same theme again over it names the changed files to delete or move first; and the packages it installed that no theme still in the record is owned by or imports); the receipt carries data.undo.',
|
|
15
15
|
importPath: '@astryxdesign/cli/api',
|
|
16
16
|
signature:
|
|
17
17
|
'themeRemove(slug: string, options?: {cwd?: string}): Promise<ThemeAppResponse>',
|
|
@@ -36,7 +36,9 @@ export const meta = {
|
|
|
36
36
|
'`padding={0}` and your own inset to adopt the theme padding. An app ' +
|
|
37
37
|
'whose theme already sets `bottom-sheet` padding on every edge is not ' +
|
|
38
38
|
'affected by the new default; the transform cannot see the theme, so ' +
|
|
39
|
-
'remove the added `padding={0}` there to keep the theme inset.'
|
|
39
|
+
'remove the added `padding={0}` there to keep the theme inset. A theme ' +
|
|
40
|
+
'that sets it on some edges only is affected too: the added ' +
|
|
41
|
+
'`padding={0}` zeroes every edge, including the ones the theme sets.',
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
|