瀏覽代碼

enhance(ui): WIP optimization for the shui popup related fundamental components

charlie 1 年之前
父節點
當前提交
061700c6b1
共有 5 個文件被更改,包括 10 次插入12 次删除
  1. 4 0
      .gitmodules
  2. 1 10
      deps/shui/src/logseq/shui/popup/core.cljs
  3. 1 1
      package.json
  4. 1 0
      packages/ui/.gitignore
  5. 3 1
      packages/ui/package.json

+ 4 - 0
.gitmodules

@@ -0,0 +1,4 @@
+[submodule "packages/ui/primitives"]
+	path = packages/ui/primitives
+	url = https://github.com/xyhp915/primitives.git
+	shallow = true

+ 1 - 10
deps/shui/src/logseq/shui/popup/core.cljs

@@ -164,6 +164,7 @@
                          :top y
                          :left x}} ""))
        (let [content-props (cond-> (merge {:onEscapeKeyDown #(hide! id)
+                                           :disableOutsideScroll false
                                            :onPointerDownOutside #(hide! id)}
                                           content-props)
                              (and (not force-popover?)
@@ -184,16 +185,6 @@
   < rum/static
   []
   (let [[popups _set-popups!] (use-atom *popups)]
-
-    (rum/use-effect!
-      (fn []
-        (let [^js cls (.-classList js/document.documentElement)
-              s "has-x-popups"]
-          (if (and (counted? popups) (> (count popups) 0))
-            (.add cls s) (.remove cls s))
-          #(.remove cls s)))
-      [popups])
-
     [:<>
      (for [config popups
            :when (and (map? config) (:id config) (not (:all? config)))]

+ 1 - 1
package.json

@@ -75,7 +75,7 @@
         "android:dev": "cross-env PLATFORM=android gulp cap",
         "tldraw:build": "yarn --cwd packages/tldraw install",
         "amplify:build": "yarn --cwd packages/amplify install",
-        "ui:build": "yarn --cwd packages/ui install",
+        "ui:build": "git submodule update --quiet --init --depth=1 && yarn --cwd packages/ui install",
         "postinstall": "yarn tldraw:build && yarn amplify:build && yarn ui:build"
     },
     "dependencies": {

+ 1 - 0
packages/ui/.gitignore

@@ -1,3 +1,4 @@
 .parcel-cache
 .storybook/cljs
+primitives/
 dist

+ 3 - 1
packages/ui/package.json

@@ -8,6 +8,7 @@
     "build:ui:only": "parcel build --target ui",
     "build:ui": "rm -rf .parcel-cache && yarn build:ui:only",
     "watch:storybook": "storybook dev -p 6006",
+    "preinstall": "cd primitives/ && yarn install && yarn build",
     "postinstall": "yarn build:ui"
   },
   "dependencies": {
@@ -85,7 +86,8 @@
     },
     "react/jsx-dev-runtime": "./node_modules/react/jsx-dev-runtime.js",
     "react/jsx-runtime": "./node_modules/react/jsx-runtime.js",
-    "@/*": "./@/$1"
+    "@/*": "./@/$1",
+    "@radix-ui/react-*": "./primitives/packages/react/$1"
   },
   "targets": {
     "main": false,