@jsenv/core 39.10.0 → 39.10.1

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.
@@ -15,6 +15,7 @@
15
15
  }
16
16
 
17
17
  .directory_nav {
18
+ gap: .3em;
18
19
  margin: 20px 25px 15px;
19
20
  font-size: 16px;
20
21
  font-weight: bold;
@@ -26,14 +27,6 @@
26
27
  position: relative;
27
28
  }
28
29
 
29
- .directory_separator {
30
- margin: 0 .3em;
31
- }
32
-
33
- .directory_separator:first-child {
34
- margin-left: 0;
35
- }
36
-
37
30
  .directory_content {
38
31
  border-radius: 3px;
39
32
  margin: 10px 15px;
@@ -15,6 +15,7 @@
15
15
  }
16
16
 
17
17
  .directory_nav {
18
+ gap: .3em;
18
19
  margin: 20px 25px 15px;
19
20
  font-size: 16px;
20
21
  font-weight: bold;
@@ -26,14 +27,6 @@
26
27
  position: relative;
27
28
  }
28
29
 
29
- .directory_separator {
30
- margin: 0 .3em;
31
- }
32
-
33
- .directory_separator:first-child {
34
- margin-left: 0;
35
- }
36
-
37
30
  .directory_content {
38
31
  border-radius: 3px;
39
32
  margin: 10px 15px;
@@ -19517,6 +19517,11 @@ const generateDirectoryNav = (relativeUrl, rootDirectoryUrl) => {
19517
19517
  const parts = isDir
19518
19518
  ? relativeUrlWithRoot.slice(0, -1).split("/")
19519
19519
  : relativeUrlWithRoot.split("/");
19520
+ const items = [];
19521
+ items.push({
19522
+ href: "/",
19523
+ text: "/",
19524
+ });
19520
19525
  let dirPartsHtml = "";
19521
19526
  let i = 0;
19522
19527
  while (i < parts.length) {
@@ -19524,7 +19529,16 @@ const generateDirectoryNav = (relativeUrl, rootDirectoryUrl) => {
19524
19529
  const href = i === 0 ? "/..." : `/${parts.slice(1, i + 1).join("/")}/`;
19525
19530
  const text = part;
19526
19531
  const isLastPart = i === parts.length - 1;
19527
- if (isLastPart) {
19532
+ items.push({
19533
+ href,
19534
+ text,
19535
+ isCurrent: isLastPart,
19536
+ });
19537
+ i++;
19538
+ }
19539
+ i = 0;
19540
+ for (const { href, text, isCurrent } of items) {
19541
+ if (isCurrent) {
19528
19542
  dirPartsHtml += `
19529
19543
  <span class="directory_nav_item" data-current>
19530
19544
  ${text}
@@ -19535,13 +19549,15 @@ const generateDirectoryNav = (relativeUrl, rootDirectoryUrl) => {
19535
19549
  <a class="directory_nav_item" href="${href}">
19536
19550
  ${text}
19537
19551
  </a>`;
19538
- dirPartsHtml += `
19539
- <span class="directory_separator">/</span>`;
19552
+ if (i > 0) {
19553
+ dirPartsHtml += `
19554
+ <span class="directory_separator">/</span>`;
19555
+ }
19540
19556
  i++;
19541
19557
  }
19542
19558
  if (isDir) {
19543
19559
  dirPartsHtml += `
19544
- <span class="directory_separator">/</span>`;
19560
+ <span class="directory_separator">/</span>`;
19545
19561
  }
19546
19562
  return dirPartsHtml;
19547
19563
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "39.10.0",
3
+ "version": "39.10.1",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -20,17 +20,12 @@ button {
20
20
  font-weight: bold;
21
21
  margin: 20px 25px 15px 25px;
22
22
  display: flex;
23
+ gap: 0.3em;
23
24
  }
24
25
  .directory_nav_item {
25
26
  text-decoration: none;
26
27
  position: relative;
27
28
  }
28
- .directory_separator {
29
- margin: 0 0.3em;
30
- }
31
- .directory_separator:first-child {
32
- margin-left: 0;
33
- }
34
29
  .directory_content {
35
30
  margin: 10px 15px 10px 15px;
36
31
  list-style-type: none;
@@ -229,6 +229,11 @@ const generateDirectoryNav = (relativeUrl, rootDirectoryUrl) => {
229
229
  const parts = isDir
230
230
  ? relativeUrlWithRoot.slice(0, -1).split("/")
231
231
  : relativeUrlWithRoot.split("/");
232
+ const items = [];
233
+ items.push({
234
+ href: "/",
235
+ text: "/",
236
+ });
232
237
  let dirPartsHtml = "";
233
238
  let i = 0;
234
239
  while (i < parts.length) {
@@ -236,7 +241,16 @@ const generateDirectoryNav = (relativeUrl, rootDirectoryUrl) => {
236
241
  const href = i === 0 ? "/..." : `/${parts.slice(1, i + 1).join("/")}/`;
237
242
  const text = part;
238
243
  const isLastPart = i === parts.length - 1;
239
- if (isLastPart) {
244
+ items.push({
245
+ href,
246
+ text,
247
+ isCurrent: isLastPart,
248
+ });
249
+ i++;
250
+ }
251
+ i = 0;
252
+ for (const { href, text, isCurrent } of items) {
253
+ if (isCurrent) {
240
254
  dirPartsHtml += `
241
255
  <span class="directory_nav_item" data-current>
242
256
  ${text}
@@ -247,13 +261,15 @@ const generateDirectoryNav = (relativeUrl, rootDirectoryUrl) => {
247
261
  <a class="directory_nav_item" href="${href}">
248
262
  ${text}
249
263
  </a>`;
250
- dirPartsHtml += `
251
- <span class="directory_separator">/</span>`;
264
+ if (i > 0) {
265
+ dirPartsHtml += `
266
+ <span class="directory_separator">/</span>`;
267
+ }
252
268
  i++;
253
269
  }
254
270
  if (isDir) {
255
271
  dirPartsHtml += `
256
- <span class="directory_separator">/</span>`;
272
+ <span class="directory_separator">/</span>`;
257
273
  }
258
274
  return dirPartsHtml;
259
275
  };