Add supporting themes required for Lotusdocs
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import persist from '../src/index.js'
|
||||
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(persist)
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
import persist from '../src/index.js'
|
||||
|
||||
export default persist
|
||||
|
||||
export { persist }
|
||||
67
themes/hugo-mod-jslibs-dist/alpinejs/packages/persist/dist/cdn.js
vendored
Normal file
67
themes/hugo-mod-jslibs-dist/alpinejs/packages/persist/dist/cdn.js
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
(() => {
|
||||
// packages/persist/src/index.js
|
||||
function src_default(Alpine) {
|
||||
let persist = () => {
|
||||
let alias;
|
||||
let storage;
|
||||
try {
|
||||
storage = localStorage;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable.");
|
||||
let dummy = /* @__PURE__ */ new Map();
|
||||
storage = {
|
||||
getItem: dummy.get.bind(dummy),
|
||||
setItem: dummy.set.bind(dummy)
|
||||
};
|
||||
}
|
||||
return Alpine.interceptor((initialValue, getter, setter, path, key) => {
|
||||
let lookup = alias || `_x_${path}`;
|
||||
let initial = storageHas(lookup, storage) ? storageGet(lookup, storage) : initialValue;
|
||||
setter(initial);
|
||||
Alpine.effect(() => {
|
||||
let value = getter();
|
||||
storageSet(lookup, value, storage);
|
||||
setter(value);
|
||||
});
|
||||
return initial;
|
||||
}, (func) => {
|
||||
func.as = (key) => {
|
||||
alias = key;
|
||||
return func;
|
||||
}, func.using = (target) => {
|
||||
storage = target;
|
||||
return func;
|
||||
};
|
||||
});
|
||||
};
|
||||
Object.defineProperty(Alpine, "$persist", { get: () => persist() });
|
||||
Alpine.magic("persist", persist);
|
||||
Alpine.persist = (key, { get, set }, storage = localStorage) => {
|
||||
let initial = storageHas(key, storage) ? storageGet(key, storage) : get();
|
||||
set(initial);
|
||||
Alpine.effect(() => {
|
||||
let value = get();
|
||||
storageSet(key, value, storage);
|
||||
set(value);
|
||||
});
|
||||
};
|
||||
}
|
||||
function storageHas(key, storage) {
|
||||
return storage.getItem(key) !== null;
|
||||
}
|
||||
function storageGet(key, storage) {
|
||||
let value = storage.getItem(key, storage);
|
||||
if (value === void 0)
|
||||
return;
|
||||
return JSON.parse(value);
|
||||
}
|
||||
function storageSet(key, value, storage) {
|
||||
storage.setItem(key, JSON.stringify(value));
|
||||
}
|
||||
|
||||
// packages/persist/builds/cdn.js
|
||||
document.addEventListener("alpine:init", () => {
|
||||
window.Alpine.plugin(src_default);
|
||||
});
|
||||
})();
|
||||
1
themes/hugo-mod-jslibs-dist/alpinejs/packages/persist/dist/cdn.min.js
vendored
Normal file
1
themes/hugo-mod-jslibs-dist/alpinejs/packages/persist/dist/cdn.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(()=>{function d(t){let n=()=>{let r,a;try{a=localStorage}catch(i){console.error(i),console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable.");let e=new Map;a={getItem:e.get.bind(e),setItem:e.set.bind(e)}}return t.interceptor((i,e,l,s,f)=>{let o=r||`_x_${s}`,u=g(o,a)?p(o,a):i;return l(u),t.effect(()=>{let c=e();m(o,c,a),l(c)}),u},i=>{i.as=e=>(r=e,i),i.using=e=>(a=e,i)})};Object.defineProperty(t,"$persist",{get:()=>n()}),t.magic("persist",n),t.persist=(r,{get:a,set:i},e=localStorage)=>{let l=g(r,e)?p(r,e):a();i(l),t.effect(()=>{let s=a();m(r,s,e),i(s)})}}function g(t,n){return n.getItem(t)!==null}function p(t,n){let r=n.getItem(t,n);if(r!==void 0)return JSON.parse(r)}function m(t,n,r){r.setItem(t,JSON.stringify(n))}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(d)});})();
|
||||
93
themes/hugo-mod-jslibs-dist/alpinejs/packages/persist/dist/module.cjs.js
vendored
Normal file
93
themes/hugo-mod-jslibs-dist/alpinejs/packages/persist/dist/module.cjs.js
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// packages/persist/builds/module.js
|
||||
var module_exports = {};
|
||||
__export(module_exports, {
|
||||
default: () => module_default,
|
||||
persist: () => src_default
|
||||
});
|
||||
module.exports = __toCommonJS(module_exports);
|
||||
|
||||
// packages/persist/src/index.js
|
||||
function src_default(Alpine) {
|
||||
let persist = () => {
|
||||
let alias;
|
||||
let storage;
|
||||
try {
|
||||
storage = localStorage;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable.");
|
||||
let dummy = /* @__PURE__ */ new Map();
|
||||
storage = {
|
||||
getItem: dummy.get.bind(dummy),
|
||||
setItem: dummy.set.bind(dummy)
|
||||
};
|
||||
}
|
||||
return Alpine.interceptor((initialValue, getter, setter, path, key) => {
|
||||
let lookup = alias || `_x_${path}`;
|
||||
let initial = storageHas(lookup, storage) ? storageGet(lookup, storage) : initialValue;
|
||||
setter(initial);
|
||||
Alpine.effect(() => {
|
||||
let value = getter();
|
||||
storageSet(lookup, value, storage);
|
||||
setter(value);
|
||||
});
|
||||
return initial;
|
||||
}, (func) => {
|
||||
func.as = (key) => {
|
||||
alias = key;
|
||||
return func;
|
||||
}, func.using = (target) => {
|
||||
storage = target;
|
||||
return func;
|
||||
};
|
||||
});
|
||||
};
|
||||
Object.defineProperty(Alpine, "$persist", { get: () => persist() });
|
||||
Alpine.magic("persist", persist);
|
||||
Alpine.persist = (key, { get, set }, storage = localStorage) => {
|
||||
let initial = storageHas(key, storage) ? storageGet(key, storage) : get();
|
||||
set(initial);
|
||||
Alpine.effect(() => {
|
||||
let value = get();
|
||||
storageSet(key, value, storage);
|
||||
set(value);
|
||||
});
|
||||
};
|
||||
}
|
||||
function storageHas(key, storage) {
|
||||
return storage.getItem(key) !== null;
|
||||
}
|
||||
function storageGet(key, storage) {
|
||||
let value = storage.getItem(key, storage);
|
||||
if (value === void 0)
|
||||
return;
|
||||
return JSON.parse(value);
|
||||
}
|
||||
function storageSet(key, value, storage) {
|
||||
storage.setItem(key, JSON.stringify(value));
|
||||
}
|
||||
|
||||
// packages/persist/builds/module.js
|
||||
var module_default = src_default;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
persist
|
||||
});
|
||||
67
themes/hugo-mod-jslibs-dist/alpinejs/packages/persist/dist/module.esm.js
vendored
Normal file
67
themes/hugo-mod-jslibs-dist/alpinejs/packages/persist/dist/module.esm.js
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
// packages/persist/src/index.js
|
||||
function src_default(Alpine) {
|
||||
let persist = () => {
|
||||
let alias;
|
||||
let storage;
|
||||
try {
|
||||
storage = localStorage;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable.");
|
||||
let dummy = /* @__PURE__ */ new Map();
|
||||
storage = {
|
||||
getItem: dummy.get.bind(dummy),
|
||||
setItem: dummy.set.bind(dummy)
|
||||
};
|
||||
}
|
||||
return Alpine.interceptor((initialValue, getter, setter, path, key) => {
|
||||
let lookup = alias || `_x_${path}`;
|
||||
let initial = storageHas(lookup, storage) ? storageGet(lookup, storage) : initialValue;
|
||||
setter(initial);
|
||||
Alpine.effect(() => {
|
||||
let value = getter();
|
||||
storageSet(lookup, value, storage);
|
||||
setter(value);
|
||||
});
|
||||
return initial;
|
||||
}, (func) => {
|
||||
func.as = (key) => {
|
||||
alias = key;
|
||||
return func;
|
||||
}, func.using = (target) => {
|
||||
storage = target;
|
||||
return func;
|
||||
};
|
||||
});
|
||||
};
|
||||
Object.defineProperty(Alpine, "$persist", { get: () => persist() });
|
||||
Alpine.magic("persist", persist);
|
||||
Alpine.persist = (key, { get, set }, storage = localStorage) => {
|
||||
let initial = storageHas(key, storage) ? storageGet(key, storage) : get();
|
||||
set(initial);
|
||||
Alpine.effect(() => {
|
||||
let value = get();
|
||||
storageSet(key, value, storage);
|
||||
set(value);
|
||||
});
|
||||
};
|
||||
}
|
||||
function storageHas(key, storage) {
|
||||
return storage.getItem(key) !== null;
|
||||
}
|
||||
function storageGet(key, storage) {
|
||||
let value = storage.getItem(key, storage);
|
||||
if (value === void 0)
|
||||
return;
|
||||
return JSON.parse(value);
|
||||
}
|
||||
function storageSet(key, value, storage) {
|
||||
storage.setItem(key, JSON.stringify(value));
|
||||
}
|
||||
|
||||
// packages/persist/builds/module.js
|
||||
var module_default = src_default;
|
||||
export {
|
||||
module_default as default,
|
||||
src_default as persist
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@alpinejs/persist",
|
||||
"version": "3.13.8",
|
||||
"description": "Persist Alpine data across page loads",
|
||||
"homepage": "https://alpinejs.dev/plugins/persist",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alpinejs/alpine.git",
|
||||
"directory": "packages/persist"
|
||||
},
|
||||
"author": "Caleb Porzio",
|
||||
"license": "MIT",
|
||||
"main": "dist/module.cjs.js",
|
||||
"module": "dist/module.esm.js",
|
||||
"unpkg": "dist/cdn.min.js",
|
||||
"dependencies": {}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
export default function (Alpine) {
|
||||
let persist = () => {
|
||||
let alias
|
||||
let storage
|
||||
|
||||
try {
|
||||
storage = localStorage
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
console.warn('Alpine: $persist is using temporary storage since localStorage is unavailable.')
|
||||
|
||||
let dummy = new Map();
|
||||
|
||||
storage = {
|
||||
getItem: dummy.get.bind(dummy),
|
||||
setItem: dummy.set.bind(dummy)
|
||||
}
|
||||
}
|
||||
|
||||
return Alpine.interceptor((initialValue, getter, setter, path, key) => {
|
||||
let lookup = alias || `_x_${path}`
|
||||
|
||||
let initial = storageHas(lookup, storage)
|
||||
? storageGet(lookup, storage)
|
||||
: initialValue
|
||||
|
||||
setter(initial)
|
||||
|
||||
Alpine.effect(() => {
|
||||
let value = getter()
|
||||
|
||||
storageSet(lookup, value, storage)
|
||||
|
||||
setter(value)
|
||||
})
|
||||
|
||||
return initial
|
||||
}, func => {
|
||||
func.as = key => { alias = key; return func },
|
||||
func.using = target => { storage = target; return func }
|
||||
})
|
||||
}
|
||||
|
||||
Object.defineProperty(Alpine, '$persist', { get: () => persist() })
|
||||
Alpine.magic('persist', persist)
|
||||
Alpine.persist = (key, { get, set }, storage = localStorage) => {
|
||||
let initial = storageHas(key, storage)
|
||||
? storageGet(key, storage)
|
||||
: get()
|
||||
|
||||
set(initial)
|
||||
|
||||
Alpine.effect(() => {
|
||||
let value = get()
|
||||
|
||||
storageSet(key, value, storage)
|
||||
|
||||
set(value)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function storageHas(key, storage) {
|
||||
return storage.getItem(key) !== null
|
||||
}
|
||||
|
||||
function storageGet(key, storage) {
|
||||
let value = storage.getItem(key, storage)
|
||||
|
||||
if (value === undefined) return
|
||||
|
||||
return JSON.parse(value)
|
||||
}
|
||||
|
||||
function storageSet(key, value, storage) {
|
||||
storage.setItem(key, JSON.stringify(value))
|
||||
}
|
||||
Reference in New Issue
Block a user