@astryxdesign/theme-chocolate 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/chocolate.js +18 -1
- package/dist/chocolateTheme.d.ts.map +1 -1
- package/dist/chocolateTheme.test.d.ts +2 -0
- package/dist/chocolateTheme.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/chocolateTheme.test.ts +25 -0
- package/src/chocolateTheme.ts +12 -0
package/dist/chocolate.js
CHANGED
|
@@ -331,7 +331,24 @@ export const chocolateTheme = {
|
|
|
331
331
|
"xl": 1280,
|
|
332
332
|
"2xl": 1536
|
|
333
333
|
},
|
|
334
|
-
"rules": [
|
|
334
|
+
"rules": [
|
|
335
|
+
{
|
|
336
|
+
"when": {
|
|
337
|
+
"pointer": "coarse",
|
|
338
|
+
"width": {
|
|
339
|
+
"below": "lg"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"value": {
|
|
343
|
+
"typography": {
|
|
344
|
+
"scale": {
|
|
345
|
+
"base": 16,
|
|
346
|
+
"ratio": 1.1736
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
]
|
|
335
352
|
},
|
|
336
353
|
__axes: {
|
|
337
354
|
"typography": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chocolateTheme.d.ts","sourceRoot":"","sources":["../src/chocolateTheme.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"chocolateTheme.d.ts","sourceRoot":"","sources":["../src/chocolateTheme.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,cAAc,yDA8MzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chocolateTheme.test.d.ts","sourceRoot":"","sources":["../src/chocolateTheme.test.ts"],"names":[],"mappings":""}
|
package/dist/source.js
CHANGED
|
@@ -108,6 +108,17 @@ var chocolateTheme = (0, import_theme.defineTheme)({
|
|
|
108
108
|
fallbacks: '"SF Mono", Monaco, Consolas, monospace'
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
112
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
113
|
+
// ratio' = 1.2 * (14/16)^(1/6) ~= 1.1736. Body 14 -> 16px, display-1 stays 42px.
|
|
114
|
+
adaptations: {
|
|
115
|
+
rules: [
|
|
116
|
+
{
|
|
117
|
+
when: { pointer: "coarse", width: { below: "lg" } },
|
|
118
|
+
value: { typography: { scale: { base: 16, ratio: 1.1736 } } }
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
111
122
|
motion: { fast: 125, medium: 300, slow: 700, ratio: 0.75 },
|
|
112
123
|
syntax: chocolateSyntax,
|
|
113
124
|
tokens: {
|
package/dist/source.mjs
CHANGED
|
@@ -111,6 +111,17 @@ var chocolateTheme = defineTheme({
|
|
|
111
111
|
fallbacks: '"SF Mono", Monaco, Consolas, monospace'
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
115
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
116
|
+
// ratio' = 1.2 * (14/16)^(1/6) ~= 1.1736. Body 14 -> 16px, display-1 stays 42px.
|
|
117
|
+
adaptations: {
|
|
118
|
+
rules: [
|
|
119
|
+
{
|
|
120
|
+
when: { pointer: "coarse", width: { below: "lg" } },
|
|
121
|
+
value: { typography: { scale: { base: 16, ratio: 1.1736 } } }
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
},
|
|
114
125
|
motion: { fast: 125, medium: 300, slow: 700, ratio: 0.75 },
|
|
115
126
|
syntax: chocolateSyntax,
|
|
116
127
|
tokens: {
|
package/dist/theme.css
CHANGED
|
@@ -442,6 +442,72 @@
|
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
+
@layer astryx-theme {
|
|
446
|
+
@media (width < 1024px) and (pointer: coarse) {
|
|
447
|
+
@scope ([data-astryx-theme="chocolate"]) to ([data-astryx-theme]) {
|
|
448
|
+
:scope {
|
|
449
|
+
--font-size-4xs: 0.4375rem;
|
|
450
|
+
--font-size-3xs: 0.5rem;
|
|
451
|
+
--font-size-2xs: 0.625rem;
|
|
452
|
+
--font-size-xs: 0.75rem;
|
|
453
|
+
--font-size-sm: 0.875rem;
|
|
454
|
+
--font-size-base: 1rem;
|
|
455
|
+
--font-size-lg: 1.1875rem;
|
|
456
|
+
--font-size-xl: 1.375rem;
|
|
457
|
+
--font-size-2xl: 1.625rem;
|
|
458
|
+
--font-size-3xl: 1.875rem;
|
|
459
|
+
--font-size-4xl: 2.25rem;
|
|
460
|
+
--font-size-5xl: 2.625rem;
|
|
461
|
+
--text-heading-1-size: var(--font-size-2xl);
|
|
462
|
+
--text-heading-1-weight: var(--font-weight-semibold);
|
|
463
|
+
--text-heading-1-leading: 1.3846;
|
|
464
|
+
--text-heading-2-size: var(--font-size-xl);
|
|
465
|
+
--text-heading-2-weight: var(--font-weight-semibold);
|
|
466
|
+
--text-heading-2-leading: 1.4545;
|
|
467
|
+
--text-heading-3-size: var(--font-size-lg);
|
|
468
|
+
--text-heading-3-weight: var(--font-weight-bold);
|
|
469
|
+
--text-heading-3-leading: 1.4737;
|
|
470
|
+
--text-heading-4-size: var(--font-size-base);
|
|
471
|
+
--text-heading-4-weight: var(--font-weight-bold);
|
|
472
|
+
--text-heading-4-leading: 1.5;
|
|
473
|
+
--text-heading-5-size: var(--font-size-sm);
|
|
474
|
+
--text-heading-5-weight: var(--font-weight-semibold);
|
|
475
|
+
--text-heading-5-leading: 1.4286;
|
|
476
|
+
--text-heading-6-size: var(--font-size-xs);
|
|
477
|
+
--text-heading-6-weight: var(--font-weight-semibold);
|
|
478
|
+
--text-heading-6-leading: 1.6667;
|
|
479
|
+
--text-body-size: var(--font-size-base);
|
|
480
|
+
--text-body-weight: var(--font-weight-normal);
|
|
481
|
+
--text-body-leading: 1.5;
|
|
482
|
+
--text-large-size: var(--font-size-lg);
|
|
483
|
+
--text-large-weight: var(--font-weight-semibold);
|
|
484
|
+
--text-large-leading: 1.4737;
|
|
485
|
+
--text-label-size: var(--font-size-base);
|
|
486
|
+
--text-label-weight: var(--font-weight-medium);
|
|
487
|
+
--text-label-leading: 1.5;
|
|
488
|
+
--text-code-size: var(--font-size-base);
|
|
489
|
+
--text-code-weight: var(--font-weight-normal);
|
|
490
|
+
--text-code-leading: 1.5;
|
|
491
|
+
--text-supporting-size: var(--font-size-sm);
|
|
492
|
+
--text-supporting-weight: var(--font-weight-normal);
|
|
493
|
+
--text-supporting-leading: 1.4286;
|
|
494
|
+
--text-display-1-size: var(--font-size-5xl);
|
|
495
|
+
--text-display-1-weight: var(--font-weight-normal);
|
|
496
|
+
--text-display-1-leading: 1.2381;
|
|
497
|
+
--text-display-2-size: var(--font-size-4xl);
|
|
498
|
+
--text-display-2-weight: var(--font-weight-normal);
|
|
499
|
+
--text-display-2-leading: 1.2222;
|
|
500
|
+
--text-display-3-size: var(--font-size-3xl);
|
|
501
|
+
--text-display-3-weight: var(--font-weight-normal);
|
|
502
|
+
--text-display-3-leading: 1.4667;
|
|
503
|
+
--font-family-body: "Albert Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
504
|
+
--font-family-heading: Fraunces, Georgia, "Times New Roman", Times, serif;
|
|
505
|
+
--font-family-code: "JetBrains Mono", "SF Mono", Monaco, Consolas, monospace;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
445
511
|
@layer astryx-theme {
|
|
446
512
|
@scope ([data-astryx-theme="chocolate"]) to ([data-astryx-theme]) {
|
|
447
513
|
[data-astryx-media="dark"] {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/theme-chocolate",
|
|
3
|
-
"version": "0.7.0
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"displayName": "Chocolate Theme",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Warm chocolate theme for Astryx — rich brown palette with Fraunces headings, Albert Sans body, and Lucide icons",
|
|
@@ -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 {chocolateTheme} from './chocolateTheme';
|
|
6
|
+
|
|
7
|
+
describe('chocolate touch + narrow type pin', () => {
|
|
8
|
+
it('floors body to 16px and holds Display 1 at its desktop size', () => {
|
|
9
|
+
const rule = chocolateTheme.__adaptationRules?.[0];
|
|
10
|
+
|
|
11
|
+
expect(chocolateTheme.__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.2 -> 1.1736, Display 1 pinned.
|
|
15
|
+
expect(rule?.tokens['--font-size-base']).toBe('1rem');
|
|
16
|
+
expect(rule?.tokens['--font-size-lg']).toBe('1.1875rem');
|
|
17
|
+
expect(rule?.tokens['--font-size-5xl']).toBe('2.625rem');
|
|
18
|
+
// Desktop scale is untouched.
|
|
19
|
+
expect(chocolateTheme.tokens['--font-size-base']).toBe('0.875rem');
|
|
20
|
+
expect(chocolateTheme.tokens['--font-size-5xl']).toBe('2.625rem');
|
|
21
|
+
expect(generateThemeCSS(chocolateTheme).component).toContain(
|
|
22
|
+
'@media (width < 1024px) and (pointer: coarse)',
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
});
|
package/src/chocolateTheme.ts
CHANGED
|
@@ -55,6 +55,18 @@ export const chocolateTheme = defineTheme({
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
|
|
58
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
59
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
60
|
+
// ratio' = 1.2 * (14/16)^(1/6) ~= 1.1736. Body 14 -> 16px, display-1 stays 42px.
|
|
61
|
+
adaptations: {
|
|
62
|
+
rules: [
|
|
63
|
+
{
|
|
64
|
+
when: {pointer: 'coarse', width: {below: 'lg'}},
|
|
65
|
+
value: {typography: {scale: {base: 16, ratio: 1.1736}}},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
|
|
58
70
|
motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
|
|
59
71
|
|
|
60
72
|
syntax: chocolateSyntax,
|