tecitheme 0.15.9 → 0.15.11
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.
- package/dist/components/BentoGrid.svelte +2 -2
- package/dist/components/CTATwoColumn.svelte +1 -1
- package/dist/components/FeatureAlternatingWithTestimonial.svelte +1 -1
- package/dist/components/SidebarContent.svelte +5 -3
- package/dist/layouts/blocks.svelte +3 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +85 -14
- package/package.json +1 -1
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
<div class="mx-auto max-w-2xl px-6 lg:max-w-7xl lg:px-8">
|
|
37
37
|
|
|
38
38
|
<!-- Eyebrow Text -->
|
|
39
|
-
<
|
|
39
|
+
<p class="font-semibold {getColorStyles("text", color)} text-center w-full">{eyebrowText ? eyebrowText : ""}</p>
|
|
40
40
|
|
|
41
41
|
<!-- Heading -->
|
|
42
|
-
<a id={id+"Heading"} href={`#${id}`} class="mt-2 text-balance text-center text-4xl font-semibold tracking-tight sm:text-5xl w-full text-gray-900 mx-auto"><
|
|
42
|
+
<a id={id+"Heading"} href={`#${id}`} class="mt-2 text-balance text-center text-4xl font-semibold tracking-tight sm:text-5xl w-full text-gray-900 mx-auto"><h2>{heading ? heading : ""}</h2></a>
|
|
43
43
|
|
|
44
44
|
<!-- Grid -->
|
|
45
45
|
<div class="mt-10 grid grid-cols-1 gap-4 sm:mt-16 {getGridSizeStyles(columns, rows)}">
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<div class="w-full flex-auto">
|
|
49
49
|
|
|
50
50
|
<!-- Heading -->
|
|
51
|
-
<a id={id+"Heading"} href={`#${id}`} class="text-4xl font-semibold tracking-tight text-pretty sm:text-5xl
|
|
51
|
+
<a id={id+"Heading"} href={`#${id}`} class="text-4xl font-semibold tracking-tight text-pretty sm:text-5xl"><h2>{heading}</h2></a>
|
|
52
52
|
|
|
53
53
|
{#if $scrollTargetVisible || !animate}
|
|
54
54
|
<!-- Text -->
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
out:conditionalTransition={{fn: fade, condition: animate, delay: 200, duration: 750, easing:cubicInOut}}
|
|
72
72
|
>
|
|
73
73
|
{#if heading}
|
|
74
|
-
<a href={`#${id}`} class="text-3xl font-bold tracking-tight text-gray-900">{heading}</a>
|
|
74
|
+
<a href={`#${id}`} class="text-3xl font-bold tracking-tight text-gray-900"><h2>{heading}</h2></a>
|
|
75
75
|
{/if}
|
|
76
76
|
|
|
77
77
|
<p class="mt-4 text-lg text-gray-500">{text}</p>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { onMount } from "svelte";
|
|
2
|
+
import { getContext, onMount } from "svelte";
|
|
3
3
|
import { buildToC, makeIdString } from "../utils.js";
|
|
4
4
|
|
|
5
5
|
export let data = {};
|
|
@@ -40,9 +40,11 @@
|
|
|
40
40
|
|
|
41
41
|
onMount(async () => {
|
|
42
42
|
if (data.toc) {
|
|
43
|
-
tocBuilt = buildToC();
|
|
43
|
+
tocBuilt = buildToC(data.tocDepth);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
+
|
|
47
|
+
let pageNavPresent = getContext("pageNavPresent");
|
|
46
48
|
</script>
|
|
47
49
|
|
|
48
50
|
<section {id}
|
|
@@ -70,7 +72,7 @@
|
|
|
70
72
|
{#if (data.toc || data.rightRail)}
|
|
71
73
|
<aside class="relative w-0 md:w-60">
|
|
72
74
|
{#if data.toc}
|
|
73
|
-
<div class="sticky top-8 flex shrink-0 flex-col">
|
|
75
|
+
<div class="sticky { pageNavPresent ? "top-20" : "top-8" } flex shrink-0 flex-col">
|
|
74
76
|
<button
|
|
75
77
|
on:click={() => {
|
|
76
78
|
tocOpen = !tocOpen;
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
import PartnersList from "../components/PartnersList.svelte";
|
|
26
26
|
import DescriptionList from "../components/DescriptionList.svelte";
|
|
27
27
|
import Carousel from "../components/Carousel.svelte";
|
|
28
|
+
import { setContext } from "svelte";
|
|
28
29
|
|
|
29
30
|
let blocks = [
|
|
30
31
|
{ ref: "accordion", component: Accordion },
|
|
@@ -76,6 +77,8 @@
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
let pageNav = page_sections ? page_sections.filter(sect => sect.fieldGroup === "pageNav")[0] : undefined;
|
|
80
|
+
|
|
81
|
+
setContext("pageNavPresent", pageNav ? true : false);
|
|
79
82
|
</script>
|
|
80
83
|
|
|
81
84
|
<svelte:head>
|
package/dist/utils.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function getGridRowSizeStyle(num: any): "lg:grid-rows-1" | "lg:grid-rows-
|
|
|
40
40
|
export function getGridSizeStyles(columns: any, rows: any): string;
|
|
41
41
|
export function validateEmail(email: any): boolean;
|
|
42
42
|
export function slugFromPath(path: any): void;
|
|
43
|
-
export function buildToC(): boolean;
|
|
43
|
+
export function buildToC(tocDepth?: number): boolean;
|
|
44
44
|
export function makeIdString(text: any): string;
|
|
45
45
|
/**
|
|
46
46
|
* Converts a simplified image source string in to the proper TECi Image src. If imageSrc is an absolute url (starts with http) it is returned unchanged
|
package/dist/utils.js
CHANGED
|
@@ -364,7 +364,7 @@ export function slugFromPath(path) {
|
|
|
364
364
|
path.match(/([\w-]+)\.(svelte\.md|md|svx)/i)?.[1] ?? null;
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
export function buildToC() {
|
|
367
|
+
export function buildToC(tocDepth = 6) {
|
|
368
368
|
// Based on https://projectcodeed.blogspot.com/2020/04/an-automatic-table-of-contents.html
|
|
369
369
|
|
|
370
370
|
// Get ToC div
|
|
@@ -393,32 +393,103 @@ export function buildToC() {
|
|
|
393
393
|
let tocList = document.createElement("ul");
|
|
394
394
|
|
|
395
395
|
// Find the primary content section
|
|
396
|
-
let content = document.getElementById("content");
|
|
396
|
+
let content = document.getElementById("content").getHTML();
|
|
397
397
|
|
|
398
|
-
|
|
399
|
-
let headers = content.getElementsByTagName("h2");
|
|
398
|
+
let headings = [];
|
|
400
399
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
400
|
+
// Set up depth search
|
|
401
|
+
let headingLevels = [];
|
|
402
|
+
for (let i=0; i<=tocDepth; i++) {
|
|
403
|
+
headingLevels.push(i.toString())
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// Look for all levels of headings
|
|
407
|
+
for (const level of headingLevels)
|
|
408
|
+
{
|
|
409
|
+
const regexp = new RegExp(String.raw`<h${level}([^>]*)>([^<>]*)<\/h${level}>`, "gm")
|
|
410
|
+
let h = Array.from(content.matchAll(regexp));
|
|
411
|
+
|
|
412
|
+
for (const tag of h)
|
|
413
|
+
{
|
|
414
|
+
let src = tag[0];
|
|
415
|
+
let text = tag[2];
|
|
416
|
+
let matches = src.match(/id="([^ ]*)"/);
|
|
417
|
+
if (matches) {
|
|
418
|
+
let tagRef = "#" + matches[1];
|
|
419
|
+
|
|
420
|
+
let data = {
|
|
421
|
+
src,
|
|
422
|
+
text,
|
|
423
|
+
index: tag["index"],
|
|
424
|
+
tagRef,
|
|
425
|
+
level: parseInt(level)
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
headings.push(data);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Sort headings by index
|
|
434
|
+
headings = headings.sort((tag1, tag2) => {
|
|
435
|
+
if (tag1.index < tag2.index)
|
|
436
|
+
{
|
|
437
|
+
return -1;
|
|
438
|
+
}
|
|
439
|
+
else if (tag1.index > tag2.index)
|
|
440
|
+
{
|
|
441
|
+
return 1;
|
|
442
|
+
}
|
|
443
|
+
else
|
|
444
|
+
{
|
|
445
|
+
return 0;
|
|
446
|
+
}
|
|
447
|
+
});
|
|
408
448
|
|
|
449
|
+
|
|
450
|
+
// Build heading links
|
|
451
|
+
if (headings.length == 0) {
|
|
452
|
+
console.log("There are not any heading elements in the document.");
|
|
453
|
+
} else {
|
|
454
|
+
// For each heading
|
|
455
|
+
for (const heading of headings) {
|
|
409
456
|
// list item for the entry
|
|
410
457
|
let tocListItem = document.createElement("li");
|
|
458
|
+
|
|
459
|
+
// Figure out how much margin to give the heading
|
|
460
|
+
let margin = "";
|
|
461
|
+
switch (heading.level) {
|
|
462
|
+
case 2:
|
|
463
|
+
margin = "ml-0";
|
|
464
|
+
break;
|
|
465
|
+
case 3:
|
|
466
|
+
margin = "ml-2";
|
|
467
|
+
break;
|
|
468
|
+
case 4:
|
|
469
|
+
margin = "ml-3";
|
|
470
|
+
break;
|
|
471
|
+
case 5:
|
|
472
|
+
margin = "ml-4";
|
|
473
|
+
break;
|
|
474
|
+
case 6:
|
|
475
|
+
margin = "ml-6";
|
|
476
|
+
break;
|
|
477
|
+
default:
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
|
|
411
481
|
tocListItem.classList.add(
|
|
412
482
|
"text-teci-blue-light",
|
|
413
483
|
"hover:text-teci-blue-dark",
|
|
414
484
|
"text-sm",
|
|
415
|
-
"truncate"
|
|
485
|
+
"truncate",
|
|
486
|
+
margin
|
|
416
487
|
);
|
|
417
488
|
|
|
418
489
|
// link for the h2
|
|
419
490
|
let tocEntry = document.createElement("a");
|
|
420
|
-
tocEntry.setAttribute("href",
|
|
421
|
-
tocEntry.innerText =
|
|
491
|
+
tocEntry.setAttribute("href", heading.tagRef);
|
|
492
|
+
tocEntry.innerText = heading.text;
|
|
422
493
|
|
|
423
494
|
// add link to list item list
|
|
424
495
|
tocListItem.appendChild(tocEntry);
|