summaryrefslogtreecommitdiffstats
path: root/vendor/jfcherng/php-diff/example/diff-table.scss
blob: 89c491eeb6c803616ec701d5ba03604b97e89e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
// You can compile this with https://www.sassmeister.com

$diff-bg-color: #fff !default;
$diff-text-color: invert($diff-bg-color) !default;

$diff-bg-color-ins-base: #8e8 !default;
$diff-bg-color-del-base: #e88 !default;
$diff-bg-color-rep-base: #fbdb65 !default;

$diff-op-highlight-ratio: 90% !default;
$diff-op-normal-ratio: 25% !default;

// emphasized colors for detailed inline difference
$diff-bg-color-ins-highlight: mix($diff-bg-color-ins-base, $diff-bg-color, $diff-op-highlight-ratio) !default;
$diff-bg-color-del-highlight: mix($diff-bg-color-del-base, $diff-bg-color, $diff-op-highlight-ratio) !default;

// colors for operation rows
$diff-bg-color-ins: mix($diff-bg-color-ins-base, $diff-bg-color, $diff-op-normal-ratio) !default;
$diff-bg-color-del: mix($diff-bg-color-del-base, $diff-bg-color, $diff-op-normal-ratio) !default;
$diff-bg-color-rep: mix($diff-bg-color-rep-base, $diff-bg-color, $diff-op-normal-ratio) !default;

$diff-table-head-color: mix($diff-bg-color, $diff-text-color, 65%) !default;
$diff-table-sidebar-color: mix($diff-bg-color, $diff-text-color, 80%) !default;
$diff-border-color: $diff-text-color !default;

// color for the nonexistent block
// for example, there are a deleted line that has no corresponding one
$diff-bg-color-none-block: mix($diff-bg-color, $diff-table-sidebar-color, 80%) !default;
$diff-bg-color-none-block-alternative: mix($diff-bg-color, $diff-table-sidebar-color, 55%) !default;

// symbol images
$img-space: 'data:image/svg+xml,%3Csvg preserveAspectRatio="xMinYMid meet" viewBox="0 0 12 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M4.5 11C4.5 10.1716 5.17157 9.5 6 9.5C6.82843 9.5 7.5 10.1716 7.5 11C7.5 11.8284 6.82843 12.5 6 12.5C5.17157 12.5 4.5 11.8284 4.5 11Z" fill="rgba%2860, 60, 60, 50%25%29"/%3E%3C/svg%3E' !default;
$img-tab: 'data:image/svg+xml,%3Csvg preserveAspectRatio="xMinYMid meet" viewBox="0 0 12 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M9.5 10.44L6.62 8.12L7.32 7.26L12.04 11V11.44L7.28 14.9L6.62 13.9L9.48 11.78H0V10.44H9.5Z" fill="rgba%2860, 60, 60, 50%25%29"/%3E%3C/svg%3E' !default;

.diff-wrapper.diff {
  --tab-size: 4;

  background: repeating-linear-gradient(
    -45deg,
    $diff-bg-color-none-block,
    $diff-bg-color-none-block 0.5em,
    $diff-bg-color-none-block-alternative 0.5em,
    $diff-bg-color-none-block-alternative 1em
  );
  border-collapse: collapse;
  border-spacing: 0;
  border: 1px solid $diff-border-color;
  color: $diff-text-color;
  empty-cells: show;
  font-family: monospace;
  font-size: 13px;
  width: 100%;
  word-break: break-all;

  th {
    font-weight: 700;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
  }

  td {
    vertical-align: baseline;
  }

  td,
  th {
    border-collapse: separate;
    border: none;
    padding: 1px 2px;
    background: $diff-bg-color;

    // make empty cell has height
    &:empty:after {
      content: ' ';
      visibility: hidden;
    }

    a {
      color: #000;
      cursor: inherit;
      pointer-events: none;
    }
  }

  thead th {
    background: $diff-table-head-color;
    border-bottom: 1px solid $diff-border-color;
    padding: 4px;
    text-align: left;
  }

  tbody {
    &.skipped {
      border-top: 1px solid $diff-border-color;

      td,
      th {
        display: none;
      }
    }

    th {
      background: $diff-table-sidebar-color;
      border-right: 1px solid $diff-border-color;
      text-align: right;
      vertical-align: top;
      width: 4em;

      &.sign {
        background: $diff-bg-color;
        border-right: none;
        padding: 1px 0;
        text-align: center;
        width: 1em;

        &.del {
          background: $diff-bg-color-del;
        }

        &.ins {
          background: $diff-bg-color-ins;
        }
      }
    }
  }

  &.diff-html {
    white-space: pre-wrap;
    tab-size: var(--tab-size);

    .ch {
      line-height: 1em;
      background-clip: border-box;
      background-repeat: repeat-x;
      background-position: left center;

      &.sp {
        background-image: url($img-space);
        background-size: 1ch 1.25em;
      }
      &.tab {
        background-image: url($img-tab);
        background-size: calc(var(--tab-size) * 1ch) 1.25em;
        background-position: 2px center;
      }
    }

    &.diff-side-by-side {
      td {
        &.old,
        &.new {
          width: 45%;
        }
      }
    }

    &.diff-combined {
      .change.change-rep {
        .rep {
          // fixes https://github.com/jfcherng/php-diff/issues/34#issuecomment-671404456
          white-space: normal;
        }
      }
    }

    .change {
      &.change-eq {
        .old,
        .new {
          background: $diff-bg-color;
        }
      }

      .old {
        background: $diff-bg-color-del;
      }

      .new {
        background: $diff-bg-color-ins;
      }

      .rep {
        background: $diff-bg-color-rep;
      }

      .old,
      .new,
      .rep {
        &.none {
          background: transparent;
          cursor: not-allowed;
        }
      }

      ins,
      del {
        font-weight: bold;
        text-decoration: none;
      }

      ins {
        background: $diff-bg-color-ins-highlight;
      }

      del {
        background: $diff-bg-color-del-highlight;
      }
    }
  }
}