@astryxdesign/theme-butter 0.7.0-canary.fe57f54 → 0.7.0
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/dist/butter.js +18 -1
- package/dist/butterTheme.d.ts.map +1 -1
- package/dist/butterTheme.test.d.ts +2 -0
- package/dist/butterTheme.test.d.ts.map +1 -0
- package/dist/source.js +11 -0
- package/dist/source.mjs +11 -0
- package/dist/theme.css +66 -0
- package/package.json +3 -3
- package/src/butterTheme.test.ts +25 -0
- package/src/butterTheme.ts +12 -0
package/dist/butter.js
CHANGED
|
@@ -656,7 +656,24 @@ export const butterTheme = {
|
|
|
656
656
|
"xl": 1280,
|
|
657
657
|
"2xl": 1536
|
|
658
658
|
},
|
|
659
|
-
"rules": [
|
|
659
|
+
"rules": [
|
|
660
|
+
{
|
|
661
|
+
"when": {
|
|
662
|
+
"pointer": "coarse",
|
|
663
|
+
"width": {
|
|
664
|
+
"below": "lg"
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
"value": {
|
|
668
|
+
"typography": {
|
|
669
|
+
"scale": {
|
|
670
|
+
"base": 16,
|
|
671
|
+
"ratio": 1.2225
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
]
|
|
660
677
|
},
|
|
661
678
|
__axes: {
|
|
662
679
|
"typography": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"butterTheme.d.ts","sourceRoot":"","sources":["../src/butterTheme.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"butterTheme.d.ts","sourceRoot":"","sources":["../src/butterTheme.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,WAAW,yDA8hBtB,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmUjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"butterTheme.test.d.ts","sourceRoot":"","sources":["../src/butterTheme.test.ts"],"names":[],"mappings":""}
|
package/dist/source.js
CHANGED
|
@@ -114,6 +114,17 @@ var butterTheme = (0, import_theme.defineTheme)({
|
|
|
114
114
|
fallbacks: '"SF Mono", Monaco, Consolas, monospace'
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
118
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
119
|
+
// ratio' = 1.25 * (14/16)^(1/6) ~= 1.2225. Body 14 -> 16px, display-1 stays 53px.
|
|
120
|
+
adaptations: {
|
|
121
|
+
rules: [
|
|
122
|
+
{
|
|
123
|
+
when: { pointer: "coarse", width: { below: "lg" } },
|
|
124
|
+
value: { typography: { scale: { base: 16, ratio: 1.2225 } } }
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
117
128
|
motion: { fast: 125, medium: 300, slow: 700, ratio: 0.75 },
|
|
118
129
|
syntax: butterSyntax,
|
|
119
130
|
tokens: {
|
package/dist/source.mjs
CHANGED
|
@@ -116,6 +116,17 @@ var butterTheme = defineTheme({
|
|
|
116
116
|
fallbacks: '"SF Mono", Monaco, Consolas, monospace'
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
120
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
121
|
+
// ratio' = 1.25 * (14/16)^(1/6) ~= 1.2225. Body 14 -> 16px, display-1 stays 53px.
|
|
122
|
+
adaptations: {
|
|
123
|
+
rules: [
|
|
124
|
+
{
|
|
125
|
+
when: { pointer: "coarse", width: { below: "lg" } },
|
|
126
|
+
value: { typography: { scale: { base: 16, ratio: 1.2225 } } }
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
119
130
|
motion: { fast: 125, medium: 300, slow: 700, ratio: 0.75 },
|
|
120
131
|
syntax: butterSyntax,
|
|
121
132
|
tokens: {
|
package/dist/theme.css
CHANGED
|
@@ -812,6 +812,72 @@
|
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
+
@layer astryx-theme {
|
|
816
|
+
@media (width < 1024px) and (pointer: coarse) {
|
|
817
|
+
@scope ([data-astryx-theme="butter"]) to ([data-astryx-theme]) {
|
|
818
|
+
:scope {
|
|
819
|
+
--font-size-4xs: 0.375rem;
|
|
820
|
+
--font-size-3xs: 0.4375rem;
|
|
821
|
+
--font-size-2xs: 0.5625rem;
|
|
822
|
+
--font-size-xs: 0.6875rem;
|
|
823
|
+
--font-size-sm: 0.8125rem;
|
|
824
|
+
--font-size-base: 1rem;
|
|
825
|
+
--font-size-lg: 1.25rem;
|
|
826
|
+
--font-size-xl: 1.5rem;
|
|
827
|
+
--font-size-2xl: 1.8125rem;
|
|
828
|
+
--font-size-3xl: 2.25rem;
|
|
829
|
+
--font-size-4xl: 2.75rem;
|
|
830
|
+
--font-size-5xl: 3.3125rem;
|
|
831
|
+
--text-heading-1-size: var(--font-size-2xl);
|
|
832
|
+
--text-heading-1-weight: var(--font-weight-semibold);
|
|
833
|
+
--text-heading-1-leading: 1.3793;
|
|
834
|
+
--text-heading-2-size: var(--font-size-xl);
|
|
835
|
+
--text-heading-2-weight: var(--font-weight-semibold);
|
|
836
|
+
--text-heading-2-leading: 1.3333;
|
|
837
|
+
--text-heading-3-size: var(--font-size-lg);
|
|
838
|
+
--text-heading-3-weight: var(--font-weight-bold);
|
|
839
|
+
--text-heading-3-leading: 1.4;
|
|
840
|
+
--text-heading-4-size: var(--font-size-base);
|
|
841
|
+
--text-heading-4-weight: var(--font-weight-bold);
|
|
842
|
+
--text-heading-4-leading: 1.5;
|
|
843
|
+
--text-heading-5-size: var(--font-size-sm);
|
|
844
|
+
--text-heading-5-weight: var(--font-weight-semibold);
|
|
845
|
+
--text-heading-5-leading: 1.5385;
|
|
846
|
+
--text-heading-6-size: var(--font-size-xs);
|
|
847
|
+
--text-heading-6-weight: var(--font-weight-semibold);
|
|
848
|
+
--text-heading-6-leading: 1.4545;
|
|
849
|
+
--text-body-size: var(--font-size-base);
|
|
850
|
+
--text-body-weight: var(--font-weight-normal);
|
|
851
|
+
--text-body-leading: 1.5;
|
|
852
|
+
--text-large-size: var(--font-size-lg);
|
|
853
|
+
--text-large-weight: var(--font-weight-semibold);
|
|
854
|
+
--text-large-leading: 1.4;
|
|
855
|
+
--text-label-size: var(--font-size-base);
|
|
856
|
+
--text-label-weight: var(--font-weight-medium);
|
|
857
|
+
--text-label-leading: 1.5;
|
|
858
|
+
--text-code-size: var(--font-size-base);
|
|
859
|
+
--text-code-weight: var(--font-weight-normal);
|
|
860
|
+
--text-code-leading: 1.5;
|
|
861
|
+
--text-supporting-size: var(--font-size-sm);
|
|
862
|
+
--text-supporting-weight: var(--font-weight-normal);
|
|
863
|
+
--text-supporting-leading: 1.5385;
|
|
864
|
+
--text-display-1-size: var(--font-size-5xl);
|
|
865
|
+
--text-display-1-weight: var(--font-weight-normal);
|
|
866
|
+
--text-display-1-leading: 1.283;
|
|
867
|
+
--text-display-2-size: var(--font-size-4xl);
|
|
868
|
+
--text-display-2-weight: var(--font-weight-normal);
|
|
869
|
+
--text-display-2-leading: 1.2727;
|
|
870
|
+
--text-display-3-size: var(--font-size-3xl);
|
|
871
|
+
--text-display-3-weight: var(--font-weight-normal);
|
|
872
|
+
--text-display-3-leading: 1.2222;
|
|
873
|
+
--font-family-body: Outfit, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
874
|
+
--font-family-heading: Outfit, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
875
|
+
--font-family-code: "JetBrains Mono", "SF Mono", Monaco, Consolas, monospace;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
815
881
|
@layer astryx-theme {
|
|
816
882
|
@scope ([data-astryx-theme="butter"]) to ([data-astryx-theme]) {
|
|
817
883
|
[data-astryx-media="dark"] {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/theme-butter",
|
|
3
|
-
"version": "0.7.0
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"displayName": "Butter Theme",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Warm, creamy yellows with a friendly blue accent. Playful enough for consumer surfaces, soft enough to stay readable.",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"lucide-react": "^1.18.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@astryxdesign/core": "0.7.0
|
|
60
|
+
"@astryxdesign/core": "0.7.0",
|
|
61
61
|
"react": ">=19"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@astryxdesign/cli": "0.7.0
|
|
64
|
+
"@astryxdesign/cli": "0.7.0"
|
|
65
65
|
},
|
|
66
66
|
"module": "./dist/source.mjs",
|
|
67
67
|
"scripts": {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
import {describe, expect, it} from 'vitest';
|
|
4
|
+
import {generateThemeCSS} from '@astryxdesign/core/theme';
|
|
5
|
+
import {butterTheme} from './butterTheme';
|
|
6
|
+
|
|
7
|
+
describe('butter touch + narrow type pin', () => {
|
|
8
|
+
it('floors body to 16px and holds Display 1 at its desktop size', () => {
|
|
9
|
+
const rule = butterTheme.__adaptationRules?.[0];
|
|
10
|
+
|
|
11
|
+
expect(butterTheme.__adaptations.rules).toHaveLength(1);
|
|
12
|
+
expect(rule?.when).toEqual({pointer: 'coarse', width: {below: 'lg'}});
|
|
13
|
+
expect(rule?.query).toBe('(width < 1024px) and (pointer: coarse)');
|
|
14
|
+
// Pinned ladder: base 16 (was 14), ratio 1.25 -> 1.2225, Display 1 pinned.
|
|
15
|
+
expect(rule?.tokens['--font-size-base']).toBe('1rem');
|
|
16
|
+
expect(rule?.tokens['--font-size-lg']).toBe('1.25rem');
|
|
17
|
+
expect(rule?.tokens['--font-size-5xl']).toBe('3.3125rem');
|
|
18
|
+
// Desktop scale is untouched.
|
|
19
|
+
expect(butterTheme.tokens['--font-size-base']).toBe('0.875rem');
|
|
20
|
+
expect(butterTheme.tokens['--font-size-5xl']).toBe('3.3125rem');
|
|
21
|
+
expect(generateThemeCSS(butterTheme).component).toContain(
|
|
22
|
+
'@media (width < 1024px) and (pointer: coarse)',
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
});
|
package/src/butterTheme.ts
CHANGED
|
@@ -65,6 +65,18 @@ export const butterTheme = defineTheme({
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
|
|
68
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
69
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
70
|
+
// ratio' = 1.25 * (14/16)^(1/6) ~= 1.2225. Body 14 -> 16px, display-1 stays 53px.
|
|
71
|
+
adaptations: {
|
|
72
|
+
rules: [
|
|
73
|
+
{
|
|
74
|
+
when: {pointer: 'coarse', width: {below: 'lg'}},
|
|
75
|
+
value: {typography: {scale: {base: 16, ratio: 1.2225}}},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
|
|
68
80
|
motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
|
|
69
81
|
|
|
70
82
|
syntax: butterSyntax,
|