فهرست منبع

chore: keep using class instead of tag for internal usage

Tienson Qin 1 سال پیش
والد
کامیت
f46372b346
30فایلهای تغییر یافته به همراه61 افزوده شده و 61 حذف شده
  1. 1 1
      deps/db/script/validate_client_db.cljs
  2. 3 3
      deps/db/src/logseq/db.cljs
  3. 2 2
      deps/db/src/logseq/db/frontend/malli_schema.cljs
  4. 1 1
      deps/db/src/logseq/db/frontend/schema.cljs
  5. 1 1
      deps/db/src/logseq/db/sqlite/common_db.cljs
  6. 4 4
      deps/db/src/logseq/db/sqlite/util.cljs
  7. 2 2
      deps/db/test/logseq/db/sqlite/build_test.cljs
  8. 1 1
      deps/db/test/logseq/db/sqlite/create_graph_test.cljs
  9. 1 1
      deps/graph-parser/src/logseq/graph_parser/block.cljs
  10. 2 2
      deps/graph-parser/src/logseq/graph_parser/exporter.cljs
  11. 6 6
      deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs
  12. 1 1
      deps/outliner/src/logseq/outliner/core.cljs
  13. 4 4
      deps/outliner/src/logseq/outliner/property.cljs
  14. 1 1
      src/main/frontend/common_keywords.cljs
  15. 1 1
      src/main/frontend/components/cmdk/core.cljs
  16. 4 4
      src/main/frontend/components/db_based/page.cljs
  17. 1 1
      src/main/frontend/components/editor.cljs
  18. 1 1
      src/main/frontend/components/icon.cljs
  19. 1 1
      src/main/frontend/components/imports.cljs
  20. 5 5
      src/main/frontend/components/page.cljs
  21. 4 4
      src/main/frontend/components/property.cljs
  22. 3 3
      src/main/frontend/components/property/value.cljs
  23. 1 1
      src/main/frontend/components/reference.cljs
  24. 1 1
      src/main/frontend/db/async.cljs
  25. 1 1
      src/main/frontend/db/model.cljs
  26. 1 1
      src/main/frontend/handler/page.cljs
  27. 1 1
      src/main/frontend/worker/db/migrate.cljs
  28. 1 1
      src/main/frontend/worker/handler/page/db_based/page.cljs
  29. 3 3
      src/test/frontend/worker/rtc/client_test.cljs
  30. 2 2
      src/test/frontend/worker/rtc/db_listener_test.cljs

+ 1 - 1
deps/db/script/validate_client_db.cljs

@@ -82,7 +82,7 @@
                                (count ent-maps) " entities, "
                                (count ent-maps) " entities, "
                                (count (filter :block/name ent-maps)) " pages, "
                                (count (filter :block/name ent-maps)) " pages, "
                                (count (filter :block/title ent-maps)) " blocks, "
                                (count (filter :block/title ent-maps)) " blocks, "
-                               (count (filter ldb/tag? ent-maps)) " tags, "
+                               (count (filter ldb/class? ent-maps)) " tags, "
                                (count (filter #(seq (:block/tags %)) ent-maps)) " objects, "
                                (count (filter #(seq (:block/tags %)) ent-maps)) " objects, "
                                (count (filter ldb/property? ent-maps)) " properties and "
                                (count (filter ldb/property? ent-maps)) " properties and "
                                (count (mapcat db-property/properties ent-maps)) " property pairs"))
                                (count (mapcat db-property/properties ent-maps)) " property pairs"))

+ 3 - 3
deps/db/src/logseq/db.cljs

@@ -85,7 +85,7 @@
              (throw e))))))))
              (throw e))))))))
 
 
 (def page? sqlite-util/page?)
 (def page? sqlite-util/page?)
-(def tag? sqlite-util/tag?)
+(def class? sqlite-util/class?)
 (def property? sqlite-util/property?)
 (def property? sqlite-util/property?)
 (def closed-value? sqlite-util/closed-value?)
 (def closed-value? sqlite-util/closed-value?)
 (def whiteboard? sqlite-util/whiteboard?)
 (def whiteboard? sqlite-util/whiteboard?)
@@ -437,7 +437,7 @@
   "Whether property a built-in property for the specific class"
   "Whether property a built-in property for the specific class"
   [class-entity property-entity]
   [class-entity property-entity]
   (and (built-in? class-entity)
   (and (built-in? class-entity)
-       (tag? class-entity)
+       (class? class-entity)
        (built-in? property-entity)
        (built-in? property-entity)
        (contains? (set (map :db/ident (:class/schema.properties class-entity)))
        (contains? (set (map :db/ident (:class/schema.properties class-entity)))
                   (:db/ident property-entity))))
                   (:db/ident property-entity))))
@@ -541,7 +541,7 @@
       (loop [current-parent parent]
       (loop [current-parent parent]
         (when (and
         (when (and
                current-parent
                current-parent
-               (tag? parent)
+               (class? parent)
                (not (contains? @*classes (:db/id parent))))
                (not (contains? @*classes (:db/id parent))))
           (swap! *classes conj (:db/id current-parent))
           (swap! *classes conj (:db/id current-parent))
           (recur (:class/parent current-parent)))))
           (recur (:class/parent current-parent)))))

