@aicayzer/inkkit 0.7.1 → 0.7.2

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-BeZFc1qW.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-BeZFc1qW.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-BeZFc1qW.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 {
@@ -506,6 +509,87 @@
506
509
  cursor: text;
507
510
  }
508
511
 
512
+ /* The drawn caret and selection sit in the surface's wrapper. It isolates its own stacking
513
+ context, so the selection layer can sit behind the text and still above the page. */
514
+ .inkkit-root .inkkit-overlay-host {
515
+ position: relative;
516
+ isolation: isolate;
517
+ }
518
+ .inkkit-root .inkkit-selection-layer {
519
+ position: absolute;
520
+ inset: 0;
521
+ z-index: -1;
522
+ pointer-events: none;
523
+ }
524
+ .inkkit-root .inkkit-selection-layer > div {
525
+ position: absolute;
526
+ background: var(
527
+ --inkkit-inactive-selection-background,
528
+ light-dark(#d4d4d4, #555)
529
+ );
530
+ }
531
+ .inkkit-root.inkkit-selection-active .inkkit-selection-layer > div {
532
+ background: var(
533
+ --inkkit-selection-background,
534
+ color-mix(in srgb, var(--_inkkit-accent) 30%, transparent)
535
+ );
536
+ }
537
+ @media (forced-colors: active) {
538
+ .inkkit-root .inkkit-selection-layer > div {
539
+ forced-color-adjust: none;
540
+ background: Highlight;
541
+ }
542
+ }
543
+ /* The drawn caret. The native caret stays, transparent, so accessibility and input methods
544
+ still read its position. */
545
+ .inkkit-root .ProseMirror.inkkit-drawn-caret {
546
+ caret-color: transparent;
547
+ }
548
+ .inkkit-root .inkkit-caret {
549
+ position: absolute;
550
+ z-index: 1;
551
+ width: 2px;
552
+ margin-left: -1px;
553
+ border-radius: 1px;
554
+ background: var(--_inkkit-accent);
555
+ pointer-events: none;
556
+ }
557
+ .inkkit-root:not(.inkkit-selection-active) .inkkit-caret {
558
+ visibility: hidden;
559
+ }
560
+ .inkkit-root .inkkit-caret[data-blink='a'] {
561
+ animation: inkkit-caret-blink-a 1.1s infinite;
562
+ }
563
+ .inkkit-root .inkkit-caret[data-blink='b'] {
564
+ animation: inkkit-caret-blink-b 1.1s infinite;
565
+ }
566
+ @keyframes inkkit-caret-blink-a {
567
+ 0%,
568
+ 49.9% {
569
+ opacity: 1;
570
+ }
571
+ 50%,
572
+ 100% {
573
+ opacity: 0;
574
+ }
575
+ }
576
+ @keyframes inkkit-caret-blink-b {
577
+ 0%,
578
+ 49.9% {
579
+ opacity: 1;
580
+ }
581
+ 50%,
582
+ 100% {
583
+ opacity: 0;
584
+ }
585
+ }
586
+ @media (forced-colors: active) {
587
+ .inkkit-root .inkkit-caret {
588
+ forced-color-adjust: none;
589
+ background: Highlight;
590
+ }
591
+ }
592
+
509
593
  .inkkit-root .ProseMirror .inkkit-empty {
510
594
  position: relative;
511
595
  }
@@ -629,27 +713,26 @@
629
713
  font-size: calc(var(--_inkkit-font-size) * 0.867);
630
714
  line-height: 1.5;
631
715
  background: var(--_inkkit-code-bg);
632
- border-radius: var(--inkkit-code-radius, 8px);
716
+ border-radius: var(--inkkit-code-radius, 10px);
633
717
  padding: calc(var(--_inkkit-font-size) * 0.8)
634
718
  calc(var(--_inkkit-font-size) * 0.933);
635
719
  margin: 0 0 calc(var(--_inkkit-font-size) * 0.8);
636
- overflow-x: auto;
637
720
  }
638
721
 
639
722
  .inkkit-root .ProseMirror pre[data-language] {
640
- padding-top: max(calc(var(--_inkkit-font-size) * 2), 30px);
723
+ padding-top: max(calc(var(--_inkkit-font-size) * 1.8), 28px);
641
724
  }
642
725
 
643
726
  .inkkit-root .ProseMirror pre .inkkit-copy {
644
727
  position: absolute;
645
- top: 6px;
728
+ top: 4px;
646
729
  right: 6px;
647
730
  display: grid;
648
731
  place-content: center;
649
732
  place-items: center;
650
733
  box-sizing: border-box;
651
- width: 26px;
652
- height: 24px;
734
+ width: 24px;
735
+ height: 22px;
653
736
  margin: 0;
654
737
  padding: 0;
655
738
  border: 0;
@@ -657,28 +740,58 @@
657
740
  background: transparent;
658
741
  color: var(--_inkkit-muted);
659
742
  cursor: pointer;
660
- opacity: 0;
661
- transition: opacity 120ms;
743
+ z-index: 2;
662
744
  user-select: none;
663
745
  }
