Browse Source

remove silk ui

Tienson Qin 1 week ago
parent
commit
f53b183924

+ 0 - 6
gulpfile.js

@@ -132,12 +132,6 @@ const common = {
         'packages/ui/dist/ui/ui.js',
         'node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm',
       ]).pipe(gulp.dest(path.join(outputPath, 'mobile', 'js'))),
-      () => gulp.src([
-        'packages/ui/dist/silkhq/*.css*',
-      ]).pipe(gulp.dest(path.join(outputPath, 'mobile', 'css'))),
-      () => gulp.src([
-        'packages/ui/dist/silkhq/*.js*',
-      ]).pipe(gulp.dest(path.join(outputPath, 'mobile', 'js'))),
       () => gulp.src([
         'node_modules/inter-ui/inter.css',
       ]).pipe(gulp.dest(path.join(outputPath, 'mobile', 'css'))),

+ 0 - 2
resources/mobile/index.html

@@ -3,7 +3,6 @@
 <head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=no">
-    <link href="./css/silkhq.css" rel="stylesheet" type="text/css">
     <link href="./css/style.css" rel="stylesheet" type="text/css">
     <title>Logseq: A privacy-first platform for knowledge management and collaboration</title>
 </head>
@@ -23,7 +22,6 @@
 <script defer src="./js/tabler-icons-react.min.js"></script>
 <script defer src="./js/tabler.ext.js"></script>
 <script defer src="./js/ui.js"></script>
-<script defer src="./js/silkhq.js"></script>
 <script defer src="./js/main.js"></script>
 <script defer src="./js/code-editor.js"></script>
 <script>

+ 1 - 2
src/main/frontend/handler/editor.cljs

@@ -72,7 +72,6 @@
             [logseq.outliner.property :as outliner-property]
             [logseq.shui.dialog.core :as shui-dialog]
             [logseq.shui.popup.core :as shui-popup]
-            [mobile.state :as mobile-state]
             [promesa.core :as p]
             [rum.core :as rum]))
 
@@ -4067,7 +4066,7 @@
              (move-blocks! children today-last-child {:sibling? true})
              (move-blocks! children today {:sibling? false})))
          (state/close-modal!)
-         (mobile-state/set-popup! nil)
+         (shui-popup/hide!)
          (when (seq children)
            (notification/show! "Blocks added to today!" :success)))))))
 

+ 0 - 5
src/main/mobile/components/app.cljs

@@ -23,7 +23,6 @@
             [mobile.components.selection-toolbar :as selection-toolbar]
             [mobile.components.settings :as settings]
             [mobile.components.ui :as ui-component]
-            [mobile.components.ui-silk :as ui-silk]
             [mobile.state :as mobile-state]
             [rum.core :as rum]))
 
