Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB properties storage refactoring #11177

Merged
merged 372 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
372 commits
Select commit Hold shift + click to select a range
1956d80
fix: lint warnings
tiensonqin Apr 7, 2024
ede9e5d
fix: page names in refs not updated after renamed
tiensonqin Apr 7, 2024
210be5a
fix: creating redundant pages when editing a block
tiensonqin Apr 7, 2024
cd38e0b
fix: calculate :block/path-refs when adding new graph or re-index
tiensonqin Apr 8, 2024
2d5eb0f
enhance: editor experience
tiensonqin Apr 8, 2024
a329024
fix: bullet and content blink when inserting a block
tiensonqin Apr 8, 2024
7a0564c
chore: cleanup unused state
tiensonqin Apr 8, 2024
76dd204
fix: block type editor
tiensonqin Apr 8, 2024
2940e86
fix: save whiteboard
tiensonqin Apr 8, 2024
6df866a
fix: handle more whiteboard properties
tiensonqin Apr 8, 2024
b3130e3
enhance: use Untitled for web page title for UUID named pages
tiensonqin Apr 8, 2024
77679db
fix: lint warning
tiensonqin Apr 8, 2024
aa98bc4
chore: remove hack
tiensonqin Apr 8, 2024
9f9bfbc
Merge branch 'feat/db' into refactor/db-remove-block-name-unique
tiensonqin Apr 8, 2024
15cb71e
fix: paste blocks
tiensonqin Apr 8, 2024
d5748f6
fix: page rename
tiensonqin Apr 8, 2024
ea1cc87
fix: properties silently clobbered each other if
logseq-cldwalker Apr 8, 2024
6a2b6d2
fix: adding class properties can result
logseq-cldwalker Apr 8, 2024
a608139
fix: new db graph doesn't silently clobber db/ident's
logseq-cldwalker Apr 8, 2024
7d2104c
fix: refresh page reference name after page renaming
tiensonqin Apr 9, 2024
ef627c2
fix: exit editor when page redirects through references
tiensonqin Apr 9, 2024
8de4989
fix: editor cursor missing when moving across blocks
tiensonqin Apr 9, 2024
62802d0
fix: move cross blocks using left and right arrows
tiensonqin Apr 9, 2024
0baba5c
Merge branch 'feat/db' into refactor/db-remove-block-name-unique
tiensonqin Apr 9, 2024
6996636
enhance: disable text selection when selecting blocks
tiensonqin Apr 9, 2024
e962797
enhance: use css to handle select-none instead of component state
tiensonqin Apr 9, 2024
aa314c8
enhance: remove border radius for property key bullet
tiensonqin Apr 9, 2024
4b1e3a8
enhance: move page configure trigger to the top of page title
tiensonqin Apr 9, 2024
39c2ee8
style tweaks
tiensonqin Apr 9, 2024
789e24f
Add gaps between page title, properties and content
tiensonqin Apr 9, 2024
d44bd44
fix: generate date and page closed properties in properties graph
logseq-cldwalker Apr 9, 2024
fcecbcf
fix: switching page closed values
logseq-cldwalker Apr 9, 2024
f1c9277
fix: unable to add a page or date closed value
logseq-cldwalker Apr 9, 2024
a70b7bf
fix: date property page crashing with closed values
logseq-cldwalker Apr 9, 2024
c29d4a3
chore: property type vars should be in property.type
logseq-cldwalker Apr 9, 2024
a42e5f6
fix: new graphs don't create unused hidden pages for
logseq-cldwalker Apr 9, 2024
e4c0c33
fix: can't choose date closed value on a block
logseq-cldwalker Apr 9, 2024
0895c13
fix: delete block value with placeholder value
logseq-cldwalker Apr 9, 2024
aa58ff3
fix: adding existing values to page and date properties
logseq-cldwalker Apr 9, 2024
4f8d76c
Merge branch 'feat/db' into refactor/db-properties-schema
logseq-cldwalker Apr 9, 2024
f3dc460
more tweaks
tiensonqin Apr 10, 2024
3e351a4
Merge branch 'feat/db' into refactor/db-properties-schema
tiensonqin Apr 10, 2024
8d128f4
Merge branch 'refactor/db-properties-schema' into refactor/db-remove-…
tiensonqin Apr 10, 2024
b9e779e
fix: property ref value not refreshed
tiensonqin Apr 10, 2024
7007fa7
fix: status and priority should be :entity type
tiensonqin Apr 10, 2024
22f2bcc
fix: regression on new, unused property displays blank type
logseq-cldwalker Apr 10, 2024
527dae3
fix: class properties schema
logseq-cldwalker Apr 10, 2024
419eac1
Merge branch 'feat/db' into refactor/db-properties-schema
tiensonqin Apr 11, 2024
0096748
Merge branch 'refactor/db-properties-schema' into refactor/db-remove-…
tiensonqin Apr 11, 2024
3b41808
fix: switch status
tiensonqin Apr 11, 2024
e8c83a3
fix: display entity type as text type in UI
tiensonqin Apr 11, 2024
bbdfb6b
enhance: disable page configure when editing page name
tiensonqin Apr 11, 2024
0c0291e
fix: don't show property info if all properties are built-in
tiensonqin Apr 11, 2024
7b6698f
fix: deleting block blink in UI
tiensonqin Apr 11, 2024
ddd9a82
perf: faster rendering editor for the new created block
tiensonqin Apr 11, 2024
81e5d5f
fix: remove frontend.config usage from graph parser dep
tiensonqin Apr 11, 2024
89b40b4
Extends entity for new :block/properties and direct property access
tiensonqin Apr 11, 2024
1a9608b
fix: property handler with the new properties pair storage
tiensonqin Apr 11, 2024
e07fd51
fix: new db graph creates properties correctly
logseq-cldwalker Apr 11, 2024
cbcff4b
fix: schema graph creation for previous properties schema
logseq-cldwalker Apr 11, 2024
97367c3
fix: add timestamps to built-in property pair
logseq-cldwalker Apr 11, 2024
354c0c1
fix: built-in? helper and most deps tests
logseq-cldwalker Apr 12, 2024
b2a2249
fix: closed validation with new properties
logseq-cldwalker Apr 12, 2024
4f3b7e7
fix: ref checks in schema
logseq-cldwalker Apr 12, 2024
4771a97
fix: page-property rules to use latest schema
logseq-cldwalker Apr 12, 2024
7003903
fix: new graph creates hidden pages all with same name '$$$'
logseq-cldwalker Apr 12, 2024
8cbc0ac
fix: validate property values
logseq-cldwalker Apr 12, 2024
90a7fe6
fix: generating graph with properties
logseq-cldwalker Apr 12, 2024
b99af71
fix: validating user :many properties
logseq-cldwalker Apr 12, 2024
8ac39b3
fix: adding new properties for some property actions
logseq-cldwalker Apr 13, 2024
10cb5b6
fix: property value not refreshed after adding new pair
tiensonqin Apr 13, 2024
52c7281
fix: debug block/page
tiensonqin Apr 13, 2024
dd1ae2e
fix: property multiple values
tiensonqin Apr 13, 2024
16a39c8
fix: tags not displayed for blocks
tiensonqin Apr 13, 2024
3efc85c
fix: can't edit page text value properties
tiensonqin Apr 14, 2024
47abd92
fix: load property pairs too when lazy load a block
tiensonqin Apr 14, 2024
e03b5a2
fix: property pairs lazy load
tiensonqin Apr 14, 2024
ebe6739
perf: no need to get all the property pairs when asking for only one
tiensonqin Apr 14, 2024
e66e8d2
fix: cycle todos
tiensonqin Apr 14, 2024
356f45b
Merge branch 'feat/db' into refactor/db-properties-schema
tiensonqin Apr 15, 2024
afde2df
fix: lint
tiensonqin Apr 15, 2024
837e1aa
fix: property set icon
tiensonqin Apr 15, 2024
dd0de0b
fix: closed value icon
tiensonqin Apr 15, 2024
81da3a9
enhance: move tags and icon to properties area too
tiensonqin Apr 15, 2024
3e0849c
fix: set more properties as hidden properties
tiensonqin Apr 15, 2024
ff53ed8
fix: display viewable properties
tiensonqin Apr 15, 2024
d30e20e
enhance: move tags outside page info
tiensonqin Apr 15, 2024
ac23d31
fix: date picker button align
tiensonqin Apr 15, 2024
4616fcb
fix: date picker
tiensonqin Apr 15, 2024
960033d
fix: date picker updated value not refreshed on UI
tiensonqin Apr 15, 2024
e19879a
fix: cleanup property related data
tiensonqin Apr 15, 2024
9725934
fix: multi-line block content not saved
tiensonqin Apr 15, 2024
3beb10c
enhance: store property text as blocks
tiensonqin Apr 15, 2024
7fb5fb7
fix: add pair with existing property
tiensonqin Apr 15, 2024
fb93a35
fix: store text values as entities
tiensonqin Apr 15, 2024
4828cfa
fix: handle situations when block values have been retracted
tiensonqin Apr 15, 2024
8ec3607
enhance(dev): humanize option for validation script
logseq-cldwalker Apr 15, 2024
dbab967
fix: refresh property value ui when block values have been retracted
tiensonqin Apr 15, 2024
b390459
fix: can't uncheck checkbox property val
logseq-cldwalker Apr 15, 2024
f57b0f1
fix: property always updating updated-at
logseq-cldwalker Apr 15, 2024
236a287
fix: new property values invalid because of placeholder
logseq-cldwalker Apr 15, 2024
09f65cf
fix: lazy load properoty value blocks
tiensonqin Apr 15, 2024
eb9f422
fix: can't add a new page property
logseq-cldwalker Apr 15, 2024
1e1a17a
fix: validation of single value for a :many property
logseq-cldwalker Apr 15, 2024
ee9391e
fix: display class properties
tiensonqin Apr 16, 2024
daafe5f
fix: default type values
tiensonqin Apr 16, 2024
202576a
fix: load property pairs for structured blocks
tiensonqin Apr 16, 2024
8554e15
fix: closed values for default type
tiensonqin Apr 16, 2024
2195c4b
fix: convert to ref type when updating a property to closed values
tiensonqin Apr 16, 2024
adcc76e
fix: keep property cardinality when switching to closed values
tiensonqin Apr 16, 2024
5833b84
fix: closed values tempid errors
tiensonqin Apr 16, 2024
0853940
fix: closed :default values validate correctly
logseq-cldwalker Apr 16, 2024
6f5b744
fix: use user-property type :default for public built-in properties
logseq-cldwalker Apr 16, 2024
bacba9d
fix: delete property pair entities when deleting a property page
tiensonqin Apr 16, 2024
0aa4bda
fix: inlined db-based-graph? calls in db-property
logseq-cldwalker Apr 16, 2024
37974a8
fix: built-in? not working
logseq-cldwalker Apr 16, 2024
8f806db
chore: use block/properties instead of property?
logseq-cldwalker Apr 16, 2024
acf5512
Increase property gap
tiensonqin Apr 16, 2024
ed8aa98
fix: toggle displaying page properties
tiensonqin Apr 16, 2024
36acf60
enhance: hide bullet when :default has only one child block
tiensonqin Apr 17, 2024
bcf0d5b
fix: hide bullet only
tiensonqin Apr 17, 2024
d4b2958
fix: add new closed value to :default type property
tiensonqin Apr 17, 2024
2884fc7
fix: select of :default typed closed values
tiensonqin Apr 17, 2024
330ec99
fix: align property values and other blocks
tiensonqin Apr 17, 2024
71aa3fe
fix and enhanced validation of property values
logseq-cldwalker Apr 17, 2024
390892e
fix: build all closed value property types correctly
logseq-cldwalker Apr 17, 2024
9bab096
fix: built-in string properties with internal :string type
logseq-cldwalker Apr 18, 2024
3f566b3
fix: basic editing of background-image property
logseq-cldwalker Apr 18, 2024
a30f2bd
fix: render slides with new properties
logseq-cldwalker Apr 18, 2024
0372cb6
fix: typing marker creates tasks e.g. DOING
logseq-cldwalker Apr 18, 2024
27aca24
fix: pages not displaying their page properties
logseq-cldwalker Apr 18, 2024
449d4d3
fix: generate schema graph with new properties
logseq-cldwalker Apr 19, 2024
38672f2
fix: class ancestor links
logseq-cldwalker Apr 19, 2024
311cd13
enhance: closed value membership validated everywhere
logseq-cldwalker Apr 19, 2024
622cbe0
fix: :string property values weren't editable
logseq-cldwalker Apr 19, 2024
8f411fa
enhance: allow user properties with other namespaces
logseq-cldwalker Apr 19, 2024
44af221
Merge branch 'feat/db' into refactor/db-properties-schema
tiensonqin Apr 21, 2024
d92a325
fix: don't run pipeline again for replace tx
tiensonqin Apr 21, 2024
9c93152
fix: closed values test
tiensonqin Apr 21, 2024
5a595b1
fix: property tests
tiensonqin Apr 21, 2024
0afeb2c
fix: more property-related tests
tiensonqin Apr 21, 2024
4a0736f
fix: property unit tests
tiensonqin Apr 22, 2024
1e835d2
fix: undo redo tests
tiensonqin Apr 22, 2024
1cd1914
Enhance: show generated db's directory in the create graph script
tiensonqin Apr 22, 2024
6b3a9f4
fix: don't use frontend.util in worker
tiensonqin Apr 22, 2024
a15066c
perf: db reload
tiensonqin Apr 22, 2024
912ddd6
Merge branch 'feat/db' into refactor/db-properties-schema
tiensonqin Apr 22, 2024
a662108
fix: don't show empty input block when loading app
tiensonqin Apr 22, 2024
71f01b1
fix: load user defined closed values
logseq-cldwalker Apr 22, 2024
b20cc9d
chore: add long flags on new long running tests
logseq-cldwalker Apr 22, 2024
2fad540
chore: cleanup setting :many property values
logseq-cldwalker Apr 22, 2024
ee3ecdb
fix: remove unused uuid string conversions when handling properties
logseq-cldwalker Apr 22, 2024
2f0fc3c
fix: large graph creation having blank and incorrect block counts
logseq-cldwalker Apr 23, 2024
2702062
fix: add class or page properties
logseq-cldwalker Apr 23, 2024
7e31888
enhance: db graphs can add case sensitive properties
logseq-cldwalker Apr 23, 2024
e5ea21e
enhance: allow page search to show case sensitive results
logseq-cldwalker Apr 24, 2024
4cb2ac6
fix: load all classes when app starts
tiensonqin Apr 24, 2024
8aca502
fix: properties are not displayed for tagged blocks
tiensonqin Apr 24, 2024
b4bd6b9
fix: tagged pages
tiensonqin Apr 24, 2024
5c3512d
fix: parent class style
tiensonqin Apr 24, 2024
d2bdc2f
fix: open block editor when adding a block property value
tiensonqin Apr 24, 2024
6006730
enhance: show as "empty" if a property block's value is empty
tiensonqin Apr 24, 2024
2cd090e
fix: jump to property block value
tiensonqin Apr 24, 2024
0a13e43
fix: loading block property values
tiensonqin Apr 24, 2024
58cf9f8
fix: jump to empty block value
tiensonqin Apr 24, 2024
edef1ea
fix: show bullets for collapsable property block values
tiensonqin Apr 24, 2024
13edd74
fix: can't save whiteboard updates
tiensonqin Apr 24, 2024
92cb360
perf: whiteboard
tiensonqin Apr 24, 2024
6d7d449
fix: loading whiteboard
tiensonqin Apr 24, 2024
fef4e89
fix: use existing property pair if exists
tiensonqin Apr 24, 2024
558606e
fix: property test
tiensonqin Apr 24, 2024
8d9e6da
refactor: use :block/type for journal pages instead of :block/journal?
tiensonqin Apr 24, 2024
96bdda4
fix: disable :block/type filter for now
tiensonqin Apr 24, 2024
e01a771
fix: add journal type to malli schema
tiensonqin Apr 24, 2024
e3213d8
fix: journal query
tiensonqin Apr 24, 2024
4c2a00d
fix: lost cursor when prev block is a property value
tiensonqin Apr 24, 2024
a91b34a
fix: inline classes for property page values
logseq-cldwalker Apr 24, 2024
706f3c7
fix: lazy load class and properties
tiensonqin Apr 24, 2024
d416687
fix: :block/original-name shouldn't be unique
tiensonqin Apr 24, 2024
297e408
fix: db graphs can use case sensitive properties
logseq-cldwalker Apr 24, 2024
94e6f78
fix: entering case sensitive properties
logseq-cldwalker Apr 24, 2024
c87c077
enhance: new classes can be case sensitive
logseq-cldwalker Apr 24, 2024
878d69f
fix: graph parser tests
logseq-cldwalker Apr 24, 2024
349542b
fix: add journal to all pages filter
tiensonqin Apr 25, 2024
bcd04db
fix: file graph issues
tiensonqin Apr 25, 2024
b55c064
fix: move :block/path-res calculation to dep graph-parser
tiensonqin Apr 25, 2024
d82c7fa
fix: tests
tiensonqin Apr 25, 2024
b0c7867
fix: selecting journal in all pages displays journals
logseq-cldwalker Apr 25, 2024
cb22dca
fix: db tests
logseq-cldwalker Apr 25, 2024
3681ac3
fix: move db-pipeline and datascript-report back to outliner dep
logseq-cldwalker Apr 25, 2024
edca304
chore: remove unused fn
logseq-cldwalker Apr 25, 2024
4276a3f
fix: replace file graph helper in db graph namespaces
logseq-cldwalker Apr 25, 2024
75bd3e8
fix: invalid new whiteboard pages
logseq-cldwalker Apr 25, 2024
0138221
fix: display page aliases
logseq-cldwalker Apr 25, 2024
81c267e
wip: undo redo editor cursor
tiensonqin Apr 26, 2024
1b3b3af
fix: invalid placeholder for :date and :page
logseq-cldwalker Apr 26, 2024
8c20e3b
fix: undo/redo editor cursor
tiensonqin Apr 27, 2024
2088c80
fix: container-id could be unknown
tiensonqin Apr 27, 2024
b90eb36
perf: load datoms instead of pull data when app loads
tiensonqin Apr 28, 2024
c4a123d
fix: save whiteboard create multiple pages
tiensonqin Apr 28, 2024
e1b5765
fix: search redirects to hidden page
tiensonqin Apr 28, 2024
5a8065d
fix: template not working for file graphs
tiensonqin Apr 28, 2024
16f2ba3
fix: modify markdown file doesn't show on UI
tiensonqin Apr 28, 2024
6272dd1
fix: use :string instead of :default type for built-in property
tiensonqin Apr 28, 2024
c4e0bda
fix: add :string to user faced and disable :default for closed value
tiensonqin Apr 28, 2024
b21bdbe
fix: add :string to select type
tiensonqin Apr 28, 2024
d0e2a09
fix: :string could be entity for closed values
tiensonqin Apr 28, 2024
5d4ae66
revert: remove :block/properties
tiensonqin Apr 28, 2024
6a976ca
Deprecate more db attributes for db graphs
tiensonqin Apr 28, 2024
dda5f22
wip: add global :block/order for properties
tiensonqin Apr 28, 2024
8275449
feat: drag && drop block properties
tiensonqin Apr 29, 2024
723f0a5
fix: class ordered properties
tiensonqin Apr 29, 2024
abbaf49
code cleanup
tiensonqin Apr 29, 2024
cdf546d
convert fractional-index js to cljs
tiensonqin Apr 29, 2024
95eb0e7
Merge branch 'feat/db' into refactor/db-properties-schema
tiensonqin Apr 29, 2024
a35bc9b
Bump nbb-logseq version for datascript and ordered-map changes
logseq-cldwalker Apr 30, 2024
efcffd6
fix: rules and most db tests
logseq-cldwalker Apr 30, 2024
670b46f
fix: validate property values again
logseq-cldwalker Apr 30, 2024
77914fb
fix: db tests and lint
logseq-cldwalker Apr 30, 2024
fa3a589
fix: built-in properties visible on all pages
logseq-cldwalker Apr 30, 2024
2540bb3
fix: type validations
logseq-cldwalker Apr 30, 2024
fec6383
fix: update properties graph to generate string-closed
logseq-cldwalker Apr 30, 2024
39f6beb
fix: slides not working in db graph
logseq-cldwalker Apr 30, 2024
5c81b61
fix: file graphs can't load b/c db specific attribute fetched
logseq-cldwalker May 1, 2024
27ed8c7
enhance: allow user classes to have db idents
logseq-cldwalker May 1, 2024
439d6e6
fix: slash commands for task properties e.g. /TODO
logseq-cldwalker May 1, 2024
1ec4796
refactor: replace :block/left with :block/order
tiensonqin Apr 30, 2024
d4ecc39
fix: schema with :block/order changes
logseq-cldwalker May 1, 2024
d4bc5f2
fix: large graph generation for some cases
logseq-cldwalker May 1, 2024
d14cc50
fix: press enter at beginning of a block that isn’t a sibling
tiensonqin May 2, 2024
d907eb7
fix: wrong digs for fractional index
tiensonqin May 2, 2024
742ac92
fix: can't edit blocks on whiteboards
tiensonqin May 2, 2024
89edb3a
fix: can't remove Many values
tiensonqin May 2, 2024
1dbdb16
fix: whiteboard shapes being invalid
logseq-cldwalker May 2, 2024
602b236
fix: graph-parser lint
logseq-cldwalker May 2, 2024
88e38b1
fix: more lints including removing dead code
logseq-cldwalker May 2, 2024
457a743
refactor: no need to create parent && hidden page for :default value
tiensonqin May 2, 2024
3df9b59
fix: property checkbox should be disabled for publishing
logseq-cldwalker May 2, 2024
24c48e7
fix: multiple fixes related to lookup-by-name
logseq-cldwalker May 2, 2024
d4d7b57
fix: frontend lints
logseq-cldwalker May 2, 2024
5130ced
fix: public queries for publishing
logseq-cldwalker May 2, 2024
b5a8f96
fix: publishing hl-type-area for db graphs
logseq-cldwalker May 2, 2024
7aa3bd7
fix: issues of :default :one property
tiensonqin May 3, 2024
b1b6d3f
fix: search content for default type blocks
tiensonqin May 3, 2024
333490f
enhance: create-graph scripts can generate classes via :classes
logseq-cldwalker May 3, 2024
f0967c5
fix: unit test and add :fix-me flag to the rest
logseq-cldwalker May 3, 2024
719ba8c
Merge branch 'feat/db' into refactor/db-properties-schema
logseq-cldwalker May 6, 2024
be567b2
fix: incorrect require and fn args on this branch
logseq-cldwalker May 6, 2024
fe27ce9
fix: remove handling file-graph specific marker
logseq-cldwalker May 6, 2024
a8081ef
chore: update linter to validate more file-graph attrs aren't in db
logseq-cldwalker May 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .clj-kondo/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
;; false positive with match/match and _
frontend.handler.paste {:linters {:used-underscored-binding {:level :off}}}
frontend.db {:linters {:aliased-namespace-symbol
{:exclude [frontend.db.conn frontend.db.react logseq.db.frontend.default]}}}}
{:exclude [frontend.db.conn frontend.db.react]}}}}

