File: emoji_group.html

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (337 lines) | stat: -rw-r--r-- 9,564 bytes parent folder | download | duplicates (6)
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<style>
  :host {
    margin-top: 10px;
    position: relative;
    --emoji-background: transparent;
  }

  :host([category="emoticon"]),
  :host([category="symbol"]) {
    --emoji-button-border-radius: 4px;
  }

  /* Base styles. */
  .emoji-button {
    background: var(--emoji-background);
    border: none;
    cursor: pointer;
    height: 100%;
  }

  .emoji-button-container {
    height: var(--emoji-size);
    position: relative;
    width: var(--emoji-size);
  }

  /* Grid layout styles. */
  .grid-layout {
    display: grid;
    gap: var(--emoji-spacing);
    grid-auto-rows: max-content;
    grid-template-columns: repeat(var(--emoji-per-row), 1fr);
    justify-items: center;
  }

  .grid-layout .emoji-button {
    border-radius: var(--emoji-button-border-radius, 50%);
    display: block;
    font-family: 'Noto Color Emoji';
    font-size: 19px;
    line-height: var(--emoji-size);
    outline: none;
    padding: 0;
    text-align: center;
    user-select: none;
    width: 100%;
  }

  /* Flex layout styles. */
  .flex-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  .flex-layout .emoji-button-container {
    width: max-content;
  }

  .flex-layout .emoji-button {
    border-radius: var(--emoji-button-border-radius, 0);
    color: var(--emoji-picker-symbol-color);
    font-family: 'Noto Sans CJK JP';
    font-size: 13px;
    padding: 6px;
    width: max-content;
  }

  /* Two Column layout styles */
  .two-column-layout {
    display: flex;
  }

  .two-column-layout .left-column {
    flex: 50%;
  }

  .two-column-layout .right-column {
    align-items: flex-end;
    display: flex;
    flex: 50%;
    flex-direction: column;
  }

  /* Heading styles */
  #heading {
    color: var(--emoji-picker-category-header-color);
    display: flex;
    font-size: 13px;
    padding-bottom: var(--emoji-group-heading-padding-bottom);
    padding-top: var(--emoji-group-heading-padding-top);
  }

  #heading:focus,
  #heading:active {
    outline-color: var(--emoji-picker-focus-ring-color);
    outline-width: 2px;
  }

  #heading-left {
    height: var(--emoji-group-heading-size);
    line-height: var(--emoji-group-heading-size);
    user-select: none;
    width: 100%;
  }

  #palette {
    padding-bottom: 16px;
  }

  #show-clear {
    --cr-icon-button-fill-color: var(--emoji-picker-icon-button-icon-color);
    --cr-icon-button-focus-outline-color: var(--emoji-picker-focus-ring-color);
    height: var(--emoji-group-heading-size);
    left: var(--emoji-picker-last-emoji-left);
    margin: 0;
    width: var(--emoji-group-heading-size);
  }

  #clear-recents-container {
    position: absolute;
    right: 0;
    top: calc(var(--emoji-group-heading-padding-top)
      + var(--emoji-group-heading-padding-bottom)
      + var(--emoji-group-heading-size));
    box-shadow: var(--cros-elevation-1-shadow);
    border-radius: 4px;
    overflow: hidden;
    /* Declare the z-index here to ensure this container is visible above
     * everything else. */
    z-index: 300;
  }

  #clear-recents, #help {
    background-color: var(--emoji-picker-container-color);
    border: 2px solid transparent;
    color: var(--cros-text-color-secondary);
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    height: var(--emoji-size);
    outline: none;
    padding: 0;
    white-space: nowrap;
    width: 100%;
    z-index: 200;
    display: block;
    text-align: left;
  }

  #clear-recents:focus,
  #clear-recents:active,
  #help:focus,
  #help:active {
    border: 2px solid var(--cros-toggle-color);
  }

  #fake-focus-target {
    position: absolute;
  }

  #clear-recents-hover {
    border: 2px solid transparent;
    margin: -2px;
    /* Padding should be 6/10 not 7/11, but without adding 1 there is a weird
     * border.*/
    padding: 7px 11px 7px 11px;
  }

  #clear-recents-hover:hover {
    background-color: var(--cros-button-background-color-secondary-hover);
    border: 2px solid var(--cros-button-background-color-secondary-hover);
  }

  .emoji-button:focus,
  .emoji-button:active {
    outline-color: var(--emoji-picker-focus-ring-color);
    outline-style: solid;
    outline-width: 2px;
  }

  .emoji-button:disabled {
    /* chrome makes disabled buttons semitransparent.
     * we set a solid colour here to prevent that
     * (exactly which colour is not important).
     */
    color: red;
    cursor: default;
  }

  .emoji-button:hover {
    background-color: var(--emoji-hover-background);
  }

  /* Implement has-variants as ::after so that it still works with hover
   * ripple.
   */
  [has-variants]::after {
    /* 4px grey triangle in bottom-right.
     * 315 degrees means starting at bottom-right towards top-left.
     * Manual color here because there isn't something easy to use, but fine
     * for dark mode since dark mode is the same.
     */
    background: linear-gradient(
        315deg, var(--google-grey-500) 4px,
        var(--emoji-background) 4px, var(--emoji-background));
    content: '';
    display: block;
    height: var(--emoji-size);
    position: relative;
    top: calc(0px - var(--emoji-size));
    width: var(--emoji-size);
  }

  paper-tooltip {
    --paper-tooltip-background: var(--cros-tooltip-background-color);
    --paper-tooltip-delay-in: var(--emoji-tooltip-delay-in);
    --paper-tooltip-delay-out: var(--emoji-tooltip-delay-out);
    --paper-tooltip-duration-in: 0;
    --paper-tooltip-duration-out: 0;
    --paper-tooltip-opacity: 1;
    --paper-tooltip-text-color: var(--cros-tooltip-label-color);
  }

  paper-tooltip::part(tooltip) {
    box-shadow: var(--cros-elevation-1-shadow);
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    margin: 4px;
    padding: 4px 8px 4px 8px;
    white-space: nowrap;
  }
