@datalayer/primer-addons 1.0.34 → 1.0.36

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/README.md CHANGED
@@ -59,16 +59,16 @@ The sources: `src/theme/colors/loopColors.ts` (colours and accents), `src/theme/
59
59
 
60
60
  ### Accents
61
61
 
62
- Six, and an application takes one. Each is four values — the accent, the text that sits on it, the **stage** (the flat tint behind a hosted application) and a **quiet** tint (the agent's bubble, a draft) — the stage and the quiet tint each with a light and a dark value.
62
+ Six, and an application takes one. Each is five values — the accent, the text that sits on it, the **stage** (the flat tint behind a hosted application), a **quiet** tint (the agent's bubble, a draft) and the accent **as text** (a link, a suggested question) — the last three each with a light and a dark value.
63
63
 
64
- | Name | Accent | Text on it | Stage (light / dark) | Quiet (light / dark) |
65
- |---|---|---|---|---|
66
- | `green` (mint, the default) | `#7ADBB8` | `#06281E` | `#DDF5EC` / `#10261F` | `#F0FAF6` / `#17211D` |
67
- | `rose` | `#F6A5C1` | `#3A0A1C` | `#FCE3EC` / `#2B141C` | `#FDF2F6` / `#22181C` |
68
- | `sky` | `#8CCBF9` | `#06243B` | `#DFF0FD` / `#0F2333` | `#F0F8FE` / `#161E25` |
69
- | `lime` | `#BEDC55` | `#1F2A00` | `#EEF6CC` / `#1E2609` | `#F7FBE6` / `#1C2014` |
70
- | `sun` | `#F8D469` | `#2E2200` | `#FDF3CD` / `#2A2209` | `#FEF9E7` / `#221F14` |
71
- | `violet` | `#C0AEF6` | `#1C0F47` | `#ECE7FD` / `#1B1533` | `#F6F3FE` / `#1C1A27` |
64
+ | Name | Accent | Text on it | Stage (light / dark) | Quiet (light / dark) | As text (light / dark) |
65
+ |---|---|---|---|---|---|
66
+ | `green` (mint, the default) | `#7ADBB8` | `#06281E` | `#DDF5EC` / `#10261F` | `#F0FAF6` / `#17211D` | `#248462` / `#8FE5C6` |
67
+ | `rose` | `#F6A5C1` | `#3A0A1C` | `#FCE3EC` / `#2B141C` | `#FDF2F6` / `#22181C` | `#B83A6B` / `#F6A5C1` |
68
+ | `sky` | `#8CCBF9` | `#06243B` | `#DFF0FD` / `#0F2333` | `#F0F8FE` / `#161E25` | `#1F6FB0` / `#8CCBF9` |
69
+ | `lime` | `#BEDC55` | `#1F2A00` | `#EEF6CC` / `#1E2609` | `#F7FBE6` / `#1C2014` | `#5F7A00` / `#BEDC55` |
70
+ | `sun` | `#F8D469` | `#2E2200` | `#FDF3CD` / `#2A2209` | `#FEF9E7` / `#221F14` | `#8A6A00` / `#F8D469` |
71
+ | `violet` | `#C0AEF6` | `#1C0F47` | `#ECE7FD` / `#1B1533` | `#F6F3FE` / `#1C1A27` | `#6B53C9` / `#C0AEF6` |
72
72
 
73
73
  `loopAccents` holds them, `loopAccentNames` lists them in the order a picker shows them, and `loopAccentVars(name, mode)` turns one into the four custom properties an application sets on its root: `--loop-accent`, `--loop-accent-on`, `--loop-stage`, `--loop-quiet`. An unknown name falls back to `green`.
74
74
 
@@ -81,7 +81,7 @@ import { loopAccentVars } from '@datalayer/primer-addons';
81
81
  baseStyles={loopAccentVars(app.interface.accent, mode)}>
