Browse Source

enhance: prefer tag instead of class on UI

Some users are confused with Classes/Objects, so on UI it'll be
Tags/Nodes.
Tienson Qin 1 year ago
parent
commit
4083a2d0a0
34 changed files with 73 additions and 74 deletions
  1. 1 1
      deps/db/script/validate_client_db.cljs
  2. 3 3
      deps/db/src/logseq/db.cljs
  3. 1 1
      deps/db/src/logseq/db/frontend/class.cljs
  4. 2 2
      deps/db/src/logseq/db/frontend/malli_schema.cljs
  5. 2 3
      deps/db/src/logseq/db/frontend/schema.cljs
  6. 1 1
      deps/db/src/logseq/db/sqlite/common_db.cljs
  7. 2 2
      deps/db/src/logseq/db/sqlite/util.cljs
  8. 2 2
      deps/db/test/logseq/db/sqlite/build_test.cljs
  9. 1 1
      deps/db/test/logseq/db/sqlite/create_graph_test.cljs
  10. 1 1
      deps/graph-parser/src/logseq/graph_parser/block.cljs
  11. 2 2
      deps/graph-parser/src/logseq/graph_parser/exporter.cljs
  12. 6 6
      deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs
  13. 1 1
      deps/outliner/src/logseq/outliner/core.cljs
  14. 4 4
      deps/outliner/src/logseq/outliner/property.cljs
  15. 1 1
      scripts/src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs
  16. 1 1
      src/main/frontend/common_keywords.cljs
  17. 8 6
      src/main/frontend/components/class.cljs
  18. 1 1
      src/main/frontend/components/cmdk/core.cljs
  19. 8 9
      src/main/frontend/components/db_based/page.cljs
  20. 3 3
      src/main/frontend/components/editor.cljs
  21. 1 1
      src/main/frontend/components/imports.cljs
  22. 1 1
      src/main/frontend/components/page.cljs
  23. 6 6
      src/main/frontend/components/property.cljs
  24. 2 2
      src/main/frontend/components/property/value.cljs
  25. 1 1
      src/main/frontend/db/async.cljs
  26. 1 1
      src/main/frontend/db/model.cljs
  27. 1 1
      src/main/frontend/handler/editor.cljs
  28. 1 1
      src/main/frontend/handler/events.cljs
  29. 2 2
      src/main/frontend/handler/page.cljs
  30. 1 1
      src/main/frontend/worker/handler/page/db_based/page.cljs
  31. 1 2
      src/resources/dicts/en.edn
  32. 1 1
      src/test/frontend/db/db_based_model_test.cljs
  33. 2 2
      src/test/frontend/worker/rtc/client_test.cljs
  34. 1 1
      src/test/frontend/worker/rtc/db_listener_test.cljs

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

