Merge remote-tracking branch 'upstream/master' into whiteboards

This commit is contained in:
Peng Xiao
2022-09-28 10:29:20 +08:00
130 changed files with 348 additions and 227 deletions

View File

@@ -4,7 +4,6 @@ electron.core/start
electron.core/stop
;; repl fn
electron.search/query
frontend.blob/blob
;; Used by shadow-cljs
frontend.core/stop
;; For repl
@@ -82,4 +81,4 @@ frontend.test.frontend-node-test-runner/main
logseq.graph-parser.nbb-test-runner/run-tests
;; For debugging
frontend.fs.sync/debug-print-sync-events-loop
frontend.fs.sync/stop-debug-print-sync-events-loop
frontend.fs.sync/stop-debug-print-sync-events-loop

View File

@@ -22,25 +22,52 @@
{:aliases {datascript.core d
datascript.transit dt
datascript.db ddb
lambdaisland.glogi log
medley.core medley
electron.ipc ipc
frontend.commands commands
frontend.config config
frontend.date date
frontend.db db
frontend.db-mixins db-mixins
frontend.db.query-dsl query-dsl
frontend.db.react react
frontend.db.query-react query-react
frontend.util util
frontend.util.property property
frontend.util.text text-util
frontend.config config
frontend.diff diff
frontend.encrypt encrypt
frontend.format.mldoc mldoc
frontend.format.block block
frontend.fs fs
frontend.fs.bfs bfs
frontend.fs.capacitor-fs capacitor-fs
frontend.fs.nfs nfs
frontend.handler.extract extract
frontend.handler.common common-handler
frontend.handler.common.file file-common-handler
frontend.handler.config config-handler
frontend.handler.events events
frontend.handler.global-config global-config-handler
frontend.handler.ui ui-handler
frontend.handler.notification notification
frontend.handler.page page-handler
frontend.handler.repo repo-handler
frontend.handler.repo-config repo-config-handler
frontend.handler.search search-handler
frontend.idb idb
frontend.loader loader
frontend.mixins mixins
frontend.mobile.util mobile-util
frontend.page page
frontend.search search
frontend.state state
frontend.template template
frontend.ui ui
frontend.util util
frontend.util.clock clock
frontend.util.property property
frontend.util.persist-var persist-var
frontend.util.text text-util
frontend.util.url url-util
frontend.util.thingatpt thingatpt
lambdaisland.glogi log
logseq.graph-parser graph-parser
logseq.graph-parser.text text
logseq.graph-parser.block gp-block
@@ -50,7 +77,8 @@
logseq.graph-parser.config gp-config
logseq.graph-parser.util.page-ref page-ref
logseq.graph-parser.util.block-ref block-ref
logseq.graph-parser.date-time-util date-time-util}}
logseq.graph-parser.date-time-util date-time-util
medley.core medley}}
:namespace-name-mismatch {:level :warning}
:used-underscored-binding {:level :warning}}

View File

@@ -106,6 +106,9 @@ jobs:
- name: Lint for vars that are too large
run: bb lint:large-vars
- name: Lint for namespaces that aren't documented
run: bb lint:ns-docstrings
- name: Lint invalid translation entries
run: bb lang:invalid-translations

13
bb.edn
View File

@@ -6,7 +6,7 @@
logseq/bb-tasks
#_{:local/root "../bb-tasks"}
{:git/url "https://github.com/logseq/bb-tasks"
:git/sha "abb32ccd26405d56fd28a29d56f3cb902b8c4334"}
:git/sha "95e4fbdb7bbf1c720c6f8b58e3b3b96b3b487526"}
logseq/graph-parser
{:local/root "deps/graph-parser"}
org.clj-commons/digest
@@ -70,6 +70,9 @@
lint:carve
logseq.bb-tasks.lint.carve/-main
lint:ns-docstrings
logseq.bb-tasks.lint.ns-docstrings/-main
nbb:watch
logseq.bb-tasks.nbb.watch/watch
@@ -98,4 +101,10 @@
;; TODO: Address vars tagged with cleanup-todo. These
;; are left mostly because they are not high priority
;; or not well understood
:metadata-exceptions #{:large-vars/cleanup-todo}}}}
:metadata-exceptions #{:large-vars/cleanup-todo}}
:ns-docstrings
{:paths ["src/main"]
;; Ignore namespaces that won't be helpful to document initially
;; e.g. frontend.components.onboarding -> "Onboarding fns"
:ignore-regex "^(frontend.components|frontend.extensions|frontend.modules|frontend.mobile)"}}}

View File

@@ -62,9 +62,6 @@
;; first block that's not a heading or unordered list
:block/pre-block? {}
;; heading's level (the block must be a heading)
:block/heading-level {}
;; scheduled day
:block/scheduled {}
@@ -119,7 +116,6 @@
:block/deadline
:block/repeated?
:block/pre-block?
:block/heading-level
:block/type
:block/properties
:block/properties-order

View File