82
82
  ```
83
83
 
84
- `loopAccentVars` sets the four `--loop-*` properties and nothing else: what reads them (the stage, a bubble drawn with them) takes the application's accent, while Primer's own accent tokens — the filled button, `--bgColor-accent-emphasis` — stay the theme's mint.
84
+ `loopAccentVars` sets the four `--loop-*` properties and nothing else: what reads them (the stage, a bubble drawn with them) takes the application's accent, while Primer's own accent tokens — the filled button, `--bgColor-accent-emphasis` — stay the theme's mint. `loopAccentStyles(name, mode)` sets everything the accent colours instead: those four, the accent fill and the filled button with its text, and Primer's accent text, links, muted border and muted tint (`--fgColor-accent`, `--fgColor-link`, `--borderColor-accent-muted`, `--bgColor-accent-muted`), and the selected tab's underline (`--underlineNav-borderColor-active`, which the theme itself also sets to its mint in place of Primer's coral) — so that nothing on an application's page keeps mint beside its own accent.
85
85
 
86
86
  ### Shape, shadow, type and motion
87
87
 
@@ -106,10 +106,16 @@ import { loopAccentVars } from '@datalayer/primer-addons';
106
106
  - **The face** of an application, at three sizes and no other: `--loop-face-large` (72px, a page), `--loop-face-medium` (40px, a header or a card), `--loop-face-small` (20px, a line of a list).
107
107
  - **Shadow**: one level, `--loop-shadow-frame`. In light mode a surface floats on a soft, low shadow; in dark mode, where a shadow shows little, on a hairline of light and a deeper shadow. Primer's `--shadow-resting-*` and `--shadow-floating-*` take the same hand, so a menu or a dialog floats as a frame does. `--loop-hairline` is the line between two surfaces (7% of the ink in light, 10% of white in dark).
108
108
  - **Motion**: three durations for three things — `--loop-motion-status` (a status changing), `--loop-motion-message` (a message arriving), `--loop-motion-pane` (a pane opening) — and one easing, `--loop-motion-easing`. Nothing else moves; a component honours `prefers-reduced-motion` itself.
109
- - **Type**: one face, Inter, then the system sans-serif (`loopFontFamily`); two weights, 400 and 600. The titles are set tighter (`--text-display-shorthand` 2.75rem/1.15 down to `--text-title-shorthand-small` 1rem/1.4) and the tracking is a token a component applies: `--loop-tracking-display` (-0.02em), `--loop-tracking-title` (-0.012em), `--loop-tracking-body` (0). The package does not ship the face: a page that has not loaded Inter shows the system face, and nothing but the letterforms changes.
109
+ - **Type**: one face, Inter — open licence (SIL OFL 1.1) and variable — then a metric-matched fallback, then the system sans-serif (`loopFontFamily`: `"Inter Variable", "Inter Fallback", ui-sans-serif, system-ui, …`). Two weights, 400 and 600 (`loopFontWeights`; Primer's light weight is 400 and its medium 600), and five sizes, one line-height for each (`loopTypeScale`, every line a multiple of 4px): 2rem/1.25 (display, title large), 1.25rem/1.4 (title medium, subtitle), 1rem/1.5 (title small, body large), 0.875rem/1.4286 (body medium, the theme's body), 0.75rem/1.3333 (body small, caption) — set on Primer's shorthands and on its size and line-height tokens alike, and held by `loopType.test.ts`. The titles are set tighter and the tracking is a token a component applies: `--loop-tracking-display` (-0.02em), `--loop-tracking-title` (-0.012em), `--loop-tracking-body` (0).
110
+ - **The face, from the page's own origin**: a page wearing the theme imports `@datalayer/primer-addons/style/loop-face.css` once. It declares `Inter Variable` from `@fontsource-variable/inter` — the upright variable file, latin and latin-ext only, `font-display: swap` — which the page's bundler emits as its own asset, so the face is fetched from the page's origin and never from a third party; and `Inter Fallback`, a local Arial (or Liberation Sans or Arimo, metric-compatible with it) drawn to Inter's measure — `size-adjust: 107.4%`, `ascent-override: 90.2%`, `descent-override: 22.48%`, `line-gap-override: 0%`, next/font's values for Inter, computed by Capsize — so the text paints in the fallback first and does not move when Inter arrives. A page that does not import it shows the system face.
111
+ - **Space**: no scale of its own — Primer's, in steps of 4 and 8 (`sx` 1 to 6 are 4, 8, 16, 24, 32, 40px), and the air of the look comes from where it is spent: a frame 24px from the edge of its stage, 16px inside a conversation (the header, the messages, the composer), 24px around a pane of work, 8px between two pills, and one hairline (`--theme-hairline`) where two surfaces meet instead of a gap and a border.
110
112
  - **The stage, lit**: `--loop-stage-gradient`, from the stage tint at the top to the quiet tint at the bottom, both the accent's.
111
113
  - **The focus ring**: `--focus-outlineColor`, the deep mint `#0F6B4F` in light mode and a mid grey `#636363` in dark mode.
