Skip to content

Commit

Permalink
Graph revamp (logseq#2372)
Browse files Browse the repository at this point in the history
Graph revamp
  • Loading branch information
tiensonqin authored Jul 6, 2021
1 parent 1c0beff commit 5a41300
Show file tree
Hide file tree
Showing 33 changed files with 1,174 additions and 431 deletions.
11 changes: 10 additions & 1 deletion externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ dummy.transaction = function() {};
dummy.getPath = function() {};
dummy.getDoc = function() {};
dummy.setValue = function() {};

dummy.data = function() {};
dummy.triangle = function() {};
dummy.vee = function() {};
dummy.destroy = function() {};
dummy.changeData = function() {};
dummy.layout = function() {};
dummy.render = function() {};
dummy.get = function() {};
dummy.addItem = function() {};
dummy.removeItem = function() {};

/**
* @typedef {{
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"postcss-import-ext-glob": "^2.0.1",
"postcss-nested": "5.0.5",
"purgecss": "4.0.2",
"shadow-cljs": "^2.12.5",
"shadow-cljs": "2.12.5",
"stylelint": "^13.8.0",
"stylelint-config-standard": "^20.0.0",
"tailwindcss": "2.2.4"
Expand All @@ -44,13 +44,13 @@
"gulp:build": "cross-env NODE_ENV=production gulp build",
"css:build": "postcss tailwind.all.css -o static/css/style.css --verbose --env production",
"css:watch": "postcss tailwind.all.css -o static/css/style.css --verbose --watch",
"cljs:watch": "clojure -M:cljs watch app publishing electron",
"cljs:watch": "clojure -M:cljs watch app publishing electron cards",
"cljs:electron-watch": "clojure -M:cljs watch app electron",
"cljs:release": "clojure -M:cljs release app publishing electron",
"cljs:electron-release": "clojure -M:cljs release app publishing electron --config-merge '{:asset-path \"./js\"}'",
"cljs:test": "clojure -M:test compile test",
"cljs:run-test": "node static/tests.js",
"cljs:watch-app": "clojure -M:cljs watch app",
"cljs:watch-app": "clojure -M:cljs watch app cards",
"cljs:release-app": "clojure -M:cljs release app",
"cljs:release-publishing": "clojure -M:cljs release publishing",
"cljs:dev-release-app": "clojure -M:cljs release app --config-merge '{:closure-defines {frontend.config/DEV-RELEASE true}}'",
Expand All @@ -68,19 +68,22 @@
"codemirror": "^5.58.1",
"cypress-clojurescript-preprocessor": "^0.1.4",
"cypress-real-events": "^1.5.0",
"d3-force": "^3.0.0",
"diff": "5.0.0",
"diff-match-patch": "^1.0.5",
"electron": "^13.0.0",
"fs": "^0.0.1-security",
"fs-extra": "^9.1.0",
"fuse.js": "^6.4.6",
"graphology": "^0.20.0",
"gulp-cached": "^1.1.1",
"highlight.js": "^10.4.1",
"ignore": "^5.1.8",
"is-svg": "4.2.2",
"jszip": "^3.5.0",
"mldoc": "0.8.4",
"path": "^0.12.7",
"pixi-graph-fork": "^0.0.9",
"posthog-js": "^1.10.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand All @@ -91,7 +94,6 @@
"react-tippy": "^1.4.0",
"react-transition-group": "^4.3.0",
"reakit": "^0.11.1",
"url": "^0.11.0",
"yargs-parser": "^20.2.4"
}
}
4 changes: 2 additions & 2 deletions resources/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ html[data-theme='dark'] {

.white-theme,
html[data-theme='light'] {
--ls-primary-background-color: white;
--ls-primary-background-color: #f6f6f6;
--ls-secondary-background-color: #f7f6f4;
--ls-tertiary-background-color: #f1eee8;
--ls-quaternary-background-color: #e8e5de;
Expand Down Expand Up @@ -625,7 +625,7 @@ video {
background-color: rgba(91, 33, 182);
}

.bg-purple-900 {
.bg-purple-900 {
background-color: rgba(76, 29, 149);
}

Expand Down
11 changes: 10 additions & 1 deletion shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
{:app
{:target :browser
:module-loader true
;; handle `require(xxx.css)`
:js-options {:ignore-asset-requires true}
:modules {:main {:init-fn frontend.core/init}
;; :graph
;; {:entries [frontend.extensions.graph.force]
;; :depends-on #{:main}}
:code-editor
{:entries [frontend.extensions.code]
:depends-on #{:main}}
Expand All @@ -21,7 +26,7 @@
:asset-path "/static/js"
:release {:asset-path "https://asset.logseq.com/static/js"}
:compiler-options {:infer-externs :auto
:output-feature-set :es-next
:output-feature-set :es-next-in
:source-map true
:externs ["datascript/externs.js"
"externs.js"]
Expand Down Expand Up @@ -62,7 +67,11 @@
:publishing
{:target :browser
:module-loader true
:js-options {:ignore-asset-requires true}
:modules {:main {:init-fn frontend.publishing/init}
;; :graph
;; {:entries [frontend.extensions.graph.force]
;; :depends-on #{:main}}
:code-editor
{:entries [frontend.extensions.code]
:depends-on #{:main}}
Expand Down
7 changes: 6 additions & 1 deletion src/main/frontend/components/hierarchy.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[frontend.state :as state]
[frontend.text :as text]))

;; FIXME: use block/namespace to get the relation
(defn get-relation
[page]
(when (text/namespace-page? page)
Expand All @@ -22,7 +23,11 @@
(rum/defc structures
[page]
(let [namespaces (get-relation page)]
(when (seq namespaces)
(when (and (seq namespaces)
(not (and (= 1
(count namespaces)
(count (first namespaces)))
(not (string/includes? (ffirst namespaces) "/")))))
[:div.page-hierachy.mt-6
(ui/foldable
[:h2.font-bold.opacity-30 "Hierarchy"]
Expand Down
Loading

0 comments on commit 5a41300

Please sign in to comment.