@aicayzer/inkkit 0.1.3 → 0.1.5

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 { a as Decoration, c as PluginKey, d as __toESM, i as $prose, o as DecorationSet, s as Plugin, u as __commonJSMin } from "./core-Bvj0PMMi.js";
1
+ import { a as Decoration, c as PluginKey, d as __toESM, i as $prose, o as DecorationSet, s as Plugin, u as __commonJSMin } from "./core-D7n0IhAZ.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) {
@@ -14023,7 +14023,8 @@ var lowlight = createLowlight(grammars);
14023
14023
  function blockDecorations(node, pos, deadline) {
14024
14024
  const language = String(node.attrs.language ?? "").toLowerCase();
14025
14025
  const found = [];
14026
- if (!language || !lowlight.registered(language)) return found;
14026
+ if (language && !lowlight.registered(language)) return found;
14027
+ if (!language && node.content.size > 500) return found;
14027
14028
  if (node.content.size > 5e3 || performance.now() > deadline) return found;
14028
14029
  let offset = pos + 1;
14029
14030
  const walk = (children, classes) => {
@@ -14036,7 +14037,7 @@ function blockDecorations(node, pos, deadline) {
14036
14037
  walk(child.children, [...classes, ...own]);
14037
14038
  }
14038
14039
  };
14039
- walk(lowlight.highlight(language, node.textContent).children, []);
14040
+ walk((language ? lowlight.highlight(language, node.textContent) : lowlight.highlightAuto(node.textContent)).children, []);
14040
14041
  return found;
14041
14042
  }
14042
14043
  function decorations(doc) {
package/dist/core.js CHANGED
@@ -1,2 +1,2 @@
1
- import { r as InkKitError, t as InkKitEditor } from "./chunks/core-Bvj0PMMi.js";
1
+ import { r as InkKitError, t as InkKitEditor } from "./chunks/core-D7n0IhAZ.js";
2
2
  export { InkKitEditor, InkKitError };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as registerMermaid, r as InkKitError, t as InkKitEditor } from "./chunks/core-Bvj0PMMi.js";
1
+ import { n as registerMermaid, r as InkKitError, t as InkKitEditor } from "./chunks/core-D7n0IhAZ.js";
2
2
  //#region src/index.ts
3
3
  registerMermaid(async () => (await import("mermaid")).default);
4
4
  //#endregion
package/dist/style.css CHANGED
@@ -554,20 +554,6 @@
554
554
  padding-top: max(calc(var(--inkkit-font-size, 15px) * 2), 30px);
555
555
  }
556
556
 
557
- .inkkit-root .ProseMirror pre[data-language]::before {
558
- content: attr(data-language);
559
- position: absolute;
560
- top: calc(var(--inkkit-font-size, 15px) * 0.533);
561
- left: calc(var(--inkkit-font-size, 15px) * 0.933);
562
- font:
563
- calc(var(--inkkit-font-size, 15px) * 0.733)/1 -apple-system,
564
- system-ui,
565
- sans-serif;
566
- color: var(--_inkkit-muted);
567
- text-transform: lowercase;
568
- user-select: none;
569
- }
570
-
571
557
  .inkkit-root .ProseMirror pre .inkkit-copy {
572
558
  position: absolute;
573
559
  top: 6px;
@@ -582,7 +568,7 @@
582
568
  padding: 0;
583
569
  border: 0;
584
570
  border-radius: 6px;
585
- background: color-mix(in srgb, CanvasText 10%, transparent);
571
+ background: transparent;
586
572
  color: var(--_inkkit-muted);
587
573
  cursor: pointer;
588
574
  opacity: 0;
@@ -591,11 +577,13 @@
591
577
  }
592
578
 
593
579
  .inkkit-root .ProseMirror pre:hover .inkkit-copy,
580
+ .inkkit-root .ProseMirror pre:focus-within .inkkit-copy,
594
581
  .inkkit-root .ProseMirror pre .inkkit-copy[data-copied] {
595
582
  opacity: 1;
596
583
  }
597
584
 
598
585
  .inkkit-root .ProseMirror pre .inkkit-copy:hover {
586
+ background: color-mix(in srgb, CanvasText 10%, transparent);
599
587
  color: var(--_inkkit-text);
600
588
  }
601
589
 
@@ -896,7 +884,8 @@
896
884
  .inkkit-root .inkkit-comment,
