@keystone-sites/marketing-design-system 1.0.26 → 1.0.27

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/AGENTS.md CHANGED
@@ -172,6 +172,30 @@ before you build: `primitives/`, `sections/`, `icons.tsx`, `media.ts`,
172
172
  consumer-local override; then the consumer reinstalls
173
173
  (`npm install` copies the `file:` link; pnpm likewise).
174
174
 
175
+ ## Where the line is
176
+
177
+ This is a shared library. It ships components with their default behaviour
178
+ and the surface to vary them: props, slots, children, and the custom
179
+ properties it documents as hooks (`--knav-mark-ink`, `--btn-size`,
180
+ `--grader-size`, `--plan-size`, `--pcard-size`, the `--z-*` scale). It is
181
+ not any one consumer's stylesheet.
182
+
183
+ - The package knows no consumer. No rule here selects a consumer's class,
184
+ names a consumer's page or product, or exists for one app's layout. The
185
+ catalog is the only page it draws.
186
+ - A consumer reaches a package part through its props and documented hooks,
187
+ never through its CSS: it does not select a package class
188
+ (`.btn-fill`, `.chat-scroll`, `.prompt-file`) in its own stylesheet, and
189
+ does not set a package file's designed constant or a `--_*` private
190
+ property. A reset, a wrapper, a seat, or a width a consumer needs around
191
+ a kit part is a missing prop or slot, and lands here.
192
+ - Anything that stands over the page (fixed, sticky, a portal) takes one
193
+ name from the `--z-*` scale in `tokens/semantic.css`, the one place the
194
+ stacking order is read whole; a consumer names its own layers in its own
195
+ stylesheet in terms of that scale. A small integer orders only siblings
196
+ inside one component (a card's badge over its picture, the nav's
197
+ slots), and a run of them stays local under `isolation: isolate`.
198
+
175
199
  Bands rm · rs · rt · rd1 · rd2 sit at 384 · 576 · 768 · 960 · 1344; a gate opens the next band.
176
200
 
177
201
  ## Verify before you say done
package/grid/engine.css CHANGED
@@ -6,9 +6,10 @@
6
6
  rd1 960 · rd2 1344 (tick 32 · 48 · 64 · 80 · 112). Gates open at the
7
7
  midpoints and are written by band name: `@container (--rs)`, `(--rt)`,
8
8
  `(--rd1)`, `(--rd2)` (widths live once in grid/gates.cjs), always on
9
- `.site-root`, never `@media`. Base CSS is the 384 design; each gate
10
- overrides upward. Above 1344 the tick
11
- caps and the 1344 design renders exact; gutters paint the side fields.
9
+ `.site-root` — or on a `.page-col` that is a container, below — never
10
+ `@media`. Base CSS is the 384 design; each gate overrides upward. Above
11
+ 1344 the tick caps and the 1344 design renders exact; gutters paint the
12
+ side fields.
12
13
  JS that needs the band measures the container, never `matchMedia`.
13
14
  Light mode only.
14
15
 
@@ -65,62 +66,82 @@
65
66
  --page-x: max(0px, round(down, calc((100cqw - 1344px) / 2), 1px));
66
67
  width: calc(12 * var(--t));
67
68
  margin-left: var(--page-x);
68
-
69
- /* The base band interpolates 384→576 and extrapolates below 384. */
69
+ }
70
+ /* The band weights. Type multiplies these px weights by its unitless
71
+ design sizes directly (primitives/text.css); no unit-stripping trig,
72
+ which iOS Safari has resolved wrongly. The base band interpolates
73
+ 384→576 and extrapolates below 384. */
74
+ .page,
75
+ .page-col > * {
70
76
  --wA: calc((48px - var(--t)) / 16);
71
77
  --wB: calc((var(--t) - 32px) / 16);
72
- /* Type multiplies these px weights by its unitless design sizes
73
- directly (primitives/text.css); no unit-stripping trig, which iOS
74
- Safari has resolved wrongly. */
75
78
  }
76
79
 
80
+ /* ---- a column that is a page of its own ----
81
+ A consumer standing two columns side by side (a report beside a chat)
82
+ may make the one carrying the page's content a query container
83
+ (`container-type: inline-size`, set at the gate where the columns
84
+ part). From there its descendants' gates and `--t` (100cqw of it) read
85
+ its width, and it lays out as the band its width is. `.page-col` gives
86
+ its children the weights of that band to match — on the children,
87
+ since a container's own queries read its ancestor. Where the column is
88
+ not a container, the children read the page's band and nothing
89
+ changes. */
90
+
77
91
  /* Midpoint gates select the nearest anchor. Compressed slices zoom type
78
92
  and containers together so wraps and clearances remain stable. */
79
93
 