@@ -81,7 +81,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 #(= (:block/type %) "class") ent-maps)) " classes, "
+                               (count (filter #(= (:block/type %) "tag") ent-maps)) " tags, "
                                (count (filter #(seq (:block/tags %)) ent-maps)) " objects, "
                                (count (filter #(seq (:block/tags %)) ent-maps)) " objects, "
                                (count (filter #(= (:block/type %) "property") ent-maps)) " properties and "
                                (count (filter #(= (:block/type %) "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

@@ -448,7 +448,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)
-       (= (:block/type class-entity) "class")
+       (= (:block/type class-entity) "tag")
        (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))))
@@ -506,7 +506,7 @@
 (def page? sqlite-util/page?)
 (def page? sqlite-util/page?)
 (defn class?
 (defn class?
   [entity]
   [entity]
-  (= (:block/type entity) "class"))
+  (= (:block/type entity) "tag"))
 (defn property?
 (defn property?
   [entity]
   [entity]
   (= (:block/type entity) "property"))
   (= (:block/type entity) "property"))
@@ -562,7 +562,7 @@
       (loop [current-parent parent]
       (loop [current-parent parent]
         (when (and
         (when (and
                current-parent
                current-parent
-               (= (:block/type parent) "class")
+               (= (:block/type parent) "tag")
                (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)))))

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

@@ -5,7 +5,7 @@
 
 
 (def ^:large-vars/data-var built-in-classes
 (def ^:large-vars/data-var built-in-classes
   "Map of built-in classes for db graphs with their :db/ident as keys"
   "Map of built-in classes for db graphs with their :db/ident as keys"
-  {:logseq.class/Root {:title "Root class"}
+  {:logseq.class/Root {:title "Root tag"}
 
 
    :logseq.class/Task
    :logseq.class/Task
    {:title "Task"
    {:title "Task"

+ 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" "class" "property" "whiteboard" "journal" "hidden"]]
+   [:block/type [:enum "page" "tag" "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
                           (= (:block/type d) "property")
                           (= (:block/type d) "property")
                           :property
                           :property
-                          (= (:block/type d) "class")
+                          (= (:block/type d) "tag")
                           :class
                           :class
                           (= (:block/type d) "hidden")
                           (= (:block/type d) "hidden")
                           :hidden
                           :hidden

+ 2 - 3
deps/db/src/logseq/db/frontend/schema.cljs

@@ -10,11 +10,10 @@
 
 
    :recent/pages {}
    :recent/pages {}
 
 
-   ;; :block/type is a string type or multiple types of the current block
+   ;; :block/type is a string type of the current block
    ;; "whiteboard" for whiteboards
    ;; "whiteboard" for whiteboards
-   ;; "macros" for macro
    ;; "property" for property blocks
    ;; "property" for property blocks
-   ;; "class" for structured page
+   ;; "tag" 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" "class"
+           ;; "property" "tag"
            "closed value"]))
            "closed value"]))
 
 
 (defn get-favorites
 (defn get-favorites

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

@@ -112,7 +112,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 "class"
+                  {:block/type "tag"
                    :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))))
@@ -129,5 +129,5 @@
 
 
 (defn page?
 (defn page?
   [block]
   [block]
-  (contains? #{"page" "journal" "whiteboard" "class" "property" "hidden"}
+  (contains? #{"page" "journal" "whiteboard" "tag" "property" "hidden"}
              (:block/type block)))
              (:block/type block)))

+ 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 "class"}]}
+    (is (= {:block/tags [{:block/title "Person", :block/type "tag"}]}
            (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 "class"}]}
+    (is (= {:block/tags [{:block/title "Person", :block/type "tag"}]}
            (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

@@ -60,7 +60,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 (= (:block/type task) "class")
+    (is (= (:block/type task) "tag")
         "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? "class" (or (:block/type page) "page"))]
+        (let [type (if class? "tag" (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 "class"] [?b :block/name ?name]]
+                                         :where [?b :block/uuid ?uuid] [?b :block/type "tag"] [?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 "class"]] @conn)
+                                 :where [?b :block/type "tag"]] @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 (= (:block/type tag-page) "class")))
+        (is (and tag-page (not (= (:block/type tag-page) "tag")))
             "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 (= "class" (:block/type tag-page))
+      (is (= "tag" (: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= (:block/type another-tag-page) "class"))
+      (is (and another-tag-page (not= (:block/type another-tag-page) "tag"))
           "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 "class"] [?b :db/ident ?ident] (not [?b :logseq.property/built-in?])])
+                       :where [?b :block/type "tag"] [?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 (= "class" (:block/type tag-page))
+      (is (= "tag" (: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 "class"] [?b :db/ident ?ident] (not [?b :logseq.property/built-in?])])
+                       :where [?b :block/type "tag"] [?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 #{"class" "property"} (:block/type page))))))}))]
+                                                                             (not (some #{"tag" "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 (fn [tag] (= (:block/type tag) "class")) tags)]
+  (let [tags' (filter (fn [tag] (= (:block/type tag) "tag")) 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 (fn [tag] (= (:block/type tag) "class"))))
+                     (filter (fn [tag] (= (:block/type tag) "tag"))))
         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]
@@ -522,7 +522,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 (= (:block/type class) "class")
+    (if (= (:block/type class) "tag")
       (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})
@@ -532,7 +532,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 (= (:block/type class) "class")
+    (when (= (:block/type class) "tag")
       (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
scripts/src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs

@@ -410,7 +410,7 @@
                                     options)
                                     options)
         {:keys [init-tx block-props-tx]} (outliner-cli/build-blocks-tx init-data)]
         {:keys [init-tx block-props-tx]} (outliner-cli/build-blocks-tx init-data)]
     (println "Generating" (str (count (filter :block/name init-tx)) " pages with "
     (println "Generating" (str (count (filter :block/name init-tx)) " pages with "
-                               (count (:classes init-data)) " classes and "
+                               (count (:classes init-data)) " tags and "
                                (count (:properties init-data)) " properties ..."))
                                (count (:properties init-data)) " properties ..."))
     (d/transact! conn init-tx)
     (d/transact! conn init-tx)
     (d/transact! conn block-props-tx)
     (d/transact! conn block-props-tx)

+ 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" "class" "whiteboard" "hidden"])
+  [:enum "page" "property" "tag" "whiteboard" "hidden"])
 
 
 (sr/defkeyword :block/parent
 (sr/defkeyword :block/parent
   "page blocks don't have this attr")
   "page blocks don't have this attr")

+ 8 - 6
src/main/frontend/components/class.cljs

@@ -24,9 +24,9 @@
                                             :selected (= class (:block/uuid entity))})
                                             :selected (= class (:block/uuid entity))})
                               classes))
                               classes))
         options (cons (if class
         options (cons (if class
-                        {:label "Choose parent class"
+                        {:label "Choose parent tag"
                          :value "Choose"}
                          :value "Choose"}
-                        {:label "Choose parent class"
+                        {:label "Choose parent tag"
                          :disabled true
                          :disabled true
                          :selected true
                          :selected true
                          :value "Choose"})
                          :value "Choose"})
@@ -65,13 +65,15 @@
                :or {show-title? true}}]
                :or {show-title? true}}]
   (let [page-id (:db/id page)
   (let [page-id (:db/id page)
         page (when page-id (db/sub-block page-id))]
         page (when page-id (db/sub-block page-id))]
+    (prn :debug :page-id page-id
+         :page page)
     (when page
     (when page
       [:div.property-configure.grid.gap-2
       [:div.property-configure.grid.gap-2
-       (when show-title? [:h1.title.mb-4 "Configure class"])
+       (when show-title? [:h1.title.mb-4 "Configure tag"])
 
 
        (when-not (= (:db/ident page) :logseq.class/Root)
        (when-not (= (:db/ident page) :logseq.class/Root)
          [:div.grid.grid-cols-5.gap-1.items-center.class-parent
          [:div.grid.grid-cols-5.gap-1.items-center.class-parent
-          [:div.col-span-2 "Parent class:"]
+          [:div.col-span-2 "Parent tag:"]
           (if config/publishing?
           (if config/publishing?
             [:div.col-span-3
             [:div.col-span-3
              (if-let [parent-class (some-> (:db/id (:class/parent page))
              (if-let [parent-class (some-> (:db/id (:class/parent page))
@@ -92,7 +94,7 @@
                class-ancestors (reverse ancestor-pages)]
                class-ancestors (reverse ancestor-pages)]
            (when (> (count class-ancestors) 2)
            (when (> (count class-ancestors) 2)
              [:div.grid.grid-cols-5.gap-1.items-center.class-ancestors
              [:div.grid.grid-cols-5.gap-1.items-center.class-ancestors
-              [:div.col-span-2 "Ancestor classes:"]
+              [:div.col-span-2 "Ancestor tags:"]
               [:div.col-span-3
               [:div.col-span-3
                (interpose [:span.opacity-50.text-sm " > "]
                (interpose [:span.opacity-50.text-sm " > "]
                           (map (fn [{class-name :block/title :as ancestor}]
                           (map (fn [{class-name :block/title :as ancestor}]
@@ -123,7 +125,7 @@
           default-collapsed? (> (count children-pages) 30)]
           default-collapsed? (> (count children-pages) 30)]
       [:div.mt-4
       [:div.mt-4
        (ui/foldable
        (ui/foldable
-        [:h2.font-medium "Child classes (" (count children-pages) ")"]
+        [:h2.font-medium "Child tags (" (count children-pages) ")"]
         [:div.mt-2.ml-1 (class-children-aux class {:default-collapsed? default-collapsed?})]
         [:div.mt-2.ml-1 (class-children-aux class {:default-collapsed? default-collapsed?})]
         {:default-collapsed? false
         {:default-collapsed? false
          :title-trigger? true})])))
          :title-trigger? true})])))

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

@@ -73,7 +73,7 @@
 (defn create-items [q]
 (defn create-items [q]
   (when-not (string/blank? q)
   (when-not (string/blank? q)
     (let [class? (string/starts-with? q "#")]
     (let [class? (string/starts-with? q "#")]
-      (->> [{:text (if class? "Create class" "Create page")       :icon "new-page"
+      (->> [{:text (if class? "Create tag" "Create page")       :icon "new-page"
              :icon-theme :gray
              :icon-theme :gray
              :info (if class?
              :info (if class?
                      (str "Create class called '" (get-class-from-input q) "'")
                      (str "Create class called '" (get-class-from-input q) "'")

+ 8 - 9
src/main/frontend/components/db_based/page.cljs

@@ -12,7 +12,6 @@
             [rum.core :as rum]
             [rum.core :as rum]
             [logseq.shui.ui :as shui]
             [logseq.shui.ui :as shui]
             [frontend.util :as util]
             [frontend.util :as util]
-            [clojure.set :as set]
             [clojure.string :as string]
             [clojure.string :as string]
             [logseq.db.frontend.property :as db-property]))
             [logseq.db.frontend.property :as db-property]))
 
 
@@ -31,7 +30,7 @@
        {:class (util/classnames [{:no-properties (not has-viewable-properties?)}])}
        {:class (util/classnames [{:no-properties (not has-viewable-properties?)}])}
        (if configure?
        (if configure?
          (cond
          (cond
-           (= mode :class)
+           (= mode :tag)
            (component-block/db-properties-cp {:editor-box editor/box}
            (component-block/db-properties-cp {:editor-box editor/box}
                                              page
                                              page
                                              (str edit-input-id-prefix "-schema")
                                              (str edit-input-id-prefix "-schema")
@@ -53,12 +52,12 @@
   (let [*mode *mode
   (let [*mode *mode
         mode (rum/react *mode)
         mode (rum/react *mode)
         type (:block/type page)
         type (:block/type page)
-        class? (= type "class")
+        class? (= type "tag")
         property? (= type "property")
         property? (= type "property")
         page-opts {:configure? true}]
         page-opts {:configure? true}]
     (when (nil? mode)
     (when (nil? mode)
       (reset! *mode (cond
       (reset! *mode (cond
-                      class? :class
+                      class? :tag
                       property? :property
                       property? :property
                       :else :page)))
                       :else :page)))
     [:div.flex.flex-col.gap-1.pb-4
     [:div.flex.flex-col.gap-1.pb-4
@@ -66,7 +65,7 @@
        :property
        :property
        (property-component/property-config page {:inline-text component-block/inline-text})
        (property-component/property-config page {:inline-text component-block/inline-text})
 
 
-       :class
+       :tag
        [:div.mt-2.flex.flex-col.gap-2
        [:div.mt-2.flex.flex-col.gap-2
         (class-component/configure page {:show-title? false})
         (class-component/configure page {:show-title? false})
         (page-properties page (assoc page-opts :mode mode))]
         (page-properties page (assoc page-opts :mode mode))]
@@ -76,14 +75,14 @@
 (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 "class")
+        class? (= type "tag")
         property? (= type "property")
         property? (= type "property")
         modes (->
         modes (->
                (cond
                (cond
                  property?
                  property?
                  ["Property"]
                  ["Property"]
                  class?
                  class?
-                 ["Class"]
+                 ["Tag"]
                  :else
                  :else
                  [])
                  [])
                (conj "Page"))]
                (conj "Page"))]
@@ -107,7 +106,7 @@
         *hover? (::hover? state)
         *hover? (::hover? state)
         *mode (::mode state)
         *mode (::mode state)
         type (:block/type page)
         type (:block/type page)
-        class? (= type "class")
+        class? (= type "tag")
         collapsed? (not @*show-info?)
         collapsed? (not @*show-info?)
         has-properties? (or
         has-properties? (or
                          (seq (:block/tags page))
                          (seq (:block/tags page))
@@ -132,7 +131,7 @@
                                (reset! *hover? false))
                                (reset! *hover? false))
             :on-click (if config/publishing?
             :on-click (if config/publishing?
                         (fn [_]
                         (fn [_]
-                          (when (contains? #{"class" "property"} type)
+                          (when (contains? #{"tag" "property"} type)
                             (swap! *show-info? not)))
                             (swap! *show-info? not)))
                         #(do
                         #(do
                            (swap! *show-info? not)
                            (swap! *show-info? not)

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

@@ -154,7 +154,7 @@
                                                            (string/lower-case (:block/title p)))) matched-pages))
                                                            (string/lower-case (:block/title p)))) matched-pages))
                                     partial-matched-pages
                                     partial-matched-pages
                                     (if db-tag?
                                     (if db-tag?
-                                      (concat [{:block/title (str (t :new-class) " " q)}]
+                                      (concat [{:block/title (str (t :new-tag) " " q)}]
                                               partial-matched-pages)
                                               partial-matched-pages)
                                       (cons {:block/title (str (t :new-page) " " q)}
                                       (cons {:block/title (str (t :new-page) " " q)}
                                             partial-matched-pages))))]
                                             partial-matched-pages))))]
@@ -180,7 +180,7 @@
                             [:div (ui/icon "whiteboard" {:extension? true})]
                             [:div (ui/icon "whiteboard" {:extension? true})]
                             (db/page? block)
                             (db/page? block)
                             [:div (ui/icon "page" {:extension? true})]
                             [:div (ui/icon "page" {:extension? true})]
-                            (or (string/starts-with? (:block/title block) (t :new-class))
+                            (or (string/starts-with? (:block/title block) (t :new-tag))
                                 (string/starts-with? (:block/title block) (t :new-page)))
                                 (string/starts-with? (:block/title block) (t :new-page)))
                             nil
                             nil
                             :else
                             :else
@@ -191,7 +191,7 @@
                                       (title/block-unique-title block))]
                                       (title/block-unique-title block))]
                           (search-handler/highlight-exact-query title q))])
                           (search-handler/highlight-exact-query title q))])
         :empty-placeholder [:div.text-gray-500.text-sm.px-4.py-2 (if db-tag?
         :empty-placeholder [:div.text-gray-500.text-sm.px-4.py-2 (if db-tag?
-                                                                   "Search for a class"
+                                                                   "Search for a tag"
                                                                    "Search for a node")]
                                                                    "Search for a node")]
         :class       "black"}))))
         :class       "black"}))))
 
 

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

@@ -238,7 +238,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 #(= (:block/type %) "class") entities))
+   :classes (count (filter #(= (:block/type %) "tag") entities))
    :objects (count (filter #(seq (:block/tags %)) entities))
    :objects (count (filter #(seq (:block/tags %)) entities))
    :properties (count (filter #(= (:block/type %) "property") entities))
    :properties (count (filter #(= (:block/type %) "property") entities))
    :property-values (count (mapcat :block/properties entities))})
    :property-values (count (mapcat :block/properties entities))})

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

@@ -590,7 +590,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 (= (:block/type page) "class")
+            (when (= (:block/type page) "tag")
               (class-component/class-children page))
               (class-component/class-children page))
 
 
             ;; referenced blocks
             ;; referenced blocks

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

@@ -67,7 +67,7 @@
                                      :value (:block/uuid class)})
                                      :value (:block/uuid class)})
                                   classes)
                                   classes)
                      opts {:items options
                      opts {:items options
-                           :input-default-placeholder (if multiple-choices? "Choose classes" "Choose class")
+                           :input-default-placeholder (if multiple-choices? "Choose tags" "Choose tag")
                            :dropdown? false
                            :dropdown? false
                            :close-modal? false
                            :close-modal? false
                            :multiple-choices? multiple-choices?
                            :multiple-choices? multiple-choices?
@@ -112,7 +112,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? (= (:block/type block) "class"))
+  (let [class? (or class? (= (:block/type block) "tag"))
         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))
@@ -130,7 +130,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 (= (:block/type entity) "class") page-configure? class-schema?)
+          add-class-property? (and (= (:block/type entity) "tag") 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
@@ -192,7 +192,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 (= (:block/type block) "class") page-configure? class-schema?)]
+                      add-class-property? (and (= (:block/type block) "tag") 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))
@@ -327,7 +327,7 @@
               :node
               :node
               (when (empty? (:property/closed-values property))
               (when (empty? (:property/closed-values property))
                 [:div.grid.grid-cols-5.gap-1.items-center.leading-8
                 [:div.grid.grid-cols-5.gap-1.items-center.leading-8
-                 [:label.col-span-2 "Specify classes:"]
+                 [:label.col-span-2 "Specify tags:"]
                  (class-select property (assoc opts :disabled? disabled?))])
                  (class-select property (assoc opts :disabled? disabled?))])
 
 
 
 
@@ -471,7 +471,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 (= (:block/type block) "class") class-schema?)
+        (let [add-class-property? (and (= (:block/type block) "tag") class-schema?)
               type (get-in property [:block/schema :type])]
               type (get-in property [:block/schema :type])]
           (cond
           (cond
             add-class-property?
             add-class-property?

+ 2 - 2
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? (= (:block/type block) "class")
+         class? (= (:block/type block) "tag")
          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]))]
@@ -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? (= (:block/type v-block) "class")
+        (let [class? (= (:block/type v-block) "tag")
               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/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 "class"]]))
+        [?tag :block/type "tag"]]))
 
 
 (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 "class")