897
885
  .inkkit-root [data-inkkit-callout-toggle],
898
886
  .inkkit-root .ProseMirror pre .inkkit-copy,
899
- .inkkit-root .inkkit-table-controls {
887
+ .inkkit-root .inkkit-table-controls,
888
+ .inkkit-root .inkkit-code-controls {
900
889
  display: none !important;
901
890
  }
902
891
 
@@ -1001,3 +990,85 @@
1001
990
  clip-path: inset(50%);
1002
991
  overflow: hidden;
1003
992
  }
993
+
994
+ .inkkit-root .inkkit-code-controls {
995
+ position: absolute;
996
+ top: 6px;
997
+ right: 38px;
998
+ font:
999
+ 11px/1.4 -apple-system,
1000
+ system-ui,
1001
+ sans-serif;
1002
+ white-space: normal;
1003
+ user-select: none;
1004
+ }
1005
+ .inkkit-root .inkkit-code-language {
1006
+ height: 24px;
1007
+ padding: 0 6px;
1008
+ border: 0;
1009
+ border-radius: 5px;
1010
+ background: transparent;
1011
+ color: var(--_inkkit-muted);
1012
+ font: inherit;
1013
+ cursor: pointer;
1014
+ }
1015
+ .inkkit-root .inkkit-code-language::after {
1016
+ content: '⌄';
1017
+ margin-left: 5px;
1018
+ }
1019
+ .inkkit-root .inkkit-code-language:hover {
1020
+ background: color-mix(in srgb, CanvasText 7%, transparent);
1021
+ }
1022
+ .inkkit-root .inkkit-code-language:focus-visible,
1023
+ .inkkit-root .inkkit-copy:focus-visible {
1024
+ outline: 2px solid var(--_inkkit-accent);
1025
+ outline-offset: 1px;
1026
+ }
1027
+ .inkkit-root .inkkit-code-language-menu {
1028
+ position: fixed;
1029
+ z-index: 50;
1030
+ display: flex;
1031
+ flex-direction: column;
1032
+ width: 220px;
1033
+ max-height: min(320px, 50vh);
1034
+ padding: 5px;
1035
+ box-sizing: border-box;
1036
+ border: 1px solid color-mix(in srgb, CanvasText 15%, transparent);
1037
+ border-radius: 8px;
1038
+ background: Canvas;
1039
+ color: CanvasText;
1040
+ box-shadow: 0 6px 20px #0002;
1041
+ }
1042
+ .inkkit-root .inkkit-code-language-menu input {
1043
+ box-sizing: border-box;
1044
+ min-width: 0;
1045
+ width: 100%;
1046
+ padding: 7px;
1047
+ border: 0;
1048
+ border-bottom: 1px solid color-mix(in srgb, CanvasText 12%, transparent);
1049
+ background: transparent;
1050
+ color: inherit;
1051
+ font: inherit;
1052
+ }
1053
+ .inkkit-root .inkkit-code-language-list {
1054
+ display: flex;
1055
+ flex-direction: column;
1056
+ overflow-y: auto;
1057
+ padding-top: 4px;
1058
+ }
1059
+ .inkkit-root .inkkit-code-language-list button {
1060
+ flex-shrink: 0;
1061
+ padding: 5px 8px;
1062
+ border: 0;
1063
+ border-radius: 4px;
1064
+ background: transparent;
1065
+ color: inherit;
1066
+ font: inherit;
1067
+ text-align: left;
1068
+ cursor: pointer;
1069
+ }
1070
+ .inkkit-root .inkkit-code-language-list button:hover,
1071
+ .inkkit-root .inkkit-code-language-list button:focus-visible,
1072
+ .inkkit-root .inkkit-code-language-list button[aria-pressed='true'] {
1073
+ background: color-mix(in srgb, CanvasText 8%, transparent);
1074
+ }
package/dist/types.d.ts CHANGED
@@ -255,6 +255,10 @@ export interface EditorLabels {
255
255
  sourceEditor: string;
256
256
  placeholder: string;
257
257
  copyCode: string;
258
+ codeLanguage: string;
259
+ codeLanguageSearch: string;
260
+ codeAuto: string;
261
+ codePlainText: string;
258
262
  expandCallout: string;
259
263
  collapseCallout: string;
260
264
  diagramRendering: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicayzer/inkkit",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "A preserving Markdown editor for offline web views and the web",
5
5
  "license": "MIT",
6
6
  "type": "module",