20 Commits
v1.0 ... v1.02

Author SHA1 Message Date
2cd25ad7bd Fixes #18 2024-09-16 16:29:32 -04:00
f358266533 Fixes #17 - add variable for colour text 2024-09-16 09:53:49 -04:00
b5ab99da8d Fixes #12 in the tab 2024-09-13 11:00:52 -04:00
5fa631a903 Fixes #12 2024-09-13 10:45:55 -04:00
c201ff8f63 Fixes #11 Second Parameter to false will not add spacer li 2024-09-03 17:55:37 -04:00
2c117442af Fixes #10 Force status for core patterns to complete 2024-09-03 17:43:07 -04:00
b60c118e41 Add font to tooltip 2024-08-21 13:30:10 -04:00
acdb794971 Move get url to self referential function 2024-08-20 13:08:46 -04:00
140b239cfc Update to allow tab and space or enter to select a tab and change copyright info 2024-08-16 21:10:37 -04:00
a60f831900 Add getCSS 2024-08-07 08:08:59 -04:00
ea92f5e7ac Update patterns use paths to match what download.php gives 2024-07-29 19:12:22 -04:00
3292729d53 Update pattern documentation 2024-07-28 15:30:51 -04:00
77a13bbd46 Update to handle multiple level statuses. 2024-07-25 17:21:52 -04:00
bdb7f0e0aa Fixed typo 2024-07-23 21:18:17 -04:00
0b82aa4be6 Update div.tab-group to use tabset 2024-07-23 20:50:36 -04:00
fd53ee174a Fixes #2 for performances issues 2024-07-23 18:08:37 -04:00
c94d5e565f Fixes #5 Update sort 2024-07-22 18:39:14 -04:00
552a204edd Fixes #5 Update to include display text in status an alpha reports 2024-07-22 18:24:29 -04:00
e7d4e2ab48 Added bootstrap comment 2024-07-22 12:01:15 -04:00
fa165d530f Added XXL breakpoint to match bootstrap v5.0 2024-07-22 12:00:26 -04:00
32 changed files with 1033 additions and 1231 deletions

View File