+ 2 - 2
deps/db/src/logseq/db/frontend/malli_schema.cljs

@@ -214,7 +214,7 @@
   "Common attributes for pages"
   "Common attributes for pages"
   [[:block/name :string]
   [[:block/name :string]
    [:block/title :string]
    [:block/title :string]
-   [:block/type [:enum "page" "tag" "property" "whiteboard" "journal" "hidden"]]
+   [:block/type [:enum "page" "class" "property" "whiteboard" "journal" "hidden"]]
    [:block/alias {:optional true} [:set :int]]
    [:block/alias {:optional true} [:set :int]]
     ;; TODO: Should this be here or in common?
     ;; TODO: Should this be here or in common?
    [:block/path-refs {:optional true} [:set :int]]
    [:block/path-refs {:optional true} [:set :int]]
@@ -431,7 +431,7 @@
                         (cond
                         (cond
                           (sqlite-util/property? d)
                           (sqlite-util/property? d)
                           :property
                           :property
-                          (sqlite-util/tag? d)
+                          (sqlite-util/class? d)
                           :class
                           :class
                           (sqlite-util/hidden? d)
                           (sqlite-util/hidden? d)
                           :hidden
                           :hidden

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

@@ -13,7 +13,7 @@
    ;; :block/type is a string type of the current block
    ;; :block/type is a string type of the current block
    ;; "whiteboard" for whiteboards
    ;; "whiteboard" for whiteboards
    ;; "property" for property blocks
    ;; "property" for property blocks
-   ;; "tag" for structured page
+   ;; "class" for structured page
    :block/type {:db/index true}
    :block/type {:db/index true}
    :block/schema {}
    :block/schema {}
    :block/uuid {:db/unique :db.unique/identity}
    :block/uuid {:db/unique :db.unique/identity}

+ 1 - 1
deps/db/src/logseq/db/sqlite/common_db.cljs

@@ -221,7 +221,7 @@
                            (d/datoms db :eavt (:e d))))))
                            (d/datoms db :eavt (:e d))))))
           [
           [
            ;; property and class pages are pulled from `get-all-pages` already
            ;; property and class pages are pulled from `get-all-pages` already
-           ;; "property" "tag"
+           ;; "property" "class"
            "closed value"]))
            "closed value"]))
 
 
 (defn get-favorites
 (defn get-favorites

+ 4 - 4
deps/db/src/logseq/db/sqlite/util.cljs

@@ -113,7 +113,7 @@
   {:pre [(qualified-keyword? (:db/ident block))]}
   {:pre [(qualified-keyword? (:db/ident block))]}
   (block-with-timestamps
   (block-with-timestamps
    (cond-> (merge block
    (cond-> (merge block
-                  {:block/type "tag"
+                  {:block/type "class"
                    :block/format :markdown})
                    :block/format :markdown})
      (not= (:db/ident block) :logseq.class/Root)
      (not= (:db/ident block) :logseq.class/Root)
      (assoc :class/parent :logseq.class/Root))))
      (assoc :class/parent :logseq.class/Root))))
@@ -130,12 +130,12 @@
 
 
 (defn page?
 (defn page?
   [block]
   [block]
-  (contains? #{"page" "journal" "whiteboard" "tag" "property" "hidden"}
+  (contains? #{"page" "journal" "whiteboard" "class" "property" "hidden"}
              (:block/type block)))
              (:block/type block)))
 
 
-(defn tag?
+(defn class?
   [entity]
   [entity]
-  (= (:block/type entity) "tag"))
+  (= (:block/type entity) "class"))
 (defn property?
 (defn property?
   [entity]
   [entity]
   (= (:block/type entity) "property"))
   (= (:block/type entity) "property"))

+ 2 - 2
deps/db/test/logseq/db/sqlite/build_test.cljs

@@ -14,13 +14,13 @@
            [{:page {:block/title "page1"}
            [{:page {:block/title "page1"}
              :blocks [{:block/title "Jrue Holiday" :build/tags [:Person]}]}
              :blocks [{:block/title "Jrue Holiday" :build/tags [:Person]}]}
             {:page {:block/title "Jayson Tatum" :build/tags [:Person]}}])]
             {:page {:block/title "Jayson Tatum" :build/tags [:Person]}}])]
-    (is (= {:block/tags [{:block/title "Person", :block/type "tag"}]}
+    (is (= {:block/tags [{:block/title "Person", :block/type "class"}]}
            (first (d/q '[:find [(pull ?b [{:block/tags [:block/title :block/type]}]) ...]
            (first (d/q '[:find [(pull ?b [{:block/tags [:block/title :block/type]}]) ...]
                          :where [?b :block/title "Jrue Holiday"]]
                          :where [?b :block/title "Jrue Holiday"]]
                        @conn)))
                        @conn)))
         "Person class is created and correctly associated to a block")
         "Person class is created and correctly associated to a block")
 
 
