Skip to content

Commit

Permalink
Merge branch 'master' into feat/wb-linkings
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 authored Nov 23, 2022
2 parents 1860a81 + bc0ebf1 commit 926b7d8
Show file tree
Hide file tree
Showing 96 changed files with 3,350 additions and 1,061 deletions.
1 change: 1 addition & 0 deletions .clj-kondo/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
frontend.db.query-react query-react
frontend.diff diff
frontend.encrypt encrypt
frontend.extensions.sci sci
frontend.format.mldoc mldoc
frontend.format.block block
frontend.fs fs
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ on:
branches: [master]
paths:
- 'ios/App'
- package.json
pull_request:
branches: [master]
paths:
- 'ios/App'
- package.json

env:
CLOJURE_VERSION: '1.10.1.763'
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/build-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ jobs:
run: yarn cache clean && yarn install --frozen-lockfile

- name: Build Released-Web
run: yarn gulp:build && clojure -M:cljs release app --config-merge '{:asset-path "${{env.asset-path}}"}'
run: |
yarn gulp:build && clojure -M:cljs release app --config-merge '{:asset-path "${{env.asset-path}}" :compiler-options {:source-map-include-sources-content false :source-map-detail-level :symbols}}'
ls -ah ./static/js
- uses: jakejarvis/s3-sync-action@master
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@1
with:
#args: --acl public-read --follow-symlinks --delete
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
SOURCE_DIR: 'static' # optional: defaults to entire repository
DEST_DIR: ${GITHUB_REF##*/}/static
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 2553ea8236c11ea0f88de28fce1cbfee
projectName: 'logseq-demo'
directory: 'static'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: 'production'
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,17 @@ We have [a dedicated overview page](https://github.com/logseq/logseq/blob/master
## Set up development environment
* For setting up web app / desktop app development environment on macOS / Linux, please refer to [Develop Logseq](docs/develop-logseq.md).

* For Windows users, please refer to [Develop LogSeq on Windows](docs/develop-logseq-on-windows.md) in addition.
* For Windows users, please refer to [Develop Logseq on Windows](docs/develop-logseq-on-windows.md) in addition.

There are more guides in [docs/](docs/), e.g. the [Guide for contributing to translations](docs/contributing-to-translations.md) and the [Docker web app guide](docs/docker-web-app-guide.md)

## How to contribute with a PR
If you would like to contribute by solving an open issue, please fork this repository and then create a branch for the fix.

Once you push your code to your fork you we'll be able to open a PR into Logseq repository. For more info you can follow this guide from [Github docs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)

And here a list of some [good firt issues](https://github.com/logseq/logseq/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)!

## Thanks

[![JetBrains](docs/assets/jetbrains.svg)](https://www.jetbrains.com/?from=logseq)
1 change: 1 addition & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
implementation project(':capacitor-splash-screen')
implementation project(':capacitor-status-bar')
implementation project(':capawesome-capacitor-background-task')
implementation project(':hugotomazi-capacitor-navigation-bar')
implementation project(':logseq-capacitor-file-sync')
implementation project(':capacitor-voice-recorder')
implementation project(':send-intent')
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/assets/capacitor.plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
"pkg": "@capawesome/capacitor-background-task",
"classpath": "io.capawesome.capacitorjs.plugins.backgroundtask.BackgroundTaskPlugin"
},
{
"pkg": "@hugotomazi/capacitor-navigation-bar",
"classpath": "br.com.tombus.capacitor.plugin.navigationbar.NavigationBarPlugin"
},
{
"pkg": "@logseq/capacitor-file-sync",
"classpath": "com.logseq.app.filesync.FileSyncPlugin"
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="logoPrimary">#002b36</color>
<color name="colorPrimary">#ffffff</color>
<color name="colorPrimaryDark">#002b36</color>
</resources>
2 changes: 2 additions & 0 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<item name="windowNoTitle">true</item>
<item name="android:background">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:navigationBarColor">@color/colorPrimary</item>
<item name="android:statusBarColor">@color/colorPrimary</item>
</style>

<!-- App Starting -->
Expand Down
3 changes: 3 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacit
include ':capawesome-capacitor-background-task'
project(':capawesome-capacitor-background-task').projectDir = new File('../node_modules/@capawesome/capacitor-background-task/android')

include ':hugotomazi-capacitor-navigation-bar'
project(':hugotomazi-capacitor-navigation-bar').projectDir = new File('../node_modules/@hugotomazi/capacitor-navigation-bar/android')

include ':logseq-capacitor-file-sync'
project(':logseq-capacitor-file-sync').projectDir = new File('../node_modules/@logseq/capacitor-file-sync/android')

Expand Down
2 changes: 1 addition & 1 deletion deps/db/bb.edn
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[logseq.db.rules :as rules])
:doc "Lint datalog rules for parsability and unbound variables"
:task (datalog/lint-rules
(into rules/rules
(into (mapcat val rules/rules)
(-> rules/query-dsl-rules
;; TODO: Update linter to handle false positive on ?str-val
(dissoc :property)
Expand Down
111 changes: 56 additions & 55 deletions deps/db/src/logseq/db/rules.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,63 @@
"Datalog rules for use with logseq.db.schema")

(def ^:large-vars/data-var rules
"Rules used mainly in frontend.db.model"
;; rule "parent" is optimized for parent node -> child node nesting queries
'[[(parent ?p ?c)
[?c :block/parent ?p]]
[(parent ?p ?c)
[?c :block/parent ?t]
(parent ?p ?t)]

;; rule "child" is optimized for child node -> parent node nesting queries
[(child ?p ?c)
[?c :block/parent ?p]]
[(child ?p ?c)
[?t :block/parent ?p]
(child ?t ?c)]

;; rule "namespace" is optimized for child node -> node of upper namespace level nesting queries
[(namespace ?p ?c)
[?c :block/namespace ?p]]
[(namespace ?p ?c)
[?t :block/namespace ?p]
(namespace ?t ?c)]

;; Select rules carefully, as it is critical for performance.
;; The rules have different clause order and resolving directions.
;; Clause order Reference:
;; https://docs.datomic.com/on-prem/query/query-executing.html#clause-order
;; Recursive optimization Reference:
;; https://stackoverflow.com/questions/42457136/recursive-datalog-queries-for-datomic-really-slow
;; Should optimize for query the decendents of a block
;; Quote:
;; My theory is that your rules are not written in a way that Datalog can optimize for this read pattern - probably resulting in a traversal of all the entities. I suggest to rewrite them as follows:
;; [[(ubersymbol ?c ?p)
;; (?c :ml/parent ?p)]
;; [(ubersymbol ?c ?p)
;; ;; we bind a child of the ancestor, instead of a parent of the descendant
;; (?c1 :ml/parent ?p)
;; (ubersymbol ?c ?c1)]]

;; This way of writing the ruleset is optimized to find the descendants of some node. The way you originally wrote it is optimized to find the anscestors of some node.

;; from https://stackoverflow.com/questions/43784258/find-entities-whose-ref-to-many-attribute-contains-all-elements-of-input
;; Quote:
;; You're tackling the general problem of 'dynamic conjunction' in Datomic's Datalog.
;; Write a dynamic Datalog query which uses 2 negations and 1 disjunction or a recursive rule
;; Datalog has no direct way of expressing dynamic conjunction (logical AND / 'for all ...' / set intersection).
;; However, you can achieve it in pure Datalog by combining one disjunction
;; (logical OR / 'exists ...' / set union) and two negations, i.e
;; (For all ?g in ?Gs p(?e,?g)) <=> NOT(Exists ?g in ?Gs, such that NOT(p(?e, ?g)))

;; [(matches-all ?e ?a ?vs)
;; [(first ?vs) ?v0]
;; [?e ?a ?v0]
;; (not-join [?e ?vs]
;; [(identity ?vs) [?v ...]]
;; (not-join [?e ?v]
;; [?e ?a ?v]))]
])
{:namespace
'[[(namespace ?p ?c)
[?c :block/namespace ?p]]
[(namespace ?p ?c)
[?t :block/namespace ?p]
(namespace ?t ?c)]]

:alias
'[[(alias ?e2 ?e1)
[?e2 :block/alias ?e1]]
[(alias ?e2 ?e1)
[?e1 :block/alias ?e2]]
[(alias ?e1 ?e3)
[?e1 :block/alias ?e2]
[?e2 :block/alias ?e3]]
[(alias ?e3 ?e1)
[?e1 :block/alias ?e2]
[?e2 :block/alias ?e3]]]})

