Browse Source

Move outliner core to its own dep

Tienson Qin 1 year ago
parent
commit
9194a671fd
61 changed files with 195 additions and 119 deletions
  1. 41 0
      deps/common/src/logseq/common/util/block_ref.cljs
  2. 36 0
      deps/common/src/logseq/common/util/page_ref.cljs
  3. 1 1
      deps/db/src/logseq/db/frontend/content.cljs
  4. 2 2
      deps/graph-parser/src/logseq/graph_parser/block.cljs
  5. 1 1
      deps/graph-parser/src/logseq/graph_parser/text.cljs
  6. 1 1
      deps/graph-parser/src/logseq/graph_parser/util/block_ref.cljs
  7. 18 18
      deps/graph-parser/src/logseq/graph_parser/util/db.cljs
  8. 1 1
      deps/graph-parser/src/logseq/graph_parser/util/page_ref.cljs
  9. 2 2
      deps/graph-parser/src/logseq/graph_parser/whiteboard.cljs
  10. 1 1
      deps/graph-parser/test/logseq/graph_parser/block_test.cljs
  11. 2 2
      deps/graph-parser/test/logseq/graph_parser/util/page_ref_test.cljs
  12. 5 5
      deps/outliner/src/logseq/outliner/core.cljs
  13. 2 2
      deps/outliner/src/logseq/outliner/datascript.cljs
  14. 11 11
      deps/outliner/src/logseq/outliner/transaction.cljc
  15. 7 7
      deps/outliner/src/logseq/outliner/util.cljs
  16. 2 2
      src/main/frontend/commands.cljs
  17. 2 2
      src/main/frontend/components/block.cljs
  18. 1 1
      src/main/frontend/components/cmdk.cljs
  19. 1 1
      src/main/frontend/components/content.cljs
  20. 1 1
      src/main/frontend/components/datetime.cljs
  21. 1 1
      src/main/frontend/components/page.cljs
  22. 1 1
      src/main/frontend/components/query/builder.cljs
  23. 2 2
      src/main/frontend/components/shortcut_help.cljs
  24. 1 1
      src/main/frontend/db/async.cljs
  25. 1 1
      src/main/frontend/db/file_based/async.cljs
  26. 1 1
      src/main/frontend/db/query_dsl.cljs
  27. 1 1
      src/main/frontend/db/query_react.cljs
  28. 2 2
      src/main/frontend/db/rtc/core.cljs
  29. 1 1
      src/main/frontend/extensions/pdf/assets.cljs
  30. 1 1
      src/main/frontend/extensions/srs.cljs
  31. 1 1
      src/main/frontend/extensions/zotero/extractor.cljs
  32. 1 1
      src/main/frontend/extensions/zotero/handler.cljs
  33. 1 1
      src/main/frontend/external/roam.cljs
  34. 1 2
      src/main/frontend/format/mldoc.cljs
  35. 1 1
      src/main/frontend/fs/watcher_handler.cljs
  36. 1 1
      src/main/frontend/handler/block.cljs
  37. 2 2
      src/main/frontend/handler/db_based/editor.cljs
  38. 1 1
      src/main/frontend/handler/db_based/page.cljs
  39. 2 2
      src/main/frontend/handler/db_based/property.cljs
  40. 2 2
      src/main/frontend/handler/dnd.cljs
  41. 3 3
      src/main/frontend/handler/editor.cljs
  42. 2 2
      src/main/frontend/handler/export.cljs
  43. 3 3
      src/main/frontend/handler/file_based/editor.cljs
  44. 2 2
      src/main/frontend/handler/file_based/page.cljs
  45. 1 1
      src/main/frontend/handler/file_based/page_property.cljs
  46. 1 1
      src/main/frontend/handler/file_based/property.cljs
  47. 1 1
      src/main/frontend/handler/file_based/property/util.cljs
  48. 1 1
      src/main/frontend/handler/page.cljs
  49. 1 1
      src/main/frontend/handler/paste.cljs
  50. 1 1
      src/main/frontend/handler/query/builder.cljs
  51. 1 1
      src/main/frontend/mobile/action_bar.cljs
  52. 1 1
      src/main/frontend/mobile/intent.cljs
  53. 2 2
      src/main/frontend/modules/outliner/ui.cljc
  54. 1 1
      src/main/frontend/template.cljs
  55. 2 2
      src/main/frontend/util/thingatpt.cljs
  56. 1 1
      src/main/logseq/api.cljs
  57. 1 1
      src/test/frontend/db/query_dsl_test.cljs
  58. 2 2
      src/test/frontend/db/rtc/rtc_effects_test.cljs
  59. 2 2
      src/test/frontend/db/rtc/rtc_fns_test.cljs
  60. 1 1
      src/test/frontend/handler/repo_test.cljs
  61. 2 2
      src/test/frontend/modules/outliner/core_test.cljs

+ 41 - 0
deps/common/src/logseq/common/util/block_ref.cljs

