tecitheme 0.0.14 → 0.0.15

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,7 +4,7 @@
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
9
  <img class="w-full" src={image} alt={title} title={title}>
10
10
  {#if caption}
@@ -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,8 +1,15 @@
1
1
  <script>
2
2
  import { onMount } from "svelte";
3
+ import { buildToC } from "../utils.js";
4
+ import { DateTime } from "luxon";
3
5
 
4
6
  export let data;
7
+ export let title;
8
+ export let date;
9
+ export let lastmod;
5
10
 
11
+ let formattedDate = (date != undefined ? DateTime.fromISO(date).toLocaleString() : undefined)
12
+ let formattedLastModDate = (lastmod != undefined ? DateTime.fromISO(lastmod).toLocaleString() : undefined)
6
13
  let tocOpen = false;
7
14
  let tocBuilt = false;
8
15
  let w;
@@ -14,73 +21,13 @@
14
21
  tocBuilt = buildToC();
15
22
  };
16
23
  });
17
-
18
- function buildToC() {
19
- // Based on https://projectcodeed.blogspot.com/2020/04/an-automatic-table-of-contents.html
20
-
21
- // Get ToC div
22
- let toc = document.getElementById("ToC");
23
-
24
- //Add a header
25
- var tocHeader = document.createElement("a");
26
- tocHeader.classList.add("mb-2", "inline-block", "w-auto", "text-center", "bg-gray-50", "hover:bg-gray-100", "py-1", "px-2", "border")
27
- tocHeader.innerHTML = "<span class='material-icons-outlined text-sm font-bold text-gray-500 align-text-bottom'>vertical_align_top</span>";
28
- tocHeader.setAttribute("href","#top");
29
- tocHeader.setAttribute("title","To Top of Page");
30
- toc.appendChild(tocHeader);
31
-
32
- // Create a list for the ToC entries
33
- let tocList = document.createElement("ul");
34
-
35
- // Find the primary content section
36
- let content = document.getElementById("content")
37
-
38
- // Get the h2 tags - ToC entries
39
- let headers = content.getElementsByTagName("h2");
40
-
41
- if (headers.length == 0) {
42
- console.log("There are not any H2 elements in the document.");
43
- } else {
44
- // For each h2
45
- for (let i = 0; i < headers.length; i++){
46
-
47
- // Get Heading ID
48
- let name = headers[i].id
49
-
50
- // list item for the entry
51
- let tocListItem = document.createElement("li");
52
- tocListItem.classList.add("text-teci-blue-light", "hover:text-teci-blue-dark", "text-sm", "truncate");
53
-
54
- // link for the h2
55
- let tocEntry = document.createElement("a");
56
- tocEntry.setAttribute("href","#"+name);
57
- tocEntry.innerText=headers[i].innerText;
58
-
59
- // add link to list item list
60
- tocListItem.appendChild(tocEntry);
61
-
62
- // add list item to list
63
- tocList.appendChild(tocListItem);
64
- }
65
-
66
- // add list to toc element
67
- toc.appendChild(tocList);
68
-
69
- //Add a footer
70
- //var tocFooter = document.createElement("a");
71
- //tocFooter.classList.add("mt-2", "inline-block", "w-auto", "text-center", "bg-gray-50", "hover:bg-gray-100", "py-1", "px-2", "border")
72
- //tocFooter.innerHTML="<span class='material-icons-outlined text-sm font-bold text-gray-500 align-text-bottom'>vertical_align_bottom</span>";
73
- //tocFooter.setAttribute("href","#bottom");
74
- //tocFooter.setAttribute("title","To Bottom of Page");
75
- //toc.appendChild(tocFooter);
76
-
77
- return true;
78
- }
79
- }
80
24
  </script>
81
25
 
82
- <section bind:clientWidth={w} class="relative mx-auto flex flex-row {(data.toc || data.rightRail) ? 'md:space-x-8' : 'space-x-0'}">
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
+
83
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>
84
31
  <slot />
85
32
  </div>
86
33
  <aside class="relative w-0 {(data.toc || data.rightRail) ? 'md:w-60' : 'hidden'}">
@@ -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>;
@@ -30,7 +30,7 @@
30
30
  {
31
31
  icon: 'icon-auto_stories',
32
32
  image: 'https://www.thunderheadeng.com/wp-content/uploads/2013/08/company_petrasim.png',
33
- classes: 'inline-block bg-teci-blue-dark text-white text-4xl text-center align-bottom h-12 w-12 pt-1 px-1',
33
+ classes: 'bg-teci-blue-dark text-white text-4xl grid place-items-center h-12 w-12',
34
34
  heading: 'Google Icon, No Subtitle or Text',
35
35
  subheading: '',
36
36
  text: '',
@@ -54,7 +54,9 @@
54
54
  {/if}
55
55
  <div class="flex flex-row items-start space-x-4">
56
56
  {#if col.icon}
57
- <Icon classes={col.classes} icon={col.icon} />
57
+ <div class="grid place-items-center">
58
+ <Icon classes={col.classes} icon={col.icon} />
59
+ </div>
58
60
  {/if}
59
61
  <div class="leading-none font-medium flex flex-col">
60
62
  <h3 class="text-2xl leading-none">{col.heading}</h3>
@@ -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.14",
3
+ "version": "0.0.15",
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 {};