@@ -191,6 +191,25 @@
}, },
"buffers": "buffers":
[ [
{
"file": "src/js/scaffolding.js",
"settings":
{
"buffer_size": 2622,
"line_ending": "Unix"
},
"undo_stack":
[
[
1,
1,
"revert",
null,
"AgAAAAAAAAAAAAAAAAAAAAAAAAA+CgAALy8gY29yZSBhbmQgcHJpc20KaW1wb3J0ICogYXMgY29yZSBmcm9tICcuL2NvcmUvX2NvcmUuanMnOwppbXBvcnQgKiBhcyBQcmlzbSBmcm9tICIuLi8uLi9ub2RlX21vZHVsZXMvcHJpc21qcy9wcmlzbSI7CmltcG9ydCAiLi4vLi4vbm9kZV9tb2R1bGVzL3ByaXNtanMvcGx1Z2lucy9saW5lLW51bWJlcnMvcHJpc20tbGluZS1udW1iZXJzIjsKaW1wb3J0ICIuLi8uLi9ub2RlX21vZHVsZXMvcHJpc21qcy9wbHVnaW5zL3Rvb2xiYXIvcHJpc20tdG9vbGJhciI7CmltcG9ydCAnLi4vLi4vbm9kZV9tb2R1bGVzL3ByaXNtanMvY29tcG9uZW50cy9wcmlzbS1qc29uJzsKaW1wb3J0ICcuLi8uLi9ub2RlX21vZHVsZXMvcHJpc21qcy9jb21wb25lbnRzL3ByaXNtLXB1Zyc7CmltcG9ydCAnLi4vLi4vbm9kZV9tb2R1bGVzL3ByaXNtanMvY29tcG9uZW50cy9wcmlzbS1zYXNzJzsKCi8vIGltcG9ydCBwYXR0ZXJuIHN0dWZmLgppbXBvcnQgKiBhcyBzdGlja3lub3RlIGZyb20gIi4uL3BnL3BhdHRlcm5zL2NvcmUvc3RpY2t5LW5vdGUvX3N0aWNreS1ub3RlLmpzIjsKaW1wb3J0ICogYXMgc3d0Y2ggICAgICBmcm9tICIuLi9wZy9wYXR0ZXJucy9jb3JlL3N3aXRjaC9fc3dpdGNoLmpzIjsKaW1wb3J0ICogYXMgdGFicyAgICAgICBmcm9tICIuLi9wZy9wYXR0ZXJucy9jb3JlL3RhYnMvX3RhYnMuanMiOwoKLy8gaW5pdCBjb3JlCmNvcmUuaW5pdCh7CglzdWNjZXNzOiAoYSkgPT4geyAKCQl0YWJzLmluaXQoYSk7CgkJc3d0Y2guaW5pdChhKTsKCQlzdGlja3lub3RlLmluaXQoYSk7Cgl9LAoJbm90Rm91bmQ6IChhLCBwYXRoKSA9PiB7CgkJYS5pbm5lckhUTUwgPSBgJHthLmlubmVySFRNTH08ZGl2IGNsYXNzPSdub3RpZmljYXRpb24tYm94IGVycm9yJz48cD5UaGlzIHBhdHRlcm4gYXBwZWFycyB0byBiZSBtaXNzaW5nLjxicj48c21hbGw+KCR7cGF0aH0gcmV0dXJuZWQgaHR0cCBzdGF0dXMgNDA0KTwvc21hbGw+PC9wPjwvZGl2PmA7Cgl9Cn0pOwoKLy8gZGVwcmVjYXRlZCBzd2l0Y2ggaGFuZGxlcgpjb25zdCBmbGlwSW5mb1N3aXRjaCA9IChlLCBzID0gZS5jdXJyZW50VGFyZ2V0KSA9PiB7CgkKCXN3aXRjaChzLmdldEF0dHJpYnV0ZSgiaWQiKSkgewoKCQljYXNlICJkZXByZWNhdGVkIiA6IAoJCQljb3JlLmNvb2tpZS5zZXQoInNob3ctZGVwcmVjYXRlZCIsIHMuZ2V0QXR0cmlidXRlKCJhcmlhLWNoZWNrZWQiKSwgMzAsICIvIik7CgkJCWRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIm1haW4iKS5xdWVyeVNlbGVjdG9yQWxsKCJhcnRpY2xlW2RhdGEtc3RhdHVzPWRlcHJlY2F0ZWRdIikuZm9yRWFjaCgoYSkgPT4gewoJCQkJYS5jbGFzc0xpc3RbKCBzLmdldEF0dHJpYnV0ZSgiYXJpYS1jaGVja2VkIikgPT0gInRydWUiID8gImFkZCIgOiAicmVtb3ZlIiApXSgic2hvdy1kZXByZWNhdGVkIik7CgkJCX0pOwoJCWJyZWFrOyAKCgkJY2FzZSAiYnJlYWtwb2ludHMiIDoKCQkJY29uc29sZS5sb2coImhlcmUiKQoJCQljb3JlLmNvb2tpZS5zZXQoInNob3ctYnJlYWtwb2ludHMiLCBzLmdldEF0dHJpYnV0ZSgiYXJpYS1jaGVja2VkIiksIDMwLCAiLyIpOwoJCQlkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJodG1sIikuY2xhc3NMaXN0Wyggcy5nZXRBdHRyaWJ1dGUoImFyaWEtY2hlY2tlZCIpID09ICJ0cnVlIiA/ICJhZGQiIDogInJlbW92ZSIgKV0oInNob3ctYnJlYWtwb2ludHMiKTsKCQlicmVhazsgCgl9Cgp9CgovLyBjcmVhdGUgYSBwdXJlIEpTIG1vdXNlIGNsaWNrIGV2ZW50CmNvbnN0IGNsaWNrID0gbmV3IE1vdXNlRXZlbnQoJ2NsaWNrJywgewoJdmlldzogd2luZG93LAoJYnViYmxlczogZmFsc2UsCgljYW5jZWxhYmxlOiB0cnVlCn0pOwoKLy8gZ2V0IHRoZSBzd2l0Y2gsIGluaXRpYWxpemUgaXQgYW5kIGFkZCB0aGUgaGFuZGxlcgpsZXQgc3dpdGNoZXMgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuaW5mby1zd2l0Y2hlcyIpOwpzd3RjaC5pbml0KHN3aXRjaGVzKTsKCmxldCBkZXByZWNhdGVkID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiI2RlcHJlY2F0ZWQiKTsKbGV0IGJyZWFrcG9pbnRzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiI2JyZWFrcG9pbnRzIik7CgpkZXByZWNhdGVkLm9uY2xpY2sgPSBmbGlwSW5mb1N3aXRjaDsKZGVwcmVjYXRlZC5rZXlwcmVzcyA9IGZsaXBJbmZvU3dpdGNoOwpicmVha3BvaW50cy5vbmNsaWNrID0gZmxpcEluZm9Td2l0Y2g7CmJyZWFrcG9pbnRzLmtleXByZXNzID0gZmxpcEluZm9Td2l0Y2g7CgovLyBjaGVjayBhIGNvb2tpZSB0byBnZXQgdGhlIHN3aXRjaCdzIHN0YXRlCmlmIChjb3JlLmNvb2tpZS5nZXQoInNob3ctZGVwcmVjYXRlZCIpID09ICJ0cnVlIikgewoJZGVwcmVjYXRlZC5kaXNwYXRjaEV2ZW50KGNsaWNrKTsKfQppZiAoY29yZS5jb29raWUuZ2V0KCJzaG93LWJyZWFrcG9pbnRzIikgPT0gInRydWUiKSB7CglicmVha3BvaW50cy5kaXNwYXRjaEV2ZW50KGNsaWNrKTsKfQoKLy8ganVzdCBmb3IgZnVuLi4uIFdlJ2xsIHNob3cgZGVwcmVjYXRlZCBpZiB0aGV5IG1hdGNoIHRoZSBwYXRoCi8vIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoYCMke2NvcmUudXJsLnAucmVwbGFjZSgvXC8vZywgIi0iKX1gKS5jbGFzc0xpc3QuYWRkKCJzaG93LWRlcHJlY2F0ZWQiKTsKAAAAAAAAAAA+CgAAAAAAAAAAAAA",
"AQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPC/"
]
]
}
], ],
"build_system": "", "build_system": "",
"build_system_choices": "build_system_choices":
@@ -281,17 +300,12 @@
"expanded_folders": "expanded_folders":
[ [
"/Users/am/Desktop/ds2-core", "/Users/am/Desktop/ds2-core",
"/Users/am/Desktop/ds2-core/src",
"/Users/am/Desktop/ds2-core/src/pg",
"/Users/am/Desktop/ds2-core/src/pg/patterns", "/Users/am/Desktop/ds2-core/src/pg/patterns",
"/Users/am/Desktop/ds2-core/src/pg/patterns/core", "/Users/am/Desktop/ds2-core/src/pg/patterns/core"
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components",
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/sticky-note",
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/switch",
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/tooltip"
], ],
"file_history": "file_history":
[ [
"/Users/am/Desktop/ds2-core/src/js/core/_core.js",
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/switch/index.pug", "/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/switch/index.pug",
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/sticky-note/index.pug", "/Users/am/Desktop/ds2-core/src/pg/patterns/core/components/sticky-note/index.pug",
"/Users/am/Desktop/ds2-core/src/pg/patterns/core/layouts/breakpoints/index.pug", "/Users/am/Desktop/ds2-core/src/pg/patterns/core/layouts/breakpoints/index.pug",
@@ -418,12 +432,11 @@
"/Users/am/Desktop/my DS2/src/pg/patterns/layouts/main-navigation/index.pug", "/Users/am/Desktop/my DS2/src/pg/patterns/layouts/main-navigation/index.pug",
"/Users/am/Desktop/my DS2/src/pg/patterns/layouts/breakpoints/index.pug", "/Users/am/Desktop/my DS2/src/pg/patterns/layouts/breakpoints/index.pug",
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/notifications/index.pug", "/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/notifications/index.pug",
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/spacing/spacing.css", "/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/spacing/spacing.css"
"/Users/am/Desktop/my DS2/src/pg/patterns/visual-design/colours/index.pug"
], ],
"find": "find":
{ {
"height": 26.0 "height": 24.0
}, },
"find_in_files": "find_in_files":
{ {
@@ -506,12 +519,44 @@
{ {
"sheets": "sheets":
[ [
{
"buffer": 0,
"file": "src/js/scaffolding.js",
"selected": true,
"semi_transient": false,
"settings":
{
"buffer_size": 2622,
"regions":
{
},
"selection":
[
[
0,
0
]
],
"settings":
{
"syntax": "Packages/JavaScript/JavaScript.sublime-syntax",
"tab_size": 4,
"translate_tabs_to_spaces": false
},
"translation.x": 0.0,
"translation.y": 365.0,
"zoom_level": 1.0
},
"stack_index": 0,
"stack_multiselect": false,
"type": "text"
}
] ]
} }
], ],
"incremental_find": "incremental_find":
{ {
"height": 26.0 "height": 24.0
}, },
"input": "input":
{ {
@@ -556,7 +601,7 @@
"project": "ds2 core.sublime-project", "project": "ds2 core.sublime-project",
"replace": "replace":
{ {
"height": 68.0 "height": 44.0
}, },
"save_all_on_build": false, "save_all_on_build": false,
"select_file": "select_file":

View File

@@ -1207,6 +1207,9 @@
"concat-js": { "concat-js": {
"enable": false "enable": false
}, },
"babel": {
"enable": true
},
"bundle-js": { "bundle-js": {
"enable": true, "enable": true,
"options": { "options": {

View File

@@ -4,31 +4,34 @@
/* 1 */ /* 1 */
/***/ (function(module) { /***/ (function(module) {
const getDate = function(){ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var getDate = function getDate() {
var d = new Date(); var d = new Date();
return d.toLocaleDateString(lang, {day: "numeric", month: "long", year: "numeric"}); return d.toLocaleDateString(lang, {
} day: "numeric",
month: "long",
year: "numeric"
});
};
String.prototype.toTitleCase = function () { String.prototype.toTitleCase = function () {
return this.replace(/\w\S*/g, function (txt) { return this.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}); });
} };
String.prototype.toSentenceCase = function () { String.prototype.toSentenceCase = function () {
return this.charAt(0).toUpperCase() + this.substr(1).toLowerCase(); return this.charAt(0).toUpperCase() + this.substr(1).toLowerCase();
} };
String.prototype.toContent = function () { String.prototype.toContent = function () {
return this.replace(/-/g, " "); return this.replace(/-/g, " ");
} };
String.prototype.toPath = function () { String.prototype.toPath = function () {
return this.trim().replace(/ /g, "_").replace(/-/g, "_").replace(/[\/\W]/g, "").replace(/_/g, "-"); return this.trim().replace(/ /g, "_").replace(/-/g, "_").replace(/[\/\W]/g, "").replace(/_/g, "-");
} };
var font = {
const font = {
size: 0 size: 0
} };
var copyColourFallback = function copyColourFallback(copyInfo, attr) {
const copyColourFallback = (copyInfo, attr) => { console.log("fallback");
console.log("fallback")
var textArea = document.createElement('textarea'); var textArea = document.createElement('textarea');
textArea.value = copyInfo; textArea.value = copyInfo;
@@ -36,48 +39,44 @@ const copyColourFallback = (copyInfo, attr) => {
textArea.style.top = '0'; textArea.style.top = '0';
textArea.style.left = '0'; textArea.style.left = '0';
textArea.style.position = 'fixed'; textArea.style.position = 'fixed';
document.body.appendChild(textArea); document.body.appendChild(textArea);
textArea.focus(); textArea.focus();
textArea.select(); textArea.select();
try { try {
var successful = document.execCommand('copy'); var successful = document.execCommand('copy');
setTimeout(function () { setTimeout(function () {
if (successful) { if (successful) {
//copyInfo.success(); //copyInfo.success();
showMessage(`Copied ${attr}.`) showMessage("Copied ".concat(attr, "."));
} else { } else {
//copyInfo.error(); //copyInfo.error();
showMessage(`Copy failed (${attr}).`, false) showMessage("Copy failed (".concat(attr, ")."), false);
} }
}, 1); }, 1);
} catch (err) { } catch (err) {
setTimeout(function () { setTimeout(function () {
showMessage(`Copy failed (${attr}). ${err.Message}`, false); showMessage("Copy failed (".concat(attr, "). ").concat(err.Message), false);
//copyInfo.error(err); //copyInfo.error(err);
}, 1); }, 1);
} }
document.body.removeChild(textArea); document.body.removeChild(textArea);
} };
var showMessage = function showMessage(m, s) {
const showMessage = (m, s) => {
s = s == undefined ? true : s; s = s == undefined ? true : s;
console.log("Copy success (navigator.clipboard)"); console.log("Copy success (navigator.clipboard)");
let status = document.createElement("div"); var status = document.createElement("div");
status.setAttribute("id", "copystatus"); status.setAttribute("id", "copystatus");
// status.style.display = "none"; // status.style.display = "none";
status.innerHTML = "<div class='" + (s ? "succeeded" : "failed") + "'>" + m + "</div>"; status.innerHTML = "<div class='" + (s ? "succeeded" : "failed") + "'>" + m + "</div>";
document.querySelector("body").prepend(status) document.querySelector("body").prepend(status);
status.querySelector("div").style.top = window.scrollY + 100 + "px";
status.querySelector("div").style.top = (window.scrollY + 100)+ "px"; setTimeout(function () {
setTimeout( () => {
status.remove(); status.remove();
}, 1000); }, 1000);
} };
var oneClickSelect = function oneClickSelect(e) {
const oneClickSelect = (e, t = e.currentTarget) => { var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : e.currentTarget;
// In here, "this" is the element // In here, "this" is the element
var range, selection; var range, selection;
if (window.getSelection) { if (window.getSelection) {
@@ -91,12 +90,11 @@ const oneClickSelect = (e, t = e.currentTarget) => {
range.moveToElementText(t); range.moveToElementText(t);
range.select(); range.select();
} }
} };
var getURLVars = function getURLVars() {
const getURLVars = () => {
var oResult = {}; var oResult = {};
if (location.search.length > 0) { if (location.search.length > 0) {
var aQueryString = (location.search.substr(1)).split("&"); var aQueryString = location.search.substr(1).split("&");
for (var i = 0; i < aQueryString.length; i++) { for (var i = 0; i < aQueryString.length; i++) {
var aTemp = aQueryString[i].split("="); var aTemp = aQueryString[i].split("=");
if (aTemp[1].length > 0) { if (aTemp[1].length > 0) {
@@ -105,27 +103,34 @@ const getURLVars = () => {
} }
} }
return oResult; return oResult;
} };
module.exports = { module.exports = {
url: getURLVars(), url: function () {
var v = {};
if (location.search.length > 0) {
var qs = location.search.substr(1).split("&");
for (var i = 0; i < qs.length; i++) {
var t = qs[i].split("=");
if (t[1].length > 0) {
v[t[0]] = decodeURIComponent(t[1].replace(/\+/g, '%20'));
}
}
}
return v;
}(),
cookie: { cookie: {
set: (name, value, expires, path, domain, secure) => { set: function set(name, value, expires, path, domain, secure) {
switch(typeof expires) { switch (_typeof(expires)) {
case "number": case "number":
var d = new Date() var d = new Date();
expires = d.setTime(d + (expires*24*60*60*1000)); expires = d.setTime(d + expires * 24 * 60 * 60 * 1000);
break; break;
case "object": case "object":
expires = expires.toGMTString(); expires = expires.toGMTString();
} }
document.cookie= name + "=" + escape(value) + document.cookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") + "; path=/" + (domain ? "; domain=" + domain : "") + (secure ? "; secure" : "");
((expires) ? "; expires=" + expires : "") +
("; path=/") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}, },
get: (cname) => { get: function get(cname) {
var name = cname + "="; var name = cname + "=";
var ca = document.cookie.split(";"); var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) { for (var i = 0; i < ca.length; i++) {
@@ -139,19 +144,17 @@ module.exports = {
} }
return ""; return "";
}, },
remove: (cnane) => { remove: function remove(cnane) {
setCookie(cname, "", -1); setCookie(cname, "", -1);
}, }
}, },
colour: { colour: {
copy: function copy(w, t) {
copy: (w, t) => { var c = t.parentNode.getAttribute("data-" + (w == "var" ? "token" : w));
let c = t.parentNode.getAttribute("data-" + (w=="var" ? "token" : w)); c = w == "var" ? "var(".concat(c, ")") : c;
c = w == "var" ? `var(${c})` : c;
if (navigator.clipboard) { if (navigator.clipboard) {
navigator.clipboard.writeText(c).then(function () { navigator.clipboard.writeText(c).then(function () {
showMessage(`Copied ${w}.`); showMessage("Copied ".concat(w, "."));
}, function (e) { }, function (e) {
copyColourFallback(c, w); copyColourFallback(c, w);
}); });
@@ -159,137 +162,136 @@ module.exports = {
copyColourFallback(c, w); copyColourFallback(c, w);
} }
}, },
positionTooltip: function positionTooltip() {
positionTooltip: () => { document.querySelectorAll("color-pill > span").forEach(function (ps) {
document.querySelectorAll("color-pill > span").forEach((ps) => { ps.querySelectorAll("div.tooltip-tc").forEach(function (tip) {
ps.querySelectorAll("div.tooltip-tc").forEach((tip) => { if (font.size * 10 > ps.offsetLeft) {
if ( (font.size * 10) > ps.offsetLeft ) {
tip.setAttribute("tip-position", "right"); tip.setAttribute("tip-position", "right");
} else { } else {
tip.setAttribute("tip-position", "bottom"); tip.setAttribute("tip-position", "bottom");
} }
}); });
}) });
} }
}, },
init: (args = {}) => { // getCSS: (el, prop, b = false) {
const url = getURLVars(); // return window.getComputedStyle(el, null).getPropertyValue(prop);
// },
init: function init() {
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var url = getURLVars();
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", "")); font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
if (url.p !== undefined) { if (url.p !== undefined) {
document.querySelectorAll("main article:not([data-path^='" + url.p + "'])").forEach((a) => { document.querySelectorAll("main article:not([data-path^='" + url.p + "'])").forEach(function (a) {
a.remove(); a.remove();
}); });
if (url.p == -1) { if (url.p == -1) {
document.querySelector("title").innerHTML = `${url.p.toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }`; document.querySelector("title").innerHTML = "".concat(url.p.toContent().toTitleCase(), " | ").concat(document.querySelector("title").getAttribute("data-site"));
} else { } else {
document.querySelector("title").innerHTML = `${url.p.substring(url.p.lastIndexOf("/")+1).toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }` var theTitle = document.querySelectorAll("article");
if (theTitle.length > 0) {
theTitle = theTitle[0].getAttribute("data-name").toContent().toTitleCase();
if (document.querySelector("article").getAttribute("data-display") !== null) {
theTitle = document.querySelector("article").getAttribute("data-display");
}
document.querySelector("title").innerHTML = "".concat(theTitle, " | ").concat(document.querySelector("title").getAttribute("data-site"));
}
} }
} }
if (typeof args.beforeArticleLoad == "function") args.beforeArticleLoad(); if (typeof args.beforeArticleLoad == "function") args.beforeArticleLoad();
document.querySelectorAll("article").forEach(function (a) {
document.querySelectorAll("article").forEach((a) => {
if (a.getAttribute("data-template") != "none") { if (a.getAttribute("data-template") != "none") {
const observer = new IntersectionObserver(articles => { var observer = new IntersectionObserver(function (articles) {
articles.forEach(article => { articles.forEach(function (article) {
let a = article.target; var 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 } )
let path = a.getAttribute("data-path"); if (article.isIntersecting == true) {
path = "patterns/" + var path = a.getAttribute("data-path");
(a.getAttribute("data-core") == "true" ? path = "patterns/" + (a.getAttribute("data-core") == "true" ? "core/" + path.substring(path.lastIndexOf("/") + 1) : a.getAttribute("data-path")) + "/index.html";
"core/" + path.substring(path.lastIndexOf("/") + 1) : var ASYNC = true;
a.getAttribute("data-path")) var ajx = new XMLHttpRequest();
+ "/index.html"; ajx.onreadystatechange = function () {
const ASYNC = true;
let ajx = new XMLHttpRequest();
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(function (aa) {
aa.innerHTML = `<code class="${aa.getAttribute("class")}">${aa.innerHTML}</code>`; aa.innerHTML = "<code class=\"".concat(aa.getAttribute("class"), "\">").concat(aa.innerHTML, "</code>");
}) });
break; break;
case "md": case "md":
a.querySelectorAll("code").forEach((aa) => { a.querySelectorAll("code").forEach(function (aa) {
aa.classList.add("language-html"); aa.classList.add("language-html");
}) });
break; break;
} }
a.querySelectorAll("code").forEach(function (c) {
a.querySelectorAll("code").forEach((c)=> {
c.classList.add("line-numbers"); c.classList.add("line-numbers");
c.innerHTML = c.innerHTML.replace(/</g, "&lt;"); c.innerHTML = c.innerHTML.replace(/</g, "&lt;");
c.classList.add("copy-to-clipboard-button"); c.classList.add("copy-to-clipboard-button");
}) });
if (typeof args.success == "function") args.success(a); if (typeof args.success == "function") args.success(a);
Prism.highlightAll(); Prism.highlightAll();
a.querySelectorAll("code").forEach(function (c) {
a.querySelectorAll("code").forEach((c)=> { c.onclick = function (e) {
c.onclick = (e) => {
oneClickSelect(e); oneClickSelect(e);
} };
}) });
module.exports.colour.positionTooltip(); module.exports.colour.positionTooltip();
window.onresize = () => { window.onresize = function () {
module.exports.colour.positionTooltip(); module.exports.colour.positionTooltip();
} };
a.querySelectorAll("name > span, color-pill > span").forEach(function (pill) {
a.querySelectorAll("name > span, color-pill > span").forEach((pill) => { pill.onclick = function (e) {
pill.onclick = (e) => {
e.preventDefault(); e.preventDefault();
let w = ""; var w = "";
if (e.metaKey || e.ctrlKey || e.keyCode == 91 || e.keyCode == 224) { if (e.metaKey || e.ctrlKey || e.keyCode == 91 || e.keyCode == 224) {
w = "var"; w = "var";
} else if (e.altKey) { } else if (e.altKey) {
w = "token" w = "token";
} else if (e.shiftKey) { } else if (e.shiftKey) {
w = "rgb"; w = "rgb";
} else { } else {
w = "hex"; w = "hex";
} }
module.exports.colour.copy(w, pill); module.exports.colour.copy(w, pill);
} };
}) });
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;
default: default:
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);
} }
}; };
ajx.open("GET", path, ASYNC); ajx.open("GET", path, ASYNC);
ajx.send(); ajx.send();
} }
}) });
}, { threshold: 0, rootMargin: (document.body.clientHeight / 2) + "px" }) }, {
threshold: 0,
rootMargin: "100%"
});
observer.observe(a); observer.observe(a);
} else {
a.style.height = "auto";
} }
}) });
if (typeof args.afterArticleLoad == "function") args.afterArticleLoad(); if (typeof args.afterArticleLoad == "function") args.afterArticleLoad();
} }
}; };
@@ -3008,45 +3010,47 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ init: function() { return /* binding */ init; } /* harmony export */ init: function() { return /* binding */ init; }
/* harmony export */ }); /* harmony export */ });
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
//- 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
const font = { var font = {
size: 0 size: 0
} };
var pos = {
const pos = {
x: 0, x: 0,
y: 0 y: 0
} };
function drag(sticky) { function drag(sticky) {
sticky.onmousedown = event => { sticky.onmousedown = function (event) {
// get the position within the sticky // get the position within the sticky
pos.x = (event.clientX - sticky.offsetLeft); pos.x = event.clientX - sticky.offsetLeft;
pos.y = (event.clientY - sticky.offsetTop); pos.y = event.clientY - sticky.offsetTop;
// on mouse move, move the sticky to the position, minus the offset, of the mouse // on mouse move, move the sticky to the position, minus the offset, of the mouse
document.onmousemove = documentEvent => { document.onmousemove = function (documentEvent) {
sticky.style.top = (documentEvent.clientY - pos.y) + 'px'; sticky.style.top = documentEvent.clientY - pos.y + 'px';
sticky.style.left = (documentEvent.clientX - pos.x) + 'px'; sticky.style.left = documentEvent.clientX - pos.x + 'px';
sticky.setAttribute("moved", "true"); sticky.setAttribute("moved", "true");
} };
// when done, remove mouse move and mouse up handlers. // when done, remove mouse move and mouse up handlers.
document.onmouseup = () => { document.onmouseup = function () {
document.onmouseup = null; document.onmouseup = null;
document.onmousemove = null; document.onmousemove = null;
};
};
} }
}
}
function waitForElement(selector) { function waitForElement(selector) {
return new Promise(resolve => { return new Promise(function (resolve) {
if (document.querySelector(selector)) { if (document.querySelector(selector)) {
return resolve(document.querySelector(selector)); return resolve(document.querySelector(selector));
} }
var observer = new MutationObserver(function (mutations) {
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) { if (document.querySelector(selector)) {
observer.disconnect(); observer.disconnect();
resolve(document.querySelector(selector)); resolve(document.querySelector(selector));
@@ -3060,84 +3064,81 @@ function waitForElement(selector) {
}); });
}); });
} }
var checkBottom = function checkBottom(attach) {
const checkBottom = (attach) => {
// check if top or bottom // check if top or bottom
if (attach.y < 0) { if (attach.y < 0) {
attach.ys = "bottom"; attach.ys = "bottom";
attach.y = attach.y * -1; attach.y = attach.y * -1;
} }
} };
var setStickyPostions = function setStickyPostions(s, attach) {
const setStickyPostions = (s, attach) => {
// set // set
s.style[attach.ys] = `${attach.y}px`; s.style[attach.ys] = "".concat(attach.y, "px");
s.style[attach.xs] = `${attach.x}px`; s.style[attach.xs] = "".concat(attach.x, "px");
s.style.display = "grid"; s.style.display = "grid";
} };
var css = function css(el, attr) {
const css = (el, attr) => { var st = "";
let st = "" Object.entries(attr).forEach(function (val) {
Object.entries(attr).forEach(val => { var _val = _slicedToArray(val, 2),
const [key, value] = val; key = _val[0],
st += `${key}: ${value}; `; value = _val[1];
}) st += "".concat(key, ": ").concat(value, "; ");
});
el.setAttribute("style", st.trim()); el.setAttribute("style", st.trim());
} };
var calculateStickyPosition = function calculateStickyPosition(s) {
var float = s.getAttribute("float");
const calculateStickyPosition = (s) => { var p = s.parentNode.getBoundingClientRect();
let float = s.getAttribute("float");
let p = s.parentNode.getBoundingClientRect()
switch (float) { switch (float) {
case "left": case "left":
css(s, {left: (p.left * -1) + "px"}) css(s, {
left: p.left * -1 + "px"
});
break; break;
case "right": case "right":
css(s, { left: (Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) - p.left - s.offsetWidth - (font.size * 2)) + "px" }); css(s, {
left: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) - p.left - s.offsetWidth - font.size * 2 + "px"
});
break; break;
} }
var offset = s.getAttribute("offset");
let offset = s.getAttribute("offset");
if (offset !== null) { if (offset !== null) {
offset = offset.trim().split(" "); offset = offset.trim().split(" ");
css(s, {top: offset[0], left: offset[1] }) css(s, {
top: offset[0],
left: offset[1]
});
} }
} };
function init() {
function init(p = document){ var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", "")); font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
p.querySelectorAll("sticky-note").forEach(function (s) {
p.querySelectorAll("sticky-note").forEach((s) => {
if (s.querySelectorAll("svg").length == 0) { if (s.querySelectorAll("svg").length == 0) {
var wrapper = document.createElement("sticky-note-wrapper");
let wrapper = document.createElement("sticky-note-wrapper");
s.parentNode.insertBefore(wrapper, s); s.parentNode.insertBefore(wrapper, s);
wrapper.appendChild(s); wrapper.appendChild(s);
s.setAttribute("content", s.innerHTML.replace(/"/g, "\"")); s.setAttribute("content", s.innerHTML.replace(/"/g, "\""));
s.innerHTML = `<div><svg width='0' height='0'><defs><clipPath id='stickyClip' clipPathUnits='objectBoundingBox'><path d='M 0 0 Q 0 0.69, 0.03 0.96 0.03 0.96, 1 0.96 Q 0.96 0.69, 0.96 0 0.96 0, 0 0' stroke-linejoin='round' stroke-linecap='square' /></clipPath></defs></svg></div><div><div>${s.innerHTML}</div></div>`; s.innerHTML = "<div><svg width='0' height='0'><defs><clipPath id='stickyClip' clipPathUnits='objectBoundingBox'><path d='M 0 0 Q 0 0.69, 0.03 0.96 0.03 0.96, 1 0.96 Q 0.96 0.69, 0.96 0 0.96 0, 0 0' stroke-linejoin='round' stroke-linecap='square' /></clipPath></defs></svg></div><div><div>".concat(s.innerHTML, "</div></div>");
} }
calculateStickyPosition(s); calculateStickyPosition(s);
drag(s); drag(s);
s.ondblclick = (e) => { s.ondblclick = function (e) {
if (e.ctrlKey) { if (e.ctrlKey) {
calculateStickyPosition(s); calculateStickyPosition(s);
} else { } else {
// add one click select // add one click select
} }
} };
}) });
window.onresize = function () {
window.onresize = () => {
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", "")); font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
let stickies = p.querySelectorAll("sticky-note"); var stickies = p.querySelectorAll("sticky-note");
stickies.forEach((s) => { stickies.forEach(function (s) {
calculateStickyPosition(s); calculateStickyPosition(s);
}); });
} };
} }
/***/ }), /***/ }),
@@ -3148,7 +3149,7 @@ function init(p = document){
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
function flip(e) { function flip(e) {
let sw = e.currentTarget; var sw = e.currentTarget;
switch (sw.getAttribute("aria-checked")) { switch (sw.getAttribute("aria-checked")) {
case "true": case "true":
sw.setAttribute("aria-checked", "false"); sw.setAttribute("aria-checked", "false");
@@ -3157,20 +3158,20 @@ function flip(e) {
sw.setAttribute("aria-checked", "true"); sw.setAttribute("aria-checked", "true");
break; break;
} }
}; }
;
module.exports = { module.exports = {
init: (p = document) => { init: function init() {
p.querySelectorAll("[role='switch']").forEach((sw) => { var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
p.querySelectorAll("[role='switch']").forEach(function (sw) {
sw.innerHTML = "<span></span>"; sw.innerHTML = "<span></span>";
sw.setAttribute("aria-checked", "false"); sw.setAttribute("aria-checked", "false");
sw.setAttribute("tabindex", "0"); sw.setAttribute("tabindex", "0");
sw.addEventListener("click", flip, false); sw.addEventListener("click", flip, false);
sw.addEventListener("keypress", flip, false); sw.addEventListener("keypress", flip, false);
}) });
} }
} };
/***/ }), /***/ }),
/* 10 */ /* 10 */
@@ -3182,60 +3183,70 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ init: function() { return /* binding */ init; } /* harmony export */ init: function() { return /* binding */ init; }
/* harmony export */ }); /* harmony export */ });
/* DS2 core (c) 2024 Alexander McIlwraith /* DS2 core (c) 2024 Alexander McIlwraith
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; Released under Creative Commons Attribution-ShareAlike 4.0 International
tabs.init();
*/ */
function init(p = document) { // create a pure JS mouse click event
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => { var click = new MouseEvent('click', {
view: window,
bubbles: false,
cancelable: true
});
function init() {
var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
p.querySelectorAll(".tab-group, tabset").forEach(function (tabGroup) {
if (tabGroup.querySelector("[role=tablist]") === null) { if (tabGroup.querySelector("[role=tablist]") === null) {
const tabgroup = tabGroup.getAttribute("id"); var tabgroup = tabGroup.getAttribute("id");
let tablist = ""; var tablist = "";
Array.from(tabGroup.children).forEach(function (child) {
Array.from(tabGroup.children).forEach(child => { var tab = child.getAttribute("tab") || child.getAttribute("data-tab");
const tab = child.getAttribute("tab") || child.getAttribute("data-tab");
if (tab !== null) { if (tab !== null) {
const tabID = tab.replace(/\W+/g, "-").toLowerCase(); var tabID = tab.replace(/\W+/g, "-").toLowerCase();
const tabPanel = document.createElement('div'); var tabPanel = document.createElement('div');
tabPanel.id = `tab-panel-${tabgroup}-${tabID}`; tabPanel.id = "tab-panel-".concat(tabgroup, "-").concat(tabID);
tabPanel.className = tablist === "" ? "open" : ""; tabPanel.className = tablist === "" ? "open" : "";
tabPanel.setAttribute("role", "tabpanel"); tabPanel.setAttribute("role", "tabpanel");
tabPanel.setAttribute("tabindex", "0"); tabPanel.setAttribute("tabindex", "0");
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`); tabPanel.setAttribute("aria-labelledby", "tab-".concat(tabgroup, "-").concat(tabID));
tabPanel.appendChild(child.cloneNode(true)); tabPanel.appendChild(child.cloneNode(true));
child.parentNode.replaceChild(tabPanel, child); child.parentNode.replaceChild(tabPanel, child);
tablist += `<li tabindex="0" role="tab" ${tablist === "" ? "class='selected'" : ""} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`; tablist += "<li tabindex=\"0\" role=\"tab\" ".concat(tablist === "" ? "class='selected'" : "", " id=\"tab-").concat(tabgroup, "-").concat(tabID, "\"><span>").concat(tab, "</span></li>");
} else { } else {
child.classList.add("tab-hidden"); child.classList.add("tab-hidden");
} }
}); });
var ul = document.createElement('ul');
const ul = document.createElement('ul');
ul.setAttribute("role", "tablist"); ul.setAttribute("role", "tablist");
ul.innerHTML = `${tablist}<li role="separator" class="separator"></li>`; ul.innerHTML = s != true ? "".concat(tablist) : "".concat(tablist, "<li role=\"separator\" class=\"separator\"></li>");
tabGroup.insertBefore(ul, tabGroup.firstChild); tabGroup.insertBefore(ul, tabGroup.firstChild);
tabGroup.querySelectorAll('[role="tab"]').forEach(function (tab) {
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => { tab.addEventListener("click", function () {
tab.addEventListener("click", () => { var siblings = Array.from(tab.parentNode.children);
const siblings = Array.from(tab.parentNode.children); siblings.forEach(function (sibling) {
siblings.forEach(sibling => sibling.classList.remove("selected")); return sibling.classList.remove("selected");
});
tab.classList.add("selected"); tab.classList.add("selected");
var tabPanels = Array.from(tab.parentNode.parentNode.children).filter(function (child) {
const tabPanels = Array.from(tab.parentNode.parentNode.children) return child.getAttribute("role") === "tabpanel";
.filter(child => child.getAttribute("role") === "tabpanel"); });
tabPanels.forEach(panel => panel.classList.remove("open")); tabPanels.forEach(function (panel) {
return panel.classList.remove("open");
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel"); });
var tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
document.getElementById(tabPanelId).classList.add("open"); document.getElementById(tabPanelId).classList.add("open");
}); });
tab.addEventListener("keypress", function (e) {
e.preventDefault();
if (e.which == 32 || e.which == 13) {
e.currentTarget.dispatchEvent(click);
}
});
}); });
} }
}); });
} }
/***/ }) /***/ })
/******/ ]); /******/ ]);
/************************************************************************/ /************************************************************************/
@@ -3356,54 +3367,46 @@ __webpack_require__.r(__webpack_exports__);
// init core // init core
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.init({ _core_core_js__WEBPACK_IMPORTED_MODULE_0__.init({
success: (a) => { success: function success(a) {
_pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__.init(a); _pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__.init(a);
_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(a); _pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(a);
_pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__.init(a); _pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__.init(a);
}, },
notFound: (a, path) => { notFound: function notFound(a, path) {
a.innerHTML = `${a.innerHTML}<div class='notification-box error'><p>This pattern appears to be missing.<br><small>(${path} returned http status 404)</small></p></div>`; a.innerHTML = "".concat(a.innerHTML, "<div class='notification-box error'><p>This pattern appears to be missing.<br><small>(").concat(path, " returned http status 404)</small></p></div>");
} }
}); });
// deprecated switch handler // deprecated switch handler
const flipInfoSwitch = (e, s = e.currentTarget) => { var flipInfoSwitch = function flipInfoSwitch(e) {
var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : e.currentTarget;
switch (s.getAttribute("id")) { switch (s.getAttribute("id")) {
case "deprecated": case "deprecated":
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.set("show-deprecated", s.getAttribute("aria-checked"), 30, "/"); _core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.set("show-deprecated", s.getAttribute("aria-checked"), 30, "/");
document.querySelector("main").querySelectorAll("article[data-status=deprecated]").forEach((a) => { document.querySelector("main").querySelectorAll("article[data-status=deprecated]").forEach(function (a) {
a.classList[( s.getAttribute("aria-checked") == "true" ? "add" : "remove" )]("show-deprecated"); a.classList[s.getAttribute("aria-checked") == "true" ? "add" : "remove"]("show-deprecated");
}); });
break; break;
case "breakpoints": case "breakpoints":
console.log("here") console.log("here");
_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.set("show-breakpoints", s.getAttribute("aria-checked"), 30, "/"); _core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.set("show-breakpoints", s.getAttribute("aria-checked"), 30, "/");
document.querySelector("html").classList[( s.getAttribute("aria-checked") == "true" ? "add" : "remove" )]("show-breakpoints"); document.querySelector("html").classList[s.getAttribute("aria-checked") == "true" ? "add" : "remove"]("show-breakpoints");
break; break;
} }
};
}
// create a pure JS mouse click event // create a pure JS mouse click event
const click = new MouseEvent('click', { var click = new MouseEvent('click', {
view: window, view: window,
bubbles: false, bubbles: false,
cancelable: true cancelable: true
}); });
// get the switch, initialize it and add the handler // get the switch, initialize it and add the handler
let switches = document.querySelector(".info-switches"); var switches = document.querySelector(".info-switches");
_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(switches); _pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__.init(switches);
var deprecated = document.querySelector("#deprecated");
let deprecated = document.querySelector("#deprecated"); var breakpoints = document.querySelector("#breakpoints");
let breakpoints = document.querySelector("#breakpoints");
deprecated.onclick = flipInfoSwitch; deprecated.onclick = flipInfoSwitch;
deprecated.keypress = flipInfoSwitch; deprecated.keypress = flipInfoSwitch;
breakpoints.onclick = flipInfoSwitch; breakpoints.onclick = flipInfoSwitch;
@@ -3419,7 +3422,6 @@ if (_core_core_js__WEBPACK_IMPORTED_MODULE_0__.cookie.get("show-breakpoints") ==
// just for fun... We'll show deprecated if they match the path // just for fun... We'll show deprecated if they match the path
// document.querySelector(`#${core.url.p.replace(/\//g, "-")}`).classList.add("show-deprecated"); // document.querySelector(`#${core.url.p.replace(/\//g, "-")}`).classList.add("show-deprecated");
}(); }();
/******/ })() /******/ })()
; ;

File diff suppressed because one or more lines are too long

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

@@ -12,11 +12,17 @@
<h2>How to use it</h2> <h2>How to use it</h2>
<p>This pattern is only available for SCSS breakpoints. The mixin is avai</p> <p>This pattern is only available for SCSS breakpoints. The mixin is avai</p>
<p>When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across. </p> <p>When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across. </p>
<div class="tab-group" id="breakpoints"> <tabset id="breakpoints">
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith <div tab="scss">
<pre class="language-sass">@import "[path-to]/breakpoints";
@include break([breakpoint]) {
// css here
}</pre>
<pre class="language-sass">//- 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 {
@@ -100,5 +106,6 @@ $grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !defau
} }
}</pre> }</pre>
</div> </div>
</tabset>
</body> </body>
</html> </html>

View File

@@ -9,9 +9,9 @@
<h2>When to use it</h2> <h2>When to use it</h2>
<p>Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages. </p> <p>Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages. </p>
<h2>How to use it</h2> <h2>How to use it</h2>
<p>Place the header at the top of the page after the skip to main content link. This basic header should be replaced with your own site's header. </p> <p>Place the header at the top of the page after the skip to main content link. You will likely want to replace core header should be replaced with your own site's header. To do this, remove the <code class="inline language-js">core: true </code> and create your own pattern in the location you wish it in your design system. </p>
<div class="tab-group" id="header"> <tabset id="header">
<pre class="language-html" data-tab="html"> <pre class="language-html" tab="html">
<!-- create temp variables and store the design system values--> <!-- create temp variables and store the design system values-->
<header> <header>
<!-- The headline banner area --> <!-- The headline banner area -->
@@ -25,20 +25,7 @@
<!-- Other sections can go here, such as search and directory--> <!-- Other sections can go here, such as search and directory-->
</div> </div>
</header></pre> </header></pre>
<pre class="language-html" data-tab="html"> <pre class="language-pug" tab="pug">//- DS2 core (c) 2024 Alexander McIlwraith
<header>
<!-- The headline banner area -->
<svg height="5.5rem" width="100%" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<text>DS2 core</text>
</svg>
<div>
<div class="header-title">
<h1> <a href="./">DS2 core</a></h1>
</div>
<!-- Other sections can go here, such as search and directory-->
</div>
</header></pre>
<pre class="language-pug" data-tab="pug">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
//- required variables //- required variables
@@ -55,60 +42,11 @@ header
a(href="./")= site a(href="./")= site
// Other sections can go here, such as search and directory // Other sections can go here, such as search and directory
</pre> </pre>
<pre class="language-css" data-tab="css">header { <pre class="language-css" tab="css">header{display:-ms-grid;display:grid;-ms-grid-rows:1.75rem 3.5rem;grid-template-rows:1.75rem 3.5rem;-ms-grid-column:2;-ms-grid-column-span:2;grid-column:2/4;overflow:hidden}header svg{grid-column:1/-1;grid-row:1/-1;-ms-grid-row-align:stretch;-ms-grid-column-align:stretch;place-self:stretch}header svg text{-webkit-transform:translate(-1rem,7.25rem);-ms-transform:translate(-1rem,7.25rem);transform:translate(-1rem,7.25rem);font-size:10rem;font-weight:1000;font-family:sans-serif;fill:var(--colour-grey-xxl)}header>div{-ms-grid-row:2;grid-row:2;grid-column:1/-1;display:-ms-grid;display:grid;grid-column-gap:1rem;-ms-grid-columns:auto -webkit-max-content -webkit-max-content;-ms-grid-columns:auto max-content max-content;grid-template-columns:auto -webkit-max-content -webkit-max-content;grid-template-columns:auto max-content max-content}header>div .header-title h1{margin:0;padding:0 1rem}header>div .header-title h1 a,header>div .header-title h1 a:visited{border-bottom:none;color:var(--colour-black);font-family:sans-serif;font-size:2.5rem;font-size:32px;font-weight:700;margin:0;padding:0;text-decoration:none}</pre>
display: -ms-grid; <div class="language-sass" tab="scss">
display: grid; <pre class="language-sass">@import "scss/core/header/header;
-ms-grid-rows: 1.75rem 3.5rem; </pre>
grid-template-rows: 1.75rem 3.5rem; <pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
-ms-grid-column: 2;
-ms-grid-column-span: 2;
grid-column: 2/4;
overflow: hidden;
}
header svg {
grid-column: 1/-1;
grid-row: 1/-1;
-ms-grid-row-align: stretch;
-ms-grid-column-align: stretch;
place-self: stretch;
}
header svg text {
-webkit-transform: translate(-1rem, 7.25rem);
-ms-transform: translate(-1rem, 7.25rem);
transform: translate(-1rem, 7.25rem);
font-size: 10rem;
font-weight: 1000;
font-family: sans-serif;
fill: var(--colour-grey-xxl);
}
header > div {
-ms-grid-row: 2;
grid-row: 2;
grid-column: 1/-1;
display: -ms-grid;
display: grid;
grid-column-gap: 1rem;
-ms-grid-columns: auto -webkit-max-content -webkit-max-content;
-ms-grid-columns: auto max-content max-content;
grid-template-columns: auto -webkit-max-content -webkit-max-content;
grid-template-columns: auto max-content max-content;
}
header > div .header-title h1 {
margin: 0;
padding: 0 1rem;
}
header > div .header-title h1 a, header > div .header-title h1 a:visited {
border-bottom: none;
color: var(--colour-black);
font-family: sans-serif;
font-size: 2.5rem;
font-size: 32px;
font-weight: 700;
margin: 0;
padding: 0;
text-decoration: none;
}</pre>
<pre class="language-sass" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
$header-bg-color: var(--colour-grey-xxl) !default; $header-bg-color: var(--colour-grey-xxl) !default;
@@ -163,5 +101,6 @@ $font-weight: 700 !default;
} }
}</pre> }</pre>
</div> </div>
</tabset>
</body> </body>
</html> </html>

