Gabriel Horner 1 rok pred
rodič
commit
c9ba357a90

+ 17 - 17
deps/outliner/src/logseq/outliner/core.cljs

@@ -18,7 +18,7 @@
             [logseq.db.sqlite.util :as sqlite-util]
             [cljs.pprint :as pprint]))
 
-(def block-map
+(def ^:private block-map
   (mu/optional-keys
    [:map
     [:db/id :int]
@@ -28,12 +28,12 @@
     [:block/parent :map]
     [:block/page :map]]))
 
-(def block-map-or-entity
+(def ^:private block-map-or-entity
   [:or [:fn de/entity?] block-map])
 
-(defrecord Block [data])
+(defrecord ^:api Block [data])
 
-(defn block
+(defn ^:api block
   [db m]
   (assert (or (map? m) (de/entity? m)) (common-util/format "block data must be map or entity, got: %s %s" (type m) m))
   (let [e (if (or (de/entity? m)
@@ -48,11 +48,11 @@
                        :block/uuid (:block/uuid entity)))))]
     (->Block e)))
 
-(defn get-data
+(defn ^:api get-data
   [block]
   (:data block))
 
-(defn get-block-by-id
+(defn- get-block-by-id
   [db id]
   (let [r (ldb/get-by-id db (outliner-u/->block-lookup-ref id))]
     (when r (->Block r))))
@@ -74,7 +74,7 @@
                 (assoc :block/created-at updated-at))]
     block))
 
-(defn block-with-updated-at
+(defn ^:api block-with-updated-at
   [block]
   (let [updated-at (common-util/time-ms)]
     (assoc block :block/updated-at updated-at)))
@@ -192,7 +192,7 @@
                                       merge-tx))))))
      (reset! (:editor/create-page? @state/state) false))))
 
-(defn rebuild-block-refs
+(defn ^:api rebuild-block-refs
   [repo conn date-formatter block new-properties & {:keys [skip-content-parsing?]}]
   (let [db @conn
         property-key-refs (keys new-properties)
@@ -400,7 +400,7 @@
           children (ldb/get-block-immediate-children @conn parent-id)]
       (map #(block @conn %) children))))
 
-(defn get-right-sibling
+(defn ^:api get-right-sibling
   [db db-id]
   (when db-id
     (ldb/get-right-sibling db db-id)))
@@ -537,7 +537,7 @@
         (mapcat #(tree-seq map? children-key %))
         (map #(dissoc % :block/children)))))
 
-(defn save-block
+(defn ^:api save-block
   "Save the `block`."
   [repo conn date-formatter block']
   {:pre [(map? block')]}
@@ -577,7 +577,7 @@
 
 ;;; ### insert-blocks, delete-blocks, move-blocks
 
-(defn fix-top-level-blocks
+(defn ^:api fix-top-level-blocks
   "Blocks with :block/level"
   [blocks]
   (let [top-level-blocks (filter #(= (:block/level %) 1) blocks)
@@ -694,7 +694,7 @@
       result)))
 
 
-(defn blocks-with-level
+(defn ^:api blocks-with-level
   "Calculate `:block/level` for all the `blocks`. Blocks should be sorted already."
   [blocks]
   {:pre [(seq blocks)]}
@@ -723,7 +723,7 @@
               m' (vec (conj m block))]
           (recur m' (rest blocks)))))))
 
-(defn ^:large-vars/cleanup-todo insert-blocks
+(defn- ^:large-vars/cleanup-todo insert-blocks
   "Insert blocks as children (or siblings) of target-node.
   Args:
     `conn`: db connection.
@@ -844,7 +844,7 @@
                                   non-consecutive-blocks)))) page-blocks)
        (remove nil?)))))
 
-(defn delete-block
+(defn ^:api delete-block
   "Delete block from the tree."
   [repo conn txs-state node {:keys [children? children-check? date-formatter]
                         :or {children-check? true}}]
@@ -933,7 +933,7 @@
                 (:db/id target-block))
              sibling?)))
 
-(defn move-blocks
+(defn- move-blocks
   "Move `blocks` to `target-block` as siblings or children."
   [repo conn blocks target-block {:keys [_sibling? _up? outliner-op _indent?]
                                   :as opts}]
@@ -979,7 +979,7 @@
                 {:tx-data full-tx
                  :tx-meta tx-meta}))))))))
 
-(defn move-blocks-up-down
+(defn- move-blocks-up-down
   "Move blocks up/down."
   [repo conn blocks up?]
   {:pre [(seq blocks) (boolean? up?)]}
@@ -1013,7 +1013,7 @@
           (move-blocks repo conn blocks right (merge opts {:sibling? sibling?
                                                            :up? up?})))))))
 
-(defn ^:large-vars/cleanup-todo indent-outdent-blocks
+(defn- ^:large-vars/cleanup-todo indent-outdent-blocks
   "Indent or outdent `blocks`."
   [repo conn blocks indent? & {:keys [get-first-block-original logical-outdenting?]}]
   {:pre [(seq blocks) (boolean? indent?)]}

+ 1 - 1
deps/outliner/src/logseq/outliner/datascript.cljs

@@ -27,7 +27,7 @@
                                        v)))
                     x)))))
 
