athena-ui-js 2.3.0 → 2.4.1

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.
@@ -2559,4 +2559,475 @@ dialog.dialog[open]::backdrop {
2559
2559
  border-bottom: 2px solid var(--athena-muted);
2560
2560
  }
2561
2561
 
2562
+
2563
+ /* ------------------------------------------------------------ Code
2564
+ highlightCode, generateCodeBlock, createCodeEditor and createDiffView. The colours of the tokens are the --athena-tok-* tokens. Line numbers are CSS counters
2565
+ (they are not copied); the editor is a transparent <textarea> over a highlighted <pre> in one scroller, so both must have the same font, padding and tab size. */
2566
+
2567
+ .athena-code,
2568
+ .code-editor-input {
2569
+ font: 0.875rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
2570
+ letter-spacing: normal;
2571
+ tab-size: 4;
2572
+ white-space: pre;
2573
+ overflow-wrap: normal;
2574
+ }
2575
+
2576
+ .athena-code.code-wrap,
2577
+ .code-editor.code-wrap .code-editor-input {
2578
+ white-space: pre-wrap;
2579
+ overflow-wrap: break-word;
2580
+ }
2581
+
2582
+ .athena-code {
2583
+ margin: 0;
2584
+ padding: 10px 0;
2585
+ overflow: auto;
2586
+ border-radius: var(--athena-radius);
2587
+ background: var(--athena-surface-alt);
2588
+ color: var(--athena-fg);
2589
+ counter-reset: line;
2590
+ }
2591
+
2592
+ .athena-code code {
2593
+ display: block;
2594
+ min-width: max-content;
2595
+ font: inherit;
2596
+ }
2597
+
2598
+ .athena-code.code-wrap code {
2599
+ min-width: 0;
2600
+ }
2601
+
2602
+ .code-line {
2603
+ display: block;
2604
+ min-height: 1lh;
2605
+ padding: 0 12px;
2606
+ }
2607
+
2608
+ .tok-comment { color: var(--athena-tok-comment); }
2609
+ .tok-string { color: var(--athena-tok-string); }
2610
+ .tok-number { color: var(--athena-tok-number); }
2611
+ .tok-keyword { color: var(--athena-tok-keyword); }
2612
+ .tok-literal { color: var(--athena-tok-literal); }
2613
+ .tok-function { color: var(--athena-tok-function); }
2614
+ .tok-type { color: var(--athena-tok-type); }
2615
+ .tok-property { color: var(--athena-tok-property); }
2616
+ .tok-tag { color: var(--athena-tok-tag); }
2617
+ .tok-attribute { color: var(--athena-tok-attribute); }
2618
+ .tok-variable { color: var(--athena-tok-variable); }
2619
+ .tok-selector { color: var(--athena-tok-selector); }
2620
+ .tok-meta { color: var(--athena-tok-meta); }
2621
+ .tok-entity { color: var(--athena-tok-entity); }
2622
+ .tok-builtin { color: var(--athena-tok-builtin); }
2623
+ .tok-operator { color: var(--athena-tok-operator); }
2624
+ .tok-punctuation { color: var(--athena-tok-punctuation); }
2625
+ .tok-comment { font-style: italic; }
2626
+ .tok-tag, .tok-keyword { font-weight: 600; }
2627
+
2628
+ .code-digits-1 { --code-gutter: 2ch; }
2629
+ .code-digits-2 { --code-gutter: 2ch; }
2630
+ .code-digits-3 { --code-gutter: 3ch; }
2631
+ .code-digits-4 { --code-gutter: 4ch; }
2632
+ .code-digits-5 { --code-gutter: 5ch; }
2633
+ .code-digits-6 { --code-gutter: 6ch; }
2634
+ .code-digits-7 { --code-gutter: 7ch; }
2635
+
2636
+ .athena-code.has-line-numbers .code-line::before {
2637
+ content: counter(line);
2638
+ counter-increment: line;
2639
+ display: inline-block;
2640
+ position: sticky;
2641
+ left: 0;
2642
+ width: var(--code-gutter, 2ch);
2643
+ margin-right: 1.5ch;
2644
+ text-align: right;
2645
+ text-indent: 0;
2646
+ color: var(--athena-muted);
2647
+ background: var(--athena-surface-alt);
2648
+ user-select: none;
2649
+ }
2650
+
2651
+ .athena-code.has-line-numbers.code-wrap .code-line {
2652
+ padding-left: calc(12px + var(--code-gutter, 2ch) + 1.5ch);
2653
+ text-indent: calc(-1 * (var(--code-gutter, 2ch) + 1.5ch));
2654
+ }
2655
+
2656
+ .code-line.is-highlighted {
2657
+ background: color-mix(in srgb, var(--athena-accent) 14%, transparent);
2658
+ }
2659
+
2660
+ .code-tab-1 .athena-code,
2661
+ .code-tab-1 .code-editor-input { tab-size: 1; }
2662
+ .code-tab-2 .athena-code,
2663
+ .code-tab-2 .code-editor-input { tab-size: 2; }
2664
+ .code-tab-3 .athena-code,
2665
+ .code-tab-3 .code-editor-input { tab-size: 3; }
2666
+ .code-tab-4 .athena-code,
2667
+ .code-tab-4 .code-editor-input { tab-size: 4; }
2668
+ .code-tab-5 .athena-code,
2669
+ .code-tab-5 .code-editor-input { tab-size: 5; }
2670
+ .code-tab-6 .athena-code,
2671
+ .code-tab-6 .code-editor-input { tab-size: 6; }
2672
+ .code-tab-7 .athena-code,
2673
+ .code-tab-7 .code-editor-input { tab-size: 7; }
2674
+ .code-tab-8 .athena-code,
2675
+ .code-tab-8 .code-editor-input { tab-size: 8; }
2676
+ .code-tab-9 .athena-code,
2677
+ .code-tab-9 .code-editor-input { tab-size: 9; }
2678
+ .code-tab-10 .athena-code,
2679
+ .code-tab-10 .code-editor-input { tab-size: 10; }
2680
+ .code-tab-11 .athena-code,
2681
+ .code-tab-11 .code-editor-input { tab-size: 11; }
2682
+ .code-tab-12 .athena-code,
2683
+ .code-tab-12 .code-editor-input { tab-size: 12; }
2684
+ .code-tab-13 .athena-code,
2685
+ .code-tab-13 .code-editor-input { tab-size: 13; }
2686
+ .code-tab-14 .athena-code,
2687
+ .code-tab-14 .code-editor-input { tab-size: 14; }
2688
+ .code-tab-15 .athena-code,
2689
+ .code-tab-15 .code-editor-input { tab-size: 15; }
2690
+ .code-tab-16 .athena-code,
2691
+ .code-tab-16 .code-editor-input { tab-size: 16; }
2692
+
2693
+ /* A block: the language, a copy button, the code */
2694
+ .code-block {
2695
+ margin: 0 0 1rem;
2696
+ border: var(--athena-border-width) solid var(--athena-line);
2697
+ border-radius: var(--athena-radius);
2698
+ overflow: hidden;
2699
+ }
2700
+
2701
+ .code-block-header {
2702
+ display: flex;
2703
+ align-items: center;
2704
+ justify-content: space-between;
2705
+ gap: 8px;
2706
+ padding: 4px 8px 4px 12px;
2707
+ border-bottom: var(--athena-border-width) solid var(--athena-line);
2708
+ background: var(--athena-surface);
2709
+ color: var(--athena-muted);
2710
+ font-size: 0.8rem;
2711
+ }
2712
+
2713
+ .code-block .athena-code {
2714
+ border-radius: 0;
2715
+ }
2716
+
2717
+ .code-block-copy,
2718
+ .code-find-button {
2719
+ padding: 2px 8px;
2720
+ border: var(--athena-border-width) solid var(--athena-line);
2721
+ border-radius: var(--athena-radius);
2722
+ background: var(--athena-bg);
2723
+ color: var(--athena-fg);
2724
+ font: inherit;
2725
+ cursor: pointer;
2726
+ }
2727
+
2728
+ .code-block-copy:hover,
2729
+ .code-find-button:hover {
2730
+ background: var(--athena-hover);
2731
+ }
2732
+
2733
+ .code-block-copy:focus-visible,
2734
+ .code-find-button:focus-visible,
2735
+ .code-find-input:focus-visible,
2736
+ .athena-code:focus-visible {
2737
+ outline: var(--athena-focus-width) solid var(--athena-focus);
2738
+ outline-offset: 1px;
2739
+ }
2740
+
2741
+ /* The editor */
2742
+ .code-editor {
2743
+ position: relative;
2744
+ display: flex;
2745
+ flex-direction: column;
2746
+ border: var(--athena-border-width) solid var(--athena-line);
2747
+ border-radius: var(--athena-radius);
2748
+ background: var(--athena-surface-alt);
2749
+ }
2750
+
2751
+ .code-editor:focus-within {
2752
+ outline: var(--athena-focus-width) solid var(--athena-focus);
2753
+ outline-offset: 1px;
2754
+ }
2755
+
2756
+ .code-editor-scroll {
2757
+ display: grid;
2758
+ grid-template-columns: minmax(100%, max-content);
2759
+ grid-template-rows: minmax(100%, auto);
2760
+ position: relative;
2761
+ min-height: var(--code-editor-min-height, 8rem);
2762
+ max-height: var(--code-editor-max-height, 32rem);
2763
+ overflow: auto;
2764
+ cursor: text;
2765
+ }
2766
+
2767
+ .code-editor.code-wrap .code-editor-scroll {
2768
+ grid-template-columns: minmax(0, 100%);
2769
+ }
2770
+
2771
+ .code-editor-highlight {
2772
+ grid-area: 1 / 1;
2773
+ overflow: visible;
2774
+ border-radius: 0;
2775
+ pointer-events: none;
2776
+ }
2777
+
2778
+ .code-editor-highlight code {
2779
+ min-width: 0;
2780
+ }
2781
+
2782
+ .code-editor-input {
2783
+ grid-area: 1 / 1;
2784
+ box-sizing: border-box;
2785
+ width: 100%;
2786
+ height: 100%;
2787
+ margin: 0;
2788
+ padding: 10px 12px;
2789
+ border: 0;
2790
+ outline: 0;
2791
+ resize: none;
2792
+ overflow: hidden;
2793
+ background: transparent;
2794
+ color: transparent;
2795
+ caret-color: var(--athena-fg);
2796
+ }
2797
+
2798
+ .code-editor-highlight.has-line-numbers ~ .code-editor-input {
2799
+ padding-left: calc(12px + var(--code-gutter, 2ch) + 1.5ch);
2800
+ }
2801
+
2802
+ .code-editor-input::selection {
2803
+ background: color-mix(in srgb, var(--athena-accent) 35%, transparent);
2804
+ color: transparent;
2805
+ }
2806
+
2807
+ .code-editor.is-readonly .code-editor-input {
2808
+ cursor: default;
2809
+ }
2810
+
2811
+ .code-editor-highlight.is-plain {
2812
+ white-space: pre;
2813
+ }
2814
+
2815
+ .code-line.is-current {
2816
+ background: color-mix(in srgb, var(--athena-fg) 7%, transparent);
2817
+ }
2818
+
2819
+ .code-line.is-locked-line {
2820
+ background: color-mix(in srgb, var(--athena-muted) 14%, transparent);
2821
+ }
2822
+
2823
+ .code-line.has-marker {
2824
+ text-decoration: underline wavy;
2825
+ text-decoration-thickness: 1px;
2826
+ text-underline-offset: 3px;
2827
+ }
2828
+
2829
+ .code-line.marker-error { text-decoration-color: var(--athena-danger); }
2830
+ .code-line.marker-warning { text-decoration-color: var(--athena-warning); }
2831
+ .code-line.marker-info { text-decoration-color: var(--athena-info); }
2832
+ .code-line.marker-error::before { color: var(--athena-danger); font-weight: 700; }
2833
+ .code-line.marker-warning::before { color: var(--athena-warning); font-weight: 700; }
2834
+
2835
+ .code-editor-status {
2836
+ display: flex;
2837
+ justify-content: space-between;
2838
+ gap: 12px;
2839
+ padding: 2px 10px;
2840
+ border-top: var(--athena-border-width) solid var(--athena-line);
2841
+ color: var(--athena-muted);
2842
+ font-size: 0.8rem;
2843
+ }
2844
+
2845
+ .code-find {
2846
+ display: flex;
2847
+ flex-direction: column;
2848
+ gap: 4px;
2849
+ padding: 6px 8px;
2850
+ border-bottom: var(--athena-border-width) solid var(--athena-line);
2851
+ background: var(--athena-surface);
2852
+ }
2853
+
2854
+ .code-find[hidden],
2855
+ .code-find-row[hidden] {
2856
+ display: none;
2857
+ }
2858
+
2859
+ .code-find-row {
2860
+ display: flex;
2861
+ flex-wrap: wrap;
2862
+ align-items: center;
2863
+ gap: 4px;
2864
+ }
2865
+
2866
+ .code-find-input {
2867
+ flex: 1;
2868
+ min-width: 8rem;
2869
+ padding: 3px 6px;
2870
+ border: var(--athena-border-width) solid var(--athena-line);
2871
+ border-radius: var(--athena-radius);
2872
+ background: var(--athena-bg);
2873
+ color: var(--athena-fg);
2874
+ font: inherit;
2875
+ }
2876
+
2877
+ .code-find-input[aria-invalid="true"] {
2878
+ border-color: var(--athena-danger);
2879
+ }
2880
+
2881
+ .code-find-button[aria-pressed="true"] {
2882
+ background: var(--athena-accent);
2883
+ color: var(--athena-accent-fg);
2884
+ }
2885
+
2886
+ .code-find-count {
2887
+ min-width: 6ch;
2888
+ color: var(--athena-muted);
2889
+ font-size: 0.8rem;
2890
+ }
2891
+
2892
+ .code-completions {
2893
+ position: absolute;
2894
+ top: var(--code-completion-top, 0);
2895
+ left: var(--code-completion-left, 0);
2896
+ z-index: 5;
2897
+ min-width: 12rem;
2898
+ max-height: 12rem;
2899
+ margin: 0;
2900
+ padding: 2px;
2901
+ overflow: auto;
2902
+ list-style: none;
2903
+ border: var(--athena-border-width) solid var(--athena-border);
2904
+ border-radius: var(--athena-radius);
2905
+ background: var(--athena-bg);
2906
+ color: var(--athena-fg);
2907
+ box-shadow: var(--athena-shadow);
2908
+ }
2909
+
2910
+ .code-completions[hidden] {
2911
+ display: none;
2912
+ }
2913
+
2914
+ .code-completion {
2915
+ display: flex;
2916
+ justify-content: space-between;
2917
+ gap: 16px;
2918
+ padding: 2px 8px;
2919
+ border-radius: var(--athena-radius);
2920
+ font: 0.85rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
2921
+ cursor: pointer;
2922
+ }
2923
+
2924
+ .code-completion-detail {
2925
+ color: var(--athena-muted);
2926
+ }
2927
+
2928
+ .code-completion.is-active {
2929
+ background: var(--athena-accent);
2930
+ color: var(--athena-accent-fg);
2931
+ }
2932
+
2933
+ .code-completion.is-active .code-completion-detail {
2934
+ color: inherit;
2935
+ }
2936
+
2937
+ ::highlight(athena-code-bracket) {
2938
+ background-color: color-mix(in srgb, var(--athena-accent) 40%, transparent);
2939
+ }
2940
+
2941
+ ::highlight(athena-code-find) {
2942
+ background-color: color-mix(in srgb, var(--athena-warning) 35%, transparent);
2943
+ }
2944
+
2945
+ ::highlight(athena-code-find-current) {
2946
+ background-color: color-mix(in srgb, var(--athena-warning) 75%, transparent);
2947
+ }
2948
+
2949
+ /* The diff view */
2950
+ .code-diff {
2951
+ border: var(--athena-border-width) solid var(--athena-line);
2952
+ border-radius: var(--athena-radius);
2953
+ overflow: hidden;
2954
+ }
2955
+
2956
+ .code-diff-header {
2957
+ display: flex;
2958
+ gap: 12px;
2959
+ padding: 4px 12px;
2960
+ border-bottom: var(--athena-border-width) solid var(--athena-line);
2961
+ background: var(--athena-surface);
2962
+ font-size: 0.8rem;
2963
+ }
2964
+
2965
+ .code-diff[data-mode="split"] .code-diff-header {
2966
+ display: grid;
2967
+ grid-template-columns: auto auto 1fr 1fr;
2968
+ }
2969
+
2970
+ .code-diff-stat.is-added { color: var(--athena-success); }
2971
+ .code-diff-stat.is-removed { color: var(--athena-danger); }
2972
+
2973
+ .code-diff-code {
2974
+ border-radius: 0;
2975
+ padding: 0;
2976
+ }
2977
+
2978
+ .code-diff-row {
2979
+ display: grid;
2980
+ grid-template-columns: 1fr;
2981
+ }
2982
+
2983
+ .code-diff-body.is-split .code-diff-row {
2984
+ grid-template-columns: 1fr 1fr;
2985
+ }
2986
+
2987
+ .code-diff-cell {
2988
+ display: grid;
2989
+ grid-template-columns: 4ch 2ch 1fr;
2990
+ gap: 0 4px;
2991
+ padding: 0 8px;
2992
+ }
2993
+
2994
+ .code-diff-cell .code-line {
2995
+ padding: 0;
2996
+ }
2997
+
2998
+ .code-diff-cell.is-added { background: color-mix(in srgb, var(--athena-success) 16%, transparent); }
2999
+ .code-diff-cell.is-removed { background: color-mix(in srgb, var(--athena-danger) 16%, transparent); }
3000
+ .code-diff-cell.is-empty { background: color-mix(in srgb, var(--athena-muted) 8%, transparent); }
3001
+
3002
+ .code-diff-number,
3003
+ .code-diff-mark {
3004
+ color: var(--athena-muted);
3005
+ text-align: right;
3006
+ user-select: none;
3007
+ }
3008
+
3009
+ .code-diff-mark {
3010
+ text-align: center;
3011
+ }
3012
+
3013
+ .code-diff-row.is-skip {
3014
+ padding: 2px 12px;
3015
+ background: var(--athena-surface);
3016
+ }
3017
+
3018
+ .code-diff-skip {
3019
+ padding: 0;
3020
+ border: 0;
3021
+ background: none;
3022
+ color: var(--athena-accent);
3023
+ font: inherit;
3024
+ cursor: pointer;
3025
+ }
3026
+
3027
+ .code-diff-empty {
3028
+ margin: 0;
3029
+ padding: 8px 12px;
3030
+ color: var(--athena-muted);
3031
+ }
3032
+
2562
3033
  }