80
94
  @container (--rs) {
81
- .page {
95
+ .page,
96
+ .page-col > * {
82
97
  /* compressed rs: the 576 design zooming down */
83
98
  --wA: calc(var(--t) / 48);
84
99
  --wB: 0px;
85
100
  }
86
101
  }
87
102
  @container (min-width: 576px) {
88
- .page {
103
+ .page,
104
+ .page-col > * {
89
105
  --wA: calc((64px - var(--t)) / 16);
90
106
  --wB: calc((var(--t) - 48px) / 16);
91
107
  }
92
108
  }
93
109
 
94
110
  @container (--rt) {
95
- .page {
111
+ .page,
112
+ .page-col > * {
96
113
  /* compressed rt: the 768 design zooming down */
97
114
  --wA: calc(var(--t) / 64);
98
115
  --wB: 0px;
99
116
  }
100
117
  }
101
118
  @container (min-width: 768px) {
102
- .page {
119
+ .page,
120
+ .page-col > * {
103
121
  --wA: calc((80px - var(--t)) / 16);
104
122
  --wB: calc((var(--t) - 64px) / 16);
105
123
  }
106
124
  }
107
125
 
108
126
  @container (--rd1) {
109
- .page {
127
+ .page,
128
+ .page-col > * {
110
129
  /* compressed rd1: the 960 design zooming down */
111
130
  --wA: calc(var(--t) / 80);
112
131
  --wB: 0px;
113
132
  }
114
133
  }
115
134
  @container (min-width: 960px) {
116
- .page {
135
+ .page,
136
+ .page-col > * {
117
137
  --wA: calc((112px - var(--t)) / 32);
118
138
  --wB: calc((var(--t) - 80px) / 32);
119
139
  }
120
140
  }
121
141
 
122
142
  @container (--rd2) {
123
- .page {
143
+ .page,
144
+ .page-col > * {
124
145
  /* One rule covers the compressed slice, anchor, and capped wide range. */
125
146
  --wA: 0px;
126
147
  --wB: calc(var(--t) / 112);
package/icons.tsx CHANGED
@@ -1280,3 +1280,229 @@ export function IconStop(props: Props) {
1280
1280
  </LineGlyph>
1281
1281
  );
1282
1282
  }
1283
+
1284
+ /* ---- ks-Chat glyphs (Ncps6KkDBLBm5og7akBkTr): 16-box fills exported
1285
+ verbatim, paint normalized to currentColor. The chat's controls, the
1286
+ composer's, and the status marks of the chat kit. ---- */
1287
+
1288
+ function ChatGlyph({
1289
+ size = 16,
1290
+ className,
1291
+ box = 16,
1292
+ children,
1293
+ }: Props & { box?: 16 | 20; children: ReactNode }) {
1294
+ return (
1295
+ <svg
1296
+ width={size}
1297
+ height={size}
1298
+ viewBox={`0 0 ${box} ${box}`}
1299
+ fill="currentColor"
1300
+ aria-hidden="true"
1301
+ className={className}
1302
+ xmlns="http://www.w3.org/2000/svg"
1303
+ >
1304
+ {children}
1305
+ </svg>
1306
+ );
1307
+ }
1308
+
1309
+ /** message-action-button copy (87:6977). */
1310
+ export function IconCopy(props: Props) {
1311
+ return (
1312
+ <ChatGlyph {...props}>
1313
+ <path d="M11.458 4.54199V14.125H1.875V4.54199H11.458ZM3.125 12.875H10.208V5.79199H3.125V12.875ZM14.125 1.875V10.8398H12.875V3.125H5.16699V1.875H14.125Z" />
1314
+ </ChatGlyph>
1315
+ );
1316
+ }
1317
+
1318
+ /** thumbs-up (135:10676). */
1319
+ export function IconThumbsUp(props: Props) {
1320
+ return (
1321
+ <ChatGlyph {...props}>
1322
+ <path d="M7.74341 1.20833C8.94513 1.20833 9.86391 2.28073 9.67896 3.4681L9.40747 5.20833H12.1721C13.7791 5.20833 15.0093 6.63926 14.7678 8.22786L14.2092 11.8949C14.0141 13.1773 12.9118 14.1253 11.6145 14.1253H1.20825V6.54134H4.20532L6.95239 1.20833H7.74341ZM5.12524 7.4847V12.8753H11.6145C12.294 12.8753 12.8717 12.3782 12.9739 11.7064L13.5315 8.04036C13.6581 7.20819 13.0139 6.45833 12.1721 6.45833H7.94751L8.4436 3.27571C8.51053 2.84623 8.17809 2.45833 7.74341 2.45833H7.71411L5.12524 7.4847ZM2.45825 12.8753H3.87524V7.79134H2.45825V12.8753Z" />
1323
+ </ChatGlyph>
1324
+ );
1325
+ }
1326
+
1327
+ /** thumbs-down (135:10673). */
1328
+ export function IconThumbsDown(props: Props) {
1329
+ return (
1330
+ <ChatGlyph {...props}>
1331
+ <path d="M14.7913 1.875V9.45801H11.7971L9.22485 14.4531L9.05103 14.792H8.25903C7.05735 14.7919 6.14045 13.7182 6.32544 12.5312L6.59595 10.792H3.83228C2.22563 10.7918 0.996951 9.35973 1.23853 7.77148L1.79614 4.10547C1.99115 2.82335 3.09308 1.87521 4.38989 1.875H14.7913ZM4.38989 3.125C3.7114 3.12521 3.13474 3.62122 3.03247 4.29297L2.47388 7.95996C2.34742 8.79231 2.99171 9.54178 3.83228 9.54199H8.05591L7.55981 12.7246C7.49314 13.1542 7.82535 13.5419 8.25903 13.542H8.28833L10.8762 8.51465V3.125H4.38989ZM12.1262 8.20801H13.5413V3.125H12.1262V8.20801Z" />
1332
+ </ChatGlyph>
1333
+ );
1334
+ }
1335
+
1336
+ /** prompt-icon-button paperclip (87:2883). */
1337
+ export function IconPaperclip(props: Props) {
1338
+ return (
1339
+ <ChatGlyph {...props}>
1340
+ <path d="M12.7076 3.99946C12.7076 3.52575 12.5433 3.06879 12.2457 2.70552L12.11 2.55611C11.7271 2.17342 11.2079 1.95845 10.6666 1.95845C10.1253 1.95845 9.60612 2.17342 9.22327 2.55611L3.6178 8.27486L3.61292 8.27974C2.9801 8.91271 2.62463 9.7714 2.62463 10.6665C2.6247 11.5615 2.98 12.4202 3.61292 13.0532C4.24583 13.6861 5.10456 14.0414 5.99963 14.0415C6.89469 14.0415 7.75338 13.686 8.38635 13.0532L13.5524 7.76314L14.4469 8.63618L9.27014 13.937L9.10413 14.0952C8.25568 14.8633 7.14957 15.2915 5.99963 15.2915C4.77304 15.2914 3.59647 14.8043 2.72913 13.937C1.86179 13.0696 1.3747 11.8931 1.37463 10.6665C1.37463 9.43988 1.86189 8.26334 2.72913 7.39595L8.33459 1.6772L8.33948 1.67232C8.95675 1.05523 9.7938 0.708453 10.6666 0.708449C11.5395 0.708449 12.3765 1.05522 12.9938 1.67232L13.1061 1.79048C13.6528 2.39428 13.9576 3.18109 13.9576 3.99946C13.9576 4.87024 13.612 5.70487 12.9977 6.32173L7.38928 12.0463L7.3844 12.0512C7.01718 12.4182 6.51881 12.6245 5.99963 12.6245C5.48065 12.6244 4.98297 12.418 4.61584 12.0512H4.61487C4.2478 11.684 4.04169 11.1856 4.04163 10.6665C4.04163 10.2121 4.19961 9.77368 4.48499 9.42525L4.61487 9.28169L10.2203 3.56196L11.1129 4.43696L5.50354 10.1606L5.49963 10.1655C5.36684 10.2983 5.29163 10.4786 5.29163 10.6665C5.29169 10.8539 5.3663 11.0337 5.49866 11.1665H5.49963C5.63238 11.2992 5.81194 11.3744 5.99963 11.3745C6.18746 11.3745 6.36778 11.2992 6.50061 11.1665L12.1051 5.44771L12.11 5.44282C12.4927 5.05997 12.7076 4.54079 12.7076 3.99946Z" />
1341
+ </ChatGlyph>
1342
+ );
1343
+ }
1344
+
1345
+ /** chat-ellipsis-menu (132:10227). */
1346
+ export function IconEllipsis(props: Props) {
1347
+ return (
1348
+ <ChatGlyph {...props}>
1349
+ <path d="M6.66634 8.00033C6.66634 7.26395 7.26395 6.66634 8.00033 6.66634C8.73656 6.66652 9.33333 7.26405 9.33333 8.00033C9.33316 8.73645 8.73645 9.33316 8.00033 9.33333C7.26405 9.33333 6.66652 8.73656 6.66634 8.00033Z" />
1350
+ <path d="M11.333 8.00033C11.333 7.26395 11.9306 6.66634 12.667 6.66634C13.4032 6.66652 14 7.26405 14 8.00033C13.9998 8.73645 13.4031 9.33316 12.667 9.33333C11.9307 9.33333 11.3332 8.73656 11.333 8.00033Z" />
1351
+ <path d="M1.99967 8.00033C1.99967 7.26395 2.59728 6.66634 3.33366 6.66634C4.06989 6.66652 4.66667 7.26405 4.66667 8.00033C4.66649 8.73645 4.06978 9.33316 3.33366 9.33333C2.59739 9.33333 1.99985 8.73656 1.99967 8.00033Z" />
1352
+ </ChatGlyph>
1353
+ );
1354
+ }
1355
+
1356
+ /** prompt-search-pill globe (87:2904). */
1357
+ export function IconGlobe(props: Props) {
1358
+ return (
1359
+ <ChatGlyph {...props}>
1360
+ <path d="M13.5413 8.00032C13.5413 6.69464 13.0899 5.49547 12.3343 4.54817L10.3235 6.55891C11.3508 7.65521 12.1608 8.7803 12.6546 9.7679C12.7732 10.0052 12.8751 10.2413 12.9593 10.471C13.3308 9.72694 13.5413 8.88849 13.5413 8.00032ZM4.54816 12.3343C5.49546 13.0899 6.69463 13.5413 8.00031 13.5413C8.88848 13.5413 9.72692 13.3308 10.471 12.9593C10.2413 12.8751 10.0051 12.7732 9.76788 12.6546C8.78028 12.1608 7.65519 11.3508 6.5589 10.3236L4.54816 12.3343ZM7.44366 9.4388C8.4626 10.3892 9.47882 11.1121 10.3275 11.5365C10.8172 11.7813 11.2189 11.9108 11.513 11.9456C11.8151 11.9814 11.895 11.9084 11.9017 11.9017C11.9081 11.8952 11.9814 11.8157 11.9456 11.513C11.9108 11.219 11.7813 10.8172 11.5364 10.3275C11.1121 9.47884 10.3892 8.46263 9.43878 7.44368L7.44366 9.4388ZM4.48761 4.05403C4.18462 4.01812 4.10444 4.0915 4.09796 4.09798C4.0914 4.10455 4.01813 4.18484 4.05402 4.48763C4.08889 4.7816 4.21852 5.18275 4.4632 5.6722C4.88732 6.52045 5.61011 7.53651 6.55988 8.55501L8.55499 6.55989C7.53662 5.61024 6.52135 4.88736 5.67316 4.46321C5.18348 4.21837 4.78168 4.08891 4.48761 4.05403ZM8.00031 2.45833C7.11211 2.45833 6.27273 2.66795 5.52863 3.03938C5.75858 3.12359 5.99427 3.22631 6.23175 3.34505C7.21902 3.83868 8.34378 4.64838 9.43976 5.67513L11.4505 3.66438C10.5035 2.90954 9.3052 2.4584 8.00031 2.45833ZM2.45831 8.00032C2.45839 9.30521 2.90953 10.5035 3.66437 11.4505L5.67511 9.43977C4.64836 8.34379 3.83867 7.21904 3.34503 6.23177C3.2263 5.99429 3.12357 5.7586 3.03937 5.52864C2.66794 6.27275 2.45831 7.11213 2.45831 8.00032ZM14.7913 8.00032C14.7911 11.751 11.751 14.7912 8.00031 14.7913C6.3498 14.7913 4.83615 14.2017 3.65948 13.223L2.81476 14.0697L1.93097 13.1859L2.7757 12.3392C1.79769 11.1628 1.20839 9.65003 1.20831 8.00032C1.20831 4.24939 4.24937 1.20833 8.00031 1.20833C9.65002 1.20841 11.1628 1.79771 12.3392 2.77571L13.1859 1.93098L14.0696 2.81477L13.223 3.6595C14.2017 4.83616 14.7913 6.34982 14.7913 8.00032Z" />
1361
+ </ChatGlyph>
1362
+ );
1363
+ }
1364
+
1365
+ /** system-message info (111:3458). */
1366
+ export function IconInfo(props: Props) {
1367
+ return (
1368
+ <ChatGlyph {...props}>
1369
+ <path d="M13.5414 8.00032C13.5414 4.93986 11.0608 2.45851 8.00037 2.45833C4.93979 2.45833 2.45837 4.93975 2.45837 8.00032C2.45855 11.0607 4.9399 13.5413 8.00037 13.5413C11.0607 13.5412 13.5412 11.0606 13.5414 8.00032ZM7.37537 7.95833H6.54138V6.70833H8.62537V11.4583H7.37537V7.95833ZM14.7914 8.00032C14.7912 11.751 11.751 14.7912 8.00037 14.7913C4.24954 14.7913 1.20855 11.7511 1.20837 8.00032C1.20837 4.24939 4.24944 1.20833 8.00037 1.20833C11.7511 1.20851 14.7914 4.2495 14.7914 8.00032Z" />
1370
+ <path d="M7.37504 4.68229V5.93229H8.62504V4.68229H7.37504Z" />
1371
+ </ChatGlyph>
1372
+ );
1373
+ }
1374
+
1375
+ /** system-message warning triangle (111:3482). */
1376
+ export function IconWarning(props: Props) {
1377
+ return (
1378
+ <ChatGlyph {...props}>
1379
+ <path d="M7.56699 3.1875C7.75944 2.85417 8.24056 2.85417 8.43301 3.1875L13.6652 12.25C13.8577 12.5833 13.6171 13 13.2322 13H2.76776C2.38286 13 2.1423 12.5833 2.33475 12.25L7.56699 3.1875Z" />
1380
+ </ChatGlyph>
1381
+ );
1382
+ }
1383
+
1384
+ /** system-message danger octagon (121:3973). */
1385
+ export function IconDanger(props: Props) {
1386
+ return (
1387
+ <ChatGlyph {...props}>
1388
+ <path d="M10.0711 3L12.9999 5.92896L13 10.0711L10.071 12.9999L5.92893 13L3.00007 10.071L3 5.92893L5.92896 3.00007L10.0711 3Z" />
1389
+ </ChatGlyph>
1390
+ );
1391
+ }
1392
+
1393
+ /** chat-nav history (222:14686) — a 20-box. */
1394
+ export function IconHistory({ size = 20, ...rest }: Props) {
1395
+ return (
1396
+ <ChatGlyph {...rest} size={size} box={20}>
1397
+ <path d="M9.375 5.83333H10.625V9.74055L13.3584 12.4749L13.8008 12.9163L12.917 13.8001L12.4746 13.3587L9.375 10.2591V5.83333Z" />
1398
+ <path d="M1.66669 3.33333H2.91669V6.66634H6.24969V7.91634H1.66669V3.33333Z" />
1399
+ <path d="M17.0833 9.99968C17.0831 6.08868 13.9077 2.91667 9.98859 2.91667C7.04951 2.9167 4.52726 4.70123 3.4505 7.24577L3.20636 7.82195L2.05499 7.33464L2.29913 6.75847C3.56499 3.76713 6.53072 1.6667 9.98859 1.66667C14.5963 1.66667 18.3331 5.3966 18.3333 9.99968C18.3333 14.6029 14.5964 18.3337 9.98859 18.3337C6.35498 18.3336 3.26495 16.0141 2.11945 12.778L1.91046 12.1891L3.08917 11.7721L3.29718 12.361C4.27119 15.1127 6.90001 17.0836 9.98859 17.0837C13.9078 17.0837 17.0833 13.9108 17.0833 9.99968Z" />
1400
+ </ChatGlyph>
1401
+ );
1402
+ }
1403
+
1404
+ /** The add (+) the prompt-icon-button's icon property names (87:2825),
1405
+ * as the chat-nav's new chat: the kit's Lucide plus flattened at its
1406
+ * 16-box and 1.25 stroke, two bars crossing at the centre. */
1407
+ export function IconPlus(props: Props) {
1408
+ return (
1409
+ <ChatGlyph {...props}>
1410
+ <path d="M3.33333 7.375H12.6667V8.625H3.33333V7.375Z" />
1411
+ <path d="M7.375 3.33333H8.625V12.6667H7.375V3.33333Z" />
1412
+ </ChatGlyph>
1413
+ );
1414
+ }
1415
+
1416
+ /** prompt-file-chip remove (87:2969); the chat-nav close is the same
1417
+ * cross on a 20-box (222:15089). */
1418
+ export function IconCross(props: Props) {
1419
+ return (
1420
+ <ChatGlyph {...props}>
1421
+ <path d="M13.7174 3.16667L8.88346 7.99968L13.7174 12.8337L12.8337 13.7175L7.99967 8.88347L3.16666 13.7175L2.28288 12.8337L2.72428 12.3913L7.11588 7.99968L2.72428 3.60905L2.28288 3.16667L3.16666 2.28288L3.60905 2.72429L7.99967 7.11589L12.3913 2.72429L12.8337 2.28288L13.7174 3.16667Z" />
1422
+ </ChatGlyph>
1423
+ );
1424
+ }
1425
+
1426
+ /** prompt-send-button arrow (87:2930). */
1427
+ export function IconSendArrow(props: Props) {
1428
+ return (
1429
+ <ChatGlyph {...props}>
1430
+ <path d="M7.37537 4.00879L3.83337 7.55078L2.94958 6.66699L3.39099 6.22461L7.55798 2.05762L8.00037 1.61621L12.6088 6.22461L13.0502 6.66699L12.1664 7.55078L11.725 7.1084L8.62537 4.00879L8.62537 14.125L7.37537 14.125L7.37537 4.00879Z" />
1431
+ </ChatGlyph>
1432
+ );
1433
+ }
1434
+
1435
+ /** prompt-file-chip image (the console's actions/image): a picture
1436
+ * attached, where a paperclip says a document. */
1437
+ export function IconImage(props: Props) {
1438
+ return (
1439
+ <ChatGlyph {...props}>
1440
+ <path d="M13 2H3C2.73478 2 2.48043 2.10536 2.29289 2.29289C2.10536 2.48043 2 2.73478 2 3V13C2 13.2652 2.10536 13.5196 2.29289 13.7071C2.48043 13.8946 2.73478 14 3 14H13C13.2652 14 13.5196 13.8946 13.7071 13.7071C13.8946 13.5196 14 13.2652 14 13V3C14 2.73478 13.8946 2.48043 13.7071 2.29289C13.5196 2.10536 13.2652 2 13 2ZM3 3H13V7.83625L11.4569 6.2925C11.2694 6.10511 11.0151 5.99984 10.75 5.99984C10.4849 5.99984 10.2306 6.10511 10.0431 6.2925L3.33562 13H3V3ZM13 13H4.75L10.75 7L13 9.25V13ZM6 7.5C6.29667 7.5 6.58668 7.41203 6.83336 7.2472C7.08003 7.08238 7.27229 6.84811 7.38582 6.57403C7.49935 6.29994 7.52906 5.99834 7.47118 5.70736C7.4133 5.41639 7.27044 5.14912 7.06066 4.93934C6.85088 4.72956 6.58361 4.5867 6.29264 4.52882C6.00166 4.47094 5.70006 4.50065 5.42597 4.61418C5.15189 4.72771 4.91762 4.91997 4.7528 5.16664C4.58797 5.41332 4.5 5.70333 4.5 6C4.5 6.39782 4.65804 6.77936 4.93934 7.06066C5.22064 7.34196 5.60218 7.5 6 7.5ZM6 5.5C6.09889 5.5 6.19556 5.52932 6.27779 5.58427C6.36001 5.63921 6.4241 5.7173 6.46194 5.80866C6.49978 5.90002 6.50969 6.00055 6.49039 6.09755C6.4711 6.19454 6.42348 6.28363 6.35355 6.35355C6.28363 6.42348 6.19454 6.4711 6.09755 6.49039C6.00055 6.50969 5.90002 6.49978 5.80866 6.46194C5.7173 6.4241 5.63921 6.36001 5.58427 6.27779C5.52932 6.19556 5.5 6.09889 5.5 6C5.5 5.86739 5.55268 5.74021 5.64645 5.64645C5.74021 5.55268 5.86739 5.5 6 5.5Z" />
1441
+ </ChatGlyph>
1442
+ );
1443
+ }
1444
+
1445
+ /* ---- The console's tool glyphs: the nav rail's 20-box fills, as the
1446
+ prompt-category pill shows them on the tool's tile (160:4549 names
1447
+ them as its icon swap). One colour, the tile's ink. ---- */
1448
+
1449
+ /** The console's Website tool. */
1450
+ export function IconToolWebsite(props: Props) {
1451
+ return (
1452
+ <ChatGlyph {...props} box={20}>
1453
+ <path d="M2.9248 16.042H17.0752V9.16699H18.3252V17.292H1.6748V9.16699H2.9248V16.042Z" />
1454
+ <path
1455
+ fillRule="evenodd"
1456
+ clipRule="evenodd"
1457
+ d="M17.333 3.33301C17.8852 3.33301 18.3328 3.78088 18.333 4.33301V7.91699H1.66699V4.33301C1.66717 3.78088 2.11482 3.33301 2.66699 3.33301H17.333ZM3.95801 5C3.61299 5.00018 3.33301 5.27994 3.33301 5.625C3.33301 5.97006 3.61298 6.24982 3.95801 6.25C4.30318 6.25 4.58301 5.97017 4.58301 5.625C4.583 5.27983 4.30318 5 3.95801 5ZM6.04199 5C5.69682 5 5.417 5.27983 5.41699 5.625C5.41699 5.97017 5.69682 6.25 6.04199 6.25C6.38702 6.24983 6.66699 5.97007 6.66699 5.625C6.66699 5.27994 6.38702 5.00017 6.04199 5ZM8.125 5C7.77983 5 7.50001 5.27983 7.5 5.625C7.5 5.97017 7.77983 6.25 8.125 6.25C8.47017 6.25 8.75 5.97017 8.75 5.625C8.74999 5.27983 8.47016 5 8.125 5Z"
1458
+ />
1459
+ </ChatGlyph>
1460
+ );
1461
+ }
1462
+
1463
+ /** The console's Reviews & Listings tool: the Google Business Profile. */
1464
+ export function IconToolListings(props: Props) {
1465
+ return (
1466
+ <ChatGlyph {...props} box={20}>
1467
+ <path d="M10.4775 5.83301C10.4775 6.93215 10.721 7.61534 11.1367 8.03125C11.5526 8.44715 12.2357 8.69042 13.335 8.69043V9.64258C12.2357 9.64259 11.5526 9.88586 11.1367 10.3018C10.7209 10.7177 10.4775 11.4008 10.4775 12.5H9.52539C9.52539 11.4008 9.28204 10.7177 8.86621 10.3018C8.45028 9.88596 7.76708 9.64258 6.66797 9.64258V8.69043C7.76724 8.69043 8.45029 8.44715 8.86621 8.03125C9.28204 7.61535 9.52539 6.93228 9.52539 5.83301H10.4775Z" />
1468
+ <path
1469
+ fillRule="evenodd"
1470
+ clipRule="evenodd"
1471
+ d="M17.5 15.833H12.7393L9.99609 18.1055L7.28516 15.833H2.5V2.5H17.5V15.833ZM3.75 14.583H7.74023L7.91406 14.7295L10 16.4775L12.1143 14.7266L12.2881 14.583H16.25V3.75H3.75V14.583Z"
1472
+ />
1473
+ </ChatGlyph>
1474
+ );
1475
+ }
1476
+
1477
+ /** The console's Social tool. */
1478
+ export function IconToolSocial(props: Props) {
1479
+ return (
1480
+ <ChatGlyph {...props} box={20}>
1481
+ <path
1482
+ fillRule="evenodd"
1483
+ clipRule="evenodd"
1484
+ d="M14.8521 1.625C16.7673 1.625 18.3198 3.17755 18.3199 5.09277C18.3199 6.79466 17.094 8.20864 15.4771 8.50293V15.3271H8.65292C8.35865 16.9441 6.94467 18.1699 5.24277 18.1699C3.32755 18.1698 1.77499 16.6174 1.77499 14.7021C1.77521 12.7871 3.32768 11.2345 5.24277 11.2344C6.94445 11.2344 8.3584 12.4605 8.65292 14.0771H14.2271V8.50293C12.6105 8.20841 11.3844 6.79447 11.3844 5.09277C11.3845 3.17768 12.9371 1.6252 14.8521 1.625ZM5.24277 12.4844C4.01804 12.4845 3.02521 13.4775 3.02499 14.7021C3.02499 15.927 4.01791 16.9198 5.24277 16.9199C6.4677 16.9199 7.46054 15.9271 7.46054 14.7021C7.46032 13.4774 6.46756 12.4844 5.24277 12.4844ZM14.8521 2.875C13.6275 2.8752 12.6345 3.86804 12.6344 5.09277C12.6344 6.31758 13.6274 7.31034 14.8521 7.31055C16.0771 7.31055 17.0699 6.3177 17.0699 5.09277C17.0698 3.86792 16.077 2.875 14.8521 2.875Z"
1485
+ />
1486
+ <path d="M5.24277 1.625C7.158 1.625 8.71045 3.17756 8.71054 5.09277C8.71054 7.00806 7.15806 8.56055 5.24277 8.56055C3.32755 8.56046 1.77499 7.00801 1.77499 5.09277C1.77508 3.17761 3.3276 1.62509 5.24277 1.625Z" />
1487
+ </ChatGlyph>
1488
+ );
1489
+ }
1490
+
1491
+ /** The console's review star (tools/review-star): reviews on their
1492
+ * own, apart from the listing. An 11-box the star fills; a margin
1493
+ * around it gives it the nav glyphs' weight at the same size. */
1494
+ export function IconToolReviews({ size = 16, className }: Props) {
1495
+ return (
1496
+ <svg
1497
+ width={size}
1498
+ height={size}
1499
+ viewBox="-1 -1 13 13"
1500
+ fill="currentColor"
1501
+ aria-hidden="true"
1502
+ className={className}
1503
+ xmlns="http://www.w3.org/2000/svg"
1504
+ >
1505
+ <path d="M10.2294 4.63306L8.12001 6.45322L8.76267 9.17525C8.79812 9.32301 8.78899 9.47797 8.73643 9.62055C8.68386 9.76313 8.59022 9.88693 8.46732 9.97632C8.34443 10.0657 8.19781 10.1167 8.04597 10.1228C7.89413 10.1289 7.74389 10.0898 7.61423 10.0106L5.24704 8.55368L2.87845 10.0106C2.7488 10.0894 2.59875 10.128 2.44717 10.1217C2.29559 10.1154 2.14927 10.0644 2.02664 9.97505C1.904 9.88574 1.81053 9.76215 1.758 9.61982C1.70546 9.4775 1.69621 9.32282 1.73142 9.17525L2.37642 6.45322L0.267041 4.63306C0.152337 4.53392 0.0693809 4.40319 0.0285329 4.25719C-0.0123151 4.11119 -0.00924472 3.95639 0.0373607 3.81212C0.083966 3.66786 0.172041 3.54052 0.290586 3.44601C0.409131 3.3515 0.552892 3.29401 0.703916 3.28072L3.46954 3.05759L4.53642 0.475716C4.59416 0.335005 4.69245 0.214645 4.81878 0.129937C4.94511 0.0452292 5.09377 0 5.24587 0C5.39797 0 5.54663 0.0452292 5.67296 0.129937C5.79929 0.214645 5.89757 0.335005 5.95532 0.475716L7.02173 3.05759L9.78735 3.28072C9.93868 3.29351 10.0829 3.35068 10.2018 3.44506C10.3208 3.53944 10.4093 3.66683 10.4562 3.81127C10.5031 3.95571 10.5063 4.11078 10.4655 4.25705C10.4246 4.40332 10.3415 4.53428 10.2266 4.63353L10.2294 4.63306Z" />
1506
+ </svg>
1507
+ );
1508
+ }
package/index.css CHANGED
@@ -69,6 +69,11 @@
69
69
  @import "./primitives/disclosure.css" layer(primitives);
70
70
  @import "./primitives/month-range.css" layer(primitives);
71
71
  @import "./primitives/strip.css" layer(primitives);
72
+ @import "./primitives/markdown.css" layer(primitives);
73
+ @import "./primitives/chat.css" layer(primitives);
74
+ @import "./primitives/prompt.css" layer(primitives);
75
+ @import "./primitives/ask.css" layer(primitives);
76
+ @import "./primitives/chart.css" layer(primitives);
72
77
 
73
78
  /* Shared: the landing kit's frame, which its sections refine. */
74
79
  @import "./sections/landing.css" layer(shared);
@@ -0,0 +1,200 @@
1
+ /** A small Markdown reader for an assistant's answer: the blocks the
2
+ * ks-Chat markdown kit draws (headings, paragraphs, bullet / ordered /
3
+ * task lists, blockquotes, dividers, tables, fenced code) and the inline
4
+ * marks inside them (code, strong, emphasis, links, @mentions). It is
5
+ * deliberately the kit's subset, not CommonMark: anything it does not
6
+ * know is a paragraph. `primitives/markdown.tsx` draws the result. */
7
+
8
+ export type Inline =
9
+ | { kind: "text"; text: string }
10
+ | { kind: "code"; text: string }
11
+ | { kind: "strong"; children: Inline[] }
12
+ | { kind: "em"; children: Inline[] }
13
+ | { kind: "link"; href: string; children: Inline[] }
14
+ | { kind: "mention"; name: string };
15
+
16
+ export interface ListItem {
17
+ children: Inline[];
18
+ /** A task item's state; undefined for a plain item. */
19
+ task?: "open" | "done";
20
+ /** Indented under the item before it. */
21
+ nested: boolean;
22
+ }
23
+
24
+ export type Block =
25
+ | { kind: "heading"; level: 1 | 2 | 3 | 4; children: Inline[] }
26
+ | { kind: "paragraph"; children: Inline[] }
27
+ | { kind: "list"; ordered: boolean; start: number; items: ListItem[] }
28
+ | { kind: "quote"; children: Inline[] }
29
+ | { kind: "divider" }
30
+ | { kind: "table"; head: Inline[][]; rows: Inline[][][] }
31
+ /** A fence's info string is `language` or `language filename`. */
32
+ | { kind: "code"; language: string; filename: string; code: string };
33
+
34
+ const HEADING = /^(#{1,4})\s+(.*)$/;
35
+ const BULLET = /^(\s*)[-*•]\s+(?:\[([ xX])\]\s+)?(.*)$/;
36
+ const ORDERED = /^(\s*)(\d+)[.)]\s+(.*)$/;
37
+ const QUOTE = /^>\s?(.*)$/;
38
+ const DIVIDER = /^(?:-{3,}|\*{3,}|_{3,})\s*$/;
39
+ const FENCE = /^```\s*([\w+#.-]*)(?:\s+(\S+))?\s*$/;
40
+ const TABLE_ROW = /^\|.*\|\s*$/;
41
+ const TABLE_RULE = /^\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/;
42
+
43
+ function cells(row: string): string[] {
44
+ return row
45
+ .trim()
46
+ .replace(/^\|/, "")
47
+ .replace(/\|$/, "")
48
+ .split("|")
49
+ .map((c) => c.trim());
50
+ }
51
+
52
+ /** Read a Markdown string into the kit's blocks. */
53
+ export function parseMarkdown(source: string): Block[] {
54
+ const lines = source.replace(/\r\n?/g, "\n").split("\n");
55
+ const blocks: Block[] = [];
56
+ let i = 0;
57
+ while (i < lines.length) {
58
+ const line = lines[i];
59
+ if (!line.trim()) {
60
+ i++;
61
+ continue;
62
+ }
63
+ const fence = FENCE.exec(line);
64
+ if (fence) {
65
+ const code: string[] = [];
66
+ i++;
67
+ while (i < lines.length && !/^```\s*$/.test(lines[i])) code.push(lines[i++]);
68
+ i++;
69
+ blocks.push({
70
+ kind: "code",
71
+ language: fence[1].toLowerCase(),
72
+ filename: fence[2] ?? "",
73
+ code: code.join("\n"),
74
+ });
75
+ continue;
76
+ }
77
+ const heading = HEADING.exec(line);
78
+ if (heading) {
79
+ blocks.push({
80
+ kind: "heading",
81
+ level: heading[1].length as 1 | 2 | 3 | 4,
82
+ children: parseInline(heading[2].trim()),
83
+ });
84
+ i++;
85
+ continue;
86
+ }
87
+ if (DIVIDER.test(line)) {
88
+ blocks.push({ kind: "divider" });
89
+ i++;
90
+ continue;
91
+ }
92
+ if (QUOTE.test(line)) {
93
+ const text: string[] = [];
94
+ while (i < lines.length && QUOTE.test(lines[i])) text.push(QUOTE.exec(lines[i++])![1]);
95
+ blocks.push({ kind: "quote", children: parseInline(text.join(" ").trim()) });
96
+ continue;
97
+ }
98
+ if (TABLE_ROW.test(line) && i + 1 < lines.length && TABLE_RULE.test(lines[i + 1])) {
99
+ const head = cells(line).map(parseInline);
100
+ i += 2;
101
+ const rows: Inline[][][] = [];
102
+ while (i < lines.length && TABLE_ROW.test(lines[i]))
103
+ rows.push(cells(lines[i++]).map(parseInline));
104
+ blocks.push({ kind: "table", head, rows });
105
+ continue;
106
+ }
107
+ const bullet = BULLET.exec(line);
108
+ const ordered = ORDERED.exec(line);
109
+ if (bullet || ordered) {
110
+ const isOrdered = !bullet;
111
+ const start = ordered ? Number(ordered[2]) : 1;
112
+ const items: ListItem[] = [];
113
+ while (i < lines.length) {
114
+ const b = BULLET.exec(lines[i]);
115
+ const o = ORDERED.exec(lines[i]);
116
+ const m = isOrdered ? o : b;
117
+ if (!m) break;
118
+ const mark = isOrdered ? undefined : b![2];
119
+ items.push({
120
+ children: parseInline(m[3].trim()),
121
+ task: mark === undefined ? undefined : mark === " " ? "open" : "done",
122
+ nested: m[1].length >= 2,
123
+ });
124
+ i++;
125
+ }
126
+ blocks.push({ kind: "list", ordered: isOrdered, start, items });
127
+ continue;
128
+ }
129
+ // A paragraph runs to the next blank line or the next block opener.
130
+ const text: string[] = [line.trim()];
131
+ i++;
132
+ while (i < lines.length && lines[i].trim() && !opensBlock(lines[i]))
133
+ text.push(lines[i++].trim());
134
+ blocks.push({ kind: "paragraph", children: parseInline(text.join(" ")) });
135
+ }
136
+ return blocks;
137
+ }
138
+
139
+ function opensBlock(line: string): boolean {
140
+ return (
141
+ HEADING.test(line) ||
142
+ BULLET.test(line) ||
143
+ ORDERED.test(line) ||
144
+ QUOTE.test(line) ||
145
+ DIVIDER.test(line) ||
146
+ FENCE.test(line) ||
147
+ TABLE_ROW.test(line)
148
+ );
149
+ }
150
+
151
+ const INLINE =
152
+ /(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\s][^*]*\*)|(_[^_\s][^_]*_)|(\[[^\]]+\]\([^)\s]+\))|((?:^|(?<=\s))@[\w.-]+)/g;
153
+
154
+ /* A link's address, which came from whoever wrote the markdown — a
155
+ model, as often as not — opens a page or a mail client and nothing
156
+ else: `javascript:` and the like are read as the words they are. */
157
+ const LINK_SCHEME = /^(?:https?:|mailto:|[/#?.])/i;
158
+
159
+ /** Read the inline marks of one line of text. */
160
+ export function parseInline(text: string): Inline[] {
161
+ const out: Inline[] = [];
162
+ let last = 0;
163
+ for (const m of text.matchAll(INLINE)) {
164
+ const at = m.index;
165
+ if (at > last) out.push({ kind: "text", text: text.slice(last, at) });
166
+ const token = m[0];
167
+ if (m[1]) out.push({ kind: "code", text: token.slice(1, -1) });
168
+ else if (m[2] || m[3]) out.push({ kind: "strong", children: parseInline(token.slice(2, -2)) });
169
+ else if (m[4] || m[5]) out.push({ kind: "em", children: parseInline(token.slice(1, -1)) });
170
+ else if (m[6]) {
171
+ const close = token.indexOf("](");
172
+ const href = token.slice(close + 2, -1);
173
+ if (LINK_SCHEME.test(href)) {
174
+ out.push({ kind: "link", href, children: parseInline(token.slice(1, close)) });
175
+ } else {
176
+ out.push({ kind: "text", text: token });
177
+ }
178
+ } else if (m[7]) out.push({ kind: "mention", name: token.slice(1) });
179
+ last = at + token.length;
180
+ }
181
+ if (last < text.length) out.push({ kind: "text", text: text.slice(last) });
182
+ return out;
183
+ }
184
+
185
+ /** The plain words of a run of inline marks, for a copy or a title. */
186
+ export function inlineText(nodes: Inline[]): string {
187
+ return nodes
188
+ .map((n) => {
189
+ switch (n.kind) {
190
+ case "text":
191
+ case "code":
192
+ return n.text;
193
+ case "mention":
194
+ return `@${n.name}`;
195
+ default:
196
+ return inlineText(n.children);
197
+ }
198
+ })
199
+ .join("");
200
+ }
@@ -0,0 +1,41 @@
1
+ "use client";
2
+
3
+ /** Copy a text to the clipboard and say so for a moment: the
4
+ * message-action-button's copied state and the code block's. The
5
+ * copied flag drops after `--motion-copied-hold` worth of time, read
6
+ * from the document so the beat lives with the other motion tokens. */
7
+
8
+ import { useCallback, useEffect, useRef, useState } from "react";
9
+
10
+ /** The fallback for a document whose tokens have not loaded. */
11
+ const HOLD_FALLBACK_MS = 1600;
12
+
13
+ function holdMs(): number {
14
+ if (typeof document === "undefined") return HOLD_FALLBACK_MS;
15
+ const raw = getComputedStyle(document.documentElement).getPropertyValue("--motion-copied-hold");
16
+ const ms = Number.parseFloat(raw);
17
+ if (!Number.isFinite(ms)) return HOLD_FALLBACK_MS;
18
+ return raw.trim().endsWith("ms") ? ms : ms * 1000;
19
+ }
20
+
21
+ export function useCopy(): { copied: boolean; copy: (text: string) => void } {
22
+ const [copied, setCopied] = useState(false);
23
+ const timer = useRef<number | null>(null);
24
+ useEffect(
25
+ () => () => {
26
+ if (timer.current !== null) window.clearTimeout(timer.current);
27
+ },
28
+ [],
29
+ );
30
+ const copy = useCallback((text: string) => {
31
+ const done = () => {
32
+ setCopied(true);
33
+ if (timer.current !== null) window.clearTimeout(timer.current);
34
+ timer.current = window.setTimeout(() => setCopied(false), holdMs());
35
+ };
36
+ if (navigator.clipboard?.writeText) {
37
+ navigator.clipboard.writeText(text).then(done, () => undefined);
38
+ }
39
+ }, []);
40
+ return { copied, copy };
41
+ }