@aicayzer/inkkit 0.7.1 → 0.7.3

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.
@@ -1,4 +1,4 @@
1
- import { c as DecorationSet, f as __commonJSMin, l as Plugin, o as $prose, p as __toESM, s as Decoration, u as PluginKey } from "./core-Bn6QiQSD.js";
1
+ import { c as DecorationSet, f as __commonJSMin, l as Plugin, o as $prose, p as __toESM, s as Decoration, u as PluginKey } from "./core-BI-sSLEL.js";
2
2
  //#region node_modules/.pnpm/highlight.js@11.11.2/node_modules/highlight.js/es/languages/arduino.js
3
3
  /** @type LanguageFn */
4
4
  function cPlusPlus(hljs) {
package/dist/core.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as InkKitError, n as normalizeLinkAddress, r as InkKitEditor, t as canOpenLink } from "./chunks/core-Bn6QiQSD.js";
1
+ import { a as InkKitError, n as normalizeLinkAddress, r as InkKitEditor, t as canOpenLink } from "./chunks/core-BI-sSLEL.js";
2
2
  export { InkKitEditor, InkKitError, canOpenLink, normalizeLinkAddress };
package/dist/editor.d.ts CHANGED
@@ -100,6 +100,9 @@ export interface EditorOptions<F extends DocumentFormat = TextDocumentFormat> {
100
100
  codeHighlighting?: boolean;
101
101
  /** Defaults to true. */
102
102
  diagramPreview?: boolean;
103
+ /** Draws the caret at text height in formatted mode, where a fine pointer is the primary
104
+ * input. Defaults to true. */
105
+ drawnSelection?: boolean;
103
106
  };
104
107
  }
105
108
  /** What the editor can do now. Availability is the state at the time of the call, not a promise. */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as InkKitError, i as registerDiagram, n as normalizeLinkAddress, r as InkKitEditor, t as canOpenLink } from "./chunks/core-Bn6QiQSD.js";
1
+ import { a as InkKitError, i as registerDiagram, n as normalizeLinkAddress, r as InkKitEditor, t as canOpenLink } from "./chunks/core-BI-sSLEL.js";
2
2
  //#region node_modules/.pnpm/dompurify@3.4.17/node_modules/dompurify/dist/purify.es.mjs
3
3
  /*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */
4
4
  function _OverloadYield(e, d) {
package/dist/style.css CHANGED
@@ -86,7 +86,7 @@
86
86
  border-collapse: separate;
87
87
  border-spacing: 0;
88
88
  border: 1px solid var(--_inkkit-rule);
89
- border-radius: var(--inkkit-table-radius, 4px);
89
+ border-radius: var(--inkkit-table-radius, 10px);
90
90
  width: 100%;
91
91
  }
92
92
  .inkkit-root .ProseMirror td,
@@ -109,24 +109,27 @@
109
109
  border-bottom-width: 0;
110
110
  }
111
111
  .inkkit-root .ProseMirror tr:first-child > :first-child {
112
- border-top-left-radius: max(0px, calc(var(--inkkit-table-radius, 4px) - 1px));
112
+ border-top-left-radius: max(
113
+ 0px,
114
+ calc(var(--inkkit-table-radius, 10px) - 1px)
115
+ );
113
116
  }
114
117
  .inkkit-root .ProseMirror tr:first-child > :last-child {
115
118
  border-top-right-radius: max(
116
119
  0px,
117
- calc(var(--inkkit-table-radius, 4px) - 1px)
120
+ calc(var(--inkkit-table-radius, 10px) - 1px)
118
121
  );
119
122
  }
120
123
  .inkkit-root .ProseMirror tr:last-child > :first-child {
121
124
  border-bottom-left-radius: max(
122
125
  0px,
123
- calc(var(--inkkit-table-radius, 4px) - 1px)
126
+ calc(var(--inkkit-table-radius, 10px) - 1px)
124
127
  );
125
128
  }