@@ -143,10 +142,6 @@
     [:div.mt-24.h-full
      (mobile-header/header tab)
      (main-content tab)
-     ;; bottom tabs
-     (when-not (mobile-util/native-ios?)
-       (ui-silk/app-silk-tabs))
-
      (ui-component/keep-keyboard-virtual-input)
      (ui-component/install-notifications)
 

+ 5 - 268
src/main/mobile/components/app.css

@@ -5,39 +5,15 @@
 
 :root {
   --ls-page-title-size: 26px;
-  --silk-tabbar-bottom-padding: 12px;
-  --silk-100-lvh-dvh-pct: max(100%, 100vh);
   --safe-area-inset-top: 40px;
   --safe-area-inset-bottom: 16px;
 }
 
 html.is-native-ios {
-  --silk-tabbar-bottom-padding: 2px;
   --safe-area-inset-top: 58px;
   --safe-area-inset-bottom: 24px;
 }
 
-html.is-native-android {
-  --silk-topbar-inner-padding-top: 14px;
-  --silk-topbar-inner-padding-bottom: 6px;
-
-  --silk-tabbar-bottom-padding: 22px;
-
-  .app-silk-index-container {
-    padding-top: calc(var(--safe-area-inset-top) + 22px);
-  }
-
-  .app-silk-search-page {
-    > .hd {
-      padding-top: calc(var(--safe-area-inset-top) + 14px);
-    }
-  }
-
-  .SheetWithDepth-content {
-    height: calc(100% - max(calc(var(--safe-area-inset-top) + 1.3vh), 2.6vh));
-  }
-}
-
 html.has-mobile-keyboard {
   body {
     @apply overflow-hidden
@@ -47,13 +23,7 @@ html.has-mobile-keyboard {
     @apply opacity-100;
   }
 
-  .block-modal-page {
-    .app-silk-scroll-content-inner {
-      padding-bottom: calc(var(--ls-native-kb-height, 0px) + 64px);
-    }
-  }
-
-  .app-silk-popup-content-inner {
+  .app-popup {
     padding-bottom: calc(var(--ls-native-kb-height, 0px) + 24px);
   }
 }
@@ -145,89 +115,10 @@ ul {
   }
 }
 
-.block-modal-page {
-  &-header {
-    @apply pt-5 pb-1 px-4 flex justify-between bg-gray-01
-    absolute top-0 left-0 w-full z-[10] overflow-hidden;
-
-    border-radius: 26px 26px 0 0;
-  }
-
-  &-content {
-    @apply pt-14;
-
-    #app-container-wrapper {
-      @apply relative px-6;
-    }
-
-    .ls-view-body {
-      @apply max-w-[90vw];
-    }
-  }
-
-  .app-silk-depth-sheet-content {
-  }
-
-  .app-silk-scroll-content {
-    @apply min-h-screen;
-    padding-bottom: 200px;
-  }
-}
-
 .block-content-or-editor-inner {
   @apply min-h-[25px];
 }
 
-.app-silk-popup-sheet-view {
-  .ls-property-dialog {
-    .ls-property-input, .property-key {
-      @apply w-full;
-    }
-  }
-
-  .property-select, .ls-property-key {
-    @apply w-full;
-
-    .cp__select-main {
-      @apply w-full;
-    }
-  }
-
-  .cp__emoji-icon-picker {
-    @apply w-full;
-  }
-
-  &.as-action-sheet {
-    .app-silk-popup-content-inner {
-      > h2 {
-        @apply text-center pb-3 text-sm;
-      }
-    }
-
-    .menu-link {
-      @apply border-b -mx-2 py-3;
-
-      span {
-        @apply inline-block w-full text-center;
-      }
-
-      .ui__icon {
-        @apply hidden;
-      }
-
-      &:first-child {
-        @apply border-t;
-      }
-
-      &:last-child {
-        @apply -mb-4;
-
-        padding-bottom: calc(env(safe-area-inset-bottom) + 6px);
-      }
-    }
-  }
-}
-
 .blocks-container {
   .block-main-container {
     &[data-has-heading] {
@@ -310,162 +201,8 @@ ul {
   }
 }
 
-
-.app-silk-popup-content-inner {
-  &:has(.ls-quick-add) {
-    @apply min-h-[80vh] max-h-[90vh] overflow-y-auto overflow-x-hidden;
-  }
-
-  .ls-debug-log {
-    @apply h-[80vh] overflow-y-auto overflow-x-hidden pb-8;
-  }
-}
-
-/* silk styles */
-.app-silk-index-scroll-view {
-  /* NOTE: fix for the depth sheet view style? */
-  padding-top: 2px;
-}
-
-.app-silk-index-scroll-content {
-  @apply bg-gray-01 min-h-[100svh] overflow-hidden;
-}
-
-.app-silk-depth-sheet-content {
-  display: grid;
-}
-
-.BottomSheet-bleedingBackground,
-.SheetWithDepth-bleedingBackground {
-  @apply bg-gray-01;
-}
-
-.app-silk-scroll-view {
-  grid-area: 1 / 1;
-  min-height: 0;
-  width: 100%;
-  overflow: clip;
-  border-radius: 24px 24px 0 0;
-  position: relative;
-}
-
-.app-silk-scroll-content {
-  overflow: hidden;
-  overflow: clip;
-  position: relative;
-}
-
-html[data-silk-native-page-scroll-replaced=false] .app-silk-index-scroll-view {
-  & > div:first-child {
-    height: var(--ls-full-screen-height, "auto") !important;
-    overflow-y: auto !important;
-  }
-}
-
-.app-silk-index-container {
-  @apply p-4 flex flex-col gap-3 bg-gray-01;
-
-  padding-top: env(safe-area-inset-top);
-  padding-bottom: 120px;
-
-  #journals {
-    @apply -mt-4 px-1;
-  }
-}
-
-.app-silk-tabs {
-  @apply fixed flex border-t overflow-hidden select-none
-  bg-gray-02 left-0 -bottom-0 w-full z-[1] dark:bg-gray-01;
-
-  padding-top: 4px;
-  padding-bottom: calc(env(safe-area-inset-bottom) + var(--silk-tabbar-bottom-padding));
-
-  > .as-item {
-    @apply flex flex-1 flex-col items-center pb-1 transition-opacity opacity-60;
-
-    > small {
-      @apply text-[9px] -mt-2;
-    }
-  }
-
-  .as-item.active {
-    @apply opacity-90 text-accent-10;
-    small {
-      @apply font-semibold;
-    }
-  }
-}
-
-.app-silk-search-page {
-  > .hd {
-    @apply fixed top-0 left-0 px-4 py-2.5 w-full bg-gray-01;
-
-    padding-top: calc(env(safe-area-inset-top, 0px) + 4px);
-    z-index: 1;
-    transition: padding 0.1s ease-in-out;
-
-    .ls-icon-search {
-      @apply absolute left-2.5 top-[11px] opacity-60;
-    }
-
-    .cancel {
-      @apply absolute right-0.5 opacity-0 text-base;
-
-      bottom: 11px;
-    }
-
-    &.input-focused {
-      padding-right: 80px;
-
-      .cancel {
-        opacity: .6;
-        display: block;
-      }
-
-      .ls-icon-search {
-        @apply opacity-90;
-      }
-
-      > .x {
-        right: 88px;
-      }
-    }
-
-    .ui__input {
-      @apply border-none dark:bg-gray-02 bg-gray-04 pl-9 outline-none ring-0 text-base rounded-full;
-
-      height: 40px;
-      outline-offset: 0;
-      box-shadow: none;
-    }
-
-    > .x {
-      @apply absolute right-6 w-[16px] h-[16px] bg-gray-10 overflow-hidden
-      rounded-full flex items-center justify-center text-gray-02 opacity-50;
-
-      bottom: 22px;
-    }
-  }
-
-  > .bd {
-    @apply -mx-4 mt-8;
-  }
-}
-
-.app-silk-action-sheet-modal {
-  &-content {
-    > h2 {
-      @apply leading-tight opacity-40 w-full py-2 px-4;
-    }
-
-    > .as-list-container {
-      @apply w-full max-h-[420px] overflow-auto px-4 pb-3;
-
-      a.as-item-btn {
-        @apply select-none py-2 flex justify-start w-full text-lg;
-      }
-    }
-  }
+.app-popup {
+  @apply w-full overflow-y-auto overflow-x-hidden;
 }
 
 .app-audio-recorder {
@@ -565,8 +302,8 @@ body, #root {
     padding-bottom: 48px;
 }
 
-.cp__select-main {
-    width: 100%;
+.cp__select-main, .cp__emoji-icon-picker, .ls-property-key {
+  @apply w-full;
 }
 
 .cp__select {

+ 1 - 4
src/main/mobile/components/header.cljs

@@ -108,10 +108,7 @@
                      (shui/tabler-icon "bug" {:class "opacity-70" :size 22})
                      "Report bug"])
       (ui/menu-link {:on-click (fn []
-                                 (mobile-state/set-popup! nil)
-                                 (mobile-state/set-popup!
-                                  {:open? true
-                                   :content-fn (fn [] (log))}))}
+                                 (shui/popup-show! nil (fn [] (log)) {}))}
                     [:span.text-lg.flex.gap-2.items-center
                      "Check log"])])
    {:title "Actions"

+ 2 - 1
src/main/mobile/components/popup.cljs

@@ -31,6 +31,7 @@
 (defn- dismiss-native-sheet!
   []
   (when-let [plugin mobile-util/native-bottom-sheet]
+    (mobile-state/set-popup! nil)
     (.dismiss plugin #js {})))
 
 (defn- handle-native-sheet-state!
@@ -117,6 +118,6 @@
                         [:span.text-lg.flex.items-center text]))]
                     (when-not (string? content-fn) content-fn)))]
     [:div {:class "flex flex-col items-center p-2 w-full h-full"}
-     [:div.app-silk-popup-content-inner.w-full.h-full
+     [:div.app-popup
       (when title [:h2.py-2.opacity-40 title])
       content]]))

