blob: 004aa1b1677d119b4108ccf6ac7b53056afd8413 (
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
|
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-ripple/paper-ripple.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<dom-module id="viewer-bookmark" attributes="bookmark">
<template>
<style>
#item {
@apply --layout-center;
@apply --layout-horizontal;
cursor: pointer;
height: 30px;
position: relative;
}
#item:hover {
background-color: var(--cr-menu-background-focus-color);
}
paper-ripple {
/* Allowing the ripple to capture pointer events prevents a focus
* rectangle for showing up for clicks, while still allowing it with
* tab-navigation. This undoes a paper-ripple bug fix aimed at
* non-Chrome browsers. TODO(tsergeant): Improve focus in
* viewer-bookmark so this can be removed (https://crbug.com/5448190).
*/
pointer-events: auto;
}
#title {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#expand {
--cr-icon-button-color: var(--primary-text-color);
--cr-icon-button-icon-size: 16px;
--cr-icon-button-size: 28px;
margin: 0;
transition: transform 150ms;
}
:host-context([dir=rtl]) #expand {
transform: rotate(180deg);
}
:host([children-shown_]) #expand {
transform: rotate(90deg);
}
</style>
<div id="item" on-click="onClick_">
<paper-ripple></paper-ripple>
<cr-icon-button id="expand" iron-icon="cr:chevron-right"
on-click="toggleChildren_"></cr-icon-button>
<span id="title" tabindex="0">{{bookmark.title}}</span>
</div>
<!-- dom-if will stamp the complex bookmark tree lazily as individual nodes
are opened. -->
<template is="dom-if" if="[[childrenShown_]]">
<template is="dom-repeat" items="[[bookmark.children]]">
<viewer-bookmark bookmark="{{item}}" depth="[[childDepth_]]">
</viewer-bookmark>
</template>
</template>
</template>
<script src="viewer-bookmark.js"></script>
</dom-module>
|