@@ -29,6 +29,24 @@
29
29
  --athena-warning: #9a6700;
30
30
  --athena-info: #2471a3;
31
31
  --athena-shadow: 0 4px 14px rgb(0 0 0 / 18%);
32
+ /* code highlighting: at least 4.5:1 on --athena-surface-alt (a test checks it) */
33
+ --athena-tok-comment: #5a6270;
34
+ --athena-tok-string: #0b6e3a;
35
+ --athena-tok-number: #a24b00;
36
+ --athena-tok-keyword: #7a2a9e;
37
+ --athena-tok-literal: #0b5fa5;
38
+ --athena-tok-function: #1f55b0;
39
+ --athena-tok-type: #0f6b6b;
40
+ --athena-tok-property: #9b2c5b;
41
+ --athena-tok-tag: #a3201f;
42
+ --athena-tok-attribute: #8a5300;
43
+ --athena-tok-variable: #0a6a8a;
44
+ --athena-tok-selector: #7a2a9e;
45
+ --athena-tok-meta: #6b4eae;
46
+ --athena-tok-entity: #0a6a8a;
47
+ --athena-tok-builtin: #0b5fa5;
48
+ --athena-tok-operator: #3b4048;
49
+ --athena-tok-punctuation: #5a6270;
32
50
 
