interactive-markdown 0.1.1 → 0.3.0

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/styles/app.css CHANGED
@@ -103,6 +103,7 @@ body {
103
103
  display: grid;
104
104
  grid-template-columns: 1fr 1fr;
105
105
  min-height: 0;
106
+ min-width: 0;
106
107
  }
107
108
 
108
109
  @media (max-width: 900px) {
@@ -110,12 +111,17 @@ body {
110
111
  grid-template-columns: 1fr;
111
112
  grid-template-rows: 45vh 1fr;
112
113
  }
114
+
115
+ .im-graph-canvas {
116
+ max-height: 22rem;
117
+ }
113
118
  }
114
119
 
115
120
  .pane {
116
121
  display: flex;
117
122
  flex-direction: column;
118
123
  min-height: 0;
124
+ min-width: 0;
119
125
  border-right: 1px solid var(--border);
120
126
  }
121
127
 
@@ -133,9 +139,44 @@ body {
133
139
  background: #0c1424;
134
140
  }
135
141
 
136
- #editor {
142
+ .pane-tabs {
143
+ display: flex;
144
+ border-bottom: 1px solid var(--border);
145
+ background: #0c1424;
146
+ }
147
+
148
+ .pane-tabs button {
149
+ font: inherit;
150
+ font-size: 0.75rem;
151
+ letter-spacing: 0.06em;
152
+ text-transform: uppercase;
153
+ color: var(--muted);
154
+ background: transparent;
155
+ border: 0;
156
+ border-bottom: 2px solid transparent;
157
+ padding: 0.65rem 0.95rem;
158
+ cursor: pointer;
159
+ }
160
+
161
+ .pane-tabs button[aria-selected="true"] {
162
+ color: var(--text);
163
+ border-bottom-color: var(--accent);
164
+ }
165
+
166
+ #editor,
167
+ #graph-editor {
137
168
  flex: 1;
138
169
  width: 100%;
170
+ min-width: 0;
171
+ min-height: 0;
172
+ }
173
+
174
+ #editor[hidden],
175
+ #graph-editor[hidden] {
176
+ display: none !important;
177
+ }
178
+
179
+ #editor {
139
180
  resize: none;
140
181
  border: 0;
141
182
  outline: none;
@@ -148,9 +189,16 @@ body {
148
189
  tab-size: 2;
149
190
  }
150
191
 
192
+ #graph-editor {
193
+ overflow: auto;
194
+ padding: 0.85rem 1rem 1.5rem;
195
+ background: var(--panel-2);
196
+ }
197
+
151
198
  #preview {
152
199
  flex: 1;
153
200
  overflow: auto;
201
+ min-width: 0;
154
202
  padding: 1rem 1.15rem 2rem;
155
203
  background: #0a101c;
156
204
  }