+ 5 - 5
src/main/mobile/components/recorder.cljs

@@ -116,7 +116,7 @@
            (.on "record-end" (fn [^js blob]
                                (when @*save?
                                  (save-asset-audio! blob @*transcribe?))
-                               (mobile-state/close-popup!)))
+                               (shui/popup-hide!)))
            (.on "record-progress" (gfun/throttle
                                    (fn [time]
                                      (when @*recorder
@@ -172,10 +172,10 @@
 
 (defn- show-recorder
   []
-  (mobile-state/set-popup! {:open? true
-                            :content-fn (fn [] (audio-recorder-aux))
-                            :opts {:id :ls-audio-record
-                                   :default-height 300}}))
+  (shui/popup-show! nil
+                    (fn [] (audio-recorder-aux))
+                    {:id :ls-audio-record
+                     :default-height 300}))
 
 (defn record!
   [& {:keys [save-to-today?]}]

+ 0 - 56
src/main/mobile/components/ui_silk.cljs

@@ -1,56 +0,0 @@
-(ns mobile.components.ui-silk
-  "Mobile top header and bottom tabs"
-  (:require [frontend.handler.editor :as editor-handler]
-            [frontend.state :as state]
-            [frontend.util :as util]
-            [logseq.shui.hooks :as hooks]
-            [logseq.shui.ui :as shui]
-            [mobile.state :as mobile-state]
-            [rum.core :as rum]))
-
-(rum/defc app-silk-tabs []
-  (let [[current-tab set-tab!] (mobile-state/use-tab)]
-    [:div.app-silk-tabs
-     {:on-pointer-down (fn [^js e]
-                         (some-> (.-target e)
-                                 ^js (.closest ".as-item")
-                                 ^js (.-dataset)
-                                 ^js (.-tab) (set-tab!)))}
-     [:span.as-item
-      {:class (when (= current-tab "home") "active")
-       :data-tab "home"}
-      (shui/button {:variant :icon
-                    :on-pointer-down (fn [] (util/scroll-to-top false))}
-                   (shui/tabler-icon "home" {:size 24}))
-      [:small "Journals"]]
-     [:span.as-item
-      {:class (when (= current-tab "favorites") "active")
-       :data-tab "favorites"}
-      (shui/button {:variant :icon}
-                   (shui/tabler-icon "star" {:size 24}))
-      [:small "Favorites"]]
-     [:span.as-item
-      {:class (when (= current-tab "search") "active")
-       :data-tab "search"}
-      (shui/button {:variant :icon}
-                   (shui/tabler-icon "search" {:size 24}))
-      [:small "Search"]]
-     [:span.as-item
-      (shui/button
-       (merge
-        {:variant :icon}
-        (hooks/use-long-press
-         {:on-click (fn [^js e]
-                      (util/stop e)
-                      (editor-handler/show-quick-add))
-          :on-long-press (fn [_e]
-                           (state/pub-event! [:mobile/start-audio-record]))
-          :delay 500}))
-       (shui/tabler-icon "plus" {:size 24}))
-      [:small "Quick add"]]
-     [:span.as-item
-      {:class (when (= current-tab "settings") "active")
-       :data-tab "settings"}
-      (shui/button {:variant :icon}
-                   (shui/tabler-icon "settings" {:size 24}))
-      [:small "Settings"]]]))

+ 4 - 8
src/main/mobile/core.cljs

@@ -66,19 +66,15 @@
                                                         :skip-refresh? true})]
                      (when entity
                        (when (state/get-edit-block)
-                         (state/clear-edit!))
-                       (when (mobile-state/quick-add-open?)
-                         (mobile-state/close-popup!))))))))
+                         (state/clear-edit!))))))))
 
            :graphs
            (mobile-state/redirect-to-tab! "settings")
 
            :import