664
746
 
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
747
  .inkkit-root .ProseMirror pre .inkkit-copy:hover {
672
748
  background: color-mix(in srgb, CanvasText 10%, transparent);
673
749
  color: var(--_inkkit-text);
674
750
  }
675
751
 
676
- .inkkit-root .ProseMirror pre code {
752
+ .inkkit-root .ProseMirror pre > code {
753
+ display: block;
754
+ overflow-x: auto;
755
+ white-space: pre;
756
+ overflow-wrap: normal;
677
757
  background: none;
678
758
  padding: 0;
679
759
  font-size: inherit;
680
760
  }
681
761
 
762
+ .inkkit-root .ProseMirror pre.inkkit-code-wrapped > code {
763
+ white-space: pre-wrap;
764
+ overflow-wrap: anywhere;
765
+ }
766
+
767
+ .inkkit-root .ProseMirror pre .inkkit-code-controls,
768
+ .inkkit-root .ProseMirror pre .inkkit-copy {
769
+ opacity: 0;
770
+ pointer-events: none;
771
+ transition: opacity 120ms;
772
+ }
773
+
774
+ .inkkit-root .ProseMirror pre:hover .inkkit-code-controls,
775
+ .inkkit-root .ProseMirror pre:hover .inkkit-copy,
776
+ .inkkit-root .ProseMirror pre:focus-within .inkkit-code-controls,
777
+ .inkkit-root .ProseMirror pre:focus-within .inkkit-copy,
778
+ .inkkit-root
779
+ .ProseMirror
780
+ pre:has(.inkkit-code-language[aria-expanded='true'])
781
+ .inkkit-code-controls,
782
+ .inkkit-root
783
+ .ProseMirror
784
+ pre:has(.inkkit-code-language[aria-expanded='true'])
785
+ .inkkit-copy,
786
+ .inkkit-root
787
+ .ProseMirror-focused
788
+ pre[data-inkkit-code-active]
789
+ .inkkit-code-controls,
790
+ .inkkit-root .ProseMirror-focused pre[data-inkkit-code-active] .inkkit-copy {
791
+ opacity: 1;
792
+ pointer-events: auto;
793
+ }
794
+
682
795
  .inkkit-root .ProseMirror blockquote {
683
796
  position: relative;
684
797
  margin: 0 0 calc(var(--_inkkit-font-size) * 0.8);
@@ -1220,35 +1333,43 @@
1220
1333
 
1221
1334
  .inkkit-root .inkkit-code-controls {
1222
1335
  position: absolute;
1223
- top: 6px;
1224
- right: 38px;
1336
+ top: 4px;
1337
+ z-index: 2;
1338
+ right: 34px;
1225
1339
  font:
1226
- 11px/1.4 -apple-system,
1340
+ calc(var(--_inkkit-font-size) * 0.8)/1.4 -apple-system,
1227
1341
  system-ui,
1228
1342
  sans-serif;
1229
1343
  white-space: normal;
1230
1344
  user-select: none;
1231
1345
  }
1346
+ .inkkit-root .inkkit-code-controls:has([aria-expanded='true']) {
1347
+ z-index: 50;
1348
+ }
1349
+ .inkkit-root pre:not(:has(.inkkit-copy)) .inkkit-code-controls {
1350
+ right: 6px;
1351
+ }
1232
1352
  .inkkit-root .inkkit-code-language {
1233
1353
  display: inline-flex;
1234
1354
  align-items: center;
1235
1355
  gap: 5px;
1236
- height: 24px;
1356
+ height: 22px;
1237
1357
  padding: 0 6px;
1238
1358
  border: 0;
1239
1359
  border-radius: 5px;
1240
1360
  background: transparent;
1241
- color: var(--_inkkit-muted);
1361
+ color: color-mix(in srgb, var(--_inkkit-text) 50%, var(--_inkkit-muted));
1242
1362
  font: inherit;
1243
1363
  cursor: pointer;
1244
1364
  }
1245
- .inkkit-root .inkkit-code-language svg {
1365
+ .inkkit-root .inkkit-code-language svg,
1366
+ .inkkit-root .inkkit-code-wrap svg {
1246
1367
  flex-shrink: 0;
1247
1368
  width: 12px;
1248
1369
  height: 12px;
1249
1370
  fill: none;
1250
1371
  stroke: currentColor;
1251
- stroke-width: 1.25;
1372
+ stroke-width: 1.5;
1252
1373
  stroke-linecap: round;
1253
1374
  stroke-linejoin: round;
1254
1375
  }
@@ -1256,7 +1377,8 @@
1256
1377
  background: color-mix(in srgb, CanvasText 7%, transparent);
1257
1378
  }
1258
1379
  .inkkit-root .inkkit-code-language:focus-visible,
1259
- .inkkit-root .inkkit-copy:focus-visible {
1380
+ .inkkit-root .inkkit-copy:focus-visible,
1381
+ .inkkit-root .inkkit-code-wrap:focus-visible {
1260
1382
  outline: var(--inkkit-focus-width, 2px) solid
1261
1383
  var(--inkkit-focus-color, var(--_inkkit-accent));
1262
1384
  outline-offset: var(--inkkit-focus-offset, 1px);
@@ -1266,38 +1388,74 @@
1266
1388
  z-index: 50;
1267
1389
  display: flex;
1268
1390
  flex-direction: column;
1269
- width: 220px;
1270
- max-height: min(320px, 50vh);
1271
- padding: 6px;
1391
+ width: 200px;
1392
+ max-height: min(264px, 50vh);
1393
+ padding: 0;
1272
1394
  box-sizing: border-box;
1273
1395
  border: 1px solid color-mix(in srgb, CanvasText 15%, transparent);
1274
- border-radius: 8px;
1275
- background: Canvas;
1276
- color: CanvasText;
1396
+ border-radius: 10px;
1397
+ background: color-mix(in srgb, CanvasText 4%, Canvas);
1398
+ color: color-mix(in srgb, CanvasText 80%, Canvas);
1277
1399
  box-shadow: 0 6px 20px #0002;
1278
1400
  }
1279
1401
  .inkkit-root .inkkit-code-language-menu input {
1280
1402
  box-sizing: border-box;
1281
1403
  min-width: 0;
1282
1404
  width: 100%;
1283
- padding: 7px 8px;
1284
- border: 1px solid color-mix(in srgb, CanvasText 12%, transparent);
1405
+ padding: 4px 2px;
1406
+ height: 28px;
1407
+ border: 0;
1285
1408
  border-radius: 5px;
1286
- background: color-mix(in srgb, CanvasText 3%, transparent);
1409
+ background: transparent;
1287
1410
  color: inherit;
1288
1411
  font: inherit;
1289
1412
  }
1413
+ .inkkit-root .inkkit-code-language-search {
1414
+ display: flex;
1415
+ flex-shrink: 0;
1416
+ align-items: center;
1417
+ gap: 4px;
1418
+ padding: 4px 6px 4px 10px;
1419
+ border-bottom: 1px solid color-mix(in srgb, CanvasText 10%, transparent);
1420
+ }
1421
+ .inkkit-root .inkkit-code-wrap {
1422
+ display: grid;
1423
+ place-items: center;
1424
+ flex: 0 0 24px;
1425
+ width: 24px;
1426
+ height: 24px;
1427
+ padding: 0;
1428
+ border: 0;
1429
+ border-radius: 5px;
1430
+ background: transparent;
1431
+ color: var(--_inkkit-muted);
1432
+ cursor: pointer;
1433
+ }
1434
+ .inkkit-root .inkkit-code-wrap svg {
1435
+ width: 16px;
1436
+ height: 16px;
1437
+ stroke-width: 1.75;
1438
+ }
1439
+ .inkkit-root .inkkit-code-wrap:hover,
1440
+ .inkkit-root .inkkit-code-wrap[aria-pressed='true'],
1441
+ .inkkit-root .inkkit-code-language[aria-expanded='true'] {
1442
+ background: color-mix(in srgb, CanvasText 10%, transparent);
1443
+ }
1444
+ .inkkit-root .inkkit-code-language[aria-expanded='true'] svg {
1445
+ transform: rotate(180deg);
1446
+ }
1290
1447
  .inkkit-root .inkkit-code-language-list {
1291
1448
  display: flex;
1292
1449
  flex-direction: column;
1293
1450
  overflow-y: auto;
1294
- padding: 4px 0 0;
1451
+ padding: 4px;
1452
+ min-height: 0;
1295
1453
  }
1296
1454
  .inkkit-root .inkkit-code-language-list button {
1297
1455
  flex-shrink: 0;
1298
- padding: 5px 8px;
1456
+ padding: 6px 8px;
1299
1457
  border: 0;
1300
- border-radius: 4px;
1458
+ border-radius: 6px;
1301
1459
  background: transparent;
1302
1460
  color: inherit;
1303
1461
  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.2",
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",