View File

@@ -9,143 +9,23 @@
<h2>When to use it</h2> <h2>When to use it</h2>
<p>Use a sticky when you want to make a note without adding it to the content. </p> <p>Use a sticky when you want to make a note without adding it to the content. </p>
<h2>How to use it</h2> <h2>How to use it</h2>
<p>Uses absolute positioning. <p>Uses absolute positioning. Passing an optional element to the init function will initialise tabs within that element. You can move the position using either <code class="language-html inline">float="&#91; right | left &#93;"</code> or <code class="language-html inline">offset="&#91; top | left &#93;"</code>. Offset will take negative values in any web measurement unit.
<sticky-note class="blue" float="right">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note> <sticky-note class="blue" offset="-10rem 1rem">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note>
<sticky-note float="right">You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).</sticky-note>
</p> </p>
<p>If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements". </p> <p>If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements". </p>
<sticky-note>You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).</sticky-note>
<tabset id="sticky-note"> <tabset id="sticky-note">
<pre class="language-html" tab="html"> <pre class="language-html" tab="html">
<sticky-note class="blue" float="right">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note></pre> <sticky-note class="blue" float="right">This <strong>is</strong> a sample sticky. You can drag it out of the way if you need to see the content under it.</sticky-note></pre>
<pre class="language-pug" tab="pug">sticky-note(float="right").blue This #[strong is] a sample sticky. <pre class="language-pug" tab="pug">sticky-note(float="right").blue This #[strong is] a sample sticky.
| You can drag it out of the way if you need to see the content under it.</pre> | You can drag it out of the way if you need to see the content under it.</pre>
<pre class="language-css" data-tab="css"> @import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap"); <pre class="language-css" data-tab="css"> @import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap");sticky-note-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid transparent;border-radius:50%;display:inline-block;height:0.5rem;position:relative;width:0.5rem}sticky-note-wrapper *{-webkit-box-sizing:border-box;box-sizing:border-box}sticky-note-wrapper sticky-note{cursor:-webkit-grab;cursor:grab;display:-ms-grid;display:grid;float:left;font-size:1rem;height:13rem;left:0;place-items:stretch;position:absolute;top:0;width:13rem;z-index:100}sticky-note-wrapper sticky-note:active{cursor:-webkit-grabbing;cursor:grabbing;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}sticky-note-wrapper sticky-note.right{float:right}sticky-note-wrapper sticky-note>div{-ms-grid-row:1;grid-row:1;-ms-grid-column:1;grid-column:1}sticky-note-wrapper sticky-note>div:first-child{background-color:rgba(0,0,0,0.25);-webkit-box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);display:-ms-grid;display:grid;margin:2rem 1rem 0.25rem 0.36rem;width:calc(100% - 1rem)}sticky-note-wrapper sticky-note>div:nth-child(2){clip-path:url(#stickyClip);display:-ms-grid;display:grid;font-family:"Kalam",cursive;font-style:1rem;font-weight:300;line-height:1.25rem;padding:1rem;place-items:center;text-align:center}sticky-note-wrapper sticky-note>div:nth-child(2)>*{font-family:"Kalam",cursive!important;font-style:normal!important;font-weight:300!important}@media screen and (max-width:1024px){sticky-note-wrapper sticky-note>div:nth-child(2){max-width:13rem;min-width:13rem;width:1rem}}@media screen and (max-width:768px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:1.75rem;max-width:21rem;min-height:21rem}}@media screen and (max-width:640px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:2.5rem;max-width:26rem;min-height:26rem}}sticky-note-wrapper sticky-note>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#ffffdd),color-stop(2%,#ffffd3),color-stop(12%,#ffffd3),color-stop(75%,#ffffc9),to(#ffffba));background:linear-gradient(180deg,#ffffdd 0%,#ffffd3 2%,#ffffd3 12%,#ffffc9 75%,#ffffba 100%)}sticky-note-wrapper sticky-note.blue>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#9dddec),color-stop(2%,#94daea),color-stop(12%,#94daea),color-stop(75%,#8bd7e8),to(#7fd3e6));background:linear-gradient(180deg,#9dddec 0%,#94daea 2%,#94daea 12%,#8bd7e8 75%,#7fd3e6 100%)}sticky-note-wrapper sticky-note.pink>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#fa7c93),color-stop(2%,#fa728b),color-stop(12%,#fa728b),color-stop(75%,#fa6883),to(#f95977));background:linear-gradient(180deg,#fa7c93 0%,#fa728b 2%,#fa728b 12%,#fa6883 75%,#f95977 100%)}sticky-note-wrapper sticky-note.green>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#c5fcc9),color-stop(2%,#bbfbc0),color-stop(12%,#bbfbc0),color-stop(75%,#b1fab7),to(#a3faaa));background:linear-gradient(180deg,#c5fcc9 0%,#bbfbc0 2%,#bbfbc0 12%,#b1fab7 75%,#a3faaa 100%)}sticky-note-wrapper:has(sticky-note:hover){background-color:#ffffd3;border:1px solid black}sticky-note-wrapper:has(sticky-note.yellow:hover){background-color:#ffffd3}sticky-note-wrapper:has(sticky-note.blue:hover){background-color:#94daea}sticky-note-wrapper:has(sticky-note.pink:hover){background-color:#fa728b}sticky-note-wrapper:has(sticky-note.green:hover){background-color:#bbfbc0}</pre>
sticky-note-wrapper { <div tab="scss">
-webkit-box-sizing: border-box; <pre class="language-sass">$sticky-colors: ( [sass map with your own defined colours] );
box-sizing: border-box; @import "scss/core/switch/_sticky-note";
border: 1px solid transparent; @include sticky-note;
border-radius: 50%; </pre>
display: inline-block; <pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
height: 0.5rem;
position: relative;
width: 0.5rem;
}
sticky-note-wrapper * {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
sticky-note-wrapper sticky-note {
cursor: -webkit-grab;
cursor: grab;
display: -ms-grid;
display: grid;
float: left;
font-size: 1rem;
height: 13rem;
left: 0;
place-items: stretch;
position: absolute;
top: 0;
width: 13rem;
z-index: 100;
}
sticky-note-wrapper sticky-note:active {
cursor: -webkit-grabbing;
cursor: grabbing;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
sticky-note-wrapper sticky-note.right {
float: right;
}
sticky-note-wrapper sticky-note > div {
-ms-grid-row: 1;
grid-row: 1;
-ms-grid-column: 1;
grid-column: 1;
}
sticky-note-wrapper sticky-note > div:nth-child(1) {
background-color: rgba(0, 0, 0, 0.25);
-webkit-box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
display: -ms-grid;
display: grid;
margin: 2rem 1rem 0.25rem 0.36rem;
width: calc(100% - 1rem);
}
sticky-note-wrapper sticky-note > div:nth-child(2) {
clip-path: url(#stickyClip);
display: -ms-grid;
display: grid;
font-family: "Kalam", cursive;
font-style: 1rem;
font-weight: 300;
line-height: 1.25rem;
padding: 1rem;
place-items: center;
text-align: center;
}
sticky-note-wrapper sticky-note > div:nth-child(2) > * {
font-family: "Kalam", cursive !important;
font-style: normal !important;
font-weight: 300 !important;
}
@media screen and (max-width: 1024px) {
sticky-note-wrapper sticky-note > div:nth-child(2) {
max-width: 13rem;
min-width: 13rem;
width: 1rem;
}
}
@media screen and (max-width: 768px) {
sticky-note-wrapper sticky-note > div:nth-child(2) {
font-size: 1.75rem;
max-width: 21rem;
min-height: 21rem;
}
}
@media screen and (max-width: 640px) {
sticky-note-wrapper sticky-note > div:nth-child(2) {
font-size: 2.5rem;
max-width: 26rem;
min-height: 26rem;
}
}
sticky-note-wrapper sticky-note > div:nth-child(2) {
background: -webkit-gradient(linear, left top, left bottom, from(#ffffdd), color-stop(2%, #ffffd3), color-stop(12%, #ffffd3), color-stop(75%, #ffffc9), to(#ffffba));
background: linear-gradient(180deg, #ffffdd 0%, #ffffd3 2%, #ffffd3 12%, #ffffc9 75%, #ffffba 100%);
}
sticky-note-wrapper sticky-note.blue > div:nth-child(2) {
background: -webkit-gradient(linear, left top, left bottom, from(#9dddec), color-stop(2%, #94daea), color-stop(12%, #94daea), color-stop(75%, #8bd7e8), to(#7fd3e6));
background: linear-gradient(180deg, #9dddec 0%, #94daea 2%, #94daea 12%, #8bd7e8 75%, #7fd3e6 100%);
}
sticky-note-wrapper sticky-note.pink > div:nth-child(2) {
background: -webkit-gradient(linear, left top, left bottom, from(#fa7c93), color-stop(2%, #fa728b), color-stop(12%, #fa728b), color-stop(75%, #fa6883), to(#f95977));
background: linear-gradient(180deg, #fa7c93 0%, #fa728b 2%, #fa728b 12%, #fa6883 75%, #f95977 100%);
}
sticky-note-wrapper sticky-note.green > div:nth-child(2) {
background: -webkit-gradient(linear, left top, left bottom, from(#c5fcc9), color-stop(2%, #bbfbc0), color-stop(12%, #bbfbc0), color-stop(75%, #b1fab7), to(#a3faaa));
background: linear-gradient(180deg, #c5fcc9 0%, #bbfbc0 2%, #bbfbc0 12%, #b1fab7 75%, #a3faaa 100%);
}
sticky-note-wrapper:has(sticky-note:hover) {
background-color: #ffffd3;
border: 1px solid black;
}
sticky-note-wrapper:has(sticky-note.yellow:hover) {
background-color: #ffffd3;
}
sticky-note-wrapper:has(sticky-note.blue:hover) {
background-color: #94daea;
}
sticky-note-wrapper:has(sticky-note.pink:hover) {
background-color: #fa728b;
}
sticky-note-wrapper:has(sticky-note.green:hover) {
background-color: #bbfbc0;
}</pre>
<pre class="language-css" data-tab="scss"> //- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
@use 'sass:color'; @use 'sass:color';
@@ -297,7 +177,12 @@ $sticky-colors: (
} }
} }
}</pre> }</pre>
<pre class="language-js" data-tab="js"> //- DS2 core (c) 2024 Alexander McIlwraith </div>
<div tab="js">
<pre class="language-js">import * as stickynote from ""./js/core/sticky-note/_sticky-note.js";
stickynote.init()
</pre>
<pre class="language-js">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
const font = { const font = {
@@ -428,6 +313,7 @@ export function init(p = document){
}); });
} }
}</pre> }</pre>
</div>
</tabset> </tabset>
</body> </body>
</html> </html>

View File

@@ -16,35 +16,14 @@
<label for="example-switch">Switch label (states the on state)</label><span id="example-switch" role="switch"></span> <label for="example-switch">Switch label (states the on state)</label><span id="example-switch" role="switch"></span>
</p> </p>
<div class="tab-group" id="switches"> <div class="tab-group" id="switches">
<pre class="language-html" data-tab="html"><span id="example-id" role="switch"></span></pre> <pre class="language-html" tab="html"><span id="example-id" role="switch"></span></pre>
<pre class="language-pug" data-tab="pug">span#example-id(role="switch")</pre> <pre class="language-pug" tab="pug">span#example-id(role="switch")</pre>
<pre class="language-css" data-tab="css">[role=switch] { <pre class="language-css" tab="css">[role=switch]{display:-ms-inline-grid;display:inline-grid;border:1px solid #2e51a1;background-color:#d8d8d8;border-radius:0.75rem;height:1.5rem;width:3rem;-webkit-transition:all 500ms;transition:all 500ms}[role=switch]>span{display:inline-block;background-color:white;border-radius:50%;margin:2%;width:calc(1.5rem - 2%);-webkit-transition:all 500ms;transition:all 500ms}[role=switch][aria-checked=true]{background-color:#2e51a1}[role=switch][aria-checked=true]>span{margin-left:calc(1.5rem - 5%)}</pre>
display: -ms-inline-grid; <div tab="scss">
display: inline-grid; <pre class="language-sass">@import "scss/core/switch/_switch";
border: 1px solid var(--colour-blue); @include switch;
background-color: var(--colour-grey-xl); </pre>
border-radius: 0.75rem; <pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
height: 1.5rem;
width: 3rem;
-webkit-transition: all 500ms;
transition: all 500ms;
}
[role=switch] > span {
display: inline-block;
background-color: white;
border-radius: 50%;
margin: 2%;
width: calc(1.5rem - 2%);
-webkit-transition: all 500ms;
transition: all 500ms;
}
[role=switch][aria-checked=true] {
background-color: var(--colour-blue);
}
[role=switch][aria-checked=true] > span {
margin-left: calc(1.5rem - 5%);
}</pre>
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
@use "sass:math"; @use "sass:math";
@@ -80,7 +59,13 @@ $switch-height: 1.5rem !default;
} }
} }
}</pre> }</pre>
<pre class="language-js" data-tab="js">//- DS2 core (c) 2024 Alexander McIlwraith </div>
<div tab="js">
<pre class="language-js">// Note that switch is a reserved word.
import * as swtch from "./js/core/switch/_switch.js";
swtch.init();
</pre>
<pre class="language-js">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
function flip(e) { function flip(e) {
@@ -108,5 +93,6 @@ module.exports = {
} }
</pre> </pre>
</div> </div>
</div>
</body> </body>
</html> </html>

View File

@@ -6,7 +6,7 @@
<body data-prismjs-copy-timeout="1500"> <body data-prismjs-copy-timeout="1500">
<h2>What is it</h2> <h2>What is it</h2>
<p>A tabs component that provides different sections of content that are displayed one at a time when the user selects that information. </p> <p>A tabs component that provides different sections of content that are displayed one at a time when the user selects that information. </p>
<h2>How to use it</h2> <h2>When to use it</h2>
<p>The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should </p> <p>The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should </p>
<ul> <ul>
<li>be logically chunked and ordered</li> <li>be logically chunked and ordered</li>
@@ -15,17 +15,17 @@
<li>obvious where they begin and end </li> <li>obvious where they begin and end </li>
</ul> </ul>
<p>Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. </p> <p>Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. </p>
<h2>When to use it</h2> <h2>How to use it</h2>
<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 structure of the tab set is defined in html. There are two forms supported. Adding a class of <code class="inline">.tab-group</code> to the container element will work in place of the <code class="inline">tabset</code> tag, and the tab panels can be defined using either <code class="inline">tab=""</code> or <code class="inline">data-tab=""</code>. Passing an optional element to the init function will initialise tabs within that element. </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;
@@ -38,8 +38,8 @@ tabset > ul, .tab-group > ul {
padding: 0; padding: 0;
} }
tabset > ul li.separator, .tab-group > ul li.separator { tabset > ul li.separator, .tab-group > ul li.separator {
border-bottom: 1px solid var(--colour-grey); border-bottom: 1px solid #7f7f7f;
border-left: 1px solid var(--colour-grey); border-left: 1px solid #7f7f7f;
display: inline-block; display: inline-block;
margin: 0.45rem 0 0 0; margin: 0.45rem 0 0 0;
width: 100%; width: 100%;
@@ -48,9 +48,9 @@ tabset .tab-hidden, .tab-group .tab-hidden {
display: none; display: none;
} }
tabset [role=tab], .tab-group [role=tab] { tabset [role=tab], .tab-group [role=tab] {
background-color: var(--colour-white); background-color: #FFF;
border-left: 1px solid var(--colour-grey); border-left: 1px solid #7f7f7f;
border-top: 1px solid var(--colour-grey); border-top: 1px solid #7f7f7f;
border-radius: 0.5rem 0.5rem 0 0; border-radius: 0.5rem 0.5rem 0 0;
cursor: pointer; cursor: pointer;
margin: 0; margin: 0;
@@ -59,19 +59,19 @@ tabset [role=tab], .tab-group [role=tab] {
z-index: 2; z-index: 2;
} }
tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type { tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type {
border-right: 1px solid var(--colour-grey); border-right: 1px solid #7f7f7f;
} }
tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) { tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) {
background-color: var(--colour-grey-xxl); background-color: #f0f0f0;
border-bottom: 1px solid var(--colour-grey); border-bottom: 1px solid #7f7f7f;
} }
tabset [role=tab] span, .tab-group [role=tab] span { tabset [role=tab] span, .tab-group [role=tab] span {
display: block; display: block;
margin: 0 0 0.5rem 0; margin: 0 0 0.5rem 0;
} }
tabset [role=tabpanel], .tab-group [role=tabpanel] { tabset [role=tabpanel], .tab-group [role=tabpanel] {
background-color: var(--colour-white); background-color: #FFF;
border: 1px solid var(--colour-grey); border: 1px solid #7f7f7f;
border-top: none; border-top: none;
padding: 1rem; padding: 1rem;
z-index: 1; z-index: 1;
@@ -79,7 +79,13 @@ tabset [role=tabpanel], .tab-group [role=tabpanel] {
tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) { tabset [role=tabpanel]:not(.open), .tab-group [role=tabpanel]:not(.open) {
display: none; display: none;
}</pre> }</pre>
<pre class="language-css" tab="scss">// DS2 core (c) 2024 Alexander McIlwraith <div tab="scss">
<pre class="language-sass">@import "scss/core/tabs/_tabs";
@include tabs{
// optional content block
};
</pre>
<pre class="language-sass">// DS2 core (c) 2024 Alexander McIlwraith
// Licensed under CC BY-SA 4.0 // Licensed under CC BY-SA 4.0
$tab-border: #7f7f7f !default; $tab-border: #7f7f7f !default;
@@ -148,12 +154,22 @@ $tab-notselected: #f0f0f0 !default;
} }
} }
}</pre> }</pre>
<pre class="language-css" tab="js">/* DS2 core (c) 2024 Alexander McIlwraith </div>
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; <div tab="js">
tabs.init(); <pre class="language-js">import * as tabs from "./js/core/tabs/_tabs.js";
tabs.init();</pre>
<pre class="language-js">/* DS2 core (c) 2024 Alexander McIlwraith
Released under Creative Commons Attribution-ShareAlike 4.0 International
*/ */
export function init(p = document) { // create a pure JS mouse click event
const click = new MouseEvent('click', {
view: window,
bubbles: false,
cancelable: true
});
export function init(p = document, s = true) {
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => { p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
if (tabGroup.querySelector("[role=tablist]") === null) { if (tabGroup.querySelector("[role=tablist]") === null) {
@@ -180,7 +196,7 @@ export function init(p = document) {
const ul = document.createElement('ul'); const ul = document.createElement('ul');
ul.setAttribute("role", "tablist"); ul.setAttribute("role", "tablist");
ul.innerHTML = `${tablist}<li role="separator" class="separator"></li>`; ul.innerHTML = s != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
tabGroup.insertBefore(ul, tabGroup.firstChild); tabGroup.insertBefore(ul, tabGroup.firstChild);
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => { tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
@@ -196,12 +212,20 @@ export function init(p = document) {
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel"); const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
document.getElementById(tabPanelId).classList.add("open"); document.getElementById(tabPanelId).classList.add("open");
}); });
});
tab.addEventListener("keypress", (e) => {
e.preventDefault();
if( e.which == 32 || e.which == 13 ) {
e.currentTarget.dispatchEvent(click);
}
})
});
} }
}); });
} }
</pre> </pre>
</div>
</tabset> </tabset>
</body> </body>
</html> </html>