-           (p/do!
-            (p/delay 300)
-            (shui/popup-show! nil (fn []
-                                    (imports/importer {}))
-                              {:id :import}))
+           (shui/popup-show! nil (fn []
+                                   (imports/importer {}))
+                             {:id :import})
 
            nil)))
 

+ 5 - 5
src/main/mobile/events.cljs

@@ -3,9 +3,9 @@
   (:require [frontend.components.quick-add :as quick-add]
             [frontend.handler.events :as events]
             [frontend.state :as state]
+            [logseq.shui.ui :as shui]
             [mobile.components.recorder :as recorder]
             [mobile.init :as init]
-            [mobile.state :as mobile-state]
             [reitit.frontend.easy :as rfe]))
 
 (defmethod events/handle :mobile/clear-edit [_]
@@ -13,10 +13,10 @@
   (init/keyboard-hide))
 
 (defmethod events/handle :dialog/mobile-quick-add [_]
-  (mobile-state/set-popup! {:open? true
-                            :content-fn (fn []
-                                          (quick-add/quick-add))
-                            :opts {:id :ls-quick-add}}))
+  (shui/popup-show! nil
+                    (fn []
+                      (quick-add/quick-add))
+                    {:id :ls-quick-add}))
 
 (defmethod events/handle :mobile/start-audio-record [_]
   (recorder/record! {:save-to-today? true}))

+ 0 - 3
src/main/mobile/init.cljs

@@ -45,9 +45,6 @@
                            (shui-dialog/has-modal?)
                            (shui-dialog/close!)
 
-                           (not-empty @mobile-state/*popup-data)
-                           (mobile-state/set-popup! nil)
-
                            (not-empty (state/get-selection-blocks))
                            (editor-handler/clear-selection!)
 

+ 0 - 4
src/main/mobile/state.cljs

@@ -20,10 +20,6 @@
   (when data
     (state/pub-event! [:mobile/clear-edit])))
 
-(defn close-popup!
-  []
-  (set-popup! nil))
-
 (defn quick-add-open?
   []
   (= :ls-quick-add (get-in @*popup-data [:opts :id])))