@@ -222,6 +270,8 @@ body {
222
270
  /* IVM widgets */
223
271
  .im-ivm-host {
224
272
  margin: 1.1rem 0 1.4rem;
273
+ min-width: 0;
274
+ max-width: 100%;
225
275
  }
226
276
 
227
277
  .im-ivm {
@@ -319,6 +369,34 @@ body {
319
369
  margin: 0 auto;
320
370
  }
321
371
 
372
+ /* A figure with no controls (self-animated SVG) fills the preview instead of the widget card. */
373
+ .im-ivm-static {
374
+ max-width: none;
375
+ background: transparent;
376
+ border: none;
377
+ padding: 0;
378
+ }
379
+
380
+ .im-ivm-static .im-svg-host {
381
+ background: transparent;
382
+ border: none;
383
+ padding: 0;
384
+ border-radius: 16px;
385
+ overflow: hidden;
386
+ }
387
+
388
+ /* XY plots: white chart card, no dark SVG stage */
389
+ .im-ivm-plot .im-svg-host {
390
+ background: #ffffff;
391
+ border: 1px solid #e5e7eb;
392
+ padding: 0.35rem;
393
+ }
394
+
395
+ .im-ivm-plot {
396
+ max-width: 640px;
397
+ }
398
+
399
+
322
400
  .im-errors {
323
401
  white-space: pre-wrap;
324
402
  color: var(--danger);
@@ -334,3 +412,583 @@ body {
334
412
  #file-input {
335
413
  display: none;
336
414
  }
415
+
416
+ /* Graph editor — node box matches NODE_W / NODE_H in src/graph-editor.js */
417
+ .im-ivm-graph {
418
+ max-width: none;
419
+ background: transparent;
420
+ border: none;
421
+ padding: 0;
422
+ }
423
+
424
+ .im-graph {
425
+ display: flex;
426
+ flex-direction: column;
427
+ gap: 0.55rem;
428
+ min-width: 0;
429
+ max-width: 100%;
430
+ }
431
+
432
+ .im-graph-bar {
433
+ display: flex;
434
+ flex-wrap: wrap;
435
+ align-items: center;
436
+ gap: 0.45rem;
437
+ }
438
+
439
+ .im-graph-bar button,
440
+ .im-graph-kind-label select,
441
+ .im-graph-kind-label input {
442
+ font: inherit;
443
+ font-size: 0.8rem;
444
+ border-radius: 8px;
445
+ border: 1px solid var(--border);
446
+ background: var(--panel-2);
447
+ color: var(--text);
448
+ padding: 0.35rem 0.65rem;
449
+ cursor: pointer;
450
+ }
451
+
452
+ .im-graph-bar button[data-action="add"] {
453
+ background: linear-gradient(135deg, #0ea5e9, #6366f1);
454
+ border-color: transparent;
455
+ color: white;
456
+ font-weight: 600;
457
+ }
458
+
459
+ .im-graph-bar button:disabled {
460
+ opacity: 0.45;
461
+ cursor: default;
462
+ }
463
+
464
+ .im-graph-motion-bar {
465
+ display: flex;
466
+ flex-wrap: wrap;
467
+ align-items: center;
468
+ gap: 0.45rem;
469
+ }
470
+
471
+ .im-graph-motion-bar[hidden] {
472
+ display: none !important;
473
+ }
474
+
475
+ .im-graph-kind-label {
476
+ display: inline-flex;
477
+ align-items: center;
478
+ gap: 0.35rem;
479
+ font-size: 0.8rem;
480
+ color: var(--muted);
481
+ }
482
+
483
+ .im-graph-kind-label input {
484
+ width: 4.5rem;
485
+ cursor: text;
486
+ }
487
+
488
+ .im-graph-count {
489
+ margin-left: auto;
490
+ font-family: var(--mono);
491
+ font-size: 0.75rem;
492
+ color: var(--muted);
493
+ }
494
+
495
+ .im-graph-help {
496
+ margin: 0;
497
+ color: var(--muted);
498
+ font-size: 0.78rem;
499
+ line-height: 1.4;
500
+ }
501
+
502
+ .im-graph-canvas {
503
+ width: 100%;
504
+ max-width: 100%;
505
+ overflow: auto;
506
+ max-height: 32rem;
507
+ border: 1px solid var(--border);
508
+ border-radius: 12px;
509
+ background:
510
+ radial-gradient(circle, #1e293b 1px, transparent 1.2px) 0 0 / 16px 16px,
511
+ #020617;
512
+ outline: none;
513
+ user-select: none;
514
+ }
515
+
516
+ .im-graph-canvas:focus {
517
+ border-color: #334155;
518
+ box-shadow: inset 0 0 0 1px #334155;
519
+ }
520
+
521
+ .im-graph-stage {
522
+ position: relative;
523
+ min-width: 100%;
524
+ }
525
+
526
+ .im-graph-edges {
527
+ position: absolute;
528
+ inset: 0;
529
+ width: 100%;
530
+ height: 100%;
531
+ overflow: visible;
532
+ pointer-events: none;
533
+ }
534
+
535
+ .im-graph-edge-hit {
536
+ fill: none;
537
+ stroke: transparent;
538
+ stroke-width: 14;
539
+ pointer-events: stroke;
540
+ cursor: pointer;
541
+ }
542
+
543
+ .im-graph-edge {
544
+ fill: none;
545
+ stroke: #8ea2d8;
546
+ stroke-width: 1.75;
547
+ stroke-linecap: round;
548
+ stroke-linejoin: round;
549
+ pointer-events: none;
550
+ }
551
+
552
+ .im-graph-edge.is-selected {
553
+ stroke: #dbe4ff;
554
+ stroke-width: 2.4;
555
+ }
556
+
557
+ .im-graph-edge.is-animated {
558
+ stroke-dasharray: 6 8;
559
+ animation: im-graph-march 1.2s linear infinite;
560
+ }
561
+
562
+ .im-graph-edge.is-animated.is-reverse {
563
+ animation-direction: reverse;
564
+ }
565
+
566
+ .im-graph-motion {
567
+ pointer-events: none;
568
+ }
569
+
570
+ .im-graph-stage.is-animated .im-graph-node {
571
+ animation: im-graph-pulse 2.4s ease-in-out infinite;
572
+ }
573
+
574
+ @keyframes im-graph-march {
575
+ to {
576
+ stroke-dashoffset: -28;
577
+ }
578
+ }
579
+
580
+ @keyframes im-graph-pulse {
581
+ 0%,
582
+ 100% {
583
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28), 0 0 0 0 rgba(56, 189, 248, 0);
584
+ }
585
+ 50% {
586
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28), 0 0 0 4px rgba(56, 189, 248, 0.35);
587
+ }
588
+ }
589
+
590
+ @media (prefers-reduced-motion: reduce) {
591
+ .im-graph-edge.is-animated,
592
+ .im-graph-stage.is-animated .im-graph-node {
593
+ animation: none;
594
+ }
595
+
596
+ .im-graph-edge.is-animated {
597
+ stroke-dasharray: none;
598
+ }
599
+
600
+ .im-graph-motion {
601
+ display: none;
602
+ }
603
+ }
604
+
605
+ .im-graph-edge-temp {
606
+ stroke: #7dd3fc;
607
+ stroke-dasharray: 5 4;
608
+ pointer-events: none;
609
+ }
610
+
611
+ .im-graph-empty {
612
+ position: absolute;
613
+ inset: 0;
614
+ display: flex;
615
+ align-items: center;
616
+ justify-content: center;
617
+ padding: 1.5rem;
618
+ text-align: center;
619
+ color: var(--muted);
620
+ pointer-events: none;
621
+ }
622
+
623
+ .im-graph-empty[hidden] {
624
+ display: none;
625
+ }
626
+
627
+ .im-graph-node {
628
+ position: absolute;
629
+ top: 0;
630
+ left: 0;
631
+ z-index: 1;
632
+ display: flex;
633
+ align-items: center;
634
+ justify-content: center;
635
+ width: 168px;
636
+ height: 56px;
637
+ padding: 0 18px;
638
+ border: 1px solid #334155;
639
+ border-radius: 12px;
640
+ background: #111827;
641
+ color: var(--text);
642
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
643
+ cursor: grab;
644
+ touch-action: none;
645
+ }
646
+
647
+ .im-graph-node.is-selected {
648
+ border-color: #38bdf8;
649
+ box-shadow: 0 0 0 1px #38bdf8, 0 8px 20px rgba(0, 0, 0, 0.28);
650
+ }
651
+
652
+ .im-graph-kind-input {
653
+ border-radius: 28px;
654
+ background: #0c1f33;
655
+ border-color: #0369a1;
656
+ }
657
+
658
+ .im-graph-kind-output {
659
+ background: #102318;
660
+ border-color: #166534;
661
+ }
662
+
663
+ .im-graph-kind-decision {
664
+ background: transparent;
665
+ border-color: transparent;
666
+ box-shadow: none;
667
+ }
668
+
669
+ .im-graph-kind-decision.is-selected {
670
+ box-shadow: none;
671
+ }
672
+
673
+ .im-graph-diamond {
674
+ position: absolute;
675
+ inset: 1px 6px;
676
+ z-index: 0;
677
+ background: #8b7cc8;
678
+ clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
679
+ }
680
+
681
+ .im-graph-diamond::after {
682
+ content: "";
683
+ position: absolute;
684
+ inset: 1.5px;
685
+ background: #1a1530;
686
+ clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
687
+ }
688
+
689
+ .im-graph-kind-decision.is-selected .im-graph-diamond {
690
+ background: #c4b5fd;
691
+ }
692
+
693
+ .im-graph-label {
694
+ position: relative;
695
+ z-index: 1;
696
+ flex: 1;
697
+ min-width: 0;
698
+ overflow: hidden;
699
+ text-overflow: ellipsis;
700
+ white-space: nowrap;
701
+ font-size: 0.86rem;
702
+ text-align: center;
703
+ }
704
+
705
+ .im-graph-port {
706
+ position: absolute;
707
+ z-index: 2;
708
+ width: 12px;
709
+ height: 12px;
710
+ padding: 0;
711
+ border: 2px solid #8ea2d8;
712
+ border-radius: 50%;
713
+ background: #0f172a;
714
+ cursor: crosshair;
715
+ }
716
+
717
+ .im-graph-port-left {
718
+ top: 50%;
719
+ left: -6px;
720
+ margin-top: -6px;
721
+ }
722
+
723
+ .im-graph-port-right {
724
+ top: 50%;
725
+ right: -6px;
726
+ margin-top: -6px;
727
+ }
728
+
729
+ .im-graph-port-top {
730
+ top: -6px;
731
+ left: 50%;
732
+ margin-left: -6px;
733
+ }
734
+
735
+ .im-graph-port-bottom {
736
+ bottom: -6px;
737
+ left: 50%;
738
+ margin-left: -6px;
739
+ }
740
+
741
+ .im-graph-port:hover,
742
+ .im-graph-port:focus-visible {
743
+ background: #38bdf8;
744
+ border-color: #e0f2fe;
745
+ }
746
+
747
+ .im-graph-rename {
748
+ position: relative;
749
+ z-index: 2;
750
+ width: 100%;
751
+ padding: 0.2rem 0.3rem;
752
+ border: 1px solid #38bdf8;
753
+ border-radius: 6px;
754
+ background: #020617;
755
+ color: var(--text);
756
+ font: inherit;
757
+ font-size: 0.86rem;
758
+ text-align: center;
759
+ }
760
+
761
+ .im-doc {
762
+ display: flex;
763
+ flex-direction: column;
764
+ gap: 0.75rem;
765
+ min-width: 0;
766
+ max-width: 52rem;
767
+ }
768
+
769
+ .im-doc-bar {
770
+ display: flex;
771
+ flex-wrap: wrap;
772
+ align-items: center;
773
+ gap: 0.4rem;
774
+ }
775
+
776
+ .im-doc-add {
777
+ position: relative;
778
+ }
779
+
780
+ .im-doc-menu {
781
+ position: absolute;
782
+ z-index: 6;
783
+ top: calc(100% + 0.35rem);
784
+ left: 0;
785
+ min-width: 14rem;
786
+ max-height: 22rem;
787
+ overflow: auto;
788
+ padding: 0.35rem;
789
+ border: 1px solid var(--border);
790
+ border-radius: var(--radius);
791
+ background: var(--panel);
792
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
793
+ }
794
+
795
+ .im-doc-menu[hidden] {
796
+ display: none !important;
797
+ }
798
+
799
+ .im-doc-menu-group + .im-doc-menu-group {
800
+ margin-top: 0.35rem;
801
+ padding-top: 0.35rem;
802
+ border-top: 1px solid var(--border);
803
+ }
804
+
805
+ .im-doc-menu-label {
806
+ margin: 0.15rem 0.45rem 0.25rem;
807
+ font-size: 0.68rem;
808
+ letter-spacing: 0.06em;
809
+ text-transform: uppercase;
810
+ color: var(--muted);
811
+ }
812
+
813
+ .im-doc-menu button {
814
+ display: block;
815
+ width: 100%;
816
+ text-align: left;
817
+ background: transparent;
818
+ border-color: transparent;
819
+ cursor: grab;
820
+ touch-action: none;
821
+ }
822
+
823
+ .im-doc.is-dragging,
824
+ .im-doc.is-dragging .im-doc-menu button {
825
+ cursor: grabbing;
826
+ }
827
+
828
+ .im-doc-drag-ghost {
829
+ position: fixed;
830
+ z-index: 20;
831
+ pointer-events: none;
832
+ padding: 0.35rem 0.65rem;
833
+ border-radius: 8px;
834
+ border: 1px solid var(--accent);
835
+ background: var(--panel);
836
+ color: var(--text);
837
+ font-size: 0.8rem;
838
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
839
+ }
840
+
841
+ .im-doc-drag-ghost[hidden],
842
+ .im-doc-snap[hidden] {
843
+ display: none !important;
844
+ }
845
+
846
+ .im-doc-snap {
847
+ position: fixed;
848
+ z-index: 15;
849
+ height: 2px;
850
+ margin-top: -1px;
851
+ border-radius: 2px;
852
+ background: var(--accent);
853
+ pointer-events: none;
854
+ box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
855
+ }
856
+
857
+ .im-doc-block.is-snap-target {
858
+ border-color: var(--accent);
859
+ box-shadow: 0 0 0 1px var(--accent);
860
+ }
861
+
862
+ .im-doc-bar button,
863
+ .im-doc-bar select,
864
+ .im-doc-block-bar button,
865
+ .im-doc-sub button,
866
+ .im-doc-field input,
867
+ .im-doc-field textarea,
868
+ .im-doc-field select {
869
+ font: inherit;
870
+ font-size: 0.8rem;
871
+ border-radius: 8px;
872
+ border: 1px solid var(--border);
873
+ background: var(--panel-2);
874
+ color: var(--text);
875
+ padding: 0.35rem 0.65rem;
876
+ }
877
+
878
+ .im-doc-bar button,
879
+ .im-doc-block-bar button,
880
+ .im-doc-sub button {
881
+ cursor: pointer;
882
+ }
883
+
884
+ .im-doc-bar button:hover,
885
+ .im-doc-block-bar button:hover,
886
+ .im-doc-sub button:hover {
887
+ border-color: var(--accent);
888
+ }
889
+
890
+ .im-doc-block-bar button:disabled {
891
+ opacity: 0.45;
892
+ cursor: default;
893
+ }
894
+
895
+ .im-doc-help,
896
+ .im-doc-empty {
897
+ margin: 0;
898
+ color: var(--muted);
899
+ font-size: 0.85rem;
900
+ }
901
+
902
+ .im-doc-empty[hidden] {
903
+ display: none;
904
+ }
905
+
906
+ .im-doc-blocks {
907
+ display: flex;
908
+ flex-direction: column;
909
+ gap: 0.7rem;
910
+ min-width: 0;
911
+ }
912
+
913
+ .im-doc-block {
914
+ display: flex;
915
+ flex-direction: column;
916
+ gap: 0.55rem;
917
+ min-width: 0;
918
+ padding: 0.65rem 0.75rem;
919
+ border: 1px solid var(--border);
920
+ border-radius: var(--radius);
921
+ background: var(--panel);
922
+ }
923
+
924
+ .im-doc-block.is-selected {
925
+ border-color: var(--accent);
926
+ }
927
+
928
+ .im-doc-block-bar {
929
+ display: flex;
930
+ flex-wrap: wrap;
931
+ align-items: center;
932
+ gap: 0.35rem;
933
+ }
934
+
935
+ .im-doc-kind {
936
+ font-weight: 600;
937
+ }
938
+
939
+ .im-doc-summary {
940
+ margin: 0;
941
+ white-space: pre-wrap;
942
+ font-size: 0.92rem;
943
+ }
944
+
945
+ .im-doc-prose {
946
+ margin: 0;
947
+ }
948
+
949
+ .im-doc-inspector {
950
+ display: flex;
951
+ flex-direction: column;
952
+ gap: 0.55rem;
953
+ }
954
+
955
+ .im-doc-field {
956
+ display: flex;
957
+ flex-direction: column;
958
+ gap: 0.2rem;
959
+ font-size: 0.75rem;
960
+ color: var(--muted);
961
+ }
962
+
963
+ .im-doc-field input,
964
+ .im-doc-field textarea,
965
+ .im-doc-field select {
966
+ width: 100%;
967
+ }
968
+
969
+ .im-doc-field input[type="checkbox"] {
970
+ width: auto;
971
+ justify-self: start;
972
+ }
973
+
974
+ .im-doc-sub {
975
+ margin: 0;
976
+ padding: 0.55rem 0.65rem 0.7rem;
977
+ border: 1px solid var(--border);
978
+ border-radius: 8px;
979
+ display: flex;
980
+ flex-direction: column;
981
+ gap: 0.45rem;
982
+ }
983
+
984
+ .im-doc-sub legend {
985
+ padding: 0 0.3rem;
986
+ color: var(--text);
987
+ font-size: 0.8rem;
988
+ }
989
+
990
+ .im-doc-live,
991
+ .im-doc-live-host {
992
+ min-width: 0;
993
+ max-width: 100%;
994
+ }