Add asset pipeline and professionalize theme
CI / build (push) Failing after 6m2s

Introduce a Node build system for minified CSS/JS with content hashes,
add PWA support, i18n helpers, accessibility improvements, and more
translatable strings. Move theme configuration from bookmarks to
localStorage, add Playwright tests, and set up CI workflows.
This commit is contained in:
2026-08-09 09:25:03 -04:00
parent 10af62dd6c
commit f753b27542
68 changed files with 4743 additions and 1989 deletions
+1
View File
@@ -0,0 +1 @@
!function(t){"use strict";const e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function n(t,n){if(!t)return null;const o=Array.prototype.slice.call(t.querySelectorAll(e));return n?o[0]:o[o.length-1]}t.ShaarliProA11y={focusFirst:function(t){const e=n(t,!0);e&&e.focus()},trapFocus:function(t){if(!t)return function(){};function e(e){if("Tab"!==e.key)return;const o=n(t,!0),i=n(t,!1);o&&i&&(e.shiftKey&&document.activeElement===o?(e.preventDefault(),i.focus()):e.shiftKey||document.activeElement!==i||(e.preventDefault(),o.focus()))}return t.addEventListener("keydown",e),function(){t.removeEventListener("keydown",e)}},getFocusable:n}}(window);
+1
View File
@@ -0,0 +1 @@
.awesomplete [hidden]{display:none}.awesomplete .visually-hidden{position:absolute;clip:rect(0,0,0,0)}.awesomplete{position:relative}.awesomplete,.awesomplete>input{display:block;width:100%}.awesomplete>ul{animation:slideDown .2s ease;background:var(--bg-card);border:1px solid var(--border);border-radius:.5rem;box-shadow:var(--shadow-lg);box-sizing:border-box;color:var(--text-main);left:0;list-style:none;margin:.25rem 0 0;min-width:100%;overflow:hidden;padding:0;position:absolute;text-shadow:none;z-index:1000}.awesomplete>ul:empty{display:none}.awesomplete>ul>li{border-bottom:1px solid var(--border-light);color:var(--text-main);cursor:pointer;font-size:.95rem;padding:.75rem 1rem;position:relative;transition:background .1s ease}.awesomplete>ul>li:last-child{border-bottom:none}.awesomplete>ul>li:hover{background:var(--bg-card-hover);color:var(--primary)}.awesomplete>ul>li[aria-selected=true]{background:var(--primary);color:#fff}.awesomplete mark{background:rgba(255,255,0,.3);color:inherit;font-weight:700;padding:0}.awesomplete li[aria-selected=true] mark{background:hsla(0,0%,100%,.3);color:inherit}[data-theme=dark] .awesomplete>ul{background:var(--bg-card);border-color:var(--border)}[data-theme=dark] .awesomplete>ul>li:hover{background:var(--bg-card-hover)}.card,.form-add .card,.page-edit .card{overflow:visible!important}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
+80
View File
@@ -0,0 +1,80 @@
{
"generatedAt": "2026-08-09T13:02:05.428Z",
"files": {
"css/style.css": {
"dist": "dist/style.min.css",
"hash": "a171bd2c9207",
"size": 71039
},
"css/themes.css": {
"dist": "dist/themes.min.css",
"hash": "eef4d8eb1c77",
"size": 29289
},
"css/custom_views.css": {
"dist": "dist/custom_views.min.css",
"hash": "4632d8790b9a",
"size": 29701
},
"css/awesomplete.css": {
"dist": "dist/awesomplete.min.css",
"hash": "3d064bc68c5d",
"size": 1440
},
"js/i18n.js": {
"dist": "dist/i18n.min.js",
"hash": "65a93efc158a",
"size": 5699
},
"js/shaarit-rules.js": {
"dist": "dist/shaarit-rules.min.js",
"hash": "13bd03a5472d",
"size": 6394
},
"js/modules/a11y.js": {
"dist": "dist/a11y.min.js",
"hash": "74b084c2aa76",
"size": 756
},
"js/modules/theme.js": {
"dist": "dist/theme.min.js",
"hash": "71ee5209634d",
"size": 1920
},
"js/modules/navigation.js": {
"dist": "dist/navigation.min.js",
"hash": "e6a4e847315c",
"size": 1671
},
"js/modules/search.js": {
"dist": "dist/search.min.js",
"hash": "86ff97ee522f",
"size": 12525
},
"js/modules/bulk-actions.js": {
"dist": "dist/bulk-actions.min.js",
"hash": "3ecca607bd44",
"size": 5165
},
"js/script.js": {
"dist": "dist/script.min.js",
"hash": "d14722799315",
"size": 49872
},
"js/custom_views.js": {
"dist": "dist/custom_views.min.js",
"hash": "595e6e4ac4c0",
"size": 143968
},
"js/awesomplete.min.js": {
"dist": "dist/awesomplete.min.js",
"hash": "784fb5005249",
"size": 7438
},
"js/metadata.min.js": {
"dist": "dist/metadata.min.js",
"hash": "61422013d705",
"size": 1552
}
}
}
+62
View File
@@ -0,0 +1,62 @@
(function () {
var loaded = false;
var tried = {};
function toAbsolute(url) {
try {
return new URL(url, window.location.href).toString();
} catch (e) {
return url;
}
}
function loadNext(candidates, index) {
if (loaded || index >= candidates.length) {
return;
}
var src = toAbsolute(candidates[index]);
if (tried[src]) {
loadNext(candidates, index + 1);
return;
}
tried[src] = true;
var script = document.createElement('script');
script.src = src;
script.async = false;
script.onload = function () {
loaded = true;
};
script.onerror = function () {
script.remove();
loadNext(candidates, index + 1);
};
document.head.appendChild(script);
}
var rootPath = (window.shaarli && window.shaarli.rootPath) || '';
var basePath = (window.shaarli && window.shaarli.basePath) || '';
var assetPath = (window.shaarli && window.shaarli.assetPath) || '';
var candidates = [];
if (assetPath) {
candidates.push(assetPath.replace(/\/tpl\/shaarli-pro\/?$/, '/tpl/default') + '/js/metadata.min.js');
}
if (basePath) {
candidates.push(basePath + '/tpl/default/js/metadata.min.js');
candidates.push(basePath + '/js/metadata.min.js');
}
if (rootPath) {
candidates.push(rootPath + '/tpl/default/js/metadata.min.js');
candidates.push(rootPath + '/js/metadata.min.js');
}
candidates.push('/js/metadata.min.js');
candidates.push('/tpl/default/js/metadata.min.js');
loadNext(candidates, 0);
})();
+1
View File
@@ -0,0 +1 @@
document.addEventListener("DOMContentLoaded",()=>{"use strict";const e=document.querySelector(".sidebar-add-note");e&&e.addEventListener("click",t=>{if(t.preventDefault(),!window.ShaarItRules)return void console.warn("[shaarit] ShaarItRules not available, cannot generate note URL");const a=e.getAttribute("data-base-path")||"",n=window.ShaarItRules.generateNoteUrl(),o=`${a}/admin/shaare?post=${encodeURIComponent(n)}&tags=note`;window.location.href=o});const t=document.querySelector(".sidebar-add-todo");t&&t.addEventListener("click",e=>{if(e.preventDefault(),!window.ShaarItRules)return void console.warn("[shaarit] ShaarItRules not available, cannot generate todo URL");const a=t.getAttribute("data-base-path")||"",n=window.ShaarItRules.generateTodoUrl(),o=`${a}/admin/shaare?post=${encodeURIComponent(n)}&tags=todo&title=%E2%9C%85%20`;window.location.href=o});const a=document.getElementById("sidebar"),n=document.getElementById("sidebar-overlay"),o=document.getElementById("mobile-menu-btn");function d(){return window.matchMedia("(max-width: 1100px)").matches}function s(){a&&n&&(a.classList.remove("show"),n.classList.remove("show"),o?.setAttribute("aria-expanded","false"),n.setAttribute("aria-hidden","true"),document.body.style.overflow="")}o?.addEventListener("click",function(){a?.classList.contains("show")?s():a&&n&&(a.classList.add("show"),n.classList.add("show"),o?.setAttribute("aria-expanded","true"),n.setAttribute("aria-hidden","false"),d()&&(document.body.style.overflow="hidden"))}),n?.addEventListener("click",s),a?.querySelectorAll("a").forEach(e=>{e.addEventListener("click",()=>{d()&&s()})}),window.addEventListener("resize",()=>{d()||s()})});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
!function(){"use strict";const e="shaarit_themes_config";function t(){try{const t=localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);return n&&"object"==typeof n?n:null}catch(e){return null}}window.ShaaritThemeConfig={save:function(n){const o=t()||{},r=Object.assign({version:2,themes:[],default:"DEFAULT",mode:"dark"},o,n||{}),a=function(t){try{return localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){return!1}}(r);return Promise.resolve({ok:a,config:r})},load:function(){return Promise.resolve(t())},findCandidates:function(){return Promise.resolve([])}}}(),document.addEventListener("DOMContentLoaded",()=>{"use strict";const e=document.getElementById("theme-toggle-checkbox"),t=document.getElementById("theme-icon-light"),n=document.querySelector(".theme-toggle-label span"),o=window.ShaarliProI18n||{t:function(e){return e}};function r(){const e=localStorage.getItem("shaarit_theme_id")||"DEFAULT";return-1!==["LINEAR","SPOTIFY","NOTION","DISCORD","DRACULA","ONE_DARK_PRO","TOKYO_NIGHT","NORD","NIGHT_OWL","ANTHRACITE","CYBERPUNK","NAVY_ELEGANCE","EARTHY"].indexOf(e)}function a(a){r()&&(a="dark"),document.documentElement.setAttribute("data-theme",a),localStorage.setItem("theme",a),e&&(e.checked="dark"===a,e.disabled=r(),e.closest(".theme-switch").style.opacity=e.disabled?"0.5":"1"),t&&(t.className="dark"===a?"mdi mdi-weather-night":"mdi mdi-weather-sunny"),n&&(n.textContent="dark"===a?o.t("Dark Mode"):o.t("Light Mode"))}window.addEventListener("themeChanged",()=>{a(localStorage.getItem("theme")||"dark")});a(localStorage.getItem("theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")),e&&e.addEventListener("change",()=>{if(r())return;const t=e.checked?"dark":"light";a(t),async function(e){try{if(!window.ShaaritThemeConfig)return;await window.ShaaritThemeConfig.save({mode:e})}catch(e){console.error("[shaarit] Failed to sync mode to bookmark",e)}}(t)})});
File diff suppressed because one or more lines are too long