6 Commits
v1.0 ... v1.01

9 changed files with 52 additions and 40 deletions

View File

@@ -195,8 +195,11 @@ module.exports = {
articles.forEach(article => { articles.forEach(article => {
let a = article.target; let a = article.target;
if (article.isIntersecting) { // console.log("observing: ", { id: a.getAttribute("id"), intersecting: a.isIntersecting } )
// if (article.intersectionRatio > 0) {
// console.log("Is interesecting: ", { id: article.target.getAttribute("id"), intersecting: article.isIntersecting, ratio: article.intersectionRatio } )
if (article.isIntersecting == true) {
let path = a.getAttribute("data-path"); let path = a.getAttribute("data-path");
path = "patterns/" + path = "patterns/" +
(a.getAttribute("data-core") == "true" ? (a.getAttribute("data-core") == "true" ?
@@ -207,12 +210,11 @@ module.exports = {
let ajx = new XMLHttpRequest(); let ajx = new XMLHttpRequest();
ajx.onreadystatechange = () => { ajx.onreadystatechange = () => {
if (ajx.readyState == 4) { if (ajx.readyState == 4) {
observer.unobserve(article.target); observer.unobserve(article.target);
switch (ajx.status) { switch (ajx.status) {
case 200: case 200:
a.innerHTML = a.innerHTML + ajx.responseText; a.innerHTML = a.innerHTML + ajx.responseText;
a.style.height = "auto"
switch (a.getAttribute("data-template")) { switch (a.getAttribute("data-template")) {
case "pug": case "pug":
a.querySelectorAll("pre").forEach((aa) => { a.querySelectorAll("pre").forEach((aa) => {
@@ -266,7 +268,6 @@ module.exports = {
break; break;
case 404: case 404:
if (typeof args.notFound == "function") args.notFound(a, path); if (typeof args.notFound == "function") args.notFound(a, path);
break; break;
@@ -274,6 +275,8 @@ module.exports = {
console.log("uncaught http error", { status: ajx.status, path: a.getAttribute("data-path") }); console.log("uncaught http error", { status: ajx.status, path: a.getAttribute("data-path") });
} }
a.style.height = "auto";
if (typeof args.done == "function") args.done(a); if (typeof args.done == "function") args.done(a);
} }
@@ -283,10 +286,12 @@ module.exports = {
} }
}) })
}, { threshold: 0, rootMargin: (document.body.clientHeight / 2) + "px" }) }, { threshold: 0, rootMargin: "100%" })
observer.observe(a); observer.observe(a);
} else {
a.style.height = "auto";
} }
}) })

View File

@@ -44,47 +44,47 @@
</p> </p>
<main id="main"> <main id="main">
<h1>DS2 core</h1> <h1>DS2 core</h1>
<article id="this-pattern-doesnt-exist" data-name="this pattern doesn't exist" data-status="deprecated" data-template="pug" data-core="false" data-path="this-pattern-doesnt-exist"> <article id="this-pattern-doesnt-exist" data-name="this pattern doesn't exist" data-status="deprecated" data-template="pug" data-core="false" data-path="this-pattern-doesnt-exist" style="height: 100vh">
<h1 class="status-deprecated"><span>This pattern doesn't exist <h1 class="status-deprecated"><span>This pattern doesn't exist
<tool-tip role="tooltip" inert="inert" tip-position="right">Deprecated</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Deprecated</tool-tip></span></h1>
</article> </article>
<article id="colours" data-name="colours" data-status="complete" data-template="pug" data-core="true" data-path="colours"> <article id="colours" data-name="colours" data-status="complete" data-template="pug" data-core="true" data-path="colours" style="height: 100vh">
<h1 class="status-complete"><span>Colours <h1 class="status-complete"><span>Colours
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="components" data-name="components" data-status="complete" data-template="none" data-core="false" data-path="components"> <article id="components" data-name="components" data-status="complete" data-template="none" data-core="false" data-path="components" style="height: 100vh">
<h1 class="status-complete"><span>Components <h1 class="status-complete"><span>Components
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="components-sticky-note" data-name="sticky-note" data-status="complete" data-template="pug" data-core="true" data-path="components/sticky-note"> <article id="components-sticky-note" data-name="sticky-note" data-status="complete" data-template="pug" data-core="true" data-path="components/sticky-note" style="height: 100vh">
<h1 class="status-complete"><span>Sticky note <h1 class="status-complete"><span>Sticky note
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="components-switch" data-name="switch" data-status="complete" data-template="pug" data-core="true" data-path="components/switch"> <article id="components-switch" data-name="switch" data-status="complete" data-template="pug" data-core="true" data-path="components/switch" style="height: 100vh">
<h1 class="status-complete"><span>Switch <h1 class="status-complete"><span>Switch
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="components-tooltip" data-name="tooltip" data-status="complete" data-template="pug" data-core="true" data-path="components/tooltip"> <article id="components-tooltip" data-name="tooltip" data-status="complete" data-template="pug" data-core="true" data-path="components/tooltip" style="height: 100vh">
<h1 class="status-complete"><span>Tooltip <h1 class="status-complete"><span>Tooltip
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="layouts" data-name="layouts" data-status="complete" data-template="none" data-core="true" data-path="layouts"> <article id="layouts" data-name="layouts" data-status="complete" data-template="none" data-core="true" data-path="layouts" style="height: 100vh">
<h1 class="status-complete"><span>Layouts <h1 class="status-complete"><span>Layouts
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="layouts-header" data-name="header" data-status="complete" data-template="pug" data-core="true" data-path="layouts/header"> <article id="layouts-header" data-name="header" data-status="complete" data-template="pug" data-core="true" data-path="layouts/header" style="height: 100vh">
<h1 class="status-complete"><span>Header <h1 class="status-complete"><span>Header
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="layouts-breakpoints" data-name="breakpoints" data-status="complete" data-template="pug" data-core="true" data-path="layouts/breakpoints"> <article id="layouts-breakpoints" data-name="breakpoints" data-status="complete" data-template="pug" data-core="true" data-path="layouts/breakpoints" style="height: 100vh">
<h1 class="status-complete"><span>Breakpoints <h1 class="status-complete"><span>Breakpoints
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="layouts-tabs" data-name="tabs" data-status="complete" data-template="pug" data-core="true" data-path="layouts/tabs"> <article id="layouts-tabs" data-name="tabs" data-status="complete" data-template="pug" data-core="true" data-path="layouts/tabs" style="height: 100vh">
<h1 class="status-complete"><span>Tabs <h1 class="status-complete"><span>Tabs
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>
<article id="status" data-name="status" data-status="complete" data-template="pug" data-core="true" data-path="status"> <article id="status" data-name="status" data-status="complete" data-template="pug" data-core="true" data-path="status" style="height: 100vh">
<h1 class="status-complete"><span>Status <h1 class="status-complete"><span>Status
<tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1> <tool-tip role="tooltip" inert="inert" tip-position="right">Complete</tool-tip></span></h1>
</article> </article>

View File

@@ -19,13 +19,13 @@
<p>The tab module can be initialised by importing a file with the javascript module using import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; contains a modularized version of the jQuery code, so that it can be called on demand. It is what is used in the design system so that the JavaScript can be called at run time (after loading content).</p> <p>The tab module can be initialised by importing a file with the javascript module using import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; contains a modularized version of the jQuery code, so that it can be called on demand. It is what is used in the design system so that the JavaScript can be called at run time (after loading content).</p>
<tabset id="tabs"> <tabset id="tabs">
<pre class="language-html" tab="html"> <pre class="language-html" tab="html">
<div class="tab-group" id="uniqueID"> <tabset id="uniqueID">
<div data-tab="[tab title]"></div> <div tab="[tab title]"></div>
<div data-tab="[tab title]"></div> <div tab="[tab title]"></div>
</div></pre> </tabset></pre>
<pre class="language-pug" tab="pug">div#uniqueID.tab-group <pre class="language-pug" tab="pug">tabset#uniqueID
div(data-tab="[tab title]") div(tab="[tab title]")
div(data-tab="[tab title]") div(tab="[tab title]")
</pre> </pre>
<pre class="language-css" tab="css">tabset, .tab-group { <pre class="language-css" tab="css">tabset, .tab-group {
margin: 2rem 0 1rem 0; margin: 2rem 0 1rem 0;

View File

@@ -189,8 +189,11 @@ module.exports = {
articles.forEach(article => { articles.forEach(article => {
let a = article.target; let a = article.target;
if (article.isIntersecting) { // console.log("observing: ", { id: a.getAttribute("id"), intersecting: a.isIntersecting } )
// if (article.intersectionRatio > 0) {
// console.log("Is interesecting: ", { id: article.target.getAttribute("id"), intersecting: article.isIntersecting, ratio: article.intersectionRatio } )
if (article.isIntersecting == true) {
let path = a.getAttribute("data-path"); let path = a.getAttribute("data-path");
path = "patterns/" + path = "patterns/" +
(a.getAttribute("data-core") == "true" ? (a.getAttribute("data-core") == "true" ?
@@ -201,12 +204,11 @@ module.exports = {
let ajx = new XMLHttpRequest(); let ajx = new XMLHttpRequest();
ajx.onreadystatechange = () => { ajx.onreadystatechange = () => {
if (ajx.readyState == 4) { if (ajx.readyState == 4) {
observer.unobserve(article.target); observer.unobserve(article.target);
switch (ajx.status) { switch (ajx.status) {
case 200: case 200:
a.innerHTML = a.innerHTML + ajx.responseText; a.innerHTML = a.innerHTML + ajx.responseText;
a.style.height = "auto"
switch (a.getAttribute("data-template")) { switch (a.getAttribute("data-template")) {
case "pug": case "pug":
a.querySelectorAll("pre").forEach((aa) => { a.querySelectorAll("pre").forEach((aa) => {
@@ -260,7 +262,6 @@ module.exports = {
break; break;
case 404: case 404:
if (typeof args.notFound == "function") args.notFound(a, path); if (typeof args.notFound == "function") args.notFound(a, path);
break; break;
@@ -268,6 +269,8 @@ module.exports = {
console.log("uncaught http error", { status: ajx.status, path: a.getAttribute("data-path") }); console.log("uncaught http error", { status: ajx.status, path: a.getAttribute("data-path") });
} }
a.style.height = "auto";
if (typeof args.done == "function") args.done(a); if (typeof args.done == "function") args.done(a);
} }
@@ -277,10 +280,12 @@ module.exports = {
} }
}) })
}, { threshold: 0, rootMargin: (document.body.clientHeight / 2) + "px" }) }, { threshold: 0, rootMargin: "100%" })
observer.observe(a); observer.observe(a);
} else {
a.style.height = "auto";
} }
}) })

View File

@@ -36,6 +36,7 @@ mixin show-content(items, path)
data-template=(items.template == undefined ? "pug" : items.template) data-template=(items.template == undefined ? "pug" : items.template)
data-core= (items.core ? "true" : "false") data-core= (items.core ? "true" : "false")
data-path=path data-path=path
style="height: 100vh"
) )
h1(class="status-" + items.status ) h1(class="status-" + items.status )

View File

@@ -1,7 +1,8 @@
//- DS2 core (c) 2024 Alexander McIlwraith //- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !default; // default breakpoints match bootstrap 5 breakpoints.
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px ) !default;
@mixin breakpoint-debug { @mixin breakpoint-debug {
body::before, body::after { body::before, body::after {

View File

@@ -6,23 +6,23 @@ block content
- -
- let list = [] - let list = []
- for(let i = 0; i < content.length; i++) { - for(let i = 0; i < content.length; i++) {
- list.push({ "name": content[i].name, "path": content[i].name, "status": content[i].status, "display": content[i].display } ) - list.push({ "name": content[i].name, "path": content[i].name, "status": content[i].status, "display": (content[i].hasOwnProperty("display") && content[i].display != "" ? content[i].display : content[i].name.toSentenceCase().toContent()) } )
- if (content[i].files != undefined) { - if (content[i].files != undefined) {
- for (let ii = 0; ii < content[i].files.length; ii++) { - for (let ii = 0; ii < content[i].files.length; ii++) {
- list.push({ "name": content[i].files[ii].name, "path": content[i].name +"."+ content[i].files[ii].name, "status": content[i].files[ii].status } ) - list.push({ "name": content[i].files[ii].name, "path": content[i].name +"."+ content[i].files[ii].name, "status": content[i].files[ii].status, "display": (content[i].files[ii].hasOwnProperty("display") && content[i].files[ii].display != "" ? content[i].files[ii].display : content[i].files[ii].name.toSentenceCase().toContent()) } )
- if (content[i].files[ii].files != undefined) { - if (content[i].files[ii].files != undefined) {
- for (let iii = 0; iii < content[i].files[ii].files.length; iii++) { - for (let iii = 0; iii < content[i].files[ii].files.length; iii++) {
- list.push({ "name": content[i].files[ii].files[iii].name, "path": content[i].name +"."+ content[i].files[ii].name + "." + content[i].files[ii].files[iii].name, "status": content[i].files[ii].files[iii].status } ) - list.push({ "name": content[i].files[ii].files[iii].name, "path": content[i].name +"."+ content[i].files[ii].name + "." + content[i].files[ii].files[iii].name, "status": content[i].files[ii].files[iii].status, "display": (content[i].files[ii].files[iii].hasOwnProperty("display") && content[i].files[ii].files[iii].display != "" ? content[i].files[ii].files[iii].display : content[i].files[ii].files[iii].name.toSentenceCase().toContent()) } )
- } - }
- } - }
- } - }
- } - }
- } - }
- list.sort((a, b) => { - list.sort((a, b) => {
- if (a.name < b.name) { - if (a.display < b.display) {
- return -1; - return -1;
- } - }
- if (a.name > b.name) { - if (a.display > b.display) {
- return 1; - return 1;
- } - }
- return 0; - return 0;

View File

@@ -1,4 +1,4 @@
div#uniqueID.tab-group tabset#uniqueID
div(data-tab="[tab title]") div(tab="[tab title]")
div(data-tab="[tab title]") div(tab="[tab title]")

View File

@@ -1,4 +1,4 @@
div#uniqueID.tab-group tabset#uniqueID
div(data-tab="[tab title]") div(tab="[tab title]")
div(data-tab="[tab title]") div(tab="[tab title]")