Initial import of LogDarioSeq baseline

Establishes version control for the personal Logseq DB fork before
starting the server-client architecture migration and domain features
described in docs/agent-guide and the approved implementation plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 15:32:15 +02:00
commit 40631362b3
2016 changed files with 543898 additions and 0 deletions

1
resources/js/eventemitter3.umd.min.js vendored Normal file
View File

@@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).EventEmitter3=t()}(this,(function(){"use strict";var e={};return function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,i){if("function"!=typeof r)throw new TypeError("The listener must be a function");var c=new o(r,s||e,i),f=n?n+t:t;return e._events[f]?e._events[f].fn?e._events[f]=[e._events[f],c]:e._events[f].push(c):(e._events[f]=c,e._eventsCount++),e}function i(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function c(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),c.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},c.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,i=new Array(s);o<s;o++)i[o]=r[o].fn;return i},c.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},c.prototype.emit=function(e,t,r,o,s,i){var c=n?n+e:e;if(!this._events[c])return!1;var f,u,a=this._events[c],l=arguments.length;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),l){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,r),!0;case 4:return a.fn.call(a.context,t,r,o),!0;case 5:return a.fn.call(a.context,t,r,o,s),!0;case 6:return a.fn.call(a.context,t,r,o,s,i),!0}for(u=1,f=new Array(l-1);u<l;u++)f[u-1]=arguments[u];a.fn.apply(a.context,f)}else{var p,v=a.length;for(u=0;u<v;u++)switch(a[u].once&&this.removeListener(e,a[u].fn,void 0,!0),l){case 1:a[u].fn.call(a[u].context);break;case 2:a[u].fn.call(a[u].context,t);break;case 3:a[u].fn.call(a[u].context,t,r);break;case 4:a[u].fn.call(a[u].context,t,r,o);break;default:if(!f)for(p=1,f=new Array(l-1);p<l;p++)f[p-1]=arguments[p];a[u].fn.apply(a[u].context,f)}}return!0},c.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,r,o){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return i(this,s),this;var c=this._events[s];if(c.fn)c.fn!==t||o&&!c.once||r&&c.context!==r||i(this,s);else{for(var f=0,u=[],a=c.length;f<a;f++)(c[f].fn!==t||o&&!c[f].once||r&&c[f].context!==r)&&u.push(c[f]);u.length?this._events[s]=1===u.length?u[0]:u:i(this,s)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&i(this,t)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c}({get exports(){return e},set exports(t){e=t}}),e}));//# sourceMappingURL=eventemitter3.umd.min.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */

View File

@@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.MagicPortal=t()}(this,function(){var e=function(e){var t=this;this.rpc_counter=0,this.channel=e,this.foreign=new Map,this.local=new Map,this.calls=new Map,this.queue=[],this.connectionEstablished=!1,this.channel.addEventListener("message",function(e){var n=e.data;if(n&&"object"==typeof n)switch(n.type){case"MP_INIT":return t.onInit(n);case"MP_SET":return t.onSet(n);case"MP_CALL":return t.onCall(n);case"MP_RETURN":return t.onReturn(n)}}),this.channel.postMessage({type:"MP_INIT",id:1,reply:!0})};e.prototype.onInit=function(e){this.connectionEstablished=!0;var t=this.queue;this.queue=[];for(var n=0,o=t;n<o.length;n+=1){this.channel.postMessage(o[n])}e.reply&&this.channel.postMessage({type:"MP_INIT",reply:!1})},e.prototype.onSet=function(e){for(var t=this,n={},o=e.object,i=function(){var i=r[s],c=!e.void.includes(i);n[i]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return t.rpc_counter=(t.rpc_counter+1)%Number.MAX_SAFE_INTEGER,new Promise(function(n,s){t.postMessage({type:"MP_CALL",object:o,method:i,id:t.rpc_counter,args:e,reply:c}),c?t.calls.set(t.rpc_counter,{resolve:n,reject:s}):n()})}},s=0,r=e.methods;s<r.length;s+=1)i();var c=this.foreign.get(e.object);this.foreign.set(e.object,n),"function"==typeof c&&c(n)},e.prototype.onCall=function(e){var t=this,n=this.local.get(e.object);n&&n[e.method].apply(n,e.args).then(function(n){return e.reply&&t.channel.postMessage({type:"MP_RETURN",id:e.id,result:n})}).catch(function(n){return t.channel.postMessage({type:"MP_RETURN",id:e.id,error:n.message})})},e.prototype.onReturn=function(e){if(this.calls.has(e.id)){var t=this.calls.get(e.id),n=t.resolve,o=t.reject;this.calls.delete(e.id),e.error?o(e.error):n(e.result)}},e.prototype.postMessage=function(e){this.connectionEstablished?this.channel.postMessage(e):this.queue.push(e)},e.prototype.set=function(e,t,n){void 0===n&&(n={}),this.local.set(e,t);var o=Object.entries(t).filter(function(e){return"function"==typeof e[1]}).map(function(e){return e[0]});this.postMessage({type:"MP_SET",object:e,methods:o,void:n.void||[]})},e.prototype.get=function(e){return new Promise(function(t,n){var o=this;return this.foreign.has(e)?t(this.foreign.get(e)):t(new Promise(function(t,n){return o.foreign.set(e,t)}))}.bind(this))};return function(t){var n=new e(t);Object.defineProperties(this,{get:{writable:!1,configurable:!1,value:n.get.bind(n)},set:{writable:!1,configurable:!1,value:n.set.bind(n)}})}});

12391
resources/js/pdf_viewer3.mjs Normal file

File diff suppressed because one or more lines are too long

163
resources/js/preload.js Normal file
View File

