@salism3/dsh-latex-editor 1.0.0 → 1.1.6

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/README.md CHANGED
@@ -8,7 +8,8 @@ Plugin resmi untuk mengubah **DeepSeek Harness** menjadi lingkungan kerja **LaTe
8
8
 
9
9
  ## Fitur Utama
10
10
 
11
- - **Layar Terpisah (Split Screen)**: Sisi kiri percakapan AI, sisi kanan panel pratinjau dokumen PDF live dan responsif.
11
+ - **Layar Terpisah (Split Screen)**: Sisi kiri percakapan AI, sisi kanan panel pratinjau dokumen PDF live dan responsif di layar desktop.
12
+ - **Mode Mobile Responsif**: Tombol toggle cepat (`📄 PDF` ⟷ `💬 Chat`) dan tombol melayang (FAB) untuk beralih instan antara layar chat dan pratinjau PDF pada perangkat seluler/smartphone.
12
13
  - **Entry Point Baku (`main.tex`)**: Menetapkan `main.tex` di root direktori workspace sebagai titik masuk dokumen tunggal.
13
14
  - **Injeksi Soul (System Prompt)**: AI Harness secara otomatis menyusun dan memperbarui struktur dokumen lengkap dalam `main.tex`.
14
15
  - **Kompilasi Cepat**: Dilengkapi engine `xelatex` (default) dan `pdflatex` dengan panel error log interaktif.