@@ -0,0 +1,41 @@
+(ns logseq.common.util.block-ref
+  "Core vars and util fns for block-refs"
+  (:require [clojure.string :as string]))
+
+(def left-parens "Opening characters for block-ref" "((")
+(def right-parens "Closing characters for block-ref" "))")
+(def left-and-right-parens "Opening and closing characters for block-ref"
+  (str left-parens right-parens))
+(def block-ref-re #"\(\(([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})\)\)")
+
+(defn get-all-block-ref-ids
+  [content]
+  (map second (re-seq block-ref-re content)))
+
+(defn get-block-ref-id
+  "Extracts block id from block-ref using regex"
+  [s]
+  (second (re-matches block-ref-re s)))
+
+(defn get-string-block-ref-id
+  "Extracts block id from block-ref by stripping parens e.g. ((123)) -> 123.
+  This is a less strict version of get-block-ref-id"
+  [s]
+  (subs s 2 (- (count s) 2)))
+
+(defn block-ref?
+  "Determines if string is block ref using regex"
+  [s]
+  (boolean (get-block-ref-id s)))
+
+(defn string-block-ref?
+  "Determines if string is block ref by checking parens. This is less strict version
+of block-ref?"
+  [s]
+  (and (string/starts-with? s left-parens)
+       (string/ends-with? s right-parens)))
+
+(defn ->block-ref
+  "Creates block ref string given id"
+  [block-id]
+  (str left-parens block-id right-parens))

+ 36 - 0
deps/common/src/logseq/common/util/page_ref.cljs

@@ -0,0 +1,36 @@
+(ns logseq.common.util.page-ref
+  "Core vars and util fns for page-ref. Currently this only handles a logseq
+  page-ref e.g. [[page name]]"
+  (:require [clojure.string :as string]))
+
+(def left-brackets "Opening characters for page-ref" "[[")
+(def right-brackets "Closing characters for page-ref" "]]")
+(def left-and-right-brackets "Opening and closing characters for page-ref"
+  (str left-brackets right-brackets))
+
+;; common regular expressions
+(def page-ref-re "Inner capture and doesn't match nested brackets" #"\[\[(.*?)\]\]")
+(def page-ref-without-nested-re "Matches most inner nested brackets" #"\[\[([^\[\]]+)\]\]")
+(def page-ref-any-re "Inner capture that matches anything between brackets" #"\[\[(.*)\]\]")
+
+(defn page-ref?
+  "Determines if string is page-ref. Avoid using with format-specific page-refs e.g. org"
+  [s]
+  (and (string/starts-with? s left-brackets)
+       (string/ends-with? s right-brackets)))
+
+(defn ->page-ref
+  "Create a page ref given a page name"
+  [page-name]
+  (str left-brackets page-name right-brackets))
+
+(defn get-page-name
+  "Extracts page-name from page-ref string"
+  [s]
+  (second (re-matches page-ref-any-re s)))
+
+(defn get-page-name!
+  "Extracts page-name from page-ref and fall back to arg. Useful for when user
+  input may (not) be a page-ref"
+  [s]
+  (or (get-page-name s) s))

+ 1 - 1
deps/db/src/logseq/db/frontend/content.cljs

@@ -1,7 +1,7 @@
 (ns logseq.db.frontend.content
   "fns to handle special ids"
   (:require [clojure.string :as string]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [datascript.core :as d]
             [logseq.db.sqlite.util :as sqlite-util]))
 

+ 2 - 2
deps/graph-parser/src/logseq/graph_parser/block.cljs

@@ -11,8 +11,8 @@
             [logseq.graph-parser.text :as text]
             [logseq.graph-parser.utf8 :as utf8]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.block-ref :as block-ref]
-            [logseq.graph-parser.util.page-ref :as page-ref]))
+            [logseq.common.util.block-ref :as block-ref]
+            [logseq.common.util.page-ref :as page-ref]))
 
 (defn heading-block?
   [block]

+ 1 - 1
deps/graph-parser/src/logseq/graph_parser/text.cljs

@@ -7,7 +7,7 @@
             [logseq.graph-parser.property :as gp-property]
             [logseq.graph-parser.mldoc :as gp-mldoc]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.page-ref :as page-ref]))
