@crewlethq/ui 0.155.0 → 0.157.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.
Files changed (34) hide show
  1. package/README.md +33 -0
  2. package/dist/ArtifactRef/index.js +3 -3
  3. package/dist/{Editor-LGZMJEUD.js → Editor-7HVKZ35J.js} +8 -5
  4. package/dist/InlineRef/index.js +2 -2
  5. package/dist/LimitMeters/LimitMeters.d.ts +39 -0
  6. package/dist/LimitMeters/index.d.ts +3 -0
  7. package/dist/LimitMeters/index.js +2 -0
  8. package/dist/LimitMeters-WCN2QTUU.css +131 -0
  9. package/dist/LinkCard/index.js +2 -2
  10. package/dist/Markdown/grammar.d.ts +107 -6
  11. package/dist/Markdown/index.js +1 -1
  12. package/dist/OpenInAppCard/index.js +2 -2
  13. package/dist/ProposalCard/index.js +2 -2
  14. package/dist/RichEditor/codec.d.ts +1 -1
  15. package/dist/RichEditor/index.js +3 -3
  16. package/dist/RichEditorMarkdown/index.js +3 -3
  17. package/dist/chunk-4LG6V4XY.js +71 -0
  18. package/dist/{chunk-7CSTEH5I.js → chunk-7XGDMXC5.js} +137 -75
  19. package/dist/{chunk-2DMTW2Y3.js → chunk-DGXHQMNP.js} +1 -1
  20. package/dist/chunk-KMTOGF6T.js +597 -0
  21. package/dist/{chunk-JUZKRHQB.js → chunk-LVHAGF4R.js} +2 -2
  22. package/dist/{chunk-AH7R777J.js → chunk-OBNOJ6IM.js} +1 -1
  23. package/dist/{chunk-346EXHOR.js → chunk-PVMDBNZ5.js} +1 -1
  24. package/dist/{chunk-QNSAFNGT.js → chunk-PZPLTFWX.js} +1 -1
  25. package/dist/{chunk-GBASM5EV.js → chunk-W5JAJJZO.js} +1 -1
  26. package/dist/{chunk-6KCQXKFQ.js → chunk-WTV24BFB.js} +1 -1
  27. package/dist/generated/index.d.ts +1 -0
  28. package/dist/generated/index.js +54 -53
  29. package/dist/index.js +54 -53
  30. package/dist/styles.css +134 -0
  31. package/package.json +3 -3
  32. package/dist/chunk-KBZO4B33.js +0 -293
  33. package/dist/{chunk-7E3M2X52.js → chunk-2YAK37D6.js} +1 -1
  34. /package/dist/{chunk-MC5JMA2T.js → chunk-XB6SMI7T.js} +0 -0