-    (is (= {:block/tags [{:block/title "Person", :block/type "tag"}]}
+    (is (= {:block/tags [{:block/title "Person", :block/type "class"}]}
            (first (d/q '[:find [(pull ?b [{:block/tags [:block/title :block/type]}]) ...]
            (first (d/q '[:find [(pull ?b [{:block/tags [:block/title :block/type]}]) ...]
                          :where [?b :block/title "Jayson Tatum"]]
                          :where [?b :block/title "Jayson Tatum"]]
                        @conn)))
                        @conn)))

+ 1 - 1
deps/db/test/logseq/db/sqlite/create_graph_test.cljs

@@ -61,7 +61,7 @@
   (let [conn (d/create-conn db-schema/schema-for-db-based-graph)
   (let [conn (d/create-conn db-schema/schema-for-db-based-graph)
         _ (d/transact! conn (sqlite-create-graph/build-db-initial-data "{}"))
         _ (d/transact! conn (sqlite-create-graph/build-db-initial-data "{}"))
         task (d/entity @conn :logseq.class/Task)]
         task (d/entity @conn :logseq.class/Task)]
-    (is (ldb/tag? task)
+    (is (ldb/class? task)
         "Task class has correct type")
         "Task class has correct type")
     (is (= 3 (count (:class/schema.properties task)))
     (is (= 3 (count (:class/schema.properties task)))
         "Has correct number of task properties")
         "Has correct number of task properties")

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

@@ -358,7 +358,7 @@
                  :else
                  :else
                  nil)]
                  nil)]
       (when page
       (when page
-        (let [type (if class? "tag" (or (:block/type page) "page"))]
+        (let [type (if class? "class" (or (:block/type page) "page"))]
           (assoc page :block/type type))))))
           (assoc page :block/type type))))))
 
 
 (defn- with-page-refs-and-tags
 (defn- with-page-refs-and-tags

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

@@ -68,7 +68,7 @@
       (if-let [existing-tag-uuid (first
       (if-let [existing-tag-uuid (first
                                   (d/q '[:find [?uuid ...]
                                   (d/q '[:find [?uuid ...]
                                          :in $ ?name
                                          :in $ ?name
-                                         :where [?b :block/uuid ?uuid] [?b :block/type "tag"] [?b :block/name ?name]]
+                                         :where [?b :block/uuid ?uuid] [?b :block/type "class"] [?b :block/name ?name]]
                                        db
                                        db
                                        (:block/name tag-block)))]
                                        (:block/name tag-block)))]
         [:block/uuid existing-tag-uuid]
         [:block/uuid existing-tag-uuid]
@@ -1017,7 +1017,7 @@
 (defn- export-class-properties
 (defn- export-class-properties
   [conn repo-or-conn]
   [conn repo-or-conn]
   (let [user-classes (->> (d/q '[:find (pull ?b [:db/id :db/ident])
   (let [user-classes (->> (d/q '[:find (pull ?b [:db/id :db/ident])
-                                 :where [?b :block/type "tag"]] @conn)
+                                 :where [?b :block/type "class"]] @conn)
                           (map first)
                           (map first)
                           (remove #(db-class/built-in-classes (:db/ident %))))
                           (remove #(db-class/built-in-classes (:db/ident %))))
         class-to-prop-uuids
         class-to-prop-uuids

+ 6 - 6
deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs

@@ -377,7 +377,7 @@
             "tagged block tag converts tag to page ref")
             "tagged block tag converts tag to page ref")
         (is (= [(:db/id tag-page)] (map :db/id (:block/refs block)))
         (is (= [(:db/id tag-page)] (map :db/id (:block/refs block)))
             "tagged block has correct refs")
             "tagged block has correct refs")
-        (is (and tag-page (not (ldb/tag? tag-page)))
+        (is (and tag-page (not (ldb/class? tag-page)))
             "tag page is not a class")
             "tag page is not a class")
 
 
         (is (= {:logseq.property/page-tags #{"Movie"}}
         (is (= {:logseq.property/page-tags #{"Movie"}}
@@ -406,9 +406,9 @@
              (:block/tags (readable-properties @conn block)))
              (:block/tags (readable-properties @conn block)))
           "tagged block has configured tag imported as a class")
           "tagged block has configured tag imported as a class")
 
 
-      (is (= "tag" (:block/type tag-page))
+      (is (= "class" (:block/type tag-page))
           "configured tag page in :tag-classes is a class")
           "configured tag page in :tag-classes is a class")
-      (is (and another-tag-page (not (ldb/tag? another-tag-page)))
+      (is (and another-tag-page (not (ldb/class? another-tag-page)))
           "unconfigured tag page is not a class")
           "unconfigured tag page is not a class")
 
 
       (is (= {:block/tags [:user.class/Movie]}
       (is (= {:block/tags [:user.class/Movie]}
@@ -445,7 +445,7 @@
     (is (= #{:user.class/Property :user.class/Movie}
     (is (= #{:user.class/Property :user.class/Movie}
            (->> @conn
            (->> @conn
                 (d/q '[:find [?ident ...]
                 (d/q '[:find [?ident ...]
-                       :where [?b :block/type "tag"] [?b :db/ident ?ident] (not [?b :logseq.property/built-in?])])
+                       :where [?b :block/type "class"] [?b :db/ident ?ident] (not [?b :logseq.property/built-in?])])
                 set))
                 set))
         "All classes are correctly defined by :type")
         "All classes are correctly defined by :type")
 
 
@@ -467,7 +467,7 @@
           "tagged block can have another property that references the same class it is tagged with,
           "tagged block can have another property that references the same class it is tagged with,
            without creating a duplicate class")
            without creating a duplicate class")
 
 
-      (is (= "tag" (:block/type tag-page))
+      (is (= "class" (:block/type tag-page))
           "configured tag page derived from :property-classes is a class")
           "configured tag page derived from :property-classes is a class")
       (is (nil? (find-page-by-name @conn "type"))
       (is (nil? (find-page-by-name @conn "type"))
           "No page exists for configured property")
           "No page exists for configured property")
@@ -499,7 +499,7 @@
     (is (= #{:user.class/Movie :user.class/CreativeWork :user.class/Thing}
     (is (= #{:user.class/Movie :user.class/CreativeWork :user.class/Thing}
            (->> @conn
            (->> @conn
                 (d/q '[:find [?ident ...]
                 (d/q '[:find [?ident ...]
-                       :where [?b :block/type "tag"] [?b :db/ident ?ident] (not [?b :logseq.property/built-in?])])
+                       :where [?b :block/type "class"] [?b :db/ident ?ident] (not [?b :logseq.property/built-in?])])
                 set))
                 set))
         "All classes are correctly defined by :type")
         "All classes are correctly defined by :type")
 
 

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

@@ -79,7 +79,7 @@
                                                                       (let [refs (:block/_refs page)]
                                                                       (let [refs (:block/_refs page)]
                                                                         (and (or (zero? (count refs))
                                                                         (and (or (zero? (count refs))
                                                                                  (= #{db-id} (set (map :db/id refs))))
                                                                                  (= #{db-id} (set (map :db/id refs))))
-                                                                             (not (some #{"tag" "property"} (:block/type page))))))}))]
+                                                                             (not (some #{"class" "property"} (:block/type page))))))}))]
       (when (seq orphaned-pages)
       (when (seq orphaned-pages)
         (let [tx (mapv (fn [page] [:db/retractEntity (:db/id page)]) orphaned-pages)]
         (let [tx (mapv (fn [page] [:db/retractEntity (:db/id page)]) orphaned-pages)]
           (swap! txs-state (fn [state] (vec (concat state tx)))))))))
           (swap! txs-state (fn [state] (vec (concat state tx)))))))))

+ 4 - 4
deps/outliner/src/logseq/outliner/property.cljs

@@ -335,7 +335,7 @@
 
 
 (defn ^:api get-class-parents
 (defn ^:api get-class-parents
   [tags]
   [tags]
-  (let [tags' (filter ldb/tag? tags)]
+  (let [tags' (filter ldb/class? tags)]
     (set (mapcat ldb/get-class-parents tags'))))
     (set (mapcat ldb/get-class-parents tags'))))
 
 
 (defn ^:api get-class-properties
 (defn ^:api get-class-properties
@@ -351,7 +351,7 @@
   (let [block (d/entity db eid)
   (let [block (d/entity db eid)
         classes (->> (:block/tags block)
         classes (->> (:block/tags block)
                      (sort-by :block/name)
                      (sort-by :block/name)
-                     (filter ldb/tag?))
+                     (filter ldb/class?))
         class-parents (get-class-parents classes)
         class-parents (get-class-parents classes)
         all-classes (->> (concat classes class-parents)
         all-classes (->> (concat classes class-parents)
                          (filter (fn [class]
                          (filter (fn [class]
@@ -514,7 +514,7 @@
 (defn class-add-property!
 (defn class-add-property!
   [conn class-id property-id]
   [conn class-id property-id]
   (when-let [class (d/entity @conn class-id)]
   (when-let [class (d/entity @conn class-id)]
-    (if (ldb/tag? class)
+    (if (ldb/class? class)
       (ldb/transact! conn
       (ldb/transact! conn
                      [[:db/add (:db/id class) :class/schema.properties property-id]]
                      [[:db/add (:db/id class) :class/schema.properties property-id]]
                      {:outliner-op :save-block})
                      {:outliner-op :save-block})
@@ -524,7 +524,7 @@
 (defn class-remove-property!
 (defn class-remove-property!
   [conn class-id property-id]
   [conn class-id property-id]
   (when-let [class (d/entity @conn class-id)]
   (when-let [class (d/entity @conn class-id)]
-    (when (ldb/tag? class)
+    (when (ldb/class? class)
       (when-let [property (d/entity @conn property-id)]
       (when-let [property (d/entity @conn property-id)]
         (when-not (ldb/built-in-class-property? class property)
         (when-not (ldb/built-in-class-property? class property)
           (ldb/transact! conn [[:db/retract (:db/id class) :class/schema.properties property-id]]
           (ldb/transact! conn [[:db/retract (:db/id class) :class/schema.properties property-id]]

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

@@ -13,7 +13,7 @@
 
 
 (sr/defkeyword :block/type
 (sr/defkeyword :block/type
   "block type"
   "block type"
-  [:enum "page" "property" "tag" "whiteboard" "hidden"])
+  [:enum "page" "property" "class" "whiteboard" "hidden"])
 
 
 (sr/defkeyword :block/parent
 (sr/defkeyword :block/parent
   "page blocks don't have this attr")
   "page blocks don't have this attr")

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

@@ -223,7 +223,7 @@
   (let [entity (db/entity [:block/uuid (:block/uuid page)])
   (let [entity (db/entity [:block/uuid (:block/uuid page)])
         source-page (model/get-alias-source-page repo (:db/id entity))
         source-page (model/get-alias-source-page repo (:db/id entity))
         icon (cond
         icon (cond
-               (ldb/tag? entity)
+               (ldb/class? entity)
                "hash"
                "hash"
                (ldb/property? entity)
                (ldb/property? entity)
                "letter-p"
                "letter-p"

+ 4 - 4
src/main/frontend/components/db_based/page.cljs

@@ -52,7 +52,7 @@
   [state page *mode]
   [state page *mode]
   (let [*mode *mode
   (let [*mode *mode
         mode (rum/react *mode)
         mode (rum/react *mode)
-        class? (ldb/tag? page)
+        class? (ldb/class? page)
         property? (ldb/property? page)
         property? (ldb/property? page)
         page-opts {:configure? true}]
         page-opts {:configure? true}]
     (when (nil? mode)
     (when (nil? mode)
@@ -75,7 +75,7 @@
 (rum/defc mode-switch < rum/reactive
 (rum/defc mode-switch < rum/reactive
   [type *mode]
   [type *mode]
   (let [current-mode (rum/react *mode)
   (let [current-mode (rum/react *mode)
-        class? (= type "tag")
+        class? (= type "class")
         property? (= type "property")
         property? (= type "property")
         modes (->
         modes (->
                (cond
                (cond
@@ -106,7 +106,7 @@
         *hover? (::hover? state)
         *hover? (::hover? state)
         *mode (::mode state)
         *mode (::mode state)
         type (:block/type page)
         type (:block/type page)
-        class? (ldb/tag? page)
+        class? (ldb/class? page)
         collapsed? (not @*show-info?)
         collapsed? (not @*show-info?)
         has-properties? (or
         has-properties? (or
                          (seq (:block/tags page))
                          (seq (:block/tags page))
@@ -131,7 +131,7 @@
                                (reset! *hover? false))
                                (reset! *hover? false))
             :on-click (if config/publishing?
             :on-click (if config/publishing?
                         (fn [_]
                         (fn [_]
-                          (when (contains? #{"tag" "property"} type)
+                          (when (contains? #{"class" "property"} type)
                             (swap! *show-info? not)))
                             (swap! *show-info? not)))
                         #(do
                         #(do
                            (swap! *show-info? not)
                            (swap! *show-info? not)

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

@@ -172,7 +172,7 @@
                        [:div.flex.flex-row.items-center.gap-1
                        [:div.flex.flex-row.items-center.gap-1
                         (when-not db-tag?
                         (when-not db-tag?
                           (cond
                           (cond
-                            (ldb/tag? block)
+                            (ldb/class? block)
                             [:div (ui/icon "hash" {:size 14})]
                             [:div (ui/icon "hash" {:size 14})]
                             (ldb/property? block)
                             (ldb/property? block)
                             [:div (ui/icon "letter-p" {:size 14})]
                             [:div (ui/icon "letter-p" {:size 14})]

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

@@ -32,7 +32,7 @@
 (defn get-node-icon
 (defn get-node-icon
   [node-entity opts]
   [node-entity opts]
   (let [default-icon-id (cond
   (let [default-icon-id (cond
-                          (ldb/tag? node-entity)
+                          (ldb/class? node-entity)
                           "hash"
                           "hash"
                           (ldb/property? node-entity)
                           (ldb/property? node-entity)
                           "letter-p"
                           "letter-p"

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

@@ -239,7 +239,7 @@
   {:entities (count entities)
   {:entities (count entities)
    :pages (count (filter :block/name entities))
    :pages (count (filter :block/name entities))
    :blocks (count (filter :block/title entities))
    :blocks (count (filter :block/title entities))
-   :classes (count (filter ldb/tag? entities))
+   :classes (count (filter ldb/class? entities))
    :objects (count (filter #(seq (:block/tags %)) entities))
    :objects (count (filter #(seq (:block/tags %)) entities))
    :properties (count (filter ldb/property? entities))
    :properties (count (filter ldb/property? entities))
    :property-values (count (mapcat :block/properties entities))})
    :property-values (count (mapcat :block/properties entities))})

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

@@ -336,7 +336,7 @@
               journal? (ldb/journal? page)
               journal? (ldb/journal? page)
               icon (or (get page (pu/get-pid :logseq.property/icon))
               icon (or (get page (pu/get-pid :logseq.property/icon))
                        (when db-based?
                        (when db-based?
-                         (or (when (ldb/tag? page)
+                         (or (when (ldb/class? page)
                                {:type :tabler-icon
                                {:type :tabler-icon
                                 :id "hash"})
                                 :id "hash"})
                              (when (ldb/property? page)
                              (when (ldb/property? page)
@@ -557,14 +557,14 @@
             (cond
             (cond
               (and db-based? (not block?))
               (and db-based? (not block?))
               (db-page/page-info page
               (db-page/page-info page
-                                 (if (and (ldb/tag? page) sidebar?)
+                                 (if (and (ldb/class? page) sidebar?)
                                    (atom true)
                                    (atom true)
                                    (::show-page-info? state)))
                                    (::show-page-info? state)))
 
 
               (and (not db-based?) (not block?))
               (and (not db-based?) (not block?))
               [:div.pb-2])
               [:div.pb-2])
 
 
-            (when (and db-based? (ldb/tag? page))
+            (when (and db-based? (ldb/class? page))
               [:div.mt-8
               [:div.mt-8
                (objects/class-objects page)])
                (objects/class-objects page)])
 
 
@@ -572,7 +572,7 @@
               [:div.mt-8
               [:div.mt-8
                (objects/property-related-objects page)])
                (objects/property-related-objects page)])
 
 
-            (when-not (and db-based? (or (ldb/tag? page) (ldb/property? page)))
+            (when-not (and db-based? (or (ldb/class? page) (ldb/property? page)))
               [:div
               [:div
                (when (and block? (not sidebar?) (not whiteboard?))
                (when (and block? (not sidebar?) (not whiteboard?))
                  (let [config (merge config {:id "block-parent"
                  (let [config (merge config {:id "block-parent"
@@ -595,7 +595,7 @@
             (when (and (not block?) (not db-based?))
             (when (and (not block?) (not db-based?))
               (tagged-pages repo page page-title))
               (tagged-pages repo page page-title))
 
 
-            (when (ldb/tag? page)
+            (when (ldb/class? page)
               (class-component/class-children page))
               (class-component/class-children page))
 
 
             ;; referenced blocks
             ;; referenced blocks

+ 4 - 4
src/main/frontend/components/property.cljs

@@ -113,7 +113,7 @@
 
 
 (defn- handle-delete-property!
 (defn- handle-delete-property!
   [block property & {:keys [class? class-schema?]}]
   [block property & {:keys [class? class-schema?]}]
-  (let [class? (or class? (ldb/tag? block))
+  (let [class? (or class? (ldb/class? block))
         remove! #(let [repo (state/get-current-repo)]
         remove! #(let [repo (state/get-current-repo)]
                    (if (and class? class-schema?)
                    (if (and class? class-schema?)
                      (db-property-handler/class-remove-property! (:db/id block) (:db/id property))
                      (db-property-handler/class-remove-property! (:db/id block) (:db/id property))
@@ -131,7 +131,7 @@
   [entity property-uuid-or-name schema {:keys [class-schema? page-configure?]}]
   [entity property-uuid-or-name schema {:keys [class-schema? page-configure?]}]
   (p/let [repo (state/get-current-repo)
   (p/let [repo (state/get-current-repo)
           ;; Both conditions necessary so that a class can add its own page properties
           ;; Both conditions necessary so that a class can add its own page properties
-          add-class-property? (and (ldb/tag? entity) page-configure? class-schema?)
+          add-class-property? (and (ldb/class? entity) page-configure? class-schema?)
           result (when (uuid? property-uuid-or-name)
           result (when (uuid? property-uuid-or-name)
                    (db-async/<get-block repo property-uuid-or-name {:children? false}))
                    (db-async/<get-block repo property-uuid-or-name {:children? false}))
           ;; In block context result is in :block
           ;; In block context result is in :block
@@ -193,7 +193,7 @@
                 (reset! *show-new-property-config? :adding-property))
                 (reset! *show-new-property-config? :adding-property))
               (p/let [property' (when block (<add-property-from-dropdown block property-name schema opts))
               (p/let [property' (when block (<add-property-from-dropdown block property-name schema opts))
                       property (or property' property)
                       property (or property' property)
-                      add-class-property? (and (ldb/tag? block) page-configure? class-schema?)]
+                      add-class-property? (and (ldb/class? block) page-configure? class-schema?)]
                 (when *property (reset! *property property))
                 (when *property (reset! *property property))
                 (p/do!
                 (p/do!
                  (when *show-new-property-config? (reset! *show-new-property-config? false))
                  (when *show-new-property-config? (reset! *show-new-property-config? false))
@@ -475,7 +475,7 @@
         (reset! *show-new-property-config? true))
         (reset! *show-new-property-config? true))
       (reset! *property property)
       (reset! *property property)
       (when property
       (when property
-        (let [add-class-property? (and (ldb/tag? block) class-schema?)
+        (let [add-class-property? (and (ldb/class? block) class-schema?)
               type (get-in property [:block/schema :type])]
               type (get-in property [:block/schema :type])]
           (cond
           (cond
             add-class-property?
             add-class-property?

+ 3 - 3
src/main/frontend/components/property/value.cljs

@@ -101,7 +101,7 @@
   ([block property-id property-value' {:keys [exit-edit? class-schema?]
   ([block property-id property-value' {:keys [exit-edit? class-schema?]
                                        :or {exit-edit? true}}]
                                        :or {exit-edit? true}}]
    (let [repo (state/get-current-repo)
    (let [repo (state/get-current-repo)
-         class? (ldb/tag? block)
+         class? (ldb/class? block)
          property (db/entity property-id)
          property (db/entity property-id)
          many? (db-property/many? property)
          many? (db-property/many? property)
          checkbox? (= :checkbox (get-in property [:block/schema :type]))]
          checkbox? (= :checkbox (get-in property [:block/schema :type]))]
@@ -313,7 +313,7 @@
 (defn- get-node-icon
 (defn- get-node-icon
   [node]
   [node]
   (cond
   (cond
-    (ldb/tag? node)
+    (ldb/class? node)
     "hash"
     "hash"
     (ldb/property? node)
     (ldb/property? node)
     "letter-p"
     "letter-p"
@@ -569,7 +569,7 @@
     (if (state/sub-async-query-loading value)
     (if (state/sub-async-query-loading value)
       [:div.text-sm.opacity-70 "loading"]
       [:div.text-sm.opacity-70 "loading"]
       (if-let [v-block (db/sub-block (:db/id value))]
       (if-let [v-block (db/sub-block (:db/id value))]
-        (let [class? (ldb/tag? v-block)
+        (let [class? (ldb/class? v-block)
               invalid-warning [:div.warning.text-sm
               invalid-warning [:div.warning.text-sm
                                "Invalid block value, please delete the current property."]]
                                "Invalid block value, please delete the current property."]]
           (when v-block
           (when v-block

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

@@ -62,7 +62,7 @@
   [page-entity *filters total filter-n filtered-ref-blocks *ref-pages]
   [page-entity *filters total filter-n filtered-ref-blocks *ref-pages]
   (let [filters @*filters
   (let [filters @*filters
         threshold (state/get-linked-references-collapsed-threshold)
         threshold (state/get-linked-references-collapsed-threshold)
-        default-collapsed? (or (>= total threshold) (ldb/tag? page-entity))
+        default-collapsed? (or (>= total threshold) (ldb/class? page-entity))
         *collapsed? (atom nil)]
         *collapsed? (atom nil)]
     (ui/foldable
     (ui/foldable
      [:div.flex.flex-row.flex-1.justify-between.items-center
      [:div.flex.flex-row.flex-1.justify-between.items-center

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

@@ -288,7 +288,7 @@
   (<q graph {:transact-db? false}
   (<q graph {:transact-db? false}
       '[:find [(pull ?tag [:db/id :block/title])]
       '[:find [(pull ?tag [:db/id :block/title])]
         :where
         :where
-        [?tag :block/type "tag"]]))
+        [?tag :block/type "class"]]))
 
 
 (comment
 (comment
   (defn <fetch-all-pages
   (defn <fetch-all-pages

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

@@ -758,7 +758,7 @@ independent of format as format specific heading characters are stripped"
   [repo & {:keys [except-root-class?]
   [repo & {:keys [except-root-class?]
            :or {except-root-class? false}}]
            :or {except-root-class? false}}]
   (let [db (conn/get-db repo)
   (let [db (conn/get-db repo)
-        classes (->> (d/datoms db :avet :block/type "tag")
+        classes (->> (d/datoms db :avet :block/type "class")
                      (map (fn [d]
                      (map (fn [d]
                             (db-utils/entity db (:e d)))))]
                             (db-utils/entity db (:e d)))))]
     (if except-root-class?
     (if except-root-class?

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

@@ -341,7 +341,7 @@
         (let [chosen (:block/title chosen-result)
         (let [chosen (:block/title chosen-result)
               class? (and db-based? hashtag?
               class? (and db-based? hashtag?
                           (or (string/includes? chosen (str (t :new-tag) " "))
                           (or (string/includes? chosen (str (t :new-tag) " "))
-                              (ldb/tag? (db/get-page chosen))))
+                              (ldb/class? (db/get-page chosen))))
               chosen (-> chosen
               chosen (-> chosen
                          (string/replace-first (str (t :new-tag) " ") "")
                          (string/replace-first (str (t :new-tag) " ") "")
                          (string/replace-first (str (t :new-page) " ") ""))
                          (string/replace-first (str (t :new-page) " ") ""))

+ 1 - 1
src/main/frontend/worker/db/migrate.cljs

@@ -103,7 +103,7 @@
                                   type (if (set? types)
                                   type (if (set? types)
                                          (cond
                                          (cond
                                            (contains? types "class")
                                            (contains? types "class")
-                                           "tag"
+                                           "class"
                                            (contains? types "property")
                                            (contains? types "property")
                                            "property"
                                            "property"
                                            (contains? types "whiteboard")
                                            (contains? types "whiteboard")

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

@@ -15,7 +15,7 @@
 
 
 (defn- build-page-tx [conn properties page {:keys [whiteboard? class? tags]}]
 (defn- build-page-tx [conn properties page {:keys [whiteboard? class? tags]}]
   (when (:block/uuid page)
   (when (:block/uuid page)
-    (let [page (assoc page :block/type (cond class? "tag"
+    (let [page (assoc page :block/type (cond class? "class"
                                              whiteboard? "whiteboard"
                                              whiteboard? "whiteboard"
                                              (:block/type page) (:block/type page)
                                              (:block/type page) (:block/type page)
                                              :else "page"))
                                              :else "page"))

+ 3 - 3
src/test/frontend/worker/rtc/client_test.cljs

@@ -16,7 +16,7 @@
                                    :block/created-at 1720017595872,
                                    :block/created-at 1720017595872,
                                    :block/format :markdown,
                                    :block/format :markdown,
                                    :db/ident :user.class/yyy,
                                    :db/ident :user.class/yyy,
-                                   :block/type "tag",
+                                   :block/type "class",
                                    :block/name "yyy",
                                    :block/name "yyy",
                                    :block/title "yyy"}])]
                                    :block/title "yyy"}])]
       (is (= {:update
       (is (= {:update
@@ -26,7 +26,7 @@
                :av-coll
                :av-coll
                [[:block/name "[\"~#'\",\"yyy\"]" 1 true]
                [[:block/name "[\"~#'\",\"yyy\"]" 1 true]
                 [:block/title "[\"~#'\",\"yyy\"]" 1 true]
                 [:block/title "[\"~#'\",\"yyy\"]" 1 true]
-                [:block/type "[\"~#'\",\"tag\"]" 1 true]]}}
+                [:block/type "[\"~#'\",\"class\"]" 1 true]]}}
              (:remote-ops
              (:remote-ops
               (#'subject/local-block-ops->remote-ops
               (#'subject/local-block-ops->remote-ops
                db
                db
@@ -36,7 +36,7 @@
                             :av-coll
                             :av-coll
                             [[:block/name (ldb/write-transit-str "yyy") 1 true]
                             [[:block/name (ldb/write-transit-str "yyy") 1 true]
                              [:block/title (ldb/write-transit-str "yyy") 1 true]
                              [:block/title (ldb/write-transit-str "yyy") 1 true]
-                             [:block/type (ldb/write-transit-str "tag") 1 true]]}]}))))))
+                             [:block/type (ldb/write-transit-str "class") 1 true]]}]}))))))
 
 
   (testing "user.property/xxx creation"
   (testing "user.property/xxx creation"
     (let [block-uuid (random-uuid)
     (let [block-uuid (random-uuid)

+ 2 - 2
src/test/frontend/worker/rtc/db_listener_test.cljs

@@ -91,7 +91,7 @@
                    [:db/add 62 :block/created-at 1720019497643 536870954]
                    [:db/add 62 :block/created-at 1720019497643 536870954]
                    [:db/add 62 :block/format :markdown 536870954]
                    [:db/add 62 :block/format :markdown 536870954]
                    [:db/add 62 :db/ident :user.class/zzz 536870954]
                    [:db/add 62 :db/ident :user.class/zzz 536870954]
-                   [:db/add 62 :block/type "tag" 536870954]
+                   [:db/add 62 :block/type "class" 536870954]
                    [:db/add 62 :block/name "zzz" 536870954]
                    [:db/add 62 :block/name "zzz" 536870954]
                    [:db/add 62 :block/title "zzz" 536870954]]
                    [:db/add 62 :block/title "zzz" 536870954]]
           {:keys [db-before db-after tx-data]} (d/transact! conn tx-data)
           {:keys [db-before db-after tx-data]} (d/transact! conn tx-data)
@@ -105,7 +105,7 @@
                       [[:block/updated-at "[\"~#'\",1720019497643]"]
                       [[:block/updated-at "[\"~#'\",1720019497643]"]
                        [:block/created-at "[\"~#'\",1720019497643]"]
                        [:block/created-at "[\"~#'\",1720019497643]"]
                        [:block/title "[\"~#'\",\"zzz\"]"]
                        [:block/title "[\"~#'\",\"zzz\"]"]
-                       [:block/type "[\"~#'\",\"tag\"]"]
+                       [:block/type "[\"~#'\",\"class\"]"]
                        ;;1. no :class/parent, because db/id 4 block doesn't exist in empty-db
                        ;;1. no :class/parent, because db/id 4 block doesn't exist in empty-db
                        ;;2. shouldn't have :db/ident, :db/ident is special, will be handled later
                        ;;2. shouldn't have :db/ident, :db/ident is special, will be handled later
                        ]}]]
                        ]}]]