</style>

<!-- Add header section. -->
<template is="dom-if" if="[[group]]">
  <div id="heading" role="heading" aria-level="2" tabindex="-1">
    <div id="heading-left">[[group]]</div>
    <template is="dom-if" if="[[clearable]]">
      <cr-icon-button id="show-clear" iron-icon="emoji_picker:more_horizontal"
        on-click="onClearClick"
        aria-label$="[[getMoreOptionsAriaLabel(gifSupport)]]">
      </cr-icon-button>
    </template>
  </div>
</template>
<template is = "dom-if" if="[[showClearRecents]]">
  <div id="clear-recents-container">
    <button id="clear-recents" on-click="onClearRecentsClick">
      <div id="clear-recents-hover">
        Clear recently used [[formatCategory(category)]]s
      </div>
    </button>

    <button id="help" on-click="onHelpClick">
      <div id="clear-recents-hover">
        Help
      </div>
    </button>
</div>
</template>

<!-- Add emoji buttons.
  Note that the click and context menu listeners are shared among all the
  elements to improve efficiency and performance.

  Note duplicate loop for case with and without variants. Since many categories
  have zero variants, doing the variants on a per-group basis has a significant
  advantage.
-->
<div id="palette"
  class$="[[getLayoutClassName(layoutType, category)]]"
  on-click="onEmojiClick"
  on-contextmenu="onEmojiContextMenu">
  <div id="fake-focus-target" tabindex="-1"></div>
  <template is="dom-if" if="[[isVisual(category)]]">
    <div class="left-column">
      <template is="dom-repeat" items="[[filterColumn(data, 'left', data.length)]]">
        <emoji-image index="[[getIndex(item)]]"
          item="[[item]]"
          show-tooltip="[[showTooltip]]"
          emoji-click="[[onEmojiClick]]"
          clearable="[[clearable]]">
        </emoji-image>
      </template>
    </div>
    <div class="right-column">
      <template is="dom-repeat" items="[[filterColumn(data, 'right', data.length)]]">
        <emoji-image index="[[getIndex(item)]]"
          item="[[item]]"
          show-tooltip="[[showTooltip]]"
          emoji-click="[[onEmojiClick]]"
          clearable="[[clearable]]">
        </emoji-image>
      </template>
    </div>
  </template>
  <template is="dom-if" if="[[!isVisual(category)]]">
    <template is="dom-if" if="[[hasAnyVariants(data)]]">
      <template is="dom-repeat" items="[[data]]">
        <div class="emoji-button-container">
        <button id="emoji-[[index]]" data-index$="[[index]]"
          class="emoji-button" has-variants$="[[hasVariants(item)]]"
          on-mouseenter="showTooltip" on-focus="showTooltip"
          aria-label="[[getEmojiAriaLabel(item)]]">
          [[getDisplayEmojiForEmoji(item.base.string, item)]]
        </button>
        <template is="dom-if"
          if="[[isEmojiVariantVisible(index,shownEmojiVariantIndex)]]">
          <emoji-variants
            id="emoji-variant-[[index]]"
            variants="[[item.alternates]]"
            grouped-tone="[[item.groupedTone]]"
            grouped-gender="[[item.groupedGender]]"
            tooltip="[[item.base.name]]">
          </emoji-variants>
        </template>
        </div>
      </template>
    </template>
    <template is="dom-if" if="[[!hasAnyVariants(data)]]">
      <template is="dom-repeat" items="[[data]]">
        <div class="emoji-button-container">
        <button id="emoji-[[index]]" data-index$="[[index]]"
          class="emoji-button"
          on-mouseenter="showTooltip" on-focus="showTooltip"
          aria-label="[[getEmojiAriaLabel(item)]]">
          [[getDisplayEmojiForEmoji(item.base.string, item)]]
        </button>
        </div>
      </template>
    </template>
  </template>
  <paper-tooltip id='tooltip' fit-to-visible-bounds offset="8">
    [[focusedEmoji.base.name]]
  </paper-tooltip>
</div>