pretty-toc 1.1.4 → 1.1.6

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.
Files changed (2) hide show
  1. package/dist/index.mjs +52 -20
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -137,13 +137,6 @@ function prettyToc(option) {
137
137
  width: fit-content;
138
138
  position: relative;
139
139
  }
140
- .toc-title:hover {
141
- color: ${lightThemeHighlightColor};
142
- cursor: pointer;
143
- }
144
- html.dark .toc-title:hover {
145
- color: ${darkThemeHighlightColor};
146
- }
147
140
  ul {
148
141
  padding-left: 0;
149
142
  list-style-type: ${listStyle} ;
@@ -194,22 +187,56 @@ function prettyToc(option) {
194
187
  .li-row > a {
195
188
  text-decoration: none;
196
189
  }
197
- .li-row:hover {
190
+ @media (hover: hover) {
191
+ .toc-title:hover {
192
+ color: ${lightThemeHighlightColor};
193
+ cursor: pointer;
194
+ }
195
+ html.dark .toc-title:hover {
196
+ color: ${darkThemeHighlightColor};
197
+ }
198
+ .li-row:hover {
199
+ color: ${lightThemeHighlightColor};
200
+ }
201
+ .li-row:hover > .li-marker::before {
202
+ color: ${lightThemeHighlightColor};
203
+ }
204
+ .li-row:hover > a {
205
+ color: ${lightThemeHighlightColor};
206
+ }
207
+ html.dark .li-row:hover {
208
+ color: ${darkThemeHighlightColor};
209
+ }
210
+ html.dark .li-row:hover > .li-marker::before {
211
+ color: ${darkThemeHighlightColor};
212
+ }
213
+ html.dark .li-row:hover > a {
214
+ color: ${darkThemeHighlightColor};
215
+ }
216
+ }
217
+ .toc-title:active {
198
218
  color: ${lightThemeHighlightColor};
219
+ cursor: pointer;
199
220
  }
200
- .li-row:hover > .li-marker::before {
221
+ html.dark .toc-title:active {
222
+ color: ${darkThemeHighlightColor};
223
+ }
224
+ .li-row:active {
225
+ color: ${lightThemeHighlightColor};
226
+ }
227
+ .li-row:active > .li-marker::before {
201
228
  color: ${lightThemeHighlightColor};
202
229
  }
203
- .li-row:hover > a {
230
+ .li-row:active > a {
204
231
  color: ${lightThemeHighlightColor};
205
232
  }
206
- html.dark .li-row:hover {
233
+ html.dark .li-row:active {
207
234
  color: ${darkThemeHighlightColor};
208
235
  }
209
- html.dark .li-row:hover > .li-marker::before {
236
+ html.dark .li-row:active > .li-marker::before {
210
237
  color: ${darkThemeHighlightColor};
211
238
  }
212
- html.dark .li-row:hover > a {
239
+ html.dark .li-row:active > a {
213
240
  color: ${darkThemeHighlightColor};
214
241
  }
215
242
  `;
@@ -220,7 +247,6 @@ function prettyToc(option) {
220
247
  <html>
221
248
  <head><meta charset="utf-8"></head>
222
249
  <body>
223
- <strong>Hello from iframe!</strong>
224
250
  <script is:inline data-astro-rerun>
225
251
  const currentLocale = window.parent.location.pathname.split('/')[1] || '${opt.locale || "en-US"}';
226
252
  const languageMap = ${JSON.stringify(opt.languageMap).replaceAll("\"", "'")} || ${JSON.stringify(DEFAULT_LANGUAGE_MAP).replaceAll("\"", "'")};
@@ -248,12 +274,18 @@ function prettyToc(option) {
248
274
  }
249
275
  }
250
276
 
251
- syncTocTitle(currentLocale, languageMap);
252
- toggleToc();
253
-
254
- window.parent.addEventListener('load', function() {
255
- syncTocTitle(currentLocale, languageMap);
256
- toggleToc();
277
+ window.addEventListener('load', function() {
278
+ if (window.parent.document.readyState === 'complete') {
279
+ syncTocTitle(currentLocale, languageMap);
280
+ toggleToc();
281
+ } else {
282
+ window.parent.document.addEventListener('readystatechange', event => {
283
+ if (event.target.readyState === 'complete') {
284
+ syncTocTitle(currentLocale, languageMap);
285
+ toggleToc();
286
+ }
287
+ });
288
+ }
257
289
  });
258
290
  <\/script>
259
291
  &lt;/body&gt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pretty-toc",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "type": "module",
5
5
  "description": "A Table of Contents generation plugin for the Satteri markdown parser library.",
6
6
  "keywords": [