chore: remove ionic ui

This commit is contained in:
Tienson Qin
2025-08-05 23:07:05 +08:00
parent e828e960be
commit ba39408d8f
4 changed files with 73 additions and 227 deletions

View File

@@ -6,9 +6,8 @@
"scripts": {
"watch:ui:examples": "parcel serve ./examples/index.html",
"build:ui:only": "parcel build --target ui",
"build:ionic:only": "parcel build --target ionic",
"build:silkhq:only": "parcel build --target silkhq",
"build:ui": "rm -rf .parcel-cache && yarn build:ui:only && yarn build:ionic:only && yarn build:silkhq:only",
"build:ui": "rm -rf .parcel-cache && yarn build:ui:only && yarn build:silkhq:only",
"watch:storybook": "storybook dev -p 6006",
"postinstall": "yarn build:ui"
},
@@ -34,7 +33,6 @@
"@radix-ui/react-toggle": "^1.1.6",
"@radix-ui/react-toggle-group": "^1.1.7",
"@radix-ui/react-tooltip": "^1.2.4",
"@ionic/react": "8.5.7",
"@silk-hq/components": "^0.9.10",
"class-variance-authority": "^0.7.1",
"clsx": "^2.0.0",
@@ -102,14 +100,6 @@
"react-dom": false
}
},
"ionic": {
"source": "src/ionic.ts",
"outputFormat": "global",
"includeNodeModules": {
"react": false,
"react-dom": false
}
},
"silkhq": {
"source": "src/silkhq/silkhq.ts",
"outputFormat": "global",

View File

@@ -1,53 +0,0 @@
import {
setupIonicReact,
IonApp, IonPage,
IonNav, IonNavLink, IonContent,
IonHeader, IonBackButton,
IonButtons, IonToolbar, IonLoading,
IonTitle, IonButton, IonAlert,
IonInput, IonTextarea, IonIcon,
IonBadge, IonTabs, IonTab, IonTabBar,
IonTabButton, IonModal, IonLabel,
IonList, IonItem, IonDatetime,
IonDatetimeButton, IonRefresher,
IonRefresherContent, IonMenu,
IonMenuButton, IonActionSheet, IonSearchbar,
IonRouterOutlet, useIonViewDidEnter,
useIonViewDidLeave,
useIonViewWillEnter,
useIonViewWillLeave,
} from '@ionic/react'
declare global {
var LSIonic: any
}
const ionicUI = {
IonApp,
IonPage,
IonNav, IonNavLink, IonContent,
IonHeader, IonBackButton,
IonButtons, IonToolbar, IonLoading,
IonTitle, IonButton, IonAlert,
IonInput, IonTextarea, IonIcon,
IonBadge, IonTabs, IonTab, IonTabBar,
IonTabButton, IonModal, IonLabel,
IonList, IonItem, IonDatetime,
IonDatetimeButton, IonRefresher,
IonRefresherContent, IonMenu,
IonMenuButton, IonActionSheet, IonSearchbar,
IonRouterOutlet,
useIonViewDidEnter,
useIonViewDidLeave,
useIonViewWillEnter,
useIonViewWillLeave,
}
// initialize ionic mode
setupIonicReact()
window.LSIonic = ionicUI
export {
setupIonicReact,
}

View File

@@ -1273,24 +1273,6 @@
resolved "https://registry.yarnpkg.com/@hookform/resolvers/-/resolvers-3.3.2.tgz#5c40f06fe8137390b071d961c66d27ee8f76f3bc"
integrity sha512-Tw+GGPnBp+5DOsSg4ek3LCPgkBOuOgS5DsDV7qsWNH9LZc433kgsWICjlsh2J9p04H2K66hsXPPb9qn9ILdUtA==
"@ionic/core@8.5.7":
version "8.5.7"
resolved "https://registry.yarnpkg.com/@ionic/core/-/core-8.5.7.tgz#7297c88035f0372225b052db5426b4e1788b3b42"
integrity sha512-V5ZRYXD1MgAPdjfLyOejILAdTqIzpMY7/v6GSynFPPWoEpfFbGe/tNsimrYm1/D8iouigYLkJjWSeg2rpIpESA==
dependencies:
"@stencil/core" "4.20.0"
ionicons "^7.2.2"
tslib "^2.1.0"
"@ionic/react@8.5.7":
version "8.5.7"
resolved "https://registry.yarnpkg.com/@ionic/react/-/react-8.5.7.tgz#ad09cb3d1189e6f3cc52156fd56216655dd8d5e3"
integrity sha512-AgX4iu6SfuBhNgYr0H+K3oGsp7ESkCsnaqZdHRO2+GtKTmo4akMrFPihGj4LrZB/IaYwcvYQR/bPWHuZGJYsnw==
dependencies:
"@ionic/core" "8.5.7"
ionicons "^7.0.0"
tslib "*"
"@isaacs/cliui@^8.0.2":
version "8.0.2"
resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550"
@@ -3117,46 +3099,6 @@
resolved "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.1.1.tgz#78244efe12930c56fd255d7923865857c41ac8cb"
integrity sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==
"@rollup/rollup-darwin-arm64@4.34.9":
version "4.34.9"
resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.9.tgz#363467bc49fd0b1e17075798ac8e9ad1e1e29535"
integrity sha512-0CY3/K54slrzLDjOA7TOjN1NuLKERBgk9nY5V34mhmuu673YNb+7ghaDUs6N0ujXR7fz5XaS5Aa6d2TNxZd0OQ==
"@rollup/rollup-darwin-x64@4.34.9":
version "4.34.9"
resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.9.tgz#c2fe3d85fffe47f0ed0f076b3563ada22c8af19c"
integrity sha512-eOojSEAi/acnsJVYRxnMkPFqcxSMFfrw7r2iD9Q32SGkb/Q9FpUY1UlAu1DH9T7j++gZ0lHjnm4OyH2vCI7l7Q==
"@rollup/rollup-linux-arm64-gnu@4.34.9":
version "4.34.9"
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.9.tgz#1015c9d07a99005025d13b8622b7600029d0b52f"
integrity sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw==
"@rollup/rollup-linux-arm64-musl@4.34.9":
version "4.34.9"
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.9.tgz#8f895eb5577748fc75af21beae32439626e0a14c"
integrity sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A==
"@rollup/rollup-linux-x64-gnu@4.34.9":
version "4.34.9"
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.9.tgz#7193cbd8d128212b8acda37e01b39d9e96259ef8"
integrity sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A==
"@rollup/rollup-linux-x64-musl@4.34.9":
version "4.34.9"
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.9.tgz#29a6867278ca0420b891574cfab98ecad70c59d1"
integrity sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA==
"@rollup/rollup-win32-arm64-msvc@4.34.9":
version "4.34.9"
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.9.tgz#89427dcac0c8e3a6d32b13a03a296a275d0de9a9"
integrity sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q==
"@rollup/rollup-win32-x64-msvc@4.34.9":
version "4.34.9"
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.9.tgz#1973871850856ae72bc678aeb066ab952330e923"
integrity sha512-AyleYRPU7+rgkMWbEh71fQlrzRfeP6SyMnRf9XX4fCdDPAJumdSBqYEcWPMzVQ4ScAl7E4oFfK0GUVn77xSwbw==
"@silk-hq/components@^0.9.10":
version "0.9.10"
resolved "https://registry.yarnpkg.com/@silk-hq/components/-/components-0.9.10.tgz#ed6baa898b4f36ce0e5ecadabfecef748546db74"
@@ -3167,25 +3109,6 @@
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e"
integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==
"@stencil/core@4.20.0":
version "4.20.0"
resolved "https://registry.yarnpkg.com/@stencil/core/-/core-4.20.0.tgz#221f2b36ab999891560449b02d6915862c435f49"
integrity sha512-WPrTHFngvN081RY+dJPneKQLwnOFD60OMCOQGmmSHfCW0f4ujPMzzhwWU1gcSwXPWXz5O+8cBiiCaxAbJU7kAg==
"@stencil/core@^4.0.3":
version "4.31.0"
resolved "https://registry.yarnpkg.com/@stencil/core/-/core-4.31.0.tgz#57c5da8e46d9ad51406e7f542dcb2048be4f25d4"
integrity sha512-Ei9MFJ6LPD9BMFs+klkHylbVOOYhG10Jv4bvoFf3GMH15kA41rSYkEdr4DiX84ZdErQE2qtFV/2SUyWoXh0AhA==
optionalDependencies:
"@rollup/rollup-darwin-arm64" "4.34.9"
"@rollup/rollup-darwin-x64" "4.34.9"
"@rollup/rollup-linux-arm64-gnu" "4.34.9"
"@rollup/rollup-linux-arm64-musl" "4.34.9"
"@rollup/rollup-linux-x64-gnu" "4.34.9"
"@rollup/rollup-linux-x64-musl" "4.34.9"
"@rollup/rollup-win32-arm64-msvc" "4.34.9"
"@rollup/rollup-win32-x64-msvc" "4.34.9"
"@storybook/addon-actions@7.5.3":
version "7.5.3"
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-7.5.3.tgz#e0d0d819488d1d19918b23469b3ea6610fee5f07"
@@ -6683,13 +6606,6 @@ invariant@^2.2.4:
dependencies:
loose-envify "^1.0.0"
ionicons@^7.0.0, ionicons@^7.2.2:
version "7.4.0"
resolved "https://registry.yarnpkg.com/ionicons/-/ionicons-7.4.0.tgz#9c285aaa8089befbd6c5a89ae13292d364cd9ace"
integrity sha512-ZK94MMqgzMCPPMhmk8Ouu6goyVHFIlw/ACP6oe3FrikcI0N7CX0xcwVaEbUc0G/v3W0shI93vo+9ve/KpvcNhQ==
dependencies:
"@stencil/core" "^4.0.3"
ip@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.1.tgz#e8f3595d33a3ea66490204234b77636965307105"
@@ -9368,11 +9284,6 @@ ts-dedent@^2.0.0, ts-dedent@^2.2.0:
resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-2.2.0.tgz#39e4bd297cd036292ae2394eb3412be63f563bb5"
integrity sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==
tslib@*:
version "2.8.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==
tslib@^1.13.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"

View File

@@ -1,12 +1,10 @@
(ns mobile.components.ui
"Mobile ui"
(:require [cljs-bean.core :as bean]
[logseq.shui.silkhq]
[frontend.handler.notification :as notification]
(:require [frontend.handler.notification :as notification]
[frontend.rum :as r]
[frontend.state :as state]
[logseq.shui.ui :as shui]
[logseq.shui.silkhq :as silkhq]
[logseq.shui.ui :as shui]
[medley.core :as medley]
[mobile.state :as mobile-state]
[react-transition-group :refer [CSSTransition TransitionGroup]]
@@ -27,10 +25,10 @@
[:div.ui__notifications-content
[:div.pointer-events-auto.notification-clear
(shui/button
{:size :sm
:on-click (fn []
(notification/clear-all!))}
"clear all")]])
{:size :sm
:on-click (fn []
(notification/clear-all!))}
"clear all")]])
(rum/defc notification-content
[state content status uid]
@@ -52,7 +50,7 @@
[:div.ui__notifications-content
{:style
(when (or (= state "exiting")
(= state "exited"))
(= state "exited"))
{:z-index -1})}
[:div.max-w-sm.w-full.shadow-lg.rounded-lg.pointer-events-auto.notification-area
{:class (case state
@@ -74,36 +72,36 @@
[:div.flex-shrink-0.flex {:style {:margin-top -9
:margin-right -18}}
(shui/button
{:variant :icon
:size :sm
:on-click (fn []
(notification/clear! uid))}
[:span {:slot "icon-only"}
(shui/tabler-icon "x")])]]]]]])))
{:variant :icon
:size :sm
:on-click (fn []
(notification/clear! uid))}
[:span {:slot "icon-only"}
(shui/tabler-icon "x")])]]]]]])))
(rum/defc install-notifications < rum/reactive
[]
(let [contents (state/sub :notification/contents)]
(transition-group
{:class-name "notifications ui__notifications"}
(let [notifications
(map (fn [el]
(let [k (first el)
v (second el)]
(css-transition
{:timeout 100
:key (name k)}
(fn [state]
(notification-content state (:content v) (:status v) k)))))
contents)
clear-all (when (> (count contents) 3)
(css-transition
{:timeout 100
:k "clear-all"}
(fn [_state]
(notification-clear-all))))
items (if clear-all (cons clear-all notifications) notifications)]
(doall items)))))
{:class-name "notifications ui__notifications"}
(let [notifications
(map (fn [el]
(let [k (first el)
v (second el)]
(css-transition
{:timeout 100
:key (name k)}
(fn [state]
(notification-content state (:content v) (:status v) k)))))
contents)
clear-all (when (> (count contents) 3)
(css-transition
{:timeout 100
:k "clear-all"}
(fn [_state]
(notification-clear-all))))
items (if clear-all (cons clear-all notifications) notifications)]
(doall items)))))
(defonce *modals (atom []))
(defonce ^:private *id (atom 0))
@@ -115,45 +113,45 @@
(case type
:action-sheet
(silkhq/bottom-sheet
(merge modal-props
{:presented true
:onPresentedChange (fn [v?] (when (false? v?)
(js/setTimeout #(close!) 200)))})
(let [title (or title header content)
content (for [{:keys [role text] :as item} buttons]
[:a.as-item-btn
{:data-role role
:on-pointer-down (fn []
(some-> on-action (apply [item]))
(close!))}
text])]
(silkhq/bottom-sheet-portal
(silkhq/bottom-sheet-view {:as-child true}
(silkhq/bottom-sheet-backdrop)
(silkhq/bottom-sheet-content
[:div.flex.flex-col.items-center.gap-2.app-silk-action-sheet-modal-content
(silkhq/bottom-sheet-handle {:class "my-2"})
(some-> title (silkhq/bottom-sheet-title))
[:div.as-list-container content]])))))
(merge modal-props
{:presented true
:onPresentedChange (fn [v?] (when (false? v?)
(js/setTimeout #(close!) 200)))})
(let [title (or title header content)
content (for [{:keys [role text] :as item} buttons]
[:a.as-item-btn
{:data-role role
:on-pointer-down (fn []
(some-> on-action (apply [item]))
(close!))}
text])]
(silkhq/bottom-sheet-portal
(silkhq/bottom-sheet-view {:as-child true}
(silkhq/bottom-sheet-backdrop)
(silkhq/bottom-sheet-content
[:div.flex.flex-col.items-center.gap-2.app-silk-action-sheet-modal-content
(silkhq/bottom-sheet-handle {:class "my-2"})
(some-> title (silkhq/bottom-sheet-title))
[:div.as-list-container content]])))))
;; default
(silkhq/bottom-sheet
(merge modal-props
{:presented true
:onPresentedChange (fn [v?] (when (false? v?) (close!)))})
(silkhq/bottom-sheet-portal
(silkhq/bottom-sheet-view {:as-child true}
(silkhq/bottom-sheet-backdrop)
(silkhq/bottom-sheet-content
(if (fn? content)
(content) content))))))))
(merge modal-props
{:presented true
:onPresentedChange (fn [v?] (when (false? v?) (close!)))})
(silkhq/bottom-sheet-portal
(silkhq/bottom-sheet-view {:as-child true}
(silkhq/bottom-sheet-backdrop)
(silkhq/bottom-sheet-content
(if (fn? content)
(content) content))))))))
(defn get-modal
([] (some-> @*modals last))
([id]
(when id
(some->> (medley/indexed @*modals)
(filter #(= id (:id (second %)))) (first)))))
(filter #(= id (:id (second %)))) (first)))))
(defn- upsert-modal!
[config]
@@ -170,11 +168,11 @@
(defn open-modal!
[content & {:keys [id type] :as props}]
(upsert-modal!
(merge props
{:id (or id (gen-id))
:type (or type :default) ;; :alert :confirm :page
:as-page? (= type :page)
:content content})))
(merge props
{:id (or id (gen-id))
:type (or type :default) ;; :alert :confirm :page
:as-page? (= type :page)
:content content})))
(defn close-modal!
([] (some-> @*modals (last) :id (close-modal!)))
@@ -183,13 +181,13 @@
(defn open-popup!
[content-fn opts]
(mobile-state/set-popup!
{:open? true
:content-fn content-fn
:opts opts}))
{:open? true
:content-fn content-fn
:opts opts}))
(defn close-popup! []
(some-> mobile-state/*popup-data
(swap! assoc :open? false)))
(swap! assoc :open? false)))
(rum/defc install-modals []
(let [_ (r/use-atom *modals)]
@@ -198,4 +196,4 @@
:let [close! #(close-modal! id)
props' (assoc props :close! close!)]]
(x-modal props'
(if (fn? content) (content props') content)))]))
(if (fn? content) (content props') content)))]))