package/dist/styles.css CHANGED
@@ -27520,6 +27520,140 @@ a.crewlet-icon-btn {
27520
27520
 
27521
27521
 
27522
27522
 
27523
+ /* LimitMeters-WCN2QTUU.css */
27524
+ /* A stack of limit windows: label, bar, figure and note line up across rows. */
27525
+
27526
+ .crewlet-limit-meters {
27527
+ container-type: inline-size;
27528
+ display: flex;
27529
+ flex-direction: column;
27530
+ gap: var(--spacing-1);
27531
+ /* Inline-size containment gives no intrinsic width, so a content-sized column needs a floor. */
27532
+ min-width: 12rem;
27533
+ font-size: var(--font-size-xs);
27534
+ line-height: var(--font-line-height-snug);
27535
+ }
27536
+
27537
+ .crewlet-limit-meters__grid {
27538
+ display: grid;
27539
+ grid-template-columns: minmax(0, max-content) minmax(2.5rem, 1fr) max-content max-content;
27540
+ align-items: center;
27541
+ column-gap: var(--spacing-2);
27542
+ row-gap: var(--spacing-1);
27543
+ }
27544
+
27545
+ .crewlet-limit-meters__window {
27546
+ display: contents;
27547
+ --crewlet-limit-meters-tone: var(--color-text-tertiary);
27548
+ }
27549
+
27550
+ .crewlet-limit-meters__window[data-state='near'] {
27551
+ --crewlet-limit-meters-tone: var(--color-feedback-warning);
27552
+ }
27553
+
27554
+ .crewlet-limit-meters__window[data-state='refusing'] {
27555
+ --crewlet-limit-meters-tone: var(--color-feedback-danger);
27556
+ }
27557
+
27558
+ /* Column 1 always, so a window without a note still starts its own row. */
27559
+ .crewlet-limit-meters__label {
27560
+ grid-column: 1;
27561
+ max-width: 8rem;
27562
+ overflow: hidden;
27563
+ text-overflow: ellipsis;
27564
+ white-space: nowrap;
27565
+ color: var(--color-text-secondary);
27566
+ }
27567
+
27568
+ /* The Meter's 6px track on the raised rung, with a hairline so its extent shows on any ground. */
27569
+ .crewlet-limit-meters__track {
27570
+ height: 6px;
27571
+ border-radius: var(--radius-pill);
27572
+ background: var(--color-surface-elevated);
27573
+ box-shadow: inset 0 0 0 1px var(--color-border-default);
27574
+ overflow: hidden;
27575
+ }
27576
+
27577
+ .crewlet-limit-meters__fill {
27578
+ height: 100%;
27579
+ border-radius: var(--radius-pill);
27580
+ background: var(--crewlet-limit-meters-tone);
27581
+ transition: width var(--motion-duration-slow) var(--motion-easing-emphasized);
27582
+ }
27583
+
27584
+ .crewlet-limit-meters__fill--some {
27585
+ min-width: var(--spacing-1);
27586
+ }
27587
+
27588
+ /* A state with no measured fraction: hatched across the track, so it never reads as a length. */
27589
+ .crewlet-limit-meters__fill--state {
27590
+ border-radius: 0;
27591
+ background: repeating-linear-gradient(
27592
+ -45deg,
27593
+ var(--crewlet-limit-meters-tone) 0 2px,
27594
+ transparent 2px 5px
27595
+ );
27596
+ }
27597
+
27598
+ .crewlet-limit-meters__figure {
27599
+ justify-self: end;
27600
+ white-space: nowrap;
27601
+ font-variant-numeric: tabular-nums;
27602
+ color: var(--color-text-primary);
27603
+ }
27604
+
27605
+ .crewlet-limit-meters__window[data-state='near'] .crewlet-limit-meters__figure {
27606
+ color: var(--color-feedback-warning-ink);
27607
+ }
27608
+
27609
+ .crewlet-limit-meters__window[data-state='refusing'] .crewlet-limit-meters__figure {
27610
+ color: var(--color-feedback-danger-ink);
27611
+ }
27612
+
27613
+ .crewlet-limit-meters__note {
27614
+ white-space: nowrap;
27615
+ color: var(--color-text-tertiary);
27616
+ }
27617
+
27618
+ .crewlet-limit-meters__empty,
27619
+ .crewlet-limit-meters__caption {
27620
+ color: var(--color-text-tertiary);
27621
+ }
27622
+
27623
+ .crewlet-limit-meters__caption {
27624
+ font-size: var(--font-size-2xs);
27625
+ }
27626
+
27627
+ /* Narrow: the note moves under its bar rather than squeezing the bar away. */
27628
+ @container (max-width: 16rem) {
27629
+ .crewlet-limit-meters__grid {
27630
+ grid-template-columns: minmax(0, max-content) minmax(2.5rem, 1fr) max-content;
27631
+ }
27632
+
27633
+ .crewlet-limit-meters__note {
27634
+ grid-column: 2 / -1;
27635
+ margin-block-start: calc(-1 * var(--spacing-1) + 1px);
27636
+ }
27637
+ }
27638
+
27639
+ @media (prefers-reduced-motion: reduce) {
27640
+ .crewlet-limit-meters__fill {
27641
+ transition: none;
27642
+ }
27643
+ }
27644
+
27645
+ /* Forced colours repaint every background, so the bar takes the system pair the Meter uses. */
27646
+ @media (forced-colors: active) {
27647
+ .crewlet-limit-meters__track {
27648
+ background: GrayText;
27649
+ }
27650
+
27651
+ .crewlet-limit-meters__window {
27652
+ --crewlet-limit-meters-tone: CanvasText;
27653
+ }
27654
+ }
27655
+
27656
+
27523
27657
  /* Link-7AADYG2F.css */
27524
27658
  /*
27525
27659
  * A link: a navigation, an identity or a quiet reference. The ink is the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewlethq/ui",
3
- "version": "0.155.0",
3
+ "version": "0.157.0",
4
4
  "description": "Crewlet shared React components built on @crewlethq/tokens and @crewlethq/icons.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,8 +42,8 @@
42
42
  "clean": "rm -rf dist src/generated"
43
43
  },
44
44
  "dependencies": {
45
- "@crewlethq/icons": "0.155.0",
46
- "@crewlethq/tokens": "0.155.0",
45
+ "@crewlethq/icons": "0.157.0",
46
+ "@crewlethq/tokens": "0.157.0",
47
47
  "prosemirror-commands": "1.7.2",
48
48
  "prosemirror-gapcursor": "1.4.1",
49
49
  "prosemirror-history": "1.5.1",
@@ -1,293 +0,0 @@
1
- // src/Markdown/grammar.ts
2
- var MARKDOWN_CALLOUT_TONES = ["note", "tip", "important", "warning", "caution"];
3
- var MARKDOWN_CALLOUT_NAMES = {
4
- note: "Note",
5
- tip: "Tip",
6
- important: "Important",
7
- warning: "Warning",
8
- caution: "Caution"
9
- };
10
- var SAFE_SCHEME = /^(https?:|mailto:)/i;
11
- var URL_NOISE = /[\u0000- ]/g;
12
- function safeHref(raw) {
13
- const href = raw.trim();
14
- if (href === "") return null;
15
- const clean = href.replace(URL_NOISE, "");
16
- if (clean.startsWith("#/")) return clean;
17
- if (SAFE_SCHEME.test(clean)) return clean;
18
- return null;
19
- }
20
- var HEADING = /^(#{1,6})\s+(.*)$/;
21
- var FENCE = /^(```|~~~)\s*([A-Za-z0-9_+-]*)\s*$/;
22
- var RULE = /^(?:\s*(?:-{3,}|\*{3,}|_{3,})\s*)$/;
23
- var BULLET = /^(\s*)([-*+])(?:\s+(.*))?$/;
24
- var ORDERED = /^(\s*)(\d{1,9})([.)])(?:\s+(.*))?$/;
25
- var QUOTE = /^\s{0,3}>\s?(.*)$/;
26
- var TABLE_RULE = /^\s*\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/;
27
- var CALLOUT = /^\[!(note|tip|important|warning|caution)\]\s*$/i;
28
- var TASK = /^\[([ xX])\](?:\s+(.*))?$/;
29
- function bareMarker(line) {
30
- const found = BULLET.exec(line) ?? ORDERED.exec(line);
31
- return found !== null && (found[found.length - 1] ?? "").trim() === "";
32
- }
33
- var FENCE_CLOSE = {
34
- "```": /^`{3,}[ \t]*$/,
35
- "~~~": /^~{3,}[ \t]*$/
36
- };
37
- function markdownClosesFence(line, marker) {
38
- return FENCE_CLOSE[marker].test(line);
39
- }
40
- function markdownFenceOf(line) {
41
- const m = FENCE.exec(line);
42
- return m ? { marker: m[1] ?? "```", lang: m[2] ?? "" } : null;
43
- }
44
- function markdownHeadingOf(line) {
45
- const m = HEADING.exec(line);
46
- if (!m) return null;
47
- return { level: (m[1] ?? "#").length, title: (m[2] ?? "").replace(/\s+#+\s*$/, "").trim() };
48
- }
49
- function markdownLines(source) {
50
- return (source ?? "").replace(/\r\n?/g, "\n").split("\n");
51
- }
52
- function parseMarkdown(source) {
53
- return blocksOf(markdownLines(source)).map((span) => span.block);
54
- }
55
- function parseMarkdownSpans(source) {
56
- const lines = markdownLines(source);
57
- return { lines, spans: blocksOf(lines) };
58
- }
59
- function blocksOf(lines) {
60
- const out = [];
61
- let i = 0;
62
- const paragraph = [];
63
- let paragraphStart = 0;
64
- const flush = () => {
65
- if (paragraph.length) {
66
- out.push({
67
- block: { kind: "paragraph", text: paragraph.join("\n") },
68
- start: paragraphStart,
69
- end: paragraphStart + paragraph.length
70
- });
71
- paragraph.length = 0;
72
- }
73
- };
74
- while (i < lines.length) {
75
- const line = lines[i] ?? "";
76
- const start = i;
77
- if (line.trim() === "") {
78
- flush();
79
- i++;
80
- continue;
81
- }
82
- const fence = markdownFenceOf(line);
83
- if (fence) {
84
- flush();
85
- const body = [];
86
- i++;
87
- while (i < lines.length && !markdownClosesFence(lines[i] ?? "", fence.marker)) {
88
- body.push(lines[i] ?? "");
89
- i++;
90
- }
91
- if (i >= lines.length && body.length > 0 && body[body.length - 1] === "") {
92
- body.pop();
93
- }
94
- i = Math.min(i + 1, lines.length);
95
- out.push({
96
- block: { kind: "code", lang: fence.lang, text: body.join("\n"), fence: fence.marker },
97
- start,
98
- end: i
99
- });
100
- continue;
101
- }
102
- if (RULE.test(line)) {
103
- flush();
104
- i++;
105
- out.push({ block: { kind: "rule" }, start, end: i });
106
- continue;
107
- }
108
- const heading = markdownHeadingOf(line);
109
- if (heading) {
110
- flush();
111
- i++;
112
- out.push({ block: { kind: "heading", level: heading.level, text: heading.title }, start, end: i });
113
- continue;
114
- }
115
- if (QUOTE.test(line)) {
116
- flush();
117
- const inner = [];
118
- while (i < lines.length && QUOTE.test(lines[i] ?? "")) {
119
- inner.push(QUOTE.exec(lines[i] ?? "")?.[1] ?? "");
120
- i++;
121
- }
122
- const tone = CALLOUT.exec(inner[0] ?? "");
123
- out.push({
124
- block: tone ? {
125
- kind: "callout",
126
- tone: (tone[1] ?? "note").toLowerCase(),
127
- blocks: parseMarkdown(inner.slice(1).join("\n"))
128
- } : { kind: "quote", blocks: parseMarkdown(inner.join("\n")) },
129
- start,
130
- end: i
131
- });
132
- continue;
133
- }
134
- if (line.includes("|") && TABLE_RULE.test(lines[i + 1] ?? "")) {
135
- flush();
136
- const head = splitRow(line);
137
- const align = splitRow(lines[i + 1] ?? "").map(alignOf);
138
- i += 2;
139
- const rows = [];
140
- while (i < lines.length && (lines[i] ?? "").includes("|") && (lines[i] ?? "").trim() !== "") {
141
- rows.push(splitRow(lines[i] ?? ""));
142
- i++;
143
- }
144
- out.push({ block: { kind: "table", head, align, rows }, start, end: i });
145
- continue;
146
- }
147
- if ((BULLET.test(line) || ORDERED.test(line)) && !(paragraph.length > 0 && bareMarker(line))) {
148
- flush();
149
- const [list, next] = parseList(lines, i);
150
- out.push({ block: list, start, end: next });
151
- i = next;
152
- continue;
153
- }
154
- if (paragraph.length === 0) paragraphStart = i;
155
- paragraph.push(line);
156
- i++;
157
- }
158
- flush();
159
- return out;
160
- }
161
- function alignOf(cell) {
162
- const t = cell.trim();
163
- if (t.startsWith(":") && t.endsWith(":")) return "center";
164
- if (t.endsWith(":")) return "right";
165
- return "left";
166
- }
167
- function splitRow(line) {
168
- let t = line.trim();
169
- if (t.startsWith("|")) t = t.slice(1);
170
- if (t.endsWith("|") && !t.endsWith("\\|")) t = t.slice(0, -1);
171
- const cells = [];
172
- let cell = "";
173
- for (let i = 0; i < t.length; i++) {
174
- const c = t[i];
175
- if (c === "\\" && t[i + 1] === "|") {
176
- cell += "|";
177
- i++;
178
- } else if (c === "|") {
179
- cells.push(cell.trim());
180
- cell = "";
181
- } else {
182
- cell += c;
183
- }
184
- }
185
- cells.push(cell.trim());
186
- return cells;
187
- }
188
- function parseList(lines, start) {
189
- const head = lines[start] ?? "";
190
- const firstBullet = BULLET.exec(head);
191
- const firstOrdered = ORDERED.exec(head);
192
- const baseIndent = ((firstBullet ?? firstOrdered)?.[1] ?? "").length;
193
- const ordered = firstOrdered !== null && firstBullet === null;
194
- const startNumber = ordered ? Number(firstOrdered?.[2] ?? 1) : 1;
195
- const marker = ordered ? firstOrdered?.[3] ?? "." : firstBullet?.[2] ?? "-";
196
- const items = [];
197
- let i = start;
198
- let own = [];
199
- let checked = null;
200
- let open = false;
201
- let loose = false;
202
- const close = () => {
203
- if (!open) return;
204
- items.push({ checked, blocks: parseMarkdown(own.join("\n")) });
205
- own = [];
206
- checked = null;
207
- open = false;
208
- };
209
- while (i < lines.length) {
210
- const line = lines[i] ?? "";
211
- const bullet = BULLET.exec(line);
212
- const numbered = ORDERED.exec(line);
213
- const found = bullet ?? numbered;
214
- const indent = (found?.[1] ?? "").length;
215
- if (found && indent === baseIndent) {
216
- if (ordered !== (numbered !== null && bullet === null)) break;
217
- close();
218
- open = true;
219
- const body = (bullet ? bullet[3] : numbered?.[4]) ?? "";
220
- const task = TASK.exec(body);
221
- if (task) {
222
- checked = (task[1] ?? " ").toLowerCase() === "x";
223
- own.push(task[2] ?? "");
224
- } else {
225
- own.push(body);
226
- }
227
- i++;
228
- continue;
229
- }
230
- if (found && indent > baseIndent) {
231
- own.push(line.slice(baseIndent));
232
- i++;
233
- continue;
234
- }
235
- if (line.trim() === "") {
236
- const following = lines[i + 1] ?? "";
237
- const continues = BULLET.test(following) || ORDERED.test(following) || /^\s{2,}\S/.test(following);
238
- if (!continues) break;
239
- const sibling = BULLET.exec(following) ?? ORDERED.exec(following);
240
- if (sibling && (sibling[1] ?? "").length === baseIndent) loose = true;
241
- own.push("");
242
- i++;
243
- continue;
244
- }
245
- if (found === null && /^\s{2,}\S/.test(line) && open) {
246
- own.push(line.slice(baseIndent));
247
- i++;
248
- continue;
249
- }
250
- break;
251
- }
252
- close();
253
- return [{ kind: "list", ordered, start: startNumber, marker, loose, items }, i];
254
- }
255
- var NOT_WP = String.raw`[^\s\p{P}\p{S}]`;
256
- var WP = String.raw`[\s\p{P}\p{S}]`;
257
- var PUNCT = String.raw`[\p{P}\p{S}]`;
258
- var leftFlanking = (d) => String.raw`(?:(?<!${NOT_WP})${d}(?!\s|$)|(?<=${NOT_WP})${d}(?!${WP}|$))`;
259
- var rightFlanking = (d) => String.raw`(?:(?<=${NOT_WP})${d}|(?<=${PUNCT})${d}(?!${NOT_WP}))`;
260
- var underOpens = (d) => String.raw`(?<!${NOT_WP})${d}(?!\s|$)`;
261
- var underCloses = (d) => String.raw`(?<!\s)${d}(?!${NOT_WP})`;
262
- var label = (name) => String.raw`(?<${name}>(?:\\[\s\S]|[^\]\\])*)`;
263
- var destination = (name, title) => String.raw`(?<${name}>(?:[^()\s]|\([^()\s]*\))*)(?:\s+"(?<${title}>[^"]*)")?\)`;
264
- var linkLabel = (name) => String.raw`(?<${name}>(?:\\[\s\S]|!\[(?:\\[\s\S]|[^\]\\])*\]\((?:[^()\s]|\([^()\s]*\))*(?:\s+"[^"]*")?\)|[^\]\\])*)`;
265
- var ASCII_PUNCTUATION = String.raw`[!-\/:-@\[-\x60{-~]`;
266
- var INLINE_SOURCE = [
267
- String.raw`\\(?<esc>${ASCII_PUNCTUATION})`,
268
- String.raw`(?<tick>\x60+)(?<code>[\s\S]*?)\k<tick>`,
269
- String.raw`!\[` + label("alt") + String.raw`\]\(` + destination("src", "srcTitle"),
270
- String.raw`\[` + linkLabel("label") + String.raw`\]\(` + destination("href", "hrefTitle"),
271
- String.raw`<(?<auto>(?:https?:|mailto:)[^>\s]+)>`,
272
- // A strong run closes on a `**` no third asterisk follows, so `***both***`
273
- // is strong around emphasis rather than strong around `*both` and a stray.
274
- leftFlanking(String.raw`\*\*`) + String.raw`(?<strong>[\s\S]+?)` + rightFlanking(String.raw`\*\*(?!\*)`),
275
- underOpens("__") + String.raw`(?<strongUnder>[\s\S]+?)` + underCloses("__"),
276
- leftFlanking(String.raw`\*`) + String.raw`(?<em>[\s\S]+?)` + rightFlanking(String.raw`\*`),
277
- underOpens("_") + String.raw`(?<emUnder>[\s\S]+?)` + underCloses("_"),
278
- String.raw`~~(?<del>[\s\S]+?)~~`
279
- ].join("|");
280
- function* markdownInline(text) {
281
- const pattern = new RegExp(INLINE_SOURCE, "gu");
282
- for (let m = pattern.exec(text); m !== null; m = pattern.exec(text)) {
283
- yield { index: m.index, end: m.index + m[0].length, groups: m.groups ?? {} };
284
- }
285
- }
286
- function markdownCodeText(code) {
287
- return code.replace(/^ | $/g, "");
288
- }
289
- function markdownBreaks(text, hard = false) {
290
- return text.split(hard ? /(?: +|\\)?\n/ : /(?: +|\\)\n/);
291
- }
292
-
293
- export { MARKDOWN_CALLOUT_NAMES, MARKDOWN_CALLOUT_TONES, markdownBreaks, markdownClosesFence, markdownCodeText, markdownFenceOf, markdownHeadingOf, markdownInline, markdownLines, parseMarkdown, parseMarkdownSpans, safeHref };
@@ -1,6 +1,6 @@
1
1
  import { RefusalStrip, ReceiptStrip } from './chunk-OAD4AXYJ.js';
2
- import { StatusCard } from './chunk-NWKH5FF7.js';
3
2
  import { ChangeList } from './chunk-NOZD547E.js';
3
+ import { StatusCard } from './chunk-NWKH5FF7.js';
4
4
  import { Callout } from './chunk-CWACQEPP.js';
5
5
  import { toInstant, formatUntil, useNow, formatExact, toISO } from './chunk-GBKBME7Q.js';
6
6
  import { Checkbox } from './chunk-BRMJPZC4.js';
File without changes