126
129
  .inkkit-root .ProseMirror tr:last-child > :last-child {
127
130
  border-bottom-right-radius: max(
128
131
  0px,
129
- calc(var(--inkkit-table-radius, 4px) - 1px)
132
+ calc(var(--inkkit-table-radius, 10px) - 1px)
130
133
  );
131
134
  }
132
135
  .inkkit-root .ProseMirror th {
@@ -376,6 +379,14 @@
376
379
  padding: 6px;
377
380
  white-space: normal;
378
381
  }
382
+ /* A picture that loads is drawn bare: no border, padding or caption. Any grey inside it is the
383
+ picture's own. A picture that is loading or has failed keeps its card. */
384
+ .inkkit-root
385
+ .ProseMirror
386
+ .inkkit-file[data-inkkit-file-state='resolved'][data-inkkit-file-kind='image'] {
387
+ border: 0;
388
+ padding: 0;
389
+ }
379
390
 
380
391
  /* A file presentation with `layout: 'fill'` takes the column's width instead of its label's. */
381
392
  .inkkit-root
@@ -405,17 +416,6 @@
405
416
  .inkkit-root .ProseMirror .inkkit-file-footer:not(:first-child) {
406
417
  margin-block-start: 0.25em;
407
418
  }
408
- /* Below a picture, the name takes the picture's width rather than widening the card, so the grip
409
- stays at the picture's edge; a short picture still leaves room for a few characters. */
410
- .inkkit-root .ProseMirror .inkkit-image-preview ~ .inkkit-file-footer {
411
- width: 0;
412
- min-width: 100%;
413
- }
414
- .inkkit-root
415
- .ProseMirror
416
- .inkkit-image.inkkit-file:has(> .inkkit-image-preview) {
417
- min-width: min(100%, 8em);
418
- }
419
419
  /* The name truncates; the open arrow stays visible right after it. */
420
420
  .inkkit-root .ProseMirror .inkkit-file-name {
421
421
  display: flex;
@@ -467,29 +467,42 @@
467
467
  cursor: pointer;
468
468
  }
469
469
  .inkkit-root .ProseMirror .inkkit-file-open {
470
+ /* The name and the arrow are one link: a plain control that the footer's muted text colours. */
470
471
  display: inline-flex;
472
+ flex: 0 1 auto;
471
473
  align-items: center;
472
- justify-content: center;
473
- min-width: 1.5em;
474
- min-height: 1.5em;
474
+ gap: 0.25em;
475
+ min-width: 0;
476
+ max-width: 100%;
475
477
  padding: 0;
476
478
  color: var(--_inkkit-muted);
477
479
  background: transparent;
478
- border-color: transparent;
480
+ border: 0;
481
+ border-radius: 3px;
482
+ text-align: start;
479
483
  }
480
484
  .inkkit-root .ProseMirror .inkkit-file-open:hover {
481
485
  color: var(--_inkkit-text);
482
- background: var(--_inkkit-code-bg);
486
+ }
487
+ .inkkit-root .ProseMirror .inkkit-file-open:hover .inkkit-file-label {
488
+ text-decoration: underline;
483
489
  }
484
490
  .inkkit-root .ProseMirror .inkkit-file-open svg {
491
+ flex: none;
492
+ box-sizing: content-box;
485
493
  width: 0.85em;
486
494
  height: 0.85em;
495
+ padding: 0.2em;
496
+ border-radius: 3px;
487
497
  fill: none;
488
498
  stroke: currentColor;
489
499
  stroke-width: 1.5;
490
500
  stroke-linecap: round;
491
501
  stroke-linejoin: round;
492
502
  }
503
+ .inkkit-root .ProseMirror .inkkit-file-open:hover svg {
504
+ background: var(--_inkkit-code-bg);
505
+ }
493
506
 
494
507
  .inkkit-root .ProseMirror {
495
508
  /* The viewport, not the wrapper Milkdown adds, so a click below the text still places the caret. */
@@ -506,6 +519,87 @@
506
519
  cursor: text;
507
520
  }
508
521
 