+            [logseq.common.util.page-ref :as page-ref]))
 
 (defn get-file-basename
   "Returns the basename of a file path. e.g. /a/b/c.md -> c.md"

+ 1 - 1
deps/graph-parser/src/logseq/graph_parser/util/block_ref.cljs

@@ -1,4 +1,4 @@
-(ns logseq.graph-parser.util.block-ref
+(ns logseq.common.util.block-ref
   "Core vars and util fns for block-refs"
   (:require [clojure.string :as string]))
 

+ 18 - 18
deps/graph-parser/src/logseq/graph_parser/util/db.cljs

@@ -3,7 +3,7 @@
   by the graph-parser soon but if not, it should be in its own library"
   (:require [cljs-time.core :as t]
             [logseq.graph-parser.date-time-util :as date-time-util]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [datascript.core :as d]
             [clojure.string :as string]))
 
@@ -42,7 +42,7 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
 
 (defn get-offset-date [relative-date direction amount unit]
   (let [offset-fn (case direction "+" t/plus "-" t/minus)
-        offset-amount (parse-long amount) 
+        offset-amount (parse-long amount)
         offset-unit-fn (case unit
                          "d" t/days
                          "w" t/weeks
@@ -50,7 +50,7 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
                          "y" t/years)]
     (offset-fn (offset-fn relative-date (offset-unit-fn offset-amount)))))
 
-(defn get-ts-units 
+(defn get-ts-units
   "There are currently several time suffixes being used in inputs:
   - ms: milliseconds, will return a time relative to the direction the date is being adjusted
   - start: will return the time at the start of the day [00:00:00.000]
@@ -58,34 +58,34 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
   - HHMM: will return the specified time at the turn of the minute [HH:MM:00.000]
   - HHMMSS: will return the specified time at the turm of the second [HH:MM:SS.000]
   - HHMMSSmmm: will return the specified time at the turn of the millisecond [HH:MM:SS.mmm]
-  
+
   The latter three will be capped to the maximum allowed for each unit so they will always be valid times"
   [offset-direction offset-time]
-  (case offset-time 
-    "ms" (if (= offset-direction "+") [23 59 59 999] [0 0 0 0]) 
-    "start" [0 0 0 0] 
-    "end" [23 59 59 999] 
+  (case offset-time
+    "ms" (if (= offset-direction "+") [23 59 59 999] [0 0 0 0])
+    "start" [0 0 0 0]
+    "end" [23 59 59 999]
     ;; if it's not a matching string, then assume it is HHMM
     (let [[h1 h2 m1 m2 s1 s2 ms1 ms2 ms3] (str offset-time "000000000")]
-      [(min 23  (parse-long (str h1 h2))) 
+      [(min 23  (parse-long (str h1 h2)))
        (min 59  (parse-long (str m1 m2)))
        (min 59  (parse-long (str s1 s2)))
        (min 999 (parse-long (str ms1 ms2 ms3)))])))
 
 (defn keyword-input-dispatch [input]
-  (cond 
+  (cond
     (#{:current-page :query-page :current-block :parent-block :today :yesterday :tomorrow :right-now-ms} input) input
 
     (re-find #"^[+-]\d+[dwmy]?$" (name input)) :relative-date
     (re-find #"^[+-]\d+[dwmy]-(ms|start|end|\d{2}|\d{4}|\d{6}|\d{9})?$" (name input)) :relative-date-time
 
-    (= :start-of-today-ms input) :today-time 
+    (= :start-of-today-ms input) :today-time
     (= :end-of-today-ms input) :today-time
     (re-find #"^today-(start|end|\d{2}|\d{4}|\d{6}|\d{9})$" (name input)) :today-time
 
     (re-find #"^\d+d(-before|-after|-before-ms|-after-ms)?$" (name input)) :DEPRECATED-relative-date))
 
-(defmulti resolve-keyword-input (fn [_db input _opts] (keyword-input-dispatch input))) 
+(defmulti resolve-keyword-input (fn [_db input _opts] (keyword-input-dispatch input)))
 
 (defmethod resolve-keyword-input :current-page [_ _ {:keys [current-page-fn]}]
   (when current-page-fn
@@ -115,15 +115,15 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
 (defmethod resolve-keyword-input :right-now-ms [_ _ _]
   (date-time-util/time-ms))
 
-;; today-time returns an epoch int 
+;; today-time returns an epoch int
 (defmethod resolve-keyword-input :today-time [_db input _opts]
-  (let [[hh mm ss ms] (case input 
+  (let [[hh mm ss ms] (case input
                         :start-of-today-ms [0 0 0 0]
                         :end-of-today-ms [23 59 59 999]
                         (get-ts-units nil (subs (name input) 6)))]
-    (date-at-local-ms (t/today) hh mm ss ms))) 
+    (date-at-local-ms (t/today) hh mm ss ms)))
 
-;; relative-date returns a YYYMMDD string 
+;; relative-date returns a YYYMMDD string
 (defmethod resolve-keyword-input :relative-date [_ input _]
   (let [relative-to (get-relative-date input)
         [_ offset-direction offset offset-unit] (re-find #"^([+-])(\d+)([dwmy])$" (name input))
@@ -136,7 +136,7 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
         [_ offset-direction offset offset-unit ts] (re-find #"^([+-])(\d+)([dwmy])-(ms|start|end|\d{2,9})$" (name input))
         offset-date (get-offset-date relative-to offset-direction offset offset-unit)
         [hh mm ss ms] (get-ts-units offset-direction ts)]
-    (date-at-local-ms offset-date hh mm ss ms))) 
+    (date-at-local-ms offset-date hh mm ss ms)))
 
 (defmethod resolve-keyword-input :DEPRECATED-relative-date [db input opts]
   ;; This handles all of the cases covered by the following:
@@ -151,7 +151,7 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
   [db input {:keys [current-block-uuid current-page-fn]
              :or {current-page-fn (constantly nil)}}]
   (cond
-    (keyword? input) 
+    (keyword? input)
     (or
      (resolve-keyword-input db input {:current-block-uuid current-block-uuid
                                       :current-page-fn current-page-fn})

+ 1 - 1
deps/graph-parser/src/logseq/graph_parser/util/page_ref.cljs

@@ -1,4 +1,4 @@
-(ns logseq.graph-parser.util.page-ref
+(ns logseq.common.util.page-ref
   "Core vars and util fns for page-ref. Currently this only handles a logseq
   page-ref e.g. [[page name]]"
   (:require [clojure.string :as string]))

+ 2 - 2
deps/graph-parser/src/logseq/graph_parser/whiteboard.cljs

@@ -1,8 +1,8 @@
 (ns logseq.graph-parser.whiteboard
   "Whiteboard related parser utilities"
   (:require [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.block-ref :as block-ref]
-            [logseq.graph-parser.util.page-ref :as page-ref]))
+            [logseq.common.util.block-ref :as block-ref]
+            [logseq.common.util.page-ref :as page-ref]))
 
 (defn block->shape [block]
   (get-in block [:block/properties :logseq.tldraw.shape]))

+ 1 - 1
deps/graph-parser/test/logseq/graph_parser/block_test.cljs

@@ -3,7 +3,7 @@
             [logseq.graph-parser.mldoc :as gp-mldoc]
             [logseq.graph-parser :as graph-parser]
             [logseq.db :as ldb]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [datascript.core :as d]
             [cljs.test :refer [deftest are testing is]]))
 

+ 2 - 2
deps/graph-parser/test/logseq/graph_parser/util/page_ref_test.cljs

@@ -1,5 +1,5 @@
-(ns logseq.graph-parser.util.page-ref-test
-  (:require [logseq.graph-parser.util.page-ref :as page-ref]
+(ns logseq.common.util.page-ref-test
+  (:require [logseq.common.util.page-ref :as page-ref]
             [cljs.test :refer [are deftest]]))
 
 (deftest page-ref?

+ 5 - 5
src/main/frontend/modules/outliner/core.cljs → deps/outliner/src/logseq/outliner/core.cljs

@@ -1,12 +1,12 @@
-(ns frontend.modules.outliner.core
+(ns logseq.outliner.core
   (:require [clojure.set :as set]
             [clojure.string :as string]
             [datascript.impl.entity :as de]
             [datascript.core :as d]
             [logseq.db.frontend.schema :as db-schema]
-            [frontend.modules.outliner.datascript :as ds]
+            [logseq.outliner.datascript :as ds]
             [logseq.outliner.tree :as otree]
-            [frontend.modules.outliner.utils :as outliner-u]
+            [logseq.outliner.util :as outliner-u]
             [logseq.common.util :as common-util]
             [cljs.spec.alpha :as s]
             [logseq.db :as ldb]
@@ -1069,12 +1069,12 @@
 
 (def ^:private ^:dynamic *transaction-data*
   "Stores transaction-data that are generated by one or more write-operations,
-  see also `frontend.modules.outliner.transaction/transact!`"
+  see also `logseq.outliner.transaction/transact!`"
   nil)
 
 (def ^:private ^:dynamic #_:clj-kondo/ignore *transaction-opts*
   "Stores transaction opts that are generated by one or more write-operations,
-  see also `frontend.modules.outliner.transaction/transact!`"
+  see also `logseq.outliner.transaction/transact!`"
   nil)
 
 (def ^:private ^:dynamic #_:clj-kondo/ignore *transaction-args*

+ 2 - 2
src/main/frontend/modules/outliner/datascript.cljs → deps/outliner/src/logseq/outliner/datascript.cljs

@@ -1,6 +1,6 @@
-(ns frontend.modules.outliner.datascript
+(ns logseq.outliner.datascript
   (:require [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [logseq.db.sqlite.util :as sqlite-util]
             [logseq.graph-parser.property :as gp-property]
             [datascript.core :as d]

+ 11 - 11
src/main/frontend/modules/outliner/transaction.cljc → deps/outliner/src/logseq/outliner/transaction.cljc

@@ -1,5 +1,5 @@
-(ns frontend.modules.outliner.transaction
-  #?(:cljs (:require-macros [frontend.modules.outliner.transaction]))
+(ns logseq.outliner.transaction
+  #?(:cljs (:require-macros [logseq.outliner.transaction]))
   #?(:cljs (:require [malli.core :as m])))
 
 (def transact-opts [:or :symbol :map])
@@ -25,8 +25,8 @@
     (move-blocks! ...)
     (delete-blocks! ...))"
   [opts & body]
-  `(let [transact-data# frontend.modules.outliner.core/*transaction-data*
-         transaction-opts# frontend.modules.outliner.core/*transaction-opts*
+  `(let [transact-data# logseq.outliner.core/*transaction-data*
+         transaction-opts# logseq.outliner.core/*transaction-opts*
          opts*# ~opts
          _# (assert (or (map? opts*#) (symbol? opts*#)) (str "opts is not a map or symbol, type: " (type opts*#)))
          opts# (if transact-data#
@@ -42,23 +42,23 @@
                                  (and (logseq.db.sqlite.util/db-based-graph? repo#)
                                       (get opts*# :persist-op? true))
                                  (assoc :persist-op? true))]
-         (binding [frontend.modules.outliner.core/*transaction-data* (transient [])
-                   frontend.modules.outliner.core/*transaction-opts* (transient [])
-                   frontend.modules.outliner.core/*transaction-args* transaction-args#]
-           (conj! frontend.modules.outliner.core/*transaction-opts* opts#)
+         (binding [logseq.outliner.core/*transaction-data* (transient [])
+                   logseq.outliner.core/*transaction-opts* (transient [])
+                   logseq.outliner.core/*transaction-args* transaction-args#]
+           (conj! logseq.outliner.core/*transaction-opts* opts#)
            ~@body
-           (let [r# (persistent! frontend.modules.outliner.core/*transaction-data*)
+           (let [r# (persistent! logseq.outliner.core/*transaction-data*)
                  tx# (mapcat :tx-data r#)
                  ;; FIXME: should we merge all the tx-meta?
                  tx-meta# (first (map :tx-meta r#))
                  all-tx# (concat tx# (:additional-tx opts#))
-                 o# (persistent! frontend.modules.outliner.core/*transaction-opts*)
+                 o# (persistent! logseq.outliner.core/*transaction-opts*)
                  full-opts# (apply merge (reverse o#))
                  opts## (merge (dissoc full-opts# :additional-tx :current-block :nested-transaction?) tx-meta#)]
 
              (when (seq all-tx#) ;; If it's empty, do nothing
                (when-not (:nested-transaction? opts#) ; transact only for the whole transaction
-                 (let [result# (frontend.modules.outliner.datascript/transact! all-tx# (dissoc opts## :transact-opts) (:transact-opts opts##))]
+                 (let [result# (logseq.outliner.datascript/transact! all-tx# (dissoc opts## :transact-opts) (:transact-opts opts##))]
                    {:tx-report result#
                     :tx-data all-tx#
                     :tx-meta tx-meta#})))))))))

+ 7 - 7
src/main/frontend/modules/outliner/utils.cljs → deps/outliner/src/logseq/outliner/util.cljs

@@ -1,18 +1,18 @@
-(ns frontend.modules.outliner.utils
+(ns logseq.outliner.util
   (:require [datascript.impl.entity :as e]
             [logseq.common.util :as common-util]))
 
 (defn block-id?
   [id]
   (or
-    (number? id)
-    (string? id)
-    (uuid? id)))
+   (number? id)
+   (string? id)
+   (uuid? id)))
 
 (defn check-block-id
   [id]
   (assert (block-id? id)
-    (common-util/format "The id should match block-id?: %s" (pr-str id))))
+          (common-util/format "The id should match block-id?: %s" (pr-str id))))
 
 (defn ->block-lookup-ref
   "
@@ -24,8 +24,8 @@
   [id]
   (cond
     (and
-      (vector? id)
-      (= (first id) :block/uuid))
+     (vector? id)
+     (= (first id) :block/uuid))
     id
 
     (block-id? id)

+ 2 - 2
src/main/frontend/commands.cljs

@@ -22,8 +22,8 @@
             [logseq.common.config :as common-config]
             [logseq.graph-parser.property :as gp-property]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.block-ref :as block-ref]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.block-ref :as block-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [promesa.core :as p]))
 
 ;; TODO: move to frontend.handler.editor.commands

+ 2 - 2
src/main/frontend/components/block.cljs

@@ -75,8 +75,8 @@
             [logseq.graph-parser.mldoc :as gp-mldoc]
             [logseq.graph-parser.text :as text]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.block-ref :as block-ref]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.block-ref :as block-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [logseq.shui.core :as shui]
             [medley.core :as medley]
             [promesa.core :as p]

+ 1 - 1
src/main/frontend/components/cmdk.cljs

@@ -22,7 +22,7 @@
    [promesa.core :as p]
    [rum.core :as rum]
    [frontend.mixins :as mixins]
-   [logseq.graph-parser.util.block-ref :as block-ref]
+   [logseq.common.util.block-ref :as block-ref]
    [logseq.common.util :as common-util]
    [logseq.shui.button.v2 :as button]
    [frontend.modules.shortcut.utils :as shortcut-utils]

+ 1 - 1
src/main/frontend/components/content.cljs

@@ -21,7 +21,7 @@
             [frontend.util :as util]
             [frontend.modules.shortcut.core :as shortcut]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [frontend.util.url :as url-util]
             [goog.dom :as gdom]
             [goog.object :as gobj]

+ 1 - 1
src/main/frontend/components/datetime.cljs

@@ -11,7 +11,7 @@
             [frontend.util :as util]
             [frontend.mixins :as mixins]
             [rum.core :as rum]
-            [logseq.graph-parser.util.page-ref :as page-ref]))
+            [logseq.common.util.page-ref :as page-ref]))
 
 (defonce default-timestamp-value {:time ""
                                   :repeater {}})

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

@@ -44,7 +44,7 @@
             [goog.object :as gobj]
             [logseq.graph-parser.mldoc :as gp-mldoc]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [logseq.db.frontend.property :as db-property]
             [medley.core :as medley]
             [promesa.core :as p]

+ 1 - 1
src/main/frontend/components/query/builder.cljs

@@ -17,7 +17,7 @@
             [rum.core :as rum]
             [clojure.string :as string]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [promesa.core :as p]))
 
 (rum/defc page-block-selector

+ 2 - 2
src/main/frontend/components/shortcut_help.cljs

@@ -4,8 +4,8 @@
             [frontend.state :as state]
             [frontend.extensions.latex :as latex]
             [frontend.extensions.highlight :as highlight]
-            [logseq.graph-parser.util.block-ref :as block-ref]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.block-ref :as block-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [rum.core :as rum]
             [frontend.components.shortcut :as shortcut]
             [logseq.shui.core :as shui]))

+ 1 - 1
src/main/frontend/db/async.cljs

@@ -4,7 +4,7 @@
             [frontend.state :as state]
             [frontend.config :as config]
             [clojure.string :as string]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [frontend.util :as util]
             [frontend.db.utils :as db-utils]
             [frontend.db.async.util :as db-async-util]

+ 1 - 1
src/main/frontend/db/file_based/async.cljs

@@ -3,7 +3,7 @@
   (:require [promesa.core :as p]
             [frontend.db.async.util :as db-async-util]
             [clojure.string :as string]
-            [logseq.graph-parser.util.page-ref :as page-ref]))
+            [logseq.common.util.page-ref :as page-ref]))
 
 (def <q db-async-util/<q)
 

+ 1 - 1
src/main/frontend/db/query_dsl.cljs

@@ -16,7 +16,7 @@
             [logseq.db.frontend.rules :as rules]
             [frontend.template :as template]
             [logseq.graph-parser.text :as text]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [logseq.common.util :as common-util]
             [frontend.util.text :as text-util]
             [frontend.util :as util]

+ 1 - 1
src/main/frontend/db/query_react.cljs

@@ -11,7 +11,7 @@
             [frontend.extensions.sci :as sci]
             [frontend.state :as state]
             [logseq.graph-parser.util.db :as db-util]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [frontend.util :as util]
             [frontend.date :as date]
             [lambdaisland.glogi :as log]))

+ 2 - 2
src/main/frontend/db/rtc/core.cljs

@@ -17,8 +17,8 @@
             [frontend.handler.property.util :as pu]
             [frontend.handler.user :as user]
             [frontend.handler.whiteboard :as whiteboard-handler]
-            [frontend.modules.outliner.core :as outliner-core]
-            [frontend.modules.outliner.transaction :as outliner-tx]
+            [logseq.outliner.core :as outliner-core]
+            [logseq.outliner.transaction :as outliner-tx]
             [frontend.state :as state]
             [frontend.util :as util]
             [malli.core :as m]

+ 1 - 1
src/main/frontend/extensions/pdf/assets.cljs

@@ -20,7 +20,7 @@
             [frontend.extensions.pdf.windows :as pdf-windows]
             [logseq.common.path :as path]
             [logseq.common.config :as common-config]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [medley.core :as medley]
             [promesa.core :as p]
             [reitit.frontend.easy :as rfe]

+ 1 - 1
src/main/frontend/extensions/srs.cljs

@@ -29,7 +29,7 @@
             [frontend.util.drawer :as drawer]
             [frontend.util.persist-var :as persist-var]
             [logseq.graph-parser.property :as gp-property]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [medley.core :as medley]
             [rum.core :as rum]))
 

+ 1 - 1
src/main/frontend/extensions/zotero/extractor.cljs

@@ -6,7 +6,7 @@
             [frontend.extensions.zotero.schema :as schema]
             [frontend.extensions.zotero.setting :as setting]
             [frontend.util :as util]
-            [logseq.graph-parser.util.page-ref :as page-ref]))
+            [logseq.common.util.page-ref :as page-ref]))
 
 (defn item-type [item] (-> item :data :item-type))
 

+ 1 - 1
src/main/frontend/extensions/zotero/handler.cljs

@@ -9,7 +9,7 @@
             [frontend.handler.editor :as editor-handler]
             [frontend.handler.page :as page-handler]
             [frontend.db :as db]
-            [logseq.graph-parser.util.page-ref :as page-ref]))
+            [logseq.common.util.page-ref :as page-ref]))
 
 (defn add [page-name type item]
   (go

+ 1 - 1
src/main/frontend/external/roam.cljs

@@ -6,7 +6,7 @@
             [clojure.walk :as walk]
             [clojure.string :as string]
             [goog.string :as gstring]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [logseq.common.util :as common-util]
             [logseq.graph-parser.text :as text]))
 

+ 1 - 2
src/main/frontend/format/mldoc.cljs

@@ -11,8 +11,7 @@
             [logseq.common.util :as common-util]
             [logseq.graph-parser.text :as text]
             [logseq.graph-parser.block :as gp-block]
-            [clojure.walk :as walk]
-            [logseq.graph-parser.mldoc :as gp-mldoc]))
+            [clojure.walk :as walk]))
 
 (defonce anchorLink (gobj/get Mldoc "anchorLink"))
 (defonce parseOPML (gobj/get Mldoc "parseOPML"))

+ 1 - 1
src/main/frontend/fs/watcher_handler.cljs

@@ -20,7 +20,7 @@
             [frontend.util.fs :as fs-util]
             [lambdaisland.glogi :as log]
             [logseq.common.config :as common-config]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [promesa.core :as p]))
 
 ;; all IPC paths must be normalized! (via common-util/path-normalize)

+ 1 - 1
src/main/frontend/handler/block.cljs

@@ -6,7 +6,7 @@
    [frontend.db :as db]
    [frontend.db.model :as db-model]
    [frontend.mobile.haptics :as haptics]
-   [frontend.modules.outliner.core :as outliner-core]
+   [logseq.outliner.core :as outliner-core]
    [frontend.modules.outliner.ui :as ui-outliner-tx]
    [frontend.state :as state]
    [frontend.util :as util]

+ 2 - 2
src/main/frontend/handler/db_based/editor.cljs

@@ -8,13 +8,13 @@
             [frontend.format.mldoc :as mldoc]
             [frontend.util :as util]
             [frontend.state :as state]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [frontend.handler.ui :as ui-handler]
             [frontend.handler.common.config-edn :as config-edn-common-handler]
             [frontend.handler.property :as property-handler]
             [frontend.handler.property.util :as pu]
             [frontend.handler.repo-config :as repo-config-handler]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [frontend.modules.outliner.ui :as ui-outliner-tx]
             [frontend.schema.handler.repo-config :as repo-config-schema]
             [promesa.core :as p]

+ 1 - 1
src/main/frontend/handler/db_based/page.cljs

@@ -9,7 +9,7 @@
             [frontend.handler.ui :as ui-handler]
             [frontend.handler.notification :as notification]
             [frontend.handler.route :as route-handler]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [logseq.outliner.tree :as otree]
             [frontend.handler.common.page :as page-common-handler]
             [datascript.core :as d]

+ 2 - 2
src/main/frontend/handler/db_based/property.cljs

@@ -6,7 +6,7 @@
             [frontend.format.block :as block]
             [frontend.handler.notification :as notification]
             [frontend.handler.db-based.property.util :as db-pu]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [frontend.util :as util]
             [frontend.state :as state]
             [logseq.common.util :as common-util]
@@ -15,7 +15,7 @@
             [logseq.db.frontend.property.util :as db-property-util]
             [malli.util :as mu]
             [malli.error :as me]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [datascript.impl.entity :as e]))
 
 ;; schema -> type, cardinality, object's class

+ 2 - 2
src/main/frontend/handler/dnd.cljs

@@ -2,10 +2,10 @@
   "Provides fns for drag and drop"
   (:require [frontend.handler.editor :as editor-handler]
             [frontend.handler.property :as property-handler]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [logseq.outliner.tree :as otree]
             [frontend.modules.outliner.ui :as ui-outliner-tx]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [frontend.state :as state]
             [frontend.db :as db]
             [frontend.handler.block :as block-handler]))

+ 3 - 3
src/main/frontend/handler/editor.cljs

@@ -31,7 +31,7 @@
             [frontend.handler.db-based.editor :as db-editor-handler]
             [frontend.handler.file-based.editor :as file-editor-handler]
             [frontend.mobile.util :as mobile-util]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [frontend.modules.outliner.ui :as ui-outliner-tx]
             [frontend.modules.outliner.tree :as tree]
             [logseq.outliner.tree :as otree]
@@ -60,8 +60,8 @@
             [logseq.graph-parser.text :as text]
             [logseq.graph-parser.utf8 :as utf8]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.block-ref :as block-ref]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.block-ref :as block-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [promesa.core :as p]
             [rum.core :as rum]
             [frontend.handler.db-based.property :as db-property-handler]

+ 2 - 2
src/main/frontend/handler/export.cljs

@@ -22,8 +22,8 @@
    [goog.dom :as gdom]
    [lambdaisland.glogi :as log]
    [logseq.graph-parser.property :as gp-property]
-   [logseq.graph-parser.util.block-ref :as block-ref]
-   [logseq.graph-parser.util.page-ref :as page-ref]
+   [logseq.common.util.block-ref :as block-ref]
+   [logseq.common.util.page-ref :as page-ref]
    [promesa.core :as p]
    [frontend.persist-db :as persist-db])
   (:import

+ 3 - 3
src/main/frontend/handler/file_based/editor.cljs

@@ -6,9 +6,9 @@
             [frontend.format.block :as block]
             [frontend.db :as db]
             [frontend.format.mldoc :as mldoc]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [frontend.state :as state]
-            [frontend.modules.outliner.transaction :as outliner-tx]
+            [logseq.outliner.transaction :as outliner-tx]
             [frontend.util :as util]
             [frontend.util.clock :as clock]
             [frontend.util.drawer :as drawer]
@@ -18,7 +18,7 @@
             [frontend.handler.file-based.property.util :as property-util]
             [logseq.db.frontend.schema :as db-schema]
             [logseq.graph-parser.block :as gp-block]
-            [logseq.graph-parser.util.block-ref :as block-ref]))
+            [logseq.common.util.block-ref :as block-ref]))
 
 (defn- remove-non-existed-refs!
   [refs]

+ 2 - 2
src/main/frontend/handler/file_based/page.cljs

@@ -16,11 +16,11 @@
             [frontend.state :as state]
             [frontend.util :as util]
             [frontend.util.fs :as fs-util]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [logseq.outliner.tree :as otree]
             [frontend.fs :as fs]
             [logseq.graph-parser.property :as gp-property]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [lambdaisland.glogi :as log]
             [promesa.core :as p]
             [datascript.core :as d]

+ 1 - 1
src/main/frontend/handler/file_based/page_property.cljs

@@ -2,7 +2,7 @@
   "Page property fns for file graphs"
   (:require [clojure.string :as string]
             [frontend.db :as db]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [frontend.modules.outliner.ui :as ui-outliner-tx]
             [frontend.state :as state]
             [frontend.util :as util]))

+ 1 - 1
src/main/frontend/handler/file_based/property.cljs

@@ -3,7 +3,7 @@
   (:require [frontend.db :as db]
             [frontend.handler.block :as block-handler]
             [frontend.handler.file-based.property.util :as property-util]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [frontend.modules.outliner.ui :as ui-outliner-tx]
             [frontend.state :as state]
             [logseq.common.util :as common-util]))

+ 1 - 1
src/main/frontend/handler/file_based/property/util.cljs

@@ -5,7 +5,7 @@
             [clojure.set :as set]
             [frontend.config :as config]
             [logseq.graph-parser.property :as gp-property :refer [properties-start properties-end]]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [frontend.format.mldoc :as mldoc]
             [logseq.graph-parser.text :as text]
             [frontend.db :as db]

+ 1 - 1
src/main/frontend/handler/page.cljs

@@ -32,7 +32,7 @@
             [logseq.db.frontend.property :as db-property]
             [logseq.common.config :as common-config]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [promesa.core :as p]
             [logseq.common.path :as path]
             [frontend.handler.property.util :as pu]

+ 1 - 1
src/main/frontend/handler/paste.cljs

@@ -4,7 +4,7 @@
             [frontend.format.block :as block]
             [logseq.common.util :as common-util]
             [logseq.graph-parser.block :as gp-block]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [clojure.string :as string]
             [frontend.util :as util]
             [frontend.handler.editor :as editor-handler]

+ 1 - 1
src/main/frontend/handler/query/builder.cljs

@@ -1,7 +1,7 @@
 (ns frontend.handler.query.builder
   "DSL query builder handler"
   (:require [clojure.walk :as walk]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [lambdaisland.glogi :as log]
             [frontend.db.query-dsl :as query-dsl]))
 

+ 1 - 1
src/main/frontend/mobile/action_bar.cljs

@@ -12,7 +12,7 @@
    [goog.dom :as gdom]
    [goog.object :as gobj]
    [rum.core :as rum]
-   [logseq.graph-parser.util.block-ref :as block-ref]
+   [logseq.common.util.block-ref :as block-ref]
    [frontend.mobile.util :as mobile-util]))
 
 (defn- action-command

+ 1 - 1
src/main/frontend/mobile/intent.cljs

@@ -19,7 +19,7 @@
             [lambdaisland.glogi :as log]
             [logseq.common.config :as common-config]
             [logseq.common.util :as common-util]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [promesa.core :as p]))
 
 (defn- is-link

+ 2 - 2
src/main/frontend/modules/outliner/ui.cljc

@@ -1,5 +1,5 @@
 (ns frontend.modules.outliner.ui
-  #?(:cljs (:require-macros [frontend.modules.outliner.transaction]))
+  #?(:cljs (:require-macros [logseq.outliner.transaction]))
   #?(:cljs (:require-macros [frontend.modules.outliner.ui]))
   #?(:cljs (:require [frontend.state :as state]
                      [frontend.config :as config]
@@ -38,5 +38,5 @@
                          :unlinked-graph? frontend.modules.outliner.ui/unlinked-graph?
                          :set-state-fn frontend.modules.outliner.ui/set-state-fn
                          :after-transact-fn frontend.modules.outliner.ui/after-transact-fn}]
-     (frontend.modules.outliner.transaction/transact! (assoc ~opts :transact-opts transact-opts#)
+     (logseq.outliner.transaction/transact! (assoc ~opts :transact-opts transact-opts#)
                                                       ~@body)))

+ 1 - 1
src/main/frontend/template.cljs

@@ -5,7 +5,7 @@
             [frontend.state :as state]
             [frontend.db.utils :as db-utils]
             [frontend.util :as util]
-            [logseq.graph-parser.util.page-ref :as page-ref]))
+            [logseq.common.util.page-ref :as page-ref]))
 
 (defn- variable-rules
   []

+ 2 - 2
src/main/frontend/util/thingatpt.cljs

@@ -5,8 +5,8 @@
             [frontend.config :as config]
             [logseq.graph-parser.text :as text]
             [logseq.graph-parser.property :as gp-property]
-            [logseq.graph-parser.util.block-ref :as block-ref]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.block-ref :as block-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [cljs.reader :as reader]
             [goog.object :as gobj]))
 

+ 1 - 1
src/main/logseq/api.cljs

@@ -30,7 +30,7 @@
             [frontend.handler.property :as property-handler]
             [frontend.handler.property.util :as pu]
             [frontend.handler.db-based.property.util :as db-pu]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [frontend.modules.outliner.tree :as outliner-tree]
             [frontend.handler.command-palette :as palette-handler]
             [frontend.modules.shortcut.core :as st]

+ 1 - 1
src/test/frontend/db/query_dsl_test.cljs

@@ -1,7 +1,7 @@
 (ns frontend.db.query-dsl-test
   (:require [cljs.test :refer [are deftest testing use-fixtures is]]
             [clojure.string :as str]
-            [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.common.util.page-ref :as page-ref]
             [frontend.db :as db]
             [frontend.util :as util]
             [frontend.db.query-dsl :as query-dsl]

+ 2 - 2
src/test/frontend/db/rtc/rtc_effects_test.cljs

@@ -11,8 +11,8 @@
             [frontend.db.rtc.idb-keyval-mock :as idb-keyval-mock :include-macros true]
             [frontend.db.rtc.op-mem-layer :as op-mem-layer]
             [frontend.handler.page :as page-handler]
-            [frontend.modules.outliner.core :as outliner-core]
-            [frontend.modules.outliner.transaction :as outliner-tx]
+            [logseq.outliner.core :as outliner-core]
+            [logseq.outliner.transaction :as outliner-tx]
             [frontend.test.helper :as test-helper :include-macros true]
             [spy.core :as spy]))
 

+ 2 - 2
src/test/frontend/db/rtc/rtc_fns_test.cljs

@@ -5,8 +5,8 @@
             [frontend.db.rtc.core :as rtc-core]
             [frontend.db.rtc.op-mem-layer :as op-mem-layer]
             [frontend.handler.page :as page-handler]
-            [frontend.modules.outliner.core :as outliner-core]
-            [frontend.modules.outliner.transaction :as outliner-tx]
+            [logseq.outliner.core :as outliner-core]
+            [logseq.outliner.transaction :as outliner-tx]
             [frontend.state :as state]
             [frontend.test.helper :as test-helper]))
 

+ 1 - 1
src/test/frontend/handler/repo_test.cljs

@@ -4,7 +4,7 @@
             [frontend.test.helper :as test-helper :refer [load-test-files]]
             [logseq.graph-parser.cli :as gp-cli]
             [logseq.graph-parser.test.docs-graph-helper :as docs-graph-helper]
-            [logseq.graph-parser.util.block-ref :as block-ref]
+            [logseq.common.util.block-ref :as block-ref]
             [frontend.db.model :as model]
             [frontend.db.conn :as conn]
             [clojure.edn :as edn]

+ 2 - 2
src/test/frontend/modules/outliner/core_test.cljs

@@ -2,10 +2,10 @@
   (:require [cljs.test :refer [deftest is use-fixtures testing] :as test]
             [clojure.test.check.generators :as gen]
             [frontend.test.fixtures :as fixtures]
-            [frontend.modules.outliner.core :as outliner-core]
+            [logseq.outliner.core :as outliner-core]
             [frontend.modules.outliner.tree :as tree]
             [logseq.outliner.tree :as otree]
-            [frontend.modules.outliner.transaction :as outliner-tx]
+            [logseq.outliner.transaction :as outliner-tx]
             [frontend.db :as db]
             [frontend.db.model :as db-model]
             [clojure.walk :as walk]