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:
38
libs/cljs-sdk/.gitignore
vendored
Normal file
38
libs/cljs-sdk/.gitignore
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Clojure/Leiningen
|
||||
pom.xml
|
||||
pom.xml.asc
|
||||
*.jar
|
||||
*.class
|
||||
/lib/
|
||||
/classes/
|
||||
/target/
|
||||
/checkouts/
|
||||
.lein-deps-sum
|
||||
.lein-repl-history
|
||||
.lein-plugins/
|
||||
.lein-failures
|
||||
.nrepl-port
|
||||
|
||||
# ClojureScript/Build
|
||||
.cpcache/
|
||||
.shadow-cljs/
|
||||
dist/
|
||||
out/
|
||||
|
||||
# Node.js
|
||||
node_modules/
|
||||
package-lock.json
|
||||
coverage/
|
||||
.nyc_output/
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
.calva/
|
||||
.calva/output-window
|
||||
.lsp/
|
||||
.clj-kondo/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
*.log
|
||||
21
libs/cljs-sdk/LICENSE
Normal file
21
libs/cljs-sdk/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Logseq
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
31
libs/cljs-sdk/bb.edn
Normal file
31
libs/cljs-sdk/bb.edn
Normal file
@@ -0,0 +1,31 @@
|
||||
{:paths ["src" "test"]
|
||||
:deps {org.babashka/cli {:mvn/version "0.8.67"}
|
||||
slipset/deps-deploy {:mvn/version "0.2.2"}}
|
||||
:tasks
|
||||
{:requires ([babashka.cli :as cli])
|
||||
:init (do
|
||||
(defn run [cmd]
|
||||
(let [result (shell cmd)]
|
||||
(when-not (zero? (:exit result))
|
||||
(throw (ex-info "Command failed" result))))))
|
||||
|
||||
clean {:doc "Clean compiled files"
|
||||
:task (do
|
||||
(run "rm -rf dist")
|
||||
(run "rm -rf .shadow-cljs")
|
||||
(run "rm -rf node_modules")
|
||||
(run "rm -rf out")
|
||||
(run "rm -rf .nyc_output")
|
||||
(run "rm -rf coverage"))}
|
||||
|
||||
install {:doc "Install dependencies"
|
||||
:task (run "pnpm install")}
|
||||
|
||||
build-jar {:doc "Build jar file"
|
||||
:task (shell "clojure -T:build jar")}
|
||||
|
||||
deploy {:doc "Deploy jar to Clojars"
|
||||
:task (shell "clojure -T:build deploy")}
|
||||
|
||||
release {:doc "Build release version and deploy to Clojars"
|
||||
:depends [clean install build-jar deploy]}}}
|
||||
46
libs/cljs-sdk/build.clj
Normal file
46
libs/cljs-sdk/build.clj
Normal file
@@ -0,0 +1,46 @@
|
||||
(ns build
|
||||
(:require [clojure.data.json :as json]
|
||||
[clojure.tools.build.api :as b]
|
||||
[deps-deploy.deps-deploy :as dd]))
|
||||
|
||||
(def lib 'com.logseq/libs)
|
||||
(def version
|
||||
(-> (slurp "package.json")
|
||||
(json/read-str :key-fn keyword)
|
||||
:version))
|
||||
(def class-dir "target/classes")
|
||||
(def basis (delay (b/create-basis {:project "deps.edn"})))
|
||||
(def jar-file (format "target/%s-%s.jar" (name lib) version))
|
||||
|
||||
(def pom-template
|
||||
[[:description "ClojureScript wrapper for @logseq/libs"]
|
||||
[:url "https://github.com/logseq/logseq"]
|
||||
[:licenses
|
||||
[:license
|
||||
[:name "MIT License"]
|
||||
[:url "https://opensource.org/licenses/MIT"]]]])
|
||||
|
||||
(def options
|
||||
{:class-dir class-dir
|
||||
:lib lib
|
||||
:version version
|
||||
:basis @basis
|
||||
:jar-file jar-file
|
||||
:src-dirs ["src"]
|
||||
:pom-data pom-template})
|
||||
|
||||
(defn clean [_]
|
||||
(b/delete {:path "target"}))
|
||||
|
||||
(defn jar [_]
|
||||
(clean nil)
|
||||
(b/write-pom options)
|
||||
(b/copy-dir {:src-dirs (:paths @basis)
|
||||
:target-dir class-dir})
|
||||
(b/jar options))
|
||||
|
||||
(defn deploy [_]
|
||||
(jar nil)
|
||||
(dd/deploy {:installer :remote
|
||||
:artifact jar-file
|
||||
:pom-file (b/pom-path {:lib lib :class-dir class-dir})}))
|
||||
20
libs/cljs-sdk/deps.edn
Normal file
20
libs/cljs-sdk/deps.edn
Normal file
@@ -0,0 +1,20 @@
|
||||
{:paths ["src" "test"]
|
||||
:deps {org.clojure/clojurescript {:mvn/version "1.12.134"}
|
||||
cljs-bean/cljs-bean {:mvn/version "1.9.0"}}
|
||||
|
||||
:npm-deps {"@logseq/libs" "0.2.3"}
|
||||
|
||||
:aliases
|
||||
{:dev
|
||||
{:extra-paths ["example"]}
|
||||
|
||||
:test
|
||||
{:extra-paths ["test"]
|
||||
:extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}}
|
||||
:ns-default build}
|
||||
|
||||
:build
|
||||
{:deps {io.github.clojure/tools.build {:mvn/version "0.9.6"}
|
||||
slipset/deps-deploy {:mvn/version "0.2.1"}
|
||||
org.clojure/data.json {:mvn/version "2.4.0"}}
|
||||
:ns-default build}}}
|
||||
28
libs/cljs-sdk/package.json
Normal file
28
libs/cljs-sdk/package.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "@logseq/cljs-libs",
|
||||
"version": "0.0.12",
|
||||
"packageManager": "pnpm@10.33.0",
|
||||
"description": "Logseq plugin API wrapper",
|
||||
"dependencies": {
|
||||
"@logseq/libs": "0.3.2"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/logseq/logseq.git"
|
||||
},
|
||||
"keywords": [
|
||||
"logseq",
|
||||
"clojurescript",
|
||||
"plugin",
|
||||
"@logseq/libs"
|
||||
],
|
||||
"author": "logseq",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/logseq/logseq/issues"
|
||||
},
|
||||
"homepage": "https://github.com/logseq/logseq#readme"
|
||||
}
|
||||
122
libs/cljs-sdk/pnpm-lock.yaml
generated
Normal file
122
libs/cljs-sdk/pnpm-lock.yaml
generated
Normal file
@@ -0,0 +1,122 @@
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@logseq/libs':
|
||||
specifier: 0.3.2
|
||||
version: 0.3.2
|
||||
|
||||
packages:
|
||||
|
||||
'@logseq/libs@0.3.2':
|
||||
resolution: {integrity: sha512-U0nMvmhR7gAL7Ph2AYw6sHCYyJvJDptebqIxPIzHNTvXDWsNeSo8ZyO9QiCGMAaWxj2rHikvx2lqt/Ialc6tBw==}
|
||||
|
||||
'@types/trusted-types@2.0.7':
|
||||
resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
|
||||
|
||||
change-case@5.4.4:
|
||||
resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==}
|
||||
|
||||
csstype@3.2.3:
|
||||
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
|
||||
|
||||
debug@4.4.3:
|
||||
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
|
||||
engines: {node: '>=6.0'}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
|
||||
deepmerge@4.3.1:
|
||||
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
dompurify@3.3.3:
|
||||
resolution: {integrity: sha512-Oj6pzI2+RqBfFG+qOaOLbFXLQ90ARpcGG6UePL82bJLtdsa6CYJD7nmiU8MW9nQNOtCHV3lZ/Bzq1X0QYbBZCA==}
|
||||
|
||||
eventemitter3@5.0.4:
|
||||
resolution: {integrity: sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==}
|
||||
|
||||
fast-deep-equal@3.1.3:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
|
||||
inherits@2.0.3:
|
||||
resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==}
|
||||
|
||||
lodash-es@4.17.23:
|
||||
resolution: {integrity: sha512-kVI48u3PZr38HdYz98UmfPnXl2DXrpdctLrFLCd3kOx1xUkOmpFPx7gCWWM5MPkL/fD8zb+Ph0QzjGFs4+hHWg==}
|
||||
|
||||
ms@2.1.3:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
|
||||
path@0.12.7:
|
||||
resolution: {integrity: sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==}
|
||||
|
||||
process@0.11.10:
|
||||
resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
|
||||
engines: {node: '>= 0.6.0'}
|
||||
|
||||
util@0.10.4:
|
||||
resolution: {integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==}
|
||||
|
||||
snapshots:
|
||||
|
||||
'@logseq/libs@0.3.2':
|
||||
dependencies:
|
||||
change-case: 5.4.4
|
||||
csstype: 3.2.3
|
||||
debug: 4.4.3
|
||||
deepmerge: 4.3.1
|
||||
dompurify: 3.3.3
|
||||
eventemitter3: 5.0.4
|
||||
fast-deep-equal: 3.1.3
|
||||
lodash-es: 4.17.23
|
||||
path: 0.12.7
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@types/trusted-types@2.0.7':
|
||||
optional: true
|
||||
|
||||
change-case@5.4.4: {}
|
||||
|
||||
csstype@3.2.3: {}
|
||||
|
||||
debug@4.4.3:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
deepmerge@4.3.1: {}
|
||||
|
||||
dompurify@3.3.3:
|
||||
optionalDependencies:
|
||||
'@types/trusted-types': 2.0.7
|
||||
|
||||
eventemitter3@5.0.4: {}
|
||||
|
||||
fast-deep-equal@3.1.3: {}
|
||||
|
||||
inherits@2.0.3: {}
|
||||
|
||||
lodash-es@4.17.23: {}
|
||||
|
||||
ms@2.1.3: {}
|
||||
|
||||
path@0.12.7:
|
||||
dependencies:
|
||||
process: 0.11.10
|
||||
util: 0.10.4
|
||||
|
||||
process@0.11.10: {}
|
||||
|
||||
util@0.10.4:
|
||||
dependencies:
|
||||
inherits: 2.0.3
|
||||
354
libs/cljs-sdk/src/com/logseq/app.cljs
Normal file
354
libs/cljs-sdk/src/com/logseq/app.cljs
Normal file
@@ -0,0 +1,354 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.app
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "App"))
|
||||
|
||||
(defn- get-info-impl
|
||||
[key]
|
||||
(let [method (aget api-proxy "getInfo")
|
||||
args [key]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-info
|
||||
([]
|
||||
(get-info-impl nil))
|
||||
([key]
|
||||
(get-info-impl key)))
|
||||
|
||||
(defn get-user-info
|
||||
[]
|
||||
(let [method (aget api-proxy "getUserInfo")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-user-configs
|
||||
[]
|
||||
(let [method (aget api-proxy "getUserConfigs")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-search-service
|
||||
[s]
|
||||
(let [method (aget api-proxy "registerSearchService")
|
||||
args [s]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-command
|
||||
[type opts action]
|
||||
(let [method (aget api-proxy "registerCommand")
|
||||
args [type opts action]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-command-palette
|
||||
[opts action]
|
||||
(let [method (aget api-proxy "registerCommandPalette")
|
||||
args [opts action]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- register-command-shortcut-impl
|
||||
[keybinding action opts]
|
||||
(let [method (aget api-proxy "registerCommandShortcut")
|
||||
args [keybinding action opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-command-shortcut
|
||||
"Supported key names"
|
||||
([keybinding action]
|
||||
(register-command-shortcut-impl keybinding action nil))
|
||||
([keybinding action opts]
|
||||
(register-command-shortcut-impl keybinding action opts)))
|
||||
|
||||
(defn invoke-external-command
|
||||
"Supported all registered palette commands"
|
||||
[type & args]
|
||||
(let [method (aget api-proxy "invokeExternalCommand")
|
||||
rest-args (vec args)
|
||||
args (into [type] rest-args)]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn invoke-external-plugin
|
||||
"Call external plugin command provided by models or registered commands"
|
||||
[type & args]
|
||||
(let [method (aget api-proxy "invokeExternalPlugin")
|
||||
rest-args (vec args)
|
||||
args (into [type] rest-args)]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-external-plugin
|
||||
[pid]
|
||||
(let [method (aget api-proxy "getExternalPlugin")
|
||||
args [pid]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-state-from-store
|
||||
"Get state from app store\nvalid state is here\nhttps://github.com/logseq/logseq/blob/master/src/main/frontend/state.cljs#L27"
|
||||
[path]
|
||||
(let [method (aget api-proxy "getStateFromStore")
|
||||
args [path]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-state-from-store
|
||||
[path value]
|
||||
(let [method (aget api-proxy "setStateFromStore")
|
||||
args [path value]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn relaunch
|
||||
[]
|
||||
(let [method (aget api-proxy "relaunch")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn quit
|
||||
[]
|
||||
(let [method (aget api-proxy "quit")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn open-external-link
|
||||
[url]
|
||||
(let [method (aget api-proxy "openExternalLink")
|
||||
args [url]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn exec-git-command
|
||||
[args]
|
||||
(let [method (aget api-proxy "execGitCommand")
|
||||
args [args]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-current-graph
|
||||
[]
|
||||
(let [method (aget api-proxy "getCurrentGraph")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn check-current-is-db-graph
|
||||
[]
|
||||
(let [method (aget api-proxy "checkCurrentIsDbGraph")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-current-graph-configs
|
||||
[& keys]
|
||||
(let [method (aget api-proxy "getCurrentGraphConfigs")
|
||||
rest-keys (vec keys)
|
||||
args (into [] rest-keys)]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-current-graph-configs
|
||||
[configs]
|
||||
(let [method (aget api-proxy "setCurrentGraphConfigs")
|
||||
args [configs]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-current-graph-favorites
|
||||
[]
|
||||
(let [method (aget api-proxy "getCurrentGraphFavorites")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-current-graph-recent
|
||||
[]
|
||||
(let [method (aget api-proxy "getCurrentGraphRecent")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-current-graph-templates
|
||||
[]
|
||||
(let [method (aget api-proxy "getCurrentGraphTemplates")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- push-state-impl
|
||||
[k params query]
|
||||
(let [method (aget api-proxy "pushState")
|
||||
args [k params query]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn push-state
|
||||
([k]
|
||||
(push-state-impl k nil nil))
|
||||
([k params]
|
||||
(push-state-impl k params nil))
|
||||
([k params query]
|
||||
(push-state-impl k params query)))
|
||||
|
||||
(defn- replace-state-impl
|
||||
[k params query]
|
||||
(let [method (aget api-proxy "replaceState")
|
||||
args [k params query]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn replace-state
|
||||
([k]
|
||||
(replace-state-impl k nil nil))
|
||||
([k params]
|
||||
(replace-state-impl k params nil))
|
||||
([k params query]
|
||||
(replace-state-impl k params query)))
|
||||
|
||||
(defn get-current-route
|
||||
[]
|
||||
(let [method (aget api-proxy "getCurrentRoute")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-template
|
||||
[name]
|
||||
(let [method (aget api-proxy "getTemplate")
|
||||
args [name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn exist-template
|
||||
[name]
|
||||
(let [method (aget api-proxy "existTemplate")
|
||||
args [name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- create-template-impl
|
||||
[target name opts]
|
||||
(let [method (aget api-proxy "createTemplate")
|
||||
args [target name opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn create-template
|
||||
([target name]
|
||||
(create-template-impl target name nil))
|
||||
([target name opts]
|
||||
(create-template-impl target name opts)))
|
||||
|
||||
(defn remove-template
|
||||
[name]
|
||||
(let [method (aget api-proxy "removeTemplate")
|
||||
args [name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn insert-template
|
||||
[target name]
|
||||
(let [method (aget api-proxy "insertTemplate")
|
||||
args [target name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-zoom-factor
|
||||
[factor]
|
||||
(let [method (aget api-proxy "setZoomFactor")
|
||||
args [factor]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-full-screen
|
||||
[flag]
|
||||
(let [method (aget api-proxy "setFullScreen")
|
||||
args [flag]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-left-sidebar-visible
|
||||
[flag]
|
||||
(let [method (aget api-proxy "setLeftSidebarVisible")
|
||||
args [flag]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-right-sidebar-visible
|
||||
[flag]
|
||||
(let [method (aget api-proxy "setRightSidebarVisible")
|
||||
args [flag]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- clear-right-sidebar-blocks-impl
|
||||
[opts]
|
||||
(let [method (aget api-proxy "clearRightSidebarBlocks")
|
||||
args [opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn clear-right-sidebar-blocks
|
||||
([]
|
||||
(clear-right-sidebar-blocks-impl nil))
|
||||
([opts]
|
||||
(clear-right-sidebar-blocks-impl opts)))
|
||||
|
||||
(defn register-ui-item
|
||||
[type opts]
|
||||
(let [method (aget api-proxy "registerUIItem")
|
||||
args [type opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-page-menu-item
|
||||
[tag action]
|
||||
(let [method (aget api-proxy "registerPageMenuItem")
|
||||
args [tag action]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-current-graph-changed
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onCurrentGraphChanged")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-graph-after-indexed
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onGraphAfterIndexed")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-theme-mode-changed
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onThemeModeChanged")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-theme-changed
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onThemeChanged")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-today-journal-created
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onTodayJournalCreated")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-before-command-invoked
|
||||
[condition callback]
|
||||
(let [method (aget api-proxy "onBeforeCommandInvoked")
|
||||
args [condition callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-after-command-invoked
|
||||
[condition callback]
|
||||
(let [method (aget api-proxy "onAfterCommandInvoked")
|
||||
args [condition callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-block-renderer-slotted
|
||||
"provide ui slot to specific block with UUID"
|
||||
[condition callback]
|
||||
(let [method (aget api-proxy "onBlockRendererSlotted")
|
||||
args [condition callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-macro-renderer-slotted
|
||||
"provide ui slot to block `renderer` macro for `{{renderer arg1, arg2}}`"
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onMacroRendererSlotted")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-page-head-actions-slotted
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onPageHeadActionsSlotted")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-route-changed
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onRouteChanged")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-sidebar-visible-changed
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onSidebarVisibleChanged")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
37
libs/cljs-sdk/src/com/logseq/assets.cljs
Normal file
37
libs/cljs-sdk/src/com/logseq/assets.cljs
Normal file
@@ -0,0 +1,37 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.assets
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "Assets"))
|
||||
|
||||
(defn- list-files-of-current-graph-impl
|
||||
[exts]
|
||||
(let [method (aget api-proxy "listFilesOfCurrentGraph")
|
||||
args [exts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn list-files-of-current-graph
|
||||
([]
|
||||
(list-files-of-current-graph-impl nil))
|
||||
([exts]
|
||||
(list-files-of-current-graph-impl exts)))
|
||||
|
||||
(defn make-sandbox-storage
|
||||
[]
|
||||
(let [method (aget api-proxy "makeSandboxStorage")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn make-url
|
||||
"make assets scheme url based on current graph"
|
||||
[path]
|
||||
(let [method (aget api-proxy "makeUrl")
|
||||
args [path]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn built-in-open
|
||||
"try to open asset type file in Logseq app"
|
||||
[path]
|
||||
(let [method (aget api-proxy "builtInOpen")
|
||||
args [path]]
|
||||
(core/call-method api-proxy method args)))
|
||||
26
libs/cljs-sdk/src/com/logseq/commands.cljs
Normal file
26
libs/cljs-sdk/src/com/logseq/commands.cljs
Normal file
@@ -0,0 +1,26 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.commands
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "Commands"))
|
||||
|
||||
(defn- register-impl
|
||||
[id options action]
|
||||
(let [method (aget api-proxy "register")
|
||||
args [id options action]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register
|
||||
"Register a plugin command with one or more placements.\n\nv1 keeps compatibility with the existing command APIs by mapping placements\nto palette commands, shortcuts, slash commands, and context-menu entries.\n`when` is stored as command metadata for future host-side evaluation."
|
||||
([id options]
|
||||
(register-impl id options nil))
|
||||
([id options action]
|
||||
(register-impl id options action)))
|
||||
|
||||
(defn execute
|
||||
"Execute a built-in or plugin command.\n\nBuilt-in commands use the existing `logseq.*` ids. Plugin commands can be\naddressed as `plugin-id/key`, `plugin-id.commands.key`, or a local command\nkey registered by the current plugin."
|
||||
[id & args]
|
||||
(let [method (aget api-proxy "execute")
|
||||
rest-args (vec args)
|
||||
args (into [id] rest-args)]
|
||||
(core/call-method api-proxy method args)))
|
||||
145
libs/cljs-sdk/src/com/logseq/core.cljs
Normal file
145
libs/cljs-sdk/src/com/logseq/core.cljs
Normal file
@@ -0,0 +1,145 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.core
|
||||
(:require ["@logseq/libs"]
|
||||
[cljs-bean.core :as bean]
|
||||
[com.logseq.util :as util]))
|
||||
|
||||
(defn- normalize-result [result]
|
||||
(if (instance? js/Promise result)
|
||||
(.then result (fn [value] (normalize-result value)))
|
||||
(util/->clj-tagged result)))
|
||||
|
||||
(defn call-method [owner method args]
|
||||
(when-not method
|
||||
(throw (js/Error. "Missing method on logseq namespace")))
|
||||
(normalize-result (.apply method owner (bean/->js args))))
|
||||
|
||||
(def api-proxy js/logseq)
|
||||
|
||||
(defn- ready-impl
|
||||
[model callback]
|
||||
(let [method (aget api-proxy "ready")
|
||||
args [model callback]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn ready
|
||||
([]
|
||||
(ready-impl nil nil))
|
||||
([model]
|
||||
(ready-impl model nil))
|
||||
([model callback]
|
||||
(ready-impl model callback)))
|
||||
|
||||
(defn ensure-connected
|
||||
[]
|
||||
(let [method (aget api-proxy "ensureConnected")
|
||||
args []]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn beforeunload
|
||||
[callback]
|
||||
(let [method (aget api-proxy "beforeunload")
|
||||
args [callback]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn provide-model
|
||||
[model]
|
||||
(let [method (aget api-proxy "provideModel")
|
||||
args [model]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn provide-theme
|
||||
[theme]
|
||||
(let [method (aget api-proxy "provideTheme")
|
||||
args [theme]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn provide-style
|
||||
[style]
|
||||
(let [method (aget api-proxy "provideStyle")
|
||||
args [style]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn provide-ui
|
||||
[ui]
|
||||
(let [method (aget api-proxy "provideUI")
|
||||
args [ui]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn use-settings-schema
|
||||
[schema]
|
||||
(let [method (aget api-proxy "useSettingsSchema")
|
||||
args [schema]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn update-settings
|
||||
[attrs]
|
||||
(let [method (aget api-proxy "updateSettings")
|
||||
args [attrs]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn on-settings-changed
|
||||
[cb]
|
||||
(let [method (aget api-proxy "onSettingsChanged")
|
||||
args [cb]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn show-settings-ui
|
||||
[]
|
||||
(let [method (aget api-proxy "showSettingsUI")
|
||||
args []]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn hide-settings-ui
|
||||
[]
|
||||
(let [method (aget api-proxy "hideSettingsUI")
|
||||
args []]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn set-main-ui-attrs
|
||||
[attrs]
|
||||
(let [method (aget api-proxy "setMainUIAttrs")
|
||||
args [attrs]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn set-main-ui-inline-style
|
||||
[style]
|
||||
(let [method (aget api-proxy "setMainUIInlineStyle")
|
||||
args [style]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn- hide-main-ui-impl
|
||||
[opts]
|
||||
(let [method (aget api-proxy "hideMainUI")
|
||||
args [opts]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn hide-main-ui
|
||||
([]
|
||||
(hide-main-ui-impl nil))
|
||||
([opts]
|
||||
(hide-main-ui-impl opts)))
|
||||
|
||||
(defn- show-main-ui-impl
|
||||
[opts]
|
||||
(let [method (aget api-proxy "showMainUI")
|
||||
args [opts]]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn show-main-ui
|
||||
([]
|
||||
(show-main-ui-impl nil))
|
||||
([opts]
|
||||
(show-main-ui-impl opts)))
|
||||
|
||||
(defn toggle-main-ui
|
||||
[]
|
||||
(let [method (aget api-proxy "toggleMainUI")
|
||||
args []]
|
||||
(call-method api-proxy method args)))
|
||||
|
||||
(defn resolve-resource-full-url
|
||||
[file-path]
|
||||
(let [method (aget api-proxy "resolveResourceFullUrl")
|
||||
args [file-path]]
|
||||
(call-method api-proxy method args)))
|
||||
54
libs/cljs-sdk/src/com/logseq/db.cljs
Normal file
54
libs/cljs-sdk/src/com/logseq/db.cljs
Normal file
@@ -0,0 +1,54 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.db
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "DB"))
|
||||
|
||||
(defn q
|
||||
"Run a DSL query. https://docs.logseq.com/#/page/queries"
|
||||
[dsl]
|
||||
(let [method (aget api-proxy "q")
|
||||
args [dsl]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn custom-query
|
||||
"Executes a datalog query through query-react,\ngiven either a regular datalog query or a simple query."
|
||||
[query]
|
||||
(let [method (aget api-proxy "customQuery")
|
||||
args [query]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn datascript-query
|
||||
"Run a datascript query with parameters."
|
||||
[query & inputs]
|
||||
(let [method (aget api-proxy "datascriptQuery")
|
||||
rest-inputs (vec inputs)
|
||||
args (into [query] rest-inputs)]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-changed
|
||||
"Hook all transaction data of DB."
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onChanged")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-block-changed
|
||||
"Subscribe a specific block changed event"
|
||||
[uuid callback]
|
||||
(let [method (aget api-proxy "onBlockChanged")
|
||||
args [uuid callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-file-content
|
||||
"For built-in files path `logseq/custom.js`, `logseq/custom.css`, `logseq/publish.js`, `logseq/publish.css` etc."
|
||||
[path content]
|
||||
(let [method (aget api-proxy "setFileContent")
|
||||
args [path content]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-file-content
|
||||
[path]
|
||||
(let [method (aget api-proxy "getFileContent")
|
||||
args [path]]
|
||||
(core/call-method api-proxy method args)))
|
||||
534
libs/cljs-sdk/src/com/logseq/editor.cljs
Normal file
534
libs/cljs-sdk/src/com/logseq/editor.cljs
Normal file
@@ -0,0 +1,534 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.editor
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "Editor"))
|
||||
|
||||
(defn register-slash-command
|
||||
"register a custom command which will be added to the Logseq slash command list"
|
||||
[tag action]
|
||||
(let [method (aget api-proxy "registerSlashCommand")
|
||||
args [tag action]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-block-context-menu-item
|
||||
"register a custom command in the block context menu (triggered by right-clicking the block dot)"
|
||||
[label action]
|
||||
(let [method (aget api-proxy "registerBlockContextMenuItem")
|
||||
args [label action]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- register-highlight-context-menu-item-impl
|
||||
[label action opts]
|
||||
(let [method (aget api-proxy "registerHighlightContextMenuItem")
|
||||
args [label action opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-highlight-context-menu-item
|
||||
"Current it's only available for pdf viewer"
|
||||
([label action]
|
||||
(register-highlight-context-menu-item-impl label action nil))
|
||||
([label action opts]
|
||||
(register-highlight-context-menu-item-impl label action opts)))
|
||||
|
||||
(defn check-editing
|
||||
[]
|
||||
(let [method (aget api-proxy "checkEditing")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn insert-at-editing-cursor
|
||||
[content]
|
||||
(let [method (aget api-proxy "insertAtEditingCursor")
|
||||
args [content]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn restore-editing-cursor
|
||||
[]
|
||||
(let [method (aget api-proxy "restoreEditingCursor")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- exit-editing-mode-impl
|
||||
[select-block]
|
||||
(let [method (aget api-proxy "exitEditingMode")
|
||||
args [select-block]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn exit-editing-mode
|
||||
([]
|
||||
(exit-editing-mode-impl nil))
|
||||
([select-block]
|
||||
(exit-editing-mode-impl select-block)))
|
||||
|
||||
(defn get-editing-cursor-position
|
||||
[]
|
||||
(let [method (aget api-proxy "getEditingCursorPosition")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-editing-block-content
|
||||
[]
|
||||
(let [method (aget api-proxy "getEditingBlockContent")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-current-page
|
||||
[]
|
||||
(let [method (aget api-proxy "getCurrentPage")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-today-page
|
||||
[]
|
||||
(let [method (aget api-proxy "getTodayPage")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-current-block
|
||||
[]
|
||||
(let [method (aget api-proxy "getCurrentBlock")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-selected-blocks
|
||||
[]
|
||||
(let [method (aget api-proxy "getSelectedBlocks")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn clear-selected-blocks
|
||||
[]
|
||||
(let [method (aget api-proxy "clearSelectedBlocks")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-current-page-blocks-tree
|
||||
"get all blocks of the current page as a tree structure"
|
||||
[]
|
||||
(let [method (aget api-proxy "getCurrentPageBlocksTree")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-page-blocks-tree
|
||||
"get all blocks for the specified page"
|
||||
[src-page]
|
||||
(let [method (aget api-proxy "getPageBlocksTree")
|
||||
args [src-page]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-page-linked-references
|
||||
"get all page/block linked references"
|
||||
[src-page]
|
||||
(let [method (aget api-proxy "getPageLinkedReferences")
|
||||
args [src-page]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-pages-from-namespace
|
||||
"get flatten pages from top namespace"
|
||||
[namespace]
|
||||
(let [method (aget api-proxy "getPagesFromNamespace")
|
||||
args [namespace]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-pages-tree-from-namespace
|
||||
"construct pages tree from namespace pages"
|
||||
[namespace]
|
||||
(let [method (aget api-proxy "getPagesTreeFromNamespace")
|
||||
args [namespace]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn new-block-uuid
|
||||
"Create a unique UUID string which can then be assigned to a block."
|
||||
[]
|
||||
(let [method (aget api-proxy "newBlockUUID")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn is-page-block
|
||||
[block]
|
||||
(let [method (aget api-proxy "isPageBlock")
|
||||
args [block]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- insert-block-impl
|
||||
[src-block content opts]
|
||||
(let [method (aget api-proxy "insertBlock")
|
||||
args [src-block content opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn insert-block
|
||||
([src-block content]
|
||||
(insert-block-impl src-block content nil))
|
||||
([src-block content opts]
|
||||
(insert-block-impl src-block content opts)))
|
||||
|
||||
(defn- insert-batch-block-impl
|
||||
[src-block batch opts]
|
||||
(let [method (aget api-proxy "insertBatchBlock")
|
||||
args [src-block batch opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn insert-batch-block
|
||||
([src-block batch]
|
||||
(insert-batch-block-impl src-block batch nil))
|
||||
([src-block batch opts]
|
||||
(insert-batch-block-impl src-block batch opts)))
|
||||
|
||||
(defn- update-block-impl
|
||||
[src-block content opts]
|
||||
(let [method (aget api-proxy "updateBlock")
|
||||
args [src-block content opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn update-block
|
||||
([src-block content]
|
||||
(update-block-impl src-block content nil))
|
||||
([src-block content opts]
|
||||
(update-block-impl src-block content opts)))
|
||||
|
||||
(defn remove-block
|
||||
[src-block]
|
||||
(let [method (aget api-proxy "removeBlock")
|
||||
args [src-block]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- get-block-impl
|
||||
[src-block opts]
|
||||
(let [method (aget api-proxy "getBlock")
|
||||
args [src-block opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-block
|
||||
([src-block]
|
||||
(get-block-impl src-block nil))
|
||||
([src-block opts]
|
||||
(get-block-impl src-block opts)))
|
||||
|
||||
(defn set-block-collapsed
|
||||
[src-block opts]
|
||||
(let [method (aget api-proxy "setBlockCollapsed")
|
||||
args [src-block opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- get-page-impl
|
||||
[src-page opts]
|
||||
(let [method (aget api-proxy "getPage")
|
||||
args [src-page opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-page
|
||||
([src-page]
|
||||
(get-page-impl src-page nil))
|
||||
([src-page opts]
|
||||
(get-page-impl src-page opts)))
|
||||
|
||||
(defn- create-page-impl
|
||||
[page-name properties opts]
|
||||
(let [method (aget api-proxy "createPage")
|
||||
args [page-name properties opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn create-page
|
||||
([page-name]
|
||||
(create-page-impl page-name nil nil))
|
||||
([page-name properties]
|
||||
(create-page-impl page-name properties nil))
|
||||
([page-name properties opts]
|
||||
(create-page-impl page-name properties opts)))
|
||||
|
||||
(defn create-journal-page
|
||||
[date]
|
||||
(let [method (aget api-proxy "createJournalPage")
|
||||
args [date]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn delete-page
|
||||
[page-name]
|
||||
(let [method (aget api-proxy "deletePage")
|
||||
args [page-name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn rename-page
|
||||
[old-name new-name]
|
||||
(let [method (aget api-proxy "renamePage")
|
||||
args [old-name new-name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- get-all-pages-impl
|
||||
[repo]
|
||||
(let [method (aget api-proxy "getAllPages")
|
||||
args [repo]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-all-pages
|
||||
([]
|
||||
(get-all-pages-impl nil))
|
||||
([repo]
|
||||
(get-all-pages-impl repo)))
|
||||
|
||||
(defn get-all-tags
|
||||
[]
|
||||
(let [method (aget api-proxy "getAllTags")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-all-properties
|
||||
[]
|
||||
(let [method (aget api-proxy "getAllProperties")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-tag-objects
|
||||
[name-or-ident]
|
||||
(let [method (aget api-proxy "getTagObjects")
|
||||
args [name-or-ident]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- create-tag-impl
|
||||
[tag-name opts]
|
||||
(let [method (aget api-proxy "createTag")
|
||||
args [tag-name opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn create-tag
|
||||
([tag-name]
|
||||
(create-tag-impl tag-name nil))
|
||||
([tag-name opts]
|
||||
(create-tag-impl tag-name opts)))
|
||||
|
||||
(defn get-tag
|
||||
[name-or-ident]
|
||||
(let [method (aget api-proxy "getTag")
|
||||
args [name-or-ident]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-tags-by-name
|
||||
[tag-name]
|
||||
(let [method (aget api-proxy "getTagsByName")
|
||||
args [tag-name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn add-tag-property
|
||||
[tag-id property-id-or-name]
|
||||
(let [method (aget api-proxy "addTagProperty")
|
||||
args [tag-id property-id-or-name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn remove-tag-property
|
||||
[tag-id property-id-or-name]
|
||||
(let [method (aget api-proxy "removeTagProperty")
|
||||
args [tag-id property-id-or-name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn add-tag-extends
|
||||
[tag-id parent-tag-id-or-name]
|
||||
(let [method (aget api-proxy "addTagExtends")
|
||||
args [tag-id parent-tag-id-or-name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn remove-tag-extends
|
||||
[tag-id parent-tag-id-or-name]
|
||||
(let [method (aget api-proxy "removeTagExtends")
|
||||
args [tag-id parent-tag-id-or-name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn add-block-tag
|
||||
[block-id tag-id]
|
||||
(let [method (aget api-proxy "addBlockTag")
|
||||
args [block-id tag-id]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn remove-block-tag
|
||||
[block-id tag-id]
|
||||
(let [method (aget api-proxy "removeBlockTag")
|
||||
args [block-id tag-id]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-block-icon
|
||||
[block-id icon-type icon-name]
|
||||
(let [method (aget api-proxy "setBlockIcon")
|
||||
args [block-id icon-type icon-name]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn remove-block-icon
|
||||
[block-id]
|
||||
(let [method (aget api-proxy "removeBlockIcon")
|
||||
args [block-id]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn add-property-value-choices
|
||||
[property-id choices]
|
||||
(let [method (aget api-proxy "addPropertyValueChoices")
|
||||
args [property-id choices]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn set-property-node-tags
|
||||
[property-id tag-ids]
|
||||
(let [method (aget api-proxy "setPropertyNodeTags")
|
||||
args [property-id tag-ids]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- prepend-block-in-page-impl
|
||||
[page content opts]
|
||||
(let [method (aget api-proxy "prependBlockInPage")
|
||||
args [page content opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn prepend-block-in-page
|
||||
([page content]
|
||||
(prepend-block-in-page-impl page content nil))
|
||||
([page content opts]
|
||||
(prepend-block-in-page-impl page content opts)))
|
||||
|
||||
(defn- append-block-in-page-impl
|
||||
[page content opts]
|
||||
(let [method (aget api-proxy "appendBlockInPage")
|
||||
args [page content opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn append-block-in-page
|
||||
([page content]
|
||||
(append-block-in-page-impl page content nil))
|
||||
([page content opts]
|
||||
(append-block-in-page-impl page content opts)))
|
||||
|
||||
(defn get-previous-sibling-block
|
||||
[src-block]
|
||||
(let [method (aget api-proxy "getPreviousSiblingBlock")
|
||||
args [src-block]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-next-sibling-block
|
||||
[src-block]
|
||||
(let [method (aget api-proxy "getNextSiblingBlock")
|
||||
args [src-block]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- move-block-impl
|
||||
[src-block target-block opts]
|
||||
(let [method (aget api-proxy "moveBlock")
|
||||
args [src-block target-block opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn move-block
|
||||
([src-block target-block]
|
||||
(move-block-impl src-block target-block nil))
|
||||
([src-block target-block opts]
|
||||
(move-block-impl src-block target-block opts)))
|
||||
|
||||
(defn- edit-block-impl
|
||||
[src-block opts]
|
||||
(let [method (aget api-proxy "editBlock")
|
||||
args [src-block opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn edit-block
|
||||
([src-block]
|
||||
(edit-block-impl src-block nil))
|
||||
([src-block opts]
|
||||
(edit-block-impl src-block opts)))
|
||||
|
||||
(defn select-block
|
||||
[src-block]
|
||||
(let [method (aget api-proxy "selectBlock")
|
||||
args [src-block]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn save-focused-code-editor-content
|
||||
[]
|
||||
(let [method (aget api-proxy "saveFocusedCodeEditorContent")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-property
|
||||
[key]
|
||||
(let [method (aget api-proxy "getProperty")
|
||||
args [key]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- upsert-property-impl
|
||||
[key schema opts]
|
||||
(let [method (aget api-proxy "upsertProperty")
|
||||
args [key schema opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn upsert-property
|
||||
([key]
|
||||
(upsert-property-impl key nil nil))
|
||||
([key schema]
|
||||
(upsert-property-impl key schema nil))
|
||||
([key schema opts]
|
||||
(upsert-property-impl key schema opts)))
|
||||
|
||||
(defn remove-property
|
||||
[key]
|
||||
(let [method (aget api-proxy "removeProperty")
|
||||
args [key]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- upsert-block-property-impl
|
||||
[block key value options]
|
||||
(let [method (aget api-proxy "upsertBlockProperty")
|
||||
args [block key value options]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn upsert-block-property
|
||||
([block key value]
|
||||
(upsert-block-property-impl block key value nil))
|
||||
([block key value options]
|
||||
(upsert-block-property-impl block key value options)))
|
||||
|
||||
(defn remove-block-property
|
||||
[block key]
|
||||
(let [method (aget api-proxy "removeBlockProperty")
|
||||
args [block key]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-block-property
|
||||
[block key]
|
||||
(let [method (aget api-proxy "getBlockProperty")
|
||||
args [block key]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-block-properties
|
||||
[block]
|
||||
(let [method (aget api-proxy "getBlockProperties")
|
||||
args [block]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get-page-properties
|
||||
[page]
|
||||
(let [method (aget api-proxy "getPageProperties")
|
||||
args [page]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- scroll-to-block-in-page-impl
|
||||
[page-name block-id opts]
|
||||
(let [method (aget api-proxy "scrollToBlockInPage")
|
||||
args [page-name block-id opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn scroll-to-block-in-page
|
||||
([page-name block-id]
|
||||
(scroll-to-block-in-page-impl page-name block-id nil))
|
||||
([page-name block-id opts]
|
||||
(scroll-to-block-in-page-impl page-name block-id opts)))
|
||||
|
||||
(defn open-in-right-sidebar
|
||||
[id]
|
||||
(let [method (aget api-proxy "openInRightSidebar")
|
||||
args [id]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn open-pdf-viewer
|
||||
[asset-block-id-or-file-url]
|
||||
(let [method (aget api-proxy "openPDFViewer")
|
||||
args [asset-block-id-or-file-url]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn on-input-selection-end
|
||||
[callback]
|
||||
(let [method (aget api-proxy "onInputSelectionEnd")
|
||||
args [callback]]
|
||||
(core/call-method api-proxy method args)))
|
||||
61
libs/cljs-sdk/src/com/logseq/experiments.cljs
Normal file
61
libs/cljs-sdk/src/com/logseq/experiments.cljs
Normal file
@@ -0,0 +1,61 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.experiments
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "Experiments"))
|
||||
|
||||
(defn invoke-exper-method
|
||||
[type & args]
|
||||
(let [method (aget api-proxy "invokeExperMethod")
|
||||
rest-args (vec args)
|
||||
args (into [type] rest-args)]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn load-scripts
|
||||
[& scripts]
|
||||
(let [method (aget api-proxy "loadScripts")
|
||||
rest-scripts (vec scripts)
|
||||
args (into [] rest-scripts)]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-fenced-code-renderer
|
||||
[lang opts]
|
||||
(let [method (aget api-proxy "registerFencedCodeRenderer")
|
||||
args [lang opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-daemon-renderer
|
||||
[key opts]
|
||||
(let [method (aget api-proxy "registerDaemonRenderer")
|
||||
args [key opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-hosted-renderer
|
||||
[key opts]
|
||||
(let [method (aget api-proxy "registerHostedRenderer")
|
||||
args [key opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-sidebar-renderer
|
||||
[key opts]
|
||||
(let [method (aget api-proxy "registerSidebarRenderer")
|
||||
args [key opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-route-renderer
|
||||
[key opts]
|
||||
(let [method (aget api-proxy "registerRouteRenderer")
|
||||
args [key opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn register-extensions-enhancer
|
||||
[type enhancer]
|
||||
(let [method (aget api-proxy "registerExtensionsEnhancer")
|
||||
args [type enhancer]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn ensure-host-scope
|
||||
[]
|
||||
(let [method (aget api-proxy "ensureHostScope")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
23
libs/cljs-sdk/src/com/logseq/git.cljs
Normal file
23
libs/cljs-sdk/src/com/logseq/git.cljs
Normal file
@@ -0,0 +1,23 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.git
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "Git"))
|
||||
|
||||
(defn exec-command
|
||||
[args]
|
||||
(let [method (aget api-proxy "execCommand")
|
||||
args [args]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn load-ignore-file
|
||||
[]
|
||||
(let [method (aget api-proxy "loadIgnoreFile")
|
||||
args []]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn save-ignore-file
|
||||
[content]
|
||||
(let [method (aget api-proxy "saveIgnoreFile")
|
||||
args [content]]
|
||||
(core/call-method api-proxy method args)))
|
||||
90
libs/cljs-sdk/src/com/logseq/net.cljs
Normal file
90
libs/cljs-sdk/src/com/logseq/net.cljs
Normal file
@@ -0,0 +1,90 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.net
|
||||
(:refer-clojure :exclude [get])
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "Net"))
|
||||
|
||||
(defn request
|
||||
[options]
|
||||
(let [method (aget api-proxy "request")
|
||||
args [options]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn- get-impl
|
||||
[url options]
|
||||
(let [method (aget api-proxy "get")
|
||||
args [url options]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn get
|
||||
([url]
|
||||
(get-impl url nil))
|
||||
([url options]
|
||||
(get-impl url options)))
|
||||
|
||||
(defn- head-impl
|
||||
[url options]
|
||||
(let [method (aget api-proxy "head")
|
||||
args [url options]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn head
|
||||
([url]
|
||||
(head-impl url nil))
|
||||
([url options]
|
||||
(head-impl url options)))
|
||||
|
||||
(defn- post-impl
|
||||
[url body options]
|
||||
(let [method (aget api-proxy "post")
|
||||
args [url body options]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn post
|
||||
([url]
|
||||
(post-impl url nil nil))
|
||||
([url body]
|
||||
(post-impl url body nil))
|
||||
([url body options]
|
||||
(post-impl url body options)))
|
||||
|
||||
(defn- put-impl
|
||||
[url body options]
|
||||
(let [method (aget api-proxy "put")
|
||||
args [url body options]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn put
|
||||
([url]
|
||||
(put-impl url nil nil))
|
||||
([url body]
|
||||
(put-impl url body nil))
|
||||
([url body options]
|
||||
(put-impl url body options)))
|
||||
|
||||
(defn- patch-impl
|
||||
[url body options]
|
||||
(let [method (aget api-proxy "patch")
|
||||
args [url body options]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn patch
|
||||
([url]
|
||||
(patch-impl url nil nil))
|
||||
([url body]
|
||||
(patch-impl url body nil))
|
||||
([url body options]
|
||||
(patch-impl url body options)))
|
||||
|
||||
(defn- delete-impl
|
||||
[url options]
|
||||
(let [method (aget api-proxy "delete")
|
||||
args [url options]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn delete
|
||||
([url]
|
||||
(delete-impl url nil))
|
||||
([url options]
|
||||
(delete-impl url options)))
|
||||
49
libs/cljs-sdk/src/com/logseq/ui.cljs
Normal file
49
libs/cljs-sdk/src/com/logseq/ui.cljs
Normal file
@@ -0,0 +1,49 @@
|
||||
;; Auto-generated via `bb libs:generate-cljs-sdk`
|
||||
(ns com.logseq.ui
|
||||
(:require [com.logseq.core :as core]))
|
||||
|
||||
(def api-proxy (aget js/logseq "UI"))
|
||||
|
||||
(defn- show-msg-impl
|
||||
[content status opts]
|
||||
(let [method (aget api-proxy "showMsg")
|
||||
args [content status opts]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn show-msg
|
||||
([content]
|
||||
(show-msg-impl content nil nil))
|
||||
([content status]
|
||||
(show-msg-impl content status nil))
|
||||
([content status opts]
|
||||
(show-msg-impl content status opts)))
|
||||
|
||||
(defn close-msg
|
||||
[key]
|
||||
(let [method (aget api-proxy "closeMsg")
|
||||
args [key]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn query-element-rect
|
||||
[selector]
|
||||
(let [method (aget api-proxy "queryElementRect")
|
||||
args [selector]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn query-element-by-id
|
||||
[id]
|
||||
(let [method (aget api-proxy "queryElementById")
|
||||
args [id]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn check-slot-valid
|
||||
[slot]
|
||||
(let [method (aget api-proxy "checkSlotValid")
|
||||
args [slot]]
|
||||
(core/call-method api-proxy method args)))
|
||||
|
||||
(defn resolve-theme-css-props-vals
|
||||
[props]
|
||||
(let [method (aget api-proxy "resolveThemeCssPropsVals")
|
||||
args [props]]
|
||||
(core/call-method api-proxy method args)))
|
||||
31
libs/cljs-sdk/src/com/logseq/util.cljs
Normal file
31
libs/cljs-sdk/src/com/logseq/util.cljs
Normal file
@@ -0,0 +1,31 @@
|
||||
(ns com.logseq.util
|
||||
(:require [cljs-bean.core :as bean]
|
||||
[clojure.string :as string]
|
||||
[clojure.walk :as walk]))
|
||||
|
||||
(def ^:private kw-tag "___kw___")
|
||||
|
||||
(defn- decode-kw [v]
|
||||
(if (and (string? v) (string/starts-with? v kw-tag))
|
||||
(let [s (subs v (count kw-tag))
|
||||
i (.indexOf s "/")]
|
||||
(if (neg? i)
|
||||
(keyword s) ; :name
|
||||
(keyword (subs s 0 i) (subs s (inc i))))) ; :ns/name
|
||||
v))
|
||||
|
||||
(defn ->clj-tagged [js]
|
||||
(some->> js
|
||||
bean/->clj
|
||||
(walk/postwalk (fn [f]
|
||||
(cond
|
||||
(keyword? f)
|
||||
(decode-kw (if-let [ns (namespace f)]
|
||||
(str ns "/" (name f))
|
||||
(name f)))
|
||||
|
||||
(string? f)
|
||||
(decode-kw f)
|
||||
|
||||
:else
|
||||
f)))))
|
||||
Reference in New Issue
Block a user