tecitheme 0.0.13 → 0.0.16

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.
@@ -4,9 +4,11 @@
4
4
  export let caption;
5
5
  </script>
6
6
 
7
- <section class="flex justify-center not-prose">
7
+ <section class="flex justify-center not-prose mb-8">
8
8
  <figure class="bg-white w-auto mx-auto shadow-lg border border-slate-100 p-2">
9
- <img class="w-full" src={image} alt={title} title={title}>
9
+ <a href={image}>
10
+ <img class="w-full" src={image} alt={title} title={title}>
11
+ </a>
10
12
  {#if caption}
11
13
  <figcaption class="text-center p-2">{@html caption}</figcaption>
12
14
  {/if}
@@ -21,7 +21,7 @@
21
21
  }
22
22
  </script>
23
23
 
24
- <footer class="bg-gray-800" aria-labelledby="footerHeading">
24
+ <footer id="bottom" class="bg-gray-800" aria-labelledby="footerHeading">
25
25
  <h2 id="footerHeading" class="sr-only">Footer</h2>
26
26
  <div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:py-16 lg:px-8">
27
27
  <div class="xl:grid xl:grid-cols-3 xl:gap-8">
@@ -50,11 +50,7 @@
50
50
  />
51
51
  </span>
52
52
  {:else if icon?.startsWith("icon-")}
53
- <span class="not-prose">
54
- <div class="{classes} bg-teci-blue-dark flex flex-col justify-center items-center">
55
- <span class="material-icons block text-4xl text-white">{icon?.slice(5)}</span>
56
- </div>
57
- </span>
53
+ <span class="material-icons-outlined {classes}">{icon?.slice(5)}</span>
58
54
  {:else}
59
55
  <span class="not-prose">
60
56
  <svg class={classes} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 250 250">
@@ -16,7 +16,7 @@
16
16
  }} />
17
17
 