;; Rules writing advice
;; ====================
;; Select rules carefully, as it is critical for performance.
;; The rules have different clause order and resolving directions.
;; Clause order Reference:
;; https://docs.datomic.com/on-prem/query/query-executing.html#clause-order
;; Recursive optimization Reference:
;; https://stackoverflow.com/questions/42457136/recursive-datalog-queries-for-datomic-really-slow
;; Should optimize for query the decendents of a block
;; Quote:
;; My theory is that your rules are not written in a way that Datalog can optimize for this read pattern - probably resulting in a traversal of all the entities. I suggest to rewrite them as follows:
;; [[(ubersymbol ?c ?p)
;; (?c :ml/parent ?p)]
;; [(ubersymbol ?c ?p)
;; ;; we bind a child of the ancestor, instead of a parent of the descendant
;; (?c1 :ml/parent ?p)
;; (ubersymbol ?c ?c1)]]

;; This way of writing the ruleset is optimized to find the descendants of some node. The way you originally wrote it is optimized to find the anscestors of some node.

;; from https://stackoverflow.com/questions/43784258/find-entities-whose-ref-to-many-attribute-contains-all-elements-of-input
;; Quote:
;; You're tackling the general problem of 'dynamic conjunction' in Datomic's Datalog.
;; Write a dynamic Datalog query which uses 2 negations and 1 disjunction or a recursive rule
;; Datalog has no direct way of expressing dynamic conjunction (logical AND / 'for all ...' / set intersection).
;; However, you can achieve it in pure Datalog by combining one disjunction
;; (logical OR / 'exists ...' / set union) and two negations, i.e
;; (For all ?g in ?Gs p(?e,?g)) <=> NOT(Exists ?g in ?Gs, such that NOT(p(?e, ?g)))

