Add supporting themes required for Lotusdocs
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import history from '../src/index.js'
|
||||
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(history)
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
import history from '../src/index.js'
|
||||
import { track } from '../src/index.js'
|
||||
|
||||
export default history
|
||||
|
||||
export { history, track }
|
||||
67
themes/hugo-mod-jslibs-dist/alpinejs/packages/history/dist/cdn.js
vendored
Normal file
67
themes/hugo-mod-jslibs-dist/alpinejs/packages/history/dist/cdn.js
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
(() => {
|
||||
// packages/history/src/index.js
|
||||
function history(Alpine) {
|
||||
Alpine.magic("queryString", (el, {interceptor}) => {
|
||||
let alias;
|
||||
return interceptor((initialValue, getter, setter, path, key) => {
|
||||
let pause = false;
|
||||
let queryKey = alias || path;
|
||||
let value = initialValue;
|
||||
let url = new URL(window.location.href);
|
||||
if (url.searchParams.has(queryKey)) {
|
||||
value = url.searchParams.get(queryKey);
|
||||
}
|
||||
setter(value);
|
||||
let object = {value};
|
||||
url.searchParams.set(queryKey, value);
|
||||
replace(url.toString(), path, object);
|
||||
window.addEventListener("popstate", (e) => {
|
||||
if (!e.state)
|
||||
return;
|
||||
if (!e.state.alpine)
|
||||
return;
|
||||
Object.entries(e.state.alpine).forEach(([newKey, {value: value2}]) => {
|
||||
if (newKey !== key)
|
||||
return;
|
||||
pause = true;
|
||||
Alpine.disableEffectScheduling(() => {
|
||||
setter(value2);
|
||||
});
|
||||
pause = false;
|
||||
});
|
||||
});
|
||||
Alpine.effect(() => {
|
||||
let value2 = getter();
|
||||
if (pause)
|
||||
return;
|
||||
let object2 = {value: value2};
|
||||
let url2 = new URL(window.location.href);
|
||||
url2.searchParams.set(queryKey, value2);
|
||||
push(url2.toString(), path, object2);
|
||||
});
|
||||
return value;
|
||||
}, (func) => {
|
||||
func.as = (key) => {
|
||||
alias = key;
|
||||
return func;
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
function replace(url, key, object) {
|
||||
let state = window.history.state || {};
|
||||
if (!state.alpine)
|
||||
state.alpine = {};
|
||||
state.alpine[key] = object;
|
||||
window.history.replaceState(state, "", url);
|
||||
}
|
||||
function push(url, key, object) {
|
||||
let state = {alpine: {...window.history.state.alpine, ...{[key]: object}}};
|
||||
window.history.pushState(state, "", url);
|
||||
}
|
||||
|
||||
// packages/history/builds/cdn.js
|
||||
document.addEventListener("alpine:init", () => {
|
||||
window.Alpine.plugin(history);
|
||||
});
|
||||
})();
|
||||
1
themes/hugo-mod-jslibs-dist/alpinejs/packages/history/dist/cdn.min.js
vendored
Normal file
1
themes/hugo-mod-jslibs-dist/alpinejs/packages/history/dist/cdn.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(()=>{function h(t){t.magic("queryString",(n,{interceptor:i})=>{let e;return i((s,c,p,f,y)=>{let w=!1,l=e||f,r=s,o=new URL(window.location.href);o.searchParams.has(l)&&(r=o.searchParams.get(l)),p(r);let m={value:r};return o.searchParams.set(l,r),g(o.toString(),f,m),window.addEventListener("popstate",a=>{!a.state||!a.state.alpine||Object.entries(a.state.alpine).forEach(([d,{value:u}])=>{d===y&&(w=!0,t.disableEffectScheduling(()=>{p(u)}),w=!1)})}),t.effect(()=>{let a=c();if(w)return;let d={value:a},u=new URL(window.location.href);u.searchParams.set(l,a),S(u.toString(),f,d)}),r},s=>{s.as=c=>(e=c,s)})})}function g(t,n,i){let e=window.history.state||{};e.alpine||(e.alpine={}),e.alpine[n]=i,window.history.replaceState(e,"",t)}function S(t,n,i){let e={alpine:{...window.history.state.alpine,[n]:i}};window.history.pushState(e,"",t)}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(h)});})();
|
||||
76
themes/hugo-mod-jslibs-dist/alpinejs/packages/history/dist/module.cjs.js
vendored
Normal file
76
themes/hugo-mod-jslibs-dist/alpinejs/packages/history/dist/module.cjs.js
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, {get: all[name], enumerable: true});
|
||||
};
|
||||
|
||||
// packages/history/builds/module.js
|
||||
__markAsModule(exports);
|
||||
__export(exports, {
|
||||
default: () => module_default
|
||||
});
|
||||
|
||||
// packages/history/src/index.js
|
||||
function history(Alpine) {
|
||||
Alpine.magic("queryString", (el, {interceptor}) => {
|
||||
let alias;
|
||||
return interceptor((initialValue, getter, setter, path, key) => {
|
||||
let pause = false;
|
||||
let queryKey = alias || path;
|
||||
let value = initialValue;
|
||||
let url = new URL(window.location.href);
|
||||
if (url.searchParams.has(queryKey)) {
|
||||
value = url.searchParams.get(queryKey);
|
||||
}
|
||||
setter(value);
|
||||
let object = {value};
|
||||
url.searchParams.set(queryKey, value);
|
||||
replace(url.toString(), path, object);
|
||||
window.addEventListener("popstate", (e) => {
|
||||
if (!e.state)
|
||||
return;
|
||||
if (!e.state.alpine)
|
||||
return;
|
||||
Object.entries(e.state.alpine).forEach(([newKey, {value: value2}]) => {
|
||||
if (newKey !== key)
|
||||
return;
|
||||
pause = true;
|
||||
Alpine.disableEffectScheduling(() => {
|
||||
setter(value2);
|
||||
});
|
||||
pause = false;
|
||||
});
|
||||
});
|
||||
Alpine.effect(() => {
|
||||
let value2 = getter();
|
||||
if (pause)
|
||||
return;
|
||||
let object2 = {value: value2};
|
||||
let url2 = new URL(window.location.href);
|
||||
url2.searchParams.set(queryKey, value2);
|
||||
push(url2.toString(), path, object2);
|
||||
});
|
||||
return value;
|
||||
}, (func) => {
|
||||
func.as = (key) => {
|
||||
alias = key;
|
||||
return func;
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
function replace(url, key, object) {
|
||||
let state = window.history.state || {};
|
||||
if (!state.alpine)
|
||||
state.alpine = {};
|
||||
state.alpine[key] = object;
|
||||
window.history.replaceState(state, "", url);
|
||||
}
|
||||
function push(url, key, object) {
|
||||
let state = {alpine: {...window.history.state.alpine, ...{[key]: object}}};
|
||||
window.history.pushState(state, "", url);
|
||||
}
|
||||
|
||||
// packages/history/builds/module.js
|
||||
var module_default = history;
|
||||
66
themes/hugo-mod-jslibs-dist/alpinejs/packages/history/dist/module.esm.js
vendored
Normal file
66
themes/hugo-mod-jslibs-dist/alpinejs/packages/history/dist/module.esm.js
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
// packages/history/src/index.js
|
||||
function history(Alpine) {
|
||||
Alpine.magic("queryString", (el, {interceptor}) => {
|
||||
let alias;
|
||||
return interceptor((initialValue, getter, setter, path, key) => {
|
||||
let pause = false;
|
||||
let queryKey = alias || path;
|
||||
let value = initialValue;
|
||||
let url = new URL(window.location.href);
|
||||
if (url.searchParams.has(queryKey)) {
|
||||
value = url.searchParams.get(queryKey);
|
||||
}
|
||||
setter(value);
|
||||
let object = {value};
|
||||
url.searchParams.set(queryKey, value);
|
||||
replace(url.toString(), path, object);
|
||||
window.addEventListener("popstate", (e) => {
|
||||
if (!e.state)
|
||||
return;
|
||||
if (!e.state.alpine)
|
||||
return;
|
||||
Object.entries(e.state.alpine).forEach(([newKey, {value: value2}]) => {
|
||||
if (newKey !== key)
|
||||
return;
|
||||
pause = true;
|
||||
Alpine.disableEffectScheduling(() => {
|
||||
setter(value2);
|
||||
});
|
||||
pause = false;
|
||||
});
|
||||
});
|
||||
Alpine.effect(() => {
|
||||
let value2 = getter();
|
||||
if (pause)
|
||||
return;
|
||||
let object2 = {value: value2};
|
||||
let url2 = new URL(window.location.href);
|
||||
url2.searchParams.set(queryKey, value2);
|
||||
push(url2.toString(), path, object2);
|
||||
});
|
||||
return value;
|
||||
}, (func) => {
|
||||
func.as = (key) => {
|
||||
alias = key;
|
||||
return func;
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
function replace(url, key, object) {
|
||||
let state = window.history.state || {};
|
||||
if (!state.alpine)
|
||||
state.alpine = {};
|
||||
state.alpine[key] = object;
|
||||
window.history.replaceState(state, "", url);
|
||||
}
|
||||
function push(url, key, object) {
|
||||
let state = {alpine: {...window.history.state.alpine, ...{[key]: object}}};
|
||||
window.history.pushState(state, "", url);
|
||||
}
|
||||
|
||||
// packages/history/builds/module.js
|
||||
var module_default = history;
|
||||
export {
|
||||
module_default as default
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@alpinejs/history",
|
||||
"version": "3.0.0-alpha.0",
|
||||
"description": "Sync Alpine data with the browser's query string",
|
||||
"homepage": "https://alpinejs.dev/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alpinejs/alpine.git",
|
||||
"directory": "packages/history"
|
||||
},
|
||||
"author": "Caleb Porzio",
|
||||
"license": "MIT",
|
||||
"main": "dist/module.cjs.js",
|
||||
"module": "dist/module.esm.js",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "^3.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
// This plugin has been moved into the livewire/livewire repository until it's more stable and ready to tag.
|
||||
Reference in New Issue
Block a user