18
18
  {#if shown}
19
- <div class="fixed inset-0 bg-gray-900 bg-opacity-50 overflow-y-auto h-full w-full">
19
+ <div class="z-50 fixed inset-0 bg-gray-900 bg-opacity-50 overflow-y-auto h-full w-full">
20
20
  <div class="relative top-20 mx-auto p-5 border w-96 shadow-lg bg-white">
21
21
  <button type="button" on:click={hide} class="absolute top-0 right-0 bg-white p-1 mr-2 mt-2 inline-flex items-center justify-center text-teci-blue-light hover:text-white hover:bg-teci-blue-dark focus:outline-none focus:ring-2 focus:ring-inset focus:ring-teci-blue-dark">
22
22
  <span class="sr-only">Close menu</span>
@@ -1,4 +1,5 @@
1
1
  <script>
2
+ import { DateTime } from "luxon";
2
3
  export let data;
3
4
  export let posts;
4
5
  </script>
@@ -35,7 +36,7 @@
35
36
  {#each posts as post}
36
37
  <div>
37
38
  <p class="text-sm text-gray-500">
38
- <time datetime={post.meta.date}>{post.meta.date}</time>
39
+ <time datetime={post.meta.date}>{DateTime.fromISO(post.meta.date).toLocaleString()}</time>
39
40
  </p>
40
41
  <a href={post.path} class="mt-2 block">
41
42
  <p class="text-xl font-semibold text-gray-900">
@@ -1,53 +1,59 @@
1
1
  <script>
2
2
  import { onMount } from "svelte";
3
- export let data;
3
+ import { buildToC } from "../utils.js";
4
+ import { DateTime } from "luxon";
4
5
 
5
- let tocMoved = false;
6
+ export let data;
7
+ export let title;
8
+ export let date;
9
+ export let lastmod;
6
10
 
7
- onMount(() => {
8
- function moveTOC() {
9
- console.log("Moving TOC");
10
- var oldParent = document.getElementsByClassName('page-toc')[0];
11
- if (oldParent && oldParent.nodeType == 1){
12
- var newParent = document.getElementById('sidebar-nav');
13
- var loader = document.getElementById('loader');
14
- var classes = oldParent.classList;
15
- newParent.insertAdjacentElement('beforeend', oldParent)
16
- loader.remove();
17
- classes.remove("hidden");
18
- tocMoved = true;
19
- console.log("TOC Moved")
20
- } else {
21
- console.log(tocMoved, oldParent);
22
- if(!tocMoved && oldParent == undefined){
23
- console.log("Reloading");
24
- window.location.reload();
25
- } else {
26
- console.log("Leave it alone.")
27
- tocMoved = true;
28
- }
29
- }
30
- };
11
+ let formattedDate = (date != undefined ? DateTime.fromISO(date).toLocaleString() : undefined)
12
+ let formattedLastModDate = (lastmod != undefined ? DateTime.fromISO(lastmod).toLocaleString() : undefined)
13
+ let tocOpen = false;
14
+ let tocBuilt = false;
15
+ let w;
16
+
17
+ $: if (w > 702 && tocOpen == false) {tocOpen = true}
31
18
 
32
- if (tocMoved == false && data.sidebar) {
33
- moveTOC();
19
+ onMount( async () => {
20
+ if (data.toc) {
21
+ tocBuilt = buildToC();
34
22
  };
35
23
  });
36
24
  </script>
37
25
 
38
- <section class="w-auto mx-auto flex flex-col lg:flex-row items-start lg:space-x-8">
39
- {#if data.sidebar}
40
- <div id="sidebar-nav" class="pr-4 lg:text-right font-medium mb-4 w-auto lg:max-w-xs lg:mb-0 lg:w-60 lg:sticky lg:top-8 shrink-0 lg:border-r lg:border-r-gray-400">
41
- <div id="loader">
42
- <svg role="status" class="inline-block mr-2 w-6 h-6 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
43
- <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
44
- <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
45
- </svg>
46
- <span class="inline-block">Loading...</span>
47
- </div>
48
- </div>
49
- {/if}
50
- <div id="text" class="w-full prose max-w-none lg:max-w-prose">
26
+ <section bind:clientWidth={w} class="relative flex flex-row { data.fullWidth ? 'mx-0' : 'mx-auto'} {(data.toc || data.rightRail) ? 'md:space-x-8' : 'space-x-0'}">
27
+
28
+ <div id="content" class="prose w-full { data.fullWidth ? 'max-w-none' : 'max-w-prose'}">
29
+ <h1>{title}</h1>
30
+ <p>Published: {formattedDate}{#if (formattedLastModDate != formattedDate && formattedLastModDate)}, Updated: {formattedLastModDate}{/if}</p>
51
31
  <slot />
52
32
  </div>
33
+ <aside class="relative w-0 {(data.toc || data.rightRail) ? 'md:w-60' : 'hidden'}">
34
+ {#if data.toc}
35
+ <div class="sticky top-8 shrink-0 flex flex-col">
36
+ <button on:click={() => {tocOpen = !tocOpen;}}
37
+ class="md:hidden absolute -left-10 w-10 h-10 flex items-center justify-center border border-teci-blue-light text-teci-blue-light bg-white
38
+ {tocOpen ? 'border-opacity-100 bg-opacity-100 text-opacity-100' : 'border-opacity-60 bg-opacity-20 text-opacity-60 hover:border-opacity-100 hover:bg-opacity-100 hover:text-opacity-100'}"
39
+ title="Table of Contents Toggle" alt="Table of Contents Toggle"
40
+ >
41
+ <span class="material-icons-outlined">menu_open</span>
42
+ </button>
43
+ {#if tocBuilt == false}
44
+ <svg role="status" class="inline-block m-2 w-6 h-6 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
45
+ <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
46
+ <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
47
+ </svg>
48
+ {/if}
49
+ <div id="ToC" class="absolute md:relative -left-[282px] border shadow-md bg-white md:left-0 font-medium text-right md:text-left p-2 {tocOpen ? 'block w-60 mb-4' : 'hidden'}">
50
+ </div>
51
+ </div>
52
+ {/if}
53
+ {#if data.rightRail}
54
+ <div class="hidden md:block p-2 bg-gray-200 {(data.toc || data.rightRail) ? 'md:w-60' : 'w-0'}">
55
+ Dynamic Stuff
56
+ </div>
57
+ {/if}
58
+ </aside>
53
59
  </section>
@@ -3,6 +3,9 @@
3
3
  /** @typedef {typeof __propDef.slots} SidebarContentSlots */
4
4
  export default class SidebarContent extends SvelteComponentTyped<{
5
5
  data: any;
6
+ title: any;
7
+ date: any;
8
+ lastmod: any;
6
9
  }, {
7
10
  [evt: string]: CustomEvent<any>;
8
11
  }, {
@@ -16,6 +19,9 @@ import { SvelteComponentTyped } from "svelte";
16
19
  declare const __propDef: {
17
20
  props: {
18
21
  data: any;
22
+ title: any;
23
+ date: any;
24
+ lastmod: any;
19
25
  };
20
26
  events: {
21
27
  [evt: string]: CustomEvent<any>;
@@ -11,6 +11,7 @@
11
11
  export let data = [
12
12
  {
13
13
  icon: 'pyrosim',
14
+ classes: 'h-12 w-12',
14
15
  image: 'https://www.thunderheadeng.com/wp-content/uploads/2013/09/company_pyrosim.jpg',
15
16
  heading: 'Product 1',
16
17
  subheading: 'Nutshell',
@@ -19,6 +20,7 @@
19
20
  },
20
21
  {
21
22
  icon: '',
23
+ classes: '',
22
24
  image: 'https://www.thunderheadeng.com/wp-content/uploads/2013/08/company_pathfinder.png',
23
25
  heading: 'Product 2',
24
26
  subheading: 'No Icon',
@@ -28,6 +30,7 @@
28
30
  {
29
31
  icon: 'icon-auto_stories',
30
32
  image: 'https://www.thunderheadeng.com/wp-content/uploads/2013/08/company_petrasim.png',
33
+ classes: 'bg-teci-blue-dark text-white text-4xl grid place-items-center h-12 w-12',
31
34
  heading: 'Google Icon, No Subtitle or Text',
32
35
  subheading: '',
33
36
  text: '',
@@ -39,19 +42,21 @@
39
42
  <!-- This example requires Tailwind CSS v2.0+ -->
40
43
  <div class="w-full mx-auto">
41
44
  <h2 class="sr-only">{title}</h2>
42
- <dl class="space-y-10 sm:grid sm:grid-cols-2 sm:gap-8 sm:space-y-0 lg:grid-cols-3">
45
+ <dl class="space-y-10 sm:grid sm:grid-cols-2 sm:gap-8 sm:space-y-0 md:grid-cols-3">
43
46
  {#each data as col}
44
47
  <div>
45
48
  <a href={col.linkURL}>
46
49
  <div class="space-y-4">
47
50
  {#if col.image}
48
51
  <div class="w-full aspect-square bg-slate-100">
49
- <img class="w-full aspect-square object-cover shadow-md border border-gray-200" src={col.image} alt="" />
52
+ <img class="w-full aspect-square object-cover shadow-md border border-gray-200" src={col.image} title={col.heading} alt={col.heading} />
50
53
  </div>
51
54
  {/if}
52
55
  <div class="flex flex-row items-start space-x-4">
53
56
  {#if col.icon}
54
- <Icon classes="h-12 w-12" icon={col.icon} />
57
+ <div class="grid place-items-center">
58
+ <Icon classes={col.classes} icon={col.icon} />
59
+ </div>
55
60
  {/if}
56
61
  <div class="leading-none font-medium flex flex-col">
57
62
  <h3 class="text-2xl leading-none">{col.heading}</h3>
@@ -4,6 +4,7 @@
4
4
  export default class ThreeColumn extends SvelteComponentTyped<{
5
5
  data?: {
6
6
  icon: string;
7
+ classes: string;
7
8
  image: string;
8
9
  heading: string;
9
10
  subheading: string;
@@ -23,6 +24,7 @@ declare const __propDef: {
23
24
  props: {
24
25
  data?: {
25
26
  icon: string;
27
+ classes: string;
26
28
  image: string;
27
29
  heading: string;
28
30
  subheading: string;
@@ -6,14 +6,19 @@
6
6
  import CTA from '../components/CTA.svelte';
7
7
  import SidebarContent from '../components/SidebarContent.svelte';
8
8
  import MediaFeature from '../components/MediaFeature.svelte';
9
+ import TrialForm from '../components/TrialForm.svelte';
9
10
 
10
11
  export let title
12
+ export let date
13
+ export let lastmod
11
14
  export let page_sections
12
15
  export let posts
16
+ export let summary
13
17
  </script>
14
18
 
15
19
  <svelte:head>
16
20
  <title>{title} | Thunderhead Engineering</title>
21
+ <meta name="description" content={summary}>
17
22
  </svelte:head>
18
23
 
19
24
  <article class="flex flex-col space-y-12">
@@ -29,11 +34,13 @@
29
34
  {:else if section.fieldGroup == "cta-center"}
30
35
  <CTA bind:data={section} />
31
36
  {:else if section.fieldGroup == "sidebar-content"}
32
- <SidebarContent bind:data={section}>
37
+ <SidebarContent bind:data={section} {title} {date} {lastmod} {summary}>
33
38
  <slot/>
34
39
  </SidebarContent>
35
40
  {:else if section.fieldGroup == "media-feature"}
36
41
  <MediaFeature bind:data={section} />
42
+ {:else if section.fieldGroup == "trial"}
43
+ <TrialForm />
37
44
  {:else if section.fieldGroup == "content"}
38
45
  <div class="content prose"><slot/></div>
39
46
  {/if}
@@ -3,8 +3,11 @@
3
3
  /** @typedef {typeof __propDef.slots} BlocksSlots */
4
4
  export default class Blocks extends SvelteComponentTyped<{
5
5
  title: any;
6
+ date: any;
7
+ lastmod: any;
6
8
  page_sections: any;
7
9
  posts: any;
10
+ summary: any;
8
11
  }, {
9
12
  [evt: string]: CustomEvent<any>;
10
13
  }, {
@@ -18,8 +21,11 @@ import { SvelteComponentTyped } from "svelte";
18
21
  declare const __propDef: {
19
22
  props: {
20
23
  title: any;
24
+ date: any;
25
+ lastmod: any;
21
26
  page_sections: any;
22
27
  posts: any;
28
+ summary: any;
23
29
  };
24
30
  events: {
25
31
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tecitheme",
3
- "version": "0.0.13",
3
+ "version": "0.0.16",
4
4
  "svelte": true,
5
5
  "devDependencies": {
6
6
  "@jsdevtools/rehype-toc": "^3.0.2",
@@ -18,6 +18,7 @@
18
18
  "eslint": "^7.32.0",
19
19
  "eslint-config-prettier": "^8.3.0",
20
20
  "eslint-plugin-svelte3": "^3.4.0",
21
+ "luxon": "^2.3.1",
21
22
  "mdsvex": "^0.10.5",
22
23
  "postcss": "^8.4.6",
23
24
  "prettier": "^2.5.1",
@@ -35,7 +36,8 @@
35
36
  "three": "^0.137.5",
36
37
  "tslib": "^2.3.1",
37
38
  "typescript": "^4.5.5",
38
- "vite": "^2.8.3"
39
+ "vite": "^2.8.3",
40
+ "vite-plugin-autoimport": "^1.4.3"
39
41
  },
40
42
  "type": "module",
41
43
  "dependencies": {
@@ -64,7 +66,6 @@
64
66
  "./components/TrialForm.svelte": "./components/TrialForm.svelte",
65
67
  "./components/YT.svelte": "./components/YT.svelte",
66
68
  "./layouts/blocks.svelte": "./layouts/blocks.svelte",
67
- "./layouts/news.svelte": "./layouts/news.svelte",
68
69
  "./req_utils": "./req_utils.js",
69
70
  "./utils": "./utils.js",
70
71
  "./variables": "./variables.js"
package/utils.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export function scrollTo(anchor: any): void;
2
2
  export function validateEmail(email: any): boolean;
3
+ export function buildToC(): boolean;
3
4
  export function slugFromPath(path: any): any;
package/utils.js CHANGED
@@ -9,4 +9,67 @@ export function validateEmail(email) {
9
9
  return re.test(String(email).toLowerCase());
10
10
  }
11
11
 
12
- export const slugFromPath = (path) => path.match(/([\w-]+)\.(svelte\.md|md|svx)/i)?.[1] ?? null;
12
+ export const slugFromPath = (path) => path.match(/([\w-]+)\.(svelte\.md|md|svx)/i)?.[1] ?? null;
13
+
14
+ export function buildToC() {
15
+ // Based on https://projectcodeed.blogspot.com/2020/04/an-automatic-table-of-contents.html
16
+
17
+ // Get ToC div
18
+ let toc = document.getElementById("ToC");
19
+
20
+ //Add a header
21
+ var tocHeader = document.createElement("a");
22
+ tocHeader.classList.add("mb-2", "inline-block", "w-auto", "text-center", "bg-gray-50", "hover:bg-gray-100", "py-1", "px-2", "border")
23
+ tocHeader.innerHTML = "<span class='material-icons-outlined text-sm font-bold text-gray-500 align-text-bottom'>vertical_align_top</span>";
24
+ tocHeader.setAttribute("href","#top");
25
+ tocHeader.setAttribute("title","To Top of Page");
26
+ toc.appendChild(tocHeader);
27
+
28
+ // Create a list for the ToC entries
29
+ let tocList = document.createElement("ul");
30
+
31
+ // Find the primary content section
32
+ let content = document.getElementById("content")
33
+
34
+ // Get the h2 tags - ToC entries
35
+ let headers = content.getElementsByTagName("h2");
36
+
37
+ if (headers.length == 0) {
38
+ console.log("There are not any H2 elements in the document.");
39
+ } else {
40
+ // For each h2
41
+ for (let i = 0; i < headers.length; i++){
42
+
43
+ // Get Heading ID
44
+ let name = headers[i].id
45
+
46
+ // list item for the entry
47
+ let tocListItem = document.createElement("li");
48
+ tocListItem.classList.add("text-teci-blue-light", "hover:text-teci-blue-dark", "text-sm", "truncate");
49
+
50
+ // link for the h2
51
+ let tocEntry = document.createElement("a");
52
+ tocEntry.setAttribute("href","#"+name);
53
+ tocEntry.innerText=headers[i].innerText;
54
+
55
+ // add link to list item list
56
+ tocListItem.appendChild(tocEntry);
57
+
58
+ // add list item to list
59
+ tocList.appendChild(tocListItem);
60
+ }
61
+
62
+ // add list to toc element
63
+ toc.appendChild(tocList);
64
+
65
+ //Add a footer
66
+ //var tocFooter = document.createElement("a");
67
+ //tocFooter.classList.add("mt-2", "inline-block", "w-auto", "text-center", "bg-gray-50", "hover:bg-gray-100", "py-1", "px-2", "border")
68
+ //tocFooter.innerHTML="<span class='material-icons-outlined text-sm font-bold text-gray-500 align-text-bottom'>vertical_align_bottom</span>";
69
+ //tocFooter.setAttribute("href","#bottom");
70
+ //tocFooter.setAttribute("title","To Bottom of Page");
71
+ //toc.appendChild(tocFooter);
72
+
73
+ return true;
74
+ }
75
+ }
@@ -1,14 +0,0 @@
1
- <script>
2
- export let title;
3
- export let date;
4
- </script>
5
-
6
- <svelte:head>
7
- <title>{title} | Thunderhead Engineering</title>
8
- </svelte:head>
9
-
10
- <div class="prose lg:prose-lg">
11
- <h1>{title}</h1>
12
- <p>Published on {date}</p>
13
- <slot/>
14
- </div>
@@ -1,29 +0,0 @@
1
- /** @typedef {typeof __propDef.props} NewsProps */
2
- /** @typedef {typeof __propDef.events} NewsEvents */
3
- /** @typedef {typeof __propDef.slots} NewsSlots */
4
- export default class News extends SvelteComponentTyped<{
5
- title: any;
6
- date: any;
7
- }, {
8
- [evt: string]: CustomEvent<any>;
9
- }, {
10
- default: {};
11
- }> {
12
- }
13
- export type NewsProps = typeof __propDef.props;
14
- export type NewsEvents = typeof __propDef.events;
15
- export type NewsSlots = typeof __propDef.slots;
16
- import { SvelteComponentTyped } from "svelte";
17
- declare const __propDef: {
18
- props: {
19
- title: any;
20
- date: any;
21
- };
22
- events: {
23
- [evt: string]: CustomEvent<any>;
24
- };
25
- slots: {
26
- default: {};
27
- };
28
- };
29
- export {};