forked from logseq/logseq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request logseq#10132 from logseq/feat/cmdk
feat: new cmdk
- Loading branch information
Showing
127 changed files
with
5,551 additions
and
3,029 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Deploy master to cloudflare pages for test | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
|
||
env: | ||
CLOJURE_VERSION: "1.10.1.763" | ||
NODE_VERSION: "18" | ||
JAVA_VERSION: "11" | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Java JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "zulu" | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Setup clojure | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: ${{ env.CLOJURE_VERSION }} | ||
|
||
- name: Fetch yarn deps | ||
run: yarn cache clean && yarn install --frozen-lockfile | ||
|
||
- name: Build Released-Web | ||
run: | | ||
yarn gulp:build && clojure -M:cljs release app --config-merge '{:compiler-options {:source-map-include-sources-content false :source-map-detail-level :symbols}}' | ||
rsync -avz --exclude node_modules --exclude '*.js.map' --exclude android --exclude ios ./static/ ./public/static/ | ||
ls -lR ./public | ||
- name: Publish to Cloudflare Pages | ||
uses: cloudflare/pages-action@1 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: 2553ea8236c11ea0f88de28fce1cbfee | ||
projectName: "logseq-dev" | ||
directory: "public" | ||
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | ||
branch: "main" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,208 @@ | ||
- [[About Shui]] | ||
- [[shui/components]] | ||
- [[shui/components/table]] | ||
- | ||
- [[shui/components]] if there was text here | ||
- beta | ||
- [[shui/components/table]] | ||
- up next | ||
- [[shui/components/button]] | ||
- [[shui/components/input]] | ||
- [[shui/components/tooltip]] | ||
- [[shui/components/text]] | ||
- future | ||
- [[shui/components/icon]] | ||
- [[shui/components/tag]] | ||
- [[shui/components/toggle]] | ||
- [[shui/components/context-menu]] | ||
- [[shui/components/right-sidebar]] | ||
- [[shui/components/modal]] | ||
- [[shui/components/properties]] | ||
- [[shui/components/code]] | ||
collapsed:: true | ||
- ```css | ||
:root { | ||
--lx-blue-1: #123456; | ||
} | ||
``` | ||
- ```clojurescript | ||
(js/document.style.setProperty "--lx-blue-1" ""#abcdef") | ||
``` | ||
- ```python | ||
# This is a single-line comment | ||
""" | ||
This is a | ||
multi-line comment (docstring) | ||
""" | ||
|
||
# Import statement | ||
import math | ||
|
||
# Constant | ||
CONSTANT = 3.14159 | ||
|
||
# Function definition, decorators and function call | ||
@staticmethod | ||
def add_numbers(x, y): | ||
"""This function adds two numbers""" | ||
return x + y | ||
|
||
result = add_numbers(5, 7) | ||
|
||
# Built-in functions | ||
print(f"Sum is: {result}") | ||
|
||
# Class definition and object creation | ||
class MyClass: | ||
# Class variable | ||
class_var = "I'm a class variable" | ||
|
||
def __init__(self, instance_var): | ||
# Instance variable | ||
self.instance_var = instance_var | ||
|
||
def method(self): | ||
return self.instance_var | ||
|
||
# Creating object of the class | ||
obj = MyClass("I'm an instance variable") | ||
print(obj.method()) | ||
|
||
# Control flow - if, elif, else | ||
num = 10 | ||
if num > 0: | ||
print("Positive number") | ||
elif num == 0: | ||
print("Zero") | ||
else: | ||
print("Negative number") | ||
|
||
# For loop and range function | ||
for i in range(5): | ||
print(i) | ||
|
||
# List comprehension | ||
squares = [x**2 for x in range(10)] | ||
|
||
# Generator expression | ||
gen = (x**2 for x in range(10)) | ||
|
||
# While loop | ||
count = 0 | ||
while count < 5: | ||
print(count) | ||
count += 1 | ||
|
||
# Exception handling | ||
try: | ||
# Division by zero | ||
x = 1 / 0 | ||
except ZeroDivisionError as e: | ||
print("Handling run-time error:", e) | ||
|
||
# Lambda function | ||
double = lambda x: x * 2 | ||
print(double(5)) | ||
|
||
# File I/O | ||
with open('test.txt', 'r') as file: | ||
content = file.read() | ||
|
||
# Assert | ||
assert num > 0, "Number is not positive" | ||
|
||
``` | ||
- ```clojure | ||
;; This is a comment | ||
|
||
;; Numbers | ||
42 | ||
2.71828 | ||
|
||
;; Strings | ||
"Hello, world!" | ||
|
||
;; Characters | ||
\a | ||
|
||
;; Booleans | ||
true | ||
false | ||
|
||
;; Lists | ||
'(1 2 3 4 5) | ||
|
||
;; Vectors | ||
[1 2 3 4 5] | ||
|
||
;; Maps | ||
{:name "John Doe" :age 30 :email "[email protected]"} | ||
|
||
;; Sets | ||
#{1 2 3 4 5} | ||
|
||
;; Functions | ||
(defn add-numbers [x y] | ||
"This function adds two numbers." | ||
(+ x y)) | ||
|
||
(def result (add-numbers 5 7)) | ||
(println "Sum is: " result) | ||
|
||
;; Anonymous function | ||
(#(+ %1 %2) 5 7) | ||
|
||
;; Conditionals | ||
(if (> result 0) | ||
(println "Positive number") | ||
(println "Zero or negative number")) | ||
|
||
;; Loops | ||
(loop [x 0] | ||
(when (< x 5) | ||
(println x) | ||
(recur (+ x 1)))) | ||
|
||
;; For | ||
(for [x (range 5)] (println x)) | ||
|
||
;; Map over a list | ||
(map inc '(1 2 3)) | ||
|
||
;; Exception handling | ||
(try | ||
(/ 1 0) | ||
(catch ArithmeticException e | ||
(println "Caught an exception: " (.getMessage e)))) | ||
|
||
;; Macros | ||
(defmacro unless [pred a b] | ||
`(if (not ~pred) ~a ~b)) | ||
|
||
(unless true | ||
(println "This will not print") | ||
(println "This will print")) | ||
|
||
;; Keywords | ||
:foo | ||
:bar/baz | ||
|
||
|
||
``` | ||
- ```css | ||
.example { | ||
something: "#abc123" | ||
} | ||
``` | ||
- [[shui/colors]] | ||
- We want to switch to radix variables | ||
- We want to make it easy to customize with themes | ||
- We want to support as much old themes as possible | ||
- var(--ui-button-color, | ||
collapsed:: true | ||
- var(--logseq-button-primary-color, | ||
collapsed:: true | ||
- var(--lx-color-6))) | ||
- light and dark variants | ||
- [[shui/inline]] | ||
- | ||
- / | ||
- | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- support hidden properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(ns logseq.shui.button.v2 | ||
(:require | ||
[clojure.string :as str] | ||
[rum.core :as rum] | ||
[logseq.shui.icon.v2 :as icon] | ||
[clojure.string :as string])) | ||
|
||
(rum/defcs root < rum/reactive | ||
(rum/local nil ::hover-theme) | ||
[state {:keys [theme hover-theme color text depth size icon interactive shortcut tiled on-click muted disabled? class href button-props icon-props] | ||
:or {theme :color depth 1 size :md interactive true muted false class ""}} context] | ||
(let [*hover-theme (::hover-theme state) | ||
color-string (or (some-> color name) (some-> context :state rum/react :ui/radix-color name) "custom") | ||
theme (or @*hover-theme theme) | ||
theme-class (str "ui__button-theme-" (if (keyword? theme) (name theme) "color")) | ||
depth-class (when-not (= :text theme) (str "ui__button-depth-" depth)) | ||
color-class (str "ui__button-color-" color-string) | ||
muted-class (when muted "ui__button-muted") | ||
size-class (str "ui__button-size-" (name size)) | ||
tiled-class (when tiled "ui__button-tiled") | ||
on-click (fn [e] | ||
(when href (set! (.-href js/window.location) href)) | ||
(when on-click (on-click e)))] | ||
[:button.ui__button | ||
(merge | ||
button-props | ||
(cond-> | ||
{:class (str theme-class " " depth-class " " color-class " " size-class " " tiled-class " " muted-class " " class) | ||
:disabled (boolean disabled?) | ||
:on-mouse-over #(when hover-theme (reset! *hover-theme hover-theme)) | ||
:on-mouse-out #(reset! *hover-theme nil)} | ||
on-click | ||
(assoc :on-click on-click))) | ||
(if-not tiled text | ||
(for [[index tile] (map-indexed vector (rest (string/split text #"")))] | ||
[:<> | ||
(when (< 0 index) | ||
[:div.ui__button__tile-separator]) | ||
[:div.ui__button__tile tile]])) | ||
|
||
(when icon | ||
(icon/root icon icon-props)) | ||
(when (not-empty shortcut) | ||
(for [key shortcut] | ||
[:div.ui__button-shortcut-key | ||
(case key | ||
"cmd" [:div "⌘"] | ||
"shift" [:div "⇧"] | ||
"return" [:div "↵"] | ||
"esc" [:div.tracking-tightest {:style {:transform "scaleX(0.8) scaleY(1.2) " | ||
:font-size "0.5rem" | ||
:font-weight "500"}} "ESC"] | ||
(cond-> key (string? key) .toUpperCase))]))])) |
Oops, something went wrong.