33
51
  /* shape and spacing */
34
52
  --athena-radius: 6px;
@@ -94,6 +112,23 @@
94
112
  --athena-warning: #e0b04a;
95
113
  --athena-info: #5b9bd5;
96
114
  --athena-shadow: 0 4px 14px rgb(0 0 0 / 55%);
115
+ --athena-tok-comment: #8b95a5;
116
+ --athena-tok-string: #8fd39c;
117
+ --athena-tok-number: #f0a56a;
118
+ --athena-tok-keyword: #c9a0f0;
119
+ --athena-tok-literal: #7fb8f0;
120
+ --athena-tok-function: #8fb4ff;
121
+ --athena-tok-type: #5fd0c8;
122
+ --athena-tok-property: #f08bb0;
123
+ --athena-tok-tag: #ff8f8f;
124
+ --athena-tok-attribute: #e8b86d;
125
+ --athena-tok-variable: #6fd0f0;
126
+ --athena-tok-selector: #c9a0f0;
127
+ --athena-tok-meta: #b4a0f0;
128
+ --athena-tok-entity: #6fd0f0;
129
+ --athena-tok-builtin: #7fb8f0;
130
+ --athena-tok-operator: #c3c8d0;
131
+ --athena-tok-punctuation: #9aa3b0;
97
132
  }