View File

@@ -11,7 +11,9 @@
<p>Use tooltips to help differentiate between multiple, close, similar options. </p> <p>Use tooltips to help differentiate between multiple, close, similar options. </p>
<h2>How to use it</h2> <h2>How to use it</h2>
<p class="notification-box info">Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that.</p> <p class="notification-box info">Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that.</p>
<p>Either form works. Place this inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field. </p> <p>Either form works.
<sticky-note class="blue">"Either form works": What are the two forms.</sticky-note>Place the <code class="language-html inline">tooltip</code> inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field.
</p>
<p>Tool tip positions are: </p> <p>Tool tip positions are: </p>
<ul> <ul>
<li>top / block-start</li> <li>top / block-start</li>
@@ -20,11 +22,11 @@
<li>left / inline-start</li> <li>left / inline-start</li>
</ul> </ul>
<p><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></p> <p><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></p>
<div class="tab-group" id="tooltip"> <tabset id="tooltip">
<pre class="language-html" data-tab="html"><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></pre> <pre class="language-html" tab="html"><a href="#">Link with a tool tip<span role="tooltip" inert="inert" tip-position="right">Tool tip content</span></a></pre>
<pre class="language-pug" data-tab="pug">a(href="#") Link with a tool tip <pre class="language-pug" tab="pug">a(href="#") Link with a tool tip
span(role="tooltip" inert tip-position="right") Tool tip content</pre> span(role="tooltip" inert tip-position="right") Tool tip content</pre>
<pre class="language-css" data-tab="css">/* Position Options <pre class="language-css" tab="css">/* Position Options
- top / block-start - top / block-start
- right / inline-end - right / inline-end
- bottom / block-end - bottom / block-end
@@ -179,7 +181,10 @@
--tooltip-x: calc(-1 * 3px * -1); --tooltip-x: calc(-1 * 3px * -1);
} }
}</pre> }</pre>
<pre class="language-css" data-tab="scss">//- DS2 core (c) 2024 Alexander McIlwraith <div tab="scss">
<pre class="language-sass">@import "scss/core/tooltip/_tooltip";
@include tooltip;</pre>
<pre class="language-sass">//- DS2 core (c) 2024 Alexander McIlwraith
//- Licensed under CC BY-SA 4.0 //- Licensed under CC BY-SA 4.0
$tooltip-border-radius: .5rem !default; $tooltip-border-radius: .5rem !default;
@@ -357,5 +362,6 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
} }
}</pre> }</pre>
</div> </div>
</tabset>
</body> </body>
</html> </html>

View File

@@ -102,7 +102,19 @@ const getURLVars = () => {
} }
module.exports = { module.exports = {
url: getURLVars(), url: (() => {
var v = {};
if (location.search.length > 0) {
var qs = (location.search.substr(1)).split("&");
for (var i = 0; i < qs.length; i++) {
var t = qs[i].split("=");
if (t[1].length > 0) {
v[t[0]] = decodeURIComponent(t[1].replace(/\+/g, '%20'));
}
}
}
return v;
})(),
cookie: { cookie: {
set: (name, value, expires, path, domain, secure) => { set: (name, value, expires, path, domain, secure) => {
switch(typeof expires) { switch(typeof expires) {
@@ -166,6 +178,9 @@ module.exports = {
}) })
} }
}, },
// getCSS: (el, prop, b = false) {
// return window.getComputedStyle(el, null).getPropertyValue(prop);
// },
init: (args = {}) => { init: (args = {}) => {
const url = getURLVars(); const url = getURLVars();
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px","")); font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px",""));
@@ -177,7 +192,14 @@ module.exports = {
if (url.p == -1) { if (url.p == -1) {
document.querySelector("title").innerHTML = `${url.p.toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }`; document.querySelector("title").innerHTML = `${url.p.toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }`;
} else { } else {
document.querySelector("title").innerHTML = `${url.p.substring(url.p.lastIndexOf("/")+1).toContent().toTitleCase()} | ${ document.querySelector("title").getAttribute("data-site") }` let theTitle = document.querySelectorAll("article");
if (theTitle.length > 0) {
theTitle = theTitle[0].getAttribute("data-name").toContent().toTitleCase();
if (document.querySelector("article").getAttribute("data-display") !== null) {
theTitle = document.querySelector("article").getAttribute("data-display")
}
document.querySelector("title").innerHTML = `${theTitle} | ${ document.querySelector("title").getAttribute("data-site") }`
}
} }
} }
@@ -189,8 +211,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 +226,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 +284,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 +291,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 +302,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

@@ -24,9 +24,6 @@ core.init({
} }
}); });
// deprecated switch handler // deprecated switch handler
const flipInfoSwitch = (e, s = e.currentTarget) => { const flipInfoSwitch = (e, s = e.currentTarget) => {

View File

@@ -139,13 +139,16 @@
- return o; - return o;
- } - }
if !colortxt
- var colortxt = "color"
mixin accessibility-info(c) mixin accessibility-info(c)
div.acchb div.acchb
span color & black span #{colortxt} & black
small= getContrastRatio(color(c, "rgb"), "rgb(0,0,0)") + ":1" small= getContrastRatio(color(c, "rgb"), "rgb(0,0,0)") + ":1"
div.acchw div.acchw
span color & white span #{colortxt} & white
small= getContrastRatio(color(c, "rgb"), "rgb(255,255,255)") + ":1" small= getContrastRatio(color(c, "rgb"), "rgb(255,255,255)") + ":1"
div.aa WCAG 2.0 AA div.aa WCAG 2.0 AA
div.accbaa.result div.accbaa.result

View File

@@ -29,6 +29,9 @@ mixin show-content(items, path)
- path = (path == "" ? "" : path + "/") + items.name.toPath() - path = (path == "" ? "" : path + "/") + items.name.toPath()
if items.core == true
- items.status = "complete"
article(id=path.replace(/\//g, "-").toPath() article(id=path.replace(/\//g, "-").toPath()
data-name=items.name data-name=items.name
data-status=items.status data-status=items.status
@@ -36,8 +39,13 @@ 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"
) )
if items.display
h1(class="status-" + items.status )
span= items.display
tool-tip(role="tooltip" inert tip-position="right")= items.status.toSentenceCase().toContent()
else
h1(class="status-" + items.status ) h1(class="status-" + items.status )
span= items.name.toSentenceCase().toContent() span= items.name.toSentenceCase().toContent()
tool-tip(role="tooltip" inert tip-position="right")= items.status.toSentenceCase().toContent() tool-tip(role="tooltip" inert tip-position="right")= items.status.toSentenceCase().toContent()
@@ -76,18 +84,3 @@ html(lang= lang )
+show-content(category, "") +show-content(category, "")
script(src="assets/scaffolding-min.js") script(src="assets/scaffolding-min.js")

View File

@@ -7,7 +7,11 @@ block config
mixin h(h) mixin h(h)
if headings[h] if headings[h]
if headings[h].indexOf("|") == -1
h2= headings[h] h2= headings[h]
else
- var cntnt = headings[h].split("|")
| <#{cntnt[0]}>#{cntnt[1]}</#{cntnt[0]}>
- const getDate = function(){ - const getDate = function(){
- var d = new Date(); - var d = new Date();

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 {
@@ -9,6 +10,7 @@ $grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px ) !defau
color: white; color: white;
content: "bigger than extra large"; content: "bigger than extra large";
display: grid; display: grid;
font-family: sans-serif;
font-size: 25px; font-size: 25px;
grid-template-columns: auto; grid-template-columns: auto;
padding: 25px; padding: 25px;

View File

@@ -17,6 +17,14 @@ block content
p When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across. p When using this, use the default break points as they are set to the same as the Bootstrap framework. The grid for the design system at large break point has been widened to accompdate 3 colour cards across.
div.tab-group#breakpoints tabset#breakpoints
pre.language-css(data-tab="scss") div(tab="scss")
+h(3)
pre.language-sass.
@import "scss/core/breakpoints/breakpoints";
@include break([breakpoint]) {
// css here
}
+h(4)
pre.language-sass
include _breakpoints.scss include _breakpoints.scss

View File

@@ -1,53 +1 @@
header { header{display:-ms-grid;display:grid;-ms-grid-rows:1.75rem 3.5rem;grid-template-rows:1.75rem 3.5rem;-ms-grid-column:2;-ms-grid-column-span:2;grid-column:2/4;overflow:hidden}header svg{grid-column:1/-1;grid-row:1/-1;-ms-grid-row-align:stretch;-ms-grid-column-align:stretch;place-self:stretch}header svg text{-webkit-transform:translate(-1rem,7.25rem);-ms-transform:translate(-1rem,7.25rem);transform:translate(-1rem,7.25rem);font-size:10rem;font-weight:1000;font-family:sans-serif;fill:var(--colour-grey-xxl)}header>div{-ms-grid-row:2;grid-row:2;grid-column:1/-1;display:-ms-grid;display:grid;grid-column-gap:1rem;-ms-grid-columns:auto -webkit-max-content -webkit-max-content;-ms-grid-columns:auto max-content max-content;grid-template-columns:auto -webkit-max-content -webkit-max-content;grid-template-columns:auto max-content max-content}header>div .header-title h1{margin:0;padding:0 1rem}header>div .header-title h1 a,header>div .header-title h1 a:visited{border-bottom:none;color:var(--colour-black);font-family:sans-serif;font-size:2.5rem;font-size:32px;font-weight:700;margin:0;padding:0;text-decoration:none}
display: -ms-grid;
display: grid;
-ms-grid-rows: 1.75rem 3.5rem;
grid-template-rows: 1.75rem 3.5rem;
-ms-grid-column: 2;
-ms-grid-column-span: 2;
grid-column: 2/4;
overflow: hidden;
}
header svg {
grid-column: 1/-1;
grid-row: 1/-1;
-ms-grid-row-align: stretch;
-ms-grid-column-align: stretch;
place-self: stretch;
}
header svg text {
-webkit-transform: translate(-1rem, 7.25rem);
-ms-transform: translate(-1rem, 7.25rem);
transform: translate(-1rem, 7.25rem);
font-size: 10rem;
font-weight: 1000;
font-family: sans-serif;
fill: var(--colour-grey-xxl);
}
header > div {
-ms-grid-row: 2;
grid-row: 2;
grid-column: 1/-1;
display: -ms-grid;
display: grid;
grid-column-gap: 1rem;
-ms-grid-columns: auto -webkit-max-content -webkit-max-content;
-ms-grid-columns: auto max-content max-content;
grid-template-columns: auto -webkit-max-content -webkit-max-content;
grid-template-columns: auto max-content max-content;
}
header > div .header-title h1 {
margin: 0;
padding: 0 1rem;
}
header > div .header-title h1 a, header > div .header-title h1 a:visited {
border-bottom: none;
color: var(--colour-black);
font-family: sans-serif;
font-size: 2.5rem;
font-size: 32px;
font-weight: 700;
margin: 0;
padding: 0;
text-decoration: none;
}

View File

@@ -10,11 +10,10 @@ block content
p Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages. p Use a header at the top of every page. The 'front page' of a site may have a different header than the rest of the pages.
+h(2) +h(2)
p Place the header at the top of the page after the skip to main content link. This basic header should be replaced with your own site's header. p Place the header at the top of the page after the skip to main content link. You will likely want to replace core header should be replaced with your own site's header. To do this, remove the #[code.inline.language-js core: true ] and create your own pattern in the location you wish it in your design system.
tabset#header
div.tab-group#header pre.language-html(tab="html")
pre.language-html(data-tab="html")
// create temp variables and store the design system values // create temp variables and store the design system values
- var tmpsite= site - var tmpsite= site
- var tmproot= root - var tmproot= root
@@ -26,12 +25,14 @@ block content
//- reset variables to original values //- reset variables to original values
- site= tmpsite - site= tmpsite
- root= tmproot - root= tmproot
pre.language-pug(tab="pug")
pre.language-html(data-tab="html")
include _header.pug
pre.language-pug(data-tab="pug")
include _header.pp include _header.pp
pre.language-css(data-tab="css") pre.language-css(tab="css")
include header.css include header.css
pre.language-sass(data-tab="scss") div.language-sass(tab="scss")
pre.language-sass.
@import "scss/core/header/header;
pre.language-sass
include _header.scss include _header.scss

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

@@ -8,13 +8,12 @@ block content
+h(1) +h(1)
p Use a sticky when you want to make a note without adding it to the content. p Use a sticky when you want to make a note without adding it to the content.
+h(2) +h(2)
p Uses absolute positioning. p Uses absolute positioning. Passing an optional element to the init function will initialise tabs within that element. You can move the position using either #[code.language-html.inline float="&#91; right | left &#93;"] or #[code.language-html.inline offset="&#91; top | left &#93;"]. Offset will take negative values in any web measurement unit.
sticky-note(float="right").blue This #[strong is] a sample sticky. sticky-note.blue(offset="-10rem 1rem") This #[strong is] a sample sticky. You can drag it out of the way if you need to see the content under it.
| You can drag it out of the way if you need to see the content under it. sticky-note(float="right") You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).
p If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements". p If you wish to create a custom element, that extends another HTML element, the native element has to be extended in customElements.define(). Custom elements that inherit native elements are also known as "type extension custom elements".
sticky-note You will notice when you hover over the sticky, it shows a dot in the colour of the sticky in the position where the sticky note refers to (assuming you haven't dragged it and scrolled that location off the screen).
tabset#sticky-note tabset#sticky-note
pre.language-html(tab="html") pre.language-html(tab="html")
@@ -23,7 +22,22 @@ block content
include _sticky-note.pp include _sticky-note.pp
pre.language-css(data-tab="css") pre.language-css(data-tab="css")
include sticky-note.css include sticky-note.css
pre.language-css(data-tab="scss") div(tab="scss")
+h(3)
pre.language-sass.
$sticky-colors: ( [sass map with your own defined colours] );
@import "scss/core/switch/_sticky-note";
@include sticky-note;
+h(4)
pre.language-sass
include _sticky-note.scss include _sticky-note.scss
pre.language-js(data-tab="js") div(tab="js")
+h(3)
pre.language-js.
import * as stickynote from ""./js/core/sticky-note/_sticky-note.js";
stickynote.init()
+h(4)
pre.language-js
include _sticky-note.js include _sticky-note.js

View File

@@ -1,126 +1 @@
@import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap");sticky-note-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid transparent;border-radius:50%;display:inline-block;height:0.5rem;position:relative;width:0.5rem}sticky-note-wrapper *{-webkit-box-sizing:border-box;box-sizing:border-box}sticky-note-wrapper sticky-note{cursor:-webkit-grab;cursor:grab;display:-ms-grid;display:grid;float:left;font-size:1rem;height:13rem;left:0;place-items:stretch;position:absolute;top:0;width:13rem;z-index:100}sticky-note-wrapper sticky-note:active{cursor:-webkit-grabbing;cursor:grabbing;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}sticky-note-wrapper sticky-note.right{float:right}sticky-note-wrapper sticky-note>div{-ms-grid-row:1;grid-row:1;-ms-grid-column:1;grid-column:1}sticky-note-wrapper sticky-note>div:first-child{background-color:rgba(0,0,0,0.25);-webkit-box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);box-shadow:-2px 2px 15px 0 rgba(0,0,0,0.5);display:-ms-grid;display:grid;margin:2rem 1rem 0.25rem 0.36rem;width:calc(100% - 1rem)}sticky-note-wrapper sticky-note>div:nth-child(2){clip-path:url(#stickyClip);display:-ms-grid;display:grid;font-family:"Kalam",cursive;font-style:1rem;font-weight:300;line-height:1.25rem;padding:1rem;place-items:center;text-align:center}sticky-note-wrapper sticky-note>div:nth-child(2)>*{font-family:"Kalam",cursive!important;font-style:normal!important;font-weight:300!important}@media screen and (max-width:1024px){sticky-note-wrapper sticky-note>div:nth-child(2){max-width:13rem;min-width:13rem;width:1rem}}@media screen and (max-width:768px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:1.75rem;max-width:21rem;min-height:21rem}}@media screen and (max-width:640px){sticky-note-wrapper sticky-note>div:nth-child(2){font-size:2.5rem;max-width:26rem;min-height:26rem}}sticky-note-wrapper sticky-note>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#ffffdd),color-stop(2%,#ffffd3),color-stop(12%,#ffffd3),color-stop(75%,#ffffc9),to(#ffffba));background:linear-gradient(180deg,#ffffdd 0%,#ffffd3 2%,#ffffd3 12%,#ffffc9 75%,#ffffba 100%)}sticky-note-wrapper sticky-note.blue>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#9dddec),color-stop(2%,#94daea),color-stop(12%,#94daea),color-stop(75%,#8bd7e8),to(#7fd3e6));background:linear-gradient(180deg,#9dddec 0%,#94daea 2%,#94daea 12%,#8bd7e8 75%,#7fd3e6 100%)}sticky-note-wrapper sticky-note.pink>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#fa7c93),color-stop(2%,#fa728b),color-stop(12%,#fa728b),color-stop(75%,#fa6883),to(#f95977));background:linear-gradient(180deg,#fa7c93 0%,#fa728b 2%,#fa728b 12%,#fa6883 75%,#f95977 100%)}sticky-note-wrapper sticky-note.green>div:nth-child(2){background:-webkit-gradient(linear,left top,left bottom,from(#c5fcc9),color-stop(2%,#bbfbc0),color-stop(12%,#bbfbc0),color-stop(75%,#b1fab7),to(#a3faaa));background:linear-gradient(180deg,#c5fcc9 0%,#bbfbc0 2%,#bbfbc0 12%,#b1fab7 75%,#a3faaa 100%)}sticky-note-wrapper:has(sticky-note:hover){background-color:#ffffd3;border:1px solid black}sticky-note-wrapper:has(sticky-note.yellow:hover){background-color:#ffffd3}sticky-note-wrapper:has(sticky-note.blue:hover){background-color:#94daea}sticky-note-wrapper:has(sticky-note.pink:hover){background-color:#fa728b}sticky-note-wrapper:has(sticky-note.green:hover){background-color:#bbfbc0}
sticky-note-wrapper {
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid transparent;
border-radius: 50%;
display: inline-block;
height: 0.5rem;
position: relative;
width: 0.5rem;
}
sticky-note-wrapper * {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
sticky-note-wrapper sticky-note {
cursor: -webkit-grab;
cursor: grab;
display: -ms-grid;
display: grid;
float: left;
font-size: 1rem;
height: 13rem;
left: 0;
place-items: stretch;
position: absolute;
top: 0;
width: 13rem;
z-index: 100;
}
sticky-note-wrapper sticky-note:active {
cursor: -webkit-grabbing;
cursor: grabbing;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
sticky-note-wrapper sticky-note.right {
float: right;
}
sticky-note-wrapper sticky-note > div {
-ms-grid-row: 1;
grid-row: 1;
-ms-grid-column: 1;
grid-column: 1;
}
sticky-note-wrapper sticky-note > div:nth-child(1) {
background-color: rgba(0, 0, 0, 0.25);
-webkit-box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
box-shadow: -2px 2px 15px 0 rgba(0, 0, 0, 0.5);
display: -ms-grid;
display: grid;
margin: 2rem 1rem 0.25rem 0.36rem;
width: calc(100% - 1rem);
}
sticky-note-wrapper sticky-note > div:nth-child(2) {
clip-path: url(#stickyClip);
display: -ms-grid;
display: grid;
font-family: "Kalam", cursive;
font-style: 1rem;
font-weight: 300;
line-height: 1.25rem;
padding: 1rem;
place-items: center;
text-align: center;
}
sticky-note-wrapper sticky-note > div:nth-child(2) > * {
font-family: "Kalam", cursive !important;
font-style: normal !important;
font-weight: 300 !important;
}
@media screen and (max-width: 1024px) {
sticky-note-wrapper sticky-note > div:nth-child(2) {
max-width: 13rem;
min-width: 13rem;
width: 1rem;
}
}
@media screen and (max-width: 768px) {
sticky-note-wrapper sticky-note > div:nth-child(2) {
font-size: 1.75rem;
max-width: 21rem;
min-height: 21rem;
}
}
@media screen and (max-width: 640px) {
sticky-note-wrapper sticky-note > div:nth-child(2) {
font-size: 2.5rem;
max-width: 26rem;
min-height: 26rem;
}
}
sticky-note-wrapper sticky-note > div:nth-child(2) {
background: -webkit-gradient(linear, left top, left bottom, from(#ffffdd), color-stop(2%, #ffffd3), color-stop(12%, #ffffd3), color-stop(75%, #ffffc9), to(#ffffba));
background: linear-gradient(180deg, #ffffdd 0%, #ffffd3 2%, #ffffd3 12%, #ffffc9 75%, #ffffba 100%);
}
sticky-note-wrapper sticky-note.blue > div:nth-child(2) {
background: -webkit-gradient(linear, left top, left bottom, from(#9dddec), color-stop(2%, #94daea), color-stop(12%, #94daea), color-stop(75%, #8bd7e8), to(#7fd3e6));
background: linear-gradient(180deg, #9dddec 0%, #94daea 2%, #94daea 12%, #8bd7e8 75%, #7fd3e6 100%);
}
sticky-note-wrapper sticky-note.pink > div:nth-child(2) {
background: -webkit-gradient(linear, left top, left bottom, from(#fa7c93), color-stop(2%, #fa728b), color-stop(12%, #fa728b), color-stop(75%, #fa6883), to(#f95977));
background: linear-gradient(180deg, #fa7c93 0%, #fa728b 2%, #fa728b 12%, #fa6883 75%, #f95977 100%);
}
sticky-note-wrapper sticky-note.green > div:nth-child(2) {
background: -webkit-gradient(linear, left top, left bottom, from(#c5fcc9), color-stop(2%, #bbfbc0), color-stop(12%, #bbfbc0), color-stop(75%, #b1fab7), to(#a3faaa));
background: linear-gradient(180deg, #c5fcc9 0%, #bbfbc0 2%, #bbfbc0 12%, #b1fab7 75%, #a3faaa 100%);
}
sticky-note-wrapper:has(sticky-note:hover) {
background-color: #ffffd3;
border: 1px solid black;
}
sticky-note-wrapper:has(sticky-note.yellow:hover) {
background-color: #ffffd3;
}
sticky-note-wrapper:has(sticky-note.blue:hover) {
background-color: #94daea;
}
sticky-note-wrapper:has(sticky-note.pink:hover) {
background-color: #fa728b;
}
sticky-note-wrapper:has(sticky-note.green:hover) {
background-color: #bbfbc0;
}

View File

@@ -21,13 +21,28 @@ block content
span#example-switch(role="switch") span#example-switch(role="switch")
div#switches.tab-group div#switches.tab-group
pre.language-html(data-tab="html") pre.language-html(tab="html")
include _switch.pug include _switch.pug
pre.language-pug(data-tab="pug") pre.language-pug(tab="pug")
include _switch.pp include _switch.pp
pre.language-css(data-tab="css") pre.language-css(tab="css")
include switch.css include switch.css
pre.language-css(data-tab="scss") div(tab="scss")
+h(3)
pre.language-sass.
@import "scss/core/switch/_switch";
@include switch;
+h(4)
pre.language-sass
include _switch.scss include _switch.scss
pre.language-js(data-tab="js") div(tab="js")
+h(3)
pre.language-js.
// Note that switch is a reserved word.
import * as swtch from "./js/core/switch/_switch.js";
swtch.init();
+h(4)
pre.language-js
include _switch.js include _switch.js

View File

@@ -1,26 +1 @@
[role=switch] { [role=switch]{display:-ms-inline-grid;display:inline-grid;border:1px solid #2e51a1;background-color:#d8d8d8;border-radius:0.75rem;height:1.5rem;width:3rem;-webkit-transition:all 500ms;transition:all 500ms}[role=switch]>span{display:inline-block;background-color:white;border-radius:50%;margin:2%;width:calc(1.5rem - 2%);-webkit-transition:all 500ms;transition:all 500ms}[role=switch][aria-checked=true]{background-color:#2e51a1}[role=switch][aria-checked=true]>span{margin-left:calc(1.5rem - 5%)}
display: -ms-inline-grid;
display: inline-grid;
border: 1px solid var(--colour-blue);
background-color: var(--colour-grey-xl);
border-radius: 0.75rem;
height: 1.5rem;
width: 3rem;
-webkit-transition: all 500ms;
transition: all 500ms;
}
[role=switch] > span {
display: inline-block;
background-color: white;
border-radius: 50%;
margin: 2%;
width: calc(1.5rem - 2%);
-webkit-transition: all 500ms;
transition: all 500ms;
}
[role=switch][aria-checked=true] {
background-color: var(--colour-blue);
}
[role=switch][aria-checked=true] > span {
margin-left: calc(1.5rem - 5%);
}

View File

@@ -1,9 +1,15 @@
/* DS2 core (c) 2024 Alexander McIlwraith /* DS2 core (c) 2024 Alexander McIlwraith
import * as tabs from "../pg/patterns/layouts/tabs/_tabs.js"; Released under Creative Commons Attribution-ShareAlike 4.0 International
tabs.init();
*/ */
export function init(p = document) { // create a pure JS mouse click event
const click = new MouseEvent('click', {
view: window,
bubbles: false,
cancelable: true
});
export function init(p = document, s = true) {
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => { p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
if (tabGroup.querySelector("[role=tablist]") === null) { if (tabGroup.querySelector("[role=tablist]") === null) {
@@ -30,7 +36,7 @@ export function init(p = document) {
const ul = document.createElement('ul'); const ul = document.createElement('ul');
ul.setAttribute("role", "tablist"); ul.setAttribute("role", "tablist");
ul.innerHTML = `${tablist}<li role="separator" class="separator"></li>`; ul.innerHTML = s != true ? `${tablist}` : `${tablist}<li role="separator" class="separator"></li>`;
tabGroup.insertBefore(ul, tabGroup.firstChild); tabGroup.insertBefore(ul, tabGroup.firstChild);
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => { tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
@@ -46,8 +52,15 @@ export function init(p = document) {
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel"); const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
document.getElementById(tabPanelId).classList.add("open"); document.getElementById(tabPanelId).classList.add("open");
}); });
});
tab.addEventListener("keypress", (e) => {
e.preventDefault();
if( e.which == 32 || e.which == 13 ) {
e.currentTarget.dispatchEvent(click);
}
})
});
} }
}); });
} }

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]")