522
+ /* The drawn caret and selection sit in the surface's wrapper. It isolates its own stacking
523
+ context, so the selection layer can sit behind the text and still above the page. */
524
+ .inkkit-root .inkkit-overlay-host {
525
+ position: relative;
526
+ isolation: isolate;
527
+ }
528
+ .inkkit-root .inkkit-selection-layer {
529
+ position: absolute;
530
+ inset: 0;
531
+ z-index: -1;
532
+ pointer-events: none;
533
+ }
534
+ .inkkit-root .inkkit-selection-layer > div {
535
+ position: absolute;
536
+ background: var(
537
+ --inkkit-inactive-selection-background,
538
+ light-dark(#d4d4d4, #555)
539
+ );
540
+ }
541
+ .inkkit-root.inkkit-selection-active .inkkit-selection-layer > div {
542
+ background: var(
543
+ --inkkit-selection-background,
544
+ color-mix(in srgb, var(--_inkkit-accent) 30%, transparent)
545
+ );
546
+ }
547
+ @media (forced-colors: active) {
548
+ .inkkit-root .inkkit-selection-layer > div {
549
+ forced-color-adjust: none;
550
+ background: Highlight;
551
+ }
552
+ }
553
+ /* The drawn caret. The native caret stays, transparent, so accessibility and input methods
554
+ still read its position. */
555
+ .inkkit-root .ProseMirror.inkkit-drawn-caret {
556
+ caret-color: transparent;
557
+ }
558
+ .inkkit-root .inkkit-caret {
559
+ position: absolute;
560
+ z-index: 1;
561
+ width: 2px;
562
+ margin-left: -1px;
563
+ border-radius: 1px;
564
+ background: var(--_inkkit-accent);
565
+ pointer-events: none;
566
+ }
567
+ .inkkit-root:not(.inkkit-selection-active) .inkkit-caret {
568
+ visibility: hidden;
569
+ }
570
+ .inkkit-root .inkkit-caret[data-blink='a'] {
571
+ animation: inkkit-caret-blink-a 1.1s infinite;
572
+ }
573
+ .inkkit-root .inkkit-caret[data-blink='b'] {
574
+ animation: inkkit-caret-blink-b 1.1s infinite;
575
+ }
576
+ @keyframes inkkit-caret-blink-a {
577
+ 0%,
578
+ 49.9% {
579
+ opacity: 1;
580
+ }
581
+ 50%,
582
+ 100% {
583
+ opacity: 0;
584
+ }
585
+ }
586
+ @keyframes inkkit-caret-blink-b {
587
+ 0%,
588
+ 49.9% {
589
+ opacity: 1;
590
+ }
591
+ 50%,
592
+ 100% {
593
+ opacity: 0;
594
+ }
595
+ }
596
+ @media (forced-colors: active) {
597
+ .inkkit-root .inkkit-caret {
598
+ forced-color-adjust: none;
599
+ background: Highlight;
600
+ }
601
+ }
602
+
509
603
  .inkkit-root .ProseMirror .inkkit-empty {
510
604
  position: relative;
511
605
  }
@@ -629,27 +723,26 @@
629
723
  font-size: calc(var(--_inkkit-font-size) * 0.867);
630
724
  line-height: 1.5;
631
725
  background: var(--_inkkit-code-bg);
632
- border-radius: var(--inkkit-code-radius, 8px);
726
+ border-radius: var(--inkkit-code-radius, 10px);
633
727
  padding: calc(var(--_inkkit-font-size) * 0.8)
634
728
  calc(var(--_inkkit-font-size) * 0.933);
635
729
  margin: 0 0 calc(var(--_inkkit-font-size) * 0.8);
636
- overflow-x: auto;
637
730
  }
638
731
 
639
732
  .inkkit-root .ProseMirror pre[data-language] {
640
- padding-top: max(calc(var(--_inkkit-font-size) * 2), 30px);
733
+ padding-top: max(calc(var(--_inkkit-font-size) * 1.8), 28px);
641
734
  }