+        classes (->> (d/datoms db :avet :block/type "tag")
                      (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/editor.cljs

@@ -1651,7 +1651,7 @@
         (text-util/wrapped-by? value pos before end)))))
         (text-util/wrapped-by? value pos before end)))))
 
 
 (defn get-matched-classes
 (defn get-matched-classes
-  "Return matched classes except the root class"
+  "Return matched classes except the root tag"
   [q]
   [q]
   (let [classes (->> (db-model/get-all-classes (state/get-current-repo) {:except-root-class? true})
   (let [classes (->> (db-model/get-all-classes (state/get-current-repo) {:except-root-class? true})
                      (map (fn [e] (select-keys e [:block/uuid :block/title]))))]
                      (map (fn [e] (select-keys e [:block/uuid :block/title]))))]

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

@@ -850,7 +850,7 @@
     #(vector :<>
     #(vector :<>
        (class-component/configure page {})
        (class-component/configure page {})
        (db-page/page-properties page {:configure? true
        (db-page/page-properties page {:configure? true
-                                      :mode :class}))
+                                      :mode :tag}))
     {:label "page-configure"
     {:label "page-configure"
      :align :top}))
      :align :top}))
 
 

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

@@ -340,10 +340,10 @@
         (state/clear-editor-action!)
         (state/clear-editor-action!)
         (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-class) " "))