@@ -0,0 +1,163 @@
const fs = require('fs')
const path = require('path')
const os = require('os')
const { ipcRenderer, contextBridge, shell, clipboard, webFrame, webUtils } = require('electron')
const IS_MAC = process.platform === 'darwin'
const IS_WIN32 = process.platform === 'win32'
const ALLOWED_EXTERNAL_PROTOCOLS = ['https:', 'http:', 'mailto:', 'zotero:', 'file:']
function getFilePathFromClipboard () {
if (IS_WIN32) {
const rawFilePath = clipboard.read('FileNameW')
return rawFilePath.replace(new RegExp(String.fromCharCode(0), 'g'), '')
} else if (IS_MAC) {
return clipboard.read('public.file-url').replace('file://', '')
} else {
return clipboard.readText()
}
}
/**
* Read the contents of the clipboard for a custom format.
* @param {string} format The custom format to read.
* @returns Buffer containing the contents of the clipboard for the specified format, or null if not available.
*/
function getClipboardData (format) {
if (clipboard.has(format, "clipboard")) {
return clipboard.readBuffer(format)
}
else {
return null;
}
}
contextBridge.exposeInMainWorld('apis', {
getFilePath: (file) => webUtils.getPathForFile(file),
doAction: async (arg) => {
return await ipcRenderer.invoke('main', arg)
},
invoke: async (channel, args) => {
return await ipcRenderer.invoke(channel, ...args)
},
addListener: ipcRenderer.on.bind(ipcRenderer),
removeListener: ipcRenderer.removeListener.bind(ipcRenderer),
removeAllListeners: ipcRenderer.removeAllListeners.bind(ipcRenderer),
on: (channel, callback) => {
const newCallback = (_, data) => callback(data)
ipcRenderer.on(channel, newCallback)
},
off: (channel, callback) => {
if (!callback) {
ipcRenderer.removeAllListeners(channel)
} else {
ipcRenderer.removeListener(channel, callback)
}
},
once: (channel, callback) => {
ipcRenderer.on(channel, callback)
},
checkForUpdates: async (...args) => {
await ipcRenderer.invoke('check-for-updates', ...args)
},
setUpdatesCallback (cb) {
if (typeof cb !== 'function') return
const channel = 'updates-callback'
ipcRenderer.removeAllListeners(channel)
ipcRenderer.on(channel, cb)
},
installUpdatesAndQuitApp () {
ipcRenderer.invoke('install-updates', true)
},
async openExternal (url, options) {
const protocol = new URL(url).protocol
if (!ALLOWED_EXTERNAL_PROTOCOLS.includes(protocol)) {
throw new Error('illegal protocol')
}
await shell.openExternal(url, options)
},
async openPath (relativePath) {
const absolutePath = path.resolve(
relativePath.startsWith('~') ? path.join(os.homedir(), relativePath.slice(1)) : relativePath
);
await shell.openPath(absolutePath)
},
/**
* save all publish assets to disk
*
* @param {string} html html file with embedded state
*/
exportPublishAssets (html, customCSSPath, exportCSSPath, repoPath, assetFilenames, outputDir) {
ipcRenderer.invoke(
'export-publish-assets',
html,
customCSSPath,
exportCSSPath,
repoPath,
assetFilenames,
outputDir
)
},
toggleMaxOrMinActiveWindow (isToggleMin = false) {
ipcRenderer.invoke('toggle-max-or-min-active-win', isToggleMin)
},
/**
* internal
* @param type
* @param args
* @private
*/
async _callApplication (type, ...args) {
return await ipcRenderer.invoke('call-application', type, ...args)
},
/**
* internal
* @param type
* @param args
* @private
*/
async _callMainWin (type, ...args) {
return await ipcRenderer.invoke('call-main-win', type, ...args)
},
/**
* Write binary data to a file, creating parent dirs as needed.
* Used for asset files that can't be transit-serialized through doAction.
*/
writeFileBytes (filePath, data) {
const dir = path.dirname(filePath)
fs.mkdirSync(dir, { recursive: true })
fs.writeFileSync(filePath, Buffer.from(data))
},
getFilePathFromClipboard,
getClipboardData,
setZoomFactor (factor) {
webFrame.setZoomFactor(factor)
},
setZoomLevel (level) {
webFrame.setZoomLevel(level)
},
isAbsolutePath: path.isAbsolute.bind(path)
})

File diff suppressed because one or more lines are too long

56
resources/js/worker.js Normal file
View File

@@ -0,0 +1,56 @@
importScripts(
// Batched optimization
"./lightning-fs.min.js",
// Fixed a bug
"./magic_portal.js"
);
const detect = () => {
if (typeof window !== 'undefined' && !self.skipWaiting) {
return 'window'
} else if (typeof self !== 'undefined' && !self.skipWaiting) {
return 'Worker'
} else if (typeof self !== 'undefined' && self.skipWaiting) {
return 'ServiceWorker'
}
};
const fsName = 'logseq';
const createFS = () => new LightningFS(fsName);
let fs = createFS();
let pfs = fs.promises;
if (typeof self !== 'undefined') {
self.fs = fs;
self.pfs = pfs;
}
if (detect() === 'Worker') {
const portal = new MagicPortal(self);
portal.set('fs', fs);
portal.set('pfs', pfs);
portal.set('workerThread', {
rimraf: async function (path) {
// Knowing path is a directory,
// first, assume everything inside path is a file.
let files = await pfs.readdir(path);
for (let file of files) {
let child = path + '/' + file
try {
await pfs.unlink(child)
} catch (err) {
if (err.code !== 'EISDIR') throw err
}
}
// Assume what's left are directories and recurse.
let dirs = await pfs.readdir(path)
for (let dir of dirs) {
let child = path + '/' + dir
await rimraf(child, pfs)
}
// Finally, delete the empty directory
await pfs.rmdir(path)
}
});
}