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

This commit is contained in:
charlie
2024-05-11 15:14:21 +08:00
parent fcf6ebd0e4
commit 061700c6b1
5 changed files with 10 additions and 12 deletions

4
.gitmodules vendored Normal file
View File

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

View File

@@ -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)))]

View File

@@ -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": {

View File

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

View File

@@ -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,