View File

@@ -7,7 +7,7 @@ block content
+h(0) +h(0)
p A tabs component that provides different sections of content that are displayed one at a time when the user selects that information. p A tabs component that provides different sections of content that are displayed one at a time when the user selects that information.
+h(2) +h(1)
p The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should p The tabbed user interface enables users to jump to their target section quickly. Tabs present like logically group information on the same page. Information should
ul ul
@@ -19,8 +19,9 @@ block content
p Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content. p Users should not need to see content of multiple tabs simultaneously and the user should be able to easily recognise where they are within the content.
+h(1) +h(2)
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 The structure of the tab set is defined in html. There are two forms supported. Adding a class of #[code.inline .tab-group] to the container element will work in place of the #[code.inline tabset] tag, and the tab panels can be defined using either #[code.inline tab=""] or #[code.inline data-tab=""]. Passing an optional element to the init function will initialise tabs within that element.
tabset#tabs tabset#tabs
pre.language-html(tab="html") pre.language-html(tab="html")
@@ -29,8 +30,23 @@ block content
include _tabs.pp include _tabs.pp
pre.language-css(tab="css") pre.language-css(tab="css")
include tabs.css include tabs.css
pre.language-css(tab="scss") div(tab="scss")
+h(3)
pre.language-sass.
@import "scss/core/tabs/_tabs";
@include tabs{
// optional content block
};
+h(4)
pre.language-sass
include _tabs.scss include _tabs.scss
pre.language-css(tab="js") div(tab="js")
+h(3)
pre.language-js.
import * as tabs from "./js/core/tabs/_tabs.js";
tabs.init();
+h(4)
pre.language-js
include _tabs.js include _tabs.js

