diff --git a/.carve/ignore b/.carve/ignore index 5a6c3ee8fd..f0efb24db7 100644 --- a/.carve/ignore +++ b/.carve/ignore @@ -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 \ No newline at end of file +frontend.fs.sync/stop-debug-print-sync-events-loop diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index f770b65063..e21c286e18 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -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}} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0cf4fd42c2..14df37613e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/bb.edn b/bb.edn index d4f73bc2a1..e5ff62756d 100644 --- a/bb.edn +++ b/bb.edn @@ -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)"}}} diff --git a/deps/db/src/logseq/db/schema.cljs b/deps/db/src/logseq/db/schema.cljs index 1997efc004..6b48fe5119 100644 --- a/deps/db/src/logseq/db/schema.cljs +++ b/deps/db/src/logseq/db/schema.cljs @@ -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 diff --git a/deps/graph-parser/src/logseq/graph_parser/block.cljs b/deps/graph-parser/src/logseq/graph_parser/block.cljs index 974e0ee9cc..c7bdd0479a 100644 --- a/deps/graph-parser/src/logseq/graph_parser/block.cljs +++ b/deps/graph-parser/src/logseq/graph_parser/block.cljs @@ -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))) diff --git a/deps/graph-parser/src/logseq/graph_parser/test/docs_graph_helper.cljs b/deps/graph-parser/src/logseq/graph_parser/test/docs_graph_helper.cljs index ac93c623cc..9474895bbb 100644 --- a/deps/graph-parser/src/logseq/graph_parser/test/docs_graph_helper.cljs +++ b/deps/graph-parser/src/logseq/graph_parser/test/docs_graph_helper.cljs @@ -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 diff --git a/docs/dev-practices.md b/docs/dev-practices.md index 71c913b13d..733f25df5d 100644 --- a/docs/dev-practices.md +++ b/docs/dev-practices.md @@ -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 diff --git a/package.json b/package.json index 86f3a7614d..411bb9ae21 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/src/logseq/tasks/dev.clj b/scripts/src/logseq/tasks/dev.clj index 950bc3530c..998b6dc1ca 100644 --- a/scripts/src/logseq/tasks/dev.clj +++ b/scripts/src/logseq/tasks/dev.clj @@ -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))) diff --git a/src/main/electron/ipc.cljs b/src/main/electron/ipc.cljs index e876597d79..9493e71af2 100644 --- a/src/main/electron/ipc.cljs +++ b/src/main/electron/ipc.cljs @@ -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])) diff --git a/src/main/electron/listener.cljs b/src/main/electron/listener.cljs index c0d1793998..a5acf2bdca 100644 --- a/src/main/electron/listener.cljs +++ b/src/main/electron/listener.cljs @@ -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] diff --git a/src/main/frontend/blob.cljs b/src/main/frontend/blob.cljs deleted file mode 100644 index 6232b91206..0000000000 --- a/src/main/frontend/blob.cljs +++ /dev/null @@ -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)) diff --git a/src/main/frontend/commands.cljs b/src/main/frontend/commands.cljs index e6be24c6e8..2edea29f82 100644 --- a/src/main/frontend/commands.cljs +++ b/src/main/frontend/commands.cljs @@ -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)) diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index 481d48e50f..95a5d229cd 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -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?))] diff --git a/src/main/frontend/components/content.cljs b/src/main/frontend/components/content.cljs index 61d61ee22d..9006095b53 100644 --- a/src/main/frontend/components/content.cljs +++ b/src/main/frontend/components/content.cljs @@ -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) diff --git a/src/main/frontend/components/editor.cljs b/src/main/frontend/components/editor.cljs index 774b7299f4..e24d9495ae 100644 --- a/src/main/frontend/components/editor.cljs +++ b/src/main/frontend/components/editor.cljs @@ -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)) diff --git a/src/main/frontend/components/file_sync.cljs b/src/main/frontend/components/file_sync.cljs index aa758271c0..a778e3e6e4 100644 --- a/src/main/frontend/components/file_sync.cljs +++ b/src/main/frontend/components/file_sync.cljs @@ -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))) diff --git a/src/main/frontend/components/repo.cljs b/src/main/frontend/components/repo.cljs index 331f9649eb..fe3a1108e8 100644 --- a/src/main/frontend/components/repo.cljs +++ b/src/main/frontend/components/repo.cljs @@ -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 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")) \ No newline at end of file + (fix-selection-text-breakline "this is a te-\nst paragraph")) diff --git a/src/main/frontend/external.cljs b/src/main/frontend/external.cljs index 0c8523d9b0..39e8524e85 100644 --- a/src/main/frontend/external.cljs +++ b/src/main/frontend/external.cljs @@ -1,4 +1,5 @@ (ns frontend.external + "Handles importing from external services" (:require [frontend.external.roam :refer [->Roam]] [frontend.external.protocol :as protocol])) diff --git a/src/main/frontend/external/protocol.cljc b/src/main/frontend/external/protocol.cljc index 894d2f0acc..388fe4e1f7 100644 --- a/src/main/frontend/external/protocol.cljc +++ b/src/main/frontend/external/protocol.cljc @@ -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]) - diff --git a/src/main/frontend/external/roam.cljs b/src/main/frontend/external/roam.cljs index be1ca47b46..6e06429936 100644 --- a/src/main/frontend/external/roam.cljs +++ b/src/main/frontend/external/roam.cljs @@ -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] diff --git a/src/main/frontend/external/roam_export.cljs b/src/main/frontend/external/roam_export.cljs index af03b7a648..f9ef2deba7 100644 --- a/src/main/frontend/external/roam_export.cljs +++ b/src/main/frontend/external/roam_export.cljs @@ -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] diff --git a/src/main/frontend/format.cljs b/src/main/frontend/format.cljs index dc8a89bdb5..e8671a79cc 100644 --- a/src/main/frontend/format.cljs +++ b/src/main/frontend/format.cljs @@ -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] diff --git a/src/main/frontend/format/adoc.cljs b/src/main/frontend/format/adoc.cljs index 1ab1cd4316..068ebb30bf 100644 --- a/src/main/frontend/format/adoc.cljs +++ b/src/main/frontend/format/adoc.cljs @@ -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])) diff --git a/src/main/frontend/format/mldoc.cljs b/src/main/frontend/format/mldoc.cljs index fd4b551e11..9ae43cb17f 100644 --- a/src/main/frontend/format/mldoc.cljs +++ b/src/main/frontend/format/mldoc.cljs @@ -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] diff --git a/src/main/frontend/format/protocol.cljs b/src/main/frontend/format/protocol.cljs index a7e2542077..9bb091dfca 100644 --- a/src/main/frontend/format/protocol.cljs +++ b/src/main/frontend/format/protocol.cljs @@ -1,4 +1,4 @@ -(ns frontend.format.protocol) +(ns ^:no-doc frontend.format.protocol) (defprotocol Format (toEdn [this content config]) diff --git a/src/main/frontend/fs.cljs b/src/main/frontend/fs.cljs index c5881f85cd..a87d0f5bfb 100644 --- a/src/main/frontend/fs.cljs +++ b/src/main/frontend/fs.cljs @@ -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] diff --git a/src/main/frontend/fs/bfs.cljs b/src/main/frontend/fs/bfs.cljs index 7e04a0ab40..30e3cb9e78 100644 --- a/src/main/frontend/fs/bfs.cljs +++ b/src/main/frontend/fs/bfs.cljs @@ -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])) diff --git a/src/main/frontend/fs/capacitor_fs.cljs b/src/main/frontend/fs/capacitor_fs.cljs index 5c8f23ad41..b9d778e6ea 100644 --- a/src/main/frontend/fs/capacitor_fs.cljs +++ b/src/main/frontend/fs/capacitor_fs.cljs @@ -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] diff --git a/src/main/frontend/fs/nfs.cljs b/src/main/frontend/fs/nfs.cljs index 453abc26e1..26bb9bd07f 100644 --- a/src/main/frontend/fs/nfs.cljs +++ b/src/main/frontend/fs/nfs.cljs @@ -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] diff --git a/src/main/frontend/fs/node.cljs b/src/main/frontend/fs/node.cljs index a0a99a7f62..43b978d54c 100644 --- a/src/main/frontend/fs/node.cljs +++ b/src/main/frontend/fs/node.cljs @@ -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] diff --git a/src/main/frontend/fs/protocol.cljs b/src/main/frontend/fs/protocol.cljs index efc4fda703..305d770e21 100644 --- a/src/main/frontend/fs/protocol.cljs +++ b/src/main/frontend/fs/protocol.cljs @@ -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}}}}) diff --git a/src/main/frontend/fs/sync.cljs b/src/main/frontend/fs/sync.cljs index 966023a0ae..6d7d46cb6c 100644 --- a/src/main/frontend/fs/sync.cljs +++ b/src/main/frontend/fs/sync.cljs @@ -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") ( 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)) ] diff --git a/src/main/frontend/handler/file.cljs b/src/main/frontend/handler/file.cljs index 75aad4bed0..4f6b7aeac3 100644 --- a/src/main/frontend/handler/file.cljs +++ b/src/main/frontend/handler/file.cljs @@ -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] diff --git a/src/main/frontend/handler/file_sync.cljs b/src/main/frontend/handler/file_sync.cljs index 335f36343f..b13c50529c 100644 --- a/src/main/frontend/handler/file_sync.cljs +++ b/src/main/frontend/handler/file_sync.cljs @@ -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 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)))))) diff --git a/src/main/frontend/handler/query.cljs b/src/main/frontend/handler/query.cljs index 72e28fca7b..ab9165013d 100644 --- a/src/main/frontend/handler/query.cljs +++ b/src/main/frontend/handler/query.cljs @@ -1,4 +1,5 @@ (ns frontend.handler.query + "Provides util handler fns for query" (:require [clojure.walk :as walk])) (defn normalize-query-function diff --git a/src/main/frontend/handler/recent.cljs b/src/main/frontend/handler/recent.cljs index c6787703e2..07624390b7 100644 --- a/src/main/frontend/handler/recent.cljs +++ b/src/main/frontend/handler/recent.cljs @@ -1,4 +1,5 @@ (ns frontend.handler.recent + "Fns related to recent pages feature" (:require [frontend.db :as db])) (defn add-page-to-recent! diff --git a/src/main/frontend/handler/repeated.cljs b/src/main/frontend/handler/repeated.cljs index f7a94c66fe..99348d2a5d 100644 --- a/src/main/frontend/handler/repeated.cljs +++ b/src/main/frontend/handler/repeated.cljs @@ -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] diff --git a/src/main/frontend/handler/repo.cljs b/src/main/frontend/handler/repo.cljs index 46821def09..fbc59bc27e 100644 --- a/src/main/frontend/handler/repo.cljs +++ b/src/main/frontend/handler/repo.cljs @@ -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] diff --git a/src/main/frontend/handler/route.cljs b/src/main/frontend/handler/route.cljs index af61413a8b..65bf04c452 100644 --- a/src/main/frontend/handler/route.cljs +++ b/src/main/frontend/handler/route.cljs @@ -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] diff --git a/src/main/frontend/handler/search.cljs b/src/main/frontend/handler/search.cljs index e00e1cacd8..a0d65d7394 100644 --- a/src/main/frontend/handler/search.cljs +++ b/src/main/frontend/handler/search.cljs @@ -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)))))) diff --git a/src/main/frontend/handler/shell.cljs b/src/main/frontend/handler/shell.cljs index 5976b251a7..05ff667b1f 100644 --- a/src/main/frontend/handler/shell.cljs +++ b/src/main/frontend/handler/shell.cljs @@ -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] diff --git a/src/main/frontend/handler/ui.cljs b/src/main/frontend/handler/ui.cljs index 0ed64b848a..894030faae 100644 --- a/src/main/frontend/handler/ui.cljs +++ b/src/main/frontend/handler/ui.cljs @@ -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] diff --git a/src/main/frontend/handler/user.cljs b/src/main/frontend/handler/user.cljs index 077d3e0399..8fa5821bf8 100644 --- a/src/main/frontend/handler/user.cljs +++ b/src/main/frontend/handler/user.cljs @@ -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] diff --git a/src/main/frontend/idb.cljs b/src/main/frontend/idb.cljs index 566a378bc9..271a5d6319 100644 --- a/src/main/frontend/idb.cljs +++ b/src/main/frontend/idb.cljs @@ -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] diff --git a/src/main/frontend/image.cljs b/src/main/frontend/image.cljs index b1abe335c3..20aaa30cba 100644 --- a/src/main/frontend/image.cljs +++ b/src/main/frontend/image.cljs @@ -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))))) diff --git a/src/main/frontend/loader.cljs b/src/main/frontend/loader.cljs index 6e2e147481..03b6aa7cb4 100644 --- a/src/main/frontend/loader.cljs +++ b/src/main/frontend/loader.cljs @@ -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])) diff --git a/src/main/frontend/log.cljs b/src/main/frontend/log.cljs index 8e301128e6..409f0978ff 100644 --- a/src/main/frontend/log.cljs +++ b/src/main/frontend/log.cljs @@ -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? diff --git a/src/main/frontend/mixins.cljs b/src/main/frontend/mixins.cljs index 338ff2036a..40fdc76bec 100644 --- a/src/main/frontend/mixins.cljs +++ b/src/main/frontend/mixins.cljs @@ -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] diff --git a/src/main/frontend/mobile/action_bar.cljs b/src/main/frontend/mobile/action_bar.cljs index e754fcaa58..ec3d540e45 100644 --- a/src/main/frontend/mobile/action_bar.cljs +++ b/src/main/frontend/mobile/action_bar.cljs @@ -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)) diff --git a/src/main/frontend/mobile/core.cljs b/src/main/frontend/mobile/core.cljs index 561ee3b623..c608bd5481 100644 --- a/src/main/frontend/mobile/core.cljs +++ b/src/main/frontend/mobile/core.cljs @@ -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]) diff --git a/src/main/frontend/modules/file/core.cljs b/src/main/frontend/modules/file/core.cljs index df89d73be3..8931c41e45 100644 --- a/src/main/frontend/modules/file/core.cljs +++ b/src/main/frontend/modules/file/core.cljs @@ -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)) diff --git a/src/main/frontend/namespaces.cljc b/src/main/frontend/namespaces.cljc index efc971028c..bbacda00de 100644 --- a/src/main/frontend/namespaces.cljc +++ b/src/main/frontend/namespaces.cljc @@ -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 diff --git a/src/main/frontend/page.cljs b/src/main/frontend/page.cljs index a73bf0da9d..1d388be234 100644 --- a/src/main/frontend/page.cljs +++ b/src/main/frontend/page.cljs @@ -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] diff --git a/src/main/frontend/publishing.cljs b/src/main/frontend/publishing.cljs index b1f67d0e16..fae90dd3c3 100644 --- a/src/main/frontend/publishing.cljs +++ b/src/main/frontend/publishing.cljs @@ -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] diff --git a/src/main/frontend/publishing/html.cljs b/src/main/frontend/publishing/html.cljs index 4ee3411783..2432c9daeb 100644 --- a/src/main/frontend/publishing/html.cljs +++ b/src/main/frontend/publishing/html.cljs @@ -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] diff --git a/src/main/frontend/regex.cljc b/src/main/frontend/regex.cljc index 5711afa932..2d8c9770b6 100644 --- a/src/main/frontend/regex.cljc +++ b/src/main/frontend/regex.cljc @@ -1,4 +1,4 @@ -(ns frontend.regex +(ns ^:no-doc frontend.regex (:require [clojure.string :as string])) (def re-specials #"([\-\/\\\^\$\*\+\?\.\(\)\|\[\]\{\}])") diff --git a/src/main/frontend/routes.cljs b/src/main/frontend/routes.cljs index 9ad0ad3e95..834efcef20 100644 --- a/src/main/frontend/routes.cljs +++ b/src/main/frontend/routes.cljs @@ -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] diff --git a/src/main/frontend/rum.cljs b/src/main/frontend/rum.cljs index 09022fbbb4..05a1fadcd6 100644 --- a/src/main/frontend/rum.cljs +++ b/src/main/frontend/rum.cljs @@ -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] diff --git a/src/main/frontend/search.cljs b/src/main/frontend/search.cljs index a8a4406b6f..3d6df542c8 100644 --- a/src/main/frontend/search.cljs +++ b/src/main/frontend/search.cljs @@ -1,4 +1,6 @@ (ns frontend.search + "Provides search functionality for a number of features including Cmd-K + search. Most of these fns depend on the search protocol" (:require [cljs-bean.core :as bean] [clojure.string :as string] [logseq.graph-parser.config :as gp-config] diff --git a/src/main/frontend/search/browser.cljs b/src/main/frontend/search/browser.cljs index ebbd552c7b..fe41d2f39c 100644 --- a/src/main/frontend/search/browser.cljs +++ b/src/main/frontend/search/browser.cljs @@ -1,4 +1,5 @@ (ns frontend.search.browser + "Browser implementation of search protocol" (:require [cljs-bean.core :as bean] [frontend.search.db :as search-db :refer [indices]] [frontend.search.protocol :as protocol] diff --git a/src/main/frontend/search/db.cljs b/src/main/frontend/search/db.cljs index f5b655d8bb..22c401574a 100644 --- a/src/main/frontend/search/db.cljs +++ b/src/main/frontend/search/db.cljs @@ -1,4 +1,4 @@ -(ns frontend.search.db +(ns ^:no-doc frontend.search.db (:require [cljs-bean.core :as bean] [clojure.string :as string] [frontend.db :as db] diff --git a/src/main/frontend/search/node.cljs b/src/main/frontend/search/node.cljs index 6c8d9cd2ac..a37927a47a 100644 --- a/src/main/frontend/search/node.cljs +++ b/src/main/frontend/search/node.cljs @@ -1,4 +1,5 @@ (ns frontend.search.node + "NodeJS implementation of search protocol" (:require [cljs-bean.core :as bean] [electron.ipc :as ipc] [frontend.search.db :as search-db] diff --git a/src/main/frontend/search/protocol.cljs b/src/main/frontend/search/protocol.cljs index 6489dcac35..30d874b30d 100644 --- a/src/main/frontend/search/protocol.cljs +++ b/src/main/frontend/search/protocol.cljs @@ -1,4 +1,4 @@ -(ns frontend.search.protocol) +(ns ^:no-doc frontend.search.protocol) (defprotocol Engine (query [this q option]) diff --git a/src/main/frontend/security.cljs b/src/main/frontend/security.cljs index 6936b5fb7b..1378f25dc4 100644 --- a/src/main/frontend/security.cljs +++ b/src/main/frontend/security.cljs @@ -1,4 +1,5 @@ (ns frontend.security + "Provide security focused fns like preventing XSS attacks" (:require [clojure.walk :as walk] [frontend.util :as util])) diff --git a/src/main/frontend/spec.cljs b/src/main/frontend/spec.cljs index 6876b8ddb1..b0a54f3192 100644 --- a/src/main/frontend/spec.cljs +++ b/src/main/frontend/spec.cljs @@ -1,4 +1,5 @@ (ns frontend.spec + "Clojure spec related setup and helpers" (:require [cljs.spec.alpha :as s] [frontend.config :as config] [lambdaisland.glogi :as log] diff --git a/src/main/frontend/state.cljs b/src/main/frontend/state.cljs index b313315792..fb62a37f03 100644 --- a/src/main/frontend/state.cljs +++ b/src/main/frontend/state.cljs @@ -1,4 +1,6 @@ (ns frontend.state + "Provides main application state, fns associated to set and state based rum + cursors" (:require [cljs-bean.core :as bean] [cljs.core.async :as async] [cljs.spec.alpha :as s] diff --git a/src/main/frontend/storage.cljs b/src/main/frontend/storage.cljs index e47f7957b6..52faf9fea9 100644 --- a/src/main/frontend/storage.cljs +++ b/src/main/frontend/storage.cljs @@ -1,4 +1,6 @@ (ns frontend.storage + "Provides fns for most common operations with localStorage. Assumes + localStorage values are edn" (:refer-clojure :exclude [get set remove]) (:require [cljs.reader :as reader] [datascript.transit :as dt] diff --git a/src/main/frontend/template.cljs b/src/main/frontend/template.cljs index 2217f7fef9..0cce099892 100644 --- a/src/main/frontend/template.cljs +++ b/src/main/frontend/template.cljs @@ -1,4 +1,5 @@ (ns frontend.template + "Provides template related functionality" (:require [clojure.string :as string] [frontend.date :as date] [frontend.state :as state] diff --git a/src/main/frontend/ui.cljs b/src/main/frontend/ui.cljs index d6def0ad74..4e381d6b54 100644 --- a/src/main/frontend/ui.cljs +++ b/src/main/frontend/ui.cljs @@ -1,4 +1,5 @@ (ns frontend.ui + "Main ns for reusable components" (:require ["@logseq/react-tweet-embed" :as react-tweet-embed] ["react-intersection-observer" :as react-intersection-observer] ["react-resize-context" :as Resize] @@ -13,7 +14,7 @@ [frontend.components.svg :as svg] [frontend.context.i18n :refer [t]] [frontend.db-mixins :as db-mixins] - [frontend.handler.notification :as notification-handler] + [frontend.handler.notification :as notification] [frontend.handler.plugin :as plugin-handler] [frontend.mixins :as mixins] [frontend.mobile.util :as mobile-util] @@ -276,7 +277,7 @@ [:div.ml-4.flex-shrink-0.flex [:button.inline-flex.text-gray-400.focus:outline-none.focus:text-gray-500.transition.ease-in-out.duration-150.notification-close-button {:on-click (fn [] - (notification-handler/clear! uid))} + (notification/clear! uid))} [:svg.h-5.w-5 {:fill "currentColor", :view-Box "0 0 20 20"} [:path @@ -782,7 +783,7 @@ < {:did-catch (fn [state error _info] (log/error :exception error) - (notification-handler/show! + (notification/show! (str "Error caught by UI!\n " error) :error) (assoc state ::error error))} diff --git a/src/main/frontend/ui.css b/src/main/frontend/ui.css index 5b68e0f675..7e984ec3bd 100644 --- a/src/main/frontend/ui.css +++ b/src/main/frontend/ui.css @@ -245,7 +245,7 @@ html.is-mobile { .ui__button { @apply flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-white - focus:outline-none transition ease-in-out duration-150 mt-1; + focus:outline-none transition ease-in-out duration-150; &:disabled { opacity: 0.5; @@ -353,6 +353,10 @@ html.is-mobile { background-color: var(--ls-quaternary-background-color); } +.ui__icon { + display: inline-block; +} + .type-icon { @apply text-xs text-center flex items-center justify-center rounded border mr-2 relative; diff --git a/src/main/frontend/ui/date_picker.cljs b/src/main/frontend/ui/date_picker.cljs index c959274d2e..c020fce9d0 100644 --- a/src/main/frontend/ui/date_picker.cljs +++ b/src/main/frontend/ui/date_picker.cljs @@ -1,4 +1,4 @@ -(ns frontend.ui.date-picker +(ns ^:no-doc frontend.ui.date-picker (:require [cljs-time.core :refer [after? before? day day-of-week days first-day-of-the-month minus month months plus year]] [cljs-time.format :refer [formatter unparse]] [frontend.modules.shortcut.core :as shortcut] diff --git a/src/main/frontend/util.cljc b/src/main/frontend/util.cljc index 36258f4f44..ba3e7df972 100644 --- a/src/main/frontend/util.cljc +++ b/src/main/frontend/util.cljc @@ -1,4 +1,5 @@ (ns frontend.util + "Main ns for utility fns. This ns should be split up into more focused namespaces" #?(:clj (:refer-clojure :exclude [format])) #?(:cljs (:require-macros [frontend.util])) #?(:cljs (:require diff --git a/src/main/frontend/util/clock.cljs b/src/main/frontend/util/clock.cljs index 456f2a1dc7..4ccf161469 100644 --- a/src/main/frontend/util/clock.cljs +++ b/src/main/frontend/util/clock.cljs @@ -1,4 +1,5 @@ (ns frontend.util.clock + "Provides clock related functionality used by tasks" (:require [frontend.state :as state] [frontend.util.drawer :as drawer] [frontend.util :as util] diff --git a/src/main/frontend/util/cursor.cljs b/src/main/frontend/util/cursor.cljs index 58f610c12f..0e4a2282a6 100644 --- a/src/main/frontend/util/cursor.cljs +++ b/src/main/frontend/util/cursor.cljs @@ -1,4 +1,4 @@ -(ns frontend.util.cursor +(ns ^:no-doc frontend.util.cursor (:require [cljs-bean.core :as bean] [clojure.string :as string] [frontend.util :as util] diff --git a/src/main/frontend/util/drawer.cljs b/src/main/frontend/util/drawer.cljs index 7abc8c6d09..3977d2ec2b 100644 --- a/src/main/frontend/util/drawer.cljs +++ b/src/main/frontend/util/drawer.cljs @@ -1,4 +1,4 @@ -(ns frontend.util.drawer +(ns ^:no-doc frontend.util.drawer (:require [clojure.string :as string] [frontend.util :as util] [logseq.graph-parser.mldoc :as gp-mldoc] diff --git a/src/main/frontend/util/fs.cljs b/src/main/frontend/util/fs.cljs index b09a5952a8..1c9a581c9f 100644 --- a/src/main/frontend/util/fs.cljs +++ b/src/main/frontend/util/fs.cljs @@ -1,4 +1,5 @@ (ns frontend.util.fs + "Misc util fns built on top of frontend.fs" (:require ["path" :as path] [clojure.string :as string] [frontend.fs :as fs] diff --git a/src/main/frontend/util/keycode.cljs b/src/main/frontend/util/keycode.cljs index db38171b0a..91c19e1f46 100644 --- a/src/main/frontend/util/keycode.cljs +++ b/src/main/frontend/util/keycode.cljs @@ -1,4 +1,5 @@ -(ns frontend.util.keycode) +(ns frontend.util.keycode + "Provides names for common keycodes") ;; code / keycode should all be deprecated for non funcional keys ;; (def left-square-bracket 219) ;; deprecated diff --git a/src/main/frontend/util/list.cljs b/src/main/frontend/util/list.cljs index a7397db605..01499e41aa 100644 --- a/src/main/frontend/util/list.cljs +++ b/src/main/frontend/util/list.cljs @@ -1,4 +1,5 @@ (ns frontend.util.list + "High level list operations for use in editor" (:require [frontend.util.thingatpt :as thingatpt] [frontend.util.cursor :as cursor] [clojure.string :as string])) diff --git a/src/main/frontend/util/marker.cljs b/src/main/frontend/util/marker.cljs index 6fec52bec6..26f6bb994b 100644 --- a/src/main/frontend/util/marker.cljs +++ b/src/main/frontend/util/marker.cljs @@ -1,4 +1,5 @@ (ns frontend.util.marker + "Task (formerly todo) related util fns" (:require [clojure.string :as string] [frontend.util :as util])) diff --git a/src/main/frontend/util/page_property.cljs b/src/main/frontend/util/page_property.cljs index 2f04615a7a..8e33cdcf60 100644 --- a/src/main/frontend/util/page_property.cljs +++ b/src/main/frontend/util/page_property.cljs @@ -1,4 +1,4 @@ -(ns frontend.util.page-property +(ns ^:no-doc frontend.util.page-property (:require [clojure.string :as string] [frontend.db :as db] [frontend.modules.outliner.core :as outliner-core] diff --git a/src/main/frontend/util/persist_var.cljs b/src/main/frontend/util/persist_var.cljs index 22e0d92da9..35cb35bc24 100644 --- a/src/main/frontend/util/persist_var.cljs +++ b/src/main/frontend/util/persist_var.cljs @@ -1,4 +1,6 @@ (ns frontend.util.persist-var + "System-component-like ns that provides an atom-like abstraction over an edn + file" (:require [frontend.config :as config] [frontend.state :as state] [frontend.fs :as fs] diff --git a/src/main/frontend/util/priority.cljs b/src/main/frontend/util/priority.cljs index 106c468a7e..4f274ef721 100644 --- a/src/main/frontend/util/priority.cljs +++ b/src/main/frontend/util/priority.cljs @@ -1,4 +1,5 @@ (ns frontend.util.priority + "Util fns for task priorities e.g. A, B, C" (:require [clojure.string :as string] [frontend.util :as util] [frontend.util.marker :as marker])) diff --git a/src/main/frontend/util/text.cljs b/src/main/frontend/util/text.cljs index fea8a1a60d..dbc9ec21e8 100644 --- a/src/main/frontend/util/text.cljs +++ b/src/main/frontend/util/text.cljs @@ -1,4 +1,6 @@ (ns frontend.util.text + "Misc low-level utility text fns that are useful across features or don't have + a good ns to be in yet" (:require [clojure.string :as string] [goog.string :as gstring] [frontend.util :as util])) diff --git a/src/main/frontend/util/thingatpt.cljs b/src/main/frontend/util/thingatpt.cljs index 8dbcf043e2..f029970a79 100644 --- a/src/main/frontend/util/thingatpt.cljs +++ b/src/main/frontend/util/thingatpt.cljs @@ -1,4 +1,4 @@ -(ns frontend.util.thingatpt +(ns ^:no-doc frontend.util.thingatpt (:require [clojure.string :as string] [frontend.state :as state] [frontend.util.cursor :as cursor] diff --git a/src/main/frontend/util/url.cljs b/src/main/frontend/util/url.cljs index 3d31d3f6bc..14a8631b9a 100644 --- a/src/main/frontend/util/url.cljs +++ b/src/main/frontend/util/url.cljs @@ -1,4 +1,5 @@ (ns frontend.util.url + "Util fns related to protocol url" (:require [frontend.db.conn :as db-conn])) ;; Keep same as electron/electron.core diff --git a/src/main/frontend/version.cljs b/src/main/frontend/version.cljs index 19eaafcbc0..0da621f7dc 100644 --- a/src/main/frontend/version.cljs +++ b/src/main/frontend/version.cljs @@ -1,3 +1,3 @@ -(ns frontend.version) +(ns ^:no-doc frontend.version) (defonce version "0.8.7") diff --git a/src/main/frontend/state_test.cljs b/src/test/frontend/state_test.cljs similarity index 100% rename from src/main/frontend/state_test.cljs rename to src/test/frontend/state_test.cljs diff --git a/yarn.lock b/yarn.lock index a9c659ef48..c815466bd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -475,10 +475,10 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@kanru/rage-wasm@0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@kanru/rage-wasm/-/rage-wasm-0.2.1.tgz#dd8fdd3133992c42bf68c0086d8cad40a13bc329" - integrity sha512-sYi4F2mL6Mpcz7zbS4myasw11xLBEbgZkDMRVg9jNxTKt6Ct/LT7/vCHDmEzAFcPcPqixD5De6Ql3bJijAX0/w== +"@kanru/rage-wasm@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@kanru/rage-wasm/-/rage-wasm-0.3.0.tgz#de96b1fda1f781ff401d43b50d0f95b7338c4399" + integrity sha512-2LMRS27nNJPqFNpRQL7kXG0kgBeIPo63KM6u0Xu6Es5XIS7LP4MFtdHkCg8Pt7IhMM7GuOa2YnzAZgKBxE1lcw== "@logseq/capacitor-file-sync@0.0.10": version "0.0.10"