98
133
 
99
134
  /* ... or, when nothing was chosen, by the system */
@@ -117,5 +152,22 @@
117
152
  --athena-warning: #e0b04a;
118
153
  --athena-info: #5b9bd5;
119
154
  --athena-shadow: 0 4px 14px rgb(0 0 0 / 55%);
155
+ --athena-tok-comment: #8b95a5;
156
+ --athena-tok-string: #8fd39c;
157
+ --athena-tok-number: #f0a56a;
158
+ --athena-tok-keyword: #c9a0f0;
159
+ --athena-tok-literal: #7fb8f0;
160
+ --athena-tok-function: #8fb4ff;
161
+ --athena-tok-type: #5fd0c8;
162
+ --athena-tok-property: #f08bb0;
163
+ --athena-tok-tag: #ff8f8f;
164
+ --athena-tok-attribute: #e8b86d;
165
+ --athena-tok-variable: #6fd0f0;
166
+ --athena-tok-selector: #c9a0f0;
167
+ --athena-tok-meta: #b4a0f0;
168
+ --athena-tok-entity: #6fd0f0;
169
+ --athena-tok-builtin: #7fb8f0;
170
+ --athena-tok-operator: #c3c8d0;
171
+ --athena-tok-punctuation: #9aa3b0;
120
172
  }
121
173
  }