+                          (or (string/includes? chosen (str (t :new-tag) " "))
                               (ldb/class? (db/get-page chosen))))
                               (ldb/class? (db/get-page chosen))))
               chosen (-> chosen
               chosen (-> chosen
-                         (string/replace-first (str (t :new-class) " ") "")
+                         (string/replace-first (str (t :new-tag) " ") "")
                          (string/replace-first (str (t :new-page) " ") ""))
                          (string/replace-first (str (t :new-page) " ") ""))
               wrapped? (= page-ref/left-brackets (common-util/safe-subs edit-content (- pos 2) pos))
               wrapped? (= page-ref/left-brackets (common-util/safe-subs edit-content (- pos 2) pos))
               wrapped-tag (if (and (util/safe-re-find #"\s+" chosen) (not wrapped?))
               wrapped-tag (if (and (util/safe-re-find #"\s+" chosen) (not wrapped?))

+ 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? "class"
+    (let [page (assoc page :block/type (cond class? "tag"
                                              whiteboard? "whiteboard"
                                              whiteboard? "whiteboard"
                                              (:block/type page) (:block/type page)
                                              (:block/type page) (:block/type page)
                                              :else "page"))
                                              :else "page"))

+ 1 - 2
src/resources/dicts/en.edn

@@ -467,8 +467,7 @@
 
 
  :home "Home"
  :home "Home"
  :new-page "New page:"
  :new-page "New page:"
- :new-class "New class:"
- ;; :new-class "New class:"
+ :new-tag "New tag:"
  :whiteboards "Whiteboards"
  :whiteboards "Whiteboards"
  :new-graph "Add new graph"
  :new-graph "Add new graph"
  :graph "Graph"
  :graph "Graph"

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

@@ -24,7 +24,7 @@
   (let [opts {:redirect? false :create-first-block? false :class? true}
   (let [opts {:redirect? false :create-first-block? false :class? true}
         _ (test-helper/create-page! "class1" opts)
         _ (test-helper/create-page! "class1" opts)
         _ (test-helper/create-page! "class2" opts)]
         _ (test-helper/create-page! "class2" opts)]
-    (is (= ["Card" "Root class" "Task" "class1" "class2"] (sort (map :block/title (model/get-all-classes repo)))))))
+    (is (= ["Card" "Root tag" "Task" "class1" "class2"] (sort (map :block/title (model/get-all-classes repo)))))))
 
 
 (deftest get-class-objects-test
 (deftest get-class-objects-test
   (let [opts {:redirect? false :create-first-block? false :class? true}
   (let [opts {:redirect? false :create-first-block? false :class? true}

+ 2 - 2
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 "class",
+                                   :block/type "tag",
                                    :block/name "yyy",
                                    :block/name "yyy",
                                    :block/title "yyy"}])]
                                    :block/title "yyy"}])]
       (is (= {:update
       (is (= {:update
@@ -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 "class") 1 true]]}]}))))))
+                             [:block/type (ldb/write-transit-str "tag") 1 true]]}]}))))))
 
 
   (testing "user.property/xxx creation"
   (testing "user.property/xxx creation"
     (let [block-uuid (random-uuid)
     (let [block-uuid (random-uuid)

+ 1 - 1
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 "class" 536870954]
+                   [:db/add 62 :block/type "tag" 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)