:linters
{:path-invalid-construct/string-join {:level :info}
Expand Down Expand Up @@ -139,9 +139,12 @@
logseq.db ldb
logseq.db.frontend.content db-content
logseq.db.frontend.inputs db-inputs
logseq.db.frontend.order db-order
logseq.db.frontend.property db-property
logseq.db.frontend.property.build db-property-build
logseq.db.frontend.property.type db-property-type
logseq.db.frontend.property.util db-property-util
logseq.db.frontend.entity-plus entity-plus
logseq.db.frontend.rules rules
logseq.db.frontend.schema db-schema
logseq.db.frontend.validate db-validate
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ deps/shui/.lsp
deps/shui/.lsp-cache
deps/shui/.clj-kondo
deps/shui/shui-graph/logseq/bak
tx-log*
2 changes: 1 addition & 1 deletion bb.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{:paths ["scripts/src" "src/main" "src/resources"]
:deps
{metosin/malli
{:mvn/version "0.10.0"}
{:mvn/version "0.16.1"}
logseq/bb-tasks
#_{:local/root "../bb-tasks"}
{:git/url "https://github.com/logseq/bb-tasks"
Expand Down
9 changes: 5 additions & 4 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
rum/rum {:mvn/version "0.12.9"}

datascript/datascript {:git/url "https://github.com/logseq/datascript" ;; fork
:sha "fc3645fa4a6b8160e087e2ad1ce1c242675680cb"}
:sha "aa2f963be5d507b55d05c4d9a6ee3ce9454c4415"}

datascript-transit/datascript-transit {:mvn/version "0.3.0"}
borkdude/rewrite-edn {:mvn/version "0.4.7"}
Expand All @@ -16,6 +16,7 @@
org.clojure/core.match {:mvn/version "1.0.0"}
com.andrewmcveigh/cljs-time {:git/url "https://github.com/logseq/cljs-time" ;; fork
:sha "5704fbf48d3478eedcf24d458c8964b3c2fd59a9"}
;; TODO: delete cljs-drag-n-drop and use dnd-kit
cljs-drag-n-drop/cljs-drag-n-drop {:mvn/version "0.1.0"}
cljs-http/cljs-http {:mvn/version "0.1.46"}
org.babashka/sci {:mvn/version "0.3.2"}
Expand All @@ -36,20 +37,20 @@
logseq/outliner {:local/root "deps/outliner"}
logseq/publishing {:local/root "deps/publishing"}
logseq/shui {:local/root "deps/shui"}
metosin/malli {:mvn/version "0.10.0"}
metosin/malli {:mvn/version "0.16.1"}
com.cognitect/transit-cljs {:mvn/version "0.8.280"}
missionary/missionary {:mvn/version "b.39"}}

:aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/" "src/electron/"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.54"}
:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.132"}
org.clojure/tools.namespace {:mvn/version "0.2.11"}
cider/cider-nrepl {:mvn/version "0.47.0"}
org.clojars.knubie/cljs-run-test {:mvn/version "1.0.1"}
tortue/spy {:mvn/version "2.14.0"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}

:test {:extra-paths ["src/test/"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.54"}
:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.132"}
org.clojure/test.check {:mvn/version "1.1.1"}
pjstadig/humane-test-output {:mvn/version "0.11.0"}
org.clojars.knubie/cljs-run-test {:mvn/version "1.0.1"}
Expand Down
2 changes: 2 additions & 0 deletions deps/common/.carve/config.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{:paths ["src"]
:api-namespaces [logseq.common.path
logseq.common.fractional-index
logseq.common.missionary-util
logseq.common.util.page-ref
logseq.common.util.block-ref
logseq.common.util
Expand Down
2 changes: 1 addition & 1 deletion deps/common/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:aliases
{:test {:extra-paths ["test"]
:extra-deps {olical/cljs-test-runner {:mvn/version "3.8.0"}
org.clojure/clojurescript {:mvn/version "1.11.54"}}
org.clojure/clojurescript {:mvn/version "1.11.132"}}
:main-opts ["-m" "cljs-test-runner.main"]}
:clj-kondo
{:replace-deps {clj-kondo/clj-kondo {:mvn/version "2023.05.26"}}
Expand Down
2 changes: 1 addition & 1 deletion deps/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"devDependencies": {
"@logseq/nbb-logseq": "logseq/nbb-logseq#feat-db-v10"
"@logseq/nbb-logseq": "logseq/nbb-logseq#feat-db-v12"
},
"scripts": {
"test": "yarn nbb-logseq -cp test -m nextjournal.test-runner"
Expand Down
2 changes: 0 additions & 2 deletions deps/common/resources/templates/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@
[?h :block/marker ?marker]
[(contains? #{"NOW" "DOING"} ?marker)]
[?h :block/page ?p]
[?p :block/journal? true]
[?p :block/journal-day ?d]
[(>= ?d ?start)]
[(<= ?d ?today)]]
Expand All @@ -232,7 +231,6 @@
[?h :block/marker ?marker]
[(contains? #{"NOW" "LATER" "TODO"} ?marker)]
[?h :block/page ?p]
[?p :block/journal? true]
[?p :block/journal-day ?d]
[(> ?d ?start)]
[(< ?d ?next)]]
Expand Down
163 changes: 163 additions & 0 deletions deps/common/src/logseq/common/fractional_index.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
(ns logseq.common.fractional-index
"Fractional indexing to create an ordering that can be used for Realtime Editing of Ordered Sequences")

;; Original code from https://github.com/rocicorp/fractional-indexing,
;; It's converted to cljs by using AI.

(def base-62-digits
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")

(defn char->int
[^js c]
(.charCodeAt c))

(defn get-integer-length
[head]
(let [head-char (char->int head)]
(cond
(and (>= head-char (char->int \a)) (<= head-char (char->int \z)))
(+ (- head-char (char->int \a)) 2)

(and (>= head-char (char->int \A)) (<= head-char (char->int \Z)))
(+ (- (char->int \Z) head-char) 2)

:else
(throw (js/Error. (str "invalid order key head: " head))))))

(defn validate-integer
[int]
(when-not (= (count int) (get-integer-length (first int)))
(throw (js/Error. (str "invalid integer part of order key: " int)))))

(defn get-integer-part
[key]
(let [integer-part-length (get-integer-length (first key))]
(when (> integer-part-length (count key))
(throw (js/Error. (str "invalid order key: " key))))
(subs key 0 integer-part-length)))

(defn validate-order-key
[key digits]
(when (= key (str "A" (repeat 26 (first digits))))
(throw (js/Error. (str "invalid order key: " key))))
(let [i (get-integer-part key)
f (subs key (count i))]
(when (= (last f) (first digits))
(throw (js/Error. (str "invalid order key: " key))))))

(defn increment-integer
[x digits]
(validate-integer x)
(let [[head & digs] (seq x)
[carry? diff] (reduce
(fn [[carry? digs] dig]
(if carry?
(let [d (inc (.indexOf digits dig))]
(if (= d (count digits))
[true (conj digs (first digits))]
[false (conj digs (nth digits d))]))
[carry? digs]))
[true []]
(reverse digs))
digs (into (subvec (vec digs) 0 (- (count digs)
(count diff)))
(reverse diff))]
(if carry?
(cond
(= head \Z) (str "a" (first digits))
(= head \z) nil
:else (let [h (char (inc (.charCodeAt head 0)))
digs (if (> (compare h \a) 0)
(conj digs (first digits))
(pop digs))]
(str h (apply str digs))))
(str head (apply str digs)))))

(defn decrement-integer
[x digits]
(validate-integer x)
(let [[head & digs] (seq x)
[borrow digs] (reduce
(fn [[_ digs] dig]
(let [d (dec (.indexOf digits dig))]
(if (= d -1)
[true (conj digs (last digits))]
[false (conj digs (nth digits d))])))
[true []]
(reverse digs))]
(if borrow
(cond
(= head \a) (str "Z" (last digits))
(= head \A) nil
:else (let [h (char (- (.charCodeAt head 0) 1))
digs (if (< (compare h \Z) 0)
(conj digs (last digits))
(pop digs))]
(str h (apply str digs))))
(str head (apply str digs)))))

(defn midpoint
[a b digits]
(let [zero (first digits)]
(when (and b (or (>= (compare a b) 0) (= (last a) zero) (= (last b) zero)))
(throw (js/Error. (str a " >= " b " or trailing zero"))))
(let [n (when b
(first (keep-indexed (fn [i _c] (when-not (= (nth a i zero) (nth b i)) i)) b)))]
(if (and n (> n 0))
(str (subs b 0 n) (midpoint (subs a n) (subs b n) digits))
(let [digit-a (if (seq a) (.indexOf digits (first a)) 0)
digit-b (if (seq b) (.indexOf digits (first b)) (count digits))]
(if (> (- digit-b digit-a) 1)
(str (nth digits (Math/round (* 0.5 (+ digit-a digit-b)))))
(if (and (seq b) (> (count b) 1))
(subs b 0 1)
(str (nth digits digit-a) (midpoint (subs a 1) nil digits)))))))))

(defn generate-key-between
[a b & {:keys [digits]
:or {digits base-62-digits}}]
(when a (validate-order-key a digits))
(when b (validate-order-key b digits))
(when (and a b (>= (compare a b) 0))
(throw (js/Error. (str a " >= " b))))
(cond
(nil? a) (if (nil? b)
(str "a" (first digits))
(let [ib (get-integer-part b)
fb (subs b (count ib))]
(if (= ib (str "A" (apply str (repeat 26 (first digits)))))
(str ib (midpoint "" fb digits))
(if (< (compare ib b) 0)
ib
(let [res (decrement-integer ib digits)]
(if (nil? res)
(throw (js/Error. "cannot decrement any more"))
res))))))
(nil? b) (let [ia (get-integer-part a)
fa (subs a (count ia))
i (increment-integer ia digits)]
(if (nil? i)
(str ia (midpoint fa nil digits))
i))
:else (let [ia (get-integer-part a)
fa (subs a (count ia))
ib (get-integer-part b)
fb (subs b (count ib))]
(if (= ia ib)
(str ia (midpoint fa fb digits))
(let [i (increment-integer ia digits)]
(if (nil? i)
(throw (js/Error. "cannot increment any more"))
(if (< (compare i b) 0) i (str ia (midpoint fa nil digits)))))))))

(defn generate-n-keys-between
[a b n & {:keys [digits]
:or {digits base-62-digits}}]
(cond
(= n 0) []
(= n 1) [(generate-key-between a b digits)]
:else (let [c (generate-key-between a b digits)]
(concat
(generate-n-keys-between a c (Math/floor (/ n 2)) digits)
[c]
(generate-n-keys-between c b (- n (Math/floor (/ n 2)) 1) digits)))))
62 changes: 62 additions & 0 deletions deps/common/test/logseq/common/fractional_index_test.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
(ns logseq.common.fractional-index-test
(:require [clojure.test :refer [deftest are]]
[logseq.common.fractional-index :as index]))

(deftest increment-integer-test
(are [x y]
(= (index/increment-integer x index/base-62-digits) y)
"a0" "a1"
"r3333333333333333zz" "r333333333333333400"))

(deftest generate-key-between-test
(are [x y]
(= (index/generate-key-between x nil) y)
"a0" "a1"
"rzzzzzzzzzzzzzzzzzz" "s0000000000000000000"))

(deftest generate-n-keys-between-test
(are [x y]
(= (index/generate-n-keys-between (first x) (second x) 20) y)
["ZxV" "Zy7"]
["ZxX"
"ZxZ"
"Zxd"
"Zxf"
"Zxh"
"Zxl"
"Zxn"
"Zxp"
"Zxt"
"Zxx"
"Zy"
"Zy0V"
"Zy1"
"Zy2"
"Zy3"
"Zy4"
"Zy4V"
"Zy5"
"Zy6"
"Zy6V"]

["Zy7" "axV"]
["ZyB"
"ZyE"
"ZyL"
"ZyP"
"ZyS"
"ZyZ"
"Zyd"
"Zyg"
"Zyn"
"Zyu"
"Zz"
"Zz8"
"ZzG"
"ZzV"
"Zzl"
"a0"
"a0G"
"a0V"
"a1"
"a2"]))
6 changes: 3 additions & 3 deletions deps/common/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# yarn lockfile v1


"@logseq/nbb-logseq@logseq/nbb-logseq#feat-db-v10":
version "1.2.173-feat-db-v10"
resolved "https://codeload.github.com/logseq/nbb-logseq/tar.gz/8a4bfaae55d85292476ac8f976516b86e6ae4036"
"@logseq/nbb-logseq@logseq/nbb-logseq#feat-db-v12":
version "1.2.173-feat-db-v12"
resolved "https://codeload.github.com/logseq/nbb-logseq/tar.gz/8274d8b40b7fec84532c54e16b5a8c6f78bf673b"
dependencies:
import-meta-resolve "^2.1.0"

Expand Down
2 changes: 2 additions & 0 deletions deps/db/.carve/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
logseq.db.sqlite.util
logseq.db.sqlite.cli
logseq.db.frontend.property
logseq.db.frontend.property.build
logseq.db.frontend.property.util
logseq.db.frontend.content
logseq.db.frontend.order
logseq.db.sqlite.create-graph
logseq.db.frontend.malli-schema
;; Some fns are used by frontend but not worth moving over yet
Expand Down
2 changes: 0 additions & 2 deletions deps/db/.carve/ignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ logseq.db.frontend.rules/db-query-dsl-rules
;; API
logseq.db.frontend.rules/extract-rules
;; API
logseq.db.frontend.property.type/type-or-closed-value?
;; API
logseq.db.frontend.property.type/infer-property-type-from-value
;; Internal API
logseq.db.frontend.rules/rules
Expand Down
5 changes: 3 additions & 2 deletions deps/db/deps.edn
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{:deps
;; External deps should be kept in sync with https://github.com/logseq/nbb-logseq/blob/main/bb.edn
{datascript/datascript {:git/url "https://github.com/logseq/datascript" ;; fork
:sha "fc3645fa4a6b8160e087e2ad1ce1c242675680cb"}
:sha "aa2f963be5d507b55d05c4d9a6ee3ce9454c4415"}
datascript-transit/datascript-transit {:mvn/version "0.3.0"
:exclusions [datascript/datascript]}
cljs-bean/cljs-bean {:mvn/version "1.5.0"}
com.cognitect/transit-cljs {:mvn/version "0.8.280"}
logseq/common {:local/root "../common"}
funcool/promesa {:mvn/version "4.0.2"}}
funcool/promesa {:mvn/version "4.0.2"}
org.flatland/ordered {:mvn/version "1.15.11"}}

:aliases
{:clj-kondo
Expand Down