642
735
 
643
736
  .inkkit-root .ProseMirror pre .inkkit-copy {
644
737
  position: absolute;
645
- top: 6px;
738
+ top: 4px;
646
739
  right: 6px;
647
740
  display: grid;
648
741
  place-content: center;
649
742
  place-items: center;
650
743
  box-sizing: border-box;
651
- width: 26px;
652
- height: 24px;
744
+ width: 24px;
745
+ height: 22px;
653
746
  margin: 0;
654
747
  padding: 0;
655
748
  border: 0;
@@ -657,28 +750,30 @@
657
750
  background: transparent;
658
751
  color: var(--_inkkit-muted);
659
752
  cursor: pointer;
660
- opacity: 0;
661
- transition: opacity 120ms;
753
+ z-index: 2;
662
754
  user-select: none;
663
755
  }
664
756
 
665
- .inkkit-root .ProseMirror pre:hover .inkkit-copy,
666
- .inkkit-root .ProseMirror pre:focus-within .inkkit-copy,
667
- .inkkit-root .ProseMirror pre .inkkit-copy[data-copied] {
668
- opacity: 1;
669
- }
670
-
671
757
  .inkkit-root .ProseMirror pre .inkkit-copy:hover {
672
758
  background: color-mix(in srgb, CanvasText 10%, transparent);
673
759
  color: var(--_inkkit-text);
674
760
  }
675
761
 