-(defn update-refs-and-macros
+(defn- update-refs-and-macros
   "When a block is deleted, refs are updated and macros associated with the block are deleted"
   [txs db repo opts set-state-fn]
   (if (= :delete-blocks (:outliner-op opts))

+ 2 - 2
deps/outliner/src/logseq/outliner/transaction.cljc

@@ -4,12 +4,12 @@
   #?(:cljs (:require-macros [logseq.outliner.transaction]))
   #?(:cljs (:require [malli.core :as m])))
 
-(def transact-opts [:or :symbol :map])
+(def ^:private transact-opts [:or :symbol :map])
 
 #?(:org.babashka/nbb nil
    :cljs (m/=> transact! [:=> [:cat transact-opts :any] :any]))
 
-(defmacro transact!
+(defmacro ^:api transact!
   "Batch all the transactions in `body` to a single transaction, Support nested transact! calls.
   Currently there are no options, it'll execute body and collect all transaction data generated by body.
   If no transactions are included in `body`, it does not save a transaction.

+ 3 - 3
deps/outliner/src/logseq/outliner/tree.cljs

@@ -80,7 +80,7 @@
       (assoc root' :block/children children)
       root')))
 
-(defn block-entity->map
+(defn ^:api block-entity->map
   [e]
   (cond-> {:db/id (:db/id e)
            :block/uuid (:block/uuid e)
@@ -93,7 +93,7 @@
     (:block/children e)
     (assoc :block/children (:block/children e))))
 
-(defn filter-top-level-blocks
+(defn ^:api filter-top-level-blocks
   [blocks]
   (let [id->blocks (zipmap (map :db/id blocks) blocks)]
     (filter #(nil?
@@ -121,7 +121,7 @@
                     (if sorted-nested-children [parent sorted-nested-children] [parent])))
         parents))
 
-(defn sort-blocks
+(defn ^:api sort-blocks
   "sort blocks by parent & left"
   [blocks-exclude-root root]
   (let [parent-groups (atom (group-by :block/parent blocks-exclude-root))]

+ 1 - 1
deps/outliner/src/logseq/outliner/util.cljs

@@ -7,7 +7,7 @@
    [datascript.impl.entity :as e]
    [logseq.common.util :as common-util]))
 
-(defn block-id?
+(defn- block-id?
   [id]
   (or
    (number? id)

+ 1 - 3
src/main/frontend/components/page.cljs

@@ -10,7 +10,6 @@
             [frontend.components.reference :as reference]
             [frontend.components.scheduled-deadlines :as scheduled]
             [frontend.components.icon :as icon-component]
-            [frontend.components.property.value :as pv]
             [frontend.components.db-based.page :as db-page]
             [frontend.handler.property.util :as pu]
             [frontend.handler.db-based.property :as db-property-handler]
@@ -337,8 +336,7 @@
                         (date/journal-title->custom-format title)
                         title))
               old-name (or title page-name)
-              db-based? (config/db-based-graph? repo)
-              tags-property (db/entity [:block/name "tags"])]
+              db-based? (config/db-based-graph? repo)]
           [:div.ls-page-title.flex.flex-1.flex-row.flex-wrap.w-full.relative.items-center.gap-2
            {:on-mouse-over #(reset! *hover? true)
             :on-mouse-out #(reset! *hover? false)}

+ 1 - 4
src/test/frontend/handler/export_test.cljs

@@ -1,12 +1,9 @@
 (ns frontend.handler.export-test
-  (:require [cljs.test :refer [are async deftest is use-fixtures]]
-            [clojure.edn :as edn]
+  (:require [cljs.test :refer [are async deftest use-fixtures]]
             [clojure.string :as string]
-            [frontend.handler.export :as export]
             [frontend.handler.export.text :as export-text]
             [frontend.state :as state]
             [frontend.test.helper :as test-helper :include-macros true :refer [deftest-async]]
-            [logseq.db.frontend.default :as default-db]
             [promesa.core :as p]))
 
 (def test-files

+ 1 - 2
src/test/frontend/worker/rtc/asset_sync_effects_test.cljs

@@ -1,8 +1,7 @@
 (ns frontend.worker.rtc.asset-sync-effects-test
   "This ns include tests abouts asset-sync with other components.
   These tests need to start the asset-sync-loop."
-  (:require [cljs.core.async :as async :refer [<! >! go timeout]]
-            [clojure.test :as t :refer [deftest is use-fixtures]]
+  (:require [clojure.test :as t :refer [deftest is use-fixtures]]
             [frontend.test.helper :include-macros true :as test-helper]
             [frontend.worker.rtc.fixture :as rtc-fixture]
             [spy.core :as spy]))

+ 1 - 1
typos.toml

@@ -18,4 +18,4 @@ fom = "fom"
 tne = "tne"
 Damon = "Damon"
 [files]
-extend-exclude = ["resources/*", "src/resources/*", "scripts/resources/*"]
+extend-exclude = ["resources/*", "src/resources/*", "scripts/resources/*", "e2e-tests/plugin/lsplugin.user.js"]