@ciridae/ui 1.0.12 → 1.0.14

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.
@@ -187,7 +187,9 @@ export const MentionSchema = z.object({
187
187
  });
188
188
  const mentionPattern = /\[@([^\]]+)\]\(mention:\/\/([a-z][a-z0-9_-]*)\/([^)\s]+)\)/g;
189
189
  export function formatMention({ id, kind, label }) {
190
- return `[@${label.replace(/[[\]]/g, "")}](mention://${kind}/${encodeURIComponent(id)})`;
190
+ // encodeURIComponent keeps ( and ), and a ) would end the markup early.
191
+ const encodedId = encodeURIComponent(id).replace(/[()]/g, (bracket) => bracket === "(" ? "%28" : "%29");
192
+ return `[@${label.replace(/[[\]]/g, "")}](mention://${kind}/${encodedId})`;
191
193
  }
192
194
  /** Message text split into plain runs and mentions, in order. */
193
195
  export function parseMentions(content) {
@@ -195,9 +197,17 @@ export function parseMentions(content) {
195
197
  let lastIndex = 0;
196
198
  for (const match of content.matchAll(mentionPattern)) {
197
199
  const [token, label = "", kind = "", encodedId = ""] = match;
200
+ let id;
201
+ try {
202
+ id = decodeURIComponent(encodedId);
203
+ }
204
+ catch {
205
+ // Model-written text can hold a stray %: it stays plain text, and the message still draws.
206
+ continue;
207
+ }
198
208
  if (match.index > lastIndex)
199
209
  parts.push(content.slice(lastIndex, match.index));
200
- parts.push({ label, kind, id: decodeURIComponent(encodedId) });
210
+ parts.push({ label, kind, id });
201
211
  lastIndex = match.index + token.length;
202
212
  }
203
213
  if (lastIndex < content.length)
@@ -151,11 +151,13 @@ const chatInline = {
151
151
  const rest = source.slice(index);
152
152
  const token = /^\[@[^\]]+\]\(mention:\/\/[a-z][a-z0-9_-]*\/[^)\s]+\)/.exec(rest)?.[0];
153
153
  if (token) {
154
- const [part] = parseMentions(token);
155
- if (part && typeof part !== "string") {
156
- return {
157
- length: token.length,
158
- node: {
154
+ const [part = token] = parseMentions(token);
155
+ return {
156
+ length: token.length,
157
+ // A mention whose id does not decode stays its literal markup, not a Markdown link.
158
+ node: typeof part === "string"
159
+ ? { type: "text", value: part }
160
+ : {
159
161
  type: "inlineComponent",
160
162
  name: "chat-mention",
161
163
  tagName: "chat-mention",
@@ -163,8 +165,7 @@ const chatInline = {
163
165
  properties: { ...part },
164
166
  children: [],
165
167
  },
166
- };
167
- }
168
+ };
168
169
  }
169
170
  const angle = /^<(https?:\/\/[^<>\s]+)>/.exec(rest);
170
171
  if (!angle && /\w/.test(source[index - 1] ?? ""))
package/dist/ciridae.css CHANGED
@@ -40,9 +40,15 @@
40
40
  /* [data-edge] paints a hairline inside the element's own box. The design counts that stroke in
41
41
  the layout, so an edged element keeps a 1px transparent border under the ring. A border the
42
42
  element sets itself wins: a native button resetting the browser's sets `1px solid transparent`,
43
- and a face the design lays its edge over, such as a text button, sets `border: 0`. */
43
+ and a face the design lays its edge over, such as a text button, sets `border: 0`.
44
+
45
+ The face is clipped to the padding box, which is where the ring sits. Left on the border box it
46
+ painted through the reserved transparent border, outside the ring, and a near-white light face
47
+ showed there as a pale halo round the control. `background-clip` does nothing to a face whose
48
+ element sets `border: 0`, so both kinds of edge draw one hairline and nothing else. */
44
49
  [data-ciridae-ui][data-edge] {
45
50
  position: relative;
51
+ background-clip: padding-box;
46
52
  }
47
53
  @layer base {
48
54
  :where([data-ciridae-ui][data-edge]) {
@@ -189,8 +189,13 @@ const round = cva({
189
189
  alignItems: "center",
190
190
  justifyContent: "center",
191
191
  padding: "none",
192
- // The edge's own 1px, as the design counts it; the bare button has neither.
193
- border: "1px solid transparent",
192
+ /*
193
+ * No border, as the text button has none: every size sets its own width and height, so the
194
+ * edge still lands in the design's box. Reserving a transparent 1px border instead put the
195
+ * `[data-edge]` ring on the padding box and left the button's own face painting through the
196
+ * border outside it, which in light read as a white halo round every round button.
197
+ */
198
+ border: "0",
194
199
  borderRadius: "pill",
195
200
  // The icon is the whole control, so it is in the primary ink in every state, as the Figma's
196
201
  // round button and its icon rule draw it; hover shows on the face.
@@ -214,7 +219,6 @@ const round = cva({
214
219
  variant: {
215
220
  raised: {},
216
221
  ghost: {
217
- border: "0",
218
222
  background: "transparent",
219
223
  _hover: { background: "bg.hover" },
220
224
  _active: { translate: "[none]" },
@@ -28,10 +28,8 @@ const viewport = css({
28
28
  // shell's row sizes the main panel inside its block margins, so a full height would push it past
29
29
  // them; a phone's main panel is a full window tall, so there it takes the space under the strip.
30
30
  "& > [data-ciridae-ui]": { height: "full", background: "transparent" },
31
- "& > [data-ciridae-ui] > main": {
32
- borderRadius: "inset",
33
- _phone: { borderRadius: "none", height: "full" },
34
- },
31
+ // The main panel keeps its own 8 corners, as the Figma's page card has them everywhere.
32
+ "& > [data-ciridae-ui] > main": { _phone: { height: "full" } },
35
33
  "& > [data-ciridae-ui] > main > header": {
36
34
  paddingInlineStart: "page.inline",
37
35
  _phone: { paddingInlineStart: "panel.default" },
@@ -1,6 +1,10 @@
1
1
  import { useRender } from "@base-ui/react/use-render";
2
2
  import type { ReactNode } from "react";
3
- /** The card's surface as a style object, to merge into a `css()` call that adds layout. */
3
+ /**
4
+ * The card's surface as a style object, to merge into a `css()` call that adds layout. The edge
5
+ * comes through `--card-edge` so a `compact` panel, whose own hairline runs 4px outside it, can
6
+ * turn it off for the cards it insets.
7
+ */
4
8
  export declare const cardSurface: import("../styled-system/types/index.js").SystemStyleObject;
5
9
  export type CardProps = useRender.ComponentProps<"div">;
6
10
  export declare function Card({ render, className, ...props }: CardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
@@ -10,10 +10,14 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
10
10
  import { useRender } from "@base-ui/react/use-render";
11
11
  import { css, cva, cx } from "#primitives/css";
12
12
  import { singleLineText } from "./single-line-text.js";
13
- /** The card's surface as a style object, to merge into a `css()` call that adds layout. */
13
+ /**
14
+ * The card's surface as a style object, to merge into a `css()` call that adds layout. The edge
15
+ * comes through `--card-edge` so a `compact` panel, whose own hairline runs 4px outside it, can
16
+ * turn it off for the cards it insets.
17
+ */
14
18
  export const cardSurface = css.raw({
15
19
  minWidth: "0",
16
- border: "1px solid token(colors.border.card)",
20
+ border: "1px solid var(--card-edge, token(colors.border.card))",
17
21
  borderRadius: "action",
18
22
  background: "[token(gradients.card)]",
19
23
  });
@@ -30,11 +34,16 @@ const panel = cva({
30
34
  variants: {
31
35
  padding: {
32
36
  none: { overflow: "hidden" },
33
- // A `PanelHeader` on top is the panel's top inset; without one, the hairline runs round.
37
+ /*
38
+ * A `PanelHeader` on top is the panel's top inset; without one, the hairline runs round.
39
+ * The panel's edge is the only one round the cards it insets: a card's own hairline 4px
40
+ * inside it drew a second rule of the same weight, which read as a double border.
41
+ */
34
42
  compact: {
35
43
  paddingInline: "panel.hairline",
36
44
  paddingBottom: "panel.hairline",
37
45
  "&:not(:has(> [data-panel-header]:first-child))": { paddingTop: "panel.hairline" },
46
+ "--card-edge": "transparent",
38
47
  },
39
48
  default: { gap: "layout.contentGap", padding: "panel.default" },
40
49
  },
@@ -30,6 +30,12 @@ const containedList = css({
30
30
  background: "bg.field",
31
31
  // Raised over the base list's own gap, as the text list's is.
32
32
  "&[data-variant=contained]": { gap: "control.trackInset" },
33
+ /*
34
+ * The track's own edge is the group's boundary, so the tab raised in it takes the quieter
35
+ * selected edge: with the raised edge the two rings ran 2px apart at the same weight and read
36
+ * as one thick double border. A `plain` tab, which has no track, keeps the raised edge.
37
+ */
38
+ "& > [data-active]::before": { background: "[token(gradients.border.selected)]" },
33
39
  });
34
40
  /* Text tabs: words only, the open one in the primary text, for a tray's or a sheet's filters. */
35
41
  const textList = css({ "&[data-variant=text]": { gap: "layout.contentGap" } });
@@ -40,7 +40,10 @@ const option = css({
40
40
  export function ThemeToggle({ className }) {
41
41
  const { preference, setPreference } = useColorTheme();
42
42
  const { labels } = useCiridaeLocale();
43
- const trackEdge = faceEdge("raised");
43
+ // The track takes the quieter toolbar edge, as the filter and slicer bars do: with the raised
44
+ // edge it matched the pressed option's own ring 2px inside it, and the pair read as one thick
45
+ // double border rather than a selected option in a track.
46
+ const trackEdge = faceEdge("toolbar");
44
47
  const choices = [
45
48
  {
46
49
  value: "light",
package/dist/preset.js CHANGED
@@ -603,8 +603,19 @@ export function createCiridaePreset({ appBase = false, ...theme } = {}) {
603
603
  _light: "linear-gradient(to bottom, #F48272, #F2533C)",
604
604
  },
605
605
  },
606
- // Dark draws no edge on the primary or destructive face.
607
- "border.raised": { value: glassEdgeWithLightGradient("#BCB6B6", "#9C9A9A") },
606
+ /*
607
+ * Dark draws no edge on the primary or destructive face, and keeps the glass
608
+ * edge on the raised one. Light draws the raised edge opaque: at a third over
609
+ * a near-white face its top end resolved to the panel's own grey, so the upper
610
+ * half of every button, toolbar control and icon tile had no edge at all and
611
+ * read as a pale smear on the page rather than a control.
612
+ */
613
+ "border.raised": {
614
+ value: {
615
+ base: darkGlassEdge,
616
+ _light: "linear-gradient(to bottom, #CBCBCE, #B9B9BD)",
617
+ },
618
+ },
608
619
  "border.primary": {
609
620
  value: {
610
621
  base: noEdge,
@@ -467,17 +467,17 @@
467
467
  --colors-bg\.warning-subtle: rgba(178,125,0,.1);
468
468
  --colors-bg\.error-subtle: rgba(235,68,44,.1);
469
469
  --colors-fg\.archived: rgba(90,88,84,.66);
470
- --colors-border\.subtle: rgba(205,205,205,.66);
470
+ --colors-border\.subtle: rgba(196,196,198,.66);
471
471
  --colors-border\.focus: #4186B8;
472
472
  --colors-fg\.primary: #2A2A2D;
473
- --colors-fg\.muted: #98989E;
474
- --colors-fg\.secondary: #7B7B7E;
475
- --colors-fg\.subtle: #98989E;
476
- --colors-fg\.label: #7B7B7E;
477
- --colors-border\.control: rgba(205,205,205,.66);
473
+ --colors-fg\.muted: #6F6F76;
474
+ --colors-fg\.secondary: #5E5E63;
475
+ --colors-fg\.subtle: #6F6F76;
476
+ --colors-fg\.label: #5E5E63;
477
+ --colors-border\.control: rgba(196,196,198,.66);
478
478
  --colors-border\.canvas: rgba(167,167,167,.33);
479
- --colors-border\.divider: rgba(205,205,205,.66);
480
- --colors-border\.popover: rgba(205,205,205,.66);
479
+ --colors-border\.divider: rgba(196,196,198,.66);
480
+ --colors-border\.popover: rgba(196,196,198,.66);
481
481
  --colors-border\.menu-hover: rgba(216,216,216,.33);
482
482
  --colors-bg\.field: rgba(238,238,238,.66);
483
483
  --colors-bg\.form-field: rgba(238,238,238,.66);
@@ -489,10 +489,10 @@
489
489
  --colors-bg\.selected: rgba(55,55,58,.07);
490
490
  --colors-bg\.selected-hover: rgba(55,55,58,.1);
491
491
  --colors-border\.selected: rgba(55,55,58,.2);
492
- --colors-bg\.track: #7B7B7E;
492
+ --colors-bg\.track: #5E5E63;
493
493
  --colors-bg\.knob: #FBFBFB;
494
- --colors-border\.panel: rgba(205,205,205,.66);
495
- --colors-border\.card: rgba(205,205,205,.66);
494
+ --colors-border\.panel: rgba(196,196,198,.66);
495
+ --colors-border\.card: rgba(196,196,198,.66);
496
496
  --colors-border\.glass: rgba(137,136,135,.28);
497
497
  --colors-border\.hairline: #E0DAD0;
498
498
  --colors-bg\.surface: #FBFBFC;
@@ -528,7 +528,7 @@
528
528
  --colors-chart\.bar-track: rgba(114,191,246,.2);
529
529
  --colors-chart\.progress-track: rgba(65,134,184,.2);
530
530
  --colors-chart\.at-risk-track: rgba(248,184,83,.2);
531
- --colors-chart\.neutral: #7B7B7E;
531
+ --colors-chart\.neutral: #5E5E63;
532
532
  --colors-chart\.not-started: rgba(167,167,167,.33);
533
533
  --shadows-indicator\.live: inset 0 1px 1px rgba(255,255,255,.18), inset 0 -1px 1px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
534
534
  --shadows-search: inset 1px 2px 8px rgba(20,20,22,.07), inset -1px -2px 8px rgba(20,20,22,.07);
@@ -556,7 +556,7 @@
556
556
  --gradients-primary-hover: linear-gradient(to bottom, rgba(87,87,91,.88), rgba(23,23,25,.88));
557
557
  --gradients-tinted: linear-gradient(to bottom, rgba(253,253,253,.66), rgba(232,226,217,.66));
558
558
  --gradients-danger: linear-gradient(to bottom, #F48272, #F2533C);
559
- --gradients-border\.raised: linear-gradient(to bottom, rgba(188,182,182,.33), rgba(156,154,154,.33));
559
+ --gradients-border\.raised: linear-gradient(to bottom, #CBCBCE, #B9B9BD);
560
560
  --gradients-border\.primary: linear-gradient(to bottom, rgba(51,51,55,.33), rgba(74,70,66,.33) 10%, rgba(55,52,48,.33) 90%, rgba(51,51,55,.33));
561
561
  --gradients-border\.danger: linear-gradient(to bottom, rgba(195,81,81,.33), rgba(142,61,61,.33));
562
562
  --gradients-border\.tinted: linear-gradient(to bottom, rgba(181,175,135,.33), rgba(191,137,49,.33));
@@ -750,6 +750,10 @@
750
750
  --dialog-sheet: var(--sizes-overlay\.dialog-wide);
751
751
  }
752
752
 
753
+ .\--card-edge_transparent {
754
+ --card-edge: transparent;
755
+ }
756
+
753
757
  .\--app-content-inset_token\(spacing\.page\.inline\) {
754
758
  --app-content-inset: var(--spacing-page\.inline);
755
759
  }
@@ -1146,6 +1150,10 @@
1146
1150
  background: var(--colors-bg\.modal-sheet);
1147
1151
  }
1148
1152
 
1153
+ .bd_1px_solid_var\(--card-edge\,_token\(colors\.border\.card\)\) {
1154
+ border: 1px solid var(--card-edge, var(--colors-border\.card));
1155
+ }
1156
+
1149
1157
  .bg_\[token\(gradients\.panel\)\] {
1150
1158
  background: var(--gradients-panel);
1151
1159
  }
@@ -5028,6 +5036,10 @@
5028
5036
  background: var(--colors-accent\.green);
5029
5037
  }
5030
5038
 
5039
+ .\[\&_\>_\[data-active\]\:\:before\]\:bg_\[token\(gradients\.border\.selected\)\] > [data-active]::before {
5040
+ background: var(--gradients-border\.selected);
5041
+ }
5042
+
5031
5043
  .\[\&\[data-active\]\]\:bg_\[token\(gradients\.raised\)\][data-active] {
5032
5044
  background: var(--gradients-raised);
5033
5045
  }
@@ -5564,10 +5576,6 @@
5564
5576
  border-color: var(--colors-border\.error);
5565
5577
  }
5566
5578
 
5567
- .\[\&_\>_\[data-ciridae-ui\]_\>_main\]\:bdr_inset > [data-ciridae-ui] > main {
5568
- border-radius: var(--radii-inset);
5569
- }
5570
-
5571
5579
  .\[\&_img\]\:bdr_keycap img {
5572
5580
  border-radius: var(--radii-keycap);
5573
5581
  }
@@ -9922,9 +9930,6 @@
9922
9930
  }
9923
9931
  .phone\:\[\&_\>_\:last-child\]\:ov_visible > :last-child {
9924
9932
  overflow: visible;
9925
- }
9926
- .\[\&_\>_\[data-ciridae-ui\]_\>_main\]\:phone\:bdr_none > [data-ciridae-ui] > main {
9927
- border-radius: var(--radii-none);
9928
9933
  }
9929
9934
  [data-variant=underline] > .\[\[data-variant\=underline\]_\>_\&\]\:phone\:px_none {
9930
9935
  padding-inline: var(--spacing-none);
package/dist/styles.css CHANGED
@@ -40,9 +40,15 @@
40
40
  /* [data-edge] paints a hairline inside the element's own box. The design counts that stroke in
41
41
  the layout, so an edged element keeps a 1px transparent border under the ring. A border the
42
42
  element sets itself wins: a native button resetting the browser's sets `1px solid transparent`,
43
- and a face the design lays its edge over, such as a text button, sets `border: 0`. */
43
+ and a face the design lays its edge over, such as a text button, sets `border: 0`.
44
+
45
+ The face is clipped to the padding box, which is where the ring sits. Left on the border box it
46
+ painted through the reserved transparent border, outside the ring, and a near-white light face
47
+ showed there as a pale halo round the control. `background-clip` does nothing to a face whose
48
+ element sets `border: 0`, so both kinds of edge draw one hairline and nothing else. */
44
49
  [data-ciridae-ui][data-edge] {
45
50
  position: relative;
51
+ background-clip: padding-box;
46
52
  }
47
53
  @layer base {
48
54
  :where([data-ciridae-ui][data-edge]) {
@@ -51,12 +51,16 @@ const ciridaeGreys = {
51
51
  well: "#EEEEEE",
52
52
  avatar: "#D8D8DE",
53
53
  primary: "#2A2A2D",
54
- secondary: "#7B7B7E",
55
- muted: "#98989E",
54
+ /*
55
+ * Supporting and meta ink, deepened from the Figma's #7B7B7E and #98989E so both clear
56
+ * WCAG AA on the card, the panel and the canvas; see design/departures.md.
57
+ */
58
+ secondary: "#5E5E63",
59
+ muted: "#6F6F76",
56
60
  archived: "#5A5854",
57
- line: "#CDCDCD",
58
- border: "#CDCDCD",
59
- cardBorder: "#CDCDCD",
61
+ line: "#C4C4C6",
62
+ border: "#C4C4C6",
63
+ cardBorder: "#C4C4C6",
60
64
  mark: "#A7A7A7",
61
65
  hairline: "#E0DAD0",
62
66
  menuHoverBorder: "#D8D8D8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciridae/ui",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",