676
- .inkkit-root .ProseMirror pre code {
762
+ .inkkit-root .ProseMirror pre > code {
763
+ display: block;
764
+ overflow-x: auto;
765
+ white-space: pre;
766
+ overflow-wrap: normal;
677
767
  background: none;
678
768
  padding: 0;
679
769
  font-size: inherit;
680
770
  }
681
771
 
772
+ .inkkit-root .ProseMirror pre.inkkit-code-wrapped > code {
773
+ white-space: pre-wrap;
774
+ overflow-wrap: anywhere;
775
+ }
776
+
682
777
  .inkkit-root .ProseMirror blockquote {
683
778
  position: relative;
684
779
  margin: 0 0 calc(var(--_inkkit-font-size) * 0.8);
@@ -1220,35 +1315,43 @@
1220
1315
 
1221
1316
  .inkkit-root .inkkit-code-controls {
1222
1317
  position: absolute;
1223
- top: 6px;
1224
- right: 38px;
1318
+ top: 4px;
1319
+ z-index: 2;
1320
+ right: 34px;
1225
1321
  font:
1226
- 11px/1.4 -apple-system,
1322
+ calc(var(--_inkkit-font-size) * 0.8)/1.4 -apple-system,
1227
1323
  system-ui,
1228
1324
  sans-serif;
1229
1325
  white-space: normal;
1230
1326
  user-select: none;
1231
1327
  }
1328
+ .inkkit-root .inkkit-code-controls:has([aria-expanded='true']) {
1329
+ z-index: 50;
1330
+ }
1331
+ .inkkit-root pre:not(:has(.inkkit-copy)) .inkkit-code-controls {
1332
+ right: 6px;
1333
+ }
1232
1334
  .inkkit-root .inkkit-code-language {
1233
1335
  display: inline-flex;
1234
1336
  align-items: center;
1235
1337
  gap: 5px;
1236
- height: 24px;
1338
+ height: 22px;
1237
1339
  padding: 0 6px;
1238
1340
  border: 0;
1239
1341
  border-radius: 5px;
1240
1342
  background: transparent;
1241
- color: var(--_inkkit-muted);
1343
+ color: color-mix(in srgb, var(--_inkkit-text) 50%, var(--_inkkit-muted));
1242
1344
  font: inherit;
1243
1345
  cursor: pointer;
1244
1346
  }
1245
- .inkkit-root .inkkit-code-language svg {
1347
+ .inkkit-root .inkkit-code-language svg,
1348
+ .inkkit-root .inkkit-code-wrap svg {
1246
1349
  flex-shrink: 0;
1247
1350
  width: 12px;
1248
1351
  height: 12px;
1249
1352
  fill: none;
1250
1353
  stroke: currentColor;
1251
- stroke-width: 1.25;
1354
+ stroke-width: 1.5;
1252
1355
  stroke-linecap: round;
1253
1356
  stroke-linejoin: round;
1254
1357
  }
@@ -1256,7 +1359,8 @@
1256
1359
  background: color-mix(in srgb, CanvasText 7%, transparent);
1257
1360
  }
1258
1361
  .inkkit-root .inkkit-code-language:focus-visible,
1259
- .inkkit-root .inkkit-copy:focus-visible {
1362
+ .inkkit-root .inkkit-copy:focus-visible,
1363
+ .inkkit-root .inkkit-code-wrap:focus-visible {
1260
1364
  outline: var(--inkkit-focus-width, 2px) solid
1261
1365
  var(--inkkit-focus-color, var(--_inkkit-accent));
1262
1366
  outline-offset: var(--inkkit-focus-offset, 1px);
@@ -1266,38 +1370,74 @@
1266
1370
  z-index: 50;
1267
1371
  display: flex;
1268
1372
  flex-direction: column;
1269
- width: 220px;
1270
- max-height: min(320px, 50vh);
1271
- padding: 6px;
1373
+ width: 200px;
1374
+ max-height: min(264px, 50vh);
1375
+ padding: 0;
1272
1376
  box-sizing: border-box;
1273
1377
  border: 1px solid color-mix(in srgb, CanvasText 15%, transparent);
1274
- border-radius: 8px;
1275
- background: Canvas;
1276
- color: CanvasText;
1378
+ border-radius: 10px;
1379
+ background: color-mix(in srgb, CanvasText 4%, Canvas);
1380
+ color: color-mix(in srgb, CanvasText 80%, Canvas);
1277
1381
  box-shadow: 0 6px 20px #0002;
1278
1382
  }
1279
1383
  .inkkit-root .inkkit-code-language-menu input {
1280
1384
  box-sizing: border-box;
1281
1385
  min-width: 0;
1282
1386
  width: 100%;
1283
- padding: 7px 8px;
1284
- border: 1px solid color-mix(in srgb, CanvasText 12%, transparent);
1387
+ padding: 4px 2px;
1388
+ height: 28px;
1389
+ border: 0;
1285
1390
  border-radius: 5px;
1286
- background: color-mix(in srgb, CanvasText 3%, transparent);
1391
+ background: transparent;
1287
1392
  color: inherit;
1288
1393
  font: inherit;
1289
1394
  }
1395
+ .inkkit-root .inkkit-code-language-search {
1396
+ display: flex;
1397
+ flex-shrink: 0;
1398
+ align-items: center;
1399
+ gap: 4px;
1400
+ padding: 4px 6px 4px 10px;
1401
+ border-bottom: 1px solid color-mix(in srgb, CanvasText 10%, transparent);
1402
+ }
1403
+ .inkkit-root .inkkit-code-wrap {
1404
+ display: grid;
1405
+ place-items: center;
1406
+ flex: 0 0 24px;
1407
+ width: 24px;
1408
+ height: 24px;
1409
+ padding: 0;
1410
+ border: 0;
1411
+ border-radius: 5px;
1412
+ background: transparent;
1413
+ color: var(--_inkkit-muted);
1414
+ cursor: pointer;
1415
+ }
1416
+ .inkkit-root .inkkit-code-wrap svg {
1417
+ width: 16px;
1418
+ height: 16px;
1419
+ stroke-width: 1.75;
1420
+ }
1421
+ .inkkit-root .inkkit-code-wrap:hover,
1422
+ .inkkit-root .inkkit-code-wrap[aria-pressed='true'],
1423
+ .inkkit-root .inkkit-code-language[aria-expanded='true'] {
1424
+ background: color-mix(in srgb, CanvasText 10%, transparent);
1425
+ }
1426
+ .inkkit-root .inkkit-code-language[aria-expanded='true'] svg {
1427
+ transform: rotate(180deg);
1428
+ }
1290
1429
  .inkkit-root .inkkit-code-language-list {
1291
1430
  display: flex;
1292
1431
  flex-direction: column;
1293
1432
  overflow-y: auto;
1294
- padding: 4px 0 0;
1433
+ padding: 4px;
1434
+ min-height: 0;
1295
1435
  }
1296
1436
  .inkkit-root .inkkit-code-language-list button {
1297
1437
  flex-shrink: 0;
1298
- padding: 5px 8px;
1438
+ padding: 6px 8px;
1299
1439
  border: 0;
1300
- border-radius: 4px;
1440
+ border-radius: 6px;
1301
1441
  background: transparent;
1302
1442
  color: inherit;
1303
1443
  font: inherit;
@@ -11,8 +11,8 @@
11
11
  --inkkit-rule-color: light-dark(#dce2e9, #434d5e);
12
12
  --inkkit-checkbox-border-color: var(--inkkit-muted-color);
13
13
  --inkkit-code-background: light-dark(#f3f5f8, #272e3a);
14
- --inkkit-table-radius: 8px;
15
- --inkkit-code-radius: 8px;
14
+ --inkkit-table-radius: 10px;
15
+ --inkkit-code-radius: 10px;
16
16
  --inkkit-quote-rule-width: 3px;
17
17
  --inkkit-quote-rule-radius: 2px;
18
18
  --inkkit-quote-rule-color: light-dark(#a6a6a6, #777777);
@@ -11,8 +11,8 @@
11
11
  --inkkit-rule-color: light-dark(#dddddd, #444444);
12
12
  --inkkit-checkbox-border-color: var(--inkkit-muted-color);
13
13
  --inkkit-code-background: light-dark(#f7f7f7, #2a2a2a);
14
- --inkkit-table-radius: 4px;
15
- --inkkit-code-radius: 4px;
14
+ --inkkit-table-radius: 10px;
15
+ --inkkit-code-radius: 10px;
16
16
  --inkkit-quote-rule-width: 3px;
17
17
  --inkkit-quote-rule-radius: 2px;
18
18
  --inkkit-quote-rule-color: light-dark(#a6a6a6, #777777);
@@ -14,8 +14,8 @@
14
14
  #f3f5f8,
15
15
  color-mix(in srgb, CanvasText 8%, transparent)
16
16
  );
17
- --inkkit-table-radius: 8px;
18
- --inkkit-code-radius: 8px;
17
+ --inkkit-table-radius: 10px;
18
+ --inkkit-code-radius: 10px;
19
19
  --inkkit-quote-rule-width: 3px;
20
20
  --inkkit-quote-rule-radius: 2px;
21
21
  --inkkit-quote-rule-color: light-dark(#a6a6a6, #777777);
package/dist/types.d.ts CHANGED
@@ -409,6 +409,7 @@ export interface EditorLabels {
409
409
  copyCode: string;
410
410
  codeLanguage: string;
411
411
  codeLanguageSearch: string;
412
+ codeWrap: string;
412
413
  codeAuto: string;
413
414
  codePlainText: string;
414
415
  expandCallout: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicayzer/inkkit",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "A preserving Markdown editor for offline web views and the web",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,7 +57,9 @@
57
57
  "test:browser": "playwright test --project=chromium",
58
58
  "test:playground": "playwright test --config playwright.playground.config.ts --project=chromium",
59
59
  "measure:browser": "playwright test --config playwright.measure.config.ts",
60
- "test:built-playground": "playwright test --config playwright.built.config.ts"
60
+ "test:built-playground": "playwright test --config playwright.built.config.ts",
61
+ "build:docs-demo": "pnpm build && node scripts/build-docs-demo.mjs",
62
+ "test:docs-demo": "playwright test --config playwright.docs-demo.config.ts"
61
63
  },
62
64
  "devDependencies": {
63
65
  "@milkdown/kit": "7.22.3",