;; [(matches-all ?e ?a ?vs)
;; [(first ?vs) ?v0]
;; [?e ?a ?v0]
;; (not-join [?e ?vs]
;; [(identity ?vs) [?v ...]]
;; (not-join [?e ?v]
;; [?e ?a ?v]))]

(def ^:large-vars/data-var query-dsl-rules
"Rules used by frontend.db.query-dsl. The symbols ?b and ?p respectively refer
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ test('should not have any automatically detectable accessibility issues', async
.setLegacyMode()
.analyze()

expect(accessibilityScanResults.violations).toEqual([]);
expect(accessibilityScanResults.violations).toEqual([]);
})
35 changes: 35 additions & 0 deletions e2e-tests/editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,41 @@ test('hashtag and quare brackets in same line #4178', async ({ page }) => {
)
})

test('hashtag search page auto-complete', async ({ page, block }) => {
await createRandomPage(page)

await block.activeEditing(0)

await page.type('textarea >> nth=0', '#', { delay: 100 })
await page.waitForSelector('text="Search for a page"', { state: 'visible' })
await page.keyboard.press('Escape', { delay: 50 })

await block.mustFill("done")

await enterNextBlock(page)
await page.type('textarea >> nth=0', 'Some#', { delay: 100 })
await page.waitForSelector('text="Search for a page"', { state: 'visible' })
await page.keyboard.press('Escape', { delay: 50 })

await block.mustFill("done")

await enterNextBlock(page)
await page.type('textarea >> nth=0', 'Some #', { delay: 100 })
await page.waitForSelector('text="Search for a page"', { state: 'visible' })
await page.keyboard.press('Escape', { delay: 50 })

await block.mustFill("done")

await enterNextBlock(page)
await page.type('textarea >> nth=0', 'SomeInner', { delay: 100 })
for (let i = 0; i < 5; i++) {
await page.press('textarea >> nth=0', 'ArrowLeft', { delay: 50 })
}
await page.type('textarea >> nth=0', '#', { delay: 50 })
await page.waitForSelector('text="Search for a page"', { state: 'visible' })
await page.keyboard.press('Escape', { delay: 50 })
})

test('disappeared children #4814', async ({ page, block }) => {
await createRandomPage(page)

Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/page-rename.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ async function homepage_rename_test(page: Page, original_page_name: string, new_
}

test('page rename test', async ({ page }) => {
await homepage_rename_test(page, "abcd", "a/b/c/d")
// TODO: Fix commented out test. Started failing after https://github.com/logseq/logseq/pull/6945
// await homepage_rename_test(page, "abcd", "a/b/c/d")
await page_rename_test(page, "abcd", "a.b.c.d")
await page_rename_test(page, "abcd", "a/b/c/d")

Expand Down
7 changes: 3 additions & 4 deletions e2e-tests/random.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from '@playwright/test'
import { test } from './fixtures'
import {
createRandomPage, randomInt, randomInsert, randomEditDelete, randomEditMoveUpDown, IsMac, randomString,
createRandomPage, randomInt, IsMac, randomString,
} from './utils'

/**
Expand Down Expand Up @@ -96,7 +96,8 @@ const generateRandomTest = (size: number): RandomTestStep[] => {
return steps
}

test('Random editor operations', async ({ page, block }) => {
// TODO: Fix test that intermittently started failing after https://github.com/logseq/logseq/pull/6945
test.skip('Random editor operations', async ({ page, block }) => {
const steps = generateRandomTest(20)

await createRandomPage(page)
Expand Down Expand Up @@ -175,7 +176,5 @@ test('Random editor operations', async ({ page, block }) => {

// FIXME: CHECK await block.waitForBlocks(expectedBlocks)
await page.waitForTimeout(50)

}

})
2 changes: 1 addition & 1 deletion e2e-tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Page, Locator } from 'playwright'
import { expect, ConsoleMessage } from '@playwright/test'
import * as process from 'process'
import { Block } from './types'
import pathlib from 'path'
import * as pathlib from 'path'

export const IsMac = process.platform === 'darwin'
export const IsLinux = process.platform === 'linux'
Expand Down
Loading

0 comments on commit 926b7d8

Please sign in to comment.