View File

@@ -9,8 +9,8 @@ tabset > ul, .tab-group > ul {
padding: 0; padding: 0;
} }
tabset > ul li.separator, .tab-group > ul li.separator { tabset > ul li.separator, .tab-group > ul li.separator {
border-bottom: 1px solid var(--colour-grey); border-bottom: 1px solid #7f7f7f;
border-left: 1px solid var(--colour-grey); border-left: 1px solid #7f7f7f;
display: inline-block; display: inline-block;
margin: 0.45rem 0 0 0; margin: 0.45rem 0 0 0;
width: 100%; width: 100%;
@@ -19,9 +19,9 @@ tabset .tab-hidden, .tab-group .tab-hidden {
display: none; display: none;
} }
tabset [role=tab], .tab-group [role=tab] { tabset [role=tab], .tab-group [role=tab] {
background-color: var(--colour-white); background-color: #FFF;
border-left: 1px solid var(--colour-grey); border-left: 1px solid #7f7f7f;
border-top: 1px solid var(--colour-grey); border-top: 1px solid #7f7f7f;
border-radius: 0.5rem 0.5rem 0 0; border-radius: 0.5rem 0.5rem 0 0;
cursor: pointer; cursor: pointer;
margin: 0; margin: 0;
@@ -30,19 +30,19 @@ tabset [role=tab], .tab-group [role=tab] {
z-index: 2; z-index: 2;
} }
tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type { tabset [role=tab]:last-of-type, .tab-group [role=tab]:last-of-type {
border-right: 1px solid var(--colour-grey); border-right: 1px solid #7f7f7f;
} }
tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) { tabset [role=tab]:not(.selected), .tab-group [role=tab]:not(.selected) {
background-color: var(--colour-grey-xxl); background-color: #f0f0f0;
border-bottom: 1px solid var(--colour-grey); border-bottom: 1px solid #7f7f7f;
} }
tabset [role=tab] span, .tab-group [role=tab] span { tabset [role=tab] span, .tab-group [role=tab] span {
display: block; display: block;
margin: 0 0 0.5rem 0; margin: 0 0 0.5rem 0;
} }
tabset [role=tabpanel], .tab-group [role=tabpanel] { tabset [role=tabpanel], .tab-group [role=tabpanel] {
background-color: var(--colour-white); background-color: #FFF;
border: 1px solid var(--colour-grey); border: 1px solid #7f7f7f;
border-top: none; border-top: none;
padding: 1rem; padding: 1rem;
z-index: 1; z-index: 1;

View File

@@ -1,6 +1,7 @@
//- 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
$font-body: sans-serif !default;
$tooltip-border-radius: .5rem !default; $tooltip-border-radius: .5rem !default;
$tooltip-dark-allow: true !default; $tooltip-dark-allow: true !default;
$tooltip-dark-background: #1f2127 !default; $tooltip-dark-background: #1f2127 !default;
@@ -29,6 +30,7 @@ $tooltip-pointer-top: conic-gradient(from 150deg at top, rgba(0, 0, 0, 0), #000
border-radius: $tooltip-border-radius; border-radius: $tooltip-border-radius;
color: $tooltip-light-foreground; color: $tooltip-light-foreground;
filter: $tooltip-light-drop-shadow; filter: $tooltip-light-drop-shadow;
$font-family: $font-body;
font-size: 1rem; font-size: 1rem;
font-weight: 400; font-weight: 400;
inline-size: max-content; inline-size: max-content;

View File

@@ -6,6 +6,7 @@ block content
+h(0) +h(0)
p Tooltips provide brief information messaging through a mouse or keyboard hover. p Tooltips provide brief information messaging through a mouse or keyboard hover.
+h(1) +h(1)
p Use tool tips to provide additional information. Don't use tooltips for that is required to complete an interaction as the information disappears when it loses the hover state. p Use tool tips to provide additional information. Don't use tooltips for that is required to complete an interaction as the information disappears when it loses the hover state.
@@ -15,7 +16,11 @@ block content
p.notification-box.info Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that. p.notification-box.info Currently, there is no easy way to activate a hover without with pure CSS without using a keyboard or mouse. Level4 media queries aim to solve that.
p Either form works. Place this inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field.
p Either form works.
sticky-note.blue "Either form works": What are the two forms.
| Place the #[code.language-html.inline tooltip] inside another element for the tooltip to be 'linked to that element.' A container element may need to be added for a single tag element, such as a input field.
p Tool tip positions are: p Tool tip positions are:
ul ul
@@ -28,13 +33,19 @@ block content
include _tooltip.pug include _tooltip.pug
div#tooltip.tab-group tabset#tooltip
pre.language-html(data-tab="html") pre.language-html(tab="html")
include _tooltip.pug include _tooltip.pug
pre.language-pug(data-tab="pug") pre.language-pug(tab="pug")
include _tooltip.pp include _tooltip.pp
pre.language-css(data-tab="css") pre.language-css(tab="css")
include tooltip.css include tooltip.css
pre.language-css(data-tab="scss") div(tab="scss")
+h(3)
pre.language-sass.
@import "scss/core/tooltip/_tooltip";
@include tooltip;
+h(4)
pre.language-sass
include _tooltip.scss include _tooltip.scss