@@ -549,6 +549,15 @@
blocks)]
(with-path-refs blocks)))
(defn- with-heading-property
[properties markdown-heading? size level]
(let [properties (if markdown-heading?
(assoc properties :heading size)
properties)]
(if (true? (:heading properties))
(assoc properties :heading (min 6 level))
properties)))
(defn- construct-block
[block properties timestamps body encoded-content format pos-meta with-id? {:keys [block-pattern supported-formats db date-formatter]}]
(let [id (get-custom-id-or-new-id properties)
@@ -559,18 +568,17 @@
markdown-heading? (and (:size block) (= :markdown format))
block (if markdown-heading?
(assoc block
:type :heading
:level (if unordered? (:level block) 1)
:heading-level (or (:size block) 6))
:level (if unordered? (:level block) 1))
block)
block (cond->
(assoc block
:uuid id
:refs ref-pages-in-properties
:format format
:meta pos-meta)
(seq (:properties properties))
(assoc :properties (:properties properties)
(-> (assoc block
:uuid id
:refs ref-pages-in-properties
:format format
:meta pos-meta)
(dissoc :size))
(or (seq (:properties properties)) markdown-heading?)
(assoc :properties (with-heading-property (:properties properties) markdown-heading? (:size block) (:level block))
:properties-text-values (:properties-text-values properties)
:properties-order (vec (:properties-order properties)))

View File

@@ -100,7 +100,8 @@
:updated-at 47 :created-at 47
:card-last-score 6 :card-repeats 6 :card-next-schedule 6
:card-last-interval 6 :card-ease-factor 6 :card-last-reviewed 6
:alias 6 :logseq.macro-arguments 94 :logseq.macro-name 94}
:alias 6 :logseq.macro-arguments 94 :logseq.macro-name 94
:heading 64}
(get-top-block-properties db))
"Counts for top block properties")
@@ -115,10 +116,9 @@
:block/priority 4
:block/deadline 1
:block/collapsed? 22
:block/heading-level 60
:block/repeated? 1}
(->> [:block/scheduled :block/priority :block/deadline :block/collapsed?
:block/heading-level :block/repeated?]
:block/repeated?]
(map (fn [attr]
[attr
(ffirst (d/q [:find (list 'count '?b) :where ['?b attr]]
@@ -142,7 +142,7 @@
;; only increase over time as the docs graph rarely has deletions
(testing "Counts"
(is (= 211 (count files)) "Correct file count")
(is (= 42070 (count (d/datoms db :eavt))) "Correct datoms count")
(is (= 42006 (count (d/datoms db :eavt))) "Correct datoms count")
(is (= 3600
(ffirst

View File

@@ -54,11 +54,13 @@ To configure the linter, see the `[:tasks/config :large-vars]` path of bb.edn.
### Document namespaces
Documentation helps teams share their knowledge and enables more individuals to contribute to the codebase. Documenting our namespaces is a good first step to improving our documentation. Currently this linter is only run on our deps/. To run this linter:
Documentation helps teams share their knowledge and enables more individuals to contribute to the codebase. Documenting our namespaces is a good first step to improving our documentation. To run this linter:
```
bb lint:ns-docstrings
```
To skip documenting a ns, use the common `^:no-doc` metadata flag.
### Datalog linting
We use [datascript](https://github.com/tonsky/datascript)'s datalog to power our

View File

@@ -84,7 +84,7 @@
"@capacitor/splash-screen": "^4.0.0",
"@capacitor/status-bar": "^4.0.0",
"@excalidraw/excalidraw": "0.10.0",
"@kanru/rage-wasm": "0.2.1",
"@kanru/rage-wasm": "^0.3.0",
"@logseq/capacitor-file-sync": "0.0.10",
"@logseq/react-tweet-embed": "1.3.1-1",
"@sentry/react": "^6.18.2",

View File

@@ -13,6 +13,7 @@
(doseq [cmd ["clojure -M:clj-kondo --parallel --lint src --cache false"
"bb lint:carve"
"bb lint:large-vars"
"bb lang:invalid-translations"]]
"bb lang:invalid-translations"
"bb lint:ns-docstrings"]]
(println cmd)
(shell cmd)))

View File

@@ -1,4 +1,5 @@
(ns electron.ipc
"Provides fns to send ipc messages to electron's main process"
(:require [cljs-bean.core :as bean]
[promesa.core :as p]
[frontend.util :as util]))

View File

@@ -1,4 +1,6 @@
(ns electron.listener
"System-component-like ns that defines listeners by event name to receive ipc
messages from electron's main process"
(:require [frontend.state :as state]
[frontend.context.i18n :refer [t]]
[frontend.date :as date]

View File

@@ -1,29 +0,0 @@
(ns frontend.blob)
(defn- decode
"Decodes the data portion of a data url from base64"
[[media-type data]]
[media-type (js/atob data)])
(defn- uint8
"Converts a base64 decoded data string to a Uint8Array"
[[media-type data]]
(->> (map #(.charCodeAt %1) data)
js/Uint8Array.
(vector media-type)))
(defn- make-blob
"Creates a JS Blob object from a media type and a Uint8Array"
[[media-type uint8]]
(js/Blob. (array uint8) (js-obj "type" media-type)))
(defn blob
"Converts a data-url into a JS Blob. This is useful for uploading
image data from JavaScript."
[data-url]
{:pre [(string? data-url)]}
(-> (re-find #"^data:([^;]+);base64,(.*)$" data-url)
rest
decode
uint8
make-blob))

View File

@@ -1,4 +1,5 @@
(ns frontend.commands
"Provides functionality for commands and advanced commands"
(:require [clojure.string :as string]
[frontend.config :as config]
[frontend.date :as date]
@@ -131,13 +132,11 @@
[:editor/set-heading heading]
[:editor/move-cursor-to-end]])
(defn- markdown-headings
(defn- headings
[]
(let [format (state/get-preferred-format)]
(when (= (name format) "markdown")
(mapv (fn [level]
(let [heading (str "h" level)]
[heading (->heading (apply str (repeat level "#")))])) (range 1 7)))))
(mapv (fn [level]
(let [heading (str "h" level)]
[heading (->heading level)])) (range 1 7)))
(defonce *matched-commands (atom nil))
(defonce *initial-commands (atom nil))
@@ -240,7 +239,7 @@
;; ["Upload an image" [[:editor/click-hidden-file-input :id]]]
)]
(markdown-headings)
(headings)
;; time & date
@@ -345,6 +344,7 @@
(or (string/starts-with? last-pattern block-ref/left-parens)
(string/starts-with? last-pattern page-ref/left-brackets)))
(and s (string/starts-with? s "{{embed"))
(and s (= (last s) \#) (string/starts-with? last-pattern "[["))
(and last-pattern
(or (string/ends-with? last-pattern gp-property/colons)
(string/starts-with? last-pattern gp-property/colons)))))))]
@@ -592,19 +592,33 @@
(property/goto-properties-end format current-input)
(cursor/move-cursor-backward current-input 3)))))
(defonce markdown-heading-pattern #"^#+\s+")
(defn set-markdown-heading
[content heading]
(let [heading-str (apply str (repeat heading "#"))]
(if (util/safe-re-find markdown-heading-pattern content)
(string/replace-first content
markdown-heading-pattern
(str heading-str " "))
(str heading-str " " (string/triml content)))))
(defn clear-markdown-heading
[content]
[:pre (string? content)]
(string/replace-first content
markdown-heading-pattern
""))
(defmethod handle-step :editor/set-heading [[_ heading]]
(when-let [input-id (state/get-edit-input-id)]
(when-let [current-input (gdom/getElement input-id)]
(let [edit-content (gobj/get current-input "value")
heading-pattern #"^#+\s+"
new-value (cond
(util/safe-re-find heading-pattern edit-content)
(string/replace-first edit-content
heading-pattern
(str heading " "))
:else
(str heading " " (string/triml edit-content)))]
(state/set-edit-content! input-id new-value)))))
(let [current-block (state/get-edit-block)
format (:block/format current-block)]
(if (= format :markdown)
(let [edit-content (gobj/get current-input "value")
new-content (set-markdown-heading edit-content heading)]
(state/set-edit-content! input-id new-content))
(state/pub-event! [:editor/set-org-mode-heading current-block heading]))))))
(defmethod handle-step :editor/search-page [[_]]
(state/set-editor-action! :page-search))

View File

@@ -1856,7 +1856,7 @@
(declare block-content)
(defn build-block-title
[config {:block/keys [title marker pre-block? properties level heading-level]
[config {:block/keys [title marker pre-block? properties]
:as t}]
(let [config (assoc config :block t)
slide? (boolean (:slide? config))
@@ -1873,14 +1873,9 @@
priority (priority-cp t)
tags (block-tags-cp t)
bg-color (:background-color properties)
heading-level (or (and heading-level
(<= heading-level 6)
heading-level)
(and (get properties :heading)
(<= level 6)
level))
elem (if heading-level
(keyword (str "h" heading-level
heading (:heading properties)
elem (if heading
(keyword (str "h" heading
(when block-ref? ".inline")))
:span.inline)]
(->elem
@@ -2309,7 +2304,7 @@
(rum/defcs block-content-or-editor < rum/reactive
(rum/local true ::hide-block-refs?)
[state config {:block/keys [uuid format] :as block} edit-input-id block-id heading-level edit? hide-block-refs-count?]
[state config {:block/keys [uuid format] :as block} edit-input-id block-id edit? hide-block-refs-count?]
(let [*hide-block-refs? (get state ::hide-block-refs?)
hide-block-refs? @*hide-block-refs?
editor-box (get config :editor-box)
@@ -2327,7 +2322,6 @@
:block-id uuid
:block-parent-id block-id
:format format
:heading-level heading-level
:on-hide (fn [value event]
(when (= event :esc)
(editor-handler/save-block! (editor-handler/get-state) value)
@@ -2402,7 +2396,7 @@
[:div.single-block.ls-block
{:class (str block-uuid)
:id (str "ls-block-" blocks-container-id "-" block-uuid)}
(block-content-or-editor config block edit-input-id block-el-id (:block/heading-level block) edit? true)])))
(block-content-or-editor config block edit-input-id block-el-id edit? true)])))
(rum/defc single-block-cp
[block-uuid]
@@ -2629,7 +2623,7 @@
block (if ref?
(merge block (db/pull-block (:db/id block)))
block)
{:block/keys [uuid children pre-block? top? refs heading-level level format content properties]} block
{:block/keys [uuid children pre-block? top? refs level format content properties]} block
config (if navigated? (assoc config :id (str navigating-block)) config)
block (merge block (block/parse-title-and-body uuid format pre-block? content))
blocks-container-id (:blocks-container-id config)
@@ -2638,7 +2632,7 @@
config (if (nil? (:query-result config))
(assoc config :query-result (atom nil))
config)
heading? (or (:heading properties) (and heading-level (<= heading-level 6)))
heading? (:heading properties)
*control-show? (get state ::control-show?)
db-collapsed? (util/collapsed? block)
collapsed? (cond
@@ -2720,7 +2714,7 @@
(when @*show-left-menu?
(block-left-menu config block))
(block-content-or-editor config block edit-input-id block-id heading-level edit? false)
(block-content-or-editor config block edit-input-id block-id edit? false)
(when @*show-right-menu?
(block-right-menu config block edit?))]

View File

@@ -84,7 +84,7 @@
:on-click editor-handler/copy-block-embeds}
"Copy block embeds"
nil)
[:hr.menu-separator]
(ui/menu-link
@@ -100,8 +100,7 @@
"#787f97"
"#978626"
"#49767b"
"#264c9b"
"#793e3e"])
"#264c9b"])
(defonce *template-including-parent? (atom nil))
@@ -163,11 +162,10 @@
(rum/defc ^:large-vars/cleanup-todo block-context-menu-content
[_target block-id]
(when-let [block (db/entity [:block/uuid block-id])]
(let [properties (:block/properties block)
heading? (true? (:heading properties))]
(let [format (:block/format block)]
[:.menu-links-wrapper
[:div.flex-row.flex.justify-between.pb-2.pt-1.px-2
[:div.flex-row.flex.justify-between
[:div.flex.flex-row.justify-between.pb-2.pt-1.px-2.items-center
[:div.flex.flex-row.justify-between.flex-1
(for [color block-background-colors]
[:a.m-2.shadow-sm
{:on-click (fn [_e]
@@ -178,7 +176,24 @@
:on-click (fn [_e]
(editor-handler/remove-block-property! block-id "background-color"))}
[:div.heading-bg.remove "-"]]]]
[:div.flex.flex-row.justify-between.pb-2.pt-1.px-2.items-center
[:div.flex.flex-row.justify-between.flex-1
(for [i (range 1 7)]
(ui/button
(str "H" i)
:on-click (fn [_e]
(editor-handler/set-heading! block-id format i))
:intent "link"
:small? true))
(ui/button
"H-"
:title (t :remove-heading)
:on-click (fn [_e]
(editor-handler/remove-heading! block-id format))
:intent "link"
:small? true)]]
[:hr.menu-separator]
(ui/menu-link
@@ -232,17 +247,6 @@
[:hr.menu-separator]
(ui/menu-link
{:key "Convert heading"
:on-click (fn [_e]
(if heading?
(editor-handler/remove-block-property! block-id :heading)
(editor-handler/set-block-property! block-id :heading true)))}
(if heading?
"Convert back to a block"
"Convert to a heading")
nil)
(block-template block-id)
(if (srs/card-block? block)

View File

@@ -571,7 +571,7 @@
(rum/defcs box < rum/reactive
{:init (fn [state]
(assoc state ::heading-level (:heading-level (first (:rum/args state)))
(assoc state
::id (str (random-uuid))))
:did-mount (fn [state]
(state/set-editor-args! (:rum/args state))

View File

@@ -13,7 +13,7 @@
[frontend.fs :as fs]
[frontend.fs.sync :as fs-sync]
[frontend.handler.file-sync :refer [*beta-unavailable?] :as file-sync-handler]
[frontend.handler.notification :as notifications]
[frontend.handler.notification :as notification]
[frontend.handler.page :as page-handler]
[frontend.handler.repo :as repo-handler]
[frontend.handler.user :as user-handler]
@@ -61,7 +61,7 @@
:else
nil)
(.then #(do
(notifications/show! (str "Cloned to => " dest-dir) :success)
(notification/show! (str "Cloned to => " dest-dir) :success)
(web-nfs/ls-dir-files-with-path! dest-dir)
(repo-handler/remove-repo! {:url repo})
(close-fn)))

View File

@@ -18,7 +18,7 @@
[electron.ipc :as ipc]
[goog.object :as gobj]
[frontend.components.encryption :as encryption]
[frontend.encrypt :as e]
[frontend.encrypt :as encrypt]
[cljs.core.async :as async :refer [go <!]]
[frontend.handler.file-sync :as file-sync]
[reitit.frontend.easy :as rfe]))
@@ -60,7 +60,7 @@
(state/pub-event! [:graph/switch url])))
[:div.controls
(when (e/encrypted-db? url)
(when (encrypt/encrypted-db? url)
[:a.control {:title "Show encryption information about this graph"
:on-click (fn []
(if remote?

View File

@@ -1,4 +1,5 @@
(ns frontend.config
"App config and fns built on top of configuration"
(:require [clojure.set :as set]
[clojure.string :as string]
[frontend.mobile.util :as mobile-util]

View File

@@ -1,4 +1,5 @@
(ns frontend.core
"Entry ns for the mobile, browser and electron frontend apps"
(:require [rum.core :as rum]
[frontend.handler :as handler]
[frontend.handler.plugin :as plugin-handler]

View File

@@ -1,4 +1,5 @@
(ns frontend.date
"Date related utility fns"
(:require ["chrono-node" :as chrono]
[cljs-bean.core :as bean]
[cljs-time.coerce :as tc]

View File

@@ -1,4 +1,5 @@
(ns frontend.db
"Main entry ns for db related fns"
(:require [clojure.core.async :as async]
[datascript.core :as d]
[logseq.db.schema :as db-schema]

View File

@@ -1,4 +1,4 @@
(ns frontend.db.debug
(ns ^:no-doc frontend.db.debug
(:require [frontend.db.utils :as db-utils]
[frontend.db :as db]
[datascript.core :as d]

View File

@@ -1,4 +1,4 @@
(ns frontend.db.migrate
(ns ^:no-doc frontend.db.migrate
(:require [datascript.core :as d]))
(defn get-collapsed-blocks

View File

@@ -56,7 +56,6 @@
:block/created-at
:block/updated-at
:block/file
:block/heading-level
{:block/page [:db/id :block/name :block/original-name :block/journal-day]}
{:block/_parent ...}])

View File

@@ -1,4 +1,5 @@
(ns frontend.db.outliner
"Db related fns for the outliner module"
(:require [datascript.core :as d]))
(defn get-by-id

View File

@@ -1,4 +1,5 @@
(ns frontend.db.persist
"Handles operations to persisting db to disk or indexedDB"
(:require [frontend.util :as util]
[frontend.idb :as idb]
[frontend.config :as config]

View File

@@ -1,4 +1,5 @@
(ns frontend.db-mixins
"Rum mixins that depend on db"
(:require [frontend.db.react :as react]))
(def query

View File

@@ -1,4 +1,5 @@
(ns frontend.debug
"Macros that are useful for debugging"
(:refer-clojure :rename {defn core-defn}))
(defmacro defn [name & fdecl]

View File

@@ -1,4 +1,5 @@
(ns frontend.debug
"Fns that are useful for debugging"
(:require [cljs.pprint :as pprint]
[frontend.state :as state]))

View File

@@ -297,6 +297,7 @@
:white "Light"
:dark "Dark"
:remove-background "Remove background"
:remove-heading "Remove heading"
:open "Open"
:open-a-directory "Open a local directory"
:user/delete-account "Delete account"

View File

@@ -1,4 +1,4 @@
(ns frontend.diff
(ns ^:no-doc frontend.diff
(:require [clojure.string :as string]
["diff" :as jsdiff]
[goog.object :as gobj]

View File

@@ -1,4 +1,5 @@
(ns frontend.encrypt
"Encryption related fns for use with encryption feature and file sync"
(:require [logseq.graph-parser.utf8 :as utf8]
[frontend.db.utils :as db-utils]
[frontend.util :as util]

View File

@@ -1,4 +1,5 @@
(ns frontend.error
"Error related utility fns"
(:require [clojure.string :as string]))
(def ignored

View File

@@ -3,7 +3,7 @@
[cljs-bean.core :as bean]
[frontend.util :as util]
["/frontend/extensions/pdf/utils" :as js-utils]
[frontend.db :as front-db]
[frontend.db :as db]
[frontend.loader :refer [load]]
[clojure.string :as string]))
@@ -115,7 +115,7 @@
(mapv #(if (map? %) % (bean/->clj %)) its)))
(defn gen-uuid []
(front-db/new-block-id))
(db/new-block-id))
(defn js-load$
[url]
@@ -186,4 +186,4 @@
(fix-selection-text-breakline "he is 1\n8 years old")
(fix-selection-text-breakline "这是一个\n\n段落")
(fix-selection-text-breakline "これ\n\nは、段落")
(fix-selection-text-breakline "this is a te-\nst paragraph"))
(fix-selection-text-breakline "this is a te-\nst paragraph"))

View File

@@ -1,4 +1,5 @@
(ns frontend.external
"Handles importing from external services"
(:require [frontend.external.roam :refer [->Roam]]
[frontend.external.protocol :as protocol]))

View File

@@ -1,4 +1,4 @@
(ns frontend.external.protocol)
(ns ^:no-doc frontend.external.protocol)
(defprotocol External
(toMarkdownFiles [this content config]
@@ -7,4 +7,3 @@
;; Long-term goal:
;; (toMldocAst [this content])
;; (fromMldocAst [this ast])

View File

@@ -1,4 +1,5 @@
(ns frontend.external.roam
"Provides roam import by implementing the external protocol"
(:require [cljs-bean.core :as bean]
[frontend.external.protocol :as protocol]
[frontend.date :as date]

View File

@@ -1,4 +1,4 @@
(ns frontend.external.roam-export
(ns ^:no-doc frontend.external.roam-export
(:require [clojure.set :as s]
[clojure.string :as str]
[clojure.walk :as walk]

View File

@@ -1,4 +1,6 @@
(ns frontend.format
"Main ns for providing common operations on file content like conversion to html
and edn. Can handle org, markdown and adoc formats"
(:require [frontend.format.mldoc :refer [->MldocMode] :as mldoc]
[frontend.format.adoc :refer [->AdocMode]]
[frontend.format.protocol :as protocol]

View File

@@ -1,4 +1,5 @@
(ns frontend.format.adoc
"Partial implementation of format protocol for adoc that uses asciidoctor"
(:require [frontend.format.protocol :as protocol]
[frontend.loader :as loader]))

View File

@@ -1,5 +1,6 @@
(ns frontend.format.mldoc
"Mldoc code needed by app but not graph-parser"
"Contains any mldoc code needed by app but not graph-parser. Implements format
protocol for org and and markdown formats"
(:require [clojure.string :as string]
[frontend.format.protocol :as protocol]
[goog.object :as gobj]

View File

@@ -1,4 +1,4 @@
(ns frontend.format.protocol)
(ns ^:no-doc frontend.format.protocol)
(defprotocol Format
(toEdn [this content config])

View File

@@ -1,9 +1,11 @@
(ns frontend.fs
"System-component-like ns that provides common file operations for all
platforms by delegating to implementations of the fs protocol"
(:require [cljs-bean.core :as bean]
[frontend.config :as config]
[frontend.fs.nfs :as nfs]
[frontend.fs.node :as node]
[frontend.fs.capacitor-fs :as mobile]
[frontend.fs.capacitor-fs :as capacitor-fs]
[frontend.fs.bfs :as bfs]
[frontend.mobile.util :as mobile-util]
[frontend.fs.protocol :as protocol]
@@ -18,7 +20,7 @@
(defonce nfs-record (nfs/->Nfs))
(defonce bfs-record (bfs/->Bfs))
(defonce node-record (node/->Node))
(defonce mobile-record (mobile/->Capacitorfs))
(defonce mobile-record (capacitor-fs/->Capacitorfs))
(defn local-db?
[dir]

View File

@@ -1,4 +1,4 @@
(ns frontend.fs.bfs
(ns ^:no-doc frontend.fs.bfs
(:require [frontend.fs.protocol :as protocol]
[frontend.util :as util]
[promesa.core :as p]))

View File

@@ -1,4 +1,5 @@
(ns frontend.fs.capacitor-fs
"Implementation of fs protocol for mobile"
(:require ["@capacitor/filesystem" :refer [Encoding Filesystem]]
[cljs-bean.core :as bean]
[clojure.string :as string]

View File

@@ -1,4 +1,4 @@
(ns frontend.fs.nfs
(ns ^:no-doc frontend.fs.nfs
(:require [frontend.fs.protocol :as protocol]
[frontend.util :as util]
[clojure.string :as string]

View File

@@ -1,4 +1,5 @@
(ns frontend.fs.node
"Implementation of fs protocol for desktop"
(:require [clojure.string :as string]
[electron.ipc :as ipc]
[frontend.config :as config]

View File

@@ -1,4 +1,4 @@
(ns frontend.fs.protocol
(ns ^:no-doc frontend.fs.protocol
;; namespace local config to suppress 'new-path' of 'rename!'. clj-kondo's bug?
{:clj-kondo/config {:linters {:private-call {:level :off}}}})

View File

@@ -1,4 +1,5 @@
(ns frontend.fs.sync
"Main ns for providing file sync functionality"
(:require [cljs-http.client :as http]
[cljs-time.core :as t]
[cljs-time.format :as tf]
@@ -2850,10 +2851,11 @@
(when-let [sm ^SyncManager (state/get-file-sync-manager)]
(println "[SyncManager" (:graph-uuid sm) "]" "stopping")
(<! (-stop! sm))
(swap! state/state assoc :file-sync/sync-state {})
(println "[SyncManager" (:graph-uuid sm) "]" "stopped")
(state/set-file-sync-manager nil)
(clear-graph-progress! (:graph-uuid sm)))
(reset! current-sm-graph-uuid nil)))
(defn sync-need-password!

View File

@@ -1,4 +1,5 @@
(ns frontend.fs.watcher-handler
"Main ns that handles file watching events from electron's main process"
(:require [clojure.string :as string]
[frontend.config :as config]
[frontend.db :as db]

View File

@@ -1,4 +1,6 @@
(ns frontend.handler
"Main ns that handles application startup. Closest ns that we have to a
system. Contains a couple of small system components"
(:require [cljs.reader :refer [read-string]]
[clojure.string :as string]
[electron.ipc :as ipc]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.block
(ns ^:no-doc frontend.handler.block
(:require
[clojure.set :as set]
[clojure.string :as string]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.command-palette
"System-component-like ns for command palette's functionality"
(:require [cljs.spec.alpha :as s]
[frontend.modules.shortcut.data-helper :as shortcut-helper]
[frontend.spec :as spec]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.common
"Common fns for handlers"
(:require [cljs-bean.core :as bean]
[cljs.reader :as reader]
[clojure.string :as string]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.dnd
"Provides fns for drag n drop"
(:require [frontend.handler.editor :as editor-handler]
[frontend.modules.outliner.core :as outliner-core]
[frontend.modules.outliner.tree :as tree]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.draw
"Provides util handler fns for drawing"
(:refer-clojure :exclude [load-file])
(:require [frontend.config :as config]
[frontend.date :as date]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.editor
(ns ^:no-doc frontend.handler.editor
(:require ["path" :as path]
[clojure.set :as set]
[clojure.string :as string]
@@ -317,9 +317,10 @@
(block/parse-title-and-body uuid format pre-block? (:block/content block)))
properties (:block/properties block)
real-content (:block/content block)
content (if (and (seq properties) real-content (not= real-content content))
(property/with-built-in-properties properties content format)
content)
content (let [properties (if (= format :markdown) (dissoc properties :heading) properties)]
(if (and (seq properties) real-content (not= real-content content))
(property/with-built-in-properties properties content format)
content))
content (drawer/with-logbook block content)
content (with-timetracking block content)
first-block? (= left page)
@@ -614,7 +615,7 @@
(when edit-block?
(if (and replace-empty-target?
(string/blank? (:block/content last-block)))
;; 20ms of waiting for DOM to load the block, to avoid race condition.
;; 20ms of waiting for DOM to load the block, to avoid race condition.
;; It's ensuring good response under M1 pro
;; Used to be 10ms before, but is causing occasional failure on M1 pro with a full page of blocks,
;; or failing E2E with a small number of blocks.
@@ -3479,3 +3480,21 @@
;; has children
(first (:block/_parent (db/entity (:db/id block)))))
(util/collapsed? block)))
(defn set-heading!
[block-id format heading]
(if (= format :markdown)
(let [repo (state/get-current-repo)
block (db/entity [:block/uuid block-id])
content' (commands/set-markdown-heading (:block/content block) heading)]
(save-block! repo block-id content'))
(set-block-property! block-id "heading" heading)))
(defn remove-heading!
[block-id format]
(remove-block-property! block-id "heading")
(when (= format :markdown)
(let [repo (state/get-current-repo)
block (db/entity [:block/uuid block-id])
content' (commands/clear-markdown-heading (:block/content block))]
(save-block! repo block-id content'))))

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.editor.keyboards
(ns ^:no-doc frontend.handler.editor.keyboards
(:require [frontend.handler.editor :as editor-handler]
[frontend.mixins :as mixins]
[frontend.state :as state]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.editor.lifecycle
(ns ^:no-doc frontend.handler.editor.lifecycle
(:require [frontend.handler.editor :as editor-handler :refer [get-state]]
[frontend.handler.editor.keyboards :as keyboards-handler]
[frontend.state :as state :refer [sub]]

View File

@@ -1,4 +1,7 @@
(ns frontend.handler.events
"System-component-like ns that defines named events and listens on a
core.async channel to handle them. Any part of the system can dispatch
one of these events using state/pub-event!"
(:refer-clojure :exclude [run!])
(:require ["@capacitor/filesystem" :refer [Directory Filesystem]]
[clojure.core.async :as async]
@@ -10,7 +13,7 @@
[frontend.components.diff :as diff]
[frontend.components.git :as git-component]
[frontend.components.plugins :as plugin]
[frontend.components.search :as search]
[frontend.components.search :as component-search]
[frontend.components.shell :as shell]
[frontend.config :as config]
[frontend.context.i18n :refer [t]]
@@ -43,7 +46,7 @@
[frontend.modules.instrumentation.posthog :as posthog]
[frontend.modules.outliner.file :as outliner-file]
[frontend.modules.shortcut.core :as st]
[frontend.search :as search-db]
[frontend.search :as search]
[frontend.state :as state]
[frontend.ui :as ui]
[frontend.util :as util]
@@ -330,7 +333,7 @@
(state/set-modal! shell/shell)))
(defmethod handle :go/search [_]
(state/set-modal! search/search-modal
(state/set-modal! component-search/search-modal
{:fullscreen? false
:close-btn? false}))
@@ -453,7 +456,7 @@
(try
(update-file-path deprecated-repo current-repo deprecated-app-id current-app-id)
(db-persist/delete-graph! deprecated-repo)
(search-db/remove-db! deprecated-repo)
(search/remove-db! deprecated-repo)
(state/delete-repo! {:url deprecated-repo})
(state/add-repo! {:url current-repo :nfs? true})
(catch :default e
@@ -608,6 +611,10 @@
template
{:target page}))))))
(defmethod handle :editor/set-org-mode-heading [[_ block heading]]
(when-let [id (:block/uuid block)]
(editor-handler/set-heading! id :org heading)))
(defmethod handle :file-sync-graph/restore-file [[_ graph page-entity content]]
(when (db/get-db graph)
(let [file (:block/file page-entity)]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.export
(ns ^:no-doc frontend.handler.export
(:require ["@capacitor/filesystem" :refer [Encoding Filesystem]]
[cljs.pprint :as pprint]
[clojure.set :as s]
@@ -482,7 +482,6 @@
[:block/id
:block/page-name
:block/properties
:block/heading-level
:block/format
:block/children
:block/content]))})

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.external
"Fns related to import from external services"
(:require [clojure.edn :as edn]
[clojure.walk :as walk]
[frontend.external :as external]
@@ -14,7 +15,7 @@
[logseq.graph-parser.mldoc :as gp-mldoc]
[logseq.graph-parser.util :as gp-util]
[logseq.graph-parser.date-time-util :as date-time-util]
[frontend.handler.page :as page]
[frontend.handler.page :as page-handler]
[frontend.handler.editor :as editor]
[frontend.handler.notification :as notification]
[frontend.util :as util]
@@ -87,7 +88,7 @@
(mapv editor/wrap-parse-block))
page-name (:title headers)]
(when (not (db/page-exists? page-name))
(page/create! page-name {:redirect? false}))
(page-handler/create! page-name {:redirect? false}))
(let [page-block (db/entity [:block/name (util/page-name-sanity-lc page-name)])
children (:block/_parent page-block)
blocks (db/sort-by-left children page-block)
@@ -115,13 +116,13 @@
[{:keys [uuid title children] :as tree}]
(let [has-children? (seq children)
page-format (some-> tree (:children) (first) (:format))]
(try (page/create! title {:redirect? false
:format page-format
:uuid uuid})
(catch :default e
(notification/show! (str "Error happens when creating page " title ":\n"
e
"\nSkipped and continue the remaining import.") :error)))
(try (page-handler/create! title {:redirect? false
:format page-format
:uuid uuid})
(catch :default e
(notification/show! (str "Error happens when creating page " title ":\n"
e
"\nSkipped and continue the remaining import.") :error)))
(when has-children?
(let [page-block (db/entity [:block/name (util/page-name-sanity-lc title)])
first-child (first (:block/_left page-block)) ]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.file
"Provides util handler fns for files"
(:refer-clojure :exclude [load-file])
(:require [frontend.config :as config]
[frontend.db :as db]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.file-sync
"Provides util handler fns for file sync"
(:require ["path" :as path]
[cljs-time.format :as tf]
[cljs.core.async :as async :refer [go <!]]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.graph
"Provides util handler fns for graph view"
(:require [clojure.set :as set]
[clojure.string :as string]
[frontend.db :as db]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.history
(ns ^:no-doc frontend.handler.history
(:require [frontend.db :as db]
[frontend.handler.editor :as editor]
[frontend.modules.editor.undo-redo :as undo-redo]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.image
(ns ^:no-doc frontend.handler.image
(:require [clojure.string :as string]
[frontend.config :as config]
[frontend.fs :as fs]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.journal
(ns ^:no-doc frontend.handler.journal
(:require [frontend.date :as date]
[frontend.handler.route :as route-handler]
[frontend.state :as state]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.metadata
"System-component-like ns that manages writing to pages-metadata.edn"
(:require [cljs.reader :as reader]
[cljs.pprint]
[clojure.string :as string]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.mobile.swipe
(ns ^:no-doc frontend.handler.mobile.swipe
(:require [cljs-bean.core :as bean]
[frontend.state :as state]
[frontend.util :as util]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.notification
"Provides notification related functionality"
(:require [frontend.state :as state]
[frontend.util :as util]))

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.page
"Provides util handler fns for pages"
(:require [cljs.reader :as reader]
[clojure.string :as string]
[clojure.walk :as walk]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.paste
(ns ^:no-doc frontend.handler.paste
(:require [frontend.state :as state]
[frontend.db :as db]
[frontend.format.block :as block]

View File

@@ -1,10 +1,11 @@
(ns frontend.handler.plugin
"System-component-like ns that provides all high level plugin functionality"
(:require [promesa.core :as p]
[rum.core :as rum]
[frontend.util :as util]
[clojure.walk :as walk]
[logseq.graph-parser.mldoc :as gp-mldoc]
[frontend.handler.notification :as notifications]
[frontend.handler.notification :as notification]
[camel-snake-kebab.core :as csk]
[frontend.state :as state]
[medley.core :as medley]
@@ -202,7 +203,7 @@
(.reload pl)
#(do
;;(if theme (select-a-plugin-theme id))
(notifications/show!
(notification/show!
(str (t :plugin/update) (t :plugins) ": " name " - " (.-version (.-options pl))) :success)
(state/consume-updates-coming-plugin payload true))))
@@ -210,7 +211,7 @@
(p/then
(js/LSPluginCore.register (bean/->js {:key id :url dst}))
(fn [] (when theme (js/setTimeout #(select-a-plugin-theme id) 300))))
(notifications/show!
(notification/show!
(str (t :plugin/installed) (t :plugins) ": " name) :success)))))
:error
@@ -232,7 +233,7 @@
(state/consume-updates-coming-plugin payload true))
;; notify human tips
(notifications/show!
(notification/show!
(str
(if (= :error type) "[Error]" "")
(str "<" (:id payload) "> ")
@@ -446,7 +447,7 @@
(state/set-state! :plugin/active-readme [content item])
(state/set-sub-modal! (fn [_] (display))))
(p/catch #(do (js/console.warn %)
(notifications/show! "No README content." :warn))))
(notification/show! "No README content." :warn))))
;; market
(state/set-sub-modal! (fn [_] (display repo nil))))))

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.query
"Provides util handler fns for query"
(:require [clojure.walk :as walk]))
(defn normalize-query-function

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.recent
"Fns related to recent pages feature"
(:require [frontend.db :as db]))
(defn add-page-to-recent!

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.repeated
"Provides fns related to schedule and deadline"
(:require [cljs-time.core :as t]
[cljs-time.local :as tl]
[cljs-time.format :as tf]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.repo
"System-component-like ns that manages user's repos/graphs"
(:refer-clojure :exclude [clone])
(:require [clojure.string :as string]
[frontend.config :as config]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.route
(ns ^:no-doc frontend.handler.route
(:require [clojure.string :as string]
[frontend.config :as config]
[frontend.date :as date]

View File

@@ -1,8 +1,9 @@
(ns frontend.handler.search
"Provides util handler fns for search"
(:require [clojure.string :as string]
[frontend.config :as config]
[frontend.db :as db]
[frontend.handler.notification :as notification-handler]
[frontend.handler.notification :as notification]
[frontend.search :as search]
[frontend.state :as state]
[frontend.util :as util]
@@ -121,7 +122,7 @@
(println "Starting to rebuild search indices!")
(p/let [_ (search/rebuild-indices!)]
(when notice?
(notification-handler/show!
(notification/show!
"Search indices rebuilt successfully!"
:success)))))
@@ -133,6 +134,6 @@
(when cache-stale?
(js/console.log "cache stale: " repo)
(p/let [_ (search/rebuild-indices! repo)]
(notification-handler/show!
(notification/show!
"Stale search cache detected. Search indices rebuilt successfully!"
:success))))))

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.shell
"Git related handler fns"
(:require [electron.ipc :as ipc]
[clojure.string :as string]
[logseq.graph-parser.util :as gp-util]

View File

@@ -1,4 +1,4 @@
(ns frontend.handler.ui
(ns ^:no-doc frontend.handler.ui
(:require [cljs-time.core :refer [plus days weeks]]
[dommy.core :as dom]
[frontend.util :as util]

View File

@@ -1,4 +1,5 @@
(ns frontend.handler.user
"Provides user related handler fns like login and logout"
(:require [frontend.config :as config]
[frontend.handler.config :as config-handler]
[frontend.state :as state]

View File

@@ -1,4 +1,5 @@
(ns frontend.idb
"System-component-like ns that provides indexedDB functionality"
(:require ["/frontend/idbkv" :as idb-keyval :refer [Store]]
[clojure.string :as string]
[frontend.config :as config]

View File

@@ -1,4 +1,5 @@
(ns frontend.image
"Image related utility fns"
(:require ["/frontend/exif" :as exif]
[clojure.string :as string]
[frontend.date :as date]
@@ -84,19 +85,4 @@
(string/join "_"))
file-name (str ymd "_" (gobj/get file "name"))]
(when (= 0 (.indexOf file-type "image/"))
(file-handler file file-name file-type)
;; (let [img (js/Image.)]
;; (set! (.-onload img)
;; (fn []
;; (get-orientation img
;; (fn [^js off-canvas]
;; (let [file-form-data ^js (js/FormData.)
;; data-url (.toDataURL off-canvas)
;; blob (blob/blob data-url)]
;; (.append file-form-data "file" blob)
;; (file-cb file file-form-data file-name file-type)))
;; max-width
;; max-height)))
;; (set! (.-src img)
;; (create-object-url file)))
))))
(file-handler file file-name file-type)))))

View File

@@ -1,4 +1,5 @@
(ns frontend.loader
"Provides fns related to loading js assets"
(:require [goog.net.jsloader :as jsloader]
[goog.html.legacyconversions :as conv]
[cljs-bean.core :as bean]))

View File

@@ -1,8 +1,11 @@
(ns frontend.log
"System-component-like ns that encapsulates logging functionality"
(:require [lambdaisland.glogi :as log]
[lambdaisland.glogi.console :as glogi-console]
[frontend.config :as config]))
;; TODO: Move code below into a fn to behave like a system component
;; instead of having no control over its behavior at require time
(glogi-console/install!)
(if config/dev?

View File

@@ -1,4 +1,5 @@
(ns frontend.mixins
"Rum mixins for use in components"
(:require [rum.core :as rum]
[goog.dom :as dom]
[frontend.util :refer [profile] :as util]

View File

@@ -52,13 +52,6 @@
(.scrollBy (util/app-scroll-container-node) #js {:top (- 10 delta)})))
[:div.action-bar
[:div.action-bar-commands
(when-not (= (:block/format block) :org)
(action-command "heading" "Heading"
#(let [properties (:block/properties block)
heading? (true? (:heading properties))]
(if heading?
(editor-handler/remove-block-property! uuid :heading)
(editor-handler/set-block-property! uuid :heading true)))))
(action-command "infinity" "Card" #(srs/make-block-a-card! (:block/uuid block)))
(action-command "copy" "Copy" #(editor-handler/copy-selection-blocks false))
(action-command "cut" "Cut" #(editor-handler/cut-selection-blocks true))

View File

@@ -1,9 +1,10 @@
(ns frontend.mobile.core
"Main ns for handling mobile start"
(:require ["@capacitor/app" :refer [^js App]]
["@capacitor/keyboard" :refer [^js Keyboard]]
[clojure.string :as string]
[promesa.core :as p]
[frontend.fs.capacitor-fs :as mobile-fs]
[frontend.fs.capacitor-fs :as capacitor-fs]
[frontend.handler.editor :as editor-handler]
[frontend.mobile.deeplink :as deeplink]
[frontend.mobile.intent :as intent]
@@ -22,7 +23,7 @@
(defn- ios-init
"Initialize iOS-specified event listeners"
[]
(p/let [path (mobile-fs/ios-ensure-documents!)]
(p/let [path (capacitor-fs/ios-ensure-documents!)]
(println "iOS container path: " (js->clj path)))
(state/pub-event! [:validate-appId])

View File

@@ -29,13 +29,14 @@
content))
(defn transform-content
[{:block/keys [collapsed? format pre-block? unordered content heading-level left page parent]} level {:keys [heading-to-list?]}]
(let [content (or content "")
[{:block/keys [collapsed? format pre-block? unordered content left page parent properties]} level {:keys [heading-to-list?]}]
(let [heading (:heading properties)
markdown? (= :markdown format)
content (or content "")
pre-block? (or pre-block?
(and (= page parent left) ; first block
(= :markdown format)
markdown?
(string/includes? (first (string/split-lines content)) ":: ")))
markdown? (= format :markdown)
content (cond
pre-block?
(let [content (string/trim content)]
@@ -45,7 +46,7 @@
(let [markdown-top-heading? (and markdown?
(= parent page)
(not unordered)
heading-level)
heading)
[prefix spaces-tabs]
(cond
(= format :org)
@@ -57,10 +58,10 @@
["" ""]
:else
(let [level (if (and heading-to-list? heading-level)
(if (> heading-level 1)
(dec heading-level)
heading-level)
(let [level (if (and heading-to-list? heading)
(if (> heading 1)
(dec heading)
heading)
level)
spaces-tabs (->>
(repeat (dec level) (state/get-export-bullet-indentation))

View File

@@ -1,4 +1,4 @@
(ns frontend.namespaces
(ns ^:no-doc frontend.namespaces
#?(:cljs (:require-macros [frontend.namespaces])))
;; copy from https://github.com/clj-commons/potemkin/issues/31#issuecomment-110689951

View File

@@ -1,4 +1,5 @@
(ns frontend.page
"Provides root component for both Logseq app and publishing build"
(:require [rum.core :as rum]
[frontend.state :as state]
[frontend.ui :as ui]

View File

@@ -1,4 +1,5 @@
(ns frontend.publishing
"Entry ns for publishing build. Handles primary publishing app behaviors"
(:require [frontend.state :as state]
[datascript.core :as d]
[frontend.db :as db]

View File

@@ -1,4 +1,4 @@
(ns frontend.publishing.html
(ns ^:no-doc frontend.publishing.html
(:require-macros [hiccups.core])
(:require [frontend.state :as state]
[frontend.util :as util]

View File

@@ -1,4 +1,4 @@
(ns frontend.regex
(ns ^:no-doc frontend.regex
(:require [clojure.string :as string]))
(def re-specials #"([\-\/\\\^\$\*\+\?\.\(\)\|\[\]\{\}])")

View File

@@ -1,4 +1,5 @@
(ns frontend.routes
"Defines routes for use with reitit router"
(:require [frontend.components.file :as file]
[frontend.components.home :as home]
[frontend.components.journal :as journal]

View File

@@ -1,4 +1,5 @@
(ns frontend.rum
"Utility fns for rum"
(:require [clojure.string :as s]
[clojure.set :as set]
[clojure.walk :as w]
@@ -33,6 +34,7 @@
x))
data)))
;; TODO: Replace this with rum's built in rum.core/adapt-class
;; adapted from https://github.com/tonsky/rum/issues/20
(defn adapt-class
([react-class]

Some files were not shown because too many files have changed in this diff Show More