112
114
 
115
+ ### The reference screens
116
+
117
+ The tokens above are drawn together on four reference screens (LOOP T-01) — **a conversation**, **a conversation beside its work**, **the activity of a worker** and **an approval** — each in the nine themes of the registry and in both modes. They are built from the real chat components of `@datalayer/agent-runtimes`, which depends on this package, so they live there: as stories (`src/stories/loop/LoopReference.stories.tsx`, *Loop/Reference screens*) and as pictures that a test compares in Chrome (`npm run test:pictures` in agent-runtimes, T-16; `TESTING.md` there says how to run it and how to accept a change). A change of token here shows there as a picture that differs: accept it, or fix it.
118
+
113
119
  ### The controls, as pills
114
120
 
115
121
  Every Primer control takes its corners from one token, `--borderRadius-medium`, which cards and list items take too — so "the controls alone are pills" cannot be said with a custom property. A theme may therefore carry **a stylesheet of its own**, `ThemeStyles.css`, written relative to `:scope` (`buildThemeStyles(light, dark, { css })`). `loop` is the only theme that has one (`loopControlsCss`): buttons, text inputs, selects, segmented controls, button groups (their two ends), toggle switches and underline tabs are pills; a multi-line text area keeps `--borderRadius-medium`, and menus and overlays keep the card's radius. The selectors match the stable prefixes of Primer's class names (`loopControlsSelectors`), and a test reads each back from the installed `@primer/react`, so an upgrade that renames one fails the build.
@@ -130,7 +136,8 @@ How `DatalayerThemeProvider` applies it:
130
136
  - the ink on the stage or on the quiet tint, light and dark, is under 4.5 to 1;
131
137
  - the focus ring is under **3 to 1** against the page or around a pill of any accent — but on the subtle dark surface, the one place the dark ring falls short, where it holds 2.7 to 1;
132
138
  - the filled button — rest, hovered, pressed — or the accent's text on white is under 4.5 to 1, or the accent's fill and the filled button stop being one colour;
133
- - the secondary text is under 4.5 to 1 on white or on near-black.
139
+ - the secondary text is under 4.5 to 1 on white or on near-black;
140
+ - the accent as text is under 4.5 to 1 on white, on near-black or on its dark quiet tint — and, but for mint, whose text the theme had first, on its light quiet tint.
134
141
 
135
142
  The same test holds the motion to three durations and one easing.
136
143
 
@@ -183,3 +190,5 @@ npm dev
183
190
  ## Releases
184
191
 