package/client.js CHANGED
@@ -1,8 +1,6 @@
1
- window.__ModuleLoader__.load({
2
- id: '@local/dsh-latex-editor',
3
- factory(require) {
4
- const React = require('react');
5
- const h = React.createElement;
1
+ function defineLatexEditorPlugin(require) {
2
+ const React = require('react');
3
+ const h = React.createElement;
6
4
 
7
5
  const STYLE_ID = 'dsh-latex-editor-styles';
8
6
 
@@ -12,7 +10,7 @@ window.__ModuleLoader__.load({
12
10
 
13
11
  const style = document.createElement('style');
14
12
  style.id = STYLE_ID;
15
- style.dataset.plugin = '@local/dsh-latex-editor';
13
+ style.dataset.plugin = '@salism3/dsh-latex-editor';
16
14
  style.textContent = `
17
15
  /* ==========================================================
18
16
  1. LATEX STUDIO SPLIT PANE STYLES
@@ -30,16 +28,77 @@ window.__ModuleLoader__.load({
30
28
  border-left: 1px solid var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.12));
31
29
  }
32
30
 
31
+ .latex-btn-header-corner {
32
+ display: inline-flex !important;
33
+ align-items: center !important;
34
+ justify-content: center !important;
35
+ width: 30px !important;
36
+ height: 30px !important;
37
+ padding: 0 !important;
38
+ background: transparent !important;
39
+ color: var(--dsw-alias-text-secondary, #a6adc8) !important;
40
+ border: 1px solid transparent !important;
41
+ border-radius: 6px !important;
42
+ cursor: pointer !important;
43
+ transition: all 0.15s ease !important;
44
+ }
45
+
46
+ .latex-btn-header-corner:hover {
47
+ background: var(--dsw-alias-bg-hover, rgba(255, 255, 255, 0.08)) !important;
48
+ color: var(--dsw-alias-text-primary, #ffffff) !important;
49
+ }
50
+
51
+ .latex-btn-header-corner:active {
52
+ transform: scale(0.94) !important;
53
+ }
54
+
55
+ .latex-btn-close {
56
+ margin-left: auto !important;
57
+ color: #94a3b8 !important;
58
+ padding: 4px 8px !important;
59
+ font-size: 13px !important;
60
+ font-weight: 700 !important;
61
+ }
62
+
63
+ .latex-btn-close:hover {
64
+ color: #f87171 !important;
65
+ background: rgba(239, 68, 68, 0.15) !important;
66
+ }
67
+
68
+ /* Sembunyikan sisa tab Mulai / DockKit guide jika ada */
69
+ [data-sidebar-right-tab*="guide"],
70
+ [data-dockkit-tab*="guide"],
71
+ [data-dockkit-float-title*="Mulai"],
72
+ [class*="guideCard"] {
73
+ display: none !important;
74
+ }
75
+
33
76
  .latex-editor-header {
77
+ position: sticky !important;
78
+ top: 0 !important;
79
+ left: 0 !important;
80
+ right: 0 !important;
81
+ z-index: 1000 !important;
34
82
  display: flex;
35
83
  align-items: center;
36
84
  justify-content: space-between;
37
85
  padding: 8px 12px;
38
86
  gap: 8px;
39
- background: var(--dsw-alias-bg-elevated, #1e1e2e);
40
- border-bottom: 1px solid var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.1));
87
+ background: var(--dsw-alias-bg-elevated, #1e1e2e) !important;
88
+ border-bottom: 1px solid var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.15)) !important;
41
89
  flex-shrink: 0;
42
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
90
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
91
+ }
92
+
93
+ /* Saat di conversation.view (misal di mobile): cegah scrollBody menggeser header */
94
+ [class*="viewArea"]:has(.latex-editor-container) {
95
+ height: 100% !important;
96
+ max-height: 100% !important;
97
+ overflow: hidden !important;
98
+ }
99
+
100
+ [class*="scrollBody"]:has(.latex-editor-container) {
101
+ overflow-y: hidden !important;
43
102
  }
44
103
 
45
104
  .latex-header-left {
@@ -452,15 +511,126 @@ window.__ModuleLoader__.load({
452
511
  display: none !important;
453
512
  }
454
513
 
455
- /* Pastikan track rightbar memiliki lebar yang pas untuk editor 50/50 */
456
- [data-rightbar-col] {
457
- min-width: 320px;
514
+ /* ==========================================================
515
+ 3. DESKTOP (>= 768px): 2 KOLOM SECTION TANPA TOMBOL PDF
516
+ ========================================================== */
517
+ @media (min-width: 768px) {
518
+ [data-rightbar-col] {
519
+ min-width: 300px;
520
+ }
521
+
522
+ /* Mode Desktop 2 Kolom: Sembunyikan tab / tombol PDF di header */
523
+ [role="tab"][data-tab-id="latex-pdf"],
524
+ button[role="tab"].latex-tab-pdf-button,
525
+ [role="tab"]:has([data-latex-tab="pdf"]),
526
+ [role="tab"]:has(.latex-tab-pdf) {
527
+ display: none !important;
528
+ }
529
+
530
+ /* Jika hanya tersisa Chat saat PDF disembunyikan, sembunyikan baris tabs */
531
+ [data-conversation-tabs]:has(> [role="tab"]:nth-of-type(2):is(.latex-tab-pdf-button, [data-tab-id="latex-pdf"], :has([data-latex-tab="pdf"]), :has(.latex-tab-pdf))):not(:has(> [role="tab"]:nth-of-type(3))) {
532
+ display: none !important;
533
+ }
534
+ }
535
+
536
+ /* ==========================================================
537
+ 4. MOBILE (< 768px): TAB PDF DI ATAS KANAN
538
+ ========================================================== */
539
+ @media (max-width: 767px) {
540
+ /* Di layar HP, sembunyikan handle resize dan rightbar bawaan */
541
+ [class*="handle"] {
542
+ display: none !important;
543
+ }
544
+ [data-rightbar-col] {
545
+ display: none !important;
546
+ }
547
+ [class*="centerCol"] {
548
+ display: flex !important;
549
+ width: 100vw !important;
550
+ max-width: 100vw !important;
551
+ min-width: 0 !important;
552
+ flex: 1 1 auto !important;
553
+ }
554
+
555
+ /* Header panel PDF di mobile agar tombol toolbar tetap rapi & sticky */
556
+ .latex-editor-header {
557
+ position: sticky !important;
558
+ top: 0 !important;
559
+ z-index: 1000 !important;
560
+ padding: 6px 10px !important;
561
+ gap: 5px !important;
562
+ flex-wrap: nowrap !important;
563
+ overflow-x: auto !important;
564
+ }
565
+
566
+ .latex-header-left {
567
+ gap: 5px !important;
568
+ }
569
+
570
+ .latex-btn-compile {
571
+ padding: 5px 9px !important;
572
+ font-size: 11px !important;
573
+ flex-shrink: 0 !important;
574
+ }
575
+
576
+ .latex-btn-icon {
577
+ padding: 5px 8px !important;
578
+ font-size: 11px !important;
579
+ flex-shrink: 0 !important;
580
+ }
581
+
582
+ .latex-scroll {
583
+ padding: 8px 6px 18px !important;
584
+ gap: 8px !important;
585
+ -webkit-overflow-scrolling: touch !important;
586
+ touch-action: pan-x pan-y pinch-zoom !important;
587
+ }
458
588
  }
459
589
  `;
460
590
  document.head.appendChild(style);
461
591
  }
462
592
 
463
593
  const SCROLL_STORE_KEY = 'dsh-latex-preview-scroll';
594
+ const MOBILE_VIEW_KEY = 'dsh-latex-mobile-view';
595
+
596
+ function getMobileView() {
597
+ if (typeof window === 'undefined') return 'chat';
598
+ try {
599
+ return window.sessionStorage.getItem(MOBILE_VIEW_KEY) === 'pdf' ? 'pdf' : 'chat';
600
+ } catch (e) {
601
+ return 'chat';
602
+ }
603
+ }
604
+
605
+ function setMobileView(view) {
606
+ if (typeof window === 'undefined') return;
607
+ const target = view === 'pdf' ? 'pdf' : 'chat';
608
+ try {
609
+ window.sessionStorage.setItem(MOBILE_VIEW_KEY, target);
610
+ } catch (e) {}
611
+ if (document && document.body) {
612
+ document.body.dataset.latexMobileView = target;
613
+ }
614
+ try {
615
+ window.dispatchEvent(new CustomEvent('latex-mobile-view-change', { detail: { view: target } }));
616
+ } catch (e) {}
617
+ }
618
+
619
+ function useMobileView() {
620
+ const [view, setViewState] = React.useState(getMobileView);
621
+ React.useEffect(() => {
622
+ const handler = (e) => {
623
+ if (e && e.detail && e.detail.view) {
624
+ setViewState(e.detail.view);
625
+ } else {
626
+ setViewState(getMobileView());
627
+ }
628
+ };
629
+ window.addEventListener('latex-mobile-view-change', handler);
630
+ return () => window.removeEventListener('latex-mobile-view-change', handler);
631
+ }, []);
632
+ return [view, setMobileView];
633
+ }
464
634
 
465
635
  function readStoredRatio() {
466
636
  try {
@@ -633,7 +803,7 @@ window.__ModuleLoader__.load({
633
803
  }, [hasPdf, pageCount, pdfMtime, activeWorkspace]);
634
804
 
635
805
  return h('div', { className: 'latex-editor-container' }, [
636
- // 1. Header Toolbar (Hanya compile, log, dan refresh)
806
+ // 1. Header Toolbar (Kompilasi, log, dan refresh)
637
807
  h('div', { className: 'latex-editor-header', key: 'header' }, [
638
808
  // Compile Button
639
809
  h(
@@ -673,6 +843,22 @@ window.__ModuleLoader__.load({
673
843
  },
674
844
  '🔄 Refresh'
675
845
  ),
846
+
847
+ // Tombol Tutup Panel Pratinjau
848
+ h(
849
+ 'button',
850
+ {
851
+ className: 'latex-btn-icon latex-btn-close',
852
+ onClick: () => {
853
+ if (typeof window !== 'undefined' && window.__dshLayout && typeof window.__dshLayout.closeRightbar === 'function') {
854
+ window.__dshLayout.closeRightbar();
855
+ }
856
+ },
857
+ title: 'Tutup Panel Pratinjau PDF',
858
+ key: 'btn-close-pdf',
859
+ },
860
+ '✕'
861
+ ),
676
862
  ]),
677
863
 
678
864
  // 2. Log Drawer (jika terbuka atau kompilasi gagal)
@@ -732,8 +918,16 @@ window.__ModuleLoader__.load({
732
918
  `Hal ${Math.min(currentPage, pageCount)} / ${pageCount}`
733
919
  ),
734
920
  ]
735
- : h('div', { className: 'latex-empty-state' }, [
736
- h(
921
+ : (status?.mainPdfExists
922
+ ? h('iframe', {
923
+ className: 'latex-pdf-iframe',
924
+ src: withWorkspace(`/api/latex/pdf?t=${pdfMtime}`),
925
+ style: { width: '100%', height: '100%', border: 'none', background: '#525659' },
926
+ title: 'Pratinjau PDF',
927
+ key: 'pdf-iframe-fallback',
928
+ })
929
+ : h('div', { className: 'latex-empty-state', key: 'empty' }, [
930
+ h(
737
931
  'svg',
738
932
  {
739
933
  className: 'latex-empty-icon',
@@ -770,7 +964,7 @@ window.__ModuleLoader__.load({
770
964
  },
771
965
  compiling ? 'Membuat & Mengompilasi...' : '📄 Buat Template main.tex & Compile'
772
966
  ),
773
- ])
967
+ ]))
774
968
  ),
775
969
 
776
970
  // 4. Footer Bar
@@ -787,30 +981,99 @@ window.__ModuleLoader__.load({
787
981
  ]);
788
982
  }
789
983
 
790
- return {
984
+ function LatexHeaderCornerToggle() {
985
+ const handleToggle = () => {
986
+ if (!ctx.layout) return;
987
+ try {
988
+ const col = document.querySelector('[data-rightbar-col]');
989
+ const isOpen = col && col.offsetWidth > 40 && window.getComputedStyle(col).display !== 'none';
990
+ if (isOpen) {
991
+ ctx.layout.closeRightbar();
992
+ } else {
993
+ ctx.layout.openRightbar(true, false);
994
+ }
995
+ } catch (e) {
996
+ ctx.layout.openRightbar(true, false);
997
+ }
998
+ };
999
+
1000
+ return h(
1001
+ 'button',
1002
+ {
1003
+ type: 'button',
1004
+ className: 'latex-btn-header-corner',
1005
+ onClick: handleToggle,
1006
+ title: 'Buka / Tutup Pratinjau PDF',
1007
+ 'aria-label': 'Toggle Preview PDF',
1008
+ key: 'latex-corner-toggle',
1009
+ },
1010
+ h(
1011
+ 'svg',
1012
+ {
1013
+ width: 16,
1014
+ height: 16,
1015
+ viewBox: '0 0 24 24',
1016
+ fill: 'none',
1017
+ stroke: 'currentColor',
1018
+ strokeWidth: 2,
1019
+ strokeLinecap: 'round',
1020
+ strokeLinejoin: 'round',
1021
+ },
1022
+ [
1023
+ h('rect', { x: 3, y: 3, width: 18, height: 18, rx: 2, ry: 2, key: 'r' }),
1024
+ h('line', { x1: 15, y1: 3, x2: 15, y2: 21, key: 'l' }),
1025
+ ]
1026
+ )
1027
+ );
1028
+ }
1029
+
1030
+ const pluginInstance = {
791
1031
  inject: ['slots', 'layout'],
792
1032
  apply(ctx) {
793
- // 1. Suntikkan stylesheet kustom untuk layout split & pembersihan fitur non-essential
794
- injectStyles();
1033
+ // 1. Simpan layout helper ke window untuk interaksi UI
1034
+ if (typeof window !== 'undefined') {
1035
+ window.__dshLayout = ctx.layout;
1036
+ }
795
1037
 
796
- // 2. Pastikan Rightbar selalu terbuka dengan track terpasang (Split Screen)
797
- if (ctx.layout && typeof ctx.layout.openRightbar === 'function') {
798
- const ensureSplit = () => {
799
- try {
800
- ctx.layout.openRightbar(true, false);
801
- } catch (e) {}
802
- };
1038
+ // 2. Suntikkan stylesheet kustom untuk layout split, responsive mobile, & pembersihan fitur non-essential
1039
+ injectStyles();
803
1040
 
804
- ensureSplit();
1041
+ // 3. Inisialisasi status tampilan mobile pada dokumen
1042
+ if (typeof document !== 'undefined' && document.body) {
1043
+ document.body.dataset.latexMobileView = getMobileView();
1044
+ }
805
1045
 
806
- // Pertahankan split screen aktif saat terjadi perpindahan view atau session
807
- const interval = setInterval(ensureSplit, 1500);
808
- ctx.effect(() => () => clearInterval(interval));
1046
+ // 4. Buka split screen di desktop saat pertama kali memuat
1047
+ if (ctx.layout && typeof ctx.layout.openRightbar === 'function') {
1048
+ try {
1049
+ ctx.layout.openRightbar(true, false);
1050
+ } catch (e) {}
809
1051
  }
810
1052
 
811
- // 3. Daftarkan panel pratinjau PDF ke dalam slot 'rightbar' dengan prioritas tertinggi (prioritas angka terendah menang)
1053
+ // 5. Daftarkan panel pratinjau PDF ke dalam slot 'rightbar' & slot tab DockKit 'sidebar.right.pane.tab'
812
1054
  if (ctx.slots && typeof ctx.slots.inject === 'function') {
813
- ctx.slots.inject('root', () =>
1055
+ // Gantikan tab 'Mulai' bawaan di sidebar kanan dengan Pratinjau PDF LaTeX
1056
+ ctx.slots.inject('sidebar.right.pane.tab', () =>
1057
+ ctx.slots.register(
1058
+ {
1059
+ name: 'sidebar.right.pane.tab',
1060
+ key: '@deepseek-ai/dsh-client-ui-sidebar-right/guide',
1061
+ },
1062
+ LatexPdfPreviewPane
1063
+ )
1064
+ );
1065
+
1066
+ ctx.slots.inject('sidebar.right.pane.tab.title', () =>
1067
+ ctx.slots.register(
1068
+ {
1069
+ name: 'sidebar.right.pane.tab.title',
1070
+ key: '@deepseek-ai/dsh-client-ui-sidebar-right/guide',
1071
+ },
1072
+ () => '📄 Pratinjau PDF'
1073
+ )
1074
+ );
1075
+
1076
+ ctx.slots.inject('rightbar', () =>
814
1077
  ctx.slots.register(
815
1078
  {
816
1079
  name: 'rightbar',
@@ -819,9 +1082,71 @@ window.__ModuleLoader__.load({
819
1082
  LatexPdfPreviewPane
820
1083
  )
821
1084
  );
1085
+
1086
+ // 6. Override tombol toggle corner [|] di kanan atas sesi untuk buka/tutup PDF Preview
1087
+ ctx.slots.inject('conversation.session.header.corner', () =>
1088
+ ctx.slots.register(
1089
+ {
1090
+ name: 'conversation.session.header.corner',
1091
+ priority: -100,
1092
+ },
1093
+ LatexHeaderCornerToggle
1094
+ )
1095
+ );
1096
+
1097
+ // 7. Daftarkan tab PDF ke dalam slot 'conversation.view' (untuk mode mobile)
1098
+ ctx.slots.inject('conversation.view', () =>
1099
+ ctx.slots.register(
1100
+ {
1101
+ name: 'conversation.view',
1102
+ id: 'latex-pdf',
1103
+ order: 20,
1104
+ label: () => 'PDF',
1105
+ },
1106
+ LatexPdfPreviewPane
1107
+ )
1108
+ );
822
1109
  }
823
1110
 
824
- // 4. Tambah workspace: sekali klik langsung membuat workspace + folder,
1111
+ // 6. Kontrol tombol PDF: sembunyikan saat mode desktop (>= 768px), tampilkan saat mobile (< 768px)
1112
+ if (typeof document !== 'undefined') {
1113
+ const updateDesktopPdfTab = () => {
1114
+ const isDesktop = typeof window !== 'undefined' && window.innerWidth >= 768;
1115
+ const tabs = document.querySelectorAll('[role="tab"]');
1116
+ for (const tab of tabs) {
1117
+ const text = (tab.textContent || '').trim();
1118
+ if (text === 'PDF' || text.includes('PDF') || tab.getAttribute('data-tab-id') === 'latex-pdf') {
1119
+ tab.classList.add('latex-tab-pdf-button');
1120
+ tab.setAttribute('data-tab-id', 'latex-pdf');
1121
+ if (isDesktop) {
1122
+ tab.style.setProperty('display', 'none', 'important');
1123
+ } else {
1124
+ tab.style.removeProperty('display');
1125
+ }
1126
+ }
1127
+ }
1128
+ };
1129
+
1130
+ updateDesktopPdfTab();
1131
+ const tabInterval = setInterval(updateDesktopPdfTab, 300);
1132
+ window.addEventListener('resize', updateDesktopPdfTab);
1133
+
1134
+ const removeOldButtons = () => {
1135
+ const old1 = document.getElementById('dsh-latex-top-toggle');
1136
+ if (old1 && old1.parentNode) old1.parentNode.removeChild(old1);
1137
+ const old2 = document.getElementById('dsh-latex-mobile-fab');
1138
+ if (old2 && old2.parentNode) old2.parentNode.removeChild(old2);
1139
+ };
1140
+ removeOldButtons();
1141
+
1142
+ ctx.effect(() => () => {
1143
+ clearInterval(tabInterval);
1144
+ window.removeEventListener('resize', updateDesktopPdfTab);
1145
+ removeOldButtons();
1146
+ });
1147
+ }
1148
+
1149
+ // 7. Tambah workspace: sekali klik langsung membuat workspace + folder,
825
1150
  // tanpa membuka dialog pemilih folder.
826
1151
  if (typeof document !== 'undefined') {
827
1152
  ctx.effect(() => {
@@ -867,5 +1192,23 @@ window.__ModuleLoader__.load({
867
1192
  }
868
1193
  },
869
1194
  };
870
- },
871
- });
1195
+
1196
+ return {
1197
+ __esModule: true,
1198
+ default: pluginInstance,
1199
+ inject: pluginInstance.inject,
1200
+ apply: pluginInstance.apply,
1201
+ };
1202
+ }
1203
+
1204
+ if (typeof window !== 'undefined' && window.__ModuleLoader__ && typeof window.__ModuleLoader__.load === 'function') {
1205
+ window.__ModuleLoader__.load({
1206
+ id: '@local/dsh-latex-editor',
1207
+ factory: defineLatexEditorPlugin,
1208
+ });
1209
+
1210
+ window.__ModuleLoader__.load({
1211
+ id: '@salism3/dsh-latex-editor',
1212
+ factory: defineLatexEditorPlugin,
1213
+ });
1214
+ }
package/cordis.patch.yml CHANGED
@@ -43,10 +43,19 @@
43
43
  - id: entry-customization
44
44
  disabled: true
45
45
 
46
- # 4b. Hilangkan File Explorer (tab file tree pada sidebar kanan).
46
+ # 4b. Hilangkan File Explorer, Terminal, Peramban dari sidebar kanan bawaan.
47
47
  - id: ui-sidebar-files
48
48
  disabled: true
49
49
 
50
+ - id: ui-sidebar-terminal
51
+ disabled: true
52
+
53
+ - id: ui-sidebar-browser
54
+ disabled: true
55
+
56
+ - id: ui-sidebar-documentpreview
57
+ disabled: true
58
+
50
59
  # 4c. Hilangkan tombol "Open in App" (File Explorer bawaan, VS Code, Git Bash di header sesi)
51
60
  - id: ui-open-in-app
52
61
  disabled: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salism3/dsh-latex-editor",
3
- "version": "1.0.0",
3
+ "version": "1.1.6",
4
4
  "description": "DeepSeek Harness LaTeX Editor with AI - Split screen chat & live PDF preview, main.tex compiler, and soul injection",
5
5
  "author": "salism3",
6
6
  "license": "MIT",