Skip to content

Commit f888c4a

Browse files
authored
Added parent CSS class to use for the component to prevent CSS infection. (#30)
Thanks @ajmcgrail for this change.
1 parent dacae72 commit f888c4a

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

src/style.css

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
.selected-tree-item {
1+
.vue3-tree-vue .selected-tree-item {
22
background: rgba(235, 106, 59, 0.795);
33
color: white;
44
}
55

6-
.tree-item:hover .on-item-hover{
6+
.vue3-tree-vue .tree-item:hover .on-item-hover{
77
display: block;
88
}
99

10-
.tree-item .on-item-hover{
10+
.vue3-tree-vue .tree-item .on-item-hover{
1111
display: none;
1212
}
1313

14-
.tree-item-node:hover li > .on-item-hover{
14+
.vue3-tree-vue .tree-item-node:hover li > .on-item-hover{
1515
display: block;
1616
}
1717

18-
.tree-item-node li > .on-item-hover{
18+
.vue3-tree-vue .tree-item-node li > .on-item-hover{
1919
display: none;
2020
}
2121

2222

23-
.no-guide .tree-item-node {
23+
.vue3-tree-vue .no-guide .tree-item-node {
2424
border: none !important;
2525
}
26-
.no-guide .tree-item-node::before {
26+
.vue3-tree-vue .no-guide .tree-item-node::before {
2727
border: none !important;
2828
}
2929

30-
.no-guide .guide-line {
30+
.vue3-tree-vue .no-guide .guide-line {
3131
border: none !important;
3232
}
3333

34-
.no-guide .guide-line::before {
34+
.vue3-tree-vue .no-guide .guide-line::before {
3535
border: none !important;
3636
}
3737

@@ -42,7 +42,7 @@ border: none !important;
4242
* Add a dashed border to the left of all but the last child in a parent node.
4343
* There will be a gap between the bottom of this tree-item-node and the top of the next sibling.
4444
*/
45-
.node-child .tree-item-node-parent .tree-item-node:not(:last-child) {
45+
.vue3-tree-vue .node-child .tree-item-node-parent .tree-item-node:not(:last-child) {
4646
position: relative;
4747
border-left: 1px dashed rgb(192, 192, 192);
4848
border-radius: 0;
@@ -53,7 +53,7 @@ border: none !important;
5353
* use the ::before pseudo-element to create a dashed line that extends down to the next sibling.
5454
* This will be applied to all but the last child in a parent node, and fill in the gap mentioned above.
5555
*/
56-
.node-child .tree-item-node-parent .tree-item-node:not(:last-child)::before {
56+
.vue3-tree-vue .node-child .tree-item-node-parent .tree-item-node:not(:last-child)::before {
5757
content: "";
5858
position: absolute;
5959
top: 100%; /* Extend below the actual element */
@@ -63,7 +63,7 @@ border: none !important;
6363
}
6464

6565

66-
.tree-item-node:only-child .tree-view-item{
66+
.vue3-tree-vue .tree-item-node:only-child .tree-view-item{
6767
position: relative; /* Needed to position the ::before pseudo-element */
6868
}
6969

@@ -72,7 +72,7 @@ border: none !important;
7272
* Since we rely on the previous sibling to fill in the gap by extending down,
7373
* only-child elements will need to extend up to fill in the gap.
7474
*/
75-
.node-child .tree-item-node-parent .tree-item-node:only-child > .tree-view-item > .guide-line::before {
75+
.vue3-tree-vue .node-child .tree-item-node-parent .tree-item-node:only-child > .tree-view-item > .guide-line::before {
7676
content: "";
7777
position: absolute;
7878
bottom: 50%; /* Extend above the actual element */
@@ -82,95 +82,95 @@ border: none !important;
8282
}
8383

8484

85-
.tree-item {
85+
.vue3-tree-vue .tree-item {
8686
padding: 0.25em;
8787
}
8888

89-
ul {
89+
.vue3-tree-vue ul {
9090
padding-left: 0;
9191
margin: 0;
9292
list-style-type: none;
9393
display: inline-block;
9494
}
9595

96-
li {
96+
.vue3-tree-vue li {
9797
border-radius: 4px;
9898
}
9999

100-
.tree-item__drag-over {
100+
.vue3-tree-vue .tree-item__drag-over {
101101
background-color: rgba(22, 22, 22, 0.068) !important;
102102
}
103103

104104

105-
.root__drag-over {
105+
.vue3-tree-vue .root__drag-over {
106106
border-left: 6px solid #ccc !important;
107107
}
108108

109109

110-
.chevron-right {
110+
.vue3-tree-vue .chevron-right {
111111
color: gray;
112112
}
113113

114-
.hide-chevron {
114+
.vue3-tree-vue .hide-chevron {
115115
visibility: collapse;
116116
}
117117

118-
.icon-area {
118+
.vue3-tree-vue .icon-area {
119119
width: 22px;
120120
margin-right: 0.4em;
121121
}
122122

123-
.guide-line {
123+
.vue3-tree-vue .guide-line {
124124
width: 1em;
125125
border-top: 1px dashed rgb(192, 192, 192);
126126
}
127127

128-
.node-name {
128+
.vue3-tree-vue .node-name {
129129
cursor: pointer;
130130
margin-left: 5px;
131131
}
132132

133-
.d-flex {
133+
.vue3-tree-vue .d-flex {
134134
display: flex;
135135
align-items: center;
136136
}
137137

138-
.align-items-center {
138+
.vue3-tree-vue .align-items-center {
139139
align-items: center;
140140
}
141141

142-
.nested {
142+
.vue3-tree-vue .nested {
143143
margin-left: 47px !important;
144144
}
145145

146-
.root {
146+
.vue3-tree-vue .root {
147147
margin-left: 30px !important;
148148
}
149149

150-
.tiny_horizontal_margin {
150+
.vue3-tree-vue .tiny_horizontal_margin {
151151
margin-left: 2px;
152152
margin-right: 2px;
153153
}
154154

155-
.tree-item__checkbox-area {
155+
.vue3-tree-vue .tree-item__checkbox-area {
156156
display: flex;
157157
align-items: center;
158158
}
159159

160-
.node-child {
160+
.vue3-tree-vue .node-child {
161161
text-align: left;
162162
display: block;
163163
}
164164

165-
.hide {
165+
.vue3-tree-vue .hide {
166166
display: none;
167167
}
168168

169-
.hide-guidelines {
169+
.vue3-tree-vue .hide-guidelines {
170170
border-left: none !important;
171171
}
172172

173-
.chevron-right {
173+
.vue3-tree-vue .chevron-right {
174174
box-sizing: border-box;
175175
position: relative;
176176
display: block;
@@ -182,15 +182,15 @@ li {
182182
transition: .2s;
183183
}
184184

185-
.pointer {
185+
.vue3-tree-vue .pointer {
186186
cursor: pointer;
187187
}
188188

189-
.chevron-right.rotate-90::after {
189+
.vue3-tree-vue .chevron-right.rotate-90::after {
190190
transform: rotateZ(45deg);
191191
}
192192

193-
.chevron-right::after {
193+
.vue3-tree-vue .chevron-right::after {
194194
content: "";
195195
display: block;
196196
box-sizing: border-box;

src/tree-component.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div class="vue3-tree-vue">
33
<ul id="explorer" class="explorer tree-item-node-parent"
44
:class="{'no-guide': hideGuideLines}"
55
@dragover.stop.prevent

0 commit comments

Comments
 (0)