185
192
  Primer Addons is released in [Npm.js](https://www.npmjs.com/package/@datalayer/primer-addons).
193
+
194
+ What each version brought, with the LOOP boxes it carries, is in the [changelog](CHANGELOG.md).
@@ -82,6 +82,14 @@ export interface LoopAccent {
82
82
  light: string;
83
83
  dark: string;
84
84
  };
85
+ /**
86
+ * The accent as text: a link, a starter, an accent's word — deep enough on
87
+ * white (4.5 to 1), and the pastel itself on dark.
88
+ */
89
+ text: {
90
+ light: string;
91
+ dark: string;
92
+ };
85
93
  }
86
94
  /** The six accents. One per application; everything else is neutral. Green — mint — is the theme's own. */
87
95
  export declare const loopAccents: Record<LoopAccentName, LoopAccent>;
@@ -83,36 +83,42 @@ export const loopAccents = {
83
83
  on: '#06281E',
84
84
  stage: { light: '#DDF5EC', dark: '#10261F' },
85
85
  quiet: { light: '#F0FAF6', dark: '#17211D' },
86
+ text: { light: '#248462', dark: '#8FE5C6' },
86
87
  },
87
88
  rose: {
88
89
  accent: '#F6A5C1',
89
90
  on: '#3A0A1C',
90
91
  stage: { light: '#FCE3EC', dark: '#2B141C' },
91
92
  quiet: { light: '#FDF2F6', dark: '#22181C' },
93
+ text: { light: '#B83A6B', dark: '#F6A5C1' },
92
94
  },
93
95
  sky: {
94
96
  accent: '#8CCBF9',
95
97
  on: '#06243B',
96
98
  stage: { light: '#DFF0FD', dark: '#0F2333' },
97
99
  quiet: { light: '#F0F8FE', dark: '#161E25' },
100
+ text: { light: '#1F6FB0', dark: '#8CCBF9' },
98
101
  },
99
102
  lime: {
100
103
  accent: '#BEDC55',
101
104
  on: '#1F2A00',
102
105
  stage: { light: '#EEF6CC', dark: '#1E2609' },
103
106
  quiet: { light: '#F7FBE6', dark: '#1C2014' },
107
+ text: { light: '#5F7A00', dark: '#BEDC55' },
104
108
  },
105
109
  sun: {
106
110
  accent: '#F8D469',
107
111
  on: '#2E2200',
108
112
  stage: { light: '#FDF3CD', dark: '#2A2209' },
109
113
  quiet: { light: '#FEF9E7', dark: '#221F14' },
114
+ text: { light: '#8A6A00', dark: '#F8D469' },
110
115
  },
111
116
  violet: {
112
117
  accent: '#C0AEF6',
113
118
  on: '#1C0F47',
114
119
  stage: { light: '#ECE7FD', dark: '#1B1533' },
115
120
  quiet: { light: '#F6F3FE', dark: '#1C1A27' },
121
+ text: { light: '#6B53C9', dark: '#C0AEF6' },
116
122
  },
117
123
  };
118
124
  /** The names of the accents, in the order a picker shows them. */
@@ -146,6 +152,14 @@ export function loopAccentStyles(name, mode = 'light') {
146
152
  ...loopAccentVars(name, mode),
147
153
  '--bgColor-accent-emphasis': accent.accent,
148
154
  '--borderColor-accent-emphasis': accent.accent,
155
+ // Its text, its muted border and tint: so that nothing on the page keeps
156
+ // the theme's default accent beside the application's own (T-18).
157
+ '--fgColor-accent': accent.text[mode],
158
+ '--fgColor-link': accent.text[mode],
159
+ '--borderColor-accent-muted': accent.accent,
160
+ '--bgColor-accent-muted': accent.quiet[mode],
161
+ // The selected tab: underlined in the accent (T-14).
162
+ '--underlineNav-borderColor-active': accent.accent,
149
163
  '--button-primary-bgColor-rest': accent.accent,
150
164
  '--button-primary-borderColor-rest': accent.accent,
151
165
  '--button-primary-bgColor-hover': accent.accent,
@@ -18,10 +18,50 @@ export declare const loopShapeVars: Record<string, string>;
18
18
  */
19
19
  export declare const loopShadows: Record<'light' | 'dark', Record<string, string>>;
20
20
  /**
21
- * Type: titles set tight and a little closer, as a good display face is;
22
- * the body left alone. The tracking is a token for a component to apply,
21
+ * Type (LOOP T-04): one face, two weights, five sizes, one line-height per
22
+ * size — each line a multiple of 4px.
23
+ *
24
+ * | Size | Line | Tokens |
25
+ * |-----------------|---------------|--------------------------------------|
26
+ * | 2rem (32px) | 1.25 (40px) | display, title large |
27
+ * | 1.25rem (20px) | 1.4 (28px) | title medium, subtitle |
28
+ * | 1rem (16px) | 1.5 (24px) | title small, body large |
29
+ * | 0.875rem (14px) | 1.4286 (20px) | body medium — the body of the theme |
30
+ * | 0.75rem (12px) | 1.3333 (16px) | body small, caption |
31
+ *
32
+ * The weights are 400 (body, subtitle) and 600 (titles, display, and what
33
+ * Primer sets in its medium weight — a button's label); Primer's light weight
34
+ * is 400. The titles are set tight and a little closer, as a good display face
35
+ * is; the body left alone. The tracking is a token for a component to apply,
23
36
  * since a CSS font shorthand carries none.
24
37
  */
38
+ export declare const loopTypeScale: {
39
+ readonly display: {
40
+ readonly size: "2rem";
41
+ readonly lineHeight: "1.25";
42
+ };
43
+ readonly title: {
44
+ readonly size: "1.25rem";
45
+ readonly lineHeight: "1.4";
46
+ };
47
+ readonly heading: {
48
+ readonly size: "1rem";
49
+ readonly lineHeight: "1.5";
50
+ };
51
+ readonly body: {
52
+ readonly size: "0.875rem";
53
+ readonly lineHeight: "1.4286";
54
+ };
55
+ readonly small: {
56
+ readonly size: "0.75rem";
57
+ readonly lineHeight: "1.3333";
58
+ };
59
+ };
60
+ /** The two weights of the `loop` theme. */
61
+ export declare const loopFontWeights: {
62
+ readonly regular: 400;
63
+ readonly semibold: 600;
64
+ };
25
65
  export declare const loopTypeVars: (font: string) => Record<string, string>;
26
66
  /**
27
67
  * The stage, lit: a soft fall from the stage tint at the top to the quiet
@@ -1118,11 +1158,16 @@ export declare const loopTheme: {
1118
1158
  }>;
1119
1159
  };
1120
1160
  /**
1121
- * Inter, then the system's own sans-serif. One face, two weights (400
1122
- * and 600). The page is expected to load Inter; without it the system
1123
- * face is used, and nothing shifts but the letterforms.
1161
+ * Inter, then its metric-matched fallback, then the system's own sans-serif
1162
+ * (LOOP T-04). One face, two weights (400 and 600). The face is served by the
1163
+ * page's own build: a page wearing the theme imports
1164
+ * `@datalayer/primer-addons/style/loop-face.css`, which declares
1165
+ * `Inter Variable` from `@fontsource-variable/inter` and `Inter Fallback`, a
1166
+ * local Arial drawn to Inter's measure. The text paints in the fallback first
1167
+ * and does not move when Inter arrives; a page that has not imported the
1168
+ * stylesheet shows the system face.
1124
1169
  */
1125
- export declare const loopFontFamily = "Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
1170
+ export declare const loopFontFamily = "\"Inter Variable\", \"Inter Fallback\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
1126
1171
  /**
1127
1172
  * Motion (LOOP T-10): three durations and one easing, for three things — a
1128
1173
  * status changing, a message arriving, a pane opening. Nothing else moves.
@@ -18,7 +18,7 @@
18
18
  * its accent, the stage behind it, a bubble, a frame, a face.
19
19
  */
20
20
  import { theme as primerTheme } from '@primer/react';
21
- import { loopAccentVars, loopColors } from '../colors/loopColors';
21
+ import { loopAccentVars, loopAccents, loopColors } from '../colors/loopColors';
22
22
  import { buildThemeStyles } from '../css/createThemeCSSVars';
23
23
  /* ── Light-mode colour definitions ───────────────────────────────────── */
24
24
  export const loopLight = {
@@ -317,20 +317,75 @@ export const loopShadows = {
317
317
  },
318
318
  };
319
319
  /**
320
- * Type: titles set tight and a little closer, as a good display face is;
321
- * the body left alone. The tracking is a token for a component to apply,
320
+ * Type (LOOP T-04): one face, two weights, five sizes, one line-height per
321
+ * size — each line a multiple of 4px.
322
+ *
323
+ * | Size | Line | Tokens |
324
+ * |-----------------|---------------|--------------------------------------|
325
+ * | 2rem (32px) | 1.25 (40px) | display, title large |
326
+ * | 1.25rem (20px) | 1.4 (28px) | title medium, subtitle |
327
+ * | 1rem (16px) | 1.5 (24px) | title small, body large |
328
+ * | 0.875rem (14px) | 1.4286 (20px) | body medium — the body of the theme |
329
+ * | 0.75rem (12px) | 1.3333 (16px) | body small, caption |
330
+ *
331
+ * The weights are 400 (body, subtitle) and 600 (titles, display, and what
332
+ * Primer sets in its medium weight — a button's label); Primer's light weight
333
+ * is 400. The titles are set tight and a little closer, as a good display face
334
+ * is; the body left alone. The tracking is a token for a component to apply,
322
335
  * since a CSS font shorthand carries none.
323
336
  */
324
- export const loopTypeVars = (font) => ({
325
- '--text-display-shorthand': `600 2.75rem/1.15 ${font}`,
326
- '--text-title-shorthand-large': `600 2rem/1.25 ${font}`,
327
- '--text-title-shorthand-medium': `600 1.25rem/1.35 ${font}`,
328
- '--text-title-shorthand-small': `600 1rem/1.4 ${font}`,
329
- '--text-subtitle-shorthand': `400 1.25rem/1.5 ${font}`,
330
- '--loop-tracking-display': '-0.02em',
331
- '--loop-tracking-title': '-0.012em',
332
- '--loop-tracking-body': '0',
333
- });
337
+ export const loopTypeScale = {
338
+ display: { size: '2rem', lineHeight: '1.25' },
339
+ title: { size: '1.25rem', lineHeight: '1.4' },
340
+ heading: { size: '1rem', lineHeight: '1.5' },
341
+ body: { size: '0.875rem', lineHeight: '1.4286' },
342
+ small: { size: '0.75rem', lineHeight: '1.3333' },
343
+ };
344
+ /** The two weights of the `loop` theme. */
345
+ export const loopFontWeights = { regular: 400, semibold: 600 };
346
+ export const loopTypeVars = (font) => {
347
+ const { display, title, heading, body, small } = loopTypeScale;
348
+ const { regular, semibold } = loopFontWeights;
349
+ const shorthand = (weight, step) => `${weight} ${step.size}/${step.lineHeight} ${font}`;
350
+ return {
351
+ '--base-text-weight-light': String(regular),
352
+ '--base-text-weight-normal': String(regular),
353
+ '--base-text-weight-medium': String(semibold),
354
+ '--base-text-weight-semibold': String(semibold),
355
+ '--text-display-size': display.size,
356
+ '--text-display-lineHeight': display.lineHeight,
357
+ '--text-display-lineBoxHeight': display.lineHeight,
358
+ '--text-display-weight': String(semibold),
359
+ '--text-title-size-large': display.size,
360
+ '--text-title-lineHeight-large': display.lineHeight,
361
+ '--text-title-size-medium': title.size,
362
+ '--text-title-lineHeight-medium': title.lineHeight,
363
+ '--text-subtitle-size': title.size,
364
+ '--text-subtitle-lineHeight': title.lineHeight,
365
+ '--text-title-size-small': heading.size,
366
+ '--text-title-lineHeight-small': heading.lineHeight,
367
+ '--text-body-size-large': heading.size,
368
+ '--text-body-lineHeight-large': heading.lineHeight,
369
+ '--text-body-size-medium': body.size,
370
+ '--text-body-lineHeight-medium': body.lineHeight,
371
+ '--text-body-size-small': small.size,
372
+ '--text-body-lineHeight-small': small.lineHeight,
373
+ '--text-caption-size': small.size,
374
+ '--text-caption-lineHeight': small.lineHeight,
375
+ '--text-display-shorthand': shorthand(semibold, display),
376
+ '--text-title-shorthand-large': shorthand(semibold, display),
377
+ '--text-title-shorthand-medium': shorthand(semibold, title),
378
+ '--text-title-shorthand-small': shorthand(semibold, heading),
379
+ '--text-subtitle-shorthand': shorthand(regular, title),
380
+ '--text-body-shorthand-large': shorthand(regular, heading),
381
+ '--text-body-shorthand-medium': shorthand(regular, body),
382
+ '--text-body-shorthand-small': shorthand(regular, small),
383
+ '--text-caption-shorthand': shorthand(regular, small),
384
+ '--loop-tracking-display': '-0.02em',
385
+ '--loop-tracking-title': '-0.012em',
386
+ '--loop-tracking-body': '0',
387
+ };
388
+ };
334
389
  /**
335
390
  * The stage, lit: a soft fall from the stage tint at the top to the quiet
336
391
  * tint at the bottom, for the page an application sits on. Both tints are
@@ -347,11 +402,16 @@ export const loopStageGradient = 'radial-gradient(140% 100% at 50% 0%, var(--loo
347
402
  */
348
403
  export const loopTheme = primerTheme;
349
404
  /**
350
- * Inter, then the system's own sans-serif. One face, two weights (400
351
- * and 600). The page is expected to load Inter; without it the system
352
- * face is used, and nothing shifts but the letterforms.
405
+ * Inter, then its metric-matched fallback, then the system's own sans-serif
406
+ * (LOOP T-04). One face, two weights (400 and 600). The face is served by the
407
+ * page's own build: a page wearing the theme imports
408
+ * `@datalayer/primer-addons/style/loop-face.css`, which declares
409
+ * `Inter Variable` from `@fontsource-variable/inter` and `Inter Fallback`, a
410
+ * local Arial drawn to Inter's measure. The text paints in the fallback first
411
+ * and does not move when Inter arrives; a page that has not imported the
412
+ * stylesheet shows the system face.
353
413
  */
354
- export const loopFontFamily = 'Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
414
+ export const loopFontFamily = '"Inter Variable", "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
355
415
  /**
356
416
  * Motion (LOOP T-10): three durations and one easing, for three things — a
357
417
  * status changing, a message arriving, a pane opening. Nothing else moves.
@@ -418,6 +478,10 @@ export const loopControlsCss = `
418
478
  :scope ${sel.buttonGroup} {
419
479
  --borderRadius-medium: var(--loop-radius-control);
420
480
  }
481
+ :scope b,
482
+ :scope strong {
483
+ font-weight: var(--base-text-weight-semibold);
484
+ }
421
485
  `;
422
486
  /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
423
487
  export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
@@ -445,6 +509,8 @@ export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
445
509
  '--loop-stage-gradient': loopStageGradient,
446
510
  '--loop-hairline': loopHairline.light,
447
511
  '--focus-outlineColor': loopFocusRing.light,
512
+ // The selected tab underlined in the accent, not Primer's coral (LOOP T-14).
513
+ '--underlineNav-borderColor-active': loopAccents.green.accent,
448
514
  },
449
515
  dark: {
450
516
  ...loopShapeVars,
@@ -455,6 +521,8 @@ export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
455
521
  '--loop-stage-gradient': loopStageGradient,
456
522
  '--loop-hairline': loopHairline.dark,
457
523
  '--focus-outlineColor': loopFocusRing.dark,
524
+ // The selected tab underlined in the accent, not Primer's coral (LOOP T-14).
525
+ '--underlineNav-borderColor-active': loopAccents.green.accent,
458
526
  },
459
527
  },
460
528
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/primer-addons",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "license": "BSD-3-Clause",
5
5
  "scripts": {
6
6
  "build": "npm run build:lib",
@@ -35,6 +35,7 @@
35
35
  "dependencies": {
36
36
  "@datalayer/icons-react": "^1.0.0",
37
37
  "@datalayer/reactor": "^1.0.4",
38
+ "@fontsource-variable/inter": "^5.3.0",
38
39
  "@primer/octicons-react": "^19.35.0",
39
40
  "@primer/primitives": "^10.7.0",
40
41
  "@primer/react": "^37.31.0",
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright (c) 2023-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+
6
+ /*
7
+ * The `loop` theme's face (LOOP T-04): Inter, open licence (SIL OFL 1.1) and
8
+ * variable, served by the page's own build from `@fontsource-variable/inter`
9
+ * — the woff2 is bundled as an asset of the importing application, so it is
10
+ * fetched from that application's origin and never from a third party.
11
+ *
12
+ * Import it once where the theme can be worn:
13
+ *
14
+ * import '@datalayer/primer-addons/style/loop-face.css';
15
+ *
16
+ * Only the upright variable axis (weights 100 to 900 in one file; the theme
17
+ * uses 400 and 600) and only two subsets, latin and latin-ext: a browser
18
+ * fetches a subset only when the page draws one of its characters, and
19
+ * everything else falls to the system face.
20
+ */
21
+
22
+ /* inter-latin-ext-wght-normal */
23
+ @font-face {
24
+ font-family: 'Inter Variable';
25
+ font-style: normal;
26
+ font-display: swap;
27
+ font-weight: 100 900;
28
+ src: url('@fontsource-variable/inter/files/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
29
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
30
+ U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
31
+ }
32
+
33
+ /* inter-latin-wght-normal */
34
+ @font-face {
35
+ font-family: 'Inter Variable';
36
+ font-style: normal;
37
+ font-display: swap;
38
+ font-weight: 100 900;
39
+ src: url('@fontsource-variable/inter/files/inter-latin-wght-normal.woff2') format('woff2-variations');
40
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
41
+ U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
42
+ }
43
+
44
+ /*
45
+ * The fallback the text is painted in first (`font-display: swap`), drawn to
46
+ * Inter's measure so that nothing moves when Inter arrives: Arial — or a face
47
+ * metric-compatible with it, Liberation Sans or Arimo, where Arial is not
48
+ * installed — scaled to Inter's average width and given Inter's ascent and
49
+ * descent. The values are next/font's for Inter (`@next/font`, computed by
50
+ * Capsize from Inter's metrics against Arial's: size-adjust 107.4%, ascent
51
+ * 90.2%, descent 22.48%, no line gap). Measured again in Chrome against the
52
+ * woff2 above: Inter's ascent 0.969 and descent 0.241 of its em, and a
53
+ * sentence of English 107.0% as wide as Arial's.
54
+ */
55
+ @font-face {
56
+ font-family: 'Inter Fallback';
57
+ src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans'), local('Arimo');
58
+ size-adjust: 107.4%;
59
+ ascent-override: 90.2%;
60
+ descent-override: 22.48%;
61
+ line-gap-override: 0%;
62
+ }